blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
6d73e7034af28550015e1f42f12131effb447add
036220d0bb780bcb077b5d8d111c1e0a928a13c0
/02-handleInputs/gameEngine/src/main/Main.java
ce7f4d8ce2fede204d2e40358f9fef7a41d09310
[]
no_license
ovvesley/lwjgl-learn
b6f96fdd9e3eb9662f9770ab0223c6d5c932b0b6
bea0f6da6003d8435cbc52a7085a60f16b5e295c
refs/heads/master
2022-07-01T06:32:21.114926
2020-05-12T23:44:04
2020-05-12T23:44:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,017
java
package main; import engine.io.Window; import org.lwjgl.glfw.GLFW; public class Main { public static void main(String[] args) { Window window = new Window(800, 600, "First Display"); window.create(); // MY GAME LOOP while(!window.closed()){ window.update(); if(window.isKeyPressed(GLFW.GLFW_KEY_SPACE)){ System.out.println("space key pressed"); } if(window.isKeyReleased(GLFW.GLFW_KEY_SPACE)){ System.out.println("space key released"); } if(window.isMousePressed(GLFW.GLFW_MOUSE_BUTTON_LEFT)){ String msg = "mouse button left pressed. Xpos: %f; yPos: %f %n"; System.out.format(msg, window.getMouseX(), window.getMouseY()); } if(window.isMouseReleased(GLFW.GLFW_MOUSE_BUTTON_LEFT)){ System.out.println("mouse button left released"); } window.swapBuffers(); } } }
[ "wsf.ley@gmail.com" ]
wsf.ley@gmail.com
bd17c516a09e4b02b1e86773a9d6c1816136f013
29ea3a1ded09a11de2b9afacbad39796f665613e
/src/listener/src/com/helloweenvsfei/listener/ListenerTest.java
2370c5a83c21fbae9b94b732991a269718e875e8
[]
no_license
seuqer/webStudy
af51262edabaed4ee652c718d5b675b30c3236c6
bb19f582b5ea18ddc0a239b2b451693e8a3dadc1
refs/heads/master
2021-07-21T11:55:03.940999
2017-10-29T12:53:10
2017-10-29T12:53:10
108,733,115
0
0
null
null
null
null
GB18030
Java
false
false
2,207
java
package com.helloweenvsfei.listener; import javax.servlet.ServletContext; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import javax.servlet.ServletRequestEvent; import javax.servlet.ServletRequestListener; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class ListenerTest implements HttpSessionListener, ServletContextListener, ServletRequestListener { Log log = LogFactory.getLog(getClass()); // 创建 session public void sessionCreated(HttpSessionEvent se) { HttpSession session = se.getSession(); log.info("新创建一个session, ID为: " + session.getId()); } // 销毁 session public void sessionDestroyed(HttpSessionEvent se) { HttpSession session = se.getSession(); log.info("销毁一个session, ID为: " + session.getId()); } // 加载 context public void contextInitialized(ServletContextEvent sce) { ServletContext servletContext = sce.getServletContext(); log.info("即将启动" + servletContext.getContextPath()); } // 卸载 context public void contextDestroyed(ServletContextEvent sce) { ServletContext servletContext = sce.getServletContext(); log.info("即将关闭" + servletContext.getContextPath()); } // 创建 request public void requestInitialized(ServletRequestEvent sre) { HttpServletRequest request = (HttpServletRequest) sre .getServletRequest(); String uri = request.getRequestURI(); uri = request.getQueryString() == null ? uri : (uri + "?" + request .getQueryString()); request.setAttribute("dateCreated", System.currentTimeMillis()); log.info("IP " + request.getRemoteAddr() + " 请求 " + uri); } // 销毁 request public void requestDestroyed(ServletRequestEvent sre) { HttpServletRequest request = (HttpServletRequest) sre .getServletRequest(); long time = System.currentTimeMillis() - (Long) request.getAttribute("dateCreated"); log.info(request.getRemoteAddr() + "请求处理结束, 用时" + time + "毫秒. "); } }
[ "seuqer@163.com" ]
seuqer@163.com
52a85ccf8ece55601048409d1de251e17044d67f
9e8187c35ef08c67186679f6d472603a8f7b2d6d
/lab4/mujavaHome/result/BackPack/traditional_mutants/int_BackPack_Solution(int,int,int,int)/SDL_9/BackPack.java
d3511d153d5a080b152af2072a502ba97d5d5328
[]
no_license
cxdzb/software-testing-technology
8b79f99ec859a896042cdf5bccdadfd11f65b64c
5fb1305dd2dd028c035667c71e0abf57a489360b
refs/heads/master
2021-01-09T15:24:42.561680
2020-04-16T06:18:58
2020-04-16T06:18:58
242,354,593
0
0
null
null
null
null
UTF-8
Java
false
false
847
java
// This is a mutant program. // Author : ysma public class BackPack { public int[][] BackPack_Solution( int m, int n, int[] w, int[] p ) { int[][] c = new int[n + 1][m + 1]; for (int i = 0; i < n + 1; i++) { c[i][0] = 0; } for (int j = 0; j < m + 1;) { c[0][j] = 0; } for (int i = 1; i < n + 1; i++) { for (int j = 1; j < m + 1; j++) { if (w[i - 1] <= j) { if (c[i - 1][j] < c[i - 1][j - w[i - 1]] + p[i - 1]) { c[i][j] = c[i - 1][j - w[i - 1]] + p[i - 1]; } else { c[i][j] = c[i - 1][j]; } } else { c[i][j] = c[i - 1][j]; } } } return c; } }
[ "1005968086@qq.com" ]
1005968086@qq.com
ef1752dbc17aac088e5450ab489482a642de5713
cbb027a5bf11a32665ece3b4fd4e7e5cea436fd6
/src/main/java/cn/lkxed/dao/IAuthorDAO.java
0a70fd122abac2c10ce1f861c5b8bf26f0a5b62f
[]
no_license
lkxed/gushiwen
4c92bca513cd6b3c789cf08c8916a043c6f5e046
52f39631e2e1e2fd4c174639d085c0e19b486b3a
refs/heads/master
2022-02-11T18:05:38.646460
2022-01-29T06:42:46
2022-01-29T06:42:46
164,292,267
3
1
null
2022-02-09T23:25:15
2019-01-06T09:18:31
Java
UTF-8
Java
false
false
316
java
package cn.lkxed.dao; import cn.lkxed.po.Author; import java.util.List; public interface IAuthorDAO { public List findAll(); public List findPage(int pageNum, int pageSize); public List findByExample(Author example); public List findDynastyAuthorPage(Author example, int pageNum, int pageSize); }
[ "lkxed@outlook.com" ]
lkxed@outlook.com
37e36edd4cdd8626d8f0df52aee2d7ed83430bf4
6b8254d00699126425f128361ebb515d3c17b68d
/leyou/ly-common/src/main/java/com/leyou/common/contants/MQConstants.java
b2bb96f94a7a3eae75b886cc31fdaff9767c0e9d
[]
no_license
Dengjx-du/CODE
d84403ed976c8db93e51ade4e30878422409eeef
efb68956ed78a07621003b2a7af07428667e539e
refs/heads/master
2022-11-26T14:37:04.908227
2019-12-22T13:13:36
2019-12-22T13:13:36
229,566,840
0
0
null
2022-11-16T12:15:06
2019-12-22T12:48:11
Java
UTF-8
Java
false
false
1,589
java
package com.leyou.common.contants; public abstract class MQConstants { public static final class Exchange { /** * 商品服务交换机名称 */ public static final String ITEM_EXCHANGE_NAME = "ly.item.exchange"; /** * 短信服务 */ public static final String SMS_EXCHANGE_NAME = "ly.sms.exchange"; } public static final class RoutingKey { /** * 商品上架的routing-key */ public static final String ITEM_UP_KEY = "item.up"; /** * 商品下架的routing-key */ public static final String ITEM_DOWN_KEY = "item.down"; /** * 发送短信验证码 */ public static final String VERIFY_CODE_KEY = "sms.verify.code"; } public static final class Queue{ /** * 搜索服务,商品上架的队列 */ public static final String SEARCH_ITEM_UP = "search.item.up.queue"; /** * 搜索服务,商品下架的队列 */ public static final String SEARCH_ITEM_DOWN = "search.item.down.queue"; /** * 搜索服务,商品上架的队列 */ public static final String PAGE_ITEM_UP = "page.item.up.queue"; /** * 搜索服务,商品下架的队列 */ public static final String PAGE_ITEM_DOWN = "page.item.down.queue"; /** * 发送短信验证码 */ public static final String SMS_VERIFY_CODE_QUEUE = "sms.verify.code.queue"; } }
[ "deng709179089@163.com" ]
deng709179089@163.com
bc149e4380362f6a917f78c5446d99a4e110aa2c
4ce0078b0375b9e2e594d82cb55d2f35efd2597d
/sdlv/src/main/java/com/yydcdut/sdlv/Callback.java
852d7403923fd1b3f4305d661e5a747325c9f443
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
wilco375/SlideAndDragListView
4da4f3674452bab74d1176dd202c44bf17840f82
2a5d4e8c06b41b91c6da6465f7c35fe09061fa34
refs/heads/master
2020-03-24T10:30:27.291326
2018-07-28T10:06:42
2018-07-28T10:06:42
142,658,267
0
0
Apache-2.0
2018-07-28T07:51:24
2018-07-28T07:51:24
null
UTF-8
Java
false
false
1,517
java
/* * Copyright (C) 2015 yydcdut (yuyidong2015@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.yydcdut.sdlv; import android.view.View; import android.widget.AbsListView; /** * Created by yuyidong on 2017/5/16. */ interface Callback { interface OnDragDropListener { boolean onDragStarted(int x, int y, View view); void onDragMoving(int x, int y, View view, SlideAndDragListView.OnDragDropListener listener); void onDragFinished(int x, int y, SlideAndDragListView.OnDragDropListener listener); } interface OnScrollListenerWrapper { void onScrollStateChanged(AbsListView view, int scrollState); void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount); } interface OnItemLongClickListenerWrapper { void onListItemLongClick(View view, int position); } interface OnItemClickListenerWrapper { void onListItemClick(View v, int position); } }
[ "378040621@qq.com" ]
378040621@qq.com
d8ad08d8e387ffedcc3e49d828b53660bb16da7a
5450714f807e918bce2da2c4bbcde42b2c877cef
/ReadyNasDownloader/src/com/thekyz/utils/HtmlHelper.java
4ee2acb6b551dc76bfb27ce98e02777cf7776a0a
[]
no_license
49magge/kyznas
77961b0f30899f3c4b04db5042c244ed7e1335cb
5d821ed3e1ce3bc1076a8102e1ed0b600f0515ea
refs/heads/master
2016-09-01T15:59:13.401984
2010-11-25T12:12:32
2010-11-25T12:12:32
51,951,035
0
0
null
null
null
null
UTF-8
Java
false
false
3,358
java
package com.thekyz.utils; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.params.HttpParams; import org.apache.http.util.EntityUtils; import java.io.*; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.sql.Date; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; /** * User: Kyz * Date: 30 oct. 2010 * Time: 17:38:38 */ public final class HtmlHelper { private static HttpClient client = new DefaultHttpClient(); public static String post(String url, List<NameValuePair> pairs) { String responsePage = ""; // Create the post header HttpPost post = new HttpPost(url); try { // Set the data post.setEntity(new UrlEncodedFormEntity(pairs)); // Execute POST request HttpResponse response = client.execute(post); responsePage = EntityUtils.toString(response.getEntity()); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return responsePage; } public static String get(String url) { String responsePage = ""; // Create the get header HttpGet get = new HttpGet(url); try { // Send the request HttpResponse response = client.execute(get); responsePage = EntityUtils.toString(response.getEntity()); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return responsePage; } public static void download(String remoteFile, String localFolder) throws IOException { URL url = new URL(remoteFile); // Open the connection System.out.println("Opening connection to " + remoteFile + "..."); URLConnection urlC = url.openConnection(); // Copy resource to local file InputStream is = url.openStream(); // Print info about resource System.out.println("Copying resource (type: " + urlC.getContentType() + ")"); // Get remote filename String localFile = null; StringTokenizer st = new StringTokenizer(url.getFile(), "/"); while (st.hasMoreTokens()) { localFile = st.nextToken(); } localFile = localFolder + File.separator + localFile; FileOutputStream fos = new FileOutputStream(new File(localFile)); int oneChar, count=0; while ((oneChar = is.read()) != -1) { fos.write(oneChar); count++; } // Close the streams is.close(); fos.close(); System.out.println(count + " byte(s) copied"); } }
[ "thekyz@3d89156a-540f-e071-52c1-05105f659ac9" ]
thekyz@3d89156a-540f-e071-52c1-05105f659ac9
15f6dffa5a4ee9c879a069d855a4b210162e6781
76554a5cc7a3e26df4ae8eb3a48e8e71624b6561
/src/test/java/SeleniumTest.java
ab79422feb3a0ea02bfd88b1c9226b287b8ec2af
[]
no_license
dariussirvidas/Selenium
50431fe89902a03082b7c0bea9c88512b140db50
d221fdffc8ce5585e67f53410cc07fb5dd65fdab
refs/heads/master
2020-12-04T15:37:00.732611
2020-01-05T22:38:34
2020-01-05T22:38:34
231,819,706
0
0
null
null
null
null
UTF-8
Java
false
false
953
java
import org.junit.*; import org.junit.runners.MethodSorters; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class SeleniumTest { @Before public void testSetup() { Selenium.setup(); } @Test public void testLoginToSherdog1() { Selenium.loginToSherdog("civerx@gmail.com", "individual11"); Assert.assertEquals("https://forums.sherdog.com/", Selenium.browser.getCurrentUrl()); WebElement visitorTabs = Selenium.browser.findElement(By.cssSelector("ul.visitorTabs")); Assert.assertTrue(visitorTabs.isDisplayed()); } @Test public void testLoginToSherdog2() { Selenium.loginToSherdog("civerxgmail.com", "individual11"); Assert.assertEquals("https://forums.sherdog.com/login/login", Selenium.browser.getCurrentUrl()); } @After public void testClose() { Selenium.close(); } }
[ "dsirvidas@yahoo.com" ]
dsirvidas@yahoo.com
4c70fed4654fe71bea66b84f333df7ff3ec1317a
d154e693676ef1971bde5d67b5f91671987c359a
/zhbj/src/main/java/com/wangshun/zhbj/base/impl/SettingPager.java
f62335c873309cd047fb7174ed45ac36f257d02b
[]
no_license
WS1009/ZHBJ
667089f7cb5d03ca201f99265a88f395331d599a
f1defa4c01eb3673af963276174045bc965833a5
refs/heads/master
2021-05-02T13:23:35.656597
2018-02-08T13:23:38
2018-02-08T13:23:38
120,759,111
0
0
null
null
null
null
UTF-8
Java
false
false
768
java
package com.wangshun.zhbj.base.impl; import android.app.Activity; import android.graphics.Color; import android.util.Log; import android.view.Gravity; import android.view.View; import android.widget.TextView; import com.wangshun.zhbj.base.BasePager; /** * 设置 * @author Kevin * */ public class SettingPager extends BasePager { public SettingPager(Activity activity) { super(activity); } @Override public void initData() { Log.d(TAG, "设置加载数据了"); tvTitle.setText("设置"); btnMenu.setVisibility(View.GONE); TextView tvContent = new TextView(mActivity); tvContent.setText("设置"); tvContent.setTextColor(Color.RED); tvContent.setTextSize(25); tvContent.setGravity(Gravity.CENTER); flContent.addView(tvContent); } }
[ "WANGSHUN611@163.com" ]
WANGSHUN611@163.com
fdc7d5826d063001400d9ee5446641594c12367e
2acdd661211c2ddeb3a51d2ffce8af1d4a39ad26
/b1ing-service/src/main/java/com/game/b1ingservice/payload/webuser/WebUserDepositList.java
16896be5cddba1904597cc2867106babefe5bab9
[]
no_license
chaosnook/b1-backend
907c8a3d04278ef00770b7d151f65265cce5c78f
7a84b702ae3842c0e37d930e3d49232584357fdc
refs/heads/main
2023-07-24T17:46:53.033937
2021-04-30T08:18:44
2021-04-30T08:18:44
328,308,616
0
0
null
null
null
null
UTF-8
Java
false
false
659
java
package com.game.b1ingservice.payload.webuser; import lombok.Data; import java.time.Instant; @Data public class WebUserDepositList { private Long id; private String username; private String password; private String tel; private String bankName; private String accountNumber; private String firstName; private String lastName; private String fullName; private String line; private String recommend; private String isBonus; private int version; private Instant createdDate; private Instant updatedDate; private String createdBy; private String updatedBy; private Integer deleteFlag; }
[ "ingenium_@hotmail.com" ]
ingenium_@hotmail.com
e403bbe2a8cec9920c73d24f95cf489c4e4aae67
8b7e75ba8c4b8e2f6e82d40e2eb6432ddfa36ac0
/myVelib/core/user/PaymentStd.java
72a0e057f113878b9c6d82d3ab96614524023943
[]
no_license
diogobodas/myVelib
a7d833ab5d5501f88130cfb3839bdfdb3c75ea98
8bb76480277b33901e83ec4ab133351cc771f074
refs/heads/master
2022-09-18T09:13:40.724296
2020-06-05T17:31:47
2020-06-05T17:31:47
261,799,710
0
0
null
null
null
null
UTF-8
Java
false
false
1,318
java
package user; import java.time.Duration; import java.time.LocalDateTime; /** * Extension of abstract class {@link user.Payment} that represents standard payment regime. * That means the hourly cost provided (1.0 for the regular bike, 2.0 for the electric bike) is divided by 60 and multiplied by the rental duration in minutes. */ public class PaymentStd extends Payment{ private double hour_cost; /** * Initializes a standard payment regime * @param start Start LocalDateTime of rental * @param cost Hourly cost for the bike. One for regular bikes, two for electric, easily extendible for new bikes that are more expensive per hour */ public PaymentStd(LocalDateTime start, double cost) { super(start); this.hour_cost = cost; } /** * Gets the price of rental. See the abstract class documentation for further info. */ @Override public double getValue(LocalDateTime end_time) { // this method will calculate the price in minutes of used bike // ex: 10h to 14h30 -> 270 min -> cost = 270 * (hour_cost/60) long num_minutes = Duration.between(this.getStartTime(), end_time).toMinutes(); return (hour_cost/60.0) * (double) num_minutes; } public double getHourCost() { return hour_cost; } public void setHourCost(double hour_cost) { this.hour_cost = hour_cost; } }
[ "bvm@poli.ufrj.br" ]
bvm@poli.ufrj.br
c74987e857ed8e3220a51dca11b234874f940d42
00fd618257b40c86e9e62fda1a68fc9a4b4efdd7
/JavaWeb 系列/weixin/src/main/java/com/petrochina/weixin/Dao/testDao.java
b2ec4127a06b7375a751085ad4a41200a139d471
[]
no_license
fly-bear/mygit
5aa95398d24e270ed2872846ab8c887ee8a5ea30
c8aa901f8fbe3efbd094db2cab22d630d6bb47ce
refs/heads/master
2023-03-29T08:48:24.454980
2022-12-09T03:36:03
2022-12-09T03:36:03
107,864,668
35
8
null
2023-03-23T20:38:27
2017-10-22T12:40:29
HTML
UTF-8
Java
false
false
241
java
package com.petrochina.weixin.Dao; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Select; import java.util.Map; @Mapper public interface testDao { @Select("select * from test1") Map getdata(); }
[ "zhengxiong.dai@renren-inc.com" ]
zhengxiong.dai@renren-inc.com
09e285425149f96007a58a7fd34f9706a6fc5d93
dada3e0360eef047912ee1d770da4c8d41bce003
/src/main/java/com/example/restaurantapplication/security/WebConfig.java
bc80fa79ef207cba5b25c2e8b32ef61da11a30e3
[]
no_license
andriigorshunov/restaurant
01c3259916d5136ecfdc75619cbf7baf2885c8df
1a87c641e39d6a30c260e75865e5b4931e7984f9
refs/heads/master
2022-09-16T06:17:50.167728
2019-12-09T20:58:56
2019-12-09T20:58:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
630
java
package com.example.restaurantapplication.security; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration public class WebConfig implements WebMvcConfigurer { // @Override // public void addViewControllers(ViewControllerRegistry registry) { //// registry.addViewController("/").setViewName(""); // registry.addViewController("/orders_list").setViewName("orders_list"); // registry.addViewController("/login"); // } }
[ "andrii.gorshunov@gmail.com" ]
andrii.gorshunov@gmail.com
3c81430b671d2667d3e8905011df292e614bdfa0
361a29244b9e78b1d319e614afbcbdfe3c9f3a6c
/src/main/java/com/dhc/fastersoft/entity/system/SysOAInfo.java
2159ed47cea88853e07550c0700342c01dac47cc
[]
no_license
nangongpushe/zclproc
452013afba9ad17791864a35b7c072c028a4d50b
1da3392598238185ffba12c6721daa9356476755
refs/heads/master
2022-12-22T21:05:33.216867
2019-11-22T16:14:04
2019-11-22T16:14:04
223,437,339
0
0
null
2022-12-16T05:01:46
2019-11-22T15:56:53
Java
UTF-8
Java
false
false
970
java
package com.dhc.fastersoft.entity.system; import java.util.Date; public class SysOAInfo { private String name; private String position; private String operation; private String advice; private String time; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPosition() { return position; } public void setPosition(String position) { this.position = position; } public String getOperation() { return operation; } public void setOperation(String operation) { this.operation = operation; } public String getAdvice() { return advice; } public void setAdvice(String advice) { this.advice = advice; } public String getTime() { return time; } public void setTime(String time) { this.time = time; } @Override public String toString() { // TODO Auto-generated method stub return this.name+","+this.position+","+this.operation+","+this.advice+","+this.time; } }
[ "xintuhlly@126.com" ]
xintuhlly@126.com
b729bcd571761debf840f3a524e875bb6fcde58d
d9456254ace524157a48bea17f1193b037197d74
/src/main/java/models/interfaces/SkiPassConfiguration.java
5c7ca660279770b0200d4ffaad9107a58e408f32
[]
no_license
asterium/SkiPass
55136fc56307c40590751341557eed3a6a45ed33
94740b83bebd6f97396df14a37816dffd529ee10
refs/heads/master
2020-07-07T05:57:20.449583
2016-09-07T03:59:51
2016-09-07T03:59:51
67,445,226
0
0
null
null
null
null
UTF-8
Java
false
false
196
java
package models.interfaces; import models.skipasses.SkiPassType; /** * Created by Asterium on 07.09.2016. */ public interface SkiPassConfiguration { public SkiPassType getValidityType(); }
[ "dmytro_zaitsev@epam.com" ]
dmytro_zaitsev@epam.com
2cb7cc78a92c7f8886974076cb9241a370f3768d
a35fa143778e8c3835cdbe1f7e2600584296294f
/src/main/java/io/iansoft/blockchain/service/AuditEventService.java
105f5c21535d06fc902a9f863f4c513bd8109179
[ "MIT" ]
permissive
casebell/all-blockchain
f4fd33d7d5506e3c6be80ec6f159cf2a5d0b784f
4f6154d1ce80ae5d2f30697b87d9ac310cdf4597
refs/heads/master
2021-04-26T23:01:39.121291
2018-02-06T05:04:18
2018-02-06T05:04:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,791
java
package io.iansoft.blockchain.service; import io.iansoft.blockchain.config.audit.AuditEventConverter; import io.iansoft.blockchain.repository.PersistenceAuditEventRepository; import org.springframework.boot.actuate.audit.AuditEvent; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.time.Instant; import java.util.Optional; /** * Service for managing audit events. * <p> * This is the default implementation to support SpringBoot Actuator AuditEventRepository */ @Service @Transactional public class AuditEventService { private final PersistenceAuditEventRepository persistenceAuditEventRepository; private final AuditEventConverter auditEventConverter; public AuditEventService( PersistenceAuditEventRepository persistenceAuditEventRepository, AuditEventConverter auditEventConverter) { this.persistenceAuditEventRepository = persistenceAuditEventRepository; this.auditEventConverter = auditEventConverter; } public Page<AuditEvent> findAll(Pageable pageable) { return persistenceAuditEventRepository.findAll(pageable) .map(auditEventConverter::convertToAuditEvent); } public Page<AuditEvent> findByDates(Instant fromDate, Instant toDate, Pageable pageable) { return persistenceAuditEventRepository.findAllByAuditEventDateBetween(fromDate, toDate, pageable) .map(auditEventConverter::convertToAuditEvent); } public Optional<AuditEvent> find(Long id) { return Optional.ofNullable(persistenceAuditEventRepository.findOne(id)).map (auditEventConverter::convertToAuditEvent); } }
[ "guitaryc33@gmail.com" ]
guitaryc33@gmail.com
f0b03f09141ca797457b8ea2cd8d624f86d3e87d
5538ecd8d2ec5850dcc3aea4a71eac5ea21f0444
/src/BCI/TCPClient.java
939e2dd1a26e92d99227b0894c12ead38de0a7be
[]
no_license
macc-n/BCI-Tello-Java-Client
43c76e5bd161d64da8553e7deedb9888468e0ebb
dd524d42cdac94a336b62e0975e30963f3f7e2ed
refs/heads/master
2020-08-06T12:47:45.279624
2019-10-05T10:23:02
2019-10-05T10:23:02
212,980,679
0
0
null
null
null
null
UTF-8
Java
false
false
1,276
java
package BCI; import java.io.DataOutputStream; import java.io.IOException; import java.net.Socket; public class TCPClient { private Socket clientSocket; private String address; private int port; private boolean socketIsClosed = false; private static final char stopChar = ';'; public TCPClient(String address, int port) { try { this.address = address; this.port = port; this.clientSocket = new Socket(address, port); } catch (IOException e) { System.err.println(e.getMessage()); e.printStackTrace(); } } public void sendToServer(String message) { try { if (socketIsClosed) { this.clientSocket = new Socket(address, port); } DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream()); outToServer.writeBytes(message + stopChar); } catch (IOException e) { e.printStackTrace(); } } public void closeSocket() { try { clientSocket.close(); socketIsClosed = true; } catch (IOException e) { System.err.println(e.getMessage()); e.printStackTrace(); } } }
[ "macc.nicola@gmail.com" ]
macc.nicola@gmail.com
c6376fb5d437b4183fd19f5ac42ece0374b04024
302af4aa0bf08a66dde5fa95bc6e8992e4505c7d
/com.gumtree.android.beta/java/novoda/lib/sqliteprovider/cursor/EmptyCursor.java
7b29d7b90d97d29da5e784145fe74cccb4367203
[]
no_license
hakat0m/Chessboxing
0f5ce696a55a5b40f1d8fa226bbdc5673ef5dbc5
0a576dec5aaafa219c340a013726037d852b91a2
refs/heads/master
2021-01-19T08:51:23.932830
2017-04-09T06:48:44
2017-04-09T06:48:44
87,688,753
3
0
null
null
null
null
UTF-8
Java
false
false
708
java
package novoda.lib.sqliteprovider.cursor; import android.database.AbstractCursor; public class EmptyCursor extends AbstractCursor { public String[] getColumnNames() { return new String[]{"_id"}; } public int getCount() { return 0; } public double getDouble(int i) { return 0.0d; } public float getFloat(int i) { return 0.0f; } public int getInt(int i) { return 0; } public long getLong(int i) { return 0; } public short getShort(int i) { return (short) 0; } public String getString(int i) { return null; } public boolean isNull(int i) { return true; } }
[ "vuesz@outlook.com" ]
vuesz@outlook.com
e27fb2964d05e69a1a6282c49741ae111e4bb738
187015a3619f29d54c880b0c11b2fc1e6a968335
/symptom2/src/test2.java
a3b85ebb87d3830a8ca0c3dcd2fa9ee1d7981d72
[]
no_license
parmeshashwath/Cisco-intern-project
717cd8808e9e89ddd25ff9ef88c957950abb5d6e
51eb0bb2e425109c17c6bd6cb9ca2babe1e81237
refs/heads/master
2020-05-18T04:47:56.867261
2015-06-30T04:08:08
2015-06-30T04:08:08
38,286,931
0
0
null
null
null
null
UTF-8
Java
false
false
8,135
java
import java.sql.*; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.ListIterator; import java.util.Map; import java.util.Set; import java.util.StringTokenizer; import java.io.*; class outkey{ String outcome; int grp; @Override public boolean equals(Object obj) { if (obj instanceof outkey) { return outcome.equals(((outkey)obj).outcome) && grp==((outkey)obj).grp; } return false; } @Override public int hashCode() { return Integer.valueOf(grp).hashCode()+(outcome).hashCode(); } } public class test2{ static String tempstr=" "; static int pp=0; static List<String> wordList = new ArrayList(); static void fun(Connection c,BufferedReader br,HashSet days, HashSet months,HashSet dic) { int n=0; pp++; String sCurrentLine=" ",temp=" "; // System.out.println(contentInBytes); String temp1=" "; try { int sym=0; int flag=0; while ((sCurrentLine = br.readLine()) != null && flag==0) { //wordList.clear(); //System.out.println(sCurrentLine); StringTokenizer tokn = new StringTokenizer(sCurrentLine, " "); if(tokn.countTokens()>2 && days.contains(tokn.nextToken()) && months.contains(tokn.nextToken())) { tempstr=sCurrentLine; //System.out.println(tempstr); // continue; br.mark(1000); while ((sCurrentLine = br.readLine()) != null) { StringTokenizer tokn1 = new StringTokenizer(sCurrentLine, " "); if(tokn1.countTokens()>2 && days.contains(tokn1.nextToken()) && months.contains(tokn1.nextToken())) { //System.out.println("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); br.reset(); flag=1; break; } StringTokenizer tokn2 = new StringTokenizer(sCurrentLine, " "); while (tokn2.hasMoreTokens()) { temp=tokn2.nextToken(); //System.out.println(temp); if(dic.contains(temp)&& !wordList.contains(temp)) wordList.add(temp); } br.mark(1000); } } // } } catch(Exception e) { e.printStackTrace(); } } public static void main(String ar[]) { String query1 = "SELECT * FROM OUT_SYM WHERE SYM="; String query2 = "SELECT * FROM OUT_SYM WHERE OUT="; List<String> wordListA = new ArrayList(); List<String> wordListB= new ArrayList(); List<String> wordListC = new ArrayList(); int ch; int id; Connection c = null; HashSet days = new HashSet(); HashSet months=new HashSet(); HashMap<outkey,outdet> symhash=new HashMap<outkey,outdet>(); String temp=" "; int n=0; int A=0x0000; int B=0x0000; int C=0x0000; /* pt.put(t1, ob1); pt.put(t2, ob2); pt.put(t3, obk);*/ HashSet dic=new HashSet(); int tempint; int cnt=0; String str2=" "; String str3=" "; String str4=" "; // add elements to the hash set dic.add("s1"); dic.add("s2"); dic.add("s3"); dic.add("s4"); dic.add("s5"); outdet obv1=new outdet(); outdet obv2=new outdet(); outdet obv3=new outdet(); outdet obv4=new outdet(); outdet obv5=new outdet(); outdet obv6=new outdet(); outdet obv7=new outdet(); outdet obv8=new outdet(); outdet testv=new outdet(); outkey obk1=new outkey(); outkey obk2=new outkey(); outkey obk3=new outkey(); outkey obk4=new outkey(); outkey obk5=new outkey(); outkey obk6=new outkey(); outkey obk7=new outkey(); outkey obk8=new outkey(); outkey testk=new outkey(); days.add("Sun"); days.add("Mon"); days.add("Tue"); days.add("Wed"); days.add("Thu"); days.add("Fri"); months.add("Jan"); months.add("Feb"); months.add("Mar"); months.add("Apr"); months.add("May"); months.add("Jun"); months.add("Jul"); months.add("Aug"); months.add("Sep"); months.add("Oct"); months.add("Nov"); months.add("Dec"); BufferedReader br1 = null; BufferedReader br2 = null; BufferedReader br3 = null; String sCurrentLine; try { Class.forName("oracle.jdbc.driver.OracleDriver"); c = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","system","azadAZAD1"); } catch(ClassNotFoundException error) { System.err.println("Unable to load the JDBC/ODBC bridge" + error.getMessage( )); System.exit(1); } catch(SQLException error) { System.err.println("Unable to connect to database---" + error.getMessage( )); System.exit(2); } catch(Exception e) { } try { br1 = new BufferedReader(new FileReader("C:/log1.txt")); br2 = new BufferedReader(new FileReader("C:/log2.txt")); br3 = new BufferedReader(new FileReader("C:/log3.txt")); br1.mark(1000); br2.mark(1000); br3.mark(1000); while(br1.readLine()!=null || br2.readLine()!=null || br3.readLine()!=null ) { br1.reset(); br2.reset(); br3.reset(); obv1.cnt=0; obv1.symptoms=" "; obv2.cnt=0; obv2.symptoms=" "; obv3.cnt=0; obv3.symptoms=" "; obv4.cnt=0; obv4.symptoms=" "; obv5.cnt=0; obv5.symptoms=" "; obv6.cnt=0; obv6.symptoms=" "; obv7.cnt=0; obv7.symptoms=" "; obv8.cnt=0; obv8.symptoms=" "; obk1.grp=1; obk1.outcome="o1"; obk2.grp=2; obk2.outcome="o1"; obk3.grp=1; obk3.outcome="o2"; obk4.grp=1; obk4.outcome="o3"; obk5.grp=1; obk5.outcome="o4"; obk6.grp=1; obk6.outcome="o5"; obk7.grp=1; obk7.outcome="o6"; obk8.grp=1; obk8.outcome="o7"; symhash.put(obk1,obv1); symhash.put(obk2,obv2); symhash.put(obk3,obv3); symhash.put(obk4,obv4); symhash.put(obk5,obv5); symhash.put(obk6,obv6); symhash.put(obk7,obv7); symhash.put(obk8,obv8); wordList.clear(); fun(c,br1,days,months,dic); fun(c,br2,days,months,dic); fun(c,br3,days,months,dic); testk.grp=1; testk.outcome="o1"; testv=symhash.get(testk); ListIterator<String> itr=wordList.listIterator(); while(itr.hasNext()) { outdet obnv=null; outkey obnk=new outkey(); temp=itr.next(); //System.out.println("jj"+temp); try { Statement st = c.createStatement(); ResultSet r = st.executeQuery(query1+ "'"+temp+"'"); while(r.next()) { str2=r.getString(1); id=r.getInt(3); obnk.grp=id; obnk.outcome=str2; obnv=symhash.get(obnk); //System.out.println("##############################"); //System.out.println(obnv.symptoms+obnv.cnt); obnv.cnt++; obnv.symptoms=obnv.symptoms+temp; symhash.put(obnk, obnv); // System.out.println("aaaaaaaaa"+sym); } } catch(Exception e) { e.printStackTrace(); } } try { Set set = symhash.entrySet(); Iterator i = set.iterator(); // Display elements while(i.hasNext()) { int v=0; Map.Entry me = (Map.Entry)i.next(); outdet u=(outdet)me.getValue(); outkey y=(outkey)me.getKey(); Statement st = c.createStatement(); //System.out.println("SELECT * FROM OUT_SYM WHERE OUT="+ "'"+y.outcome+"'"+ "AND"+"ID= "+y.grp); ResultSet r = st.executeQuery("SELECT * FROM OUT_SYM WHERE OUT="+ "'"+y.outcome+"'"+ " AND "+"ID= "+y.grp); while(r.next()) { v++; // System.out.println("aaaaaaaaa"+sym); } if(v!=0) { System.out.println("************************************"+tempstr); System.out.println("Symptoms"+u.symptoms); System.out.println("error::"+y.outcome); System.out.println((float)u.cnt/v); //System.out.println(u.cnt); } } // System.out.println(pp); } catch(Exception e) { e.printStackTrace(); } } } catch (IOException e) { e.printStackTrace(); } finally { try { br1.close(); br2.close(); br3.close(); } catch (IOException ex) { ex.printStackTrace(); } } } }
[ "parma@PARMA-WS.cisco.com" ]
parma@PARMA-WS.cisco.com
790c6478b7dab9e336e90a7cc119b4523bc73973
b146594bccfded847236840ebeef357e6456a581
/src/main/java/com/springmvc/final_project/Model/CompaniesFindByIdRequest.java
ae013d09d35594b2d342cd2db10ac2fc02fede27
[]
no_license
BuiVanKhoa/backend
b79ee7fbe9b6f978593a396c079768e252b78399
b6f262a269909700092f45d18568e3b91b052041
refs/heads/master
2022-11-30T09:57:13.519706
2020-08-14T03:59:14
2020-08-14T03:59:14
287,438,450
0
0
null
null
null
null
UTF-8
Java
false
false
217
java
package com.springmvc.final_project.Model; public class CompaniesFindByIdRequest { private int id; public int getId() { return id; } public void setId(int id) { this.id = id; } }
[ "buivankhoa.dtu@gmail.com" ]
buivankhoa.dtu@gmail.com
da0266f3acf0599190a559eab7ae66c7506362a0
935385f41daf85ddbf0970a8a3e5af2d1ff68f87
/src/com/insanexs/leetcode/algorithms/IsIsomorphic.java
ba27d9f90d67b431a1a316d7044de13df201aad5
[]
no_license
insaneXs/leetcode
5b0919c30483662f909bd3212574248d3dd151d2
0a57ae7573dead698f90b91ff33460d51275890c
refs/heads/master
2021-01-10T10:22:43.185736
2020-11-06T08:11:02
2020-11-06T08:11:02
50,817,992
0
0
null
null
null
null
UTF-8
Java
false
false
694
java
package com.insanexs.leetcode.algorithms; import java.util.HashMap; public class IsIsomorphic { public static void main(String[] args){ System.out.println(isIsomorphic("aa", "ab")); } public static boolean isIsomorphic(String s, String t) { HashMap<Character, Character> map = new HashMap<Character, Character> (); char[] arr1 = s.toCharArray(); char[] arr2 = t.toCharArray(); for(int i = 0; i < arr1.length; i++){ if(map.containsKey(arr1[i])){ if(map.get(arr1[i]) != arr2[i]) return false; }else{ map.put(arr1[i],arr2[i]); } } return true; } }
[ "191717154@qq.com" ]
191717154@qq.com
0d92bf0099d93d96b85d9904ce042407c56b4c50
434b9f4c57ad9dca57d4cd478ec0c69b2b85ba9a
/src/main/java/com/yellowdoge/app/xiyoumusic/service/ChatService.java
13315faf6d4e28a99b26d730aed0ce126f8a13cb
[]
no_license
yellowdoge1996/xiyouMusicService
3c006a73ef1f4a193d20d0f0a36a340f29f8dfd7
a0e1976a06209663fbb124332618251fe83cea4f
refs/heads/master
2022-06-24T07:12:33.769692
2019-12-05T15:52:04
2019-12-05T15:52:04
226,136,489
0
0
null
2022-06-21T02:23:28
2019-12-05T15:48:20
Java
UTF-8
Java
false
false
209
java
package com.yellowdoge.app.xiyoumusic.service; import com.yellowdoge.app.xiyoumusic.model.LiuYan; public interface ChatService { public void chat(LiuYan liuYan); public void getMessage(String xh); }
[ "yellowdoge1996@gmail.com" ]
yellowdoge1996@gmail.com
ae31eff47fc7dd3710e8136eb7a3f20164b5ee4b
b4ba18c2c84b58d8b595e1294be06f669dc041d7
/src/com/mZone/epro/account/twitter/TwitterWebLoginActivity.java
c44c5073960b10f3d3b1703006567e5eb7ac1e94
[]
no_license
lochuynh211/ePro-Toeic
85356ccab18a41a1c6dd98a2bfe1508ffecb7894
12816bd494641778c53a8713a9552f60eda8852f
refs/heads/master
2021-01-10T23:20:48.652361
2016-10-11T13:26:17
2016-10-11T13:26:17
70,595,487
0
1
null
null
null
null
UTF-8
Java
false
false
16,825
java
package com.mZone.epro.account.twitter; import com.mZone.epro.BuildConfig; import com.mZone.epro.R; import com.mZone.epro.client.utility.AbstractCacheAsyncTaskLoader; import twitter4j.Twitter; import twitter4j.TwitterException; import twitter4j.TwitterFactory; import twitter4j.auth.AccessToken; import twitter4j.auth.RequestToken; import twitter4j.conf.Configuration; import twitter4j.conf.ConfigurationBuilder; import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.support.v4.app.DialogFragment; import android.support.v4.app.LoaderManager; import android.support.v4.app.LoaderManager.LoaderCallbacks; import android.support.v4.app.NavUtils; import android.support.v4.content.Loader; import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBarActivity; import android.text.TextUtils; import android.view.Menu; import android.view.MenuItem; import android.webkit.CookieManager; import android.webkit.CookieSyncManager; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; public class TwitterWebLoginActivity extends ActionBarActivity { /** 認証トークン取得失敗ダイアログ用フラグメントタグ */ private static final String FRAGMENT_TAG_DIALOG_OAUTH_REQUEST_TOKEN_ERROR = "FRAGMENT_TAG_DIALOG_OAUTH_REQUEST_TOKEN_ERROR"; /** */ private Twitter mTwitter; /** */ private String mOauthVerifier; /** */ private WebView mWebView; /** */ private final Handler mShowDialogHandler = new Handler() { @Override public void handleMessage(final Message msg) { switch (msg.what) { case MESSAGE_ID_OAUTH_REQUEST_TOKEN_ERROR_DIALOG: final Object obj = msg.obj; if (obj instanceof DialogFragment) { // ダイアログを表示 final DialogFragment dialogFragment = (DialogFragment) obj; dialogFragment.show(getSupportFragmentManager(), FRAGMENT_TAG_DIALOG_OAUTH_REQUEST_TOKEN_ERROR); } break; default: break; } } }; /** */ private static final int MESSAGE_ID_OAUTH_REQUEST_TOKEN_ERROR_DIALOG = 1; @SuppressWarnings("deprecation") @Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); // レイアウトを読み込み setContentView(R.layout.account_twitter_web_login_activity); // ActionBarの設定 final ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); // WebViewの準備 mWebView = (WebView) findViewById(R.id.webView); CookieSyncManager.createInstance(this); // final CookieManager cookieManager = CookieManager.getInstance(); // cookieManager.removeAllCookie(); // cookieManager.setAcceptCookie(false); // final WebSettings ws = mWebView.getSettings(); // ws.setSaveFormData(false); // ws.setSavePassword(false); mWebView.setWebViewClient(new LoginTwitterWebViewClient()); // Twitterアクセスオブジェクトを作成 final ConfigurationBuilder builder = new ConfigurationBuilder(); builder.setDebugEnabled(true); builder.setOAuthConsumerKey(TwitterConstants.CONSUMER_KEY); builder.setOAuthConsumerSecret(TwitterConstants.CONSUMER_SECRET); final Configuration configuration = builder.build(); mTwitter = new TwitterFactory(configuration).getInstance(); // 読み込み開始 final LoaderManager loaderManager = getSupportLoaderManager(); final GetTwitterOAuthRequestTokenLoaderCallback callback = new GetTwitterOAuthRequestTokenLoaderCallback(); loaderManager.restartLoader(R.id.twitter_web_login_activity_load_oauth_request_token, null, callback); // setResult(RESULT_CANCELED); } /** * * @param url */ private void loadUrl(final String url) { mWebView.loadUrl(url); } @Override public boolean onCreateOptionsMenu(final Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.twitter_web_login, menu); return true; } @Override public boolean onOptionsItemSelected(final MenuItem item) { boolean consumed = false; switch (item.getItemId()) { case android.R.id.home: NavUtils.navigateUpFromSameTask(this); consumed = true; default: // 自クラスで消費しない場合は親クラスに譲渡する consumed = super.onOptionsItemSelected(item); break; } return consumed; } /** * */ private class LoginTwitterWebViewClient extends WebViewClient { /** ログ用タグ */ @Override public boolean shouldOverrideUrlLoading(final WebView view, final String url) { boolean handled = false; if (url.contains(TwitterConstants.CALLBACK_URL)) { // トークンのもとを取得 final Uri uri = Uri.parse(url); mOauthVerifier = uri.getQueryParameter("oauth_verifier"); // トークンを取得 if (!TextUtils.isEmpty(mOauthVerifier)){ final LoaderManager loaderManager = getSupportLoaderManager(); final GetAccessTokenLoaderCallback callback = new GetAccessTokenLoaderCallback(); loaderManager.initLoader(R.id.twitter_web_login_activity_load_access_token, null, callback); handled = true; } else{ finishActivity(); } } return handled; } } /** * */ private static class GetTwitterOAuthRequestTokenLoader extends AbstractCacheAsyncTaskLoader<TwitterOAuthRequestToken> { /** */ private final Twitter mTwitter; /** * * @param context * @param twitter */ public GetTwitterOAuthRequestTokenLoader(final Context context, final Twitter twitter) { super(context); mTwitter = twitter; } @Override public TwitterOAuthRequestToken loadInBackground() { final TwitterOAuthRequestToken result = new TwitterOAuthRequestToken(); try { final RequestToken requestToken = mTwitter.getOAuthRequestToken(TwitterConstants.CALLBACK_URL); result.isCausedByNetworkIssue = false; result.isErrorMessageAvailable = false; result.errorCode = 0; result.authenticationURL = requestToken.getAuthenticationURL(); } catch (final TwitterException e) { e.printStackTrace(); result.isCausedByNetworkIssue = e.isCausedByNetworkIssue(); result.isErrorMessageAvailable = e.isErrorMessageAvailable(); result.errorCode = e.getErrorCode(); result.exceptionCode = e.getExceptionCode(); result.errorMessage = e.getErrorMessage(); result.authenticationURL = null; } return result; } } /** * */ private static final class TwitterOAuthRequestToken { /** */ public boolean isCausedByNetworkIssue; /** */ public boolean isErrorMessageAvailable; /** */ public int errorCode; /** */ public String exceptionCode; /** */ public String errorMessage; /** */ public String authenticationURL; @Override public int hashCode() { final int prime = 31; int result = 1; result = (prime * result) + ((authenticationURL == null) ? 0 : authenticationURL.hashCode()); result = (prime * result) + errorCode; result = (prime * result) + ((errorMessage == null) ? 0 : errorMessage.hashCode()); result = (prime * result) + ((exceptionCode == null) ? 0 : exceptionCode.hashCode()); result = (prime * result) + (isCausedByNetworkIssue ? 1231 : 1237); result = (prime * result) + (isErrorMessageAvailable ? 1231 : 1237); return result; } @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final TwitterOAuthRequestToken other = (TwitterOAuthRequestToken) obj; if (authenticationURL == null) { if (other.authenticationURL != null) { return false; } } else if (!authenticationURL.equals(other.authenticationURL)) { return false; } if (errorCode != other.errorCode) { return false; } if (errorMessage == null) { if (other.errorMessage != null) { return false; } } else if (!errorMessage.equals(other.errorMessage)) { return false; } if (exceptionCode == null) { if (other.exceptionCode != null) { return false; } } else if (!exceptionCode.equals(other.exceptionCode)) { return false; } if (isCausedByNetworkIssue != other.isCausedByNetworkIssue) { return false; } if (isErrorMessageAvailable != other.isErrorMessageAvailable) { return false; } return true; } @Override public String toString() { return "TwitterOAuthRequestToken [isCausedByNetworkIssue=" + isCausedByNetworkIssue + ", isErrorMessageAvailable=" + isErrorMessageAvailable + ", errorCode=" + errorCode + ", exceptionCode=" + exceptionCode + ", errorMessage=" + errorMessage + ", authenticationURL=" + authenticationURL + "]"; } } private class GetTwitterOAuthRequestTokenLoaderCallback implements LoaderCallbacks<TwitterOAuthRequestToken> { @Override public Loader<TwitterOAuthRequestToken> onCreateLoader(final int id, final Bundle args) { final GetTwitterOAuthRequestTokenLoader loader = new GetTwitterOAuthRequestTokenLoader(getApplicationContext(), mTwitter); return loader; } @Override public void onLoadFinished(final Loader<TwitterOAuthRequestToken> loader, final TwitterOAuthRequestToken twitterOAuthRequestToken) { // URLの読み込み final String authenticationURL = twitterOAuthRequestToken.authenticationURL; if (!TextUtils.isEmpty(authenticationURL)) { loadUrl(authenticationURL); } else { // エラーダイアログを表示 final OAuthRequestTokenErrorDialogFragment dialogFragment = OAuthRequestTokenErrorDialogFragment.newInstance(twitterOAuthRequestToken.isCausedByNetworkIssue, twitterOAuthRequestToken.isErrorMessageAvailable, twitterOAuthRequestToken.exceptionCode, twitterOAuthRequestToken.errorCode, twitterOAuthRequestToken.errorMessage); final Message msg = mShowDialogHandler.obtainMessage(MESSAGE_ID_OAUTH_REQUEST_TOKEN_ERROR_DIALOG, dialogFragment); mShowDialogHandler.sendMessage(msg); } } @Override public void onLoaderReset(final Loader<TwitterOAuthRequestToken> loader) { } } /** * */ private static class GetAccessTokenLoader extends AbstractCacheAsyncTaskLoader<Boolean> { /** */ private final Twitter mTwitter; /** */ private final String mOauthVerifier; /** * * @param context */ public GetAccessTokenLoader(final Context context, final Twitter twitter, final String oauthVerifier) { super(context); mTwitter = twitter; mOauthVerifier = oauthVerifier; } @Override public Boolean loadInBackground() { boolean successful = false; try { // トークンを取得 final AccessToken accessToken = mTwitter.getOAuthAccessToken(mOauthVerifier); final String token = accessToken.getToken(); final String tokenSecret = accessToken.getTokenSecret(); // トークンを保存 final TwitterDataController twitterDataController = TwitterDataController.getInstance(getContext()); successful = twitterDataController.saveOAuthAccessToken(token, tokenSecret); if (!successful) { return successful; } // Twitterオブジェクトを再生成 final ConfigurationBuilder builder = new ConfigurationBuilder(); builder.setDebugEnabled(BuildConfig.DEBUG); builder.setOAuthConsumerKey(TwitterConstants.CONSUMER_KEY); builder.setOAuthConsumerSecret(TwitterConstants.CONSUMER_SECRET); builder.setOAuthAccessToken(token); builder.setOAuthAccessTokenSecret(tokenSecret); final Configuration configuration = builder.build(); // スクリーン名を取得 final Twitter twitter = new TwitterFactory(configuration).getInstance(); final String screenName = twitter.getScreenName(); // スクリーン名を保存 successful = twitterDataController.saveAccountName(screenName); } catch (final IllegalStateException e) { e.printStackTrace(); successful = false; } catch (final TwitterException e) { e.printStackTrace(); successful = false; } return successful; } } /** * */ private class GetAccessTokenLoaderCallback implements LoaderCallbacks<Boolean> { @Override public Loader<Boolean> onCreateLoader(final int id, final Bundle args) { // ローダーを作成 final GetAccessTokenLoader loader = new GetAccessTokenLoader(getApplicationContext(), mTwitter, mOauthVerifier); return loader; } @Override public void onLoadFinished(final Loader<Boolean> loader, final Boolean successful) { if (successful) { // Activityを終了 if (!isFinishing()) { setResult(RESULT_OK); finish(); } } } @Override public void onLoaderReset(final Loader<Boolean> loader) { } } /** * */ public static class OAuthRequestTokenErrorDialogFragment extends DialogFragment { /** */ private static final String FRAGMENT_ARGS_KEY_IS_CAUSED_BY_NETWORK_ISSUE = "isCausedByNetworkIssue"; /** */ private static final String FRAGMENT_ARGS_KEY_IS_ERROR_MESSAGE_AVAILAVLE = "isErrorMessageAvailable"; /** */ private static final String FRAGMENT_ARGS_KEY_EXCEPTION_CODE = "exceptionCode"; /** */ private static final String FRAGMENT_ARGS_KEY_ERROR_CODE = "errorCode"; /** */ private static final String FRAGMENT_ARGS_KEY_ERROR_MESSAGE = "errorMessage"; /** * * @param isCausedByNetworkIssue * @param isErrorMessageAvailable * @param exceptionCode * @param errorCode * @param errorMessage * @return */ public static OAuthRequestTokenErrorDialogFragment newInstance(final boolean isCausedByNetworkIssue, final boolean isErrorMessageAvailable, final String exceptionCode, final int errorCode, final String errorMessage) { // フラグメントを作成 final OAuthRequestTokenErrorDialogFragment fragment = new OAuthRequestTokenErrorDialogFragment(); // フラグメントの引数を作成 final Bundle args = new Bundle(); args.putBoolean(FRAGMENT_ARGS_KEY_IS_CAUSED_BY_NETWORK_ISSUE, isCausedByNetworkIssue); args.putBoolean(FRAGMENT_ARGS_KEY_IS_ERROR_MESSAGE_AVAILAVLE, isErrorMessageAvailable); args.putString(FRAGMENT_ARGS_KEY_EXCEPTION_CODE, exceptionCode); args.putInt(FRAGMENT_ARGS_KEY_ERROR_CODE, errorCode); args.putString(FRAGMENT_ARGS_KEY_ERROR_MESSAGE, errorMessage); fragment.setArguments(args); return fragment; } @Override public Dialog onCreateDialog(final Bundle savedInstanceState) { // TODO : メッセージをxmlに変更すること final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.twitter_web_login_activity_oauth_request_token_error); // 引数を取得 boolean isCausedByNetworkIssue = false; boolean isErrorMessageAvailable = false; String exceptionCode = null; int errorCode = 0; String errorMessage = null; final Bundle args = getArguments(); if (args != null) { isCausedByNetworkIssue = args.getBoolean(FRAGMENT_ARGS_KEY_IS_CAUSED_BY_NETWORK_ISSUE); isErrorMessageAvailable = args.getBoolean(FRAGMENT_ARGS_KEY_IS_ERROR_MESSAGE_AVAILAVLE); exceptionCode = args.getString(FRAGMENT_ARGS_KEY_EXCEPTION_CODE); errorCode = args.getInt(FRAGMENT_ARGS_KEY_ERROR_CODE); errorMessage = args.getString(FRAGMENT_ARGS_KEY_ERROR_MESSAGE); } // エラー内容によりメッセージを切り替え if (isCausedByNetworkIssue) { builder.setMessage(R.string.twitter_web_login_activity_oauth_request_token_network_error); } else if (isErrorMessageAvailable) { final StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(errorMessage).append("\nErrorCode=").append(errorCode).append("\nExceptionCode=").append(exceptionCode).append("\n"); builder.setMessage(stringBuilder.toString()); } else { builder.setMessage(R.string.twitter_web_login_activity_oauth_request_token_unknown_error); } // リスナーを作成 final DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { switch (which) { case DialogInterface.BUTTON_POSITIVE: // Activityを閉じる dialog.dismiss(); getActivity().finish(); break; case DialogInterface.BUTTON_NEGATIVE: default: // 何もしない break; } } }; builder.setPositiveButton(R.string.twitter_web_login_activity_oauth_request_token_positive_button, listener); builder.setCancelable(false); // ダイアログを作成 final Dialog dialog = builder.create(); return dialog; } } private void finishActivity(){ finish(); } }
[ "loc.huynh.211@gmail.com" ]
loc.huynh.211@gmail.com
f6db8dc4a0568bc64508d64d90118a0447843e9a
0eb1a5ea1afb5aec9d2652767e8391eeadf4370f
/retail-store/src/main/java/com/retail/store/model/CartItem.java
dbc6651081687fb9d04fe782c0c17bc0e66ce2cd
[]
no_license
yogeshrnaik/projects
36b2b6e115c45a562a5206ab7280d7933c072561
fed554cd365865a6e505d2c146fc820931d78da0
refs/heads/master
2022-12-23T05:32:11.548117
2022-09-08T07:48:48
2022-09-08T07:48:48
40,397,110
6
8
null
2022-12-16T03:41:00
2015-08-08T08:47:28
Java
UTF-8
Java
false
false
2,457
java
package com.retail.store.model; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.validation.constraints.NotNull; @Entity @Table(name = "cart_items") public class CartItem implements Serializable { private static final long serialVersionUID = -5454681550675014977L; @Id @Column(name = "id") @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @ManyToOne private Product product; @ManyToOne private Cart cart; @NotNull private int quantity; private double salesTax; private double priceBeforeTax; private double totalPrice; public CartItem() { } public CartItem(Product product, int quantity, Cart cart) { this(null, product, quantity, cart); } public CartItem(Long id, Product product, int quantity, Cart cart) { this.id = id; this.product = product; this.quantity = quantity; this.cart = cart; updateQuantity(quantity); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Product getProduct() { return product; } public void setProduct(Product product) { this.product = product; } public int getQuantity() { return quantity; } public void setQuantity(int quantity) { this.quantity = quantity; } public Double getSalesTax() { return salesTax; } public void setSalesTax(Double salesTax) { this.salesTax = salesTax; } public Double getPriceBeforeTax() { return priceBeforeTax; } public void setPriceBeforeTax(Double price) { priceBeforeTax = price; } public double getTotalPrice() { return totalPrice; } public void setTotalPrice(double totalPrice) { this.totalPrice = totalPrice; } public void setSalesTax(double salesTax) { this.salesTax = salesTax; } public void updateQuantity(int quantity) { setQuantity(quantity); priceBeforeTax = product.calculatePrice(quantity); salesTax = product.calculateSalesTax(quantity); totalPrice = priceBeforeTax + salesTax; } }
[ "yogeshrnaik@gmail.com" ]
yogeshrnaik@gmail.com
298f5126fb622ee12096a9ad3f38499d2c2945eb
1d43fb019aa5abec9265f4e812af8775985879aa
/aeroperu/src/main/java/com/example/aeroperu/repo/CityRepo.java
b5a840ee5386ce9dffb0e2e683a85a268cda5efc
[]
no_license
ltoniut/tp5-rest
fc495120dd71153ec9289b481dedd2a69af3a39b
45bf25448b0515e4d6ff6fb94aa6bc27c9787487
refs/heads/master
2020-03-19T10:45:21.760476
2018-06-09T22:55:43
2018-06-09T22:55:43
136,398,589
0
0
null
2018-06-07T00:00:56
2018-06-07T00:00:56
null
UTF-8
Java
false
false
403
java
package com.example.aeroperu.repo; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import com.esq.models.City; @Repository public interface CityRepo extends JpaRepository<City, Long> { public default City findByIata(String str) { for (City c : findAll()) { if (c.getIataCode() == str) { return c; } } return null; } }
[ "ltoniut@gmail.com" ]
ltoniut@gmail.com
ca217f49e0576716aa81d08136d25e7b98bd8d17
ec09a8a03a309439a68d15d8dec650e9c51a3ea4
/src/main/java/com/mercury/SpringBootRestDemo/bean/Sample.java
7044797dd3e613ff17a963f74b3e50898c4cd72d
[]
no_license
Rainie16/SpringBootRestDemo
e1abd152fb40bb3432b3be8740a00681a68a5f90
3add005080ca8dc6823b0ed020ab3a878efbbd3d
refs/heads/master
2023-08-22T06:25:51.327619
2021-10-17T18:44:27
2021-10-17T18:44:27
418,213,977
0
0
null
null
null
null
UTF-8
Java
false
false
704
java
package com.mercury.SpringBootRestDemo.bean; public class Sample { private String name; private int age; public Sample() { } public Sample(String name, int age) { this.name = name; this.age = age; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } @Override public String toString() { return "Sample{" + "name='" + name + '\'' + ", age=" + age + '}'; } }
[ "yuqing_0916@hotmail.com" ]
yuqing_0916@hotmail.com
ae7bceffc7abaebc45ace505c293a1028b26bb92
86fa729606d159d001f299151610ea036e2460a8
/app/src/main/java/cn/com/broadlink/blappsdkdemo/data/RmStbProviderInfoResult.java
57e66de149ed246eb867750d2bcd1c4077342c5d
[]
no_license
ibroadlink/APPSDK_Android_Demo
d27e04d652fc5c7141fd50f21b369dcaae9ec08a
f8db69151820d9ea94096371fbac36a55962c388
refs/heads/master
2021-07-13T13:32:10.669618
2020-05-21T07:20:47
2020-05-21T07:20:47
140,553,214
10
5
null
null
null
null
UTF-8
Java
false
false
748
java
package cn.com.broadlink.blappsdkdemo.data; import java.util.ArrayList; import java.util.List; public class RmStbProviderInfoResult extends BaseResult{ private RespbodyBean respbody = new RespbodyBean(); public RespbodyBean getRespbody() { return respbody; } public void setRespbody(RespbodyBean respbody) { this.respbody = respbody; } public List<RmStbProviderInfo> getProviderinfo() { return respbody.getProviderinfo(); } public static class RespbodyBean { private List<RmStbProviderInfo> providerinfo = new ArrayList<>(); public List<RmStbProviderInfo> getProviderinfo() { return providerinfo; } public void setProviderinfo(List<RmStbProviderInfo> providerinfo) { this.providerinfo = providerinfo; } } }
[ "echojiangyq@gmail.com" ]
echojiangyq@gmail.com
19cd1f67a7d67aaeb6decbd3e3de4e84dcc1ca98
a5d01febfd8d45a61f815b6f5ed447e25fad4959
/Source Code/5.27.0/sources/com/iqoption/fragment/assets/i.java
373aac1dce393c34677adcea312e7ae421cf3c75
[]
no_license
kkagill/Decompiler-IQ-Option
7fe5911f90ed2490687f5d216cb2940f07b57194
c2a9dbbe79a959aa1ab8bb7a89c735e8f9dbc5a6
refs/heads/master
2020-09-14T20:44:49.115289
2019-11-04T06:58:55
2019-11-04T06:58:55
223,236,327
1
0
null
2019-11-21T18:17:17
2019-11-21T18:17:16
null
UTF-8
Java
false
false
434
java
package com.iqoption.fragment.assets; import com.iqoption.fragment.assets.model.AssetSortType; @kotlin.i(bne = {1, 1, 15}) public final /* synthetic */ class i { public static final /* synthetic */ int[] aob = new int[AssetSortType.values().length]; static { aob[AssetSortType.BY_DIFF.ordinal()] = 1; aob[AssetSortType.BY_SPREAD.ordinal()] = 2; aob[AssetSortType.BY_LEVERAGE.ordinal()] = 3; } }
[ "yihsun1992@gmail.com" ]
yihsun1992@gmail.com
601dc5586be3bc56df6a4452f70b95857c45d3b8
b3a03bbd9380c7b6f7653ac31fe1bb7b7bfadcfe
/src/faq/pagingAction.java
72bc674aa666b2e0c3eb7cae4561ddc74a6eb081
[]
no_license
daegyung2/antman
265b254f2780213659c64c68f5b7455d3f00d486
114dbb5be911f0b2f9d0179ec19fe69e7364df89
HEAD
2016-08-11T13:55:24.230934
2016-01-14T03:29:17
2016-01-14T03:29:17
47,238,993
0
0
null
null
null
null
UHC
Java
false
false
4,302
java
package faq; public class pagingAction { private int currentPage; // 현재페이지 private int totalCount; // 전체 게시물 수 private int totalPage; // 전체 페이지 수 private int blockCount; // 한 페이지의 게시물의 수 private int blockPage; // 한 화면에 보여줄 페이지 수 private int startCount; // 한 페이지에서 보여줄 게시글의 시작 번호 private int endCount; // 한 페이지에서 보여줄 게시글의 끝 번호 private int startPage; // 시작 페이지 private int endPage; // 마지막 페이지 private StringBuffer pagingHtml; // 페이징 생성자 public pagingAction(int currentPage, int totalCount, int blockCount, int blockPage) { this.blockCount = blockCount; this.blockPage = blockPage; this.currentPage = currentPage; this.totalCount = totalCount; // 전체 페이지 수 totalPage = (int) Math.ceil((double) totalCount / blockCount); if (totalPage == 0) { totalPage = 1; } // 현재 페이지가 전체 페이지 수보다 크면 전체 페이지 수로 설정 if (currentPage > totalPage) { currentPage = totalPage; } // 현재 페이지의 처음과 마지막 글의 번호 가져오기. startCount = (currentPage - 1) * blockCount; endCount = startCount + blockCount - 1; // 시작 페이지와 마지막 페이지 값 구하기. startPage = (int) ((currentPage - 1) / blockPage) * blockPage + 1; endPage = startPage + blockPage - 1; // 마지막 페이지가 전체 페이지 수보다 크면 전체 페이지 수로 설정 if (endPage > totalPage) { endPage = totalPage; } // 이전 block 페이지 pagingHtml = new StringBuffer(); if (currentPage > blockPage) { pagingHtml.append("<a href=/antman/praiseboard.do?PageNum=" + (startPage - 1) + ">"); pagingHtml.append("이전"); pagingHtml.append("</a>"); } pagingHtml.append("&nbsp;|&nbsp;"); //페이지 번호.현재 페이지는 빨간색으로 강조하고 링크를 제거. for (int i = startPage; i <= endPage; i++) { if (i > totalPage) { break; } if (i == currentPage) { pagingHtml.append("&nbsp;<b> <font size='6' color='blue'>"); pagingHtml.append(i); pagingHtml.append("</font></b>"); } else { pagingHtml .append("&nbsp;<a href='/antman/praiseboard.do?PageNum="); pagingHtml.append(i); pagingHtml.append("'>"); pagingHtml.append(i); pagingHtml.append("</a>"); } pagingHtml.append("&nbsp;"); } pagingHtml.append("&nbsp;&nbsp;|&nbsp;&nbsp;"); // 다음 block 페이지 if (totalPage - startPage >= blockPage) { pagingHtml.append("<a href=/antman/praiseboard.do?PageNum=" + (endPage + 1) + ">"); pagingHtml.append("다음"); pagingHtml.append("</a>"); } } public int getCurrentPage() { return currentPage; } public void setCurrentPage(int currentPage) { this.currentPage = currentPage; } public int getTotalCount() { return totalCount; } public void setTotalCount(int totalCount) { this.totalCount = totalCount; } public int getTotalPage() { return totalPage; } public void setTotalPage(int totalPage) { this.totalPage = totalPage; } public int getBlockCount() { return blockCount; } public void setBlockCount(int blockCount) { this.blockCount = blockCount; } public int getBlockPage() { return blockPage; } public void setBlockPage(int blockPage) { this.blockPage = blockPage; } public int getStartCount() { return startCount; } public void setStartCount(int startCount) { this.startCount = startCount; } public int getEndCount() { return endCount; } public void setEndCount(int endCount) { this.endCount = endCount; } public int getStartPage() { return startPage; } public void setStartPage(int startPage) { this.startPage = startPage; } public int getEndPage() { return endPage; } public void setEndPage(int endPage) { this.endPage = endPage; } public StringBuffer getPagingHtml() { return pagingHtml; } public void setPagingHtml(StringBuffer pagingHtml) { this.pagingHtml = pagingHtml; } }
[ "94cat@naver.com" ]
94cat@naver.com
df6785bf2cb83235476455a99cd4d51cda9a80f3
709ffb56ca435adfe28b4c94b7c690350e8e1765
/src/gui/ReceiveThread.java
2da4faad646455db0ff9afd2e24d92dd085a53f0
[]
no_license
Christopherfer/ChatApp
06fb951a5cbc46748e1d9e3eeff3e0950329be5a
b02443ab6e80a0f2a277926d2580126847493580
refs/heads/master
2016-09-16T15:53:10.473512
2013-08-20T12:33:18
2013-08-20T12:33:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
502
java
package gui; import java.io.IOException; import net.Client; public class ReceiveThread extends Thread { private Client client; private ChatAppWindow chatAppWindow; public ReceiveThread(Client client, ChatAppWindow chatAppWindow){ this.client = client; this.chatAppWindow = chatAppWindow; } @Override public void run(){ try{ while(true){ String words = client.receiveMessage(); chatAppWindow.setTextArea(words); } }catch(IOException e){ e.printStackTrace(); } } }
[ "n4keitaro@gmail.com" ]
n4keitaro@gmail.com
397dff93a8758950f89e8d640b0304b19ecddd19
a1e49f5edd122b211bace752b5fb1bd5c970696b
/projects/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/ConstructorResolver.java
3a769c85d279fcf2f9f600b818f66c75a05a0d69
[ "Apache-2.0" ]
permissive
savster97/springframework-3.0.5
4f86467e2456e5e0652de9f846f0eaefc3214cfa
34cffc70e25233ed97e2ddd24265ea20f5f88957
refs/heads/master
2020-04-26T08:48:34.978350
2019-01-22T14:45:38
2019-01-22T14:45:38
173,434,995
0
0
Apache-2.0
2019-03-02T10:37:13
2019-03-02T10:37:12
null
UTF-8
Java
false
false
34,702
java
/* * Copyright 2002-2010 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.beans.factory.support; import java.beans.ConstructorProperties; import java.lang.reflect.Constructor; import java.lang.reflect.Member; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; import org.springframework.beans.BeanMetadataElement; import org.springframework.beans.BeanWrapper; import org.springframework.beans.BeanWrapperImpl; import org.springframework.beans.BeansException; import org.springframework.beans.TypeConverter; import org.springframework.beans.TypeMismatchException; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.BeanDefinitionStoreException; import org.springframework.beans.factory.UnsatisfiedDependencyException; import org.springframework.beans.factory.config.ConstructorArgumentValues; import org.springframework.beans.factory.config.ConstructorArgumentValues.ValueHolder; import org.springframework.beans.factory.config.DependencyDescriptor; import org.springframework.core.GenericTypeResolver; import org.springframework.core.MethodParameter; import org.springframework.core.ParameterNameDiscoverer; import org.springframework.util.ClassUtils; import org.springframework.util.MethodInvoker; import org.springframework.util.ObjectUtils; import org.springframework.util.ReflectionUtils; import org.springframework.util.StringUtils; /** * Helper class for resolving constructors and factory methods. * Performs constructor resolution through argument matching. * * <p>Operates on an {@link AbstractBeanFactory} and an {@link InstantiationStrategy}. * Used by {@link AbstractAutowireCapableBeanFactory}. * * @author Juergen Hoeller * @author Rob Harrop * @author Mark Fisher * @author Costin Leau * @since 2.0 * @see #autowireConstructor * @see #instantiateUsingFactoryMethod * @see AbstractAutowireCapableBeanFactory */ class ConstructorResolver { private static final String CONSTRUCTOR_PROPERTIES_CLASS_NAME = "java.beans.ConstructorProperties"; private static final boolean constructorPropertiesAnnotationAvailable = ClassUtils.isPresent(CONSTRUCTOR_PROPERTIES_CLASS_NAME, ConstructorResolver.class.getClassLoader()); private final AbstractAutowireCapableBeanFactory beanFactory; /** * Create a new ConstructorResolver for the given factory and instantiation strategy. * @param beanFactory the BeanFactory to work with */ public ConstructorResolver(AbstractAutowireCapableBeanFactory beanFactory) { this.beanFactory = beanFactory; } /** * "autowire constructor" (with constructor arguments by type) behavior. * Also applied if explicit constructor argument values are specified, * matching all remaining arguments with beans from the bean factory. * <p>This corresponds to constructor injection: In this mode, a Spring * bean factory is able to host components that expect constructor-based * dependency resolution. * @param beanName the name of the bean * @param mbd the merged bean definition for the bean * @param chosenCtors chosen candidate constructors (or <code>null</code> if none) * @param explicitArgs argument values passed in programmatically via the getBean method, * or <code>null</code> if none (-> use constructor argument values from bean definition) * @return a BeanWrapper for the new instance */ public BeanWrapper autowireConstructor( final String beanName, final RootBeanDefinition mbd, Constructor[] chosenCtors, final Object[] explicitArgs) { BeanWrapperImpl bw = new BeanWrapperImpl(); this.beanFactory.initBeanWrapper(bw); Constructor constructorToUse = null; ArgumentsHolder argsHolderToUse = null; Object[] argsToUse = null; if (explicitArgs != null) { argsToUse = explicitArgs; } else { Object[] argsToResolve = null; synchronized (mbd.constructorArgumentLock) { constructorToUse = (Constructor) mbd.resolvedConstructorOrFactoryMethod; if (constructorToUse != null && mbd.constructorArgumentsResolved) { // Found a cached constructor... argsToUse = mbd.resolvedConstructorArguments; if (argsToUse == null) { argsToResolve = mbd.preparedConstructorArguments; } } } if (argsToResolve != null) { argsToUse = resolvePreparedArguments(beanName, mbd, bw, constructorToUse, argsToResolve); } } if (constructorToUse == null) { // Need to resolve the constructor. boolean autowiring = (chosenCtors != null || mbd.getResolvedAutowireMode() == RootBeanDefinition.AUTOWIRE_CONSTRUCTOR); ConstructorArgumentValues resolvedValues = null; int minNrOfArgs; if (explicitArgs != null) { minNrOfArgs = explicitArgs.length; } else { ConstructorArgumentValues cargs = mbd.getConstructorArgumentValues(); resolvedValues = new ConstructorArgumentValues(); minNrOfArgs = resolveConstructorArguments(beanName, mbd, bw, cargs, resolvedValues); } // Take specified constructors, if any. Constructor[] candidates = chosenCtors; if (candidates == null) { Class beanClass = mbd.getBeanClass(); try { candidates = (mbd.isNonPublicAccessAllowed() ? beanClass.getDeclaredConstructors() : beanClass.getConstructors()); } catch (Throwable ex) { throw new BeanCreationException(mbd.getResourceDescription(), beanName, "Resolution of declared constructors on bean Class [" + beanClass.getName() + "] from ClassLoader [" + beanClass.getClassLoader() + "] failed", ex); } } AutowireUtils.sortConstructors(candidates); int minTypeDiffWeight = Integer.MAX_VALUE; Set<Constructor> ambiguousConstructors = null; List<Exception> causes = null; for (int i = 0; i < candidates.length; i++) { Constructor<?> candidate = candidates[i]; Class[] paramTypes = candidate.getParameterTypes(); if (constructorToUse != null && argsToUse.length > paramTypes.length) { // Already found greedy constructor that can be satisfied -> // do not look any further, there are only less greedy constructors left. break; } if (paramTypes.length < minNrOfArgs) { continue; } ArgumentsHolder argsHolder; if (resolvedValues != null) { try { String[] paramNames = null; if (constructorPropertiesAnnotationAvailable) { paramNames = ConstructorPropertiesChecker.evaluateAnnotation(candidate, paramTypes.length); } if (paramNames == null) { ParameterNameDiscoverer pnd = this.beanFactory.getParameterNameDiscoverer(); if (pnd != null) { paramNames = pnd.getParameterNames(candidate); } } argsHolder = createArgumentArray( beanName, mbd, resolvedValues, bw, paramTypes, paramNames, candidate, autowiring); } catch (UnsatisfiedDependencyException ex) { if (this.beanFactory.logger.isTraceEnabled()) { this.beanFactory.logger.trace( "Ignoring constructor [" + candidate + "] of bean '" + beanName + "': " + ex); } if (i == candidates.length - 1 && constructorToUse == null) { if (causes != null) { for (Exception cause : causes) { this.beanFactory.onSuppressedException(cause); } } throw ex; } else { // Swallow and try next constructor. if (causes == null) { causes = new LinkedList<Exception>(); } causes.add(ex); continue; } } } else { // Explicit arguments given -> arguments length must match exactly. if (paramTypes.length != explicitArgs.length) { continue; } argsHolder = new ArgumentsHolder(explicitArgs); } int typeDiffWeight = (mbd.isLenientConstructorResolution() ? argsHolder.getTypeDifferenceWeight(paramTypes) : argsHolder.getAssignabilityWeight(paramTypes)); // Choose this constructor if it represents the closest match. if (typeDiffWeight < minTypeDiffWeight) { constructorToUse = candidate; argsHolderToUse = argsHolder; argsToUse = argsHolder.arguments; minTypeDiffWeight = typeDiffWeight; ambiguousConstructors = null; } else if (constructorToUse != null && typeDiffWeight == minTypeDiffWeight) { if (ambiguousConstructors == null) { ambiguousConstructors = new LinkedHashSet<Constructor>(); ambiguousConstructors.add(constructorToUse); } ambiguousConstructors.add(candidate); } } if (constructorToUse == null) { throw new BeanCreationException(mbd.getResourceDescription(), beanName, "Could not resolve matching constructor " + "(hint: specify index/type/name arguments for simple parameters to avoid type ambiguities)"); } else if (ambiguousConstructors != null && !mbd.isLenientConstructorResolution()) { throw new BeanCreationException(mbd.getResourceDescription(), beanName, "Ambiguous constructor matches found in bean '" + beanName + "' " + "(hint: specify index/type/name arguments for simple parameters to avoid type ambiguities): " + ambiguousConstructors); } if (explicitArgs == null) { argsHolderToUse.storeCache(mbd, constructorToUse); } } try { Object beanInstance; if (System.getSecurityManager() != null) { final Constructor ctorToUse = constructorToUse; final Object[] argumentsToUse = argsToUse; beanInstance = AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { return beanFactory.getInstantiationStrategy().instantiate( mbd, beanName, beanFactory, ctorToUse, argumentsToUse); } }, beanFactory.getAccessControlContext()); } else { beanInstance = this.beanFactory.getInstantiationStrategy().instantiate( mbd, beanName, this.beanFactory, constructorToUse, argsToUse); } bw.setWrappedInstance(beanInstance); return bw; } catch (Throwable ex) { throw new BeanCreationException(mbd.getResourceDescription(), beanName, "Instantiation of bean failed", ex); } } /** * Resolve the factory method in the specified bean definition, if possible. * {@link RootBeanDefinition#getResolvedFactoryMethod()} can be checked for the result. * @param mbd the bean definition to check */ public void resolveFactoryMethodIfPossible(RootBeanDefinition mbd) { Class factoryClass; if (mbd.getFactoryBeanName() != null) { factoryClass = this.beanFactory.getType(mbd.getFactoryBeanName()); } else { factoryClass = mbd.getBeanClass(); } factoryClass = ClassUtils.getUserClass(factoryClass); Method[] candidates = ReflectionUtils.getAllDeclaredMethods(factoryClass); Method uniqueCandidate = null; for (Method candidate : candidates) { if (mbd.isFactoryMethod(candidate)) { if (uniqueCandidate == null) { uniqueCandidate = candidate; } else if (!Arrays.equals(uniqueCandidate.getParameterTypes(), candidate.getParameterTypes())) { uniqueCandidate = null; break; } } } synchronized (mbd.constructorArgumentLock) { mbd.resolvedConstructorOrFactoryMethod = uniqueCandidate; } } /** * Instantiate the bean using a named factory method. The method may be static, if the * bean definition parameter specifies a class, rather than a "factory-bean", or * an instance variable on a factory object itself configured using Dependency Injection. * <p>Implementation requires iterating over the static or instance methods with the * name specified in the RootBeanDefinition (the method may be overloaded) and trying * to match with the parameters. We don't have the types attached to constructor args, * so trial and error is the only way to go here. The explicitArgs array may contain * argument values passed in programmatically via the corresponding getBean method. * @param beanName the name of the bean * @param mbd the merged bean definition for the bean * @param explicitArgs argument values passed in programmatically via the getBean * method, or <code>null</code> if none (-> use constructor argument values from bean definition) * @return a BeanWrapper for the new instance */ public BeanWrapper instantiateUsingFactoryMethod(final String beanName, final RootBeanDefinition mbd, final Object[] explicitArgs) { BeanWrapperImpl bw = new BeanWrapperImpl(); this.beanFactory.initBeanWrapper(bw); Object factoryBean; Class factoryClass; boolean isStatic; String factoryBeanName = mbd.getFactoryBeanName(); if (factoryBeanName != null) { if (factoryBeanName.equals(beanName)) { throw new BeanDefinitionStoreException(mbd.getResourceDescription(), beanName, "factory-bean reference points back to the same bean definition"); } factoryBean = this.beanFactory.getBean(factoryBeanName); if (factoryBean == null) { throw new BeanCreationException(mbd.getResourceDescription(), beanName, "factory-bean '" + factoryBeanName + "' returned null"); } factoryClass = factoryBean.getClass(); isStatic = false; } else { // It's a static factory method on the bean class. if (!mbd.hasBeanClass()) { throw new BeanDefinitionStoreException(mbd.getResourceDescription(), beanName, "bean definition declares neither a bean class nor a factory-bean reference"); } factoryBean = null; factoryClass = mbd.getBeanClass(); isStatic = true; } Method factoryMethodToUse = null; ArgumentsHolder argsHolderToUse = null; Object[] argsToUse = null; if (explicitArgs != null) { argsToUse = explicitArgs; } else { Object[] argsToResolve = null; synchronized (mbd.constructorArgumentLock) { factoryMethodToUse = (Method) mbd.resolvedConstructorOrFactoryMethod; if (factoryMethodToUse != null && mbd.constructorArgumentsResolved) { // Found a cached factory method... argsToUse = mbd.resolvedConstructorArguments; if (argsToUse == null) { argsToResolve = mbd.preparedConstructorArguments; } } } if (argsToResolve != null) { argsToUse = resolvePreparedArguments(beanName, mbd, bw, factoryMethodToUse, argsToResolve); } } if (factoryMethodToUse == null || argsToUse == null) { // Need to determine the factory method... // Try all methods with this name to see if they match the given arguments. factoryClass = ClassUtils.getUserClass(factoryClass); Method[] rawCandidates; final Class factoryClazz = factoryClass; if (System.getSecurityManager() != null) { rawCandidates = AccessController.doPrivileged(new PrivilegedAction<Method[]>() { public Method[] run() { return (mbd.isNonPublicAccessAllowed() ? ReflectionUtils.getAllDeclaredMethods(factoryClazz) : factoryClazz.getMethods()); } }); } else { rawCandidates = (mbd.isNonPublicAccessAllowed() ? ReflectionUtils.getAllDeclaredMethods(factoryClazz) : factoryClazz.getMethods()); } List<Method> candidateSet = new ArrayList<Method>(); for (Method candidate : rawCandidates) { if (Modifier.isStatic(candidate.getModifiers()) == isStatic && candidate.getName().equals(mbd.getFactoryMethodName()) && mbd.isFactoryMethod(candidate)) { candidateSet.add(candidate); } } Method[] candidates = candidateSet.toArray(new Method[candidateSet.size()]); AutowireUtils.sortFactoryMethods(candidates); ConstructorArgumentValues resolvedValues = null; boolean autowiring = (mbd.getResolvedAutowireMode() == RootBeanDefinition.AUTOWIRE_CONSTRUCTOR); int minTypeDiffWeight = Integer.MAX_VALUE; Set<Method> ambiguousFactoryMethods = null; int minNrOfArgs; if (explicitArgs != null) { minNrOfArgs = explicitArgs.length; } else { // We don't have arguments passed in programmatically, so we need to resolve the // arguments specified in the constructor arguments held in the bean definition. ConstructorArgumentValues cargs = mbd.getConstructorArgumentValues(); resolvedValues = new ConstructorArgumentValues(); minNrOfArgs = resolveConstructorArguments(beanName, mbd, bw, cargs, resolvedValues); } List<Exception> causes = null; for (int i = 0; i < candidates.length; i++) { Method candidate = candidates[i]; Class[] paramTypes = candidate.getParameterTypes(); if (paramTypes.length >= minNrOfArgs) { ArgumentsHolder argsHolder; if (resolvedValues != null) { // Resolved constructor arguments: type conversion and/or autowiring necessary. try { String[] paramNames = null; ParameterNameDiscoverer pnd = this.beanFactory.getParameterNameDiscoverer(); if (pnd != null) { paramNames = pnd.getParameterNames(candidate); } argsHolder = createArgumentArray( beanName, mbd, resolvedValues, bw, paramTypes, paramNames, candidate, autowiring); } catch (UnsatisfiedDependencyException ex) { if (this.beanFactory.logger.isTraceEnabled()) { this.beanFactory.logger.trace("Ignoring factory method [" + candidate + "] of bean '" + beanName + "': " + ex); } if (i == candidates.length - 1 && argsHolderToUse == null) { if (causes != null) { for (Exception cause : causes) { this.beanFactory.onSuppressedException(cause); } } throw ex; } else { // Swallow and try next overloaded factory method. if (causes == null) { causes = new LinkedList<Exception>(); } causes.add(ex); continue; } } } else { // Explicit arguments given -> arguments length must match exactly. if (paramTypes.length != explicitArgs.length) { continue; } argsHolder = new ArgumentsHolder(explicitArgs); } int typeDiffWeight = (mbd.isLenientConstructorResolution() ? argsHolder.getTypeDifferenceWeight(paramTypes) : argsHolder.getAssignabilityWeight(paramTypes)); // Choose this factory method if it represents the closest match. if (typeDiffWeight < minTypeDiffWeight) { factoryMethodToUse = candidate; argsHolderToUse = argsHolder; argsToUse = argsHolder.arguments; minTypeDiffWeight = typeDiffWeight; ambiguousFactoryMethods = null; } else if (factoryMethodToUse != null && typeDiffWeight == minTypeDiffWeight) { if (ambiguousFactoryMethods == null) { ambiguousFactoryMethods = new LinkedHashSet<Method>(); ambiguousFactoryMethods.add(factoryMethodToUse); } ambiguousFactoryMethods.add(candidate); } } } if (factoryMethodToUse == null) { boolean hasArgs = (resolvedValues.getArgumentCount() > 0); String argDesc = ""; if (hasArgs) { List<String> argTypes = new ArrayList<String>(); for (ValueHolder value : resolvedValues.getIndexedArgumentValues().values()) { String argType = (value.getType() != null ? ClassUtils.getShortName(value.getType()) : value.getValue().getClass().getSimpleName()); argTypes.add(argType); } argDesc = StringUtils.collectionToCommaDelimitedString(argTypes); } throw new BeanCreationException(mbd.getResourceDescription(), beanName, "No matching factory method found: " + (mbd.getFactoryBeanName() != null ? "factory bean '" + mbd.getFactoryBeanName() + "'; " : "") + "factory method '" + mbd.getFactoryMethodName() + "(" + argDesc + ")'. " + "Check that a method with the specified name " + (hasArgs ? "and arguments " : "") + "exists and that it is " + (isStatic ? "static" : "non-static") + "."); } else if (void.class.equals(factoryMethodToUse.getReturnType())) { throw new BeanCreationException(mbd.getResourceDescription(), beanName, "Invalid factory method '" + mbd.getFactoryMethodName() + "': needs to have a non-void return type!"); } else if (ambiguousFactoryMethods != null && !mbd.isLenientConstructorResolution()) { throw new BeanCreationException(mbd.getResourceDescription(), beanName, "Ambiguous factory method matches found in bean '" + beanName + "' " + "(hint: specify index/type/name arguments for simple parameters to avoid type ambiguities): " + ambiguousFactoryMethods); } if (explicitArgs == null && argsHolderToUse != null) { argsHolderToUse.storeCache(mbd, factoryMethodToUse); } } try { Object beanInstance; if (System.getSecurityManager() != null) { final Object fb = factoryBean; final Method factoryMethod = factoryMethodToUse; final Object[] args = argsToUse; beanInstance = AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { return beanFactory.getInstantiationStrategy().instantiate( mbd, beanName, beanFactory, fb, factoryMethod, args); } }, beanFactory.getAccessControlContext()); } else { beanInstance = beanFactory.getInstantiationStrategy().instantiate( mbd, beanName, beanFactory, factoryBean, factoryMethodToUse, argsToUse); } if (beanInstance == null) { return null; } bw.setWrappedInstance(beanInstance); return bw; } catch (Throwable ex) { throw new BeanCreationException(mbd.getResourceDescription(), beanName, "Instantiation of bean failed", ex); } } /** * Resolve the constructor arguments for this bean into the resolvedValues object. * This may involve looking up other beans. * This method is also used for handling invocations of static factory methods. */ private int resolveConstructorArguments( String beanName, RootBeanDefinition mbd, BeanWrapper bw, ConstructorArgumentValues cargs, ConstructorArgumentValues resolvedValues) { TypeConverter converter = (this.beanFactory.getCustomTypeConverter() != null ? this.beanFactory.getCustomTypeConverter() : bw); BeanDefinitionValueResolver valueResolver = new BeanDefinitionValueResolver(this.beanFactory, beanName, mbd, converter); int minNrOfArgs = cargs.getArgumentCount(); for (Map.Entry<Integer, ConstructorArgumentValues.ValueHolder> entry : cargs.getIndexedArgumentValues().entrySet()) { int index = entry.getKey(); if (index < 0) { throw new BeanCreationException(mbd.getResourceDescription(), beanName, "Invalid constructor argument index: " + index); } if (index > minNrOfArgs) { minNrOfArgs = index + 1; } ConstructorArgumentValues.ValueHolder valueHolder = entry.getValue(); if (valueHolder.isConverted()) { resolvedValues.addIndexedArgumentValue(index, valueHolder); } else { Object resolvedValue = valueResolver.resolveValueIfNecessary("constructor argument", valueHolder.getValue()); ConstructorArgumentValues.ValueHolder resolvedValueHolder = new ConstructorArgumentValues.ValueHolder(resolvedValue, valueHolder.getType(), valueHolder.getName()); resolvedValueHolder.setSource(valueHolder); resolvedValues.addIndexedArgumentValue(index, resolvedValueHolder); } } for (ConstructorArgumentValues.ValueHolder valueHolder : cargs.getGenericArgumentValues()) { if (valueHolder.isConverted()) { resolvedValues.addGenericArgumentValue(valueHolder); } else { Object resolvedValue = valueResolver.resolveValueIfNecessary("constructor argument", valueHolder.getValue()); ConstructorArgumentValues.ValueHolder resolvedValueHolder = new ConstructorArgumentValues.ValueHolder(resolvedValue, valueHolder.getType(), valueHolder.getName()); resolvedValueHolder.setSource(valueHolder); resolvedValues.addGenericArgumentValue(resolvedValueHolder); } } return minNrOfArgs; } /** * Create an array of arguments to invoke a constructor or factory method, * given the resolved constructor argument values. */ private ArgumentsHolder createArgumentArray( String beanName, RootBeanDefinition mbd, ConstructorArgumentValues resolvedValues, BeanWrapper bw, Class[] paramTypes, String[] paramNames, Object methodOrCtor, boolean autowiring) throws UnsatisfiedDependencyException { String methodType = (methodOrCtor instanceof Constructor ? "constructor" : "factory method"); TypeConverter converter = (this.beanFactory.getCustomTypeConverter() != null ? this.beanFactory.getCustomTypeConverter() : bw); ArgumentsHolder args = new ArgumentsHolder(paramTypes.length); Set<ConstructorArgumentValues.ValueHolder> usedValueHolders = new HashSet<ConstructorArgumentValues.ValueHolder>(paramTypes.length); Set<String> autowiredBeanNames = new LinkedHashSet<String>(4); for (int paramIndex = 0; paramIndex < paramTypes.length; paramIndex++) { Class<?> paramType = paramTypes[paramIndex]; String paramName = (paramNames != null ? paramNames[paramIndex] : null); // Try to find matching constructor argument value, either indexed or generic. ConstructorArgumentValues.ValueHolder valueHolder = resolvedValues.getArgumentValue(paramIndex, paramType, paramName, usedValueHolders); // If we couldn't find a direct match and are not supposed to autowire, // let's try the next generic, untyped argument value as fallback: // it could match after type conversion (for example, String -> int). if (valueHolder == null && !autowiring) { valueHolder = resolvedValues.getGenericArgumentValue(null, null, usedValueHolders); } if (valueHolder != null) { // We found a potential match - let's give it a try. // Do not consider the same value definition multiple times! usedValueHolders.add(valueHolder); Object originalValue = valueHolder.getValue(); Object convertedValue; if (valueHolder.isConverted()) { convertedValue = valueHolder.getConvertedValue(); args.preparedArguments[paramIndex] = convertedValue; } else { ConstructorArgumentValues.ValueHolder sourceHolder = (ConstructorArgumentValues.ValueHolder) valueHolder.getSource(); Object sourceValue = sourceHolder.getValue(); try { convertedValue = converter.convertIfNecessary(originalValue, paramType, MethodParameter.forMethodOrConstructor(methodOrCtor, paramIndex)); // TODO re-enable once race condition has been found (SPR-7423) /* if (originalValue == sourceValue || sourceValue instanceof TypedStringValue) { // Either a converted value or still the original one: store converted value. sourceHolder.setConvertedValue(convertedValue); args.preparedArguments[paramIndex] = convertedValue; } else { */ args.resolveNecessary = true; args.preparedArguments[paramIndex] = sourceValue; // } } catch (TypeMismatchException ex) { throw new UnsatisfiedDependencyException( mbd.getResourceDescription(), beanName, paramIndex, paramType, "Could not convert " + methodType + " argument value of type [" + ObjectUtils.nullSafeClassName(valueHolder.getValue()) + "] to required type [" + paramType.getName() + "]: " + ex.getMessage()); } } args.arguments[paramIndex] = convertedValue; args.rawArguments[paramIndex] = originalValue; } else { // No explicit match found: we're either supposed to autowire or // have to fail creating an argument array for the given constructor. if (!autowiring) { throw new UnsatisfiedDependencyException( mbd.getResourceDescription(), beanName, paramIndex, paramType, "Ambiguous " + methodType + " argument types - " + "did you specify the correct bean references as " + methodType + " arguments?"); } try { MethodParameter param = MethodParameter.forMethodOrConstructor(methodOrCtor, paramIndex); Object autowiredArgument = resolveAutowiredArgument(param, beanName, autowiredBeanNames, converter); args.rawArguments[paramIndex] = autowiredArgument; args.arguments[paramIndex] = autowiredArgument; args.preparedArguments[paramIndex] = new AutowiredArgumentMarker(); args.resolveNecessary = true; } catch (BeansException ex) { throw new UnsatisfiedDependencyException( mbd.getResourceDescription(), beanName, paramIndex, paramType, ex); } } } for (String autowiredBeanName : autowiredBeanNames) { this.beanFactory.registerDependentBean(autowiredBeanName, beanName); if (this.beanFactory.logger.isDebugEnabled()) { this.beanFactory.logger.debug("Autowiring by type from bean name '" + beanName + "' via " + methodType + " to bean named '" + autowiredBeanName + "'"); } } return args; } /** * Resolve the prepared arguments stored in the given bean definition. */ private Object[] resolvePreparedArguments( String beanName, RootBeanDefinition mbd, BeanWrapper bw, Member methodOrCtor, Object[] argsToResolve) { Class[] paramTypes = (methodOrCtor instanceof Method ? ((Method) methodOrCtor).getParameterTypes() : ((Constructor) methodOrCtor).getParameterTypes()); TypeConverter converter = (this.beanFactory.getCustomTypeConverter() != null ? this.beanFactory.getCustomTypeConverter() : bw); BeanDefinitionValueResolver valueResolver = new BeanDefinitionValueResolver(this.beanFactory, beanName, mbd, converter); Object[] resolvedArgs = new Object[argsToResolve.length]; for (int argIndex = 0; argIndex < argsToResolve.length; argIndex++) { Object argValue = argsToResolve[argIndex]; MethodParameter methodParam = MethodParameter.forMethodOrConstructor(methodOrCtor, argIndex); GenericTypeResolver.resolveParameterType(methodParam, methodOrCtor.getDeclaringClass()); if (argValue instanceof AutowiredArgumentMarker) { argValue = resolveAutowiredArgument(methodParam, beanName, null, converter); } else if (argValue instanceof BeanMetadataElement) { argValue = valueResolver.resolveValueIfNecessary("constructor argument", argValue); } else if (argValue instanceof String) { argValue = this.beanFactory.evaluateBeanDefinitionString((String) argValue, mbd); } Class<?> paramType = paramTypes[argIndex]; try { resolvedArgs[argIndex] = converter.convertIfNecessary(argValue, paramType, methodParam); } catch (TypeMismatchException ex) { String methodType = (methodOrCtor instanceof Constructor ? "constructor" : "factory method"); throw new UnsatisfiedDependencyException( mbd.getResourceDescription(), beanName, argIndex, paramType, "Could not convert " + methodType + " argument value of type [" + ObjectUtils.nullSafeClassName(argValue) + "] to required type [" + paramType.getName() + "]: " + ex.getMessage()); } } return resolvedArgs; } /** * Template method for resolving the specified argument which is supposed to be autowired. */ protected Object resolveAutowiredArgument( MethodParameter param, String beanName, Set<String> autowiredBeanNames, TypeConverter typeConverter) { return this.beanFactory.resolveDependency( new DependencyDescriptor(param, true), beanName, autowiredBeanNames, typeConverter); } /** * Private inner class for holding argument combinations. */ private static class ArgumentsHolder { public final Object rawArguments[]; public final Object arguments[]; public final Object preparedArguments[]; public boolean resolveNecessary = false; public ArgumentsHolder(int size) { this.rawArguments = new Object[size]; this.arguments = new Object[size]; this.preparedArguments = new Object[size]; } public ArgumentsHolder(Object[] args) { this.rawArguments = args; this.arguments = args; this.preparedArguments = args; } public int getTypeDifferenceWeight(Class[] paramTypes) { // If valid arguments found, determine type difference weight. // Try type difference weight on both the converted arguments and // the raw arguments. If the raw weight is better, use it. // Decrease raw weight by 1024 to prefer it over equal converted weight. int typeDiffWeight = MethodInvoker.getTypeDifferenceWeight(paramTypes, this.arguments); int rawTypeDiffWeight = MethodInvoker.getTypeDifferenceWeight(paramTypes, this.rawArguments) - 1024; return (rawTypeDiffWeight < typeDiffWeight ? rawTypeDiffWeight : typeDiffWeight); } public int getAssignabilityWeight(Class[] paramTypes) { for (int i = 0; i < paramTypes.length; i++) { if (!ClassUtils.isAssignableValue(paramTypes[i], this.arguments[i])) { return Integer.MAX_VALUE; } } for (int i = 0; i < paramTypes.length; i++) { if (!ClassUtils.isAssignableValue(paramTypes[i], this.rawArguments[i])) { return Integer.MAX_VALUE - 512; } } return Integer.MAX_VALUE - 1024; } public void storeCache(RootBeanDefinition mbd, Object constructorOrFactoryMethod) { synchronized (mbd.constructorArgumentLock) { mbd.resolvedConstructorOrFactoryMethod = constructorOrFactoryMethod; mbd.constructorArgumentsResolved = true; if (this.resolveNecessary) { mbd.preparedConstructorArguments = this.preparedArguments; } else { mbd.resolvedConstructorArguments = this.arguments; } } } } /** * Marker for autowired arguments in a cached argument array. */ private static class AutowiredArgumentMarker { } /** * Inner class to avoid a Java 6 dependency. */ private static class ConstructorPropertiesChecker { public static String[] evaluateAnnotation(Constructor<?> candidate, int paramCount) { ConstructorProperties cp = candidate.getAnnotation(ConstructorProperties.class); if (cp != null) { String[] names = cp.value(); if (names.length != paramCount) { throw new IllegalStateException("Constructor annotated with @ConstructorProperties but not " + "corresponding to actual number of parameters (" + paramCount + "): " + candidate); } return names; } else { return null; } } } }
[ "taibi@sonar-scheduler.rd.tut.fi" ]
taibi@sonar-scheduler.rd.tut.fi
af34709d7692df42a6e2418bda2f006c43e94ac8
950cde9a5c6ff2249618fa4e638ba14ba4a1ecd9
/target/generated-sources/annotations/memstore/benchmarks/generated/PredicatedAllColumnsSumBench_testColumnTable_jmhTest.java
6e536e72cf16bc79cac8caacdac4f2afce8ee89a
[ "Apache-2.0" ]
permissive
Zaidnabulsi/cs245-as1
027a3547ec8dea2717a347963762be102bfca590
d0a10ed11e797913ae314d533a1b8d685c41e295
refs/heads/master
2020-12-22T04:11:58.652975
2020-01-30T03:07:20
2020-01-30T03:07:20
236,666,488
1
0
Apache-2.0
2020-01-28T05:38:44
2020-01-28T05:38:44
null
UTF-8
Java
false
false
17,720
java
package memstore.benchmarks.generated; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import java.util.Collection; import java.util.ArrayList; import java.util.concurrent.TimeUnit; import org.openjdk.jmh.annotations.CompilerControl; import org.openjdk.jmh.runner.InfraControl; import org.openjdk.jmh.infra.ThreadParams; import org.openjdk.jmh.results.BenchmarkTaskResult; import org.openjdk.jmh.results.Result; import org.openjdk.jmh.results.ThroughputResult; import org.openjdk.jmh.results.AverageTimeResult; import org.openjdk.jmh.results.SampleTimeResult; import org.openjdk.jmh.results.SingleShotResult; import org.openjdk.jmh.util.SampleBuffer; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.results.RawResults; import org.openjdk.jmh.results.ResultRole; import java.lang.reflect.Field; import org.openjdk.jmh.infra.BenchmarkParams; import org.openjdk.jmh.infra.IterationParams; import org.openjdk.jmh.infra.Blackhole; import org.openjdk.jmh.infra.Control; import org.openjdk.jmh.results.ScalarResult; import org.openjdk.jmh.results.AggregationPolicy; import org.openjdk.jmh.runner.FailureAssistException; import memstore.benchmarks.generated.PredicatedAllColumnsSumBench_jmhType; public final class PredicatedAllColumnsSumBench_testColumnTable_jmhTest { boolean p000, p001, p002, p003, p004, p005, p006, p007, p008, p009, p010, p011, p012, p013, p014, p015; boolean p016, p017, p018, p019, p020, p021, p022, p023, p024, p025, p026, p027, p028, p029, p030, p031; boolean p032, p033, p034, p035, p036, p037, p038, p039, p040, p041, p042, p043, p044, p045, p046, p047; boolean p048, p049, p050, p051, p052, p053, p054, p055, p056, p057, p058, p059, p060, p061, p062, p063; boolean p064, p065, p066, p067, p068, p069, p070, p071, p072, p073, p074, p075, p076, p077, p078, p079; boolean p080, p081, p082, p083, p084, p085, p086, p087, p088, p089, p090, p091, p092, p093, p094, p095; boolean p096, p097, p098, p099, p100, p101, p102, p103, p104, p105, p106, p107, p108, p109, p110, p111; boolean p112, p113, p114, p115, p116, p117, p118, p119, p120, p121, p122, p123, p124, p125, p126, p127; boolean p128, p129, p130, p131, p132, p133, p134, p135, p136, p137, p138, p139, p140, p141, p142, p143; boolean p144, p145, p146, p147, p148, p149, p150, p151, p152, p153, p154, p155, p156, p157, p158, p159; boolean p160, p161, p162, p163, p164, p165, p166, p167, p168, p169, p170, p171, p172, p173, p174, p175; boolean p176, p177, p178, p179, p180, p181, p182, p183, p184, p185, p186, p187, p188, p189, p190, p191; boolean p192, p193, p194, p195, p196, p197, p198, p199, p200, p201, p202, p203, p204, p205, p206, p207; boolean p208, p209, p210, p211, p212, p213, p214, p215, p216, p217, p218, p219, p220, p221, p222, p223; boolean p224, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239; boolean p240, p241, p242, p243, p244, p245, p246, p247, p248, p249, p250, p251, p252, p253, p254, p255; int startRndMask; BenchmarkParams benchmarkParams; IterationParams iterationParams; ThreadParams threadParams; Blackhole blackhole; Control notifyControl; public BenchmarkTaskResult testColumnTable_Throughput(InfraControl control, ThreadParams threadParams) throws Throwable { this.benchmarkParams = control.benchmarkParams; this.iterationParams = control.iterationParams; this.threadParams = threadParams; this.notifyControl = control.notifyControl; if (this.blackhole == null) { this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous."); } if (threadParams.getSubgroupIndex() == 0) { RawResults res = new RawResults(); PredicatedAllColumnsSumBench_jmhType l_predicatedallcolumnssumbench0_0 = _jmh_tryInit_f_predicatedallcolumnssumbench0_0(control); control.preSetup(); control.announceWarmupReady(); while (control.warmupShouldWait) { blackhole.consume(l_predicatedallcolumnssumbench0_0.testColumnTable()); res.allOps++; } notifyControl.startMeasurement = true; testColumnTable_thrpt_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, l_predicatedallcolumnssumbench0_0); notifyControl.stopMeasurement = true; control.announceWarmdownReady(); try { while (control.warmdownShouldWait) { blackhole.consume(l_predicatedallcolumnssumbench0_0.testColumnTable()); res.allOps++; } control.preTearDown(); } catch (InterruptedException ie) { control.preTearDownForce(); } if (control.isLastIteration()) { f_predicatedallcolumnssumbench0_0 = null; } res.allOps += res.measuredOps; int batchSize = iterationParams.getBatchSize(); int opsPerInv = benchmarkParams.getOpsPerInvocation(); res.allOps *= opsPerInv; res.allOps /= batchSize; res.measuredOps *= opsPerInv; res.measuredOps /= batchSize; BenchmarkTaskResult results = new BenchmarkTaskResult(res.allOps, res.measuredOps); results.add(new ThroughputResult(ResultRole.PRIMARY, "testColumnTable", res.measuredOps, res.getTime(), benchmarkParams.getTimeUnit())); this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes."); return results; } else throw new IllegalStateException("Harness failed to distribute threads among groups properly"); } public static void testColumnTable_thrpt_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, PredicatedAllColumnsSumBench_jmhType l_predicatedallcolumnssumbench0_0) throws Throwable { long operations = 0; long realTime = 0; result.startTime = System.nanoTime(); do { blackhole.consume(l_predicatedallcolumnssumbench0_0.testColumnTable()); operations++; } while(!control.isDone); result.stopTime = System.nanoTime(); result.realTime = realTime; result.measuredOps = operations; } public BenchmarkTaskResult testColumnTable_AverageTime(InfraControl control, ThreadParams threadParams) throws Throwable { this.benchmarkParams = control.benchmarkParams; this.iterationParams = control.iterationParams; this.threadParams = threadParams; this.notifyControl = control.notifyControl; if (this.blackhole == null) { this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous."); } if (threadParams.getSubgroupIndex() == 0) { RawResults res = new RawResults(); PredicatedAllColumnsSumBench_jmhType l_predicatedallcolumnssumbench0_0 = _jmh_tryInit_f_predicatedallcolumnssumbench0_0(control); control.preSetup(); control.announceWarmupReady(); while (control.warmupShouldWait) { blackhole.consume(l_predicatedallcolumnssumbench0_0.testColumnTable()); res.allOps++; } notifyControl.startMeasurement = true; testColumnTable_avgt_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, l_predicatedallcolumnssumbench0_0); notifyControl.stopMeasurement = true; control.announceWarmdownReady(); try { while (control.warmdownShouldWait) { blackhole.consume(l_predicatedallcolumnssumbench0_0.testColumnTable()); res.allOps++; } control.preTearDown(); } catch (InterruptedException ie) { control.preTearDownForce(); } if (control.isLastIteration()) { f_predicatedallcolumnssumbench0_0 = null; } res.allOps += res.measuredOps; int batchSize = iterationParams.getBatchSize(); int opsPerInv = benchmarkParams.getOpsPerInvocation(); res.allOps *= opsPerInv; res.allOps /= batchSize; res.measuredOps *= opsPerInv; res.measuredOps /= batchSize; BenchmarkTaskResult results = new BenchmarkTaskResult(res.allOps, res.measuredOps); results.add(new AverageTimeResult(ResultRole.PRIMARY, "testColumnTable", res.measuredOps, res.getTime(), benchmarkParams.getTimeUnit())); this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes."); return results; } else throw new IllegalStateException("Harness failed to distribute threads among groups properly"); } public static void testColumnTable_avgt_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, PredicatedAllColumnsSumBench_jmhType l_predicatedallcolumnssumbench0_0) throws Throwable { long operations = 0; long realTime = 0; result.startTime = System.nanoTime(); do { blackhole.consume(l_predicatedallcolumnssumbench0_0.testColumnTable()); operations++; } while(!control.isDone); result.stopTime = System.nanoTime(); result.realTime = realTime; result.measuredOps = operations; } public BenchmarkTaskResult testColumnTable_SampleTime(InfraControl control, ThreadParams threadParams) throws Throwable { this.benchmarkParams = control.benchmarkParams; this.iterationParams = control.iterationParams; this.threadParams = threadParams; this.notifyControl = control.notifyControl; if (this.blackhole == null) { this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous."); } if (threadParams.getSubgroupIndex() == 0) { RawResults res = new RawResults(); PredicatedAllColumnsSumBench_jmhType l_predicatedallcolumnssumbench0_0 = _jmh_tryInit_f_predicatedallcolumnssumbench0_0(control); control.preSetup(); control.announceWarmupReady(); while (control.warmupShouldWait) { blackhole.consume(l_predicatedallcolumnssumbench0_0.testColumnTable()); res.allOps++; } notifyControl.startMeasurement = true; int targetSamples = (int) (control.getDuration(TimeUnit.MILLISECONDS) * 20); // at max, 20 timestamps per millisecond int batchSize = iterationParams.getBatchSize(); int opsPerInv = benchmarkParams.getOpsPerInvocation(); SampleBuffer buffer = new SampleBuffer(); testColumnTable_sample_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, buffer, targetSamples, opsPerInv, batchSize, l_predicatedallcolumnssumbench0_0); notifyControl.stopMeasurement = true; control.announceWarmdownReady(); try { while (control.warmdownShouldWait) { blackhole.consume(l_predicatedallcolumnssumbench0_0.testColumnTable()); res.allOps++; } control.preTearDown(); } catch (InterruptedException ie) { control.preTearDownForce(); } if (control.isLastIteration()) { f_predicatedallcolumnssumbench0_0 = null; } res.allOps += res.measuredOps * batchSize; res.allOps *= opsPerInv; res.allOps /= batchSize; res.measuredOps *= opsPerInv; BenchmarkTaskResult results = new BenchmarkTaskResult(res.allOps, res.measuredOps); results.add(new SampleTimeResult(ResultRole.PRIMARY, "testColumnTable", buffer, benchmarkParams.getTimeUnit())); this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes."); return results; } else throw new IllegalStateException("Harness failed to distribute threads among groups properly"); } public static void testColumnTable_sample_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, SampleBuffer buffer, int targetSamples, long opsPerInv, int batchSize, PredicatedAllColumnsSumBench_jmhType l_predicatedallcolumnssumbench0_0) throws Throwable { long realTime = 0; long operations = 0; int rnd = (int)System.nanoTime(); int rndMask = startRndMask; long time = 0; int currentStride = 0; do { rnd = (rnd * 1664525 + 1013904223); boolean sample = (rnd & rndMask) == 0; if (sample) { time = System.nanoTime(); } for (int b = 0; b < batchSize; b++) { if (control.volatileSpoiler) return; blackhole.consume(l_predicatedallcolumnssumbench0_0.testColumnTable()); } if (sample) { buffer.add((System.nanoTime() - time) / opsPerInv); if (currentStride++ > targetSamples) { buffer.half(); currentStride = 0; rndMask = (rndMask << 1) + 1; } } operations++; } while(!control.isDone); startRndMask = Math.max(startRndMask, rndMask); result.realTime = realTime; result.measuredOps = operations; } public BenchmarkTaskResult testColumnTable_SingleShotTime(InfraControl control, ThreadParams threadParams) throws Throwable { this.benchmarkParams = control.benchmarkParams; this.iterationParams = control.iterationParams; this.threadParams = threadParams; this.notifyControl = control.notifyControl; if (this.blackhole == null) { this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous."); } if (threadParams.getSubgroupIndex() == 0) { PredicatedAllColumnsSumBench_jmhType l_predicatedallcolumnssumbench0_0 = _jmh_tryInit_f_predicatedallcolumnssumbench0_0(control); control.preSetup(); notifyControl.startMeasurement = true; RawResults res = new RawResults(); int batchSize = iterationParams.getBatchSize(); testColumnTable_ss_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, batchSize, l_predicatedallcolumnssumbench0_0); control.preTearDown(); if (control.isLastIteration()) { f_predicatedallcolumnssumbench0_0 = null; } int opsPerInv = control.benchmarkParams.getOpsPerInvocation(); long totalOps = opsPerInv; BenchmarkTaskResult results = new BenchmarkTaskResult(totalOps, totalOps); results.add(new SingleShotResult(ResultRole.PRIMARY, "testColumnTable", res.getTime(), benchmarkParams.getTimeUnit())); this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes."); return results; } else throw new IllegalStateException("Harness failed to distribute threads among groups properly"); } public static void testColumnTable_ss_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, int batchSize, PredicatedAllColumnsSumBench_jmhType l_predicatedallcolumnssumbench0_0) throws Throwable { long realTime = 0; result.startTime = System.nanoTime(); for (int b = 0; b < batchSize; b++) { if (control.volatileSpoiler) return; blackhole.consume(l_predicatedallcolumnssumbench0_0.testColumnTable()); } result.stopTime = System.nanoTime(); result.realTime = realTime; } PredicatedAllColumnsSumBench_jmhType f_predicatedallcolumnssumbench0_0; PredicatedAllColumnsSumBench_jmhType _jmh_tryInit_f_predicatedallcolumnssumbench0_0(InfraControl control) throws Throwable { if (control.isFailing) throw new FailureAssistException(); PredicatedAllColumnsSumBench_jmhType val = f_predicatedallcolumnssumbench0_0; if (val == null) { val = new PredicatedAllColumnsSumBench_jmhType(); val.prepare(); f_predicatedallcolumnssumbench0_0 = val; } return val; } }
[ "znabulsi@stanford.edu" ]
znabulsi@stanford.edu
8d31b6e635924055e45ecdb46b5af7b65b08e9bc
683357e10855417d77c9ca24c889b8e20cb50510
/core/src/main/java/com/karltech/tpk/core/service/FixExpenseServiceImpl.java
d914cd0f53b35804f2e77cb9772346d6ca49e077
[]
no_license
chuquockhanh/tpkwhm
49852487637ba1a51712b55d57bcd580811fec9a
54b2bbec37592f5be29802dad9c7e3e796b92bdb
refs/heads/master
2021-01-10T13:03:56.086654
2015-10-13T15:41:26
2015-10-13T15:41:26
44,185,475
0
0
null
null
null
null
UTF-8
Java
false
false
2,687
java
package com.karltech.tpk.core.service; import com.karltech.tpk.core.dao.FixExpenseDAO; import com.karltech.tpk.core.dao.GenericDAO; import com.karltech.tpk.core.domain.FixExpense; import com.karltech.tpk.core.dto.FixExpenseBean; import com.karltech.tpk.core.exception.DuplicateException; import com.karltech.tpk.core.exception.ObjectNotFoundException; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.util.HashMap; import java.util.List; import java.util.Map; public class FixExpenseServiceImpl extends GenericServiceImpl<FixExpense,Long> implements FixExpenseService { protected final Log logger = LogFactory.getLog(getClass()); private FixExpenseDAO fixExpenseDAO; public void setFixExpenseDAO(FixExpenseDAO fixExpenseDAO) { this.fixExpenseDAO = fixExpenseDAO; } @Override protected GenericDAO<FixExpense, Long> getGenericDAO() { return fixExpenseDAO; } @Override public void updateItem(FixExpenseBean colourBean) throws ObjectNotFoundException, DuplicateException { FixExpense dbItem = this.fixExpenseDAO.findByIdNoAutoCommit(colourBean.getPojo().getFixExpenseID()); if (dbItem == null) throw new ObjectNotFoundException("Not found FixExpense " + colourBean.getPojo().getFixExpenseID()); FixExpense pojo = colourBean.getPojo(); this.fixExpenseDAO.detach(dbItem); this.fixExpenseDAO.update(pojo); } @Override public void addNew(FixExpenseBean colourBean) throws DuplicateException { FixExpense pojo = colourBean.getPojo(); pojo = this.fixExpenseDAO.save(pojo); colourBean.setPojo(pojo); } @Override public Integer deleteItems(String[] checkList) { Integer res = 0; if (checkList != null && checkList.length > 0) { res = checkList.length; for (String id : checkList) { fixExpenseDAO.delete(Long.parseLong(id)); } } return res; } @Override public Object[] search(FixExpenseBean bean) { Map<String, Object> properties = new HashMap<String, Object>(); if (StringUtils.isNotBlank(bean.getPojo().getName())) { properties.put("name", bean.getPojo().getName()); } return this.fixExpenseDAO.searchByProperties(properties, bean.getFirstItem(), bean.getMaxPageItems(), bean.getSortExpression(), bean.getSortDirection(), true); } @Override public List<FixExpense> findAllByOrder(String name) { return this.fixExpenseDAO.findAllByOrder(name); } }
[ "khanh.chu@hoanghoacgroup.com" ]
khanh.chu@hoanghoacgroup.com
68a3c9c6b64708aaa4930910899fe5f1275260f4
b0cce84067ea5d37bf126bf671620a15b9d90890
/app/src/main/java/com/mouqu/zhailu/zhailu/bean/CardBean.java
38dc7169fd98faab26e73d6efac02fdac8ce7a48
[]
no_license
18668197127/ZhailuQB
f4df02dda885c5c8f19ef67857374f4b388542bd
846f5d29df4d2c2fa7bad2f6239a2e41701e2c11
refs/heads/master
2020-04-17T16:30:39.044861
2019-01-21T03:39:06
2019-01-21T03:39:06
166,743,120
0
0
null
null
null
null
UTF-8
Java
false
false
618
java
package com.mouqu.zhailu.zhailu.bean; import com.contrarywind.interfaces.IPickerViewData; public class CardBean implements IPickerViewData { int id; String cardNo; public CardBean(int id, String cardNo) { this.id = id; this.cardNo = cardNo; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getCardNo() { return cardNo; } public void setCardNo(String cardNo) { this.cardNo = cardNo; } @Override public String getPickerViewText() { return cardNo; } }
[ "1013273644@qq.com" ]
1013273644@qq.com
2d7e7cea2a824aab472f6d1414ea15a123d5e157
d2fc5d5ad6ac340ae4e0004623d743c8d92d1f74
/simplemad-android/src/main/java/com/simplemad/android/service/UserAccountServiceImpl.java
bd9b36fb12f2e182ea1effb4e1f87abe1fcf5944
[]
no_license
MichaelScofield1/android-client
a033d34553a11bf500b2bdf0a66ebc7fe9e07d11
d3501a3424312e921df5960d443f4e29cd792e20
refs/heads/master
2016-09-06T12:26:57.201688
2012-04-12T17:13:49
2012-04-12T17:13:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,242
java
package com.simplemad.android.service; import java.io.IOException; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import com.simplemad.android.SimpleMadApp; import com.simplemad.android.client.ClientUtil; import com.simplemad.android.client.TimerManager; import com.simplemad.android.dao.UserAccountDAO; import com.simplemad.android.dao.UserAccountDAOImpl; import com.simplemad.bean.MessageType; import com.simplemad.bean.Timer; import com.simplemad.bean.UserAccount; import com.simplemad.parameter.ClientParameter; public class UserAccountServiceImpl implements UserAccountService { private static final String PASSWORD = "password"; private static final String MOBILE = "mobile"; private UserAccountDAO userAccountDao; private static UserAccountService instance; private UserAccount userAccount; private UserService userService; private UserAccountServiceImpl() { userAccountDao = new UserAccountDAOImpl(); userService = UserServiceImpl.instance(); } public static synchronized UserAccountService instance() { if(instance == null) instance = new UserAccountServiceImpl(); return instance; } @Override public UserAccount loadFirstUserAccount() { return userAccountDao.first(); } @Override public boolean loginLocal(UserAccount userAccount, boolean isLoginToServer) { boolean isLogined = false; UserAccount loadedLocal = userAccountDao.find(userAccount.getMobile()); if(isLoginToServer) { if(loadedLocal == null) { /*if login to the server, do the following*/ loadedLocal = userAccount; loadedLocal.setLogined(true); loadedLocal.setLoginTime(new Date()); isLogined = userAccountDao.add(loadedLocal); userService.setMobile(loadedLocal.getMobile()); userService.create(); } else { loadedLocal.setLogined(true); loadedLocal.setLoginTime(new Date()); isLogined = userAccountDao.update(loadedLocal); } } else { if(loadedLocal == null) { isLogined = false; } else { if(loadedLocal.getPassword().equals(userAccount.getPassword())) { loadedLocal.setLogined(true); loadedLocal.setLoginTime(new Date()); isLogined = userAccountDao.update(loadedLocal); } else { isLogined = false; } } } if(isLogined) { userService.setMobile(loadedLocal.getMobile()); // if(isLoginToServer) { // userService.synchronizedUser(); // } this.userAccount = loadedLocal; } return isLogined; } @Override public boolean loginRemote(UserAccount userAccount) { if(this.userAccount == null) { userAccount.setLogined(false); } else if(this.userAccount.getMobile() != userAccount.getMobile()) { userAccount.setLogined(false); } if(userAccount.isLogined()) { userService.setMobile(userAccount.getMobile()); this.userAccount = userAccount; return true; } try { TimerManager.setTimer(ClientUtil.doGet(ClientParameter.TIMER, Timer.class)); } catch (IOException e) { e.printStackTrace(); } return loginToServer(userAccount); } /** @Override public boolean login(UserAccount userAccount) { boolean isLogined = false; System.out.println("UserAccountService userAccount.isLogined():" + userAccount.isLogined()); if(this.userAccount == null) { userAccount.setLogined(false); } else if(this.userAccount.getMobile() != userAccount.getMobile()) { userAccount.setLogined(false); } if(userAccount.isLogined()) { userService.setMobile(userAccount.getMobile()); this.userAccount = userAccount; return true; } boolean isLogin = loginToServer(userAccount); userAccount.setLogined(true); System.out.println("UserAccountService loginToServer:" + isLogin); UserAccount loadedLocal = userAccountDao.find(userAccount.getMobile()); if(!isLogin) { isLogined = false; } else { if(loadedLocal == null) { //f login to the server, do the following userAccount.setLoginTime(new Date()); isLogined = userAccountDao.add(userAccount); userService.setMobile(userAccount.getMobile()); userService.create(); } else { userAccount.setLoginTime(new Date()); isLogined = userAccountDao.update(userAccount); } } if(isLogined) { logout(); userService.setMobile(userAccount.getMobile()); userService.synchronizedUser(); this.userAccount = userAccount; } return isLogined; } */ private boolean loginAfterRegister(UserAccount userAccount) { UserAccount loadedLocal = userAccountDao.find(userAccount.getMobile()); if(loadedLocal == null) { return false; } userService.setMobile(loadedLocal.getMobile()); userService.create(); // userService.synchronizedUser(); this.userAccount = loadedLocal; return true; } private boolean notNeedLoginToServer(UserAccount userAccount) { if(SimpleMadApp.DEBUG_MODE) { return true; } if(!SimpleMadApp.instance().isInNetwork()) { return true; } else { return false; } } private boolean loginToServer(UserAccount userAccount) { if(notNeedLoginToServer(userAccount)) { return true; } Map<String, Object> params = new HashMap<String, Object>(); params.put(MOBILE, userAccount.getMobile()); params.put(PASSWORD, userAccount.getPassword()); /** try { ClientUtil.doPost(ClientParameter.USER_LOGIN, params, Boolean.class); } catch (IOException e) { e.printStackTrace(); return true; } */ ClientUtil.doSend(MessageType.LOGON, userAccount); return false; } private void logoutToServer(UserAccount userAccount) { if(SimpleMadApp.DEBUG_MODE) { return; } if(!SimpleMadApp.instance().isInNetwork()) { return; } Map<String, Object> params = new HashMap<String, Object>(); params.put(MOBILE, userAccount.getMobile()); params.put(PASSWORD, userAccount.getPassword()); /** try { ClientUtil.doPost(ClientParameter.USER_LOGOUT, params, Boolean.class); } catch (IOException e) { e.printStackTrace(); } */ ClientUtil.doSend(MessageType.LOGOFF, userAccount); } @Override public boolean logout() { if(userAccount != null) { userAccount.setLogined(false); userAccountDao.update(userAccount); logoutToServer(userAccount); } userAccount = null; return true; } @Override public List<UserAccount> loadAvaiableUserAccounts() { return userAccountDao.getAllUserAccountByLoginTime(); } @Override public boolean registerRemote(long mobile, String password) { UserAccount userAccount = new UserAccount(); userAccount.setLoginTime(new Date()); userAccount.setPassword(password); userAccount.setMobile(mobile); return registerToServer(userAccount); } @Override public boolean registerLocal(long mobile, String password) { UserAccount userAccount = new UserAccount(); userAccount.setLoginTime(new Date()); userAccount.setPassword(password); userAccount.setMobile(mobile); userAccount.setLogined(true); userAccountDao.add(userAccount); return loginAfterRegister(userAccount); } private boolean registerToServer(UserAccount userAccount) { if(SimpleMadApp.DEBUG_MODE) { return false; } if(!SimpleMadApp.instance().isInNetwork()) { return false; } Map<String, Object> params = new HashMap<String, Object>(); params.put(MOBILE, userAccount.getMobile()); params.put(PASSWORD, userAccount.getPassword()); try { return ClientUtil.doPost(ClientParameter.USER_REGISTER, params, Boolean.class); } catch (IOException e) { e.printStackTrace(); return false; } } @Override public boolean clean(long mobile) { UserAccount userAccount = new UserAccount(); userAccount.setMobile(mobile); return userAccountDao.delete(userAccount); } @Override public UserAccount getCurrentUserAccount() { return userAccount; } @Override public boolean modifyPassword(String newPassword, String oldPassword) { boolean isModified = modifyPasswordInServer(newPassword, oldPassword); if(isModified) { userAccount.setPassword(newPassword); userAccountDao.update(userAccount); } return isModified; } private boolean modifyPasswordInServer(String newPassword, String oldPassword) { if(SimpleMadApp.DEBUG_MODE) { return true; } if(!SimpleMadApp.instance().isInNetwork()) { return false; } try { Map<String, Object> params = new HashMap<String, Object>(); params.put("mobile", userAccount.getMobile()); params.put("oldPassword", oldPassword); params.put("newPassword", newPassword); return ClientUtil.doPost(ClientParameter.USER_PASSWORD_MODIFY, params, Boolean.class); } catch(IOException e) { e.printStackTrace(); return false; } } @Override public boolean loginrecently() { userAccount = userAccountDao.first(); userService.setMobile(userAccount.getMobile()); return true; } @Override public boolean reloginRemote() { if(getCurrentUserAccount() != null) { UserAccount userAccount = new UserAccount(); userAccount.setLogined(false); userAccount.setMobile(getCurrentUserAccount().getMobile()); userAccount.setPassword(getCurrentUserAccount().getPassword()); userAccount.setRemLoginStatus(getCurrentUserAccount().isRemLoginStatus()); userAccount.setRemPassword(getCurrentUserAccount().isRemPassword()); return !loginRemote(userAccount); } return false; } }
[ "kamenlai0@gmail.com" ]
kamenlai0@gmail.com
0d32239ce4254f620bdd22d23dae51d551abe2c2
859afa584f3def2f5da1de60048665ef7c54d87a
/car-repair/web-app/src/main/java/com/epam/brest/summer/courses2019/web_app/HelloController.java
756a7db69d8341944b0f834a15940e667d5ff39d
[ "Apache-2.0" ]
permissive
brest-java-course-summer-2019/ihnat-misiyuk
4b99009e83b039b3318ef8b258a4c7bdeb2aafff
a188f841c969b490570e0e124b5d0212fcad2141
refs/heads/master
2022-12-28T23:04:00.612544
2019-09-05T15:29:34
2019-09-05T15:29:34
191,216,112
0
0
Apache-2.0
2022-12-16T05:02:50
2019-06-10T17:38:41
JavaScript
UTF-8
Java
false
false
592
java
package com.epam.brest.summer.courses2019.web_app; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; /** * Hello MVC controller. */ @Controller public class HelloController { @GetMapping(value = "/hello") public String hello(@RequestParam(value = "name", required = false, defaultValue = "World") String name, Model model) { model.addAttribute("name", name); return "hello"; } }
[ "mineraignat@gmail.com" ]
mineraignat@gmail.com
29f2b08c5ecf8a2087a6f72207aea0ceca1dca12
b7910e40356c56c733b1a63484cc94dcc7426320
/io/src/file/object/ObjectOutputStreamDemo1.java
6b6430f42285b6f8ee7f0fa9ad3d6156bd179b66
[]
no_license
jinhn/java_study
ffb748caf9d3704c16ba1d2f4d957d09ae7ce84a
767c2ddb084ac911cbff7c8fbfd1cf28da94d5f0
refs/heads/master
2020-06-14T20:13:08.421228
2016-12-16T06:42:04
2016-12-16T06:42:04
75,351,691
0
0
null
null
null
null
UTF-8
Java
false
false
793
java
package file.object; import java.io.FileOutputStream; import java.io.ObjectOutputStream; public class ObjectOutputStreamDemo1 { public static void main(String[] args) throws Exception{ Account account = new Account(); account.setName("홍길동"); account.setAccNumber("111-222-333-4444"); account.setBalance(100000000); // Rate 클래스가 직렬화 되어있지 않으면 // NotSerializableException 발생 Rate rate = new Rate(); rate.setMonth(0.03); rate.setYear(0.3); account.setRate(rate); FileOutputStream fos = new FileOutputStream("account.sav"); ObjectOutputStream oos = new ObjectOutputStream(fos); /* * Account객체를 직렬화해서 FileOutputStream으로 흘려보낸다. */ oos.writeObject(account); oos.close(); } }
[ "jinhn1313@gmail.com" ]
jinhn1313@gmail.com
2e97d1b00430638594f647c72c6bb13376a66dcb
5fbf7863d76eab7999b821241115c642c532cd89
/chrome/android/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteCoordinatorImpl.java
7d95d64cbae1cc25be17fb4062fe0e7f2326dc43
[ "BSD-3-Clause" ]
permissive
klebertarcisio/chromium
cd5675f96c65b00fdad7dbfdfd65109f24482def
4350a5e68f405a4e8eaf26d92025db55c5681431
refs/heads/master
2022-11-07T16:18:06.882020
2020-05-27T20:34:40
2020-05-27T20:34:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
14,459
java
// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.chrome.browser.omnibox.suggestions; import android.content.Context; import android.os.Handler; import android.util.Pair; import android.view.KeyEvent; import android.view.View; import android.view.ViewGroup; import android.view.ViewStub; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import androidx.core.view.ViewCompat; import org.chromium.base.Callback; import org.chromium.base.supplier.Supplier; import org.chromium.chrome.R; import org.chromium.chrome.browser.ActivityTabProvider; import org.chromium.chrome.browser.compositor.layouts.OverviewModeBehavior; import org.chromium.chrome.browser.omnibox.UrlBarEditingTextStateProvider; import org.chromium.chrome.browser.omnibox.suggestions.AutocompleteController.OnSuggestionsReceivedListener; import org.chromium.chrome.browser.omnibox.suggestions.SuggestionListViewBinder.SuggestionListViewHolder; import org.chromium.chrome.browser.omnibox.suggestions.answer.AnswerSuggestionViewBinder; import org.chromium.chrome.browser.omnibox.suggestions.base.BaseSuggestionView; import org.chromium.chrome.browser.omnibox.suggestions.base.BaseSuggestionViewBinder; import org.chromium.chrome.browser.omnibox.suggestions.basic.SuggestionViewViewBinder; import org.chromium.chrome.browser.omnibox.suggestions.editurl.EditUrlSuggestionProcessor; import org.chromium.chrome.browser.omnibox.suggestions.editurl.EditUrlSuggestionViewBinder; import org.chromium.chrome.browser.omnibox.suggestions.entity.EntitySuggestionViewBinder; import org.chromium.chrome.browser.omnibox.suggestions.header.HeaderView; import org.chromium.chrome.browser.omnibox.suggestions.header.HeaderViewBinder; import org.chromium.chrome.browser.omnibox.suggestions.tail.TailSuggestionView; import org.chromium.chrome.browser.omnibox.suggestions.tail.TailSuggestionViewBinder; import org.chromium.chrome.browser.omnibox.suggestions.tiles.TileSuggestionViewBinder; import org.chromium.chrome.browser.omnibox.voice.VoiceRecognitionHandler; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.share.ShareDelegate; import org.chromium.chrome.browser.toolbar.ToolbarDataProvider; import org.chromium.chrome.browser.util.KeyNavigationUtil; import org.chromium.components.query_tiles.QueryTile; import org.chromium.ui.ViewProvider; import org.chromium.ui.base.WindowAndroid; import org.chromium.ui.modelutil.LazyConstructionPropertyMcp; import org.chromium.ui.modelutil.MVCListAdapter; import org.chromium.ui.modelutil.MVCListAdapter.ModelList; import org.chromium.ui.modelutil.PropertyModel; import java.util.ArrayList; import java.util.List; /** * Coordinator that handles the interactions with the autocomplete system. */ public class AutocompleteCoordinatorImpl implements AutocompleteCoordinator { private final ViewGroup mParent; private OmniboxQueryTileCoordinator mQueryTileCoordinator; private AutocompleteMediator mMediator; private OmniboxSuggestionsDropdown mDropdown; /** * See {@link AutocompleteCoordinatorFactory#createAutocompleteCoordinator}. * * Keep this constructor protected so clients use the factory instead. */ @VisibleForTesting protected AutocompleteCoordinatorImpl(ViewGroup parent, AutocompleteDelegate delegate, OmniboxSuggestionsDropdown.Embedder dropdownEmbedder, UrlBarEditingTextStateProvider urlBarEditingTextProvider) { mParent = parent; Context context = parent.getContext(); PropertyModel listModel = new PropertyModel(SuggestionListProperties.ALL_KEYS); MVCListAdapter.ModelList listItems = new MVCListAdapter.ModelList(); mQueryTileCoordinator = new OmniboxQueryTileCoordinator(context, this::onTileSelected); mMediator = new AutocompleteMediator(context, delegate, urlBarEditingTextProvider, new AutocompleteController(), mQueryTileCoordinator::setTiles, listModel, new Handler()); mMediator.initDefaultProcessors(); listModel.set(SuggestionListProperties.EMBEDDER, dropdownEmbedder); listModel.set(SuggestionListProperties.VISIBLE, false); listModel.set(SuggestionListProperties.OBSERVER, mMediator); listModel.set(SuggestionListProperties.SUGGESTION_MODELS, listItems); ViewProvider<SuggestionListViewHolder> viewProvider = createViewProvider(context, listItems); viewProvider.whenLoaded((holder) -> { mDropdown = holder.dropdown; }); LazyConstructionPropertyMcp.create(listModel, SuggestionListProperties.VISIBLE, viewProvider, SuggestionListViewBinder::bind); // https://crbug.com/966227 Set initial layout direction ahead of inflating the suggestions. updateSuggestionListLayoutDirection(); } @Override public void destroy() { mQueryTileCoordinator.destroy(); mQueryTileCoordinator = null; mMediator.destroy(); mMediator = null; } private ViewProvider<SuggestionListViewHolder> createViewProvider( Context context, MVCListAdapter.ModelList modelList) { return new ViewProvider<SuggestionListViewHolder>() { private List<Callback<SuggestionListViewHolder>> mCallbacks = new ArrayList<>(); private SuggestionListViewHolder mHolder; @Override public void inflate() { ViewGroup container = (ViewGroup) ((ViewStub) mParent.getRootView().findViewById( R.id.omnibox_results_container_stub)) .inflate(); Pair<OmniboxSuggestionsDropdown, MVCListAdapter> dropdownAndAdapter = OmniboxSuggestionsDropdownFactory.provideDropdownAndAdapter( context, modelList); OmniboxSuggestionsDropdown dropdown = dropdownAndAdapter.first; MVCListAdapter adapter = dropdownAndAdapter.second; // Start with visibility GONE to ensure that show() is called. // http://crbug.com/517438 dropdown.getViewGroup().setVisibility(View.GONE); dropdown.getViewGroup().setClipToPadding(false); // Register a view type for a default omnibox suggestion. // Note: clang-format does a bad job formatting lambdas so we turn it off here. // clang-format off adapter.registerType( OmniboxSuggestionUiType.DEFAULT, parent -> new BaseSuggestionView<View>( parent.getContext(), R.layout.omnibox_basic_suggestion), new BaseSuggestionViewBinder<View>(SuggestionViewViewBinder::bind)); adapter.registerType( OmniboxSuggestionUiType.EDIT_URL_SUGGESTION, parent -> EditUrlSuggestionProcessor.createView(parent.getContext()), EditUrlSuggestionViewBinder::bind); adapter.registerType( OmniboxSuggestionUiType.ANSWER_SUGGESTION, parent -> new BaseSuggestionView<View>( parent.getContext(), R.layout.omnibox_answer_suggestion), new BaseSuggestionViewBinder<View>(AnswerSuggestionViewBinder::bind)); adapter.registerType( OmniboxSuggestionUiType.ENTITY_SUGGESTION, parent -> new BaseSuggestionView<View>( parent.getContext(), R.layout.omnibox_entity_suggestion), new BaseSuggestionViewBinder<View>(EntitySuggestionViewBinder::bind)); adapter.registerType( OmniboxSuggestionUiType.TAIL_SUGGESTION, parent -> new BaseSuggestionView<TailSuggestionView>( new TailSuggestionView(parent.getContext())), new BaseSuggestionViewBinder<TailSuggestionView>( TailSuggestionViewBinder::bind)); adapter.registerType( OmniboxSuggestionUiType.CLIPBOARD_SUGGESTION, parent -> new BaseSuggestionView<View>( parent.getContext(), R.layout.omnibox_basic_suggestion), new BaseSuggestionViewBinder<View>(SuggestionViewViewBinder::bind)); adapter.registerType( OmniboxSuggestionUiType.TILE_SUGGESTION, parent -> mQueryTileCoordinator.createView(parent.getContext()), TileSuggestionViewBinder::bind); adapter.registerType( OmniboxSuggestionUiType.HEADER, parent -> new HeaderView(parent.getContext()), HeaderViewBinder::bind); // clang-format on mHolder = new SuggestionListViewHolder(container, dropdown); for (int i = 0; i < mCallbacks.size(); i++) { mCallbacks.get(i).onResult(mHolder); } mCallbacks = null; } @Override public void whenLoaded(Callback<SuggestionListViewHolder> callback) { if (mHolder != null) { callback.onResult(mHolder); return; } mCallbacks.add(callback); } }; } @Override public void onUrlFocusChange(boolean hasFocus) { mMediator.onUrlFocusChange(hasFocus); } @Override public void onUrlAnimationFinished(boolean hasFocus) { mMediator.onUrlAnimationFinished(hasFocus); } @Override public void setToolbarDataProvider(ToolbarDataProvider toolbarDataProvider) { mMediator.setToolbarDataProvider(toolbarDataProvider); } @Override public void setOverviewModeBehavior(OverviewModeBehavior overviewModeBehavior) { mMediator.setOverviewModeBehavior(overviewModeBehavior); } @Override public void setAutocompleteProfile(Profile profile) { mMediator.setAutocompleteProfile(profile); } @Override public void setWindowAndroid(WindowAndroid windowAndroid) { mMediator.setWindowAndroid(windowAndroid); } @Override public void setActivityTabProvider(ActivityTabProvider provider) { mMediator.setActivityTabProvider(provider); } @Override public void setShareDelegateSupplier(Supplier<ShareDelegate> shareDelegateSupplier) { mMediator.setShareDelegateSupplier(shareDelegateSupplier); } @Override public void setShouldPreventOmniboxAutocomplete(boolean prevent) { mMediator.setShouldPreventOmniboxAutocomplete(prevent); } @Override public int getSuggestionCount() { return mMediator.getSuggestionCount(); } @Override public OmniboxSuggestion getSuggestionAt(int index) { return mMediator.getSuggestionAt(index); } @Override public void onNativeInitialized() { mMediator.onNativeInitialized(); } @Override public void onVoiceResults(@Nullable List<VoiceRecognitionHandler.VoiceResult> results) { mMediator.onVoiceResults(results); } @Override public long getCurrentNativeAutocompleteResult() { return mMediator.getCurrentNativeAutocompleteResult(); } @Override public void updateSuggestionListLayoutDirection() { mMediator.setLayoutDirection(ViewCompat.getLayoutDirection(mParent)); } @Override public void updateVisualsForState(boolean useDarkColors, boolean isIncognito) { mMediator.updateVisualsForState(useDarkColors, isIncognito); } @Override public void setShowCachedZeroSuggestResults(boolean showCachedZeroSuggestResults) { mMediator.setShowCachedZeroSuggestResults(showCachedZeroSuggestResults); } @Override public boolean handleKeyEvent(int keyCode, KeyEvent event) { boolean isShowingList = mDropdown != null && mDropdown.getViewGroup().isShown(); boolean isUpOrDown = KeyNavigationUtil.isGoUpOrDown(event); if (isShowingList && mMediator.getSuggestionCount() > 0 && isUpOrDown) { mMediator.allowPendingItemSelection(); } boolean isValidListKey = isUpOrDown || KeyNavigationUtil.isGoRight(event) || KeyNavigationUtil.isGoLeft(event) || KeyNavigationUtil.isEnter(event); if (isShowingList && isValidListKey && mDropdown.getViewGroup().onKeyDown(keyCode, event)) { return true; } if (KeyNavigationUtil.isEnter(event) && mParent.getVisibility() == View.VISIBLE) { mMediator.loadTypedOmniboxText(event.getEventTime()); return true; } return false; } @Override public void onTextChanged(String textWithoutAutocomplete, String textWithAutocomplete) { mMediator.onTextChanged(textWithoutAutocomplete, textWithAutocomplete); } @Override public void startAutocompleteForQuery(String query) { mMediator.startAutocompleteForQuery(query); } @Override public String qualifyPartialURLQuery(String query) { return AutocompleteControllerJni.get().qualifyPartialURLQuery(query); } @Override public void prefetchZeroSuggestResults() { AutocompleteControllerJni.get().prefetchZeroSuggestResults(); } @VisibleForTesting OmniboxSuggestionsDropdown getSuggestionsDropdown() { return mDropdown; } @VisibleForTesting void setAutocompleteController(AutocompleteController controller) { mMediator.setAutocompleteController(controller); } @VisibleForTesting OnSuggestionsReceivedListener getSuggestionsReceivedListenerForTest() { return mMediator; } @VisibleForTesting ModelList getSuggestionModelList() { return mMediator.getSuggestionModelList(); } private void onTileSelected(QueryTile queryTile) { mMediator.onQueryTileSelected(queryTile); } }
[ "commit-bot@chromium.org" ]
commit-bot@chromium.org
22c58271ba582541268a3fd15b3b348d6ac85511
0e1e63bc2b0baf7f3379d873760a873e54fbd8e2
/src/main/java/wang/huaichao/io/ExcelUtils.java
c4edff3a7d3caab6840feb258366f69abc4a25ae
[]
no_license
doodlecoge/tools4j
ab3818a235b58df22ccde10e7a285b7c84c37407
febb8ddbb86239324a8835e98337aba63fdb88ce
refs/heads/master
2021-01-23T20:12:56.277135
2015-03-13T06:01:32
2015-03-13T06:01:32
30,222,040
0
0
null
null
null
null
UTF-8
Java
false
false
2,591
java
package wang.huaichao.io; import jxl.Sheet; import jxl.Workbook; import jxl.read.biff.BiffException; import jxl.write.Label; import jxl.write.WritableSheet; import jxl.write.WritableWorkbook; import jxl.write.WriteException; import jxl.write.biff.RowsExceededException; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; /** * Created by Administrator on 2015/2/27. */ public class ExcelUtils { public static void main(String[] args) throws IOException, BiffException, WriteException { String oldfile = "e:\\tmp\\disc.xls"; String newfile = "e:\\tmp\\disc2.xls"; Workbook oldbook = Workbook.getWorkbook(new File(oldfile)); Sheet oldsheet = oldbook.getSheet(0); WritableWorkbook newbook = Workbook.createWorkbook(new File(newfile)); WritableSheet newsheet = newbook.createSheet("xxx", 0); int rows = oldsheet.getRows(); int cols = oldsheet.getColumns(); for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { String contents = oldsheet.getCell(j, i).getContents(); newsheet.addCell(new Label(j, i, contents)); } if (i == 0) continue; newsheet.addCell(new Label(cols, i, getType( Integer.valueOf(oldsheet.getCell(2, i).getContents()), Integer.valueOf(oldsheet.getCell(3, i).getContents()), Integer.valueOf(oldsheet.getCell(4, i).getContents()), Integer.valueOf(oldsheet.getCell(5, i).getContents()) ))); } newbook.write(); newbook.close(); } private static class KV { public char k; public int v; public KV(char k, int v) { this.k = k; this.v = v; } } public static String getType(int d, int i, int s, int c) { final ArrayList<KV> kvs = new ArrayList<KV>(); if (d > 1) kvs.add(new KV('d', d)); if (i > 0) kvs.add(new KV('i', i)); if (s > 0) kvs.add(new KV('s', s)); if (c > -2) kvs.add(new KV('c', c)); if (kvs.size() == 0) return "-"; Collections.sort(kvs, new Comparator<KV>() { @Override public int compare(KV o1, KV o2) { return o2.v - o1.v; } }); String ret = ""; ret += kvs.get(0).k; if (kvs.size() > 1) ret += kvs.get(1).k; return ret; } }
[ "doodlecoge@163.com" ]
doodlecoge@163.com
fda22c9a163bead31d41f153d6353afecf11c6c8
035db371d9454d458e1a4fdcda8e22e440cda0e0
/app/src/main/java/com/jiefanproj/android/embutton_master2/data/PageDbManager.java
17da9fe93667ed58ededdddca49e39757c99d121
[]
no_license
Nafeij/NUSH-icode-proj
2dbfec1dc15edd2a0deb49c76dda34707d7b0ff4
ee127bdf3afcff7acbee6e4b1acb298930f712c5
refs/heads/master
2021-04-06T00:22:49.837752
2016-07-11T13:07:48
2016-07-11T13:07:48
62,054,785
1
0
null
null
null
null
UTF-8
Java
false
false
9,882
java
package com.jiefanproj.android.embutton_master2.data; import android.content.ContentValues; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteStatement; import java.util.ArrayList; import java.util.List; import com.jiefanproj.android.embutton_master2.AppConstants; import com.jiefanproj.android.embutton_master2.model.Page; import com.jiefanproj.android.embutton_master2.model.PageAction; import com.jiefanproj.android.embutton_master2.model.PageChecklist; import com.jiefanproj.android.embutton_master2.model.PageItem; import com.jiefanproj.android.embutton_master2.model.PageStatus; import com.jiefanproj.android.embutton_master2.model.PageTimer; /** * v 2.0.1 */ public class PageDbManager { private static final String TAG = PageDbManager.class.getSimpleName(); private static final String TABLE_PAGE = "page_table"; private static final String PAGE_ID = "page_id"; private static final String PAGE_LANGUAGE = "page_language"; private static final String PAGE_TYPE = "page_type"; private static final String PAGE_TITLE = "page_title"; private static final String PAGE_INTRODUCTION = "page_introduction"; private static final String PAGE_WARNING = "page_warning"; private static final String PAGE_COMPONENT = "page_component"; private static final String PAGE_CONTENT = "page_content"; private static final String PAGE_SUCCESS_ID = "page_success_id"; private static final String PAGE_FAILED_ID = "page_failed_id"; private static final String PAGE_HEADING = "page_heading"; private static final String PAGE_SECTION_ORDER = "page_section_order"; private static final String CREATE_TABLE_WIZARD_PAGE = "create table " + TABLE_PAGE + " ( " + AppConstants.TABLE_PRIMARY_KEY + " integer primary key autoincrement, " + PAGE_ID + " text, " + PAGE_LANGUAGE + " text, " + PAGE_TYPE + " text, " + PAGE_TITLE + " text, " + PAGE_INTRODUCTION + " text, " + PAGE_WARNING + " text, " + PAGE_COMPONENT + " text, " + PAGE_CONTENT + " text, " + PAGE_SUCCESS_ID + " text, " + PAGE_FAILED_ID + " text, " + PAGE_HEADING + " text, " + PAGE_SECTION_ORDER + " text);"; private static final String INSERT_SQL = "insert into " + TABLE_PAGE + " (" + PAGE_ID + ", " + PAGE_LANGUAGE + ", " + PAGE_TYPE + ", " + PAGE_TITLE + ", " + PAGE_INTRODUCTION + ", " + PAGE_WARNING + ", " + PAGE_COMPONENT + ", " + PAGE_CONTENT + ", " + PAGE_SUCCESS_ID + ", " + PAGE_FAILED_ID + ", " + PAGE_HEADING + ", " + PAGE_SECTION_ORDER + ") values (?,?,?,?,?,?,?,?,?,?,?,?)"; public static void createTable(SQLiteDatabase db) { db.execSQL(CREATE_TABLE_WIZARD_PAGE); } public static void dropTable(SQLiteDatabase db) { db.execSQL("DROP TABLE IF EXISTS " + TABLE_PAGE); } public static long insert(SQLiteDatabase db, Page page) throws SQLException { SQLiteStatement insertStatement = db.compileStatement(INSERT_SQL); if(page.getId() != null) insertStatement.bindString(1, page.getId()); if(page.getLang() != null) insertStatement.bindString(2, page.getLang()); if(page.getType() != null) insertStatement.bindString(3, page.getType()); if(page.getTitle() != null) insertStatement.bindString(4, page.getTitle()); if(page.getIntroduction() != null) insertStatement.bindString(5, page.getIntroduction()); if(page.getWarning() != null) insertStatement.bindString(6, page.getWarning()); if(page.getComponent() != null) insertStatement.bindString(7, page.getComponent()); if(page.getContent() != null) insertStatement.bindString(8, page.getContent()); if(page.getSuccessId() != null) insertStatement.bindString(9, page.getSuccessId()); if(page.getFailedId() != null) insertStatement.bindString(10, page.getFailedId()); if(page.getHeading() != null) insertStatement.bindString(11, page.getHeading()); if(page.getSectionOrder() != null) insertStatement.bindString(12, page.getSectionOrder()); return insertStatement.executeInsert(); } public static Page retrieve(SQLiteDatabase db, String pageId, String lang) throws SQLException { Page page = null; Cursor c = db.query(TABLE_PAGE, null, PAGE_ID + "=? AND " + PAGE_LANGUAGE + "=?", new String[]{pageId, lang}, null, null, null); if (c != null && c.getCount() > 0) { c.moveToFirst(); String pageType = c.getString(c.getColumnIndex(PAGE_TYPE)); String pageTitle = c.getString(c.getColumnIndex(PAGE_TITLE)); String pageIntro = c.getString(c.getColumnIndex(PAGE_INTRODUCTION)); String pageWarning = c.getString(c.getColumnIndex(PAGE_WARNING)); String pageComponent = c.getString(c.getColumnIndex(PAGE_COMPONENT)); String pageContent = c.getString(c.getColumnIndex(PAGE_CONTENT)); String successId = c.getString(c.getColumnIndex(PAGE_SUCCESS_ID)); String failedId = c.getString(c.getColumnIndex(PAGE_FAILED_ID)); String heading = c.getString(c.getColumnIndex(PAGE_HEADING)); String secOrder = c.getString(c.getColumnIndex(PAGE_SECTION_ORDER)); List<PageStatus> statusList = PageStatusDbManager.retrieve(db, pageId, lang); List<PageAction> actionList = PageActionDbManager.retrieve(db, pageId, lang); List<PageItem> itemList = PageItemDbManager.retrieve(db, pageId, lang); PageTimer timer = PageTimerDbManager.retrieve(db, pageId, lang); List<PageChecklist> checkList = PageChecklistDbManager.retrieve(db, pageId, lang); page = new Page(pageId, lang, pageType, pageTitle, pageIntro, pageWarning, pageComponent, statusList, actionList, itemList, pageContent, timer, successId, failedId, checkList, heading, secOrder); } c.close(); return page; } public static List<Page> retrieve(SQLiteDatabase db, String lang) throws SQLException { List<Page> pageList = new ArrayList<Page>(); Cursor c = db.query(TABLE_PAGE, null, PAGE_LANGUAGE + "=?", new String[]{lang}, null, null, null); if (c != null && c.getCount() > 0) { c.moveToFirst(); while (!c.isAfterLast()) { String pageId = c.getString(c.getColumnIndex(PAGE_ID)); String pageType = c.getString(c.getColumnIndex(PAGE_TYPE)); String pageTitle = c.getString(c.getColumnIndex(PAGE_TITLE)); String pageIntro = c.getString(c.getColumnIndex(PAGE_INTRODUCTION)); String pageWarning = c.getString(c.getColumnIndex(PAGE_WARNING)); String pageComponent = c.getString(c.getColumnIndex(PAGE_COMPONENT)); String pageContent = c.getString(c.getColumnIndex(PAGE_CONTENT)); String successId = c.getString(c.getColumnIndex(PAGE_SUCCESS_ID)); String failedId = c.getString(c.getColumnIndex(PAGE_FAILED_ID)); String heading = c.getString(c.getColumnIndex(PAGE_HEADING)); String secOrder = c.getString(c.getColumnIndex(PAGE_SECTION_ORDER)); List<PageStatus> statusList = PageStatusDbManager.retrieve(db, pageId, lang); List<PageAction> actionList = PageActionDbManager.retrieve(db, pageId, lang); List<PageItem> itemList = PageItemDbManager.retrieve(db, pageId, lang); PageTimer timer = PageTimerDbManager.retrieve(db, pageId, lang); List<PageChecklist> checkList = PageChecklistDbManager.retrieve(db, pageId, lang); Page page = new Page(pageId, lang, pageType, pageTitle, pageIntro, pageWarning, pageComponent, statusList, actionList, itemList, pageContent, timer, successId, failedId, checkList, heading, secOrder); pageList.add(page); c.moveToNext(); } } c.close(); return pageList; } public static long update(SQLiteDatabase db, Page page) throws SQLException { ContentValues cv = new ContentValues(); cv.put(PAGE_TYPE, page.getType()); cv.put(PAGE_TITLE, page.getTitle()); cv.put(PAGE_INTRODUCTION, page.getIntroduction()); cv.put(PAGE_WARNING, page.getWarning()); cv.put(PAGE_COMPONENT, page.getComponent()); cv.put(PAGE_CONTENT, page.getContent()); cv.put(PAGE_SUCCESS_ID, page.getSuccessId()); cv.put(PAGE_FAILED_ID, page.getFailedId()); cv.put(PAGE_HEADING, page.getHeading()); cv.put(PAGE_SECTION_ORDER, page.getSectionOrder()); return db.update(TABLE_PAGE, cv, PAGE_ID + "=? AND " + PAGE_LANGUAGE + "=?", new String[]{page.getId(), page.getLang()}); } public static boolean isExist(SQLiteDatabase db, String pageId, String lang) throws SQLException { boolean itemExist = false; Cursor c = db.query(TABLE_PAGE, null, PAGE_ID + "=? AND " + PAGE_LANGUAGE + "=?", new String[]{pageId, lang}, null, null, null); if ((c != null) && (c.getCount() > 0)) { itemExist = true; } c.close(); return itemExist; } public static void insertOrUpdate(SQLiteDatabase db, Page page){ if(isExist(db, page.getId(), page.getLang())){ update(db, page); } else{ insert(db, page); } } public static int delete(SQLiteDatabase db, String pageId, String lang){ return db.delete(TABLE_PAGE, PAGE_ID + "=? AND " + PAGE_LANGUAGE + "=?", new String[]{pageId, lang}); } }
[ "wng.jiefan@gmail.com" ]
wng.jiefan@gmail.com
e8d1d7368cfbc0003c0b29aeb227f3492f268e4b
48e835e6f176a8ac9ae3ca718e8922891f1e5a18
/benchmark/training/com/google/cloud/DateTest.java
08e4a2c145ab3fd9d082a988c44dc0c85b377755
[]
no_license
STAMP-project/dspot-experiments
f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5
121487e65cdce6988081b67f21bbc6731354a47f
refs/heads/master
2023-02-07T14:40:12.919811
2019-11-06T07:17:09
2019-11-06T07:17:09
75,710,758
14
19
null
2023-01-26T23:57:41
2016-12-06T08:27:42
null
UTF-8
Java
false
false
3,187
java
/** * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.cloud; import com.google.common.testing.EqualsTester; import java.text.ParseException; import java.text.SimpleDateFormat; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; /** * Unit tests for {@link Date}. */ @RunWith(JUnit4.class) public class DateTest { private static final SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); @Test public void parseDate() { Date date = Date.parseDate("2016-09-18"); assertThat(date.getYear()).isEqualTo(2016); assertThat(date.getMonth()).isEqualTo(9); assertThat(date.getDayOfMonth()).isEqualTo(18); } @Test public void testToString() { Date date = Date.fromYearMonthDay(10, 9, 5); assertThat(date.toString()).isEqualTo("0010-09-05"); date = Date.fromYearMonthDay(2016, 12, 31); assertThat(date.toString()).isEqualTo("2016-12-31"); date = Date.fromYearMonthDay(1, 1, 1); assertThat(date.toString()).isEqualTo("0001-01-01"); } @Test public void equalAndHashCode() { Date d1 = Date.fromYearMonthDay(2016, 9, 18); Date d2 = Date.fromYearMonthDay(2016, 9, 18); Date d3 = Date.fromYearMonthDay(2016, 9, 19); EqualsTester tester = new EqualsTester(); tester.addEqualityGroup(d1, d2); tester.addEqualityGroup(d3); } @Test public void validOrdering() { Date d1 = Date.fromYearMonthDay(2016, 9, 18); Date d2 = Date.fromYearMonthDay(2016, 9, 19); Date d3 = Date.fromYearMonthDay(2016, 9, 20); Date d4 = Date.fromYearMonthDay(2016, 10, 1); Date d5 = Date.fromYearMonthDay(2017, 1, 1); assertDescending(d5, d4, d3, d2, d1); } @Test public void serialization() { reserializeAndAssert(Date.fromYearMonthDay(2017, 4, 20)); } @Test public void testToJavaUtilDate() throws ParseException { Date gcDate = Date.parseDate("2016-09-18"); java.util.Date juDate1 = DateTest.SIMPLE_DATE_FORMAT.parse("2016-09-18"); java.util.Date juDate2 = Date.toJavaUtilDate(gcDate); assertThat(juDate1).isEqualTo(juDate2); } @Test public void testFromJavaUtilDate() throws ParseException { java.util.Date juDate = DateTest.SIMPLE_DATE_FORMAT.parse("2016-09-18"); Date gcDate = Date.fromJavaUtilDate(juDate); assertThat(gcDate.getYear()).isEqualTo(2016); assertThat(gcDate.getMonth()).isEqualTo(9); assertThat(gcDate.getDayOfMonth()).isEqualTo(18); } }
[ "benjamin.danglot@inria.fr" ]
benjamin.danglot@inria.fr
712f1c343d6bd43b7928cf13777c8d42a2cfbbdc
718bbc09370691f7564220d82bc3a735b61ed089
/src/test/java/com/itexpt/seltest/test/DriverUtls.java
531e9b3be83661266bcbdba43270cdc0ca802ca1
[]
no_license
yabanakh/MySelPrg2
f9e6b23676af325a1058211f62a52cca3f4f9000
a079bdca6cca43f87cc1e42e6c870a4ac30090f0
refs/heads/master
2020-12-22T02:00:08.210103
2020-01-28T01:51:04
2020-01-28T01:51:04
236,636,730
0
0
null
2020-10-13T19:06:53
2020-01-28T01:47:42
Java
UTF-8
Java
false
false
765
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.itexpt.seltest.test; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.remote.DesiredCapabilities; /** * * @author yaban */ public class DriverUtls { public static WebDriver getChromeDriver(){ System.setProperty("webdriver.chrome.driver", "c:\\qa\\drivers\\chromedriver.exe"); DesiredCapabilities capabilities=DesiredCapabilities.chrome(); return new ChromeDriver(capabilities); } public static void main (String[] args){ getChromeDriver(); } }
[ "yabanakh@gmail.com" ]
yabanakh@gmail.com
2e9d8c5e9ae3f3bd0a28456a17d325c1fd4b61ea
81c700c2c62d07b01392706f6e36a7fb9d95d657
/backend/auth/src/main/java/com/samuel/urlshortener/core/usecase/UseCase.java
63a32bb677357c51fb3dbb1a166b952b141bb54a
[]
no_license
scys12/urlshortener
babce847fbc58f0cbdfa7a230b17467aba7b0efd
54d60deb2f54383df48adabcf89c736a37c882cc
refs/heads/main
2023-06-18T23:58:24.237347
2021-07-20T12:36:54
2021-07-20T12:36:54
296,908,611
2
0
null
null
null
null
UTF-8
Java
false
false
278
java
package com.samuel.urlshortener.core.usecase; public abstract class UseCase<I extends UseCase.InputValues, O extends UseCase.OutputValues> { public abstract O execute(I input); public interface InputValues { } public interface OutputValues { } }
[ "sinambelasam03@gmail.com" ]
sinambelasam03@gmail.com
32e420cadc2182d7dff337f52efd7150c11815f9
5d1fc477b017acc0042fe71b3de463e06d199b50
/src/main/java/com/happybudui/venuesystem/wrapper/ResponseResult.java
a16df6957229b56b3ff522fc822e09991fd9124a
[ "MIT" ]
permissive
happybuduiorg/venuesystem
9dda72446a4f7dba1dd0b7977b1913cb8a4dac7a
4ff22f77c0a1d053c1cab66cbca377cd918d1cd6
refs/heads/master
2020-04-09T05:39:49.967012
2018-12-04T14:39:52
2018-12-04T14:39:52
160,068,045
0
0
null
null
null
null
UTF-8
Java
false
false
1,358
java
package com.happybudui.venuesystem.wrapper; import com.fasterxml.jackson.annotation.JsonInclude; //CopyRight © 2018-2018 Happybudui All Rights Reserved. //Written by Happybudui @JsonInclude(JsonInclude.Include.NON_EMPTY) public class ResponseResult<T> { private boolean success; private int errorcode; private String message; private T data; public ResponseResult() { } ResponseResult(boolean success, int errorcode,String message) { this.success = success; this.errorcode = errorcode; this.message = message; } ResponseResult(boolean success, int errorcode, String message, T data) { this.success = success; this.errorcode = errorcode; this.message = message; this.data = data; } public boolean isSuccess() { return success; } public void setSuccess(boolean success) { this.success = success; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public int getErrorcode() { return errorcode; } public void setErrorcode(int errorcode) { this.errorcode = errorcode; } public T getData() { return data; } public void setData(T data) { this.data = data; } }
[ "one_how@163.com" ]
one_how@163.com
5e24beb8611b65a0bb2e52b6a98a628012405a78
63895b6ec2b1d554cfce92fe83f97874b9a0384a
/BinaryTree/src/_105ConstructBTPreorderInorder.java
70b7d19df2b79caa02b07fefab1888c20060f0b6
[]
no_license
Elliiee/CSNotesLT
31fc8295826a19a937e320eb47f559c2820593e8
8bc8bebf923cc8cfbbe66ab2320f0d259e123058
refs/heads/master
2022-06-18T17:42:29.970060
2020-05-05T04:45:58
2020-05-05T04:45:58
257,099,508
0
0
null
null
null
null
UTF-8
Java
false
false
1,007
java
import java.util.HashMap; public class _105ConstructBTPreorderInorder { private int preorderFirst; private int[] preorder; private int[] inorder; HashMap<Integer, Integer> inorderIndexMap = new HashMap<>(); public TreeNode buildTree(int[] preorder, int[] inorder) { this.preorder = preorder; this.inorder = inorder; this.preorderFirst = 0; int inorderIndex = 0; for (Integer i : inorder){ inorderIndexMap.put(i, inorderIndex++); } return buildNode(0, inorder.length - 1); } private TreeNode buildNode(int inLeft, int inRight){ if (inLeft > inRight) return null; int rootVal = preorder[preorderFirst]; TreeNode root = new TreeNode(rootVal); int inorderRootIndex = inorderIndexMap.get(rootVal); preorderFirst++; root.left = buildNode(inLeft, inorderRootIndex - 1); root.right = buildNode(inorderRootIndex + 1, inRight); return root; } }
[ "danyiluozhang@gmail.com" ]
danyiluozhang@gmail.com
bfce57c2914fc53dfa51e33bf50835206e97058d
6485bbe2ea39b44d6dd3f587cd03eaeea90ac7d7
/src/main/java/com/manoriega/dolarhoy/config/SpringSecurityConfig.java
711bbd169f19456d4112e3f5be33a1d89b0b9ebe
[]
no_license
manuelnoriega13/dolarhoy
434acaf776422cc31007b0d3dec9e9916f062868
097efad30026f50bb906fd0ce3d89196acc3a2f9
refs/heads/master
2022-09-10T09:36:29.121930
2018-11-26T03:51:15
2018-11-26T03:51:15
149,163,363
0
0
null
2022-09-01T22:30:03
2018-09-17T17:35:15
JavaScript
UTF-8
Java
false
false
1,789
java
//package com.manoriega.dolarhoy.config; // //import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.context.annotation.Configuration; //import org.springframework.security.authentication.AuthenticationManager; //import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; //import org.springframework.security.config.annotation.web.builders.HttpSecurity; //import org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration; //import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; //import org.springframework.security.core.userdetails.User; //import org.springframework.security.crypto.factory.PasswordEncoderFactories; //import org.springframework.security.crypto.password.PasswordEncoder; //import sun.security.util.Password; // //@Configuration //public class SpringSecurityConfig extends WebSecurityConfigurerAdapter { // // @Autowired // public void configureGlobal(AuthenticationManagerBuilder build) throws Exception { // // PasswordEncoder encoder = PasswordEncoderFactories.createDelegatingPasswordEncoder(); // User.UserBuilder user = User.builder().passwordEncoder(encoder::encode); // // build.inMemoryAuthentication().withUser(user.username("admin").password("1234").roles("ADMIN", "USER")) // .withUser(user.username("manuel").password("1313").roles("USER")); // } // // @Override // protected void configure(HttpSecurity http) throws Exception { // http.authorizeRequests().antMatchers("/","/dolar/**", "/css/**", "/js/**", "/images/**").permitAll() // .antMatchers("form").hasAnyRole("ADMIN").anyRequest().authenticated(); // } //}
[ "manuelnoriega13@gmail.com" ]
manuelnoriega13@gmail.com
c3e970c33bbfb7e4295ed194949d4306871c261a
ef51db085cfafe331b530019fa7935addd60be64
/FragmentExample2/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/androidx/asynclayoutinflater/R.java
0839c523e2bee199f0fb74b0058474527b23c011
[ "Apache-2.0" ]
permissive
pamunoz/android_advanced_codelabs
a4a6fb0ce0d3ba9d450f4def5e6897e58962de99
5fa158d1a71ac75f47e7572f96da738ce5447b7c
refs/heads/master
2020-05-09T11:12:58.309903
2019-05-09T19:00:25
2019-05-09T19:00:25
181,048,736
0
0
null
null
null
null
UTF-8
Java
false
false
10,459
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package androidx.asynclayoutinflater; public final class R { private R() {} public static final class attr { private attr() {} public static final int alpha = 0x7f020027; public static final int font = 0x7f020083; public static final int fontProviderAuthority = 0x7f020085; public static final int fontProviderCerts = 0x7f020086; public static final int fontProviderFetchStrategy = 0x7f020087; public static final int fontProviderFetchTimeout = 0x7f020088; public static final int fontProviderPackage = 0x7f020089; public static final int fontProviderQuery = 0x7f02008a; public static final int fontStyle = 0x7f02008b; public static final int fontVariationSettings = 0x7f02008c; public static final int fontWeight = 0x7f02008d; public static final int ttcIndex = 0x7f02014b; } public static final class color { private color() {} public static final int notification_action_color_filter = 0x7f040040; public static final int notification_icon_bg_color = 0x7f040041; public static final int ripple_material_light = 0x7f04004c; public static final int secondary_text_default_material_light = 0x7f04004e; } public static final class dimen { private dimen() {} public static final int compat_button_inset_horizontal_material = 0x7f050050; public static final int compat_button_inset_vertical_material = 0x7f050051; public static final int compat_button_padding_horizontal_material = 0x7f050052; public static final int compat_button_padding_vertical_material = 0x7f050053; public static final int compat_control_corner_material = 0x7f050054; public static final int compat_notification_large_icon_max_height = 0x7f050055; public static final int compat_notification_large_icon_max_width = 0x7f050056; public static final int notification_action_icon_size = 0x7f050063; public static final int notification_action_text_size = 0x7f050064; public static final int notification_big_circle_margin = 0x7f050065; public static final int notification_content_margin_start = 0x7f050066; public static final int notification_large_icon_height = 0x7f050067; public static final int notification_large_icon_width = 0x7f050068; public static final int notification_main_column_padding_top = 0x7f050069; public static final int notification_media_narrow_margin = 0x7f05006a; public static final int notification_right_icon_size = 0x7f05006b; public static final int notification_right_side_padding_top = 0x7f05006c; public static final int notification_small_icon_background_padding = 0x7f05006d; public static final int notification_small_icon_size_as_large = 0x7f05006e; public static final int notification_subtext_size = 0x7f05006f; public static final int notification_top_pad = 0x7f050070; public static final int notification_top_pad_large_text = 0x7f050071; } public static final class drawable { private drawable() {} public static final int notification_action_background = 0x7f06005f; public static final int notification_bg = 0x7f060060; public static final int notification_bg_low = 0x7f060061; public static final int notification_bg_low_normal = 0x7f060062; public static final int notification_bg_low_pressed = 0x7f060063; public static final int notification_bg_normal = 0x7f060064; public static final int notification_bg_normal_pressed = 0x7f060065; public static final int notification_icon_background = 0x7f060066; public static final int notification_template_icon_bg = 0x7f060067; public static final int notification_template_icon_low_bg = 0x7f060068; public static final int notification_tile_bg = 0x7f060069; public static final int notify_panel_notification_icon_bg = 0x7f06006a; } public static final class id { private id() {} public static final int action_container = 0x7f07002f; public static final int action_divider = 0x7f070031; public static final int action_image = 0x7f070032; public static final int action_text = 0x7f070038; public static final int actions = 0x7f070039; public static final int async = 0x7f070040; public static final int blocking = 0x7f070043; public static final int chronometer = 0x7f07004e; public static final int forever = 0x7f070064; public static final int icon = 0x7f07006b; public static final int icon_group = 0x7f07006c; public static final int info = 0x7f070070; public static final int italic = 0x7f070072; public static final int line1 = 0x7f070074; public static final int line3 = 0x7f070075; public static final int normal = 0x7f07007e; public static final int notification_background = 0x7f07007f; public static final int notification_main_column = 0x7f070080; public static final int notification_main_column_container = 0x7f070081; public static final int right_icon = 0x7f07008f; public static final int right_side = 0x7f070090; public static final int tag_transition_group = 0x7f0700b7; public static final int tag_unhandled_key_event_manager = 0x7f0700b8; public static final int tag_unhandled_key_listeners = 0x7f0700b9; public static final int text = 0x7f0700ba; public static final int text2 = 0x7f0700bb; public static final int time = 0x7f0700be; public static final int title = 0x7f0700bf; } public static final class integer { private integer() {} public static final int status_bar_notification_info_maxnum = 0x7f080004; } public static final class layout { private layout() {} public static final int notification_action = 0x7f0a001f; public static final int notification_action_tombstone = 0x7f0a0020; public static final int notification_template_custom_big = 0x7f0a0027; public static final int notification_template_icon_group = 0x7f0a0028; public static final int notification_template_part_chronometer = 0x7f0a002c; public static final int notification_template_part_time = 0x7f0a002d; } public static final class string { private string() {} public static final int status_bar_notification_info_overflow = 0x7f0c0026; } public static final class style { private style() {} public static final int TextAppearance_Compat_Notification = 0x7f0d00ed; public static final int TextAppearance_Compat_Notification_Info = 0x7f0d00ee; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0d00f0; public static final int TextAppearance_Compat_Notification_Time = 0x7f0d00f3; public static final int TextAppearance_Compat_Notification_Title = 0x7f0d00f5; public static final int Widget_Compat_NotificationActionContainer = 0x7f0d0161; public static final int Widget_Compat_NotificationActionText = 0x7f0d0162; } public static final class styleable { private styleable() {} public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f020027 }; public static final int ColorStateListItem_android_color = 0; public static final int ColorStateListItem_android_alpha = 1; public static final int ColorStateListItem_alpha = 2; public static final int[] FontFamily = { 0x7f020085, 0x7f020086, 0x7f020087, 0x7f020088, 0x7f020089, 0x7f02008a }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f020083, 0x7f02008b, 0x7f02008c, 0x7f02008d, 0x7f02014b }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_android_ttcIndex = 3; public static final int FontFamilyFont_android_fontVariationSettings = 4; public static final int FontFamilyFont_font = 5; public static final int FontFamilyFont_fontStyle = 6; public static final int FontFamilyFont_fontVariationSettings = 7; public static final int FontFamilyFont_fontWeight = 8; public static final int FontFamilyFont_ttcIndex = 9; public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 }; public static final int GradientColor_android_startColor = 0; public static final int GradientColor_android_endColor = 1; public static final int GradientColor_android_type = 2; public static final int GradientColor_android_centerX = 3; public static final int GradientColor_android_centerY = 4; public static final int GradientColor_android_gradientRadius = 5; public static final int GradientColor_android_tileMode = 6; public static final int GradientColor_android_centerColor = 7; public static final int GradientColor_android_startX = 8; public static final int GradientColor_android_startY = 9; public static final int GradientColor_android_endX = 10; public static final int GradientColor_android_endY = 11; public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 }; public static final int GradientColorItem_android_color = 0; public static final int GradientColorItem_android_offset = 1; } }
[ "pfariasmunoz@gmail.com" ]
pfariasmunoz@gmail.com
db359d109cf71abdea1e80450fa0a52bbab901b8
79302b85a9c7d8a93575d23b92a09520f37b7b06
/src/leetcode/Code_003_LongestSubString.java
c925f0ea22992f9a5551181f7ef6a3ce23e0569a
[]
no_license
ColdLight230/Foundation
83265c18f88d96034c0149c5a6e32cf7dda66588
20f560545c2dfcc24778eeaa5349cfc0299896c1
refs/heads/master
2021-07-08T17:25:14.743812
2020-08-05T12:14:08
2020-08-05T12:14:08
160,897,117
0
0
null
null
null
null
UTF-8
Java
false
false
3,936
java
package leetcode; import java.util.HashMap; /** * Longest Substring Without Repeating Characters * <p> * Given a string, find the length of the longest substring without repeating characters. * <p> * Example 1: * <p> * Input: "abcabcbb" * Output: 3 * Explanation: The answer is "abc", with the length of 3. * Example 2: * <p> * Input: "bbbbb" * Output: 1 * Explanation: The answer is "b", with the length of 1. * Example 3: * <p> * Input: "pwwkew" * Output: 3 * Explanation: The answer is "wke", with the length of 3. * Note that the answer must be a substring, "pwke" is a subsequence and not a substring. */ public class Code_003_LongestSubString { static class Helper { public int preIndex = 0; public int nextIndex = 0; public int curIndex = 0; public Helper() { } } // public static int lengthOfLongestSubstring(String s) { // if (s == null || s.length() == 0) { // return 0; // } // if (s.length() == 1) { // return 1; // } // char[] chars = s.toCharArray(); // HashMap<Character, Integer> map = new HashMap<>(); // Helper[] hasRepeat = new Helper[s.length()]; // for (int i = 0; i < chars.length; i++) { // hasRepeat[i] = new Helper(); // hasRepeat[i].curIndex = i; // hasRepeat[i].preIndex = i; // hasRepeat[i].nextIndex = chars.length - 1; // if (map.containsKey(chars[i])) { // hasRepeat[i].preIndex = map.get(chars[i]); // hasRepeat[map.get(chars[i])].nextIndex = i; // } // map.put(chars[i], i); // } // int maxOffset = 0; // HashSet set = new HashSet(); // for (Helper helper : hasRepeat) { // int curOffset; // if (helper.curIndex != helper.preIndex && chars.length - 1 != helper.nextIndex) { // curOffset = (helper.nextIndex - helper.curIndex) + (helper.curIndex - helper.preIndex) - 1; // } else { // curOffset = (helper.nextIndex - helper.curIndex) + (helper.curIndex - helper.preIndex); // } // if (curOffset > maxOffset) { // for (int i = helper.preIndex; i <= helper.nextIndex; i++) { // set.add(chars[i]); // } // if (set.size() != curOffset) { // curOffset = 0; // } // set.clear(); // } // maxOffset = curOffset > maxOffset ? curOffset : maxOffset; // } // return maxOffset == 0 ? s.length() : maxOffset; // } // hashmap 解法 public static int lengthOfLongestSubstring(String s) { if (s == null || s.length() == 0) { return 0; } if (s.length() == 1) { return 1; } char[] chars = s.toCharArray(); int max = 0; HashMap<Character, Integer> map = new HashMap<>(); for (int i = 0, j = 0; i < chars.length; i++) { if (map.containsKey(chars[i])) { // 这个 j 是精妙的一笔,永远是指向每个不同子序列的第一个位置 // 存在相同的时候,就把 j 往后挪一步 j = Math.max(j, map.get(chars[i]) + 1); } map.put(chars[i], i); max = Math.max(max, i - j + 1); } return max; } public static void main(String[] args) { // input bbbbb -> b -> 1 // input pwwkew -> wke -> 3 // input abcabcbb -> abc -> 3 // input abcdaefgha -> bcdaefgh ->8 String s = "bbbbb"; // String s = "pwwkew"; // String s = "abcabcbb"; // String s = "abcdaefgha"; // String s = "a"; // String s = "aab"; // String s = "asljlj"; System.out.println(lengthOfLongestSubstring(s)); } }
[ "xuliang@qiushibaike.com" ]
xuliang@qiushibaike.com
689a5bd6f8101dcd750fde1462ed9a276caf8fb1
34c8b01849d7265c73bcc696e7f0c11312c7f84d
/src/java/org/apache/commons/jelly/impl/TextScript.java
ec8fda1e5c0ca5dc4fc877aa6afe19d808d4a21f
[ "Apache-2.0" ]
permissive
pwntester/jelly
03ddb422005970ddfc86f0e1cc7c5b5a84f7e431
cb7966734f339619e5ee8e57b08009acbf5e1d10
refs/heads/master
2021-01-16T11:55:47.916026
2017-11-27T20:21:47
2017-11-27T20:21:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,365
java
/* * Copyright 2002,2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.jelly.impl; import org.apache.commons.jelly.JellyContext; import org.apache.commons.jelly.JellyTagException; import org.apache.commons.jelly.Script; import org.apache.commons.jelly.XMLOutput; import org.xml.sax.SAXException; /** <p><code>TextScript</code> outputs some static text.</p> * * @author <a href="mailto:jstrachan@apache.org">James Strachan</a> * @version $Revision: 155420 $ */ public class TextScript implements Script { /** the text output by this script */ private String text; public TextScript() { } public TextScript(String text) { this.text = text; } public String toString() { return super.toString() + "[text=" + text + "]"; } /** * Trims whitespace if this is ignorable whitespace. */ public void trimWhitespace() { if(text.trim().length()==0) this.text = ""; } /** @return the text output by this script */ public String getText() { return text; } /** Sets the text output by this script */ public void setText(String text) { this.text = text; } // Script interface //------------------------------------------------------------------------- public Script compile() { return this; } /** Evaluates the body of a tag */ public void run(JellyContext context, XMLOutput output) throws JellyTagException { if ( text != null ) { try { output.write(text); } catch (SAXException e) { throw new JellyTagException("could not write to XMLOutput",e); } } } }
[ "kk@kohsuke.org" ]
kk@kohsuke.org
d56e102b6ea76baa47695153bb2446345081493e
208ff39815fd6126e4ea726e6ba8be6a20576d07
/app/src/main/java/com/dimana/bobo/bobodimanaapp/Rest/ApiClient.java
21c332e479fc27acb1e903bcf4321aea3a60b8b9
[]
no_license
ikowirya/BoboDimanaApp
6f1b4acdf413908cdbc8c68ee5f5809051e926b7
6ca8ba02002338cb3062c6cd98970a36b5f53c11
refs/heads/master
2020-04-11T11:31:46.951134
2018-12-21T10:16:45
2018-12-21T10:16:45
161,750,735
0
0
null
null
null
null
UTF-8
Java
false
false
819
java
package com.dimana.bobo.bobodimanaapp.Rest; import java.util.concurrent.TimeUnit; import okhttp3.OkHttpClient; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; public class ApiClient { private static Retrofit retrofit = null; public static Retrofit getClient() { //interval koneksi OkHttpClient client = new OkHttpClient.Builder() .connectTimeout(60, TimeUnit.SECONDS) .readTimeout(60, TimeUnit.SECONDS) .build(); //koneksi retrofit = new Retrofit.Builder() .baseUrl("http://192.168.43.81/rest_server/index.php/api/") .addConverterFactory(GsonConverterFactory.create()) .client(client) .build(); return retrofit; } }
[ "ikoqirya@gmail.com" ]
ikoqirya@gmail.com
f730d33a67417e0a207516ac8c7e1f404673c10c
0609091f8d71b6c90a2d4fed4138f7038e7bf9e2
/app/src/main/java/com/ldcovid19project/OnlineDoctorsActivity.java
1f7625835fed603888ecf0ffd4968402b27ee300
[]
no_license
COVID-19-Apps/LD-Covid-19-Project
995cfb3272c865541d2c85186355d96c913943fd
0f760da435c6fb7a26937e691eb70e47b6c41c9d
refs/heads/master
2022-11-19T19:39:54.126318
2020-07-20T07:05:03
2020-07-20T07:05:03
281,040,219
0
0
null
null
null
null
UTF-8
Java
false
false
6,934
java
package com.ldcovid19project; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.SearchView; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.app.SearchManager; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.net.ConnectivityManager; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.Toast; import com.ldcovid19project.Adapter.PersonAdapter; import com.ldcovid19project.Models.Persons; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class OnlineDoctorsActivity extends AppCompatActivity implements PersonAdapter.SearchAdapterListener { private FloatingActionButton Add; private RecyclerView mPersonList; private PersonAdapter personAdapter; private List<Persons> personsList; private RelativeLayout mNoPersons; private DatabaseReference mPersonsDatabase; private SearchView searchView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_online_doctors); Add = findViewById(R.id.add); mNoPersons = findViewById(R.id.no_persons); mPersonList = findViewById(R.id.volunteer_list); mPersonsDatabase = FirebaseDatabase.getInstance().getReference().child("Persons"); mPersonsDatabase.keepSynced(true); mPersonList.setHasFixedSize(true); LinearLayoutManager mLayoutManager = new LinearLayoutManager(this); mPersonList.setLayoutManager(mLayoutManager); personsList = new ArrayList<>(); personAdapter = new PersonAdapter(this, personsList, this); mPersonList.setAdapter(personAdapter); readPersons("Doctor Online Appointment"); Add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (isNetworkConnected()) { AlertDialog.Builder builder = new AlertDialog.Builder(OnlineDoctorsActivity.this); builder.setMessage("Do you want to become Online Doctor ?").setTitle("Doctor Online Appointment"); builder.setCancelable(false) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent intent = new Intent(OnlineDoctorsActivity.this, ConfirmActivity.class); startActivity(intent); dialog.dismiss(); } }) .setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.setTitle("Doctor Online Appointment"); alert.show(); } else { Toast.makeText(OnlineDoctorsActivity.this, "Connect to Internet", Toast.LENGTH_SHORT).show(); } } }); } private void readPersons(final String title) { mPersonsDatabase.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { if (dataSnapshot.exists()) { personsList.clear(); for (DataSnapshot snapshot : dataSnapshot.getChildren()) { Persons myStatus = snapshot.getValue(Persons.class); if (myStatus.getType().contains(title)) personsList.add(myStatus); } if (!personsList.isEmpty()) { mPersonList.setVisibility(View.VISIBLE); mNoPersons.setVisibility(View.GONE); personAdapter.notifyDataSetChanged(); }else{ mNoPersons.setVisibility(View.VISIBLE); mPersonList.setVisibility(View.GONE); } } else { mNoPersons.setVisibility(View.VISIBLE); mPersonList.setVisibility(View.GONE); } } @Override public void onCancelled(DatabaseError databaseError) { } }); } private boolean isNetworkConnected() { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); return cm.getActiveNetworkInfo() != null && cm.getActiveNetworkInfo().isConnected(); } @Override public void onSearchSelected(Persons persons) { } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_search, menu); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); searchView = (SearchView) menu.findItem(R.id.action_search) .getActionView(); searchView.setSearchableInfo(searchManager .getSearchableInfo(getComponentName())); searchView.setMaxWidth(Integer.MAX_VALUE); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { personAdapter.getFilter().filter(query); return false; } @Override public boolean onQueryTextChange(String query) { personAdapter.getFilter().filter(query); return false; } }); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_search) { return true; } return super.onOptionsItemSelected(item); } }
[ "anandhamurthy2000@gmail.com" ]
anandhamurthy2000@gmail.com
3cfc21a2ac3adb0598d913a66a4c794bf9c05e37
b56a92e25308f0979b1ff12ff04e31d6e3c69e5b
/main/src/test/java/ru/timmson/CompoundInterestCalculatorShould.java
4d40d20e7dcda4215c8d9bbd6a9e90bd471fbafa
[ "MIT" ]
permissive
timmson/java-engineering-study
32182e6cd99c4b782ab79805462d222a6420c9ed
37df3f370f203e8763157e3fd32ef9ff06b64eee
refs/heads/master
2021-10-20T17:25:44.690412
2021-10-16T10:48:18
2021-10-16T10:48:18
204,785,326
0
0
null
null
null
null
UTF-8
Java
false
false
709
java
package ru.timmson; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; public class CompoundInterestCalculatorShould { @Test void giveRevenueByOneYear() { final var amount = 1000.0; final var interestRate = 0.05; final var years = 1; final double revenue = Calc.convert(amount, interestRate, years); assertEquals(1050.0, revenue); } @Test void giveRevenueByTwoYear() { final var amount = 1000.0; final var interestRate = 0.05; final var years = 2; final double revenue = Calc.convert(amount, interestRate, years); assertEquals(1102.5, revenue); } }
[ "timmson666@mail.ru" ]
timmson666@mail.ru
f49d17af3f9fc04117178d1642fc348f8f4215ca
925ee2d77997ad588a79cb368840eba41034651e
/Tetris-4A/PieceEnFormeDeEsse.java
d53e105f6a10dcf20a3af5dda63d1395e3a78f8b
[]
no_license
Mankouri/Tris-Te-de-l-espace
3edfa73a961f6b64a7f07a6af1fbe0f02c00b143
da23233e735a13c3e5cb8713e9e20588d2a08568
refs/heads/master
2016-08-12T17:33:36.868770
2016-04-03T21:49:18
2016-04-03T21:49:18
55,365,565
0
0
null
null
null
null
UTF-8
Java
false
false
707
java
/** * Piece de type: forme en 'S'. * @author Ange FOFE, Jalil MANKOURI & Andy HARVEL; * @version $Revision: 1.0 $ */ public class PieceEnFormeDeEsse extends Piece { /** * Constructeur de la piece en 'S'. * @param posX Position X de la piece. * @param posY Position Y de la piece. */ public PieceEnFormeDeEsse(int posX, int posY) { super(posX, posY); /* Le 'S' tient dans une matrice 3x3: */ mat = new Matrix(3); /* On choisit une couleur aleatoire: */ int couleur = (int) (Math.random() * 4); /* Dessine la forme d'un 'S' dans la matrice: */ mat.setVal(1, 1, couleur); mat.setVal(2, 1, couleur); mat.setVal(0, 2, couleur); mat.setVal(1, 2, couleur); } }
[ "ange_2894@hotmail.fr" ]
ange_2894@hotmail.fr
6f7f5e59ca6cdd7362d1537e80c869d07e65f513
b814ecfa50da6c2423f5969641a5fadc972c6aea
/Hamburguesas/src/modelo/Pedido.java
bf9c68a15cd37ba98fa3baec9a375e5f088dbd04
[]
no_license
DPOO-Talleres/Taller1
4e81de85581814848b9ced8c36aab5bcab5d365c
117a29f83d74bd927773198bcf67fce181af325d
refs/heads/master
2023-07-16T15:58:43.876353
2021-09-06T04:10:22
2021-09-06T04:10:22
402,787,537
0
0
null
2021-09-03T13:55:49
2021-09-03T13:55:49
null
ISO-8859-3
Java
false
false
3,191
java
package modelo; import java.util.ArrayList; import java.util.List; import Logica.Restaurante; public class Pedido { private int numeroPedidos; private int idPedido; private String nombreCliente; private String direccionCliente; private Restaurante restaurante; private ArrayList<Producto_Menu> productos=new ArrayList<>(); public boolean listo=false; public Pedido (String pnombreCliente, String pdireccionCliente ) { direccionCliente= pdireccionCliente; nombreCliente=pnombreCliente; } public int getId() { // idPedido=restaurante.pedidos.size(); return idPedido; } public void agregarProducto(Producto_Menu nuevoItem) { if (restaurante.menus1.get(nuevoItem)!=null) { productos.add(nuevoItem); } else { System.out.println("No se ha encontrado el producto"); } } public ArrayList<Producto_Menu> listaDeProductos() { return (ArrayList<Producto_Menu>) productos; } public int getPrecioNetoPedido() { int precioNetoPedido=0; for (int i=0; i<=productos.size(); i++) { precioNetoPedido+= Integer.parseInt(productos.get(i).getPrecioBase()) ; } return precioNetoPedido; } public int getPrecioIVAPedido() { int precioIVAPedido=0; for(int i=0; i<=productos.size() ; i++) { int precioProducto= Integer.parseInt(productos.get(i).getPrecioBase()); int precioProductoIVA = (int) (0.19*precioProducto); precioIVAPedido+=precioProductoIVA; } return precioIVAPedido; } public int getPrecioTotalPedido() { int precioTotalPedido=0; int precioIVA= getPrecioIVAPedido(); int precioNeto= getPrecioNetoPedido(); precioTotalPedido= precioIVA+precioNeto; return precioTotalPedido; } public boolean darEstado() { return listo; } public String generarTextoFactura() { listo=true; System.out.println(" +++++++++++++++ FACTURA +++++++++++++++ "); System.out.println("Id Pedido: "+idPedido); System.out.println("Nombre Cliente: "+nombreCliente); System.out.println("Dirección: "+direccionCliente); for (int i=0; i<=productos.size(); i++) { System.out.println("Nombre producto: "+productos.get(i).getNombre() + " Precio: "+productos.get(i).getPrecioBase()); } System.out.println("Precio Neto del pedido: "+getPrecioNetoPedido()); System.out.println("Precio IVA del pedido: "+getPrecioIVAPedido()); System.out.println("Precio Total del pedido: "+getPrecioTotalPedido()); return""; } public String consultarInfoPedido() { System.out.println(" +++++++++++++++ INFO PEDIDO +++++++++++++++ "); System.out.println("Id Pedido: "+idPedido); System.out.println("Nombre Cliente: "+nombreCliente); System.out.println("Dirección: "+direccionCliente); for (int i=0; i<=productos.size(); i++) { System.out.println("Nombre producto: "+productos.get(i).getNombre() + " Precio: "+productos.get(i).getPrecioBase()); } System.out.println("Precio Neto del pedido: "+getPrecioNetoPedido()); System.out.println("Precio IVA del pedido: "+getPrecioIVAPedido()); System.out.println("Precio Total del pedido: "+getPrecioTotalPedido()); return""; } }
[ "s.diazm1@uniandes.edu.co" ]
s.diazm1@uniandes.edu.co
9d813543a05bc5eaa16e0caa6be89fabcdf4949e
5d61b3eb60b220e1053f2411f3bf20cd359ff3a4
/src/main/java/br/edu/ifes/sr/devweb/musyk/web/persistencia/Dao.java
2a2e05f6be893e522dbdc04fe3735aaa8649e65f
[]
no_license
MarcosDias/Musyk
728b63c0f9ce566ad7378aaf4b53cffb7437489c
bc504839a1294a2e126b4315b3b858b2340f2d19
refs/heads/master
2021-01-25T03:40:37.007424
2015-08-04T00:30:14
2015-08-04T00:30:14
35,940,269
0
0
null
null
null
null
UTF-8
Java
false
false
456
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 br.edu.ifes.sr.devweb.musyk.web.persistencia; import br.edu.ifes.sr.devweb.musyk.web.conexao.HibernateUtil; import lombok.Setter; import org.hibernate.Session; /** * * @author marcosdias */ @Setter public abstract class Dao{ protected Session session; }
[ "marcos.a.melo.dias@gmail.com" ]
marcos.a.melo.dias@gmail.com
b69d25c13656f23488406c7d2765d9493e0baa95
d2d30b2f6ede894b1c639c42d92e524a4b8dbbb2
/demo/springcloud/service_ribbon/src/main/java/cloud/service/ribbon/service/HelloService.java
1c8d57ef8ed3f3ce962e427374cd886d08aa6115
[]
no_license
492304732/notes
613f5dfb9459eb472c2a1b9e52e761fe2a4afa8f
679cd1261f9a24346fea7ff18a6dedda0ce11d84
refs/heads/master
2021-10-06T12:54:26.585787
2021-10-06T07:14:44
2021-10-06T07:14:44
130,651,160
0
0
null
null
null
null
UTF-8
Java
false
false
638
java
package cloud.service.ribbon.service; import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; @Service public class HelloService { @Autowired RestTemplate restTemplate; @HystrixCommand(fallbackMethod = "hiError") public String hiService(String name) { return restTemplate.getForObject("http://SERVICE-HI/hi?name="+name,String.class); } public String hiError(String name) { return "hi,"+name+",sorry,error!"; } }
[ "492304732@qq.com" ]
492304732@qq.com
66ed0b7808dedec71446bfa0e674fd53162f9cb2
a56b05b45e66cde7b533e88e23642a984f65ce68
/app/src/main/java/com/epicodus/shoppinglist/util/ItemTouchHelperAdapter.java
9cde391f3d04023db6c74e371ae91458e5991475
[ "MIT" ]
permissive
epangelinan/ShoppingList
7f44b6d9d8919232a2d6d90a144c6106a51c5750
e9eb92312cfb438cc1bd91a553ffcff56d925dab
refs/heads/master
2021-07-20T20:56:29.219471
2017-10-30T01:04:00
2017-10-30T01:04:00
105,486,981
0
0
null
null
null
null
UTF-8
Java
false
false
181
java
package com.epicodus.shoppinglist.util; public interface ItemTouchHelperAdapter { boolean onItemMove(int fromPosition, int toPosition); void onItemDismiss(int position); }
[ "esveth@aol.com" ]
esveth@aol.com
c2feda429acf5aa07b2f972c2e2336bcd254048a
7f9cc42a27e986a2adf1e6fd394c99cf6f9cf57c
/test/projectpaqman/GameEventTypeTest.java
02357f9093a285b3db7b413cc737c9eae009a422
[]
no_license
Jerrold01/PaQman
509996f5df8184db7b3414ef764b63ad05b2ba44
2042a67c650e5737451c4497aa78fb630334734a
refs/heads/master
2021-03-12T22:36:44.420915
2014-06-24T20:29:14
2014-06-24T20:29:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
724
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 projectpaqman; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.*; /** * * @author kevinwareman */ public class GameEventTypeTest { public GameEventTypeTest() { } @BeforeClass public static void setUpClass() { } @AfterClass public static void tearDownClass() { } @Before public void setUp() { } @After public void tearDown() { } }
[ "Kevin Wareman" ]
Kevin Wareman
9d804f7fc03466dd9bbbbded5016a491c1dafc31
e9a168309d1f54890612e7dbaf7575c96b1eeae7
/project_master/app/src/main/java/com/example/project_master/recycleView/adaptater/CheckpointAdaptater.java
2dd8dbaeecb4bac7ec6044eb6f5a80cda4926622
[]
no_license
ajdin14200/ASProject
70dd9721eb1397f198a6fd85e49dee508ad19398
ff30efca554d2f29e26d02e3820c1bb90558b213
refs/heads/master
2021-05-17T02:55:40.600986
2020-03-28T16:37:30
2020-03-28T16:37:30
250,586,017
0
0
null
null
null
null
UTF-8
Java
false
false
2,456
java
package com.example.project_master.recycleView.adaptater; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.example.project_master.model.Checkpoint; import com.example.project_master.R; import com.example.project_master.recycleView.viewHolder.CheckpointViewHolder; import java.util.ArrayList; public class CheckpointAdaptater extends RecyclerView.Adapter<CheckpointViewHolder> { Context context; ArrayList<Checkpoint> arrayList; Checkpoint checkpoint; public CheckpointAdaptater(Context context, ArrayList<Checkpoint> arrayList) { this.context = context; this.arrayList = arrayList; } @NonNull @Override public CheckpointViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(context).inflate(R.layout.recycler_checkpoint, parent, false); return new CheckpointViewHolder(view); } @Override public void onBindViewHolder(@NonNull CheckpointViewHolder holder, final int position) { checkpoint=arrayList.get(position); holder.bind(checkpoint); holder.itemView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { final AlertDialog.Builder confirmation= new AlertDialog.Builder(context); confirmation.setMessage(R.string.messagecheckpoint); confirmation.setPositiveButton(R.string.removeYes,new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { arrayList.remove(checkpoint); notifyDataSetChanged(); } }); confirmation.setNegativeButton(R.string.removeNo, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); confirmation.show(); return false; } }); } @Override public int getItemCount() { return arrayList.size(); } }
[ "anis.71@hotmailt.fr" ]
anis.71@hotmailt.fr
a78b8e959fb3a30f7df7b1640bdf302f588f607e
470a7abc183dc9e0c9bbb93a92f35c82f4bf34e0
/src/main/java/com/furknyavuz/test/HappyCubePuzzle.java
cef51fd44064cebe2fec4152b80e24bda47eb989
[]
no_license
furknyavuz/happyCubeSolver
de1488ae770c318e262a13c81c4390e8aac4a711
379ab6538d70cdd05defa93ee4f6dc771c1026da
refs/heads/master
2021-01-10T11:09:59.507155
2015-09-25T00:51:22
2015-09-25T00:51:22
43,098,574
1
0
null
null
null
null
UTF-8
Java
false
false
1,149
java
package com.furknyavuz.test; import com.furknyavuz.test.algorithm.BruteForceSolver; import com.furknyavuz.test.input.InMemoryInput; import com.furknyavuz.test.input.Input; import com.furknyavuz.test.algorithm.Solver; import java.io.*; /** * Happy Cube Puzzle * Created by furkan on 06.09.2015. */ public class HappyCubePuzzle { public static void main( String[] args ) { try { // Create input object Input input = new InMemoryInput(); // Initialize solver with input Solver solver = new BruteForceSolver(input.getPieces()); // Solve the problem String result = solver.execute(); // Print the result printToFile(result); } catch (Exception e) { e.printStackTrace(); } } private static void printToFile(String input) throws IOException { File file = new File("result.txt"); file.createNewFile(); PrintWriter out = new PrintWriter(file); String newInput = input.replaceAll("\n", System.lineSeparator()); out.println(newInput); out.close(); } }
[ "furknyavuz@gmail.com" ]
furknyavuz@gmail.com
0db34b737579da029c77bc7553509a20da1201d9
2fb4f07c330901757d1220f9d6ac07bac35daaff
/src/main/java/cn/beatree/paillier/entity/Numbers.java
03f301c15a725c40417ca9cf34d28c4cc3191b28
[]
no_license
seasky100/Paillier-Server
04db083affcc1b8bcbdd05e99720fb0b5bcede72
3d938d7cff9b5854953587e40227505909652d71
refs/heads/master
2022-12-30T02:40:31.149809
2020-09-28T14:58:12
2020-09-28T14:58:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
153
java
package cn.beatree.paillier.entity; import lombok.Data; import java.math.BigInteger; @Data public class Numbers { private BigInteger[] numbers; }
[ "1336951311@qq.com" ]
1336951311@qq.com
34750e6fc368d8491c8cdd14c2aa477380d671e1
f089cb4883da7899e5ec4f66a12d2b9e3c680943
/src/main/java/ma/sid/exceptions/RestResponseEntityExceptionHandler.java
fd3610d407a60f003067a3bc26af9171add4c162
[]
no_license
soufiane-id/gestion-facture-services
a8dcd1b60a9815afdabe40d5153f1541a6e6d6c6
12c1cb1302c56d9be01c0f357d894165267d2429
refs/heads/master
2022-12-04T02:29:21.396671
2020-08-23T00:13:36
2020-08-23T00:13:36
212,868,146
0
0
null
null
null
null
UTF-8
Java
false
false
1,136
java
package ma.sid.exceptions; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; import java.util.Date; @RestControllerAdvice public class RestResponseEntityExceptionHandler extends ResponseEntityExceptionHandler { @ExceptionHandler(value = { DataIntegrityViolationException.class}) public ResponseEntity<Object> constraintViolationException(DataIntegrityViolationException ex) { JSONExceptionResponse apiError = new JSONExceptionResponse(new Date(), HttpStatus.BAD_REQUEST, "Violation de la contrainte d\'unicité : Vérifier que l\'enregistrement n\'existe pas déjà", ex.getLocalizedMessage()); return new ResponseEntity<Object>( apiError, new HttpHeaders(), apiError.getStatus()); } }
[ "soufiane.idbrahim@gmail.com" ]
soufiane.idbrahim@gmail.com
74164d98a51fabf932e812b018acd7e3395952d4
2b84bd00a37ac2517645032c41fcfd864458765f
/app/src/main/java/io/moresushant48/saveyourwork/Model/User.java
0d2f6fe056685d23cd5c78927838691b1c0d1480
[]
no_license
moresushant48/SaveYourWork-Android
e90e591c545dd33172a662f66f755af96f5d0d1a
982903667e70856c7ca2d7fa1fe790a4abfce5fd
refs/heads/master
2020-08-09T01:04:08.510131
2020-05-06T15:12:21
2020-05-06T15:12:21
213,963,061
0
0
null
null
null
null
UTF-8
Java
false
false
1,373
java
package io.moresushant48.saveyourwork.Model; public class User { private int id; private String email; private String username; private String password; private String publicPass; private Role role; public User(int id, String email, String username, String password, String publicPass, Role role) { this.id = id; this.email = email; this.username = username; this.password = password; this.publicPass = publicPass; this.role = role; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getPublicPass() { return publicPass; } public void setPublicPass(String publicPass) { this.publicPass = publicPass; } public Role getRole() { return role; } public void setRole(Role role) { this.role = role; } }
[ "moresushant48@gmail.com" ]
moresushant48@gmail.com
8c577422b20b43636c8b8457923d9bbb16c14f52
40665051fadf3fb75e5a8f655362126c1a2a3af6
/ibinti-bugvm/247be47827899ba1da9c6dfdac9fdb3509672f45/5372/FaultRecoveringOutputStream.java
ae7c41c2db6301cb4512deae8896ec163fec3710
[]
no_license
fermadeiral/StyleErrors
6f44379207e8490ba618365c54bdfef554fc4fde
d1a6149d9526eb757cf053bc971dbd92b2bfcdf1
refs/heads/master
2020-07-15T12:55:10.564494
2019-10-24T02:30:45
2019-10-24T02:30:45
205,546,543
2
0
null
null
null
null
UTF-8
Java
false
false
5,427
java
/* * Copyright (C) 2013 Square, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.bugvm.okhttp.internal; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; import static com.bugvm.okhttp.internal.Util.checkOffsetAndCount; /** * An output stream wrapper that recovers from failures in the underlying stream * by replacing it with another stream. This class buffers a fixed amount of * data under the assumption that failures occur early in a stream's life. * If a failure occurs after the buffer has been exhausted, no recovery is * attempted. * * <p>Subclasses must override {@link #replacementStream} which will request a * replacement stream each time an {@link IOException} is encountered on the * current stream. */ public abstract class FaultRecoveringOutputStream extends AbstractOutputStream { private final int maxReplayBufferLength; /** Bytes to transmit on the replacement stream, or null if no recovery is possible. */ private ByteArrayOutputStream replayBuffer; private OutputStream out; /** * @param maxReplayBufferLength the maximum number of successfully written * bytes to buffer so they can be replayed in the event of an error. * Failure recoveries are not possible once this limit has been exceeded. */ public FaultRecoveringOutputStream(int maxReplayBufferLength, OutputStream out) { if (maxReplayBufferLength < 0) throw new IllegalArgumentException(); this.maxReplayBufferLength = maxReplayBufferLength; this.replayBuffer = new ByteArrayOutputStream(maxReplayBufferLength); this.out = out; } @Override public final void write(byte[] buffer, int offset, int count) throws IOException { if (closed) throw new IOException("stream closed"); checkOffsetAndCount(buffer.length, offset, count); while (true) { try { out.write(buffer, offset, count); if (replayBuffer != null) { if (count + replayBuffer.size() > maxReplayBufferLength) { // Failure recovery is no longer possible once we overflow the replay buffer. replayBuffer = null; } else { // Remember the written bytes to the replay buffer. replayBuffer.write(buffer, offset, count); } } return; } catch (IOException e) { if (!recover(e)) throw e; } } } @Override public final void flush() throws IOException { if (closed) { return; // don't throw; this stream might have been closed on the caller's behalf } while (true) { try { out.flush(); return; } catch (IOException e) { if (!recover(e)) throw e; } } } @Override public final void close() throws IOException { if (closed) { return; } while (true) { try { out.close(); closed = true; return; } catch (IOException e) { if (!recover(e)) throw e; } } } /** * Attempt to replace {@code out} with another equivalent stream. Returns true * if a suitable replacement stream was found. */ private boolean recover(IOException e) { if (replayBuffer == null) { return false; // Can't recover because we've dropped data that we would need to replay. } while (true) { OutputStream replacementStream = null; try { replacementStream = replacementStream(e); if (replacementStream == null) { return false; } replaceStream(replacementStream); return true; } catch (IOException replacementStreamFailure) { // The replacement was also broken. Loop to ask for another replacement. Util.closeQuietly(replacementStream); e = replacementStreamFailure; } } } /** * Returns true if errors in the underlying stream can currently be recovered. */ public boolean isRecoverable() { return replayBuffer != null; } /** * Replaces the current output stream with {@code replacementStream}, writing * any replay bytes to it if they exist. The current output stream is closed. */ public final void replaceStream(OutputStream replacementStream) throws IOException { if (!isRecoverable()) { throw new IllegalStateException(); } if (this.out == replacementStream) { return; // Don't replace a stream with itself. } replayBuffer.writeTo(replacementStream); Util.closeQuietly(out); out = replacementStream; } /** * Returns a replacement output stream to recover from {@code e} thrown by the * previous stream. Returns a new OutputStream if recovery was successful, in * which case all previously-written data will be replayed. Returns null if * the failure cannot be recovered. */ protected abstract OutputStream replacementStream(IOException e) throws IOException; }
[ "fer.madeiral@gmail.com" ]
fer.madeiral@gmail.com
f1c1ca34f8cacfd69a322ad981f21024cf6cb373
03e24b333daa2041ecefc3ce8f7febd517ac0c66
/src/com/pcbje/ahbm/CaseWrapper.java
c8f727b36f80f82557c77f16c2f96a9e74e5d99f
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
peterclemenko/autopsy-ahbm
f12d3fc1882bfe9cfed1dab551ee735108455bb8
0f919e174348e3fc06036e8762ae2691d4282f3a
refs/heads/master
2021-12-21T22:28:13.599456
2013-10-28T17:17:25
2013-10-28T17:17:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,293
java
/** * This work is made available under the Apache License, Version 2.0. * * 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.pcbje.ahbm; import com.pcbje.ahbm.matchable.Matchable; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.util.Properties; import org.openide.util.Exceptions; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.ingest.IngestMessage; import org.sleuthkit.autopsy.ingest.IngestServices; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.TskCoreException; /** * * @author pcbje */ public class CaseWrapper { private static final int AHBM_MAX_FILE_SIZE = 64; private static final int READ_BUFFER_SIZE = 1024; private static final String DEFAULT_SKIP_KNOWN_GOOD_FILES = "false"; private static final String DEFAULT_AGAINST_EXISTING = "false"; private volatile int messageID = 0; public File getFileInModuleDir(String pathRelativeToModule) { StringBuilder path = new StringBuilder(); path.append(Case.getCurrentCase().getModulesOutputDirAbsPath()); path.append(File.separator); path.append("AHBM"); path.append(File.separator); path.append(pathRelativeToModule); File file = new File(path.toString()); if (!file.getParentFile().exists()) { file.getParentFile().mkdirs(); } return file; } public Content getContentById(long objId) throws TskCoreException { return Case.getCurrentCase().getSleuthkitCase().getContentById(objId); } public void addOverizeWarning(Content content) throws TskCoreException { IngestServices.getDefault().postMessage(IngestMessage. createMessage(messageID++, IngestMessage.MessageType.WARNING, AhbmIngestModule.getDefault(), String.format("File %s is too large for AHBM", content.getUniquePath()))); } public void addMatchNotice(Matchable probe) throws TskCoreException { String name = probe.getContent().getName(); IngestServices.getDefault().postMessage(IngestMessage. createMessage(messageID++, IngestMessage.MessageType.INFO, AhbmIngestModule.getDefault(), String.format("Found AHBM hits for %s", name))); } public Properties getProperties() { Properties props = new Properties(); props.setProperty("ahbm.max.file.size", Integer.toString(AHBM_MAX_FILE_SIZE)); props.setProperty("read.buffer.size", Integer.toString(READ_BUFFER_SIZE)); props.setProperty("ahbm.skip.known.good", DEFAULT_SKIP_KNOWN_GOOD_FILES); props.setProperty("ahbm.against.existing", DEFAULT_AGAINST_EXISTING); try { props.load(new FileInputStream(getFileInModuleDir("ahbm.properties"))); } catch (FileNotFoundException ex) { storeProperties(props); } catch (IOException ex) { Exceptions.printStackTrace(ex); } return props; } public void readFile(OutputStream baos, int bufferSize, Content content) { byte[] buffer = new byte[bufferSize]; try { for (long pos = 0; pos < content.getSize(); pos = pos + buffer.length) { int remaining = (int) Math.min(content.getSize() - pos, buffer.length); int read = content.read(buffer, pos, remaining); baos.write(buffer, 0, read); } } catch (Exception e) { Exceptions.printStackTrace(e); } } public void storeProperties(Properties properties) { try { properties.store(new FileOutputStream(getFileInModuleDir("ahbm.properties")), null); } catch (IOException ex1) { Exceptions.printStackTrace(ex1); } } }
[ "petter.bjelland@gmail.com" ]
petter.bjelland@gmail.com
60de58473dccc0cde4e0da2bdd6e7c6ea09c0d22
4ff2af6df91cf977ddbcf5e177e2cc57f0eebd0b
/src/helpers/Protein.java
432ac5255e571d7dc20f6445a21e205d0a7f972e
[]
no_license
kkF1796/HbVar
da0feb3e70f363165875055448fab7d2bac403cd
e4798eef02a5f10b9efa0a905a0bc132a75ee3ef
refs/heads/main
2023-03-31T16:47:09.272963
2021-04-11T12:51:29
2021-04-11T12:51:29
356,865,551
0
0
null
null
null
null
UTF-8
Java
false
false
1,576
java
package helpers; public class Protein { private ProteinEnum[] proteinTab= {ProteinEnum.beta, ProteinEnum.alpha1,ProteinEnum.alpha2, ProteinEnum.Ggamma,ProteinEnum.Agamma,ProteinEnum.delta}; private ProteinEnum protein; public Protein(){ } // used when the name is given public Protein(String name){ for(ProteinEnum protein: proteinTab){ if(name.equals(protein.getNameHbVar())){ this.protein=protein; break; } } } public String getNameHbVar(){ return this.protein.getNameHbVar(); } public String getName(){ return this.protein.getName(); } public String getIdSwissProt(){ return this.protein.getIdSwissProt(); } public int getLength(){ return this.protein.getLength(); } public String getSequence(){ return this.protein.getSequence(); } /* Function that calculates the monoisotopic mass of the protein*/ public double getMonoisoMass(){ AminoAcid acidAmin; String sequence= this.getSequence(); double mass=0; int i; for(i=0;i<sequence.length();i++){ acidAmin=new AminoAcid(sequence.charAt(i)); mass += acidAmin.getMonoisoMass(); } return mass; } /* Function that calculates the average mass of the protein*/ public double getAverageMass(){ AminoAcid acidAmin; String sequence= this.getSequence(); double mass=0; int i; for(i=0;i<sequence.length();i++){ acidAmin=new AminoAcid(sequence.charAt(i)); mass += acidAmin.getAverageMass(); } return mass; } }
[ "favre.kathleen@orange.fr" ]
favre.kathleen@orange.fr
e99601ed312f862cfc608f4b0aa04b3ab055ce60
699c3c05401813da60c9080af794aa39ef8479e8
/owllinkhttpxml/src/main/java/org/semanticweb/owlapi/owllink/server/parser/OWLlinkGetFlattenedDataPropertySourcesElementHandler.java
14ed18013d0a7e4becf72e72b232dc744ab82109
[ "EPL-2.0", "Apache-2.0" ]
permissive
sisinflab-swot/owllink-matchmaking-extension
7201a0b82f42819d46ba7abb4220b1b41c24fb34
4bc6300bbde1a35576eac0324616d40131aa2fbf
refs/heads/master
2021-08-07T13:13:28.823760
2020-06-08T19:10:40
2020-06-08T19:10:40
227,086,030
1
0
Apache-2.0
2020-10-13T18:07:13
2019-12-10T10:06:05
Java
UTF-8
Java
false
false
3,225
java
/* * This file is part of the OWLlink API. * * The contents of this file are subject to the LGPL License, Version 3.0. * * Copyright (C) 2011, derivo GmbH * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see http://www.gnu.org/licenses/. * * * Alternatively, the contents of this file may be used under the terms of the Apache License, Version 2.0 * in which case, the provisions of the Apache License Version 2.0 are applicable instead of those above. * * Copyright 2011, derivo GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.semanticweb.owlapi.owllink.server.parser; import org.coode.owlapi.owlxmlparser.OWLLiteralElementHandler; import org.coode.owlapi.owlxmlparser.OWLXMLParserException; import org.coode.owlapi.owlxmlparser.OWLXMLParserHandler; import org.semanticweb.owlapi.model.OWLLiteral; import org.semanticweb.owlapi.owllink.OWLlinkXMLVocabulary; import org.semanticweb.owlapi.owllink.builtin.requests.GetFlattenedDataPropertySources; /** * Author: Olaf Noppens * Date: 28.11.2009 */ public class OWLlinkGetFlattenedDataPropertySourcesElementHandler extends AbstractOWLlinkDataPropertyElementHandler<GetFlattenedDataPropertySources> { protected boolean isNegative = false; protected OWLLiteral literal; public OWLlinkGetFlattenedDataPropertySourcesElementHandler(OWLXMLParserHandler handler) { super(handler); } public void startElement(String name) throws OWLXMLParserException { super.startElement(name); isNegative = false; } public void attribute(String localName, String value) throws OWLXMLParserException { super.attribute(localName, value); if (OWLlinkXMLVocabulary.NEGATIVE_ATTRIBUTE.getShortName().equals(localName)) { isNegative = Boolean.valueOf(value); } } public void handleChild(OWLLiteralElementHandler handler) throws OWLXMLParserException { this.literal = handler.getOWLObject(); } public GetFlattenedDataPropertySources getOWLObject() throws OWLXMLParserException { return new GetFlattenedDataPropertySources(getKB(), getObject(), literal, isNegative); } }
[ "ievasaverio@gmail.com" ]
ievasaverio@gmail.com
a65cf9233380f66cb6cf9ec5df2fe20dcca69c2d
543626a533a9fd03445d83063632ad36f637bfc7
/src/main/java/com/zhaomenghan/dao/AdminDao.java
9be8cb35a01817143a540ef6fafb5f1522cfb129
[]
no_license
Zhaomenghan512/XLWB
ea081667d0f7eede80b25d12bd98b3e6c908c241
fc40ddb8d70dfef312f56932fdff366efc914084
refs/heads/master
2023-01-04T20:31:49.343911
2020-11-05T15:11:07
2020-11-05T15:11:07
310,335,235
0
0
null
null
null
null
UTF-8
Java
false
false
300
java
package com.zhaomenghan.dao; import com.zhaomenghan.domain.Admin; import org.springframework.stereotype.Component; @Component public interface AdminDao { /** * 通过用户名查询管理员用户 * @param username * @return */ Admin findAdminByName(String username); }
[ "58596010+Zhaomenghan512@users.noreply.github.com" ]
58596010+Zhaomenghan512@users.noreply.github.com
bfae87380070d183631d2c9a3654087acaf89b91
d0c43aa56c4f32071c4176700ab81378a68751de
/src/main/java/io/github/pascalgrimaud/crm/repository/ProductOrderRepository.java
a6fb2b6e758e19470d0db87375cabc74f10cfc1d
[]
no_license
pascalgrimaud/jh-issue-13855-crm
c23fb548ce3a34eaeb71db41821d0ad64bd6bcf4
15e265aad9d97061630019a88a34d12df0a42e9f
refs/heads/main
2023-03-01T19:01:29.028337
2021-02-13T13:06:46
2021-02-13T13:06:46
338,623,238
0
0
null
2021-02-13T17:00:21
2021-02-13T16:59:29
Java
UTF-8
Java
false
false
398
java
package io.github.pascalgrimaud.crm.repository; import io.github.pascalgrimaud.crm.domain.ProductOrder; import org.springframework.data.jpa.repository.*; import org.springframework.stereotype.Repository; /** * Spring Data SQL repository for the ProductOrder entity. */ @SuppressWarnings("unused") @Repository public interface ProductOrderRepository extends JpaRepository<ProductOrder, Long> {}
[ "pascalgrimaud@gmail.com" ]
pascalgrimaud@gmail.com
744f463630c7b34ba99b04045f76754511b2745f
8168302aece7797e5fd46f6af87553bd06f2dc43
/src/main/java/com/chainalysis/cryptoprice/exchange/ExchangeService.java
1687acf1ebe9fc2cc1e3d7da085e78dc542f0152
[]
no_license
aisenkim/BACKUP-_crypto_price_backend
7b16ed2617c3497132d5a5ad229b10804ed546ed
36be7e110b6abb58b0c5f2252ab1d23f3b05f851
refs/heads/main
2023-08-28T21:37:56.458417
2021-10-28T03:36:33
2021-10-28T03:36:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,407
java
package com.chainalysis.cryptoprice.exchange; import org.springframework.web.util.UriComponentsBuilder; import java.math.BigDecimal; import java.net.URI; import java.util.Map; public interface ExchangeService { /** * API call to retrieve last trade closed coin value * @param coinSymbol - (BTC, ETH) * @return - price */ String getPrice(String coinSymbol); /** * Calls API to retrieve maker fee and taker fee * @param coinSymbol - (BTC, ETH) * @return - mapped as {takerFee : "value", makerFee: "value"} */ Map<String, String> getFees(String coinSymbol); /** * Convert URL to URI * @param url - API URL * @return API in URI format */ static URI buildURI(String url) { UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(url); return builder.build().encode().toUri(); } /** * Returns buyer price and seller price in string format */ Map<String, String> getBuySellPrice(String coinSymbol); /** * Calculates price with fees combined * @param price - featured coin price * @param fees - adding a makers or takers fee * @return - total price in String format */ static String calculatePrice(BigDecimal price, BigDecimal fees) { BigDecimal feePrice = price.multiply(fees); return price.add(feePrice).toString(); } }
[ "aisenkim15@gmail.com" ]
aisenkim15@gmail.com
ff97bd675350d45fd4bedc5cd6defb278431114d
79595075622ded0bf43023f716389f61d8e96e94
/app/src/main/java/android/service/autofill/RequiredValidators.java
118ade67d6bd007312c49a1e976116ea3551d28b
[]
no_license
dstmath/OppoR15
96f1f7bb4d9cfad47609316debc55095edcd6b56
b9a4da845af251213d7b4c1b35db3e2415290c96
refs/heads/master
2020-03-24T16:52:14.198588
2019-05-27T02:24:53
2019-05-27T02:24:53
142,840,716
7
4
null
null
null
null
UTF-8
Java
false
false
1,515
java
package android.service.autofill; import android.os.Parcel; import android.os.Parcelable.Creator; import android.view.autofill.Helper; import com.android.internal.util.Preconditions; final class RequiredValidators extends InternalValidator { public static final Creator<RequiredValidators> CREATOR = new Creator<RequiredValidators>() { public RequiredValidators createFromParcel(Parcel parcel) { return new RequiredValidators((InternalValidator[]) parcel.readParcelableArray(null, InternalValidator.class)); } public RequiredValidators[] newArray(int size) { return new RequiredValidators[size]; } }; private final InternalValidator[] mValidators; RequiredValidators(InternalValidator[] validators) { this.mValidators = (InternalValidator[]) Preconditions.checkArrayElementsNotNull(validators, "validators"); } public boolean isValid(ValueFinder finder) { for (InternalValidator validator : this.mValidators) { if (!validator.isValid(finder)) { return false; } } return true; } public String toString() { if (Helper.sDebug) { return "RequiredValidators: [validators=" + this.mValidators + "]"; } return super.toString(); } public int describeContents() { return 0; } public void writeToParcel(Parcel dest, int flags) { dest.writeParcelableArray(this.mValidators, flags); } }
[ "toor@debian.toor" ]
toor@debian.toor
71b0bb7157cb25552e79f39ce4df107b89fa9281
7896c3914c03d011ecb89ba9bca6707b3d8e4f19
/core/src/main/java/juniter/core/utils/ExecUtils.java
856e3b8216acd2a284e4aa58e79d77fc0be75302
[]
no_license
Bertrandbenj/juniter
f0c98da2230a466b411966a9c797271ddf04836e
0be954480ba24754b653af82c3c92678b65fdcad
refs/heads/master
2020-03-21T10:16:15.035791
2020-01-22T12:15:19
2020-01-22T12:15:19
138,442,065
4
1
null
2019-07-31T12:29:18
2018-06-24T00:19:44
Java
UTF-8
Java
false
false
1,288
java
package juniter.core.utils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; public class ExecUtils { private static final Logger LOG = LogManager.getLogger(ExecUtils.class); /** * Fail safe command execution * TODO : streamline that for god sake, no need to have 2 intermediate disk write * * @param cmd : * @return : */ public static Object run(String cmd) { try { LOG.info("Executing : " + cmd); final Process process = new ProcessBuilder("bash", "-c", cmd).start(); final ArrayList<String> output = new ArrayList<>(); final BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream())); String line = null; while ((line = br.readLine()) != null) { output.add(line); LOG.info(line); } // There should really be a timeout here. if (0 != process.waitFor()) return null; return output; } catch (final Exception e1) { LOG.error("executing "+cmd, e1); } return null; } }
[ "bertrandbenj@gmail.com" ]
bertrandbenj@gmail.com
87acdf7f8e09119e9174698b1f700fd46a508139
a2f9d3f6ed3b3ebeb1f7a1ff80f79c64e048ac22
/src/mips/RInstruction.java
44b346f343263910499dee925213cec30ce98b79
[]
no_license
weidaru/mips_disassembler
96ce89c845b76dcbaecdf333dbcfbb9aa21f4871
c34f1dd809dad3341a08866da99cb825676aa1a3
refs/heads/master
2021-01-04T02:37:48.617569
2013-10-09T06:11:28
2013-10-09T06:11:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,605
java
package mips; import java.util.TreeMap; public class RInstruction extends Instruction { private Register rs; private Register rt; private Register rd; private int shamt; private int funct; public static TreeMap<Integer, String> fmMap = null; static { fmMap = new TreeMap<Integer, String>(); fmMap.put(0x20, "add"); fmMap.put(0x21, "addu"); fmMap.put(0x24, "and"); fmMap.put(0x8, "jr"); fmMap.put(0x27, "nor"); fmMap.put(0x25, "or"); fmMap.put(0x2a, "slt"); fmMap.put(0x2b, "sltu"); fmMap.put(0x0, "sll"); fmMap.put(0x2, "srt"); fmMap.put(0x22, "sub"); fmMap.put(0x23, "subu"); } public RInstruction(int pcAddr, int code) { super(pcAddr, code); rs = Register.registerMap.get((machineCode>>21) & 0x1f); rt = Register.registerMap.get((machineCode>>16) & 0x1f); rd = Register.registerMap.get((machineCode>>11) & 0x1f); shamt = (machineCode>>6) & 0x1f; funct = machineCode & 0x3f; mnemonic = fmMap.get(funct); } public String toString() { switch(funct) { case 0x20: case 0x21: case 0x24: case 0x27: case 0x25: case 0x2a: case 0x2b: case 0x22: case 0x23: return mnemonic+" "+rd.name+", "+rs.name+", "+rt.name; case 0x08: return mnemonic+" "+rs.name; case 0x00: case 0x02: return mnemonic+" "+rd.name+", "+rt.name+", "+Integer.toHexString(shamt); default: return null; } } public Register getRs() { return rs; } public Register getRt() { return rt; } public Register getRd() { return rd; } public int getShamt() { return shamt; } public int getFunct() { return funct; } }
[ "weidaru@gmail.com" ]
weidaru@gmail.com
f46627c0014d70a177dc742136817287b4930918
a52d6bb42e75ef0678cfcd291e5696a9e358fc4d
/af_webapp/src/main/java/org/kuali/kfs/module/purap/businessobject/PurchaseRequisitionItemUseTax.java
d17ca7b9e428f14c2591762271669c6e6ef87295
[]
no_license
Ariah-Group/Finance
894e39cfeda8f6fdb4f48a4917045c0bc50050c5
ca49930ca456799f99aad57e1e974453d8fe479d
refs/heads/master
2021-01-21T12:11:40.987504
2016-03-24T14:22:40
2016-03-24T14:22:40
26,879,430
0
0
null
null
null
null
UTF-8
Java
false
false
749
java
/* * Copyright 2008 The Kuali Foundation * * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.kuali.kfs.module.purap.businessobject; public class PurchaseRequisitionItemUseTax extends PurApItemUseTaxBase { }
[ "code@ariahgroup.org" ]
code@ariahgroup.org
037c3c83fa3cc68ddff1ceb6d8e8090225b27ad8
ce9b6a3385534cc62df16d9769ad8ff5e0eb087e
/JDBC DEMO/src/com/beans/Book.java
611a3d8f52c4e392a1d83c9e8e4295d38da0dd98
[]
no_license
qwerty123jdh/readUs
c282abdc936e4aa3816509e34686d2f8dd4415c4
f54b0ac887835ace4b2611e4bf2a1b9d9b6d6db0
refs/heads/master
2020-03-27T04:35:14.285325
2018-08-24T05:21:46
2018-08-24T05:21:46
145,952,089
0
0
null
null
null
null
UTF-8
Java
false
false
1,055
java
package com.beans; public class Book { private String isbn; private String name; private String publication; private String author; public Book() { isbn ="One"; name = "Core Java"; publication="My Publication"; author = "Sen"; } @Override public String toString() { return "Book [isbn=" + isbn + ", name=" + name + ", publication=" + publication + ", author =" + author + "]"; } public Book(String isbn, String name, String publication, double price) { super(); this.isbn = isbn; this.name = name; this.publication = publication; this.author = author; } public String getIsbn() { return isbn; } public void setIsbn(String isbn) { this.isbn = isbn; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPublication() { return publication; } public void setPublication(String publication) { this.publication = publication; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } }
[ "sensoumajit@gmail.com" ]
sensoumajit@gmail.com
9411ca13c6adc0dd76a660a2ea6e381904a639f5
5201cc60bd408eb765cee693847a5bfa8df6ab16
/src/airBNB/PropInfo.java
c8f4e4f79ef77ac962b62aeec52047644a71af3e
[]
no_license
jagxman/AirBnB2.0
72dc33ceb9652ecd7bc6356e2eda5fc488f1220d
a11e179ce55e42f4d185ec3b8fd833e8bcea6a68
refs/heads/main
2023-08-25T06:41:12.686849
2023-08-04T00:19:45
2023-08-04T00:19:45
325,196,782
0
0
null
null
null
null
UTF-8
Java
false
false
43,388
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 airBNB; import javax.swing.JOptionPane; import java.util.Map; import java.sql.*; import javax.swing.DefaultListModel; import java.util.logging.Logger; import java.util.logging.Level; /** * * @author Administrator */ public class PropInfo extends javax.swing.JFrame { private Map<String, String> bundle; private Map<String, String> rental; private Connection conn; /** * Creates new form login */ public PropInfo() { initComponents(); } public PropInfo(Map<String, String> bundle, Map<String, String> rental, Connection conn){ this(); this.bundle = bundle; this.rental = rental; this.conn = conn; populateFields(); populateContractInfo(); } private void populateFields() { DefaultListModel model = new DefaultListModel(); Statement st = null; try { String q = String.format("select * from project.property where property_id=%s", rental.get("property_id")); st = conn.createStatement(); ResultSet rs = st.executeQuery(q); while(rs.next()) { Property.setText(rs.getString("propertytype")); Room.setText(rs.getString("roomtype")); Accommodates.setText(rs.getString("accommodates")); Amenities.setText(rs.getString("amenities")); Bathrooms.setText(rs.getString("bathroom")); Beds.setText(rs.getString("bedroom")); Date.setText(rs.getString("availabledate")); Price.setText(rs.getString("price")); Country.setText(rs.getString("country")); Location.setText(rs.getString("houseno") + " " + rs.getString("street") + " " + rs.getString("city")); } rs.close(); st.close(); } catch(SQLException ex) { Logger.getLogger(PropInfo.class.getName()).log(Level.SEVERE, ex, null); } } private void populateContractInfo(){ StartDate.setText(rental.get("startdate")); EndDate.setText(rental.get("enddate")); } /** * 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() { jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); FrameClose1 = new javax.swing.JLabel(); PropLabel1 = new javax.swing.JLabel(); RoomTypeLabel = new javax.swing.JLabel(); AccommodatesLabel = new javax.swing.JLabel(); AmenitiesLabel = new javax.swing.JLabel(); BathroomLabel = new javax.swing.JLabel(); BedLabel = new javax.swing.JLabel(); AvailableDateLabel = new javax.swing.JLabel(); PriceLabel = new javax.swing.JLabel(); LocationLabel = new javax.swing.JLabel(); Property = new javax.swing.JLabel(); Room = new javax.swing.JLabel(); Accommodates = new javax.swing.JLabel(); Amenities = new javax.swing.JLabel(); Bathrooms = new javax.swing.JLabel(); Beds = new javax.swing.JLabel(); Date = new javax.swing.JLabel(); Price = new javax.swing.JLabel(); Location = new javax.swing.JLabel(); EndDate = new javax.swing.JLabel(); Sign = new java.awt.Button(); StartDateLabel = new javax.swing.JLabel(); EndDateLabel = new javax.swing.JLabel(); StartDate = new javax.swing.JLabel(); CountryLabel = new javax.swing.JLabel(); Country = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setUndecorated(true); setResizable(false); getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jPanel1.setBackground(new java.awt.Color(32, 33, 35)); jPanel1.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseDragged(java.awt.event.MouseEvent evt) { jPanel1MouseDragged(evt); } }); jPanel1.addMouseListener(new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { jPanel1MousePressed(evt); } public void mouseReleased(java.awt.event.MouseEvent evt) { jPanel1MouseReleased(evt); } }); jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jLabel1.setFont(new java.awt.Font("Tahoma", 3, 14)); // NOI18N jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setText("Booking Info:"); jPanel1.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 10, 110, -1)); FrameClose1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N FrameClose1.setForeground(new java.awt.Color(255, 255, 255)); FrameClose1.setText("X"); FrameClose1.setName(""); // NOI18N FrameClose1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseReleased(java.awt.event.MouseEvent evt) { FrameClose1MouseReleased(evt); } }); jPanel1.add(FrameClose1, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 0, 20, 20)); PropLabel1.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N PropLabel1.setForeground(new java.awt.Color(255, 255, 255)); PropLabel1.setText("Property Type:"); jPanel1.add(PropLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 30, 100, -1)); RoomTypeLabel.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N RoomTypeLabel.setForeground(new java.awt.Color(255, 255, 255)); RoomTypeLabel.setText("Room Type:"); jPanel1.add(RoomTypeLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 70, 70, -1)); AccommodatesLabel.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N AccommodatesLabel.setForeground(new java.awt.Color(255, 255, 255)); AccommodatesLabel.setText("Accommodates:"); jPanel1.add(AccommodatesLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 110, 90, -1)); AmenitiesLabel.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N AmenitiesLabel.setForeground(new java.awt.Color(255, 255, 255)); AmenitiesLabel.setText("Amenities:"); jPanel1.add(AmenitiesLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 150, 70, -1)); BathroomLabel.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N BathroomLabel.setForeground(new java.awt.Color(255, 255, 255)); BathroomLabel.setText("Bathrooms:"); jPanel1.add(BathroomLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 190, 70, -1)); BedLabel.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N BedLabel.setForeground(new java.awt.Color(255, 255, 255)); BedLabel.setText("Beds:"); jPanel1.add(BedLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 230, 40, -1)); AvailableDateLabel.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N AvailableDateLabel.setForeground(new java.awt.Color(255, 255, 255)); AvailableDateLabel.setText("Available Date:"); jPanel1.add(AvailableDateLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 270, 80, -1)); PriceLabel.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N PriceLabel.setForeground(new java.awt.Color(255, 255, 255)); PriceLabel.setText("Price:"); jPanel1.add(PriceLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 310, 30, -1)); LocationLabel.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N LocationLabel.setForeground(new java.awt.Color(255, 255, 255)); LocationLabel.setText("Location:"); jPanel1.add(LocationLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 350, 50, -1)); Property.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N Property.setForeground(new java.awt.Color(255, 255, 255)); Property.setText("NA"); jPanel1.add(Property, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 30, 130, -1)); Room.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N Room.setForeground(new java.awt.Color(255, 255, 255)); Room.setText("NA"); jPanel1.add(Room, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 70, 130, -1)); Accommodates.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N Accommodates.setForeground(new java.awt.Color(255, 255, 255)); Accommodates.setText("NA"); jPanel1.add(Accommodates, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 110, 120, -1)); Amenities.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N Amenities.setForeground(new java.awt.Color(255, 255, 255)); Amenities.setText("NA"); jPanel1.add(Amenities, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 150, 240, -1)); Bathrooms.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N Bathrooms.setForeground(new java.awt.Color(255, 255, 255)); Bathrooms.setText("NA"); jPanel1.add(Bathrooms, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 190, 70, -1)); Beds.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N Beds.setForeground(new java.awt.Color(255, 255, 255)); Beds.setText("NA"); jPanel1.add(Beds, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 230, 60, -1)); Date.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N Date.setForeground(new java.awt.Color(255, 255, 255)); Date.setText("NA"); jPanel1.add(Date, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 270, 140, -1)); Price.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N Price.setForeground(new java.awt.Color(255, 255, 255)); Price.setText("NA"); jPanel1.add(Price, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 310, 140, -1)); Location.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N Location.setForeground(new java.awt.Color(255, 255, 255)); Location.setText("NA"); jPanel1.add(Location, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 350, 260, -1)); EndDate.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N EndDate.setForeground(new java.awt.Color(255, 255, 255)); EndDate.setText("NA"); jPanel1.add(EndDate, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 470, 140, -1)); Sign.setActionCommand("Leave A Review"); Sign.setBackground(new java.awt.Color(102, 102, 255)); Sign.setFont(new java.awt.Font("DialogInput", 3, 18)); // NOI18N Sign.setForeground(new java.awt.Color(255, 255, 255)); Sign.setLabel("Leave a Review"); Sign.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { SignActionPerformed(evt); } }); jPanel1.add(Sign, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 500, 180, 40)); StartDateLabel.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N StartDateLabel.setForeground(new java.awt.Color(255, 255, 255)); StartDateLabel.setText("Start Date:"); StartDateLabel.setToolTipText(""); jPanel1.add(StartDateLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 430, 70, -1)); EndDateLabel.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N EndDateLabel.setForeground(new java.awt.Color(255, 255, 255)); EndDateLabel.setText("End Date:"); jPanel1.add(EndDateLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 470, 70, -1)); StartDate.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N StartDate.setForeground(new java.awt.Color(255, 255, 255)); StartDate.setText("NA"); jPanel1.add(StartDate, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 430, 140, -1)); CountryLabel.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N CountryLabel.setForeground(new java.awt.Color(255, 255, 255)); CountryLabel.setText("End Date:"); jPanel1.add(CountryLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 390, 70, -1)); Country.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N Country.setForeground(new java.awt.Color(255, 255, 255)); Country.setText("NA"); jPanel1.add(Country, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 390, 140, -1)); getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 360, 550)); pack(); setLocationRelativeTo(null); }// </editor-fold>//GEN-END:initComponents int xy; int xx; private void jPanel1MouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel1MouseDragged // TODO add your handling code here: int x = evt.getXOnScreen(); int y = evt.getYOnScreen(); this.setLocation(x-xx, y-xy); }//GEN-LAST:event_jPanel1MouseDragged private void jPanel1MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel1MouseReleased // TODO add your handling code here: }//GEN-LAST:event_jPanel1MouseReleased private void jPanel1MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel1MousePressed // TODO add your handling code here: xx = evt.getX(); xy = evt.getY(); }//GEN-LAST:event_jPanel1MousePressed private void FrameClose1MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_FrameClose1MouseReleased // TODO add your handling code here: dispose(); }//GEN-LAST:event_FrameClose1MouseReleased private void SignActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SignActionPerformed // TODO add your handling code here: dispose(); Review r = new Review(bundle, rental, conn); r.setVisible(true); }//GEN-LAST:event_SignActionPerformed /** * @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(PropInfo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(PropInfo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(PropInfo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(PropInfo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new PropInfo().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel Accommodates; private javax.swing.JLabel AccommodatesLabel; private javax.swing.JLabel Amenities; private javax.swing.JLabel AmenitiesLabel; private javax.swing.JLabel AvailableDateLabel; private javax.swing.JLabel BathroomLabel; private javax.swing.JLabel Bathrooms; private javax.swing.JLabel BedLabel; private javax.swing.JLabel Beds; private javax.swing.JLabel Country; private javax.swing.JLabel CountryLabel; private javax.swing.JLabel Date; private javax.swing.JLabel EndDate; private javax.swing.JLabel EndDateLabel; private javax.swing.JLabel FrameClose1; private javax.swing.JLabel Location; private javax.swing.JLabel LocationLabel; private javax.swing.JLabel Price; private javax.swing.JLabel PriceLabel; private javax.swing.JLabel PropLabel1; private javax.swing.JLabel Property; private javax.swing.JLabel Room; private javax.swing.JLabel RoomTypeLabel; private java.awt.Button Sign; private javax.swing.JLabel StartDate; private javax.swing.JLabel StartDateLabel; private javax.swing.JLabel jLabel1; private javax.swing.JPanel jPanel1; // End of variables declaration//GEN-END:variables }
[ "33289432+JagMan177@users.noreply.github.com" ]
33289432+JagMan177@users.noreply.github.com
14f8cbcff3b0642981985f9528265e128657e766
2a348707336f6f658de611267b36fd598457e7ea
/src/com/company/Cosidor.java
f2a9913e4ef4b515f9676b2baeb6cc5c2401a82b
[]
no_license
adrii3/TallerDeCosturas
7d27df5a72a477f5729b6a1e52642086423f5664
2b6eb5b9f5f28c05a9c3509bcfaadb0ddf474a98
refs/heads/master
2020-12-28T09:16:57.620912
2020-02-10T16:31:25
2020-02-10T16:31:25
238,263,142
0
0
null
null
null
null
UTF-8
Java
false
false
655
java
package com.company; public class Cosidor extends Thread { Cistell cistell; public Cosidor(Cistell cistell, String name) { super(name); this.cistell = cistell; } @Override public void run() { for(;;) { //cosir un temps try { Thread.sleep((long) Math.random() * 1000 + 500); } catch (InterruptedException e) { e.printStackTrace(); } //posar peça al cistell una màniga cosida int c = cistell.posar(1); System.out.println(getName() + " he afegit una peça. Total = " + c); } } }
[ "aquinoa@elpuig.xeill.net" ]
aquinoa@elpuig.xeill.net
baa6552c7aa3b5489531afafd82de7b61e5c8449
b5c43f75faff02041bdbf9c9a3ef82606042aae1
/plugins/com.github.lbroudoux.dsl.eip.edit/src/com/github/lbroudoux/dsl/eip/provider/AggregatorItemProvider.java
70ac895a6387031ea974f7d9ef8b2ce830ba67c9
[ "Apache-2.0" ]
permissive
yanngv29/eip-designer
0d87309c463bce52eb3d8968b5b779f595d8fe63
704a25844ceb144f4dc371502fcd01d23464f93a
refs/heads/master
2021-01-18T08:00:18.330876
2015-07-16T12:37:56
2015-07-16T12:37:56
38,744,984
0
0
null
2015-07-08T09:34:20
2015-07-08T09:34:20
null
UTF-8
Java
false
false
9,325
java
/** */ package com.github.lbroudoux.dsl.eip.provider; import com.github.lbroudoux.dsl.eip.Aggregator; import com.github.lbroudoux.dsl.eip.EipPackage; import java.util.Collection; import java.util.List; import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.util.ResourceLocator; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; import org.eclipse.emf.edit.provider.IItemLabelProvider; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; import org.eclipse.emf.edit.provider.IItemPropertySource; import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; import org.eclipse.emf.edit.provider.ITreeItemContentProvider; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.eclipse.emf.edit.provider.ItemProviderAdapter; import org.eclipse.emf.edit.provider.ViewerNotification; /** * This is the item provider adapter for a {@link com.github.lbroudoux.dsl.eip.Aggregator} object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class AggregatorItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { /** * This constructs an instance from a factory and a notifier. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public AggregatorItemProvider(AdapterFactory adapterFactory) { super(adapterFactory); } /** * This returns the property descriptors for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { if (itemPropertyDescriptors == null) { super.getPropertyDescriptors(object); addNamePropertyDescriptor(object); addToChannelPropertyDescriptor(object); addFromChannelsPropertyDescriptor(object); addPartPropertyDescriptor(object); addStrategyPropertyDescriptor(object); addExpressionPropertyDescriptor(object); } return itemPropertyDescriptors; } /** * This adds a property descriptor for the Name feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addNamePropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Endpoint_name_feature"), getString("_UI_PropertyDescriptor_description", "_UI_Endpoint_name_feature", "_UI_Endpoint_type"), EipPackage.Literals.ENDPOINT__NAME, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the To Channel feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addToChannelPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Endpoint_toChannel_feature"), getString("_UI_PropertyDescriptor_description", "_UI_Endpoint_toChannel_feature", "_UI_Endpoint_type"), EipPackage.Literals.ENDPOINT__TO_CHANNEL, true, false, true, null, null, null)); } /** * This adds a property descriptor for the From Channels feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addFromChannelsPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Endpoint_fromChannels_feature"), getString("_UI_PropertyDescriptor_description", "_UI_Endpoint_fromChannels_feature", "_UI_Endpoint_type"), EipPackage.Literals.ENDPOINT__FROM_CHANNELS, true, false, true, null, null, null)); } /** * This adds a property descriptor for the Part feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addPartPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Aggregator_part_feature"), getString("_UI_PropertyDescriptor_description", "_UI_Aggregator_part_feature", "_UI_Aggregator_type"), EipPackage.Literals.AGGREGATOR__PART, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Strategy feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addStrategyPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Aggregator_strategy_feature"), getString("_UI_PropertyDescriptor_description", "_UI_Aggregator_strategy_feature", "_UI_Aggregator_type"), EipPackage.Literals.AGGREGATOR__STRATEGY, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Expression feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addExpressionPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Aggregator_expression_feature"), getString("_UI_PropertyDescriptor_description", "_UI_Aggregator_expression_feature", "_UI_Aggregator_type"), EipPackage.Literals.AGGREGATOR__EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This returns Aggregator.gif. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object getImage(Object object) { return overlayImage(object, getResourceLocator().getImage("full/obj16/Aggregator")); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected boolean shouldComposeCreationImage() { return true; } /** * This returns the label text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String getText(Object object) { String label = ((Aggregator)object).getName(); return label == null || label.length() == 0 ? getString("_UI_Aggregator_type") : getString("_UI_Aggregator_type") + " " + label; } /** * This handles model notifications by calling {@link #updateChildren} to update any cached * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void notifyChanged(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(Aggregator.class)) { case EipPackage.AGGREGATOR__NAME: case EipPackage.AGGREGATOR__PART: case EipPackage.AGGREGATOR__STRATEGY: case EipPackage.AGGREGATOR__EXPRESSION: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; } super.notifyChanged(notification); } /** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); } /** * Return the resource locator for this item provider's resources. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public ResourceLocator getResourceLocator() { return EipEditPlugin.INSTANCE; } }
[ "laurent.broudoux@gmail.com" ]
laurent.broudoux@gmail.com
fc3205bd7b9f06d69d545c7b5e347d18f55f026e
88370dbe8e25d1dcfafe557ea17252bef7c95948
/Meal Management/src/mill/management/loginUser.java
8c4856489c0132d950c9ad25055e96b97ad8ba1c
[]
no_license
akib9ctg/JavaProject
e9256c5edd048948bf73db65e9e9b02a4813f093
37b30ace957cd6ebb1491c009343eb9909bc96be
refs/heads/master
2021-01-16T20:24:38.201351
2017-08-13T21:09:24
2017-08-13T21:09:24
100,204,164
0
0
null
null
null
null
UTF-8
Java
false
false
8,945
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 mill.management; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.swing.JOptionPane; /** * * @author ACER */ public class loginUser extends javax.swing.JFrame { /** * Creates new form loginUser */ public loginUser() { 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() { jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); userName = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); password = new javax.swing.JPasswordField(); jButton1 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Log in"); jLabel1.setText("User Name:"); jLabel2.setText("Password:"); jButton1.setText("Log in"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(44, 44, 44) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel2) .addGap(18, 18, 18) .addComponent(password)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(userName, javax.swing.GroupLayout.PREFERRED_SIZE, 182, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(88, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton1) .addGap(68, 68, 68)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(65, 65, 65) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(userName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(password, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addComponent(jButton1) .addContainerGap(43, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: String p = userName.getText(); String q = password.getText(); try { Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE",mainShape.oracle_username, mainShape.oracle_password); Statement stmt = con.createStatement(); String query = "select *from realUser where id='" + p + "'and password = '" + q + "'"; ResultSet sql = stmt.executeQuery(query); int ck = 0; if (sql.next()) { userView ob=new userView(); ob.id=p; ob.name=sql.getString("name"); ob.setUsername(); ob.checkmill(); ob.setVisible(true); super.dispose(); } else { try { query = "select *from requestmill where id='" + p + "'and password = '" + q + "'"; sql = stmt.executeQuery(query); if (sql.next()) { JOptionPane.showMessageDialog(null, "Wait for Admin Approval"); ck = 1; } if (ck == 0) { JOptionPane.showMessageDialog(null, "Invalid User Name or Password"); } } catch (SQLException ex) { System.out.println(ex); } } } catch (SQLException ex) { System.out.println(ex); } }//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(loginUser.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(loginUser.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(loginUser.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(loginUser.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 loginUser().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; private javax.swing.JPanel jPanel1; private javax.swing.JPasswordField password; private javax.swing.JTextField userName; // End of variables declaration//GEN-END:variables }
[ "30986837+akib9ctg@users.noreply.github.com" ]
30986837+akib9ctg@users.noreply.github.com
12aa1c6413a2d4869bba53014bd350aa8d64d9e3
d151481f624c61ba7a6c570b29cf90d271bd3fbe
/swing/EventWithAIC.java
0bd55cd239fee9abaae1fe5862a72b26885142e1
[]
no_license
srikanthpragada/JavaSE_Material_2021_Programs
04fc5e66a1d6a174b15b7535c1ef30d8070c5877
93d8ae573212bd66fc22c8fa78f53641fe17075e
refs/heads/master
2023-05-08T10:47:18.109334
2021-06-01T05:33:54
2021-06-01T05:33:54
372,707,805
0
0
null
null
null
null
UTF-8
Java
false
false
774
java
package swing; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.Date; public class EventWithAIC extends JFrame { JButton b1; JLabel lbl; public EventWithAIC() { super("Event with Anonymous Inner Class"); lbl = new JLabel(); lbl.setHorizontalAlignment(JLabel.CENTER); b1 = new JButton("Click Here"); b1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { lbl.setText(new Date().toString()); } }); Container c = getContentPane(); c.add(lbl, BorderLayout.PAGE_START); c.add(b1, BorderLayout.PAGE_END); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setSize(300, 200); } public static void main(String args[]) { new EventWithAIC().setVisible(true); } }
[ "srikanthpragada@gmail.com" ]
srikanthpragada@gmail.com
4fb7fffbe8ed42cc8247e245974200306b6413cf
39241f3186ce7a61fc5f687960cc3d0d18aaf584
/app/build/generated/source/r/debug/com/example/sony/smarteyeglass/extension/helloworld/R.java
a38452baaf506f294d3326450da555619c784988
[]
no_license
adiprakash/SpotifyGlass
a9e76918bf184b5a1fa21b10dac3c7992b10bfde
bc64f2c5f90ca051ddc3798ea0971a231c4f185c
refs/heads/master
2020-06-16T00:46:06.668729
2016-12-21T21:21:32
2016-12-21T21:21:32
75,255,221
1
0
null
null
null
null
UTF-8
Java
false
false
24,359
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.example.sony.smarteyeglass.extension.helloworld; public final class R { public static final class attr { /** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int fontPath=0x7f010006; /** <p>Must be one or more (separated by '|') of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>top</code></td><td>0x30</td><td></td></tr> <tr><td><code>bottom</code></td><td>0x50</td><td></td></tr> <tr><td><code>left</code></td><td>0x03</td><td></td></tr> <tr><td><code>right</code></td><td>0x05</td><td></td></tr> <tr><td><code>center_vertical</code></td><td>0x10</td><td></td></tr> <tr><td><code>center_horizontal</code></td><td>0x01</td><td></td></tr> <tr><td><code>center</code></td><td>0x11</td><td></td></tr> </table> */ public static final int gravity=0x7f010000; /** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int template=0x7f010005; /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int textArray=0x7f010003; /** <p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>May be one of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>match_parent</code></td><td>-1</td><td></td></tr> </table> */ public static final int textSize=0x7f010002; /** <p>Must be an integer value, such as "<code>100</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int timeOffset=0x7f010001; /** <p>Must be one of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>constant</code></td><td>0</td><td></td></tr> <tr><td><code>seconds</code></td><td>1</td><td></td></tr> <tr><td><code>seconds_digit2</code></td><td>2</td><td></td></tr> <tr><td><code>seconds_digit1</code></td><td>3</td><td></td></tr> <tr><td><code>minutes</code></td><td>4</td><td></td></tr> <tr><td><code>minutes_digit2</code></td><td>5</td><td></td></tr> <tr><td><code>minutes_digit1</code></td><td>6</td><td></td></tr> <tr><td><code>hours</code></td><td>7</td><td></td></tr> <tr><td><code>hours_digit2</code></td><td>8</td><td></td></tr> <tr><td><code>hours_digit1</code></td><td>9</td><td></td></tr> <tr><td><code>days_of_week</code></td><td>10</td><td></td></tr> <tr><td><code>days_of_month</code></td><td>11</td><td></td></tr> <tr><td><code>days_of_month_digit2</code></td><td>12</td><td></td></tr> <tr><td><code>days_of_month_digit1</code></td><td>13</td><td></td></tr> <tr><td><code>days_of_year</code></td><td>14</td><td></td></tr> <tr><td><code>days_of_year_digit3</code></td><td>15</td><td></td></tr> <tr><td><code>days_of_year_digit2</code></td><td>16</td><td></td></tr> <tr><td><code>days_of_year_digit1</code></td><td>17</td><td></td></tr> <tr><td><code>months</code></td><td>18</td><td></td></tr> <tr><td><code>months_digit2</code></td><td>19</td><td></td></tr> <tr><td><code>months_digit1</code></td><td>20</td><td></td></tr> <tr><td><code>years_digit4</code></td><td>21</td><td></td></tr> <tr><td><code>years_digit3</code></td><td>22</td><td></td></tr> <tr><td><code>years_digit2</code></td><td>23</td><td></td></tr> <tr><td><code>years_digit1</code></td><td>24</td><td></td></tr> <tr><td><code>am_pm</code></td><td>25</td><td></td></tr> <tr><td><code>hours_fine</code></td><td>26</td><td></td></tr> </table> */ public static final int timeType=0x7f010004; } public static final class color { public static final int smart_watch_2_text_color_grey=0x7f060000; public static final int smart_watch_2_text_color_orange=0x7f060001; public static final int smart_watch_2_text_color_white=0x7f060002; public static final int smart_watch_text_color_grey=0x7f060003; public static final int smart_watch_text_color_orange=0x7f060004; public static final int smart_watch_text_color_white=0x7f060005; } public static final class dimen { public static final int headset_pro_control_height=0x7f040003; public static final int headset_pro_control_width=0x7f040004; public static final int headset_pro_text_size=0x7f040000; public static final int smart_eyeglass_text_size_medium=0x7f040005; public static final int smart_eyeglass_text_size_small=0x7f040006; public static final int smart_watch_2_control_height=0x7f040007; public static final int smart_watch_2_control_width=0x7f040008; public static final int smart_watch_2_statusbar_height=0x7f040009; public static final int smart_watch_2_text_size_large=0x7f04000a; public static final int smart_watch_2_text_size_medium=0x7f04000b; public static final int smart_watch_2_text_size_small=0x7f04000c; public static final int smart_watch_2_widget_cell_height=0x7f04000d; public static final int smart_watch_2_widget_cell_width=0x7f04000e; public static final int smart_watch_2_widget_height=0x7f04000f; public static final int smart_watch_2_widget_width=0x7f040010; public static final int smart_watch_control_height=0x7f040011; public static final int smart_watch_control_width=0x7f040012; public static final int smart_watch_text_size_normal=0x7f040001; public static final int smart_watch_text_size_small=0x7f040002; public static final int smart_watch_text_size_widget_badge=0x7f040013; public static final int smart_watch_text_size_widget_name=0x7f040014; public static final int smart_watch_text_size_widget_text=0x7f040015; public static final int smart_watch_text_size_widget_time=0x7f040016; public static final int smart_watch_widget_height_inner=0x7f040017; public static final int smart_watch_widget_height_outer=0x7f040018; public static final int smart_watch_widget_text_background_height=0x7f040019; public static final int smart_watch_widget_text_background_width=0x7f04001a; public static final int smart_watch_widget_width_inner=0x7f04001b; public static final int smart_watch_widget_width_outer=0x7f04001c; public static final int smarteyeglass_control_height=0x7f04001d; public static final int smarteyeglass_control_width=0x7f04001e; public static final int smarteyeglass_text_size_large=0x7f04001f; public static final int smarteyeglass_text_size_normal=0x7f040020; public static final int smarteyeglass_text_size_small=0x7f040021; public static final int smarteyeglass_widget_height=0x7f040022; public static final int smarteyeglass_widget_width=0x7f040023; } public static final class drawable { public static final int a=0x7f020000; public static final int actions_view_in_phone=0x7f020001; public static final int b=0x7f020002; public static final int background=0x7f020003; public static final int badge_counter=0x7f020004; public static final int c=0x7f020005; public static final int d=0x7f020006; public static final int headset_pro_cancel_icn=0x7f020007; public static final int headset_pro_focus_xs_icn=0x7f020008; public static final int headset_pro_ok_icn=0x7f020009; public static final int icon=0x7f02000a; public static final int icon_extension=0x7f02000b; public static final int icon_extension48=0x7f02000c; public static final int next=0x7f02000d; public static final int pause=0x7f02000e; public static final int plan1=0x7f02000f; public static final int plan2=0x7f020010; public static final int play=0x7f020011; public static final int shape=0x7f020012; public static final int song=0x7f020013; public static final int test=0x7f020014; public static final int test1=0x7f020015; public static final int text_bg=0x7f020016; public static final int widget_frame=0x7f020017; } public static final class id { public static final int am_pm=0x7f090008; public static final int bottom=0x7f090000; public static final int btn_update_this=0x7f090024; public static final int center=0x7f090001; public static final int center_horizontal=0x7f090002; public static final int center_vertical=0x7f090003; public static final int constant=0x7f090009; public static final int days_of_month=0x7f09000a; public static final int days_of_month_digit1=0x7f09000b; public static final int days_of_month_digit2=0x7f09000c; public static final int days_of_week=0x7f09000d; public static final int days_of_year=0x7f09000e; public static final int days_of_year_digit1=0x7f09000f; public static final int days_of_year_digit2=0x7f090010; public static final int days_of_year_digit3=0x7f090011; public static final int hours=0x7f090012; public static final int hours_digit1=0x7f090013; public static final int hours_digit2=0x7f090014; public static final int hours_fine=0x7f090015; public static final int image=0x7f090023; public static final int label=0x7f090027; public static final int left=0x7f090004; public static final int match_parent=0x7f090007; public static final int minutes=0x7f090016; public static final int minutes_digit1=0x7f090017; public static final int minutes_digit2=0x7f090018; public static final int months=0x7f090019; public static final int months_digit1=0x7f09001a; public static final int months_digit2=0x7f09001b; public static final int phn_play_btn=0x7f090026; public static final int phn_text=0x7f090029; public static final int phn_title=0x7f090028; public static final int play_btn=0x7f090039; public static final int right=0x7f090005; public static final int seconds=0x7f09001c; public static final int seconds_digit1=0x7f09001d; public static final int seconds_digit2=0x7f09001e; public static final int smart_watch_notification_widget_background=0x7f09002a; public static final int smart_watch_notification_widget_text_background=0x7f09002b; public static final int smart_watch_notification_widget_text_name=0x7f09002e; public static final int smart_watch_notification_widget_text_time=0x7f09002c; public static final int smart_watch_notification_widget_text_title=0x7f09002d; public static final int smart_watch_widget_custom_image=0x7f09002f; public static final int smart_watch_widget_custom_text_view=0x7f090030; public static final int smart_watch_widget_event_counter_badge=0x7f090032; public static final int smart_watch_widget_event_counter_text=0x7f090033; public static final int smart_watch_widget_icon=0x7f090031; public static final int smarteyeglass_widget_icon=0x7f090035; public static final int smarteyeglass_widget_inner=0x7f090034; public static final int smarteyeglass_widget_inner_image=0x7f090037; public static final int smarteyeglass_widget_text=0x7f090036; public static final int spotify_glass=0x7f090038; public static final int spotify_phone=0x7f090025; public static final int text=0x7f09003b; public static final int title=0x7f09003a; public static final int top=0x7f090006; public static final int years_digit1=0x7f09001f; public static final int years_digit2=0x7f090020; public static final int years_digit3=0x7f090021; public static final int years_digit4=0x7f090022; } public static final class integer { public static final int api_version=0x7f070000; } public static final class layout { public static final int layout=0x7f030000; public static final int phonelayout=0x7f030001; public static final int smart_watch_notification_widget=0x7f030002; public static final int smart_watch_widget=0x7f030003; public static final int smarteyeglass_widgetcard=0x7f030004; public static final int spotify_layout=0x7f030005; } public static final class string { public static final int api_version_error_throw_message=0x7f080000; public static final int app_name=0x7f080001; public static final int configuration_text=0x7f080002; public static final int extension_name=0x7f080003; public static final int hello_blank_fragment=0x7f080004; public static final int play_button=0x7f080005; public static final int preference_activity_title=0x7f080006; public static final int preference_key_read_me=0x7f080007; public static final int text_phone_to_smarteyeglass=0x7f080008; public static final int text_title_layout=0x7f080009; } public static final class style { public static final int ExtensionLightTheme=0x7f050000; } public static final class styleable { /** Attributes that can be used with a TimeLayout. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #TimeLayout_gravity com.example.sony.smarteyeglass.extension.helloworld:gravity}</code></td><td></td></tr> <tr><td><code>{@link #TimeLayout_timeOffset com.example.sony.smarteyeglass.extension.helloworld:timeOffset}</code></td><td></td></tr> </table> @see #TimeLayout_gravity @see #TimeLayout_timeOffset */ public static final int[] TimeLayout = { 0x7f010000, 0x7f010001 }; /** <p>This symbol is the offset where the {@link com.example.sony.smarteyeglass.extension.helloworld.R.attr#gravity} attribute's value can be found in the {@link #TimeLayout} array. <p>Must be one or more (separated by '|') of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>top</code></td><td>0x30</td><td></td></tr> <tr><td><code>bottom</code></td><td>0x50</td><td></td></tr> <tr><td><code>left</code></td><td>0x03</td><td></td></tr> <tr><td><code>right</code></td><td>0x05</td><td></td></tr> <tr><td><code>center_vertical</code></td><td>0x10</td><td></td></tr> <tr><td><code>center_horizontal</code></td><td>0x01</td><td></td></tr> <tr><td><code>center</code></td><td>0x11</td><td></td></tr> </table> @attr name com.example.sony.smarteyeglass.extension.helloworld:gravity */ public static final int TimeLayout_gravity = 0; /** <p>This symbol is the offset where the {@link com.example.sony.smarteyeglass.extension.helloworld.R.attr#timeOffset} attribute's value can be found in the {@link #TimeLayout} array. <p>Must be an integer value, such as "<code>100</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name com.example.sony.smarteyeglass.extension.helloworld:timeOffset */ public static final int TimeLayout_timeOffset = 1; /** Attributes that can be used with a TimeView. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #TimeView_fontPath com.example.sony.smarteyeglass.extension.helloworld:fontPath}</code></td><td></td></tr> <tr><td><code>{@link #TimeView_template com.example.sony.smarteyeglass.extension.helloworld:template}</code></td><td></td></tr> <tr><td><code>{@link #TimeView_textArray com.example.sony.smarteyeglass.extension.helloworld:textArray}</code></td><td></td></tr> <tr><td><code>{@link #TimeView_textSize com.example.sony.smarteyeglass.extension.helloworld:textSize}</code></td><td></td></tr> <tr><td><code>{@link #TimeView_timeType com.example.sony.smarteyeglass.extension.helloworld:timeType}</code></td><td></td></tr> </table> @see #TimeView_fontPath @see #TimeView_template @see #TimeView_textArray @see #TimeView_textSize @see #TimeView_timeType */ public static final int[] TimeView = { 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006 }; /** <p>This symbol is the offset where the {@link com.example.sony.smarteyeglass.extension.helloworld.R.attr#fontPath} attribute's value can be found in the {@link #TimeView} array. <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name com.example.sony.smarteyeglass.extension.helloworld:fontPath */ public static final int TimeView_fontPath = 4; /** <p>This symbol is the offset where the {@link com.example.sony.smarteyeglass.extension.helloworld.R.attr#template} attribute's value can be found in the {@link #TimeView} array. <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name com.example.sony.smarteyeglass.extension.helloworld:template */ public static final int TimeView_template = 3; /** <p>This symbol is the offset where the {@link com.example.sony.smarteyeglass.extension.helloworld.R.attr#textArray} attribute's value can be found in the {@link #TimeView} array. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". @attr name com.example.sony.smarteyeglass.extension.helloworld:textArray */ public static final int TimeView_textArray = 1; /** <p>This symbol is the offset where the {@link com.example.sony.smarteyeglass.extension.helloworld.R.attr#textSize} attribute's value can be found in the {@link #TimeView} array. <p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>May be one of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>match_parent</code></td><td>-1</td><td></td></tr> </table> @attr name com.example.sony.smarteyeglass.extension.helloworld:textSize */ public static final int TimeView_textSize = 0; /** <p>This symbol is the offset where the {@link com.example.sony.smarteyeglass.extension.helloworld.R.attr#timeType} attribute's value can be found in the {@link #TimeView} array. <p>Must be one of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>constant</code></td><td>0</td><td></td></tr> <tr><td><code>seconds</code></td><td>1</td><td></td></tr> <tr><td><code>seconds_digit2</code></td><td>2</td><td></td></tr> <tr><td><code>seconds_digit1</code></td><td>3</td><td></td></tr> <tr><td><code>minutes</code></td><td>4</td><td></td></tr> <tr><td><code>minutes_digit2</code></td><td>5</td><td></td></tr> <tr><td><code>minutes_digit1</code></td><td>6</td><td></td></tr> <tr><td><code>hours</code></td><td>7</td><td></td></tr> <tr><td><code>hours_digit2</code></td><td>8</td><td></td></tr> <tr><td><code>hours_digit1</code></td><td>9</td><td></td></tr> <tr><td><code>days_of_week</code></td><td>10</td><td></td></tr> <tr><td><code>days_of_month</code></td><td>11</td><td></td></tr> <tr><td><code>days_of_month_digit2</code></td><td>12</td><td></td></tr> <tr><td><code>days_of_month_digit1</code></td><td>13</td><td></td></tr> <tr><td><code>days_of_year</code></td><td>14</td><td></td></tr> <tr><td><code>days_of_year_digit3</code></td><td>15</td><td></td></tr> <tr><td><code>days_of_year_digit2</code></td><td>16</td><td></td></tr> <tr><td><code>days_of_year_digit1</code></td><td>17</td><td></td></tr> <tr><td><code>months</code></td><td>18</td><td></td></tr> <tr><td><code>months_digit2</code></td><td>19</td><td></td></tr> <tr><td><code>months_digit1</code></td><td>20</td><td></td></tr> <tr><td><code>years_digit4</code></td><td>21</td><td></td></tr> <tr><td><code>years_digit3</code></td><td>22</td><td></td></tr> <tr><td><code>years_digit2</code></td><td>23</td><td></td></tr> <tr><td><code>years_digit1</code></td><td>24</td><td></td></tr> <tr><td><code>am_pm</code></td><td>25</td><td></td></tr> <tr><td><code>hours_fine</code></td><td>26</td><td></td></tr> </table> @attr name com.example.sony.smarteyeglass.extension.helloworld:timeType */ public static final int TimeView_timeType = 2; }; }
[ "ADITYA PRAKASH" ]
ADITYA PRAKASH
c27edcfe3f9e45eec94d001159ff4b368ceafff4
eea0cb722d00fd78389487a36b19e9f25cee9698
/src/core/org.openhab.core/src/main/java/org/openhab/core/internal/events/EventBusImpl.java
006c0f78b24a1b88b84108f0c63cac19884dbc5d
[]
no_license
aiyi/openhab
8d9a18a1264cf431efac30519de68e2afc6623fa
e846b1fd3ced304e9343f1bc61fa370e3e3d9940
refs/heads/master
2016-09-03T01:03:04.189605
2014-11-16T06:30:51
2014-11-16T06:30:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,885
java
/** * openHAB, the open Home Automation Bus. * Copyright (C) 2010-2013, openHAB.org <admin@openhab.org> * * See the contributors.txt file in the distribution for a * full listing of individual contributors. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see <http://www.gnu.org/licenses>. * * Additional permission under GNU GPL version 3 section 7 * * If you modify this Program, or any covered work, by linking or * combining it with Eclipse (or a modified version of that library), * containing parts covered by the terms of the Eclipse Public License * (EPL), the licensors of this Program grant you additional permission * to convey the resulting work. */ package org.openhab.core.internal.events; import net.engio.mbassy.bus.BusConfiguration; import net.engio.mbassy.bus.MBassador; import net.engio.mbassy.listener.Handler; import net.engio.mbassy.listener.Listener; import net.engio.mbassy.listener.References; import org.openhab.core.events.EventBus; import org.openhab.core.events.Event; import org.openhab.core.events.EventSubscriber; import org.openhab.core.types.Command; import org.openhab.core.types.EventType; import org.openhab.core.types.State; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * This is the implementation of the {@link EventBus} interface. * Through it, events can be sent to the EventBus service in * order to broadcast them. * * @author Jesse * @since 2.0.0 */ public class EventBusImpl implements EventBus { private static final Logger logger = LoggerFactory.getLogger(EventBusImpl.class); private MBassador<Event> eventBus; public EventBusImpl() { eventBus = new MBassador<Event>(BusConfiguration.Default()); } /* * (non-Javadoc) * * @see * org.openhab.core.internal.events.EventBus#addSubscriber(org.openhab * .core.events.EventSubscriber) */ public void addSubscriber(EventSubscriber subscriber) { EventHandler handler = new EventHandler(subscriber); eventBus.subscribe(handler); } /* * (non-Javadoc) * * @see * org.openhab.core.internal.events.EventBus#sendCommand(org.openhab * .core.items.GenericItem, org.openhab.core.datatypes.DataType) */ public void sendCommand(String itemName, Command command) { if (command != null) { eventBus.publish(createCommandEvent(itemName, command)); } else { logger.warn("given command is NULL, couldn't send command to '{}'", itemName); } } /* * (non-Javadoc) * * @see * org.openhab.core.internal.events.EventBus#postCommand(org.openhab * .core.items.GenericItem, org.openhab.core.datatypes.DataType) */ public void postCommand(String itemName, Command command) { if (command != null) { eventBus.publishAsync(createCommandEvent(itemName, command)); } else { logger.warn("given command is NULL, couldn't post command to '{}'", itemName); } } /* * (non-Javadoc) * * @see * org.openhab.core.internal.events.EventBus#postUpdate(org.openhab * .core.items.GenericItem, org.openhab.core.datatypes.DataType) */ public void postUpdate(String itemName, State newState) { if (newState != null) { eventBus.publishAsync(createUpdateEvent(itemName, newState)); } else { logger.warn("given new state is NULL, couldn't post update for '{}'", itemName); } } private Event createUpdateEvent(String itemName, State newState) { return new Event(EventType.UPDATE, itemName, newState); } private Event createCommandEvent(String itemName, Command command) { return new Event(EventType.COMMAND, itemName, command); } @Listener(references = References.Strong) public class EventHandler { EventSubscriber subscriber; public EventHandler(EventSubscriber subscriber) { this.subscriber = subscriber; } @Handler public void handleEvent(Event event) { String itemName = (String) event.getItemName(); EventType eventType = event.getEventType(); if(eventType == EventType.UPDATE) { State newState = (State) event.getEventData(); if(newState!=null) subscriber.receiveUpdate(itemName, newState); } else if(eventType == EventType.COMMAND) { Command command = (Command) event.getEventData(); if(command!=null) subscriber.receiveCommand(itemName, command); } else { return; // we have received an event with an invalid event type } } } }
[ "aiyi1015@gmail.com" ]
aiyi1015@gmail.com
53aa6eb5b1ff4949b7bf50ed73154bf7c715a705
50fae8de82c5bef70e27e52787e31bea31366ed8
/src/main/java/com/sjtu/icare/modules/gero/entity/GeroEntity.java
399114c626b4943036ff1dbe7de1f9c3864df556
[]
no_license
wwhui/icare
88f7618014d7469ab137f173f61cd99771201232
d86b84a987447dd2122e0a22bb674a67e7ebad9a
refs/heads/master
2021-01-22T02:39:17.699586
2015-03-25T07:18:34
2015-03-25T07:18:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,022
java
/** * @Package com.sjtu.icare.modules.gero.entity * @Description TODO * @date Mar 24, 2015 5:16:33 PM * @author Wang Qi * @version TODO */ package com.sjtu.icare.modules.gero.entity; import java.io.Serializable; import com.sjtu.icare.common.persistence.DataEntity; public class GeroEntity extends DataEntity<GeroEntity> implements Serializable { private static final long serialVersionUID = 1L; private Integer id; private String name; private String city; private String district; private String address; private String contact; private String licence; private Integer scale; private Integer careLevel; private Integer contactId; private String logoUrl; private String photoUrl; private String registerDate; private String cancelDate; /* (non-Javadoc) * @see com.sjtu.icare.common.persistence.BaseEntity#preDelete() */ @Override public void preDelete() { // TODO Auto-generated method stub } /** * @return the id */ public int getId() { return super.getId(); } /** * @param id the id to set */ public void setId(Integer id) { this.id = id; } /** * @return the name */ public String getName() { return name; } /** * @param name the name to set */ public void setName(String name) { this.name = name; } /** * @return the city */ public String getCity() { return city; } /** * @param city the city to set */ public void setCity(String city) { this.city = city; } /** * @return the district */ public String getDistrict() { return district; } /** * @param district the district to set */ public void setDistrict(String district) { this.district = district; } /** * @return the address */ public String getAddress() { return address; } /** * @param address the address to set */ public void setAddress(String address) { this.address = address; } /** * @return the contact */ public String getContact() { return contact; } /** * @param contact the contact to set */ public void setContact(String contact) { this.contact = contact; } /** * @return the licence */ public String getLicence() { return licence; } /** * @param licence the licence to set */ public void setLicence(String licence) { this.licence = licence; } /** * @return the scale */ public Integer getScale() { return scale; } /** * @param scale the scale to set */ public void setScale(Integer scale) { this.scale = scale; } /** * @return the careLevel */ public Integer getCareLevel() { return careLevel; } /** * @param careLevel the careLevel to set */ public void setCareLevel(Integer careLevel) { this.careLevel = careLevel; } /** * @return the contactId */ public Integer getContactId() { return contactId; } /** * @param contactId the contactId to set */ public void setContactId(Integer contactId) { this.contactId = contactId; } /** * @return the logoUrl */ public String getLogoUrl() { return logoUrl; } /** * @param logoUrl the logoUrl to set */ public void setLogoUrl(String logoUrl) { this.logoUrl = logoUrl; } /** * @return the photoUrl */ public String getPhotoUrl() { return photoUrl; } /** * @param photoUrl the photoUrl to set */ public void setPhotoUrl(String photoUrl) { this.photoUrl = photoUrl; } /** * @return the registerDate */ public String getRegisterDate() { return registerDate; } /** * @param registerDate the registerDate to set */ public void setRegisterDate(String registerDate) { this.registerDate = registerDate; } /** * @return the cancelDate */ public String getCancelDate() { return cancelDate; } /** * @param cancelDate the cancelDate to set */ public void setCancelDate(String cancelDate) { this.cancelDate = cancelDate; } /** * @return the serialversionuid */ public static long getSerialversionuid() { return serialVersionUID; } }
[ "wqsdot7@gmail.com" ]
wqsdot7@gmail.com
3d8d877271140b9c4938cc9fe96165bbadee81e6
0c600206a70badccbb75fa91699b60102a91c8db
/src/test/java/com/musicmath_v2/service/TripletBpmServiceTest.java
62eb78369ab8d18099cfb615b9549c731c8b9342
[]
no_license
PeterEJensen/MixtoolsEXAM
14511ba1c090a88457fd0f5e56234d2fcb016735
e3768c02df80ec6ef4165430a8f24c97a83cde7b
refs/heads/master
2020-04-11T07:34:17.210386
2019-01-06T20:29:09
2019-01-06T20:29:09
161,615,212
0
0
null
null
null
null
UTF-8
Java
false
false
511
java
package com.musicmath_v2.service; import com.musicmath_v2.domain.DottedBpmEntity; import com.musicmath_v2.domain.TripletBpmEntity; import org.junit.Test; import static org.junit.Assert.assertEquals; public class TripletBpmServiceTest { TripletBpmService tS = new TripletBpmService(); TripletBpmEntity tE = new TripletBpmEntity(); @Test public void tripletBpm64() { tE.setSixtyfourNote(tS.tripletBpm(120)); assertEquals(20.84375,tE.getSixtyfourNote(),0000.00000); } }
[ "rasmushecter@gmail.com" ]
rasmushecter@gmail.com
a4a07fd171fbc42de28a591ddefb462a66f522be
3a8ca1d981629f49bd9e75f68fc2287b7c830177
/src/main/java/guru/sfg/brewery/model/events/NewInventoryEvent.java
4c632df3a40f5e1612e0479f22a67b5e6675a8a4
[]
no_license
kmoreti/kmoreti-beer-inventory-service
9b583dc061f0875c2a2d16dcb9630cce0df72307
297616c2f6a157aa052c6f9e6acf9a38e3e45db2
refs/heads/master
2023-06-07T00:56:58.119877
2021-07-03T18:16:47
2021-07-03T18:16:47
285,384,857
0
0
null
null
null
null
UTF-8
Java
false
false
338
java
package guru.sfg.brewery.model.events; import lombok.NoArgsConstructor; /** * Created by jt on 2019-07-21. */ @NoArgsConstructor public class NewInventoryEvent extends BeerEvent { private static final long serialVersionUID = -3915175777227421743L; public NewInventoryEvent(BeerDto beerDto) { super(beerDto); } }
[ "kleber.camargo@fatec.sp.gov.br" ]
kleber.camargo@fatec.sp.gov.br
081f18679b686f1a81de689b3ce862f2cb104387
17e28f979a105cadebf35d555d8e3199fd215d27
/src/java/jlr/src/Jlr.java
017f81392b588c73c4736eb2da0f5ecd758a198b
[ "MIT" ]
permissive
junjiemars/ant-ivy
10b5408dc8ede7be02bb0a48372051da8b9bda10
6041d2e9c3472773bbefc2b67ac6420d8bd148a2
refs/heads/master
2016-09-02T00:16:01.925249
2014-09-23T09:56:11
2014-09-23T09:56:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,420
java
import org.antlr.v4.runtime.ANTLRInputStream; import org.antlr.v4.runtime.CommonTokenStream; import org.antlr.v4.runtime.tree.ParseTree; import org.antlr.v4.runtime.tree.ParseTreeWalker; import java.io.StringReader; import static java.lang.System.out; public final class Jlr { public static void main(String[] args) throws Exception { ANTLRInputStream in = null; if (args.length > 0) { final StringReader reader = new StringReader(args[0]); in = new ANTLRInputStream(reader); } else { in = new ANTLRInputStream(System.in); } // calcT(in); // build with -listener -no-visitor // calcE(in); // build with -no-listener -visitor // sqlT(in); // sqlR(in); // propT(in); // propE(in); rqlE(in); } static final void sqlR(final ANTLRInputStream in) throws Exception { SQLLexer l = new SQLLexer(in); CommonTokenStream t = new CommonTokenStream(l); SQLParser p = new SQLParser(t); ParseTree tree = p.sql(); out.println(tree.toStringTree(p)); SQLVisitor e = new SqlR(); e.visit(tree); } static final void sqlT(final ANTLRInputStream in) throws Exception { SQLLexer l = new SQLLexer(in); CommonTokenStream t = new CommonTokenStream(l); SQLParser p = new SQLParser(t); ParseTree tree = p.sql(); out.println(tree.toStringTree(p)); ParseTreeWalker w = new ParseTreeWalker(); w.walk(new SqlT(), tree); out.println(); } static final void calcT(final ANTLRInputStream in) throws Exception { CalcLexer l = new CalcLexer(in); CommonTokenStream t = new CommonTokenStream(l); CalcParser p = new CalcParser(t); ParseTree tree = p.calc(); out.println(tree.toStringTree(p)); ParseTreeWalker w = new ParseTreeWalker(); final CalcT T = new CalcT(p); w.walk(T, tree); out.println(); } static final void calcE(final ANTLRInputStream in) throws Exception { CalcLexer l = new CalcLexer(in); CommonTokenStream t = new CommonTokenStream(l); CalcParser p = new CalcParser(t); ParseTree tree = p.calc(); out.println(tree.toStringTree(p)); CalcVisitor e = new CalcE(); e.visit(tree); } static final void propT(final ANTLRInputStream in) throws Exception { PropertyLexer l = new PropertyLexer(in); CommonTokenStream t = new CommonTokenStream(l); PropertyParser p = new PropertyParser(t); ParseTree tree = p.file(); out.println(tree.toStringTree(p)); ParseTreeWalker w = new ParseTreeWalker(); final PropertyT T = new PropertyT(); w.walk(T, tree); out.println(); } static final void propE(final ANTLRInputStream in) throws Exception { PropertyLexer l = new PropertyLexer(in); CommonTokenStream t = new CommonTokenStream(l); PropertyParser p = new PropertyParser(t); ParseTree tree = p.file(); out.println(tree.toStringTree(p)); PropertyVisitor e = new PropertyE(); e.visit(tree); } static final void rqlE(final ANTLRInputStream in) throws Exception { RQLLexer l = new RQLLexer(in); CommonTokenStream t = new CommonTokenStream(l); RQLParser p = new RQLParser(t); ParseTree tree = p.select(); out.println(tree.toStringTree(p)); RQLEmitter e = new RQLEmitter(); e.visit(tree); for (String s : e.ins()) { out.println(s); } } }
[ "junjiemars@gmail.com" ]
junjiemars@gmail.com
b13a29062d705760d99798f82d50b22752edd179
03be3f540f93a1507e82e4e84a651e205ba2971e
/.svn/pristine/b1/b13a29062d705760d99798f82d50b22752edd179.svn-base
7b484e9603552f058a89cfc6a80f86ff76edafcf
[]
no_license
Tarunjain19/DXC_SVN
448103f0c56e79616a2801acbf5d369d6e256b36
99a90150d30374929382c3181ee8b1f914c905ae
refs/heads/master
2022-06-04T10:36:52.755986
2020-05-06T08:44:47
2020-05-06T08:44:47
261,372,252
0
0
null
null
null
null
UTF-8
Java
false
false
3,941
package flow.subflow.NumberVerification; /** * The Data class handles many types of server-side operations including data * collection (from a data sources such as a database, or web service), variable * assignments and operations (like copying variable values, performing mathematic * operations, and collection iteration), conditional evaluation to control callflow * execution based on variable values, and logging/tracing statements. * * Items created in the getDataActions() method are executed/evaluated in order * and if a condional branch condition evaluates to "true" then the branch is * activated and the execution of data actions is halted. If no "true" conditions * are encountered, then all data actions will be executed/evaluated and the * application will proceed to the "Default" servlet. * Last generated by Orchestration Designer at: 2015-MAY-08 04:11:36 PM */ public class ChkIntelligentLayer extends com.avaya.sce.runtime.Data { //{{START:CLASS:FIELDS //}}END:CLASS:FIELDS /** * Default constructor * Last generated by Orchestration Designer at: 2015-MAY-08 04:11:36 PM */ public ChkIntelligentLayer() { //{{START:CLASS:CONSTRUCTOR super(); //}}END:CLASS:CONSTRUCTOR } /** * Returns the Next item which will forward application execution * to the next form in the call flow. * Last generated by Orchestration Designer at: 2017-AUG-28 11:20:45 AM */ public com.avaya.sce.runtime.Next getNext(com.avaya.sce.runtimecommon.SCESession mySession) { com.avaya.sce.runtime.Next next = null; return next; } /** * Create a list of local variables used by items in the data node. * * This method is generated automatically by the code generator * and should not be manually edited. Manual edits may be overwritten * by the code generator. * Last generated by Orchestration Designer at: 2017-AUG-28 11:20:45 AM */ public java.util.Collection<VariableInfo> getLocalVariables(){ java.util.Collection<VariableInfo> variables = new java.util.ArrayList<VariableInfo>(); return variables; } /** * Creates and conditionally executes operations that have been configured * in the Callflow. This method will build a collection of operations and * have the framework execute the operations by calling evaluateActions(). * If the evaluation causes the framework to forward to a different servlet * then execution stops. * Returning true from this method means that the framework has forwarded the * request to a different servlet. Returning false means that the default * Next will be invoked. * * This method is generated automatically by the code generator * and should not be manually edited. Manual edits may be overwritten * by the code generator. * Last generated by Orchestration Designer at: 2017-AUG-28 11:20:45 AM */ public boolean executeDataActions(com.avaya.sce.runtimecommon.SCESession mySession) throws Exception { java.util.Collection actions = null; actions = new java.util.ArrayList(1); if(evaluateActions(actions, mySession)) { return true; } actions = null; if(((com.avaya.sce.runtime.Condition)new com.avaya.sce.runtime.Condition("condition1", "Flag:isFromIntelligentLayer", com.avaya.sce.runtime.Expression.STRING_EQUAL_IGNORE, "Constants:yes", true).setDebugId(698)).evaluate(mySession)) { actions = new java.util.ArrayList(1); actions.add(new com.avaya.sce.runtime.Next("NumberVerification-MainMenu", "MainMenu").setDebugId(697)); if(evaluateActions(actions, mySession)) { return true; } actions = null; } else { actions = new java.util.ArrayList(1); actions.add(new com.avaya.sce.runtime.Next("NumberVerification-LinkDown", "LinkDown").setDebugId(700)); if(evaluateActions(actions, mySession)) { return true; } actions = null; } // return false if the evaluation of actions did not cause a servlet forward or redirect return false; } }
[ "tarun.jain3@dxc.com" ]
tarun.jain3@dxc.com
ada048f2588ca2e647529a3bc9fe56146b5977fb
81f689567f5a64989d73ba0ad2109418047bd52a
/Semester 1 and 2/Assignments/Java/LORD/Battlefield.java
7cd9dd04cc410c23678abfdf9ac62d3259e62c87
[]
no_license
hutiann/School_Stuff
b87459b7e2f9239b4f414d782de6b991beddde27
67024c9fac9e0b0517e0df30520b82053c91d3fd
refs/heads/master
2020-07-01T12:46:59.390421
2012-11-12T23:24:31
2012-11-12T23:24:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,324
java
/** Battlefield - models a two-dimensional array of Square objects * Author: Linda Crane * Data Fields: numRows: int - number of rows in array * numCols: int - number of cols in array * battlefield: Square[][] * numElves: int - number of elves in array * numOrcs: int - number of orcs in array * Methods: initial constructor - using parameters of numRows and numCols * getNumRows - returns numRows * getNumCols - returns numCols * getNumElves - returns numElves * getNumOrcs - returns numOrcs * setSquare: sets value of square based on parameters row, col and Square object, increments numElves and numOrcs * display: displays the battlefield array * moveActor: moves current actor at position indicated by parameters row and col, in direction indicated by parameter direction */ public class Battlefield { private int numRows; private int numCols; private Square [] [] battlefield; private int numElves; private int numOrcs; public Battlefield (int numRows, int numCols) { this.numRows = numRows; this.numCols = numCols; battlefield = new Square[numRows][numCols]; for (int i = 0; i < numRows; i++) for (int j = 0; j < numCols; j++) battlefield[i][j] = new Square(); } // get methods public int getNumRows() { return numRows; } public int getNumCols() { return numCols; } public Square getSquare (int row, int col) { return battlefield[row][col]; } public int getNumElves() { return numElves; } public int getNumOrcs() { return numOrcs; } // set methods public void setSquare(int row, int col, Square square) { battlefield[row][col] = new Square(square); if (square.getActor().getActorType() == 'o' || square.getActor().getActorType() == 'w') numOrcs++; else if (square.getActor().getActorType() == 'e' || square.getActor().getActorType() == 'h') numElves++; } // other methods public void display () { // display top border for (int i = 0; i < numCols+2; i++) System.out.print("-"); System.out.println(); // display board for (int i = 0; i < numRows; i++){ System.out.print ("|"); for (int j = 0; j < numCols; j++) { System.out.print(battlefield[i][j]); } System.out.println ("|"); } // display bottom border for (int i = 0; i < numCols+2; i++) System.out.print("-"); System.out.println(); System.out.println ("Current army count - Elves: " + numElves + " Orcs: " + numOrcs); } // end of display public void moveActor (int direction, int row, int col){ int newRow = 0; int newCol = 0; if (battlefield[row][col].getActor().getActorType() == ' ') System.out.println ("No actor to move at row " + row + " col " + col); else if (direction == 0 && row == 0) // move up not allowed System.out.println ("Actor at row " + row + " col " + col + " cannot move up"); else if (direction == 1 && row == numRows-1) // move down not allowed System.out.println ("Actor at row " + row + " col " + col + " cannot move down"); else if (direction == 2 && col == 0) // move left not allowed System.out.println ("Actor at row " + row + " col " + col + " cannot move left"); else if (direction == 3 && col == numCols-1) // move right not allowed System.out.println ("Actor at row " + row + " col " + col + " cannot move right"); else { if (direction == 0){ // move up newRow = row-1; newCol = col; } else if (direction == 1) { // move down newRow = row + 1; newCol = col; } else if (direction == 2) { // move left newRow = row; newCol = col-1; } else { // move right newRow = row; newCol = col+1; } if (battlefield[newRow][newCol].getTerrain() == 'm' && battlefield[row][col].getActor().getStrength() < 30) // cannot move onto a mountain System.out.println ("Cannot move onto a mountain from row " + row + " and col " + col); else if (battlefield[newRow][newCol].getTerrain() == 'm' && battlefield[row][col].getActor().getStrength() >= 30){ System.out.println ("Move onto Mountain with strength greater than 30"); battlefield[newRow][newCol].setTerrain('n'); battlefield[newRow][newCol].setActor (new Actor(battlefield[row][col].getActor().getActorType(), battlefield[row][col].getActor().getStrength())); battlefield[row][col].setActor (new Actor(' ', 0)); } else if (battlefield[newRow][newCol].getActor().getActorTeam() == battlefield[row][col].getActor().getActorTeam() ) System.out.println ("Cannot move onto a space occupied by your own team player"); else if (battlefield[newRow][newCol].getActor().getActorType() == ' ' ) { System.out.println ("Move onto normal terrain to position row " + newRow + " and col" + newCol); battlefield[newRow][newCol].setActor (new Actor(battlefield[row][col].getActor().getActorType(), battlefield[row][col].getActor().getStrength())); battlefield[row][col].setActor (new Actor(' ', 0)); }else // fight if (battlefield[newRow][newCol].getActor().getStrength() == battlefield[row][col].getActor().getStrength() ) System.out.println ("Battle resulted in draw at row "+ row + "and col" + col ); else if (battlefield[newRow][newCol].getActor().getStrength() > battlefield[row][col].getActor().getStrength() ){ System.out.println ("Lost the battle.... die at row " + row + " col " + col); if (battlefield[row][col].getActor().getActorType() == 'e' || battlefield[row][col].getActor().getActorType() == 'h') numElves --; else numOrcs--; battlefield[row][col].setActor(new Actor(' ', 0)); } else { System.out.println ("Won the battle...move to row " + row + " col " + col ); if (battlefield[row][col].getActor().getActorType() == 'e' || battlefield[row][col].getActor().getActorType() == 'h') numOrcs --; else numElves--; battlefield[newRow][newCol].setActor (new Actor(battlefield[row][col].getActor().getActorType(), battlefield[row][col].getActor().getStrength())); battlefield[row][col].setActor (new Actor(' ', 0)); } } // end else } // end moveActor method }// end class Battlefield
[ "willy@WILLY-LAPTOP.(none)" ]
willy@WILLY-LAPTOP.(none)
449dbba924637cfd793c11bad6594af1ee37159a
168025ead95cdcd3383df39e6aee2ec881b39e93
/src/main/java/com/example/datajdbcexample/DataJdbcExampleApplication.java
b5d3c2fa6efd7b98bccc215dcaac08a8fc10518a
[]
no_license
eduanb/data-jdbc-example
6eeed3fef02af21d8b46c886f2c90a753e04e9b7
36cec933882bc3edf3d752337fabc540e5125c51
refs/heads/master
2023-03-13T09:27:10.992327
2021-02-08T11:52:35
2021-02-08T11:52:35
337,058,061
0
0
null
null
null
null
UTF-8
Java
false
false
350
java
package com.example.datajdbcexample; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class DataJdbcExampleApplication { public static void main(String[] args) { SpringApplication.run(DataJdbcExampleApplication.class, args); } }
[ "bekker.eduan@gmail.com" ]
bekker.eduan@gmail.com
247027356ff469f821efe15374d4ebf6e9ebb07d
c199c3a7a29e1616361d58bf3f5a635440fe89cd
/src/main/java/utils/StringUtils.java
f47319403f0a2cb53fa265fecb2197a89fe85f37
[]
no_license
lxxjn0/jwp-was
e55c600015ff57140949246893deeca8a6c8051c
af644d07f668c28ee05741f92fdfc6cbfc2ea64d
refs/heads/main
2023-02-05T23:12:09.892307
2020-10-19T11:15:06
2020-11-15T04:02:38
293,973,531
0
0
null
2020-09-09T01:50:54
2020-09-09T01:50:53
null
UTF-8
Java
false
false
796
java
package utils; import java.util.HashMap; import java.util.Map; import java.util.Objects; public class StringUtils { private static final String PARAMETER_DELIMITER = "="; private static final String PARAMETERS_DELIMITER = "&"; private static final int PARAMETER_KEY = 0; private static final int PARAMETER_VALUE = 1; public static Map<String, String> readParameters(String line) { Objects.requireNonNull(line); Map<String, String> params = new HashMap<>(); String[] paramTokens = line.split(PARAMETERS_DELIMITER); for (String paramToken : paramTokens) { String[] strings = paramToken.split(PARAMETER_DELIMITER); params.put(strings[PARAMETER_KEY], strings[PARAMETER_VALUE]); } return params; } }
[ "ljy3510@gmail.com" ]
ljy3510@gmail.com
45ce6829233a84b369dc31aba78668af4c4d5ca4
382d0914b30e5c7a0a6611f929bdcc76259747ed
/GamePhomExtension/src/game/vn/game/phom/PhomConfig.java
4412d5a3a1a4773b4a0fb2b516c52ce3e20efb02
[]
no_license
Mrkenvin1982/viet13
874dbb02cb4d8659ac677a6b9f46d9315d1f1df8
d63aefaacf879df26441af625354bd9183a0820c
refs/heads/master
2022-04-09T06:53:04.807008
2020-03-24T16:24:58
2020-03-24T16:24:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,135
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 game.vn.game.phom; import game.vn.util.watchservice.PropertyConfigurator; /** * * @author tuanp */ public class PhomConfig extends PropertyConfigurator{ private static final String MAX_VIEWER= "game.phom.MaxViewer"; private final static PhomConfig INSTANCE=new PhomConfig("conf/","phom.properties"); /** * Singleton class. Get an instance of BaicaoConfig. * * @return An instance of ServerInfo. */ public static PhomConfig getInstance() { return INSTANCE; } public PhomConfig(String path, String nameFile){ super(path, nameFile); } /** * số viewer tối đa cho game * * @return */ public int getMaxViewer() { return getIntAttribute(MAX_VIEWER, 0); } public boolean isTest() { return getBooleanAttribute("IS_TEST"); } int getTestCase() { return getIntAttribute("TESTCASE", 0); } }
[ "hanv@mecorp.vn" ]
hanv@mecorp.vn
403fc7f6bdcde4b3e9451c610edcba52240c9cbf
88b883da0599391a81548686ef325ad6337a1547
/app/src/main/java/org/opensharingtoolkit/daoplayer/audio/FileCache.java
d231020240e700fa811a112c4cb895f11970f779
[ "BSD-3-Clause" ]
permissive
cgreenhalgh/daoplayer
c1994df3cd9456dd52602a9dfcccec9c7fd01316
30182756c665e2579ed055aa7909b302357b6af3
refs/heads/master
2021-01-17T09:19:08.768340
2018-01-17T17:35:57
2018-01-17T17:35:57
25,549,962
0
0
null
null
null
null
UTF-8
Java
false
false
17,847
java
/** * */ package org.opensharingtoolkit.daoplayer.audio; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.Map; import java.util.TreeMap; import java.util.TreeSet; import java.util.Vector; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.FutureTask; import org.opensharingtoolkit.daoplayer.IAudio; import org.opensharingtoolkit.daoplayer.ILog; import org.opensharingtoolkit.daoplayer.audio.AudioEngine.StateType; import android.content.Context; import android.util.Log; /** * Maintains cache of decoded files, decoding more as required. Used by AudioEngine. * Updates based on AudioEngine queue State. Uses internal threads to decode in the * background. * * @author pszcmg */ public class FileCache { static boolean debug = true; public static class Block { short mSamples[]; int mChannels; int mStartFrame; // Note frame number // internal int mIndex; long mLastRequestedTime; /** * @return the mSamples */ public short[] getSamples() { return mSamples; } /** * @return the mChannels */ public int getChannels() { return mChannels; } /** * @return the mStartFrame */ public int getStartFrame() { return mStartFrame; } /** * @return the mIndex */ public int getIndex() { return mIndex; } }; static class File { String mPath; FileDecoder mDecoder; TreeMap<Integer,Block> mBlocks = new TreeMap<Integer,Block>(); File(String path) { mPath = path; } } private static final String TAG = "daoplayer-filecache"; private static final long CACHE_RETAIN_TIME_MS = 2000; private static final int CACHE_RATAIN_SAMPLES = (2*44100); private Map<String,File> mFiles = new HashMap<String,File>(); private Vector<FileNeedTask> mTasks = new Vector<FileNeedTask>(); private ExecutorService mExecutor; /** may use context to access assets */ private Context mContext; private static ILog mLog; /** * @param mContext */ public FileCache(Context mContext, ILog log) { this.mContext = mContext; mLog = log; mExecutor = Executors.newSingleThreadExecutor(); } /** play out API */ public Block getBlock(AFile afile, int frame, Block lastBlock) { File file = null; synchronized(this) { file = mFiles.get(afile.getPath()); } if (file==null) return null; synchronized(file.mBlocks) { TreeMap.Entry<Integer,Block> ent = file.mBlocks.floorEntry(frame); if (ent!=null) { Block b = ent.getValue(); if (b.mStartFrame<=frame && b.mStartFrame+b.mSamples.length/b.mChannels > frame) { // found in cache! b.mLastRequestedTime = System.currentTimeMillis(); return b; } } // cache miss } return null; } public void reset() { synchronized (this) { for (File file : mFiles.values()) { if (file.mDecoder!=null) file.mDecoder.cancel(); } // TODO no need?! mFiles.clear(); } } static class NeedRec { public NeedRec(AFile file) { mFile = file; } AFile mFile; TreeMap<Integer,Interval> mIntervals = new TreeMap<Integer,Interval>(); public void merge(Interval ival) { int fromInclusive = ival.mFromInclusive; TreeMap.Entry<Integer,Interval> from = mIntervals.floorEntry(fromInclusive); if (from!=null) fromInclusive = from.getValue().mFromInclusive; // overlaps // copy Collection<Interval> overlaps = new LinkedList<Interval>(); overlaps.addAll(mIntervals.subMap(fromInclusive, ival.mToExclusive).values()); for (Interval overlap : overlaps) { if (overlap.mToExclusive<=ival.mFromInclusive) // shouldn't happen continue; else if (overlap.mToExclusive<=ival.mToExclusive) { // 1. ends at/before new if (overlap.mFromInclusive<ival.mFromInclusive) { // 1.1 starts before new (and ends at/before new) if (overlap.mPriority==ival.mPriority) { // merge (into new) ival.mFromInclusive = overlap.mFromInclusive; mIntervals.remove(overlap.mFromInclusive); } else if (overlap.mPriority>ival.mPriority){ // we shrink ival.mFromInclusive = overlap.mToExclusive; // dead? if (ival.mFromInclusive>=ival.mToExclusive) return; } else { // they shrink overlap.mToExclusive = ival.mFromInclusive; } } else { // 1.2. start at/after new (and ends at/before new), i.e. dominated! if (overlap.mPriority==ival.mPriority) { // merge (into new) ival.mFromInclusive = overlap.mFromInclusive; mIntervals.remove(overlap.mFromInclusive); } else if (overlap.mPriority>ival.mPriority){ // we shrink, possible split off before if (ival.mFromInclusive<overlap.mFromInclusive) { Interval fragment = new Interval(ival.mFromInclusive, overlap.mFromInclusive, ival.mPriority); mIntervals.put(fragment.mFromInclusive, fragment); } ival.mFromInclusive = overlap.mToExclusive; // dead? if (ival.mFromInclusive>=ival.mToExclusive) return; } else { // it shrinks = killed! mIntervals.remove(overlap.mFromInclusive); } } } else { // 2. ends after new if (overlap.mFromInclusive<ival.mFromInclusive) { // 2.1 starts before new (and ends after new) if (overlap.mPriority==ival.mPriority) { // we are no needed! (merge) return; } else if (overlap.mPriority>ival.mPriority) { // we are no needed! (killed) return; } else { // we split it Interval fragment = new Interval(ival.mToExclusive, overlap.mToExclusive, overlap.mPriority); mIntervals.put(fragment.mFromInclusive, fragment); overlap.mToExclusive = ival.mFromInclusive; } } else { // 2.2 starts at/after new (and ends after new) if (overlap.mPriority==ival.mPriority) { // merge (in order) ival.mToExclusive = overlap.mToExclusive; mIntervals.remove(overlap.mFromInclusive); } else if (overlap.mPriority>ival.mPriority) { // we shrink ival.mToExclusive = overlap.mFromInclusive; // dead? if (ival.mFromInclusive>=ival.mToExclusive) return; } else { // it shrinks if (ival.mToExclusive>=overlap.mToExclusive) mIntervals.remove(overlap.mFromInclusive); else overlap.mFromInclusive = ival.mToExclusive; } } } }//for overlaps // add what is left! mIntervals.put(ival.mFromInclusive, ival); } }; static int getPriority(AudioEngine.StateType type) { switch(type) { case STATE_DISCARDED: case STATE_WRITTEN: default: return -1; case STATE_IN_PROGRESS: return 1; case STATE_NEXT: return 1; case STATE_FUTURE: return 0; case STATE_FUTURE2: return 0; } } static class Interval { int mFromInclusive; int mToExclusive; int mPriority; Interval(int fromInclusive, int toExclusive) { mFromInclusive = fromInclusive; mToExclusive = toExclusive; } public Interval(int fromInclusive, int toExclusive, int priority) { mFromInclusive = fromInclusive; mToExclusive = toExclusive; mPriority = priority; } } public void update(Vector<AudioEngine.StateRec> stateQueue, HashMap<Integer, ATrack> mTracks, int samplesPerBlock, AudioEngine engine) { // What file spans do we need and how soon? HashMap<String,NeedRec> needRecs = new HashMap<String,NeedRec>(); for (AudioEngine.StateRec srec : stateQueue) { if (srec.mType==AudioEngine.StateType.STATE_IN_PROGRESS || srec.mType==AudioEngine.StateType.STATE_NEXT) { int blockLength = samplesPerBlock*2; for (ATrack track : mTracks.values()) { AState.TrackRef tr = srec.mState.get(track); if (tr==null || tr.isPaused()) // TODO ok with align? continue; int [] align = tr.getAlign(); // frames, inclusive int bufStart = 0, bufEnd = -1; int refPos = tr.getPos(); float pwlVolume[] = tr.getPwlVolume(); int vol = 0; if (pwlVolume==null) { // 12 bit shift vol = (int)(tr.getVolume() * 0x1000); if (vol<=0) { // silent continue; } } int sceneTime = engine.secondsToSamples(srec.mSceneTime); // each aligned sub-section for (int ai=0; ai<=(align!=null ? align.length : 0) && bufStart<=blockLength-1; ai+=2, bufStart = bufEnd+1) { int tpos = refPos+bufStart; if (align!=null && align.length>=2) { if (ai<align.length) { // up to an alignment if (align[ai]<=sceneTime+bufStart) { // already past refPos = align[ai+1]+sceneTime-align[ai]; //Log.d(TAG,"Align track at +"+bufStart+": "+sceneTime+" -> "+tr.getPos()+" (align "+align[ai]+"->"+align[ai+1]+")"); continue; } if (align[ai]>=sceneTime+blockLength) // after this buffer bufEnd = blockLength-1; else { // coming up... bufEnd = align[ai]-sceneTime-1; // for next time refPos = align[ai+1]+sceneTime-align[ai]; } } else { // from last alignment bufEnd = blockLength-1; } } else bufEnd = blockLength-1; if (pwlVolume!=null) { float fromSceneTime = (float)engine.samplesToSeconds(sceneTime+bufStart); float toSceneTime = (float)engine.samplesToSeconds(sceneTime+bufEnd); if (!AudioEngine.pwlNonzero(fromSceneTime, toSceneTime, pwlVolume)) { // silent continue; } Float cvol = AudioEngine.pwlConstant(fromSceneTime, toSceneTime, pwlVolume); if (cvol!=null) { pwlVolume = null; vol = (int)(cvol * 0x1000); if (vol<=0) { // silent continue; } } } for (ATrack.FileRef fr : track.mFileRefs) { int spos = tpos, epos = tpos+bufEnd-bufStart; if (fr.mTrackPos > epos || fr.mRepeats==0) continue; if (fr.mTrackPos > spos) spos = fr.mTrackPos; int repetition = 0; AFile file = (AFile)fr.mFile; int length = fr.mLength; if (length==IAudio.ITrack.LENGTH_ALL) repetition = 0; else { repetition = (spos - fr.mTrackPos)/length; if (fr.mRepeats!=IAudio.ITrack.REPEATS_FOREVER) { if (repetition >= fr.mRepeats) continue; if (fr.mTrackPos+length*fr.mRepeats<epos) epos = fr.mTrackPos+length*fr.mRepeats; } } // within file? while (spos <= epos) { int fpos = fr.mFilePos+(spos-fr.mTrackPos-repetition*length); // fpos is position in file of spos in track NeedRec nr = needRecs.get(file.getPath()); if (nr==null) { nr = new NeedRec(file); needRecs.put(file.getPath(), nr); } Interval ival = new Interval(fpos, fpos+epos-spos, getPriority(srec.mType)); nr.merge(ival); // next repetition if (length==IAudio.ITrack.LENGTH_ALL) // can't repeat length all (for now, anyway) break; repetition++; if (fr.mRepeats!=IAudio.ITrack.REPEATS_FOREVER && repetition >= fr.mRepeats) break; spos = fr.mTrackPos+repetition*length; continue; } } } } } } // Throw this over the the background thread!! update(needRecs); } private synchronized void update(HashMap<String, NeedRec> needRecs) { // old tasks for (FileNeedTask task : mTasks) { task.cancel(false); } mTasks.clear(); // eject old long now = System.currentTimeMillis(); long old = now-CACHE_RETAIN_TIME_MS; for (File file : mFiles.values()) { synchronized(file.mBlocks) { Iterator<TreeMap.Entry<Integer,Block>> iter = file.mBlocks.tailMap(CACHE_RATAIN_SAMPLES).entrySet().iterator(); while(iter.hasNext()) { TreeMap.Entry<Integer,Block> entry = iter.next(); if (entry.getValue().mLastRequestedTime < old && entry.getValue().mStartFrame>=CACHE_RATAIN_SAMPLES) { if (debug) Log.d(TAG,"Eject block "+entry.getValue().mStartFrame+"("+entry.getValue().mSamples.length+") from cache for "+file.mPath); iter.remove(); } } } } // decode / blocks...? for (NeedRec nrec : needRecs.values()) { File file = null; synchronized(this) { file = mFiles.get(nrec.mFile.getPath()); if (file==null) { file = new File(nrec.mFile.getPath()); mFiles.put(nrec.mFile.getPath(), file); } if (file.mDecoder==null) { file.mDecoder = new FileDecoder(nrec.mFile.getPath(), mContext); //file.mDecoder.queueDecode(); } } FileNeedTask task = new FileNeedTask(nrec, file, 1); mTasks.add(task); mExecutor.execute(task); } } /** handle needed stuff from a File */ static class FileNeedTask extends FutureTask<Boolean> { FileNeedTask(final NeedRec nrec, final File file, final int priority) { super(new Runnable() { public void run() { work(nrec, file, priority); } }, true); } private static void work(NeedRec nrec, File file, int priority) { //Log.d(TAG,"work pri="+priority+" on "+nrec.mFile.getPath()); for (Interval needed : nrec.mIntervals.values()) { if (needed.mPriority!=priority) { //if (needed.mPriority<0) if (debug) Log.d(TAG,"ignore work pri="+needed.mPriority+"/"+priority+" "+needed.mFromInclusive+"-"+needed.mToExclusive+" of "+nrec.mFile.getPath()); continue; } Collection<Block> blocks = null; synchronized(file.mBlocks) { // block at/immediately before int startFrame = needed.mFromInclusive; TreeMap.Entry<Integer,Block> ent = file.mBlocks.floorEntry(startFrame); if (ent!=null) startFrame = ent.getValue().mStartFrame; // candidate blocks blocks = file.mBlocks.subMap(startFrame, needed.mToExclusive).values(); } if (debug) Log.d(TAG,"work pri="+needed.mPriority+" "+needed.mFromInclusive+"-"+needed.mToExclusive+" of "+nrec.mFile.getPath()); // have we already got this? // gaps? from/length TreeMap<Integer,Interval> gaps = new TreeMap<Integer,Interval>(); gaps.put(needed.mFromInclusive, new Interval(needed.mFromInclusive, needed.mToExclusive, needed.mPriority)); long now = System.currentTimeMillis(); for (Block b : blocks) { b.mLastRequestedTime = now; int length = b.mSamples.length/b.mChannels; int startFrame = b.mStartFrame; TreeMap.Entry<Integer,Interval> from = gaps.floorEntry(b.mStartFrame); if (from!=null) startFrame = from.getValue().mFromInclusive; // copy Collection<Interval> overlapGaps = new LinkedList<Interval>(); overlapGaps.addAll(gaps.subMap(startFrame, b.mStartFrame+length).values()); for (Interval overlapGap : overlapGaps) { // start after? if (overlapGap.mFromInclusive>=b.mStartFrame) { if (overlapGap.mToExclusive<=b.mStartFrame+length) //discard gaps.remove(overlapGap.mFromInclusive); else if (overlapGap.mFromInclusive<b.mStartFrame+length) { // clip start gaps.remove(overlapGap.mFromInclusive); overlapGap.mFromInclusive = b.mStartFrame+length; gaps.put(overlapGap.mFromInclusive, overlapGap); } } else if (overlapGap.mToExclusive>b.mStartFrame) { if (overlapGap.mToExclusive<=b.mStartFrame+length) // clip end overlapGap.mToExclusive = b.mStartFrame; else { if (debug) Log.d(TAG,"split gap "+overlapGap.mFromInclusive+"-"+overlapGap.mToExclusive+" with "+b.mStartFrame+"-"+(b.mStartFrame+length)+" in "+nrec.mFile.getPath()); // split gap - post gaps.put(b.mStartFrame+length, new Interval(b.mStartFrame+length, overlapGap.mToExclusive, overlapGap.mPriority)); // pre overlapGap.mToExclusive = b.mStartFrame; } } } } // these are the fragment(s) we are missing from that particular interval for (Interval gap : gaps.values()) { if (debug) Log.d(TAG,"gap "+gap.mFromInclusive+"-"+gap.mToExclusive+" in "+nrec.mFile.getPath()); int bpos = gap.mFromInclusive; while (!file.mDecoder.isFailed() && bpos<gap.mToExclusive) { if (!file.mDecoder.isStarted()) { file.mDecoder.start(); if (file.mDecoder.isFailed()) { Log.e(TAG,"Failed to start decoder for "+file.mPath); mLog.logError("Unable to read/decode audio file "+file.mPath); break; } } Block b = file.mDecoder.getBlock(bpos); if (b==null) { if (debug) Log.d(TAG,"Could not get block "+bpos+" for "+file.mPath); break; } b.mLastRequestedTime = now; synchronized (file.mBlocks) { if (debug) Log.d(TAG,"Got block "+bpos+" (+"+b.mSamples.length/b.mChannels+") for "+file.mPath); file.mBlocks.put(b.mStartFrame, b); } bpos += b.mSamples.length/b.mChannels; } } // TODO mark past end } } }; /** warm up for files... */ public void init(HashMap<Integer, ATrack> mTracks) { HashMap<String,NeedRec> needRecs = new HashMap<String,NeedRec>(); for (ATrack atrack : mTracks.values()) { for (ATrack.FileRef fr : atrack.mFileRefs) { AFile file = (AFile)fr.mFile; NeedRec nr = needRecs.get(file.getPath()); if (nr==null) { nr = new NeedRec(file); needRecs.put(file.getPath(), nr); } Interval ival = new Interval(0,1, getPriority(StateType.STATE_NEXT)); nr.merge(ival); } } update(needRecs); } /** all done ? */ public synchronized boolean isIdle() { for (FileNeedTask task : mTasks) { if (!task.isDone() && !task.isCancelled()) return false; } return true; } }
[ "chris.greenhalgh@nottingham.ac.uk" ]
chris.greenhalgh@nottingham.ac.uk
b5e9687164986719a83c0e54df7c7371b5319317
5e2f9e49ac0d118c217895b48ec9c200fbefed91
/wdwebLib/src/main/java/com/wdweblib/web/WDWebChromeClient.java
29fb2291f6d48ffc3e374da52857a9770f44da90
[]
no_license
1208912705/WDWebView
64d3881524a922a046185e6cf5b3efb58e7c5234
94edddb1cc37ebc54fe3ddb0bec2a99cc47f241e
refs/heads/master
2023-06-02T11:17:24.483335
2021-06-16T08:33:24
2021-06-16T08:33:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,694
java
package com.wdweblib.web; import android.graphics.Bitmap; import android.net.Uri; import android.os.Message; import android.util.Log; import android.view.View; import androidx.annotation.Nullable; import com.tencent.smtt.export.external.interfaces.ConsoleMessage; import com.tencent.smtt.export.external.interfaces.GeolocationPermissionsCallback; import com.tencent.smtt.export.external.interfaces.IX5WebChromeClient; import com.tencent.smtt.export.external.interfaces.JsPromptResult; import com.tencent.smtt.export.external.interfaces.JsResult; import com.tencent.smtt.export.external.interfaces.PermissionRequest; import com.tencent.smtt.sdk.ValueCallback; import com.tencent.smtt.sdk.WebChromeClient; import com.tencent.smtt.sdk.WebStorage; import com.tencent.smtt.sdk.WebView; import com.wdweblib.LoadView; /** * code by markfeng * <p> * create on 2021-05-26 16:12 */ public class WDWebChromeClient extends WebChromeClient { private LoadView mLoadView; public WDWebChromeClient() { super(); } @Override public void onExceededDatabaseQuota(String s, String s1, long l, long l1, long l2, WebStorage.QuotaUpdater quotaUpdater) { super.onExceededDatabaseQuota(s, s1, l, l1, l2, quotaUpdater); Log.i("WDWeb","onExceededDatabaseQuota"); } @Override public Bitmap getDefaultVideoPoster() { Log.i("WDWeb","getDefaultVideoPoster"); return super.getDefaultVideoPoster(); } @Override public void getVisitedHistory(ValueCallback<String[]> valueCallback) { super.getVisitedHistory(valueCallback); Log.i("WDWeb","getVisitedHistory"); } @Override public boolean onConsoleMessage(ConsoleMessage consoleMessage) { Log.i("WDWeb","onConsoleMessage"); return super.onConsoleMessage(consoleMessage); } @Override public boolean onCreateWindow(WebView webView, boolean b, boolean b1, Message message) { Log.i("WDWeb","onCreateWindow"); return super.onCreateWindow(webView, b, b1, message); } @Override public void onGeolocationPermissionsHidePrompt() { Log.i("WDWeb","onGeolocationPermissionsHidePrompt"); super.onGeolocationPermissionsHidePrompt(); } @Override public void onGeolocationPermissionsShowPrompt(String s, GeolocationPermissionsCallback geolocationPermissionsCallback) { Log.i("WDWeb","onGeolocationPermissionsShowPrompt"); super.onGeolocationPermissionsShowPrompt(s, geolocationPermissionsCallback); } @Override public void onHideCustomView() { Log.i("WDWeb","onHideCustomView"); super.onHideCustomView(); } @Override public boolean onJsAlert(WebView webView, String s, String s1, JsResult jsResult) { Log.i("WDWeb","onJsAlert"); return super.onJsAlert(webView, s, s1, jsResult); } @Override public boolean onJsConfirm(WebView webView, String s, String s1, JsResult jsResult) { Log.i("WDWeb","onJsConfirm"); return super.onJsConfirm(webView, s, s1, jsResult); } @Override public boolean onJsPrompt(WebView webView, String s, String s1, String s2, JsPromptResult jsPromptResult) { Log.i("WDWeb","onJsPrompt"); return super.onJsPrompt(webView, s, s1, s2, jsPromptResult); } @Override public boolean onJsBeforeUnload(WebView webView, String s, String s1, JsResult jsResult) { Log.i("WDWeb","onJsBeforeUnload"); return super.onJsBeforeUnload(webView, s, s1, jsResult); } @Override public boolean onJsTimeout() { Log.i("WDWeb","onJsTimeout"); return super.onJsTimeout(); } @Override public void onProgressChanged(WebView webView, int newProgress) { Log.i("WDWeb","onProgressChanged"); super.onProgressChanged(webView, newProgress); if (newProgress == 100) { if (mLoadView != null) { mLoadView.hide(); } } } @Override public void onReachedMaxAppCacheSize(long l, long l1, WebStorage.QuotaUpdater quotaUpdater) { super.onReachedMaxAppCacheSize(l, l1, quotaUpdater); Log.i("WDWeb","onReachedMaxAppCacheSize"); } @Override public void onReceivedIcon(WebView webView, Bitmap bitmap) { super.onReceivedIcon(webView, bitmap); Log.i("WDWeb","onReceivedIcon"); } @Override public void onReceivedTouchIconUrl(WebView webView, String s, boolean b) { super.onReceivedTouchIconUrl(webView, s, b); Log.i("WDWeb","onReceivedTouchIconUrl"); } @Override public void onReceivedTitle(WebView webView, String s) { super.onReceivedTitle(webView, s); Log.i("WDWeb","onReceivedTitle"); } @Override public void onRequestFocus(WebView webView) { super.onRequestFocus(webView); Log.i("WDWeb","onRequestFocus"); } @Override public void onShowCustomView(View view, IX5WebChromeClient.CustomViewCallback customViewCallback) { super.onShowCustomView(view, customViewCallback); Log.i("WDWeb","onShowCustomView"); } @Override public void onShowCustomView(View view, int i, IX5WebChromeClient.CustomViewCallback customViewCallback) { super.onShowCustomView(view, i, customViewCallback); Log.i("WDWeb","onShowCustomView"); } @Override public void onCloseWindow(WebView webView) { super.onCloseWindow(webView); Log.i("WDWeb","onCloseWindow"); } @Override public View getVideoLoadingProgressView() { Log.i("WDWeb","getVideoLoadingProgressView"); return super.getVideoLoadingProgressView(); } @Override public void openFileChooser(ValueCallback<Uri> valueCallback, String s, String s1) { super.openFileChooser(valueCallback, s, s1); Log.i("WDWeb","openFileChooser"); } @Override public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> valueCallback, FileChooserParams fileChooserParams) { Log.i("WDWeb","onShowFileChooser"); return super.onShowFileChooser(webView, valueCallback, fileChooserParams); } @Override public void onPermissionRequest(PermissionRequest permissionRequest) { super.onPermissionRequest(permissionRequest); Log.i("WDWeb","onPermissionRequest"); } @Override public void onPermissionRequestCanceled(PermissionRequest permissionRequest) { super.onPermissionRequestCanceled(permissionRequest); Log.i("WDWeb","onPermissionRequestCanceled"); } public void setLoadView(LoadView mLoadView) { this.mLoadView = mLoadView; } }
[ "1246114057@qq.com" ]
1246114057@qq.com
f854497206c1869a5078e9f0236c5d8b94ddef5c
edcb0687d27051dd4fc13e2208be9048c295d02f
/test1.java
fc74b752fcefdd63da2b9452a6499f1a8ca57172
[]
no_license
Rajeshwari1330/demo1
51a97b0262f4aec0adf498d076efe55a8b607d8f
26c396bcd2abc5ddfebc6907107c604eb4300506
refs/heads/master
2022-08-09T19:47:10.994030
2020-05-19T10:31:55
2020-05-19T10:31:55
263,656,536
0
0
null
null
null
null
UTF-8
Java
false
false
99
java
class t1 { public static void main(String[] args) { System.out.println("welcome......."); } }
[ "yallalraj1330@gmail.com" ]
yallalraj1330@gmail.com
220ff900d9073b75753921e8f2dd531582d489aa
b31cf5586f210c7c5b5245b6cae47f0ec0c57099
/itoken-common/src/main/java/com/sen/itoken/common/utils/MapperUtils.java
f5a3df61beca5a26fc664b9964f50ac02c966e0b
[ "Apache-2.0" ]
permissive
sumforest/itoken
7a012ed55b3e4c9976cc0a6ba94a68a20059d399
427f4fa56631d27cf9f40ab4ae3b0b6818cd62ac
refs/heads/master
2022-11-30T11:18:42.786801
2019-10-08T16:24:44
2019-10-08T16:24:44
205,435,175
1
0
Apache-2.0
2022-11-16T09:48:46
2019-08-30T18:17:48
Java
UTF-8
Java
false
false
6,477
java
package com.sen.itoken.common.utils; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.ObjectMapper; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Jackson 工具类 * <p>Title: MapperUtils</p> * <p>Description: </p> * * @author Lusifer * @version 1.0.0 * @date 2018/3/4 21:50 */ public class MapperUtils { private final static ObjectMapper objectMapper = new ObjectMapper(); public static ObjectMapper getInstance() { return objectMapper; } /** * 转换为 JSON 字符串 * * @param obj * @return * @throws Exception */ public static String obj2json(Object obj) throws Exception { return objectMapper.writeValueAsString(obj); } /** * 转换为 JSON 字符串,忽略空值 * * @param obj * @return * @throws Exception */ public static String obj2jsonIgnoreNull(Object obj) throws Exception { ObjectMapper mapper = new ObjectMapper(); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); return mapper.writeValueAsString(obj); } /** * 转换为 JavaBean * * @param jsonString * @param clazz * @return * @throws Exception */ public static <T> T json2pojo(String jsonString, Class<T> clazz) throws Exception { objectMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); return objectMapper.readValue(jsonString, clazz); } /** * 字符串转换为 Map<String, Object> * * @param jsonString * @return * @throws Exception */ public static <T> Map<String, Object> json2map(String jsonString) throws Exception { ObjectMapper mapper = new ObjectMapper(); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); return mapper.readValue(jsonString, Map.class); } /** * 字符串转换为 Map<String, T> */ public static <T> Map<String, T> json2map(String jsonString, Class<T> clazz) throws Exception { Map<String, Map<String, Object>> map = objectMapper.readValue(jsonString, new TypeReference<Map<String, T>>() { }); Map<String, T> result = new HashMap<String, T>(); for (Map.Entry<String, Map<String, Object>> entry : map.entrySet()) { result.put(entry.getKey(), map2pojo(entry.getValue(), clazz)); } return result; } /** * 深度转换 JSON 成 Map * * @param json * @return */ public static Map<String, Object> json2mapDeeply(String json) throws Exception { return json2MapRecursion(json, objectMapper); } /** * 把 JSON 解析成 List,如果 List 内部的元素存在 jsonString,继续解析 * * @param json * @param mapper 解析工具 * @return * @throws Exception */ private static List<Object> json2ListRecursion(String json, ObjectMapper mapper) throws Exception { if (json == null) { return null; } List<Object> list = mapper.readValue(json, List.class); for (Object obj : list) { if (obj != null && obj instanceof String) { String str = (String) obj; if (str.startsWith("[")) { obj = json2ListRecursion(str, mapper); } else if (obj.toString().startsWith("{")) { obj = json2MapRecursion(str, mapper); } } } return list; } /** * 把 JSON 解析成 Map,如果 Map 内部的 Value 存在 jsonString,继续解析 * * @param json * @param mapper * @return * @throws Exception */ private static Map<String, Object> json2MapRecursion(String json, ObjectMapper mapper) throws Exception { if (json == null) { return null; } Map<String, Object> map = mapper.readValue(json, Map.class); for (Map.Entry<String, Object> entry : map.entrySet()) { Object obj = entry.getValue(); if (obj != null && obj instanceof String) { String str = ((String) obj); if (str.startsWith("[")) { List<?> list = json2ListRecursion(str, mapper); map.put(entry.getKey(), list); } else if (str.startsWith("{")) { Map<String, Object> mapRecursion = json2MapRecursion(str, mapper); map.put(entry.getKey(), mapRecursion); } } } return map; } /** * 将 JSON 数组转换为集合 * * @param jsonArrayStr * @param clazz * @return * @throws Exception */ public static <T> List<T> json2list(String jsonArrayStr, Class<T> clazz) throws Exception { JavaType javaType = getCollectionType(ArrayList.class, clazz); List<T> list = (List<T>) objectMapper.readValue(jsonArrayStr, javaType); return list; } /** * 获取泛型的 Collection Type * * @param collectionClass 泛型的Collection * @param elementClasses 元素类 * @return JavaType Java类型 * @since 1.0 */ public static JavaType getCollectionType(Class<?> collectionClass, Class<?>... elementClasses) { return objectMapper.getTypeFactory().constructParametricType(collectionClass, elementClasses); } /** * 将 Map 转换为 JavaBean * * @param map * @param clazz * @return */ public static <T> T map2pojo(Map map, Class<T> clazz) { return objectMapper.convertValue(map, clazz); } /** * 将 Map 转换为 JSON * * @param map * @return */ public static String mapToJson(Map map) { try { return objectMapper.writeValueAsString(map); } catch (Exception e) { e.printStackTrace(); } return ""; } /** * 将 JSON 对象转换为 JavaBean * * @param obj * @param clazz * @return */ public static <T> T obj2pojo(Object obj, Class<T> clazz) { return objectMapper.convertValue(obj, clazz); } }
[ "12345678" ]
12345678
215ce4a2259df6562edb76b524e36b76feaaaf4a
47761f5843a42ec5ce4b0e4a5ab23579e8c44959
/src/main/java/com/geniisys/giac/service/GIACChartOfAcctsService.java
3d300dc77859a089c5cf533119f0080ce7236aa0
[]
no_license
jabautista/GeniisysSCA
df6171c27594638193949df1a65c679444d51b9f
6dc1b21386453240f0632f37f00344df07f6bedd
refs/heads/development
2021-01-19T20:54:11.936774
2017-04-20T02:05:41
2017-04-20T02:05:41
88,571,440
2
0
null
2017-08-02T01:48:59
2017-04-18T02:18:03
PLSQL
UTF-8
Java
false
false
1,912
java
/** * * Project Name: Geniisys Web * Version: * Author: Computer Professionals, Inc. * */ package com.geniisys.giac.service; import java.sql.SQLException; import java.text.ParseException; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import org.json.JSONException; import org.json.JSONObject; import com.geniisys.framework.util.PaginatedList; import com.geniisys.giac.entity.GIACChartOfAccts; /** * The Interface GIACOrderOfPaymentService. */ public interface GIACChartOfAcctsService { /** * Get Account Code Details. * * @return the GIACChartOfAccts * @throws SQLException the sQL exception */ PaginatedList getAccountCodeDtls(Map<String, Object> params, Integer pageNo) throws SQLException; PaginatedList getAccountCodeDtls2(String keyword, Integer pageNo) throws SQLException; List<GIACChartOfAccts> getAllChartOfAccts() throws SQLException; List<GIACChartOfAccts> getAccountCodes(Map<String, Object> params) throws SQLException; JSONObject showGiacs311(HttpServletRequest request, String userId) throws SQLException, JSONException; String checkGiacs311UserFunction(HttpServletRequest request, String userId) throws SQLException; String getGlMotherAcct(HttpServletRequest request) throws SQLException; String getIncrementedLevel(HttpServletRequest request) throws SQLException; JSONObject getChildRecList(HttpServletRequest request, String userId) throws SQLException, JSONException; Map<String, Object> getChildChartOfAccts (HttpServletRequest request, String userId) throws SQLException, JSONException, ParseException; void valUpdateRec(HttpServletRequest request) throws SQLException; void saveGiacs311(HttpServletRequest request, String userId) throws SQLException, JSONException; void valAddRec(HttpServletRequest request) throws SQLException; void valDelRec(HttpServletRequest request) throws SQLException; }
[ "jeromecris.bautista@gmail.com" ]
jeromecris.bautista@gmail.com
8a4b5175718d5e5ade8d862bad6dccae5aaa3cb4
1921c12b102764f56087840f95bb38f4077cb5dd
/backend/src/main/java/com/hh/webcollect/common/exception/WcException.java
a59bf53c152b1314ca0dd504a05a9800d74234de
[ "MIT" ]
permissive
panhb/webcollect
1ae52aac588833b11ce8c9d3635ac28b8d248c17
d5416c71cd3ca81f5dac4f1d4a1a5195826d01b9
refs/heads/master
2021-07-08T22:24:51.435977
2019-03-19T06:38:46
2019-03-19T06:38:46
147,649,870
0
0
null
null
null
null
UTF-8
Java
false
false
1,085
java
package com.hh.webcollect.common.exception; import com.hh.webcollect.common.Constant; import com.hh.webcollect.common.enums.error.ErrorCode; /** * @author hongbo.pan * @date 2018/9/6 */ public class WcException extends RuntimeException { /** * 非业务异常, 默认0 */ private int code = Constant.FAIL; private String errMsg; public WcException(String errMsg) { super(errMsg); } public WcException(ErrorCode errorCode) { super(errorCode.getMsg()); this.code = errorCode.getCode(); this.errMsg = errorCode.getMsg(); } public WcException(String errMsg, Throwable e) { super(errMsg, e); this.errMsg = errMsg; } public WcException(ErrorCode errorCode, Throwable e) { this(errorCode.getMsg(), e); this.code = errorCode.getCode(); this.errMsg = errorCode.getMsg(); } public WcException(Throwable e) { super(e); } public int getCode() { return code; } public String getErrMsg() { return errMsg; } }
[ "hongbo.pan@zhaogang.china.com" ]
hongbo.pan@zhaogang.china.com
8f734d92e3ca1ee05ccac7ba10670d08b61b29ef
585b32aa908a603aed56565f54e0e4bc44e3a9e9
/fastutil-6.4.6/src/it/unimi/dsi/fastutil/shorts/ShortHeapIndirectPriorityQueue.java
91dbd1e77ab8e363e898694f6f349ba53e32a6eb
[ "Apache-2.0" ]
permissive
commoncrawl/example-languageentropy
212008c219f2a2822321ca4e02bd35c4fb7eff1d
0653cf112f1c16dec4b16f4503feba6b100a7440
refs/heads/master
2021-01-16T23:13:59.123943
2013-01-15T11:25:11
2013-01-15T11:25:11
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-2012 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.shorts; 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 ShortHeapIndirectPriorityQueue extends ShortHeapSemiIndirectPriorityQueue { /** 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 ShortHeapIndirectPriorityQueue( short[] refArray, int capacity, ShortComparator 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 ShortHeapIndirectPriorityQueue( short[] 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 ShortHeapIndirectPriorityQueue( short[] refArray, ShortComparator 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 ShortHeapIndirectPriorityQueue( short[] 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 ShortHeapIndirectPriorityQueue( final short[] refArray, final int[] a, final int size, final ShortComparator 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; } ShortIndirectHeaps.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 ShortHeapIndirectPriorityQueue( final short[] refArray, final int[] a, final ShortComparator 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 ShortHeapIndirectPriorityQueue( final short[] 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 ShortHeapIndirectPriorityQueue( final short[] refArray, final int[] a ) { this( refArray, a, a.length ); } 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++; ShortIndirectHeaps.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 ) ShortIndirectHeaps.downHeap( refArray, heap, inv, size, 0, c ); return result; } public void changed() { ShortIndirectHeaps.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 = ShortIndirectHeaps.upHeap( refArray, heap, inv, size, pos, c ); ShortIndirectHeaps.downHeap( refArray, heap, inv, size, newPos, c ); } /** Rebuilds this heap in a bottom-up fashion. */ public void allChanged() { ShortIndirectHeaps.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 = ShortIndirectHeaps.upHeap( refArray, heap, inv, size, result, c ); ShortIndirectHeaps.downHeap( refArray, heap, inv, size, newPos, c ); } return true; } public void clear() { size = 0; IntArrays.fill( inv, -1 ); } }
[ "participant@hadoop-vm.(none)" ]
participant@hadoop-vm.(none)
42753b78fcc79cb4d7acceda6d3010a407cf81c0
02665a65ba1f08a738257d1c0473f52b961947d6
/Complete Search/Maximum number of overlapping intervals – Merge Overlapping Intervals – Max Task Load.java
dc25a0ebafe00f4602e2a3c6f6633c8be9779fb5
[]
no_license
mehedi-imam241/DS-and-Algo
8660d44f126718772eb148ebb21045483f0f1742
67015cde98c863a1505f9477a0321e93eba9408b
refs/heads/master
2022-11-15T05:02:25.692646
2020-07-03T14:50:23
2020-07-03T14:50:23
276,923,514
0
0
null
null
null
null
UTF-8
Java
false
false
1,125
java
import java.io.File; import java.io.FileInputStream; import java.io.PrintStream; import java.util.Arrays; class A { public static void main(String[] args) { try { System.setIn(new FileInputStream(new File("input.txt"))); System.setOut(new PrintStream(new File("output.txt"))); } catch (Exception e) { } int[] start = { 0, 3, 4, 7, 1 }; int[] end = { 2, 7, 6, 8, 5 }; System.out.println(maxOverlapIntervalCount(start, end)); } public static int maxOverlapIntervalCount(int[] start, int[] end) { int maxOverlap = 0; int currentOverlap = 0; Arrays.sort(start); Arrays.sort(end); int i = 0; int j = 0; while (i < start.length && j < end.length) { int s = start[i]; int e = end[j]; if (s < e) { currentOverlap++; maxOverlap = Math.max(maxOverlap, currentOverlap); i++; } else { currentOverlap--; j++; } } return maxOverlap; } }
[ "1805039@ugrad.cse.buet.ac.bd" ]
1805039@ugrad.cse.buet.ac.bd
e232526dba227c5f68176f930aa886dfd706bf20
999457318ecbc81307321b7a1de8436f91fda8b8
/multiplayerPacMan/src/networking/exceptions/NoRegistryException.java
0d6f4cb8d0b301082c3eefa6383883d0a10ee5ee
[]
no_license
s3725331/multiPlayerPacMan
4a670da60c88569314be1548822d1d3e2c1a7f28
bf122cab5050e80a3166d353371d4eb6023677bd
refs/heads/master
2023-01-25T00:18:37.944808
2020-12-10T05:13:58
2020-12-10T05:13:58
205,306,936
0
0
null
null
null
null
UTF-8
Java
false
false
170
java
package networking.exceptions; public class NoRegistryException extends ClientException{ public NoRegistryException(String message) { super(message); } }
[ "41284505+s3725331@users.noreply.github.com" ]
41284505+s3725331@users.noreply.github.com