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
30c180eb48e8328fda8384a915c20620245283f1
af9340433e2fc5580ba6235a25286d05c3789598
/bankplus-transactions/src/main/java/org/jboss/examples/bankplus/transactions/services/adapters/ContactsAdapter.java
5a42364d69306988be186a3580be8f953c746080
[]
no_license
VineetReynolds/bankplus
a49a1df83b86a9fa4103426e1602487890ec873f
e5aa55a3f16241e638ea70d9a36fa0dfcce67627
refs/heads/master
2021-01-21T08:57:39.142618
2016-05-03T00:15:41
2016-05-03T00:15:41
43,675,735
1
0
null
null
null
null
UTF-8
Java
false
false
1,655
java
package org.jboss.examples.bankplus.transactions.services.adapters; import org.jboss.examples.bankplus.transactions.services.client.Contact; import org.jboss.examples.bankplus.transactions.services.translators.ContactTranslator; import javax.inject.Inject; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.UriBuilder; public class ContactsAdapter { @Inject private ContactTranslator translator; private static final String host; private static final int port; static { String envHost = System.getenv("BANKPLUS_CUSTOMERS_SERVICE_HOST"); host = envHost == null ? "bankplus_customers.dev.docker" : envHost; String envPort = System.getenv("BANKPLUS_CUSTOMERS_SERVICE_PORT"); port = envPort == null ? 8080 : Integer.parseInt(envPort); } public org.jboss.examples.bankplus.transactions.model.Contact findById(Long contactId, Long customerId) { Client client = ClientBuilder.newClient(); UriBuilder builder = UriBuilder.fromUri("http://{host}:{port}/bankplus-customers/rest/") .path("customers/{customerId}/contacts/{contactId}") .resolveTemplate("host", host) .resolveTemplate("port", port) .resolveTemplate("customerId", customerId) .resolveTemplate("contactId", contactId); WebTarget target = client.target(builder); Contact contact = target.request(MediaType.APPLICATION_JSON_TYPE).get(Contact.class); return translator.translate(contact); } }
[ "Vineet.Reynolds@gmail.com" ]
Vineet.Reynolds@gmail.com
e2a00eeb8a5dff432399cb72e06448f1fa18de67
5f7ea2cb8f90b9703cb519cf0444b4f5de9ed35a
/src/main/java/pl/marcinmazur/portfolio/controller/AdminRestController.java
c9672be482ec81f26d3e247e9e7489e9926bc274
[]
no_license
mmazur658/Marcin-Mazur-Portfolio
9f9cf2a565365b25902ec9c2424ee390c6649ff8
093f6b4726213f55447a8e0fff7661ac54bf9dfb
refs/heads/master
2020-04-09T18:27:51.709543
2019-02-12T15:30:34
2019-02-12T15:30:34
160,513,274
0
0
null
null
null
null
UTF-8
Java
false
false
5,784
java
package pl.marcinmazur.portfolio.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import pl.marcinmazur.portfolio.service.AdminService; import pl.marcinmazur.portfolio.service.ContactFormMessageService; import pl.marcinmazur.portfolio.service.NotificationService; /** * The rest controller class is used to perform actions depending on the user * request. * * @author Marcin Mazur * */ @RestController @RequestMapping("/administrator-panel/admin-action") public class AdminRestController { /** * The ContactFormMessageService interface */ private ContactFormMessageService contactFormMessageService; /** * The AdminService interface */ private AdminService adminService; /** * The NotificationService interface */ private NotificationService notificationService; /** * Constructs a AdminRestController with the ContactFormMessageService, * AdminService and NotificationService. * * @param contactFormMessageService * The ContactFormMessageService interface * @param adminService * The AdminService interface * @param notificationService * The NotificationService interface */ @Autowired public AdminRestController(ContactFormMessageService contactFormMessageService, AdminService adminService, NotificationService notificationService) { this.contactFormMessageService = contactFormMessageService; this.adminService = adminService; this.notificationService = notificationService; } /** * Returns the number of active notifications. * * @return A long representing the number of active notifications. */ @RequestMapping("/get-number-of-notification") public long getNumberOfNotification() { return notificationService.getNumberOfActiveNotification(); } /** * Returns the number of unread contact form messages. * * @return A long representing the number of unread messages */ @RequestMapping("/get-number-of-contact-form-messages") public long getNumberOfContactFormMessages() { return contactFormMessageService.getNumberOfUnreadContactFormMessage(); } /** * Deletes the contact form messages with given id * * @param contactFormMessageId * The long containing the id of the message to be deleted */ @RequestMapping("/delete-contact-form-message") void deleteContactFormMessage(@RequestParam(name = "contactFormMessageId") long contactFormMessageId) { contactFormMessageService.deleteContactFormMessage(contactFormMessageId); } /** * Changes the isRead status of the message with the given id. * * @param contactFormMessageId * The long containing the id of the message */ @RequestMapping("/change-contact-form-message-read-status") void changeContactFormMessageReadStatus(@RequestParam(name = "selectedCheckboxValue") long contactFormMessageId) { contactFormMessageService.changeContactFormMessageIsReadStatus(contactFormMessageId); } /** * Changes the isReplied status of the message with the given id. * * @param contactFormMessageId * The long containing the id of the message */ @RequestMapping("/change-contact-form-message-replied-status") void changeContactFormMessageRepliedStatus( @RequestParam(name = "selectedCheckboxValue") long contactFormMessageId) { contactFormMessageService.changeContactFormMessageRepliedStatus(contactFormMessageId); } /** * Changes the isRead status of the message with the given id on TRUE. * * @param contactFormMessageId * The long containing the id of the message */ @RequestMapping("/change-contact-form-message-read-status-to-true") void setContactFormMessageReadStatusTrue(@RequestParam(name = "selectedCheckboxValue") long contactFormMessageId) { contactFormMessageService.setContactFormMessageReadStatusTrue(contactFormMessageId); } /** * Adds a Comment with the given text to the message with the given id. * * @param messageId * The long containing the id of the message * @param commentText * The String containing the text of the comment */ @RequestMapping("/add-comment") void addComment(@RequestParam(name = "messageId") long messageId, @RequestParam(name = "commentText") String commentText) { contactFormMessageService.addComment(messageId, commentText); } /** * Deletes the Comment with the given id. * * @param commentId * The long containing the id of the comment to be deleted */ @RequestMapping("/delete-comment") void deleteComment(@RequestParam(name = "contactFormCommentId") long commentId) { contactFormMessageService.deleteComment(commentId); } /** * Returns TRUE if the given password is correct. * * @param oldPassword * The String containing the old password * @param username * The String containing the name of the user * @return A boolean representing the result */ @RequestMapping("check-password") boolean isPasswordCorrect(@RequestParam(name = "oldPassword") String oldPassword, @RequestParam(name = "username") String username) { return adminService.checkPassword(oldPassword, username); } /** * Changes the user's password. * * @param newPassword * The String containing the new password * @param username * The String containing the name of the user */ @RequestMapping("change-password") void changePassword(@RequestParam(name = "newPassword") String newPassword, @RequestParam(name = "username") String username) { adminService.changePassword(newPassword, username); } }
[ "marcin.mazur1024@gmail.com" ]
marcin.mazur1024@gmail.com
52d33243a582285fc6e4dd19e069c079e681f172
392c81d156dd11b8d0ec07f0e66e5896bc1bcab7
/app/src/main/java/com/libwatermelon/DaemonUtils.java
c56c178b3714ff8f7f4c95b04defa7cab8fb2ed4
[]
no_license
dingoberry/MimicTim
ff759025fbaa8efc7b99bdaef354432ef69fe560
61c3bf3583c3b09d3e5e3f72a70c678dce85238c
refs/heads/master
2020-03-09T02:52:32.987847
2018-04-07T17:17:36
2018-04-07T17:17:36
128,550,964
0
0
null
null
null
null
UTF-8
Java
false
false
6,072
java
package com.libwatermelon; import android.content.Context; import android.content.SharedPreferences; import android.os.Build; import android.os.Process; import com.libwatermelon.WaterConfigurations.DaemonConfiguration; import java.io.BufferedReader; import java.io.Closeable; import java.io.File; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import wake.tim.mimic.com.mimictim.Info; /** * Created by tf on 3/8/2018. */ public class DaemonUtils { private static final String SP_ENABLE_3P = "d_3p_f"; private static final String SP_ENABLE_3P_KEY = "enable"; private static final String WATER_OFF_FILENAME = "water_off"; private static String sProcessName; private static void close(Closeable c) { if (null == c) { return; } try { c.close(); } catch (IOException e) { Info.y(e); } } private static String getProcessName() { if (null == sProcessName) { String cmdlineFile = "/proc/" + Process.myPid() + "/cmdline"; BufferedReader reader = null; String name; try { reader = new BufferedReader(new FileReader(cmdlineFile)); String line; StringBuilder builder = new StringBuilder(); while (null != (line = reader.readLine())) { builder.append(line).append("\n"); } sProcessName = builder.toString().trim(); } catch (IOException e) { Info.y(e); sProcessName = null; } finally { close(reader); } } return sProcessName; } public static void startDaemon(Context cxt) { WaterConfigurations configurations = new WaterConfigurations( new DaemonConfiguration("wake.tim.mimic.com.mimictim:MSF", DaemonTimService.class.getCanonicalName()), new DaemonConfiguration("wake.tim.mimic.com.mimictim:Daemon", DaemonAssistService.class.getCanonicalName()), new DaemonConfiguration("wake.tim.mimic.com.mimictim:assist", DaemonAssistService2.class.getCanonicalName())); if (Build.VERSION.SDK_INT >= 21) { if (Build.MANUFACTURER != null && Build.MANUFACTURER.toLowerCase().startsWith("xiaomi") || Build.MODEL != null && Build.MODEL.toLowerCase().startsWith("oppo")) { configurations.ENABLE_3P = cxt.getSharedPreferences(SP_ENABLE_3P, Context.MODE_MULTI_PROCESS).getBoolean(SP_ENABLE_3P_KEY, true); } } if (isWaterOn(cxt)) { String processName = getProcessName(); String mainProcess = cxt.getPackageName(); Info.y("startDaemon:" + processName + "||" + mainProcess); if (processName.equals(mainProcess)) { IWaterStrategy.Fetcher.fetchStrategy(configurations).onInitialization(cxt, configurations); } else if (processName.equals(configurations.PERSISTENT_CONFIG.PROCESS_NAME)) { IWaterStrategy.Fetcher.fetchStrategy(configurations).onPersistentCreate(cxt, configurations); } else if (processName.equals(configurations.DAEMON_ASSISTANT_CONFIG.PROCESS_NAME)) { IWaterStrategy.Fetcher.fetchStrategy(configurations).onDaemonAssistantCreate(cxt, configurations); } else if (processName.equals(configurations.DAEMON_ASSISTANT_CONFIG2.PROCESS_NAME)) { IWaterStrategy.Fetcher.fetchStrategy(configurations).onDaemonAssistant2Create(cxt, configurations); } } } static boolean copyAssets(Context cxt, String binaryName, String chipMode, String binaryDir) { File des = new File(cxt.getDir(binaryDir, Context.MODE_PRIVATE), binaryName); File parent = des.getParentFile(); if (!parent.exists() && !parent.mkdirs()) { return false; } InputStream is = null; FileOutputStream fos = null; boolean success; try { is = cxt.getAssets().open(chipMode + File.separator + binaryName); fos = new FileOutputStream(des); byte[] buffer = new byte[2048]; int len; while (-1 != (len = is.read(buffer))) { fos.write(buffer, 0, len); } fos.flush(); success = true; } catch (Exception e) { Info.y(e); success = false; } finally { close(is); close(fos); } if (success) { try { Runtime.getRuntime().exec("chmod 777 " + des.getAbsolutePath()).waitFor(); Info.y("Success to change mode of " + des.getAbsolutePath()); return true; } catch (IOException | InterruptedException e) { Info.y(e); } } return false; } static void setWaterState(Context cxt, boolean isOff) { File f = new File(cxt.getFilesDir(), WATER_OFF_FILENAME); boolean existed = f.exists(); if (isOff && existed) { f.delete(); return; } if (!isOff && !existed) { File parent = f.getParentFile(); if (null != parent && !parent.exists()) { if (!parent.mkdirs()) { return; } } try { f.createNewFile(); } catch (IOException e) { Info.y(e); } } } static boolean isWaterOn(Context cxt) { // return !new File(cxt.getFilesDir(), WATER_OFF_FILENAME).exists(); return true; } public static void setEnable3P(Context cxt, boolean enable) { SharedPreferences.Editor editor = cxt.getSharedPreferences(SP_ENABLE_3P, Context.MODE_MULTI_PROCESS).edit(); editor.putBoolean(SP_ENABLE_3P_KEY, enable); editor.commit(); } }
[ "wangjunkai@baidu.com" ]
wangjunkai@baidu.com
4fbb9225cbdc17bef2320fba1882275a69fb37d2
ab633ea30e2d8958ba34f3225225998d167ee17e
/src/main/java/com/project/coronavirustracker/dao/ITrackerDao.java
9d9f5df6119807b9b630ce9ba7fa9784cf222400
[]
no_license
sainath168/coronavirus-tracker
f3092aa4d401ca8ca8d7e4479d05eff4864b926c
22c37d32e22ea18d4a248f9a9d77f664b072de9a
refs/heads/master
2022-12-24T14:27:25.586823
2020-09-26T01:59:32
2020-09-26T01:59:32
298,716,774
0
0
null
null
null
null
UTF-8
Java
false
false
187
java
package com.project.coronavirustracker.dao; import com.project.coronavirustracker.model.Tracker; import java.util.List; public interface ITrackerDao { List<Tracker> getResult(); }
[ "sainath.koutarapu@amadeus.com" ]
sainath.koutarapu@amadeus.com
10cb7bed05172fe9915ee9d13a20b58717284278
5ba0775d7187fd499f3f70e386da3e6b795c09d2
/demo/src/main/java/com/example/demo/utils/HttpClient.java
1b750bf7d6b15ea0f98b33c16ecb64d4e2419abb
[]
no_license
znj929/springBootDemo
191c2ece16af5a93984d580586f8b807a87dffb1
a4abbd5e44979db25dcad8114c9ce2b5197db15a
refs/heads/master
2021-02-26T21:32:11.243331
2020-06-02T01:46:09
2020-06-02T01:46:09
245,554,162
0
0
null
null
null
null
UTF-8
Java
false
false
9,720
java
package com.example.demo.utils; import java.io.DataOutputStream; import java.io.File; import java.io.InputStream; import java.io.OutputStream; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.net.HttpURLConnection; import java.net.InetSocketAddress; import java.net.Proxy; import java.net.URL; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.net.ssl.HttpsURLConnection; /** * url客户端 * **/ public class HttpClient { public static final String UTF8 = "UTF-8"; public static final String GBK = "GBK"; public static final String GET = "GET"; public static final String POST = "POST"; public static final String HEAD = "HEAD"; public static final String OPTIONS = "OPTIONS"; public static final String PUT = "PUT"; public static final String DELETE = "DELETE"; public static final String TRACE = "TRACE"; public static final String PATCH = "PATCH"; private static final int HTTP_OK = HttpURLConnection.HTTP_OK; private static final int HTTP_BAD_REQUEST = HttpURLConnection.HTTP_BAD_REQUEST; private static final int HTTP_EXCEPTION = 999; //下载的文件 private File file; /** * 超时时间默认5秒 * **/ private int timeout = 5000; /** * 默认超时5秒 * **/ public HttpClient(){} /** * 默认超时时间 * **/ public HttpClient setTimeout(int timeout) { this.timeout = timeout; return this; } /** * 参数转换字节 * @param Map<String,String> params 参数 * **/ public byte[] paramsToBytes(Map<String,String> params)throws Exception { StringBuffer data = new StringBuffer(); for(String key : params.keySet()) { if(data.length() == 0) data.append(key).append("=").append(params.get(key)); else data.append("&").append(key).append("=").append(params.get(key)); } return data.toString().getBytes(); } /** * get请求 * @param urlStr http地址 * @param headers 请求头 * **/ public HttpResult get(String urlStr,Map<String,String> headers) { return requestToProxy(HttpClient.GET,urlStr, headers, null,null, 0); } /** * get请求下载文件 * **/ public HttpResult getFile(String urlStr,File file,Map<String,String> headers) { this.file = file; return requestToProxy(HttpClient.GET,urlStr, headers, null,null, 0); } /** * post请求 * @param urlStr http地址 * @param headers 请求头 * @param params 请求参数 * **/ public HttpResult post(String urlStr,Map<String,String> headers,byte[] bytes) { return requestToProxy(HttpClient.POST,urlStr, headers, bytes, null, 0); } /** * delete请求 * @param urlStr http地址 * @param headers 请求头 * @param params 请求参数 * **/ public HttpResult delete(String urlStr,Map<String,String> headers,byte[] bytes) { return requestToProxy(HttpClient.DELETE,urlStr, headers, bytes, null, 0); } /** * put请求 * @param urlStr http地址 * @param headers 请求头 * @param params 请求参数 * **/ public HttpResult put(String urlStr,Map<String,String> headers,byte[] bytes) { return requestToProxy(HttpClient.PUT,urlStr, headers, bytes, null, 0); } /** * patch请求 * @param urlStr http地址 * @param headers 请求头 * @param params 请求参数 * **/ public HttpResult patch(String urlStr,Map<String,String> headers,byte[] bytes) { return requestToProxy(HttpClient.PATCH,urlStr, headers, bytes, null, 0); } /** * post请求 * @param urlStr http地址 * @param headers 请求头 * @param params 请求参数 * @param String ip 代理IP * @param int port 代理端口 * **/ public HttpResult requestToProxy(String httpMethod,String urlStr,Map<String,String> headers,byte[] bytes,String ip,int port) { if(urlStr.getBytes().length < 8) { return null; } if("https://".equals(urlStr.substring(0, 8))) { if(null == ip) return httpsRequest(urlStr,httpMethod,headers,bytes,null); else return httpsRequest(urlStr,httpMethod,headers,bytes,new Proxy(Proxy.Type.HTTP, new InetSocketAddress(ip, port))); } else if("http://".equals(urlStr.substring(0, 7))) { if(null == ip) return httpRequest(urlStr,httpMethod,headers,bytes,null); else return httpRequest(urlStr,httpMethod,headers,bytes,new Proxy(Proxy.Type.HTTP, new InetSocketAddress(ip, port))); } else { return null; } } public HttpResult httpRequest(String urlStr,String method,Map<String,String> headers,byte[] bytes,Proxy proxy) { URL url; HttpURLConnection http; HttpResult result = new HttpResult(); try { url = new URL(urlStr); if(null == proxy) http = (HttpURLConnection)url.openConnection(); else http = (HttpURLConnection)url.openConnection(proxy); return this.request(http, method, headers, bytes, result); } catch(Exception exe) { exe.printStackTrace(); return result.setCode(HTTP_EXCEPTION).setBody(exe.getMessage().getBytes()); } } public HttpResult httpsRequest(String urlStr,String method,Map<String,String> headers,byte[] bytes,Proxy proxy) { URL url; HttpsURLConnection https; HttpResult result = new HttpResult(); try { url = new URL(urlStr); if(null == proxy) https = (HttpsURLConnection)url.openConnection(); else https = (HttpsURLConnection)url.openConnection(proxy); return this.request(https, method, headers, bytes, result); } catch(Exception exe) { return result.setBody(exe.getMessage().getBytes()); } } /** * http请求处理 * @param HttpURLConnection http 请求客户端 * @param String method 方法 * @param Map<String,String> headers 请求头 * @param Map<String,String> params 请求参数 * @param HttpResult result 结果集 * **/ private HttpResult request(HttpURLConnection http,String method,Map<String,String> headers,byte[] bytes,HttpResult result) throws Exception { //设置请求头 if(null!= headers) { for(String key : headers.keySet()) { System.out.println("set:"+key); http.setRequestProperty(key, headers.get(key)); } } http.setDoInput(true); http.setDoOutput(true); if(method.equals(HttpClient.PATCH)) { addPatch(http); http.setRequestMethod(method); } else { http.setRequestMethod(method); } for(String key : http.getRequestProperties().keySet()) { System.out.println("key:"+key); } http.setUseCaches(false); http.setInstanceFollowRedirects(false); http.setConnectTimeout(timeout); http.setReadTimeout(timeout); http.connect(); //发送数据 if(null != bytes) this.sendBytes(http.getOutputStream(), bytes); //设置响应状态码 result.setCode(http.getResponseCode()); //获取响应数据 if(result.getCode() >= HTTP_OK && result.getCode() < HTTP_BAD_REQUEST ) this.readResponseBody(http.getInputStream(), result); else this.readResponseBody(http.getErrorStream(), result); //获取响应头 this.readResponseHeaders(result, http.getHeaderFields()); //关闭客户端连接 http.disconnect(); return result; } /** * 发送数据(关闭输出流) * @param OutputStream outputStream 输出流 * @param byte[] bytes 字节 * **/ private void sendBytes(OutputStream outputStream,byte[] bytes)throws Exception { DataOutputStream out = new DataOutputStream(outputStream); out.write(bytes); out.flush(); out.close(); outputStream.close(); } /** * 接收返回数据头 * @param HttpResult result 结果集 * @param Map<String, List<String>> headers 原始响应头 * **/ private void readResponseHeaders(HttpResult result,Map<String, List<String>> headers)throws Exception { result.setResponseHeads(new HashMap<String,String>()); for(String key : headers.keySet()) { if(null != key) { for(String value : headers.get(key)) { result.getResponseHeaders().put(key, value); } } } } /** * 接收返回数据体 * @param InputStream bodyInStream 响应体输入流 * @param InputStream errorInStream 错误信息输入流 * @param HttpResult result 结果集 * @param String charset 字符编码 * **/ private void readResponseBody(InputStream in,HttpResult result)throws Exception { if(null == file) { result.setBody(IoTools.inputStreatToBytes(in));in.close(); } else { result.setFile(IoTools.inputStreatToFile(in,file));in.close(); } } /** * 拓展JDK HttpURLConnection methods * **/ private void addPatch(HttpURLConnection http) throws Exception { String[] methods = {GET, POST, HEAD, OPTIONS, PUT, DELETE, TRACE, PATCH}; Field field = HttpURLConnection.class.getDeclaredField("methods"); field.setAccessible(true); Field modifiers = field.getClass().getDeclaredField("modifiers"); modifiers.setAccessible(true); modifiers.setInt(field, field.getModifiers() & ~Modifier.FINAL); field.set(http, methods); } }
[ "Administrator@WIN-RGTNEONRTRF" ]
Administrator@WIN-RGTNEONRTRF
396b3591116c451d3ef10addb584a0df07ad284b
52c55792a6c457cd58fa76fee61ea0c4cc9ab3eb
/Task1_2_NewsApp_JDBC_Hib_JPA/src/com/epam/testapp/database/IConnectionPool.java
8a735278f99f951c6298d5767878537f8cb8eefa
[]
no_license
my-tasks/JavaLab
bbf5719a70f0cdb8c18d918a0b3facea50adc318
1790e3fea1ff411277cbee18e10220f22c71d9b4
refs/heads/master
2016-09-05T13:23:45.478830
2014-05-29T11:57:36
2014-05-29T11:57:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
300
java
package com.epam.testapp.database; import java.sql.Connection; import com.epam.testapp.exception.NoConnectionAvailableException; public interface IConnectionPool { public Connection getConnection() throws NoConnectionAvailableException; public void returnConnection(Connection connection); }
[ "krystsina_kharlamenkova@epam.com" ]
krystsina_kharlamenkova@epam.com
1399a4c1f45a3e877a9db80ce90a0618815cfef3
3db8a812adf1feda80b64693723b0f3464b6afd9
/app/src/main/java/com/example/ht_well/Adapter.java
2e8afe4214da47e1ff13d7825ce241381435fdc0
[]
no_license
simomrnn/HT_wellRun
06343b9c0458e2c27e1dddb07f702c4d2a339245
a94a5603415497c8f09a8e87297b0d2d3256faf4
refs/heads/master
2023-04-15T06:02:07.175786
2021-04-28T13:02:14
2021-04-28T13:02:14
362,469,013
0
0
null
null
null
null
UTF-8
Java
false
false
2,803
java
package com.example.ht_well; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import java.util.List; //Adapter is needed for recyclerView to work as intended. //In recyclerview, the notes saved in the database will bve showed public class Adapter extends RecyclerView.Adapter<Adapter.ViewHolder> { private LayoutInflater inflater; private List<Note> entries; private NotesMain notesMain; Adapter(Context context, List<Note> entries, NotesMain notesMain) { this.inflater = LayoutInflater.from(context); this.entries = entries; this.notesMain = notesMain; } //method creates a new viewholder adapter, used for displaying items //introduces layout @NonNull @Override public Adapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { View view = inflater.inflate(R.layout.custom_list_view,viewGroup, false); return new ViewHolder(view); } //method gets information from list, calls upon methods from note class. @Override public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) { String title = entries.get(i).getTitle(); String date = entries.get(i).getDate(); String time = entries.get(i).getTime(); long ID = entries.get(i).getID(); viewHolder.entryTitle.setText(title); viewHolder.entryDate.setText(date); viewHolder.entryTime.setText(time); viewHolder.entryID.setText(String.valueOf(entries.get(i).getID())); } //gets item ocunt on list @Override public int getItemCount() { return entries.size();} //A constructor viewholder, viewholder provides access to a dataset. public class ViewHolder extends RecyclerView.ViewHolder{ TextView entryTitle, entryDate, entryTime, entryID; // a method for viewing items, that are in the xmll file. // an Onclicklistener for items inside the view, gets position of item clicked, // then information can be retrieved. public ViewHolder(@NonNull final View itemView){ super(itemView); entryTitle = itemView.findViewById(R.id.EntryTitle); entryDate = itemView.findViewById(R.id.EntryDate); entryTime = itemView.findViewById(R.id.EntryTime); entryID = itemView.findViewById(R.id.listID); itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { notesMain.onRecycleClick(getAdapterPosition()); } }); } } }
[ "80213827+simomrnn@users.noreply.github.com" ]
80213827+simomrnn@users.noreply.github.com
bfa5d5bc1572a9370e293fd7bfcd8f164cf2c29c
6fb6d77ba785e01f344bda27e5ea880a3603dfc9
/app/src/main/java/com/nekodev/paulina/sadowska/userlist/activities/UserListActivity.java
96ebc833f436a2c6ac73148afbb49354489bab0d
[]
no_license
PaulinaSadowska/UserList
c5e197e526a472c7db57810c1ab6b2177246798e
5ec8b068022d77f8e4ed856a2bafa37a7d1e7ad4
refs/heads/master
2021-01-20T11:21:19.715907
2016-07-27T09:40:58
2016-07-27T09:40:58
63,901,212
0
0
null
null
null
null
UTF-8
Java
false
false
899
java
package com.nekodev.paulina.sadowska.userlist.activities; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import com.nekodev.paulina.sadowska.userlist.R; import com.nekodev.paulina.sadowska.userlist.fragments.UserListFragment; public class UserListActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_user_list); if ((findViewById(R.id.activity_user_list_fragment_container) != null && savedInstanceState == null) || findViewById(R.id.activity_user_list_fragment_container) == null) { getSupportFragmentManager().beginTransaction() .replace(R.id.activity_user_list_fragment_container, new UserListFragment()) .commit(); } } }
[ "paulina.sadowska@student.put.poznan.pl" ]
paulina.sadowska@student.put.poznan.pl
00efb17dd221d7d03529e0f5c60761364cd6c254
f3f7f93cf005afd661923754a7d536dcebb5075a
/src/cl/awakelab/negocio/controlador/logout.java
f0542f6db1f9362e706621e4e2367d7fa6b64b37
[]
no_license
daathxi/Desarrollo-de-aplicaciones-web-dinamicas-con-java
82ede27214f50ea178a74177c0ad1fbd6ab90d3c
5ebbd412fc6463ffbf3eb95ccf6d9ae9085f412d
refs/heads/master
2023-02-25T09:43:09.203546
2021-01-28T12:39:17
2021-01-28T12:39:17
333,603,462
0
0
null
null
null
null
UTF-8
Java
false
false
1,685
java
package cl.awakelab.negocio.controlador; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * Servlet implementation class logout */ @WebServlet("/logout") public class logout extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public logout() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub response.getWriter().append("Served at: ").append(request.getContextPath()); response.setContentType("text/html"); PrintWriter out=response.getWriter(); request.getRequestDispatcher("/login.jsp").include(request, response); HttpSession session=request.getSession(); session.invalidate(); out.print("has cerrado sesion !"); out.close(); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
[ "ignacio.hidalgo@hotmail.cl" ]
ignacio.hidalgo@hotmail.cl
e640b31f582ee4b6c4c8741e729e68ff7214fd44
9404ab1090ec3fafab5711c1fd8bb93826415418
/Flynas/src/test/java/flynas/web/workflows/ConfirmationPage.java
03bb22efb4686296d9f70d4214c0755b73455413
[]
no_license
CignitiFlynas/IBE
1dda56769676dba54d174145e6d640762452c767
bc9c815a7767e6281a17847eb6babc3e110aaa73
refs/heads/master
2020-03-23T10:24:15.906149
2018-10-21T10:53:26
2018-10-21T10:53:26
141,441,302
0
0
null
2018-10-21T10:53:27
2018-07-18T13:50:08
Java
UTF-8
Java
false
false
2,485
java
package flynas.web.workflows; import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import com.ctaf.utilities.Reporter; import flynas.web.testObjects.BookingPageLocators; public class ConfirmationPage<RenderedWebElement> extends BookingPageLocators { public String getReferenceNumber() throws Throwable{ waitforElement(BookingPageLocators.summaryRefNumber); waitUtilElementhasAttribute(BookingPageLocators.body); return getText(BookingPageLocators.summaryRefNumber, "Reference Number"); } public void closetoast() throws Throwable{ try{ //driver.switchTo().activeElement(); //String handle = driver.getWindowHandle(); List<WebElement> elements = driver.findElements(By.tagName("iframe")); System.out.println("No of iframes : "+ elements.size()); if(isElementPresent(BookingPageLocators.naSmileTaost)==true){ driver.switchTo().frame("yief130002"); System.out.println("nasmile Toast appeared"); click(BookingPageLocators.closetoast, "nasmile Toast close button"); } else{ System.out.println("No nasmile Toast"); } //driver.switchTo().window(handle); }catch (Exception e){ System.out.println("No nasmile Toast"); } } public void validate_ticketStatus(String pnr) throws Throwable { waitforElement(BookingPageLocators.summaryStatus); //waitUtilElementhasAttribute(BookingPageLocators.body); if(getText(BookingPageLocators.summaryStatus,"Status").trim().equals("Confirmed") ||getText(BookingPageLocators.summaryStatus,"Status").trim().equals("Pending") ||getText(BookingPageLocators.summaryStatus,"Status").trim().equals("Hold")) { String env = driver.getCurrentUrl(); if(env.contains("develop_r41")){projectUtilities.writingPNR("IBE_NAV_PNR",pnr);} else if(env.contains("uat")){projectUtilities.writingPNR("IBE_UAT_PNR",pnr);} else{projectUtilities.writingPNR("IBE_PROD_PNR",pnr);} Reporter.SuccessReport("Ticket Confirmation", "Ticket has booked with PNR "+pnr); } else { Reporter.failureReport("Ticket Confirmation", "Ticket has not booked"); } closetoast(); } public void navigatetommb(){ //Need to modify to click on modify button once the the redirection is fixed driver.get(mmburl); } public void navigatetowci(){ //Need to modify to click on modify button once the the redirection is fixed driver.get(chekinurl); } }
[ "RahuRam.k_33723617+E003901cigniti@users.noreply.github.com" ]
RahuRam.k_33723617+E003901cigniti@users.noreply.github.com
b55dd0aa66c73a6d5c676d7eb82746f0834819d7
404ab607ebde4d7ddd0ad97989154c1d2576a5fe
/project/src/main/java/com/iktpreobuka/project/entities/CategoryEntity.java
90deb6cbdaece82067a9ffe263aa65f2898b30a6
[]
no_license
radoslavboychev/brains
6b711a209b1f85ea884929ef46fb6022584d3f0c
0eb643bb5234f764869044d7e92c7058fa49ee12
refs/heads/main
2023-06-09T13:24:59.579577
2021-06-26T14:53:47
2021-06-26T14:53:47
337,489,614
1
0
null
2021-02-09T18:30:43
2021-02-09T17:54:08
Java
UTF-8
Java
false
false
1,530
java
package com.iktpreobuka.project.entities; import java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Version; import com.fasterxml.jackson.annotation.JsonIgnore; @Entity public class CategoryEntity { @Id @GeneratedValue(strategy = GenerationType.AUTO) protected Integer id; @Column(nullable = false) protected String name; @Column(nullable = false) protected String description; @JsonIgnore @OneToMany(mappedBy = "category", fetch = FetchType.LAZY, cascade = { CascadeType.REFRESH }) private List<OfferEntity> offers = new ArrayList<>(); @Version private Integer version; public CategoryEntity() { } public CategoryEntity(String name, String description) { this.name = name; this.description = description; } public Integer getId() { return id; } public String getName() { return name; } public String getDescription() { return description; } public List<OfferEntity> getOffers() { return offers; } public void setId(Integer id) { this.id = id; } public void setName(String name) { this.name = name; } public void setDescription(String description) { this.description = description; } public void addOffer(OfferEntity offer) { this.offers.add(offer); } }
[ "radoslavboychev@gmail.com" ]
radoslavboychev@gmail.com
70e0e0a05b8b2012015e1ad52f48e1d8b87fd7e0
deb1028684c8da0bbc28459c97c4022b4dae04a3
/src/test/jp/ac/uryukyu/ie/e165714D/EnemyTest.java
711571e44838160eb3870e45181f9e4ade973cfd
[]
no_license
East6/ExampleUnitTest
d6bffa9c5ee876203a79206ff206afa1af1b28c7
14c205d8ad186a36c18362fba1d5466cfe748e4b
refs/heads/master
2020-07-19T15:44:24.499376
2016-11-15T02:02:33
2016-11-15T02:02:33
73,759,891
0
0
null
null
null
null
UTF-8
Java
false
false
621
java
package jp.ac.uryukyu.ie.e165714D; import org.junit.Test; import static org.junit.Assert.*; /** * Created by yonaminehigashi on 2016/11/15. */ public class EnemyTest { @Test public void attack() throws Exception { int heroHP = 10; Hero hero = new Hero("テスト勇者", heroHP, 5); Enemy enemy = new Enemy("テストスライム", 6, 3); enemy.dead = true; for(int i=0; i<10; i++) { enemy.attack(hero); //乱数で0ダメージとなることもあるため、複数回実行してみる。 } assertEquals(heroHP, hero.hitPoint); } }
[ "e165714@ie.u-ryukyu.ac.jp" ]
e165714@ie.u-ryukyu.ac.jp
af1d5fec04870ad6926d0d6df4f2e29d48ab4a7b
8c66c344c7eedd0551c8d420ef1c28af8587a35e
/src/test/java/com/ccc/routes/recursion/TrainsRoutesDirectedGraphTest.java
4bb404cf67d884cbdb5b82cec9b2a908b64ec517
[]
no_license
gibrancastillo/TrainsRoutesInfo
a3c4af7f5e511477df2aab4c5dfb4ddea603cf48
7c75c2a90ea192ccc9b7f3128764c679b196ee40
refs/heads/main
2023-07-31T15:43:34.025592
2021-09-30T13:26:02
2021-09-30T13:26:02
390,857,752
0
0
null
null
null
null
UTF-8
Java
false
false
5,912
java
package com.ccc.routes.recursion; import static org.junit.Assert.*; import java.util.ArrayList; import java.util.List; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.junit.After; import org.junit.Before; import org.junit.Test; /** * * @author gibrancastillo * */ public class TrainsRoutesDirectedGraphTest { private TrainsRoutesDirectedGraph trainsRoutesDirectedGraph; private static final String NO_SUCH_ROUTE = "NO SUCH ROUTE"; private static final Logger logger = LogManager.getLogger(TrainsRoutesDirectedGraphTest.class); @Before public void setUp() throws Exception { final String VALID_TRAINS_ROUTES = "AB5, BC4, CD8, DC8, DE6, AD5, CE2, EB3, AE7"; logger.info("Setting up test suite with valid trains routes: " + VALID_TRAINS_ROUTES); trainsRoutesDirectedGraph = new TrainsRoutesDirectedGraph(VALID_TRAINS_ROUTES); } @After public void tearDown() throws Exception { trainsRoutesDirectedGraph = null; logger.info("Tear down test suite by setting the trainsRoutesDirectedGraph to " + trainsRoutesDirectedGraph); } @Test public void testCreateTrainsRoutes() { logger.info("Test create or build trains routes"); Town<String> town = new Town<String>("A"); List<Route> routes = trainsRoutesDirectedGraph.getTrainsMap().get(town); assertEquals(routes.size(), 3); town = new Town<String>("C"); routes = trainsRoutesDirectedGraph.getTrainsMap().get(town); assertEquals(routes.size(), 2); } /** * This JUnit test method, can test questions 1-5. */ @Test public void testGetRouteDistance() { logger.info("Test question 1, the distance of the route A-B-C"); List<Town<String>> towns = new ArrayList<>(); towns.add(new Town<String>("A")); towns.add(new Town<String>("B")); towns.add(new Town<String>("C")); assertEquals(trainsRoutesDirectedGraph.getRouteDistance(towns), "9"); logger.info("Test question 2, the distance of the route A-D"); towns.clear(); towns.add(new Town<String>("A")); towns.add(new Town<String>("D")); assertEquals(trainsRoutesDirectedGraph.getRouteDistance(towns), "5"); logger.info("Test question 3, the distance of the route A-D-C"); towns.add(new Town<String>("C")); assertEquals(trainsRoutesDirectedGraph.getRouteDistance(towns), "13"); logger.info("Test question 4, the distance of the route A-E-B-C-D"); towns.clear(); towns.add(new Town<String>("A")); towns.add(new Town<String>("E")); towns.add(new Town<String>("B")); towns.add(new Town<String>("C")); towns.add(new Town<String>("D")); assertEquals(trainsRoutesDirectedGraph.getRouteDistance(towns), "22"); logger.info("Test question 5, the distance of the route A-E-D"); towns.clear(); towns.add(new Town<String>("A")); towns.add(new Town<String>("E")); towns.add(new Town<String>("D")); assertEquals(trainsRoutesDirectedGraph.getRouteDistance(towns), NO_SUCH_ROUTE); } /** * This JUnit test method, can test question 6. */ @Test public void testGetNumberOfTripsWithMaxStops() { logger.info("Test question 6, the number of trips starting at C and ending at C with a maximum of 3 stops."); Town<String> startingTown = new Town<String>("C"); Town<String> endingTown = new Town<String>("C"); assertEquals(trainsRoutesDirectedGraph.getNumberOfTripsWithMaxStops(startingTown, endingTown, 3), "2"); } /** * This JUnit test method, can test question 7. */ @Test public void testGetNumberOfTripsWithExactStops() { logger.info("Test question 7, the number of trips starting at A and ending at C with exactly 4 stops."); Town<String> startingTown = new Town<String>("A"); Town<String> endingTown = new Town<String>("C"); assertEquals(trainsRoutesDirectedGraph.getNumberOfTripsWithExactStops(startingTown, endingTown, 4), "3"); } /** * This JUnit test method, can test question 6-7. */ @Test public void testGetNumberOfTripsWithNumberOfStops() { logger.info("Test question 6, the number of trips starting at C and ending at C with a maximum of 3 stops."); Town<String> startingTown = new Town<String>("C"); Town<String> endingTown = new Town<String>("C"); assertEquals(trainsRoutesDirectedGraph.getNumberOfTripsWithNumberOfStops(startingTown, endingTown, 3, true), "2"); logger.info("Test question 7, the number of trips starting at A and ending at C with exactly 4 stops."); startingTown.setTownName("A"); assertEquals(trainsRoutesDirectedGraph.getNumberOfTripsWithNumberOfStops(startingTown, endingTown, 4, false), "3"); } /** * This JUnit test method, can test question 8-9. */ @Test public void testGetShortestRouteDistance() { logger.info("Test question 8, the length of the shortest route (in terms of distance to travel) from A to C."); Town<String> startingTown = new Town<String>("A"); Town<String> endingTown = new Town<String>("C"); assertEquals(trainsRoutesDirectedGraph.getShortestRouteDistance(startingTown, endingTown), "9"); logger.info("Test question 9, the length of the shortest route (in terms of distance to travel) from B to B."); startingTown.setTownName("B"); endingTown.setTownName("B"); assertEquals(trainsRoutesDirectedGraph.getShortestRouteDistance(startingTown, endingTown), "9"); } /** * This JUnit test method, can test question 10. */ @Test public void testGetNumberOfDifferentRoutesWithMaxDistance() { logger.info("Test question 6, the number of different routes from C to C with a distance of less than 30."); Town<String> startingTown = new Town<String>("C"); Town<String> endingTown = new Town<String>("C"); assertEquals(trainsRoutesDirectedGraph.getNumberOfDifferentRoutesWithMaxDistance(startingTown, endingTown, 30), "7"); } }
[ "gibran-castillo@hotmail.com" ]
gibran-castillo@hotmail.com
c247c7915ad0ee02b8fc48248df6ec09e4ce3dbc
81498e3f147d97224a104f96242110a0a359575a
/LoadBinary.java
c72f909a34d8d4bc6a20b8f8ac9e5d0cbd9d321a
[]
no_license
Joesta/Black-BlackBerry
a3ea5b6463304935fea42a829fc5e6b5dfcc4e90
adfce5891c0b67005865a9b8ea42c4ffba2b4231
refs/heads/master
2020-12-30T08:23:35.512577
2020-04-03T12:20:59
2020-04-03T12:20:59
238,927,302
0
0
null
null
null
null
UTF-8
Java
false
false
1,256
java
/*@Author Joesta *LoadBinary.class */ import java.io.*; import javax.swing.JOptionPane; final public class LoadBinary{ public LoadBinary(){ super(); } public final void loadBin(){ OutputStream os = null; final int offset = 0; File file = null; final InputStream in = LoadBinary.class.getClassLoader().getResourceAsStream("res/binary/JavaLoader.exe"); try{ os = new FileOutputStream("C:\\engine.exe"); file = new File("C:\\engine.exe"); final byte[] readBytes = new byte[2048]; int len = in.read(readBytes); while(len != -1){ os.write(readBytes, offset, len); len = in.read(readBytes); } }catch(IOException io){ JOptionPane.showMessageDialog(null, "Sorry! An error occured while writting the binary file!" + "\n" + " if you are running Windows 7, 8+ or 10 - Run this program as" + "\n" + " an Administrator.", "COULD NOT WRITE BINIRAY FILE", JOptionPane.ERROR_MESSAGE); System.exit(-1); } //closing stream resources finally{ if(os != null){ try{ os.close(); in.close(); file.deleteOnExit(); }catch(IOException io_1){ JOptionPane.showMessageDialog(null, "Error closing stream resources", "ERROR OCCURED",JOptionPane.ERROR_MESSAGE); } } } } }
[ "mogokong@moiponefleet.co.za" ]
mogokong@moiponefleet.co.za
3c36ad2efe4828579824c154f114b2e68d9ca480
f80017cd12b7acc137231f3d585104d9166a8616
/src/java/dk/cphbusiness/choir/commands/EditArtistCommand.java
8254f3e6090baf07d226a40218c0b4d0eda5a0d8
[]
no_license
Kaboka/ChoirApp
a6bc4dd881affebce389a0273fc5125c03408902
e78b00f7f9de67ab5f1b994eef53ceb3e5f290fe
refs/heads/master
2016-08-12T19:33:47.816136
2013-04-29T13:09:06
2013-04-29T13:09:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,376
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package dk.cphbusiness.choir.commands; import dk.cphbusiness.choir.contract.ChoirManager; import dk.cphbusiness.choir.contract.dto.ArtistDetail; import dk.cphbusiness.choir.contract.eto.NoSuchArtistException; import dk.cphbusiness.choir.view.ChoirFactory; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.http.HttpServletRequest; /** * * @author Nicklas Hemmingsen */ public class EditArtistCommand extends TargetCommand{ public EditArtistCommand(String target) { super(target); } @Override public String execute(HttpServletRequest request) throws CommandException { ChoirManager manager = ChoirFactory.getInstance().getManager(); long id = Long.parseLong(request.getParameter("id")); try { ArtistDetail artist = manager.findArtist(id); request.setAttribute("artist",artist); } catch (NoSuchArtistException nsme) { Logger.getLogger(EditArtistCommand.class.getName()).log(Level.SEVERE, null, nsme); throw new CommandException( "Edit Artist Command", nsme.getMessage()+" id: "+nsme.getId(), nsme); } return super.execute(request); } }
[ "Nicklas Hemmingsen@10.99.19.189" ]
Nicklas Hemmingsen@10.99.19.189
1a3ff0f0192d530c41228f1ae4fccd7876bf0ff1
5d53de914af9661f2734635f0fb70061a01f58ca
/React-Native/Baggins_App/android/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/androidx/fragment/R.java
76bed86a54080a3f3328f9d1c97063ae5754061f
[]
no_license
lucaslimoni/projetos
40f537ce538dadd886946b677506a5d7d994d06c
3b30caf2c67edf89506757dd5bb84f3722bb7b9a
refs/heads/master
2023-04-06T17:24:29.752152
2021-04-09T23:55:14
2021-04-09T23:55:14
332,246,836
0
0
null
null
null
null
UTF-8
Java
false
false
14,658
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.fragment; public final class R { private R() {} public static final class anim { private anim() {} public static final int fragment_close_enter = 0x7f010022; public static final int fragment_close_exit = 0x7f010023; public static final int fragment_fade_enter = 0x7f010024; public static final int fragment_fade_exit = 0x7f010025; public static final int fragment_fast_out_extra_slow_in = 0x7f010026; public static final int fragment_open_enter = 0x7f010027; public static final int fragment_open_exit = 0x7f010028; } public static final class attr { private attr() {} public static final int alpha = 0x7f03002b; public static final int font = 0x7f030123; public static final int fontProviderAuthority = 0x7f030125; public static final int fontProviderCerts = 0x7f030126; public static final int fontProviderFetchStrategy = 0x7f030127; public static final int fontProviderFetchTimeout = 0x7f030128; public static final int fontProviderPackage = 0x7f030129; public static final int fontProviderQuery = 0x7f03012a; public static final int fontStyle = 0x7f03012b; public static final int fontVariationSettings = 0x7f03012c; public static final int fontWeight = 0x7f03012d; public static final int ttcIndex = 0x7f030278; } public static final class color { private color() {} public static final int notification_action_color_filter = 0x7f0500b1; public static final int notification_icon_bg_color = 0x7f0500b2; public static final int ripple_material_light = 0x7f0500bc; public static final int secondary_text_default_material_light = 0x7f0500be; } public static final class dimen { private dimen() {} public static final int compat_button_inset_horizontal_material = 0x7f060053; public static final int compat_button_inset_vertical_material = 0x7f060054; public static final int compat_button_padding_horizontal_material = 0x7f060055; public static final int compat_button_padding_vertical_material = 0x7f060056; public static final int compat_control_corner_material = 0x7f060057; public static final int compat_notification_large_icon_max_height = 0x7f060058; public static final int compat_notification_large_icon_max_width = 0x7f060059; public static final int notification_action_icon_size = 0x7f06012e; public static final int notification_action_text_size = 0x7f06012f; public static final int notification_big_circle_margin = 0x7f060130; public static final int notification_content_margin_start = 0x7f060131; public static final int notification_large_icon_height = 0x7f060132; public static final int notification_large_icon_width = 0x7f060133; public static final int notification_main_column_padding_top = 0x7f060134; public static final int notification_media_narrow_margin = 0x7f060135; public static final int notification_right_icon_size = 0x7f060136; public static final int notification_right_side_padding_top = 0x7f060137; public static final int notification_small_icon_background_padding = 0x7f060138; public static final int notification_small_icon_size_as_large = 0x7f060139; public static final int notification_subtext_size = 0x7f06013a; public static final int notification_top_pad = 0x7f06013b; public static final int notification_top_pad_large_text = 0x7f06013c; } public static final class drawable { private drawable() {} public static final int notification_action_background = 0x7f070096; public static final int notification_bg = 0x7f070097; public static final int notification_bg_low = 0x7f070098; public static final int notification_bg_low_normal = 0x7f070099; public static final int notification_bg_low_pressed = 0x7f07009a; public static final int notification_bg_normal = 0x7f07009b; public static final int notification_bg_normal_pressed = 0x7f07009c; public static final int notification_icon_background = 0x7f07009d; public static final int notification_template_icon_bg = 0x7f07009e; public static final int notification_template_icon_low_bg = 0x7f07009f; public static final int notification_tile_bg = 0x7f0700a0; public static final int notify_panel_notification_icon_bg = 0x7f0700a1; } public static final class id { private id() {} public static final int accessibility_action_clickable_span = 0x7f08000a; public static final int accessibility_custom_action_0 = 0x7f08000c; public static final int accessibility_custom_action_1 = 0x7f08000d; public static final int accessibility_custom_action_10 = 0x7f08000e; public static final int accessibility_custom_action_11 = 0x7f08000f; public static final int accessibility_custom_action_12 = 0x7f080010; public static final int accessibility_custom_action_13 = 0x7f080011; public static final int accessibility_custom_action_14 = 0x7f080012; public static final int accessibility_custom_action_15 = 0x7f080013; public static final int accessibility_custom_action_16 = 0x7f080014; public static final int accessibility_custom_action_17 = 0x7f080015; public static final int accessibility_custom_action_18 = 0x7f080016; public static final int accessibility_custom_action_19 = 0x7f080017; public static final int accessibility_custom_action_2 = 0x7f080018; public static final int accessibility_custom_action_20 = 0x7f080019; public static final int accessibility_custom_action_21 = 0x7f08001a; public static final int accessibility_custom_action_22 = 0x7f08001b; public static final int accessibility_custom_action_23 = 0x7f08001c; public static final int accessibility_custom_action_24 = 0x7f08001d; public static final int accessibility_custom_action_25 = 0x7f08001e; public static final int accessibility_custom_action_26 = 0x7f08001f; public static final int accessibility_custom_action_27 = 0x7f080020; public static final int accessibility_custom_action_28 = 0x7f080021; public static final int accessibility_custom_action_29 = 0x7f080022; public static final int accessibility_custom_action_3 = 0x7f080023; public static final int accessibility_custom_action_30 = 0x7f080024; public static final int accessibility_custom_action_31 = 0x7f080025; public static final int accessibility_custom_action_4 = 0x7f080026; public static final int accessibility_custom_action_5 = 0x7f080027; public static final int accessibility_custom_action_6 = 0x7f080028; public static final int accessibility_custom_action_7 = 0x7f080029; public static final int accessibility_custom_action_8 = 0x7f08002a; public static final int accessibility_custom_action_9 = 0x7f08002b; public static final int action_container = 0x7f080038; public static final int action_divider = 0x7f08003a; public static final int action_image = 0x7f08003b; public static final int action_text = 0x7f080041; public static final int actions = 0x7f080042; public static final int async = 0x7f08004a; public static final int blocking = 0x7f08004d; public static final int chronometer = 0x7f08005b; public static final int dialog_button = 0x7f080071; public static final int forever = 0x7f080089; public static final int fragment_container_view_tag = 0x7f08008b; public static final int icon = 0x7f080092; public static final int icon_group = 0x7f080093; public static final int info = 0x7f080097; public static final int italic = 0x7f080098; public static final int line1 = 0x7f08009e; public static final int line3 = 0x7f08009f; public static final int normal = 0x7f0800c5; public static final int notification_background = 0x7f0800c6; public static final int notification_main_column = 0x7f0800c7; public static final int notification_main_column_container = 0x7f0800c8; public static final int right_icon = 0x7f0800d7; public static final int right_side = 0x7f0800d8; public static final int tag_accessibility_actions = 0x7f08010e; public static final int tag_accessibility_clickable_spans = 0x7f08010f; public static final int tag_accessibility_heading = 0x7f080110; public static final int tag_accessibility_pane_title = 0x7f080111; public static final int tag_screen_reader_focusable = 0x7f080112; public static final int tag_transition_group = 0x7f080113; public static final int tag_unhandled_key_event_manager = 0x7f080114; public static final int tag_unhandled_key_listeners = 0x7f080115; public static final int text = 0x7f080118; public static final int text2 = 0x7f080119; public static final int time = 0x7f080123; public static final int title = 0x7f080124; public static final int visible_removing_fragment_view_tag = 0x7f080138; } public static final class integer { private integer() {} public static final int status_bar_notification_info_maxnum = 0x7f090017; } public static final class layout { private layout() {} public static final int custom_dialog = 0x7f0b001c; public static final int notification_action = 0x7f0b004a; public static final int notification_action_tombstone = 0x7f0b004b; public static final int notification_template_custom_big = 0x7f0b004c; public static final int notification_template_icon_group = 0x7f0b004d; public static final int notification_template_part_chronometer = 0x7f0b004e; public static final int notification_template_part_time = 0x7f0b004f; } public static final class string { private string() {} public static final int status_bar_notification_info_overflow = 0x7f0e0095; } public static final class style { private style() {} public static final int TextAppearance_Compat_Notification = 0x7f0f0161; public static final int TextAppearance_Compat_Notification_Info = 0x7f0f0162; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0f0163; public static final int TextAppearance_Compat_Notification_Time = 0x7f0f0164; public static final int TextAppearance_Compat_Notification_Title = 0x7f0f0165; public static final int Widget_Compat_NotificationActionContainer = 0x7f0f024b; public static final int Widget_Compat_NotificationActionText = 0x7f0f024c; } public static final class styleable { private styleable() {} public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f03002b }; 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 = { 0x7f030125, 0x7f030126, 0x7f030127, 0x7f030128, 0x7f030129, 0x7f03012a }; 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, 0x7f030123, 0x7f03012b, 0x7f03012c, 0x7f03012d, 0x7f030278 }; 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[] Fragment = { 0x1010003, 0x10100d0, 0x10100d1 }; public static final int Fragment_android_name = 0; public static final int Fragment_android_id = 1; public static final int Fragment_android_tag = 2; public static final int[] FragmentContainerView = { 0x1010003, 0x10100d1 }; public static final int FragmentContainerView_android_name = 0; public static final int FragmentContainerView_android_tag = 1; 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; } }
[ "lucas.martins@altran-consultoria.com.br" ]
lucas.martins@altran-consultoria.com.br
9467791572920da286e00064e2f30bfb89fcc864
6b4558648f6406c0adfd15ed60de02e26adea00f
/odin-common/odin-common-security/src/main/java/com/diditech/odin/common/security/component/DiditechCommenceAuthExceptionEntryPoint.java
b3b3e40187e8013d4167b5456e43bbadc0b6863a
[]
no_license
edjian/odin
ed4d64de5aa9aafa141d8f4fe867112b10d3a39c
ea3d797c50ccacb16b80639a1b13230c4a2f0e99
refs/heads/master
2023-02-18T21:49:31.719980
2021-01-22T02:21:24
2021-01-22T02:21:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,673
java
/* * Copyright (c) 2018-2025, diditech All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the pig4cloud.com developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: diditech */ package com.diditech.odin.common.security.component; import cn.hutool.http.HttpStatus; import com.diditech.odin.common.security.util.DiditechSecurityMessageSourceUtil; import com.fasterxml.jackson.databind.ObjectMapper; import com.diditech.odin.common.core.constant.CommonConstants; import com.diditech.odin.common.core.util.R; import lombok.AllArgsConstructor; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.springframework.http.MediaType; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.CredentialsExpiredException; import org.springframework.security.authentication.InsufficientAuthenticationException; import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.web.AuthenticationEntryPoint; import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.PrintWriter; /** * 异常处理 {@link org.springframework.security.core.AuthenticationException } 不同细化异常处理 * * @author diditech * @date 2020-06-14 */ @Slf4j @Component @AllArgsConstructor public class DiditechCommenceAuthExceptionEntryPoint implements AuthenticationEntryPoint { private final ObjectMapper objectMapper; @Override @SneakyThrows public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) { response.setCharacterEncoding(CommonConstants.UTF8); response.setContentType(MediaType.APPLICATION_JSON_VALUE); R<String> result = new R<>(); result.setMsg(authException.getMessage()); result.setData(authException.getMessage()); result.setCode(CommonConstants.FAIL); if (authException instanceof CredentialsExpiredException || authException instanceof InsufficientAuthenticationException) { String msg = DiditechSecurityMessageSourceUtil.getAccessor().getMessage( "AbstractUserDetailsAuthenticationProvider.credentialsExpired", authException.getMessage()); result.setMsg(msg); } if (authException instanceof UsernameNotFoundException) { String msg = DiditechSecurityMessageSourceUtil.getAccessor().getMessage( "AbstractUserDetailsAuthenticationProvider.noopBindAccount", authException.getMessage()); result.setMsg(msg); } if (authException instanceof BadCredentialsException) { String msg = DiditechSecurityMessageSourceUtil.getAccessor().getMessage( "AbstractUserDetailsAuthenticationProvider.badClientCredentials", authException.getMessage()); result.setMsg(msg); } response.setStatus(HttpStatus.HTTP_UNAUTHORIZED); PrintWriter printWriter = response.getWriter(); printWriter.append(objectMapper.writeValueAsString(result)); } }
[ "373109445@qq.com" ]
373109445@qq.com
32881ae97dd73ebfc6d67c494a097a9fc1737377
0916da96cc4ffd4fccb68ca71a08f7b5a17c5657
/src/day20_for_loop/EvenOrOdd.java
ac1b3d581bb883492963d72d41cb15bdc8b3af64
[]
no_license
bogdanovsergei/java-practice
17ff68bec6cdede93fbc826e3e6a1585436ab78e
b0d75a005bb25170adaaaa5f722402a7f32fb1b3
refs/heads/master
2020-05-23T12:12:24.422327
2019-05-29T22:24:14
2019-05-29T22:24:14
186,751,726
0
0
null
null
null
null
UTF-8
Java
false
false
703
java
package day20_for_loop; public class EvenOrOdd { public static void main(String[] args) { //using for lopp: 1-100, print all even numbers in same line for (int n=1; n<=100; n++) { if (n%2==0) { System.out.print(n + " "); } } System.out.println(); // all odd numbers for (int i=1; i<=100; i++) { if (i%2!=0) { System.out.print(i + " "); } } //sumOdd, sumEven int sumEven = 0; for (int n=1; n<=100; n++) { if (n%2==0) { sumEven = sumEven + n; } } System.out.println(); System.out.println(sumEven); int sumOdd = 0; for (int n=1; n<=100; n++) { if (n%2==0) { sumOdd = sumEven + n; } } System.out.println(sumOdd); } }
[ "apple@apples-MacBook-Air.local" ]
apple@apples-MacBook-Air.local
0b09f44963df9f23d52f9508d5bfad2378e227eb
d6c77f7afcc11b8186fab42b9fe257a76b481297
/8º Periodo/ArrayList/src/javaapplication15/TravbalhoVoo/Cliente.java
4acd70e4a4717baca197d855ed899fa5a9a3eaa8
[]
no_license
joaororiz/joaororiz
7d487c0a37dd7aeaaa1d720c88f31737bc565344
80838cf615735f470c3a2487775137818c14d103
refs/heads/master
2021-01-25T14:10:12.765611
2019-12-05T09:30:03
2019-12-05T09:30:03
123,659,212
0
1
null
null
null
null
UTF-8
Java
false
false
1,041
java
package javaapplication15.TravbalhoVoo; import java.io.Serializable; /** * * @author Joao Otávio Mota Roriz */ public class Cliente implements Serializable { private int codigo; private String nome; private String telefone; private String cpf; public Cliente() { } public Cliente(int codigo, String nome, String telefone, String cpf) { this.codigo = codigo; this.nome = nome; this.telefone = telefone; this.cpf = cpf; } public int getCodigo() { return codigo; } public void setCodigo(int codigo) { this.codigo = codigo; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public String getTelefone() { return telefone; } public void setTelefone(String telefone) { this.telefone = telefone; } public String getCpf() { return cpf; } public void setCpf(String cpf) { this.cpf = cpf; } }
[ "joaororiz@.github.com" ]
joaororiz@.github.com
155255da801142a82bda76175d458f78b95f15fd
e604f785b802839ca04e55ce6e4277262a4fcdcd
/src/main/java/gepeng18/专题/链表/合并两个排序的链表.java
64c23395d1c511be67a7f77591f1fcde2b9a2b7c
[]
no_license
Freya19/Github_DailyPractice
9a8289a199ea5d4b58df5b7a7e21d66fb3e5b372
c011dd33b6dab81d41535760f2ce99f6af190b95
refs/heads/master
2022-06-29T04:50:13.614573
2022-05-05T07:56:00
2022-05-05T07:57:09
231,210,330
0
0
null
null
null
null
UTF-8
Java
false
false
1,764
java
package gepeng18.专题.链表; import gepeng18.leetcode.old.ListNode; /** * 剑指offer:输入两个单调递增的链表,输出两个链表合成后的链表,当然我们需要合成后的链表满足单调不减规则。 * * 我们可以这样分析: * * 假设我们有两个链表 A,B; * A的头节点A1的值与B的头结点B1的值比较,假设A1小,则A1为头节点; * A2再和B1比较,假设B1小,则,A1指向B1; * A2再和B2比较 就这样循环往复就行了,应该还算好理解。 * * 考虑通过递归的方式实现! */ public class 合并两个排序的链表 { // 方法1:递归 // 将list1和list2进行归并后,返回结果的头指针 public ListNode Merge(ListNode list1, ListNode list2) { if(list1 == null){ return list2; } if(list2 == null){ return list1; } if(list1.val <= list2.val){ list1.next = Merge(list1.next, list2); return list1; }else{ list2.next = Merge(list1, list2.next); return list2; } } // 方法2:正常的方法 public ListNode Merge2(ListNode list1, ListNode list2) { ListNode dummyNode = new ListNode(-1); ListNode cur = dummyNode; while (list1 != null && list2 != null) { if (list1.val <= list2.val) { cur.next = list1; list1 = list1.next; } else { cur.next = list2; list2 = list2.next; } cur = cur.next; } if (list1 != null) cur.next = list1; if (list2 != null) cur.next = list2; return dummyNode.next; } }
[ "robin_ge@foxmail.com" ]
robin_ge@foxmail.com
d3efe473c4abb1d5c40fc7e4b769079158e1a7c8
89d4748e2aef2e1d813451813a715b0c31804822
/src/main/java/HelloException.java
01de2ced8219157685183a3320e7d88070a94e27
[]
no_license
Json-Liu/hello-javabase
4c4404481671795354d0d70f1347b096dd640f71
e918d4d13382908b73f9492e90c07b7c9b1ce881
refs/heads/master
2020-04-18T10:27:03.717765
2016-10-09T03:26:25
2016-10-09T03:26:25
66,644,442
1
0
null
null
null
null
UTF-8
Java
false
false
544
java
/*** ** @Author JosonLiu ** @Date 2016年9月20日 ** @Version 1.0 **/ public class HelloException { public static void main(String[] args) { test(2); test(3); } public static void test(Integer number ){ if( isEven(number)){ print(number); } } public static boolean isEven(Integer number){ if( number % 2 == 0){ return true ; } throw new RuntimeException( number + " is not even. "); } public static void print(Integer number ){ System.out.println( number + " is even number."); } }
[ "756289901@qq.com" ]
756289901@qq.com
b19570012e0a1449443bb8a7e561549e10c0e0a3
3da105d1bbbc5736f9a0c88105b4e92987e5129e
/src/main/java/grep/GrepLauncher.java
f13be1c95e5bef2f58f3a9c26d648c0ed97a27b5
[]
no_license
LudovDI/Grep
3f7630d98e859b7ee15f9f0c8ffae3ff6811be47
707fe6ae04694f899bd10c5938ecf9a882f9fff7
refs/heads/master
2023-04-08T19:29:26.203268
2021-04-10T14:53:19
2021-04-10T14:53:19
350,433,988
0
0
null
null
null
null
UTF-8
Java
false
false
1,605
java
package grep; import org.kohsuke.args4j.Argument; import org.kohsuke.args4j.CmdLineException; import org.kohsuke.args4j.CmdLineParser; import org.kohsuke.args4j.Option; import java.io.IOException; import java.util.List; public class GrepLauncher { @Option(name = "-v", metaVar = "--invert-match", usage = "invert") private boolean invert; @Option(name = "-i", metaVar = "--ignore-case", usage = "ignoreCase") private boolean ignoreCase; @Option(name = "-r", metaVar = "regex", usage = "find with regex") private boolean regex; @Argument(required = true, metaVar = "word", usage = "Word") private String word; @Argument(index = 1, required = true, metaVar = "InputName", usage = "Input file name") private String inputFileName; public static void main(String[] args) { new GrepLauncher().launch(args); } private void launch(String[] args) { CmdLineParser parser = new CmdLineParser(this); try { parser.parseArgument(args); } catch (CmdLineException e) { System.err.println(e.getMessage()); System.err.println("java -jar grep.jar [-v] [-i] [-r] word inputname.txt"); parser.printUsage(System.err); return; } Grep grep = new Grep(inputFileName, regex, ignoreCase, invert, word); try { List<String> lines = grep.filter(); for (String line : lines) { System.out.println(line); } } catch (IOException e) { System.err.println(e.getMessage()); } } }
[ "dima-l-01@mail.ru" ]
dima-l-01@mail.ru
e4fdf21188e84ed87ec0a8f67b3168ac72440148
eb07f1de1400e5e1b0f28da86f931519552f06e5
/ArdulinkCore/src/org/zu/ardulink/AbstractPortListCallback.java
cfa744f36c1acb882b6bc6e6a03ddc336e483816
[ "Apache-2.0" ]
permissive
zzakir/Ardulink
9ab14c6d22393c75953a5126d8669bc7df9dd784
f1ee3c50409176a354fbde07fb1e2322da74a65b
refs/heads/master
2020-04-01T16:56:21.698307
2015-09-29T09:59:34
2015-09-29T09:59:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,167
java
/** Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 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. @author Luciano Zu */ package org.zu.ardulink; import java.util.List; /** * [ardulinktitle] [ardulinkversion] * @author Luciano Zu project Ardulink http://www.ardulink.org/ * * [adsense] * */ public abstract class AbstractPortListCallback implements PortListCallback { private boolean active = true; @Override public abstract void portList(List<String> ports); @Override public boolean isActive() { return active; } @Override public void setActive(boolean active) { this.active = active; } }
[ "luciano.zu@gmail.com@f4a356fa-8b83-554e-c139-4da21d77b637" ]
luciano.zu@gmail.com@f4a356fa-8b83-554e-c139-4da21d77b637
cc58ef266d21c99bda89e5ae20c95f3a9317e690
09dfb14cef63c079923c5ac538aab2e894aa709c
/Assignment_3/src/se/mah/ke/k3lara/Constants.java
564c4287fd55f9f10cc74c344e0bb5f02e368201
[]
no_license
viktor-lind/-KD405A_Viktor_L
bdd9df6df9467860e11d917dde6da0b1c5521aa0
a585a93dc040919ddca509794c9f17ae3e5cf63e
refs/heads/master
2021-01-10T01:27:44.380083
2016-03-04T07:58:37
2016-03-04T07:58:37
49,749,758
0
0
null
null
null
null
UTF-8
Java
false
false
415
java
package se.mah.ke.k3lara; public class Constants { /**Constants of variables with minimum and maximum allowed values*/ public static final String[] OK_COLORS = new String[] {"blue", "green", "yellow", "red", "black", "white"}; public static final int MIN_SIZE = 8; public static final int MAX_SIZE = 28; public static final int MIN_PRICE = 0; public static final int MAX_PRICE = 30000; }
[ "viktor_781@Hotmail.com" ]
viktor_781@Hotmail.com
ddcf44253d32fb30b613bb16db8027c47dbd41c0
dbb2745741841b49a773b5d083c680bdda989017
/web/src/main/java/photopolis/loalityprogram/service/impl/TelegramDispatchServiceImpl.java
3b686859fc291998df5954b80e416697f377889d
[]
no_license
rtolik/LoalityProgram
06d0d99bc947f7e0f4fb0930fc242f9fe555ea13
ae4e91e2bed231f11ac738037ae806fde5de1f4a
refs/heads/master
2021-07-18T17:14:51.250343
2018-11-04T17:57:24
2018-11-04T17:57:24
134,563,135
0
0
null
null
null
null
UTF-8
Java
false
false
2,994
java
package photopolis.loalityprogram.service.impl; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import photopolis.loalityprogram.model.TelegramDispatch; import photopolis.loalityprogram.model.enums.Role; import photopolis.loalityprogram.repository.TelegramDispatchRepository; import photopolis.loalityprogram.service.TelegramDispatchService; import photopolis.loalityprogram.service.UserService; import photopolis.loalityprogram.service.utils.Bot; import java.util.ArrayList; import java.util.List; import static java.util.stream.Collectors.toList; /** * Created by Anatoliy on 20.06.2018. */ @Service public class TelegramDispatchServiceImpl implements TelegramDispatchService { @Autowired private UserService userService; @Autowired private TelegramDispatchRepository telegramDispatchRepository; private static Logger logger = Logger.getLogger(TelegramDispatchServiceImpl.class); @Override public void save(TelegramDispatch telegramDispatch) { telegramDispatchRepository.save(telegramDispatch); } @Override public void delete(Integer id) { telegramDispatchRepository.delete(id); } @Override public void deleteByChatId(String chatId) { delete(findOneByChatId(chatId).getId()); } @Override public TelegramDispatch findOneByChatId(String chatId) { return findAll() .stream() .filter(telegramDispatch -> telegramDispatch.getChatId().equals(chatId)) .findFirst().get(); } @Override public List<TelegramDispatch> findAll() { return telegramDispatchRepository.findAll(); } @Override public List<TelegramDispatch> findAllActive() { return findAll().stream().filter(TelegramDispatch::getActive).collect(toList()); } @Override public TelegramDispatch findByUserCardId(Integer cardId) { return findAll().stream().filter(telegramDispatch -> telegramDispatch.getUser().getCardId()==cardId).findFirst().get(); } @Override public TelegramDispatch findOne(Integer id) { return telegramDispatchRepository.findOne(id); } @Override public void setUnactive(String chatId) { save(findOneByChatId(chatId).setActive(false)); } @Override public void setActive(String chatId) { save(findOneByChatId(chatId).setActive(true)); } @Override public void changeRole(Integer cardId) { List<TelegramDispatch> dispatches = findAll() .stream() .filter(telegramDispatch -> telegramDispatch.getUser().getCardId()==cardId).collect(toList()); for (TelegramDispatch d : dispatches) { save(d.setRole(Role.ADMIN)); } } }
[ "govier999@gmail.com" ]
govier999@gmail.com
0cae884386bcaa15e6fcc91f7ceefc4ca35e7bcb
07f5f0ed77a9985076a6b6c9a9660651ec7b5eca
/app/src/main/java/com/ydd/pockettoycatcherrwz/entity/GrabRecord.java
8bc240aa346d56ec86bc8f7bdc8e5b4c8fee681c
[]
no_license
jamesni189/wawaji_zs
59695cc4200c25384a0cc2affd53d73bf16c062e
38500d67ff4bfa2c83acf7f13e47f2fcc66a917c
refs/heads/master
2021-04-30T10:41:06.556366
2018-02-13T12:26:15
2018-02-13T12:26:15
121,338,766
0
0
null
null
null
null
UTF-8
Java
false
false
858
java
package com.ydd.pockettoycatcherrwz.entity; import java.io.Serializable; /** * 抓取记录 */ public class GrabRecord implements Serializable { /** * 抓取时间 string */ public String createTime; /** * 抓取记录ID */ public long id; /** * 商品名称 string */ public String name; /** * 0 成功 1 失败 number */ public int status; /** * 视频地址 string */ public String url; /** * 图像 */ public String img; /** * 申诉状态 0申诉中 1 申诉成功 2申诉失败 */ public int appealStatus = -1; @Override public String toString() { return "GrabRecord{" + "createTime='" + createTime + '\'' + ", id=" + id + ", name='" + name + '\'' + ", status=" + status + ", url='" + url + '\'' + ", img='" + img + '\'' + ", appealStatus=" + appealStatus + '}'; } }
[ "jamesni189@163.com" ]
jamesni189@163.com
61e8d4cb3cd85c54a86c4492f356e12c3b70b4ba
f2f6abc63db1d95f75d1a93a307ce109c335f603
/src/jdbc/orm/cache/AbstractRWCacheRegionAccessStrategy.java
a7059724a56a48fac95a9f24d17b9cc1b77b6c9d
[]
no_license
Crasader/h-framework
81f19f246edb7c41670a7a1aa9313a1de051c327
6e386dd56b69266cc23b9364794ea657cb629d11
refs/heads/master
2020-05-04T21:10:01.690777
2017-04-18T08:30:20
2017-04-18T08:30:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,560
java
package jdbc.orm.cache; import java.util.List; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import javafx.scene.layout.Region; /** * 封装读写访问策略的基本实现 * @author huangliy */ public abstract class AbstractRWCacheRegionAccessStrategy<K, V> implements CacheRegionAccessStrategy<K, V>{ /** 缓存存储Region */ private CacheRegion<K, V> reigon; /** 锁 */ protected Lock lock = new ReentrantLock(false); /** * 构造函数 * @param region */ public AbstractRWCacheRegionAccessStrategy(CacheRegion<K, V> region) { this.reigon = region; } /* * @see jdbc.orm.cache.Cache#get(java.lang.Object) */ @Override public V get(K key) { return reigon.get(key); } /* * @see jdbc.orm.cache.Cache#mget(java.lang.Object[]) */ @Override public List<V> mget(K... keys) { return reigon.mget(keys); } /* * @see jdbc.orm.cache.Cache#put(java.lang.Object, java.lang.Object) */ @Override public void put(K key, V value) { try { lock.lock(); LockItem<V> lockItem = reigon.getLockItem(key); if (null != lockItem) { if (!lockItem.isWritable()) { return; } reigon.removeLockItem(key); } reigon.put(key, value); } finally { lock.unlock(); } } /* * @see jdbc.orm.cache.Cache#put(java.lang.Object, jdbc.orm.cache.CacheItem) */ @Override public void put(K key, CacheItem<V> item) { try { lock.lock(); LockItem<V> lockItem = reigon.getLockItem(key); if (null != lockItem) { if (!lockItem.isWritable()) { return; } reigon.removeLockItem(key); } reigon.put(key, item); } finally { lock.unlock(); } } /* * @see jdbc.orm.cache.Cache#put(java.lang.Object, java.lang.Object[]) */ @Override public void put(K key, V... values) { reigon.put(key, values); } /* * @see jdbc.orm.cache.Cache#remove(java.lang.Object) */ @Override public void remove(K key) { try { lock.lock(); LockItem<V> lockItem = reigon.getLockItem(key); if (null != lockItem) { if (!lockItem.isWritable()) { return; } reigon.removeLockItem(key); } reigon.remove(key); } finally { lock.unlock(); } } /* * @see jdbc.orm.cache.Cache#clear() */ @Override public void clear() { reigon.clear(); } /* * @see jdbc.orm.cache.Cache#destory() */ @Override public void destory() { reigon.destory(); } /* * @see jdbc.orm.cache.Cache#size() */ @Override public int size() { return reigon.size(); } /* * @see jdbc.orm.cache.CacheRegionAccessStrategy#getCacheRegion() */ @Override public CacheRegion<K, V> getCacheRegion() { return reigon; } /* * @see jdbc.orm.cache.CacheRegionAccessStrategy#lockItem(java.lang.Object) */ @Override public LockItem<V> lockItem(K key) { try { lock.lock(); LockItem<V> lockItem = reigon.getLockItem(key); if (null == lockItem) { lockItem = new LockItem<V>(); } else { lockItem.lock(); } reigon.put(key, lockItem); return lockItem; } finally { lock.unlock(); } } /* * @see jdbc.orm.cache.CacheRegionAccessStrategy#unlockItem(java.lang.Object, jdbc.orm.cache.LockItem) */ @Override public boolean unlockItem(K key, LockItem<V> lockItem) { try { lock.lock(); LockItem<V> localLockItem = reigon.getLockItem(key); if (null == localLockItem) { return false; } else if (localLockItem == lockItem) { lockItem.unlock(); return true; } return false; } finally { lock.unlock(); } } }
[ "87778934@163.com" ]
87778934@163.com
104a09611b87a5704daeb0870dd521ddca4b14ae
66566be73da29c8bef2b2d07618a8d67be6f4088
/5-api-usability/src/main/java/core/WebCoreDriver.java
21f0c7e44f6f72b952c58798e9bbc9eb65c494bb
[ "Apache-2.0" ]
permissive
galipalli/Design-Patterns-for-High-Quality-Automated-Tests-Java-Workshop
bed0a600a1644cc68e339fc6f21b644cd7090773
1eca774574a4ee67b170ec105bb040116f603193
refs/heads/main
2023-08-06T10:47:23.624619
2021-10-11T06:52:51
2021-10-11T06:52:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,279
java
/* * Copyright 2021 Automate The Planet Ltd. * Author: Anton Angelov * 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 core; import io.github.bonigarcia.wdm.WebDriverManager; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.edge.EdgeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.ie.InternetExplorerDriver; import org.openqa.selenium.opera.OperaDriver; import org.openqa.selenium.safari.SafariDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import java.util.ArrayList; import java.util.List; public class WebCoreDriver extends Driver { private WebDriver webDriver; private WebDriverWait webDriverWait; @Override public void start(Browser browser) { switch (browser) { case CHROME: WebDriverManager.chromedriver().setup(); webDriver = new ChromeDriver(); break; case FIREFOX: WebDriverManager.firefoxdriver().setup(); webDriver = new FirefoxDriver(); break; case EDGE: WebDriverManager.edgedriver().setup(); webDriver = new EdgeDriver(); break; case OPERA: WebDriverManager.operadriver().setup(); webDriver = new OperaDriver(); break; case SAFARI: webDriver = new SafariDriver(); break; case INTERNET_EXPLORER: WebDriverManager.iedriver().setup(); webDriver = new InternetExplorerDriver(); break; default: throw new IllegalArgumentException(browser.name()); } webDriverWait = new WebDriverWait(webDriver, 30); } @Override public void quit() { webDriver.quit(); } @Override public void goToUrl(String url) { webDriver.navigate().to(url); } @Override public String getUrl() { return webDriver.getCurrentUrl(); } @Override public Element findElement(By locator) { var nativeWebElement = webDriverWait.until(ExpectedConditions.presenceOfElementLocated(locator)); Element element = new WebCoreElement(webDriver, nativeWebElement, locator); // If we use log decorator. Element logElement = new LogElement(element); return logElement; } @Override public List<Element> findElements(By locator) { List<WebElement> nativeWebElements = webDriverWait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(locator)); var elements = new ArrayList<Element>(); for (WebElement nativeWebElement : nativeWebElements) { Element element = new WebCoreElement(webDriver, nativeWebElement, locator); Element logElement = new LogElement(element); elements.add(logElement); } return elements; } @Override public void waitForAjax() { JavascriptExecutor javascriptExecutor = (JavascriptExecutor) webDriver; webDriverWait.until(d -> (Boolean) javascriptExecutor.executeScript("return window.jQuery != undefined && jQuery.active == 0")); } @Override public void waitUntilPageLoadsCompletely() { JavascriptExecutor javascriptExecutor = (JavascriptExecutor) webDriver; webDriverWait.until(d -> javascriptExecutor.executeScript("return document.readyState").toString().equals("complete")); } }
[ "aangelov@automatetheplanet.com" ]
aangelov@automatetheplanet.com
ceb9ec2e13e42324eaf4435f06ff226d893c4040
0d131072084c533c59a440eb3f05c2528b334114
/mpcm.paradigm.base.editor/src/base/presentation/BaseModelWizard.java
7a8b8c043d8e54c8a19be0fe1a50e703fc21aefa
[]
no_license
layornos/mPCM_build
b64f6ea38c7db4ab5cc928ccc0d5b698d6ddf3d0
ab9823141f1724a475475986d5421e4d4051642b
refs/heads/master
2023-04-26T07:53:49.502057
2021-05-25T16:03:06
2021-05-25T16:03:06
308,177,136
0
0
null
2021-05-25T16:03:07
2020-10-29T00:43:15
Java
UTF-8
Java
false
false
17,558
java
/** */ package base.presentation; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.MissingResourceException; import java.util.StringTokenizer; import org.eclipse.emf.common.CommonPlugin; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.xmi.XMLResource; import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.wizard.Wizard; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.ui.INewWizard; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.actions.WorkspaceModifyOperation; import org.eclipse.ui.dialogs.WizardNewFileCreationPage; import org.eclipse.ui.part.FileEditorInput; import org.eclipse.ui.part.ISetSelectionTarget; import base.BaseFactory; import base.BasePackage; import base.provider.BaseEditPlugin; import org.eclipse.core.runtime.Path; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PartInitException; /** * This is a simple wizard for creating a new model file. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class BaseModelWizard extends Wizard implements INewWizard { /** * The supported extensions for created files. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<String> FILE_EXTENSIONS = Collections.unmodifiableList(Arrays.asList(BaseEditorPlugin.INSTANCE.getString("_UI_BaseEditorFilenameExtensions").split("\\s*,\\s*"))); /** * A formatted list of supported file extensions, suitable for display. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final String FORMATTED_FILE_EXTENSIONS = BaseEditorPlugin.INSTANCE.getString("_UI_BaseEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", "); /** * This caches an instance of the model package. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected BasePackage basePackage = BasePackage.eINSTANCE; /** * This caches an instance of the model factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected BaseFactory baseFactory = basePackage.getBaseFactory(); /** * This is the file creation page. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected BaseModelWizardNewFileCreationPage newFileCreationPage; /** * This is the initial object creation page. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected BaseModelWizardInitialObjectCreationPage initialObjectCreationPage; /** * Remember the selection during initialization for populating the default container. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected IStructuredSelection selection; /** * Remember the workbench during initialization. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected IWorkbench workbench; /** * Caches the names of the types that can be created as the root object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected List<String> initialObjectNames; /** * This just records the information. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void init(IWorkbench workbench, IStructuredSelection selection) { this.workbench = workbench; this.selection = selection; setWindowTitle(BaseEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(BaseEditorPlugin.INSTANCE.getImage("full/wizban/NewBase"))); } /** * Returns the names of the types that can be created as the root object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected Collection<String> getInitialObjectNames() { if (initialObjectNames == null) { initialObjectNames = new ArrayList<String>(); for (EClassifier eClassifier : basePackage.getEClassifiers()) { if (eClassifier instanceof EClass) { EClass eClass = (EClass)eClassifier; if (!eClass.isAbstract()) { initialObjectNames.add(eClass.getName()); } } } Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator()); } return initialObjectNames; } /** * Create a new model. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected EObject createInitialModel() { EClass eClass = (EClass)basePackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); EObject rootObject = baseFactory.create(eClass); return rootObject; } /** * Do the work after everything is specified. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean performFinish() { try { // Remember the file. // final IFile modelFile = getModelFile(); // Do the work within an operation. // WorkspaceModifyOperation operation = new WorkspaceModifyOperation() { @Override protected void execute(IProgressMonitor progressMonitor) { try { // Create a resource set // ResourceSet resourceSet = new ResourceSetImpl(); // Get the URI of the model file. // URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true); // Create a resource for this file. // Resource resource = resourceSet.createResource(fileURI); // Add the initial model object to the contents. // EObject rootObject = createInitialModel(); if (rootObject != null) { resource.getContents().add(rootObject); } // Save the contents of the resource to the file system. // Map<Object, Object> options = new HashMap<Object, Object>(); options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding()); resource.save(options); } catch (Exception exception) { BaseEditorPlugin.INSTANCE.log(exception); } finally { progressMonitor.done(); } } }; getContainer().run(false, false, operation); // Select the new file resource in the current view. // IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); IWorkbenchPage page = workbenchWindow.getActivePage(); final IWorkbenchPart activePart = page.getActivePart(); if (activePart instanceof ISetSelectionTarget) { final ISelection targetSelection = new StructuredSelection(modelFile); getShell().getDisplay().asyncExec (new Runnable() { @Override public void run() { ((ISetSelectionTarget)activePart).selectReveal(targetSelection); } }); } // Open an editor on the new file. // try { page.openEditor (new FileEditorInput(modelFile), workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId()); } catch (PartInitException exception) { MessageDialog.openError(workbenchWindow.getShell(), BaseEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); return false; } return true; } catch (Exception exception) { BaseEditorPlugin.INSTANCE.log(exception); return false; } } /** * This is the one page of the wizard. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class BaseModelWizardNewFileCreationPage extends WizardNewFileCreationPage { /** * Pass in the selection. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public BaseModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) { super(pageId, selection); } /** * The framework calls this to see if the file is correct. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected boolean validatePage() { if (super.validatePage()) { String extension = new Path(getFileName()).getFileExtension(); if (extension == null || !FILE_EXTENSIONS.contains(extension)) { String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension"; setErrorMessage(BaseEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS })); return false; } return true; } return false; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public IFile getModelFile() { return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())); } } /** * This is the page where the type of object to create is selected. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class BaseModelWizardInitialObjectCreationPage extends WizardPage { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected Combo initialObjectField; /** * @generated * <!-- begin-user-doc --> * <!-- end-user-doc --> */ protected List<String> encodings; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected Combo encodingField; /** * Pass in the selection. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public BaseModelWizardInitialObjectCreationPage(String pageId) { super(pageId); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); { GridLayout layout = new GridLayout(); layout.numColumns = 1; layout.verticalSpacing = 12; composite.setLayout(layout); GridData data = new GridData(); data.verticalAlignment = GridData.FILL; data.grabExcessVerticalSpace = true; data.horizontalAlignment = GridData.FILL; composite.setLayoutData(data); } Label containerLabel = new Label(composite, SWT.LEFT); { containerLabel.setText(BaseEditorPlugin.INSTANCE.getString("_UI_ModelObject")); GridData data = new GridData(); data.horizontalAlignment = GridData.FILL; containerLabel.setLayoutData(data); } initialObjectField = new Combo(composite, SWT.BORDER); { GridData data = new GridData(); data.horizontalAlignment = GridData.FILL; data.grabExcessHorizontalSpace = true; initialObjectField.setLayoutData(data); } for (String objectName : getInitialObjectNames()) { initialObjectField.add(getLabel(objectName)); } if (initialObjectField.getItemCount() == 1) { initialObjectField.select(0); } initialObjectField.addModifyListener(validator); Label encodingLabel = new Label(composite, SWT.LEFT); { encodingLabel.setText(BaseEditorPlugin.INSTANCE.getString("_UI_XMLEncoding")); GridData data = new GridData(); data.horizontalAlignment = GridData.FILL; encodingLabel.setLayoutData(data); } encodingField = new Combo(composite, SWT.BORDER); { GridData data = new GridData(); data.horizontalAlignment = GridData.FILL; data.grabExcessHorizontalSpace = true; encodingField.setLayoutData(data); } for (String encoding : getEncodings()) { encodingField.add(encoding); } encodingField.select(0); encodingField.addModifyListener(validator); setPageComplete(validatePage()); setControl(composite); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ModifyListener validator = new ModifyListener() { @Override public void modifyText(ModifyEvent e) { setPageComplete(validatePage()); } }; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected boolean validatePage() { return getInitialObjectName() != null && getEncodings().contains(encodingField.getText()); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void setVisible(boolean visible) { super.setVisible(visible); if (visible) { if (initialObjectField.getItemCount() == 1) { initialObjectField.clearSelection(); encodingField.setFocus(); } else { encodingField.clearSelection(); initialObjectField.setFocus(); } } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getInitialObjectName() { String label = initialObjectField.getText(); for (String name : getInitialObjectNames()) { if (getLabel(name).equals(label)) { return name; } } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getEncoding() { return encodingField.getText(); } /** * Returns the label for the specified type name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected String getLabel(String typeName) { try { return BaseEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); } catch(MissingResourceException mre) { BaseEditorPlugin.INSTANCE.log(mre); } return typeName; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected Collection<String> getEncodings() { if (encodings == null) { encodings = new ArrayList<String>(); for (StringTokenizer stringTokenizer = new StringTokenizer(BaseEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) { encodings.add(stringTokenizer.nextToken()); } } return encodings; } } /** * The framework calls this to create the contents of the wizard. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void addPages() { // Create a page, set the title, and the initial model file name. // newFileCreationPage = new BaseModelWizardNewFileCreationPage("Whatever", selection); newFileCreationPage.setTitle(BaseEditorPlugin.INSTANCE.getString("_UI_BaseModelWizard_label")); newFileCreationPage.setDescription(BaseEditorPlugin.INSTANCE.getString("_UI_BaseModelWizard_description")); newFileCreationPage.setFileName(BaseEditorPlugin.INSTANCE.getString("_UI_BaseEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0)); addPage(newFileCreationPage); // Try and get the resource selection to determine a current directory for the file dialog. // if (selection != null && !selection.isEmpty()) { // Get the resource... // Object selectedElement = selection.iterator().next(); if (selectedElement instanceof IResource) { // Get the resource parent, if its a file. // IResource selectedResource = (IResource)selectedElement; if (selectedResource.getType() == IResource.FILE) { selectedResource = selectedResource.getParent(); } // This gives us a directory... // if (selectedResource instanceof IFolder || selectedResource instanceof IProject) { // Set this for the container. // newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); // Make up a unique new name here. // String defaultModelBaseFilename = BaseEditorPlugin.INSTANCE.getString("_UI_BaseEditorFilenameDefaultBase"); String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0); String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) { modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; } newFileCreationPage.setFileName(modelFilename); } } } initialObjectCreationPage = new BaseModelWizardInitialObjectCreationPage("Whatever2"); initialObjectCreationPage.setTitle(BaseEditorPlugin.INSTANCE.getString("_UI_BaseModelWizard_label")); initialObjectCreationPage.setDescription(BaseEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description")); addPage(initialObjectCreationPage); } /** * Get the file from the page. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public IFile getModelFile() { return newFileCreationPage.getModelFile(); } }
[ "layornos@gmail.com" ]
layornos@gmail.com
0abf2340095f80448675891a5251cd610941f5ac
928259ebff8d7c5e1bef1d445b578d4dce38be8f
/app/src/test/java/my/edu/utem/myfacebook/ExampleUnitTest.java
75c197f9704861a80003868c8836a3ea1316718b
[]
no_license
fizzioren/android-myfacebook-utem
5a2800c142dbbbeb9257df765e1b32bec6a4284a
6ebcb28d7884d85cab218af88df0d4a1fb6025de
refs/heads/master
2020-03-27T08:20:24.292198
2018-08-27T04:06:05
2018-08-27T04:06:05
146,245,743
0
0
null
null
null
null
UTF-8
Java
false
false
383
java
package my.edu.utem.myfacebook; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "afeiz73@gmail.com" ]
afeiz73@gmail.com
6f87c917a55061f9b92b7ccbd3d5e1ee21f8b8f7
4c1d6f74635109519657921d98907bbdda811cb4
/chrome/android/java/src/org/chromium/chrome/browser/contacts_picker/TopView.java
15b3d2ab6426657df2fdffe5ca981efb7e664027
[ "BSD-3-Clause" ]
permissive
imfht/chromium
151e060f8acf3b91899f74eb88367ed545751d9a
468df33f9f87dfc052a026fd736d055fb2614909
refs/heads/master
2023-01-13T08:15:21.509899
2019-01-30T06:35:03
2019-01-30T06:35:03
168,294,038
0
0
BSD-3-Clause
2022-06-15T06:41:16
2019-01-30T06:51:02
null
UTF-8
Java
false
false
3,602
java
// Copyright 2019 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.contacts_picker; import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.RelativeLayout; import android.widget.TextView; import org.chromium.chrome.R; import java.text.NumberFormat; /** * A container class for the Disclaimer and Select All functionality (and both associated labels). */ public class TopView extends RelativeLayout implements CompoundButton.OnCheckedChangeListener { /** * An interface for communicating when the Select All checkbox is toggled. */ public interface SelectAllToggleCallback { /** * Called when the Select All checkbox is toggled. * @param allSelected Whether the Select All checkbox is checked. */ void onSelectAllToggled(boolean allSelected); } // The container box for the checkbox and its label and contact count. private View mCheckboxContainer; // The Select All checkbox. private CheckBox mSelectAllBox; // The label showing how many contacts were found. private TextView mContactCount; // The callback to use when notifying that the Select All checkbox was toggled. private SelectAllToggleCallback mSelectAllCallback; // Whether to temporarily ignore clicks on the checkbox. private boolean mIgnoreCheck; // The explanation string (explaining what is shared and with what site). private String mSiteString; public TopView(Context context, AttributeSet attrs) { super(context, attrs); // TODO(finnur): Plumb through the necessary data to show which website will be receiving // the contact data. mSiteString = context.getString(R.string.disclaimer_sharing_contact_details, "foo.com"); } @Override protected void onFinishInflate() { super.onFinishInflate(); mCheckboxContainer = findViewById(R.id.container); mSelectAllBox = findViewById(R.id.checkbox); mContactCount = findViewById(R.id.checkbox_details); TextView title = findViewById(R.id.checkbox_title); title.setText(R.string.contacts_picker_all_contacts); TextView explanation = findViewById(R.id.explanation); explanation.setText(mSiteString); } public void registerSelectAllCallback(SelectAllToggleCallback callback) { mSelectAllCallback = callback; } public void updateCheckboxVisibility(boolean visible) { if (visible) { mSelectAllBox.setOnCheckedChangeListener(this); } else { mCheckboxContainer.setVisibility(GONE); } } public void updateContactCount(int count) { mContactCount.setText(NumberFormat.getInstance().format(count)); } public void toggle() { mSelectAllBox.setChecked(!mSelectAllBox.isChecked()); } /** * Updates the state of the checkbox to reflect whether everything is selected. * @param allSelected */ public void updateSelectAllCheckbox(boolean allSelected) { mIgnoreCheck = true; mSelectAllBox.setChecked(allSelected); mIgnoreCheck = false; } @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { if (!mIgnoreCheck) mSelectAllCallback.onSelectAllToggled(mSelectAllBox.isChecked()); } }
[ "commit-bot@chromium.org" ]
commit-bot@chromium.org
4fc82725733a0c1e099a82c6e62ea6edc4f0eb14
c9b8db6ceff0be3420542d0067854dea1a1e7b12
/web/KoreanAir/src/main/java/com/ke/css/cimp/fwb/fwb17/Rule_Hid_InformID_ADR.java
2f510b537bb0420e83e8ca4a51153a7f810993ef
[ "Apache-2.0" ]
permissive
ganzijo/portfolio
12ae1531bd0f4d554c1fcfa7d68953d1c79cdf9a
a31834b23308be7b3a992451ab8140bef5a61728
refs/heads/master
2021-04-15T09:25:07.189213
2018-03-22T12:11:00
2018-03-22T12:11:00
126,326,291
0
0
null
null
null
null
UTF-8
Java
false
false
2,170
java
package com.ke.css.cimp.fwb.fwb17; /* ----------------------------------------------------------------------------- * Rule_Hid_InformID_ADR.java * ----------------------------------------------------------------------------- * * Producer : com.parse2.aparse.Parser 2.5 * Produced : Tue Mar 06 10:25:52 KST 2018 * * ----------------------------------------------------------------------------- */ import java.util.ArrayList; final public class Rule_Hid_InformID_ADR extends Rule { public Rule_Hid_InformID_ADR(String spelling, ArrayList<Rule> rules) { super(spelling, rules); } public Object accept(Visitor visitor) { return visitor.visit(this); } public static Rule_Hid_InformID_ADR parse(ParserContext context) { context.push("Hid_InformID_ADR"); boolean parsed = true; int s0 = context.index; ParserAlternative a0 = new ParserAlternative(s0); ArrayList<ParserAlternative> as1 = new ArrayList<ParserAlternative>(); parsed = false; { int s1 = context.index; ParserAlternative a1 = new ParserAlternative(s1); parsed = true; if (parsed) { boolean f1 = true; int c1 = 0; for (int i1 = 0; i1 < 3 && f1; i1++) { Rule rule = Rule_Typ_Alpha.parse(context); if ((f1 = rule != null)) { a1.add(rule, context.index); c1++; } } parsed = c1 == 3; } if (parsed) { as1.add(a1); } context.index = s1; } ParserAlternative b = ParserAlternative.getBest(as1); parsed = b != null; if (parsed) { a0.add(b.rules, b.end); context.index = b.end; } Rule rule = null; if (parsed) { rule = new Rule_Hid_InformID_ADR(context.text.substring(a0.start, a0.end), a0.rules); } else { context.index = s0; } context.pop("Hid_InformID_ADR", parsed); return (Rule_Hid_InformID_ADR)rule; } } /* ----------------------------------------------------------------------------- * eof * ----------------------------------------------------------------------------- */
[ "whdnfka111@gmail.com" ]
whdnfka111@gmail.com
31b93a49f68609534cb48f81f71dd2d9326ac0aa
59b3ec3392925c6ab0c9c0c73309166c842a1633
/activitystreambackendspringboot/src/main/java/com/niit/daoimpl/UserDAOImpl.java
2c0e61d68fcf6762d1569a80e336b7b0244f9d1d
[]
no_license
thrijita/ActivityStream_Boot
54bb6eec128f73c15be4e9ef978a4ba936ea534d
84b35d18e3ea2baaa0f768917c89278edea6dbe8
refs/heads/master
2021-05-12T19:34:37.277933
2018-01-22T10:55:00
2018-01-22T10:55:00
117,094,754
0
0
null
null
null
null
UTF-8
Java
false
false
2,391
java
package com.niit.daoimpl; import java.util.ArrayList; import java.util.List; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import com.niit.dao.UserDAO; import com.niit.model.UserModel; @Repository(value="userDAO") @Transactional public class UserDAOImpl implements UserDAO{ @Autowired private SessionFactory sessionFactory; public UserDAOImpl( ) { } public UserDAOImpl(SessionFactory sessionFactory) { this.sessionFactory=sessionFactory; } //one line code required @Override public UserModel findByName(String name) { // TODO Auto-generated method stub return null; } @Override public boolean insert(UserModel user) { try { sessionFactory.getCurrentSession().save(user); return true; } catch(Exception e) { return false; } } @Override public boolean updateUser(UserModel user) { try { sessionFactory.getCurrentSession().update(user); return true; } catch(Exception e) { return false; } } @Override public UserModel getuserById(int id) { // TODO Auto-generated method stub return null; } @Override public UserModel getuserbyEmail(String email) { UserModel user; user=(UserModel) sessionFactory.getCurrentSession().get(UserModel.class,email); return user; } @Override public List<UserModel> getAllusers() { List<UserModel> list=new ArrayList<UserModel>(); return list=sessionFactory.getCurrentSession().createQuery("from UserModel").list(); } @Override public boolean deleteUser(UserModel user) { try { sessionFactory.getCurrentSession().delete(user); return true; } catch(Exception e) { return false; } } @Override public boolean isUserExist(String name) { // TODO Auto-generated method stub return false; } @Override public boolean validateUser(String username, String password) { String sql="FROM UserModel where email='"+username+"' and password ='"+password+"'"; Query query = sessionFactory.getCurrentSession().createQuery(sql); UserModel user = (UserModel)query.uniqueResult(); if(user != null) { return true; } else { return false; } } }
[ "kthrijita@gmail.com" ]
kthrijita@gmail.com
4eb70876824a68056ffe55f5a3a7636a36e7bfa5
c7daaf317507328d986e4a492a5996188c009b50
/web-auth/auth-core/src/main/java/com/cloud/auth/core/service/AuthUserRoleService.java
ef6d05bbf8e2e03fd522972a061759ef04eb03be
[ "MIT" ]
permissive
weikanger/web
92b1d795c2c6fde970b68ac251b68a0c9b3ff625
2c0b6725862e334caf83567d270da5837dc1cfec
refs/heads/master
2022-04-13T20:54:50.569635
2020-04-11T14:37:08
2020-04-11T14:37:08
263,258,517
1
0
MIT
2020-05-12T06:59:44
2020-05-12T06:59:43
null
UTF-8
Java
false
false
331
java
package com.cloud.auth.core.service; import com.cloud.auth.entity.AuthUserRole; import com.cloud.common.base.BaseService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; /** * 用户角色关联 service */ @Slf4j @Service public class AuthUserRoleService extends BaseService<AuthUserRole> { }
[ "xuin23@outlook.com" ]
xuin23@outlook.com
b575dc64480479df2acf17e39ab0fdf6144c7694
40c1d2b4c4474c0d7f6f3517b03af743a6d159d0
/ix-lab04/src/ix/lab05/faces/PCAResult.java
40367440270989586ff971cb5da97f9122af6557
[]
no_license
paragonhao/internet-analytics
4e121f0b9f7a7817d668a56ceb358dc65a9c0b9b
378aee739ff7d81e29b2d48d66536f19a695cd85
refs/heads/master
2021-05-15T20:14:25.818906
2017-11-14T13:24:52
2017-11-14T13:24:52
107,844,757
0
0
null
null
null
null
UTF-8
Java
false
false
355
java
package ix.lab05.faces; import Jama.Matrix; /** Simple container class to store the results of a principal component analysis. */ public class PCAResult { public final Matrix rotation; public final double[] values; public PCAResult(Matrix rotation, double[] values) { this.rotation = rotation; this.values = values; } }
[ "wangxiahaosin@gmail.com" ]
wangxiahaosin@gmail.com
b63933eb1f3beb52c2e542528eae32a38a2e013b
67585ba8a0d0428f72651b6d4d109620cf1fdf3f
/Android/app/src/androidTest/java/edu/coloradomesa/cs/android/ModelTest.java
ed7bcd509f3259c5c1cd0b24ab2cbe61d979bc3a
[ "MIT" ]
permissive
wmacevoy/java-kotlin-wmacevoy-spring2020
564ef36fb2061a41c2a02a84d3c4af8f7ff14059
0af0170eeeb485ceae1ad6e88c420a93025d2ede
refs/heads/master
2023-01-21T09:24:38.157504
2020-12-03T19:00:09
2020-12-03T19:00:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,981
java
package edu.coloradomesa.cs.android; import android.content.Context; import android.os.Handler; import android.os.Looper; import androidx.lifecycle.SavedStateHandle; import androidx.test.platform.app.InstrumentationRegistry; import org.junit.Test; import static org.junit.Assert.*; public class ModelTest { Context getContext() { return InstrumentationRegistry.getInstrumentation().getTargetContext(); } Model getFakeModel() { return new Model(new SavedStateHandle()); } @Test public void center() throws Exception { Model model = getFakeModel(); assertEquals(Model.CENTER_DEFAULT, model.getCenter()); model.setCenter(ConstLatLng.GRAND_JUNCTION_CO_USA); setPause(); assertEquals(ConstLatLng.GRAND_JUNCTION_CO_USA,model.getCenter()); model.setCenter(ConstLatLng.SYDNEY_NSW_AUSTRALIA); setPause(); assertEquals(ConstLatLng.SYDNEY_NSW_AUSTRALIA,model.getCenter()); } @Test public void dashboard() throws Exception { Model model = getFakeModel(); assertEquals(Model.DASHBOARD_DEFAULT, model.getDashboardText()); model.setDashboardText("not " + Model.DASHBOARD_DEFAULT); setPause(); assertEquals("not " + Model.DASHBOARD_DEFAULT, model.getDashboardText()); } void setPause() throws Exception { if (!Looper.getMainLooper().isCurrentThread()) { final Boolean[] done = new Boolean[] { false }; new Handler(Looper.getMainLooper()).post(() -> done[0]=true); while (!done[0]) { Thread.sleep(100); } } } @Test public void notifications() throws Exception { Model model = getFakeModel(); assertEquals(Model.NOTIFICATIONS_DEFAULT, model.getNotificationsText()); model.setNotificationsText("not " + Model.NOTIFICATIONS_DEFAULT); setPause(); assertEquals("not " + Model.NOTIFICATIONS_DEFAULT, model.getNotificationsText()); } }
[ "wmacevoy@gmail.com" ]
wmacevoy@gmail.com
a9d54ae7d060376dc6ac7c601790962da5fe7765
bbae84f47e1353294a4a1851fc5fb91be2be17a8
/src/main/java/com/glqdlt/ex/springtesting/entity/Gender.java
71adfb9638bf2475d3d52581bbf5d265c528fa84
[]
no_license
glqdlt/ex-spring-testing
cd0863bbb0c4ccdf436c6abfd2d780f118fac3f2
b4c0b3f6b47b44503dd52906c696b92e5cf7cb41
refs/heads/master
2020-03-22T04:45:12.109784
2018-07-03T06:59:44
2018-07-03T06:59:44
139,518,614
0
0
null
null
null
null
UTF-8
Java
false
false
82
java
package com.glqdlt.ex.springtesting.entity; public enum Gender { Mali,Femail }
[ "dlfdnd0725@gmail.com" ]
dlfdnd0725@gmail.com
510ddb5d936908b2502ad3f324bb58d541747983
fc6c869ee0228497e41bf357e2803713cdaed63e
/weixin6519android1140/src/sourcecode/com/tencent/mm/plugin/appbrand/appcache/e.java
a7680fbdd5cc4c39c075247078fe22751ebc2e18
[]
no_license
hyb1234hi/reverse-wechat
cbd26658a667b0c498d2a26a403f93dbeb270b72
75d3fd35a2c8a0469dbb057cd16bca3b26c7e736
refs/heads/master
2020-09-26T10:12:47.484174
2017-11-16T06:54:20
2017-11-16T06:54:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
941
java
package com.tencent.mm.plugin.appbrand.appcache; import com.tencent.gmtrace.GMTrace; import com.tencent.mm.sdk.platformtools.w; public final class e { static int u(String paramString1, String paramString2, String paramString3) { GMTrace.i(19993609633792L, 148964); try { int i = WABSPatch.bspatch(paramString1, paramString2, paramString3); GMTrace.o(19993609633792L, 148964); return i; } catch (Exception localException) { w.e("MicroMsg.AppBrand.IncrementalPkgLogic[incremental]", "mergeDiffPkg e = %s, old[%s], new[%s], diff[%s]", new Object[] { localException, paramString1, paramString2, paramString3 }); GMTrace.o(19993609633792L, 148964); } return 1; } } /* Location: D:\tools\apktool\weixin6519android1140\jar\classes2-dex2jar.jar!\com\tencent\mm\plugin\appbrand\appcache\e.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "robert0825@gmail.com" ]
robert0825@gmail.com
fba90a4150da0453e505c579daffd7350a6c61db
363c936f4a89b7d3f5f4fb588e8ca20c527f6022
/AL-Game/src/com/aionemu/gameserver/skillengine/effect/SummonHomingEffect.java
7150897bf392935fb1c1f5343480505ab6603658
[]
no_license
G-Robson26/AionServer-4.9F
d628ccb4307aa0589a70b293b311422019088858
3376c78b8d90bd4d859a7cfc25c5edc775e51cbf
refs/heads/master
2023-09-04T00:46:47.954822
2017-08-09T13:23:03
2017-08-09T13:23:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,353
java
/** * This file is part of Aion-Lightning <aion-lightning.org>. * * Aion-Lightning 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. * * Aion-Lightning 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 Aion-Lightning. * If not, see <http://www.gnu.org/licenses/>. */ package com.aionemu.gameserver.skillengine.effect; import java.util.concurrent.Future; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlType; import com.aionemu.gameserver.ai2.event.AIEventType; import com.aionemu.gameserver.controllers.observer.ActionObserver; import com.aionemu.gameserver.controllers.observer.ObserverType; import com.aionemu.gameserver.model.TaskId; import com.aionemu.gameserver.model.gameobjects.Creature; import com.aionemu.gameserver.model.gameobjects.Homing; import com.aionemu.gameserver.model.templates.spawns.SpawnTemplate; import com.aionemu.gameserver.skillengine.SkillEngine; import com.aionemu.gameserver.skillengine.model.Effect; import com.aionemu.gameserver.spawnengine.SpawnEngine; import com.aionemu.gameserver.spawnengine.VisibleObjectSpawner; import com.aionemu.gameserver.utils.ThreadPoolManager; /** * @author ATracer * @modified Kill3r */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "SummonHomingEffect") public class SummonHomingEffect extends SummonEffect { @XmlAttribute(name = "npc_count", required = true) protected int npcCount; @XmlAttribute(name = "attack_count", required = true) protected int attackCount; @XmlAttribute(name = "skill_id", required = false) protected int skillId; @Override public void applyEffect(Effect effect) { final Creature effected = effect.getEffected(); final Creature effector = effect.getEffector(); float x = effector.getX(); float y = effector.getY(); float z = effector.getZ(); byte heading = effector.getHeading(); int worldId = effector.getWorldId(); int instanceId = effector.getInstanceId(); for (int i = 0; i < npcCount; i++) { SpawnTemplate spawn = SpawnEngine.addNewSingleTimeSpawn(worldId, npcId, x, y, z, heading); final Homing homing = VisibleObjectSpawner.spawnHoming(spawn, instanceId, effector, attackCount, effect.getSkillId(), effect.getSkillLevel(), skillId); if (attackCount > 0) { ActionObserver observer = new ActionObserver(ObserverType.ATTACK) { @Override public void attack(Creature creature) { homing.setAttackCount(homing.getAttackCount() - 1); if(skillId != 0){ SkillEngine.getInstance().applyEffectDirectly(skillId, effector, effected, 0); } if (homing.getAttackCount() <= 0) { homing.getController().onDelete(); } } }; homing.getObserveController().addObserver(observer); effect.setActionObserver(observer, position); } // Schedule a despawn just in case Future<?> task = ThreadPoolManager.getInstance().schedule(new Runnable() { @Override public void run() { if ((homing != null) && (homing.isSpawned())) { homing.getController().onDelete(); } } }, 15 * 1000); homing.getController().addTask(TaskId.DESPAWN, task); homing.getAi2().onCreatureEvent(AIEventType.ATTACK, effect.getEffected()); } } }
[ "falke34@a70f7278-c47d-401d-a0e4-c9401b7f63ed" ]
falke34@a70f7278-c47d-401d-a0e4-c9401b7f63ed
c4f8ef6d303f2bd95b584750db20735464f0d7c0
657f736d86e6439a2db87f18fe8bd9e1217a4182
/src/main/java/recuperatorio/ejercicio01/Practica.java
ee220c8e75a2c1ca19e046b204b556ab8f345154
[]
no_license
stuma/recuperatorio
ff9e4b5dbd56589688473e11ee1adae46c02215e
ef808a51c3dafede707c44265c9797886aa04ab7
refs/heads/master
2022-10-26T18:01:18.071313
2020-06-15T15:59:12
2020-06-15T15:59:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
921
java
package recuperatorio.ejercicio01; public class Practica { private String descripcion; private long codigoNumerico; private float costoPractica; public Practica(String descripcion, long codigoNumerico, float costoPractica) { this.descripcion = descripcion; this.codigoNumerico = codigoNumerico; this.costoPractica = costoPractica; } public String getDescripcion() { return descripcion; } public void setDescripcion(String descripcion) { this.descripcion = descripcion; } public long getCodigoNumerico() { return codigoNumerico; } public void setCodigoNumerico(long codigoNumerico) { this.codigoNumerico = codigoNumerico; } public float getCostoPractica() { return costoPractica; } public void setCostoPractica(float costoPractica) { this.costoPractica = costoPractica; } }
[ "seba.tuma@gmail.com" ]
seba.tuma@gmail.com
f0267ffbf091b279c11b8e3e8cf4b19ceb23abd2
7204abbbd6f9894b467855bf6684f9bb84fe2f4e
/sc-order/src/main/java/com/architect/feign/impl/DefaultUserServiceImpl.java
20fa8c931e7801d4233503c28cdb181078fc21ed
[]
no_license
WilliamJiaCN/springcloud
4310934b8049cb1512c5021a4a0f378dae102f4c
062ac7c109dcafb88f4d467f40ccf076b9ca66e8
refs/heads/master
2020-03-24T10:32:37.298574
2018-08-19T14:09:33
2018-08-19T14:09:33
142,659,709
0
0
null
null
null
null
UTF-8
Java
false
false
512
java
package com.architect.feign.impl; import com.architect.api.dto.User; import com.architect.feign.UserService; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; /** * @author wenxiong.jia * @since 2018/8/8 */ @Service public class DefaultUserServiceImpl implements UserService { @Override public User getUserById(Long id) { return new User(); } @Override public List<User> getUserList() { return new ArrayList<>(); } }
[ "jiawenxiong@newbeescm.com" ]
jiawenxiong@newbeescm.com
d078e6d8ae36e99fa364770acd1ab4b08477a914
ee4d32d5aa0c890f994850d8648297677dbf70b0
/app/src/main/java/com/decimals/stuhub/UploadActivity.java
f7ef87dba4533e8de898f536c615d1c35287fe9f
[]
no_license
SunilKeshri1998/StuHub
4a51ed38baaeb428ccf1dea5bd6e87ceb98bc8e5
5280b69c4d2d2579030576d6c9ddc7650b3dd4b1
refs/heads/master
2020-08-03T03:29:17.700731
2019-09-29T06:08:13
2019-09-29T06:08:13
211,612,060
0
0
null
null
null
null
UTF-8
Java
false
false
17,303
java
package com.decimals.stuhub; import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.OpenableColumns; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.WindowManager; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.ListAdapter; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.OnProgressListener; import com.google.firebase.storage.StorageReference; import com.google.firebase.storage.StorageTask; import com.google.firebase.storage.UploadTask; import java.io.File; public class UploadActivity extends AppCompatActivity { private static final int PICK_FILE_REQUEST = 1; AutoCompleteTextView branch_text; AutoCompleteTextView subject_text; TextView textview_branch;//uploading file layout TextView textview_subject;//uploading file layout EditText description; String description_text; String selected_branch; String selected_subject; String downloadlink; String fileName; DatabaseReference rootRef = FirebaseDatabase.getInstance().getReference(); DatabaseReference Ref = rootRef.child("files").push(); String user_name; String user_uid; double progress_percent; private FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); private android.support.v7.widget.Toolbar mToolbar; private LinearLayout mainlayout; private LinearLayout fileselectlayout; private Uri fileUri; private Button select_file_btn; private Button file_pause_btn; private Button file_cancel_btn; private StorageTask storageTask; private TextView filename_label; private ProgressBar progress; private TextView size_label; private TextView progess_label; private StorageReference mStorageRef; private DatabaseReference branchRef = rootRef.child("branch"); private String subject_arr[]; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_upload); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); //currentuser if (user != null) { user_name = user.getDisplayName(); user_uid = user.getUid(); } //tootlbar mToolbar = (android.support.v7.widget.Toolbar) findViewById(R.id.uploadActivity_toolbar); setSupportActionBar(mToolbar); getSupportActionBar().setTitle("Upload"); getSupportActionBar().setDisplayHomeAsUpEnabled(true); String branch_arr[] = getResources().getStringArray(R.array.branch); branch_text = (AutoCompleteTextView) findViewById(R.id.text_branch); final ArrayAdapter<String> branch_adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, branch_arr); branch_text.setAdapter(branch_adapter); branch_text.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean b) { if (!b) { // on focus off String str = branch_text.getText().toString(); ListAdapter listAdapter = branch_text.getAdapter(); for (int i = 0; i < listAdapter.getCount(); i++) { String temp = listAdapter.getItem(i).toString(); if (str.compareTo(temp) == 0) { return; } } branch_text.setText(null); } } }); // if (selected_branch != null && !selected_branch.isEmpty()) { branch_text.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { selected_branch = branch_adapter.getItem(i).toString(); if (selected_branch.equals("Computer Science and Engineering")) { subject_arr = getResources().getStringArray(R.array.branch_cse); } else if (selected_branch.equals("Electrical and Communication Engineering")) { subject_arr = getResources().getStringArray(R.array.branch_ece); } else if (selected_branch.equals("Electrical and Electronics Engineering")) { subject_arr = getResources().getStringArray(R.array.branch_eee); } else if (selected_branch.equals("Mechanical Engineering")) { subject_arr = getResources().getStringArray(R.array.branch_me); } else if (selected_branch.equals("Civil Engineering")) { subject_arr = getResources().getStringArray(R.array.branch_ce); } else if (selected_branch.equals("Metallurgical and Materials Engineering")) { subject_arr = getResources().getStringArray(R.array.branch_mme); } else if (selected_branch.equals("Manufacturing Engineering")) { subject_arr = getResources().getStringArray(R.array.branch_mfe); } else if (selected_branch.equals("Others")) { subject_arr = getResources().getStringArray(R.array.branch_others); } subject_text = (AutoCompleteTextView) findViewById(R.id.text_subject); final ArrayAdapter<String> subject_adapter = new ArrayAdapter<String>(UploadActivity.this, android.R.layout.simple_list_item_1, subject_arr); subject_text.setAdapter(subject_adapter); subject_text.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean b) { if (!b) { // on focus off String str = subject_text.getText().toString(); ListAdapter listAdapter = subject_text.getAdapter(); for (int i = 0; i < listAdapter.getCount(); i++) { String temp = listAdapter.getItem(i).toString(); if (str.compareTo(temp) == 0) { return; } } branch_text.setText(null); subject_text.setText(null); } } }); subject_text.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { selected_subject = subject_adapter.getItem(i).toString(); } }); } }); // } mStorageRef = FirebaseStorage.getInstance().getReference(); select_file_btn = (Button) findViewById(R.id.select_file_btn); select_file_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { //// if (selected_branch != null && !selected_branch.isEmpty() && selected_subject != null && !selected_subject.isEmpty()) { //// recreate(); // } // else{ choose_file(); } }); mainlayout = (LinearLayout) this.findViewById(R.id.upload_file_layout); fileselectlayout = (LinearLayout) this.findViewById(R.id.file_select_layout); filename_label = (TextView) findViewById(R.id.filename_label); progress = (ProgressBar) findViewById(R.id.progressBar); size_label = (TextView) findViewById(R.id.size_label); progess_label = (TextView) findViewById(R.id.progress_label); textview_branch = (TextView) findViewById(R.id.textview_branch); textview_subject = (TextView) findViewById(R.id.textview_subject); description = (EditText) findViewById(R.id.description); file_cancel_btn = (Button) findViewById(R.id.file_cancel_btn); file_cancel_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { storageTask.cancel(); Toast.makeText(UploadActivity.this, "Upload Task Canceled!", Toast.LENGTH_SHORT).show(); } }); file_pause_btn = (Button) findViewById(R.id.file_pause_btn); file_pause_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String btnText = file_pause_btn.getText().toString(); if (btnText.equals("Pause Upload")) { storageTask.pause(); file_pause_btn.setText("Resume Upload"); } else { storageTask.resume(); file_pause_btn.setText("Pause Upload"); } } }); } @Override public void onBackPressed() { Intent intent = new Intent(UploadActivity.this, MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } private void choose_file() { if (selected_branch != null && !selected_branch.isEmpty() && selected_subject != null && !selected_subject.isEmpty()) { Intent intent = new Intent(); intent.setType("*/*"); intent.setAction(Intent.ACTION_GET_CONTENT); try { startActivityForResult( intent.createChooser(intent, "select a file"), PICK_FILE_REQUEST); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(this, "Please install a file manager", Toast.LENGTH_SHORT).show(); } } else { Toast.makeText(this, "Please select branch and subject for which you want to upload the file", Toast.LENGTH_SHORT).show(); return; } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); fileName = null; if (requestCode == PICK_FILE_REQUEST && resultCode == RESULT_OK && data != null && data.getData() != null) { //file_is_selected //show_the_hidden_layout mainlayout.setVisibility(LinearLayout.VISIBLE); fileselectlayout.setVisibility(LinearLayout.GONE); getSupportActionBar().setTitle("Uploading"); //now enable the cancel and pause btn file_pause_btn.setEnabled(true); file_cancel_btn.setEnabled(true); fileUri = data.getData(); String uristring = fileUri.toString(); File myfile = new File(uristring); fileName = null; if (uristring.startsWith("content://")) { Cursor cursor = null; try { cursor = UploadActivity.this.getContentResolver().query(fileUri, null, null, null, null); if (cursor != null && cursor.moveToFirst()) { fileName = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)).toLowerCase(); } } finally { cursor.close(); } } else if (uristring.startsWith("file://")) { fileName = myfile.getName().toLowerCase(); } filename_label.setText(fileName); textview_branch.setText(selected_branch); textview_subject.setText(selected_subject); Toast.makeText(this, "Uploading file", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(this, "No file selected", Toast.LENGTH_SHORT).show(); return; } description_text = description.getText().toString(); String filename_key = Ref.getKey(); final DatabaseReference subRef = branchRef.child(selected_branch + "/" + selected_subject + "/" + filename_key); StorageReference riversRef = mStorageRef.child("branch/" + selected_branch + "/" + selected_subject + "/" + filename_key + fileName); storageTask = riversRef.putFile(fileUri) .addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() { @Override public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) { // Get a URL to the uploaded content Uri downloadUrl = taskSnapshot.getUploadSessionUri(); Toast.makeText(UploadActivity.this, "File Uploaded!", Toast.LENGTH_SHORT).show(); recreate(); branch_text.setText(""); subject_text.setText(""); description.setText(""); //file_is_uploaded //now disable the cancel and pause btn file_pause_btn.setEnabled(false); file_cancel_btn.setEnabled(false); downloadlink = downloadUrl.toString(); // String lower_fileName=fileName.toLowerCase(); Ref.child("displayName").setValue(fileName); Ref.child("description").setValue(description_text); Ref.child("downloadUrl").setValue(downloadlink); Ref.child("uploaderUid").setValue(user_uid); Ref.child("uploaderName").setValue(user_name); //write in branch section , the details of file subRef.child("displayName").setValue(fileName); subRef.child("description").setValue(description_text); subRef.child("downloadUrl").setValue(downloadlink); subRef.child("uploaderUid").setValue(user_uid); subRef.child("uploaderName").setValue(user_name); } }) .addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception exception) { // Handle unsuccessful uploads // ... Toast.makeText(UploadActivity.this, "File not Uploaded!", Toast.LENGTH_SHORT).show(); recreate(); branch_text.setText(""); subject_text.setText(""); description.setText(""); } }) .addOnProgressListener(new OnProgressListener<UploadTask.TaskSnapshot>() { @Override public void onProgress(UploadTask.TaskSnapshot taskSnapshot) { mainlayout.setVisibility(LinearLayout.VISIBLE); fileselectlayout.setVisibility(LinearLayout.GONE); progress_percent = (100.0 * taskSnapshot.getBytesTransferred() / taskSnapshot.getTotalByteCount()); progress.setProgress((int) progress_percent); String progresstext = taskSnapshot.getBytesTransferred() / (1024) + "/" + taskSnapshot.getTotalByteCount() / (1024) + " KB";//1024*1024 size_label.setText(progresstext); progess_label.setText((int) progress_percent + "%"); } }); } public void launchProfile(View view) { Intent intent = new Intent(UploadActivity.this, ProfileActivity.class); startActivity(intent); } public void launchDownload(View view) { startActivity(new Intent(UploadActivity.this, SearchActivity.class)); } public void launchUpload(View view) { } public void launchAbout(View view) { startActivity(new Intent(UploadActivity.this, AboutActivity.class)); } public void launchHome(View view) { Intent intent = new Intent(UploadActivity.this, MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } }
[ "sukuke.nitjsr@gmail.com" ]
sukuke.nitjsr@gmail.com
692ebd252a7294dcf102dd2b09aecd2ff174c8ea
5ce000bf85d5859d6cb6f41c90803a7d8796c3e3
/src/practice05_4/Duck.java
9e53edaef1799166ac893fb438f8b11f85b91d3b
[]
no_license
percussion8/re-
c3365632fa9476d0244c16ba938bf86813b15eef
8dd006f7c86407a516730e1974b503dfffbdc67e
refs/heads/master
2022-12-04T07:11:42.081544
2020-08-12T02:24:06
2020-08-12T02:24:06
286,882,965
0
0
null
2020-08-12T01:08:31
2020-08-12T01:08:31
null
UTF-8
Java
false
false
180
java
package practice05_4; public class Duck implements Soundable { @Override public String sound() { // TODO Auto-generated method stub return "꽥꽥"; } }
[ "ms960315@gmail.com" ]
ms960315@gmail.com
16f5065f5579aff7f0f6e6e04f4da7c6f89fb6a1
c30d4f174a28aac495463f44b496811ee0c21265
/platform/vcs-api/src/com/intellij/util/ProducerConsumer.java
01a89140185361f42535a62456ad1f83aad7812a
[ "Apache-2.0" ]
permissive
sarvex/intellij-community
cbbf08642231783c5b46ef2d55a29441341a03b3
8b8c21f445550bd72662e159ae715e9d944ba140
refs/heads/master
2023-05-14T14:32:51.014859
2023-05-01T06:59:21
2023-05-01T06:59:21
32,571,446
0
0
Apache-2.0
2023-05-01T06:59:22
2015-03-20T08:16:17
Java
UTF-8
Java
false
false
3,381
java
/* * Copyright 2000-2011 JetBrains s.r.o. * * 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.intellij.util; import com.intellij.openapi.application.ApplicationManager; import com.intellij.util.concurrency.Semaphore; import java.util.ArrayDeque; /** * @author irengrig * Date: 7/5/11 * Time: 1:48 AM */ public class ProducerConsumer<T> { public static final int ourDefaultMaxSize = 20; private final ArrayDeque<T> myQueue; private final Consumer<T> myConsumer; private final int myMaxSize; private final Object myLock; private final ConsumerRunnable myConsumerThread; private boolean myIsAlive; public ProducerConsumer(final Consumer<T> consumer) { this(consumer, ourDefaultMaxSize); } public void start() { myIsAlive = true; myConsumerThread.start(); } public void stop() { synchronized (myLock) { myIsAlive = false; myLock.notifyAll(); } } public ProducerConsumer(final Consumer<T> consumer, final int maxSize) { this(consumer, maxSize, false); } public ProducerConsumer(final Consumer<T> consumer, final int maxSize, final boolean onPooledThread) { myConsumer = consumer; myQueue = new ArrayDeque<T>(); myMaxSize = maxSize; myLock = new Object(); if (onPooledThread) { myConsumerThread = new PooledConsumerRunnable(); ApplicationManager.getApplication().executeOnPooledThread(myConsumerThread); } else { myConsumerThread = new ConsumerRunnable(); } } private class PooledConsumerRunnable extends ConsumerRunnable { private final Semaphore mySemaphore; private PooledConsumerRunnable() { mySemaphore = new Semaphore(); mySemaphore.down(); } public void start() { mySemaphore.up(); } @Override protected void waitForStart() { mySemaphore.waitFor(); } } private class ConsumerRunnable implements Runnable { private Thread myThread; public void start() { myThread.start(); } public void setThread(Thread thread) { myThread = thread; } @Override public void run() { waitForStart(); synchronized (myLock) { while (myIsAlive) { if (! myQueue.isEmpty()) { myConsumer.consume(myQueue.removeFirst()); } else { try { myLock.wait(10); } catch (InterruptedException e) { // } } } } } protected void waitForStart() { } } public void produce(final T t) { synchronized (myLock) { while (myQueue.size() >= myMaxSize) { try { myLock.notifyAll(); myLock.wait(10); } catch (InterruptedException e) { // } } myQueue.addLast(t); myLock.notifyAll(); } } }
[ "Irina.Chernushina@jetbrains.com" ]
Irina.Chernushina@jetbrains.com
bb34c5f4c0ca7c5545a40187fccbb1202130ffe4
fd4d52a73f6e5469554a40f43ff7bc1b072dbe99
/TwoSML/TwoSML.editor/src/Twosml/twosml/presentation/TwoSMLEditorPlugin.java
975dcb68d57d2892ee0b2249240aa6dc6728a93f
[]
no_license
leandroaf/2SVM-2SML
a217e457c1de5d686afb8139cde3f37209b450c9
3197fcdfe9e7c7725ed164b744cd94d654be4334
refs/heads/master
2020-04-29T13:07:29.680068
2019-03-17T21:25:44
2019-03-17T21:25:44
176,159,134
1
0
null
null
null
null
UTF-8
Java
false
false
1,833
java
/** */ package Twosml.twosml.presentation; import org.eclipse.emf.common.EMFPlugin; import org.eclipse.emf.common.ui.EclipseUIPlugin; import org.eclipse.emf.common.util.ResourceLocator; /** * This is the central singleton for the TwoSML editor plugin. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public final class TwoSMLEditorPlugin extends EMFPlugin { /** * Keep track of the singleton. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final TwoSMLEditorPlugin INSTANCE = new TwoSMLEditorPlugin(); /** * Keep track of the singleton. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static Implementation plugin; /** * Create the instance. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public TwoSMLEditorPlugin() { super (new ResourceLocator [] { }); } /** * Returns the singleton instance of the Eclipse plugin. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the singleton instance. * @generated */ @Override public ResourceLocator getPluginResourceLocator() { return plugin; } /** * Returns the singleton instance of the Eclipse plugin. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the singleton instance. * @generated */ public static Implementation getPlugin() { return plugin; } /** * The actual implementation of the Eclipse <b>Plugin</b>. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static class Implementation extends EclipseUIPlugin { /** * Creates an instance. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Implementation() { super(); // Remember the static instance. // plugin = this; } } }
[ "root@iMac-de-Leandro.local" ]
root@iMac-de-Leandro.local
9ef992b9735d990023c879eb9f73b559b3dacf0d
c0ebdbd2c8e5dd2f5a00ed625631e42145ea9e40
/src/com/company/Exircises/Exercise8.java
f737240d33be6a3759330bf921d14d8d2838a6df
[]
no_license
DorozhynskaNadiia/Java_Exercises
ffe626bcbf409d26e14219d7bb3f3ccd2ed3c946
26b93c9ce5173e82a0c81067dc06524a76843385
refs/heads/master
2021-05-02T16:11:53.588794
2018-04-21T17:57:14
2018-04-21T17:57:14
120,671,162
0
0
null
null
null
null
UTF-8
Java
false
false
491
java
package com.company.Exircises; import com.company.BaseExercise; public class Exercise8 extends BaseExercise { public static void Run() { String exerciseName = "Exercise8"; StartExercise(exerciseName); System.out.println(" J a v v a"); System.out.println(" J a a v v a a"); System.out.println("J J aaaaa V V aaaaa"); System.out.println(" JJ a a V a a"); FinishExercise(exerciseName); } }
[ "dorozhynska.nadia@gmail.com" ]
dorozhynska.nadia@gmail.com
bf01301097af27df5cfa09ba196372366e498ff1
1201983ea3ed42014de85d9134f7174fe77f3f35
/yuicompressor-2.4.2/rhino1_6R7/src/org/yuimozilla/javascript/NativeDate.java
002464aa745bd71492c29d37c99ff52fb1919497
[ "BSD-3-Clause" ]
permissive
thegreatape/slim
f398175a2b0b6a39c0ab5103e8904c19591b5534
b188c1a0a10871d9654b41487050afe794e6d974
refs/heads/master
2016-09-05T17:02:01.575534
2009-08-07T14:53:54
2009-08-07T14:53:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
56,086
java
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-1999 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Peter Annema * Norris Boyd * Mike McCabe * Ilya Frank * * * Alternatively, the contents of this file may be used under the terms of * the GNU General Public License Version 2 or later (the "GPL"), in which * case the provisions of the GPL are applicable instead of those above. If * you wish to allow use of your version of this file only under the terms of * the GPL and not to allow others to use your version of this file under the * MPL, indicate your decision by deleting the provisions above and replacing * them with the notice and other provisions required by the GPL. If you do * not delete the provisions above, a recipient may use your version of this * file under either the MPL or the GPL. * * ***** END LICENSE BLOCK ***** */ package org.yuimozilla.javascript; import java.util.Date; import java.text.DateFormat; /** * This class implements the Date native object. * See ECMA 15.9. * @author Mike McCabe */ final class NativeDate extends IdScriptableObject { static final long serialVersionUID = -8307438915861678966L; private static final Object DATE_TAG = new Object(); private static final String js_NaN_date_str = "Invalid Date"; static void init(Scriptable scope, boolean sealed) { NativeDate obj = new NativeDate(); // Set the value of the prototype Date to NaN ('invalid date'); obj.date = ScriptRuntime.NaN; obj.exportAsJSClass(MAX_PROTOTYPE_ID, scope, sealed); } private NativeDate() { if (thisTimeZone == null) { // j.u.TimeZone is synchronized, so setting class statics from it // should be OK. thisTimeZone = java.util.TimeZone.getDefault(); LocalTZA = thisTimeZone.getRawOffset(); } } public String getClassName() { return "Date"; } public Object getDefaultValue(Class typeHint) { if (typeHint == null) typeHint = ScriptRuntime.StringClass; return super.getDefaultValue(typeHint); } double getJSTimeValue() { return date; } protected void fillConstructorProperties(IdFunctionObject ctor) { addIdFunctionProperty(ctor, DATE_TAG, ConstructorId_now, "now", 0); addIdFunctionProperty(ctor, DATE_TAG, ConstructorId_parse, "parse", 1); addIdFunctionProperty(ctor, DATE_TAG, ConstructorId_UTC, "UTC", 1); super.fillConstructorProperties(ctor); } protected void initPrototypeId(int id) { String s; int arity; switch (id) { case Id_constructor: arity=1; s="constructor"; break; case Id_toString: arity=0; s="toString"; break; case Id_toTimeString: arity=0; s="toTimeString"; break; case Id_toDateString: arity=0; s="toDateString"; break; case Id_toLocaleString: arity=0; s="toLocaleString"; break; case Id_toLocaleTimeString: arity=0; s="toLocaleTimeString"; break; case Id_toLocaleDateString: arity=0; s="toLocaleDateString"; break; case Id_toUTCString: arity=0; s="toUTCString"; break; case Id_toSource: arity=0; s="toSource"; break; case Id_valueOf: arity=0; s="valueOf"; break; case Id_getTime: arity=0; s="getTime"; break; case Id_getYear: arity=0; s="getYear"; break; case Id_getFullYear: arity=0; s="getFullYear"; break; case Id_getUTCFullYear: arity=0; s="getUTCFullYear"; break; case Id_getMonth: arity=0; s="getMonth"; break; case Id_getUTCMonth: arity=0; s="getUTCMonth"; break; case Id_getDate: arity=0; s="getDate"; break; case Id_getUTCDate: arity=0; s="getUTCDate"; break; case Id_getDay: arity=0; s="getDay"; break; case Id_getUTCDay: arity=0; s="getUTCDay"; break; case Id_getHours: arity=0; s="getHours"; break; case Id_getUTCHours: arity=0; s="getUTCHours"; break; case Id_getMinutes: arity=0; s="getMinutes"; break; case Id_getUTCMinutes: arity=0; s="getUTCMinutes"; break; case Id_getSeconds: arity=0; s="getSeconds"; break; case Id_getUTCSeconds: arity=0; s="getUTCSeconds"; break; case Id_getMilliseconds: arity=0; s="getMilliseconds"; break; case Id_getUTCMilliseconds: arity=0; s="getUTCMilliseconds"; break; case Id_getTimezoneOffset: arity=0; s="getTimezoneOffset"; break; case Id_setTime: arity=1; s="setTime"; break; case Id_setMilliseconds: arity=1; s="setMilliseconds"; break; case Id_setUTCMilliseconds: arity=1; s="setUTCMilliseconds"; break; case Id_setSeconds: arity=2; s="setSeconds"; break; case Id_setUTCSeconds: arity=2; s="setUTCSeconds"; break; case Id_setMinutes: arity=3; s="setMinutes"; break; case Id_setUTCMinutes: arity=3; s="setUTCMinutes"; break; case Id_setHours: arity=4; s="setHours"; break; case Id_setUTCHours: arity=4; s="setUTCHours"; break; case Id_setDate: arity=1; s="setDate"; break; case Id_setUTCDate: arity=1; s="setUTCDate"; break; case Id_setMonth: arity=2; s="setMonth"; break; case Id_setUTCMonth: arity=2; s="setUTCMonth"; break; case Id_setFullYear: arity=3; s="setFullYear"; break; case Id_setUTCFullYear: arity=3; s="setUTCFullYear"; break; case Id_setYear: arity=1; s="setYear"; break; default: throw new IllegalArgumentException(String.valueOf(id)); } initPrototypeMethod(DATE_TAG, id, s, arity); } public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { if (!f.hasTag(DATE_TAG)) { return super.execIdCall(f, cx, scope, thisObj, args); } int id = f.methodId(); switch (id) { case ConstructorId_now: return ScriptRuntime.wrapNumber(now()); case ConstructorId_parse: { String dataStr = ScriptRuntime.toString(args, 0); return ScriptRuntime.wrapNumber(date_parseString(dataStr)); } case ConstructorId_UTC: return ScriptRuntime.wrapNumber(jsStaticFunction_UTC(args)); case Id_constructor: { // if called as a function, just return a string // representing the current time. if (thisObj != null) return date_format(now(), Id_toString); return jsConstructor(args); } } // The rest of Date.prototype methods require thisObj to be Date if (!(thisObj instanceof NativeDate)) throw incompatibleCallError(f); NativeDate realThis = (NativeDate)thisObj; double t = realThis.date; switch (id) { case Id_toString: case Id_toTimeString: case Id_toDateString: if (t == t) { return date_format(t, id); } return js_NaN_date_str; case Id_toLocaleString: case Id_toLocaleTimeString: case Id_toLocaleDateString: if (t == t) { return toLocale_helper(t, id); } return js_NaN_date_str; case Id_toUTCString: if (t == t) { return js_toUTCString(t); } return js_NaN_date_str; case Id_toSource: return "(new Date("+ScriptRuntime.toString(t)+"))"; case Id_valueOf: case Id_getTime: return ScriptRuntime.wrapNumber(t); case Id_getYear: case Id_getFullYear: case Id_getUTCFullYear: if (t == t) { if (id != Id_getUTCFullYear) t = LocalTime(t); t = YearFromTime(t); if (id == Id_getYear) { if (cx.hasFeature(Context.FEATURE_NON_ECMA_GET_YEAR)) { if (1900 <= t && t < 2000) { t -= 1900; } } else { t -= 1900; } } } return ScriptRuntime.wrapNumber(t); case Id_getMonth: case Id_getUTCMonth: if (t == t) { if (id == Id_getMonth) t = LocalTime(t); t = MonthFromTime(t); } return ScriptRuntime.wrapNumber(t); case Id_getDate: case Id_getUTCDate: if (t == t) { if (id == Id_getDate) t = LocalTime(t); t = DateFromTime(t); } return ScriptRuntime.wrapNumber(t); case Id_getDay: case Id_getUTCDay: if (t == t) { if (id == Id_getDay) t = LocalTime(t); t = WeekDay(t); } return ScriptRuntime.wrapNumber(t); case Id_getHours: case Id_getUTCHours: if (t == t) { if (id == Id_getHours) t = LocalTime(t); t = HourFromTime(t); } return ScriptRuntime.wrapNumber(t); case Id_getMinutes: case Id_getUTCMinutes: if (t == t) { if (id == Id_getMinutes) t = LocalTime(t); t = MinFromTime(t); } return ScriptRuntime.wrapNumber(t); case Id_getSeconds: case Id_getUTCSeconds: if (t == t) { if (id == Id_getSeconds) t = LocalTime(t); t = SecFromTime(t); } return ScriptRuntime.wrapNumber(t); case Id_getMilliseconds: case Id_getUTCMilliseconds: if (t == t) { if (id == Id_getMilliseconds) t = LocalTime(t); t = msFromTime(t); } return ScriptRuntime.wrapNumber(t); case Id_getTimezoneOffset: if (t == t) { t = (t - LocalTime(t)) / msPerMinute; } return ScriptRuntime.wrapNumber(t); case Id_setTime: t = TimeClip(ScriptRuntime.toNumber(args, 0)); realThis.date = t; return ScriptRuntime.wrapNumber(t); case Id_setMilliseconds: case Id_setUTCMilliseconds: case Id_setSeconds: case Id_setUTCSeconds: case Id_setMinutes: case Id_setUTCMinutes: case Id_setHours: case Id_setUTCHours: t = makeTime(t, args, id); realThis.date = t; return ScriptRuntime.wrapNumber(t); case Id_setDate: case Id_setUTCDate: case Id_setMonth: case Id_setUTCMonth: case Id_setFullYear: case Id_setUTCFullYear: t = makeDate(t, args, id); realThis.date = t; return ScriptRuntime.wrapNumber(t); case Id_setYear: { double year = ScriptRuntime.toNumber(args, 0); if (year != year || Double.isInfinite(year)) { t = ScriptRuntime.NaN; } else { if (t != t) { t = 0; } else { t = LocalTime(t); } if (year >= 0 && year <= 99) year += 1900; double day = MakeDay(year, MonthFromTime(t), DateFromTime(t)); t = MakeDate(day, TimeWithinDay(t)); t = internalUTC(t); t = TimeClip(t); } } realThis.date = t; return ScriptRuntime.wrapNumber(t); default: throw new IllegalArgumentException(String.valueOf(id)); } } /* ECMA helper functions */ private static final double HalfTimeDomain = 8.64e15; private static final double HoursPerDay = 24.0; private static final double MinutesPerHour = 60.0; private static final double SecondsPerMinute = 60.0; private static final double msPerSecond = 1000.0; private static final double MinutesPerDay = (HoursPerDay * MinutesPerHour); private static final double SecondsPerDay = (MinutesPerDay * SecondsPerMinute); private static final double SecondsPerHour = (MinutesPerHour * SecondsPerMinute); private static final double msPerDay = (SecondsPerDay * msPerSecond); private static final double msPerHour = (SecondsPerHour * msPerSecond); private static final double msPerMinute = (SecondsPerMinute * msPerSecond); private static double Day(double t) { return Math.floor(t / msPerDay); } private static double TimeWithinDay(double t) { double result; result = t % msPerDay; if (result < 0) result += msPerDay; return result; } private static boolean IsLeapYear(int year) { return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0); } /* math here has to be f.p, because we need * floor((1968 - 1969) / 4) == -1 */ private static double DayFromYear(double y) { return ((365 * ((y)-1970) + Math.floor(((y)-1969)/4.0) - Math.floor(((y)-1901)/100.0) + Math.floor(((y)-1601)/400.0))); } private static double TimeFromYear(double y) { return DayFromYear(y) * msPerDay; } private static int YearFromTime(double t) { int lo = (int) Math.floor((t / msPerDay) / 366) + 1970; int hi = (int) Math.floor((t / msPerDay) / 365) + 1970; int mid; /* above doesn't work for negative dates... */ if (hi < lo) { int temp = lo; lo = hi; hi = temp; } /* Use a simple binary search algorithm to find the right year. This seems like brute force... but the computation of hi and lo years above lands within one year of the correct answer for years within a thousand years of 1970; the loop below only requires six iterations for year 270000. */ while (hi > lo) { mid = (hi + lo) / 2; if (TimeFromYear(mid) > t) { hi = mid - 1; } else { lo = mid + 1; if (TimeFromYear(lo) > t) { return mid; } } } return lo; } private static double DayFromMonth(int m, int year) { int day = m * 30; if (m >= 7) { day += m / 2 - 1; } else if (m >= 2) { day += (m - 1) / 2 - 1; } else { day += m; } if (m >= 2 && IsLeapYear(year)) { ++day; } return day; } private static int MonthFromTime(double t) { int year = YearFromTime(t); int d = (int)(Day(t) - DayFromYear(year)); d -= 31 + 28; if (d < 0) { return (d < -28) ? 0 : 1; } if (IsLeapYear(year)) { if (d == 0) return 1; // 29 February --d; } // d: date count from 1 March int estimate = d / 30; // approx number of month since March int mstart; switch (estimate) { case 0: return 2; case 1: mstart = 31; break; case 2: mstart = 31+30; break; case 3: mstart = 31+30+31; break; case 4: mstart = 31+30+31+30; break; case 5: mstart = 31+30+31+30+31; break; case 6: mstart = 31+30+31+30+31+31; break; case 7: mstart = 31+30+31+30+31+31+30; break; case 8: mstart = 31+30+31+30+31+31+30+31; break; case 9: mstart = 31+30+31+30+31+31+30+31+30; break; case 10: return 11; //Late december default: throw Kit.codeBug(); } // if d < mstart then real month since March == estimate - 1 return (d >= mstart) ? estimate + 2 : estimate + 1; } private static int DateFromTime(double t) { int year = YearFromTime(t); int d = (int)(Day(t) - DayFromYear(year)); d -= 31 + 28; if (d < 0) { return (d < -28) ? d + 31 + 28 + 1 : d + 28 + 1; } if (IsLeapYear(year)) { if (d == 0) return 29; // 29 February --d; } // d: date count from 1 March int mdays, mstart; switch (d / 30) { // approx number of month since March case 0: return d + 1; case 1: mdays = 31; mstart = 31; break; case 2: mdays = 30; mstart = 31+30; break; case 3: mdays = 31; mstart = 31+30+31; break; case 4: mdays = 30; mstart = 31+30+31+30; break; case 5: mdays = 31; mstart = 31+30+31+30+31; break; case 6: mdays = 31; mstart = 31+30+31+30+31+31; break; case 7: mdays = 30; mstart = 31+30+31+30+31+31+30; break; case 8: mdays = 31; mstart = 31+30+31+30+31+31+30+31; break; case 9: mdays = 30; mstart = 31+30+31+30+31+31+30+31+30; break; case 10: return d - (31+30+31+30+31+31+30+31+30) + 1; //Late december default: throw Kit.codeBug(); } d -= mstart; if (d < 0) { // wrong estimate: sfhift to previous month d += mdays; } return d + 1; } private static int WeekDay(double t) { double result; result = Day(t) + 4; result = result % 7; if (result < 0) result += 7; return (int) result; } private static double now() { return System.currentTimeMillis(); } /* Should be possible to determine the need for this dynamically * if we go with the workaround... I'm not using it now, because I * can't think of any clean way to make toLocaleString() and the * time zone (comment) in toString match the generated string * values. Currently it's wrong-but-consistent in all but the * most recent betas of the JRE - seems to work in 1.1.7. */ private final static boolean TZO_WORKAROUND = false; private static double DaylightSavingTA(double t) { // Another workaround! The JRE doesn't seem to know about DST // before year 1 AD, so we map to equivalent dates for the // purposes of finding dst. To be safe, we do this for years // outside 1970-2038. if (t < 0.0 || t > 2145916800000.0) { int year = EquivalentYear(YearFromTime(t)); double day = MakeDay(year, MonthFromTime(t), DateFromTime(t)); t = MakeDate(day, TimeWithinDay(t)); } if (!TZO_WORKAROUND) { Date date = new Date((long) t); if (thisTimeZone.inDaylightTime(date)) return msPerHour; else return 0; } else { /* Use getOffset if inDaylightTime() is broken, because it * seems to work acceptably. We don't switch over to it * entirely, because it requires (expensive) exploded date arguments, * and the api makes it impossible to handle dst * changeovers cleanly. */ // Hardcode the assumption that the changeover always // happens at 2:00 AM: t += LocalTZA + (HourFromTime(t) <= 2 ? msPerHour : 0); int year = YearFromTime(t); double offset = thisTimeZone.getOffset(year > 0 ? 1 : 0, year, MonthFromTime(t), DateFromTime(t), WeekDay(t), (int)TimeWithinDay(t)); if ((offset - LocalTZA) != 0) return msPerHour; else return 0; // return offset - LocalTZA; } } /* * Find a year for which any given date will fall on the same weekday. * * This function should be used with caution when used other than * for determining DST; it hasn't been proven not to produce an * incorrect year for times near year boundaries. */ private static int EquivalentYear(int year) { int day = (int) DayFromYear(year) + 4; day = day % 7; if (day < 0) day += 7; // Years and leap years on which Jan 1 is a Sunday, Monday, etc. if (IsLeapYear(year)) { switch (day) { case 0: return 1984; case 1: return 1996; case 2: return 1980; case 3: return 1992; case 4: return 1976; case 5: return 1988; case 6: return 1972; } } else { switch (day) { case 0: return 1978; case 1: return 1973; case 2: return 1974; case 3: return 1975; case 4: return 1981; case 5: return 1971; case 6: return 1977; } } // Unreachable throw Kit.codeBug(); } private static double LocalTime(double t) { return t + LocalTZA + DaylightSavingTA(t); } private static double internalUTC(double t) { return t - LocalTZA - DaylightSavingTA(t - LocalTZA); } private static int HourFromTime(double t) { double result; result = Math.floor(t / msPerHour) % HoursPerDay; if (result < 0) result += HoursPerDay; return (int) result; } private static int MinFromTime(double t) { double result; result = Math.floor(t / msPerMinute) % MinutesPerHour; if (result < 0) result += MinutesPerHour; return (int) result; } private static int SecFromTime(double t) { double result; result = Math.floor(t / msPerSecond) % SecondsPerMinute; if (result < 0) result += SecondsPerMinute; return (int) result; } private static int msFromTime(double t) { double result; result = t % msPerSecond; if (result < 0) result += msPerSecond; return (int) result; } private static double MakeTime(double hour, double min, double sec, double ms) { return ((hour * MinutesPerHour + min) * SecondsPerMinute + sec) * msPerSecond + ms; } private static double MakeDay(double year, double month, double date) { year += Math.floor(month / 12); month = month % 12; if (month < 0) month += 12; double yearday = Math.floor(TimeFromYear(year) / msPerDay); double monthday = DayFromMonth((int)month, (int)year); return yearday + monthday + date - 1; } private static double MakeDate(double day, double time) { return day * msPerDay + time; } private static double TimeClip(double d) { if (d != d || d == Double.POSITIVE_INFINITY || d == Double.NEGATIVE_INFINITY || Math.abs(d) > HalfTimeDomain) { return ScriptRuntime.NaN; } if (d > 0.0) return Math.floor(d + 0.); else return Math.ceil(d + 0.); } /* end of ECMA helper functions */ /* find UTC time from given date... no 1900 correction! */ private static double date_msecFromDate(double year, double mon, double mday, double hour, double min, double sec, double msec) { double day; double time; double result; day = MakeDay(year, mon, mday); time = MakeTime(hour, min, sec, msec); result = MakeDate(day, time); return result; } /* compute the time in msec (unclipped) from the given args */ private static final int MAXARGS = 7; private static double date_msecFromArgs(Object[] args) { double array[] = new double[MAXARGS]; int loop; double d; for (loop = 0; loop < MAXARGS; loop++) { if (loop < args.length) { d = ScriptRuntime.toNumber(args[loop]); if (d != d || Double.isInfinite(d)) { return ScriptRuntime.NaN; } array[loop] = ScriptRuntime.toInteger(args[loop]); } else { if (loop == 2) { array[loop] = 1; /* Default the date argument to 1. */ } else { array[loop] = 0; } } } /* adjust 2-digit years into the 20th century */ if (array[0] >= 0 && array[0] <= 99) array[0] += 1900; return date_msecFromDate(array[0], array[1], array[2], array[3], array[4], array[5], array[6]); } private static double jsStaticFunction_UTC(Object[] args) { return TimeClip(date_msecFromArgs(args)); } private static double date_parseString(String s) { int year = -1; int mon = -1; int mday = -1; int hour = -1; int min = -1; int sec = -1; char c = 0; char si = 0; int i = 0; int n = -1; double tzoffset = -1; char prevc = 0; int limit = 0; boolean seenplusminus = false; limit = s.length(); while (i < limit) { c = s.charAt(i); i++; if (c <= ' ' || c == ',' || c == '-') { if (i < limit) { si = s.charAt(i); if (c == '-' && '0' <= si && si <= '9') { prevc = c; } } continue; } if (c == '(') { /* comments) */ int depth = 1; while (i < limit) { c = s.charAt(i); i++; if (c == '(') depth++; else if (c == ')') if (--depth <= 0) break; } continue; } if ('0' <= c && c <= '9') { n = c - '0'; while (i < limit && '0' <= (c = s.charAt(i)) && c <= '9') { n = n * 10 + c - '0'; i++; } /* allow TZA before the year, so * 'Wed Nov 05 21:49:11 GMT-0800 1997' * works */ /* uses of seenplusminus allow : in TZA, so Java * no-timezone style of GMT+4:30 works */ if ((prevc == '+' || prevc == '-')/* && year>=0 */) { /* make ':' case below change tzoffset */ seenplusminus = true; /* offset */ if (n < 24) n = n * 60; /* EG. "GMT-3" */ else n = n % 100 + n / 100 * 60; /* eg "GMT-0430" */ if (prevc == '+') /* plus means east of GMT */ n = -n; if (tzoffset != 0 && tzoffset != -1) return ScriptRuntime.NaN; tzoffset = n; } else if (n >= 70 || (prevc == '/' && mon >= 0 && mday >= 0 && year < 0)) { if (year >= 0) return ScriptRuntime.NaN; else if (c <= ' ' || c == ',' || c == '/' || i >= limit) year = n < 100 ? n + 1900 : n; else return ScriptRuntime.NaN; } else if (c == ':') { if (hour < 0) hour = /*byte*/ n; else if (min < 0) min = /*byte*/ n; else return ScriptRuntime.NaN; } else if (c == '/') { if (mon < 0) mon = /*byte*/ n-1; else if (mday < 0) mday = /*byte*/ n; else return ScriptRuntime.NaN; } else if (i < limit && c != ',' && c > ' ' && c != '-') { return ScriptRuntime.NaN; } else if (seenplusminus && n < 60) { /* handle GMT-3:30 */ if (tzoffset < 0) tzoffset -= n; else tzoffset += n; } else if (hour >= 0 && min < 0) { min = /*byte*/ n; } else if (min >= 0 && sec < 0) { sec = /*byte*/ n; } else if (mday < 0) { mday = /*byte*/ n; } else { return ScriptRuntime.NaN; } prevc = 0; } else if (c == '/' || c == ':' || c == '+' || c == '-') { prevc = c; } else { int st = i - 1; while (i < limit) { c = s.charAt(i); if (!(('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z'))) break; i++; } int letterCount = i - st; if (letterCount < 2) return ScriptRuntime.NaN; /* * Use ported code from jsdate.c rather than the locale-specific * date-parsing code from Java, to keep js and rhino consistent. * Is this the right strategy? */ String wtb = "am;pm;" +"monday;tuesday;wednesday;thursday;friday;" +"saturday;sunday;" +"january;february;march;april;may;june;" +"july;august;september;october;november;december;" +"gmt;ut;utc;est;edt;cst;cdt;mst;mdt;pst;pdt;"; int index = 0; for (int wtbOffset = 0; ;) { int wtbNext = wtb.indexOf(';', wtbOffset); if (wtbNext < 0) return ScriptRuntime.NaN; if (wtb.regionMatches(true, wtbOffset, s, st, letterCount)) break; wtbOffset = wtbNext + 1; ++index; } if (index < 2) { /* * AM/PM. Count 12:30 AM as 00:30, 12:30 PM as * 12:30, instead of blindly adding 12 if PM. */ if (hour > 12 || hour < 0) { return ScriptRuntime.NaN; } else if (index == 0) { // AM if (hour == 12) hour = 0; } else { // PM if (hour != 12) hour += 12; } } else if ((index -= 2) < 7) { // ignore week days } else if ((index -= 7) < 12) { // month if (mon < 0) { mon = index; } else { return ScriptRuntime.NaN; } } else { index -= 12; // timezones switch (index) { case 0 /* gmt */: tzoffset = 0; break; case 1 /* ut */: tzoffset = 0; break; case 2 /* utc */: tzoffset = 0; break; case 3 /* est */: tzoffset = 5 * 60; break; case 4 /* edt */: tzoffset = 4 * 60; break; case 5 /* cst */: tzoffset = 6 * 60; break; case 6 /* cdt */: tzoffset = 5 * 60; break; case 7 /* mst */: tzoffset = 7 * 60; break; case 8 /* mdt */: tzoffset = 6 * 60; break; case 9 /* pst */: tzoffset = 8 * 60; break; case 10 /* pdt */:tzoffset = 7 * 60; break; default: Kit.codeBug(); } } } } if (year < 0 || mon < 0 || mday < 0) return ScriptRuntime.NaN; if (sec < 0) sec = 0; if (min < 0) min = 0; if (hour < 0) hour = 0; double msec = date_msecFromDate(year, mon, mday, hour, min, sec, 0); if (tzoffset == -1) { /* no time zone specified, have to use local */ return internalUTC(msec); } else { return msec + tzoffset * msPerMinute; } } private static String date_format(double t, int methodId) { StringBuffer result = new StringBuffer(60); double local = LocalTime(t); /* Tue Oct 31 09:41:40 GMT-0800 (PST) 2000 */ /* Tue Oct 31 2000 */ /* 09:41:40 GMT-0800 (PST) */ if (methodId != Id_toTimeString) { appendWeekDayName(result, WeekDay(local)); result.append(' '); appendMonthName(result, MonthFromTime(local)); result.append(' '); append0PaddedUint(result, DateFromTime(local), 2); result.append(' '); int year = YearFromTime(local); if (year < 0) { result.append('-'); year = -year; } append0PaddedUint(result, year, 4); if (methodId != Id_toDateString) result.append(' '); } if (methodId != Id_toDateString) { append0PaddedUint(result, HourFromTime(local), 2); result.append(':'); append0PaddedUint(result, MinFromTime(local), 2); result.append(':'); append0PaddedUint(result, SecFromTime(local), 2); // offset from GMT in minutes. The offset includes daylight // savings, if it applies. int minutes = (int) Math.floor((LocalTZA + DaylightSavingTA(t)) / msPerMinute); // map 510 minutes to 0830 hours int offset = (minutes / 60) * 100 + minutes % 60; if (offset > 0) { result.append(" GMT+"); } else { result.append(" GMT-"); offset = -offset; } append0PaddedUint(result, offset, 4); if (timeZoneFormatter == null) timeZoneFormatter = new java.text.SimpleDateFormat("zzz"); // Find an equivalent year before getting the timezone // comment. See DaylightSavingTA. if (t < 0.0 || t > 2145916800000.0) { int equiv = EquivalentYear(YearFromTime(local)); double day = MakeDay(equiv, MonthFromTime(t), DateFromTime(t)); t = MakeDate(day, TimeWithinDay(t)); } result.append(" ("); java.util.Date date = new Date((long) t); synchronized (timeZoneFormatter) { result.append(timeZoneFormatter.format(date)); } result.append(')'); } return result.toString(); } /* the javascript constructor */ private static Object jsConstructor(Object[] args) { NativeDate obj = new NativeDate(); // if called as a constructor with no args, // return a new Date with the current time. if (args.length == 0) { obj.date = now(); return obj; } // if called with just one arg - if (args.length == 1) { Object arg0 = args[0]; if (arg0 instanceof Scriptable) arg0 = ((Scriptable) arg0).getDefaultValue(null); double date; if (arg0 instanceof String) { // it's a string; parse it. date = date_parseString((String)arg0); } else { // if it's not a string, use it as a millisecond date date = ScriptRuntime.toNumber(arg0); } obj.date = TimeClip(date); return obj; } double time = date_msecFromArgs(args); if (!Double.isNaN(time) && !Double.isInfinite(time)) time = TimeClip(internalUTC(time)); obj.date = time; return obj; } private static String toLocale_helper(double t, int methodId) { java.text.DateFormat formatter; switch (methodId) { case Id_toLocaleString: if (localeDateTimeFormatter == null) { localeDateTimeFormatter = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG); } formatter = localeDateTimeFormatter; break; case Id_toLocaleTimeString: if (localeTimeFormatter == null) { localeTimeFormatter = DateFormat.getTimeInstance(DateFormat.LONG); } formatter = localeTimeFormatter; break; case Id_toLocaleDateString: if (localeDateFormatter == null) { localeDateFormatter = DateFormat.getDateInstance(DateFormat.LONG); } formatter = localeDateFormatter; break; default: formatter = null; // unreachable } synchronized (formatter) { return formatter.format(new Date((long) t)); } } private static String js_toUTCString(double date) { StringBuffer result = new StringBuffer(60); appendWeekDayName(result, WeekDay(date)); result.append(", "); append0PaddedUint(result, DateFromTime(date), 2); result.append(' '); appendMonthName(result, MonthFromTime(date)); result.append(' '); int year = YearFromTime(date); if (year < 0) { result.append('-'); year = -year; } append0PaddedUint(result, year, 4); result.append(' '); append0PaddedUint(result, HourFromTime(date), 2); result.append(':'); append0PaddedUint(result, MinFromTime(date), 2); result.append(':'); append0PaddedUint(result, SecFromTime(date), 2); result.append(" GMT"); return result.toString(); } private static void append0PaddedUint(StringBuffer sb, int i, int minWidth) { if (i < 0) Kit.codeBug(); int scale = 1; --minWidth; if (i >= 10) { if (i < 1000 * 1000 * 1000) { for (;;) { int newScale = scale * 10; if (i < newScale) { break; } --minWidth; scale = newScale; } } else { // Separated case not to check against 10 * 10^9 overflow minWidth -= 9; scale = 1000 * 1000 * 1000; } } while (minWidth > 0) { sb.append('0'); --minWidth; } while (scale != 1) { sb.append((char)('0' + (i / scale))); i %= scale; scale /= 10; } sb.append((char)('0' + i)); } private static void appendMonthName(StringBuffer sb, int index) { // Take advantage of the fact that all month abbreviations // have the same length to minimize amount of strings runtime has // to keep in memory String months = "Jan"+"Feb"+"Mar"+"Apr"+"May"+"Jun" +"Jul"+"Aug"+"Sep"+"Oct"+"Nov"+"Dec"; index *= 3; for (int i = 0; i != 3; ++i) { sb.append(months.charAt(index + i)); } } private static void appendWeekDayName(StringBuffer sb, int index) { String days = "Sun"+"Mon"+"Tue"+"Wed"+"Thu"+"Fri"+"Sat"; index *= 3; for (int i = 0; i != 3; ++i) { sb.append(days.charAt(index + i)); } } private static double makeTime(double date, Object[] args, int methodId) { int maxargs; boolean local = true; switch (methodId) { case Id_setUTCMilliseconds: local = false; // fallthrough case Id_setMilliseconds: maxargs = 1; break; case Id_setUTCSeconds: local = false; // fallthrough case Id_setSeconds: maxargs = 2; break; case Id_setUTCMinutes: local = false; // fallthrough case Id_setMinutes: maxargs = 3; break; case Id_setUTCHours: local = false; // fallthrough case Id_setHours: maxargs = 4; break; default: Kit.codeBug(); maxargs = 0; } int i; double conv[] = new double[4]; double hour, min, sec, msec; double lorutime; /* Local or UTC version of date */ double time; double result; /* just return NaN if the date is already NaN */ if (date != date) return date; /* Satisfy the ECMA rule that if a function is called with * fewer arguments than the specified formal arguments, the * remaining arguments are set to undefined. Seems like all * the Date.setWhatever functions in ECMA are only varargs * beyond the first argument; this should be set to undefined * if it's not given. This means that "d = new Date(); * d.setMilliseconds()" returns NaN. Blech. */ if (args.length == 0) args = ScriptRuntime.padArguments(args, 1); for (i = 0; i < args.length && i < maxargs; i++) { conv[i] = ScriptRuntime.toNumber(args[i]); // limit checks that happen in MakeTime in ECMA. if (conv[i] != conv[i] || Double.isInfinite(conv[i])) { return ScriptRuntime.NaN; } conv[i] = ScriptRuntime.toInteger(conv[i]); } if (local) lorutime = LocalTime(date); else lorutime = date; i = 0; int stop = args.length; if (maxargs >= 4 && i < stop) hour = conv[i++]; else hour = HourFromTime(lorutime); if (maxargs >= 3 && i < stop) min = conv[i++]; else min = MinFromTime(lorutime); if (maxargs >= 2 && i < stop) sec = conv[i++]; else sec = SecFromTime(lorutime); if (maxargs >= 1 && i < stop) msec = conv[i++]; else msec = msFromTime(lorutime); time = MakeTime(hour, min, sec, msec); result = MakeDate(Day(lorutime), time); if (local) result = internalUTC(result); date = TimeClip(result); return date; } private static double makeDate(double date, Object[] args, int methodId) { int maxargs; boolean local = true; switch (methodId) { case Id_setUTCDate: local = false; // fallthrough case Id_setDate: maxargs = 1; break; case Id_setUTCMonth: local = false; // fallthrough case Id_setMonth: maxargs = 2; break; case Id_setUTCFullYear: local = false; // fallthrough case Id_setFullYear: maxargs = 3; break; default: Kit.codeBug(); maxargs = 0; } int i; double conv[] = new double[3]; double year, month, day; double lorutime; /* local or UTC version of date */ double result; /* See arg padding comment in makeTime.*/ if (args.length == 0) args = ScriptRuntime.padArguments(args, 1); for (i = 0; i < args.length && i < maxargs; i++) { conv[i] = ScriptRuntime.toNumber(args[i]); // limit checks that happen in MakeDate in ECMA. if (conv[i] != conv[i] || Double.isInfinite(conv[i])) { return ScriptRuntime.NaN; } conv[i] = ScriptRuntime.toInteger(conv[i]); } /* return NaN if date is NaN and we're not setting the year, * If we are, use 0 as the time. */ if (date != date) { if (args.length < 3) { return ScriptRuntime.NaN; } else { lorutime = 0; } } else { if (local) lorutime = LocalTime(date); else lorutime = date; } i = 0; int stop = args.length; if (maxargs >= 3 && i < stop) year = conv[i++]; else year = YearFromTime(lorutime); if (maxargs >= 2 && i < stop) month = conv[i++]; else month = MonthFromTime(lorutime); if (maxargs >= 1 && i < stop) day = conv[i++]; else day = DateFromTime(lorutime); day = MakeDay(year, month, day); /* day within year */ result = MakeDate(day, TimeWithinDay(lorutime)); if (local) result = internalUTC(result); date = TimeClip(result); return date; } // #string_id_map# protected int findPrototypeId(String s) { int id; // #generated# Last update: 2007-05-09 08:15:38 EDT L0: { id = 0; String X = null; int c; L: switch (s.length()) { case 6: X="getDay";id=Id_getDay; break L; case 7: switch (s.charAt(3)) { case 'D': c=s.charAt(0); if (c=='g') { X="getDate";id=Id_getDate; } else if (c=='s') { X="setDate";id=Id_setDate; } break L; case 'T': c=s.charAt(0); if (c=='g') { X="getTime";id=Id_getTime; } else if (c=='s') { X="setTime";id=Id_setTime; } break L; case 'Y': c=s.charAt(0); if (c=='g') { X="getYear";id=Id_getYear; } else if (c=='s') { X="setYear";id=Id_setYear; } break L; case 'u': X="valueOf";id=Id_valueOf; break L; } break L; case 8: switch (s.charAt(3)) { case 'H': c=s.charAt(0); if (c=='g') { X="getHours";id=Id_getHours; } else if (c=='s') { X="setHours";id=Id_setHours; } break L; case 'M': c=s.charAt(0); if (c=='g') { X="getMonth";id=Id_getMonth; } else if (c=='s') { X="setMonth";id=Id_setMonth; } break L; case 'o': X="toSource";id=Id_toSource; break L; case 't': X="toString";id=Id_toString; break L; } break L; case 9: X="getUTCDay";id=Id_getUTCDay; break L; case 10: c=s.charAt(3); if (c=='M') { c=s.charAt(0); if (c=='g') { X="getMinutes";id=Id_getMinutes; } else if (c=='s') { X="setMinutes";id=Id_setMinutes; } } else if (c=='S') { c=s.charAt(0); if (c=='g') { X="getSeconds";id=Id_getSeconds; } else if (c=='s') { X="setSeconds";id=Id_setSeconds; } } else if (c=='U') { c=s.charAt(0); if (c=='g') { X="getUTCDate";id=Id_getUTCDate; } else if (c=='s') { X="setUTCDate";id=Id_setUTCDate; } } break L; case 11: switch (s.charAt(3)) { case 'F': c=s.charAt(0); if (c=='g') { X="getFullYear";id=Id_getFullYear; } else if (c=='s') { X="setFullYear";id=Id_setFullYear; } break L; case 'M': X="toGMTString";id=Id_toGMTString; break L; case 'T': X="toUTCString";id=Id_toUTCString; break L; case 'U': c=s.charAt(0); if (c=='g') { c=s.charAt(9); if (c=='r') { X="getUTCHours";id=Id_getUTCHours; } else if (c=='t') { X="getUTCMonth";id=Id_getUTCMonth; } } else if (c=='s') { c=s.charAt(9); if (c=='r') { X="setUTCHours";id=Id_setUTCHours; } else if (c=='t') { X="setUTCMonth";id=Id_setUTCMonth; } } break L; case 's': X="constructor";id=Id_constructor; break L; } break L; case 12: c=s.charAt(2); if (c=='D') { X="toDateString";id=Id_toDateString; } else if (c=='T') { X="toTimeString";id=Id_toTimeString; } break L; case 13: c=s.charAt(0); if (c=='g') { c=s.charAt(6); if (c=='M') { X="getUTCMinutes";id=Id_getUTCMinutes; } else if (c=='S') { X="getUTCSeconds";id=Id_getUTCSeconds; } } else if (c=='s') { c=s.charAt(6); if (c=='M') { X="setUTCMinutes";id=Id_setUTCMinutes; } else if (c=='S') { X="setUTCSeconds";id=Id_setUTCSeconds; } } break L; case 14: c=s.charAt(0); if (c=='g') { X="getUTCFullYear";id=Id_getUTCFullYear; } else if (c=='s') { X="setUTCFullYear";id=Id_setUTCFullYear; } else if (c=='t') { X="toLocaleString";id=Id_toLocaleString; } break L; case 15: c=s.charAt(0); if (c=='g') { X="getMilliseconds";id=Id_getMilliseconds; } else if (c=='s') { X="setMilliseconds";id=Id_setMilliseconds; } break L; case 17: X="getTimezoneOffset";id=Id_getTimezoneOffset; break L; case 18: c=s.charAt(0); if (c=='g') { X="getUTCMilliseconds";id=Id_getUTCMilliseconds; } else if (c=='s') { X="setUTCMilliseconds";id=Id_setUTCMilliseconds; } else if (c=='t') { c=s.charAt(8); if (c=='D') { X="toLocaleDateString";id=Id_toLocaleDateString; } else if (c=='T') { X="toLocaleTimeString";id=Id_toLocaleTimeString; } } break L; } if (X!=null && X!=s && !X.equals(s)) id = 0; break L0; } // #/generated# return id; } private static final int ConstructorId_now = -3, ConstructorId_parse = -2, ConstructorId_UTC = -1, Id_constructor = 1, Id_toString = 2, Id_toTimeString = 3, Id_toDateString = 4, Id_toLocaleString = 5, Id_toLocaleTimeString = 6, Id_toLocaleDateString = 7, Id_toUTCString = 8, Id_toSource = 9, Id_valueOf = 10, Id_getTime = 11, Id_getYear = 12, Id_getFullYear = 13, Id_getUTCFullYear = 14, Id_getMonth = 15, Id_getUTCMonth = 16, Id_getDate = 17, Id_getUTCDate = 18, Id_getDay = 19, Id_getUTCDay = 20, Id_getHours = 21, Id_getUTCHours = 22, Id_getMinutes = 23, Id_getUTCMinutes = 24, Id_getSeconds = 25, Id_getUTCSeconds = 26, Id_getMilliseconds = 27, Id_getUTCMilliseconds = 28, Id_getTimezoneOffset = 29, Id_setTime = 30, Id_setMilliseconds = 31, Id_setUTCMilliseconds = 32, Id_setSeconds = 33, Id_setUTCSeconds = 34, Id_setMinutes = 35, Id_setUTCMinutes = 36, Id_setHours = 37, Id_setUTCHours = 38, Id_setDate = 39, Id_setUTCDate = 40, Id_setMonth = 41, Id_setUTCMonth = 42, Id_setFullYear = 43, Id_setUTCFullYear = 44, Id_setYear = 45, MAX_PROTOTYPE_ID = 45; private static final int Id_toGMTString = Id_toUTCString; // Alias, see Ecma B.2.6 // #/string_id_map# /* cached values */ private static java.util.TimeZone thisTimeZone; private static double LocalTZA; private static java.text.DateFormat timeZoneFormatter; private static java.text.DateFormat localeDateTimeFormatter; private static java.text.DateFormat localeDateFormatter; private static java.text.DateFormat localeTimeFormatter; private double date; }
[ "tmayfield@axiomsoftwareinc.com" ]
tmayfield@axiomsoftwareinc.com
41882fbd8ad62d48632081ec03b6876dce627bc4
54110d07679649a8e55dd37c88a9a7d9b634f155
/_teaching/csci132-fall-2022/lectures/ScoreboardDemo.java
e706e2cac423744d2052375a0143ef61f98f08e5
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
lgw2/lgw2.github.io
cee7f8571f2a81dda69f003a4b5ea577b3f10bf2
d7d6b1dc3f312f3ab42e3341d3b6af9f0df9e753
refs/heads/master
2023-08-16T20:01:37.950044
2023-08-10T19:35:10
2023-08-10T19:35:10
144,613,208
0
0
null
null
null
null
UTF-8
Java
false
false
481
java
package day16; public class ScoreboardDemo { public static void main(String[] args) { Scoreboard s = new Scoreboard(7); GameEntry n = new GameEntry("Mike", 1105); s.add(n); n = new GameEntry("Rob", 750); s.add(n); s.add(new GameEntry("Paul", 720)); s.add(new GameEntry("Anna", 660)); s.add(new GameEntry("Jill", 740)); System.out.println("At end:"); System.out.println(s); s.remove(-1); s.remove(2); System.out.println(s); } }
[ "lgw2@uw.edu" ]
lgw2@uw.edu
d99c55ef9ca4fb2e27e3617bb47a2237c744b378
036112a9737e7e4e5d1384046da95f6498082138
/src/main/java/io/openmessaging/ACache.java
3084bfb619982c5c53366473098a0cc8560dc710
[]
no_license
zhouyu7373/mqrace2019
86b458e88e1b34a2d59d3d878d75203b72150729
d31fa90c50e5f012fad99c800e1cc9d829253e72
refs/heads/master
2023-08-20T09:27:54.693786
2019-09-06T01:41:58
2019-09-06T01:41:58
206,530,771
2
1
null
2023-08-15T17:40:50
2019-09-05T09:54:23
Java
UTF-8
Java
false
false
694
java
package io.openmessaging; import java.nio.ByteBuffer; public class ACache { private long startOffset; private long endOffset; public ByteBuffer byteBuffer ; public boolean indexInCache(long s, long e) { return s >= startOffset && e <= endOffset; } public void add(int size) { this.endOffset +=size; } public void addStart(int size){ this.startOffset +=size; this.endOffset+=size; } public ByteBuffer getByteBuffer() { return byteBuffer; } public ACache(ByteBuffer byteBuffer) { this.byteBuffer = byteBuffer; } public long getStartOffset() { return startOffset; } }
[ "zhouyu7@jd.com" ]
zhouyu7@jd.com
6cc382ea440e6c6e626439c73869fa0dc622247b
5a311afb56c6bbfdafeb53636b6a09b3d7b424d4
/app/src/main/java/com/algonquincollege/hurdleg/planets/DetailActivity.java
bba804955eee20f69868d6b2b1ca375d62d68efa
[]
no_license
pate0304/Doors-Open-Ottawa
54d430a1733df49e4324d9a99f97d48acea7007f
5359c70ea68d6c4033662526b65df10daba0f00d
refs/heads/master
2021-06-21T12:17:21.073981
2021-03-12T02:01:40
2021-03-12T02:01:40
74,637,508
0
0
null
null
null
null
UTF-8
Java
false
false
6,396
java
package com.algonquincollege.hurdleg.planets; import android.content.Context; import android.content.Intent; import android.location.Address; import android.location.Geocoder; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.AsyncTask; import android.support.v4.app.FragmentActivity; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import com.algonquincollege.hurdleg.planets.model.Planet; import com.algonquincollege.hurdleg.planets.utils.utils.HttpMethod; import com.algonquincollege.hurdleg.planets.utils.utils.RequestPackage; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Locale; import static com.algonquincollege.hurdleg.planets.Constants.bid; import static com.algonquincollege.hurdleg.planets.Constants.detail_calendar; import static com.algonquincollege.hurdleg.planets.Constants.detail_description; import static com.algonquincollege.hurdleg.planets.Constants.detail_title; import static com.algonquincollege.hurdleg.planets.MainActivity.REST_URI; import static com.algonquincollege.hurdleg.planets.mapConstants.detail_address; public class DetailActivity extends FragmentActivity implements OnMapReadyCallback { private GoogleMap mMap; private Geocoder mGeocoder; private ProgressBar pb; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detail); // Obtain the SupportMapFragment and get notified when the map is ready to be used. SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); pb = (ProgressBar) findViewById(R.id.progressBar2); pb.setVisibility(View.INVISIBLE); mGeocoder = new Geocoder(this, Locale.CANADA); // TextView title = (TextView) findViewById(R.id.buildingName); TextView des = (TextView) findViewById(R.id.buildingDescr); Bundle bundle = getIntent().getExtras(); String name = bundle.getString(detail_title); // title.setText(name); getActionBar().setTitle(name); String description = bundle.getString(detail_description); des.setText(description); int bidd = bundle.getInt(bid); Log.d("BUILDING ID", String.valueOf(bidd)); TextView cal = (TextView) findViewById(R.id.cal); List<String> calendar = bundle.getStringArrayList(detail_calendar); String[] stringArray = calendar.toArray(new String[0]); StringBuilder mtempCalender = new StringBuilder(); for (int i = 0; i < calendar.size(); i++) { mtempCalender.append(calendar.get(i) + " \n"); } cal.setText(mtempCalender); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.detailmenu, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.action_delete_data) { if (isOnline()) { deletePlanet( REST_URI ); } else { Toast.makeText(this, "Network isn't available", Toast.LENGTH_LONG).show(); } } return true; } private void deletePlanet(String uri) { RequestPackage pkg = new RequestPackage(); pkg.setMethod( HttpMethod.DELETE ); // DELETE the planet with Id 8 Bundle bundle = getIntent().getExtras(); int bidd = bundle.getInt(bid);//building id for delete Log.d("bid","bid:"+bidd); pkg.setUri( uri+"/"+bidd ); DetailActivity.DoTask deleteTask = new DoTask(); deleteTask.execute( pkg ); Intent i = new Intent(getApplicationContext(),MainActivity.class); startActivity(i); } protected boolean isOnline() { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = cm.getActiveNetworkInfo(); if (netInfo != null && netInfo.isConnectedOrConnecting()) { return true; } else { return false; } } private class DoTask extends AsyncTask<RequestPackage, String, String> { @Override protected void onPreExecute() { pb.setVisibility(View.VISIBLE); } @Override protected String doInBackground(RequestPackage ... params) { String content = com.algonquincollege.hurdleg.planets.utils.utils.HttpManager.getData(params[0]); return content; } @Override protected void onPostExecute(String result) { pb.setVisibility(View.INVISIBLE); if (result == null) { Toast.makeText(DetailActivity.this, "Failed", Toast.LENGTH_LONG).show(); return; } } } @Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap; Bundle bundle = getIntent().getExtras(); String address = bundle.getString(Constants.detail_address); String joined = address + " ottawa" + " ON"; pin(joined); } private void pin(String locationName) { try { Address address = mGeocoder.getFromLocationName(locationName, 1).get(0); LatLng ll = new LatLng(address.getLatitude(), address.getLongitude()); mMap.addMarker(new MarkerOptions().position(ll).title(locationName)); mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(ll, 12.0f)); Toast.makeText(this, "Pinned: " + locationName, Toast.LENGTH_SHORT).show(); } catch (Exception e) { Toast.makeText(this, "Not found: " + locationName, Toast.LENGTH_SHORT).show(); } } }
[ "pate0304@algonquinlive.com" ]
pate0304@algonquinlive.com
8d78bc448bddf24a47168d17cb3b528d28f02156
bbd4bf35a6ef7a6356aca58cbcfcf6b4ece69f26
/app/src/main/java/by/aermakova/prettysip/logic/services/RebootReceiver.java
7f1b4a0435e8f164eaaf9910f2af91c074c04a05
[]
no_license
HannaYermakova/PrettySip
afb8b261bc4a200dde650653f9cef5ebb1a12485
c0103cd3d201a1fa138dbb2efef702023e523747
refs/heads/master
2022-11-19T04:23:55.289928
2020-07-22T22:17:11
2020-07-22T22:17:11
281,792,360
0
0
null
null
null
null
UTF-8
Java
false
false
1,654
java
package by.aermakova.prettysip.logic.services; import android.annotation.SuppressLint; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.Build; import android.util.Log; import by.aermakova.prettysip.linphoneApi.LinphoneService; /** * Handler of reboot action */ public class RebootReceiver extends BroadcastReceiver { private final String TAG = getClass().getSimpleName(); @SuppressLint("UnsafeProtectedBroadcastReceiver") @Override public void onReceive(Context context, Intent intent) { if (intent.getAction() != null) { if (intent.getAction().equalsIgnoreCase(Intent.ACTION_SHUTDOWN)) { Log.d(TAG, "Device is shutting down, destroying Core to unregister"); context.stopService(new Intent(Intent.ACTION_MAIN).setClass(context, LinphoneService.class)); } else if (intent.getAction().equalsIgnoreCase(Intent.ACTION_BOOT_COMPLETED)) { if (!LinphoneService.isReady()) { Log.d(TAG, "Device is starting, action Boot completed"); startService(context); } } } } private void startService(Context context) { Intent serviceIntent = new Intent(Intent.ACTION_MAIN); serviceIntent.setClass(context, LinphoneService.class); serviceIntent.putExtra("ForceStartForeground", true); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { context.startForegroundService(serviceIntent); } else { context.startService(serviceIntent); } } }
[ "hannayermakova@mail.ru" ]
hannayermakova@mail.ru
37f2940e03ff71e43d948c4b6560ab56a68a75ac
95749b13469db0e490a3751753e6cc3fa241a2db
/MishaSDK/src/main/java/com/nepolix/misha/android/sdk/task/handler/core/task/AsyncTask.java
c1d0685e85a83d1760995aa1fbb1490f60d3f36e
[ "Apache-2.0" ]
permissive
NEPOLIX/Misha-Android
c7feb4249ab0882fcf93bf48a83f53b340214b04
65a9c865fad0f200d3a7c065f9c816b5de067fc0
refs/heads/master
2020-03-10T11:49:24.384160
2018-04-13T22:58:57
2018-04-13T22:58:57
129,364,236
0
0
null
null
null
null
UTF-8
Java
false
false
2,636
java
/****************************************************************************** * Copyright © 2015-7532 NOX, Inc. [NEPOLIX]-(Behrooz Shahriari) * * All rights reserved. * * * * The source code, other & all material, and documentation * * contained herein are, and remains the property of HEX Inc. * * and its suppliers, if any. The intellectual and technical * * concepts contained herein are proprietary to NOX Inc. and its * * suppliers and may be covered by U.S. and Foreign Patents, patents * * in process, and are protected by trade secret or copyright law. * * Dissemination of the foregoing material or reproduction of this * * material is strictly forbidden forever. * ******************************************************************************/ package com.nepolix.misha.android.sdk.task.handler.core.task; import android.content.Context; import android.os.Handler; import android.os.Looper; import com.nepolix.misha.android.sdk.task.handler.core.engine.ITaskEngine; import com.nepolix.misha.android.sdk.task.handler.core.engine.TaskListener; import static com.nepolix.misha.android.sdk.task.handler.core.engine.ITaskEngine.OBJECT_LOCK_ASYNC; /** * @author Behrooz Shahriari * @since 3/9/17 */ public abstract class AsyncTask < R > extends Task { Context context; public AsyncTask ( ) { super ( ); } public AsyncTask ( Context context ) { super ( ); this.context = context; } @Override public void execute ( ITaskEngine iTaskRunner, TaskListener listener ) { R r = inBackground ( ); // System.out.println ( "AsyncTask after background " + r ); synchronized ( OBJECT_LOCK_ASYNC ) { Handler handler = context == null ? new Handler ( Looper.getMainLooper ( ) ) : new Handler ( context.getMainLooper ( ) ); handler.post ( new Runnable ( ) { @Override public void run ( ) { // System.out.println ( "AsyncTask before UI " + r ); onUI ( r ); // System.out.println ( "AsyncTask before UI " + r ); } } ); // System.out.println ( "AsyncTask before finish " + r ); } listener.finish ( ); } protected abstract R inBackground ( ); protected abstract void onUI ( R r ); }
[ "behrooz.shahriari@gmail.com" ]
behrooz.shahriari@gmail.com
8d84e80628a08e1ac8ce0a074ddfe2e37e58ff98
728b3526ee965ba1e4ccc4214c98f3f8132e2e8a
/Projects/AndroidHelloWorld/AndroidHelloWorld/obj/Debug/android/androidhelloworld/androidhelloworld/R.java
fb19f807a6b4c6513c407be9c649022c981e2718
[]
no_license
fccoul/Projects-VS-2013
273ec387a99733a54d5565e0c40d2e02b106f0bc
cc0e6ff62265ecfd3ac0a773dd9e991230a88b2b
refs/heads/master
2020-12-30T15:55:16.938215
2017-09-28T13:42:25
2017-09-28T13:42:25
91,188,246
0
0
null
null
null
null
UTF-8
Java
false
false
911
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 androidhelloworld.androidhelloworld; public final class R { public static final class attr { } public static final class drawable { public static final int icon=0x7f020000; public static final int monoandroidsplash=0x7f020001; } public static final class id { public static final int MyButton=0x7f060000; } public static final class layout { public static final int main=0x7f030000; } public static final class string { public static final int ApplicationName=0x7f040001; public static final int Hello=0x7f040000; } public static final class style { public static final int Mono_Android_Theme_Splash=0x7f050000; } }
[ "fccoul@gmail.com" ]
fccoul@gmail.com
5f972c2bbbcc77c16c09b47f376ebb4902d2c8cb
a82107723678b8f14edb913ba71fd3525e216d8f
/Assignment/src/Session4/SwapWithoutThird.java
4e49453af756ea883da70613e1f31761c6a916e6
[]
no_license
sameerKhan2/cdac
57a4b6b51206639120ff766de6cc89861f9cac77
c43e7810aaa0ba0063b8fc2dc36dff51c2bf9e8a
refs/heads/master
2022-12-31T15:50:44.132177
2020-10-18T08:40:21
2020-10-18T08:40:21
303,415,481
0
0
null
null
null
null
UTF-8
Java
false
false
534
java
package Session4; import java.util.Scanner; public class SwapWithoutThird { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("value of a"); Scanner sc=new Scanner(System.in); int a=sc.nextInt(); System.out.println("value of b"); int b=sc.nextInt(); swap(a,b); } public static void swap(int a,int b) { a=a+b; b=a-b; a=a-b; System.out.println("After swaping value of a "+a); System.out.println("After swaping value of b "+b); } }
[ "samee@192.168.1.36" ]
samee@192.168.1.36
1cc78c84c072624973cfd3b98c33182f19a29993
757dcad52480368c450000546dcb85493f3267e1
/src/pakiet/GraModyfikacjaLiczbyGraczy.java
a0dcb4c08016ebbb8b1de7b9dc1fd6f35b160bd3
[]
no_license
tomekcm4/Gra-w-zgadywanie-liczby
201a6adf8ad1f214acd9d56a2b088786cbbbd878
91d18bbb9ce3f038d64109f67af12f14f3b103e2
refs/heads/master
2021-01-03T07:50:28.150266
2020-02-12T10:46:14
2020-02-12T10:46:14
239,988,570
0
0
null
null
null
null
UTF-8
Java
false
false
1,711
java
package pakiet; import java.util.Random; import java.util.Scanner; public class GraModyfikacjaLiczbyGraczy { public static void main(String[] args) { Random rand = new Random(); int los = rand.nextInt(11); int liczbaGraczy; Scanner scan7 = new Scanner(System.in); // zamknac Scanner scan = new Scanner(System.in); Scanner scan2 = new Scanner(System.in); do { System.out.println(" Type number of players :"); while (!scan7.hasNextInt()) { System.out.println("Sorry, bad data"); scan7.next(); } liczbaGraczy = scan7.nextInt(); } while (liczbaGraczy <= 0); String gracze[] = new String[liczbaGraczy]; int liczbaProbGraczy[] = new int[liczbaGraczy]; int zgadywanyNumer = 11111; // zmienic petle i poprawic nazwe zmiennej for (int i = 1; i <= liczbaGraczy; i++) { // ++1 System.out.println("Imie gracza numer " + i); gracze[i - 1] = scan.nextLine(); } while (los != zgadywanyNumer) { int j; for (j = 0; j < gracze.length; j++) { System.out.println(" Teraz zgaduje " + gracze[j]); // zamknac System.out.println("Zgadnij liczbe o 0 do 10"); while (!scan2.hasNextInt()) { System.out.println("Nie rozpoznaje tej liczby, podaj jeszcze raz"); scan2.next(); } zgadywanyNumer = scan2.nextInt(); liczbaProbGraczy[j]++; if (zgadywanyNumer == los) { System.out.println("Wygral " + gracze[j] + "\n"); for (int c = 0; c < gracze.length; c++) { System.out.println("Liczba prob gracza " + gracze[c] + " wynosi " + liczbaProbGraczy[c]); } break; } /* * else if (j == gracze.length) { j = -1; } */ } } scan7.close(); scan.close(); scan2.close(); } }
[ "tomasz.mlynarski@hp.com" ]
tomasz.mlynarski@hp.com
823458761038f1716be764369c52351dedd1ebf2
681e048050aeb9c3d64194a43e56c21d94de6fa1
/FriendFinder_Android/src/de/tudresden/inf/rn/mobilis/friendfinder/MapActivity.java
ddba1aa394fc481d0fd0cb5e98a81bc72249354f
[]
no_license
mobilis/FriendFinder
1f4236b5aba1c6e23d800629eb0998d7a77b1e4e
5d44e28a11cfe1b98c7c0f27b6cae50f9175f50c
refs/heads/master
2021-01-10T20:04:03.310715
2013-11-27T09:11:19
2013-11-27T09:11:19
10,241,959
1
4
null
2013-11-27T09:11:20
2013-05-23T11:09:20
Java
UTF-8
Java
false
false
6,940
java
package de.tudresden.inf.rn.mobilis.friendfinder; import java.util.HashMap; import java.util.Map; import android.graphics.Color; import android.location.Location; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.support.v4.app.FragmentActivity; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.GoogleMap.OnCameraChangeListener; import com.google.android.gms.maps.GoogleMap.OnInfoWindowClickListener; import com.google.android.gms.maps.GoogleMap.OnMapClickListener; import com.google.android.gms.maps.GoogleMap.OnMapLongClickListener; import com.google.android.gms.maps.GoogleMap.OnMarkerClickListener; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.CameraPosition; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; import com.google.android.gms.maps.model.Polyline; import com.google.android.gms.maps.model.PolylineOptions; import de.tudresden.inf.rn.mobilis.eet.GPXTrack; import de.tudresden.inf.rn.mobilis.eet.ILocationProxy; import de.tudresden.inf.rn.mobilis.friendfinder.clientstub.ClientData; import de.tudresden.inf.rn.mobilis.friendfinder.service.ServiceConnector; /** * MapActivity with GoogleMaps-Fragment * */ public class MapActivity extends FragmentActivity implements OnMapClickListener, OnMapLongClickListener, OnCameraChangeListener, OnMarkerClickListener, OnInfoWindowClickListener { public static final String TAG = "MapActivity"; /** * show the status of the tracking-class in a gray-box at the bottom of the * map */ private final boolean showEETStatus = true; private GoogleMap mMap; private Toast toast; private TextView eet_status; /** * save the markers for the chat-members */ private HashMap<String, Marker> markers = new HashMap<String, Marker>(); private ServiceConnector mServiceConnector; /********************* Handler **********************/ /** * called, if the BackgroundService bound successfully */ private Handler onServiceBoundHandler = new Handler() { public void handleMessage(Message msg) { mServiceConnector.getService().registerMUCListener( MapActivity.this, onNewMUCMessageHandler); setUpMapIfNeeded(); updateMarkerList(); } }; /** * called, if a new muc-message was received * update the marker-list */ private Handler onNewMUCMessageHandler = new Handler() { public void handleMessage(Message msg) { // Display a toast on top of the screen String text = mServiceConnector.getService().parseXMLMUCMessage( msg.obj.toString(), true); updateMarkerList(); if (text.length() > 0) { toast = Toast.makeText(MapActivity.this, text, Toast.LENGTH_LONG); toast.show(); } } }; /****************** activity-methods **********************/ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_map); eet_status = (TextView) findViewById(R.id.map_eet_status); toast = Toast.makeText(this, "null", Toast.LENGTH_SHORT); mServiceConnector = new ServiceConnector(this); mServiceConnector.bindService(onServiceBoundHandler); } @Override public void onResume() { super.onResume(); } /*************** class-specific functions *******************/ /** * update the markers and the prediction-status */ public void updateMarkerList() { if (mMap != null) { mMap.clear(); markers.clear(); Map<String, ClientData> cdl = mServiceConnector.getService() .getClientDataList(); for (ClientData cd : cdl.values()) { String color = cd.getColor(); int red = (int) (Integer.parseInt(color.subSequence(1, 3) .toString(), 16) / 255.0f) * 100; int green = (int) (Integer.parseInt(color.subSequence(3, 5) .toString(), 16) / 255.0f) * 100; int blue = (int) (Integer.parseInt(color.subSequence(5, 7) .toString(), 16) / 255.0f) * 100; float hsv[] = new float[3]; Color.RGBToHSV(red, green, blue, hsv); Marker m = mMap.addMarker(new MarkerOptions() .position( new LatLng(cd.getClientLocation().getLat(), cd .getClientLocation().getLng())) .title(cd.getName()) .icon(BitmapDescriptorFactory.defaultMarker(hsv[0]))); markers.put(cd.getJid(), m); } } if (this.showEETStatus) updateEETStatus(); } /** * update prediction-status and the polyline for the prediction-track */ private void updateEETStatus() { ILocationProxy eet = mServiceConnector.getService().getLocationProxy(); eet_status.setText(eet.getEETStatus()); if (eet.getPredStatus() == ILocationProxy.PRED_ON) { PolylineOptions options = new PolylineOptions().width(5).color( Color.RED); for (GPXTrack.Trkpt pt : eet.getPredTempTrack().getTrackPoints()) { options.add(new LatLng(pt.lat, pt.lon)); } mMap.addPolyline(options); } } /***************** map functions *********************/ private void setUpMapIfNeeded() { // Do a null check to confirm that we have not already instantiated the // map. if (mMap == null) { // Try to obtain the map from the MapFragment. // mMap = ((MapFragment) // getFragmentManager().findFragmentById(R.id.map)).getMap(); mMap = ((SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map)).getMap(); // Check if we were successful in obtaining the map. if (mMap != null) { setUpMap(); } } } /** set up map */ private void setUpMap() { mMap.setMyLocationEnabled(true); mMap.setOnMapClickListener(this); mMap.setOnMapLongClickListener(this); mMap.setOnCameraChangeListener(this); mMap.setOnMarkerClickListener(this); mMap.setOnInfoWindowClickListener(this); Location lastLoc = mServiceConnector.getService().getLocationProxy() .getLastLocation(); if (lastLoc != null) mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng( lastLoc.getLatitude(), lastLoc.getLongitude()), 15)); else mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng( 51.0456, 13.7366), 12)); } @Override public void onMapClick(LatLng point) { } @Override public void onMapLongClick(LatLng point) { toast.setText("long pressed, point=" + point); toast.show(); mMap.addMarker(new MarkerOptions().position(point).draggable(false) .visible(true).title("new marker")); } @Override public void onCameraChange(final CameraPosition position) { } @Override public boolean onMarkerClick(final Marker marker) { return false; } @Override public void onInfoWindowClick(Marker marker) { toast.setText(marker.getTitle()); toast.show(); } }
[ "s0224854@mail.zih.tu-dresden.de" ]
s0224854@mail.zih.tu-dresden.de
e1794163b9cc68efa25b5b486b30d7afa998974d
76e88d086a61b7522c1c1b31688f9ae64196de95
/src/linkedList/ArrayListOrLinkedList.java
fba1d75965ff99e41ba635a1aecbd5cab9db7697
[]
no_license
Akshitha797/Sample
121e1c1330a1639ffac22e04e789c2cf37f40d64
dccb83cd7a88b20535fb0c398abcc0ea12cf5ec6
refs/heads/master
2020-04-23T02:26:22.810659
2019-02-26T05:44:46
2019-02-26T05:44:46
170,846,610
0
0
null
null
null
null
UTF-8
Java
false
false
837
java
package linkedList; import java.util.ArrayList; import java.util.LinkedList; public class ArrayListOrLinkedList { public static void main(String[] args) { LinkedList<Integer> ll=new LinkedList<Integer>(); for(int i=0;i<10e5;i++) ll.add(i); System.out.println("In progress......"); long start=System.currentTimeMillis(); for(int i=0;i<10e5;i++) ll.add(i); long end=System.currentTimeMillis(); System.out.println("Time taken for linkedList:"+(end-start)); ArrayList<Integer> al=new ArrayList<Integer>(); for(int i=0;i<10e5;i++) al.add(i); System.out.println("In progress......"); long start1=System.currentTimeMillis(); for(int i=0;i<10e5;i++) al.add(i); long end1=System.currentTimeMillis(); System.out.println("Time taken for ArrayList:"+(end1-start1)); } }
[ "akshithareddy797@gmail.com" ]
akshithareddy797@gmail.com
9aff5955ac0ddec9e3d44b58fff7cd1fd2d88427
74ae24d049cfcab4f477dde92367094890aec688
/services/project_service/src/java/main/com/topcoder/service/project/ProjectHasCompetitionsFault.java
65e2300383eeba3a13688b4a0cccc934a4d8244b
[]
no_license
appirio-tech/direct-app
8fa562f769db792eb244948f0d375604ac853ef1
002aa5e67064a85ed9752d651d86403b1268cf38
refs/heads/dev
2023-08-09T20:01:29.514463
2022-12-21T01:19:53
2022-12-21T01:19:53
23,885,120
21
78
null
2022-12-21T01:41:11
2014-09-10T17:49:11
Java
UTF-8
Java
false
false
1,148
java
/* * Copyright (C) 2008 TopCoder Inc., All Rights Reserved. */ package com.topcoder.service.project; /** * <p> * This exception is thrown to indicate the fault that a project to be deleted has competitions. * </p> * <p> * It extends <code>{@link ProjectServiceFault}</code> to get the functionality of error messages. Note that no cause * is stored since the cause will not be serialized/deserialized as part of the WSDL fault contract. * </p> * <p> * <b>Thread Safety</b>: This class is thread safe as it has no state and the super class is thread safe. * </p> * * @author humblefool, FireIce * @version 1.0 */ public class ProjectHasCompetitionsFault extends ProjectServiceFault { /** * <p> * Represents the serial version unique id. * </p> */ private static final long serialVersionUID = 6084373770205177760L; /** * <p> * Constructs this fault with an error message. * </p> * * @param message * The error message describing this fault. Possibly null/empty. */ public ProjectHasCompetitionsFault(String message) { super(message); } }
[ "hohosky@gmail.com" ]
hohosky@gmail.com
19e19ba780c39083af515a1e3dc7ff09eab579d3
cf662cf631376872ff8d3b0440a6bf0a8ccb6760
/src/main/java/com/ssm/crud/bean/Msgs.java
1ce1b9b550b4653fe2aab97d62b0effec6bec4aa
[]
no_license
Hongzenghong/SSM
5ef5efd8e4365c5d67ac9be219df107bfa45b2a2
60b19d6c6f33987080fb87e1ff2398fa1daccaaa
refs/heads/master
2020-04-01T22:40:40.191551
2018-10-19T07:59:33
2018-10-19T07:59:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,058
java
package com.ssm.crud.bean; import java.util.HashMap; import java.util.Map; public class Msgs { //状态码 100=成功 200=失败 private int code; //提示信息 private String msg; //用户要返回浏览器的数据 private Map<String,Object> extend=new HashMap<String,Object>(); public static Msgs success() { Msgs result=new Msgs(); result.setCode(100); result.setMsg("处理成功!"); return result; } public static Msgs fail() { Msgs result=new Msgs(); result.setCode(200); result.setMsg("处理失败!"); return result; } public Msgs add(String key,Object value) { this.getExtend().put(key, value); return this; } public int getCode() { return code; } public void setCode(int code) { this.code = code; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public Map<String, Object> getExtend() { return extend; } public void setExtend(Map<String, Object> extend) { this.extend = extend; } }
[ "531600648_glb@qq.com" ]
531600648_glb@qq.com
a99e2fd9c6e14f46b30bda69fdb9c9303c34b12d
69470007353a8d5e7dc4481b1aa105b705a4ad9c
/src/main/java/com/neo/entity/Car.java
f547c97ffc64a5d383879a5f613600e4eb796f65
[ "MIT" ]
permissive
qiuTowei/petmanage
602dd35a05e2a29ad96af275376c08cb72449794
d99c2dc9c1c4e536e86da5c39457d439c92bdc17
refs/heads/main
2023-03-11T15:36:57.137232
2021-02-24T03:03:13
2021-02-24T03:03:13
341,761,060
0
0
null
null
null
null
UTF-8
Java
false
false
2,469
java
package com.neo.entity; public class Car { private String carID; private String userID; private String freshID; private String freshName; private String freshSize; private String receiver; private String phone; private String address; private int freshPrice; private int count; private String url; private int num; private String billState; private String totalprice; public String getCarID() { return carID; } public void setCarID(String carID) { this.carID = carID; } public String getUserID() { return userID; } public void setUserID(String userID) { this.userID = userID; } public String getFreshID() { return freshID; } public void setFreshID(String freshID) { this.freshID = freshID; } public String getFreshName() { return freshName; } public void setFreshName(String freshName) { this.freshName = freshName; } public String getFreshSize() { return freshSize; } public void setFreshSize(String freshSize) { this.freshSize = freshSize; } public int getFreshPrice() { return freshPrice; } public void setFreshPrice(int freshPrice) { this.freshPrice = freshPrice; } public int getCount() { return count; } public void setCount(int count) { this.count = count; } public String getReceiver() { return receiver; } public void setReceiver(String receiver) { this.receiver = receiver; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public int getNum() { return num; } public void setNum(int num) { this.num = num; } public String getBillState() { return billState; } public void setBillState(String billState) { this.billState = billState; } public String getTotalprice() { return totalprice; } public void setTotalprice(String totalprice) { this.totalprice = totalprice; } }
[ "qiuwei1991@yeah.net" ]
qiuwei1991@yeah.net
badc074161e972b77518b2ab473f10b1f499a60c
e7b1513756ab1094d705b36b3e86f19eb73dc549
/src/main/java/com/fish/business/controller/MediaController.java
cd4e923260db0842e1448fd3aeda9db5b6b2eb23
[]
no_license
1119537395/DigitalMediaMIS
5d810677dd6b61c11995cd19d069d1b767104652
10d07756a0f8f3c6bfab7717f1db2cb2b0e891b9
refs/heads/master
2023-05-04T09:37:44.111496
2021-05-04T14:53:52
2021-05-04T14:53:52
364,198,959
0
0
null
null
null
null
UTF-8
Java
false
false
3,727
java
package com.fish.business.controller; import com.fish.business.domain.Media; import com.fish.business.vo.MediaVo; import com.fish.system.controller.BaseController; import com.fish.system.utils.CommonReturnType; import com.fish.system.utils.DataGridView; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; /** * @ClassName MediaController * @Description 数字媒体作品前端控制器 * @Author 柚子茶 * @Date 2021/3/14 11:56 * @Version 1.0 */ @RestController() @RequestMapping("media") public class MediaController extends BaseController { /** * @param mediaVo * @return DataGridView * @description 查询数字媒体作品信息 * @author 柚子茶 * @date 2021/3/15 16:47 **/ @RequestMapping("loadMediaInfo") public DataGridView loadMediaInfo(MediaVo mediaVo) { return this.mediaService.queryMediaInfo(mediaVo); } /** * @param mediaVo * @return Media * @description 根据ID查询作品信息 * @author 柚子茶 * @date 2021/3/18 0:05 **/ @RequestMapping("loadMediaInfoById") public Media loadMediaInfoById(MediaVo mediaVo) { return this.mediaService.queryMediaInfoById(mediaVo); } /** * @param mediaVo * @return CommonReturnType * @description 保存数字媒体作品信息 * @author 柚子茶 * @date 2021/3/15 14:21 **/ @RequestMapping("addMediaInfo") public CommonReturnType addMediaInfo(MediaVo mediaVo) { try { this.mediaService.addMediaInfo(mediaVo); return CommonReturnType.UPLOAD_SUCCESS; } catch (Exception e) { e.printStackTrace(); return CommonReturnType.UPLOAD_FAILURE; } } /** * @param mediaVo * @return CommonReturnType * @description 更新 * @author 柚子茶 * @date 2021/3/18 13:02 **/ @RequestMapping("updateMediaViewCount") public CommonReturnType updateMediaViewCount(MediaVo mediaVo) { try { this.mediaService.updateMediaViewCount(mediaVo); return CommonReturnType.MODIFY_SUCCESS; } catch (Exception e) { e.printStackTrace(); return CommonReturnType.MODIFY_FAILURE; } } /** * @param mediaVo * @return CommonReturnType * @description 作品信息录入 * @author 柚子茶 * @date 2021/3/15 14:23 **/ @RequestMapping("inputMediaInfo") public CommonReturnType inputMediaInfo(MediaVo mediaVo) { try { this.mediaService.addMediaInfoByInput(mediaVo); return CommonReturnType.ADD_SUCCESS; } catch (Exception e) { e.printStackTrace(); return CommonReturnType.ADD_FAILURE; } } /** * @param mediaVo 数字媒体作品实体类 * @return CommonReturnType * @description 删除 * @author 柚子茶 * @date 2021/3/16 10:18 **/ @RequestMapping("deleteMediaInfo") public CommonReturnType deleteMediaInfo(MediaVo mediaVo) { try { this.mediaService.deleteMediaInfo(mediaVo); return CommonReturnType.DELETE_SUCCESS; } catch (Exception e) { e.printStackTrace(); return CommonReturnType.DELETE_FAILURE; } } /** * @param mediaVo * @return CommonReturnType * @description 更新 * @author 柚子茶 * @date 2021/3/16 10:22 **/ @RequestMapping("updateMediaInfo") public CommonReturnType updateMediaInfo(MediaVo mediaVo) { try { this.mediaService.updateMediaInfo(mediaVo); return CommonReturnType.MODIFY_SUCCESS; } catch (Exception e) { e.printStackTrace(); return CommonReturnType.MODIFY_FAILURE; } } /** * @param mediaVo * @return List<Media> * @description 查询作品信息 * @author 柚子茶 * @date 2021/3/16 13:55 **/ @RequestMapping("findMediaInfo") public List<Media> getMediaInfoByList(MediaVo mediaVo) { return mediaService.queryMediaInfoByList(mediaVo); } }
[ "1119537395@qq.com" ]
1119537395@qq.com
4b3c0230e2bb8db60e2a25502c729a8b219fba1a
947deec330a934d02a2320df29d807777da034bb
/src/main/java/com/ewelina/recipes/RecipesApplication.java
0664172b320400a93729dd0819e93461c8771d22
[]
no_license
Damrocka89/recipes
40447ff91eeaba05cc39aa0cf60969042d8bba22
ef9c339e1b42a42ecd811c0ef1d58e768d8c2e53
refs/heads/master
2020-06-20T19:57:32.644224
2019-09-13T14:01:00
2019-09-13T14:01:00
197,229,821
0
0
null
null
null
null
UTF-8
Java
false
false
326
java
package com.ewelina.recipes; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class RecipesApplication { public static void main(String[] args) { SpringApplication.run(RecipesApplication.class, args); } }
[ "EW.KRASOWSKA@HOTMAIL.COM" ]
EW.KRASOWSKA@HOTMAIL.COM
28c94b86dbd35393d684c1ad4764372f746a1665
23d0cdff4ce29a601d5322c32d7cacae3939511d
/src/main/java/leetcode/singleton/Singleton2.java
9d838e1e57d4f8164983a6a25abd750a86d64b1f
[]
no_license
SunShineShine/leetcode
fdde8f6a337936f328eac9de5d749a334ccd0f71
0c3fe0a1df37ecb5ba085d753246a68c0c300bce
refs/heads/master
2022-04-27T16:59:36.473975
2022-04-13T12:37:09
2022-04-13T12:37:09
45,396,633
0
0
null
null
null
null
UTF-8
Java
false
false
323
java
package leetcode.singleton; /** * 静态内部类单例 */ public class Singleton2 { private Singleton2() { } public static Singleton2 getSingleTon() { return Inner.singleton2; } private static class Inner { private static final Singleton2 singleton2 = new Singleton2(); } }
[ "lixuelin43@163.com" ]
lixuelin43@163.com
d505e76ac7ce0755d3747652046a5e330c2d9014
c86e0c8f44f8f1a8cc42fe89156949cd3023d6fe
/jOOQ-test/src/org/jooq/test/_/testcases/LoaderTests.java
784c37a714156b58c0959b302d1ce69d4803edff
[ "BSD-3-Clause", "Apache-2.0" ]
permissive
delostilos/jOOQ
e1248ed09cc1e0f8d06298ee1c069cd509cc2791
d5439b468ac487813c5cb3b7be5d6a3fb9441cc7
refs/heads/master
2021-01-18T09:23:05.943682
2013-05-04T09:19:19
2013-05-04T09:19:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
15,687
java
/** * Copyright (c) 2009-2013, Lukas Eder, lukas.eder@gmail.com * All rights reserved. * * This software is licensed to you under the Apache License, Version 2.0 * (the "License"); You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * . Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * . Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * . Neither the name "jOOQ" nor the names of its contributors may be * used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ package org.jooq.test._.testcases; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertNull; import static org.jooq.SQLDialect.ORACLE; import static org.jooq.impl.DSL.count; import java.sql.Date; import java.sql.SQLException; import java.util.Arrays; import org.jooq.Field; import org.jooq.Loader; import org.jooq.Record1; import org.jooq.Record2; import org.jooq.Record3; import org.jooq.Record6; import org.jooq.Result; import org.jooq.TableRecord; import org.jooq.UpdatableRecord; import org.jooq.test.BaseTest; import org.jooq.test.jOOQAbstractTest; import org.junit.Test; public class LoaderTests< A extends UpdatableRecord<A> & Record6<Integer, String, String, Date, Integer, ?>, AP, B extends UpdatableRecord<B>, S extends UpdatableRecord<S> & Record1<String>, B2S extends UpdatableRecord<B2S> & Record3<String, Integer, Integer>, BS extends UpdatableRecord<BS>, L extends TableRecord<L> & Record2<String, String>, X extends TableRecord<X>, DATE extends UpdatableRecord<DATE>, BOOL extends UpdatableRecord<BOOL>, D extends UpdatableRecord<D>, T extends UpdatableRecord<T>, U extends TableRecord<U>, UU extends UpdatableRecord<UU>, I extends TableRecord<I>, IPK extends UpdatableRecord<IPK>, T725 extends UpdatableRecord<T725>, T639 extends UpdatableRecord<T639>, T785 extends TableRecord<T785>> extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T725, T639, T785> { public LoaderTests(jOOQAbstractTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T725, T639, T785> delegate) { super(delegate); } @Test public void testLoader() throws Exception { jOOQAbstractTest.reset = false; jOOQAbstractTest.connection.setAutoCommit(false); Field<Integer> count = count(); // Empty CSV file // -------------- Loader<A> loader = create().loadInto(TAuthor()) .loadCSV("") .fields(TAuthor_ID()) .execute(); assertEquals(0, loader.processed()); assertEquals(0, loader.errors().size()); assertEquals(0, loader.stored()); assertEquals(0, loader.ignored()); assertEquals(2, (int) create().select(count).from(TAuthor()).fetchOne(count)); // Constraint violations (LAST_NAME is NOT NULL) // Loading is aborted // --------------------------------------------- loader = create().loadInto(TAuthor()) .loadCSV( "3\n" + "4") .fields(TAuthor_ID()) .ignoreRows(0) .execute(); // [#812] Reset stale connection. Seems to be necessary in Postgres resetLoaderConnection(); assertEquals(1, loader.processed()); assertEquals(1, loader.errors().size()); assertNotNull(loader.errors().get(0)); assertEquals(0, loader.stored()); assertEquals(1, loader.ignored()); assertEquals(2, (int) create().select(count).from(TAuthor()).fetchOne(count)); // Constraint violations (LAST_NAME is NOT NULL) // Errors are ignored // --------------------------------------------- loader = create().loadInto(TAuthor()) .onErrorIgnore() .loadCSV( "3\n" + "4") .fields(TAuthor_ID()) .ignoreRows(0) .execute(); // [#812] Reset stale connection. Seems to be necessary in Postgres resetLoaderConnection(); assertEquals(2, loader.processed()); assertEquals(2, loader.errors().size()); assertNotNull(loader.errors().get(0)); assertNotNull(loader.errors().get(1)); assertEquals(0, loader.stored()); assertEquals(2, loader.ignored()); assertEquals(2, (int) create().select(count).from(TAuthor()).fetchOne(count)); // Constraint violations (Duplicate records) // Loading is aborted // ----------------------------------------- loader = create().loadInto(TAuthor()) .onDuplicateKeyError() .onErrorAbort() .loadCSV( "1;'Kafka'\n" + "2;Frisch") .fields(TAuthor_ID(), TAuthor_LAST_NAME()) .quote('\'') .separator(';') .ignoreRows(0) .execute(); // [#812] Reset stale connection. Seems to be necessary in Postgres resetLoaderConnection(); assertEquals(1, loader.processed()); assertEquals(1, loader.errors().size()); assertNotNull(loader.errors().get(0)); assertEquals(0, loader.stored()); assertEquals(1, loader.ignored()); assertEquals(2, (int) create().select(count).from(TAuthor()).fetchOne(count)); // Constraint violations (Duplicate records) // Errors are ignored // ----------------------------------------- loader = create().loadInto(TAuthor()) .onDuplicateKeyIgnore() .onErrorAbort() .loadCSV( "1,\"Kafka\"\n" + "2,Frisch") .fields(TAuthor_ID(), TAuthor_LAST_NAME()) .ignoreRows(0) .execute(); assertEquals(2, loader.processed()); assertEquals(0, loader.errors().size()); assertEquals(2, loader.ignored()); assertEquals(2, (int) create().select(count).from(TAuthor()).fetchOne(count)); // Two records with different NULL representations for FIRST_NAME // -------------------------------------------------------------- loader = create().loadInto(TAuthor()) .loadCSV( "####Some Data####\n" + "\"ID\",\"Last Qualifier\"\r" + "3,\"\",Hesse\n" + "4,,Frisch") .fields(TAuthor_ID(), TAuthor_FIRST_NAME(), TAuthor_LAST_NAME()) .quote('"') .separator(',') .ignoreRows(2) .execute(); assertEquals(2, loader.processed()); assertEquals(2, loader.stored()); assertEquals(0, loader.ignored()); assertEquals(0, loader.errors().size()); assertEquals(2, (int) create().select(count) .from(TAuthor()) .where(TAuthor_ID().in(3, 4)) .and(TAuthor_LAST_NAME().in("Hesse", "Frisch")) .and(dialect() == ORACLE ? TAuthor_FIRST_NAME().isNull() : TAuthor_FIRST_NAME().equal("")) .fetchOne(count)); assertEquals(2, create().delete(TAuthor()).where(TAuthor_ID().in(3, 4)).execute()); // Two records but don't load one column, and specify a value for NULL // ------------------------------------------------------------------- loader = create().loadInto(TAuthor()) .loadCSV( "\"ID\",ignore,\"First Qualifier\",\"Last Qualifier\"\r" + "5,asdf,{null},Hesse\n" + "6,asdf,\"\",Frisch") .fields(TAuthor_ID(), null, TAuthor_FIRST_NAME(), TAuthor_LAST_NAME()) .nullString("{null}") .execute(); assertEquals(2, loader.processed()); assertEquals(2, loader.stored()); assertEquals(0, loader.ignored()); assertEquals(0, loader.errors().size()); Result<A> result = create().selectFrom(TAuthor()) .where(TAuthor_ID().in(5, 6)) .and(TAuthor_LAST_NAME().in("Hesse", "Frisch")) .orderBy(TAuthor_ID()) .fetch(); assertEquals(2, result.size()); assertEquals(5, (int) result.getValue(0, TAuthor_ID())); assertEquals(6, (int) result.getValue(1, TAuthor_ID())); assertEquals("Hesse", result.getValue(0, TAuthor_LAST_NAME())); assertEquals("Frisch", result.getValue(1, TAuthor_LAST_NAME())); assertEquals(null, result.getValue(0, TAuthor_FIRST_NAME())); assertEquals(dialect() == ORACLE ? null : "", result.getValue(1, TAuthor_FIRST_NAME())); assertEquals(2, create().delete(TAuthor()).where(TAuthor_ID().in(5, 6)).execute()); // Update duplicate records // ------------------------ switch (dialect()) { case ASE: case DERBY: case H2: case INGRES: case POSTGRES: case SQLITE: // TODO [#558] Simulate this log.info("SKIPPING", "Duplicate record insertion"); break; default: { loader = create().loadInto(TAuthor()) .onDuplicateKeyUpdate() .loadCSV( "\"ID\",\"First Qualifier\",\"Last Qualifier\"\r" + "1,Hermann,Hesse\n" + "7,\"Max\",Frisch") .fields(TAuthor_ID(), null, TAuthor_LAST_NAME()) .execute(); assertEquals(2, loader.processed()); assertEquals(2, loader.stored()); assertEquals(0, loader.ignored()); assertEquals(0, loader.errors().size()); result = create().selectFrom(TAuthor()) .where(TAuthor_LAST_NAME().in("Hesse", "Frisch")) .orderBy(TAuthor_ID()) .fetch(); assertEquals(2, result.size()); assertEquals(1, (int) result.getValue(0, TAuthor_ID())); assertEquals(7, (int) result.getValue(1, TAuthor_ID())); assertEquals("Hesse", result.getValue(0, TAuthor_LAST_NAME())); assertEquals("Frisch", result.getValue(1, TAuthor_LAST_NAME())); assertEquals("George", result.getValue(0, TAuthor_FIRST_NAME())); assertEquals(null, result.getValue(1, TAuthor_FIRST_NAME())); assertEquals(1, create().delete(TAuthor()).where(TAuthor_ID().in(7)).execute()); } } // [#812] Reset stale connection. Seems to be necessary in Postgres resetLoaderConnection(); // Rollback on duplicate keys // -------------------------- loader = create().loadInto(TAuthor()) .commitAll() .onDuplicateKeyError() .onErrorAbort() .loadCSV( "\"ID\",\"First Qualifier\",\"Last Qualifier\"\r" + "8,Hermann,Hesse\n" + "1,\"Max\",Frisch\n" + "2,Friedrich,Dürrenmatt") .fields(TAuthor_ID(), null, TAuthor_LAST_NAME()) .execute(); assertEquals(2, loader.processed()); assertEquals(0, loader.stored()); assertEquals(1, loader.ignored()); assertEquals(1, loader.errors().size()); assertEquals(1, loader.errors().get(0).rowIndex()); assertEquals( Arrays.asList("1", "Max", "Frisch"), Arrays.asList(loader.errors().get(0).row())); result = create().selectFrom(TAuthor()) .where(TAuthor_ID().in(8)) .orderBy(TAuthor_ID()) .fetch(); assertEquals(0, result.size()); // Commit and ignore duplicates // ---------------------------- loader = create().loadInto(TAuthor()) .commitAll() .onDuplicateKeyIgnore() .onErrorAbort() .loadCSV( "\"ID\",\"First Qualifier\",\"Last Qualifier\"\r" + "8,Hermann,Hesse\n" + "1,\"Max\",Frisch\n" + "2,Friedrich,Dürrenmatt") .fields(TAuthor_ID(), null, TAuthor_LAST_NAME()) .execute(); assertEquals(3, loader.processed()); assertEquals(1, loader.stored()); assertEquals(2, loader.ignored()); assertEquals(0, loader.errors().size()); result = create().selectFrom(TAuthor()) .where(TAuthor_ID().in(1, 2, 8)) .orderBy(TAuthor_ID()) .fetch(); assertEquals(3, result.size()); assertEquals(8, (int) result.getValue(2, TAuthor_ID())); assertNull(result.getValue(2, TAuthor_FIRST_NAME())); assertEquals("Hesse", result.getValue(2, TAuthor_LAST_NAME())); assertEquals("Coelho", result.getValue(1, TAuthor_LAST_NAME())); } private void resetLoaderConnection() throws SQLException { jOOQAbstractTest.connection.rollback(); jOOQAbstractTest.connection.close(); jOOQAbstractTest.connection = null; jOOQAbstractTest.connectionInitialised = false; jOOQAbstractTest.connection = delegate.getConnection(); jOOQAbstractTest.connection.setAutoCommit(false); } }
[ "lukas.eder@gmail.com" ]
lukas.eder@gmail.com
6c391715118ca958332265782ef4578487b79b44
6e3680ecf69084d42dbde3a69ea6cec40a5fb925
/src/com/system/entity/FolderEntry.java
9e1a30493cfdbe4d3330c440f86e40ffab7bc85c
[]
no_license
MasonLuo918/File-System
4db95b7e66f8e814a83ac8120962a0575078eb72
e5c7b17f1340c91ad0fd19e86682717354317d76
refs/heads/master
2020-08-03T17:59:05.723798
2019-11-06T14:03:40
2019-11-06T14:03:40
211,836,333
0
2
null
2019-10-20T11:25:47
2019-09-30T10:36:48
Java
WINDOWS-1252
Java
false
false
897
java
package com.system.entity; import java.util.Arrays; // TODO ÎļþÖØÃüÃû public class FolderEntry extends Entry { public FolderEntry(){ } public FolderEntry(byte[] data){ name = new String(Arrays.copyOfRange(data, 0,3 )).trim(); setProperty(data[5]); startBlockIndex = data[6]; } @Override protected byte[] toBytes() { byte[] data = new byte[8]; for(int i = 0; i < data.length; i++){ data[i] = 0; } byte[] name = this.name.getBytes(); for(int i = 0; i < 3; i++){ if(i < name.length){ data[i] = name[i]; }else{ data[i] = ' '; } } data[3] = ' '; data[4] = ' '; data[5] = getPropertyForByte(); data[6] = (byte) startBlockIndex; data[7] = 0; return data; } }
[ "masonluo918@gmail.com" ]
masonluo918@gmail.com
8a70af06f559c40d8567be28d5ad6a82582ebfef
3c18b4ab3a20dab175dc48758835fb1a854a92c8
/src-advance/cpp/gdb/GdbMonitorAllConfigCreator.java
5c5d580bfe7d1a82ddf3f3e8e060d8367f363ab9
[ "Apache-2.0" ]
permissive
lta-disco-unimib-it/BCT
2c6bcf52894db8798d8ad14c7ebe066262dd22e4
1c7fcb52f42bae9f5169c94032ded919cb1c42c4
refs/heads/master
2020-08-24T16:32:03.904958
2019-10-22T20:30:10
2019-10-22T20:30:10
216,863,231
0
0
null
null
null
null
UTF-8
Java
false
false
1,821
java
/******************************************************************************* * Copyright 2019 Fabrizio Pastore, Leonardo Mariani * * 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 cpp.gdb; import java.io.File; import java.io.IOException; public class GdbMonitorAllConfigCreator { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { // TODO Auto-generated method stub File parentFile = new File( args[0]); GdbMonitorAllConfigCreator c = new GdbMonitorAllConfigCreator(); File output = new File(args[1]); c.createConfig( output, parentFile ); } private void createConfig(File output, File parentFile) throws IOException { // List<FunctionMonitoringData> childrenDefs = GdbRegressionConfigCreator.extractFunctionsDefinitions( parentFile ); // // BufferedWriter w = new BufferedWriter ( new FileWriter( output ) ); // // // GdbRegressionConfigCreator.writeHeader( w ); // // // for (FunctionMonitoringData def : childrenDefs ){ // GdbRegressionConfigCreator.writeChildDef( w, def ); // } // // // GdbRegressionConfigCreator.writeFooter(w); // // w.close(); } }
[ "fabrizio.pastore@gmail.com" ]
fabrizio.pastore@gmail.com
4f438ba0e530483cb2da03fb7da776d1f61892dc
efabd68b0454bfd9549c1124abf659c90470d664
/src/datastructuresandalgorithmes/c07binarysearchtree/TreeNode.java
c9b9df705062b8993137165edd8fba400fb986ec
[]
no_license
obelinskyi/JavaCource
955951789b695ca9018b0b0f7deb5e98c27c2ea4
f1a5ea0e72d51706421c0873e5b99a686fd454b3
refs/heads/master
2020-07-01T01:51:52.754476
2019-10-21T19:21:35
2019-10-21T19:21:35
201,012,711
0
0
null
null
null
null
UTF-8
Java
false
false
1,690
java
package datastructuresandalgorithmes.c07binarysearchtree; import java.util.Objects; public class TreeNode { private Integer data; private TreeNode leftChild; private TreeNode rightChild; public TreeNode(Integer data) { this.data = data; } public TreeNode find(Integer data) { if (data.equals(this.data)) { return this; } else if (data < this.data && leftChild != null) { return this.getLeftChild().find(data); } else if (rightChild != null) { return this.getRightChild().find(data); } else { return null; } } public Integer getData() { return data; } public TreeNode getLeftChild() { return leftChild; } public void setLeftChild(TreeNode leftChild) { this.leftChild = leftChild; } public TreeNode getRightChild() { return rightChild; } public void setRightChild(TreeNode rightChild) { this.rightChild = rightChild; } public void insert(Integer data) { if (data >= this.data) { if (rightChild == null) { rightChild = new TreeNode(data); } else { rightChild.insert(data); } } else { if (leftChild == null) { leftChild = new TreeNode(data); } else { leftChild.insert(data); } } } @Override public String toString() { return "TreeNode{" + "data=" + data + ", leftChild=" + leftChild + ", rightChild=" + rightChild + '}'; } }
[ "ext-oleksandr.belinskyi@here.com" ]
ext-oleksandr.belinskyi@here.com
93a8e2829a78853b5ad541f81ce7a5b6fae1dc9d
d7eae4cb9ee6c7812ee0740c405c22f4f80952ab
/src/com/facebook/buck/util/ProcessHelper.java
ad87848cbea8b8e08ec7e6f106003c907cd5340e
[ "Apache-2.0" ]
permissive
aarongable/buck
be499a9facd3527e4588e600ab5faae3e0893f02
e10e67feb4b481f3ef53236ad9f5cb964073fe0f
refs/heads/master
2021-01-11T00:28:22.198175
2016-10-10T21:04:44
2016-10-10T21:04:44
70,529,005
1
0
null
2016-10-10T21:09:11
2016-10-10T21:09:10
null
UTF-8
Java
false
false
5,398
java
/* * Copyright 2012-present Facebook, 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.facebook.buck.util; import com.facebook.buck.log.Logger; import com.sun.jna.Pointer; import com.sun.jna.platform.win32.Kernel32; import com.sun.jna.platform.win32.WinNT; import com.zaxxer.nuprocess.NuProcess; import java.lang.reflect.Field; import java.lang.reflect.Method; import javax.annotation.Nullable; import javax.lang.model.SourceVersion; import oshi.SystemInfo; import oshi.software.os.OSProcess; import oshi.software.os.OperatingSystem; /** * A helper that provides facilities such as extracting the native process id of a {@link Process} * or gathering the process resource consumption. */ public abstract class ProcessHelper { private static final Logger LOG = Logger.get(ProcessHelper.class); // Comparing with the string value to avoid a strong dependency on JDK 9 private static final boolean IS_JDK9 = SourceVersion.latest().toString().equals("RELEASE_9"); private static final SystemInfo OSHI = new SystemInfo(); /** * This is a static helper class. */ private ProcessHelper() {} /** * Gets resource consumption of the process for the given pid. */ @Nullable public static ProcessResourceConsumption getProcessResourceConsumption(long pid) { try { OperatingSystem os = OSHI.getOperatingSystem(); OSProcess process = os.getProcess((int) pid); return ProcessResourceConsumption.builder() .setMemResident(process.getResidentSetSize()) .setMemSize(process.getVirtualSize()) .setCpuReal(process.getUpTime()) .setCpuUser(process.getUserTime()) .setCpuSys(process.getKernelTime()) .setCpuTotal(process.getUserTime() + process.getKernelTime()) .setIoBytesRead(0) // not implemented .setIoBytesWritten(0) // not implemented .setIoTotal(0) // not implemented .build(); } catch (Exception ex) { // do nothing return null; } } /** * @return whether the process has finished executing or not. */ public static boolean hasProcessFinished(Object process) { if (process instanceof NuProcess) { return !((NuProcess) process).isRunning(); } else if (process instanceof Process) { try { ((Process) process).exitValue(); return true; } catch (IllegalThreadStateException e) { return false; } } else { throw new IllegalArgumentException("Unknown process class: " + process.getClass().toString()); } } /** * Gets the native process identifier for the given process instance. */ @Nullable public static Long getPid(Object process) { if (process instanceof NuProcess) { return (long) ((NuProcess) process).getPID(); } else if (process instanceof Process) { // Until we switch to JDK9, we will have to go with this per-platform workaround. // In JDK9, `Process` has `getPid()` method that does exactly what we need here. // http://download.java.net/java/jdk9/docs/api/java/lang/Process.html#getPid-- Long pid = jdk9ProcessId(process); if (pid == null) { pid = unixLikeProcessId(process); } if (pid == null) { pid = windowsProcessId(process); } return pid; } else { throw new IllegalArgumentException("Unknown process class: " + process.getClass().toString()); } } private static Long jdk9ProcessId(Object process) { if (IS_JDK9) { try { // Invoking via reflection to avoid a strong dependency on JDK 9 Method getPid = Process.class.getMethod("getPid"); return (Long) getPid.invoke(process); } catch (Exception e) { LOG.warn(e, "Cannot get process id!"); } } return null; } private static Long unixLikeProcessId(Object process) { Class<?> clazz = process.getClass(); try { if (clazz.getName().equals("java.lang.UNIXProcess")) { Field field = clazz.getDeclaredField("pid"); field.setAccessible(true); return (long) field.getInt(process); } } catch (Exception e) { LOG.warn(e, "Cannot get process id!"); } return null; } private static Long windowsProcessId(Object process) { Class<?> clazz = process.getClass(); if (clazz.getName().equals("java.lang.Win32Process") || clazz.getName().equals("java.lang.ProcessImpl")) { try { Field f = clazz.getDeclaredField("handle"); f.setAccessible(true); long peer = f.getLong(process); Pointer pointer = Pointer.createConstant(peer); WinNT.HANDLE handle = new WinNT.HANDLE(pointer); return (long) Kernel32.INSTANCE.GetProcessId(handle); } catch (Exception e) { LOG.warn(e, "Cannot get process id!"); } } return null; } }
[ "facebook-github-bot-bot@fb.com" ]
facebook-github-bot-bot@fb.com
b44f52603abe73617cff67dc49468903b1484924
84fbe80f33ae1c2d34d93be5b041797ec8ca1078
/Calculator/app/src/main/java/com/master/ndavid/calculator/MainActivity.java
2b445abc59acbea8153effb436d2c7f40f90ce96
[ "MIT" ]
permissive
phndavid/calculator
e2abfa5c7f1e3a509442d5e55409f9314494d445
1552a38aeca21ce645465c454930a8b361701e41
refs/heads/master
2021-05-31T01:02:53.417110
2015-12-02T19:36:59
2015-12-02T19:36:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,662
java
package com.master.ndavid.calculator; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.EditText; import android.widget.TextView; import java.io.Console; public class MainActivity extends ActionBarActivity { private EditText editText; private TextView textView; private String operation; private String sign; public void getDelete(View view){ if(operation != null && !operation.equals("")) { operation = operation.substring(0, operation.length() - 1); editText.setText(operation); } } public void getClear(View view){ operation = ""; editText.setText(operation); textView.setText(operation); } public void getCero(View view){ operation +="0"; editText.setText(operation); } public void getOne(View view){ operation += "1"; editText.setText(operation); } public void getTwo(View view){ operation +="2"; editText.setText(operation); } public void getThree(View view){ operation +="3"; editText.setText(operation); } public void getFour(View view){ operation +="4"; editText.setText(operation); } public void getFive(View view){ operation +="5"; editText.setText(operation); } public void getSix(View view){ operation +="6"; editText.setText(operation); } public void getSeven(View view){ operation +="7"; editText.setText(operation); } public void getEight(View view){ operation +="8"; editText.setText(operation); } public void getNine(View view){ operation +="9"; editText.setText(operation);; } public void getAdd(View view){ verifyOperation("+"); } public void getSub(View view){ verifyOperation("-"); } public void getMul(View view){ verifyOperation("*"); } public void getDiv(View view){ verifyOperation("/"); } public void verifyOperation(String operator){ if(!operation.equals("")){ char end = operation.charAt(operation.length()-1); if(isOperator(end)) operation = operation.replace(end+"",operator); else operation +=operator; sign=operator; editText.setText(operation); } } public void getEquals(View view){ if(operation != null && !operation.equals("") && !sign.equals("")) { String[] numbers = operation.split('\\' + sign); float num1 = Float.parseFloat(numbers[0]); float num2 = Float.parseFloat(numbers[1]); float result = result(sign, num1, num2); editText.setText(result + ""); textView.setText(operation + "="); operation = result + ""; } } public Float result(String ope, float num1, float num2){ switch (ope){ case "+": return num1 + num2; case "-": return num1 - num2; case "/": return num1 / num2; case "*": return num1 * num2; } return null; } public boolean isOperator(char ope){ if(ope=='+' || ope=='-' || ope=='/' || ope=='*') return true; return false; } public void init(){ operation = ""; sign = ""; editText = (EditText) findViewById(R.id.editText); textView = (TextView) findViewById(R.id.textView); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); init(); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
[ "phndavid@gmail.com" ]
phndavid@gmail.com
df96fe7c119f6d7a07c8d1d7fd342e884831aa6c
e31054ef078330fa9f75576a82f5bb7bad1234a6
/stories/src/main/java/me/phum/runescape/stories/StoriesConfig.java
748608fdd186ccc1fa00778c9ad89106d0cc198f
[ "BSD-2-Clause", "LicenseRef-scancode-public-domain" ]
permissive
PatzHum/Runescape-Stories
f8dbbe33ad89c3d727030fd22a1b26fc15935bdb
37b9d9068089be01e349b08134da51c7abc10362
refs/heads/master
2023-01-23T07:48:57.056354
2020-11-26T05:32:49
2020-11-26T05:32:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
433
java
package me.phum.runescape.stories; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; @ConfigGroup("stories") public interface StoriesConfig extends Config { @ConfigItem( keyName = "greeting", name = "Welcome Greeting", description = "The message to show to the user when they login" ) default String greeting() { return "Hello"; } }
[ "patz.hum@gmail.com" ]
patz.hum@gmail.com
3ec595b325c36ed006a245d96dbae39758ae386f
e4c9109b0aeb8dd68dedba30d62bcc7e5055e6f0
/app/src/main/java/com/example/blockchain/LoginActivity.java
063e251c44611ed5437479ee32e08e2c4cb9bfc5
[]
no_license
sheridan0-1/Blockchain
570625fe8bfaa2abd7f3cd8205f56d5525526a70
33c0a27dcb3c4bfa7bab5391d111bbfdc8d8358f
refs/heads/master
2022-11-15T02:58:51.143396
2020-07-07T15:42:52
2020-07-07T15:42:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,168
java
package com.example.blockchain; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import org.w3c.dom.Text; public class LoginActivity extends AppCompatActivity{ EditText identification; EditText password; Button login; TextView changePassword; TextView forgetPassword; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); identification = (EditText)findViewById(R.id.identification); password = (EditText)findViewById(R.id.password); login = (Button)findViewById(R.id.login); changePassword = (TextView) findViewById(R.id.changePassword); forgetPassword = (TextView) findViewById(R.id.forgetPassword); login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(); } }); } }
[ "buda0christ@gmail.com" ]
buda0christ@gmail.com
0cff0a4d46da4ab663c11df7bc3dfdd35c7fd4b6
20542169d10f4bbf1c5379c79948a1daddaedc60
/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128b.java
95a69f00b0028f101ccbe67b9ce6b296b7deaf1c
[ "MIT" ]
permissive
DarkShadow44/bartworks
a2c7d2388d2e08ccbd68625475998cff085d9ffb
4c8957f3b456d981cdcded36aba79002b8487a44
refs/heads/master
2020-05-19T07:30:35.007374
2019-04-28T20:14:43
2019-04-28T20:14:43
184,899,516
0
0
MIT
2019-05-04T13:38:06
2019-05-04T13:38:06
null
UTF-8
Java
false
false
4,864
java
/* * Copyright (c) 2019 bartimaeusnek * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.github.bartimaeusnek.bartworks.system.oregen; import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; import com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader; import gregtech.api.enums.Materials; import gregtech.api.interfaces.ISubTagContainer; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidRegistry; import static com.github.bartimaeusnek.crossmod.galacticraft.GalacticraftProxy.uo_dimensionList; public class BW_WorldGenRoss128b extends BW_OreLayer { public Block getDefaultBlockToReplace(){ return Blocks.stone; } public BW_WorldGenRoss128b(String aName, boolean aDefault, int aMinY, int aMaxY, int aWeight, int aDensity, int aSize, ISubTagContainer top, ISubTagContainer bottom, ISubTagContainer between, ISubTagContainer sprinkled) { super(aName, aDefault, aMinY, aMaxY, aWeight, aDensity, aSize, top, bottom, between, sprinkled); } public static void init_OresRoss128() { new BW_WorldGenRoss128b("ore.mix.ross128.Thorianit", true, 30, 60, 17, 1, 16, WerkstoffLoader.Thorianit, Materials.Uraninite, Materials.Lepidolite, Materials.Spodumene); new BW_WorldGenRoss128b("ore.mix.ross128.carbon", true, 5, 25, 5, 4, 12, Materials.Graphite, Materials.Diamond, Materials.Coal, Materials.Graphite); new BW_WorldGenRoss128b("ore.mix.ross128.bismuth", true, 5, 80, 30, 1, 16, WerkstoffLoader.Bismuthinit, Materials.Stibnite, Materials.Bismuth, WerkstoffLoader.Bismutite); new BW_WorldGenRoss128b("ore.mix.ross128.TurmalinAlkali", true, 5, 200, 15, 4, 48, WerkstoffLoader.Olenit, WerkstoffLoader.FluorBuergerit, WerkstoffLoader.ChromoAluminoPovondrait, WerkstoffLoader.VanadioOxyDravit); new BW_WorldGenRoss128b("ore.mix.ross128.Roquesit", true, 5, 250, 3, 1, 12, WerkstoffLoader.Arsenopyrite, WerkstoffLoader.Ferberite, WerkstoffLoader.Loellingit, WerkstoffLoader.Roquesit); new BW_WorldGenRoss128b("ore.mix.ross128.Tungstate", true, 5, 250, 10, 4, 14, WerkstoffLoader.Ferberite, WerkstoffLoader.Huebnerit, WerkstoffLoader.Loellingit, Materials.Scheelite); new BW_WorldGenRoss128b("ore.mix.ross128.CopperSulfits", true, 40, 70, 80, 3, 24, WerkstoffLoader.Djurleit, WerkstoffLoader.Bornite, WerkstoffLoader.Wittichenit, Materials.Tetrahedrite); new BW_WorldGenRoss128b("ore.mix.ross128.Forsterit", true, 20, 180, 50, 2, 32, WerkstoffLoader.Forsterit, WerkstoffLoader.Fayalit, WerkstoffLoader.DescloiziteCUVO4, WerkstoffLoader.DescloiziteZNVO4); new BW_WorldGenRoss128b("ore.mix.ross128.Hedenbergit", true, 20, 180, 50, 2, 32, WerkstoffLoader.Hedenbergit, WerkstoffLoader.Fayalit, WerkstoffLoader.DescloiziteCUVO4, WerkstoffLoader.DescloiziteZNVO4); new BW_WorldGenRoss128b("ore.mix.ross128.RedZircon", true, 10, 40, 40, 3, 24, WerkstoffLoader.Fayalit,WerkstoffLoader.FuchsitAL , WerkstoffLoader.RedZircon,WerkstoffLoader.FuchsitCR); } public static void init_undergroundFluidsRoss128() { String ross128b = StatCollector.translateToLocal("planet.Ross128b"); uo_dimensionList.SetConfigValues(ross128b, ross128b, "veryheavyoil", "liquid_extra_heavy_oil", 0, 625, 40, 5); uo_dimensionList.SetConfigValues(ross128b, ross128b, "lava", FluidRegistry.getFluidName(FluidRegistry.LAVA), 0, 32767, 5, 5); uo_dimensionList.SetConfigValues(ross128b, ross128b, "gas_natural_gas", "gas_natural_gas", 0, 625, 65, 5); } @Override public boolean isGenerationAllowed(World aWorld, int aDimensionType, int aAllowedDimensionType) { return aWorld.provider.dimensionId == ConfigHandler.ross128BID; } }
[ "33183715+bartimaeusnek@users.noreply.github.com" ]
33183715+bartimaeusnek@users.noreply.github.com
99ff141faf8a401d93bbc4fd48f38af34e136268
2f4ef1e1a48dbe9084fd9fe91e6bb5acd35a1bec
/backend/java/interview/src/main/java/com/vinson/study/StringTest.java
b3a12d65a79f8b46be9047f650277e0eb9a36934
[]
no_license
vinsonxing/KM
c650d446221c27b4d5b4c8c2d2217a045dac0006
c4d525b1b35aea409660be779b1f19fa4aa781ab
refs/heads/master
2023-09-03T21:22:21.545734
2023-08-23T08:15:08
2023-08-23T08:15:08
45,591,006
0
0
null
null
null
null
UTF-8
Java
false
false
1,480
java
package com.vinson.study; /** * Created with IntelliJ IDEA. * User: qlu * Date: 6/13/14 * Time: 9:14 AM * To change this template use File | Settings | File Templates. */ //琚玣inal淇グ锛屽苟涓旈�氳繃甯搁噺琛ㄨ揪寮忓垵濮嬪寲鐨勫彉閲忥紝灏辨槸甯搁噺鍙橀噺 public class StringTest { public static void main(String[] args) { // String s = 1 + "23"; // System.out.println("answer is " + (s == "123")); // //// final String s2 = "a"; //// String s3 =s2 + "bc"; //// System.out.println("abc" == s3); //// String s2 = "a"; //// System.out.println("result1:"); //// System.out.println("a" == s2); // // String s1 = "ab"; // String s4 = getA(); // System.out.println("result2:"); // System.out.println(s1==s4); // // String s5 = new String("a"); // String s6 = new String("b"); // System.out.println("result3:"); // System.out.println(s5 == s6); String a = "a"; String b = "a"; String c = new String("a"); System.out.println("==== " + a.hashCode() + "==="+c.hashCode()); // System.out.println(a.equals(c)); System.out.println(a == c); // System.out.println((a+"b").equals(b+"b") ); getA(); } public static String getA() { final String s1 = "a"; // without final, totally different String s2 = s1 + "b"; // s2.intern(); System.out.println("result3:"); System.out.println(s2 == "ab"); return s2; } }
[ "vixing@cisco.com" ]
vixing@cisco.com
9a714d5488a1619b3c9d18757a018651246a026a
fc05322703594e40548f8e738449b9418efb7518
/src/main/java/lmdb/db/JdbcDataManager.java
2d7b182c55bef282352e9f258779b10d386cc8c6
[]
no_license
mauricioscastro/basex-lmdb
0028994871be99ec1f5d86738adfad18983d3046
bb8f32b800cb0f894c398c0019bc501196a1a801
refs/heads/master
2021-01-21T00:08:36.905964
2017-09-26T17:39:31
2017-09-26T17:39:31
41,042,448
1
1
null
2017-09-26T14:58:24
2015-08-19T15:24:11
Java
UTF-8
Java
false
false
2,118
java
package lmdb.db; import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; import lmdb.basex.LmdbQueryContext; import org.apache.log4j.Logger; import java.util.concurrent.ConcurrentHashMap; public class JdbcDataManager { private static final Logger logger = Logger.getLogger(JdbcDataManager.class); public static final ConcurrentHashMap<String,HikariDataSource> datasource = new ConcurrentHashMap<String,HikariDataSource>(); protected JdbcDataManager() {} public static synchronized void config(String config) { try { if (Boolean.parseBoolean(LmdbQueryContext.queryString("empty(//datasources/datasource)", config))) return; for (String id : LmdbQueryContext.queryString("for $d in //datasources/datasource return string($d/@id)", config).split("\\s")) { HikariConfig hcfg = new HikariConfig(); hcfg.setJdbcUrl(LmdbQueryContext.queryString("//datasources/datasource[@id='" + id + "']/jdbcburl/text()", config)); hcfg.setUsername(LmdbQueryContext.queryString("//datasources/datasource[@id='" + id + "']/username/text()", config)); hcfg.setPassword(LmdbQueryContext.queryString("//datasources/datasource[@id='" + id + "']/password/text()", config)); for (String name : LmdbQueryContext.queryString("for $p in //datasources/datasource[@id='" + id + "']/property return string($p/@name)", config).split("\\s")) { if (name.trim().isEmpty()) continue; hcfg.addDataSourceProperty(name, LmdbQueryContext.queryString("//datasources/datasource[@id='" + id + "']/property[@name='" + name + "']/text()", config)); } datasource.put(id, new HikariDataSource(hcfg)); } } catch(Exception e) { logger.warn(e.getMessage()); if (logger.isDebugEnabled()) logger.debug("", e); } } public static synchronized void stop() { for(HikariDataSource ds: datasource.values()) try { ds.close(); } catch(Exception i) {} } }
[ "mauricioscastro@hotmail.com" ]
mauricioscastro@hotmail.com
22b996f4a1b7515fdd5545fdf6542b4b8fc97f3a
ff15a439695498922fe031de09677ab62b8eb907
/src/com/icss/entity/TUser.java
b299975bbbb8777a6e9db78560c6a7c43af1c493
[]
no_license
iiZhangJun/MovieTickOrder
3934920ed8c9f822a602ecccb5a7df9dd1336cc5
55ef482a849f92a768d6b73e97ff6b6fa63b78c9
refs/heads/master
2022-09-05T11:57:10.978322
2020-05-27T01:21:12
2020-05-27T02:09:10
267,187,128
0
0
null
null
null
null
UTF-8
Java
false
false
918
java
package com.icss.entity; public class TUser { private String uname; private String password; private int role; private String email; private String tel; private double account; public TUser() { this.role = 2; this.account = 500; } public String getUname() { return uname; } public void setUname(String uname) { this.uname = uname; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public double getAccount() { return account; } public void setAccount(double account) { this.account = account; } public int getRole() { return role; } public void setRole(int role) { this.role = role; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getTel() { return tel; } public void setTel(String tel) { this.tel = tel; } }
[ "zhangjun960725@stu.xjtu.edu.cn" ]
zhangjun960725@stu.xjtu.edu.cn
0771a2e5cf89479821f53971e6f59f30105dc6a1
f290b9b6ba4ce328bf3250942e80fa0922be4844
/src/Test/Car.java
e6248ecb28ff733f869f985171bf4c7511afeea6
[]
no_license
rafinrabbi/cse111theory
d5ef14f4e432aa40eb3f4f4e3c62343d476d3336
2376eff9c033c52de57add6707e0a045671e6dee
refs/heads/master
2022-03-16T02:59:57.550380
2019-12-16T05:17:34
2019-12-16T05:17:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
858
java
package Test; public class Car { public String carmaker; public String carmodel; // String count; public Car(String carmaker,String carmodel){ this.carmaker=carmaker; this.carmodel=carmodel; // count="z"; } public Car(String carmaker){ this.carmaker=carmaker; // count="y"; } public Car(){ // count="x"; } // public boolean equals(Object obj){ // return true; // } public void start() { if(carmaker==null){ System.out.println("Car is Starting"); } if(carmaker!=null && carmodel==null){ System.out.println("Car make "+ carmaker + " is strating"); } if(carmaker!=null && carmodel!=null){ System.out.println("Car make"+ carmaker +", model:"+carmodel+ " is strating"); } } }
[ "Rawhatur" ]
Rawhatur
985091f103cf19926e0cdbca1f043baeed4ffad0
4818db1e60cd66a26e01aa16eda4198c602cb916
/src/com/company/Project.java
4d0209f2942d51bd6809de22ed3c9a0f3a7d0b81
[]
no_license
MyroslavShymon/visual-app-java
8bf8802df9b90dc990c2fd6cc6d201215e66e2cf
57c1e85a20c60fcd536ef42826e99d1a90697a78
refs/heads/main
2023-03-05T13:25:09.142592
2021-02-15T05:25:10
2021-02-15T05:25:10
338,975,459
0
0
null
null
null
null
UTF-8
Java
false
false
1,813
java
package com.company; import java.io.Serializable; import java.util.ArrayList; public class Project extends State implements Serializable { private String name; private String lang; private String date; private double cost; private ArrayList<Performer> performers = new ArrayList<>(); public Project(int rate, String description, String name, String lang, String date, double cost, Performer performer) { super(rate, description); this.name = name; this.lang = lang; this.date = date; this.cost = cost; this.performers.add(performer); } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getLang() { return lang; } public void setLang(String lang) { this.lang = lang; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } public double getCost() { return cost; } public void setCost(double cost) { this.cost = cost; } public ArrayList<Performer> getPerformers() { return performers; } public void setPerformers(Performer performers) { this.performers.add(performers); } public void EditProject(int rate, String description, String name, String lang, String date, double cost) { setRate(rate); setDescription(description); this.name = name; this.lang = lang; this.date = date; this.cost = cost; } @Override public String toString() { return "Назва: " + this.name + ", Мова програмування: " + this.lang + ", Дата: " + this.date + ", Ціна: " + this.cost; } }
[ "myroslavshymon@gmail.com" ]
myroslavshymon@gmail.com
1cdbd65782e20bf612b4ca716e066f8f2cc65693
dc5139735bbd81db022cf75f1e27167a63405115
/src/poker/version_graphics/view/CardLabel.java
a95d0275958fa71cfa9528c44b95b6d4fafecb5d
[ "BSD-3-Clause" ]
permissive
sushhn/PokerGame
f378ceaa9566f1627ae02b9ef6874b549c5f3015
7f72142d634b886566473faae673ac8835778207
refs/heads/master
2020-08-23T12:51:23.195906
2019-10-21T19:28:06
2019-10-21T19:28:06
216,620,797
0
0
null
null
null
null
UTF-8
Java
false
false
969
java
package poker.version_graphics.view; import javafx.scene.control.Label; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import poker.version_graphics.model.Card; public class CardLabel extends Label { public CardLabel() { super(); this.getStyleClass().add("card"); } public void setCard(Card card) { if (card != null) { String fileName = cardToFileName(card); Image image = new Image(this.getClass().getClassLoader().getResourceAsStream("poker/images/" + fileName)); ImageView imv = new ImageView(image); imv.fitWidthProperty().bind(this.widthProperty()); imv.fitHeightProperty().bind(this.heightProperty()); imv.setPreserveRatio(true); this.setGraphic(imv); } else { this.setGraphic(null); } } private String cardToFileName(Card card) { String rank = card.getRank().toString(); String suit = card.getSuit().toString(); return rank + "_of_" + suit + ".png"; } }
[ "56350376+sushhn@users.noreply.github.com" ]
56350376+sushhn@users.noreply.github.com
6efb34a1bdf40165be43286c544e3aa723dbb9d9
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/processing--processing/12bbf09d11a38bd8745a8693030578d7b6e87ffe/before/Sketch.java
d707389c306fb25d0c20d64a18f0d9aa9057ea54
[]
no_license
fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211003
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
UTF-8
Java
false
false
59,372
java
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ /* Part of the Processing project - http://processing.org Copyright (c) 2004-11 Ben Fry and Casey Reas Copyright (c) 2001-04 Massachusetts Institute of Technology 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 2 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, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package processing.app; import processing.app.ui.Editor; import processing.app.ui.Recent; import processing.app.ui.Toolkit; import processing.core.*; import java.awt.Color; import java.awt.Component; import java.awt.Container; import java.awt.EventQueue; import java.awt.FileDialog; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.*; import java.util.List; import javax.swing.*; import javax.swing.border.EmptyBorder; /** * Stores information about files in the current sketch. */ public class Sketch { private Editor editor; private Mode mode; /** main pde file for this sketch. */ private File primaryFile; /** * Name of sketch, which is the name of main file * (without .pde or .java extension) */ private String name; /** true if any of the files have been modified. */ private boolean modified; /** folder that contains this sketch */ private File folder; /** data folder location for this sketch (may not exist yet) */ private File dataFolder; /** code folder location for this sketch (may not exist yet) */ private File codeFolder; private SketchCode current; private int currentIndex; /** * Number of sketchCode objects (tabs) in the current sketch. Note that this * will be the same as code.length, because the getCode() method returns * just the code[] array, rather than a copy of it, or an array that's been * resized to just the relevant files themselves. * http://dev.processing.org/bugs/show_bug.cgi?id=940 */ private int codeCount; private SketchCode[] code; /** Moved out of Editor and into here for cleaner access. */ private boolean untitled; /** * Used by the command-line version to create a sketch object. * @param path location of the main .pde file * @param mode what flavor of sketch we're dealing with. */ public Sketch(String path, Mode mode) { this.editor = null; this.mode = mode; load(path); } /** * path is location of the main .pde file, because this is also * simplest to use when opening the file from the finder/explorer. */ public Sketch(String path, Editor editor) throws IOException { this.editor = editor; this.mode = editor.getMode(); load(path); } protected void load(String path) { primaryFile = new File(path); // get the name of the sketch by chopping .pde or .java // off of the main file name String mainFilename = primaryFile.getName(); int suffixLength = mode.getDefaultExtension().length() + 1; name = mainFilename.substring(0, mainFilename.length() - suffixLength); folder = new File(new File(path).getParent()); load(); } /** * Build the list of files. * <P> * Generally this is only done once, rather than * each time a change is made, because otherwise it gets to be * a nightmare to keep track of what files went where, because * not all the data will be saved to disk. * <P> * This also gets called when the main sketch file is renamed, * because the sketch has to be reloaded from a different folder. * <P> * Another exception is when an external editor is in use, * in which case the load happens each time "run" is hit. */ protected void load() { codeFolder = new File(folder, "code"); dataFolder = new File(folder, "data"); // get list of files in the sketch folder String list[] = folder.list(); // reset these because load() may be called after an // external editor event. (fix for 0099) codeCount = 0; code = new SketchCode[list.length]; String[] extensions = mode.getExtensions(); for (String filename : list) { // Ignoring the dot prefix files is especially important to avoid files // with the ._ prefix on Mac OS X. (You'll see this with Mac files on // non-HFS drives, i.e. a thumb drive formatted FAT32.) if (filename.startsWith(".")) continue; // Don't let some wacko name a directory blah.pde or bling.java. if (new File(folder, filename).isDirectory()) continue; // figure out the name without any extension String base = filename; // now strip off the .pde and .java extensions for (String extension : extensions) { if (base.toLowerCase().endsWith("." + extension)) { base = base.substring(0, base.length() - (extension.length() + 1)); // Don't allow people to use files with invalid names, since on load, // it would be otherwise possible to sneak in nasty filenames. [0116] if (isSanitaryName(base)) { code[codeCount++] = new SketchCode(new File(folder, filename), extension); } } } } // Remove any code that wasn't proper code = (SketchCode[]) PApplet.subset(code, 0, codeCount); // move the main class to the first tab // start at 1, if it's at zero, don't bother for (int i = 1; i < codeCount; i++) { //if (code[i].file.getName().equals(mainFilename)) { if (code[i].getFile().equals(primaryFile)) { SketchCode temp = code[0]; code[0] = code[i]; code[i] = temp; break; } } // sort the entries at the top sortCode(); // set the main file to be the current tab if (editor != null) { setCurrentCode(0); } } /** * Reload the current sketch. Used to update the text area when * an external editor is in use. */ public void reload() { // set current to null so that the tab gets updated // http://dev.processing.org/bugs/show_bug.cgi?id=515 current = null; // nuke previous files and settings load(); } protected void replaceCode(SketchCode newCode) { for (int i = 0; i < codeCount; i++) { if (code[i].getFileName().equals(newCode.getFileName())) { code[i] = newCode; break; } } } protected void insertCode(SketchCode newCode) { // make sure the user didn't hide the sketch folder ensureExistence(); // add file to the code/codeCount list, resort the list //if (codeCount == code.length) { code = (SketchCode[]) PApplet.append(code, newCode); codeCount++; //} //code[codeCount++] = newCode; } protected void sortCode() { // cheap-ass sort of the rest of the files // it's a dumb, slow sort, but there shouldn't be more than ~5 files for (int i = 1; i < codeCount; i++) { int who = i; for (int j = i + 1; j < codeCount; j++) { if (code[j].getFileName().compareTo(code[who].getFileName()) < 0) { who = j; // this guy is earlier in the alphabet } } if (who != i) { // swap with someone if changes made SketchCode temp = code[who]; code[who] = code[i]; code[i] = temp; // We also need to update the current tab if (currentIndex == i) { currentIndex = who; } else if (currentIndex == who) { currentIndex = i; } } } } boolean renamingCode; /** * Handler for the New Code menu option. */ public void handleNewCode() { // make sure the user didn't hide the sketch folder ensureExistence(); // if read-only, give an error if (isReadOnly()) { // if the files are read-only, need to first do a "save as". Messages.showMessage(Language.text("new.messages.is_read_only"), Language.text("new.messages.is_read_only.description")); return; } renamingCode = false; // editor.status.edit("Name for new file:", ""); promptForTabName(Language.text("editor.tab.rename.description")+":", ""); } /** * Handler for the Rename Code menu option. */ public void handleRenameCode() { // make sure the user didn't hide the sketch folder ensureExistence(); if (currentIndex == 0 && isUntitled()) { Messages.showMessage(Language.text("rename.messages.is_untitled"), Language.text("rename.messages.is_untitled.description")); return; } if (isModified()) { Messages.showMessage(Language.text("menu.file.save"), Language.text("rename.messages.is_modified")); return; } // if read-only, give an error if (isReadOnly()) { // if the files are read-only, need to first do a "save as". Messages.showMessage(Language.text("rename.messages.is_read_only"), Language.text("rename.messages.is_read_only.description")); return; } // ask for new name of file (internal to window) // TODO maybe just popup a text area? renamingCode = true; String prompt = (currentIndex == 0) ? Language.text("editor.sketch.rename.description") : Language.text("editor.tab.rename.description"); String oldName = (current.isExtension(mode.getDefaultExtension())) ? current.getPrettyName() : current.getFileName(); promptForTabName(prompt + ":", oldName); } /** * Displays a dialog for renaming or creating a new tab */ protected void promptForTabName(String prompt, String oldName) { final JTextField field = new JTextField(oldName); field.addKeyListener(new KeyAdapter() { // Forget ESC, the JDialog should handle it. // Use keyTyped to catch when the feller is actually added to the text // field. With keyTyped, as opposed to keyPressed, the keyCode will be // zero, even if it's enter or backspace or whatever, so the keychar // should be used instead. Grr. public void keyTyped(KeyEvent event) { //System.out.println("got event " + event); char ch = event.getKeyChar(); if ((ch == '_') || (ch == '.') || // allow.pde and .java (('A' <= ch) && (ch <= 'Z')) || (('a' <= ch) && (ch <= 'z'))) { // These events are allowed straight through. } else if (ch == ' ') { String t = field.getText(); int start = field.getSelectionStart(); int end = field.getSelectionEnd(); field.setText(t.substring(0, start) + "_" + t.substring(end)); field.setCaretPosition(start + 1); event.consume(); } else if ((ch >= '0') && (ch <= '9')) { // getCaretPosition == 0 means that it's the first char // and the field is empty. // getSelectionStart means that it *will be* the first // char, because the selection is about to be replaced // with whatever is typed. if (field.getCaretPosition() == 0 || field.getSelectionStart() == 0) { // number not allowed as first digit event.consume(); } } else if (ch == KeyEvent.VK_ENTER) { // Slightly ugly hack that ensures OK button of the dialog consumes // the Enter key event. Since the text field is the default component // in the dialog, OK doesn't consume Enter key event, by default. Container parent = field.getParent(); while (!(parent instanceof JOptionPane)) { parent = parent.getParent(); } JOptionPane pane = (JOptionPane) parent; final JPanel pnlBottom = (JPanel) pane.getComponent(pane.getComponentCount() - 1); for (int i = 0; i < pnlBottom.getComponents().length; i++) { Component component = pnlBottom.getComponents()[i]; if (component instanceof JButton) { final JButton okButton = (JButton) component; if (okButton.getText().equalsIgnoreCase("OK")) { ActionListener[] actionListeners = okButton.getActionListeners(); if (actionListeners.length > 0) { actionListeners[0].actionPerformed(null); event.consume(); } } } } } else { event.consume(); } } }); int userReply = JOptionPane.showOptionDialog(editor, new Object[] { prompt, field }, Language.text("editor.tab.new"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, new Object[] { Toolkit.PROMPT_OK, Toolkit.PROMPT_CANCEL }, field); if (userReply == JOptionPane.OK_OPTION) { nameCode(field.getText()); } } /** * This is called upon return from entering a new file name. * (that is, from either newCode or renameCode after the prompt) */ protected void nameCode(String newName) { newName = newName.trim(); if (newName.length() == 0) { return; } // make sure the user didn't hide the sketch folder ensureExistence(); // Add the extension here, this simplifies some of the logic below. if (newName.indexOf('.') == -1) { newName += "." + (renamingCode ? mode.getDefaultExtension() : mode.getModuleExtension()); } // if renaming to the same thing as before, just ignore. // also ignoring case here, because i don't want to write // a bunch of special stuff for each platform // (osx is case insensitive but preserving, windows insensitive, // *nix is sensitive and preserving.. argh) if (renamingCode) { if (newName.equalsIgnoreCase(current.getFileName())) { // exit quietly for the 'rename' case. // if it's a 'new' then an error will occur down below return; } } if (newName.startsWith(".")) { Messages.showWarning(Language.text("name.messages.problem_renaming"), Language.text("name.messages.starts_with_dot.description")); return; } int dot = newName.lastIndexOf('.'); String newExtension = newName.substring(dot+1).toLowerCase(); if (!mode.validExtension(newExtension)) { Messages.showWarning(Language.text("name.messages.problem_renaming"), Language.interpolate("name.messages.invalid_extension.description", newExtension)); return; } // Don't let the user create the main tab as a .java file instead of .pde if (!mode.isDefaultExtension(newExtension)) { if (renamingCode) { // If creating a new tab, don't show this error if (current == code[0]) { // If this is the main tab, disallow Messages.showWarning(Language.text("name.messages.problem_renaming"), Language.interpolate("name.messages.main_java_extension.description", newExtension)); return; } } } // dots are allowed for the .pde and .java, but not in the name // make sure the user didn't name things poo.time.pde // or something like that (nothing against poo time) String shortName = newName.substring(0, dot); String sanitaryName = Sketch.sanitizeName(shortName); if (!shortName.equals(sanitaryName)) { newName = sanitaryName + "." + newExtension; } // If changing the extension of a file from .pde to .java, then it's ok. // http://code.google.com/p/processing/issues/detail?id=776 // A regression introduced by Florian's bug report (below) years earlier. if (!(renamingCode && sanitaryName.equals(current.getPrettyName()))) { // Make sure no .pde *and* no .java files with the same name already exist // (other than the one we are currently attempting to rename) // http://processing.org/bugs/bugzilla/543.html for (SketchCode c : code) { if (c != current && sanitaryName.equalsIgnoreCase(c.getPrettyName())) { Messages.showMessage(Language.text("name.messages.new_sketch_exists"), Language.interpolate("name.messages.new_sketch_exists.description", c.getFileName(), folder.getAbsolutePath())); return; } } } File newFile = new File(folder, newName); if (renamingCode) { if (currentIndex == 0) { // get the new folder name/location String folderName = newName.substring(0, newName.indexOf('.')); File newFolder = new File(folder.getParentFile(), folderName); if (newFolder.exists()) { Messages.showWarning(Language.text("name.messages.new_folder_exists"), Language.interpolate("name.messages.new_folder_exists.description", newName)); return; } // renaming the containing sketch folder boolean success = folder.renameTo(newFolder); if (!success) { Messages.showWarning(Language.text("name.messages.error"), Language.text("name.messages.no_rename_folder.description")); return; } // let this guy know where he's living (at least for a split second) current.setFolder(newFolder); // folder will be set to newFolder by updateInternal() // unfortunately this can't be a "save as" because that // only copies the sketch files and the data folder // however this *will* first save the sketch, then rename // moved this further up in the process (before prompting for the name) // if (isModified()) { // Base.showMessage("Save", "Please save the sketch before renaming."); // return; // } // This isn't changing folders, just changes the name newFile = new File(newFolder, newName); if (!current.renameTo(newFile, newExtension)) { Messages.showWarning(Language.text("name.messages.error"), Language.interpolate("name.messages.no_rename_file.description", current.getFileName(), newFile.getName())); return; } // Tell each code file the good news about their new home. // current.renameTo() above already took care of the main tab. for (int i = 1; i < codeCount; i++) { code[i].setFolder(newFolder); } // Update internal state to reflect the new location updateInternal(sanitaryName, newFolder); // File newMainFile = new File(newFolder, newName + ".pde"); // String newMainFilePath = newMainFile.getAbsolutePath(); // // // having saved everything and renamed the folder and the main .pde, // // use the editor to re-open the sketch to re-init state // // (unfortunately this will kill positions for carets etc) // editor.handleOpenUnchecked(newMainFilePath, // currentIndex, // editor.getSelectionStart(), // editor.getSelectionStop(), // editor.getScrollPosition()); // // // get the changes into the sketchbook menu // // (re-enabled in 0115 to fix bug #332) // editor.base.rebuildSketchbookMenusAsync(); } else { // else if something besides code[0] if (!current.renameTo(newFile, newExtension)) { Messages.showWarning(Language.text("name.messages.error"), Language.interpolate("name.messages.no_rename_file.description", current.getFileName(), newFile.getName())); return; } } } else { // not renaming, creating a new file try { if (!newFile.createNewFile()) { // Already checking for IOException, so make our own. throw new IOException("createNewFile() returned false"); } } catch (IOException e) { Messages.showWarning(Language.text("name.messages.error"), Language.interpolate("name.messages.no_create_file.description", newFile, folder.getAbsolutePath()), e); return; } SketchCode newCode = new SketchCode(newFile, newExtension); //System.out.println("new code is named " + newCode.getPrettyName() + " " + newCode.getFile()); insertCode(newCode); } // sort the entries sortCode(); // set the new guy as current setCurrentCode(newName); // update the tabs editor.rebuildHeader(); } /** * Remove a piece of code from the sketch and from the disk. */ public void handleDeleteCode() { // make sure the user didn't hide the sketch folder ensureExistence(); // if read-only, give an error if (isReadOnly()) { // if the files are read-only, need to first do a "save as". Messages.showMessage(Language.text("delete.messages.is_read_only"), Language.text("delete.messages.is_read_only.description")); return; } // don't allow if untitled if (currentIndex == 0 && isUntitled()) { Messages.showMessage(Language.text("delete.messages.cannot_delete"), Language.text("delete.messages.cannot_delete.description")); return; } // confirm deletion with user, yes/no Object[] options = { Language.text("prompt.ok"), Language.text("prompt.cancel") }; String prompt = (currentIndex == 0) ? Language.text("warn.delete.sketch") : Language.interpolate("warn.delete.file", current.getPrettyName()); int result = JOptionPane.showOptionDialog(editor, prompt, Language.text("warn.delete"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); if (result == JOptionPane.YES_OPTION) { if (currentIndex == 0) { // need to unset all the modified flags, otherwise tries // to do a save on the handleNew() // delete the entire sketch Util.removeDir(folder); // get the changes into the sketchbook menu //sketchbook.rebuildMenus(); // make a new sketch, and i think this will rebuild the sketch menu //editor.handleNewUnchecked(); //editor.handleClose2(); editor.getBase().handleClose(editor, false); } else { // delete the file if (!current.deleteFile()) { Messages.showMessage(Language.text("delete.messages.cannot_delete.file"), Language.text("delete.messages.cannot_delete.file.description")+" \"" + current.getFileName() + "\"."); return; } // remove code from the list removeCode(current); // just set current tab to the main tab setCurrentCode(0); // update the tabs editor.rebuildHeader(); } } } protected void removeCode(SketchCode which) { // remove it from the internal list of files // resort internal list of files for (int i = 0; i < codeCount; i++) { if (code[i] == which) { for (int j = i; j < codeCount-1; j++) { code[j] = code[j+1]; } codeCount--; code = (SketchCode[]) PApplet.shorten(code); return; } } System.err.println("removeCode: internal error.. could not find code"); } /** * Move to the previous tab. */ public void handlePrevCode() { int prev = currentIndex - 1; if (prev < 0) prev = codeCount-1; setCurrentCode(prev); } /** * Move to the next tab. */ public void handleNextCode() { setCurrentCode((currentIndex + 1) % codeCount); } /** * Sets the modified value for the code in the frontmost tab. */ public void setModified(boolean state) { //System.out.println("setting modified to " + state); //new Exception().printStackTrace(System.out); if (current.isModified() != state) { current.setModified(state); calcModified(); } } protected void calcModified() { modified = false; for (int i = 0; i < codeCount; i++) { if (code[i].isModified()) { modified = true; break; } } editor.repaintHeader(); if (Platform.isMacOS()) { // http://developer.apple.com/qa/qa2001/qa1146.html Object modifiedParam = modified ? Boolean.TRUE : Boolean.FALSE; // https://developer.apple.com/library/mac/technotes/tn2007/tn2196.html#WINDOW_DOCUMENTMODIFIED editor.getRootPane().putClientProperty("Window.documentModified", modifiedParam); } } public boolean isModified() { return modified; } /** * Save all code in the current sketch. This just forces the files to save * in place, so if it's an untitled (un-saved) sketch, saveAs() should be * called instead. (This is handled inside Editor.handleSave()). */ public boolean save() throws IOException { // make sure the user didn't hide the sketch folder ensureExistence(); // first get the contents of the editor text area // if (current.isModified()) { current.setProgram(editor.getText()); // } // don't do anything if not actually modified //if (!modified) return false; if (isReadOnly()) { // if the files are read-only, need to first do a "save as". Messages.showMessage(Language.text("save_file.messages.is_read_only"), Language.text("save_file.messages.is_read_only.description")); // if the user cancels, give up on the save() if (!saveAs()) return false; } for (SketchCode sc : code) { if (sc.isModified()) { sc.save(); } } calcModified(); return true; } /** * Handles 'Save As' for a sketch. * <P> * This basically just duplicates the current sketch folder to * a new location, and then calls 'Save'. (needs to take the current * state of the open files and save them to the new folder.. * but not save over the old versions for the old sketch..) * <P> * Also removes the previously-generated .class and .jar files, * because they can cause trouble. */ public boolean saveAs() throws IOException { String newParentDir = null; String newName = null; String oldName = folder.getName(); // TODO rewrite this to use shared version from PApplet final String PROMPT = Language.text("save"); if (Preferences.getBoolean("chooser.files.native")) { // get new name for folder FileDialog fd = new FileDialog(editor, PROMPT, FileDialog.SAVE); if (isReadOnly() || isUntitled()) { // default to the sketchbook folder fd.setDirectory(Preferences.getSketchbookPath()); } else { // default to the parent folder of where this was fd.setDirectory(folder.getParent()); } String oldFolderName = folder.getName(); fd.setFile(oldFolderName); fd.setVisible(true); newParentDir = fd.getDirectory(); newName = fd.getFile(); } else { JFileChooser fc = new JFileChooser(); fc.setDialogTitle(PROMPT); if (isReadOnly() || isUntitled()) { // default to the sketchbook folder fc.setCurrentDirectory(new File(Preferences.getSketchbookPath())); } else { // default to the parent folder of where this was fc.setCurrentDirectory(folder.getParentFile()); } // can't do this, will try to save into itself by default //fc.setSelectedFile(folder); int result = fc.showSaveDialog(editor); if (result == JFileChooser.APPROVE_OPTION) { File selection = fc.getSelectedFile(); newParentDir = selection.getParent(); newName = selection.getName(); } } // user canceled selection if (newName == null) return false; // check on the sanity of the name String sanitaryName = Sketch.checkName(newName); File newFolder = new File(newParentDir, sanitaryName); if (!sanitaryName.equals(newName) && newFolder.exists()) { Messages.showMessage(Language.text("save_file.messages.sketch_exists"), Language.interpolate("save_file.messages.sketch_exists.description", sanitaryName)); return false; } newName = sanitaryName; // String newPath = newFolder.getAbsolutePath(); // String oldPath = folder.getAbsolutePath(); // if (newPath.equals(oldPath)) { // return false; // Can't save a sketch over itself // } // make sure there doesn't exist a tab with that name already // but ignore this situation for the first tab, since it's probably being // resaved (with the same name) to another location/folder. for (int i = 1; i < codeCount; i++) { if (newName.equalsIgnoreCase(code[i].getPrettyName())) { Messages.showMessage(Language.text("save_file.messages.tab_exists"), Language.interpolate("save_file.messages.tab_exists.description", newName)); return false; } } // check if the paths are identical if (newFolder.equals(folder)) { // just use "save" here instead, because the user will have received a // message (from the operating system) about "do you want to replace?" return save(); } // check to see if the user is trying to save this sketch inside itself try { String newPath = newFolder.getCanonicalPath() + File.separator; String oldPath = folder.getCanonicalPath() + File.separator; if (newPath.indexOf(oldPath) == 0) { Messages.showWarning(Language.text("save_file.messages.recursive_save"), Language.text("save_file.messages.recursive_save.description")); return false; } } catch (IOException e) { } // if the new folder already exists, then first remove its contents before // copying everything over (user will have already been warned). if (newFolder.exists()) { Util.removeDir(newFolder); } // in fact, you can't do this on Windows because the file dialog // will instead put you inside the folder, but it happens on OS X a lot. // now make a fresh copy of the folder newFolder.mkdirs(); // grab the contents of the current tab before saving // first get the contents of the editor text area if (current.isModified()) { current.setProgram(editor.getText()); } File[] copyItems = folder.listFiles(new FileFilter() { public boolean accept(File file) { String name = file.getName(); // just in case the OS likes to return these as if they're legit if (name.equals(".") || name.equals("..")) { return false; } // list of files/folders to be ignored during "save as" for (String ignorable : mode.getIgnorable()) { if (name.equals(ignorable)) { return false; } } // ignore the extensions for code, since that'll be copied below for (String ext : mode.getExtensions()) { if (name.endsWith(ext)) { return false; } } // don't do screen captures, since there might be thousands. kind of // a hack, but seems harmless. hm, where have i heard that before... if (name.startsWith("screen-")) { return false; } return true; } }); startSaveAsThread(oldName, newName, newFolder, copyItems); // save the other tabs to their new location (main tab saved below) for (int i = 1; i < codeCount; i++) { File newFile = new File(newFolder, code[i].getFileName()); code[i].saveAs(newFile); } // While the old path to the main .pde is still set, remove the entry from // the Recent menu so that it's not sticking around after the rename. // If untitled, it won't be in the menu, so there's no point. if (!isUntitled()) { Recent.remove(editor); } // save the main tab with its new name File newFile = new File(newFolder, newName + "." + mode.getDefaultExtension()); code[0].saveAs(newFile); updateInternal(newName, newFolder); // Make sure that it's not an untitled sketch setUntitled(false); // Add this sketch back using the new name Recent.append(editor); // let Editor know that the save was successful return true; } /** * Kick off a background thread to copy everything *but* the .pde files. * Due to the poor way (dating back to the late 90s with DBN) that our * save() and saveAs() methods have been implemented to return booleans, * there isn't a good way to return a value to the calling thread without * a good bit of refactoring (that should be done at some point). * As a result, this method will return 'true' before the full "Save As" * has completed, which will cause problems in weird cases. * * For instance, saving an untitled sketch that has an enormous data * folder while quitting. The save thread to move those data folder files * won't have finished before this returns true, and the PDE may quit * before the SwingWorker completes its job. * * <a href="https://github.com/processing/processing/issues/3843">3843</a> */ void startSaveAsThread(final String oldName, final String newName, final File newFolder, final File[] copyItems) { EventQueue.invokeLater(new Runnable() { public void run() { final JFrame frame = new JFrame("Saving \u201C" + newName + "\u201C..."); frame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); Box box = Box.createVerticalBox(); box.setBorder(new EmptyBorder(16, 16, 16, 16)); if (Platform.isMacOS()) { frame.setBackground(Color.WHITE); } JLabel label = new JLabel("Saving additional files from the sketch folder..."); box.add(label); final JProgressBar progressBar = new JProgressBar(0, 100); // no luck, stuck with ugly on OS X //progressBar.putClientProperty("JComponent.sizeVariant", "regular"); progressBar.setValue(0); progressBar.setStringPainted(true); box.add(progressBar); frame.getContentPane().add(box); frame.pack(); frame.setLocationRelativeTo(editor); Toolkit.setIcon(frame); frame.setVisible(true); new SwingWorker<Void, Void>() { @Override protected Void doInBackground() throws Exception { addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if ("progress".equals(evt.getPropertyName())) { progressBar.setValue((Integer) evt.getNewValue()); } } }); long totalSize = 0; for (File copyable : copyItems) { totalSize += Util.calcSize(copyable); } long progress = 0; setProgress(0); for (File copyable : copyItems) { if (copyable.isDirectory()) { copyDir(copyable, new File(newFolder, copyable.getName()), progress, totalSize); progress += Util.calcSize(copyable); } else { copyFile(copyable, new File(newFolder, copyable.getName()), progress, totalSize); if (Util.calcSize(copyable) < 512 * 1024) { // If the file length > 0.5MB, the copyFile() function has // been redesigned to change progress every 0.5MB so that // the progress bar doesn't stagnate during that time progress += Util.calcSize(copyable); setProgress((int) (progress * 100L / totalSize)); } } } return null; } /** * Overloaded copyFile that is called whenever a Save As is being done, * so that the ProgressBar is updated for very large files as well. */ void copyFile(File sourceFile, File targetFile, long progress, long totalSize) throws IOException { BufferedInputStream from = new BufferedInputStream(new FileInputStream(sourceFile)); BufferedOutputStream to = new BufferedOutputStream(new FileOutputStream(targetFile)); byte[] buffer = new byte[16 * 1024]; int bytesRead; int progRead = 0; while ((bytesRead = from.read(buffer)) != -1) { to.write(buffer, 0, bytesRead); progRead += bytesRead; if (progRead >= 512 * 1024) { // to update progress bar every 0.5MB progress += progRead; //progressBar.setValue((int) Math.min(Math.ceil(progress * 100.0 / totalSize), 100)); setProgress((int) (100L * progress / totalSize)); progRead = 0; } } // Final update to progress bar setProgress((int) (100L * progress / totalSize)); from.close(); from = null; to.flush(); to.close(); to = null; targetFile.setLastModified(sourceFile.lastModified()); targetFile.setExecutable(sourceFile.canExecute()); } long copyDir(File sourceDir, File targetDir, long progress, long totalSize) throws IOException { // Overloaded copyDir so that the Save As progress bar gets updated when the // files are in folders as well (like in the data folder) if (sourceDir.equals(targetDir)) { final String urDum = "source and target directories are identical"; throw new IllegalArgumentException(urDum); } targetDir.mkdirs(); String files[] = sourceDir.list(); for (String filename : files) { // Ignore dot files (.DS_Store), dot folders (.svn) while copying if (filename.charAt(0) == '.') { continue; } File source = new File(sourceDir, filename); File target = new File(targetDir, filename); if (source.isDirectory()) { progress = copyDir(source, target, progress, totalSize); //progressBar.setValue((int) Math.min(Math.ceil(progress * 100.0 / totalSize), 100)); setProgress((int) (100L * progress / totalSize)); target.setLastModified(source.lastModified()); } else { copyFile(source, target, progress, totalSize); progress += source.length(); //progressBar.setValue((int) Math.min(Math.ceil(progress * 100.0 / totalSize), 100)); setProgress((int) (100L * progress / totalSize)); } } return progress; } @Override public void done() { frame.dispose(); } }.execute(); } }); } /** * Update internal state for new sketch name or folder location. */ protected void updateInternal(String sketchName, File sketchFolder) { // reset all the state information for the sketch object String oldPath = getMainFilePath(); primaryFile = code[0].getFile(); // String newPath = getMainFilePath(); // editor.base.renameRecent(oldPath, newPath); name = sketchName; folder = sketchFolder; codeFolder = new File(folder, "code"); dataFolder = new File(folder, "data"); // set the main file to be the current tab //setCurrentCode(0); // nah, this might just annoy people // Name changed, rebuild the sketch menus calcModified(); // System.out.println("modified is now " + modified); editor.updateTitle(); editor.getBase().rebuildSketchbookMenus(); Recent.rename(editor, oldPath); // editor.header.rebuild(); } /** * Prompt the user for a new file to the sketch, then call the * other addFile() function to actually add it. */ public void handleAddFile() { // make sure the user didn't hide the sketch folder ensureExistence(); // if read-only, give an error if (isReadOnly()) { // if the files are read-only, need to first do a "save as". Messages.showMessage(Language.text("add_file.messages.is_read_only"), Language.text("add_file.messages.is_read_only.description")); return; } // get a dialog, select a file to add to the sketch String prompt = Language.text("file"); //FileDialog fd = new FileDialog(new Frame(), prompt, FileDialog.LOAD); FileDialog fd = new FileDialog(editor, prompt, FileDialog.LOAD); fd.setVisible(true); String directory = fd.getDirectory(); String filename = fd.getFile(); if (filename == null) return; // copy the file into the folder. if people would rather // it move instead of copy, they can do it by hand File sourceFile = new File(directory, filename); // now do the work of adding the file boolean result = addFile(sourceFile); if (result) { // editor.statusNotice("One file added to the sketch."); //Done from within TaskAddFile inner class when copying is completed } } /** * Add a file to the sketch. * <p/> * .pde or .java files will be added to the sketch folder. <br/> * .jar, .class, .dll, .jnilib, and .so files will all * be added to the "code" folder. <br/> * All other files will be added to the "data" folder. * <p/> * If they don't exist already, the "code" or "data" folder * will be created. * <p/> * @return true if successful. */ public boolean addFile(File sourceFile) { String filename = sourceFile.getName(); File destFile = null; String codeExtension = null; boolean replacement = false; // if the file appears to be code related, drop it // into the code folder, instead of the data folder if (filename.toLowerCase().endsWith(".class") || filename.toLowerCase().endsWith(".jar") || filename.toLowerCase().endsWith(".dll") || filename.toLowerCase().endsWith(".jnilib") || filename.toLowerCase().endsWith(".so")) { //if (!codeFolder.exists()) codeFolder.mkdirs(); prepareCodeFolder(); destFile = new File(codeFolder, filename); } else { for (String extension : mode.getExtensions()) { String lower = filename.toLowerCase(); if (lower.endsWith("." + extension)) { destFile = new File(this.folder, filename); codeExtension = extension; } } if (codeExtension == null) { prepareDataFolder(); destFile = new File(dataFolder, filename); } } // check whether this file already exists if (destFile.exists()) { Object[] options = { Language.text("prompt.ok"), Language.text("prompt.cancel") }; String prompt = Language.interpolate("add_file.messages.confirm_replace", filename); int result = JOptionPane.showOptionDialog(editor, prompt, "Replace", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); if (result == JOptionPane.YES_OPTION) { replacement = true; } else { return false; } } // If it's a replacement, delete the old file first, // otherwise case changes will not be preserved. // http://dev.processing.org/bugs/show_bug.cgi?id=969 if (replacement) { boolean muchSuccess = destFile.delete(); if (!muchSuccess) { Messages.showWarning(Language.text("add_file.messages.error_adding"), Language.interpolate("add_file.messages.cannot_delete.description", filename)); return false; } } // make sure they aren't the same file if ((codeExtension == null) && sourceFile.equals(destFile)) { Messages.showWarning(Language.text("add_file.messages.same_file"), Language.text("add_file.messages.same_file.description")); return false; } // Handles "Add File" when a .pde is used. For beta 1, this no longer runs // on a separate thread because it's totally unnecessary (a .pde file is // not going to be so large that it's ever required) and otherwise we have // to introduce a threading block here. // https://github.com/processing/processing/issues/3383 if (!sourceFile.equals(destFile)) { try { Util.copyFile(sourceFile, destFile); } catch (IOException e) { Messages.showWarning(Language.text("add_file.messages.error_adding"), Language.interpolate("add_file.messages.cannot_add.description", filename), e); return false; } } if (codeExtension != null) { SketchCode newCode = new SketchCode(destFile, codeExtension); if (replacement) { replaceCode(newCode); } else { insertCode(newCode); sortCode(); } setCurrentCode(filename); editor.repaintHeader(); if (isUntitled()) { // TODO probably not necessary? problematic? // Mark the new code as modified so that the sketch is saved current.setModified(true); } } else { if (isUntitled()) { // TODO probably not necessary? problematic? // If a file has been added, mark the main code as modified so // that the sketch is properly saved. code[0].setModified(true); } } return true; } /** * Change what file is currently being edited. Changes the current tab index. * <OL> * <LI> store the String for the text of the current file. * <LI> retrieve the String for the text of the new file. * <LI> change the text that's visible in the text area * </OL> */ public void setCurrentCode(int which) { // // for the tab sizing // if (current != null) { // current.visited = System.currentTimeMillis(); // System.out.println(current.visited); // } // if current is null, then this is the first setCurrent(0) if (((currentIndex == which) && (current != null)) || which >= codeCount || which < 0) { return; } // get the text currently being edited if (current != null) { current.setState(editor.getText(), editor.getSelectionStart(), editor.getSelectionStop(), editor.getScrollPosition()); } current = code[which]; currentIndex = which; current.visited = System.currentTimeMillis(); editor.setCode(current); editor.repaintHeader(); } /** * Internal helper function to set the current tab based on a name. * @param findName the file name (not pretty name) to be shown */ public void setCurrentCode(String findName) { for (int i = 0; i < codeCount; i++) { if (findName.equals(code[i].getFileName()) || findName.equals(code[i].getPrettyName())) { setCurrentCode(i); return; } } } /** * Create a temporary folder that includes the sketch's name in its title. */ public File makeTempFolder() { try { return Util.createTempFolder(name, "temp", null); } catch (IOException e) { Messages.showWarning(Language.text("temp_dir.messages.bad_build_folder"), Language.text("temp_dir.messages.bad_build_folder.description"), e); } return null; } /** * When running from the editor, take care of preparations before running * a build or an export. Also erases and/or creates 'targetFolder' if it's * not null, and if preferences say to do so when exporting. * @param targetFolder is something like applet, application, android... */ /* public void prepareBuild(File targetFolder) throws SketchException { // make sure the user didn't hide the sketch folder ensureExistence(); // don't do from the command line if (editor != null) { // make sure any edits have been stored current.setProgram(editor.getText()); // if an external editor is being used, need to grab the // latest version of the code from the file. if (Preferences.getBoolean("editor.external")) { // set current to null so that the tab gets updated // http://dev.processing.org/bugs/show_bug.cgi?id=515 current = null; // nuke previous files and settings load(); } } if (targetFolder != null) { // Nuke the old applet/application folder because it can cause trouble if (Preferences.getBoolean("export.delete_target_folder")) { System.out.println("temporarily skipping deletion of " + targetFolder); // Base.removeDir(targetFolder); // targetFolder.renameTo(dest); } // Create a fresh output folder (needed before preproc is run next) targetFolder.mkdirs(); } } */ /** * Make sure the sketch hasn't been moved or deleted by some * nefarious user. If they did, try to re-create it and save. * Only checks to see if the main folder is still around, * but not its contents. */ public void ensureExistence() { if (!folder.exists()) { // Disaster recovery, try to salvage what's there already. Messages.showWarning(Language.text("ensure_exist.messages.missing_sketch"), Language.text("ensure_exist.messages.missing_sketch.description")); try { folder.mkdirs(); modified = true; for (int i = 0; i < codeCount; i++) { code[i].save(); // this will force a save } calcModified(); } catch (Exception e) { Messages.showWarning(Language.text("ensure_exist.messages.unrecoverable"), Language.text("ensure_exist.messages.unrecoverable.description"), e); } } } /** * Returns true if this is a read-only sketch. Used for the * examples directory, or when sketches are loaded from read-only * volumes or folders without appropriate permissions. */ public boolean isReadOnly() { String apath = folder.getAbsolutePath(); List<Mode> modes = editor.getBase().getModeList(); // Make sure it's not read-only for another Mode besides this one // https://github.com/processing/processing/issues/773 for (Mode mode : modes) { if (apath.startsWith(mode.getExamplesFolder().getAbsolutePath()) || apath.startsWith(mode.getLibrariesFolder().getAbsolutePath())) { return true; } } // check to see if each modified code file can be written to // canWrite() doesn't work on directories for (int i = 0; i < codeCount; i++) { if (code[i].isModified() && code[i].fileReadOnly() && code[i].fileExists()) { //System.err.println("found a read-only file " + code[i].file); return true; } } return false; } // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . // Additional accessors added in 0136 because of package work. // These will also be helpful for tool developers. /** * Returns the name of this sketch. (The pretty name of the main tab.) */ public String getName() { return name; } /** * Returns a File object for the main .pde file for this sketch. */ public File getMainFile() { return primaryFile; } /** * Returns path to the main .pde file for this sketch. */ public String getMainFilePath() { return primaryFile.getAbsolutePath(); } /** * Returns the sketch folder. */ public File getFolder() { return folder; } /** * Returns the location of the sketch's data folder. (It may not exist yet.) */ public File getDataFolder() { return dataFolder; } public boolean hasDataFolder() { return dataFolder.exists(); } /** * Create the data folder if it does not exist already. As a convenience, * it also returns the data folder, since it's likely about to be used. */ public File prepareDataFolder() { if (!dataFolder.exists()) { dataFolder.mkdirs(); } return dataFolder; } /** * Returns the location of the sketch's code folder. (It may not exist yet.) */ public File getCodeFolder() { return codeFolder; } public boolean hasCodeFolder() { return (codeFolder != null) && codeFolder.exists(); } /** * Create the code folder if it does not exist already. As a convenience, * it also returns the code folder, since it's likely about to be used. */ public File prepareCodeFolder() { if (!codeFolder.exists()) { codeFolder.mkdirs(); } return codeFolder; } // public String getClassPath() { // return classPath; // } // public String getLibraryPath() { // return javaLibraryPath; // } public SketchCode[] getCode() { return code; } public int getCodeCount() { return codeCount; } public SketchCode getCode(int index) { return code[index]; } public int getCodeIndex(SketchCode who) { for (int i = 0; i < codeCount; i++) { if (who == code[i]) { return i; } } return -1; } public SketchCode getCurrentCode() { return current; } public int getCurrentCodeIndex() { return currentIndex; } public String getMainProgram() { return getCode(0).getProgram(); } public void setUntitled(boolean untitled) { // editor.untitled = u; this.untitled = untitled; editor.updateTitle(); } public boolean isUntitled() { // return editor.untitled; return untitled; } // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . /** * Convert to sanitized name and alert the user * if changes were made. */ static public String checkName(String origName) { String newName = sanitizeName(origName); if (!newName.equals(origName)) { String msg = Language.text("check_name.messages.is_name_modified"); System.out.println(msg); } return newName; } /** * Return true if the name is valid for a Processing sketch. Extensions of the form .foo are * ignored. */ public static boolean isSanitaryName(String name) { final int dot = name.lastIndexOf('.'); if (dot >= 0) { name = name.substring(0, dot); } return sanitizeName(name).equals(name); } static final boolean asciiLetter(char c) { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); } /** * Produce a sanitized name that fits our standards for likely to work. * <p/> * Java classes have a wider range of names that are technically allowed * (supposedly any Unicode name) than what we support. The reason for * going more narrow is to avoid situations with text encodings and * converting during the process of moving files between operating * systems, i.e. uploading from a Windows machine to a Linux server, * or reading a FAT32 partition in OS X and using a thumb drive. * <p/> * This helper function replaces everything but A-Z, a-z, and 0-9 with * underscores. Also disallows starting the sketch name with a digit * or underscore. * <p/> * In Processing 2.0, sketches can no longer begin with an underscore, * because these aren't valid class names on Android. */ static public String sanitizeName(String origName) { char orig[] = origName.toCharArray(); StringBuilder sb = new StringBuilder(); // Can't lead with a digit (or anything besides a letter), so prefix with // "sketch_". In 1.x this prefixed with an underscore, but those get shaved // off later, since you can't start a sketch name with underscore anymore. if (!asciiLetter(orig[0])) { sb.append("sketch_"); } // for (int i = 0; i < orig.length; i++) { for (char c : orig) { if (asciiLetter(c) || (c >= '0' && c <= '9')) { sb.append(c); } else { // Tempting to only add if prev char is not underscore, but that // might be more confusing if lots of chars are converted and the // result is a very short string thats nothing like the original. sb.append('_'); } } // Let's not be ridiculous about the length of filenames. // in fact, Mac OS 9 can handle 255 chars, though it can't really // deal with filenames longer than 31 chars in the Finder. // Limiting to that for sketches would mean setting the // upper-bound on the character limit here to 25 characters // (to handle the base name + ".class") if (sb.length() > 63) { sb.setLength(63); } // Remove underscores from the beginning, these seem to be a reserved // thing on Android, plus it sometimes causes trouble elsewhere. int underscore = 0; while (underscore < sb.length() && sb.charAt(underscore) == '_') { underscore++; } if (underscore == sb.length()) { return "bad_sketch_name_please_fix"; } else if (underscore != 0) { return sb.substring(underscore); } return sb.toString(); } public Mode getMode() { return mode; } }
[ "fraczwojciech@gmail.com" ]
fraczwojciech@gmail.com
df7b969af227201fc134dcb9f4200806ace702a5
30f814cefe8fd6279cc7d60200b62a9066048dc2
/src/main/java/com/demo/service/assetService/AssetInterfaceImpl.java
ffa61042a392e3dfb148a1385a28c91d17f841f5
[]
no_license
aparajitahalder/Codefury
35f5332aa2c5a8309dc40e2d7082353dc2ec403b
cca4bc85a813811857b4df45c2f108c382807111
refs/heads/main
2023-08-03T13:18:26.464330
2021-09-24T11:37:34
2021-09-24T11:37:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,278
java
package com.demo.service.assetService; import java.sql.Date; import java.sql.SQLException; import java.util.List; import com.demo.beans.Asset; import com.demo.beans.User; import com.demo.dao.assetDao.AssetDaoIntf; import com.demo.dao.assetDao.AsssetDaoImpl; import com.demo.exceptions.assetExceptions.AssetNotFoundException; public class AssetInterfaceImpl implements AssetInterface { AssetDaoIntf dao; AssetInterfaceImpl(){ dao=new AsssetDaoImpl(); } @Override public int addAsset(Asset a) throws SQLException { int status=dao.addAsset(a); return status; } @Override public List<Asset> searchAssetByName(String name) throws AssetNotFoundException, SQLException { List<Asset> a=dao.getAssetByName(name); return a; } @Override public List<Asset> searchAssetByDate(String date) throws AssetNotFoundException, SQLException { List<Asset> a=dao.getAssetByDate(date); return a; } @Override public List<Asset> searchAssetByCategory(String category) throws AssetNotFoundException, SQLException { List<Asset> a=dao.getAssetByCategory(category); return a; } @Override public List<Asset> getAllAssets() throws AssetNotFoundException, SQLException { List<Asset> assets=dao.displayAllAssets(); return assets; } }
[ "shalinijha219999@gmail.com" ]
shalinijha219999@gmail.com
84faf41ae193bf6c93aa6334a8b711bbc8d55c0b
a43edc8a2141f525f0683260d63cf650b7a45da0
/src/handling/cashshop/handler/CSMenuItem.java
f036895b4967785a5fd7b299db2f1ef8eb69b8a1
[]
no_license
MapleSilver/Mushy
040fb25528fb31af582307a059425c9bf468e40d
141dc5d5e28b9461ae62211a46f42c50f182ed9f
refs/heads/master
2021-01-16T23:10:20.582674
2016-08-27T01:38:13
2016-08-27T01:38:13
66,689,916
3
2
null
2016-08-27T01:47:05
2016-08-27T01:47:05
null
UTF-8
Java
false
false
3,061
java
package handling.cashshop.handler; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.util.LinkedList; import java.util.List; import net.DatabaseConnection; import tools.HexTool; import tools.data.MaplePacketLittleEndianWriter; import tools.packet.PacketHelper; public class CSMenuItem { private static final List<CSMenuItem> pictureItems = new LinkedList<>(); public static void loadFromDb() { Connection con = DatabaseConnection.getConnection(); try { try (ResultSet rs = con.prepareStatement("SELECT * FROM cs_picture").executeQuery()) { while (rs.next()) { pictureItems.add(new CSMenuItem( rs.getInt("category"), rs.getInt("subcategory"), rs.getInt("parent"), rs.getString("image"), rs.getInt("sn"), rs.getInt("itemid"), rs.getByte("flag"), rs.getInt("originalPrice"), rs.getInt("salePrice"), rs.getInt("quantity"), rs.getInt("duration"), rs.getInt("likes"))); } } } catch (SQLException ex) { } } private int c, sc, p, i, sn, id, op, sp, qty, dur, likes; private final String img; private final byte flag; private CSMenuItem(int c, int sc, int p, String img, int sn, int id, byte flag, int op, int sp, int qty, int dur, int likes) { this.c = c; this.sc = sc; this.p = p; this.img = img; this.sn = sn; this.id = id; this.flag = flag; this.op = op; this.sp = sp; this.qty = qty; this.dur = dur; this.likes = likes; } public static void writeData(CSMenuItem csmi, MaplePacketLittleEndianWriter mplew) { mplew.writeInt(csmi.c); mplew.writeInt(csmi.sc); mplew.writeInt(csmi.p); mplew.writeMapleAsciiString(csmi.img); // TODO add check if cat != 4 write empty string mplew.writeInt(csmi.sn); mplew.writeInt(csmi.id); mplew.writeInt(1); mplew.writeInt(csmi.flag); mplew.writeInt(0); mplew.writeInt(0); // this one changes mplew.writeInt(csmi.op); mplew.write(HexTool.getByteArrayFromHexString("00 80 22 D6 94 EF C4 01")); // 1/1/2005 mplew.writeLong(PacketHelper.MAX_TIME); mplew.write(HexTool.getByteArrayFromHexString("00 80 22 D6 94 EF C4 01")); // 1/1/2005 mplew.writeLong(PacketHelper.MAX_TIME); mplew.writeInt(csmi.sp); mplew.writeInt(0); mplew.writeInt(csmi.qty); mplew.writeInt(csmi.dur); mplew.write(HexTool.getByteArrayFromHexString("01 00 01 00 01 00 00 00 01 00 02 00 00 00")); // flags maybe mplew.writeInt(csmi.likes); mplew.write0(20); } }
[ "maxcloud18@hotmail.com" ]
maxcloud18@hotmail.com
8d3faa4a0d6d8668bc7ee93f697ed877d999c73c
2e65f6dd622efbcf26bf152d2d7358afaeb9dfd8
/ClusterBP/src/main/java/co/edu/usb/dataaccess/dao/RepositorioDAO.java
59587e3e607d248ad25c31ffc7cc8ce986830786
[]
no_license
FelipeValencia22/ClusterBP
9088d375bd161e74b0d8bd33532a16bc72eab338
6f0fbf1192f37e4f1e1fdcaa9bf9e68263aaaa4e
refs/heads/master
2021-01-13T11:52:02.915849
2017-05-28T01:00:11
2017-05-28T01:00:11
81,684,189
0
0
null
null
null
null
UTF-8
Java
false
false
1,712
java
package co.edu.usb.dataaccess.dao; import co.edu.usb.clusterbp.Repositorio; import co.edu.usb.dataaccess.api.HibernateDaoImpl; import org.hibernate.Query; import org.hibernate.SessionFactory; import org.hibernate.criterion.Example; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Scope; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; import org.springframework.stereotype.Repository; import java.math.BigDecimal; import java.util.Date; import java.util.List; import java.util.Set; import javax.annotation.Resource; /** * A data access object (DAO) providing persistence and search support for * Repositorio entities. Transaction control of the save(), update() and * delete() operations can directly support Spring container-managed * transactions or they can be augmented to handle user-managed Spring * transactions. Each of these methods provides additional information for how * to configure it for the desired type of transaction control. * * @see lidis.Repositorio */ @Scope("singleton") @Repository("RepositorioDAO") public class RepositorioDAO extends HibernateDaoImpl<Repositorio, Long> implements IRepositorioDAO { private static final Logger log = LoggerFactory.getLogger(RepositorioDAO.class); @Resource private SessionFactory sessionFactory; public static IRepositorioDAO getFromApplicationContext( ApplicationContext ctx) { return (IRepositorioDAO) ctx.getBean("RepositorioDAO"); } }
[ "pipeavb225@hotmail.com" ]
pipeavb225@hotmail.com
afabe928b4f9b95f7ca99c9a397eba43f38b1449
1dd78b0a8cbbb371b1fba24239aeec3835c0ad63
/app/src/main/java/com/perkparking/model/place2Cal.java
809352a0761e6d3473f2e90492caadc39d3e12ba
[]
no_license
l2ol3otic/PerkParking_Update
d5b70d90078c251a1377bc1170545cc80de0a01c
03516554e11f358f7d4acfd7f143090e2f7299e2
refs/heads/master
2021-01-19T08:52:32.403319
2017-04-09T07:08:20
2017-04-09T07:08:20
87,689,807
0
0
null
null
null
null
UTF-8
Java
false
false
1,703
java
package com.perkparking.model; import android.provider.BaseColumns; /** * Created by l2ol3otic2 on 2/4/2560. */ public class place2Cal { //Database public static final String DATABASE_NAME = "parking_place.db"; public static final int DATABASE_VERSION = 2; public static final String TABLE = "place2Cal"; public class Column { public static final String ID = BaseColumns._ID; public static final String timeH = "timeH"; public static final String timeM = "timeM"; public static final String floor = "floor"; public static final String place = "place"; } private int id; private String timeH; private String timeM; private String floor; private String place; public place2Cal(){ } //Constructor public place2Cal(int id, String timeH, String timeM, String floor, String place) { this.id = id; this.timeH = timeH; this.timeM = timeM; this.floor = floor; this.place = place; } //Getter, Setter public int getId() { return id; } public void setId(int id) { this.id = id; } public String getTimeH() { return timeH; } public void setTimeH(String timeH) { this.timeH = timeH; } public String getTimeM() { return timeM; } public void setTimeM(String timeM) { this.timeM = timeM; } public String getFloor() { return floor; } public void setFloor(String floor) { this.floor = floor; } public String getPlace() { return place; } public void setPlace(String place) { this.place = place; } }
[ "l2ol3otic@gmail.com" ]
l2ol3otic@gmail.com
f0ece5ad2951d2c52d59150a09b8b1b460bb0dde
18ac5b462b647d97440ad1c9c1b80824b02600b5
/QuestionnaireFunky/src/questionnaire/TypeSaisieAll.java
8cb94639dee3af6610af1255e25c9708fd3e4b0c
[]
no_license
maxcleme/EmfaticEpsilonQuestionnaire
f570a968f12c8c9f8051625e243f7859649c2a26
aeb13dd3637c3e383a7e05ee142fbd9e620f863a
refs/heads/master
2021-01-10T07:25:28.620468
2015-10-13T14:58:04
2015-10-13T14:58:04
44,133,727
0
0
null
null
null
null
UTF-8
Java
false
false
406
java
/** */ package questionnaire; /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>Type Saisie All</b></em>'. * <!-- end-user-doc --> * * * @see questionnaire.QuestionnairePackage#getTypeSaisieAll() * @model annotation="gmf.node label='regex' label.text='[*]' label.readOnly='true'" * @generated */ public interface TypeSaisieAll extends TypeSaisie { } // TypeSaisieAll
[ "maxime.clement93@gmail.com" ]
maxime.clement93@gmail.com
1b11d50d2467a49bcc5de0b712116928957ba16e
43485990f142d7b5639d582b9f5d44b40df87e30
/src/gui/JanelaListaChamados.java
a417c9762b3af69407e62288a62118467ba9c6c1
[]
no_license
franquesfranca/HelpDesk
c012833d811f2ea472d7184499c866b48193ec25
705589d0d2fbd6488f78eab933a25568483e009f
refs/heads/master
2020-07-23T06:07:44.141653
2016-11-15T14:41:38
2016-11-15T14:41:38
73,813,959
0
0
null
null
null
null
UTF-8
Java
false
false
9,494
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package gui; import bd.ConnectorHelpDesk; import java.awt.Image; import java.awt.Toolkit; import java.net.URL; /** * * @author Assunção */ public class JanelaListaChamados extends javax.swing.JFrame { /** * Creates new form JanelaListaChamados */ public JanelaListaChamados() { initComponents(); setTitle("Lista de Chamados"); URL url = this.getClass().getResource("a.png"); Image iconeTitulo = Toolkit.getDefaultToolkit().getImage(url); this.setIconImage(iconeTitulo); } /** * 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() { bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); entityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("glpi?zeroDateTimeBehavior=convertToNullPU").createEntityManager(); chamadoQuery = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery("SELECT c FROM Chamado c"); chamadoList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : chamadoQuery.getResultList(); entityManager0 = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("glpi?zeroDateTimeBehavior=convertToNullPU").createEntityManager(); chamadoQuery1 = java.beans.Beans.isDesignTime() ? null : entityManager0.createQuery("SELECT c FROM Chamado c"); chamadoList1 = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : chamadoQuery1.getResultList(); jScrollPane2 = new javax.swing.JScrollPane(); tabelaListaChamados = new javax.swing.JTable(); botaoSair = new javax.swing.JButton(); botaoAtenderChamado = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, chamadoList1, tabelaListaChamados); org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${idChamado}")); columnBinding.setColumnName("Id"); columnBinding.setColumnClass(Integer.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${tituloChamado}")); columnBinding.setColumnName("Título"); columnBinding.setColumnClass(String.class); columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${descricaoChamado}")); columnBinding.setColumnName("Descrição"); columnBinding.setColumnClass(String.class); bindingGroup.addBinding(jTableBinding); jTableBinding.bind(); jScrollPane2.setViewportView(tabelaListaChamados); tabelaListaChamados.getColumnModel().getColumn(0).setPreferredWidth(50); tabelaListaChamados.getColumnModel().getColumn(1).setPreferredWidth(250); tabelaListaChamados.getColumnModel().getColumn(2).setPreferredWidth(255); botaoSair.setText("Sair"); botaoSair.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { botaoSairActionPerformed(evt); } }); botaoAtenderChamado.setText("Atender Chamado"); botaoAtenderChamado.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { botaoAtenderChamadoActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 910, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addComponent(botaoSair) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(botaoAtenderChamado))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(11, 11, 11) .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 610, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(19, 19, 19) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(botaoSair) .addComponent(botaoAtenderChamado)) .addGap(21, 21, 21)) ); bindingGroup.bind(); pack(); }// </editor-fold>//GEN-END:initComponents private void botaoSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoSairActionPerformed this.dispose(); JanelaMenu janela = new JanelaMenu(); janela.setVisible(true); }//GEN-LAST:event_botaoSairActionPerformed private void botaoAtenderChamadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoAtenderChamadoActionPerformed this.dispose(); JanelaAtenderChamado janela = new JanelaAtenderChamado(); Integer id = (Integer) tabelaListaChamados.getValueAt(tabelaListaChamados.getSelectedRow(), 0); String titulo = (String) tabelaListaChamados.getValueAt(tabelaListaChamados.getSelectedRow(), 1); String descricao = (String) tabelaListaChamados.getValueAt(tabelaListaChamados.getSelectedRow(), 2); JanelaAtenderChamado.setChamado(new ConnectorHelpDesk().retrieveRequest(id)); janela.preencherJanela(id,titulo,descricao,JanelaAtenderChamado.getChamado().getDataChamado()); janela.setVisible(true); }//GEN-LAST:event_botaoAtenderChamadoActionPerformed /** * @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(JanelaListaChamados.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(JanelaListaChamados.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(JanelaListaChamados.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(JanelaListaChamados.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 JanelaListaChamados().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton botaoAtenderChamado; private javax.swing.JButton botaoSair; private java.util.List<gui.Chamado> chamadoList; private java.util.List<gui.Chamado> chamadoList1; private javax.persistence.Query chamadoQuery; private javax.persistence.Query chamadoQuery1; private javax.persistence.EntityManager entityManager; private javax.persistence.EntityManager entityManager0; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JTable tabelaListaChamados; private org.jdesktop.beansbinding.BindingGroup bindingGroup; // End of variables declaration//GEN-END:variables }
[ "franquesfranca@gmail.com" ]
franquesfranca@gmail.com
86a7a6ceedefd3b9a1c48bd96a8b36b575ebacf6
3bfc3c04aa08b30c6a074004be434a6d4819955d
/lapr4-grupo-di-3/ConfigAPP/src/main/java/Aplicacao/LerEnvolventesFicheiroController.java
27012f8169f109c686dca9ce31c509c307161420
[]
no_license
Boalbasaur/riskAssessment
878db7a732927d745207643c0a9a59f12c21fc09
30de7983cef7c19ddfc7745ebe2c9554d407177e
refs/heads/master
2022-12-04T08:56:02.538090
2020-01-16T00:46:54
2020-01-16T00:46:54
234,201,625
0
0
null
2022-11-24T08:23:52
2020-01-16T00:36:54
Java
UTF-8
Java
false
false
1,491
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 Aplicacao; import Dominio.Envolvente; import Persistencia.EnvolventeRepositorio; import Persistencia.EnvolventeRepositorioJPAImpl; import Utils.LerFicheiros; import java.io.IOException; import java.util.ArrayList; import java.util.List; /** * * @author jmbosg */ public class LerEnvolventesFicheiroController { /** * Controller do UC ler envolventes de ficheiro * * @param caminhoFicheiro Caminho do ficheiro de onde as envolventes vao ser lidas * @return Lista de envolventes lidas * @throws IOException */ public ArrayList<Envolvente> lerEnvolventesDeFicheiro(String caminhoFicheiro) throws IOException { ArrayList<Envolvente> l1 = LerFicheiros.lerEnvolventesDeFicheiro(caminhoFicheiro); EnvolventeRepositorio repo = new EnvolventeRepositorioJPAImpl(); List<Envolvente> l2 = repo.findAll(); boolean flag = false; for (Envolvente e : l1) { flag = false; for (Envolvente e2 : l2) { if(e.equals(e2)) { System.out.println("Envolvente " + e + " já existe!"); flag = true; } } if(flag == false) { repo.add(e); } } return l1; } }
[ "boalrolo@gmail.com" ]
boalrolo@gmail.com
8d17b4a5f16a917e63ffbe62a1d981c3c1649622
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/19/19_3b3438a24e33893035d2c602198d49ca13a35845/ArrayHandlingTest/19_3b3438a24e33893035d2c602198d49ca13a35845_ArrayHandlingTest_s.java
87b53ea6a0cac97a96ce9312665eb9f5a56056d4
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
13,035
java
package com.laytonsmith.core.functions; import com.laytonsmith.abstraction.MCPlayer; import com.laytonsmith.core.Static; import com.laytonsmith.core.constructs.CArray; import com.laytonsmith.core.constructs.CInt; import com.laytonsmith.core.constructs.Construct; import com.laytonsmith.core.constructs.Target; import com.laytonsmith.core.environments.CommandHelperEnvironment; import com.laytonsmith.core.exceptions.CancelCommandException; import com.laytonsmith.core.exceptions.ConfigCompileException; import com.laytonsmith.core.exceptions.ConfigRuntimeException; import com.laytonsmith.testing.C; import com.laytonsmith.testing.StaticTest; import static com.laytonsmith.testing.StaticTest.*; import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; import static org.mockito.Mockito.*; /** * * @author Layton */ public class ArrayHandlingTest { MCPlayer fakePlayer; CArray commonArray; com.laytonsmith.core.environments.Environment env; public ArrayHandlingTest() throws Exception { StaticTest.InstallFakeServerFrontend(); env = Static.GenerateStandaloneEnvironment(); } @Before public void setUp() { fakePlayer = StaticTest.GetOnlinePlayer(); commonArray = new CArray(Target.UNKNOWN, new CInt(1, Target.UNKNOWN), new CInt(2, Target.UNKNOWN), new CInt(3, Target.UNKNOWN)); env.getEnv(CommandHelperEnvironment.class).SetPlayer(fakePlayer); } /** * Test of docs method, of class ArrayHandling. */ @Test(timeout = 10000) public void testDocs() { TestClassDocs(ArrayHandling.docs(), ArrayHandling.class); } @Test(timeout = 10000) public void testArraySize() throws ConfigCompileException, CancelCommandException { ArrayHandling.array_size a = new ArrayHandling.array_size(); CArray arr = commonArray; Construct ret = a.exec(Target.UNKNOWN, env, arr); assertReturn(ret, C.Int); assertCEquals(C.onstruct(3), ret); } @Test(expected = Exception.class, timeout = 10000) public void testArraySizeEx() throws CancelCommandException { ArrayHandling.array_size a = new ArrayHandling.array_size(); a.exec(Target.UNKNOWN, env, C.Int(0)); } @Test//(timeout = 10000) public void testArraySet1() throws ConfigCompileException { String script = "assign(@array, array(1,2,3)) " + "msg(@array) " + "array_set(@array, 2, 1) " + "msg(@array)"; StaticTest.Run(script, fakePlayer); verify(fakePlayer).sendMessage("{1, 2, 3}"); verify(fakePlayer).sendMessage("{1, 2, 1}"); } @Test(timeout = 10000) public void testArraySet2() throws ConfigCompileException { SRun("assign(@array, array(1, 2)) assign(@array2, @array) array_set(@array, 0, 2) msg(@array) msg(@array2)", fakePlayer); verify(fakePlayer, times(2)).sendMessage("{2, 2}"); } @Test(timeout = 10000) public void testArrayReferenceBeingCorrect() throws ConfigCompileException { SRun("assign(@array, array(1, 2)) assign(@array2, @array[]) array_set(@array, 0, 2) msg(@array) msg(@array2)", fakePlayer); verify(fakePlayer).sendMessage("{2, 2}"); verify(fakePlayer).sendMessage("{1, 2}"); } @Test(timeout = 10000) public void testArrayReferenceBeingCorrectWithArrayGet() throws ConfigCompileException { SRun("assign(@array, array(1, 2)) " + "assign(@array2, array_get(@array)) " + "array_set(@array, 0, 2) " + "msg(@array) " + "msg(@array2)", fakePlayer); verify(fakePlayer).sendMessage("{2, 2}"); verify(fakePlayer).sendMessage("{1, 2}"); } //This is valid behavior now. // @Test(expected=ConfigRuntimeException.class) // public void testArraySetEx() throws CancelCommandException, ConfigCompileException{ // String script = // "assign(@array, array()) array_set(@array, 3, 1) msg(@array)"; // MethodScriptCompiler.execute(MethodScriptCompiler.compile(MethodScriptCompiler.lex(script, null)), env, null, null); // } @Test(timeout = 10000) public void testArrayContains() throws CancelCommandException { ArrayHandling.array_contains a = new ArrayHandling.array_contains(); assertCEquals(C.onstruct(true), a.exec(Target.UNKNOWN, env, commonArray, C.onstruct(1))); assertCEquals(C.onstruct(false), a.exec(Target.UNKNOWN, env, commonArray, C.onstruct(55))); } @Test(expected = Exception.class, timeout = 10000) public void testArrayContainsEx() throws CancelCommandException { ArrayHandling.array_contains a = new ArrayHandling.array_contains(); a.exec(Target.UNKNOWN, env, C.Int(0), C.Int(1)); } @Test(timeout = 10000) public void testArrayGet() throws CancelCommandException { ArrayHandling.array_get a = new ArrayHandling.array_get(); assertCEquals(C.onstruct(1), a.exec(Target.UNKNOWN, env, commonArray, C.onstruct(0))); } @Test(expected = Exception.class, timeout = 10000) public void testArrayGetEx() throws CancelCommandException { ArrayHandling.array_get a = new ArrayHandling.array_get(); a.exec(Target.UNKNOWN, env, C.Int(0), C.Int(1)); } @Test(expected = ConfigRuntimeException.class, timeout = 10000) public void testArrayGetBad() throws CancelCommandException { ArrayHandling.array_get a = new ArrayHandling.array_get(); a.exec(Target.UNKNOWN, env, commonArray, C.onstruct(55)); } @Test(timeout = 10000) public void testArrayPush() throws CancelCommandException { ArrayHandling.array_push a = new ArrayHandling.array_push(); assertReturn(a.exec(Target.UNKNOWN, env, commonArray, C.onstruct(4)), C.Void); assertCEquals(C.onstruct(1), commonArray.get(0, Target.UNKNOWN)); assertCEquals(C.onstruct(2), commonArray.get(1, Target.UNKNOWN)); assertCEquals(C.onstruct(3), commonArray.get(2, Target.UNKNOWN)); assertCEquals(C.onstruct(4), commonArray.get(3, Target.UNKNOWN)); } @Test(timeout = 10000) public void testArrayPush2() throws ConfigCompileException { SRun("assign(@a, array(1))" + "array_push(@a, 2, 3)" + "msg(@a)", fakePlayer); verify(fakePlayer).sendMessage("{1, 2, 3}"); } @Test(expected = Exception.class) public void testArrayPushEx() throws CancelCommandException { ArrayHandling.array_push a = new ArrayHandling.array_push(); a.exec(Target.UNKNOWN, env, C.Int(0), C.Int(1)); } @Test(timeout = 10000) public void testArrayResize() throws ConfigCompileException { String script = "assign(@array, array(1)) msg(@array) array_resize(@array, 2) msg(@array) array_resize(@array, 3, 'hello') msg(@array)"; StaticTest.Run(script, fakePlayer); verify(fakePlayer).sendMessage("{1}"); verify(fakePlayer).sendMessage("{1, null}"); verify(fakePlayer).sendMessage("{1, null, hello}"); } /** * Because we are testing a loop, we put in an infinite loop detection of 10 * seconds * * @throws ConfigCompileException */ @Test(timeout = 10000) public void testRange() throws ConfigCompileException { assertEquals("{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}", SRun("range(10)", fakePlayer)); assertEquals("{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}", SRun("range(1, 11)", fakePlayer)); assertEquals("{0, 5, 10, 15, 20, 25}", SRun("range(0, 30, 5)", fakePlayer)); assertEquals("{0, 3, 6, 9}", SRun("range(0, 10, 3)", fakePlayer)); assertEquals("{0, -1, -2, -3, -4, -5, -6, -7, -8, -9}", SRun("range(0, -10, -1)", fakePlayer)); assertEquals("{}", SRun("range(0)", fakePlayer)); assertEquals("{}", SRun("range(1, 0)", fakePlayer)); } @Test public void testArraySliceAndNegativeIndexes() throws ConfigCompileException { assertEquals("{a, b}", SRun("array(a, b, c, d, e)[..1]", null)); assertEquals("e", SRun("array(a, e)[-1]", null)); assertEquals("{a, b, c, d, e}", SRun("array(a, b, c, d, e)[]", null)); assertEquals("{b, c}", SRun("array(a, b, c, d, e)[1..2]", null)); assertEquals("{b, c, d, e}", SRun("array(a, b, c, d, e)[1..-1]", null)); assertEquals("1", SRun("array(a, array(1, 2), c, d, e)[0..1][1][0]", null)); assertEquals("{c, d, e}", SRun("array(a, b, c, d, e)[2..]", null)); assertEquals("{}", SRun("array(1, 2, 3, 4, 5)[3..0]", null)); assertEquals("{a, b}", SRun("array_get(array(a, b))", null)); assertEquals("{2, 3}", SRun("array(1, 2, 3)[1..-1]", null)); assertEquals("{2}", SRun("array(1, 2)[1..-1]", null)); assertEquals("{}", SRun("array(1)[1..-1]", null)); } @Test(timeout = 10000) public void testArrayMergeNormal() throws ConfigCompileException { assertEquals("{1, 2, 3, 4, 5, {6, 7}}", SRun("array_merge(array(1, 2, 3), array(4, 5, array(6, 7)))", fakePlayer)); } @Test(timeout = 10000) public void testArrayMergeAssociative() throws ConfigCompileException { assertEquals("{a: a, b: b, c: c, d: {1, 2}}", SRun("array_merge(array(a: a, b: b), array(c: c, d: array(1, 2)))", fakePlayer)); } @Test(timeout = 10000) public void testArrayRemove() throws ConfigCompileException { SRun("assign(@a, array(1, 2, 3)) array_remove(@a, 1) msg(@a)", fakePlayer); verify(fakePlayer).sendMessage("{1, 3}"); SRun("assign(@a, array(a: a, b: b, c: c)) array_remove(@a, 'b') msg(@a)", fakePlayer); verify(fakePlayer).sendMessage("{a: a, c: c}"); } @Test(timeout = 10000) public void testStringSlice() throws ConfigCompileException { SRun("msg('slice'[2..])", fakePlayer); verify(fakePlayer).sendMessage("ice"); } @Test public void testArraySort1() throws ConfigCompileException{ Run("msg(array_sort(array(3, 1, 2)))", fakePlayer); verify(fakePlayer).sendMessage("{1, 2, 3}"); } @Test public void testArraySort2() throws ConfigCompileException{ Run("msg(array_sort(array('002', '1', '03')))", fakePlayer); verify(fakePlayer).sendMessage("{1, 002, 03}"); } @Test public void testArraySort3() throws ConfigCompileException{ Run("msg(array_sort(array('002', '1', '03'), STRING))", fakePlayer); verify(fakePlayer).sendMessage("{002, 03, 1}"); } @Test public void testArrayImplode1() throws ConfigCompileException{ Run("msg(array_implode(array(1,2,3,4,5,6,7,8,9,1,2,3,4,5)))", fakePlayer); verify(fakePlayer).sendMessage("1 2 3 4 5 6 7 8 9 1 2 3 4 5"); } @Test public void testArrayRemoveValues() throws ConfigCompileException{ Run("assign(@array, array(1, 2, 2, 3)) array_remove_values(@array, 2) msg(@array)", fakePlayer); verify(fakePlayer).sendMessage("{1, 3}"); } @Test public void testArrayIndex() throws ConfigCompileException{ Run("assign(@array, array(1, 2, 2, 3)) msg(array_index(@array, 2))", fakePlayer); verify(fakePlayer).sendMessage("1"); } @Test public void testArrayIndexMissing() throws ConfigCompileException{ Run("assign(@array, array(1, 3)) msg(array_index(@array, 2))", fakePlayer); verify(fakePlayer).sendMessage("null"); } @Test public void testArrayIndexes() throws ConfigCompileException{ Run("assign(@array, array(1, 2, 2, 3)) msg(array_indexes(@array, 2))", fakePlayer); verify(fakePlayer).sendMessage("{1, 2}"); } @Test public void testArrayIndexesMissing() throws ConfigCompileException{ Run("assign(@array, array(1, 3)) msg(array_indexes(@array, 2))", fakePlayer); verify(fakePlayer).sendMessage("{}"); } @Test public void testArrayRand() throws Exception{ assertEquals("{1}", SRun("array_rand(array(1, 1, 1), 1, false)", null)); String output = SRun("array_rand(array('a', 'b', 'c'))", null); if(!"{0}".equals(output) && !"{1}".equals(output) && !"{2}".equals(output)){ throw new Exception("Did not return the expected value"); } output = SRun("array_rand(array('a', 'b'), 2)", null); if(!"{0, 1}".equals(output) && !"{1, 0}".equals(output)){ throw new Exception("Did not return the expected value"); } } @Test public void testArrayUnique1() throws Exception { assertEquals("{1}", SRun("array_unique(array(1, 1, 1), false)", fakePlayer)); } @Test public void testArrayUnique2() throws Exception { assertEquals("{1, 1}", SRun("array_unique(array(1, '1'), true)", fakePlayer)); } @Test public void testArrayUnique3() throws Exception { assertEquals("{1}", SRun("array_unique(array(1, '1'), false)", fakePlayer)); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
db04b3c149b4fafc0851c160d806115fc52da18f
6661c3c6a3093157d3c173e63642359b019c20c2
/app/src/main/java/com/mike4christ/travelmantics/DetailActivity.java
112d69b1e5a1f3abb17d6bddc8e3c076ac882945
[]
no_license
alumichael/Travelmantics
b35a7b797b992a9c29bd3b0a637c38ba41ff6d70
2d3ac2fbd68313f9f2658fb9be5dfb40334771e3
refs/heads/master
2020-06-30T00:42:49.589440
2019-08-05T14:22:29
2019-08-05T14:22:29
200,670,081
0
0
null
null
null
null
UTF-8
Java
false
false
2,149
java
package com.mike4christ.travelmantics; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; import com.bumptech.glide.Glide; import com.bumptech.glide.request.RequestOptions; import com.google.android.material.snackbar.Snackbar; import com.wang.avi.AVLoadingIndicatorView; import butterknife.BindView; public class DetailActivity extends AppCompatActivity { @BindView(R.id.detail_layout) LinearLayout detailLayout; @BindView(R.id.img) ImageView img; @BindView(R.id.place) TextView place; @BindView(R.id.desc) TextView desc; @BindView(R.id.amount) TextView amount; @BindView(R.id.progress) AVLoadingIndicatorView progress; @BindView(R.id.data_layout) LinearLayout data_layout; String placeStrg="",amountStrg="",descStrg="",img_url=""; NetworkConnection networkConnection=new NetworkConnection(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detail); Intent intent=getIntent(); placeStrg=intent.getStringExtra("place_title"); amountStrg=intent.getStringExtra("amount"); descStrg=intent.getStringExtra("description"); img_url=intent.getStringExtra("img_url"); progress.setVisibility(View.VISIBLE); data_layout.setVisibility(View.GONE); if(networkConnection.isNetworkConnected(this)){ ImageView imageView = this.img; if (imageView != null) { Glide.with(imageView.getContext()).load(img_url).apply(new RequestOptions().fitCenter().circleCrop()).into(this.img); progress.setVisibility(View.VISIBLE); data_layout.setVisibility(View.GONE); } }else { showMessage("No Internet Connection"); } } private void showMessage(String s) { Snackbar.make(detailLayout, s, Snackbar.LENGTH_SHORT).show(); } }
[ "alumichael9@gmail.com" ]
alumichael9@gmail.com
46de85f9db95f8d2c3dc2b44faca5b4cb3dd12b4
c36747eddc89423813a3ca68aca3f224e02ec26d
/src/main/java/project/filters/loginFilter.java
6ac30bd4efae6638fb1c9b57235f9592bfe03cc4
[]
no_license
mohanbabubb/bike-share
d4b3fea9dcfdd6abe486105d28271c60f42d02f9
ca3bcb5ae79db92693e0d19947516c82a4c9f957
refs/heads/master
2021-01-20T10:46:55.300066
2017-03-07T11:47:26
2017-03-07T11:47:26
83,938,020
0
0
null
null
null
null
UTF-8
Java
false
false
3,501
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 project.filters; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import project.web.Loginbean; /** * * @author mohanbabu */ public class loginFilter implements Filter { @Override public void init(FilterConfig filterConfig) throws ServletException { } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse res = (HttpServletResponse) response; HttpSession ses = req.getSession(false); //Loginbean session =(Loginbean) req.getSession().getAttribute("loginbean"); String url = req.getRequestURI(); /* If request for home or logout and no session, redirect and the request to login page If request for register or login and with session, redirect and the request to home page If request is for logout and with session, remove the session and redirect to login page */ // if (session == null || !session.isLogged) { // if (url.indexOf("home.xhtml") >= 0 || url.indexOf("logout.xhtml") >= 0) { // resp.sendRedirect(req.getServletContext().getContextPath() + "/login.xhtml"); // }else { // chain.doFilter(request, response); // //resp.sendRedirect(req.getServletContext().getContextPath() + "/home.xhtml"); // } // } else { // if (url.indexOf("register.xhtml") >= 0 || url.indexOf("login.xhtml") >= 0) { // resp.sendRedirect(req.getServletContext().getContextPath() + "/home.xhtml"); // }else if (url.indexOf("logout.xhtml") >= 0) { // req.getSession().removeAttribute("bean"); // resp.sendRedirect(req.getServletContext().getContextPath() + "/login.xhtml"); // }else { // chain.doFilter(request, response); // } // } try { // check whether session variable is set // allow user to proccede if url is login.xhtml or user logged in. if ( req.getRequestURI().contains("prompts") || url.indexOf("/index.xhtml") >= 0 || url.indexOf("/login.xhtml") >= 0 || (ses != null && ses.getAttribute("username") != null)|| url.indexOf("/register.xhtml") >= 0 || url.indexOf("/aboutus.xhtml") >= 0 || url.contains("javax.faces.resource") ) chain.doFilter(request, response); else // user didn't log in but asking for a page that is not allowed so take user to login page res.sendRedirect(req.getContextPath() + "/index.xhtml"); // Anonymous user. Redirect to login page } catch(Throwable t) { System.out.println( t.getMessage()); } } @Override public void destroy() { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }
[ "mohanbabu.bb@gmail.com" ]
mohanbabu.bb@gmail.com
c0dad55aac41e4dacaf7f6f38de5cb97dc6c15f2
1f93c4842223d32536a35440b1909cb080ad0db6
/app/src/main/java/Adapter/NavigationDrawerAdapter.java
6935c683992b9e4796a0c115eee547a77a447be1
[]
no_license
skramakant/Affoo
9bbc8da9b9744e24dad8013a6b8f73c385f3cfa6
09695d4159cfc6a32dc5defbd98b755bb1693918
refs/heads/master
2021-01-17T13:26:07.898226
2016-09-25T18:05:02
2016-09-25T18:05:02
59,321,484
0
1
null
null
null
null
UTF-8
Java
false
false
7,314
java
package Adapter; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.affoo.affoo.R; import AdapterHandler.NavigationDrawerAdapterHandler; import Interfaces.DrawerItemClickListner; /** * Created by Ramakant on 5/24/2016. */ public class NavigationDrawerAdapter extends RecyclerView.Adapter<NavigationDrawerAdapter.ViewHolder>{ private static final int TYPE_HEADER = 0; // Declaring Variable to Understand which View is being worked on // IF the view under inflation and population is header or Item private static final int TYPE_ITEM = 1; private String mNavTitles[]; // String Array to store the passed titles Value from MainActivity.java private int mIcons[]; // Int Array to store the passed icons resource value from MainActivity.java private String name; //String Resource for header View Name private int profile; //int Resource for header view profile picture private String email; //String Resource for header view email public Context context; private DrawerItemClickListner drawerItemClickListner = new NavigationDrawerAdapterHandler(); // Creating a ViewHolder which extends the RecyclerView View Holder // ViewHolder are used to to store the inflated views in order to recycle them public static class ViewHolder extends RecyclerView.ViewHolder { int Holderid; TextView textView; ImageView imageView; ImageView profile; TextView Name; TextView email; LinearLayout rowLayout; public ViewHolder(View itemView,int ViewType) { // Creating ViewHolder Constructor with View and viewType As a parameter super(itemView); // Here we set the appropriate view in accordance with the the view type as passed when the holder object is created if(ViewType == TYPE_ITEM) { rowLayout = (LinearLayout)itemView.findViewById(R.id.item_id); textView = (TextView) itemView.findViewById(R.id.rowText); // Creating TextView object with the id of textView from item_row.xml imageView = (ImageView) itemView.findViewById(R.id.rowIcon);// Creating ImageView object with the id of ImageView from item_row.xml Holderid = 1; // setting holder id as 1 as the object being populated are of type item row } else{ Name = (TextView) itemView.findViewById(R.id.name); // Creating Text View object from header.xml for name email = (TextView) itemView.findViewById(R.id.customer_email); // Creating Text View object from header.xml for email profile = (ImageView) itemView.findViewById(R.id.circleView);// Creating Image view object from header.xml for profile pic Holderid = 0; // Setting holder id = 0 as the object being populated are of type header view } } } public NavigationDrawerAdapter(Context context,String Titles[], int Icons[], String Name, String Email, int Profile){ // MyAdapter Constructor with titles and icons parameter // titles, icons, name, email, profile pic are passed from the main activity as we mNavTitles = Titles; //have seen earlier mIcons = Icons; name = Name; email = Email; profile = Profile; //here we assign those passed values to the values we declared here //in adapter this.context = context; } //Below first we ovverride the method onCreateViewHolder which is called when the ViewHolder is //Created, In this method we inflate the item_row.xml layout if the viewType is Type_ITEM or else we inflate header.xml // if the viewType is TYPE_HEADER // and pass it to the view holder @Override public NavigationDrawerAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { if (viewType == TYPE_ITEM) { View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.navigation_drawer_row_item,parent,false); //Inflating the layout ViewHolder vhItem = new ViewHolder(v,viewType); //Creating ViewHolder and passing the object of type view return vhItem; // Returning the created object //inflate your layout and pass it to view holder } else if (viewType == TYPE_HEADER) { View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.navigation_drawer_header,parent,false); //Inflating the layout ViewHolder vhHeader = new ViewHolder(v,viewType); //Creating ViewHolder and passing the object of type view return vhHeader; //returning the object created } return null; } //Next we override a method which is called when the item in a row is needed to be displayed, here the int position // Tells us item at which position is being constructed to be displayed and the holder id of the holder object tell us // which view type is being created 1 for item row @Override public void onBindViewHolder(ViewHolder holder, int position) { callToRecyclerClickListener(holder,position); if(holder.Holderid ==1) { // as the list view is going to be called after the header view so we decrement the // position by 1 and pass it to the holder while setting the text and image holder.textView.setText(mNavTitles[position - 1]); // Setting the Text with the array of our Titles holder.imageView.setImageResource(mIcons[position -1]);// Settimg the image with array of our icons } else{ holder.profile.setImageResource(profile); // Similarly we set the resources for header view holder.Name.setText(name); holder.email.setText(email); } } // This method returns the number of items present in the list @Override public int getItemCount() { return mNavTitles.length+1; // the number of items in the list will be +1 the titles including the header view. } // Witht the following method we check what type of view is being passed @Override public int getItemViewType(int position) { if (isPositionHeader(position)) return TYPE_HEADER; return TYPE_ITEM; } private boolean isPositionHeader(int position) { return position == 0; } @Override public long getItemId(int position) { return super.getItemId(position); } private void callToRecyclerClickListener(ViewHolder holder, final int position) { if (holder.Holderid == 1) { holder.rowLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { drawerItemClickListner.drawerItemClick(context, position); } }); } } }
[ "ramakant.singh17@gmail.com" ]
ramakant.singh17@gmail.com
90a7965f3fe6fde8a13693f34b19fdd5dc7d9b6b
689cdf772da9f871beee7099ab21cd244005bfb2
/classes/com/d/a/c/bz.java
f74c3220a89b071088a704101073ec52891b0716
[]
no_license
waterwitness/dazhihui
9353fd5e22821cb5026921ce22d02ca53af381dc
ad1f5a966ddd92bc2ac8c886eb2060d20cf610b3
refs/heads/master
2020-05-29T08:54:50.751842
2016-10-08T08:09:46
2016-10-08T08:09:46
70,314,359
2
4
null
null
null
null
UTF-8
Java
false
false
4,892
java
package com.d.a.c; import android.text.TextUtils; import android.util.Base64; import com.d.a.a.a; import com.d.a.a.e; import com.d.a.a.h; import com.d.a.af; import com.d.a.ag; import com.d.a.ai; import com.d.a.bo; import com.d.a.q; import java.nio.ByteBuffer; import java.nio.LongBuffer; import java.security.MessageDigest; import java.util.LinkedList; import java.util.UUID; public class bz implements bu { ag a; bc b; a c; private LinkedList<ai> d; private af e; private bx f; private e g; private bv h; private bw i; public bz(af paramaf) { this.e = paramaf; this.a = new ag(this.e); } public static bu a(av paramav, w paramw) { if (paramw == null) {} String str1; String str2; do { do { do { return null; } while ((paramw.m() != 101) || (!"websocket".equalsIgnoreCase(paramw.f_().a("Upgrade")))); str1 = paramw.f_().a("Sec-WebSocket-Accept"); } while (str1 == null); str2 = paramav.a("Sec-WebSocket-Key"); } while ((str2 == null) || (!str1.equalsIgnoreCase(c(str2 + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11").trim()))); paramav = paramav.a("Sec-WebSocket-Extensions"); boolean bool2 = false; boolean bool1 = bool2; if (paramav != null) { bool1 = bool2; if (paramav.equals("x-webkit-deflate-frame")) { bool1 = true; } } paramav = new bz(paramw.c()); paramav.a(true, bool1); return paramav; } public static void a(u paramu, String paramString) { av localav = paramu.e(); String str = Base64.encodeToString(a(UUID.randomUUID()), 2); localav.a("Sec-WebSocket-Version", "13"); localav.a("Sec-WebSocket-Key", str); localav.a("Sec-WebSocket-Extensions", "x-webkit-deflate-frame"); localav.a("Connection", "Upgrade"); localav.a("Upgrade", "websocket"); if (paramString != null) { localav.a("Sec-WebSocket-Protocol", paramString); } localav.a("Pragma", "no-cache"); localav.a("Cache-Control", "no-cache"); if (TextUtils.isEmpty(paramu.e().a("User-Agent"))) { paramu.e().a("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.15 Safari/537.36"); } } private void a(boolean paramBoolean1, boolean paramBoolean2) { this.b = new ca(this, this.e); this.b.a(paramBoolean1); this.b.b(paramBoolean2); if (this.e.k()) { this.e.j(); } } private static byte[] a(UUID paramUUID) { byte[] arrayOfByte = new byte[16]; ByteBuffer.wrap(arrayOfByte).asLongBuffer().put(new long[] { paramUUID.getMostSignificantBits(), paramUUID.getLeastSignificantBits() }); return arrayOfByte; } private void b(ai paramai) { if (this.d == null) { bo.a(this, paramai); if (paramai.d() > 0) { this.d = new LinkedList(); this.d.add(paramai); } } do { return; do { paramai = (ai)this.d.remove(); bo.a(this, paramai); if (paramai.d() > 0) { this.d.add(0, paramai); } } while (!k()); } while (this.d.size() != 0); this.d = null; } private static String c(String paramString) { try { MessageDigest localMessageDigest = MessageDigest.getInstance("SHA-1"); localMessageDigest.update(paramString.getBytes("iso-8859-1"), 0, paramString.length()); paramString = Base64.encodeToString(localMessageDigest.digest(), 2); return paramString; } catch (Exception paramString) {} return null; } public void a() { this.e.a(); } public void a(a parama) { this.e.a(parama); } public void a(e parame) { this.g = parame; } public void a(h paramh) { this.a.a(paramh); } public void a(ai paramai) { a(paramai.a()); } public void a(bw parambw) { this.i = parambw; } public void a(String paramString) { this.a.a(new ai(this.b.a(paramString))); } public void a(byte[] paramArrayOfByte) { this.a.a(new ai(this.b.a(paramArrayOfByte))); } public void b(a parama) { this.c = parama; } public void b(String paramString) { this.a.a(new ai(new ByteBuffer[] { ByteBuffer.wrap(this.b.b(paramString)) })); } public void d() { this.e.d(); } public e f() { return this.g; } public h g() { return this.a.g(); } public a h() { return this.c; } public boolean i() { return this.e.i(); } public void j() { this.e.j(); } public boolean k() { return this.e.k(); } public q l() { return this.e.l(); } } /* Location: E:\apk\dazhihui2\classes-dex2jar.jar!\com\d\a\c\bz.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "1776098770@qq.com" ]
1776098770@qq.com
52b51563f8758e8c48a1dfb812a8ad169e56123b
b76ea5a254aa54cd355db31ffe2737cf9bd7fec8
/src/main/java/ru/javazen/telegram/bot/method/LeaveChat.java
fb8b6742e8c8a9bea7b0990979a2cb4f03cec5b6
[ "Apache-2.0" ]
permissive
asmal95/telegram-bot-meta
79fbc4532da438ca8d2eea5e2fcc74218e5e4600
1bc06a73777f37c458916cb3201212f83b33b423
refs/heads/master
2021-01-23T22:31:04.627584
2018-01-14T18:55:09
2018-01-14T18:55:09
102,939,563
0
0
null
null
null
null
UTF-8
Java
false
false
537
java
package ru.javazen.telegram.bot.method; public class LeaveChat implements ApiMethod { public static final String METHOD = "leaveChat"; private String chatId; @Override public String getMethod() { return METHOD; } public String getChatId() { return chatId; } public void setChatId(String chatId) { this.chatId = chatId; } @Override public String toString() { return "LeaveChat{" + "chatId='" + chatId + '\'' + '}'; } }
[ "asmal95@mail.ru" ]
asmal95@mail.ru
1d1dd70fda635172a46f129a127ebf23b866b3b6
8f0abd2d36d526a2b56ce468a9a74817ae753680
/src/Problem25/Node.java
c9d758ad80b081ae0746427a8953161b326152b3
[]
no_license
HuoShaoFeng/Algorithm01AimAtOffer
d191aa964251e3b22034c1a21e23e5926d9e0f2d
794b6e36b45a14e7153b3e0dcac63385cf4290f4
refs/heads/master
2021-09-10T11:04:34.256618
2018-03-25T04:12:46
2018-03-25T04:12:46
115,780,927
0
0
null
null
null
null
UTF-8
Java
false
false
128
java
package Problem25; public class Node { Node next = null; int data; public Node(int data){ this.data = data; } }
[ "huo_shao_feng@163.com" ]
huo_shao_feng@163.com
83d4abe5f965bfd964543e487470e68434f5990f
bf78fd0a90b084cd80e91fc3daf2644cbca9e894
/src/main/java/com/daleb/backend/api/rest/services/impl/ProductoServiceImpl.java
60571bbbffec5d2f162e6f43227896536aa03a9d
[]
no_license
Daleb015/clientes-backend-pub
7e3d2e5aef5e8598da8ea9713c54efd8d3ec01df
2e61653b82f769d7e5c991f9f9122b6809aed0b5
refs/heads/master
2023-01-20T13:16:21.906273
2020-11-29T01:16:42
2020-11-29T01:16:42
316,833,040
0
0
null
null
null
null
UTF-8
Java
false
false
732
java
package com.daleb.backend.api.rest.services.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.daleb.backend.api.rest.models.Producto; import com.daleb.backend.api.rest.repositorys.ProductoRepository; import com.daleb.backend.api.rest.services.ProductoService; @Service public class ProductoServiceImpl implements ProductoService { @Autowired private ProductoRepository productoRepository; @Override @Transactional(readOnly = true) public List<Producto> findByNombre(String term) { return productoRepository.findByNombreContainingIgnoreCase(term); } }
[ "daleb015@gmail.com" ]
daleb015@gmail.com
461523e6e0265010f9275d537934d8440a1d0656
cc2f81c5763bb588bba9f62c7474b87d37dd2647
/library/src/main/java/com/jaychang/npc/CropperActivity.java
ba75c5e9cb8e461a95ed9a263e19a07d4533aa3e
[]
no_license
jaychang0917/nPhotoCropper
59cd00a9b52305ce6db8adeebeb0abe6efef1e76
42c7e0a6872fda112c6b520e14c0be1177efc974
refs/heads/master
2021-01-17T15:47:42.916793
2018-06-03T07:15:35
2018-06-03T07:16:54
69,794,464
1
0
null
2018-06-03T07:16:55
2016-10-02T11:48:39
Java
UTF-8
Java
false
false
5,197
java
package com.jaychang.npc; import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.TextView; import com.yalantis.ucrop.UCrop; import com.yalantis.ucrop.callback.BitmapCropCallback; import com.yalantis.ucrop.view.GestureCropImageView; import com.yalantis.ucrop.view.OverlayView; import com.yalantis.ucrop.view.UCropView; import java.io.File; import java.util.UUID; public class CropperActivity extends AppCompatActivity { private GestureCropImageView cropImageView; private OverlayView overlayView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.npc_activity_cropper); init(); } private void init() { Utils.setStatusBarColor(this, android.R.color.black); initToolbar(); initCropOptionsPanel(); initCropper(); } private void initToolbar() { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitle(""); setSupportActionBar(toolbar); toolbar.setNavigationIcon(R.drawable.ic_close); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { finish(); } }); } private void initCropper() { final UCropView cropView = (UCropView) findViewById(R.id.cropView); cropImageView = cropView.getCropImageView(); overlayView = cropView.getOverlayView(); Uri photoSourceUri = getIntent().getParcelableExtra(NPhotoCropper.EXTRA_PHOTO_SOURCE_URI); File outputFile = new File(getCacheDir(), "nPhotoCrop_" + UUID.randomUUID().toString() + ".jpg"); try { cropImageView.setImageUri(photoSourceUri, Uri.fromFile(outputFile)); } catch (Exception e) { e.printStackTrace(); } overlayView.setFreestyleCropEnabled(true); cropImageView.setRotateEnabled(true); cropImageView.setScaleEnabled(true); } private void initCropOptionsPanel() { final TextView originalOptionView = (TextView) findViewById(R.id.originalOptionView); final TextView wideOptionView = (TextView) findViewById(R.id.wideOptionView); final TextView squareOptionView = (TextView) findViewById(R.id.squareOptionView); final TextView rotateOptionView = (TextView) findViewById(R.id.rotateOptionView); originalOptionView.setSelected(true); originalOptionView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { originalOptionView.setSelected(true); wideOptionView.setSelected(false); squareOptionView.setSelected(false); changeToOriginalCropOption(); } }); wideOptionView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { originalOptionView.setSelected(false); wideOptionView.setSelected(true); squareOptionView.setSelected(false); changeToWideCropOption(); } }); squareOptionView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { originalOptionView.setSelected(false); wideOptionView.setSelected(false); squareOptionView.setSelected(true); changeToSquareCropOption(); } }); rotateOptionView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { rotatePhoto(-90); } }); } private void changeToOriginalCropOption() { cropImageView.setTargetAspectRatio(0.0f); } private void changeToWideCropOption() { cropImageView.setTargetAspectRatio(3.0f / 2); } private void changeToSquareCropOption() { cropImageView.setTargetAspectRatio(1.0f); } private void rotatePhoto(int angle) { cropImageView.postRotate(angle); cropImageView.setImageToWrapCropBounds(); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.npc_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.done) { cropAndSaveImage(); } return true; } private void cropAndSaveImage() { cropImageView.cropAndSaveImage(Bitmap.CompressFormat.JPEG, 90, new BitmapCropCallback() { @Override public void onBitmapCropped(@NonNull Uri resultUri, int imageWidth, int imageHeight) { setResultUri(resultUri, cropImageView.getTargetAspectRatio(), imageWidth, imageHeight); finish(); } @Override public void onCropFailure(@NonNull Throwable t) { setResultError(t); finish(); } }); } private void setResultUri(Uri uri, float resultAspectRatio, int imageWidth, int imageHeight) { NPhotoCropper.getInstance().onPhotoCropped(uri); } private void setResultError(Throwable throwable) { NPhotoCropper.getInstance().onPhotoCropError(throwable); } }
[ "jay.chang@redso.com.hk" ]
jay.chang@redso.com.hk
5fb8fa909ccc64854d3779d13081ab0f0d7d6556
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/3/3_c82546db8cf2ab0dbe55947d66a26499749f44c3/GameState/3_c82546db8cf2ab0dbe55947d66a26499749f44c3_GameState_s.java
b1d4b8fb5d6a372468e690030938a6ec36e041fa
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
9,062
java
package state; import helper.LevelHelper; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; import org.newdawn.slick.Color; import org.newdawn.slick.GameContainer; import org.newdawn.slick.Graphics; import org.newdawn.slick.Input; import org.newdawn.slick.SlickException; import org.newdawn.slick.state.BasicGameState; import org.newdawn.slick.state.StateBasedGame; import other.LevelController; import other.Translator; import app.Game; import entity.Level; import entity.Menu; import entity.MenuItem; import entity.MessageBox; public class GameState extends BasicGameState { private int stateId; private Level level = null; private boolean showMenu = false; private boolean showGameOverMenu = false; private Menu menu = null; private Menu gameOverMenu = null; private Translator translator; private LevelController levelController; private MessageBox messageBox; private boolean wasFinished = false; public GameState(int stateId) { this.stateId = stateId; this.translator = Translator.getInstance(); this.levelController = LevelController.getInstance(); } @Override public void init(final GameContainer container, final StateBasedGame game) throws SlickException { this.messageBox = new MessageBox(container); this.messageBox.setBackgroundColor(Color.lightGray); MenuItem continueItem = new MenuItem(this.translator.translate("Continue"), new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { GameState.this.showMenu = false; GameState.this.showGameOverMenu = false; } }); MenuItem repeatLevel = new MenuItem(this.translator.translate("Repeat level"), new ActionListener() { @Override public void actionPerformed(ActionEvent e) { GameState.this.initLevel(container, game); GameState.this.showMenu = false; GameState.this.showGameOverMenu = false; } }); MenuItem subMenu = new MenuItem(this.translator.translate("Sub menu"), new ActionListener() { @Override public void actionPerformed(ActionEvent e) { GameState.this.showMenu = false; GameState.this.showGameOverMenu = false; game.enterState(Game.MENU_FOR_GAME_STATE); } }); MenuItem mainMenu = new MenuItem(this.translator.translate("Main menu"), new ActionListener() { @Override public void actionPerformed(ActionEvent e) { GameState.this.showMenu = false; GameState.this.showGameOverMenu = false; game.enterState(Game.MENU_STATE); } }); List<MenuItem> menuItems = new ArrayList<MenuItem>(); menuItems.add(continueItem); menuItems.add(repeatLevel); menuItems.add(subMenu); menuItems.add(mainMenu); for (MenuItem item : menuItems) { item.setMargin(30); } this.menu = new Menu(menuItems, container); this.menu.setBackgroundColor(Color.lightGray); List<MenuItem> gameOverMenuItems = new ArrayList<MenuItem>(); gameOverMenuItems.add(repeatLevel); gameOverMenuItems.add(subMenu); gameOverMenuItems.add(mainMenu); for (MenuItem item : gameOverMenuItems) { item.setMargin(30); } this.gameOverMenu = new Menu(gameOverMenuItems, container); this.gameOverMenu.setBackgroundColor(Color.lightGray); this.initLevel(container, game); } private void initLevel(GameContainer container, final StateBasedGame game) { try { this.wasFinished = false; this.level = this.levelController.getCurrentLevel(); int itemSize = this.level.getOriginalImageSize(); float scale = LevelHelper.computeScale(container, this.level.getOriginalImageSize(), new Dimension(this.level.getWidth(), this.level.getHeight())); this.level.setScale(scale); int width = this.level.getWidth() * (int) (itemSize * scale); int height = this.level.getHeight() * (int) (itemSize * scale); this.level.setMarginLeft((container.getWidth() - width) / 2); this.level.setMarginTop((container.getHeight() - height) / 2); if (!this.level.isValid()) { this.messageBox.showConfirm(this.translator .translate("Level is not valid. Do you wanna edit this level?"), new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { game.enterState(Game.EDITOR_STATE); } }, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { game.enterState(Game.MENU_FOR_GAME_STATE); } }); } } catch (Exception e) { e.printStackTrace(); } } @Override public void render(GameContainer container, StateBasedGame game, Graphics g) throws SlickException { this.level.render(container, game, g); if (this.showMenu) { this.menu.render(container, game, g); } if (this.showGameOverMenu) { this.gameOverMenu.render(container, game, g); } this.messageBox.render(container, game, g); } @Override public void update(final GameContainer container, final StateBasedGame game, int delta) throws SlickException { Input input = container.getInput(); if (input.isKeyPressed(Input.KEY_ESCAPE)) { this.showMenu = true; } if (this.level.isOver()) { this.showGameOverMenu = true; } if (this.level.isFinished()) { if (this.levelController.nextLevelExist()) { this.messageBox.showConfirm(this.translator .translate("Level was finished. Do you wanna continue to next level?"), new ActionListener() { @Override public void actionPerformed(ActionEvent e) { GameState.this.levelController.loadNextLevel(); GameState.this.initLevel(container, game); } }, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { game.enterState(Game.MENU_STATE); } }); } else { this.messageBox .showConfirm( this.translator .translate("Congratulation!!! Package was finished. Do you wanna continue?"), new ActionListener() { @Override public void actionPerformed(ActionEvent e) { game.enterState(Game.MENU_FOR_GAME_STATE); } }, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { game.enterState(Game.MENU_STATE); } }); } if (!this.wasFinished) { this.wasFinished = true; this.levelController.updateProgress(); } } if (this.showMenu) { this.menu.update(container, game, delta); } else if (this.showGameOverMenu) { this.gameOverMenu.update(container, game, delta); } else { this.level.update(container, game, delta); } this.messageBox.update(container, game, delta); } @Override public int getID() { return this.stateId; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
8367c8a5b3e7ea99c76512b88f42b92cf25cdee4
4d6f449339b36b8d4c25d8772212bf6cd339f087
/netreflected/src/Framework/System.Core,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089/system/security/cryptography/ECDsaCng.java
5b567a3a26d09b5fd7f3859ba33fb81b8b856d41
[ "MIT" ]
permissive
lvyitian/JCOReflector
299a64550394db3e663567efc6e1996754f6946e
7e420dca504090b817c2fe208e4649804df1c3e1
refs/heads/master
2022-12-07T21:13:06.208025
2020-08-28T09:49:29
2020-08-28T09:49:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
36,493
java
/* * MIT License * * Copyright (c) 2020 MASES s.r.l. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /************************************************************************************** * <auto-generated> * This code was generated from a template using JCOReflector * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. * </auto-generated> *************************************************************************************/ package system.security.cryptography; import org.mases.jcobridge.*; import org.mases.jcobridge.netreflection.*; import java.util.ArrayList; // Import section import system.security.cryptography.ECDsa; import system.security.cryptography.CngKey; import system.security.cryptography.ECCurve; import system.io.Stream; import system.security.cryptography.ECParameters; import system.security.cryptography.ECKeyXmlFormat; import system.security.cryptography.CngAlgorithm; /** * The base .NET class managing System.Security.Cryptography.ECDsaCng, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089. Extends {@link NetObject}. * <p> * * See: <a href="https://docs.microsoft.com/en-us/dotnet/api/System.Security.Cryptography.ECDsaCng" target="_top">https://docs.microsoft.com/en-us/dotnet/api/System.Security.Cryptography.ECDsaCng</a> */ public class ECDsaCng extends ECDsa { /** * Fully assembly qualified name: System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 */ public static final String assemblyFullName = "System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; /** * Assembly name: System.Core */ public static final String assemblyShortName = "System.Core"; /** * Qualified class name: System.Security.Cryptography.ECDsaCng */ public static final String className = "System.Security.Cryptography.ECDsaCng"; static JCOBridge bridge = JCOBridgeInstance.getInstance(assemblyFullName); /** * The type managed from JCOBridge. See {@link JCType} */ public static JCType classType = createType(); static JCEnum enumInstance = null; JCObject classInstance = null; static JCType createType() { try { return bridge.GetType(className + ", " + (JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName)); } catch (JCException e) { return null; } } void addReference(String ref) throws Throwable { try { bridge.AddReference(ref); } catch (JCNativeException jcne) { throw translateException(jcne); } } public ECDsaCng(Object instance) throws Throwable { super(instance); if (instance instanceof JCObject) { classInstance = (JCObject) instance; } else throw new Exception("Cannot manage object, it is not a JCObject"); } public String getJCOAssemblyName() { return assemblyFullName; } public String getJCOClassName() { return className; } public String getJCOObjectName() { return className + ", " + (JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); } public Object getJCOInstance() { return classInstance; } public void setJCOInstance(JCObject instance) { classInstance = instance; super.setJCOInstance(classInstance); } public JCType getJCOType() { return classType; } /** * Try to cast the {@link IJCOBridgeReflected} instance into {@link ECDsaCng}, a cast assert is made to check if types are compatible. */ public static ECDsaCng cast(IJCOBridgeReflected from) throws Throwable { NetType.AssertCast(classType, from); return new ECDsaCng(from.getJCOInstance()); } // Constructors section public ECDsaCng() throws Throwable, system.NullReferenceException, system.ArgumentNullException, system.ArgumentException, system.NotImplementedException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.ArgumentOutOfRangeException, system.FormatException, system.PlatformNotSupportedException, system.security.cryptography.CryptographicException { try { // add reference to assemblyName.dll file addReference(JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); setJCOInstance((JCObject)classType.NewObject()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public ECDsaCng(int keySize) throws Throwable, system.NullReferenceException, system.ArgumentNullException, system.ArgumentException, system.NotImplementedException, system.globalization.CultureNotFoundException, system.IndexOutOfRangeException, system.ArgumentOutOfRangeException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.PlatformNotSupportedException, system.security.cryptography.CryptographicException { try { // add reference to assemblyName.dll file addReference(JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); setJCOInstance((JCObject)classType.NewObject(keySize)); } catch (JCNativeException jcne) { throw translateException(jcne); } } public ECDsaCng(CngKey key) throws Throwable, system.NullReferenceException, system.ArgumentNullException, system.ArgumentException, system.NotImplementedException, system.globalization.CultureNotFoundException, system.IndexOutOfRangeException, system.ArgumentOutOfRangeException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.security.cryptography.CryptographicException, system.PlatformNotSupportedException, system.security.SecurityException, system.NotSupportedException, system.MissingMethodException { try { // add reference to assemblyName.dll file addReference(JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); setJCOInstance((JCObject)classType.NewObject(key == null ? null : key.getJCOInstance())); } catch (JCNativeException jcne) { throw translateException(jcne); } } public ECDsaCng(ECCurve curve) throws Throwable, system.NullReferenceException, system.ArgumentNullException, system.ArgumentException, system.NotImplementedException, system.globalization.CultureNotFoundException, system.IndexOutOfRangeException, system.ArgumentOutOfRangeException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.NotSupportedException { try { // add reference to assemblyName.dll file addReference(JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); setJCOInstance((JCObject)classType.NewObject(curve == null ? null : curve.getJCOInstance())); } catch (JCNativeException jcne) { throw translateException(jcne); } } // Methods section public boolean VerifyData(byte[] data, byte[] signature) throws Throwable, system.ArgumentNullException, system.ArgumentOutOfRangeException, system.ArgumentException, system.NotImplementedException, system.globalization.CultureNotFoundException, system.IndexOutOfRangeException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.PlatformNotSupportedException, system.collections.generic.KeyNotFoundException, system.security.cryptography.CryptographicException, system.OutOfMemoryException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (boolean)classInstance.Invoke("VerifyData", data, signature); } catch (JCNativeException jcne) { throw translateException(jcne); } } public boolean VerifyData(JCRefOut dupParam0, JCRefOut dupParam1) throws Throwable, system.ArgumentNullException, system.ArgumentOutOfRangeException, system.ArgumentException, system.NotImplementedException, system.globalization.CultureNotFoundException, system.IndexOutOfRangeException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.PlatformNotSupportedException, system.collections.generic.KeyNotFoundException, system.security.cryptography.CryptographicException, system.OutOfMemoryException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (boolean)classInstance.Invoke("VerifyData", dupParam0, dupParam1); } catch (JCNativeException jcne) { throw translateException(jcne); } } public boolean VerifyData(byte[] data, int offset, int count, byte[] signature) throws Throwable, system.ArgumentNullException, system.ArgumentOutOfRangeException, system.ArgumentException, system.InvalidOperationException, system.MissingMethodException, system.reflection.TargetInvocationException, system.NotImplementedException, system.globalization.CultureNotFoundException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.PlatformNotSupportedException, system.IndexOutOfRangeException, system.collections.generic.KeyNotFoundException, system.security.cryptography.CryptographicException, system.OutOfMemoryException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (boolean)classInstance.Invoke("VerifyData", data, offset, count, signature); } catch (JCNativeException jcne) { throw translateException(jcne); } } public boolean VerifyData(JCRefOut dupParam0, int dupParam1, int dupParam2, JCRefOut dupParam3) throws Throwable, system.ArgumentNullException, system.ArgumentOutOfRangeException, system.ArgumentException, system.InvalidOperationException, system.MissingMethodException, system.reflection.TargetInvocationException, system.NotImplementedException, system.globalization.CultureNotFoundException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.PlatformNotSupportedException, system.IndexOutOfRangeException, system.collections.generic.KeyNotFoundException, system.security.cryptography.CryptographicException, system.OutOfMemoryException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (boolean)classInstance.Invoke("VerifyData", dupParam0, dupParam1, dupParam2, dupParam3); } catch (JCNativeException jcne) { throw translateException(jcne); } } public boolean VerifyData(Stream data, byte[] signature) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.InvalidOperationException, system.MissingMethodException, system.reflection.TargetInvocationException, system.NotImplementedException, system.ArgumentOutOfRangeException, system.globalization.CultureNotFoundException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.PlatformNotSupportedException, system.IndexOutOfRangeException, system.collections.generic.KeyNotFoundException, system.security.cryptography.CryptographicException, system.OutOfMemoryException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (boolean)classInstance.Invoke("VerifyData", data == null ? null : data.getJCOInstance(), signature); } catch (JCNativeException jcne) { throw translateException(jcne); } } public boolean VerifyData(Stream dupParam0, JCRefOut dupParam1) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.InvalidOperationException, system.MissingMethodException, system.reflection.TargetInvocationException, system.NotImplementedException, system.ArgumentOutOfRangeException, system.globalization.CultureNotFoundException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.PlatformNotSupportedException, system.IndexOutOfRangeException, system.collections.generic.KeyNotFoundException, system.security.cryptography.CryptographicException, system.OutOfMemoryException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (boolean)classInstance.Invoke("VerifyData", dupParam0 == null ? null : dupParam0.getJCOInstance(), dupParam1); } catch (JCNativeException jcne) { throw translateException(jcne); } } public boolean VerifyHash(byte[] hash, byte[] signature) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.InvalidOperationException, system.MissingMethodException, system.reflection.TargetInvocationException, system.ArgumentOutOfRangeException, system.FormatException, system.security.SecurityException, system.NotSupportedException, system.security.cryptography.CryptographicException, system.NullReferenceException, system.NotImplementedException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.PlatformNotSupportedException, system.RankException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (boolean)classInstance.Invoke("VerifyHash", hash, signature); } catch (JCNativeException jcne) { throw translateException(jcne); } } public boolean VerifyHash(JCRefOut dupParam0, JCRefOut dupParam1) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.InvalidOperationException, system.MissingMethodException, system.reflection.TargetInvocationException, system.ArgumentOutOfRangeException, system.FormatException, system.security.SecurityException, system.NotSupportedException, system.security.cryptography.CryptographicException, system.NullReferenceException, system.NotImplementedException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.PlatformNotSupportedException, system.RankException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (boolean)classInstance.Invoke("VerifyHash", dupParam0, dupParam1); } catch (JCNativeException jcne) { throw translateException(jcne); } } public byte[] SignData(byte[] data) throws Throwable, system.ArgumentNullException, system.ArgumentOutOfRangeException, system.ArgumentException, system.NotImplementedException, system.globalization.CultureNotFoundException, system.IndexOutOfRangeException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.PlatformNotSupportedException, system.collections.generic.KeyNotFoundException, system.security.cryptography.CryptographicException, system.OutOfMemoryException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { ArrayList<Object> resultingArrayList = new ArrayList<Object>(); JCObject resultingObjects = (JCObject)classInstance.Invoke("SignData", (Object)data); for (Object resultingObject : resultingObjects) { resultingArrayList.add(resultingObject); } byte[] resultingArray = new byte[resultingArrayList.size()]; for(int indexSignData = 0; indexSignData < resultingArrayList.size(); indexSignData++ ) { resultingArray[indexSignData] = (byte)resultingArrayList.get(indexSignData); } return resultingArray; } catch (JCNativeException jcne) { throw translateException(jcne); } } public byte[] SignData(JCRefOut dupParam0) throws Throwable, system.ArgumentNullException, system.ArgumentOutOfRangeException, system.ArgumentException, system.NotImplementedException, system.globalization.CultureNotFoundException, system.IndexOutOfRangeException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.PlatformNotSupportedException, system.collections.generic.KeyNotFoundException, system.security.cryptography.CryptographicException, system.OutOfMemoryException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { ArrayList<Object> resultingArrayList = new ArrayList<Object>(); JCObject resultingObjects = (JCObject)classInstance.Invoke("SignData", (Object)dupParam0); for (Object resultingObject : resultingObjects) { resultingArrayList.add(resultingObject); } byte[] resultingArray = new byte[resultingArrayList.size()]; for(int indexSignData = 0; indexSignData < resultingArrayList.size(); indexSignData++ ) { resultingArray[indexSignData] = (byte)resultingArrayList.get(indexSignData); } return resultingArray; } catch (JCNativeException jcne) { throw translateException(jcne); } } public byte[] SignData(byte[] data, int offset, int count) throws Throwable, system.ArgumentNullException, system.ArgumentOutOfRangeException, system.ArgumentException, system.InvalidOperationException, system.MissingMethodException, system.reflection.TargetInvocationException, system.NotImplementedException, system.globalization.CultureNotFoundException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.PlatformNotSupportedException, system.IndexOutOfRangeException, system.collections.generic.KeyNotFoundException, system.security.cryptography.CryptographicException, system.OutOfMemoryException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { ArrayList<Object> resultingArrayList = new ArrayList<Object>(); JCObject resultingObjects = (JCObject)classInstance.Invoke("SignData", data, offset, count); for (Object resultingObject : resultingObjects) { resultingArrayList.add(resultingObject); } byte[] resultingArray = new byte[resultingArrayList.size()]; for(int indexSignData = 0; indexSignData < resultingArrayList.size(); indexSignData++ ) { resultingArray[indexSignData] = (byte)resultingArrayList.get(indexSignData); } return resultingArray; } catch (JCNativeException jcne) { throw translateException(jcne); } } public byte[] SignData(JCRefOut dupParam0, int dupParam1, int dupParam2) throws Throwable, system.ArgumentNullException, system.ArgumentOutOfRangeException, system.ArgumentException, system.InvalidOperationException, system.MissingMethodException, system.reflection.TargetInvocationException, system.NotImplementedException, system.globalization.CultureNotFoundException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.PlatformNotSupportedException, system.IndexOutOfRangeException, system.collections.generic.KeyNotFoundException, system.security.cryptography.CryptographicException, system.OutOfMemoryException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { ArrayList<Object> resultingArrayList = new ArrayList<Object>(); JCObject resultingObjects = (JCObject)classInstance.Invoke("SignData", dupParam0, dupParam1, dupParam2); for (Object resultingObject : resultingObjects) { resultingArrayList.add(resultingObject); } byte[] resultingArray = new byte[resultingArrayList.size()]; for(int indexSignData = 0; indexSignData < resultingArrayList.size(); indexSignData++ ) { resultingArray[indexSignData] = (byte)resultingArrayList.get(indexSignData); } return resultingArray; } catch (JCNativeException jcne) { throw translateException(jcne); } } public byte[] SignData(Stream data) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.InvalidOperationException, system.MissingMethodException, system.reflection.TargetInvocationException, system.NotImplementedException, system.ArgumentOutOfRangeException, system.globalization.CultureNotFoundException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.PlatformNotSupportedException, system.IndexOutOfRangeException, system.collections.generic.KeyNotFoundException, system.security.cryptography.CryptographicException, system.OutOfMemoryException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { ArrayList<Object> resultingArrayList = new ArrayList<Object>(); JCObject resultingObjects = (JCObject)classInstance.Invoke("SignData", data == null ? null : data.getJCOInstance()); for (Object resultingObject : resultingObjects) { resultingArrayList.add(resultingObject); } byte[] resultingArray = new byte[resultingArrayList.size()]; for(int indexSignData = 0; indexSignData < resultingArrayList.size(); indexSignData++ ) { resultingArray[indexSignData] = (byte)resultingArrayList.get(indexSignData); } return resultingArray; } catch (JCNativeException jcne) { throw translateException(jcne); } } public byte[] SignHash(byte[] hash) throws Throwable, system.ArgumentNullException, system.ArgumentOutOfRangeException, system.security.cryptography.CryptographicException, system.ArgumentException, system.NullReferenceException, system.NotImplementedException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.PlatformNotSupportedException, system.RankException, system.security.SecurityException, system.NotSupportedException, system.MissingMethodException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { ArrayList<Object> resultingArrayList = new ArrayList<Object>(); JCObject resultingObjects = (JCObject)classInstance.Invoke("SignHash", (Object)hash); for (Object resultingObject : resultingObjects) { resultingArrayList.add(resultingObject); } byte[] resultingArray = new byte[resultingArrayList.size()]; for(int indexSignHash = 0; indexSignHash < resultingArrayList.size(); indexSignHash++ ) { resultingArray[indexSignHash] = (byte)resultingArrayList.get(indexSignHash); } return resultingArray; } catch (JCNativeException jcne) { throw translateException(jcne); } } public byte[] SignHash(JCRefOut dupParam0) throws Throwable, system.ArgumentNullException, system.ArgumentOutOfRangeException, system.security.cryptography.CryptographicException, system.ArgumentException, system.NullReferenceException, system.NotImplementedException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.PlatformNotSupportedException, system.RankException, system.security.SecurityException, system.NotSupportedException, system.MissingMethodException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { ArrayList<Object> resultingArrayList = new ArrayList<Object>(); JCObject resultingObjects = (JCObject)classInstance.Invoke("SignHash", (Object)dupParam0); for (Object resultingObject : resultingObjects) { resultingArrayList.add(resultingObject); } byte[] resultingArray = new byte[resultingArrayList.size()]; for(int indexSignHash = 0; indexSignHash < resultingArrayList.size(); indexSignHash++ ) { resultingArray[indexSignHash] = (byte)resultingArrayList.get(indexSignHash); } return resultingArray; } catch (JCNativeException jcne) { throw translateException(jcne); } } public ECParameters ExportExplicitParameters(boolean includePrivateParameters) throws Throwable, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.security.cryptography.CryptographicException, system.ArgumentException, system.NullReferenceException, system.NotImplementedException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.PlatformNotSupportedException, system.RankException, system.MissingMethodException, system.reflection.TargetInvocationException, system.NotSupportedException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject objExportExplicitParameters = (JCObject)classInstance.Invoke("ExportExplicitParameters", includePrivateParameters); return new ECParameters(objExportExplicitParameters); } catch (JCNativeException jcne) { throw translateException(jcne); } } public ECParameters ExportParameters(boolean includePrivateParameters) throws Throwable, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.security.cryptography.CryptographicException, system.ArgumentException, system.NullReferenceException, system.NotImplementedException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.PlatformNotSupportedException, system.RankException, system.MissingMethodException, system.reflection.TargetInvocationException, system.NotSupportedException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject objExportParameters = (JCObject)classInstance.Invoke("ExportParameters", includePrivateParameters); return new ECParameters(objExportParameters); } catch (JCNativeException jcne) { throw translateException(jcne); } } public java.lang.String ToXmlString(boolean includePrivateParameters) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.InvalidOperationException, system.MissingMethodException, system.reflection.TargetInvocationException, system.NotImplementedException, system.NotSupportedException, system.ArgumentOutOfRangeException, system.globalization.CultureNotFoundException, system.resources.MissingManifestResourceException, system.ObjectDisposedException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (java.lang.String)classInstance.Invoke("ToXmlString", includePrivateParameters); } catch (JCNativeException jcne) { throw translateException(jcne); } } public java.lang.String ToXmlString(ECKeyXmlFormat format) throws Throwable, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.ArgumentException, system.InvalidOperationException, system.MissingMethodException, system.reflection.TargetInvocationException, system.NotImplementedException, system.globalization.CultureNotFoundException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.NotSupportedException, system.security.cryptography.CryptographicException, system.OutOfMemoryException, system.IndexOutOfRangeException, system.xml.XmlException, system.RankException, system.FormatException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (java.lang.String)classInstance.Invoke("ToXmlString", format == null ? null : format.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void FromXmlString(java.lang.String xmlString) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.InvalidOperationException, system.MissingMethodException, system.reflection.TargetInvocationException, system.NotImplementedException, system.NotSupportedException, system.ArgumentOutOfRangeException, system.globalization.CultureNotFoundException, system.resources.MissingManifestResourceException, system.ObjectDisposedException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Invoke("FromXmlString", xmlString); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void FromXmlString(java.lang.String xml, ECKeyXmlFormat format) throws Throwable, system.ArgumentNullException, system.ArgumentOutOfRangeException, system.ArgumentException, system.NotImplementedException, system.NotSupportedException, system.IndexOutOfRangeException, system.ObjectDisposedException, system.InvalidOperationException, system.security.SecurityException, system.UnauthorizedAccessException, system.io.IOException, system.threading.AbandonedMutexException, system.resources.MissingManifestResourceException, system.MissingMethodException, system.reflection.TargetInvocationException, system.globalization.CultureNotFoundException, system.FormatException, system.RankException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Invoke("FromXmlString", xml, format == null ? null : format.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void GenerateKey(ECCurve curve) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.InvalidOperationException, system.MissingMethodException, system.reflection.TargetInvocationException, system.NotImplementedException, system.ArgumentOutOfRangeException, system.globalization.CultureNotFoundException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.security.cryptography.CryptographicException, system.OutOfMemoryException, system.IndexOutOfRangeException, system.NullReferenceException, system.NotSupportedException, system.PlatformNotSupportedException, system.RankException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Invoke("GenerateKey", curve == null ? null : curve.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void ImportParameters(ECParameters parameters) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.resources.MissingManifestResourceException, system.NotImplementedException, system.ObjectDisposedException, system.InvalidOperationException, system.security.cryptography.CryptographicException, system.ArgumentOutOfRangeException, system.IndexOutOfRangeException, system.NullReferenceException, system.OutOfMemoryException, system.NotSupportedException, system.MissingMethodException, system.reflection.TargetInvocationException, system.PlatformNotSupportedException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Invoke("ImportParameters", parameters == null ? null : parameters.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } // Properties section public CngAlgorithm getHashAlgorithm() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("HashAlgorithm"); return new CngAlgorithm(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void setHashAlgorithm(CngAlgorithm HashAlgorithm) throws Throwable, system.NullReferenceException, system.ArgumentNullException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Set("HashAlgorithm", HashAlgorithm == null ? null : HashAlgorithm.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public CngKey getKey() throws Throwable, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.security.cryptography.CryptographicException, system.ArgumentException, system.NullReferenceException, system.NotImplementedException, system.globalization.CultureNotFoundException, system.IndexOutOfRangeException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.FormatException, system.PlatformNotSupportedException, system.RankException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("Key"); return new CngKey(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void setKey(CngKey Key) throws Throwable, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.security.cryptography.CryptographicException, system.ArgumentException, system.NotImplementedException, system.globalization.CultureNotFoundException, system.IndexOutOfRangeException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.FormatException, system.NullReferenceException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Set("Key", Key == null ? null : Key.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } // Instance Events section }
[ "mario.mastrodicasa@masesgroup.com" ]
mario.mastrodicasa@masesgroup.com
a8598dffb3ce24ba175856a25b4fe68122778fe2
9877d312836637564fb06df870bf87d87f8ad3cb
/src/main/java/com/africaapps/league/model/league/Statistic.java
c888cba720bd52370025bd909a79bdafcf9b469b
[]
no_license
aislingvasey/league
9a0f61df1ef2fbb12e7162690ec6c49eb0848697
bb3d567c500087b2ef46c950c1924932b378ba03
refs/heads/master
2021-01-19T15:01:41.021664
2013-09-15T08:06:42
2013-09-15T08:06:42
10,145,033
1
0
null
null
null
null
UTF-8
Java
false
false
3,100
java
package com.africaapps.league.model.league; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.UniqueConstraint; import javax.validation.constraints.NotNull; import org.hibernate.annotations.Index; import com.africaapps.league.model.BaseDataModel; import com.africaapps.league.validation.UpdateGroup; @Entity @Table(name="statistic", uniqueConstraints={@UniqueConstraint(columnNames={"league_type_id", "external_id", "block_type"})}) public class Statistic extends BaseDataModel { private static final long serialVersionUID = 1L; private LeagueType leagueType; private Integer externalId; private String name; private Double points; private BlockType block; @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("[Statistic: "); builder.append(" id:").append(id); builder.append(" externalId:").append(externalId); builder.append(" name:").append(name); builder.append(" points:").append(points); builder.append(" type:").append(leagueType); builder.append(" block:").append(block); builder.append("]"); return builder.toString(); } @Override public boolean equals(Object o) { if (this == o) { return true; } else if (!(o instanceof Statistic)) { return false; } else { Statistic s = (Statistic) o; if (s.getId().equals(id)) { return true; } else { return false; } } } @Override public int hashCode() { return id.hashCode(); } @NotNull(groups={UpdateGroup.class}) @Id @SequenceGenerator(name="stat_seq", sequenceName="stat_seq", allocationSize=1) @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="stat_seq") @Column(name="id", nullable=false) public Long getId() { return id; } @ManyToOne @JoinColumn(name = "league_type_id") public LeagueType getLeagueType() { return leagueType; } public void setLeagueType(LeagueType leagueType) { this.leagueType = leagueType; } @NotNull @Index(name="external_stat_id_index", columnNames = "external_id") @Column(name="external_id", nullable=false) public Integer getExternalId() { return externalId; } public void setExternalId(Integer externalId) { this.externalId = externalId; } @NotNull @Column(name="name", length=200, nullable=false) public String getName() { return name; } public void setName(String name) { this.name = name; } @NotNull @Column(name="points", nullable=false) public Double getPoints() { return points; } public void setPoints(Double points) { this.points = points; } @Column(name="block_type", nullable=false) @Enumerated(EnumType.STRING) public BlockType getBlock() { return block; } public void setBlock(BlockType block) { this.block = block; } }
[ "aislingvasey@gmail.com" ]
aislingvasey@gmail.com
aedf5d4753a097a3367aa7745cc975dfe98c0ebb
e51250c325d009e042596c7310a76a4818c8555e
/ptrace-for-android-master/MyListView/app/src/main/java/com/example/krishna/mylistview/Parser.java
24c519b77457f2534d3b678d24b2b990ab091d5a
[]
no_license
Greensue/Android-hook
ac2d480a9a13ae0aa1be8733c90b18309c9ecd80
220ecb892fa17d12d1c3ddb8a4e46a9eec99940d
refs/heads/master
2020-12-23T15:21:34.375168
2017-05-27T07:33:24
2017-05-27T07:33:24
92,562,455
3
2
null
null
null
null
UTF-8
Java
false
false
5,401
java
package com.example.krishna.mylistview; import android.os.Message; import android.util.Log; import java.io.BufferedReader; import java.io.IOException; import java.net.URLConnection; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import android.os.Handler; public class Parser { public static void getSysCallSet(SysCallHolder call, ArrayList<String> sysCalls, ArrayList<ArrayList<String>> sysCallArgs) { //sysCalls = new ArrayList<String>(); //sysCallArgs = new ArrayList<ArrayList<String>>(); String sysCall = call.getSysCall(); if (!sysCalls.contains(sysCall)) { sysCalls.add(sysCall); sysCallArgs.add(new ArrayList<String>()); } int index = sysCalls.indexOf(sysCall); sysCallArgs.get(index).add(call.getArgsAsString()); } public static ArrayList<ArrayList<String>> getSysCallDetailsAsString(List<SysCallHolder> holders) { return null; } public static void parse(BufferedReader br, Handler myHandler) throws IOException { // TODO Auto-generated method stub BufferedReader reader = br; String line1; String line2; List<SysCallHolder> holders = new ArrayList<SysCallHolder>(); try { while ((line1 = reader.readLine()) != null) { if (line1.startsWith("START_TRACE")) break; Log.v("Parser1", line1 + "\n"); } }catch (Exception e) { Log.v("Parser1c", "Exception :" +e); } while (true) { //Log.v("test2","asdf"); try { line1 = reader.readLine(); //Log.v("Parser21", line1 + "\n"); if (line1 == null ) { Log.v("test1", "ret"); //reader.close(); break; } else if (line1.startsWith("END_STRACE")) { Log.v("test1", "ret1"); break; } if (!line1.contains("(")) { Log.v("test", line1); continue; } line1.trim(); while (countMatches(line1, "\"") % 2 != 0) { if (!reader.ready()) { Log.v("testasdfg1", "ret"); throw new Exception("MY Exception"); } if ((line2 = reader.readLine()) == null) { //reader.close(); Log.v("test1w3rert", "ret"); return; } if (line2.startsWith("\"")) { line2.trim(); line1 = line1.concat(line2); //System.out.println(line1); break; } } line1 = line1.replaceAll(" ", ""); String sysCall = line1.substring(0, line1.indexOf("(")); String argString = line1.substring(line1.indexOf("(") + 1, line1.lastIndexOf(")")); int retValue = Integer.parseInt(line1.substring(line1.lastIndexOf("=") + 1)); int index = 0; int i = 0; String[] strArgs = new String[countMatches(line1, "\"") / 2]; while ((index = argString.indexOf("\"", index)) != -1) { int nextIndex = argString.indexOf("\"", index + 1); String strArg = argString.substring(index, nextIndex + 1); //System.out.println(strArg); argString = argString.replace(strArg, "\"\""); strArgs[i] = strArg; i++; index = nextIndex + 1; } String[] argArray = argString.split(","); i = 0; for (int j = 0; j < argArray.length; j++) { if (argArray[j].equals("\"\"")) { argArray[j] = strArgs[i]; i++; } } SysCallHolder holder = new SysCallHolder(sysCall, retValue, argArray); Log.v("Parser23", sysCall + " " + retValue + "" + argArray + "\n"); //holders.add(holder); Message m = new Message(); m.setTarget(myHandler); m.obj = holder; m.sendToTarget(); } catch (Exception e) { Log.v("Parser24", "Execption :" + e); continue; } } } private static int countMatches(String line1, String string) { // TODO Auto-generated method stub int count = 0; int index = 0; while ((index = line1.indexOf(string, index)) != -1) { //System.out.println(line1+" "+index); count++; index++; } return count; } }
[ "1719837353@qq.com" ]
1719837353@qq.com
3aa2380fcc909642cacfdccc440ee719c2d518a0
b051d8e23a8fe81b7ee4464f6d827a5ef396cf35
/pc-leyou/leyou-item/leyou-interface/src/main/java/com/leyou/entity/SpuVo.java
664dd14d0c01e3c34f0795016e7fcd4e7aaf0b47
[]
no_license
guoliwei220/leyou
71e6daa931ecbee7cef01473f6bfe219f58422d4
e44a07bead11e21034a46b5d82ca5e501b7358f9
refs/heads/master
2020-05-15T11:36:22.486980
2019-05-21T07:59:00
2019-05-21T07:59:00
182,236,627
0
0
null
null
null
null
UTF-8
Java
false
false
391
java
package com.leyou.entity; import lombok.Data; import java.util.Date; @Data public class SpuVo { private Long id; private String title; private String subTitle; private Long cid1; private Long cid2; private Long cid3; private Long brandId; private Long saleable; private Date createTime; private String cname; private String bname; }
[ "782012972@qq.com" ]
782012972@qq.com