blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
6e8900aab1b18632660d41cb15a2dfb96b8eb3fa
46167791cbfeebc8d3ddc97112764d7947fffa22
/spring-boot/src/main/java/com/justexample/entity/Entity1587.java
17c6c927c7970eed24b2d509ba80fb0212d37e5a
[]
no_license
kahlai/unrealistictest
4f668b4822a25b4c1f06c6b543a26506bb1f8870
fe30034b05f5aacd0ef69523479ae721e234995c
refs/heads/master
2023-08-25T09:32:16.059555
2021-11-09T08:17:22
2021-11-09T08:17:22
425,726,016
0
0
null
null
null
null
UTF-8
Java
false
false
1,134
java
package com.justexample.entity; import java.sql.Timestamp; import javax.persistence.Entity; import javax.persistence.Id; @Entity public class Entity1587 { @Id private Long id; private String code; private String name; private String status; private int seq; private Timestamp createdDate; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public int getSeq() { return seq; } public void setSeq(int seq) { this.seq = seq; } public Timestamp getCreatedDate() { return createdDate; } public void setCreatedDate(Timestamp createdDate) { this.createdDate = createdDate; } }
a68c19a66610d5f33021fa5b98784175c6144013
2a9841df0a067de061578bed4c588b23ce223c87
/src/main/java/ae/anyorder/bigorder/controller/view/MerchantViewController.java
f583970e91e3bced8b18c886ff754eaa54a01442
[]
no_license
bandanasinghco/aidtask3
086f833e8ca221ea51394c4c16dc314dc286e921
5e3642d36b5674f93cb582976e74293fe3508f2a
refs/heads/master
2023-03-14T07:08:06.885444
2018-05-11T06:59:05
2018-05-11T06:59:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
752
java
package ae.anyorder.bigorder.controller.view; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; /** * Created by Frank on 4/8/2018. */ @Controller @RequestMapping(value = "/merchant") public class MerchantViewController { @RequestMapping(value = "/**/{page}/**", method = RequestMethod.GET) public ModelAndView merchantSignup(@PathVariable String page){ ModelAndView modelAndView = new ModelAndView(); modelAndView.setViewName("merchant/" + page); return modelAndView; } }
4999be6553f7a1a25bad3f3d4afedf575b3e83d3
e28ac6c13c40436adb709872d74aaacc3be27b49
/src/com/xiaov/bean/ResultInfo.java
aad0c37596a28a85ab1e9289e7ab05eefb15ad2b
[]
no_license
LiXiaoV/lianxi1
4c9065775c0ea180e6e34c757e6cd15f798ee95b
b53cef74c0dcdaa3bdfe69b3418df55d8488ec4a
refs/heads/master
2020-09-01T11:18:08.458245
2020-04-18T01:04:04
2020-04-18T01:04:04
218,948,391
0
0
null
null
null
null
UTF-8
Java
false
false
1,154
java
package com.xiaov.bean; /** * 用于封装后端返回前端数据对象 * @author xiaov Li * @date 2019-10-28 19:25 */ public class ResultInfo{ private boolean flag;//后端返回结果正常为true,发生异常返回false private Object data;//后端返回结果数据对象 private String errorMsg;//发生异常的错误消息 public ResultInfo() { } public ResultInfo(boolean flag) { this.flag = flag; } public ResultInfo(boolean flag, String errorMsg) { this.flag = flag; this.errorMsg = errorMsg; } public ResultInfo(boolean flag, Object data, String errorMsg) { this.flag = flag; this.data = data; this.errorMsg = errorMsg; } public boolean isFlag() { return flag; } public void setFlag(boolean flag) { this.flag = flag; } public Object getData() { return data; } public void setData(Object data) { this.data = data; } public String getErrorMsg() { return errorMsg; } public void setErrorMsg(String errorMsg) { this.errorMsg = errorMsg; } }
3f0722d29e64a2706bf805d80a345b5cc5e73dea
3553213064d9d2d2d19da7e4a12d7b01c8bef84a
/fengdis-common/src/main/java/com/fengdis/util/PropertiesUtils.java
02f0317204159e1c6134c79d285947f7161adeb2
[ "MIT" ]
permissive
fengdis/fengdis
153bb4555c9b5b7ca3085b4807533bc5ff60349b
0696bdc56408f07e21f8574bf89096b39bc00f1b
refs/heads/master
2022-11-22T15:30:51.474477
2021-04-15T15:47:21
2021-04-15T15:47:21
143,523,399
25
0
MIT
2020-02-19T03:03:09
2018-08-04T11:32:45
Java
UTF-8
Java
false
false
4,997
java
package com.fengdis.util; import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.PropertiesConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.InputStream; import java.io.InputStreamReader; import java.util.*; /** * @version 1.0 * @Descrittion: properties文件读取工具类 * @author: fengdi * @since: 2018/9/3 0003 22:51 */ public class PropertiesUtils { private PropertiesUtils(){ } private static final Logger logger = LoggerFactory.getLogger(PropertiesUtils.class); /** * 默认把system.properties中的属性放入静态map中 */ public static Map<String, String> propertiesMap = new HashMap<>(); private static Properties properties; private static Configuration configuration; static { //properties = loadProperties("system.properties"); /*if (null != properties) { Iterator<Object> keys = properties.keySet().iterator(); while (keys.hasNext()) { String key = keys.next().toString(); String value = properties.getProperty(key); if(!propertiesMap.containsKey(key)){ propertiesMap.put(key, value); } } }*/ configuration = getConfig("system.properties"); if (null != configuration) { Iterator keys = configuration.getKeys(); while (keys.hasNext()) { String key = keys.next().toString(); String value = properties.getProperty(key); if(!propertiesMap.containsKey(key)){ propertiesMap.put(key, value); } } } } /** * 根据文件路径获取Properties对象(java.util包中Properties) * @param path * @return */ @Deprecated private static Properties loadProperties(String path) { Properties properties = new Properties(); try { InputStream inputStream = PropertiesUtils.class.getClassLoader().getResourceAsStream(path); properties.load(new InputStreamReader(inputStream,"UTF-8")); logger.info(String.format("load %s file success",path)); } catch (Exception e) { logger.error(String.format("load %s file error",path),e); } return properties; } /** * 采用apache.common包中的Configuration获取配置信息,放弃使用java.util包中Properties * 根据文件路径获取Configuration对象 * @param fileName * @return */ public static Configuration getConfig(String fileName) { try { Configuration configuration = new PropertiesConfiguration(fileName); logger.info(String.format("load %s file success",fileName)); return configuration; } catch (ConfigurationException e) { logger.error(String.format("load %s file error",fileName),e); } return null; } /*public static String getString(String key, String defaultValue){ if(configuration != null){ return configuration.getString(key, defaultValue); } return defaultValue; } public static Boolean getBoolean(String key, Boolean defaultValue){ if(configuration != null){ return configuration.getBoolean(key, defaultValue); } return defaultValue; } public static Integer getInteger(String key, Integer defaultValue){ if(configuration != null){ return configuration.getInteger(key, defaultValue); } return defaultValue; } public static Long getLong(String key, Long defaultValue){ if(configuration != null){ return configuration.getLong(key, defaultValue); } return defaultValue; } public static Double getDouble(String key, Double defaultValue){ if(configuration != null){ return configuration.getDouble(key, defaultValue); } return defaultValue; } public static Float getFloat(String key, Float defaultValue){ if(configuration != null){ return configuration.getFloat(key, defaultValue); } return defaultValue; } public static Byte getByte(String key, Byte defaultValue){ if(configuration != null){ return configuration.getByte(key, defaultValue); } return defaultValue; } public static Short getShort(String key, Short defaultValue){ if(configuration != null){ return configuration.getShort(key, defaultValue); } return defaultValue; } public static BigDecimal getBigDecimal(String key, BigDecimal defaultValue){ if(configuration != null){ return configuration.getBigDecimal(key, defaultValue); } return defaultValue; } public static BigInteger getBigInteger(String key, BigInteger defaultValue){ if(configuration != null){ return configuration.getBigInteger(key, defaultValue); } return defaultValue; } public static List getList(String key, List defaultValue){ if(configuration != null){ return configuration.getList(key, defaultValue); } return defaultValue; } public static String[] getStringArray(String key, String[] defaultValue){ if(configuration != null){ return configuration.getStringArray(key); } return defaultValue; } public static Properties getProperties(String key){ if(configuration != null){ return configuration.getProperties(key); } return null; }*/ }
a7dc659c196e1b08c4dcd66ba9e6f7b9f0713679
0b1a84c42ab54340b1ef12dfee03193b2bbf893a
/util-excel/src/main/java/com/ld/util/excel/example/writer/builder/BuilderObjectSimpleExample.java
f5247c4abebc6ea69b2bd95aae1c62d22b94a019
[]
no_license
ldhappy/util
acc63d866fdd2601b9cd8a21f2e440bf8933d588
7523d48f5d3f75eea6d6fc1a154d1c913174042c
refs/heads/master
2023-08-25T21:00:44.976069
2021-10-19T02:44:16
2021-10-19T02:44:16
414,427,316
0
0
null
null
null
null
UTF-8
Java
false
false
2,596
java
package com.ld.util.excel.example.writer.builder; import com.ld.util.excel.core.ExportColumnHeader; import com.ld.util.excel.writer.DefaultExcelWriter; import com.ld.util.excel.writer.output.FileOutputStreamROP; import com.ld.util.excel.writer.sheet.StandardSheetWriter; import lombok.extern.slf4j.Slf4j; import java.util.Objects; /** * @ClassName BuilderObjectSimpleExample * @Description 使用构造函数创建excel输出任务,简单样例(单行表头) * @Author 梁聃 * @Date 2021/9/25 10:04 */ @Slf4j public class BuilderObjectSimpleExample { public static void main(String[] args) { DefaultExcelWriter<String> writer = DefaultExcelWriter.<String>builder() //文件前缀 .fileNamePre("BuilderObjectSimpleExample") //单个工作空间需要打印的信息配置 .sheetWriter(StandardSheetWriter.<People>builder() //工作空间名 .sheetName("导出信息") //是否需要设置默认的列序号,默认不需要 .needDefaultCoordinate(true) //每个需要导出的列---开始 .columnHeader(ExportColumnHeader.<People,String>exportColumnHeaderBuilder() .columnName("姓名") .columnFunction(People::getName) .build()) .columnHeader(ExportColumnHeader.<People,Integer>exportColumnHeaderBuilder() .columnName("年龄") .columnFunction(People::getAge) .build()) .columnHeader(ExportColumnHeader.<People,String>exportColumnHeaderBuilder() .columnName("性别") .columnFunction(people -> Objects.isNull(people.getSex())?"未知":(Objects.equals(0,people.getSex())?"男":"女")) .build()) //每个需要导出的列---结束 //每一行需要导出的内容---开始 .content(new People("测试1",28,null)) .content(new People("测试2",30,0)) .content(new People("测试3",27,1)) //每一行需要导出的内容---结束 .build()) .build(); log.debug("文件地址:"+writer.write(new FileOutputStreamROP("d://"))); } }
9549fff2f29624c039ab886ac4ddec0130739155
259abfc65a0f478a6094f15593d101c77d90545a
/src/main/java/com/richard/akka/AppConfiguration.java
5c59e993be9ca231ae68b2ee18938bec102e2d29
[]
no_license
Ricardolv/spring-akka
788604de201558af810879d09acd38422aec4b89
b5a29adf74afece2a036b708289e0b52cc50a8dc
refs/heads/master
2021-01-20T19:25:50.649716
2016-08-06T05:09:35
2016-08-06T05:09:35
65,065,785
0
0
null
null
null
null
UTF-8
Java
false
false
784
java
package com.richard.akka; import akka.actor.ActorSystem; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import static com.richard.akka.SpringExtension.SPRING_EXTENSION_PROVIDER; @Configuration @ComponentScan public class AppConfiguration { @Autowired private ApplicationContext applicationContext; @Bean public ActorSystem actorSystem() { ActorSystem system = ActorSystem.create("akka-spring-demo"); SPRING_EXTENSION_PROVIDER.get(system).initialize(applicationContext); return system; } }
381e3c4f127f72973b04bd3f4c7beff49eeee2a1
8ad5ad30d0c91186b5eeb18bb7c2a4ef9b8cd55a
/EclipseProjects/EasyDB/src/Resource/DimenR.java
628c5e5ce46de1d10ab9e65ada6bb0384e7fdd26
[]
no_license
Tamuel/EasyDB
8056ecaf2895d47cb4f261a3b272ef38af1c0442
3907931026f4f86877b865dbcbd39121ee926dba
refs/heads/master
2020-04-17T21:56:09.209517
2019-02-02T07:41:16
2019-02-02T07:41:16
166,972,689
1
0
null
null
null
null
UTF-8
Java
false
false
2,166
java
package Resource; /** * Dimensions for GUI * @author DongKyu * @since 11.07.15 */ public class DimenR { /** For text size */ public static final int BIG_FONT = 15; public static final int SMALL_FONT = 12; /** Component size */ public static final int TITLE_BAR_HEIGHT = 30; public static final int BUILDING_INFO_HEIGHT = 100; public static final int BUTTON_WIDTH = 60; public static final int BUTTON_HEIGHT = 35; public static final int BUTTON_BORDER = 5; /** For frame size */ public static final int SPLASH_FRAME_WIDTH = 320; public static final int SPLASH_FRAME_HEIGHT = 180; public static final int MAIN_FRAME_WIDTH = 1600; public static final int MAIN_FRAME_HEIGHT = 720; /** For Menu Panel */ public static final int MENU_PANEL_WIDTH = 200; public static final int MENU_BUTTON_MARGIN = 15; /** For Add table frame */ public static final int ADD_TABLE_FRAME_WIDTH = 200; public static final int ADD_TABLE_FRAME_HEIGHT = 100; public static final int ADD_TABLE_MARGIN = 10; /** For Table List Panel */ public static final int TABLE_LIST_PANEL_WIDTH = 630; public static final int TABLE_LIST_BUTTON_MARGIN = 30; public static final int TABLE_LIST_BUTTON_WIDTH = 120; public static final int TABLE_LIST_BUTTON_HEIGHT = 240; public static final int TABLE_LIST_SELECT_BUTTON_SIZE = 20; /** For Table Table Edit */ public static final int TABLE_NAME_LABEL_HEIGHT = 30; public static final int SQL_OP_BUTTON_MARGIN = 15; public static final int SQL_OP_BUTTON_WIDTH = 120; public static final int SQL_OP_BUTTON_HEIGHT = 50; public static final int TABLE_ATTRIBUTE_LABEL_HEIGHT = 40; public static final int TABLE_ATTRIBUTE_BUTTON_MARGIN = 10; /** For Edit Menu Panel */ public static final int EDIT_MENU_PANEL_HEIGHT = 30; public static final int EDIT_MENU_BUTTON_SIZE = 15; public static final int EDIT_MENU_BUTTON_MARGIN = 15; /** For add condition frame */ public static final int ADD_CONDITION_FRAME_WIDTH = 500; public static final int ADD_CONDITION_FRAME_HEIGHT = 400; /** For caution frame */ public static final int CAUTION_FRAME_WIDTH = 300; public static final int CAUTION_FRAME_HEIGHT = 150; }
522c63381a4a72170a7d63e45b44426056986b6f
bc286cd1cfec33a6d0b400c4eee380b6e87c2aae
/app/src/main/java/mrallright/httpexample/mvp/MvpActivity.java
5ab40f7ac4d0d8b078fea24c0140476faaea8999
[]
no_license
MrAllRight/HttpExample
bfa5f29d9fe1065c99f0b6cdd748f258ced4d502
fa5370a334037069231d3e2fc5032772ec7bfd20
refs/heads/master
2020-12-30T11:03:02.964719
2017-08-03T08:34:02
2017-08-03T08:34:02
98,844,222
3
1
null
null
null
null
UTF-8
Java
false
false
1,258
java
package mrallright.httpexample.mvp; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.TextView; import java.util.HashMap; import java.util.List; import java.util.Map; import mrallright.httpexample.R; /** * Created by liuyong * Data: 2017/8/3 * Github:https://github.com/MrAllRight */ public class MvpActivity extends AppCompatActivity implements HttpPresent.View { private TextView tvResult; private HttpModel httpModel; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.retrofit);//布局和retrofit一样,使用textview显示结果 tvResult = (TextView) findViewById(R.id.tv_result); httpModel = new HttpModel(this); //POST请求和上篇一样,创建请求体 final Map<String, String> map = new HashMap<String, String>(); map.put("page", "1"); map.put("code", "news"); map.put("pageSize", "20"); map.put("parentid", "0"); map.put("type", "1"); httpModel.getGameList(map); } @Override public void showTvResult(List<GameBean> beanList) { tvResult.setText(beanList.get(0).toString()); } }
94c383e4422fbdfac2528cc191839ffab1c698a4
44054acde6dbdb09cb736e0c6805583b320e8b09
/web/src/main/java/com/infoshareacademy/jjdd6/codeina/login/Auth0FilterAdmin.java
ea84011d66811b870052b63da7b0ad6931f43bb0
[]
no_license
infoshareacademy/jjdd6-codeina
024d38bb394f422b9e28a291a5619bdc036c3103
1e928f7ad630272d176096a676144103ae29cf04
refs/heads/develop
2020-05-01T17:33:06.437772
2019-05-21T08:51:10
2019-05-21T08:51:10
177,602,736
1
1
null
2019-05-21T08:11:15
2019-03-25T14:29:08
Java
UTF-8
Java
false
false
1,622
java
package com.infoshareacademy.jjdd6.codeina.login; import com.auth0.SessionUtils; import javax.servlet.*; import javax.servlet.annotation.WebFilter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; /** * Filter class to check if a valid session exists. This will be true if the User Id is present. */ @WebFilter(urlPatterns = {"/lukjanadmin", "/someservlet", "/error", "logs"}) public class Auth0FilterAdmin implements Filter { Boolean isUserAdmin; @Override public void init(FilterConfig filterConfig) throws ServletException { Boolean isUserAdmin = Boolean.valueOf(filterConfig.getInitParameter("IsUserAdmin")); } /** * Perform filter check on this request - verify the User Id is present. * * @param request the received request * @param response the response to send * @param next the next filter chain **/ @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain next) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse res = (HttpServletResponse) response; String accessToken = (String) SessionUtils.get(req, "accessToken"); String idToken = (String) SessionUtils.get(req, "idToken"); if (accessToken == null && idToken == null) { res.sendRedirect("/login"); return; } next.doFilter(request, response); } @Override public void destroy() { isUserAdmin = false; } }
e7841c18ab81de8f7f7a9bb5bc08c71ddf72d20f
8ca7aa9857119d90a56ab41c32bc8607c137b0a3
/src/com/onlyknow/platform/entity/PraiseCommentEntity.java
c3544bc5b2dc5ce550119e584d550804584170cd
[]
no_license
HookTong/onlyknow-webapp
757bbd72c1bd1adf128cd1a3f04de639cf7d2719
8f152aecc1f2225a10f2c144530a2d94323dd684
refs/heads/master
2023-02-05T14:17:40.380111
2020-05-16T08:57:01
2020-05-16T08:57:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,562
java
package com.onlyknow.platform.entity; import javax.persistence.*; import java.util.Date; import java.util.Objects; @Entity @Table(name = "praise_comment", schema = "onlyknow_platform", catalog = "") public class PraiseCommentEntity { private int cpId; private String userName; private int comId; private Date cpDate; @Id @Column(name = "CP_ID") public int getCpId() { return cpId; } public void setCpId(int cpId) { this.cpId = cpId; } @Basic @Column(name = "USER_NAME") public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } @Basic @Column(name = "COM_ID") public int getComId() { return comId; } public void setComId(int comId) { this.comId = comId; } @Basic @Column(name = "CP_DATE") public Date getCpDate() { return cpDate; } public void setCpDate(Date cpDate) { this.cpDate = cpDate; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PraiseCommentEntity that = (PraiseCommentEntity) o; return cpId == that.cpId && comId == that.comId && Objects.equals(userName, that.userName) && Objects.equals(cpDate, that.cpDate); } @Override public int hashCode() { return Objects.hash(cpId, userName, comId, cpDate); } }
c7515409556431c9ae119adc3569aa9fa98cd117
fb2cb34bcbb9017b29011f0e11bdb6d305f0d532
/WinAPI.java
ac6b428fcfae13104a5d5c012aff8ce948f28ace
[]
no_license
Ranbo-20171103200/WINAPI
09c70c65032c505364619bb3fd6f603684f63001
a88b4d9f9446e65194a97d02f61e2e2c1af098cd
refs/heads/master
2020-06-04T00:08:07.370648
2019-06-13T15:26:52
2019-06-13T15:26:52
191,788,379
0
0
null
null
null
null
GB18030
Java
false
false
6,674
java
package me.tikiwong.PlantsVsZombies; import com.sun.jna.Native; import com.sun.jna.win32.StdCallLibrary; /** * Windows API */ public interface WinAPI extends StdCallLibrary {//定义一个接口继承StdCallLibrary以调用该接口的方法,以StdCallLibrary方式输出 WinAPI Kernel32 = (WinAPI)Native.loadLibrary("Kernel32", WinAPI.class); //库名为Kernel32,通过该函数获取公共静态常量INSTANCE,通过该常量得到该接口实例从而使用该接口方法,第二个参数为该接口的class类型 int OpenProcess(int dwDesiredAccess, boolean bInheritHandle, int dwProcessId);//定义打开进程函数传入参数为想拥有的该进程访问权限,继承的句柄,进程的ID // 1.函数原型 // HANDLE OpenProcess(DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId); // 2.参数 // a.dwDesiredAccess:想拥有的该进程访问权限 // PROCESS_ALL_ACCESS //所有能获得的权限 // PROCESS_CREATE_PROCESS //需要创建一个进程 // PROCESS_CREATE_THREAD //需要创建一个线程 // PROCESS_DUP_HANDLE //重复使用DuplicateHandle句柄 // PROCESS_QUERY_INFORMATION //获得进程信息的权限,如它的退出代码、优先级 // PROCESS_QUERY_LIMITED_INFORMATION /*获得某些信息的权限,如果获得了PROCESS_QUERY_INFORMATION,也拥有PROCESS_QUERY_LIMITED_INFORMATION权限*/ // PROCESS_SET_INFORMATION //设置某些信息的权限,如进程优先级 // PROCESS_SET_QUOTA //设置内存限制的权限,使用SetProcessWorkingSetSize // PROCESS_SUSPEND_RESUME //暂停或恢复进程的权限 // PROCESS_TERMINATE //终止一个进程的权限,使用TerminateProcess // PROCESS_VM_OPERATION //操作进程内存空间的权限(可用VirtualProtectEx和WriteProcessMemory) // PROCESS_VM_READ //读取进程内存空间的权限,可使用ReadProcessMemory // PROCESS_VM_WRITE //读取进程内存空间的权限,可使用WriteProcessMemory // SYNCHRONIZE //等待进程终止 // b.bInheritHandle:表示所得到的进程句柄是否可以被继承 // c.dwProcessId:被打开进程的PID // 3.返回类型 // // 如成功,返回值为指定进程的句柄。 // 如失败,返回值为NULL,可调用GetLastError()获得错误代码。 int CloseHandle(int handle);//关闭句柄表示对该内核对象不进行任何操作,传入句柄标识 boolean Module32First(int hSnapshot, MODULEENTRY32 lpme); // BOOL WINAPI Module32First(HANDLE hSnapshot,LPMODULEENTRY32 lpme); // 此函数检索与进程相关联的第一个模块的信息 // 参数hSnapshot调用CreateToolhelp32Snapshot函数返回的快照句柄 // lpme MODULEENTRY32结构的指针。用来返回数据 // 返回值 // 成功返回TRUE失败返回FALSE boolean Module32Next(int hSnapshot, MODULEENTRY32 lpme);//此函数检索与进程相关联的下一个模块的信息 int TerminateProcess(int processId,int a);//函数终止指定进程及其所有线程。 // BOOL TerminateProcess(HANDLE hProcess,UINT uExitCode); // HANDLE hProcess //进程句柄 // UINT uExitCode //进程终止码 // 返回值Long,非零表示成功,零表示失败。 int ReadProcessMemory(int hProcess, int lpBaseAddress, int[] lpBuffer, int nSize, int lpNumberOfBytesRead); // 函数原型为BOOL ReadProcessMemory(HANDLE hProcess, LPCVOID lpBaseAddress, LPVOID lpBuffer, DWORD nSize, LPDWORD lpNumberOfBytesRead); // hProcess [in]远程进程句柄。 被读取者 // pvAddressRemote [in]远程进程中内存地址。 从具体何处读取 // pvBufferLocal [out]本地进程中内存地址. 函数将读取的内容写入此处 // nSize [in]要传送的字节数。要写入多少 // pdwNumBytesRead [out]实际传送的字节数. 函数返回时报告实际写入多少 int WriteProcessMemory(int hProcess, int lpBaseAddress, int[] lpBuffer, int nSize, int lpNumberOfBytesRead); // 参数: // hProcess // 由OpenProcess返回的进程句柄。 // 如参数传数据为 INVALID_HANDLE_VALUE 【即-1】目标进程为自身进程 // lpBaseAddress // 要写的内存首地址 // 在写入之前,此函数将先检查目标地址是否可用,并能容纳待写入的数据。 // lpBuffer // 指向要写的数据的指针。 // nSize // 要写入的字节数。 // lpNumberOfBytesWritten,实际数据的长度 // 返回值 // 非零值代表成功。 // 可用GetLastError获取更多的错误详细信息。 int CreateToolhelp32Snapshot(int falg, int id);//为当前进程线程创建快照,第一个参数为标识 // HANDLE WINAPI CreateToolhelp32Snapshot(DWORD dwFlags, DWORD th32ProcessID ); //这个函数的意思是给想看的东西拍个照,然后慢慢的看(系统的进程或者线程的创建非常的迅速,所以只能拍个照片慢慢看,若是拍过照片之后,系统的进程,线程,堆栈等发生了变化,就不在考虑范围之内了,从这点来说,函数的名字还是挺贴合实际的) // dwFlags: // TH32CS_INHERIT :使用这个标志表示,这个快照句柄是可继承的 // // TH32CS_SNAPALL :表示使用了以下的全部标志,总共四个 // TH32CS_SNAPHEAPLIST, TH32CS_SNAPMODULE, TH32CS_SNAPPROCESS, and TH32CS_SNAPTHREAD. // TH32CS_SNAPHEAPLIST:表示快照信息包含特定进程的堆栈列表 // // TH32CS_SNAPMODULE :表示快照信息包含特定进程的使用模块的列表 // // TH32CS_SNAPPROCESS:表示快照信息包含系统的所有进程的列表 // // TH32CS_SNAPTHREAD :表示快照信息包含系统所有线程的列表 // Const TH32CS_SNAPHEAPLIST = &H1 // Const TH32CS_SNAPPROCESS = &H2 // Const TH32CS_SNAPTHREAD = &H4 // Const TH32CS_SNAPMODULE = &H8 // Const TH32CS_SNAPALL = (TH32CS_SNAPHEAPLIST | TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD | TH32CS_SNAPMODULE) // Const TH32CS_INHERIT = &H80000000 // th32ProcessID: // 只有当dwFlags信息中包含TH32CS_SNAPHEAPLIST,TH32CS_SNAPMODULE 时这个值才有效,否则,这个值会被忽略 // int Process32First(int h,PriClass p); // BOOL Process32First()函数 // 参数:HANDLE hSnapshot 传入的Snapshot句柄 // 参数:LPPROCESSENTRY32 lppe 指向PROCESSENTRY32结构的指针 // 作用:从Snapshot得到第一个进程记录信息 int Process32Next(int h,PriClass p); // BOOL Process32Next()函数 // 参数:HANDLE hSnapshot 传入的Snapshot句柄 // 参数:LPPROCESSENTRY32 lppe 指向PROCESSENTRY32结构的指针 // 作用:从Snapshot得到下一个进程记录信息 }
ca55896f75a0984bec374926aeda612326ffa88d
807c5f6c91fab10b91b09eab9772d90ae89ef21a
/src/main/java/ru/dabutskikh/questionnaires/controller/ServiceController.java
341027305a9029f16482bcd6194288eb8d2d0e54
[]
no_license
dabutskikh/questionnaires
4d05026fddc1820b04a13e2f60d5a742d53b4930
52f20b72c96176af5062d06595476a55225bcd7b
refs/heads/master
2023-02-05T03:25:50.078069
2020-12-21T05:44:50
2020-12-21T05:44:50
320,279,884
0
0
null
null
null
null
UTF-8
Java
false
false
3,628
java
package ru.dabutskikh.questionnaires.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; import ru.dabutskikh.questionnaires.model.*; import ru.dabutskikh.questionnaires.service.interfaces.QuestionnaireService; import ru.dabutskikh.questionnaires.service.interfaces.UserAnswerService; import ru.dabutskikh.questionnaires.service.interfaces.UserService; import java.util.List; import java.util.Set; import java.util.stream.Collectors; @Controller public class ServiceController { @Autowired UserService userService; @Autowired UserAnswerService userAnswerService; @Autowired QuestionnaireService questionnaireService; @GetMapping public String getCatalog() { return "redirect:/catalog"; } @GetMapping("/catalog") public String getAvailableQuestionnaires(@AuthenticationPrincipal UserDetails currentUser, Model model) { User user = userService.findByLogin(currentUser.getUsername()); model.addAttribute("isAdmin", user.getRole().equals(Role.ADMIN)); model.addAttribute("qustionnaires", questionnaireService.getAvailableQuestionnaires(user)); return "available_questionnaires"; } @GetMapping("/current") public String getCurrentQuestionnaires(@AuthenticationPrincipal UserDetails currentUser, Model model) { User user = userService.findByLogin(currentUser.getUsername()); model.addAttribute("isAdmin", user.getRole().equals(Role.ADMIN)); model.addAttribute("qustionnaires", questionnaireService.getCurrentQuestionnaires(user)); return "current_questionnaires"; } @GetMapping("/history") public String getCompletedQuestionnaires(@AuthenticationPrincipal UserDetails currentUser, Model model) { User user = userService.findByLogin(currentUser.getUsername()); model.addAttribute("isAdmin", user.getRole().equals(Role.ADMIN)); model.addAttribute("qustionnaires", questionnaireService.getCompletedQuestionnaires(user)); return "completed_questionnaires"; } @GetMapping("/watch") public String getCompletedQuestionnaire(@AuthenticationPrincipal UserDetails currentUser, @RequestParam("questionnaire_id") Long questionnaireId, Model model) { User user = userService.findByLogin(currentUser.getUsername()); Questionnaire questionnaire = questionnaireService.findById(questionnaireId); Set<Questionnaire> completedQuestionnaires = questionnaireService.getCompletedQuestionnaires(user); if (!completedQuestionnaires.contains(questionnaire)) { return "redirect:/history"; } Set<Answer> userAnswers = userAnswerService .getUserAnswersToQuestionnaire(user, questionnaire).stream() .map(userAnswer -> userAnswer.getUserAnswerId().getAnswer()) .collect(Collectors.toSet()); model.addAttribute("userAnswers", userAnswers); model.addAttribute("questionnaire", questionnaire); return "watch_completed_questionnaire"; } }
7bb2e8c141ea782ed87cbac32cb84b6f22c80ad6
fa1ce418494e1302c42c8930eb5ee60663e185ff
/Spring-jpa Projects/jpa_many_to_many/src/main/java/io/github/rura6502/jpa_many_to_many/domain/Person.java
497b8f7dcddb34413a39342cdf72a26d3ab942b4
[ "MIT" ]
permissive
rura6502/repo.rura6502.github.io
88ae65ef8f175182b4b7c2318bf7d5aa8caea2eb
40650c990f36d8155e59de1bb46903088b07bc24
refs/heads/master
2022-12-30T08:04:30.770820
2020-08-18T07:02:37
2020-08-18T07:02:37
188,647,610
0
0
NOASSERTION
2022-12-13T03:36:01
2019-05-26T06:21:22
Java
UTF-8
Java
false
false
914
java
package io.github.rura6502.jpa_many_to_many.domain; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToOne; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import lombok.NonNull; import lombok.RequiredArgsConstructor; @Data @NoArgsConstructor @AllArgsConstructor @RequiredArgsConstructor @Entity public class Person { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @NonNull private String name; @OneToOne(cascade = CascadeType.ALL , fetch = FetchType.EAGER) private Club mainClub; public Person(@NonNull String name, Club mainClub) { this.name = name; this.mainClub = mainClub; } }
106d338be78b75b3f15948307d81b5e4de28f156
518dacfadbca303c8393d019dc22f7d33321dd2a
/app/src/main/java/com/example/wasuradananjith/mediq/Welcome5.java
40446a7233b9d63d49ab882d082636b872f6ab3e
[]
no_license
wasuradananjith/MediQ3-Codefest
d2ed95b0421687d070c85a1f489835321f7ede2d
2ea9fcec3ade09e9ab7ca206e0c39ddbf1146b06
refs/heads/master
2021-03-19T17:49:40.730669
2017-09-21T06:57:34
2017-09-21T06:57:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,322
java
package com.example.wasuradananjith.mediq; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.ImageView; public class Welcome5 extends AppCompatActivity implements View.OnClickListener { private ImageView btnNext3,btnPrev3; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_welcome5); btnNext3 = (ImageView) findViewById(R.id.finish); btnPrev3 = (ImageView) findViewById(R.id.previous3); btnNext3.setOnClickListener(this); btnPrev3.setOnClickListener(this); } @Override public void onClick(View v) { switch ((v.getId())){ case R.id.finish: { startActivity(new Intent(Welcome5.this, First.class)); overridePendingTransition(R.anim.slide_in_left,R.anim.slide_out_right); finish(); break; } case R.id.previous3:{ startActivity(new Intent(Welcome5.this, Welcome4.class)); overridePendingTransition(R.anim.slide_in_right,R.anim.slide_out_left); finish(); break; } } } }
d578b5e4a0ad192a12dfe800bc742426ef68b5e3
72b9a43f8dff795ec50fe40aab4d9af4e77af0b1
/manifold-deps-parent/manifold-ext/src/main/java/manifold/ext/api/IBindingsBacked.java
f4f2f8299da0220a48a00676ae52db08c8aead68
[ "Apache-2.0" ]
permissive
fupfin/manifold
89bf71be210f160b553d40fdb9b943253390a2e9
81a1e504fa5f21fbc2eff119a619ee7db2b023fd
refs/heads/master
2020-04-21T11:41:40.625871
2019-02-07T07:32:49
2019-02-07T07:32:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,132
java
/* * Copyright (c) 2018 - Manifold Systems LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package manifold.ext.api; import javax.script.Bindings; /** * A {@link Structural} interface with only getter/setter methods can extend this interface and provide default * implementations of its methods and provide a static {@code proxy(Bindings)} method to avoid runtime proxy generation. * See the {@code JsonStructureType}. */ public interface IBindingsBacked { /** * The {@link Bindings} object used to store name/value pairs corresponding with gettter/setter methods. */ Bindings getBindings(); }
5a17112bbed8e45bd3c07bf5244decd1c88677e4
46946342fed948e9f65e22328d14c8f13b857ae1
/mapsdk/src/main/java/com/unistrong/api/mapcore/IPolygonDelegate.java
878504e71bd88337973bc4c9c4b9cb1ac7e2e806
[]
no_license
UersNOer/AllInLinkApp
a1805816198d12e9d491c8f8af1a58fcc091c4ff
1a75da52e53921060a934bdb653d29708cb1d87d
refs/heads/master
2023-07-09T22:48:05.180754
2021-08-13T06:59:17
2021-08-13T06:59:17
394,186,337
2
0
null
2021-08-13T06:59:18
2021-08-09T07:04:41
Java
UTF-8
Java
false
false
918
java
package com.unistrong.api.mapcore; import android.os.RemoteException; import com.unistrong.api.maps.model.LatLng; import java.util.List; public abstract interface IPolygonDelegate extends IOverlayDelegateDecode { public abstract void setStrokeWidth(float paramFloat) throws RemoteException; public abstract float getStrokeWidth() throws RemoteException; public abstract void setFillColor(int paramInt) throws RemoteException; public abstract int getFillColor() throws RemoteException; public abstract void setStrokeColor(int paramInt) throws RemoteException; public abstract void a(List<LatLng> paramList) throws RemoteException; public abstract List<LatLng> getPoints() throws RemoteException; public abstract int getStrokeColor() throws RemoteException; public abstract boolean contains(LatLng paramLatLng) throws RemoteException; }
677773d4194a42c25ca2802646282b4d0b5a8bfb
ee4a62e97e24b8700cfb206ca2c21dba8da8fcd1
/JavaTutorials/src/com/lao/javaLearning/ChildClass.java
d8e448dc7f5b792fa766fb94b1b86a693fe2909a
[]
no_license
naveenraj1211/JavaTutorials
7a429617f1eba97bdef4bfd5717ae6dafab519b5
439a533da607a1e57821dc80aa2b1b11e242702d
refs/heads/master
2023-02-20T13:02:05.948234
2021-01-24T18:25:10
2021-01-24T18:25:10
332,523,004
0
0
null
null
null
null
UTF-8
Java
false
false
315
java
package com.lao.javaLearning; public class ChildClass extends ParentClass { public ChildClass() { super(); System.out.println("This is child class non parameterised constructor "); } public static void main(String[] args) { ChildClass childClass = new ChildClass(); } }
a37b4f845120bea1d5d01c50cc7ea34a99edf0a8
d908f0210144063873d6d42a7b3cbf067159d708
/src/main/java/com/sherman/covid19/reservationtool/managers/CustomNurseVaccinationCentreTimeslotRepository.java
52b92f678971cd5735d496ff01d3100349d86ec7
[]
no_license
rotarycut/covidreservations
4836d2b5aa90623672123735528340726f444899
4a782278da1a0c86deac5b508c05ad75ebf27046
refs/heads/main
2023-07-16T17:27:52.223719
2021-08-23T14:04:43
2021-08-23T14:04:43
398,230,820
0
0
null
null
null
null
UTF-8
Java
false
false
599
java
package com.sherman.covid19.reservationtool.managers; import com.sherman.covid19.reservationtool.models.NurseVaccinationCentreTimeslot; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.TypedQuery; import java.util.List; public interface CustomNurseVaccinationCentreTimeslotRepository { List<NurseVaccinationCentreTimeslot> findTimeslotsNurseSlotVacCtr(String slotTime, String vacCtrName); }
706debf93d0de01149672874d9302376d1ae532f
93c0f53aa54e9bcba57521749babf564e778abd9
/code/leetcode/QuickSort/src/Solution.java
93da344de109b3df1fc5c8d243211927d3b8a6a8
[]
no_license
ogugugugugua/Java-Notes
095015f5c238abd8a5a81e801c8e9284a1fe0994
719a912aecf3a6c194ed4b5697859b69233f0902
refs/heads/master
2022-12-27T20:05:42.298141
2021-02-13T11:08:57
2021-02-13T11:08:57
219,140,414
1
0
null
2022-12-16T15:48:44
2019-11-02T10:52:13
Java
UTF-8
Java
false
false
1,135
java
import java.util.Arrays; public class Solution { public static void sort(int a[], int low, int high){ int i, j, index; if (low > high) { return; } i = low; j = high; index = a[i]; // 用子表的第一个记录做基准 while (i < j) { // 从表的两端交替向中间扫描 while (i < j && a[j] >= index) j--; if (i < j) a[i++] = a[j];// 用比基准小的记录替换低位记录 while (i < j && a[i] < index) i++; if (i < j) // 用比基准大的记录替换高位记录 a[j--] = a[i]; } a[i] = index;// 将基准数值替换回 a[i] sort(a, low, i - 1); // 对低子表进行递归排序 sort(a, i + 1, high); // 对高子表进行递归排序 } public static void quickSort(int a[]) { sort(a, 0, a.length - 1); } public static void main(String[] args) { int a[] = { 49, 38, 65, 97, 76, 13, 27, 49 }; quickSort(a); System.out.println(Arrays.toString(a)); } }
f3b6a00f88973049f04eea0317a85b1ca46dc336
a27ab3aba79dd45649bd6f0b35397b61ca356179
/src/main/java/store/exception/ApplicationException.java
57518ab7e46ee7b8838c7eb404bfb7c513c73e29
[]
no_license
Reshkas/InternetShop
0f20e48cd21d35e3a966804bcdf3be68fdae75bc
cb5f98051cd64a60a9c39dd55ea0b6d5a842e23e
refs/heads/master
2021-08-23T06:46:47.235382
2017-12-04T00:27:49
2017-12-04T00:27:49
107,485,973
0
0
null
null
null
null
UTF-8
Java
false
false
266
java
package store.exception; public class ApplicationException extends Exception { public ApplicationException(String message){ super(message); } public ApplicationException(String message, Throwable cause){ super(message, cause); } }
0edcd749346cc491cb26947a51ac5d2194aeac17
b2231604178a5b2abe987b8802d2a210266018d8
/SentimentAnalysisV3/encog-core-3.1.0/src/test/java/org/encog/persist/TestPersistPopulationNPE.java
8dd230077e0700b6228e4b1759fc8503461ffa36
[ "BSD-3-Clause", "Apache-2.0" ]
permissive
palchrnj/sentiment-prosjekt-v4
5305717de68e01e9a4960f29f09fb47821f39f9b
e7e4779ecda4e244340f8e26d9b3eb340d2196ed
refs/heads/master
2021-01-01T17:16:10.866963
2014-05-27T11:15:32
2014-05-27T11:15:32
17,907,541
0
1
null
null
null
null
UTF-8
Java
false
false
3,651
java
package org.encog.persist; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import junit.framework.Assert; import junit.framework.TestCase; import org.encog.ml.data.basic.BasicMLDataSet; import org.encog.ml.genetic.population.Population; import org.encog.neural.neat.NEATPopulation; import org.encog.neural.neat.PersistNEATPopulation; import org.encog.neural.neat.training.NEATTraining; import org.encog.neural.networks.training.CalculateScore; import org.encog.neural.networks.training.TrainingSetScore; import org.encog.util.file.FileUtil; public final class TestPersistPopulationNPE extends TestCase { private static double FAKE_DATA[][] = { { 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0 } }; public void testNPE() throws Exception { final CalculateScore score = new TrainingSetScore(new BasicMLDataSet(FAKE_DATA, FAKE_DATA)); // create a new random population and train it final NEATTraining training1 = new NEATTraining(score, new NEATPopulation(FAKE_DATA[0].length, 1, 5000)); training1.iteration(); // enough training for now, backup current population to continue later final ByteArrayOutputStream serialized1 = new ByteArrayOutputStream(); new PersistNEATPopulation().save(serialized1, training1.getPopulation()); // reload initial backup and continue training final NEATTraining training2 = new NEATTraining( score, (Population)new PersistNEATPopulation().read(new ByteArrayInputStream(serialized1.toByteArray()))); training2.iteration(); // enough training, backup the reloaded population to continue later final ByteArrayOutputStream serialized2 = new ByteArrayOutputStream(); new PersistNEATPopulation().save(serialized2, training2.getPopulation()); // NEATTraining.init() randomly fails with a NPE in NEATGenome.getCompatibilityScore() final NEATTraining training3 = new NEATTraining( score, (Population)new PersistNEATPopulation().read(new ByteArrayInputStream(serialized2.toByteArray()))); training3.iteration(); final ByteArrayOutputStream serialized3 = new ByteArrayOutputStream(); new PersistNEATPopulation().save(serialized3, training3.getPopulation()); } public void testSaveRead() throws Exception { final CalculateScore score = new TrainingSetScore(new BasicMLDataSet(FAKE_DATA, FAKE_DATA)); // create a new random population and train it final NEATTraining training1 = new NEATTraining(score, new NEATPopulation(FAKE_DATA[0].length, 1, 5000)); training1.iteration(); // enough training for now, backup current population final ByteArrayOutputStream serialized1 = new ByteArrayOutputStream(); new PersistNEATPopulation().save(serialized1, training1.getPopulation()); final Population population2 = (Population)new PersistNEATPopulation().read(new ByteArrayInputStream( serialized1.toByteArray())); final ByteArrayOutputStream serialized2 = new ByteArrayOutputStream(); new PersistNEATPopulation().save(serialized2, population2); Assert.assertEquals(serialized1.toString("UTF-8"), serialized2.toString("UTF-8")); // ok, populations seems identical /*final NEATTraining trainingFromPersist = new NEATTraining(score, population2); final ByteArrayOutputStream serialized3 = new ByteArrayOutputStream(); new PersistNEATPopulation().save(serialized3, trainingFromPersist.getPopulation()); FileUtil.writeFileAsString(new File("e:\\test1.txt"),serialized1.toString("UTF-8")); FileUtil.writeFileAsString(new File("e:\\test2.txt"),serialized3.toString("UTF-8")); Assert.assertEquals(serialized1.toString("UTF-8"), serialized3.toString("UTF-8")); // population changed ? is this ok ? */ } }
3190844e62e7818b2d83f8c3aa2b81a27a6e1856
3dbdfb4a9e16ed9c63d2ebb5a691824b7bed466b
/SharedCode/src/test/java/com/github/pmtischler/control/MecanumTest.java
2b1cbb0778236ffa7788b67892dcd04485b22265
[ "BSD-3-Clause" ]
permissive
tobortechftc/pmtischler
f1d13436009efa4639b4e16b8628913dec13650d
cc16994c0679320c7dfd6c89d43bb9f0475e0efc
refs/heads/master
2021-01-20T12:58:06.494135
2016-12-27T12:45:40
2016-12-27T12:45:40
90,433,891
1
1
null
null
null
null
UTF-8
Java
false
false
2,283
java
package com.github.pmtischler.control; import static org.junit.Assert.assertEquals; import org.junit.Test; /** * Tests correctness of Mecanum calculations. */ public class MecanumTest { // The comparison threshold. private static final double diffThresh = 0.001; /** * Asserts that the input controls yields the expected output controls. */ private void assertMecanum(double vD, double thetaD, double vTheta, double frontLeft, double frontRight, double backLeft, double backRight) { Mecanum.Wheels wheels = Mecanum.motionToWheels(vD, thetaD, vTheta); assertEquals(frontLeft, wheels.frontLeft, diffThresh); assertEquals(frontRight, wheels.frontRight, diffThresh); assertEquals(backLeft, wheels.backLeft, diffThresh); assertEquals(backRight, wheels.backRight, diffThresh); } @Test // Test Mecanum for direct strafing. public void testMecanumStrafing() throws Exception { // Forward. assertMecanum(1, 0, 0, 0.7071, 0.7071, 0.7071, 0.7071); // Right. assertMecanum(1, Math.PI / 2, 0, 0.7071, -0.7071, -0.7071, 0.7071); // Back. assertMecanum(1, Math.PI, 0, -0.7071, -0.7071, -0.7071, -0.7071); // Left. assertMecanum(1, 3 * Math.PI / 2, 0, -0.7071, 0.7071, 0.7071, -0.7071); // Front right. assertMecanum(1, Math.PI / 4, 0, 1, 0, 0, 1); } @Test // Test Mecanum for turning. public void testMecanumTurning() throws Exception { // Right. assertMecanum(0, 0, 1, 1, -1, 1, -1); // Left. assertMecanum(0, 0, -1, -1, 1, -1, 1); } @Test // Test Mecanum for moving and turning to clamp motors. public void testMecanumClamping() throws Exception { // Forward and full right. assertMecanum(1, 0, 1, 1, -0.1716, 1, -0.1716); } }
02c34061e7c67740775e6f9178ba9d352dbfc99f
5cd28759dc0627f45a13e791406984c300942aaa
/https:/github.com/oscarodriguez094/angular-spring-RESTFUL/oscar-curriculum/src/main/java/com/curriculum/controllers/UserController.java
b5879787c3f1efd4f6d9b77808a67f1e7f32ad3b
[]
no_license
oscarodriguez094/angular-spring-RESTFUL
66b1dbc609a336ac7925ca8b988777b18b4f2e8d
ee6a02b1ded01b5d84c32c21f178b5a9c52b5344
refs/heads/master
2021-07-24T04:14:47.123040
2017-11-04T00:39:09
2017-11-04T00:39:09
109,453,520
0
0
null
null
null
null
UTF-8
Java
false
false
2,583
java
package com.curriculum.controllers; import java.io.IOException; import java.util.List; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import com.curriculum.model.User; import com.curriculum.service.UserService; import com.curriculum.util.RestResponse; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; @RestController public class UserController { @Autowired protected UserService userService; protected ObjectMapper mapper; @RequestMapping(value = "/saveOrUpdate", method = RequestMethod.POST) public RestResponse saveOrUpdate(@RequestBody String userJson) throws JsonParseException, JsonMappingException, IOException { this.mapper = new ObjectMapper(); User user = this.mapper.readValue(userJson, User.class); if (!this.validate(user)) { return new RestResponse(HttpStatus.NOT_ACCEPTABLE.value(), "Los campos obligatorios no estan rellenados"); } this.userService.save(user); return new RestResponse(HttpStatus.OK.value(), "Operacion realizada con éxito"); } @RequestMapping(value = "/getUsers", method = RequestMethod.GET) public List<User> getUsers() { return this.userService.findAll(); } @RequestMapping(value = "/deleteUser", method = RequestMethod.POST) public void deleteUser(@RequestBody String userJson) throws Exception { this.mapper = new ObjectMapper(); User user = this.mapper.readValue(userJson, User.class); if(user.getId() == null ) throw new Exception("El usuario no existe "); this.userService.deleteUser(user.getId()); } @RequestMapping(value = "/getUser/{userId}", method = RequestMethod.GET) public User getUser(@PathVariable Long userId) { return this.userService.findById(userId); } private boolean validate(User user) { boolean isValid = true; if (StringUtils.trimToNull(user.getFirstName()) == null) { isValid = false; } if (StringUtils.trimToNull(user.getFirstSurname()) == null) { isValid = false; } if (StringUtils.trimToNull(user.getAddress()) == null) { isValid = false; } return isValid; } }
a79c469a283746c881321778bbfa292348970ab2
6b7eb5413cd7a6bf9020a46afea64ee6a8181c68
/November/Test/NewBeSuper/beSuperDao/BeSuperConsole.java
6573dcff62fde81267235fffb5aaf8fda08bb187
[]
no_license
chaosV/core-java
7a6b82ae3851a4b3b22fbd30d3918e4c9310b657
296a483e5abc71fdfb369d35e87b754a589914e4
refs/heads/master
2021-01-12T07:49:58.483196
2016-12-23T02:41:39
2016-12-23T02:41:39
76,920,898
0
0
null
null
null
null
GB18030
Java
false
false
1,045
java
package beSuperDao; import java.io.InputStream; import java.util.Scanner; public class BeSuperConsole{ private BeSuperConsole(){ } public static String NEW_LINE="\n"; private static Scanner sc; static{ sc=new Scanner(System.in); } private BeSuperConsole(InputStream is){ sc=new Scanner(is); } public static void println(String str){ System.out.println(str); } public static void println(Object obj){ System.out.println(obj); } public static String askUserInput(String prompt){ String input=null; while(true){ System.out.print(prompt+">"); input=sc.nextLine(); if(!input.trim().equals("")){ break; } println("请输入一个非空命令!"); } return input; } public static int askUserInputInt(String prompt){ int result= -1; while(true){ String out=askUserInput(prompt); try{ result=Integer.parseInt(out); }catch(Exception e){ println("请输入合法的命令!"); } if(result != -1){ break; } } return result; } }
61e2fc0127aed3d175dca1afeb2e06817dafe1fc
4ce4b4a2631e6760c50b8957a59cfa8980f77551
/arrays/MedianOfTwoSortedArrays.java
89f8a48c88170265035edeb660b57d9370d5f81a
[ "MIT" ]
permissive
ivanmmarkovic/Code-problems
804d1c33326f480625e784880fd25320f46936b0
2c7cb9d5f2aaa2bb9eb3a0359bf71df16cdbc901
refs/heads/master
2023-08-17T06:09:24.388012
2023-08-10T09:04:59
2023-08-10T09:04:59
170,051,837
3
1
null
null
null
null
UTF-8
Java
false
false
1,246
java
/* https://leetcode.com/problems/median-of-two-sorted-arrays/submissions/ ################ 100% 4. Median of Two Sorted Arrays Hard There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). You may assume nums1 and nums2 cannot be both empty. Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] The median is (2 + 3)/2 = 2.5 Accepted 576,133 Submissions 2,047,644 */ class MedianOfTwoSortedArrays { public double findMedianSortedArrays(int[] nums1, int[] nums2) { int total[] = new int[nums1.length + nums2.length]; int i = 0, j = 0, k = 0; while(i < nums1.length && j < nums2.length){ if(nums1[i] <= nums2[j]) total[k++] = nums1[i++]; else total[k++] = nums2[j++]; } while(i < nums1.length){ total[k++] = nums1[i++]; } while(j < nums2.length){ total[k++] = nums2[j++]; } return total.length % 2 != 0 ? total[total.length / 2] : (total[total.length / 2 - 1] + total[total.length / 2]) / 2.0; } }
943feca8c2304ea885a6e9b6750f050ff9b8dbef
ba3878b3702fb23f00044ce665cba10f0a812217
/src/test/java/com/nano/integ/product/demo/ProductApplicationTests.java
ca292e50d8aba6da39fcfc586fc93e8a3f56c8c5
[]
no_license
khurramhanif/nano-integ-spring-angular-product
bc21c8e46aca84f32d5c61b74b9de0002105d283
a22f86eef2170ced7a91db4e30edec42c65218f8
refs/heads/master
2023-02-03T14:37:20.680971
2019-09-23T04:00:28
2019-09-23T04:00:28
210,218,192
0
0
null
2023-01-07T09:58:56
2019-09-22T21:43:10
TypeScript
UTF-8
Java
false
false
345
java
package com.nano.integ.product.demo; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class ProductApplicationTests { @Test public void contextLoads() { } }
e1e61275c7e6332d0ecd2e8a21c57114e05f00d6
c7584a69bb7ded146fb7888b52b6fde42a494331
/app/src/main/java/cn/edu/nju/flowerstory/fragment/FlowerFragment.java
b466128b224ac6e60b2cce7700913938cb83eafe
[]
no_license
challvy/FlowerStory
0133ed5cd3738f165a82b02ef1dfcc3188352555
d68e9262f70ddeceba0f130ad6834290ddaf8fa9
refs/heads/master
2021-06-30T16:04:35.645224
2018-12-14T15:33:50
2018-12-14T15:33:50
125,897,384
1
0
null
null
null
null
UTF-8
Java
false
false
1,513
java
package cn.edu.nju.flowerstory.fragment; import android.support.annotation.NonNull; import android.support.v4.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import cn.edu.nju.flowerstory.R; import cn.edu.nju.flowerstory.utils.FloatWindowUtil; /** * * Created by Administrator on 2018/3/22 0022. */ public class FlowerFragment extends Fragment { FloatWindowUtil mFloatWindowUtil; public void hideFloatWindow(){ mFloatWindowUtil.hideContactView(); } public void showFloatWindow(){ mFloatWindowUtil.showContactView(); } @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); } @Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_flower, container, false); mFloatWindowUtil = new FloatWindowUtil(getContext(), this, getActivity()); // 默认显示 mFloatWindowUtil.showContactView(); return view; } @Override public void setUserVisibleHint(boolean isVisibleToUser) { super.setUserVisibleHint(isVisibleToUser); if(mFloatWindowUtil ==null) { return; } if(isVisibleToUser) { mFloatWindowUtil.showContactView(); } else { mFloatWindowUtil.hideContactView(); } } }
8b41d29455c038f05e5fab1487851a0d712d40b9
02ee90eda26cbcdc6a7bc1ce7e2d054af858498b
/CalculadoraWeb/src/java/Controlador/CalculadoraControl.java
65c0794bd333e89783ed9ed4bc1d443d8cc8c498
[]
no_license
JosueCuba/CalculadoraWeb
5547c301b6279ea3706bfb071d29dc4c4a6cc84a
96fcc8f5bfb1a221dc6317af873554e21d6a0b79
refs/heads/master
2020-04-28T16:49:40.859653
2019-03-13T14:20:29
2019-03-13T14:20:29
175,425,456
0
0
null
null
null
null
UTF-8
Java
false
false
1,607
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 Controlador; import javax.inject.Named; import javax.enterprise.context.SessionScoped; import java.io.Serializable; import servicio.CalculadoraService; /** * * @author PC */ @Named(value = "calculaControl") @SessionScoped public class CalculadoraControl implements Serializable { private int nro1, nro2; private String resultado = ""; private char operador; public void calcular() { resultado = CalculadoraService.respuesta(nro1, nro2, operador); } public void limpiar() { setNro1(10); setNro2(10); setResultado(""); setOperador('0'); } public int getNro1() { return nro1; } public void setNro1(int nro1) { this.nro1 = nro1; } public int getNro2() { return nro2; } public void setNro2(int nro2) { this.nro2 = nro2; } public String getResultado() { return resultado; } public void setResultado(String resultado) { this.resultado = resultado; } public char getOperador() { return operador; } public void setOperador(char operador) { this.operador = operador; } /** * Creates a new instance of CalculadoraControl */ public CalculadoraControl() { } }
[ "JosueCuba" ]
JosueCuba
ffe846ff27d419acbb9ff35561cacbbcb7afc0cc
fcdc57ab70a3aba2b0627c97751452b6d7e2b11d
/SpringWeb/MVN/Ecomm/src/main/java/com/mart/user/dao/IUser.java
19fe184846f52c849b093829052bf390a2634bb1
[]
no_license
bharat72007/didactic-dollop
db86e4b8bcb24f11cd1aff67d949452bec4becf9
5c3571c4114e9c79db0fdd1ab6a88695bdc28eea
refs/heads/master
2021-01-17T19:01:06.735773
2016-07-20T16:18:53
2016-07-20T16:18:53
63,795,527
0
0
null
null
null
null
UTF-8
Java
false
false
126
java
package com.mart.user.dao; import com.mart.user.entity.User; public interface IUser extends InterfaceDao<User,Integer>{ }
c90845e2e142b4705e06f3eb7461677fd0f4dd54
d24a31b0549a90d1efee14a1d6dda9d4ad7e2ad2
/Calendar/src/FinalCalendar1/SaveMemo.java
9a957030670671e112b4239c0ba4bfc6d6407455
[]
no_license
hhi0128/Calendar
5c91d9f3d7893c3d62906456a148b045d0a60139
76fdc9d96f2833dcc2dda8852d755195adf50138
refs/heads/master
2021-09-09T16:02:08.875495
2018-03-17T16:33:51
2018-03-17T16:33:51
125,634,616
0
0
null
null
null
null
UHC
Java
false
false
486
java
package FinalCalendar1; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; //메모저장 클래스 class SaveMemo implements ActionListener { public void actionPerformed(ActionEvent e) { JButton b = (JButton) e.getSource(); if (b.getText().equals("Save")) { CalendarMemo.memo.getText(); new FileWriterTest(); //파일 쓰기 클래스 } } }
[ "user@DESKTOP-3676PQ4" ]
user@DESKTOP-3676PQ4
a86559e03dd67b1c467a872012131fa3dd1768cf
1e6f471ace15aaab9ee9f4f904efa2b258f39e3b
/app/src/main/java/com/tqnam/filemanager/utils/OperationManager.java
3fddbf6904602525108c7d6be2e0178bebc8ba53
[ "MIT" ]
permissive
namtq1990/FileManager
5663e2cacea721d61128c6ddb42818c6c41c7f7a
0b655cbd02db8b0c76245a3597825df40e7b8ffe
refs/heads/master
2021-01-17T02:56:15.357659
2017-03-30T05:31:35
2017-03-30T05:31:35
26,473,492
0
0
null
null
null
null
UTF-8
Java
false
false
4,291
java
/* * MIT License * * Copyright (c) 2017 Tran Quang Nam * * 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.tqnam.filemanager.utils; import com.tqnam.filemanager.explorer.fileExplorer.FileItem; import com.tqnam.filemanager.model.eventbus.OperationAddedEvent; import com.tqnam.filemanager.model.operation.CopyFileOperation; import com.tqnam.filemanager.model.operation.Operation; import org.greenrobot.eventbus.EventBus; import java.util.ArrayList; import java.util.List; import rx.Observable; import rx.Subscriber; /** * Created by quangnam on 11/17/16. * Project FileManager-master */ public class OperationManager { public static final int CATEGORY_COPY = 0; public static final int CATEGORY_MOVE = 1; public static final int CATEGORY_DELETE = 2; public static final int CATEGORY_OTHER = 10; public static final int[] CATEGORIES = { CATEGORY_COPY, CATEGORY_MOVE, CATEGORY_DELETE, CATEGORY_OTHER }; // private ArrayList<Operation> mPrepareList; private static OperationManager mInstance; private ArrayList<Operation> mCopyOperation; private ArrayList<Operation> mDeleteOperation; private ArrayList<Operation> mMoveOperation; private ArrayList<Operation> mOtherList; private OperationManager() { // mPrepareList = new ArrayList<>(); mCopyOperation = new ArrayList<>(); mDeleteOperation = new ArrayList<>(); mMoveOperation = new ArrayList<>(); mOtherList = new ArrayList<>(); } public static OperationManager getInstance() { if (mInstance == null) mInstance = new OperationManager(); return mInstance; } public static CopyFileOperation makeCopy(List<FileItem> data, String path) { return new CopyFileOperation(data, path); } public ArrayList<Operation> getOperatorList(int category) { switch (category) { case CATEGORY_COPY: return mCopyOperation; case CATEGORY_DELETE: return mDeleteOperation; case CATEGORY_MOVE: return mMoveOperation; default: return mOtherList; } } /** * Add operation to Manager and will be started * */ public void addOperator(Operation<?> operation, int category) { // mPrepareList.remove(operation); ArrayList<Operation> list = getOperatorList(category); list.add(operation); Observable<?> observable = operation.execute(); observable .subscribe(new Subscriber<Object>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { // So don't handle here } @Override public void onNext(Object o) { } }); OperationAddedEvent event = new OperationAddedEvent(category, list.size() - 1); EventBus.getDefault().post(event); } // public void addPrepareList(Operation operator) { // mPrepareList.add(operator); // } }
2a82147a3b7cf20cf2e2057224da8597ace4b18b
3c7c6696b366ab04bd3bf7e5be72c73890ffbda1
/app/src/main/java/com/opendata/yu_hsienchou/taiwanair/MainActivity.java
3afbb791a5e975315c00cf21e24880ad8cf0e6af
[]
no_license
slps970093/TaiwanAir
b02689a571d7f381a6e748adf6bc39b59c64f244
1af6c1aa56593726511abd28287a7c1dee33d93d
refs/heads/master
2020-04-04T16:54:56.175459
2018-11-26T15:32:51
2018-11-26T15:32:51
156,098,863
0
0
null
null
null
null
UTF-8
Java
false
false
7,907
java
package com.opendata.yu_hsienchou.taiwanair; import android.Manifest; import android.content.Context; import android.content.DialogInterface; import android.content.pm.PackageManager; import android.database.Cursor; import android.databinding.DataBindingUtil; import android.location.Location; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.support.annotation.NonNull; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.widget.Toast; import com.google.android.gms.location.FusedLocationProviderClient; import com.google.android.gms.location.LocationCallback; import com.google.android.gms.location.LocationRequest; import com.google.android.gms.location.LocationServices; import com.google.android.gms.tasks.OnSuccessListener; import com.opendata.yu_hsienchou.taiwanair.Model.DashBoardModel; import com.opendata.yu_hsienchou.taiwanair.viewModel.DashBoardViewModel; import com.opendata.yu_hsienchou.taiwanair.databinding.ActivityMainBinding; import java.util.ArrayList; import permissions.dispatcher.NeedsPermission; import permissions.dispatcher.OnNeverAskAgain; import permissions.dispatcher.OnPermissionDenied; import permissions.dispatcher.OnShowRationale; import permissions.dispatcher.PermissionRequest; import permissions.dispatcher.RuntimePermissions; @RuntimePermissions public class MainActivity extends AppCompatActivity { private LocationRequest locationRequest; private LocationCallback locationCallback; private Location currentLocation; private FusedLocationProviderClient fusedLocationProviderClient; private AirSQLiteModel airSQLiteModel; private double gps_lat,gps_log; private ActivityMainBinding activityMainBinding; private DashBoardViewModel dashBoardViewModel; private ArrayList<AirDataModel> airModel; private AirSuggestHelper airSuggestHelper; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); airSQLiteModel = new AirSQLiteModel(this); MainActivityPermissionsDispatcher.GPSLocationWithPermissionCheck(this); fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(this); activityMainBinding = DataBindingUtil.setContentView(this,R.layout.activity_main); dashBoardViewModel = new DashBoardViewModel( new DashBoardModel("GPS 訊號接收中,請稍後... ",0.0,"")); activityMainBinding.setAirData(dashBoardViewModel); airSuggestHelper = new AirSuggestHelper(); try{ // 取得空氣資料 airModel = (ArrayList<AirDataModel>) new AirBoxAsyncTask().execute().get(); // @todo 教學影片: https://www.youtube.com/watch?v=H18P38wn8Z4&fbclid=IwAR2jSKNinkv6Igd1fZQuMK2DfCUO5xJfYtB-HLNogiV2wGZpyejp5EEK1Kg setLocationRequest(); getLocationInfo(); }catch (Exception e){ e.printStackTrace(); } } /** * 檢查網路連線狀態 * @see http://dean-android.blogspot.com/2013/08/android-connectivity-network-active.html * @return boolean */ public boolean getConnectStatus(){ ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); if (networkInfo != null){ return networkInfo.isConnected(); } return false; } /** * 在前端顯示資料 */ public void showAirInfo(){ if( getConnectStatus() ){ try{ airModel = (ArrayList<AirDataModel>) new AirBoxAsyncTask().execute().get(); }catch (Exception e){ e.printStackTrace(); } } if( gps_lat != 0.0 && gps_log != 0.0 ){ airSQLiteModel.insert_clean_all(airModel,gps_lat,gps_log); Cursor cursor = airSQLiteModel.getAdjacent(); if ( cursor.moveToFirst() != false ){ dashBoardViewModel.setLocationName(cursor.getString(cursor.getColumnIndex("name"))); dashBoardViewModel.setPm25Value(cursor.getDouble(cursor.getColumnIndex("pm25"))); dashBoardViewModel.setCategory(airSuggestHelper.getCategory( cursor.getDouble(cursor.getColumnIndex("pm25")) )); Log.e("device_id :",cursor.getString(cursor.getColumnIndex("device_id"))); } }else{ dashBoardViewModel.setLocationName("取得GPS訊號中 請稍後"); } activityMainBinding.setAirData(dashBoardViewModel); } /** * 取得GPS資訊 */ private void getLocationInfo(){ if(ActivityCompat.checkSelfPermission(this,Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED ) { fusedLocationProviderClient.getLastLocation().addOnSuccessListener(this, new OnSuccessListener<Location>() { @Override public void onSuccess(Location location) { if( location != null ){ gps_lat = location.getLatitude(); gps_log = location.getLongitude(); showAirInfo(); Toast.makeText(MainActivity.this,"Lat: "+location.getLatitude()+" Log: "+location.getLongitude(),Toast.LENGTH_LONG).show(); } } }); } } @NeedsPermission({Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}) void GPSLocation() { } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); MainActivityPermissionsDispatcher.onRequestPermissionsResult(this, requestCode, grantResults); } @OnShowRationale({Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}) void onGPSShowRationale(final PermissionRequest request) { new AlertDialog.Builder(MainActivity.this) .setMessage("你必須允許 "+getString(R.string.app_name)+"定位權限,否則無法正常運作,是否重新設定權限?") .setPositiveButton("是", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { request.proceed(); } }) .setNegativeButton("否", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { request.cancel(); } }) .create() .show(); } @OnPermissionDenied({Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}) void onGPSPermissionDenied() { Toast.makeText(this,"Permisson Denied",Toast.LENGTH_LONG).show(); } @OnNeverAskAgain({Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}) void onGPSNeverAskAgain() { } /** * 設定 LocationRequest */ private void setLocationRequest(){ locationRequest = new LocationRequest() .setInterval(1000) // 設定讀取位置資訊的間隔時間為一秒(1000ms) .setFastestInterval(1000) // 設定讀取位置資訊最快的間隔時間為一秒(1000ms) .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY) ; // 設定優先讀取高精確度的位置資訊(GPS) } }
4491161c077eded8ddbde966e906f9fccf594b58
7c679d8bfc4e89890101a6e818616de0357a7113
/src/main/java/jpabook/jpashop/controller/MemberForm.java
a5ea20eb4dfaad338d1fd69d59bf66f02a0f4a75
[]
no_license
BryceYangS/jpashop
24703b8a7cd06c51a6ba0df35a2a3524f448249f
7c39116fcdfd06a5c17ac7387f57be635a042970
refs/heads/main
2023-09-01T06:34:04.285891
2021-10-26T14:37:50
2021-10-26T14:37:50
368,186,918
0
0
null
null
null
null
UTF-8
Java
false
false
328
java
package jpabook.jpashop.controller; import javax.validation.constraints.NotEmpty; import lombok.Getter; import lombok.Setter; @Getter @Setter public class MemberForm { @NotEmpty(message = "회원 이름은 필수 입니다.") private String name; private String city; private String street; private String zipcode; }
89977b86a2ec9f1bf61abde02fff77d4c5d13f9b
983cb7b41983f1f91371ad3cd6b48c78f87d7349
/src/com/codepuran/repository/RoleRepository.java
a38aa269b80dd87a9d07eb47aad322b43db46534
[]
no_license
pethaniakshay/SpringMVC-JPA-Hibernate-MYSQL
8ccaa568e50e3732cbde5f8020a45e6da0a47dbc
bb8650f17f79d033ab47936c952acf48288f0e27
refs/heads/master
2021-05-14T00:46:58.875777
2018-01-07T07:44:53
2018-01-07T07:44:53
116,547,005
1
1
null
null
null
null
UTF-8
Java
false
false
200
java
package com.codepuran.repository; import org.springframework.data.jpa.repository.JpaRepository; import com.codepuran.model.Role; public interface RoleRepository extends JpaRepository<Role, Long>{ }
3ec47b122842a990d80c8d31be44d6f3b435f7ba
93c5574c0e786bb600ecdf5782e31331905516ef
/src/main/java/com/example/bddspring1584725047/DemoApplication.java
b6d5dc4395c4b9c8d9c2fdb7949d3b2e00aae0b1
[]
no_license
cb-kubecd/bdd-spring-1584725047
99b144776084a5f066ab27a5213ac537ca1e5d40
6761281dd7f28c13c1392230d35dc69c376a370e
refs/heads/master
2021-04-08T22:04:58.968974
2020-03-20T17:24:33
2020-03-20T17:24:33
248,813,648
0
0
null
null
null
null
UTF-8
Java
false
false
320
java
package com.example.bddspring1584725047; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } }
8bdbe73402418958400f10b9d967fee4ad041ec8
19ef79eda4aea2120fbf27902fabedef4f8e1a20
/src/allduplacyavoid/Parent.java
8a7d75d9642cc5db99bf72984cd80091c20fd7a3
[]
no_license
vikashankita79/DEMO_Checking
37fb34d865a11b68f26857d69d4bb27aea388f71
48ffa13b9d5109491a2ad24b1547e22795b000e2
refs/heads/master
2021-01-24T07:14:31.999868
2017-06-04T20:08:37
2017-06-04T20:08:37
93,335,905
0
0
null
null
null
null
UTF-8
Java
false
false
645
java
package allduplacyavoid; import java.io.IOException; import java.io.PrintWriter; public class Parent { public void m1(int i) { } protected String m1(String str) { return str; } public void m2() throws Throwable { } } class Child extends Parent { public void m2() throws IOException { Runtime.getRuntime().exec("notepad"); } } class Mainrun { public static void main(String args[]) throws Throwable { Child child=new Child(); child.m2(); } }
[ "vikash@vikash-PC" ]
vikash@vikash-PC
c97bc9bafa712310aee146c7b306e6b280943241
8f0d508be866a9a5c515c1bbbc5bf85693ef3ffd
/bedrock282/src/main/java/soupply/bedrock282/protocol/play/PurchaseReceipt.java
738a02d3969c166c050239113d6656d50508931c
[ "MIT" ]
permissive
hanbule/java
83e7e1e2725b48370b0151a2ac1ec222b5e99264
40fecf30625bdbdc71cce4c6e3222022c0387c6e
refs/heads/master
2021-09-21T22:43:25.890116
2018-09-02T09:28:23
2018-09-02T09:28:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,317
java
package soupply.bedrock282.protocol.play; import java.util.*; import soupply.util.*; public class PurchaseReceipt extends soupply.bedrock282.Packet { public static final int ID = 92; public String[] unknown0; public PurchaseReceipt() { } public PurchaseReceipt(String[] unknown0) { this.unknown0 = unknown0; } @Override public int getId() { return ID; } @Override public void encodeBody(Buffer _buffer) { _buffer.writeVaruint((int)unknown0.length); for(String d5b9ba:unknown0) { byte[] zvoj = _buffer.convertString(d5b9ba); _buffer.writeVaruint((int)zvoj.length); _buffer.writeBytes(zvoj); } } @Override public void decodeBody(Buffer _buffer) throws DecodeException { final int bva5d4 = _buffer.readVaruint(); unknown0 = new String[bva5d4]; for(int d5b9ba=0;d5b9ba<unknown0.length;d5b9ba++) { final int bvd5b9bb = _buffer.readVaruint(); unknown0[d5b9ba] = _buffer.readString(bvd5b9bb); } } public static PurchaseReceipt fromBuffer(byte[] buffer) { PurchaseReceipt packet = new PurchaseReceipt(); packet.safeDecode(buffer); return packet; } }
b33bbe4eba8132d4fe2aeb0e7bd5a903d11429fe
eaa86fb92c72aecbd1ae8659c01ab74e9143f615
/android/app/build/generated/not_namespaced_r_class_sources/release/processReleaseResources/r/com/google/android/exoplayer2/R.java
dce79a31260698a2b55aa87c72a09e9aad343c20
[]
no_license
Harikasai999/Sample-Animations
1752917c3cdd04aaca2001267cb349d1e2bbf9ba
aaa041cf52bdae5eaa22494f1a2d2e6808861b42
refs/heads/master
2023-01-13T19:14:17.330338
2019-06-10T11:56:32
2019-06-10T11:56:32
185,121,967
0
0
null
2023-01-03T21:07:24
2019-05-06T04:09:17
Java
UTF-8
Java
false
false
23,069
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 com.google.android.exoplayer2; public final class R { private R() {} public static final class attr { private attr() {} public static final int ad_marker_color = 0x7f020025; public static final int ad_marker_width = 0x7f020026; public static final int auto_show = 0x7f020036; public static final int bar_height = 0x7f02003e; public static final int buffered_color = 0x7f020041; public static final int controller_layout_id = 0x7f020068; public static final int default_artwork = 0x7f02006c; public static final int fastforward_increment = 0x7f020082; public static final int font = 0x7f020084; public static final int fontProviderAuthority = 0x7f020086; public static final int fontProviderCerts = 0x7f020087; public static final int fontProviderFetchStrategy = 0x7f020088; public static final int fontProviderFetchTimeout = 0x7f020089; public static final int fontProviderPackage = 0x7f02008a; public static final int fontProviderQuery = 0x7f02008b; public static final int fontStyle = 0x7f02008c; public static final int fontWeight = 0x7f02008e; public static final int hide_during_ads = 0x7f020093; public static final int hide_on_touch = 0x7f020094; public static final int keep_content_on_player_reset = 0x7f0200a0; public static final int played_ad_marker_color = 0x7f0200cb; public static final int played_color = 0x7f0200cc; public static final int player_layout_id = 0x7f0200cd; public static final int repeat_toggle_modes = 0x7f0200de; public static final int resize_mode = 0x7f0200df; public static final int rewind_increment = 0x7f0200e2; public static final int scrubber_color = 0x7f0200f1; public static final int scrubber_disabled_size = 0x7f0200f2; public static final int scrubber_dragged_size = 0x7f0200f3; public static final int scrubber_drawable = 0x7f0200f4; public static final int scrubber_enabled_size = 0x7f0200f5; public static final int show_buffering = 0x7f020100; public static final int show_shuffle_button = 0x7f020101; public static final int show_timeout = 0x7f020102; public static final int shutter_background_color = 0x7f020103; public static final int surface_type = 0x7f020113; public static final int touch_target_height = 0x7f02013c; public static final int unplayed_color = 0x7f020141; public static final int use_artwork = 0x7f020142; public static final int use_controller = 0x7f020143; } public static final class bool { private bool() {} public static final int abc_action_bar_embed_tabs = 0x7f030000; } public static final class color { private color() {} public static final int exo_edit_mode_background_color = 0x7f04002e; public static final int exo_error_message_background_color = 0x7f04002f; public static final int notification_action_color_filter = 0x7f040040; public static final int notification_icon_bg_color = 0x7f040041; public static final int notification_material_background_media_default_color = 0x7f040042; public static final int primary_text_default_material_dark = 0x7f040047; public static final int ripple_material_light = 0x7f04004c; public static final int secondary_text_default_material_dark = 0x7f04004d; public static final int secondary_text_default_material_light = 0x7f04004e; } public static final class dimen { private dimen() {} public static final int compat_button_inset_horizontal_material = 0x7f05004b; public static final int compat_button_inset_vertical_material = 0x7f05004c; public static final int compat_button_padding_horizontal_material = 0x7f05004d; public static final int compat_button_padding_vertical_material = 0x7f05004e; public static final int compat_control_corner_material = 0x7f05004f; public static final int exo_media_button_height = 0x7f050054; public static final int exo_media_button_width = 0x7f050055; public static final int notification_action_icon_size = 0x7f05005d; public static final int notification_action_text_size = 0x7f05005e; public static final int notification_big_circle_margin = 0x7f05005f; public static final int notification_content_margin_start = 0x7f050060; public static final int notification_large_icon_height = 0x7f050061; public static final int notification_large_icon_width = 0x7f050062; public static final int notification_main_column_padding_top = 0x7f050063; public static final int notification_media_narrow_margin = 0x7f050064; public static final int notification_right_icon_size = 0x7f050065; public static final int notification_right_side_padding_top = 0x7f050066; public static final int notification_small_icon_background_padding = 0x7f050067; public static final int notification_small_icon_size_as_large = 0x7f050068; public static final int notification_subtext_size = 0x7f050069; public static final int notification_top_pad = 0x7f05006a; public static final int notification_top_pad_large_text = 0x7f05006b; } public static final class drawable { private drawable() {} public static final int exo_controls_fastforward = 0x7f060054; public static final int exo_controls_fullscreen_enter = 0x7f060055; public static final int exo_controls_fullscreen_exit = 0x7f060056; public static final int exo_controls_next = 0x7f060057; public static final int exo_controls_pause = 0x7f060058; public static final int exo_controls_play = 0x7f060059; public static final int exo_controls_previous = 0x7f06005a; public static final int exo_controls_repeat_all = 0x7f06005b; public static final int exo_controls_repeat_off = 0x7f06005c; public static final int exo_controls_repeat_one = 0x7f06005d; public static final int exo_controls_rewind = 0x7f06005e; public static final int exo_controls_shuffle = 0x7f06005f; public static final int exo_edit_mode_logo = 0x7f060060; public static final int exo_icon_fastforward = 0x7f060061; public static final int exo_icon_next = 0x7f060062; public static final int exo_icon_pause = 0x7f060063; public static final int exo_icon_play = 0x7f060064; public static final int exo_icon_previous = 0x7f060065; public static final int exo_icon_rewind = 0x7f060066; public static final int exo_icon_stop = 0x7f060067; public static final int exo_notification_fastforward = 0x7f060068; public static final int exo_notification_next = 0x7f060069; public static final int exo_notification_pause = 0x7f06006a; public static final int exo_notification_play = 0x7f06006b; public static final int exo_notification_previous = 0x7f06006c; public static final int exo_notification_rewind = 0x7f06006d; public static final int exo_notification_small_icon = 0x7f06006e; public static final int exo_notification_stop = 0x7f06006f; public static final int notification_action_background = 0x7f060074; public static final int notification_bg = 0x7f060075; public static final int notification_bg_low = 0x7f060076; public static final int notification_bg_low_normal = 0x7f060077; public static final int notification_bg_low_pressed = 0x7f060078; public static final int notification_bg_normal = 0x7f060079; public static final int notification_bg_normal_pressed = 0x7f06007a; public static final int notification_icon_background = 0x7f06007b; public static final int notification_template_icon_bg = 0x7f06007c; public static final int notification_template_icon_low_bg = 0x7f06007d; public static final int notification_tile_bg = 0x7f06007e; public static final int notify_panel_notification_icon_bg = 0x7f06007f; } public static final class id { private id() {} public static final int action0 = 0x7f070008; public static final int action_container = 0x7f070010; public static final int action_divider = 0x7f070012; public static final int action_image = 0x7f070013; public static final int action_text = 0x7f070019; public static final int actions = 0x7f07001a; public static final int always = 0x7f07001f; public static final int async = 0x7f070020; public static final int blocking = 0x7f070022; public static final int cancel_action = 0x7f070025; public static final int chronometer = 0x7f07002d; public static final int end_padder = 0x7f07003a; public static final int exo_artwork = 0x7f07003b; public static final int exo_buffering = 0x7f07003c; public static final int exo_content_frame = 0x7f07003d; public static final int exo_controller = 0x7f07003e; public static final int exo_controller_placeholder = 0x7f07003f; public static final int exo_duration = 0x7f070040; public static final int exo_error_message = 0x7f070041; public static final int exo_ffwd = 0x7f070042; public static final int exo_next = 0x7f070043; public static final int exo_overlay = 0x7f070044; public static final int exo_pause = 0x7f070045; public static final int exo_play = 0x7f070046; public static final int exo_position = 0x7f070048; public static final int exo_prev = 0x7f070049; public static final int exo_progress = 0x7f07004a; public static final int exo_repeat_toggle = 0x7f07004b; public static final int exo_rew = 0x7f07004c; public static final int exo_shuffle = 0x7f07004d; public static final int exo_shutter = 0x7f07004e; public static final int exo_subtitles = 0x7f07004f; public static final int exo_track_selection_view = 0x7f070050; public static final int fill = 0x7f070053; public static final int fit = 0x7f070056; public static final int fixed_height = 0x7f07005c; public static final int fixed_width = 0x7f07005d; public static final int forever = 0x7f07005f; public static final int icon = 0x7f070064; public static final int icon_group = 0x7f070065; public static final int info = 0x7f070068; public static final int italic = 0x7f070069; public static final int line1 = 0x7f07006b; public static final int line3 = 0x7f07006c; public static final int media_actions = 0x7f07006f; public static final int never = 0x7f070073; public static final int none = 0x7f070074; public static final int normal = 0x7f070075; public static final int notification_background = 0x7f070076; public static final int notification_main_column = 0x7f070077; public static final int notification_main_column_container = 0x7f070078; public static final int right_icon = 0x7f070081; public static final int right_side = 0x7f070082; public static final int spherical_view = 0x7f0700a1; public static final int status_bar_latest_event_content = 0x7f0700a7; public static final int surface_view = 0x7f0700aa; public static final int tag_transition_group = 0x7f0700ac; public static final int text = 0x7f0700af; public static final int text2 = 0x7f0700b0; public static final int texture_view = 0x7f0700b3; public static final int time = 0x7f0700b4; public static final int title = 0x7f0700b5; public static final int when_playing = 0x7f0700bf; public static final int zoom = 0x7f0700c2; } public static final class integer { private integer() {} public static final int cancel_button_image_alpha = 0x7f080002; public static final int status_bar_notification_info_maxnum = 0x7f080006; } public static final class layout { private layout() {} public static final int exo_list_divider = 0x7f09001d; public static final int exo_playback_control_view = 0x7f09001e; public static final int exo_player_control_view = 0x7f09001f; public static final int exo_player_view = 0x7f090020; public static final int exo_simple_player_view = 0x7f090021; public static final int exo_track_selection_dialog = 0x7f090022; public static final int notification_action = 0x7f090024; public static final int notification_action_tombstone = 0x7f090025; public static final int notification_media_action = 0x7f090026; public static final int notification_media_cancel_action = 0x7f090027; public static final int notification_template_big_media = 0x7f090028; public static final int notification_template_big_media_custom = 0x7f090029; public static final int notification_template_big_media_narrow = 0x7f09002a; public static final int notification_template_big_media_narrow_custom = 0x7f09002b; public static final int notification_template_custom_big = 0x7f09002c; public static final int notification_template_icon_group = 0x7f09002d; public static final int notification_template_lines_media = 0x7f09002e; public static final int notification_template_media = 0x7f09002f; public static final int notification_template_media_custom = 0x7f090030; public static final int notification_template_part_chronometer = 0x7f090031; public static final int notification_template_part_time = 0x7f090032; } public static final class string { private string() {} public static final int exo_controls_fastforward_description = 0x7f0b0045; public static final int exo_controls_fullscreen_description = 0x7f0b0046; public static final int exo_controls_next_description = 0x7f0b0047; public static final int exo_controls_pause_description = 0x7f0b0048; public static final int exo_controls_play_description = 0x7f0b0049; public static final int exo_controls_previous_description = 0x7f0b004a; public static final int exo_controls_repeat_all_description = 0x7f0b004b; public static final int exo_controls_repeat_off_description = 0x7f0b004c; public static final int exo_controls_repeat_one_description = 0x7f0b004d; public static final int exo_controls_rewind_description = 0x7f0b004e; public static final int exo_controls_shuffle_description = 0x7f0b004f; public static final int exo_controls_stop_description = 0x7f0b0050; public static final int exo_download_completed = 0x7f0b0051; public static final int exo_download_description = 0x7f0b0052; public static final int exo_download_downloading = 0x7f0b0053; public static final int exo_download_failed = 0x7f0b0054; public static final int exo_download_notification_channel_name = 0x7f0b0055; public static final int exo_download_removing = 0x7f0b0056; public static final int exo_item_list = 0x7f0b0057; public static final int exo_track_bitrate = 0x7f0b0058; public static final int exo_track_mono = 0x7f0b0059; public static final int exo_track_resolution = 0x7f0b005a; public static final int exo_track_selection_auto = 0x7f0b005b; public static final int exo_track_selection_none = 0x7f0b005c; public static final int exo_track_selection_title_audio = 0x7f0b005d; public static final int exo_track_selection_title_text = 0x7f0b005e; public static final int exo_track_selection_title_video = 0x7f0b005f; public static final int exo_track_stereo = 0x7f0b0060; public static final int exo_track_surround = 0x7f0b0061; public static final int exo_track_surround_5_point_1 = 0x7f0b0062; public static final int exo_track_surround_7_point_1 = 0x7f0b0063; public static final int exo_track_unknown = 0x7f0b0064; public static final int status_bar_notification_info_overflow = 0x7f0b006b; } public static final class style { private style() {} public static final int ExoMediaButton = 0x7f0c00a8; public static final int ExoMediaButton_FastForward = 0x7f0c00a9; public static final int ExoMediaButton_Next = 0x7f0c00aa; public static final int ExoMediaButton_Pause = 0x7f0c00ab; public static final int ExoMediaButton_Play = 0x7f0c00ac; public static final int ExoMediaButton_Previous = 0x7f0c00ad; public static final int ExoMediaButton_Rewind = 0x7f0c00ae; public static final int ExoMediaButton_Shuffle = 0x7f0c00af; public static final int TextAppearance_Compat_Notification = 0x7f0c00ff; public static final int TextAppearance_Compat_Notification_Info = 0x7f0c0100; public static final int TextAppearance_Compat_Notification_Info_Media = 0x7f0c0101; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0c0102; public static final int TextAppearance_Compat_Notification_Line2_Media = 0x7f0c0103; public static final int TextAppearance_Compat_Notification_Media = 0x7f0c0104; public static final int TextAppearance_Compat_Notification_Time = 0x7f0c0105; public static final int TextAppearance_Compat_Notification_Time_Media = 0x7f0c0106; public static final int TextAppearance_Compat_Notification_Title = 0x7f0c0107; public static final int TextAppearance_Compat_Notification_Title_Media = 0x7f0c0108; public static final int Widget_Compat_NotificationActionContainer = 0x7f0c0178; public static final int Widget_Compat_NotificationActionText = 0x7f0c0179; } public static final class styleable { private styleable() {} public static final int[] AspectRatioFrameLayout = { 0x7f0200df }; public static final int AspectRatioFrameLayout_resize_mode = 0; public static final int[] DefaultTimeBar = { 0x7f020025, 0x7f020026, 0x7f02003e, 0x7f020041, 0x7f0200cb, 0x7f0200cc, 0x7f0200f1, 0x7f0200f2, 0x7f0200f3, 0x7f0200f4, 0x7f0200f5, 0x7f02013c, 0x7f020141 }; public static final int DefaultTimeBar_ad_marker_color = 0; public static final int DefaultTimeBar_ad_marker_width = 1; public static final int DefaultTimeBar_bar_height = 2; public static final int DefaultTimeBar_buffered_color = 3; public static final int DefaultTimeBar_played_ad_marker_color = 4; public static final int DefaultTimeBar_played_color = 5; public static final int DefaultTimeBar_scrubber_color = 6; public static final int DefaultTimeBar_scrubber_disabled_size = 7; public static final int DefaultTimeBar_scrubber_dragged_size = 8; public static final int DefaultTimeBar_scrubber_drawable = 9; public static final int DefaultTimeBar_scrubber_enabled_size = 10; public static final int DefaultTimeBar_touch_target_height = 11; public static final int DefaultTimeBar_unplayed_color = 12; public static final int[] FontFamily = { 0x7f020086, 0x7f020087, 0x7f020088, 0x7f020089, 0x7f02008a, 0x7f02008b }; 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, 0x7f020084, 0x7f02008c, 0x7f02008d, 0x7f02008e, 0x7f020140 }; 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[] PlayerControlView = { 0x7f020068, 0x7f020082, 0x7f0200de, 0x7f0200e2, 0x7f020101, 0x7f020102 }; public static final int PlayerControlView_controller_layout_id = 0; public static final int PlayerControlView_fastforward_increment = 1; public static final int PlayerControlView_repeat_toggle_modes = 2; public static final int PlayerControlView_rewind_increment = 3; public static final int PlayerControlView_show_shuffle_button = 4; public static final int PlayerControlView_show_timeout = 5; public static final int[] PlayerView = { 0x7f020036, 0x7f020068, 0x7f02006c, 0x7f020082, 0x7f020093, 0x7f020094, 0x7f0200a0, 0x7f0200cd, 0x7f0200de, 0x7f0200df, 0x7f0200e2, 0x7f020100, 0x7f020101, 0x7f020102, 0x7f020103, 0x7f020113, 0x7f020142, 0x7f020143 }; public static final int PlayerView_auto_show = 0; public static final int PlayerView_controller_layout_id = 1; public static final int PlayerView_default_artwork = 2; public static final int PlayerView_fastforward_increment = 3; public static final int PlayerView_hide_during_ads = 4; public static final int PlayerView_hide_on_touch = 5; public static final int PlayerView_keep_content_on_player_reset = 6; public static final int PlayerView_player_layout_id = 7; public static final int PlayerView_repeat_toggle_modes = 8; public static final int PlayerView_resize_mode = 9; public static final int PlayerView_rewind_increment = 10; public static final int PlayerView_show_buffering = 11; public static final int PlayerView_show_shuffle_button = 12; public static final int PlayerView_show_timeout = 13; public static final int PlayerView_shutter_background_color = 14; public static final int PlayerView_surface_type = 15; public static final int PlayerView_use_artwork = 16; public static final int PlayerView_use_controller = 17; } }
[ "harika.n" ]
harika.n
a34afe5b3315f9cc92217c16c323d1001b180b1a
b406beb56133ce9ce73066498b1569e9ff24c1ed
/src/main/java/com/xk/dao/hibernate/BaseDaoHibernate.java
7c9d9b2bb5f43f12debb020923b55ee220270b46
[]
no_license
404hasFound/springtest
3773f9a430e088fe42e8a0def115dd017039a0d2
c4f4aedaa55fc5046110667c49648d01039fd6db
refs/heads/master
2020-04-12T04:23:11.201883
2018-12-18T15:36:58
2018-12-18T15:36:58
162,294,010
0
0
null
null
null
null
UTF-8
Java
false
false
12,667
java
package com.xk.dao.hibernate; import java.io.Serializable; import java.util.Collection; import java.util.List; import java.util.Map; import javax.annotation.Resource; import org.apache.commons.lang3.Validate; import org.hibernate.Criteria; import org.hibernate.Hibernate; import org.hibernate.Query; import org.hibernate.SQLQuery; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.criterion.CriteriaSpecification; import org.hibernate.criterion.Criterion; import org.hibernate.criterion.DetachedCriteria; import org.hibernate.criterion.Order; import org.hibernate.criterion.Restrictions; import org.hibernate.metadata.ClassMetadata; import org.hibernate.transform.Transformers; import org.hibernate.type.Type; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; /** * 封装Hibernate原生API的DAO泛型基类. * * 参考Spring2.5自带的Petlinc例子, 取消了HibernateTemplate, 直接使用Hibernate原生API. * * @param <T> * DAO操作的对象类型 * @param <ID> * 主键类型 * */ public class BaseDaoHibernate<T, ID extends Serializable> { protected Logger logger = LoggerFactory.getLogger(getClass()); protected Class<T> entityClass; @Resource protected SessionFactory authsessionFactory; protected Session session; /** * 用于Dao层子类使用的构造函数. 通过子类的泛型定义取得对象类型Class. eg. public class UserDao extends * SimpleHibernateDao<User, Long> */ public BaseDaoHibernate() { //this.entityClass = Reflections.getClassGenricType(getClass()); } public BaseDaoHibernate(Class<T> entityClass) { this.entityClass = entityClass; } /** * 保存新增或修改的对象. */ public void save(final T entity) { Validate.notNull(entity, "entity不能为空"); authsessionFactory.getCurrentSession().save(entity); logger.debug("save entity: {}", entity); } public void saveOrUpdate(final T entity) { Validate.notNull(entity, "entity不能为空"); authsessionFactory.getCurrentSession().saveOrUpdate(entity); logger.debug("save entity: {}", entity); } /** * 删除对象. * * @param entity * 对象必须是session中的对象或含id属性的transient对象. */ public void delete(final T entity) { Validate.notNull(entity, "entity不能为空"); authsessionFactory.getCurrentSession().delete(entity); logger.debug("delete entity: {}", entity); } /** * 按id删除对象. */ public void delete(final ID id) { Validate.notNull(id, "id不能为空"); delete(get(id)); logger.debug("delete entity {},id is {}", entityClass.getSimpleName(), id); } /** * 按id获取对象. */ public T get(final ID id) { Validate.notNull(id, "id不能为空"); return (T) authsessionFactory.getCurrentSession().load(entityClass, id); } /** * 按id列表获取对象列表. */ public List<T> get(final Collection<ID> ids) { return find(Restrictions.in(getIdName(), ids)); } /** * 获取全部对象. */ public List<T> getAll() { return find(); } /** * 获取全部对象, 支持按属性行序. */ public List<T> getAll(String orderByProperty, boolean isAsc) { Criteria c = createCriteria(); if (isAsc) { c.addOrder(Order.asc(orderByProperty)); } else { c.addOrder(Order.desc(orderByProperty)); } return c.list(); } /** * 按属性查找对象列表, 匹配方式为相等. */ public List<T> findBy(final String propertyName, final Object value) { Validate.notBlank(propertyName, "propertyName不能为空"); Criterion criterion = Restrictions.eq(propertyName, value); return find(criterion); } /** * 按属性查找唯一对象, 匹配方式为相等. */ public T findUniqueBy(final String propertyName, final Object value) { Validate.notBlank(propertyName, "propertyName不能为空"); Criterion criterion = Restrictions.eq(propertyName, value); return (T) createCriteria(criterion).uniqueResult(); } /** * 按HQL查询对象列表. * * @param values * 数量可变的参数,按顺序绑定. */ public <X> List<X> find(final String hql, final Object... values) { return createQuery(hql, values).list(); } /** * 按HQL查询对象列表. * * @param values * 命名参数,按名称绑定. */ public <X> List<X> find(final String hql, final Map<String, ?> values) { return createQuery(hql, values).list(); } public List findBySQL(String sql, Object... values) { Validate.notBlank(sql); SQLQuery query = createSQLQuery(sql, null, null, values); return query.list(); } public List findBySQL(String sql, String[] field, Type[] fieldtype, Object[] values) { Validate.notBlank(sql); SQLQuery query = createSQLQuery(sql, field, fieldtype, values); return query.list(); } public <T> List<T> findBySQL(Class<T> entityClass, String sql, final Object... values) { Validate.notBlank(sql); SQLQuery query = createSQLQuery(sql, null, null, values).addEntity(entityClass); return query.list(); } /** * 根据sql查询并转化为VO * * @param voClass * @param sql * @param values * @return */ @SuppressWarnings("unchecked") public <X> List<X> findBySQL(Class<X> voClass, String sql, final Map<String, ?> values) { Validate.notBlank(sql); return createSQLQuery(sql, null, null, null) .setResultTransformer(Transformers.aliasToBean(voClass)) .setProperties(values).list(); } /** * 按HQL查询唯一对象. * * @param values * 数量可变的参数,按顺序绑定. */ public <X> X findUnique(final String hql, final Object... values) { return (X) createQuery(hql, values).uniqueResult(); } /** * 按HQL查询唯一对象. * * @param values * 命名参数,按名称绑定. */ public <X> X findUnique(final String hql, final Map<String, ?> values) { return (X) createQuery(hql, values).uniqueResult(); } /** * 执行HQL进行批量修改/删除操作. * * @param values * 数量可变的参数,按顺序绑定. * @return 更新记录数. */ public int batchExecute(final String hql, final Object... values) { return createQuery(hql, values).executeUpdate(); } /** * 执行HQL进行批量修改/删除操作. * * @param values * 命名参数,按名称绑定. * @return 更新记录数. */ public int batchExecute(final String hql, final Map<String, ?> values) { return createQuery(hql, values).executeUpdate(); } /** * 根据查询HQL与参数列表创建Query对象. 与find()函数可进行更加灵活的操作. * * @param values * 数量可变的参数,按顺序绑定. */ public Query createQuery(final String queryString, final Object... values) { Validate.notBlank(queryString, "queryString不能为空"); Query query = authsessionFactory.getCurrentSession().createQuery(queryString); if (values != null) { for (int i = 0; i < values.length; i++) { query.setParameter(i, values[i]); } } return query; } /** * 根据查询HQL与参数列表创建Query对象. 与find()函数可进行更加灵活的操作. * * @param values * 命名参数,按名称绑定. */ public Query createQuery(final String queryString, final Map<String, ?> values) { Validate.notBlank(queryString, "queryString不能为空"); Query query = authsessionFactory.getCurrentSession().createQuery(queryString); if (values != null) { query.setProperties(values); } return query; } public SQLQuery createSQLQuery(String queryString, String[] field, Type[] fieldtype, Object[] values) { Validate.notBlank(queryString, "queryString不能为空", new Object[0]); //SQLQuery query = authsessionFactory.getCurrentSession().createSQLQuery(queryString); session = authsessionFactory.openSession(); SQLQuery query = session.createSQLQuery(queryString); if (values != null) { for (int i = 0; i < values.length; i++) { query.setParameter(i, values[i]); } } if (field != null) { for (int i = 0; i < field.length; i++) { query.addScalar(field[i], fieldtype[i]); } } return query; } /** * 按Criteria查询对象列表. * * @param criterions * 数量可变的Criterion. */ public List<T> find(final Criterion... criterions) { return createCriteria(criterions).list(); } public List<T> find(DetachedCriteria detachedCriteria) { Criteria criteria = detachedCriteria.getExecutableCriteria(authsessionFactory .getCurrentSession()); return criteria.list(); } /** * 按Criteria查询唯一对象. * * @param criterions * 数量可变的Criterion. */ public T findUnique(final Criterion... criterions) { return (T) createCriteria(criterions).uniqueResult(); } /** * 根据Criterion条件创建Criteria. 与find()函数可进行更加灵活的操作. * * @param criterions * 数量可变的Criterion. */ public Criteria createCriteria(final Criterion... criterions) { Criteria criteria = authsessionFactory.getCurrentSession().createCriteria(entityClass); for (Criterion c : criterions) { criteria.add(c); } return criteria; } /** * 初始化对象. 使用load()方法得到的仅是对象Proxy, 在传到View层前需要进行初始化. 如果传入entity, * 则只初始化entity的直接属性,但不会初始化延迟加载的关联集合和属性. 如需初始化关联属性,需执行: * Hibernate.initialize(user.getRoles()),初始化User的直接属性和关联集合. * Hibernate.initialize * (user.getDescription()),初始化User的直接属性和延迟加载的Description属性. */ public void initProxyObject(Object proxy) { Hibernate.initialize(proxy); } /** * Flush当前Session. */ public void flush() { authsessionFactory.getCurrentSession().flush(); } /** * 为Query添加distinct transformer. 预加载关联对象的HQL会引起主对象重复, 需要进行distinct处理. */ public Query distinct(Query query) { query.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY); return query; } /** * 为Criteria添加distinct transformer. 预加载关联对象的HQL会引起主对象重复, 需要进行distinct处理. */ public Criteria distinct(Criteria criteria) { criteria.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY); return criteria; } /** * 取得对象的主键名. */ public String getIdName() { ClassMetadata meta = authsessionFactory.getClassMetadata(entityClass); return meta.getIdentifierPropertyName(); } /** * 判断对象的属性值在数据库内是否唯一. * * 在修改对象的情景下,如果属性新修改的值(value)等于属性原来的值(orgValue)则不作比较. */ public boolean isPropertyUnique(final String propertyName, final Object newValue, final Object oldValue) { if (newValue == null || newValue.equals(oldValue)) { return true; } Object object = findUniqueBy(propertyName, newValue); return (object == null); } public int batchExecSQL(String sql, Object... values) { Validate.notBlank(sql); SQLQuery query = createSQLQuery(sql, null, null, values); return query.executeUpdate(); } }
c63d15ad5bc26471b461b5aacfa5f9869ba50ebd
09bcc817a0b25d49de18adb9eb68690fa17d70ce
/bitcamp-java-basic/src/main/java/com/eomcs/oop/ex06/c/B3.java
c5297acaf31c876c7342de1b78b8291a492dffdb
[]
no_license
2seunghyuck/bitcamp-workspace
4a84b1a329e57a9fe545fd32415a463ac9ad2c9f
c7b6844e7350d844e59f169a6681fdc83fb8e1c7
refs/heads/master
2023-07-08T07:02:55.531157
2021-08-05T20:37:50
2021-08-05T20:37:50
279,742,762
0
1
null
null
null
null
UTF-8
Java
false
false
827
java
package com.eomcs.oop.ex06.c; public class B3 extends B { // 오버라이딩 문법 검사 // => 오버라이딩을 제대로 했는지 컴파일러에게 검사하도록 요청할 수 있다. // => 어떻게? // 메서드 정의 앞에 @Override를 붙여라 @Override // <= 컴파일러야, 내가 상속받은 메서드를 재정의한다고 했는데, 혹시 실수는 없는지 검사해 줄래? void m(int x) { // 오버라이딩을 한다고 하면서 파라미터의 타입이나 개수, 순서를 달리해서 // 오버로딩이 되는 경우가 있기 때문에 // 이를 방지하기 위해 오버라이딩을 하는 메서드 앞에 // @Override 애노테이션을 붙임으로써 잘못 사용하는 경우를 방지할 수 있다. // System.out.println("B3의 m()"); } }
5580d91dc90fb5ce47031027bd94dd5a548be318
8cbbbcab0358565f58d0d079d584a39116586909
/declare-core/src/main/java/com/dspsemi/declare/core/service/location/ProvinceService.java
4a082d68c25d43bcc4d003a2aaf6be4a04e0740f
[]
no_license
lijinjiang92/declare
3bc7dcc9180a5fcf5ee819f962c0b5ed27a806ce
5f6291e7ba0434e2bbcf7492294ce83a730e01b3
refs/heads/master
2021-01-19T22:22:38.374957
2017-08-04T03:24:57
2017-08-04T03:24:57
88,806,849
1
0
null
null
null
null
UTF-8
Java
false
false
938
java
package com.dspsemi.declare.core.service.location; import java.util.List; import com.dspsemi.common.lang.dto.DataPage; import com.dspsemi.declare.core.pojo.location.Province; public interface ProvinceService { /** * 查找 * @return */ List<Province> list(); /** * 详情 * @param id * @return */ Province load(Integer id); /** * 新增 * @param shop * @return 应该实现返回数据能获取到主键 */ Province add(Province province); /** * 逻辑删除 * @param id * @return */ int remove(Integer id); /** * 物理删除 * @param id * @return */ int removePhy(Integer id); /** * 分页查找 * @param pageNo * @param pageSize * @return */ DataPage<Province> page(int pageNo, int pageSize); /** * 分页查找 传递给o2o的省市区信息 * @param pageNo * @param pageSize * @return */ List<Province> list4O2O(int pageNo, int pageSize); }
71959050c71daebfbda253c556205ca2cd4e573e
9c7e8ffeac14f451a90bf559383ec5566ea81d1b
/projects/papabench/src/main/java/papabench/core/autopilot/modules/impl/EstimatorModuleImpl.java
38ab1a2df80ea34a3c78d0f9387e07e13172808a
[ "MIT" ]
permissive
mc-imperial/jtool-sct
fc2209f2d6c6273e9dae7a37a8209291914a7195
80811bb88e1cec0234bc720b5b47ec9e2cdf6364
refs/heads/master
2021-01-12T12:46:55.912768
2016-10-26T11:07:18
2016-10-26T11:07:20
69,858,207
0
1
null
null
null
null
UTF-8
Java
false
false
5,678
java
/** * */ package papabench.core.autopilot.modules.impl; import papabench.core.autopilot.data.Attitude; import papabench.core.autopilot.data.HorizSpeed; import papabench.core.autopilot.data.Position3D; import papabench.core.autopilot.devices.GPSDevice; import papabench.core.autopilot.devices.IRDevice; import papabench.core.autopilot.modules.Estimator; import papabench.core.commons.conf.AirframeParametersConf; import papabench.core.commons.modules.Module; import papabench.core.utils.LogUtils; import papabench.core.utils.MathUtils; /** * * Notes: * - internal data are allocated in the same memory as this module. * * @author Michal Malohlava * */ //@SCJAllowed public class EstimatorModuleImpl implements Estimator, Module { protected static final float RHO = 0.999f; /* The higher, the slower the estimation is changing */ protected static final float INIT_WEIGHT = 100.0f; /* The number of times the initial value has to be taken */ private GPSDevice gpsDevice; private IRDevice irDevice; /* position in meters */ private final Position3D position; /* * airplane attitude in radians * x -> + = right (PHI) * y -> CW, 0 = N (PSI) * z -> + = up (THETA) * theta = The pitch in degrees relative to a plane(mathematical) normal to the earth radius line at the point the plane(aircraft) is at * phi = The roll of the aircraft in degrees * psi = The true heading of the aircraft in degrees */ private final Attitude attitude; /* speed in meters per second */ private final Position3D speed; /* rotational speed in radians per second (phi,psi,theta) */ private final Position3D rotationalSpeed; /* flight time in seconds */ private int flightTime = 0; /* horizontal ground speed in module and dir (m/s, rad (CW/North)) */ private final HorizSpeed horizontalSpeed; // (estimator_hspeed_mod, estimator_hspeed_dir) /* Wind and airspeed estimation sent by the GCS */ private final float windEast = 0f; private final float windNorth = 0f; /* m/s */ private final float airspeed = 0f; /* m/s */ /* IR related values */ private final boolean irEstimationModeEnabled = false; private float radOfIR; private float ir; private float rad; private boolean irInitialized = false; private float lastHSpeedDir; private float lastGPSTow; private float sumXX, sumXY; public EstimatorModuleImpl() { position = new Position3D(0.0f, 0.0f, 0.0f); attitude = new Attitude(0.0f, 0.0f, 0.0f); speed = new Position3D(0.0f, 0.0f, 0.0f); rotationalSpeed = new Position3D(0.0f, 0.0f, 0.0f); horizontalSpeed = new HorizSpeed(0.0f, 0.0f); } public void init() { if (gpsDevice == null || irDevice == null) { throw new IllegalArgumentException("Estimator modules is not properly configured"); } } public void updateIR() { // -> estimator_update_ir_estim if (irInitialized) { // float dt = gpsDevice.getTow() - lastGPSTow; // FIXME float dt = 0.5f; if (dt > 0.1) { float phi = (this.horizontalSpeed.direction - lastHSpeedDir); phi = MathUtils.normalizeRadAngle(phi); phi = phi / dt * AirframeParametersConf.NOMINAL_AIRSPEED / AirframeParametersConf.G; phi = MathUtils.normalizeRadAngle(phi); ir = irDevice.getIrRoll(); rad = phi; float absphi = Math.abs(phi); if (absphi < 1.0f && absphi > 0.05f && (-irDevice.getIrContrast()/2 < irDevice.getIrRoll() && irDevice.getIrRoll() < irDevice.getIrContrast()/2) ) { sumXY = rad * ir + RHO*sumXY; sumXY = ir * ir + RHO*sumXX; radOfIR = sumXY / sumXY; } } } else { irInitialized = true; float initIR = irDevice.getIrContrast(); initIR = initIR * initIR; sumXY = INIT_WEIGHT * radOfIR * initIR; sumXX = INIT_WEIGHT * initIR; } lastHSpeedDir = this.horizontalSpeed.direction; lastGPSTow = this.gpsDevice.getTow(); } public void updateIRState() { float radofir; if (irEstimationModeEnabled) radofir = this.radOfIR; else radofir = irDevice.getIrRadOfIr(); attitude.phi = radofir * irDevice.getIrRoll(); // phi updated attitude.theta = radofir * irDevice.getIrPitch(); // theta updated } public void updatePosition() { if (true) { // FIXME //if ((gpsDevice.getMode() & 1<<5) == 1) { updatePosition(gpsDevice.getEast(), gpsDevice.getNorth(), gpsDevice.getAltitude()); updateSpeedPol(gpsDevice.getSpeed(), gpsDevice.getCourse(), gpsDevice.getClimb()); // airplane is flying => update roll information if (flightTime > 0) { updateIR(); } } } public void updateFlightTime() { flightTime++; LogUtils.log(this, "Flight time = " + flightTime); } public void setGPSDevice(GPSDevice gpsDevice) { this.gpsDevice = gpsDevice; } public void setIRDevice(IRDevice irDevice) { this.irDevice = irDevice; } public Position3D getPosition() { return this.position; } public Attitude getAttitude() { return this.attitude; } public HorizSpeed getHorizontalSpeed() { return this.horizontalSpeed; } public Position3D getSpeed() { return this.speed; } public void setFlightTime(int flightTime) { this.flightTime = flightTime; } public int getFlightTime() { return flightTime; } protected void updatePosition(float x, float y, float z) { position.x = x; position.y = y; position.z = z; } protected void updateAttitude(float phi, float psi, float theta) { attitude.psi = phi; attitude.phi = psi; attitude.theta = theta; } protected void updateSpeedPol(float vhmod, float vhdir, float vz) { horizontalSpeed.module = vhmod; horizontalSpeed.direction = vhdir; speed.z = vz; } }
3840e931dfa11ca8007b44761862efafd09db925
cc06776afaaba03d74e3d97e761935b403cdba86
/src/org/rmorozov/wot_stats/TanksGraph.java
c46c9f6a5d22473c40a60b1e0ba35a2fcb3604c0
[]
no_license
roman-morozov/WoTStats
f2cb4b51806f28170a132e12ff535cf4d0c13d36
dea70c8b2b48467f77af6687a8b370660f41c439
refs/heads/master
2020-06-11T12:28:16.704427
2016-12-08T22:50:18
2016-12-08T22:50:18
75,667,410
0
0
null
null
null
null
UTF-8
Java
false
false
12,031
java
package org.rmorozov.wot_stats; import android.app.Fragment; import android.content.Context; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.content.res.Resources; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.*; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.TabHost.TabSpec; import java.util.ArrayList; public class TanksGraph extends Fragment { public static final String APP_PREFERENCES = "mysettings"; public static final String APP_PREFERENCES_COUNTER = "battle_count"; private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; DatabaseHelper dbHelper; SharedPreferences mSettings; public View mViewHierarchy; @SuppressWarnings("SameParameterValue") public static TanksGraph newInstance(String param1, String param2) { TanksGraph fragment = new TanksGraph(); Bundle args = new Bundle(); args.putString(ARG_PARAM1, param1); args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); dbHelper = DatabaseHelper.createDatabaseHelper(getActivity()); } public void onPause() { super.onStop(); Spinner spinner = (Spinner) mViewHierarchy.findViewById(R.id.spinnerBattleCount); String[] choose = getResources().getStringArray(R.array.battle_count); Editor editor = mSettings.edit(); editor.putString(APP_PREFERENCES_COUNTER, choose[spinner.getSelectedItemPosition()]); editor.apply(); } public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View viewHierarchy = inflater.inflate(R.layout.fragment_tanks_graph, container, false); mViewHierarchy = viewHierarchy; TabHost tabs = (TabHost) viewHierarchy; Spinner spinner = (Spinner) viewHierarchy.findViewById(R.id.spinnerBattleCount); String[] choose = getResources().getStringArray(R.array.battle_count); Context context = mViewHierarchy.getContext(); String str = APP_PREFERENCES; mViewHierarchy.getContext(); mSettings = context.getSharedPreferences(str, 0); if (mSettings.contains(APP_PREFERENCES_COUNTER)) { int i = 0; while (i < choose.length && !choose[i].equals(mSettings.getString(APP_PREFERENCES_COUNTER, ""))) { i++; } spinner.setSelection(i); } spinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { String[] choose = getResources().getStringArray(R.array.battle_count); refreshGraph(1, mViewHierarchy.findViewById(R.id.GraphTanks1), choose[position]); refreshGraph(2, mViewHierarchy.findViewById(R.id.GraphTanks2), choose[position]); refreshGraph(3, mViewHierarchy.findViewById(R.id.GraphTanks3), choose[position]); refreshGraph(4, mViewHierarchy.findViewById(R.id.GraphTanks4), choose[position]); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); tabs.setup(); TabSpec spec = tabs.newTabSpec("tag1"); View tabIndicator = LayoutInflater.from(getActivity()).inflate(R.layout.apptheme_tab_indicator_holo, tabs.getTabWidget(), false); TextView title = (TextView) tabIndicator.findViewById(android.R.id.title); title.setText(getString(R.string.ttl_tanks_gr_tab1)); title.setTextSize(11.0f); spec.setContent(R.id.tab1t); spec.setIndicator(tabIndicator); tabs.addTab(spec); spec = tabs.newTabSpec("tag2"); tabIndicator = LayoutInflater.from(getActivity()).inflate(R.layout.apptheme_tab_indicator_holo, tabs.getTabWidget(), false); title = (TextView) tabIndicator.findViewById(android.R.id.title); title.setText(getString(R.string.ttl_tanks_gr_tab2)); title.setTextSize(11.0f); spec.setContent(R.id.tab2t); spec.setIndicator(tabIndicator); tabs.addTab(spec); spec = tabs.newTabSpec("tag3"); tabIndicator = LayoutInflater.from(getActivity()).inflate(R.layout.apptheme_tab_indicator_holo, tabs.getTabWidget(), false); title = (TextView) tabIndicator.findViewById(android.R.id.title); title.setText(getString(R.string.ttl_tanks_gr_tab3)); title.setTextSize(11.0f); spec.setContent(R.id.tab3t); spec.setIndicator(tabIndicator); tabs.addTab(spec); spec = tabs.newTabSpec("tag4"); tabIndicator = LayoutInflater.from(getActivity()).inflate(R.layout.apptheme_tab_indicator_holo, tabs.getTabWidget(), false); title = (TextView) tabIndicator.findViewById(android.R.id.title); title.setText(getString(R.string.ttl_tanks_gr_tab4)); title.setTextSize(11.0f); spec.setContent(R.id.tab4t); spec.setIndicator(tabIndicator); tabs.addTab(spec); tabs.setCurrentTab(0); return viewHierarchy; } public void refreshGraph(int GraphType, View view, String BattleCount) { SQLiteDatabase sdb = dbHelper.getReadableDatabase(); String str = DatabaseHelper.DATABASE_TABLE_MAIN_PLAYER; String[] strArr = new String[3]; strArr[0] = DatabaseHelper.PLAYER_NAME_COLUMN; strArr[1] = DatabaseHelper.PLAYER_ID_COLUMN; strArr[2] = DatabaseHelper.ACTIVE; StringBuilder stringBuilder = new StringBuilder(); Cursor mainPlayerCursor = sdb.query(str, strArr, stringBuilder.append(DatabaseHelper.ACTIVE).append("= ?").toString(), new String[]{"1"}, null, null, null); if (mainPlayerCursor.moveToFirst()) { mainPlayerCursor.moveToFirst(); String player_id = mainPlayerCursor.getString(1); mainPlayerCursor.close(); String order_by = DatabaseHelper.BATTLES_COLUMN; if (GraphType == 1) { order_by = DatabaseHelper.DAMAGE_COLUMN; } if (GraphType == 2) { order_by = DatabaseHelper.EXP_COLUMN; } if (GraphType == 3) { order_by = DatabaseHelper.WINS_COLUMN; } if (GraphType == 4) { order_by = DatabaseHelper.WN8_COLUMN; } StringBuilder append = new StringBuilder().append("select "); append = append.append(DatabaseHelper.NAME_RU).append(", "); append = append.append(DatabaseHelper.WINS_COLUMN).append(", "); append = append.append(DatabaseHelper.BATTLES_COLUMN).append(", "); append = append.append(DatabaseHelper.DAMAGE_COLUMN).append(", "); append = append.append(DatabaseHelper.EXP_COLUMN).append(", "); append = append.append(DatabaseHelper.WN8_COLUMN).append(" from "); append = append.append(DatabaseHelper.DATABASE_TABLE_TANK_STAT_LAST).append(" where "); append = append.append(DatabaseHelper.PLAYER_ID_COLUMN).append(" = '").append(player_id).append("' AND "); Cursor cursor = sdb.rawQuery(append.append(DatabaseHelper.BATTLES_COLUMN).append(" >= ").append("'").append(BattleCount).append("'").append(" ORDER BY ").append(order_by).append(" DESC").toString(), null); cursor.moveToFirst(); ViewGroup.LayoutParams layoutParams = view.getLayoutParams(); layoutParams.width = (int) (((double) (cursor.getCount() * getResources().getDisplayMetrics().widthPixels)) / 4.2d); view.setLayoutParams(layoutParams); if (cursor.getCount() > 0) { Resources resources = getResources(); ArrayList<Bar> aBars = new ArrayList<>(); for (int i = 0; i < cursor.getCount(); i++) { Bar bar = new Bar(); switch (GraphType) { case 1: bar.setColor(resources.getColor(R.color.green_light)); bar.setLabelColor(resources.getColor(R.color.abc_search_url_text)); bar.setSelectedColor(resources.getColor(R.color.transparent_orange)); bar.setName(cursor.getString(cursor.getColumnIndex(DatabaseHelper.NAME_RU))); bar.setValue((float) cursor.getLong(cursor.getColumnIndex(DatabaseHelper.DAMAGE_COLUMN))); append = new StringBuilder().append(""); bar.setValueString(append.append(cursor.getLong(cursor.getColumnIndex(DatabaseHelper.DAMAGE_COLUMN))).toString()); aBars.add(bar); break; case 2: bar.setColor(resources.getColor(R.color.orange)); bar.setLabelColor(resources.getColor(R.color.abc_search_url_text)); bar.setSelectedColor(resources.getColor(R.color.transparent_orange)); bar.setName(cursor.getString(cursor.getColumnIndex(DatabaseHelper.NAME_RU))); bar.setValue((float) cursor.getLong(cursor.getColumnIndex(DatabaseHelper.EXP_COLUMN))); append = new StringBuilder().append(""); bar.setValueString(append.append(cursor.getLong(cursor.getColumnIndex(DatabaseHelper.EXP_COLUMN))).toString()); aBars.add(bar); break; case 3: bar.setColor(resources.getColor(R.color.purple)); bar.setLabelColor(resources.getColor(R.color.abc_search_url_text)); bar.setSelectedColor(resources.getColor(R.color.green_light)); bar.setName(cursor.getString(cursor.getColumnIndex(DatabaseHelper.NAME_RU))); bar.setValue((float) cursor.getLong(cursor.getColumnIndex(DatabaseHelper.WINS_COLUMN))); append = new StringBuilder().append(""); bar.setValueString(append.append(cursor.getLong(cursor.getColumnIndex(DatabaseHelper.WINS_COLUMN))).append("%").toString()); aBars.add(bar); break; case 4: bar.setColor(resources.getColor(R.color.transparent_blue)); bar.setLabelColor(resources.getColor(R.color.abc_search_url_text)); bar.setSelectedColor(resources.getColor(R.color.transparent_blue)); bar.setName(cursor.getString(cursor.getColumnIndex(DatabaseHelper.NAME_RU))); bar.setValue((float) cursor.getLong(cursor.getColumnIndex(DatabaseHelper.WN8_COLUMN))); append = new StringBuilder().append(""); bar.setValueString(append.append(cursor.getLong(cursor.getColumnIndex(DatabaseHelper.WN8_COLUMN))).toString()); aBars.add(bar); break; default: break; } cursor.moveToNext(); } cursor.close(); ((BarGraph) view).setBars(aBars); return; } return; } Toast.makeText(getActivity(), getString(R.string.no_select), Toast.LENGTH_SHORT).show(); } }
244ab7aa28a9c263e159dd6f88f1d66db154f440
20784d8f4210358c357b0d81051e52ffadd180ce
/architecture/src/main/java/com/kunminx/architecture/domain/usecase/UseCaseScheduler.java
857d5ac46fa0d42fa8776d7571a582b90aca10a1
[ "Apache-2.0" ]
permissive
gabyallen/Jetpack-MVVM-Best-Practice
4947d2af96dd233b0c8da3d7d49b9029ff92b130
db8dd826421cebcd66a3bcbc90dbcda2a61743e4
refs/heads/master
2022-11-24T07:29:11.498293
2020-07-24T02:00:48
2020-07-24T02:00:48
271,925,451
0
0
null
2020-06-13T02:20:06
2020-06-13T02:20:06
null
UTF-8
Java
false
false
1,101
java
/* * Copyright 2018-2020 KunMinX * * 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.kunminx.architecture.domain.usecase; /** * Interface for schedulers, see {@link UseCaseThreadPoolScheduler}. */ public interface UseCaseScheduler { void execute(Runnable runnable); <V extends UseCase.ResponseValue> void notifyResponse(final V response, final UseCase.UseCaseCallback<V> useCaseCallback); <V extends UseCase.ResponseValue> void onError( final UseCase.UseCaseCallback<V> useCaseCallback); }
0adcab7d3d8a949fb3a4ef38649559bc4a0fc912
b31120cefe3991a960833a21ed54d4e10770bc53
/modules/org.clang.staticanalyzer/src/org/clang/staticanalyzer/checkers/ento/impl/ProgramStateTraitFreeReturnValue.java
56bf33b6ad7f98b0e3181a954473c40b4846793e
[]
no_license
JianpingZeng/clank
94581710bd89caffcdba6ecb502e4fdb0098caaa
bcdf3389cd57185995f9ee9c101a4dfd97145442
refs/heads/master
2020-11-30T05:36:06.401287
2017-10-26T14:15:27
2017-10-26T14:15:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,169
java
/** * This file was converted to Java from the original LLVM source file. The original * source file follows the LLVM Release License, outlined below. * * ============================================================================== * LLVM Release License * ============================================================================== * University of Illinois/NCSA * Open Source License * * Copyright (c) 2003-2017 University of Illinois at Urbana-Champaign. * All rights reserved. * * Developed by: * * LLVM Team * * University of Illinois at Urbana-Champaign * * http://llvm.org * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal with * 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: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimers. * * * Redistributions in binary form must reproduce the above copyright notice * this list of conditions and the following disclaimers in the * documentation and/or other materials provided with the distribution. * * * Neither the names of the LLVM Team, University of Illinois at * Urbana-Champaign, nor the names of its contributors may be used to * endorse or promote products derived from this Software without specific * prior written permission. * * 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 * CONTRIBUTORS 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 WITH THE * SOFTWARE. * * ============================================================================== * Copyrights and Licenses for Third Party Software Distributed with LLVM: * ============================================================================== * The LLVM software contains code written by third parties. Such software will * have its own individual LICENSE.TXT file in the directory in which it appears. * This file will describe the copyrights, license, and restrictions which apply * to that code. * * The disclaimer of warranty in the University of Illinois Open Source License * applies to all code in the LLVM Distribution, and nothing in any of the * other licenses gives permission to use the names of the LLVM Team or the * University of Illinois to endorse or promote products derived from this * Software. * * The following pieces of software have additional or alternate copyrights, * licenses, and/or restrictions: * * Program Directory * ------- --------- * Autoconf llvm/autoconf * llvm/projects/ModuleMaker/autoconf * Google Test llvm/utils/unittest/googletest * OpenBSD regex llvm/lib/Support/{reg*, COPYRIGHT.regex} * pyyaml tests llvm/test/YAMLParser/{*.data, LICENSE.TXT} * ARM contributions llvm/lib/Target/ARM/LICENSE.TXT * md5 contributions llvm/lib/Support/MD5.cpp llvm/include/llvm/Support/MD5.h */ package org.clang.staticanalyzer.checkers.ento.impl; import static org.clank.support.Native.$AddrOf; import org.clank.support.*; import org.clang.staticanalyzer.core.pathsensitive.ento.*; // A map from the freed symbol to the symbol representing the return value of // the free function. //<editor-fold defaultstate="collapsed" desc="clang::ento::ProgramStateTrait<(anonymous)::FreeReturnValue>"> @Converted(kind = Converted.Kind.MANUAL_SEMANTIC, source = "${LLVM_SRC}/llvm/tools/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp", line = 518, FQN="clang::ento::ProgramStateTrait<(anonymous)::FreeReturnValue>", NM="_ZN5clang4ento17ProgramStateTraitIN12_GLOBAL__N_115FreeReturnValueEEE", cmd="jclank.sh -java-options=${SPUTNIK}/modules/org.clang.staticanalyzer/llvmToClangType ${LLVM_SRC}/llvm/tools/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp -nm=_ZN5clang4ento17ProgramStateTraitIN12_GLOBAL__N_115FreeReturnValueEEE") //</editor-fold> public class/*struct*/ ProgramStateTraitFreeReturnValue extends /*public*/ ProgramStatePartialTraitImmutableMapPtrPtr</*const*/ SymExpr /*P*/ , /*const*/ SymExpr /*P*/> { //<editor-fold defaultstate="collapsed" desc="clang::ento::ProgramStateTrait<(anonymous)::FreeReturnValue>::GDMIndex"> @Converted(kind = Converted.Kind.MANUAL_SEMANTIC, source = "${LLVM_SRC}/llvm/tools/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp", line = 518, FQN="clang::ento::ProgramStateTrait<(anonymous)::FreeReturnValue>::GDMIndex", NM="_ZN5clang4ento17ProgramStateTraitIN12_GLOBAL__N_115FreeReturnValueEE8GDMIndexEv", cmd="jclank.sh -java-options=${SPUTNIK}/modules/org.clang.staticanalyzer/llvmToClangType ${LLVM_SRC}/llvm/tools/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp -nm=_ZN5clang4ento17ProgramStateTraitIN12_GLOBAL__N_115FreeReturnValueEE8GDMIndexEv") //</editor-fold> public Object/*void P*/ GDMIndex() { final/*static*/ Object Index = GDMIndex$$.Index; return $AddrOf(Index); } private static final class GDMIndex$$ { static final/*static*/ Object Index = ProgramStateTraitFreeReturnValue.class; } ////////////////////////////////////////////////////////////// // EXTRA MEMBERS: BEGIN private ProgramStateTraitFreeReturnValue() {} public static ProgramStateTraitFreeReturnValue $Instance = new ProgramStateTraitFreeReturnValue(); // EXTRA MEMBERS: END ////////////////////////////////////////////////////////////// @Override public String toString() { return "" + super.toString(); // NOI18N } }
81af09a85b5a3a2c95f56dc5e2aa71b7552b4c0a
922918082d64b116dd0b26ad0682756d49888507
/src/main/java/busexit/BusExit.java
c4e519bc3fab3a7371cc5d0c2a5e6b424a3e0d3c
[]
no_license
anton-git/anton-java-tests
e0efb90109b7ef4a1ef10fbf3a1c779a7f626ae7
ca2619d99bd9a15e48bb5a831fb18f3e38baf29b
refs/heads/master
2021-01-01T19:21:00.359326
2019-03-22T20:45:50
2019-03-22T20:45:50
19,587,379
0
0
null
null
null
null
UTF-8
Java
false
false
4,726
java
package busexit; import java.util.ArrayList; import java.util.List; /** * User: Anton * Date: 02/11/13 * Time: 19:56 */ public class BusExit { private static List<Person> personList; private static boolean busPerson[][] = new boolean[4][8]; public static void main(String[] args) { initBus(); System.out.println("Iterations count = " + getIterationsToExit()); } private static void initBus() { personList = intiPersons(); occupyPlaces(); System.out.println("Bus is ready and occupied."); } private static int getIterationsToExit() { int iterationNumber = 0; while (!personList.isEmpty()) { List<Integer> personsToRemove = new ArrayList<Integer>(); for (Person person : personList) { person.makeStepToExit(busPerson); if (person.isOutOfBus()) { personsToRemove.add(person.getId()); } showBusSeats(); // return 0; } for (Integer i : personsToRemove) { personList.remove(new Person(i, 0, 0)); System.out.println("Person #" + i + " exited the bus."); } iterationNumber++; } return iterationNumber; } private static void occupyPlaces() { showBusSeats(); for (Person person : personList) { busPerson[person.getX()-1][person.getY()-1] = true; } showBusSeats(); } private static void showBusSeats() { System.out.println("-----"); for (int i=busPerson.length-1; i>=0; i--) { boolean line[] = busPerson[i]; for (int j = 0; j < line.length; j++) { System.out.print(busPerson[i][j] + ", "); } System.out.println(); } System.out.println("-----"); } private static List<Person> intiPersons() { List<Person> persons = new ArrayList<Person>(); persons.add(new Person(1, 1, 1)); persons.add(new Person(2, 1, 2)); persons.add(new Person(3, 4, 1)); return persons; } private static class Person { int id; int x; int y; private Person(int id, int x, int y) { this.id = id; this.x = x; this.y = y; } void makeStepToExit(final boolean seatPlan[][]) { System.out.print("ID #" + getId() + " on x=" + getX() + " y=" + getY()); int nextX = x; int nextY = y; if (x == 1 || x == 2) { nextX = x + 1; } if (x == 4) { nextX = x - 1; } if (x == 3) { nextY = y - 1; } System.out.print(" = nextX=" +nextX+" , nextY=" +nextY+" = "); if (!isNextStepOccupied(seatPlan, nextX, nextY)) { freeOldSeat(seatPlan, x, y); x = nextX; y = nextY; occupyNewSeat(seatPlan, x, y); System.out.print("moved to x=" + getX() + " y=" + getY()); } System.out.println(); } private void freeOldSeat(final boolean seatPlan[][], final int x, final int y) { if (x > 0 && y > 0) { seatPlan[x-1][y-1] = false; } } private void occupyNewSeat(final boolean seatPlan[][], final int x, final int y) { if (x > 0 && y > 0) { seatPlan[x-1][y-1] = true; } } private boolean isNextStepOccupied(final boolean seatPlan[][], final int x, final int y) { if (x > 0 && y > 0) { return seatPlan[x-1][y-1]; } return false; } boolean isOutOfBus() { return (x == 3 && y <1); } private int getX() { return x; } private void setX(int x) { this.x = x; } private int getY() { return y; } private void setY(int y) { this.y = y; } private int getId() { return id; } private void setId(int id) { this.id = id; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Person person = (Person) o; if (id != person.id) return false; return true; } @Override public int hashCode() { return id; } } }
406c868c1ca17c940d5b5d7c0a696f0bf9e646eb
2cb5b13e5b7238d276d3a22ee100f6930c564301
/src/main/java/amazon/LCAOfBinaryTree.java
fe30447ae0bca9bf1ce31c5fe723e662d7faa031
[]
no_license
siddhiparkar151992/Data-Structures-and-Algorithms
eaac07a88c80676bb895e9d5c61b0403438cf233
68e8ccd3e500a2f3b3f732d842e3fb5581c57e90
refs/heads/master
2020-05-04T00:18:13.734834
2019-04-01T16:54:47
2019-04-01T16:54:47
178,881,590
1
0
null
null
null
null
UTF-8
Java
false
false
995
java
package main.java.amazon; import main.java.algorithms.binarytree.BinaryTree; import main.java.algorithms.binarytree.Node; public class LCAOfBinaryTree { public Node findLCA(int n1, int n2, Node root){ if(root == null) return null; if(root.root == n1 || root.root == n2) return root; Node l = findLCA(n1, n2, root.left); Node r = findLCA(n1, n2, root.right); if(l!=null && r!=null){ return root; } return l!=null ? l : r; } public static void main(String[] args) { // TODO Auto-generated method stub BinaryTree tree = new BinaryTree(); tree.root = new Node(1); tree.root.left = new Node(2); tree.root.right = new Node(3); tree.root.left.left = new Node(4); tree.root.left.right = new Node(5); tree.root.right.left = new Node(6); tree.root.right.right = new Node(7); LCAOfBinaryTree l = new LCAOfBinaryTree(); Node n = l.findLCA(4, 6, tree.root); System.out.println(n.root); } }
692d972a387f2d392ddd171a6d95df58e42d311c
7102adda8659cc3a2f7eb82f2cde779d379943b5
/src/vending/Item.java
9ea07fa7afefbad80a21ee8c24e706076e998c92
[]
no_license
lucgupta/DSA_Practice
b86d9d1f9e2495a7910285ba0721d4572281b5c0
f25110ebce05a0120951dd1e2fbf2bc010e6f4fe
refs/heads/main
2023-07-22T14:14:04.707048
2021-08-17T15:16:07
2021-08-17T15:16:07
397,300,456
0
0
null
null
null
null
UTF-8
Java
false
false
364
java
package vending; public enum Item { COKE("Coke", 25), PEPSI("Pepsi", 35), SODA("Soda", 45); private String name; private int price; private Item(String name, int price){ this.name = name; this.price = price; } public String getName(){ return name; } public long getPrice(){ return price; } }
3d6c0ec3d6137a38eb3bb1a971ef54917766f186
6ef9b19ec5b5a865efa9f1d9b156362798f5d61a
/src/main/java/br/com/gestaoginasio/model/Endereco.java
94c98b748b6846e13dc95f751e4b82feba89c32e
[]
no_license
Allisson95/gestao-ginasio
6848c57c40adcd38f385a04274d7afceaba6d004
564d78a9b0d9b6375e1543152871cb4544554f78
refs/heads/master
2020-03-16T09:32:05.562075
2018-06-27T20:28:34
2018-06-27T20:28:34
132,617,552
0
3
null
null
null
null
UTF-8
Java
false
false
3,005
java
package br.com.gestaoginasio.model; import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; @Entity @Table(name = "endereco") public class Endereco implements Serializable { private static final long serialVersionUID = 1L; private Long codigo; private String logradouro; private Short numero; private String complemento; private String bairro; private String cep; private Cidade cidade; public Endereco() { this.cidade = new Cidade(); } @Id @GeneratedValue(strategy = GenerationType.IDENTITY) public Long getCodigo() { return codigo; } public void setCodigo(Long codigo) { this.codigo = codigo; } @NotBlank(message = "Logradouro é obrigatório.") @Size(max = 120, message = "Tamanho máximo do logradouro é de {max} caracteres.") public String getLogradouro() { return logradouro; } public void setLogradouro(String logradouro) { this.logradouro = logradouro; } @NotNull(message = "Número é obrigatório.") public Short getNumero() { return numero; } public void setNumero(Short numero) { this.numero = numero; } @Size(max = 120, message = "Tamanho máximo do complemento é de {max} caracteres.") public String getComplemento() { return complemento; } public void setComplemento(String complemento) { this.complemento = complemento; } @Size(max = 120, message = "Tamanho máximo do bairro é de {max} caracteres.") public String getBairro() { return bairro; } public void setBairro(String bairro) { this.bairro = bairro; } @Size(max = 8, message = "Tamanho máximo do cep é de {max} caracteres.") public String getCep() { return cep; } public void setCep(String cep) { this.cep = cep; } @NotNull(message = "Cidade é obrigatório.") @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "codigo_cidade") public Cidade getCidade() { return cidade; } public void setCidade(Cidade cidade) { this.cidade = cidade; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((codigo == null) ? 0 : codigo.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Endereco)) { return false; } Endereco other = (Endereco) obj; if (codigo == null) { if (other.codigo != null) { return false; } } else if (!codigo.equals(other.getCodigo())) { return false; } return true; } }
6d0204855e9c22c5c107f290abc3bd9617ce423f
3b25c554a63dbf0d24e9b24270b74f1fa8ca5307
/Head First Design Patterns/src/Chapter_10/NoCoinState.java
8673dcc458f4d9d42a4c37519c2e039ff923b6bf
[]
no_license
Nibuton/Education
cfb90e9bf916fa6004a7d49e488ac33496150a13
d99860d893bdc01f6cdd1b6c9522444286dfaa2a
refs/heads/master
2023-01-23T01:04:13.627936
2020-12-03T12:24:47
2020-12-03T12:24:47
310,248,430
0
0
null
null
null
null
UTF-8
Java
false
false
666
java
package Chapter_10; public class NoCoinState implements State { private GumMachine gumMachine; public NoCoinState(GumMachine gumMachine) { this.gumMachine = gumMachine; } @Override public void insertCoin() { System.out.println("Coin inserted..."); gumMachine.setState(gumMachine.getHasCoinState()); } @Override public void ejectCoin() { System.out.println("There is no coin inside"); } @Override public void turnCrank() { System.out.println("You should pay first"); } @Override public void dispense() { System.out.println("Nothing was dispensed"); } }
8aa18c3138af4341cb313b608dd612b5eb4207d3
dc48609f326fd96f7799a8478609a6afd3b01e72
/src/main/java/bixie/checker/transition_relation/TransitionRelation.java
508a2ab42526fbce7c71d6dd6f93050607ef59eb
[]
no_license
whuo3/Bixie-Accuracy-Enhanced-1015-1215
0431bdcb7bb78d9a612a7cdb4c47090ddd35b8d9
2ca68553dcae9ecfb9896ca3cfdd21bd98dd90c4
refs/heads/master
2021-01-10T01:39:20.381682
2016-01-11T21:09:24
2016-01-11T21:09:24
49,454,442
0
0
null
null
null
null
UTF-8
Java
false
false
10,290
java
package bixie.checker.transition_relation; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import org.joogie.cfgPlugin.Util.Dag; import ap.parser.IFormula; import bixie.prover.Prover; import bixie.prover.ProverExpr; import boogie.controlflow.AbstractControlFlowFactory; import boogie.controlflow.BasicBlock; import boogie.controlflow.CfgProcedure; import boogie.controlflow.CfgVariable; import boogie.controlflow.expression.CfgBooleanLiteral; import boogie.controlflow.expression.CfgExpression; import boogie.controlflow.expression.CfgIdentifierExpression; import boogie.controlflow.statement.CfgAssertStatement; import boogie.controlflow.statement.CfgAssignStatement; import boogie.controlflow.statement.CfgAssumeStatement; import boogie.controlflow.statement.CfgHavocStatement; import boogie.controlflow.statement.CfgStatement; /** * @author schaef * TODO: if we plan to do interprocedural analysis, we have * to change the way globals are handled here. */ public class TransitionRelation extends AbstractTransitionRelation { public HashMap<BasicBlock, ProverExpr> blockTransitionReleations = new HashMap<BasicBlock, ProverExpr>(); public HashMap<BasicBlock, ProverExpr> abstractTransitionReleations = new HashMap<BasicBlock, ProverExpr>(); public ProverExpr assertionFlag; protected Dag<IFormula> proverDAG; // protected ProverExpr expetionalReturnFlag = null; //TODO: this is a hack, like the creation //of this variable in the constructor // public ProverExpr getExpetionalReturnFlag() { // return expetionalReturnFlag; // } public Dag<IFormula> getProverDAG() { return proverDAG; } public TransitionRelation(CfgProcedure cfg, AbstractControlFlowFactory cff, Prover p) { super(cfg, cff, p); //*********************Handle Global axioms makePrelude(); //*********************Tell prover it is a boolean type this.assertionFlag = prover.mkVariable("MartinsAssertionFlag", prover.getBooleanType()); //*********************create the ProverExpr for the precondition ProverExpr[] prec = new ProverExpr[cfg.getRequires().size()]; int i=0; for (CfgExpression expr : cfg.getRequires()) { prec[i]=this.expression2proverExpression(expr); i++; } this.requires = this.prover.mkAnd(prec); //*********************create the ProverExpr for the precondition ProverExpr[] post = new ProverExpr[cfg.getEnsures().size()]; i=0; for (CfgExpression expr : cfg.getEnsures()) { post[i]=this.expression2proverExpression(expr); i++; } this.ensures = this.prover.mkAnd(post); //*********************encode the forward reachability ProverExpr firstok = block2transitionRelation(cfg.getRootNode(), this.proofObligations); //*********************the proof obligation for root als must contain that the block variable for root is true this.proofObligations.get(cfg.getRootNode()).add(firstok); //bfs through all blocks LinkedList<BasicBlock> todo = new LinkedList<BasicBlock>(); HashSet<BasicBlock> done = new HashSet<BasicBlock>(); todo.add(cfg.getRootNode()); while (!todo.isEmpty()) { BasicBlock current = todo.pop(); done.add(current); for (BasicBlock b : current.getSuccessors()) { if (!done.contains(b) && !todo.contains(b)) { todo.push(b); } } this.addBlock(current); } this.proverDAG = procToPrincessDag(cfg, this.reachabilityVariables ); finalizeAxioms(); } private ProverExpr block2transitionRelation(BasicBlock b, HashMap<BasicBlock, LinkedList<ProverExpr>> proofobligations) { if (reachabilityVariables.containsKey(b)) { return reachabilityVariables.get(b); } ProverExpr post; if (b.getSuccessors().size() == 0 ) { post = this.prover.mkLiteral(true); } else if (b.getSuccessors().size() == 1) { post = block2transitionRelation( b.getSuccessors().toArray(new BasicBlock[1])[0], proofobligations); } else { /* * compute \not (/\ (\not B_succ)) that is\/ ( B_succ) */ ProverExpr[] succs = new ProverExpr[b.getSuccessors().size()]; int i = 0; for (BasicBlock next : b.getSuccessors()) { succs[i++] = block2transitionRelation(next, proofobligations); } post = this.prover.mkOr(succs); } List<ProverExpr> stmts = statements2proverExpression(b.getStatements()); stmts.add(post); ProverExpr[] conj = stmts.toArray(new ProverExpr[stmts.size()]); ProverExpr blockvar = this.prover.mkVariable(b.getLabel() + "_fwd", this.prover.getBooleanType()); reachabilityVariables.put(b, blockvar); LinkedList<ProverExpr> obligations = new LinkedList<ProverExpr>(); obligations.add(this.prover.mkOr(this.prover.mkNot(blockvar), this.prover.mkAnd(conj))); proofobligations.put(b, obligations); return blockvar; } protected ProverExpr mkConjunction(Collection<ProverExpr> conjuncts) { if (conjuncts.size() == 0) { return prover.mkLiteral(true); } if (conjuncts.size() == 1) { return conjuncts.iterator().next(); } return prover.mkAnd(conjuncts.toArray(new ProverExpr[conjuncts.size()])); } public void addBlock(BasicBlock b) { LinkedList<CfgStatement> bStatements = b.getStatements(); // Add the concrete List<ProverExpr> concreteStmts = statements2proverExpression(bStatements); this.blockTransitionReleations.put(b, mkConjunction(concreteStmts)); // Add the abstract LinkedList<CfgStatement> bAbstractStatements = abstractStatements(bStatements); List<ProverExpr> abstractStmts = statements2proverExpression(bAbstractStatements); this.abstractTransitionReleations.put(b, mkConjunction(abstractStmts)); // Add the variable // if (!this.reachabilityVariables.containsKey(b)) { // this.reachabilityVariables.put(b, this.prover.mkVariable(b.getLabel() + "_fwd", this.prover.getBooleanType())); // } } /** * Isolate the abstraction of the statements (for example, just keep the frame statements). */ private LinkedList<CfgStatement> abstractStatements(LinkedList<CfgStatement> bStatements) { LinkedList<CfgStatement> abstractStatements = new LinkedList<CfgStatement>(); for (CfgStatement stmnt : bStatements) { if (stmnt instanceof CfgAssignStatement) { CfgAssignStatement asgn = (CfgAssignStatement) stmnt; CfgIdentifierExpression[] left = asgn.getLeft(); CfgExpression[] right = asgn.getRight(); boolean ok = true; if (left.length == right.length) { for (int i = 0; ok && i < left.length; ++ i) { CfgIdentifierExpression left_i = left[i]; CfgExpression right_i = right[i]; if (right_i instanceof CfgIdentifierExpression) { CfgVariable left_var = left_i.getVariable(); CfgVariable right_var = ((CfgIdentifierExpression)right_i).getVariable(); if (left_var!=right_var) { ok = false; } } else { ok = false; } } } else { ok = false; } if (ok) { abstractStatements.add(stmnt); } } } return abstractStatements; } // public void removeBlock(BasicBlock b) { // this.blockTransitionReleations.remove(b); // this.reachabilityVariables.remove(b); // } /* * (non-Javadoc) * @see bixie.checker.verificationcondition.AbstractTransitionRelation#statements2proverExpression(java.util.List) * * override the original ones to add a flag to all assertions so that we can disable them. */ @Override public List<ProverExpr> statements2proverExpression(List<CfgStatement> stmts) { LinkedList<ProverExpr> res = new LinkedList<ProverExpr>(); for (CfgStatement s : stmts) { if (s instanceof CfgAssumeStatement && ((CfgAssumeStatement)s).getCondition() instanceof CfgBooleanLiteral && ((CfgBooleanLiteral)((CfgAssumeStatement)s).getCondition()).getValue()==true) { //do nothing continue; } if (s instanceof CfgAssertStatement && ((CfgAssertStatement)s).getCondition() instanceof CfgBooleanLiteral && ((CfgBooleanLiteral)((CfgAssertStatement)s).getCondition()).getValue()==true) { //do nothing continue; } ProverExpr pe = statement2proverExpression(s); this.pe2StmtMap.put(pe, s); res.add(pe); } return res; } /* * (non-Javadoc) * @see bixie.checker.verificationcondition.AbstractTransitionRelation#statements2proverExpression(java.util.List) * * override the original ones to add a flag to all assertions so that we can disable them. */ @Override public ProverExpr statement2proverExpression(CfgStatement s) { if (s instanceof CfgAssertStatement) { CfgAssertStatement assrt = (CfgAssertStatement) s; /*!!!!! Here we translate 'assert(e)' to 'e\/assertionFlag' so that we can disable all * assertions at once by setting the flag to true. */ return this.prover.mkOr(expression2proverExpression(assrt.getCondition()), this.assertionFlag); // return expression2proverExpression(assrt.getCondition()); } else if (s instanceof CfgAssignStatement) { CfgAssignStatement assgn = (CfgAssignStatement) s; if (assgn.getLeft().length != assgn.getRight().length) { throw new RuntimeException("malformed assignment."); } ProverExpr[] conj = new ProverExpr[assgn.getLeft().length]; for (int i = 0; i < assgn.getLeft().length; i++) { ProverExpr left = expression2proverExpression(assgn.getLeft()[i]); ProverExpr right = expression2proverExpression(assgn.getRight()[i]); conj[i] = this.prover.mkEq(left, right); } return this.prover.mkAnd(conj); } else if (s instanceof CfgAssumeStatement) { CfgAssumeStatement assme = (CfgAssumeStatement) s; return expression2proverExpression(assme.getCondition()); } else if (s instanceof CfgHavocStatement) { // s Log.error("BUG: no havoc should be in the passive program!"); // Havoc is a no-op after SSA, so no need to keep it // in the transition relation return prover.mkLiteral(true); } else { //eg CfgCallStatement throw new RuntimeException("Unknown statement type: " + s.getClass().toString()); } } }
fa71d5ff8c76fc871379c2cb3220bb7f37086d7c
3d738a1fc1696b1e412b7a69c147a49377af917b
/src/main/java/com/mapper/ExamRepository.java
481e3e239794050863168bb69093cd9ef10abd04
[]
no_license
Youthjack/ExamSystem
531a439e46a55f3ce1ee9e7f25402db111baa4d7
052f9b6f070785034a96a7a4e74e8e70a236c149
refs/heads/master
2021-01-13T03:47:44.724008
2017-01-09T11:18:52
2017-01-09T11:18:52
77,193,628
0
2
null
2017-02-06T08:48:01
2016-12-23T03:11:07
HTML
UTF-8
Java
false
false
372
java
package com.mapper; import com.model.Exam; import com.model.StudentPaperPk; import org.springframework.data.jpa.repository.JpaRepository; import java.util.List; /** * Created by Jack on 2016/12/23. */ public interface ExamRepository extends JpaRepository<Exam,StudentPaperPk> { List<Exam> findByPkStudentId(int studentId); Exam findByPk(StudentPaperPk pk); }
c88dc32741d6b32360ca9295af28dacc9e62a508
5fb7436fbc998f88f0154170340d1b034dc3697f
/assignments/mod 11/Assignment-2/Solution.java
dcea3c7a38ca09dfa727276ad33b89b595b1a0ce
[]
no_license
gvnaakhilsurya/20186087_CSPP-2
6edf9116d7ddf76d011cd78dba387dab1ee24b85
1162f719825a18f73353ad4d190927ee8933bfcf
refs/heads/master
2020-03-27T08:23:16.741309
2019-01-31T12:57:44
2019-01-31T12:57:44
146,249,406
0
0
null
null
null
null
UTF-8
Java
false
false
19,890
java
import java.io.BufferedInputStream; import java.util.Scanner; //A Class is implemented for Student details /** *@author : manojbandari. * Class for student. */ class Student { /** * {string name}. */ private String name; /** * Constructs the object. * * @param name1 The name */ Student(final String name1) { //A constructor used to initialize the instance variables this.name = name1; } /** * Gets the name. * * @return The name. */ public String getName() { //Getter method which returns the value of instance variable return this.name; } /** * { function_description }. * * @param other The other * @return { description_of_the_return_value } */ @Override public boolean equals(final Object other) { //This method is to check if two students names are equal or not if (!(other instanceof Student)) { return false; } Student that = (Student) other; return this.getName().equals(that.getName()); } /** * { function_description }. * * @return { description_of_the_return_value } */ public int hashCode() { return 0; } /** * Returns a string representation of the object. * * @return String representation of the object. */ public String toString() { return this.name; } } /** * Class for solution. */ public final class Solution { /** * Constructs the object. */ private Solution() { } /** * { function_description }. * * @param stdin The stdin */ public static void executeListInteger(final Scanner stdin) { List<Integer> l = new List(); while (stdin.hasNext()) { // read the line String line = stdin.nextLine(); // split the line using space String[] tokens = line.split(" "); // based on the list operation invoke the corresponding method switch (tokens[0]) { case "add": if (tokens.length == 2) { String[] t = tokens[1].split(","); if (t.length == 1) { l.add(Integer.parseInt(tokens[1])); } } break; case "size": System.out.println(l.size()); break; case "print": System.out.println(l); break; case "remove": if (tokens.length == 2) { l.remove(Integer.parseInt(tokens[1])); } break; case "indexOf": if (tokens.length == 2) { System.out.println(l.indexOf(Integer.parseInt(tokens[1]))); } break; case "get": if (tokens.length == 2) { System.out.println(l.get(Integer.parseInt(tokens[1]))); } break; case "contains": if (tokens.length == 2) { System.out.println(l.contains(Integer.parseInt(tokens[1]))); } break; case "addAll": if (tokens.length == 2) { String[] t1 = tokens[1].split(","); Integer[] temp = new Integer[t1.length]; for (int i = 0; i < temp.length; i++) { temp[i] = Integer.parseInt(t1[i]); } l.addAll(temp); } break; case "removeAll": if (tokens.length == 2) { String[] t2 = tokens[1].split(","); Integer[] a = new Integer[t2.length]; for (int i = 0; i < t2.length; i++) { a[i] = Integer.parseInt(t2[i]); } l.removeAll(a); } break; case "subList": if (tokens.length != 2) { break; } String[] arrstring3 = tokens[1].split(","); List object = l.subList(Integer.parseInt(arrstring3[0]), Integer.parseInt(arrstring3[1])); if (object != null) { System.out.println(object); } break; case "equals": if (tokens.length == 2) { String[] lt = tokens[1].split(","); List l2 = new List(); for (int k = 0; k < lt.length; k++) { l2.add(Integer.parseInt(lt[k])); } System.out.println(l.equals(l2)); } break; case "clear": l.clear(); break; default: break; } } } /** * { function_description }. * * @param stdin The stdin */ public static void executeListDouble(final Scanner stdin) { List<Double> l = new List(); while (stdin.hasNext()) { // read the line String line = stdin.nextLine(); // split the line using space String[] tokens = line.split(" "); // based on the list operation invoke the corresponding method switch (tokens[0]) { case "add": if (tokens.length == 2) { String[] t = tokens[1].split(","); if (t.length == 1) { l.add(Double.parseDouble(tokens[1])); } } break; case "size": System.out.println(l.size()); break; case "print": System.out.println(l); break; case "remove": if (tokens.length == 2) { l.remove(Integer.parseInt(tokens[1])); } break; case "indexOf": if (tokens.length == 2) { System.out.println(l.indexOf(Double.parseDouble(tokens[1]))); } break; case "get": if (tokens.length == 2) { System.out.println(l.get(Integer.parseInt(tokens[1]))); } break; case "contains": if (tokens.length == 2) { System.out.println(l.contains(Double.parseDouble(tokens[1]))); } break; case "addAll": if (tokens.length == 2) { String[] t1 = tokens[1].split(","); Double[] temp = new Double[t1.length]; for (int i = 0; i < temp.length; i++) { temp[i] = Double.parseDouble(t1[i]); } l.addAll(temp); } break; case "removeAll": if (tokens.length == 2) { String[] t2 = tokens[1].split(","); Double[] a = new Double[t2.length]; for (int i = 0; i < t2.length; i++) { a[i] = Double.parseDouble(t2[i]); } l.removeAll(a); } break; case "subList": if (tokens.length != 2) { break; } String[] arrstring3 = tokens[1].split(","); List object = l.subList(Integer.parseInt(arrstring3[0]), Integer.parseInt(arrstring3[1])); if (object != null) { System.out.println(object); } break; case "equals": if (tokens.length == 2) { String[] lt = tokens[1].split(","); List l2 = new List(); for (int k = 0; k < lt.length; k++) { l2.add(Double.parseDouble(lt[k])); } System.out.println(l.equals(l2)); } break; case "clear": l.clear(); break; default: break; } } } /** * { function_description }. * @param stdin The stdin */ public static void executeListFloat(final Scanner stdin) { List<Float> l = new List(); while (stdin.hasNext()) { // read the line String line = stdin.nextLine(); // split the line using space String[] tokens = line.split(" "); // based on the list operation invoke the corresponding method switch (tokens[0]) { case "add": if (tokens.length == 2) { String[] t = tokens[1].split(","); if (t.length == 1) { l.add(Float.parseFloat(tokens[1])); } } break; case "size": System.out.println(l.size()); break; case "print": System.out.println(l); break; case "remove": if (tokens.length == 2) { l.remove(Integer.parseInt(tokens[1])); } break; case "indexOf": if (tokens.length == 2) { System.out.println(l.indexOf(Float.parseFloat(tokens[1]))); } break; case "get": if (tokens.length == 2) { System.out.println(l.get(Integer.parseInt(tokens[1]))); } break; case "contains": if (tokens.length == 2) { System.out.println(l.contains(Float.parseFloat(tokens[1]))); } break; case "addAll": if (tokens.length == 2) { String[] t1 = tokens[1].split(","); Float[] temp = new Float[t1.length]; for (int i = 0; i < temp.length; i++) { temp[i] = Float.parseFloat(t1[i]); } l.addAll(temp); } break; case "removeAll": if (tokens.length == 2) { String[] t2 = tokens[1].split(","); Float[] a = new Float[t2.length]; for (int i = 0; i < t2.length; i++) { a[i] = Float.parseFloat(t2[i]); } l.removeAll(a); } break; case "subList": if (tokens.length != 2) { break; } String[] arrstring3 = tokens[1].split(","); List object = l.subList(Integer.parseInt(arrstring3[0]), Integer.parseInt(arrstring3[1])); if (object != null) { System.out.println(object); } break; case "equals": if (tokens.length == 2) { String[] lt = tokens[1].split(","); List l2 = new List(); for (int k = 0; k < lt.length; k++) { l2.add(Float.parseFloat(lt[k])); } System.out.println(l.equals(l2)); } break; case "clear": l.clear(); break; default: break; } } } /** * { function_description }. * * @param stdin The stdin */ public static void executeListString(final Scanner stdin) { List<String> l = new List(); while (stdin.hasNext()) { // read the line String line = stdin.nextLine(); // split the line using space String[] tokens = line.split(" "); // based on the list operation invoke the corresponding method switch (tokens[0]) { case "add": if (tokens.length == 2) { String[] t = tokens[1].split(","); if (t.length == 1) { l.add(tokens[1]); } } break; case "size": System.out.println(l.size()); break; case "print": System.out.println(l); break; case "remove": if (tokens.length == 2) { l.remove(Integer.parseInt(tokens[1])); } break; case "indexOf": if (tokens.length == 2) { System.out.println(l.indexOf((tokens[1]))); } break; case "get": if (tokens.length == 2) { System.out.println(l.get(Integer.parseInt(tokens[1]))); } break; case "contains": if (tokens.length == 2) { System.out.println(l.contains((tokens[1]))); } break; case "addAll": if (tokens.length == 2) { String[] t1 = tokens[1].split(","); l.addAll(t1); } break; case "removeAll": if (tokens.length == 2) { String[] t2 = tokens[1].split(","); l.removeAll(t2); } break; case "subList": if (tokens.length != 2) { break; } String[] arrstring3 = tokens[1].split(","); List object = l.subList(Integer.parseInt(arrstring3[0]), Integer.parseInt(arrstring3[1])); if (object != null) { System.out.println(object); } break; case "equals": if (tokens.length == 2) { String[] lt = tokens[1].split(","); List l2 = new List(); for (int k = 0; k < lt.length; k++) { l2.add((lt[k])); } System.out.println(l.equals(l2)); } break; case "clear": l.clear(); break; default: break; } } } /** * { function_description }. * * @param stdin The stdin */ public static void executeListStudent(final Scanner stdin) { List<Student> l = new List(); while (stdin.hasNext()) { // read the line String line = stdin.nextLine(); // split the line using space String[] tokens = line.split(" "); // based on the list operation invoke the corresponding method switch (tokens[0]) { case "add": if (tokens.length == 2) { String[] t = tokens[1].split(","); if (t.length == 1) { l.add(new Student(tokens[1])); } } break; case "size": System.out.println(l.size()); break; case "print": System.out.println(l); break; case "remove": if (tokens.length == 2) { l.remove(Integer.parseInt(tokens[1])); } break; case "indexOf": if (tokens.length == 2) { System.out.println(l.indexOf(new Student(tokens[1]))); } break; case "get": if (tokens.length == 2) { System.out.println(l.get(Integer.parseInt(tokens[1]))); } break; case "contains": if (tokens.length == 2) { System.out.println(l.contains(new Student(tokens[1]))); } break; case "addAll": if (tokens.length == 2) { String[] t1 = tokens[1].split(","); Student[] students = new Student[t1.length]; for (int i = 0; i < t1.length; i++) { students[i] = new Student(t1[i]); } l.addAll(students); } break; case "removeAll": if (tokens.length == 2) { String[] t1 = tokens[1].split(","); Student[] students = new Student[t1.length]; for (int i = 0; i < t1.length; i++) { students[i] = new Student(t1[i]); } l.removeAll(students); } break; case "subList": if (tokens.length != 2) { break; } String[] arrstring3 = tokens[1].split(","); List object = l.subList(Integer.parseInt(arrstring3[0]), Integer.parseInt(arrstring3[1])); if (object != null) { System.out.println(object); } break; case "equals": if (tokens.length == 2) { String[] lt = tokens[1].split(","); List l2 = new List(); for (int k = 0; k < lt.length; k++) { l2.add((lt[k])); } System.out.println(l.equals(l2)); } break; case "clear": l.clear(); break; default: break; } } } /** * { function_description }. * * @param args The arguments */ public static void main(final String[] args) { // create an object of the list to invoke methods on it Scanner stdin = new Scanner(new BufferedInputStream(System.in)); String objectType = stdin.nextLine(); switch (objectType) { case "S"://This case will be executed for String type list executeListString(stdin); break; case "I"://This case will be executed for Integer type list executeListInteger(stdin); break; case "F"://This case will be executed for Float type list executeListFloat(stdin); break; case "C"://This case will be executed for Character type list executeListString(stdin); break; case "D"://This case will be executed for Double type list executeListDouble(stdin); break; case "O": //This case will be executed for Student type list //i.e to store List of Student Objects executeListStudent(stdin); break; default: break; } } }
1cc72ddbabb348f0b3d486bf3b83866e0728a97d
12c2849948659ffd8bb7c3752e3d19f9b27c25ac
/src/main/java/com/moicen/learning/single/Encode.java
db11b8f699e9836994814d162c529990000d2086
[]
no_license
Moicen/java-learning
07ad0f9c1fcb2fc06fd940d09eb1c9501a247fd3
50881ad575c469eaaa1f24b38b906ddd951d633e
refs/heads/master
2020-03-23T09:41:43.999643
2018-09-08T02:34:19
2018-09-08T02:34:19
141,403,338
0
0
null
null
null
null
UTF-8
Java
false
false
697
java
package com.moicen.learning.single; public class Encode { public static void main(String args[]) { String msg = "This is a test"; String encmsg = ""; String decmsg = ""; int key = 88; System.out.print("Original message: "); System.out.println(msg); for (int i = 0; i < msg.length(); i++) encmsg = encmsg + (char) (msg.charAt(i) ^ key); System.out.print("Encoded message: "); System.out.println(encmsg); for (int i = 0; i < msg.length(); i++) decmsg = decmsg + (char) (encmsg.charAt(i) ^ key); System.out.print("Decoded message: "); System.out.println(decmsg); } }
9c74e91cfdb65ed7e322c08e90f231d028dcf5ed
3da2d542f02632420fcca4279f9d0238c4597341
/Servlets/tomcat/work/Catalina/localhost/_/org/apache/jsp/index_jsp.java
eee95914fb3f2e116487a6c474c01932f3e34080
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "bzip2-1.0.6", "CDDL-1.0", "CPL-1.0", "Zlib", "EPL-1.0", "LZMA-exception", "LGPL-2.0-or-later", "GPL-2.0-only", "MIT" ]
permissive
FurySwordXD/Java1007
feb01a7936c15f050a4b332250dcbf87c85b9f26
ce4dd2440e6a0c59e3b3d6a73348e3c5d964f959
refs/heads/master
2022-10-31T13:09:06.061458
2020-06-04T07:01:18
2020-06-04T07:01:18
226,039,173
0
0
MIT
2022-10-04T23:58:49
2019-12-05T07:11:06
Java
UTF-8
Java
false
false
29,766
java
/* * Generated by the Jasper component of Apache Tomcat * Version: Apache Tomcat/7.0.103 * Generated at: 2020-05-03 07:17:16 UTC * Note: The last modified time of this file was set to * the last modified time of the source file after * generation to assist with modification tracking. */ package org.apache.jsp; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; public final class index_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { private static final javax.servlet.jsp.JspFactory _jspxFactory = javax.servlet.jsp.JspFactory.getDefaultFactory(); private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants; private volatile javax.el.ExpressionFactory _el_expressionfactory; private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager; public java.util.Map<java.lang.String,java.lang.Long> getDependants() { return _jspx_dependants; } public javax.el.ExpressionFactory _jsp_getExpressionFactory() { if (_el_expressionfactory == null) { synchronized (this) { if (_el_expressionfactory == null) { _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); } } } return _el_expressionfactory; } public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() { if (_jsp_instancemanager == null) { synchronized (this) { if (_jsp_instancemanager == null) { _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); } } } return _jsp_instancemanager; } public void _jspInit() { } public void _jspDestroy() { } public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException { final javax.servlet.jsp.PageContext pageContext; final javax.servlet.ServletContext application; final javax.servlet.ServletConfig config; javax.servlet.jsp.JspWriter out = null; final java.lang.Object page = this; javax.servlet.jsp.JspWriter _jspx_out = null; javax.servlet.jsp.PageContext _jspx_page_context = null; try { response.setContentType("text/html; charset=UTF-8"); pageContext = _jspxFactory.getPageContext(this, request, response, null, false, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); out = pageContext.getOut(); _jspx_out = out; out.write("\r\n"); out.write("\r\n"); java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy"); request.setAttribute("year", sdf.format(new java.util.Date())); request.setAttribute("tomcatUrl", "https://tomcat.apache.org/"); request.setAttribute("tomcatDocUrl", "/docs/"); request.setAttribute("tomcatExamplesUrl", "/examples/"); out.write("\r\n"); out.write("<!DOCTYPE html>\r\n"); out.write("<html lang=\"en\">\r\n"); out.write(" <head>\r\n"); out.write(" <meta charset=\"UTF-8\" />\r\n"); out.write(" <title>"); out.print(request.getServletContext().getServerInfo() ); out.write("</title>\r\n"); out.write(" <link href=\"favicon.ico\" rel=\"icon\" type=\"image/x-icon\" />\r\n"); out.write(" <link href=\"favicon.ico\" rel=\"shortcut icon\" type=\"image/x-icon\" />\r\n"); out.write(" <link href=\"tomcat.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n"); out.write(" </head>\r\n"); out.write("\r\n"); out.write(" <body>\r\n"); out.write(" <div id=\"wrapper\">\r\n"); out.write(" <div id=\"navigation\" class=\"curved container\">\r\n"); out.write(" <span id=\"nav-home\"><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("\">Home</a></span>\r\n"); out.write(" <span id=\"nav-hosts\"><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatDocUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("\">Documentation</a></span>\r\n"); out.write(" <span id=\"nav-config\"><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatDocUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("config/\">Configuration</a></span>\r\n"); out.write(" <span id=\"nav-examples\"><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatExamplesUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("\">Examples</a></span>\r\n"); out.write(" <span id=\"nav-wiki\"><a href=\"https://wiki.apache.org/tomcat/FrontPage\">Wiki</a></span>\r\n"); out.write(" <span id=\"nav-lists\"><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("lists.html\">Mailing Lists</a></span>\r\n"); out.write(" <span id=\"nav-help\"><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("findhelp.html\">Find Help</a></span>\r\n"); out.write(" <br class=\"separator\" />\r\n"); out.write(" </div>\r\n"); out.write(" <div id=\"asf-box\">\r\n"); out.write(" <h1>"); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${pageContext.servletContext.serverInfo}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("</h1>\r\n"); out.write(" </div>\r\n"); out.write(" <div id=\"upper\" class=\"curved container\">\r\n"); out.write(" <div id=\"congrats\" class=\"curved container\">\r\n"); out.write(" <h2>If you're seeing this, you've successfully installed Tomcat. Congratulations!</h2>\r\n"); out.write(" </div>\r\n"); out.write(" <div id=\"notice\">\r\n"); out.write(" <img src=\"tomcat.png\" alt=\"[tomcat logo]\" />\r\n"); out.write(" <div id=\"tasks\">\r\n"); out.write(" <h3>Recommended Reading:</h3>\r\n"); out.write(" <h4><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatDocUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("security-howto.html\">Security Considerations How-To</a></h4>\r\n"); out.write(" <h4><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatDocUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("manager-howto.html\">Manager Application How-To</a></h4>\r\n"); out.write(" <h4><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatDocUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("cluster-howto.html\">Clustering/Session Replication How-To</a></h4>\r\n"); out.write(" </div>\r\n"); out.write(" </div>\r\n"); out.write(" <div id=\"actions\">\r\n"); out.write(" <div class=\"button\">\r\n"); out.write(" <a class=\"container shadow\" href=\"/manager/status\"><span>Server Status</span></a>\r\n"); out.write(" </div>\r\n"); out.write(" <div class=\"button\">\r\n"); out.write(" <a class=\"container shadow\" href=\"/manager/html\"><span>Manager App</span></a>\r\n"); out.write(" </div>\r\n"); out.write(" <div class=\"button\">\r\n"); out.write(" <a class=\"container shadow\" href=\"/host-manager/html\"><span>Host Manager</span></a>\r\n"); out.write(" </div>\r\n"); out.write(" </div>\r\n"); out.write(" <br class=\"separator\" />\r\n"); out.write(" </div>\r\n"); out.write(" <div id=\"middle\" class=\"curved container\">\r\n"); out.write(" <h3>Developer Quick Start</h3>\r\n"); out.write(" <div class=\"col25\">\r\n"); out.write(" <div class=\"container\">\r\n"); out.write(" <p><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatDocUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("setup.html\">Tomcat Setup</a></p>\r\n"); out.write(" <p><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatDocUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("appdev/\">First Web Application</a></p>\r\n"); out.write(" </div>\r\n"); out.write(" </div>\r\n"); out.write(" <div class=\"col25\">\r\n"); out.write(" <div class=\"container\">\r\n"); out.write(" <p><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatDocUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("realm-howto.html\">Realms &amp; AAA</a></p>\r\n"); out.write(" <p><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatDocUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("jndi-datasource-examples-howto.html\">JDBC DataSources</a></p>\r\n"); out.write(" </div>\r\n"); out.write(" </div>\r\n"); out.write(" <div class=\"col25\">\r\n"); out.write(" <div class=\"container\">\r\n"); out.write(" <p><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatExamplesUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("\">Examples</a></p>\r\n"); out.write(" </div>\r\n"); out.write(" </div>\r\n"); out.write(" <div class=\"col25\">\r\n"); out.write(" <div class=\"container\">\r\n"); out.write(" <p><a href=\"https://wiki.apache.org/tomcat/Specifications\">Servlet Specifications</a></p>\r\n"); out.write(" <p><a href=\"https://wiki.apache.org/tomcat/TomcatVersions\">Tomcat Versions</a></p>\r\n"); out.write(" </div>\r\n"); out.write(" </div>\r\n"); out.write(" <br class=\"separator\" />\r\n"); out.write(" </div>\r\n"); out.write(" <div id=\"lower\">\r\n"); out.write(" <div id=\"low-manage\" class=\"\">\r\n"); out.write(" <div class=\"curved container\">\r\n"); out.write(" <h3>Managing Tomcat</h3>\r\n"); out.write(" <p>For security, access to the <a href=\"/manager/html\">manager webapp</a> is restricted.\r\n"); out.write(" Users are defined in:</p>\r\n"); out.write(" <pre>$CATALINA_HOME/conf/tomcat-users.xml</pre>\r\n"); out.write(" <p>In Tomcat 7.0 access to the manager application is split between\r\n"); out.write(" different users. &nbsp; <a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatDocUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("manager-howto.html\">Read more...</a></p>\r\n"); out.write(" <br />\r\n"); out.write(" <h4><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatDocUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("RELEASE-NOTES.txt\">Release Notes</a></h4>\r\n"); out.write(" <h4><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatDocUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("changelog.html\">Changelog</a></h4>\r\n"); out.write(" <h4><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("migration.html\">Migration Guide</a></h4>\r\n"); out.write(" <h4><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("security.html\">Security Notices</a></h4>\r\n"); out.write(" </div>\r\n"); out.write(" </div>\r\n"); out.write(" <div id=\"low-docs\" class=\"\">\r\n"); out.write(" <div class=\"curved container\">\r\n"); out.write(" <h3>Documentation</h3>\r\n"); out.write(" <h4><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatDocUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("\">Tomcat 7.0 Documentation</a></h4>\r\n"); out.write(" <h4><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatDocUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("config/\">Tomcat 7.0 Configuration</a></h4>\r\n"); out.write(" <h4><a href=\"https://wiki.apache.org/tomcat/FrontPage\">Tomcat Wiki</a></h4>\r\n"); out.write(" <p>Find additional important configuration information in:</p>\r\n"); out.write(" <pre>$CATALINA_HOME/RUNNING.txt</pre>\r\n"); out.write(" <p>Developers may be interested in:</p>\r\n"); out.write(" <ul>\r\n"); out.write(" <li><a href=\"https://tomcat.apache.org/bugreport.html\">Tomcat 7.0 Bug Database</a></li>\r\n"); out.write(" <li><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatDocUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("api/index.html\">Tomcat 7.0 JavaDocs</a></li>\r\n"); out.write(" <li><a href=\"https://github.com/apache/tomcat/tree/7.0.x\">Tomcat 7.0 Git Repository at GitHub</a></li>\r\n"); out.write(" </ul>\r\n"); out.write(" </div>\r\n"); out.write(" </div>\r\n"); out.write(" <div id=\"low-help\" class=\"\">\r\n"); out.write(" <div class=\"curved container\">\r\n"); out.write(" <h3>Getting Help</h3>\r\n"); out.write(" <h4><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("faq/\">FAQ</a> and <a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("lists.html\">Mailing Lists</a></h4>\r\n"); out.write(" <p>The following mailing lists are available:</p>\r\n"); out.write(" <ul>\r\n"); out.write(" <li id=\"list-announce\"><strong><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("lists.html#tomcat-announce\">tomcat-announce</a><br />\r\n"); out.write(" Important announcements, releases, security vulnerability notifications. (Low volume).</strong>\r\n"); out.write(" </li>\r\n"); out.write(" <li><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("lists.html#tomcat-users\">tomcat-users</a><br />\r\n"); out.write(" User support and discussion\r\n"); out.write(" </li>\r\n"); out.write(" <li><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("lists.html#taglibs-user\">taglibs-user</a><br />\r\n"); out.write(" User support and discussion for <a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("taglibs/\">Apache Taglibs</a>\r\n"); out.write(" </li>\r\n"); out.write(" <li><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("lists.html#tomcat-dev\">tomcat-dev</a><br />\r\n"); out.write(" Development mailing list, including commit messages\r\n"); out.write(" </li>\r\n"); out.write(" </ul>\r\n"); out.write(" </div>\r\n"); out.write(" </div>\r\n"); out.write(" <br class=\"separator\" />\r\n"); out.write(" </div>\r\n"); out.write(" <div id=\"footer\" class=\"curved container\">\r\n"); out.write(" <div class=\"col20\">\r\n"); out.write(" <div class=\"container\">\r\n"); out.write(" <h4>Other Downloads</h4>\r\n"); out.write(" <ul>\r\n"); out.write(" <li><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("download-connectors.cgi\">Tomcat Connectors</a></li>\r\n"); out.write(" <li><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("download-native.cgi\">Tomcat Native</a></li>\r\n"); out.write(" <li><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("taglibs/\">Taglibs</a></li>\r\n"); out.write(" <li><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatDocUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("deployer-howto.html\">Deployer</a></li>\r\n"); out.write(" </ul>\r\n"); out.write(" </div>\r\n"); out.write(" </div>\r\n"); out.write(" <div class=\"col20\">\r\n"); out.write(" <div class=\"container\">\r\n"); out.write(" <h4>Other Documentation</h4>\r\n"); out.write(" <ul>\r\n"); out.write(" <li><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("connectors-doc/\">Tomcat Connectors</a></li>\r\n"); out.write(" <li><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("connectors-doc/\">mod_jk Documentation</a></li>\r\n"); out.write(" <li><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("native-doc/\">Tomcat Native</a></li>\r\n"); out.write(" <li><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatDocUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("deployer-howto.html\">Deployer</a></li>\r\n"); out.write(" </ul>\r\n"); out.write(" </div>\r\n"); out.write(" </div>\r\n"); out.write(" <div class=\"col20\">\r\n"); out.write(" <div class=\"container\">\r\n"); out.write(" <h4>Get Involved</h4>\r\n"); out.write(" <ul>\r\n"); out.write(" <li><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("getinvolved.html\">Overview</a></li>\r\n"); out.write(" <li><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("source.html\">Source Repositories</a></li>\r\n"); out.write(" <li><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("lists.html\">Mailing Lists</a></li>\r\n"); out.write(" <li><a href=\"https://wiki.apache.org/tomcat/FrontPage\">Wiki</a></li>\r\n"); out.write(" </ul>\r\n"); out.write(" </div>\r\n"); out.write(" </div>\r\n"); out.write(" <div class=\"col20\">\r\n"); out.write(" <div class=\"container\">\r\n"); out.write(" <h4>Miscellaneous</h4>\r\n"); out.write(" <ul>\r\n"); out.write(" <li><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("contact.html\">Contact</a></li>\r\n"); out.write(" <li><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("legal.html\">Legal</a></li>\r\n"); out.write(" <li><a href=\"https://www.apache.org/foundation/sponsorship.html\">Sponsorship</a></li>\r\n"); out.write(" <li><a href=\"https://www.apache.org/foundation/thanks.html\">Thanks</a></li>\r\n"); out.write(" </ul>\r\n"); out.write(" </div>\r\n"); out.write(" </div>\r\n"); out.write(" <div class=\"col20\">\r\n"); out.write(" <div class=\"container\">\r\n"); out.write(" <h4>Apache Software Foundation</h4>\r\n"); out.write(" <ul>\r\n"); out.write(" <li><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("whoweare.html\">Who We Are</a></li>\r\n"); out.write(" <li><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("heritage.html\">Heritage</a></li>\r\n"); out.write(" <li><a href=\"https://www.apache.org\">Apache Home</a></li>\r\n"); out.write(" <li><a href=\""); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${tomcatUrl}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write("resources.html\">Resources</a></li>\r\n"); out.write(" </ul>\r\n"); out.write(" </div>\r\n"); out.write(" </div>\r\n"); out.write(" <br class=\"separator\" />\r\n"); out.write(" </div>\r\n"); out.write(" <p class=\"copyright\">Copyright &copy;1999-"); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${year}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)); out.write(" Apache Software Foundation. All Rights Reserved</p>\r\n"); out.write(" </div>\r\n"); out.write(" </body>\r\n"); out.write("\r\n"); out.write("</html>\r\n"); } catch (java.lang.Throwable t) { if (!(t instanceof javax.servlet.jsp.SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { if (response.isCommitted()) { out.flush(); } else { out.clearBuffer(); } } catch (java.io.IOException e) {} if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } } }
e8f60c09719324f0ed75db4e6cca365d3c330dbb
1629e37bba65c44f8cf5e88d73c71870089041a4
/JAVA基础/day19/代码/day19/src/cn/itcast/file/Demo3.java
2a8d3906b1fa834ed355115a39633041a07cd01c
[]
no_license
15529343201/Java-Web
e202e242663911420879685c6762c8d232ef5d61
15886604aa7b732d42f7f5783f73766da34923e2
refs/heads/master
2021-01-19T08:50:32.816256
2019-03-28T23:34:31
2019-03-28T23:34:31
87,683,430
0
0
null
null
null
null
GB18030
Java
false
false
1,665
java
package cn.itcast.file; import java.io.File; import java.io.IOException; /* 创建: createNewFile() 在指定位置创建一个空文件,成功就返回true,如果已存在就不创建然后返回false mkdir() 在指定位置创建目录,这只会创建最后一级目录,如果上级目录不存在就抛异常。 mkdirs() 在指定位置创建目录,这会创建路径中所有不存在的目录。 renameTo(File dest) 重命名文件或文件夹,也可以操作非空的文件夹,文件不同时相当于文件的剪切,剪切时候不能操作非空的文件夹。移动/重命名成功则返回true,失败则返回false。 */ public class Demo3 { public static void main(String[] args) throws IOException { File file = new File("F:\\aa"); System.out.println("创建成功了吗?"+file.createNewFile()); //createNewFile 创建一个指定的文件,如果该文件存在了,则不会再创建,如果还没有存在则创建。创建成功返回true,否则返回false。 File dir = new File("F:\\a.txt"); System.out.println("创建文件夹成功吗?"+dir.mkdir()); // mkdir 创建一个单级文件夹, dir = new File("F:\\aa\\bb"); System.out.println("创建多级文件夹:"+ dir.mkdirs()); //renameTo() 如果目标文件与源文件是在同一个路径下,那么renameTo的作用是重命名, 如果目标文件与源文件不是在同一个路径下,那么renameTo的作用就是剪切,而且还不能操作文件夹。 File destFile = new File("F:\\aaaaaaw"); System.out.println("重命名成功吗?"+file.renameTo(destFile)) ; } }
55e5a90025fd9f3f8d2bf586515ab28c37d90e1e
91e72ef337a34eb7e547fa96d99fca5a4a6dc89e
/subjects/TridentSDK/results/evosuite/1564520560/0022/evosuite-tests/net/tridentsdk/world/opt/WorldBorder$DoubleXZ_ESTest_scaffolding.java
6ace9bf02eb7770cb17e54d2880b1d83824c614c
[]
no_license
STAMP-project/descartes-amplification-experiments
deda5e2f1a122b9d365f7c76b74fb2d99634aad4
a5709fd78bbe8b4a4ae590ec50704dbf7881e882
refs/heads/master
2021-06-27T04:13:17.035471
2020-10-14T08:17:05
2020-10-14T08:17:05
169,711,716
0
0
null
2020-10-14T08:17:07
2019-02-08T09:32:43
Java
UTF-8
Java
false
false
3,928
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Tue Jul 30 21:30:17 GMT 2019 */ package net.tridentsdk.world.opt; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; import org.junit.AfterClass; import org.evosuite.runtime.sandbox.Sandbox; import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; @EvoSuiteClassExclude public class WorldBorder$DoubleXZ_ESTest_scaffolding { @org.junit.Rule public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); @BeforeClass public static void initEvoSuiteFramework() { org.evosuite.runtime.RuntimeSettings.className = "net.tridentsdk.world.opt.WorldBorder$DoubleXZ"; org.evosuite.runtime.GuiSupport.initialize(); org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); org.evosuite.runtime.classhandling.JDKClassResetter.init(); setSystemProperties(); initializeClasses(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); } @AfterClass public static void clearEvoSuiteFramework(){ Sandbox.resetDefaultSecurityManager(); java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); } @Before public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); setSystemProperties(); org.evosuite.runtime.GuiSupport.setHeadless(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); org.evosuite.runtime.agent.InstrumentingAgent.activate(); } @After public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); org.evosuite.runtime.classhandling.JDKClassResetter.reset(); resetClasses(); org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); } public static void setSystemProperties() { java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); java.lang.System.setProperty("user.dir", "/home/ubuntu/oscar/descartes-evosuite/subjects/TridentSDK/results/evosuite/1564520560/0022"); java.lang.System.setProperty("java.io.tmpdir", "/tmp"); } private static void initializeClasses() { org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(WorldBorder$DoubleXZ_ESTest_scaffolding.class.getClassLoader() , "net.tridentsdk.world.opt.WorldBorder$DoubleXZ", "net.tridentsdk.world.opt.WorldBorder" ); } private static void resetClasses() { org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(WorldBorder$DoubleXZ_ESTest_scaffolding.class.getClassLoader()); org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( "net.tridentsdk.world.opt.WorldBorder$DoubleXZ" ); } }
8270d5a9033e664b88d9fd1f7ea2e2a765982899
3277fc9085abe8357d40a28dfa10df5fb19bf43d
/xtomframework/src/main/java/xtom/frame/XtomObject.java
21387c4f80ce410e1469598eb1b60abb108e47c8
[]
no_license
690810892/km_zhongxiang
0c03d7384ccb420c62ff8b59a005fdc72c63c415
2a73e5073e7d28bc260bb41ff263ee12edfb077e
refs/heads/master
2020-03-17T17:32:45.776837
2018-05-17T09:48:21
2018-05-17T09:48:25
133,792,586
0
0
null
null
null
null
UTF-8
Java
false
false
2,006
java
package xtom.frame; import org.json.JSONException; import org.json.JSONObject; import xtom.frame.util.XtomBaseUtil; import xtom.frame.util.XtomLogger; /** * 相当于Object,集成了log_v(msg)等打印方法以及println(Object)。 */ public class XtomObject { /** * 打印TAG,类名 */ private String TAG; public XtomObject() { TAG = getLogTag(); } /** * 获取打印TAG,即类名 * * @return */ private String getLogTag() { return getClass().getSimpleName(); } /** * 打印v级别信息 * * @param msg */ protected void log_v(String msg) { XtomLogger.v(TAG, msg); } /** * 打印d级别信息 * * @param msg */ protected void log_d(String msg) { XtomLogger.d(TAG, msg); } /** * 打印i级别信息 * * @param msg */ protected void log_i(String msg) { XtomLogger.i(TAG, msg); } /** * 打印w级别信息 * * @param msg */ protected void log_w(String msg) { XtomLogger.w(TAG, msg); } /** * 打印e级别信息 * * @param msg */ protected void log_e(String msg) { XtomLogger.e(TAG, msg); } /** * 打印 * * @param msg */ protected void println(Object msg) { XtomLogger.println(msg); } /** * 解析时,判断是否为空 * * @param jsonObject * @param s * @return * @throws JSONException */ protected String get(JSONObject jsonObject, String s) throws JSONException { if (!jsonObject.isNull(s)) { return jsonObject.getString(s); } return null; } /** * 解析时,判断是否为空 * * @param jsonObject * @param s * @return 若为空返回0 * @throws JSONException */ protected int getInt(JSONObject jsonObject, String s) throws JSONException { if (!jsonObject.isNull(s)) { return jsonObject.getInt(s); } return 0; } /** * 判断字符串是否为空 * * @param str * @return true如果该字符串为null或者"",否则false */ protected boolean isNull(String str) { return XtomBaseUtil.isNull(str); } }
a5e68511f0eaeb4dd21e64b41bb2b121d926534c
5e09739061e94ace7fb970dd208ef669f0623bd2
/app/src/main/java/com/kudkud32/ramalanjodoh/service/UserService.java
f117e778642d5bb23491ac1ce4cceb2863e3370e
[]
no_license
joedha8/RamalanJodoh
7042bd5fa7783642f0fc4dea84b9f3b23736f600
a3a7a561816a237b7a3fe670139e899c02c8ecf9
refs/heads/master
2021-01-12T06:13:07.647321
2018-05-21T09:14:25
2018-05-21T09:14:25
77,328,390
0
1
null
null
null
null
UTF-8
Java
false
false
681
java
package com.kudkud32.ramalanjodoh.service; import com.kudkud32.ramalanjodoh.common.ApiUrl; import com.kudkud32.ramalanjodoh.model.User; import retrofit2.Call; /** * Created by joedhaalzelvin on 13/05/18. */ public class UserService extends BaseService<UserApi> { private static UserService instance; public static UserService getInstance() { if (instance == null) { instance = new UserService(); } return instance; } public UserService() { setApi(UserApi.class); } public Call<User> login(String username, String password) { return getApi().login(ApiUrl.LOGIN_API, username, password); } }
0d17ef5cbdc4329bd178977d18c3edf72d7b1372
1b5e0a35df398afa907daf0eb30df20adf82776e
/src/main/java/com/kim/app/ApplicationMainClass.java
1c2035069101fbc6e7b31bb2f338ae4aada84fcb
[]
no_license
pracct0/test-spring-project
7315570a833790775a3417b6452b8cdd5a6671cf
4edac91304c6c0ad10488b5390527ad66b290d96
refs/heads/master
2020-03-27T21:54:19.369591
2018-12-08T14:44:32
2018-12-08T14:44:32
147,185,330
0
0
null
null
null
null
UTF-8
Java
false
false
1,370
java
package com.kim.app; import org.jboss.logging.Logger; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.data.jpa.repository.config.EnableJpaAuditing; @SpringBootApplication @EnableJpaAuditing public class ApplicationMainClass extends SpringBootServletInitializer implements ApplicationRunner, CommandLineRunner { private static Logger logger = Logger.getLogger(ApplicationMainClass.class.getName()); public static void main(String[] args) { SpringApplication.run(ApplicationMainClass.class, args); } @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(ApplicationMainClass.class); } @Override public void run(ApplicationArguments args) throws Exception { logger.debug("#####::Application Runner."); } @Override public void run(String... args) throws Exception { logger.debug("#####::CommandLine Runner."); } }
4f8994490ba112a6e96bc7b828e0bc011ba455b5
e1ec2852c77d9a450862981cd8cf075d70625510
/allinone/src/com/gameif/portal/dao/impl/MediaKindMstDaoImpl.java
b96e375ee771d2985d2ad8d64b6544592bc72b6f
[]
no_license
heitara/webbasedev
be827451ff4bcabca14fb2ee280d5412acad1af2
ea5e79d7abecc8d8386d000f13c8f6029c1279dd
refs/heads/master
2016-09-05T10:21:00.807486
2014-04-21T10:41:49
2014-04-21T10:41:49
38,759,859
0
0
null
null
null
null
UTF-8
Java
false
false
312
java
package com.gameif.portal.dao.impl; import com.gameif.common.dao.impl.AbstractBaseDao; import com.gameif.portal.dao.IMediaKindMstDao; import com.gameif.portal.entity.MediaKindMst; public class MediaKindMstDaoImpl extends AbstractBaseDao<MediaKindMst, MediaKindMst> implements IMediaKindMstDao { }
[ "mylightweb@3d4058ee-63e8-11de-9f54-6d4fae1110e3" ]
mylightweb@3d4058ee-63e8-11de-9f54-6d4fae1110e3
8cd544a0f9b2b994d6e82c6a9ef08d002d2d652e
c6ba59cc5ef68f70db430a3b43fececce12a2675
/327.CountOfRangeSum/Solution.java
67fc62afb3540808b7d388d35383ca627bff7f38
[]
no_license
0Kelvins/LeetCode
ef59f6111e8eb9b8286bf81bd02ffaf0e0351cb5
8aafd1ed8a0d57aad45f2fafc178fb001a7096ca
refs/heads/master
2022-10-23T18:33:07.018470
2022-08-04T05:42:26
2022-08-04T05:42:26
110,679,725
0
0
null
null
null
null
UTF-8
Java
false
false
1,758
java
import java.util.*; /** * 327. Count of Range Sum * Hard */ public class Solution { public int countRangeSum(int[] nums, int lower, int upper) { int n = nums.length; long[] prefixSum = new long[n + 1]; for (int i = 1; i <= n; i++) { prefixSum[i] = prefixSum[i - 1] + nums[i - 1]; } Set<Long> set = new TreeSet<>(); for (long s : prefixSum) { set.add(s); set.add(s - upper); set.add(s - lower); } Map<Long, Integer> map = new HashMap<>(); int i = 0; for (Long s : set) { map.put(s, i++); } int[] bit = new int[i + 1]; int count = 0; //lower <= s[i]-s[j] <= upper, s[i] - upper <= s[j] <= s[i] - lower for (long p : prefixSum) { int l = map.get(p - upper), r = map.get(p - lower); count += query(bit, r + 1) - query(bit, l); update(bit, map.get(p) + 1, 1); } return count; } private int lowbit(int x) { return x & (-x); } private int query(int[] bit, int i) { int s = 0; while (i > 0) { s += bit[i]; i -= lowbit(i); } return s; } private void update(int[] bit, int i, int val) { while (i < bit.length) { bit[i] += val; i += lowbit(i); } } public static void main(String[] args) { int[][] nums = { { -2, 5, -1 }, {0} }; int[] lower = { -2, 0 }; int[] upper = { 2, 0 }; Solution sol = new Solution(); for (int i = 0; i < upper.length; i++) { System.out.println(sol.countRangeSum(nums[i], lower[i], upper[i])); } } }
dafffc47a8ca9c59a9d07d3f9778ab64dd676cdb
80873a74a3a7c1a07a2b619930e4e708388fb048
/src/jp/mosp/time/dao/settings/impl/TmdTotalAbsenceDao.java
056170376d5163f26ab00ef6decced912959a847
[]
no_license
ekyan/ccmosp
7fb6272e2f53923b19e46b17a29d4b32a23b1319
924a257e3ecb81707e03dfc81becbf380dd52be3
refs/heads/master
2020-04-11T09:31:35.991354
2018-12-13T20:48:38
2018-12-13T20:48:38
161,681,437
1
0
null
null
null
null
UTF-8
Java
false
false
6,839
java
/* * MosP - Mind Open Source Project http://www.mosp.jp/ * Copyright (C) MIND Co., Ltd. http://www.e-mind.co.jp/ * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Affero General Public License * as published by the Free Software Foundation, either version 3 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package jp.mosp.time.dao.settings.impl; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import jp.mosp.framework.base.BaseDto; import jp.mosp.framework.base.BaseDtoInterface; import jp.mosp.framework.base.MospException; import jp.mosp.platform.base.PlatformDao; import jp.mosp.time.dao.settings.TotalAbsenceDaoInterface; import jp.mosp.time.dto.settings.TotalAbsenceDtoInterface; import jp.mosp.time.dto.settings.impl.TmdTotalAbsenceDto; /** * 欠勤集計データDTOクラス。 */ public class TmdTotalAbsenceDao extends PlatformDao implements TotalAbsenceDaoInterface { /** * 欠勤集計データ。 */ public static final String TABLE = "tmd_total_absence"; /** * レコード識別ID。 */ public static final String COL_TMD_TOTAL_ABSENCE_ID = "tmd_total_absence_id"; /** * 個人ID。 */ public static final String COL_PERSONAL_ID = "personal_id"; /** * 年。 */ public static final String COL_CALCULATION_YEAR = "calculation_year"; /** * 月。 */ public static final String COL_CALCULATION_MONTH = "calculation_month"; /** * 欠勤コード。 */ public static final String COL_ABSENCE_CODE = "absence_code"; /** * 欠勤日数。 */ public static final String COL_TIMES = "times"; /** * 欠勤時間数。 */ public static final String COL_HOURS = "hours"; /** * キー。 */ public static final String KEY_1 = COL_TMD_TOTAL_ABSENCE_ID; /** * コンストラクタ。 */ public TmdTotalAbsenceDao() { } @Override public void initDao() { // 処理無し } @Override public BaseDto mapping() throws MospException { TmdTotalAbsenceDto dto = new TmdTotalAbsenceDto(); dto.setTmdTotalAbsenceId(getLong(COL_TMD_TOTAL_ABSENCE_ID)); dto.setPersonalId(getString(COL_PERSONAL_ID)); dto.setCalculationYear(getInt(COL_CALCULATION_YEAR)); dto.setCalculationMonth(getInt(COL_CALCULATION_MONTH)); dto.setAbsenceCode(getString(COL_ABSENCE_CODE)); dto.setTimes(getDouble(COL_TIMES)); dto.setHours(getInt(COL_HOURS)); mappingCommonInfo(dto); return dto; } @Override public List<TotalAbsenceDtoInterface> mappingAll() throws MospException { List<TotalAbsenceDtoInterface> all = new ArrayList<TotalAbsenceDtoInterface>(); while (next()) { all.add((TotalAbsenceDtoInterface)mapping()); } return all; } @Override public int update(BaseDtoInterface baseDto) throws MospException { try { index = 1; prepareStatement(getUpdateQuery(getClass())); setParams(baseDto, false); TotalAbsenceDtoInterface dto = (TotalAbsenceDtoInterface)baseDto; setParam(index++, dto.getTmdTotalAbsenceId()); executeUpdate(); chkUpdate(1); return cnt; } catch (Throwable e) { throw new MospException(e); } finally { releaseResultSet(); releasePreparedStatement(); } } @Override public int delete(BaseDtoInterface baseDto) throws MospException { try { index = 1; prepareStatement(getDeleteQuery(getClass())); TotalAbsenceDtoInterface dto = (TotalAbsenceDtoInterface)baseDto; setParam(index++, dto.getTmdTotalAbsenceId()); executeUpdate(); chkDelete(1); return cnt; } catch (Throwable e) { throw new MospException(e); } finally { releaseResultSet(); releasePreparedStatement(); } } @Override public void setParams(BaseDtoInterface baseDto, boolean isInsert) throws MospException { TotalAbsenceDtoInterface dto = (TotalAbsenceDtoInterface)baseDto; setParam(index++, dto.getTmdTotalAbsenceId()); setParam(index++, dto.getPersonalId()); setParam(index++, dto.getCalculationYear()); setParam(index++, dto.getCalculationMonth()); setParam(index++, dto.getAbsenceCode()); setParam(index++, dto.getTimes()); setParam(index++, dto.getHours()); setCommonParams(baseDto, isInsert); } @Override public Map<String, Object> getParamsMap() { return new HashMap<String, Object>(); } @Override public TotalAbsenceDtoInterface findForKey(String personalId, int calculationYear, int calculationMonth, String absenceCode) throws MospException { try { index = 1; StringBuffer sb = getSelectQuery(getClass()); sb.append(where()); sb.append(deleteFlagOff()); sb.append(and()); sb.append(equal(COL_PERSONAL_ID)); sb.append(and()); sb.append(equal(COL_CALCULATION_YEAR)); sb.append(and()); sb.append(equal(COL_CALCULATION_MONTH)); sb.append(and()); sb.append(equal(COL_ABSENCE_CODE)); prepareStatement(sb.toString()); setParam(index++, personalId); setParam(index++, calculationYear); setParam(index++, calculationMonth); setParam(index++, absenceCode); executeQuery(); TotalAbsenceDtoInterface dto = null; if (next()) { dto = (TotalAbsenceDtoInterface)mapping(); } return dto; } catch (Throwable e) { throw new MospException(e); } finally { releaseResultSet(); releasePreparedStatement(); } } @Override public List<TotalAbsenceDtoInterface> findForList(String personalId, int calculationYear, int calculationMonth) throws MospException { try { index = 1; StringBuffer sb = getSelectQuery(getClass()); sb.append(where()); sb.append(deleteFlagOff()); sb.append(and()); sb.append(equal(COL_PERSONAL_ID)); sb.append(and()); sb.append(equal(COL_CALCULATION_YEAR)); sb.append(and()); sb.append(equal(COL_CALCULATION_MONTH)); sb.append(getOrderByColumn(COL_ABSENCE_CODE)); prepareStatement(sb.toString()); setParam(index++, personalId); setParam(index++, calculationYear); setParam(index++, calculationMonth); executeQuery(); return mappingAll(); } catch (Throwable e) { throw new MospException(e); } finally { releaseResultSet(); releasePreparedStatement(); } } }
df97ca75a4adb4ca6130df03ab8ad4c222cdb8f5
8f913daf0dcaa63101a75a5e3dbf7a48dc8a6518
/bizcore/WEB-INF/hfgw_core_src/com/doublechaintech/hfgw/channel/ChannelNotFoundException.java
2bb1e229079b3d6363224198c7329e6c4db2a03c
[]
no_license
doublechaintech/hfgw-biz-suite
e09c10ccdcc5dc85ff4753f0902f8f75f80c3a3b
201a3ff6f46ed347b288c2b5512adeb8ec584e49
refs/heads/master
2021-07-08T23:37:06.886710
2020-04-03T05:34:07
2020-04-03T05:34:07
222,888,857
0
0
null
2021-01-05T17:10:18
2019-11-20T08:33:41
Java
UTF-8
Java
false
false
296
java
package com.doublechaintech.hfgw.channel; import com.doublechaintech.hfgw.EntityNotFoundException; public class ChannelNotFoundException extends EntityNotFoundException { private static final long serialVersionUID = 1L; public ChannelNotFoundException(String string) { super(string); } }
bd18cc42b982791fdc62b2a9468f7c780c4bd1dd
b1979f178fe4c13b6e6b82f75acc012c8e327412
/Venice/Venice-Interface-Model/src/main/java/com/gdn/venice/facade/finance/fundsin/FundsInReconciliationHelperSessionEJBRemote.java
01b4f7774054980b7c23ef7695a828f773c9dc31
[ "Apache-2.0" ]
permissive
yauritux/venice-legacy
57ce5ff6c37dcb4e6efd299975326101c7ef6bd5
0a04259bed3a3564b2d6663b663fd8901fb67e3c
refs/heads/master
2016-09-06T12:04:43.249545
2013-12-10T18:47:09
2013-12-10T18:47:09
14,918,264
1
0
null
null
null
null
UTF-8
Java
false
false
1,660
java
package com.gdn.venice.facade.finance.fundsin; import java.util.ArrayList; import java.util.List; import javax.ejb.Remote; import com.gdn.venice.persistence.FinArFundsInReconRecord; import com.gdn.venice.persistence.FinArFundsInReport; /** * Session bean remote interface for finance reconciliation helper bean. * * <p> * <b>author:</b> <a href="mailto:[email protected]">David Forden</a> * <p> * <b>version:</b> 1.0 * <p> * <b>since:</b> 2011 */ @Remote public interface FundsInReconciliationHelperSessionEJBRemote { /** * Deletes a funds-in report based on the report identifier * which is part of the description stored with the report. * * Note that several other actions and validations need to be applied. * 1) Restrict deletion * o if the reports hits a record referencing an order with more than one payment * o if the order is in any status other than "C" * o any recon record in the report has been processed in any way * 2) Update fin_ar_funds_in_recon_record (each record linked to the file) * o reconcilliation_record_timestamp = null * o order_payment_id = null * o payment_report_id = null * o provider_report_payment_date = null * o provider_report_payment_id = null * o provider_report_paid_amount = null * o provider_report_fee_amount = null * o remaining_balance_amount = CALCULATED * o payment_confirmation_number = null * o recon_result_id = 4 * * @param bank * @param reportType * @param reportIdentifier * @return */ public Boolean deleteFundsInReport(List<FinArFundsInReport> finArFundsInReportRecordList); }
496eba3da23b684312858c23feb76ab4c916315f
dd32d74c2851e0f8ac81a0f20b965eb1bd3fc50a
/src/main/java/org/example/rabbitTutorial/Worker.java
828d7cea3992cdb343f957a0e9f5df025b2beee7
[]
no_license
miyeon396/rabbitmq
6139c97c75f1f48d2c519bdd9bdf33bf6c4d7672
9a366a42a5d969fc3ab9709573e62abe5429fe5b
refs/heads/master
2023-08-17T22:25:04.305424
2021-09-27T09:40:09
2021-09-27T09:40:09
398,973,560
1
0
null
null
null
null
UTF-8
Java
false
false
1,606
java
package org.example.rabbitTutorial; import com.rabbitmq.client.Channel; import com.rabbitmq.client.Connection; import com.rabbitmq.client.ConnectionFactory; import com.rabbitmq.client.DeliverCallback; public class Worker { private static final String TASK_QUEUE_NAME = "task_queue"; public static void main(String[] argv) throws Exception { ConnectionFactory factory = new ConnectionFactory(); final Connection connection = factory.newConnection(); final Channel channel = connection.createChannel(); channel.queueDeclare(TASK_QUEUE_NAME, true, false, false, null); System.out.println(" [*] Waiting for messages. To exit press CTRL+C"); channel.basicQos(2); DeliverCallback deliverCallback = (consumerTag, delivery) -> { String message = new String(delivery.getBody(), "UTF-8"); System.out.println(" [x] Received '" + message + "'"); try { doWork(message); } finally { System.out.println(" [x] Done"); channel.basicAck(delivery.getEnvelope().getDeliveryTag(), false); } }; channel.basicConsume(TASK_QUEUE_NAME, false, deliverCallback, consumerTag -> { }); } private static void doWork(String task) { for (char ch : task.toCharArray()) { if (ch == '.') { try { Thread.sleep(1000); } catch (InterruptedException _ignored) { Thread.currentThread().interrupt(); } } } } }
e589209710f2f41ade62ab203fde40060035fd4b
bcfcaf6649633f886c5385e87c53f4ebae3adb38
/SanPedrito/src/sanpedrito/ui/SanPedrito.java
6a81856d51d1ced866f95837dc7f45ef43c61e8a
[]
no_license
ArturoGJ/SanPedrito
6ff2c70d4f48abb6a2240351f779dcecd59f0ee6
64d402f185853dae4cf7d82baf63f76bbcac3ddb
refs/heads/master
2020-06-13T20:37:08.492802
2019-10-22T17:30:16
2019-10-22T17:30:16
194,780,862
0
0
null
null
null
null
UTF-8
Java
false
false
615
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 sanpedrito.ui; import javafx.application.Application; import javafx.stage.Stage; /** * * @author Arturo */ public class SanPedrito extends Application { @Override public void start(Stage primaryStage) { new Login(); } /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } }
4935c2239ef3c85b1fd987cfd805fea3719e6430
314a0e6d8e6b52b0272cfb998738d646977b3c2e
/web/web-base/src/main/java/org/visallo/web/routes/element/ElementGetAcl.java
7af7d1da2b33c1f38f139773b924582ddd8ae1b8
[ "Apache-2.0" ]
permissive
ndjido/visallo
8fda0218b551b92cf33b1ff6fcd7b47300ff8d2f
5a1d8b702aaa1bbbbf64f3316ebb3a8dd1f317fb
refs/heads/master
2021-01-16T22:50:58.412439
2016-06-29T13:28:32
2016-06-29T13:28:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,142
java
package org.visallo.web.routes.element; import com.v5analytics.webster.ParameterizedHandler; import com.v5analytics.webster.annotations.Handle; import com.v5analytics.webster.annotations.Required; import org.vertexium.Authorizations; import org.vertexium.Element; import org.vertexium.ElementType; import org.vertexium.Graph; import org.visallo.core.exception.VisalloException; import org.visallo.core.exception.VisalloResourceNotFoundException; import org.visallo.core.model.ontology.OntologyRepository; import org.visallo.core.security.ACLProvider; import org.visallo.core.user.User; import org.visallo.web.clientapi.model.ClientApiElementAcl; import javax.servlet.http.HttpServletRequest; public abstract class ElementGetAcl implements ParameterizedHandler { private Graph graph; private OntologyRepository ontologyRepository; private ACLProvider aclProvider; private ElementType elementType; protected ElementGetAcl(Graph graph, OntologyRepository ontologyRepository, ACLProvider aclProvider, ElementType elementType) { this.graph = graph; this.ontologyRepository = ontologyRepository; this.aclProvider = aclProvider; this.elementType = elementType; } @Handle public ClientApiElementAcl handle( HttpServletRequest request, @Required(name = "elementId") String elementId, User user, Authorizations authorizations ) throws Exception { Element element; if (elementType == ElementType.VERTEX) { element = graph.getVertex(elementId, authorizations); } else if (elementType == ElementType.EDGE) { element = graph.getEdge(elementId, authorizations); } else { throw new VisalloException("Unrecognized element type: " + elementType.name()); } if (element == null) { throw new VisalloResourceNotFoundException( String.format("%s %s not found", elementType.name(), elementId), elementId); } return aclProvider.elementACL(element, user, ontologyRepository); } }
102995049e215f3eef9160124039c838dab855b0
c89752b484a20c150a882d3bedd4dcbda0fbe3b1
/src/main/java/creago/dfisc/afg/sifis/planejamento/entities/Feriado.java
c4c416da4f8334f601bee09faa3f653344d0819c
[]
no_license
soareslucas/SysOS
c2eb3c3ac06f6ed6384644934c49d274f41e9118
34fdf2e7125e1a481036a0c0eb2ba80ae0e60a8c
refs/heads/master
2021-04-28T18:43:02.362387
2018-03-14T19:57:20
2018-03-14T19:57:20
121,879,139
0
0
null
null
null
null
UTF-8
Java
false
false
1,410
java
package creago.dfisc.afg.sifis.planejamento.entities; // Generated 19/03/2015 11:54:19 by Hibernate Tools 4.3.1 import java.util.Date; import java.util.HashSet; import java.util.Set; /** * Feriado generated by hbm2java */ public class Feriado implements java.io.Serializable { private Long idferiado; private String nome; private Date data; private Boolean isFixo; private Set cidades = new HashSet(0); public Feriado() { } public Feriado(String nome, Date data, Boolean isFixo, Set cidades) { this.nome = nome; this.data = data; this.isFixo = isFixo; this.cidades = cidades; } public Long getIdferiado() { return this.idferiado; } public void setIdferiado(Long idferiado) { this.idferiado = idferiado; } public String getNome() { return this.nome; } public void setNome(String nome) { this.nome = nome; } public Date getData() { return this.data; } public void setData(Date data) { this.data = data; } public Boolean getIsFixo() { return this.isFixo; } public void setIsFixo(Boolean isFixo) { this.isFixo = isFixo; } public Set getCidades() { return this.cidades; } public void setCidades(Set cidades) { this.cidades = cidades; } }
20fbcd83888b956a79269bab984ccfd144a1d293
edf13996a94b8fe564eda19b41b9e82750198c18
/src/com/leetcode/algorithm/easy/Solution_657.java
8d66b4e6e025fbcceb64f706a92189184c6655ef
[]
no_license
walkercy/leetcode-practice
56d0c56d8dba69c0d90939c8fdc0a42dc1373542
f454c4a6c3cc52361e9b7ca41ca6c34cbc408fae
refs/heads/master
2021-07-14T22:56:07.169097
2021-01-25T13:43:20
2021-01-25T13:43:20
228,199,491
0
0
null
null
null
null
UTF-8
Java
false
false
461
java
package com.leetcode.algorithm.easy; /** * @author walker * @date 2020/02/01 */ public class Solution_657 { public boolean judgeCircle(String moves) { int horizontal = 0; int vertical = 0; for (char c : moves.toCharArray()) { if (c == 'L') { vertical++; } else if (c == 'R') { vertical--; } else if (c == 'U') { horizontal++; } else if (c == 'D') { horizontal--; } } return horizontal == 0 && vertical == 0; } }
c5d40deb5b4978e87c236298987dbf7775552890
5b023382b1cbaab80f38c4383636c39e7399db33
/src/main/java/com/pdfjet/MaskPattern.java
b8311bd93a2af159a1b10199e64cea539b48279a
[ "MIT", "BSD-2-Clause", "BSD-2-Clause-Views" ]
permissive
soster/pdfjet
0349676c98ec782e6e01e3ef866a750d2cd3901b
b88776ba23e37546b2d1b660cb9abbfd06390837
refs/heads/master
2023-06-15T20:57:48.877270
2023-05-25T19:33:51
2023-05-25T19:33:51
23,327,654
38
10
null
2015-12-03T14:59:45
2014-08-25T20:29:59
Java
UTF-8
Java
false
false
714
java
/** * Copyright 2009 Kazuhiko Arase URL: http://www.d-project.com/ Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php The word "QR Code" is registered trademark of DENSO WAVE INCORPORATED http://www.denso-wave.com/qrcode/faqpatent-e.html */ package com.pdfjet; /** * @author Kazuhiko Arase */ interface MaskPattern { public static final int PATTERN000 = 0; public static final int PATTERN001 = 1; public static final int PATTERN010 = 2; public static final int PATTERN011 = 3; public static final int PATTERN100 = 4; public static final int PATTERN101 = 5; public static final int PATTERN110 = 6; public static final int PATTERN111 = 7; }
fa68f3e7acd66fd078cfbe16e854b7df5668dd33
d3088aee7398d0ef2632a3e195b44543bb78630f
/TargetProject/src/TargetLoop/TargetObjectRep.java
eab6bc94e35a5f3d000f97736f1b388c325d1ec0
[]
no_license
nusrat1221/project
8d4a483d5d37c91a8eb69014c7d1f68a4b519237
a9bf587837e2bfd01376692ddca90f72197e64ad
refs/heads/main
2023-03-08T09:53:13.977265
2021-02-22T20:48:25
2021-02-22T20:48:25
341,332,711
0
0
null
null
null
null
UTF-8
Java
false
false
1,388
java
package TargetLoop; import org.openqa.selenium.By; public class TargetObjectRep { public static String url = "https://www.target.com/"; public static By deals = By.id("secondary"); public static By dealsClearance = By.id("deals-clearance"); public static By shoesClearance = By.xpath("//a[@data-lnk='ShoesClearance']"); public static By firstShoe = By.xpath("/html/body/div[1]/div/div[5]/div[3]/div[2]/div/div[1]/div[3]/div[2]/ul/li[1]/div/div[2]/div/div/div/div[1]/div[1]/a"); public static By oneShoePrice = By.xpath("/html/body/div[1]/div/div[5]/div/div[2]/div[2]/div[1]/div[1]/div[1]"); public static String oneshoe = "$25.99"; public static By clickquantityIncrease = By.xpath("//button[@data-test='custom-quantity-picker']"); public static By increaseToTwoShoes= By.xpath("//ul[@id='options']/li[2]"); public static By ShipIt = By.xpath("//button[@data-test='shipItButton']"); public static By viewCart = By.xpath("//button[@data-test='addToCartModalViewCartCheckout']"); public static By twoShoeSubtotal = By.xpath("//p[@class='h-text-bs']"); public static String twoshoe = "$51.98"; public static By changeQuantity = By.id("default-id-change-me"); public static int backToOneShoe = 1; public static String shoeValue = "Qty 1"; public static By lastSubtotal= By.className("Row__StyledRow-sc-19ydihw-0 bUoBNS"); public static double lastTotal= 25.99; }
8d846827d25df1c87dbb26aec6b2138a4f719c6e
4931ef6c42e809552317833fc3f9748d81ed33d0
/SudokuSimulation/src/Sudoku/SudokuSimulation.java
5fef4f9dec1f8e19b763377b215f665680294871
[]
no_license
nicolettecelli/Java-Programs
c4d87d0017c34ab38edc6cca5e9b00a701bfb1b1
da4b590aabf0a65f439aa6c79a01ef9e2c3d0f4c
refs/heads/master
2021-01-02T09:46:55.721035
2017-08-14T03:52:46
2017-08-14T03:52:46
99,301,308
0
0
null
null
null
null
UTF-8
Java
false
false
2,566
java
package Sudoku; /////////////////////////////////////////////////////////////////////////////// // Title: Universal Sudoku Puzzle // Files: Sudoku.java, SudokuSimulation.java // Semester: COP3337 Fall 2015 // // Author: 4174075 // Lecturer's Name: Maria Charters // // Description of Program’s Functionality: Creates a Sudoku puzzle and checks if // it is valid /////////////////////////////////////////////////////////////////////////////// /** * * @author 4174075 */ public class SudokuSimulation { /** * @param args the command line arguments */ public static void main(String[] args) { Sudoku mySudokuPuzzle = new Sudoku(); // Row and column Latin but with invalid subsquares String config1 = "1234567892345678913456789124567891235678912346" + "78912345789123456891234567912345678"; String[][] puzzle1 = mySudokuPuzzle.makeSudoku(config1); if (mySudokuPuzzle.isValidSudoku(puzzle1)) { System.out.println("This puzzle is valid."); } else { System.out.println("This puzzle is invalid."); } System.out.println(mySudokuPuzzle.getPrintableSudoku(puzzle1)); System.out.println("--------------------------------------------------"); // Row Latin but column not Latin and with invalid subsquares String config2 = "12345678912345678912345678912345678912345678" + "9123456789123456789123456789123456789"; String[][] puzzle2 = mySudokuPuzzle.makeSudoku(config2); if (mySudokuPuzzle.isValidSudoku(puzzle2)) { System.out.println("This puzzle is valid."); } else { System.out.println("This puzzle is invalid."); } System.out.println(mySudokuPuzzle.getPrintableSudoku(puzzle2)); System.out.println("--------------------------------------------------"); // A valid sudoku String config3 = "25813764914698532779324685147286319558149273663" + "9571482315728964824619573967354218"; String[][] puzzle3 = mySudokuPuzzle.makeSudoku(config3); if (mySudokuPuzzle.isValidSudoku(puzzle3)) { System.out.println("This puzzle is valid."); } else { System.out.println("This puzzle is invalid."); } System.out.println(mySudokuPuzzle.getPrintableSudoku(puzzle3)); System.out.println("--------------------------------------------------"); } }
b8e5045244be04871bd742dfce10f4cec93a3f0d
6e3fb40d118525213c5c0ea48e8857d554c6faec
/javaAdvance/src/com/onehao/basic/lesson3/ObjectTest.java
196f6dc258c4e6ce019bc9334a7497e6552fd37e
[]
no_license
onehao/teragrid
14f8d42c5453a07962c3024c5cbf46a26f1a3a6c
0aa73c770f8ecd51eed0e100bd30a6ad47c36710
refs/heads/master
2021-01-10T06:02:43.411633
2011-07-26T05:19:31
2011-07-26T05:19:31
36,421,134
0
0
null
null
null
null
UTF-8
Java
false
false
540
java
package com.onehao.basic.lesson3; public class ObjectTest { public static void main(String[] args) { Object object = new Object(); System.out.println(object); System.out.println(object.toString()); String str = "aaa"; System.out.println(str); System.out.println(str.toString()); Student student = new Student(); System.out.println(student); System.out.println(student.toString()); } } class Student extends Object { public String toString() { return "Hello World"; } }
ea55b87ebd8180ae14b05c2783a109f1f02b68fd
1a6b3f9c2116e6e95ca4454ff92f31043b3715d8
/面试题40_最小的K个数.java
b5a79bad11cb5186052662d4f9c65624ad0550ce
[]
no_license
zuozhen666/JianZhiOffer
7b6521b4dbe341e04144232a60b084e4fe11be95
a301c624b4516165d946fdb1c668d470859f7581
refs/heads/main
2023-03-08T09:29:36.084068
2021-02-23T05:57:40
2021-02-23T05:57:40
329,332,893
1
0
null
null
null
null
UTF-8
Java
false
false
2,111
java
package zuozhen; import org.junit.Test; import java.util.ArrayList; import java.util.PriorityQueue; public class 面试题40_最小的K个数 { public ArrayList<Integer> GetLeastNumbers_Solution(int[] input, int k) { /* 思路一:利用Partition函数,找到排序下标为k-1的数字,这时数组前k个数字即为所求。 O(n) */ // ArrayList ret = new ArrayList<Integer>(); // if (input.length == 0 || k == 0 || input.length < k) return ret; // int start = 0; // int end = input.length - 1; // int index = Partition(input, start, end); // while (index != k - 1) { // if (index > k - 1) { // end = index - 1; // index = Partition(input, start, end); // } else { // start = index + 1; // index = Partition(input, start, end); // } // } // for (int i = 0; i <= k - 1; i++) { // ret.add(input[i]); // } // return ret; /* 思路二:利用堆 O(nlgk) */ if (input.length == 0 || k == 0 || input.length < k) return new ArrayList<Integer>(); PriorityQueue<Integer> maxHeap = new PriorityQueue<>((o1, o2) -> o2 - o1); for(int num: input){ maxHeap.add(num); if(maxHeap.size()>k) maxHeap.poll(); } return new ArrayList<>(maxHeap); } public int Partition(int[] array, int lo, int hi) { int key = array[lo];//以第一个值为基准值 while (lo < hi) { while (array[hi] > key && hi > lo) { hi--; } array[lo] = array[hi]; while (array[lo] <= key && hi > lo) { lo++; } array[hi] = array[lo]; } array[hi] = key; return hi; } @Test public void test() { int[] arr = {3, 4, 1, 2, 5}; System.out.println(Partition(arr, 0, arr.length - 1)); } }
f435c3c0060f7322fe767c13f696aa36bb555b45
b24818a948152b06c7d85ac442e9b37cb6becbbc
/src/main/java/com/ash/experiments/performance/whitespace/Class3988.java
fd51c7092d545a1b6c0971b74bf3ae7430c1ffe1
[]
no_license
ajorpheus/whitespace-perf-test
d0797b6aa3eea1435eaa1032612f0874537c58b8
d2b695aa09c6066fbba0aceb230fa4e308670b32
refs/heads/master
2020-04-17T23:38:39.420657
2014-06-02T09:27:17
2014-06-02T09:27:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
41
java
public class Class3988 {}
62f6832fce283aad84e42e50423525c22e49065b
aa7ed3bdb7199f7fffc48e75cfc2611bae995bb8
/modules/samples/src/main/java/org/wso2/synapse/samples/jaxrs/foodsample/FoodService.java
c9d1f518e0808dfabf2dde30fda227a1409ee713
[]
no_license
Susankha/wso2-synapse
47e8e945dbe776480e90b1ad9974f74fffb67a76
4bc716d47750b5af1a5a239ce7d986371db2c4fb
refs/heads/master
2021-11-22T09:47:06.705171
2021-09-09T06:23:49
2021-09-09T06:23:49
32,726,062
0
0
null
2015-03-23T10:43:11
2015-03-23T10:43:10
null
UTF-8
Java
false
false
5,050
java
/* * Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except * in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.wso2.synapse.samples.jaxrs.foodsample; import org.apache.commons.codec.binary.Base64; import org.wso2.synapse.samples.jaxrs.foodsample.bean.Token; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; @javax.inject.Singleton @Path("/foodservice/") public class FoodService { private int unauthorizedReqCount = 0; private int tokenReqCount = 0; @POST @Path("/token") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces(MediaType.APPLICATION_JSON) public Response getAccessToken(@Context HttpHeaders httpHeaders, MultivaluedMap<String, String> tokenRequestParams) { tokenReqCount++; String basicHeader = httpHeaders.getHeaderString("Authorization"); if (validateCredentials(basicHeader, tokenRequestParams)) { return Response.status(Response.Status.OK).entity(new Token(Constants.accessToken, Constants.expiresIn, Constants.tokenType)).build(); } return Response.status(Response.Status.UNAUTHORIZED).entity("Invalid Credentials").build(); } @POST @Path("/custom-token") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces(MediaType.APPLICATION_JSON) public Response getAccessTokenWithCustomParams(@Context HttpHeaders httpHeaders, MultivaluedMap<String, String> tokenRequestParams) { String basicHeader = httpHeaders.getHeaderString("Authorization"); if (validateCustomParams(tokenRequestParams) && validateCredentials(basicHeader, tokenRequestParams)) { return Response.status(Response.Status.OK).entity(new Token(Constants.accessToken, Constants.expiresIn, Constants.tokenType)).build(); } return Response.status(Response.Status.UNAUTHORIZED).entity("Invalid Credentials").build(); } @GET @Path("/food") @Produces(MediaType.APPLICATION_JSON) public Response getFoodItem(@Context HttpHeaders httpHeaders) { String authorizationHeader = httpHeaders.getHeaderString("Authorization"); if (authorizationHeader != null) { String token = authorizationHeader.split(" ")[1]; if (token.equals(Constants.accessToken)) { return Response.status(Response.Status.OK).entity(tokenReqCount).build(); } } return Response.status(Response.Status.UNAUTHORIZED).build(); } @GET @Path("/unauthorized") @Produces(MediaType.APPLICATION_JSON) public Response getUnauthorizedItem(@Context HttpHeaders httpHeaders) { unauthorizedReqCount++; return Response.status(Response.Status.UNAUTHORIZED).entity(unauthorizedReqCount).build(); } private boolean validateCredentials(String basicHeader, MultivaluedMap<String, String> tokenRequestParams) { String credentials = basicHeader.substring(6).trim(); String decodedCredentials = new String(new Base64().decode(credentials.getBytes())); String clientId = decodedCredentials.split(":")[0]; String clientSecret = decodedCredentials.split(":")[1]; String refreshToken = tokenRequestParams.getFirst("refresh_token"); String clientIdInBody = tokenRequestParams.getFirst("client_id"); String clientSecretInBody = tokenRequestParams.getFirst("client_secret"); if (refreshToken != null && !refreshToken.equals(Constants.refreshToken)) { return false; } if (!clientId.equals(Constants.clientId) || !clientIdInBody.equals(Constants.clientId) || !clientSecret.equals(Constants.clientSecret) || !clientSecretInBody.equals(Constants.clientSecret)) { return false; } return true; } private boolean validateCustomParams(MultivaluedMap<String, String> tokenRequestParams) { String accountId = tokenRequestParams.getFirst("account_id"); String userRole = tokenRequestParams.getFirst("user_role"); return accountId.equals("1234") && userRole.equals("tester"); } }
93c3df728ad6d18d858aa579a7374b1430bf3ff9
bf41d4664cb690bf638302834ba5c0fb3334fe7a
/Cucumber_HAL/HearingLanguage/Source/com.shs.hl.ui/src/com/shs/hl/ui/HearingLanguageUiModule.java
3593430eb0c2e165c0c706c7a1c0f5937ace7d63
[]
no_license
hamxyy/HL-Analyzer
d0169e58e0edacf4777bc5302e8b2efab8a91a6b
a77a4902158c465261a7dcccd89ffe23c60fa904
refs/heads/master
2021-01-25T05:22:01.162098
2015-03-26T09:14:43
2015-03-26T09:14:43
29,338,622
0
0
null
null
null
null
UTF-8
Java
false
false
2,948
java
/* * generated by Xtext */ package com.shs.hl.ui; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.eclipse.xtext.ui.editor.autoedit.DefaultAutoEditStrategyProvider; import org.eclipse.xtext.ui.editor.syntaxcoloring.DefaultHighlightingConfiguration; import org.eclipse.xtext.ui.editor.syntaxcoloring.ISemanticHighlightingCalculator; import com.shs.hl.ui.contentassist.AutoEditingStrategyProvider; import com.shs.hl.ui.highlighting.HLHighlightingConfiguration; import com.shs.hl.ui.highlighting.HLSemanticHighlightingCalculator; import com.shs.hl.ui.hover.HLHover; /** * Use this class to register components to be used within the IDE. */ public class HearingLanguageUiModule extends com.shs.hl.ui.AbstractHearingLanguageUiModule { public HearingLanguageUiModule(final AbstractUIPlugin plugin) { super(plugin); } @Override public Class<? extends org.eclipse.jface.text.ITextHover> bindITextHover() { return HLHover.class; } public Class<? extends DefaultHighlightingConfiguration> bindHighlightingConfiguration() { return HLHighlightingConfiguration.class; } public Class<? extends DefaultAutoEditStrategyProvider> bindAutoEditingStrategyProvider() { return AutoEditingStrategyProvider.class; } public Class<? extends ISemanticHighlightingCalculator> bindSemanticHighlightingCalculator() { return HLSemanticHighlightingCalculator.class; } @Override public Class<? extends org.eclipse.xtext.builder.IXtextBuilderParticipant> bindIXtextBuilderParticipant() { // return // org.eclipse.xtext.builder.JavaProjectBasedBuilderParticipant.class; return org.eclipse.xtext.builder.BuilderParticipant.class; } @Override public org.eclipse.core.resources.IWorkspaceRoot bindIWorkspaceRootToInstance() { return org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot(); } // // contributed by org.eclipse.xtext.ui.generator.projectWizard.SimpleProjectWizardFragment // public Class<? extends org.eclipse.xtext.ui.wizard.IProjectCreator> bindIProjectCreator() { //// return com.shs.hl.ui.wizard.HearingLanguageProjectCreator.class; // return com.shs.hl.ui.wizard.JDTFreeHearingLanguageProjectCreator.class; // } // /** // * @see org.eclipse.xtext.ui.DefaultUiModule#bindIResourceForEditorInputFactory() // */ // @Override // public Class<? extends IResourceForEditorInputFactory> bindIResourceForEditorInputFactory() { // return ResourceForIEditorInputFactory.class; // } // /** // * @see org.eclipse.xtext.ui.DefaultUiModule#bindIResourceSetProvider() // */ // @Override // public Class<? extends IResourceSetProvider> bindIResourceSetProvider() { // return SimpleResourceSetProvider.class; // } // // // // contributed by org.eclipse.xtext.ui.generator.ImplicitUiFragment // public com.google.inject.Provider<org.eclipse.xtext.resource.containers.IAllContainersState> provideIAllContainersState() { // return org.eclipse.xtext.ui.shared.Access.getWorkspaceProjectsState(); // } }
815fc4cd3edd63967c943e3ca731f6d1d7bd284a
dffad2521c85e2728ab993d17589fd71e603f818
/src/main/java/singleinstance/TestReflectionSingleton.java
56ef1a917c5bafffd3aec0e61a018e16bb8dc9e4
[]
no_license
zhangjunapk/designMode
44235240b9dbbad8d7e05df1da2855ae881f76d5
e3c4d467dc809ef8c5aa8351d6939f04ee37595b
refs/heads/master
2020-06-10T14:46:14.756014
2019-07-17T09:49:22
2019-07-17T09:49:22
193,420,496
0
0
null
null
null
null
UTF-8
Java
false
false
3,133
java
package singleinstance; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.concurrent.CountDownLatch; /** * @BelongsProject: designmode * @BelongsPackage: singleinstance * @Author: ZhangJun * @CreateTime: 2019-07-11 22:26 * @Description: 测试反射攻击单例 */ public class TestReflectionSingleton { public static void main(String[] args) { test2(); /* try { Constructor<SingletonNotAttackByReflect> declaredConstructor = SingletonNotAttackByReflect.class.getDeclaredConstructor(); declaredConstructor.setAccessible(true); SingletonNotAttackByReflect utilSync = declaredConstructor.newInstance(); System.out.println(utilSync); System.out.println(UtilCantReflection.GetInstance()); } catch (Exception e) { e.printStackTrace(); }*/ } public static void test1() { try { Constructor<UtilSync> declaredConstructor = UtilSync.class.getDeclaredConstructor(); declaredConstructor.setAccessible(true); UtilSync utilSync = declaredConstructor.newInstance(); Method show = UtilSync.class.getMethod("show"); show.invoke(utilSync); } catch (Exception e) { e.printStackTrace(); } } public static void test2() { try { CountDownLatch latch = new CountDownLatch(1); for (int i = 0; i < 10000; i++) { new Thread(new Runnable() { @Override public void run() { try { latch.await(); synchronized (SingletonNotAttackByReflect.class) { // SingletonNotAttackByReflect.getInstance().pringFlag(); Constructor<SingletonNotAttackByReflect> declaredConstructor = SingletonNotAttackByReflect.class.getDeclaredConstructor(); declaredConstructor.setAccessible(true); SingletonNotAttackByReflect utilSync = declaredConstructor.newInstance(); System.out.println(utilSync); System.out.println(UtilCantReflection.GetInstance()); } } catch (Exception e) { e.printStackTrace(); } } }).start(); } latch.countDown(); } catch (Exception e) { e.printStackTrace(); } } public static void test3() { try { Field instance = SingletonNotAttackByReflect.class.getDeclaredField("INSTANCE"); instance.setAccessible(true); Object o = instance.get(null); System.out.println(o); System.out.println(SingletonNotAttackByReflect.getInstance()); } catch (Exception e) { e.printStackTrace(); } } }
c5acb527e8f9a4367ad178a1566534a6ff326327
7508682239b536ff6988afdece57d37f1c56c534
/ShoppingCartFrontEnd/src/main/java/com/niit/shoppingcart/controller/AuthorsController.java
9eb5567f4502afaac1af034c1154dfd692321b86
[]
no_license
shailaja1601/B-World
ff56b062a72b873b3ca56ccfa4b11b3c9cfd01cb
40e7e4305efdf9f7702da66c39d3c6f661a30eb5
refs/heads/master
2021-01-12T02:46:14.834932
2017-01-05T08:37:40
2017-01-05T08:37:40
78,092,431
0
0
null
null
null
null
UTF-8
Java
false
false
3,632
java
package com.niit.shoppingcart.controller; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import com.niit.shoppingcart.dao.AuthorsDAO; import com.niit.shoppingcart.model.Authors; @Controller public class AuthorsController { private static final Logger logger=LoggerFactory.getLogger(AuthorsController.class); @Autowired Authors authors; @Autowired AuthorsDAO authorsDAO; @RequestMapping(value="/manageAuthors",method=RequestMethod.GET) public String listAuthors (Model model){ logger.debug("Method START:listAuthors"); model.addAttribute("authors",authors); model.addAttribute("authorsList",this.authorsDAO.list()); model.addAttribute("authorsAdd",true); model.addAttribute("isAdminClickedAuthors","true"); logger.debug("Method END:listAuthors"); return "/index"; } @RequestMapping(value="/manage_authors_add",method=RequestMethod.POST) public String addAuthors(@ModelAttribute("authors")Authors authors,Model model){ if(authorsDAO.saveOrUpdate(authors)==true) { model.addAttribute("msg", "Successfully added Author"); } else { model.addAttribute("msg", "ID already exist"); } model.addAttribute("authors", authors); model.addAttribute("authorsList",authorsDAO.list()); model.addAttribute("isAdminClickedAuthors", "true"); return "/index"; } @RequestMapping(value="/manage_authors_update",method=RequestMethod.POST) public String updateAuthors(@ModelAttribute("authors") Authors authors,Model model){ if(authorsDAO.update(authors)==true) { model.addAttribute("msg", "Successfully"); } else { model.addAttribute("msg", "operation failed"); } model.addAttribute("authors", authors); model.addAttribute("authorsList",this.authorsDAO.list()); model.addAttribute("authors",new Authors()); model.addAttribute("isAdminClickedAuthors", "true"); return "/index"; } @RequestMapping("/manage_authors_remove") public String deleteAuthors(@RequestParam("author") String author,Model model) throws Exception{ boolean flag=authorsDAO.delete(author); String msg="Successfully done the opertion"; if(flag!=true){ msg="The opertion could not success"; } model.addAttribute("msg", msg); return "forward:/manageAuthors"; } @RequestMapping(value="/manage_authors_edit") public String editAuthors(@RequestParam("id") String id,Model model) { authors=authorsDAO.get(id); model.addAttribute("authors",authors); model.addAttribute("authorsList",this.authorsDAO.list()); model.addAttribute("authorsAdd",false); model.addAttribute("isAdminClickedAuthors","true"); return "index"; } @RequestMapping(value="/open_select_author") public ModelAndView getSelectedAuthor(@RequestParam("id")String author){ ModelAndView mv=new ModelAndView("/index"); mv.addObject("author",author); mv.addObject("authorsList",this.authorsDAO.list()); return mv; } }
632ee6bf6a71d8c649d2991ea5832669958bee2a
43092d84e17fd255d6f51c728a79b71da54e1697
/4.JavaCollections/src/com/javarush/task/task33/task3310/strategy/FileBucket.java
8ffae9c223d49ffed4e25ab776cecff11011574a
[]
no_license
ADolodarenko/JavaRushTasks
0713f7ae7493c1de177e3b26c7cb2055fa3bf352
37c81df5e984b02db7597c0d7219c0e0ece82948
refs/heads/master
2020-12-03T02:16:02.100777
2017-07-31T13:11:32
2017-07-31T13:11:32
95,919,962
1
0
null
null
null
null
UTF-8
Java
false
false
1,541
java
package com.javarush.task.task33.task3310.strategy; import com.javarush.task.task33.task3310.ExceptionHandler; import java.io.*; import java.nio.file.Files; import java.nio.file.Path; /** * Created by n_alex on 07.07.17. */ public class FileBucket { private Path path; public FileBucket() { try { path = Files.createTempFile(null, null); Files.deleteIfExists(path); Files.createFile(path); path.toFile().deleteOnExit(); } catch (IOException e) { ExceptionHandler.log(e); } } public long getFileSize() { long size = 0; try { size = Files.size(path); } catch (IOException e) { ExceptionHandler.log(e); } return size; } public void putEntry(Entry entry) { try { OutputStream stream = Files.newOutputStream(path); ObjectOutputStream objStream = new ObjectOutputStream(stream); objStream.writeObject(entry); objStream.close(); } catch (IOException e) { ExceptionHandler.log(e); } } public Entry getEntry() { Entry entry = null; if (getFileSize() > 0) try { InputStream stream = Files.newInputStream(path); ObjectInputStream objStream = new ObjectInputStream(stream); entry = (Entry)objStream.readObject(); objStream.close(); } catch (IOException e) { ExceptionHandler.log(e); } catch (ClassNotFoundException e) { ExceptionHandler.log(e); } return entry; } public void remove() { try { Files.delete(path); } catch (IOException e) { ExceptionHandler.log(e); } } }
40d275e95e411596e11ac541677646231b941112
2201c4909a56300c5380342f43008d055ce9d44b
/Kinesis-Lambda/Integration/src/main/java/lambda_algorithm_twilio/version1/TwilioSMS.java
6293009852698481c15082f5fef0808c83df00c5
[ "MIT" ]
permissive
AngelHacks-Statisfy/Statisfy
673f21873f81805107cc54c0da5f1ae691652435
d7dbd1d76edadf074b9157a1a01b57d48a849a88
refs/heads/master
2021-01-20T18:07:34.404367
2017-07-09T20:36:10
2017-07-09T20:36:10
61,984,498
0
0
null
null
null
null
UTF-8
Java
false
false
1,175
java
package lambda_algorithm_twilio.version1; import java.util.*; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import com.twilio.sdk.*; import com.twilio.sdk.resource.factory.*; import com.twilio.sdk.resource.instance.*; public class TwilioSMS { //contactNumber, userName, docName, record, docNumber public void messageTwilio(String contactNumber, String patientName, String docName, String value, String docNumber) throws TwilioRestException { TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN); System.out.println("In Twilio SMS"); List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("To", contactNumber)); params.add(new BasicNameValuePair("From", "+")); params.add(new BasicNameValuePair("Body", "Hi " + patientName + "! Your calorie intake is: " + value + ". You can reach out to the provider " + docName + " on " + docNumber )); MessageFactory messageFactory = client.getAccount().getMessageFactory(); Message message = messageFactory.create(params); System.out.println(message.getSid()); } }
3ac9d0dfd455411bc301b9bc2cbca8c65f437b7a
31182dc90943b43e2c8f1d4c3d47b2f12b2ba4d0
/src/main/java/com/practice/DateUtils.java
46f00dca5c069a9aa1de48bbfc25a956520fd5c8
[]
no_license
kummaravenkatesh1/pet-app
729d9c793aa7814088dae1c8469027db7f5da2bb
a0ad65ade0c3feecd872264c9c0fc852c36f854d
refs/heads/master
2023-06-21T17:13:29.275748
2021-08-03T12:08:47
2021-08-03T12:08:47
392,300,432
0
0
null
null
null
null
UTF-8
Java
false
false
373
java
package com.practice; import java.time.LocalDateTime; import java.time.ZoneId; import java.time.ZoneOffset; import java.util.Date; public class DateUtils { public static Long convertToEpochSecond(Date date) { LocalDateTime dateTime = LocalDateTime.ofInstant(date.toInstant(), ZoneId.of("UTC")); return dateTime.toEpochSecond(ZoneOffset.UTC); } }
3c55dda89db816fa9cdcb0b34aa9d6426205dc2c
bd7a8558b233337a5e3511db15639ef0a12a0b02
/app/src/main/java/cn/teach/equip/weight/PopDeleteWindow.java
bc8f147e254c403e6a06f1f7be6cf028b355aa6f
[]
no_license
sengeiou/teach
db54d70bf058c92a37dbdfb3bf4250b0d4bb1af0
2a9e625de5519685a687838fdc0a6f22e76cbc8c
refs/heads/master
2023-06-07T18:20:58.144395
2021-06-24T10:40:31
2021-06-24T10:40:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,008
java
package cn.teach.equip.weight; import android.app.Activity; import android.graphics.drawable.ColorDrawable; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.WindowManager; import android.widget.LinearLayout; import android.widget.PopupWindow; import cn.teach.equip.R; /** * author : wuliang * e-mail : [email protected] * date : 2020/7/2412:24 * desc : 收藏底部的删除弹窗 * version: 1.0 */ public class PopDeleteWindow extends PopupWindow { private View dialogView; private onClickListener listener; public PopDeleteWindow(Activity context) { super(context); dialogView = LayoutInflater.from(context).inflate(R.layout.pop_delete, null); LinearLayout deleteLayout = dialogView.findViewById(R.id.delete_layout); deleteLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (listener != null) { listener.onClick(); } } }); this.setBackgroundDrawable(new ColorDrawable(0)); this.setContentView(dialogView); //设置PopupWindow弹出窗体的宽 this.setWidth(WindowManager.LayoutParams.MATCH_PARENT); //设置PopupWindow弹出窗体的高 this.setHeight(WindowManager.LayoutParams.WRAP_CONTENT); //设置PopupWindow弹出窗体可点击 this.setFocusable(false); this.setOutsideTouchable(false); //设置SelectPicPopupWindow弹出窗体动画效果 this.setAnimationStyle(R.style.anim_menu_bottombar); } /*** * 显示时将屏幕置为透明 */ public void showAtLocation(View parent) { super.showAtLocation(parent, Gravity.BOTTOM, 0, 0); } public void setListener(onClickListener listener) { this.listener = listener; } public interface onClickListener { void onClick(); } }
f9bc33007ed7d1730484c0a531f81538640a505d
6a516859a7091d6e20f69150250039453f0a94dc
/Sistema/Implementacao/Licita/src/main/java/br/solutio/licita/modelo/StatusPregao.java
f75a7c925af2764be898812e4a1d8bec2dea52fc
[]
no_license
SolutioSoftware/Licita
3f324fd8003c95438180970465fd87f53e67f422
67436405fe13c571ea6fad5d5cc78aee53b92ef7
refs/heads/master
2021-01-21T02:30:46.590474
2015-11-18T22:16:14
2015-11-18T22:16:14
34,025,273
2
1
null
null
null
null
UTF-8
Java
false
false
2,769
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package br.solutio.licita.modelo; import java.io.Serializable; import java.util.Set; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.ManyToMany; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.validation.constraints.Size; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlTransient; /** * * @author WitaloCarlos */ @Entity @Table(name = "tbl_status_pregao") @XmlRootElement @NamedQueries({ @NamedQuery(name = "StatusPregao.findAll", query = "SELECT s FROM StatusPregao s"), @NamedQuery(name = "StatusPregao.findById", query = "SELECT s FROM StatusPregao s WHERE s.id = :id"), @NamedQuery(name = "StatusPregao.findByValor", query = "SELECT s FROM StatusPregao s WHERE s.valor = :valor")}) public class StatusPregao implements Serializable{ private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "id") private Long id; @Size(max = 20) @Column(name = "valor") private String valor; @ManyToMany(mappedBy = "statusPregaoSet") private transient Set<Pregao> pregaoSet; public StatusPregao() { } public StatusPregao(Long id) { this.id = id; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getValor() { return valor; } public void setValor(String valor) { this.valor = valor; } @XmlTransient public Set<Pregao> getPregaoSet() { return pregaoSet; } public void setPregaoSet(Set<Pregao> pregaoSet) { this.pregaoSet = pregaoSet; } @Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { if (!(object instanceof StatusPregao)) { return false; } StatusPregao other = (StatusPregao) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { return false; } return true; } @Override public String toString() { return "br.solutio.licita.modelo.StatusPregao[ id=" + id + " ]"; } }
39b36a5a0f7860a4c72c8489fce739e9e00d0869
b55222a71d1275387d538fb9c0cf03116a611922
/jOOQ/src/main/java/org/jooq/InsertValuesStep2.java
931409a879ae582fb1d18f06cebd0461e07e4cc7
[ "Apache-2.0", "BSD-3-Clause" ]
permissive
monolithic/jOOQ
e05625873b5a9d46010554064294d5aa199865b2
300c4b8693fdaa31adf15d6e9b7e153ef2c5ffeb
refs/heads/master
2021-01-18T10:26:27.727927
2013-02-20T16:54:58
2013-02-20T16:54:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,445
java
/** * Copyright (c) 2009-2013, Lukas Eder, [email protected] * 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; import java.util.Collection; import javax.annotation.Generated; import org.jooq.Support; import org.jooq.impl.Executor; /** * This type is used for the {@link Insert}'s DSL API. * <p> * Example: <code><pre> * Executor create = new Executor(); * * create.insertInto(table, field1, field2) * .values(field1, field2) * .values(field1, field2) * .onDuplicateKeyUpdate() * .set(field1, value1) * .set(field2, value2) * .execute(); * </pre></code> * * @author Lukas Eder */ @Generated("This class was generated using jOOQ-tools") public interface InsertValuesStep2<R extends Record, T1, T2> extends InsertOnDuplicateStep<R> { /** * Add values to the insert statement. */ @Support InsertValuesStep2<R, T1, T2> values(T1 value1, T2 value2); /** * Add values to the insert statement. */ @Support InsertValuesStep2<R, T1, T2> values(Field<T1> value1, Field<T2> value2); /** * Add values to the insert statement. */ @Support InsertValuesStep2<R, T1, T2> values(Collection<?> values); /** * Use a <code>SELECT</code> statement as the source of values for the * <code>INSERT</code> statement * <p> * This variant of the <code>INSERT .. SELECT</code> statement expects a * select returning exactly as many fields as specified previously in the * <code>INTO</code> clause: * {@link Executor#insertInto(Table, Field, Field)} */ @Support Insert<R> select(Select<? extends Record2<T1, T2>> select); }
d3cf5734b0e0c2beacbc7f2d6e60c56b17a1f25e
0976c8e2a030dff1fcb2de76d3a805ba149f1d33
/app/src/main/java/com/mitchwongho/d3/domain/DataPoint.java
e89977387d7bc9ef45738cfa74d51d8840ee93df
[]
no_license
chema/D3Android
c8644c62be3c9d303383b6f38e3698c1e45ba4c6
3600927281372a08da382d50c7dee66b78e90a4b
refs/heads/master
2020-05-22T18:43:50.051469
2017-04-06T10:28:45
2017-04-06T10:28:45
84,715,498
0
0
null
2017-03-12T09:51:14
2017-03-12T09:51:13
null
UTF-8
Java
false
false
394
java
package com.mitchwongho.d3.domain; import java.io.Serializable; /** * */ public class DataPoint implements Serializable { private static final long serialVersionUID = 4990064484446119372L; public String letter; public float frequency; public DataPoint(final String letter, final float frequency) { this.letter = letter; this.frequency = frequency; } }
214e9aa512c1bdc2033d774d9926bcdfaeec29de
85a35461d0929ca5cf1ff66255617b3352a973ed
/src/clase02_poo/Persona.java
49707a11dad2ab88d150665eb04d9691fd198fc0
[]
no_license
LuisLavado/Polimorfismo
0bd38e1ac8ca5034a04116108691b2b73a4f37c7
1d92f999d8df052dcc6942c40e0e2ce3b3b177aa
refs/heads/master
2021-01-10T20:07:53.103300
2015-03-30T21:01:44
2015-03-30T21:01:44
33,145,056
1
0
null
null
null
null
UTF-8
Java
false
false
1,635
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 clase02_poo; /** * * @author alumno05 */ public class Persona { String nombre, apellidos, genero, dni, id_persona, direcion, telefono, fecha_nac; public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String getApellidos() { return apellidos; } public void setApellidos(String apellidos) { this.apellidos = apellidos; } public String getGenero() { return genero; } public void setGenero(String genero) { this.genero = genero; } public String getDni() { return dni; } public void setDni(String dni) { this.dni = dni; } public String getId_persona() { return id_persona; } public void setId_persona(String id_persona) { this.id_persona = id_persona; } public String getDirecion() { return direcion; } public void setDirecion(String direcion) { this.direcion = direcion; } public String getTelefono() { return telefono; } public void setTelefono(String telefono) { this.telefono = telefono; } public String getFecha_nac() { return fecha_nac; } public void setFecha_nac(String fecha_nac) { this.fecha_nac = fecha_nac; } }
bb7fe90fc8cee207781f7202b0ef377d96527200
fe1f5e4e4c38cd4f6969e32210d75c4ab0646a0f
/shundi-common/src/main/java/com/pps/util/UUIDUtil.java
5dfef699495235eb7057b7106d578125676285da
[]
no_license
pupansheng/shundifather
72288aeb7a24fe32cf504c9b3876252c690961ce
6c1b6c8809b38a83a7a31522e7cbef48d3373dd8
refs/heads/master
2022-07-10T11:21:15.629944
2020-07-11T11:20:18
2020-07-11T11:20:18
230,855,923
0
0
null
2022-06-21T02:32:34
2019-12-30T05:50:07
Java
UTF-8
Java
false
false
2,127
java
package com.pps.util; import java.util.Random; /** * @Classname UUIDUtil * @Description * @@Author Pupansheng * @Date 2019/7/17 11:13 * @Vestion 1.0 **/ public class UUIDUtil { /** * 生成不带-的UUID * * @return UUID */ public static String getUUID() { // 返回用UUID String uuidResult = ""; // 临时用UUID String uuidTemp = ""; // 取得UUID存储到临时用UUID uuidTemp = java.util.UUID.randomUUID().toString(); // 替换掉所有-字符 uuidResult = uuidTemp.replaceAll("-", ""); // 返回UUID return uuidResult; } /** * java生成随机数字和字母组合 * * @param length * [生成随机数的长度] * @return */ public static String getCharAndNumr(int length) { String val = ""; Random random = new Random(); for (int i = 0; i < length; i++) { // 输出字母还是数字 String charOrNum = random.nextInt(2) % 2 == 0 ? "char" : "num"; // 字符串 if ("char".equalsIgnoreCase(charOrNum)) { // 取得大写字母还是小写字母 int choice = random.nextInt(2) % 2 == 0 ? 65 : 97; val += (char) (choice + random.nextInt(26)); } else if ("num".equalsIgnoreCase(charOrNum)) { // 数字 val += String.valueOf(random.nextInt(10)); } } return val; } /** * 随机生成纯数字 * * @param length * @return */ public static String getNumber(int length) { char[] chars = { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' }; Random random = new Random(); StringBuffer sb = new StringBuffer(); for (int i = 1; i <= length; i++) { sb.append(chars[random.nextInt(chars.length)]); } return sb.toString(); } public static void main(String[] args) { System.out.println(UUIDUtil.getCharAndNumr(16)); System.out.println(UUIDUtil.getUUID()); } }
c7baf70795cd6a78feb7e6579db3855dc5d56c5b
3cb75d537e492d5f8799a63e6e1858290a2959d3
/proj1a/LinkedListDeque.java
d0a31137e695f08dc493db67c7f4acbc9b72bc05
[]
no_license
fei4ei/skeleton-sp18
47116531b6949b7c802485d808c639eff819fd9d
6d586fa72bffcf769173a0ac93293ea183afd076
refs/heads/master
2023-02-26T01:11:28.838207
2021-02-02T23:22:53
2021-02-02T23:22:53
273,614,522
0
0
null
2020-06-20T01:04:57
2020-06-20T01:04:56
null
UTF-8
Java
false
false
4,098
java
public class LinkedListDeque<BleepBlorp> { /** LinkedListDeque is a doubly linked list of generic types, which hides the nakedness within. */ private IndNode sentinel; private int size; // nested class of the naked IndNode class of doubly linked list // IndNode cannot be static b/c non-static variable BleepBlorp is referenced here private class IndNode { public IndNode prev; public BleepBlorp item; public IndNode next; public IndNode(IndNode PrevPointer, BleepBlorp CurrentItem, IndNode NextPointer) { prev = PrevPointer; item = CurrentItem; next = NextPointer; } // let me read about public vs. private method in a private nested class // a helper method for getRecursive of LinkedListDeque. // cannot be static b/c we use the BleepBlorp generic type public BleepBlorp getR(int i) { IndNode aNode = this; if (i == 0) { return aNode.next.item; } return aNode.next.getR(i-1); } } // constructor for 1 element list public LinkedListDeque(BleepBlorp x){ sentinel = new IndNode(null, null, null); sentinel.next = new IndNode(sentinel, x, sentinel); sentinel.prev = sentinel.next; size = 1; } // constructor for an empty list public LinkedListDeque() { sentinel = new IndNode(null, null, null); sentinel.next = sentinel; sentinel.prev = sentinel; size = 0; } public int size() { return this.size; } public boolean isEmpty() { return (this.size == 0); } public void addFirst(BleepBlorp x) { IndNode aNode = new IndNode(sentinel, x, sentinel.next); sentinel.next = aNode; aNode.next.prev = sentinel.next; size += 1; } public void addLast(BleepBlorp x) { IndNode aNode = new IndNode(sentinel.prev, x, sentinel); sentinel.prev = aNode; aNode.prev.next = aNode; size += 1; } public BleepBlorp removeFirst() { if (size > 0) { IndNode first = sentinel.next; sentinel.next = first.next; first.next.prev = sentinel; size -= 1; return first.item; } return null; } public BleepBlorp removeLast() { if (size > 0) { IndNode last = sentinel.prev; sentinel.prev = last.prev; last.prev.next = sentinel; size -= 1; return last.item; } return null; } // iterative method for accessing the ith element of the LinkedListDeque public BleepBlorp get(int i) { IndNode aNode = sentinel; for (int j = 0; j < i+1; j++) { aNode = aNode.next; } return aNode.item; } // recursive method for accessing the ith element of the LinkedListDeque with the help of a private getR method of IndNode public BleepBlorp getRecursive(int i) { return sentinel.getR(i); } public void printDeque() { IndNode aNode = sentinel; for (int i = 0; i < size; i++) { System.out.println(aNode.next.item); aNode = aNode.next; } } public static void main(String[] args) { LinkedListDeque<String> stringL = new LinkedListDeque<>("this "); System.out.println(stringL.isEmpty()); stringL.addFirst("Hello, "); stringL.addLast("is"); stringL.addLast("me"); stringL.printDeque(); System.out.println(stringL.get(0)); System.out.println(stringL.get(1)); System.out.println(stringL.get(2)); System.out.println(stringL.get(3)); System.out.println(stringL.getRecursive(3)); LinkedListDeque<Integer> integerL = new LinkedListDeque<>(); System.out.println(integerL.isEmpty()); System.out.println(integerL.removeLast()); integerL.addLast(9); System.out.println(integerL.removeLast()); } }
16cc59956fcb5364f830e569dd80c3a0eda0ff49
90ad5696a7c20e9e74b995504c66b71d6b521772
/plugins/org.mondo.ifc.cstudy.metamodel.edit/src/org/bimserver/models/ifc2x3tc1/provider/IfcFootingItemProvider.java
bae0f6d420aff083598f490f9dc7bb626fbf1a52
[]
no_license
mondo-project/mondo-demo-bim
5bbdffa5a61805256e476ec2fa84d6d93aeea29f
96d673eb14e5c191ea4ae7985eee4a10ac51ffec
refs/heads/master
2016-09-13T11:53:26.773266
2016-06-02T20:02:05
2016-06-02T20:02:05
56,190,032
1
0
null
null
null
null
UTF-8
Java
false
false
3,865
java
/** */ package org.bimserver.models.ifc2x3tc1.provider; import java.util.Collection; import java.util.List; import org.bimserver.models.ifc2x3tc1.Ifc2x3tc1Package; import org.bimserver.models.ifc2x3tc1.IfcFooting; import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.eclipse.emf.edit.provider.ViewerNotification; /** * This is the item provider adapter for a {@link org.bimserver.models.ifc2x3tc1.IfcFooting} object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class IfcFootingItemProvider extends IfcBuildingElementItemProvider { /** * This constructs an instance from a factory and a notifier. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public IfcFootingItemProvider(AdapterFactory adapterFactory) { super(adapterFactory); } /** * This returns the property descriptors for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { if (itemPropertyDescriptors == null) { super.getPropertyDescriptors(object); addPredefinedTypePropertyDescriptor(object); } return itemPropertyDescriptors; } /** * This adds a property descriptor for the Predefined Type feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addPredefinedTypePropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_IfcFooting_PredefinedType_feature"), getString("_UI_PropertyDescriptor_description", "_UI_IfcFooting_PredefinedType_feature", "_UI_IfcFooting_type"), Ifc2x3tc1Package.eINSTANCE.getIfcFooting_PredefinedType(), true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This returns IfcFooting.gif. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object getImage(Object object) { return overlayImage(object, getResourceLocator().getImage("full/obj16/IfcFooting")); } /** * This returns the label text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String getText(Object object) { String label = ((IfcFooting)object).getName(); return label == null || label.length() == 0 ? getString("_UI_IfcFooting_type") : getString("_UI_IfcFooting_type") + " " + label; } /** * This handles model notifications by calling {@link #updateChildren} to update any cached * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void notifyChanged(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(IfcFooting.class)) { case Ifc2x3tc1Package.IFC_FOOTING__PREDEFINED_TYPE: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; } super.notifyChanged(notification); } /** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); } }
b0417f4326627430bee7f17c3688921e7040d5e0
54e391b2bae3829d531c8adcb930fc500129e55c
/app/src/main/java/com/example/uploadservice/activity/PictureSelectActivity.java
f13122d206c6f95e5cc36532c8fd0ea01b77e895
[]
no_license
lanhuawei/UploadService
3ce5e687d96bc27221edaa9f8ec27c47a2a47122
45edb638af2deb541020fca5bced13c9198d81d3
refs/heads/master
2020-03-17T04:44:33.277898
2018-03-29T09:38:48
2018-03-29T09:38:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
13,229
java
package com.example.uploadservice.activity; import android.Manifest; import android.annotation.SuppressLint; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.graphics.Color; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.os.Handler; import android.os.Message; import android.provider.MediaStore; import android.support.annotation.NonNull; import android.support.v4.content.FileProvider; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.bumptech.glide.Glide; import com.example.uploadservice.R; import com.example.uploadservice.adapter.PhotoListAdapter; import com.example.uploadservice.adapter.decoration.ThreeGridDecoration; import com.example.uploadservice.listener.PhotoAlbumListener; import com.example.uploadservice.model.Resp; import com.example.uploadservice.model.UploadVideoResp; import com.example.uploadservice.net.ApiHelper; import com.example.uploadservice.net.ApiInterface; import com.example.uploadservice.upload.ProgressRequestBody; import com.example.uploadservice.util.SizeUtils; import com.example.uploadservice.util.SystemUtil; import com.example.uploadservice.util.permission.KbPermission; import com.example.uploadservice.util.permission.KbPermissionListener; import com.example.uploadservice.util.permission.KbPermissionUtils; import com.example.uploadservice.view.KbWithWordsCircleProgressBar; import java.io.File; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import okhttp3.MultipartBody; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; public class PictureSelectActivity extends AppCompatActivity implements View.OnClickListener { private static final String TAG = "IconSelectActivity"; public static final String PATH_IMAGE = "PATH_IMAGE"; private static final int PHOTO_REQUEST_TAKEPHOTO = 11; //拍照 private FrameLayout mBack; //返回 private TextView mTvPreview; //预览 private TextView mNext; //下一步 private RecyclerView mPhotoList; //图片列表 private ImageView mIvPreview; //预览图片 //进度条相关 @BindView(R.id.fl_circle_progress) ViewGroup mFlCircleProgress; @BindView(R.id.circle_progress) KbWithWordsCircleProgressBar mCircleProgress; private Context mContext; private ApiInterface mApi; private PhotoListAdapter mPhotoListAdapter; //照片列表适配器 private List<String> mPhotoPathList = new ArrayList<>(); //存放本地图片路径的集合 private File FILEPATH_FILE = Environment.getExternalStorageDirectory(); //保存图片的路径 private String imageName = ""; //图片名字 private String mPicPath; //想要上传的图片路径 @SuppressLint("HandlerLeak") private Handler mHandler = new Handler() { @Override public void handleMessage(Message msg) { switch (msg.what) { case 1000: for (String photoPath : mPhotoPathList) { Log.e(TAG, "handleMessage: " + photoPath); } mPhotoListAdapter.addData(mPhotoPathList); break; } } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_picture_select); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { SystemUtil.setLightStatusBar(this, Color.WHITE); } mContext = PictureSelectActivity.this; ButterKnife.bind(this); mApi = ApiHelper.getInstance().buildRetrofit(ApiHelper.BASE_URL) .createService(ApiInterface.class); initView(); getLocalPhoto(); } @Override protected void onResume() { super.onResume(); mTvPreview.setTextColor(getResources().getColor(R.color.sub_title)); mTvPreview.setClickable(false); mNext.setTextColor(getResources().getColor(R.color.sub_title)); mNext.setClickable(false); mPhotoListAdapter.changeCheckState(); } private void initView() { mBack = findViewById(R.id.btn_back); mBack.setOnClickListener(this); mTvPreview = (TextView) findViewById(R.id.tv_preview); mNext = (TextView) findViewById(R.id.tv_next); mIvPreview = findViewById(R.id.iv_preview); mIvPreview.setOnClickListener(this); mPhotoList = (RecyclerView) findViewById(R.id.rv_photo_list); mPhotoList.setLayoutManager(new GridLayoutManager(this, 3)); mPhotoListAdapter = new PhotoListAdapter(PictureSelectActivity.this); mPhotoList.setAdapter(mPhotoListAdapter); mPhotoList.addItemDecoration(new ThreeGridDecoration(SizeUtils.dp2px(mContext, 2), SizeUtils.dp2px(mContext, 2))); mPhotoListAdapter.setPhotoAlbumListener(new PhotoAlbumListener<String>() { @Override public void onSelected(String s) { mPicPath = s; Glide.with(mContext).load(s).into(mIvPreview); mTvPreview.setTextColor(getResources().getColor(R.color.title)); mTvPreview.setOnClickListener(PictureSelectActivity.this); mNext.setTextColor(getResources().getColor(R.color.title)); mNext.setOnClickListener(PictureSelectActivity.this); } @Override public void onClickCamera() { mTvPreview.setClickable(false); mNext.setClickable(false); if (KbPermissionUtils.needRequestPermission()) { KbPermission.with(PictureSelectActivity.this) .requestCode(300) .permission(Manifest.permission.CAMERA) .callBack(new KbPermissionListener() { @Override public void onPermit(int requestCode, String... permission) { //调起相机 takePhoto(); } @Override public void onCancel(int requestCode, String... permission) { KbPermissionUtils.goSetting(mContext); } }) .send(); } else { //调起相机 takePhoto(); } } }); } /** * 扫描本地图片 */ private void getLocalPhoto() { new Thread(new Runnable() { @Override public void run() { Uri mImageUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; ContentResolver mContentResolver = mContext.getContentResolver(); //只查询jpeg和png的图片   Cursor mCursor = mContentResolver.query(mImageUri, null, MediaStore.Images.Media.MIME_TYPE + "=? or " + MediaStore.Images.Media.MIME_TYPE + "=?", new String[]{"image/jpeg", "image/png"}, MediaStore.Images.Media.DATE_MODIFIED); if (mCursor == null) { return; } while (mCursor.moveToNext()) { //获取图片的路径   String path = mCursor.getString(mCursor.getColumnIndex(MediaStore.Images.Media.DATA)); if (!TextUtils.isEmpty(path)) { mPhotoPathList.add(path); } } mHandler.sendEmptyMessage(1000); mCursor.close(); } }).start(); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.btn_back: finish(); break; case R.id.tv_preview: mIvPreview.setVisibility(View.VISIBLE); break; case R.id.iv_preview: mIvPreview.setVisibility(View.GONE); break; case R.id.tv_next: if (!TextUtils.isEmpty(mPicPath)) { uploadPicture(); } break; } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); if (resultCode == 0) return; // 拍照回调 if (requestCode == PHOTO_REQUEST_TAKEPHOTO) { mPicPath = FILEPATH_FILE + "/" + imageName; } } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { KbPermission.onRequestPermissionResult(requestCode, permissions, grantResults); } @Override public void finish() { super.finish(); //Activity退出时动画 overridePendingTransition(R.anim.slide_out_bottom, R.anim.slide_out_top); } /** * 拍照 */ private void takePhoto() { if (!FILEPATH_FILE.exists()) { FILEPATH_FILE.mkdirs(); } imageName = getNowTime() + ".png"; Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); // 指定调用相机拍照后照片的储存路径 File file = new File(FILEPATH_FILE, imageName); Log.e(TAG, "takePhoto: " + file.getAbsolutePath()); intent.putExtra(MediaStore.EXTRA_OUTPUT, getUriForFile(mContext, file)); startActivityForResult(intent, PHOTO_REQUEST_TAKEPHOTO); overridePendingTransition(R.anim.slide_in_bottom, R.anim.slide_out_bottom); } private static Uri getUriForFile(Context context, File file) { if (context == null || file == null) { throw new NullPointerException(); } Uri uri; /** * 需要在清单文件的application节点中加入以下代码 * <provider android:name="android.support.v4.content.FileProvider" android:authorities="com.example.uploadservice.fileprovider" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/filepaths" /> </provider> */ if (Build.VERSION.SDK_INT >= 24) { uri = FileProvider.getUriForFile(context.getApplicationContext(), "com.example.uploadservice.fileprovider", file); } else { uri = Uri.fromFile(file); } return uri; } private void uploadPicture() { mFlCircleProgress.setVisibility(View.VISIBLE); File file = new File(mPicPath); //是否需要压缩 //实现上传进度监听 ProgressRequestBody requestFile = new ProgressRequestBody(file, "image/*", new ProgressRequestBody.UploadCallbacks() { @Override public void onProgressUpdate(int percentage) { Log.e(TAG, "onProgressUpdate: " + percentage); mCircleProgress.setProgress(percentage); } @Override public void onError() { } @Override public void onFinish() { } }); MultipartBody.Part body = MultipartBody.Part.createFormData("file", file.getName(), requestFile); mApi.uploadFile(body).enqueue(new Callback<UploadVideoResp>() { @Override public void onResponse(Call<UploadVideoResp> call, Response<UploadVideoResp> response) { mFlCircleProgress.setVisibility(View.GONE); UploadVideoResp resp = response.body(); if (resp != null) { Toast.makeText(mContext, "图片上传成功!", Toast.LENGTH_SHORT).show(); } } @Override public void onFailure(Call<UploadVideoResp> call, Throwable t) { mFlCircleProgress.setVisibility(View.GONE); Toast.makeText(mContext, "图片上传失败,稍后重试", Toast.LENGTH_SHORT).show(); } }); } /** * 获取当前时间 * * @return */ private String getNowTime() { Date date = new Date(System.currentTimeMillis()); SimpleDateFormat dateFormat = new SimpleDateFormat("MMddHHmmssSS"); return dateFormat.format(date); } }
2d634ac1e92f1e2fcd17b7e453d1ef37506deeeb
9ac443405a7054c230e1db6f104d671906183582
/src/main/java/br/com/salesreport/launcher/Launcher.java
063df4e39de1199a1d5612256ba73b02fc78fa60
[]
no_license
oliverccf/SalesReport
75deac988e68a0098e75581771a87ef647c3a8c4
f8ae2e21e8358c46a43b5607dc855e3f8354f449
refs/heads/main
2023-01-19T04:00:36.729801
2020-11-11T20:22:12
2020-11-11T20:22:12
311,491,505
0
0
null
null
null
null
UTF-8
Java
false
false
349
java
package br.com.salesreport.launcher; import java.io.File; public class Launcher { public static void main(String[] args) { new Launcher().start(); } public void start() { new FileSalesSkanner(new File("/Users/oliveirafilho/temp/desafio/input"), new File("/Users/oliveirafilho/temp/desafio/output")).start(); } }
508f5843a458e062a6d2a303aa73725db7248378
ad507ae741671e1386547a110eccc303a0fcc861
/src/main/java/com/mmdo/simplex/DTO/Pair.java
f43a0557bc1e4dafff5ee8062b98a638b978df13
[]
no_license
ediklutsyk/mmdo-simplex
07e2e4ac7e09accf083b40549658fc9adae2e27e
9ab35fd9c272a50c874ef11361398f12e6ada382
refs/heads/master
2020-12-21T09:02:50.330180
2020-01-27T09:37:45
2020-01-27T09:37:45
236,381,269
0
0
null
null
null
null
UTF-8
Java
false
false
1,118
java
package com.mmdo.simplex.DTO; import java.util.Objects; public class Pair<A,B> { private A key; private B value; public Pair(A key, B value) { this.key = key; this.value = value; } public static <A,B> Pair<A,B> of(A key, B value) { return new Pair<>(key, value); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Pair<?, ?> pair = (Pair<?, ?>) o; return Objects.equals(key, pair.key) && Objects.equals(value, pair.value); } @Override public int hashCode() { return Objects.hash(key, value); } @Override public String toString() { return "Pair{" + "key=" + key + ", value=" + value + '}'; } public A getKey() { return key; } public void setKey(A key) { this.key = key; } public B getValue() { return value; } public void setValue(B value) { this.value = value; } }
baa4f03e9214e422629e0c87c091a31f074131f6
16aa3d64b6b894abc4de17794b9f96efc0f3f33b
/src/main/java/com/rishi/reserve/common/persistence/dialect/db/DB2Dialect.java
b77c686c45bcefd45a48f4177adb61108a24f7f8
[]
no_license
rishiding/yuyue
751713055028539b70b8110e2b7e3d317d261298
206e02a1447550b0ce7791c0948c02f0e0688f88
refs/heads/master
2022-12-21T13:02:50.662407
2019-06-16T11:32:26
2019-06-16T11:32:26
102,445,540
0
0
null
2022-12-16T02:06:49
2017-09-05T06:55:58
JavaScript
UTF-8
Java
false
false
3,208
java
/** * Copyright &copy; 2017-2017<a href="#">rishi</a> All rights reserved. */ package com.rishi.reserve.common.persistence.dialect.db; import com.rishi.reserve.common.persistence.dialect.Dialect; /** * DB2的分页数据库方言实现 * * @author poplar.yfyang * @version 1.0 2010-10-10 下午12:31 * @since JDK 1.5 */ public class DB2Dialect implements Dialect { @Override public boolean supportsLimit() { return true; } private static String getRowNumber(String sql) { StringBuilder rownumber = new StringBuilder(50) .append("rownumber() over("); int orderByIndex = sql.toLowerCase().indexOf("order by"); if (orderByIndex > 0 && !hasDistinct(sql)) { rownumber.append(sql.substring(orderByIndex)); } rownumber.append(") as rownumber_,"); return rownumber.toString(); } private static boolean hasDistinct(String sql) { return sql.toLowerCase().contains("select distinct"); } @Override public String getLimitString(String sql, int offset, int limit) { return getLimitString(sql, offset, Integer.toString(offset), Integer.toString(limit)); } /** * 将sql变成分页sql语句,提供将offset及limit使用占位符号(placeholder)替换. * <pre> * 如mysql * dialect.getLimitString("select * from user", 12, ":offset",0,":limit") 将返回 * select * from user limit :offset,:limit * </pre> * * @param sql 实际SQL语句 * @param offset 分页开始纪录条数 * @param offsetPlaceholder 分页开始纪录条数-占位符号 * @param limitPlaceholder 分页纪录条数占位符号 * @return 包含占位符的分页sql */ public String getLimitString(String sql, int offset, String offsetPlaceholder, String limitPlaceholder) { int startOfSelect = sql.toLowerCase().indexOf("select"); StringBuilder pagingSelect = new StringBuilder(sql.length() + 100) .append(sql.substring(0, startOfSelect)) //add the comment .append("select * from ( select ") //nest the main query in an outer select .append(getRowNumber(sql)); //add the rownnumber bit into the outer query select list if (hasDistinct(sql)) { pagingSelect.append(" row_.* from ( ") //add another (inner) nested select .append(sql.substring(startOfSelect)) //add the main query .append(" ) as row_"); //close off the inner nested select } else { pagingSelect.append(sql.substring(startOfSelect + 6)); //add the main query } pagingSelect.append(" ) as temp_ where rownumber_ "); //add the restriction to the outer select if (offset > 0) { // int end = offset + limit; String endString = offsetPlaceholder + "+" + limitPlaceholder; pagingSelect.append("between ").append(offsetPlaceholder) .append("+1 and ").append(endString); } else { pagingSelect.append("<= ").append(limitPlaceholder); } return pagingSelect.toString(); } }
b761568fbf6c231fa07d863e2d1e3b7595ae8a48
97a8db12f936367a72656bb635f6997a913bb6ff
/Medcal/app/src/main/java/com/berwyn/medcal/database/DatabaseClass.java
594e430dd4d6bfb7a8575a51db728e361afe1ad8
[]
no_license
kermit9848/Medcal_2021
7626e2292cc1d53d19fcf75434d40c12bc4811d5
e6aa082d2ff00b8491700213432e4cbbfacecc4c
refs/heads/main
2023-05-30T21:26:53.998387
2021-06-08T17:46:32
2021-06-08T17:46:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
889
java
package com.berwyn.medcal.database; import androidx.room.Database; import androidx.room.Room; import androidx.room.RoomDatabase; import android.content.Context; @Database(entities = {EntityClass.class}, version = 1) public abstract class DatabaseClass extends RoomDatabase { private static DatabaseClass INSTANCE; public abstract EventDao EventDao(); public static DatabaseClass getDatabase(final Context context) { if (INSTANCE == null) { synchronized (DatabaseClass.class) { if (INSTANCE == null) { INSTANCE = Room.databaseBuilder(context.getApplicationContext(), DatabaseClass.class, "product_database").allowMainThreadQueries().build(); } } } return INSTANCE; } }
2a213b4e2c399ed1693fd4a882a0339d6240d550
e453380fba1dbb332a833d43af492c79aa2e3b8a
/src/main/java/io/inveasy/matcher/DualMatcher.java
edc5d11b3581046ca0e9864f324b6e3b90c04c8c
[]
no_license
Inveasy/lambda-matcher
37b8a03a42c56bc7ca20c26908aa1f35468d3138
9528438fdac46c524ef4e4e1eb3ddd4e934f3f06
refs/heads/master
2020-03-24T18:56:48.725322
2018-07-30T19:14:40
2018-07-30T19:14:40
142,904,472
0
0
null
null
null
null
UTF-8
Java
false
false
1,648
java
/* * Copyright 2018 Guillaume Gravetot * * 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 io.inveasy.matcher; import java.util.Optional; import java.util.function.BiFunction; import java.util.function.BiPredicate; // StackOverflow inspired : https://stackoverflow.com/a/41550809 public class DualMatcher<T, K> { public <U> Case<U> match(BiPredicate<T, K> cond, BiFunction<T, K, U> map) { return this.new Case<>(cond, map, Optional.empty()); } public class Case<U> implements BiFunction<T, K, Optional<U>> { private BiPredicate<T, K> cond; private BiFunction<T, K, U> map; private Optional<Case<U>> previous; Case(BiPredicate<T, K> cond, BiFunction<T, K, U> map, Optional<Case<U>> previous) { this.cond = cond; this.map = map; this.previous = previous; } public Case<U> match(BiPredicate<T, K> cond, BiFunction<T, K, U> map) { return new Case<>(cond, map, Optional.of(this)); } @Override public Optional<U> apply(T value1, K value2) { return cond.test(value1, value2) ? Optional.of(map.apply(value1, value2)) : previous.flatMap(p -> p.apply(value1, value2)); } } }
b9e1a0000cf3fc36b3ed4d480e8c82774d3067fb
0b8856c1a5a2e0a26880004873a940a2bc0318fb
/src/B4_BT_Point_Va_MoveablePoint/MovablePoint.java
3c3b25fc1d1f6ff6cc3d9f1b636785da231d93b0
[]
no_license
letuananh12345/Modul2_B6_Ke_Thua
b243d4938cd4a8e7d5358a68f7c99ce516bc7f99
caa08eb80991c68c9eef75cf093e8a9ace3b801c
refs/heads/main
2023-05-29T20:57:19.087979
2021-06-14T16:54:20
2021-06-14T16:54:20
376,809,471
0
0
null
null
null
null
UTF-8
Java
false
false
1,196
java
package B4_BT_Point_Va_MoveablePoint; public class MovablePoint extends Point { private float xSpeed; private float ySpeed; public MovablePoint(){ } public MovablePoint(float xSpeed, float ySpeed) { this.xSpeed = xSpeed; this.ySpeed = ySpeed; } public MovablePoint(float x, float y, float xSpeed, float ySpeed) { super(x, y); this.xSpeed = xSpeed; this.ySpeed = ySpeed; } public float getxSpeed() { return xSpeed; } public void setxSpeed(float xSpeed) { this.xSpeed = xSpeed; } public float getySpeed() { return ySpeed; } public void setySpeed(float ySpeed) { this.ySpeed = ySpeed; } public void setSpeed(float xSpeed,float ySpeed){ this.xSpeed = xSpeed; this.ySpeed = ySpeed; } public float[] getSpeed(){ return new float[]{this.xSpeed,this.ySpeed}; } @Override public String toString() { return super.toString()+ " move with xSpeed = " + xSpeed + ", ySpeed = " + ySpeed; } public void move() { setX(getX()+this.xSpeed); setY(getY()+this.ySpeed); } }
7a2f161722c643d058679c6667ab921ff309584d
0aefde4d1ac27e02ccc3143576a25a4ff034689a
/src/test/java/BaseTest.java
fdc0b2682805da58f1d6a8ac265a9e0e2390b131
[]
no_license
krepetsNata/REST-test-framework
42755087a21381191b781f39aa7232610d749d8c
51f555eadae4b77892ae4d7be6ce1eacab5fd025
refs/heads/master
2023-07-13T21:37:45.103379
2021-08-26T15:34:45
2021-08-26T15:34:45
394,640,226
0
0
null
2021-08-20T10:10:24
2021-08-10T12:11:02
Java
UTF-8
Java
false
false
4,829
java
import constants.FileNames; import org.apache.log4j.Logger; import org.testng.annotations.*; import pojo.Author; import pojo.Book; import pojo.Genre; import service.AuthorService; import service.BookService; import service.GenreService; import utils.ParsingAndConvert; import java.lang.reflect.Method; public class BaseTest { private final Logger LOG = Logger.getLogger(BaseTest.class); private Test test; ParsingAndConvert parsingAndConvert = new ParsingAndConvert(); private BookService bookService = new BookService(); private AuthorService authorService = new AuthorService(); private GenreService genreService = new GenreService(); private Book baseNewBook; private Author baseNewAuthor; private Genre baseNewGenre; @BeforeMethod(alwaysRun = true) public void beforeMethod(Method method) { System.out.println("beforeMethod"); test = method.getAnnotation(Test.class); LOG.info(String.format("Test '%s' started.", method.getName())); } @AfterMethod(alwaysRun = true) public void afterMethod(final Method method) { System.out.println("afterMethod"); LOG.info(String.format("Test '%s' completed.", method.getName())); } @BeforeGroups(groups = "authorGroup") public void beforeGroupAuthor() { System.out.println("beforeGroupAuthor"); baseNewAuthor = parsingAndConvert.getNewAuthorObj(FileNames.CSV_FILE_NEW_AUTHOR.getFileName()); } @AfterGroups(groups = "authorGroup") public void afterGroupAuthor() { System.out.println("afterGroupAuthor"); baseNewAuthor = null; } @BeforeGroups(groups = "bookGroup") public void beforeGroupBook() { System.out.println("beforeGroupBook"); baseNewBook = parsingAndConvert.getNewBookObj(FileNames.CSV_FILE_NEW_BOOK.getFileName()); baseNewAuthor = parsingAndConvert.getNewAuthorObj(FileNames.CSV_FILE_AUTHORS.getFileName());//existed author baseNewGenre = parsingAndConvert.getNewGenreObj(FileNames.CSV_FILE_GENRES.getFileName());//existed genre } @AfterGroups(groups = "bookGroup") public void afterGroupBook() { System.out.println("afterGroupBook"); baseNewBook = null; baseNewAuthor = null; baseNewGenre = null; } @BeforeGroups(groups = "genreGroup") public void beforeGroupGenre() { System.out.println("beforeGroupGenre"); baseNewGenre = parsingAndConvert.getNewGenreObj(FileNames.CSV_FILE_NEW_GENRE.getFileName()); } @AfterGroups(groups = "genreGroup") public void afterGroupGenre() { System.out.println("afterGroupGenre"); baseNewGenre = null; } @BeforeMethod(groups = "bookGroup") public void beforeMethodBook(Method method) { System.out.println("beforeMethodBook"); if (method.getName().contains("verifyDeleting") || method.getName().contains("verifyUpdating")) { bookService.addBookPost(baseNewBook, baseNewAuthor.getAuthorId(), baseNewGenre.getGenreId()); } } @AfterMethod(groups = "bookGroup") public void afterMethodBook(Method method) { System.out.println("afterMethodBook"); if (method.getName().contains("verifyUpdating") || method.getName().contains("verifyCreating")) { bookService.deleteBookDelete(baseNewBook.getBookId()); } } @BeforeMethod(groups = "authorGroup") public void beforeMethodAuthor(Method method) { System.out.println("beforeMethodAuthor"); if (method.getName().contains("verifyDeleting") || method.getName().contains("verifyUpdating")) { authorService.addAuthorPost(baseNewAuthor); } } @AfterMethod(groups = "authorGroup") public void afterMethodAuthor(Method method) { System.out.println("afterMethodAuthor"); if (method.getName().contains("verifyUpdating") || method.getName().contains("verifyCreating")) { authorService.deleteAuthorDelete(baseNewAuthor.getAuthorId()); } } @BeforeMethod(groups = "genreGroup") public void beforeMethodGenre(Method method) { System.out.println("beforeMethodGenre"); if (method.getName().contains("verifyDeleting") || method.getName().contains("verifyUpdating")) { genreService.addGenrePost(baseNewGenre); } } @AfterMethod(groups = "genreGroup") public void afterMethodGenre(Method method) { System.out.println("afterMethodGenre"); if (method.getName().contains("verifyUpdating") || method.getName().contains("verifyCreating")) { genreService.deleteGenreDelete(baseNewGenre.getGenreId()); } } }
9029952e383cea3d0ffabc6ae51d23d1a12f1db1
ee91b610c596a9fffdd1220f3352cdfd006f813a
/src/com/gmail/berndivader/mythicmobsext/CustomParticleEffect.java
44ef6a8ef4064a041fb0dcf3d5457c1168267288
[]
no_license
GrandeMalum/MythicMobsExtension
e21b3eef2f9920501370147d96171596824fa13c
3cd11c08e72c512aea826dd100e358faf47dc719
refs/heads/master
2022-12-27T01:02:10.247815
2018-01-13T05:42:39
2018-01-13T05:42:39
117,574,627
1
0
null
null
null
null
UTF-8
Java
false
false
7,279
java
package com.gmail.berndivader.mythicmobsext; import io.lumine.xikage.mythicmobs.MythicMobs; import io.lumine.xikage.mythicmobs.adapters.AbstractEntity; import io.lumine.xikage.mythicmobs.adapters.AbstractLocation; import io.lumine.xikage.mythicmobs.adapters.AbstractVector; import io.lumine.xikage.mythicmobs.adapters.bukkit.BukkitAdapter; import io.lumine.xikage.mythicmobs.io.MythicLineConfig; import io.lumine.xikage.mythicmobs.skills.ITargetedEntitySkill; import io.lumine.xikage.mythicmobs.skills.ITargetedLocationSkill; import io.lumine.xikage.mythicmobs.skills.ParticleMaker; import io.lumine.xikage.mythicmobs.skills.SkillMechanic; import io.lumine.xikage.mythicmobs.skills.SkillMetadata; import java.awt.Color; import org.bukkit.Location; import org.bukkit.entity.LivingEntity; import org.bukkit.util.Vector; public class CustomParticleEffect extends SkillMechanic implements ITargetedEntitySkill, ITargetedLocationSkill { protected static MythicMobs mythicmobs; String strParticle; float hSpread; float vSpread; float pSpeed; float yOffset; float fOffset; float sOffset; boolean useEyeLocation; int amount; int viewDistance; boolean directional; boolean directionReversed; Color color = null; boolean fromOrigin; public CustomParticleEffect(String skill, MythicLineConfig mlc) { super(skill, mlc); CustomParticleEffect.mythicmobs = Main.getPlugin().getMythicMobs(); this.strParticle = mlc.getString("particle", "reddust"); this.strParticle = mlc.getString("p", this.strParticle); this.amount = mlc.getInteger("amount", 10); this.amount = mlc.getInteger("a", this.amount); this.hSpread = mlc.getFloat("hspread", 0.0f); this.hSpread = mlc.getFloat("hs", this.hSpread); this.vSpread = mlc.getFloat("vspread", 0.0f); this.vSpread = mlc.getFloat("vs", this.vSpread); this.pSpeed = mlc.getFloat("speed", 0.0f); this.pSpeed = mlc.getFloat("s", this.pSpeed); this.yOffset = mlc.getFloat("yoffset", 0.0f); this.yOffset = mlc.getFloat("y", this.yOffset); this.fOffset = mlc.getFloat("forwardoffset", 0.0f); this.fOffset = mlc.getFloat("foffset", this.fOffset); this.fOffset = mlc.getFloat("fo", this.fOffset); this.sOffset = mlc.getFloat(new String[] { "sideoffset", "soffset", "so" }, 0.0f); this.useEyeLocation = mlc.getBoolean("useeyelocation", false); this.useEyeLocation = mlc.getBoolean("uel", this.useEyeLocation); this.viewDistance = mlc.getInteger(new String[] { "viewdistance", "vd" }, 128); this.viewDistance *= this.viewDistance; this.fromOrigin = mlc.getBoolean(new String[] { "fromorigin", "fo" }, false); this.directional = mlc.getBoolean(new String[] { "directional", "d" }, false); this.directionReversed = mlc.getBoolean(new String[] { "directionreversed", "dr" }, false); String color = mlc.getString(new String[] { "color", "c" }, null, new String[0]); if (color != null) { this.color = Color.decode(color); } } @Override public boolean castAtLocation(SkillMetadata data, AbstractLocation target) { Location l = BukkitAdapter.adapt(target); if (this.fOffset > 0.0f || this.sOffset != 0.0f) { l.setPitch(0.0f); l = CustomParticleEffect.move(l, this.fOffset, 0.0, this.sOffset); } if (this.directional) { this.playDirectionalParticleEffect(BukkitAdapter.adapt(data.getOrigin()), BukkitAdapter.adapt(target)); } else { this.playParticleEffect(BukkitAdapter.adapt(data.getOrigin()), l); } return true; } @Override public boolean castAtEntity(SkillMetadata data, AbstractEntity target) { LivingEntity bukkitEntity = (LivingEntity)target.getBukkitEntity(); Location l = this.useEyeLocation ? bukkitEntity.getEyeLocation() : BukkitAdapter.adapt(target.getLocation()); if (this.fOffset > 0.0f || this.sOffset != 0.0f) { l.setPitch(0.0f); l = CustomParticleEffect.move(l, this.fOffset, 0.0, this.sOffset); } if (this.directional) { this.playDirectionalParticleEffect(BukkitAdapter.adapt(data.getOrigin()), BukkitAdapter.adapt(target.getLocation())); } else { this.playParticleEffect(BukkitAdapter.adapt(data.getOrigin()), l); } return true; } protected void playParticleEffect(Location origin, Location target) { if (CustomParticleEffect.mythicmobs.getMinecraftVersion() < 7) { CustomParticleEffect.mythicmobs.getVolatileCodeHandler().doParticleEffect(target, this.strParticle, this.hSpread, this.vSpread, this.amount, this.pSpeed, this.yOffset, 256); return; } if (this.color != null) { this.playColoredParticleEffect(target); return; } Location ln = target.clone().add(0.0, this.yOffset, 0.0); new ParticleMaker.ParticlePacket(this.strParticle, this.hSpread, this.vSpread, this.hSpread, this.pSpeed, this.amount, true).send(ln, this.viewDistance); } protected void playColoredParticleEffect(Location target) { for (int i = 0; i < this.amount; ++i) { Location ln = target.clone().add(0.0f - this.hSpread + MythicMobs.r.nextDouble() * this.hSpread * 2.0, this.yOffset - this.vSpread + MythicMobs.r.nextDouble() * this.vSpread * 2.0, 0.0f - this.hSpread + MythicMobs.r.nextDouble() * this.hSpread * 2.0); new ParticleMaker.ParticlePacket(this.strParticle, this.color, this.pSpeed, this.amount, true).send(ln, this.viewDistance); } } protected void playDirectionalParticleEffect(Location origin, Location target) { Vector direction = this.directionReversed ? origin.toVector().subtract(target.clone().toVector()).normalize() : target.toVector().subtract(origin.clone().toVector()).normalize(); for (int i = 0; i < this.amount; ++i) { Location ln = target.clone().add(0.0f - this.hSpread + MythicMobs.r.nextDouble() * this.hSpread * 2.0, this.yOffset - this.vSpread + MythicMobs.r.nextDouble() * this.vSpread * 2.0, 0.0f - this.hSpread + MythicMobs.r.nextDouble() * this.hSpread * 2.0); new ParticleMaker.ParticlePacket(this.strParticle, direction, this.pSpeed, this.amount, true).send(ln, this.viewDistance); } } protected Location getOffsetLocation(Location l, double vo, double ho, boolean iy) { double yaw = 0.0D; if (!iy) yaw = Math.toRadians(l.getYaw()); double xo = Math.cos(yaw) * ho; double zo = Math.sin(yaw) * ho; Location offset = l.clone().add(xo, vo, zo); return offset; } public static Location move(Location loc, double dx, double dy, double dz) { AbstractVector off = CustomParticleEffect.rotate(loc.getYaw(), loc.getPitch(), dx, dy, dz); double x = loc.getX() + off.getX(); double y = loc.getY() + off.getY(); double z = loc.getZ() + off.getZ(); return new Location(loc.getWorld(), x, y, z, loc.getYaw(), loc.getPitch()); } public static AbstractVector rotate(float yaw, float pitch, double x, double y, double z) { float angle = yaw * 0.017453292F; double sinyaw = Math.sin(angle); double cosyaw = Math.cos(angle); angle = pitch * 0.017453292F; double sinpitch = Math.sin(angle); double cospitch = Math.cos(angle); double newx = 0.0D; double newy = 0.0D; double newz = 0.0D; newz -= x * cosyaw; newz -= y * sinyaw * sinpitch; newz -= z * sinyaw * cospitch; newx += x * sinyaw; newx -= y * cosyaw * sinpitch; newx -= z * cosyaw * cospitch; newy += y * cospitch; newy -= z * sinpitch; return new AbstractVector(newx, newy, newz); } }