blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
4ace37d987c5cf7bfe7c294a3ef7b9cccb7b0ae4
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/19/19_032f87a7ef30d6646a127592b397026a401257aa/Socket/19_032f87a7ef30d6646a127592b397026a401257aa_Socket_s.java
17f924a023bbbabe97cafd0d2b260509bb390df0
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
2,259
java
package socket; import java.net.MalformedURLException; import io.socket.IOAcknowledge; import io.socket.IOCallback; import io.socket.SocketIO; import io.socket.SocketIOException; import org.json.JSONException; import org.json.JSONObject; import topology.TwitterTopology; public class Socket implements IOCallback { private SocketIO socket; private TwitterTopology twtp; public Socket() { socket = new SocketIO(); try { socket.connect("http://127.0.0.1:3000/", this); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public Socket(TwitterTopology t) { socket = new SocketIO(); this.twtp = t; try { socket.connect("http://127.0.0.1:3000/", this); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public SocketIO getSocket() { return socket; } public void setSocket(SocketIO socket) { this.socket = socket; } @Override public void onMessage(JSONObject json, IOAcknowledge ack) { try { System.out.println("Server said:" + json.toString(2)); } catch (JSONException e) { e.printStackTrace(); } } @Override public void onMessage(String data, IOAcknowledge ack) { System.out.println("Server said: " + data); } @Override public void onError(SocketIOException socketIOException) { System.out.println("an Error occured"); socketIOException.printStackTrace(); } @Override public void onDisconnect() { System.out.println("Connection terminated."); } @Override public void onConnect() { System.out.println("Connection established"); } @Override public void on(String event, IOAcknowledge ack, Object... args) { if (event.equals("startStorm")){ try { JSONObject json = ((JSONObject) args[0]); System.out.println(event + " " + json.getString("cat")); try { this.twtp.executeStorm(json.getString("cat")); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }
242c7f1fcfc1506d4f41c0d68f0a09599a3e48b6
4abd8cedd59bc987b73f5e8825ff1c10571b1df5
/heron-app/src/test/java/com/github/smalnote/app/lang/TestQueue.java
548b9823e42c0be2e770a9d5759bf7f1e5cfcd84
[]
no_license
smalnote/heron
ebbc239171203eccedf5b5b33158d94456291bd8
4bda087a745a01582a616000963ea9369710ab28
refs/heads/master
2021-06-25T18:02:44.620809
2020-11-15T16:55:20
2020-11-15T16:55:20
225,171,394
0
0
null
2021-06-04T02:59:46
2019-12-01T14:05:18
Java
UTF-8
Java
false
false
3,153
java
package com.github.smalnote.app.lang; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runners.model.TestTimedOutException; import java.util.ArrayDeque; import java.util.Deque; import java.util.concurrent.*; import static org.junit.Assert.assertEquals; @SuppressWarnings("ALL") public class TestQueue { @Rule public ExpectedException thrown = ExpectedException.none(); @Test public void shouldSuccessWhenUseDequeAsStack() { Deque<Integer> queue = new ArrayDeque<>(); for (int i = 0; i < 10; i++) { queue.addLast(i); } Integer expected = 9; while (!queue.isEmpty()) { assertEquals(expected--, queue.pollLast()); } // use ArrayDeque as stack/queue is faster } public void should() { /** * TransferQueue * TransferQueue(java7引入)继承了BlockingQueue(BlockingQueue又继承了Queue)并扩展了一些新方法。生产者会一直阻塞直到所添加到队列的元素被某一个消费者所消费(不仅仅是添加到队列里就完事)。 * * LinkedTransferQueue * LinkedTransferQueue实际上是ConcurrentLinkedQueue、SynchronousQueue(公平模式)和LinkedBlockingQueue的超集。而且LinkedTransferQueue更好用,因为它不仅仅综合了这几个类的功能,同时也提供了更高效的实现。 * * 对比SynchronousQueue * SynchronousQueue使用两个队列(一个用于正在等待的生产者、另一个用于正在等待的消费者)和一个用来保护两个队列的锁。而LinkedTransferQueue使用CAS操作实现一个非阻塞的方法,这是避免序列化处理任务的关键。 * * 使用场景 * 当我们不想生产者过度生产消息时,TransferQueue可能非常有用,可避免发生OutOfMemory错误。在这样的设计中,消费者的消费能力将决定生产者产生消息的速度。 * * 作者:go4it * 链接:https://www.jianshu.com/p/b3e97770c551 * 来源:简书 * 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。 */ } @Test public void shouldThrowExceptionAddToBlockingQueue() { thrown.expect(IllegalStateException.class); BlockingDeque<Integer> blockingDeque = new LinkedBlockingDeque<>(10); for (int i = 0; i < 11; i++) { blockingDeque.add(i); } } @Test public void shouldReturnFalseWhenAddToFullBlockingQueue() { BlockingQueue blockingQueue = new LinkedBlockingQueue(10); for (int i = 0; i < 11; i++) { boolean offered = blockingQueue.offer(i); assertEquals(offered, i < 10); } } @Test(timeout = 16) public void shouldBlockWhenAddToTransferQueue() throws InterruptedException { thrown.expect(TestTimedOutException.class); TransferQueue<Integer> transferQueue = new LinkedTransferQueue<>(); transferQueue.transfer(10); } }
cc729c8a5f9b63aea53ab87243d805b437966f0a
733dcfe369cc691eea44b2b58d51f9d78eff8921
/ctt-web/src/main/java/com/atguigu/ct/web/controller/CallLogController.java
b471625d5558687811279142818bdaa5d079e9a4
[]
no_license
clownAdam/atguigu-project-ct
bf25c819d2a3a01dcf91e6f1c56732f41024674e
4a91422d69833e294c8633bd0fc654f6a4217fa9
refs/heads/master
2022-11-30T04:34:54.913713
2020-08-16T13:42:38
2020-08-16T13:42:38
287,937,733
0
0
null
null
null
null
UTF-8
Java
false
false
991
java
package com.atguigu.ct.web.controller; import com.atguigu.ct.web.bean.CallLog; import com.atguigu.ct.web.service.CallLogService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import java.util.List; /** * 通话日志控制器对象 * @author clown */ @Controller public class CallLogController { @Autowired private CallLogService callLogService; @RequestMapping("/query") public String query(){ return "query"; } // @ResponseBody @RequestMapping("/view") public String view(String tel, String callTime, Model model){ System.out.println("hello"); //查询统计结果 List<CallLog> logs = callLogService.queryMonthDates(tel,callTime); System.out.println("logs = " + logs); model.addAttribute("callLogs",logs); return "view"; } }
4f86e32a95c4bffa10846cbe4282b3cea10eb94d
13780d3edb3d4f5faf78168887a9b8628c5c7198
/src/main/java/com/zaphrox/myapp/service/dto/UserDTO.java
9d98c4fa1d01ce7b7d25874c2fb5899938dc05a3
[]
no_license
EinkaufHilfe/jhipster-dialog-application
a0509bd3e05fe9c55239718409f4af2cee9f908a
bc7dd4b4b12284c9fb85c1d7c21ea19b76e66861
refs/heads/main
2023-03-21T13:19:00.115200
2021-03-14T18:16:21
2021-03-14T18:16:21
347,716,708
0
0
null
2021-03-14T18:16:57
2021-03-14T18:16:03
Java
UTF-8
Java
false
false
4,523
java
package com.zaphrox.myapp.service.dto; import com.zaphrox.myapp.config.Constants; import com.zaphrox.myapp.domain.Authority; import com.zaphrox.myapp.domain.User; import java.time.Instant; import java.util.Set; import java.util.stream.Collectors; import javax.validation.constraints.*; /** * A DTO representing a user, with his authorities. */ public class UserDTO { private Long id; @NotBlank @Pattern(regexp = Constants.LOGIN_REGEX) @Size(min = 1, max = 50) private String login; @Size(max = 50) private String firstName; @Size(max = 50) private String lastName; @Email @Size(min = 5, max = 254) private String email; @Size(max = 256) private String imageUrl; private boolean activated = false; @Size(min = 2, max = 10) private String langKey; private String createdBy; private Instant createdDate; private String lastModifiedBy; private Instant lastModifiedDate; private Set<String> authorities; public UserDTO() { // Empty constructor needed for Jackson. } public UserDTO(User user) { this.id = user.getId(); this.login = user.getLogin(); this.firstName = user.getFirstName(); this.lastName = user.getLastName(); this.email = user.getEmail(); this.activated = user.getActivated(); this.imageUrl = user.getImageUrl(); this.langKey = user.getLangKey(); this.createdBy = user.getCreatedBy(); this.createdDate = user.getCreatedDate(); this.lastModifiedBy = user.getLastModifiedBy(); this.lastModifiedDate = user.getLastModifiedDate(); this.authorities = user.getAuthorities().stream().map(Authority::getName).collect(Collectors.toSet()); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getLogin() { return login; } public void setLogin(String login) { this.login = login; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getImageUrl() { return imageUrl; } public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; } public boolean isActivated() { return activated; } public void setActivated(boolean activated) { this.activated = activated; } public String getLangKey() { return langKey; } public void setLangKey(String langKey) { this.langKey = langKey; } public String getCreatedBy() { return createdBy; } public void setCreatedBy(String createdBy) { this.createdBy = createdBy; } public Instant getCreatedDate() { return createdDate; } public void setCreatedDate(Instant createdDate) { this.createdDate = createdDate; } public String getLastModifiedBy() { return lastModifiedBy; } public void setLastModifiedBy(String lastModifiedBy) { this.lastModifiedBy = lastModifiedBy; } public Instant getLastModifiedDate() { return lastModifiedDate; } public void setLastModifiedDate(Instant lastModifiedDate) { this.lastModifiedDate = lastModifiedDate; } public Set<String> getAuthorities() { return authorities; } public void setAuthorities(Set<String> authorities) { this.authorities = authorities; } // prettier-ignore @Override public String toString() { return "UserDTO{" + "login='" + login + '\'' + ", firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' + ", email='" + email + '\'' + ", imageUrl='" + imageUrl + '\'' + ", activated=" + activated + ", langKey='" + langKey + '\'' + ", createdBy=" + createdBy + ", createdDate=" + createdDate + ", lastModifiedBy='" + lastModifiedBy + '\'' + ", lastModifiedDate=" + lastModifiedDate + ", authorities=" + authorities + "}"; } }
265fe269065330ebb60829a5f361c4311881a330
db8319098d05974a1f27865e18fe249f9402ad5e
/adplatform/src/main/java/com/changhong/common/utils/excel/poi/helper/HssfExcelHelper.java
514ba3be47a4b6cb2d3377e2c8d9fe0cd8ddbb25
[]
no_license
zxl1024096977/model
e97cde61056166765ec859d08e62c560d8ab61be
7d0082b10a3dc4f490dd27d228b0dc5e54c55f22
refs/heads/master
2021-07-08T21:35:07.553553
2017-09-27T09:04:44
2017-09-27T09:04:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,692
java
package com.changhong.common.utils.excel.poi.helper; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Date; import java.util.List; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFCellStyle; import org.apache.poi.hssf.usermodel.HSSFFont; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Font; import com.changhong.common.utils.excel.poi.tools.DateUtils; import com.changhong.common.utils.excel.poi.tools.ReflectUtil; import com.changhong.common.utils.excel.poi.tools.StringUtil; /** * 基于POI实现的Excel工具类 * 处理后缀是 xls 的 excel 文件 * */ public class HssfExcelHelper extends ExcelHelper { private static HssfExcelHelper instance = null; // 单例对象 private File file; // 操作文件 /** * 私有化构造方法 * * @param file * 文件对象 */ private HssfExcelHelper(File file) { super(); this.file = file; } public File getFile() { return file; } public void setFile(File file) { this.file = file; } /** * 获取单例对象并进行初始化 * * @param file * 文件对象 * @return 返回初始化后的单例对象 */ public static HssfExcelHelper getInstance(File file) { if (instance == null) { // 当单例对象为null时进入同步代码块 synchronized (HssfExcelHelper.class) { // 再次判断单例对象是否为null,防止多线程访问时多次生成对象 if (instance == null) { instance = new HssfExcelHelper(file); } } } else { // 如果操作的文件对象不同,则重置文件对象 if (!file.equals(instance.getFile())) { instance.setFile(file); } } return instance; } /** * 获取单例对象并进行初始化 * * @param filePath * 文件路径 * @return 返回初始化后的单例对象 */ public static HssfExcelHelper getInstance(String filePath) { return getInstance(new File(filePath)); } @Override public <T> List<T> readExcel(Class<T> clazz, String[] fieldNames, int sheetNo, boolean hasTitle) throws Exception { List<T> dataModels = new ArrayList<T>(); // 获取excel工作簿 HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(file)); HSSFSheet sheet = workbook.getSheetAt(sheetNo); int start = sheet.getFirstRowNum() + (hasTitle ? 1 : 0); // 如果有标题则从第二行开始 for (int i = start; i <= sheet.getLastRowNum(); i++) { HSSFRow row = sheet.getRow(i); if (row == null) { continue; } // 生成实例并通过反射调用setter方法 T target = clazz.newInstance(); for (int j = 0; j < fieldNames.length; j++) { String fieldName = fieldNames[j]; if (fieldName == null || UID.equals(fieldName)) { continue; // 过滤serialVersionUID属性 } // 获取excel单元格的内容 HSSFCell cell = row.getCell(j); if (cell == null) { continue; } String content = cell.getStringCellValue(); // 如果属性是日期类型则将内容转换成日期对象 if (isDateType(clazz, fieldName)) { // 如果属性是日期类型则将内容转换成日期对象 ReflectUtil.invokeSetter(target, fieldName, DateUtils.parse(content)); } else { Field field = clazz.getDeclaredField(fieldName); ReflectUtil.invokeSetter(target, fieldName, parseValueWithType(content, field.getType())); } } dataModels.add(target); } return dataModels; } @Override public <T> List<T> readExcel(Class<T> clazz, String[] fieldNames, int sheetNo, int rowOffset, int cloumnOffset) throws Exception { List<T> dataModels = new ArrayList<T>(); // 获取excel工作簿 HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(file)); HSSFSheet sheet = workbook.getSheetAt(sheetNo); int cloumnLength = fieldNames.length+cloumnOffset; // 如果有标题则从第二行开始 int start = sheet.getFirstRowNum() + rowOffset; for (int i = start; i <= sheet.getLastRowNum(); i++) { HSSFRow row = sheet.getRow(i); if (row == null) { continue; } // 生成实例并通过反射调用setter方法 T target = clazz.newInstance(); for (int j = cloumnOffset; j < cloumnLength; j++) { String fieldName = fieldNames[j-cloumnOffset]; if (fieldName == null || UID.equals(fieldName)) { continue; // 过滤serialVersionUID属性 } // 获取excel单元格的内容 HSSFCell cell = row.getCell(j); if (cell == null) { continue; } String content = cell.getStringCellValue(); // 如果属性是日期类型则将内容转换成日期对象 if (isDateType(clazz, fieldName)) { // 如果属性是日期类型则将内容转换成日期对象 ReflectUtil.invokeSetter(target, fieldName, DateUtils.parse(content)); } else { Field field = clazz.getDeclaredField(fieldName); ReflectUtil.invokeSetter(target, fieldName, parseValueWithType(content, field.getType())); } } dataModels.add(target); } return dataModels; } @Override public <T> void writeExcel(Class<T> clazz, List<T> dataModels, String[] fieldNames, String[] titles) throws Exception { HSSFWorkbook workbook = null; // 检测文件是否存在,如果存在则修改文件,否则创建文件 if (file.exists()) { FileInputStream fis = new FileInputStream(file); workbook = new HSSFWorkbook(fis); } else { workbook = new HSSFWorkbook(); } // 根据当前工作表数量创建相应编号的工作表 String sheetName = DateUtils.format(new Date(), "yyyyMMddHHmmssSS"); HSSFSheet sheet = workbook.createSheet(sheetName); HSSFRow headRow = sheet.createRow(0); // 添加表格标题 for (int i = 0; i < titles.length; i++) { HSSFCell cell = headRow.createCell(i); cell.setCellType(HSSFCell.CELL_TYPE_STRING); cell.setCellValue(titles[i]); // 设置字体加粗 HSSFCellStyle cellStyle = workbook.createCellStyle(); HSSFFont font = workbook.createFont(); font.setBoldweight(Font.BOLDWEIGHT_BOLD); cellStyle.setFont(font); // 设置自动换行 cellStyle.setWrapText(true); cell.setCellStyle(cellStyle); // 设置单元格宽度 sheet.setColumnWidth(i, titles[i].length() * 1000); } // 添加表格内容 for (int i = 0; i < dataModels.size(); i++) { HSSFRow row = sheet.createRow(i + 1); // 遍历属性列表 for (int j = 0; j < fieldNames.length; j++) { // 通过反射获取属性的值域 String fieldName = fieldNames[j]; if (fieldName == null || UID.equals(fieldName)) { continue; // 过滤serialVersionUID属性 } Object result = ReflectUtil.invokeGetter(dataModels.get(i), fieldName); HSSFCell cell = row.createCell(j); cell.setCellValue(StringUtil.toString(result)); // 如果是日期类型则进行格式化处理 if (isDateType(clazz, fieldName)) { cell.setCellValue(DateUtils.format((Date) result)); } } } // 将数据写到磁盘上 FileOutputStream fos = new FileOutputStream(file); try { workbook.write(new FileOutputStream(file)); } finally { if (fos != null) { fos.close(); // 不管是否有异常发生都关闭文件输出流 } } } }
24e2440a7dc78a11da65926b4ca7357cd9a96c45
1f19aec2ecfd756934898cf0ad2758ee18d9eca2
/u-1/u-11/u-11-111/u-11-111-1111/u-11-111-1111-11111/u-11-111-1111-11111-f3369.java
cdad8f820665732160d5e3cdd70cbb7dd7f81918
[]
no_license
apertureatf/perftest
f6c6e69efad59265197f43af5072aa7af8393a34
584257a0c1ada22e5486052c11395858a87b20d5
refs/heads/master
2020-06-07T17:52:51.172890
2019-06-21T18:53:01
2019-06-21T18:53:01
193,039,805
0
0
null
null
null
null
UTF-8
Java
false
false
106
java
mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117 2680322854712
bb002459aab007f3cf7e36c9d1f862c5c6ce158f
b32a1ce53b2e0ae1262a2843b25dbac3a1294f41
/app/src/main/java/com/hr/ui/view/PopWindowUpdate.java
fdbebfad062c71e6d70ba0de6d14d8ec46d8c67e
[]
no_license
Deruwei/800HR60
5398775979c229b12481e70c901512bcea667f5a
238a3f25b96ed579ecdc0901d8fe1266eaff2457
refs/heads/master
2021-05-15T06:34:27.026506
2018-07-16T01:01:07
2018-07-16T01:01:08
113,560,842
0
0
null
null
null
null
UTF-8
Java
false
false
10,863
java
package com.hr.ui.view; import android.annotation.SuppressLint; import android.app.Activity; import android.app.Dialog; import android.app.NotificationManager; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.os.Handler; import android.support.v4.app.NotificationCompat; import android.support.v4.content.FileProvider; import android.text.method.ScrollingMovementMethod; import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.WindowManager; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.PopupWindow; import android.widget.TextView; import android.widget.Toast; import com.hr.ui.BuildConfig; import com.hr.ui.R; import com.hr.ui.bean.VersionBean; import com.hr.ui.ui.main.activity.SplashActivity; import com.hr.ui.utils.ToastUitl; import com.service.DownloadSignatureServic; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.net.URLConnection; /** * Created by wdr on 2018/1/31. */ public class PopWindowUpdate extends Dialog { private int program; protected static final String fileRootPath = Environment.getExternalStorageDirectory() + File.separator; protected static final String fileDownloadPath = "sunrise/download/"; public static final String TAG=PopWindowUpdate.class.getSimpleName(); protected int fileSzie;//文件大小 protected int fileCache;//文件缓存 protected String fileName = "";//文件名 protected String fileNametemp = "";//临时文件 private String versionName; protected String urlStr = "";//下载url protected File downloaddir, downloadfile, downloadfiletemp; private Activity activity; private TextView tvUpdateNow; private VersionBean.AndroidBean androidBean; private BeerProgressView pb_update; private View viewMain; public PopWindowUpdate(Activity activity, VersionBean.AndroidBean androidBean, View view){ super(activity,R.style.MyUpdateDialog); this.activity=activity; this.androidBean=androidBean; this.viewMain=view; } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); initView(); } private void initView() { LayoutInflater inflater = LayoutInflater.from(activity); View view = inflater.inflate(R.layout.layout_update, null); setContentView(view); TextView tvUpdateContent=view.findViewById(R.id.tv_updateContent); tvUpdateNow=view.findViewById(R.id.tv_updateNow); pb_update=view.findViewById(R.id.pb_update); ImageView ivUpdateCancle=view.findViewById(R.id.iv_updateCancel); ivUpdateCancle.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dismiss(); } }); tvUpdateContent.setText(androidBean.getText()); tvUpdateContent.setMovementMethod(ScrollingMovementMethod.getInstance()); setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { if(SplashActivity.instance.isAllreadyInstance==true) { SplashActivity.instance.doAutoLogin(); } } }); tvUpdateNow.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { downLoadApp(); } }); setCanceledOnTouchOutside(false); } private void downLoadApp(){ String s=androidBean.getUrl()+"android/800hr.apk"; fileName = s.substring(s.lastIndexOf("/") + 1); fileName=fileName.substring(0,fileName.indexOf("."))+ androidBean.getVer().replace(".","_")+fileName.substring(fileName.indexOf(".")); /*缓存文件*/ fileNametemp = "download.tmp"; /*下载目录*/ downloaddir = new File(fileRootPath + fileDownloadPath); downloadfile = new File(fileRootPath + fileDownloadPath + fileName); downloadfiletemp = new File(fileRootPath + fileDownloadPath + fileNametemp); DownloadFile(s); /* Bundle bundle = new Bundle(); bundle.putString("signatureurl", androidBean.getUrl()+"android/800hr.apk");*//*电子签名下载地址*//* bundle.putString("versionName",androidBean.getVer()); *//* bundle.putString("version",);*//* Intent it = new Intent().setClass(activity, DownloadSignatureServic.class).putExtras(bundle); if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1) { activity.startForegroundService(it); } else { activity.startService(it); }*/ } /** * install Apk * * @param context * @param filePath */ public void installApp(Context context, String filePath) { File file = new File(filePath); //Log.i("文件的路径",filePath+""); SplashActivity.instance.isAllreadyInstance=false; dismiss(); if (file.exists()) { if (Build.VERSION.SDK_INT >= 24) {//判读版本是否在7.0以上 Uri apkUri = FileProvider.getUriForFile(context, "com.hr.ui.fileProvider", file);//在AndroidManifest中的android:authorities值 Intent install = new Intent(Intent.ACTION_VIEW); install.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); install.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);//添加这一句表示对目标应用临时授权该Uri所代表的文件 install.setDataAndType(apkUri, "application/vnd.android.package-archive"); context.startActivity(install); } else { Intent install = new Intent(Intent.ACTION_VIEW); install.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); install.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(install); } }else{ ToastUitl.showShort("文件不存在"); } } /** * Download Signature * * @param downloadUrl */ @SuppressLint("StaticFieldLeak") protected void DownloadFile(String downloadUrl) { Log.e(TAG, "DownloadFile"); /*文件名*/ if (!downloaddir.exists()) { downloaddir.mkdirs(); } /*如何文件存在 这安装文件*/ if (downloadfile.exists()) { installApp(activity, fileRootPath + fileDownloadPath + fileName); } /*否则下载文件*/ else { /* ToastUitl.showShort("行业找工作后台下载中");*/ program=0; //downloadfile new AsyncTask<String, Integer, String>() { @Override protected void onPreExecute() { pb_update.setBeerProgress(0); super.onPreExecute(); } @Override protected void onProgressUpdate(Integer... values) { if(values[0]==100){ tvUpdateNow.setText("下载完毕"); }else { tvUpdateNow.setText("下载中" + values[0] + "%"); } pb_update.setBeerProgress(values[0]); super.onProgressUpdate(values); } @Override protected String doInBackground(String... params) { try { //fileName = params[0].substring(params[0].lastIndexOf("/") + 1); //Log.e("LLL", "---fileName = " + fileName); //获取文件名 URL myURL = new URL(params[0]); URLConnection conn = myURL.openConnection(); conn.setDoInput(true); conn.connect(); InputStream is = conn.getInputStream(); fileSzie = conn.getContentLength();//根据响应获取文件大小 if (fileSzie <= 0) { throw new RuntimeException("无法获知文件大小 "); } if (is == null) throw new RuntimeException("stream is null"); //*下载目录*//* if (!downloaddir.exists()) { downloaddir.mkdirs(); } //把数据存入 路径+文件名 FileOutputStream fos = new FileOutputStream(downloadfiletemp); byte buf[] = new byte[1024]; fileCache = 0; do { //循环读取 int numread = is.read(buf); if (numread == -1) { fos.close(); break; } fos.write(buf, 0, numread); fileCache += numread; //this.publishProgress(fileCache); publishProgress((int) ((fileCache / (float) fileSzie) * 100)); } while (true); try { is.close(); } catch (Exception ex) { Log.e("tag", "error: " + ex.getMessage()); } } catch (IOException e) { e.printStackTrace(); } return "下载成功"; } @Override protected void onPostExecute(String s) { super.onPostExecute(s); /*下载成功后*/ if (downloadfiletemp.exists()) { downloadfiletemp.renameTo(downloadfile); } //Log.i("文件的路径",downloadfiletemp+"-------"+downloadfile); Toast.makeText(activity, s, Toast.LENGTH_SHORT).show(); installApp(activity, fileRootPath + fileDownloadPath + fileName); /*取消通知*/ /* pb_update.setBeerProgress(100); /*service kill 自杀*/ } }.execute(downloadUrl); } } }
9c59d44e2db1c1f50542db32448c2c0861f72ee5
6a2ac0a015fae62fe7e55205bd5e47f3866d71ae
/Android-TensorFlow/app/build/generated/source/buildConfig/androidTest/debug/com/amitshekhar/tflite/test/BuildConfig.java
f09f1929deec928d9cd5c65c550518f5e116f30d
[ "Apache-2.0" ]
permissive
CSID-DGU/2019-1-OSSP2-A4-3
2ff1afc2f2c27f54bab19951bb42dd8758c2f3d4
b126136aa244377bf8c301f52a31bb1f3624f157
refs/heads/master
2020-05-04T16:57:39.383208
2019-06-19T09:59:37
2019-06-19T09:59:37
179,293,437
1
3
null
null
null
null
UTF-8
Java
false
false
461
java
/** * Automatically generated file. DO NOT MODIFY */ package com.amitshekhar.tflite.test; public final class BuildConfig { public static final boolean DEBUG = Boolean.parseBoolean("true"); public static final String APPLICATION_ID = "com.amitshekhar.tflite.test"; public static final String BUILD_TYPE = "debug"; public static final String FLAVOR = ""; public static final int VERSION_CODE = 1; public static final String VERSION_NAME = "1.0"; }
a07188f34d51e40de59c936bb0813f49690f38ee
5d08aab22da58ac3da6fcb03b8b9395b41343e52
/MethodTest4/src/com/naver/CarRegistManagementService.java
7ade22a5f5806f0c2ac1a31f4d14d7fff4c504e5
[]
no_license
junho4050/javastudy
f6cb52857dfdc7ee6d3b87eaf7c2a2bb92b4828f
9aa5362999d1851946c3edb90f353f73c7f5935d
refs/heads/main
2023-01-19T22:09:31.889243
2020-11-27T08:04:15
2020-11-27T08:04:15
303,949,648
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
635
java
package com.naver; public class CarRegistManagementService { private String carName; public CarRegistManagementService() { carName = "¼Ò³ªÅ¸"; } public void setCarName(String carName) { this.carName = carName; } public String getCarName() { return carName; } public String getCarname() { return carName; } public int getCountCarName(String carName) { int size = carName.length(); return size; } public long add(int a,int b) { return (long)a+b; } }
2c764f30140b81f04d3dc6759ce5ff88a96ac190
2b4e08c4f15e6949780b92270e1cde17b33bb46b
/AtividadeFundamentosJava/src/br/com/fiap/scj/fundamentos/atividade/modelo/Cliente.java
f1bf6317fccd7748c030785bd3bdd0d2511ff9e2
[]
no_license
felipefriserio/AtividadeFundamentosJava
418ff10fb4bee2ae1fae64ea5d8dfceb05eb6b0e
5f133b24b80e4fa2af0ac83aac36ed8306128684
refs/heads/master
2021-05-12T11:24:35.546767
2018-01-13T23:40:44
2018-01-13T23:40:44
117,387,221
0
0
null
null
null
null
UTF-8
Java
false
false
707
java
package br.com.fiap.scj.fundamentos.atividade.modelo; import java.util.List; public class Cliente { public Cliente(String nome) { this.nome = nome; } private String nome; private Carrinho carrinho = new Carrinho(); public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public Cliente querComprarNaQtdPeloPreco(String nomeItem, int quantidade, double preco) { this.carrinho.getItensPedidos().add(new ItemPedido(nomeItem, quantidade, preco)); return this; } public double getPrecoDaCompra() { return this.carrinho.getPreco(); } public List<ItemPedido> getItensPedidosDaCompra(){ return this.carrinho.getItensPedidos(); } }
145c8fb12784235d139fd338c74a737744f790bf
f6f83491421d94250a1479837807fb0f13dce424
/zookeeper/src/main/java/bhz/curator/watcher/CuratorWatcher1.java
379cceaae787f2f465e82784cf162c4b8c4bce95
[]
no_license
qinwenlong/zookeeper
d17bfc7493adc5b3d9b334d3d036eaf8038a7afc
1fd837d37ea599c69dbb0aafdb0b45301988dcca
refs/heads/master
2020-03-26T23:21:24.120762
2018-08-21T08:47:47
2018-08-21T08:47:47
145,534,612
0
0
null
null
null
null
UTF-8
Java
false
false
2,400
java
package bhz.curator.watcher; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import org.apache.curator.RetryPolicy; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.CuratorFrameworkFactory; import org.apache.curator.framework.api.BackgroundCallback; import org.apache.curator.framework.api.CuratorEvent; import org.apache.curator.framework.recipes.cache.NodeCache; import org.apache.curator.framework.recipes.cache.NodeCacheListener; import org.apache.curator.retry.ExponentialBackoffRetry; import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.data.Stat; public class CuratorWatcher1 { /** zookeeper地址 */ static final String CONNECT_ADDR = "192.168.1.171:2181,192.168.1.172:2181,192.168.1.173:2181"; /** session超时时间 */ static final int SESSION_OUTTIME = 5000;//ms public static void main(String[] args) throws Exception { //1 重试策略:初试时间为1s 重试10次 RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 10); //2 通过工厂创建连接 CuratorFramework cf = CuratorFrameworkFactory.builder() .connectString(CONNECT_ADDR) .sessionTimeoutMs(SESSION_OUTTIME) .retryPolicy(retryPolicy) .build(); //3 建立连接 cf.start(); //4 建立一个cache缓存 final NodeCache cache = new NodeCache(cf, "/super", false); cache.start(true); cache.getListenable().addListener(new NodeCacheListener() { /** * <B>方法名称:</B>nodeChanged<BR> * <B>概要说明:</B>触发事件为创建节点和更新节点,在删除节点的时候并不触发此操作。<BR> * @see org.apache.curator.framework.recipes.cache.NodeCacheListener#nodeChanged() */ public void nodeChanged() throws Exception { System.out.println("路径为:" + cache.getCurrentData().getPath()); System.out.println("数据为:" + new String(cache.getCurrentData().getData())); System.out.println("状态为:" + cache.getCurrentData().getStat()); System.out.println("---------------------------------------"); } }); Thread.sleep(1000); cf.create().forPath("/super", "123".getBytes()); Thread.sleep(1000); cf.setData().forPath("/super", "456".getBytes()); Thread.sleep(1000); cf.delete().forPath("/super"); Thread.sleep(Integer.MAX_VALUE); } }
ba6e7ba6be10f66c1107116b19c8a8b26257c2be
51109653ab01c2d9f6f01af36a67bda47fb84aa9
/Project-17-SpringBooot-EmployeeDetails_using_MySQL-1/src/main/java/com/st/repo/EmployeeRepo.java
96d7946951bda6fbc9152eb99c33956c21576bdf
[]
no_license
GITSatya123/Jenkins
b16ea9c0ce095015ba4fdf7969c66f47cf6ba1b8
a5eb14e1664dae22e0825f723d1acbb2cf54822d
refs/heads/master
2022-12-26T20:33:15.496217
2020-10-07T19:34:13
2020-10-07T19:34:13
286,124,159
0
0
null
null
null
null
UTF-8
Java
false
false
191
java
package com.st.repo; import org.springframework.data.jpa.repository.JpaRepository; import com.st.model.Employee; public interface EmployeeRepo extends JpaRepository<Employee, Integer>{ }
7823abbfbf8f03bde0ba5f6d110c74770296e1ed
19cc1abbab87fe64f060066c72bdca6aaa56f929
/EasyResearch/src/main/java/com/junhee/EasyResearch/Model/CommentVO.java
f96fc168637fc2ae6c35058e74a77cbd9d178c65
[]
no_license
zzun0319/EasyResearch
6456d43e702d8f7b25afa86f1ee28158ecf609b1
d1dbb2575525bc4c76e53ed924967ee9e8fcd046
refs/heads/master
2023-07-01T20:33:29.465635
2021-08-14T16:36:15
2021-08-14T16:36:15
389,477,225
0
0
null
null
null
null
UTF-8
Java
false
false
1,475
java
package com.junhee.EasyResearch.Model; import java.sql.Timestamp; public class CommentVO { private long commentId; private UserVO writer; // 글쓴이 정보, 아이디 + 이름까지 필요해서 UserVO로 선언 private int researchId; // 연구 번호 private String content; // 피드백 내용 private Timestamp writeDate; public CommentVO() {} public CommentVO(long commentId, UserVO writer, int researchId, String content, Timestamp writeDate) { this.commentId = commentId; this.writer = writer; this.researchId = researchId; this.content = content; this.writeDate = writeDate; } public long getCommentId() { return commentId; } public void setCommentId(long commentId) { this.commentId = commentId; } public UserVO getWriter() { return writer; } public void setWriter(UserVO writer) { this.writer = writer; } public int getResearchId() { return researchId; } public void setResearchId(int researchId) { this.researchId = researchId; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public Timestamp getWriteDate() { return writeDate; } public void setWriteDate(Timestamp writeDate) { this.writeDate = writeDate; } @Override public String toString() { return "CommentVO [commentId=" + commentId + ", writer=" + writer + ", researchId=" + researchId + ", content=" + content + ", writeDate=" + writeDate + "]"; } }
1bfca66a0b98ba5b00c4a93f5795ff9eac20c45f
ba4826e1e7ea53eba99ce25d9a3bdc01f0245741
/app/src/main/java/com/susion/boring/base/view/LoadMoreRecycleView.java
a192ac0f2d4e45dd1dc66713e27927a61ecf7715
[]
no_license
wherego/Boring
e47779aaf72a87405d6bd31f0789c67a0c66342a
2dcaed6649ce2df7abe07e226e1a05f5155abce1
refs/heads/master
2021-01-20T14:28:23.435106
2017-04-24T02:28:05
2017-04-24T02:28:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,643
java
package com.susion.boring.base.view; import android.content.Context; import android.support.annotation.IntDef; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.StaggeredGridLayoutManager; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import com.susion.boring.base.ui.OnLastItemVisibleListener; import com.susion.boring.utils.RVUtils; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Created by susion on 17/1/19. */ public class LoadMoreRecycleView extends RecyclerView { Context mContext; private LoadMoreAdapter mLoadMoreAdapter; private boolean hasLastListener; public LoadMoreRecycleView(Context context) { super(context); init(); } public LoadMoreRecycleView(Context context, AttributeSet attrs) { super(context, attrs); init(); } public LoadMoreRecycleView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(); } private void init() { mContext = getContext(); } @Override public void setAdapter(Adapter adapter) { if (adapter instanceof LoadMoreAdapter) { mLoadMoreAdapter = (LoadMoreAdapter) adapter; super.setAdapter(adapter); } else { mLoadMoreAdapter = new LoadMoreAdapter(adapter); super.setAdapter(mLoadMoreAdapter); } } @IntDef({LoadMoreView.LOADING, LoadMoreView.LOAD_FAILED, LoadMoreView.NO_LOAD, LoadMoreView.NO_DATA}) @Retention(RetentionPolicy.SOURCE) public @interface LoadMoreStatus { } public void setLoadStatus(@LoadMoreStatus int status) { if (mLoadMoreAdapter != null) { mLoadMoreAdapter.setLoadStatus(status); } } public void setOnLastItemVisibleListener(OnLastItemVisibleListener listener) { RVUtils.setOnLastItemVisibleListener(this, listener); hasLastListener = true; } public class LoadMoreAdapter extends Adapter<ViewHolder> { LoadMoreView mLoadMoreView; public Adapter mAdapter; public static final int LOAD_MORE_VIEW_TYPE = -100; public LoadMoreAdapter(Adapter adapter) { mAdapter = adapter; } private boolean isLoadMoreView(int position) { return hasLastListener ? position == mAdapter.getItemCount() : position == 0 && mAdapter.getItemCount() == 0; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { if (viewType == LOAD_MORE_VIEW_TYPE) { mLoadMoreView = new LoadMoreView(mContext); return new LoadMoreVH(mLoadMoreView); } return mAdapter.onCreateViewHolder(parent, viewType); } @Override public void onBindViewHolder(ViewHolder holder, int position) { if (!isLoadMoreView(position)) { mAdapter.onBindViewHolder(holder, position); } else { if (getLayoutManager() instanceof StaggeredGridLayoutManager ) { StaggeredGridLayoutManager.LayoutParams layoutParams = (StaggeredGridLayoutManager.LayoutParams) (getLayoutManager()).generateDefaultLayoutParams(); layoutParams.setFullSpan(true); holder.itemView.setLayoutParams(layoutParams); } if (holder instanceof VH) { ((VH) holder).onBindViewHolder(); } } } @Override public int getItemViewType(int position) { if (!isLoadMoreView(position)) { return mAdapter.getItemViewType(position); } else { return LOAD_MORE_VIEW_TYPE; } } @Override public int getItemCount() { if (hasLastListener) { return mAdapter.getItemCount() + 1; } return mAdapter.getItemCount(); } public void setLoadStatus(int status) { if (mLoadMoreView != null) { mLoadMoreView.setLoadStatus(status); } } class LoadMoreVH extends VH { public LoadMoreVH(View itemView) { super(itemView); } } class VH extends ViewHolder { public VH(View itemView) { super(itemView); } public void onBindViewHolder() { } } } }
113f31a0f9ce634b28752294c46f1cecd23a25db
14d6ceb88d03f636f54e6a8e912b23159a3aa381
/Apply11Street/app/src/main/java/com/example/dowkk/apply11streetapi/abbyy/BarcodeSettings.java
3df6ab335153331c0bdf8b4013427cadf3b5008b
[]
no_license
hyunahOh/EwhaCapstone2018
8c1056db079fde758eb2c184133df899b5e2efe9
b5d1af09ca9bfc910dae3292d3b5077bff4570c2
refs/heads/master
2020-03-26T03:15:26.301230
2019-12-10T12:23:26
2019-12-10T12:23:26
144,447,051
1
0
null
null
null
null
UTF-8
Java
false
false
485
java
/** * */ package com.example.dowkk.apply11streetapi.abbyy; /** * Barcode recognition settings. * * For all possible parameters see * http://ocrsdk.com/documentation/apireference/processBarcodeField/ */ public class BarcodeSettings { public String asUrlParams() { return "barcodeType=" + barcodeType; } public String getType() { return barcodeType; } public void setType(String newType) { barcodeType = newType; } private String barcodeType = "autodetect"; }
3c96822e7198a346bddc46a42abc1a59121e84e8
63990ae44ac4932f17801d051b2e6cec4abb8ad8
/bus-image/src/main/java/org/aoju/bus/image/metric/internal/xdsi/FederationQueryType.java
07e4e7732e32669872d3d6ca63884d957420aca4
[ "MIT" ]
permissive
xeon-ye/bus
2cca99406a540cf23153afee8c924433170b8ba5
6e927146074fe2d23f9c9f23433faad5f9e40347
refs/heads/master
2023-03-16T17:47:35.172996
2021-02-22T10:31:48
2021-02-22T10:31:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,539
java
/********************************************************************************* * * * The MIT License (MIT) * * * * Copyright (c) 2015-2021 aoju.org and other contributors. * * * * 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 org.aoju.bus.image.metric.internal.xdsi; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; /** * @author Kimi Liu * @version 6.2.0 * @since JDK 1.8+ */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "FederationQueryType", namespace = "urn:oasis:names:tc:ebxml-regrep:xsd:query:3.0") public class FederationQueryType extends RegistryObjectQueryType { }
ea58aec857002568187efd69b8f6a7c6cec468b1
af79916025156e3d0cf4986b126fbe7f059753e2
/web/dx/oa/src/main/java/com/oa/dao/file/FileDao.java
6ba548254253784010970cee5a01b41e2bc1b3a9
[]
no_license
Letmebeawinner/yywt
5380680fadb7fc0d4c86fb92234f7c69cb216010
254fa0f54c09300d4bdcdf8617d97d75003536bd
refs/heads/master
2022-12-26T06:17:11.755486
2020-02-14T10:04:29
2020-02-14T10:04:29
240,468,510
0
0
null
2022-12-16T11:36:21
2020-02-14T09:08:31
Roff
UTF-8
Java
false
false
214
java
package com.oa.dao.file; import com.a_268.base.core.BaseDao; import com.oa.entity.file.File; /** * 文件管理 * * @author ccl * @create 2017-01-04-9:43 */ public interface FileDao extends BaseDao<File>{ }
51a4c1fd52e01643ac89255954c1ea4370cac270
4a62c210099d5dac1cd31b7e51c9c59dfc54557b
/src/test/java/elements/RadioButton.java
97a430dfa6a89e68514a5ace3a3f5fc712b09a18
[]
no_license
AnastasiaPauliuchuk/EpamAutomatedTestingTask
72c6957fa54f593be8386a9f827023768d45a115
8a3ac4808c4c117859400c69b6a2651e8c171ad7
refs/heads/master
2021-05-11T06:40:11.419081
2018-02-21T14:06:48
2018-02-21T14:06:48
117,994,045
0
0
null
null
null
null
UTF-8
Java
false
false
819
java
package elements; import base.element.AbstractBaseElement; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; /** * @author Anastasia Pauliuchuk * created: 1/16/2018. */ public class RadioButton extends AbstractBaseElement { private final static String LABEL_FOR_LOCATOR = "parent::span"; public RadioButton(WebElement wrappedElement) { super(wrappedElement); } @Override public String getElementType() { return "RadioButton"; } private void setChecked(boolean state) { if (wrappedElement.isSelected() != state) { WebElement label = this.findElement(new By.ByXPath(LABEL_FOR_LOCATOR)); label.click(); } } public void check() { setChecked(true); info("checked"); } }
125b1bec5f096a17fa4f4e918bb64eb4fde40f4c
cf729a7079373dc301d83d6b15e2451c1f105a77
/adwords_appengine/src/main/java/com/google/api/ads/adwords/jaxws/v201506/cm/AdGroupExperimentData.java
30e27a3681201093e8b06bdafa26cd1ae6cdf93f
[]
no_license
cvsogor/Google-AdWords
044a5627835b92c6535f807ea1eba60c398e5c38
fe7bfa2ff3104c77757a13b93c1a22f46e98337a
refs/heads/master
2023-03-23T05:49:33.827251
2021-03-17T14:35:13
2021-03-17T14:35:13
348,719,387
0
0
null
null
null
null
UTF-8
Java
false
false
4,324
java
package com.google.api.ads.adwords.jaxws.v201506.cm; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; /** * * Data associated with an advertiser experiment for this adgroup. * <span class="constraint AdxEnabled">This is disabled for AdX.</span> * * * <p>Java class for AdGroupExperimentData complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="AdGroupExperimentData"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="experimentId" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/> * &lt;element name="experimentDeltaStatus" type="{https://adwords.google.com/api/adwords/cm/v201506}ExperimentDeltaStatus" minOccurs="0"/> * &lt;element name="experimentDataStatus" type="{https://adwords.google.com/api/adwords/cm/v201506}ExperimentDataStatus" minOccurs="0"/> * &lt;element name="experimentBidMultipliers" type="{https://adwords.google.com/api/adwords/cm/v201506}AdGroupExperimentBidMultipliers" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "AdGroupExperimentData", propOrder = { "experimentId", "experimentDeltaStatus", "experimentDataStatus", "experimentBidMultipliers" }) public class AdGroupExperimentData { protected Long experimentId; @XmlSchemaType(name = "string") protected ExperimentDeltaStatus experimentDeltaStatus; @XmlSchemaType(name = "string") protected ExperimentDataStatus experimentDataStatus; protected AdGroupExperimentBidMultipliers experimentBidMultipliers; /** * Gets the value of the experimentId property. * * @return * possible object is * {@link Long } * */ public Long getExperimentId() { return experimentId; } /** * Sets the value of the experimentId property. * * @param value * allowed object is * {@link Long } * */ public void setExperimentId(Long value) { this.experimentId = value; } /** * Gets the value of the experimentDeltaStatus property. * * @return * possible object is * {@link ExperimentDeltaStatus } * */ public ExperimentDeltaStatus getExperimentDeltaStatus() { return experimentDeltaStatus; } /** * Sets the value of the experimentDeltaStatus property. * * @param value * allowed object is * {@link ExperimentDeltaStatus } * */ public void setExperimentDeltaStatus(ExperimentDeltaStatus value) { this.experimentDeltaStatus = value; } /** * Gets the value of the experimentDataStatus property. * * @return * possible object is * {@link ExperimentDataStatus } * */ public ExperimentDataStatus getExperimentDataStatus() { return experimentDataStatus; } /** * Sets the value of the experimentDataStatus property. * * @param value * allowed object is * {@link ExperimentDataStatus } * */ public void setExperimentDataStatus(ExperimentDataStatus value) { this.experimentDataStatus = value; } /** * Gets the value of the experimentBidMultipliers property. * * @return * possible object is * {@link AdGroupExperimentBidMultipliers } * */ public AdGroupExperimentBidMultipliers getExperimentBidMultipliers() { return experimentBidMultipliers; } /** * Sets the value of the experimentBidMultipliers property. * * @param value * allowed object is * {@link AdGroupExperimentBidMultipliers } * */ public void setExperimentBidMultipliers(AdGroupExperimentBidMultipliers value) { this.experimentBidMultipliers = value; } }
e2e231b8a1dd03d4fb91129ae1be47fcedfd112d
0967f32b3185e5fe0a0f4bad177ff19e5bf1a954
/Java/fitg/fitg.basegame/src/test/java/com/rogers/rmcdouga/fitg/basegame/BaseGameActionTest.java
8b8d8f92de1f4b2f0514f9df97c182aa345cb7ae
[ "Apache-2.0" ]
permissive
rmcdouga/FitG
bd1dfa8a6b09c17cb1bfd08f48dc7e18732b716a
f1108455bc92591ae09dbc6c20d7b61ce98956ac
refs/heads/master
2022-06-07T19:18:52.371821
2022-05-14T12:40:06
2022-05-14T12:40:06
144,883,874
2
0
Apache-2.0
2021-04-27T12:28:48
2018-08-15T17:36:32
Java
UTF-8
Java
false
false
3,353
java
package com.rogers.rmcdouga.fitg.basegame; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.IntStream; import org.junit.jupiter.api.Test; class BaseGameActionTest { private static final int EXPECTED_NUM_OF_ACTIONS = 30; private static final int EXPECTED_START_CARD_NO = 68; private static final int EXPECTED_END_CARD_NO = EXPECTED_START_CARD_NO + EXPECTED_NUM_OF_ACTIONS - 1; @Test void testIsSuccessful_true() { assertTrue(BaseGameAction.CARD_68.isSuccessful(BaseGameMission.STEAL_ENEMY_RESOURCES, Action.EnvironType.URBAN), "Expected Mission to be successful."); } @Test void testIsSuccessful_false() { assertFalse(BaseGameAction.CARD_68.isSuccessful(BaseGameMission.ASSASINATION, Action.EnvironType.URBAN), "Expected Mission to be successful."); } @Test void testActionCardNumbers() { assertEquals(EXPECTED_NUM_OF_ACTIONS, BaseGameAction.ALL_ACTIONS.size(), "Expected there to be " + EXPECTED_NUM_OF_ACTIONS + " unique actions."); } @Test void testNumberOfActions() { Set<Integer> expectedCards = IntStream.rangeClosed(EXPECTED_START_CARD_NO, EXPECTED_END_CARD_NO).mapToObj(Integer::valueOf).collect(Collectors.toSet()); Set<Integer> foundCards = BaseGameAction.ALL_ACTIONS.stream().mapToInt(BaseGameAction::cardNumber).mapToObj(Integer::valueOf).collect(Collectors.toSet()); assertEquals(expectedCards, foundCards, "Expected card numbers and found card numbers should match."); } @Test void testGetMissions() { Action action = BaseGameAction.CARD_68; Set<Mission> missions = action.getMissions(Action.EnvironType.URBAN); assertEquals(2, missions.size(), "Expected only two missions for card 68."); assertTrue(missions.contains(BaseGameMission.STEAL_ENEMY_RESOURCES), "Expected Card 68 missions to contain STEAL EMENY RESOURCES"); assertTrue(missions.contains(BaseGameMission.START_STOP_REBELLION), "Expected Card 68 missions to contain START_STOP_REBELLION"); assertFalse(missions.contains(BaseGameMission.ASSASINATION), "Expected Card 68 missions to not contain ASSASSINATION"); } @Test void testGetMissionLetters_NoDelim() { Action action = BaseGameAction.CARD_68; String missionLetters = action.getMissionLetters(Action.EnvironType.URBAN); assertEquals("H R", missionLetters, "Expected mission letters to be 'R H'."); } @Test void testGetMissionLetters_WithDelim() { Action action = BaseGameAction.CARD_68; String missionLetters = action.getMissionLetters(Action.EnvironType.URBAN, "|"); assertEquals("H|R", missionLetters, "Expected mission letters to be 'R|H'."); } @Test void testActionFactory_GetAction() { Optional<Action> action = BaseGameAction.actionfactory().getAction(74); assertTrue(action.isPresent(), "Expected to find card 74."); assertEquals(BaseGameAction.CARD_74, action.get(), "Expected to retrieve CARD_74"); } @Test void testActionFactory_GetAction_InvalidCard() { Optional<Action> action = BaseGameAction.actionfactory().getAction(1); assertFalse(action.isPresent(), "Expected not to find card 1."); } }
b65a2cfaf25028ace7469aeb1769cabe8a27b158
3e309d60e1d45596f2012e96379bb706fe972c1e
/app/src/main/java/wiredhorizon/response/HostPollFragment.java
c89286fcb2e01de2842c4ef4a0491149e86d1669
[]
no_license
czhu12/Response
64bfd7663e571eb562bcc6c6f471bcbd6b3b588e
42b58f06f1227875b861d27c396f42fb0b07b1ab
refs/heads/master
2016-09-05T15:52:52.863593
2014-08-29T23:21:21
2014-08-29T23:21:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,005
java
package wiredhorizon.response; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; import java.util.Timer; import java.util.TimerTask; /** * Created by chriszhu on 7/10/14. */ public class HostPollFragment extends Fragment { private int roomID; private TextView timer; private Thread t; private Button openPoll; private int timerValue = 0; private boolean shouldBeTiming = true; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_host_poll, container, false); Bundle bundle = getArguments(); roomID = bundle.getInt("ROOM_ID"); initialize(rootView); return rootView; } private void initialize(View rootView) { openPoll = (Button) rootView.findViewById(R.id.open_poll); timer = (TextView) rootView.findViewById(R.id.open_poll_timer); openPoll.setOnClickListener(new Button.OnClickListener() { @Override public void onClick(View v) { setTimerVisibility(View.VISIBLE); setPollOpenButtonVisibility(View.INVISIBLE); startTimer(); } }); } private void setPollOpenButtonVisibility(int visible) { openPoll.setVisibility(visible); } private void setTimerVisibility(int visible) { timer.setVisibility(visible); } public void startTimer() { t = new Thread(new Runnable() { @Override public void run() { while (shouldBeRunning()) { try { getActivity().runOnUiThread(new Runnable() { @Override public void run() { setTimerValue(); incrementTimerValue(); } }); Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } } }); t.start(); } private boolean shouldBeRunning() { return shouldBeTiming; } private void incrementTimerValue () { timerValue++; } private void setTimerValue() { String seconds = String.valueOf(timerValue % 60); String minutes = String.valueOf(timerValue / 60); if (minutes.length() == 1) { minutes = "0" + minutes; } if (seconds.length() == 1) { seconds = "0" + seconds; } timer.setText(minutes + ":" + seconds); } @Override public void onDestroy() { shouldBeTiming = false; super.onDestroy(); } }
70a04d283011b1261e0ae5139bf8fbcef703073b
e475cc0eb9550fb980e27936add50c9f17c2dd0b
/src/main/java/br/com/necroterio/model/enums/Estado.java
dfa93cbd72f4f14b4939189499dbec28686da25d
[]
no_license
LuMistro/SistemaNecroterio
c158b4737f7a8c45b6cbd48ef5c04374bb062067
c5acecc3b636eb02f24ecdc5d1f6b52eb4c3e17b
refs/heads/master
2022-06-21T19:10:36.184836
2019-12-05T00:26:58
2019-12-05T00:26:58
218,783,953
0
0
null
null
null
null
UTF-8
Java
false
false
829
java
package br.com.necroterio.model.enums; public enum Estado { AC("Acre"), AL("Alagoas"), AP("Amapá"), AM("Amazonas"), BA("Bahia"), CE("Ceará"), DF("Distrito Federal"), ES("Espirito Santo"), GO("Goiás"), MA("Maranhão"), MT("Mato Grosso"), MS("Mato Grosso do Sul"), MG("Minas Gerais"), PA("Pará"), PB("Paraiba"), PR("Paraná"), PE("Pernambuco"), PI("Piauí"), RJ("Rio de Janeiro"), RN("Rio Grande do Norte"), RS("Rio Grande do Sul"), RO("Rondônia"), RR("Roraima"), SC("Santa Catarina"), SP("São Paulo"), SE("Sergipe"), TO("Tocantins"); private String descricao; Estado(String descricao) { this.descricao = descricao; } public String getDescricao() { return descricao; } }
cbeb13902bfff18a695879d1bafa2601d4dfc15d
e01656767f7e5f464e40792fb245068d876051dc
/Vmware/src/main/java/com/vmware/sample/model/vm/DiskToInfo.java
93294986df5127717f8e12c081d2ae4fe549d4d0
[ "MIT" ]
permissive
TaylorKanper/vmwarePlugin
cf18fd850e4fef302141d47fd911c17988736bee
310889f931a6ddf649c53812bcfcd8636bbb79d7
refs/heads/master
2023-07-29T19:02:20.714682
2021-01-22T15:32:43
2021-01-22T15:32:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
460
java
/* * Copyright (c). 2021-2021. All rights reserved. */ package com.vmware.sample.model.vm; import lombok.Getter; import lombok.Setter; /** * Virtual machine's disk info * * @since 2020-09-15 */ @Setter @Getter public class DiskToInfo { /** * disk name */ private String diskName; /** * disk size */ private Long diskSize; /** * yes or no thin provisioning */ private boolean thinProvisioned; }
[ "Huawei@1234!@#$" ]
Huawei@1234!@#$
7195f9942098fbee1eaf978efdc88552e5b98126
8316e7b6be9b46a7d383af2181ec53331e2721c4
/src/com/myApp/gwt/client/internationalizaton/MyConstants.java
126b4f3cee3238be1fb49fce28e7a80c3d0a2a6f
[]
no_license
FedirChuiko/MyGWT
ef89ca35c7540d4d1349c596e2c8aeefa19af778
dccc4ea8caad0a4627426acf0b3124ee25fbf6ab
refs/heads/master
2021-01-10T17:19:44.055360
2016-03-23T14:35:38
2016-03-23T14:35:38
53,136,896
0
0
null
null
null
null
UTF-8
Java
false
false
754
java
package com.myApp.gwt.client.internationalizaton; /** * Created by Fedir on 03.03.2016. */ import com.google.gwt.i18n.client.Constants; public interface MyConstants extends Constants { @DefaultStringValue("Good morning, ") String goodMorning(); @DefaultStringValue("Good evening, ") String goodEvening(); @DefaultStringValue("Good night, ") String goodNight(); @DefaultStringValue("Good day, ") String goodDay(); @DefaultStringValue("User: ") String user(); @DefaultStringValue("Password: ") String password(); @DefaultStringValue("Login") String login(); @DefaultStringValue("Invalid username or password") String invalidPassword(); @DefaultStringValue("Exit") String exit(); }
9d30817bfc87c8c73ca996f8bed5aa8836d38b56
0ae20f3489e436910c346a5d17cdcfb4c1041106
/src/codigo/PanelColores.java
822a8e7ad099bf3f6edcb58c96a20d47ba5487d6
[]
no_license
Ignacio1973/Java_Paint2019_Grupo
8a5616ab1886277cbd7fd370b89b6a62db90e40f
62f066c0617866d015fe40a160d7540b624f0987
refs/heads/master
2020-04-27T00:11:10.264567
2019-03-13T12:54:47
2019-03-13T12:54:47
173,926,449
0
0
null
2019-03-05T10:34:54
2019-03-05T10:34:54
null
UTF-8
Java
false
false
1,726
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 codigo; /** * * @author PAPA */ public class PanelColores extends javax.swing.JPanel { /** * Creates new form PanelColores */ public PanelColores() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jButton1 = new javax.swing.JButton(); jButton1.setText("jButton1"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jButton1) .addGap(0, 37, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jButton1) .addGap(0, 229, Short.MAX_VALUE)) ); }// </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; // End of variables declaration//GEN-END:variables }
019eeb89d43daa727db126b191b852c584c52d3e
a10b492150149d5a070d514c3695e70af9acaa46
/src/main/java/com/fan/eightrestaurant/utils/PathUtils.java
65abdf4cfe9b8d35f4060520d824122638f23824
[ "Apache-2.0" ]
permissive
arilpan/IFood
5b44e72b01342c516bbc9692b49a339a1560d426
4fa679f49689ddd9e68a7a286b09350cad6c5431
refs/heads/master
2021-01-18T17:38:53.749795
2016-09-26T17:04:50
2016-09-26T17:04:50
69,270,371
1
0
null
null
null
null
UTF-8
Java
false
false
2,487
java
package com.fan.eightrestaurant.utils; import com.ydxiaoyuan.ifood.api.APIConfig; /** * Created by xdkj on 2016/8/8. * 接口类 */ public class PathUtils { public static String path = APIConfig.IP_PORT; /** * 用户注册、修改密码短信接口 */ public static String postSendCodeUrl() { return path + "/GrogshopSystem/app/sendCode.do"; } /** * 用户注册保存接口 */ public static String postUserRegisterUrl() { return path + "/GrogshopSystem/app/userRegister.do"; } /** * 用户登录接口 */ public static String postUserLoginUrl() { return path + "/GrogshopSystem/app/userLogin.do"; } /** * 用户修改密码接口 */ public static String postUpdatePwdUrl() { return path + "/GrogshopSystem/app/updatePwd.do"; } /** * 用户登录重置密码接口 */ public static String postResetPasswordUrl() { return path + "/GrogshopSystem/app/updataPassword.do"; } /** * 用户个人资料修改保存接口 */ public static String postUpdateInformationUrl() { return path + "/GrogshopSystem/app/updateInformation.do"; } /** * 用户上传头像接口 */ public static String postImageUploadUrl() { return path + "/GrogshopSystem/app/imageUpload.do"; } /** * 留言——常见问题查询接口 */ public static String getAppListMessageUrl() { return path + "/GrogshopSystem/app/MessageBack/appListMessage.do"; } /** * 客户问题查询 传user_id用户主键 hotel_id菜馆主键 */ public static String getAppListBackMessageUrl() { return path + "/GrogshopSystem/app/MessageBack/appListBackMessage.do"; } /** * 客服回复问题或者提问问题,传back_content回复内容 createuser_id用户主键 createuser用户名称 hotel_id菜馆主键 */ public static String getAppAddBackMessageUrl() { return path + "/GrogshopSystem/app/MessageBack/appAddBackMessage.do"; } /** * 专属优惠信息接口preferential */ public static String getPreferentialUrl() { return path + "/GrogshopSystem/app/appShop/shop_RechargeDiscount_info.do?shop_id=&card_type=2"; } /** * 专属优惠详情的接口 */ public static String getPreferentialDtailsUrl() { return path + "/GrogshopSystem/app/appShop/appShowDiscounts.do?"; } /** * 用户注销登录接口 */ public static String postLoginOutUrl() { return path + "/GrogshopSystem/app/loginOut.do"; } }
[ "pan aril" ]
pan aril
28326b123247f4c0d62538daf20161dda2e813ba
590743a486c9fc609db115f2bc868a930a6cdfd1
/yggdrasil-cache-spring-boot-starter/src/main/java/io/github/s3s3l/yggdrasil/starter/cache/WrapperFilter.java
4d71788284715da24e78cb4fdd7d542caa602b13
[ "Apache-2.0" ]
permissive
S3S3L/yggdrasil
6730501fa75bcf37a0a72a80fa484313641c52fa
610b25747a1647510e2d5abcea5d7b74a4d862d9
refs/heads/master
2023-08-09T16:50:32.975806
2023-08-09T08:52:57
2023-08-09T08:52:57
193,113,715
6
1
Apache-2.0
2023-07-20T01:22:57
2019-06-21T14:40:22
Java
UTF-8
Java
false
false
1,539
java
package io.github.s3s3l.yggdrasil.starter.cache; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.util.ContentCachingRequestWrapper; import org.springframework.web.util.ContentCachingResponseWrapper; public class WrapperFilter implements Filter { @Override public void init(FilterConfig filterConfig) throws ServletException { } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { ServletResponse res = response; ServletRequest req = request; if (request instanceof HttpServletRequest && !(request instanceof ContentCachingRequestWrapper)) { req = new ContentCachingRequestWrapper((HttpServletRequest) request); } if (response instanceof HttpServletResponse && !(response instanceof ContentCachingResponseWrapper)) { res = new ContentCachingResponseWrapper((HttpServletResponse) response); } chain.doFilter(req, res); if (res instanceof ContentCachingResponseWrapper) { ((ContentCachingResponseWrapper) res).copyBodyToResponse(); } } @Override public void destroy() { } }
1be8414f5c943653fb11736e43137440657cee61
b98514eaefbc30b7b573922bd09887162d31aedd
/feep-media/src/main/java/cn/flyrise/feep/media/images/adapter/GridDivideDecoration.java
23541105c189879bc658f537875aa4e72a83fa7c
[]
no_license
mofangwan23/LimsOA
c7a6c664531fcd8b950aed62d02f8a5fe6ca233c
37da27081432a719fddd1a7784f9a2f29274a083
refs/heads/main
2023-05-29T22:25:44.839145
2021-06-18T09:41:17
2021-06-18T09:41:17
363,003,883
3
2
null
null
null
null
UTF-8
Java
false
false
5,202
java
package cn.flyrise.feep.media.images.adapter; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.StaggeredGridLayoutManager; import android.view.View; /** * @author ZYP * @since 2017-10-18 10:49 */ public class GridDivideDecoration extends RecyclerView.ItemDecoration { private static final int[] ATTRS = new int[]{android.R.attr.listDivider}; private Drawable mDivider; public GridDivideDecoration(Context context) { final TypedArray a = context.obtainStyledAttributes(ATTRS); mDivider = a.getDrawable(0); a.recycle(); } @Override public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) { drawGridHorizontal(c, parent); drawGridVertical(c, parent); } public Drawable getDivider() { return mDivider; } private int getSpanCount(RecyclerView parent) { int spanCount = -1; // 列数 RecyclerView.LayoutManager layoutManager = parent.getLayoutManager(); if (layoutManager instanceof GridLayoutManager) { spanCount = ((GridLayoutManager) layoutManager).getSpanCount(); } else if (layoutManager instanceof StaggeredGridLayoutManager) { spanCount = ((StaggeredGridLayoutManager) layoutManager).getSpanCount(); } return spanCount; } public void drawGridHorizontal(Canvas c, RecyclerView parent) { int childCount = parent.getChildCount(); for (int i = 0; i < childCount; i++) { final View child = parent.getChildAt(i); final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams(); final int left = child.getLeft() - params.leftMargin; final int right = child.getRight() + params.rightMargin + mDivider.getIntrinsicWidth(); final int top = child.getBottom() + params.bottomMargin; final int bottom = top + mDivider.getIntrinsicHeight(); mDivider.setBounds(left, top, right, bottom); mDivider.draw(c); } } public void drawGridVertical(Canvas c, RecyclerView parent) { final int childCount = parent.getChildCount(); for (int i = 0; i < childCount; i++) { final View child = parent.getChildAt(i); final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams(); final int top = child.getTop() - params.topMargin; final int bottom = child.getBottom() + params.bottomMargin; final int left = child.getRight() + params.rightMargin; final int right = left + mDivider.getIntrinsicWidth(); mDivider.setBounds(left, top, right, bottom); mDivider.draw(c); } } private boolean isLastColum(RecyclerView parent, int pos, int spanCount, int childCount) { RecyclerView.LayoutManager layoutManager = parent.getLayoutManager(); if (layoutManager instanceof GridLayoutManager) { if ((pos + 1) % spanCount == 0) {// 如果是最后一列,则不需要绘制右边 return true; } } else if (layoutManager instanceof StaggeredGridLayoutManager) { int orientation = ((StaggeredGridLayoutManager) layoutManager).getOrientation(); if (orientation == StaggeredGridLayoutManager.VERTICAL) { if ((pos + 1) % spanCount == 0) {// 如果是最后一列,则不需要绘制右边 return true; } } else { childCount = childCount - childCount % spanCount; if (pos >= childCount) {// 如果是最后一列,则不需要绘制右边 return true; } } } return false; } private boolean isLastRaw(RecyclerView parent, int pos, int spanCount, int childCount) { RecyclerView.LayoutManager layoutManager = parent.getLayoutManager(); if (layoutManager instanceof GridLayoutManager) { childCount = childCount - childCount % spanCount; if (pos >= childCount) {// 如果是最后一行,则不需要绘制底部 return true; } } else if (layoutManager instanceof StaggeredGridLayoutManager) { int orientation = ((StaggeredGridLayoutManager) layoutManager).getOrientation(); // StaggeredGridLayoutManager 且纵向滚动 if (orientation == StaggeredGridLayoutManager.VERTICAL) { childCount = childCount - childCount % spanCount; // 如果是最后一行,则不需要绘制底部 if (pos >= childCount) return true; } else { // StaggeredGridLayoutManager 且横向滚动 // 如果是最后一行,则不需要绘制底部 if ((pos + 1) % spanCount == 0) { return true; } } } return false; } @Override public void getItemOffsets(Rect outRect, int itemPosition, RecyclerView parent) { int spanCount = getSpanCount(parent); int childCount = parent.getAdapter().getItemCount(); if (isLastRaw(parent, itemPosition, spanCount, childCount)){// 如果是最后一行,则不需要绘制底部 outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0); } else if (isLastColum(parent, itemPosition, spanCount, childCount)){// 如果是最后一列,则不需要绘制右边 outRect.set(0, 0, 0, mDivider.getIntrinsicHeight()); } else { outRect.set(0, 0, mDivider.getIntrinsicWidth(), mDivider.getIntrinsicHeight()); } } }
f2aa74c358fc1220d27bf2241761dd7c5831f301
f946632b3b47af3b564e1ecf4262f7011c75dfa6
/app/src/main/java/com/unitesoft/huanrong/Bean/mine/NickNamePostBean.java
a3dd8778957b0752ba85f29c483f4d384be9b58d
[]
no_license
zyf19930419/RuiYin
34228695899a09c32326199e60f877e8794ccf03
aabea64c99c32a20504d17aa4b81bf7c153b01ca
refs/heads/master
2021-01-15T12:43:54.764120
2017-10-16T08:24:41
2017-10-16T08:24:41
99,656,253
1
1
null
null
null
null
UTF-8
Java
false
false
638
java
package com.unitesoft.huanrong.Bean.mine; /** * Created by Mr.zhang on 2017/8/11. */ public class NickNamePostBean { private String userPhone; private String nickName; public NickNamePostBean(String userPhone, String nickName) { this.userPhone = userPhone; this.nickName = nickName; } public String getUserPhone() { return userPhone; } public void setUserPhone(String userPhone) { this.userPhone = userPhone; } public String getNickName() { return nickName; } public void setNickName(String nickName) { this.nickName = nickName; } }
a2a45af1d33062b4fa427b41aa4dec2e775207e2
a245581e6ae82609af7dc20bcedd8aa70cb0e08d
/HibernatePractice/src/main/java/com/joincolumn/Answer.java
dd88037f446a91dd5cd472a70f77fa847253b121
[]
no_license
priyks/HibernatePractice
042d0d8da3cf6d4fd51fa1d994b067eac63cb7ea
7b96d6420a1ab2f61180619be6f02afdc5fdbd41
refs/heads/main
2023-03-22T16:04:00.576229
2021-03-09T10:37:30
2021-03-09T10:37:30
344,445,164
0
0
null
null
null
null
UTF-8
Java
false
false
1,273
java
package com.joincolumn; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OneToOne; @Entity public class Answer { @Id @Column(name="answer_id") private int answerId; private String answer; @OneToOne(mappedBy="answer") // mapping depends on question table private Question question; /** * @return the question */ public Question getQuestion() { return question; } /** * @param question the question to set */ public void setQuestion(Question question) { this.question = question; } /** * @param answerId * @param answer */ public Answer(int answerId, String answer) { super(); this.answerId = answerId; this.answer = answer; } public Answer() { super(); // TODO Auto-generated constructor stub } /** * @return the answerId */ public int getAnswerId() { return answerId; } /** * @param answerId the answerId to set */ public void setAnswerId(int answerId) { this.answerId = answerId; } /** * @return the answer */ public String getAnswer() { return answer; } /** * @param answer the answer to set */ public void setAnswer(String answer) { this.answer = answer; } }
eda81351a638e72258946989164aad3414f3300a
55e093bfeea384973176c71edf3e71a4dd39f981
/oop_exercises/src/main/java/ch/hslu/sw_05/switchable/Motor.java
bc26ca442ee659aaf5156230451028d62e313dc8
[ "Apache-2.0" ]
permissive
nvondru/hslu_oop
50f108c052e4cc97113b96f29f237f6c0a8cbf16
0b0ecc6c7f875f560fa580ff3d3b3d654da1dd08
refs/heads/main
2023-02-17T11:21:15.247204
2021-01-10T13:47:58
2021-01-10T13:47:58
302,082,611
0
0
null
null
null
null
UTF-8
Java
false
false
555
java
package ch.hslu.sw_05.switchable; public class Motor implements Switchable { private boolean running = false; public Motor(boolean running) { this.running = running; } @Override public void switchOn() { this.running = true; } @Override public void switchOff() { this.running = false; } @Override public boolean isSwitchedOn() { return this.running ? true : false; } @Override public boolean isSwitchedOff() { return this.running ? false : true; } }
0906f28637ad5a6b71643ab5e726ee6f74f70008
5a152bc99251de1916de2e7ec302987a3b2a2aba
/herddb-net/src/main/java/herddb/network/Channel.java
9009b406c5d4947c27f5e05ac68ce324b1e46c86
[ "Apache-2.0" ]
permissive
dianacle/herddb
89292fd0ce64516c928cc1398b0fabd6cb3c6868
b7d552bc3f6f6864c46e4b6d913dcbf55b853c13
refs/heads/master
2021-06-02T17:25:55.308049
2016-04-14T13:19:46
2016-04-14T13:19:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,033
java
/* Licensed to Diennea S.r.l. under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. Diennea S.r.l. 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 herddb.network; import java.io.IOException; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; /** * Abstract for two-way async comunication channels * * @author enrico.olivelli */ public abstract class Channel implements AutoCloseable { protected ChannelEventListener messagesReceiver; protected String name = "unnamed"; public Channel() { } public ChannelEventListener getMessagesReceiver() { return messagesReceiver; } public void setMessagesReceiver(ChannelEventListener messagesReceiver) { this.messagesReceiver = messagesReceiver; } public abstract void sendOneWayMessage(Message message, SendResultCallback callback); public abstract void sendReplyMessage(Message inAnswerTo, Message message); public abstract void sendMessageWithAsyncReply(Message message, long timeout, ReplyCallback callback); public abstract void channelIdle(); @Override public abstract void close(); public Message sendMessageWithReply(Message message, long timeout) throws InterruptedException, TimeoutException { CompletableFuture<Message> resp = new CompletableFuture<>(); sendMessageWithAsyncReply(message, timeout, (Message originalMessage, Message message1, Throwable error) -> { if (error != null) { resp.completeExceptionally(error); } else { resp.complete(message1); } }); try { return resp.get(timeout, TimeUnit.MILLISECONDS); } catch (ExecutionException err) { if (err.getCause() instanceof IOException) { TimeoutException te = new TimeoutException("io-error while waiting for reply"); te.initCause(err.getCause()); throw te; } throw new RuntimeException(err.getCause()); } } public abstract boolean isValid(); public String getName() { return name; } public void setName(String name) { this.name = name; } }
a7a4bab1c1943355f552f6eb75376ea57e5bbf36
ef0d2c7c79bf3a7e1bd718081b8d78c89350b8b3
/src/item/Item.java
044a94652af9e4683fe04183ebba0f16294e565e
[]
no_license
kalmanbendeguz/icefield
561ed55609f9be31bc46665583d0766d86543a0a
d046070e76650c797bece0aa4a82ea10a9389f9b
refs/heads/main
2023-02-20T00:25:04.819731
2021-01-22T21:29:37
2021-01-22T21:29:37
332,058,433
0
0
null
null
null
null
UTF-8
Java
false
false
582
java
package item; import player.Player; /** * Eszkoz osztaly, ami egy jatekbeli eszkozt (pl. aso, kotel, etel) reprezental, ezeknek absztrakt ososztalya. */ public abstract class Item implements java.io.Serializable { /** * Az eszkoz hasznalatanak megvalositasat implementalo fuggvenyek ezt a fuggvenyt definialjak felul. * @param player A szereplo, aki hasznalja */ public abstract void Use(Player player); /** * Az item nevevel ter vissza, azonositashoz kell * @return megvalositas fuggo (string) */ public abstract String getName(); }
98ce7ebc705a6512d0222a8965a0c7b91e76f9d2
7b92d35a860af15a85ec8aeb4f0d2bba94ef673e
/ANDROID/Chenjun.demo.abstracttabactivity/Chenjun.demo.abstracttabactivity/src/main/java/com/chenjun/demo/abstracttabactivity/AbstractMyActivityGroup.java
f2a43fe8d283c30a07b08be8a2baa5dbf601e9c6
[]
no_license
chaochaoyet/MyFanCard01
6919ea971f57a0001a8de673e1bbfed8998f0ba3
d222487648380f414d830b5556eb4da7b199e9a8
refs/heads/master
2021-01-19T19:34:38.064552
2015-08-11T14:13:45
2015-08-11T14:13:45
40,545,329
0
2
null
null
null
null
GB18030
Java
false
false
3,602
java
package com.chenjun.demo.abstracttabactivity; import android.app.Activity; import android.app.ActivityGroup; import android.app.LocalActivityManager; import android.content.Intent; import android.os.Bundle; import android.view.ViewGroup; import android.widget.CompoundButton; import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; import android.widget.RadioButton; /** * 自己实现的一个通用ActivityGroup。 * 可以通过简单的重写它来制作有导航按钮和用导航按钮控制动态加载Activity的ActivityGroup。 * 开发者需要在实现类中实现三个方法: * 1.指定动态加载Activity的容器的对象,getContainer()方法。 * 2.初始化所有的导航按钮,initRadioBtns()方法,开发者要遍历所有的导航按钮并执行initRadioBtn(int id)方法。 * 3.实现导航按钮动作监听器的具体方法,onCheckedChanged(...)方法。这个方法将实现某个导航按钮与要启动对应的Activity的关联关系,可以调用setContainerView(...)方法。 * @author zet * */ public abstract class AbstractMyActivityGroup extends ActivityGroup implements CompoundButton.OnCheckedChangeListener{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); initRadioBtns(); } //加载Activity的View容器,容器应该是ViewGroup的子类 private ViewGroup container; private LocalActivityManager localActivityManager; /** * 加载Activity的View容器的id并不是固定的,将命名规则交给开发者 * 开发者可以在布局文件中自定义其id,通过重写这个方法获得这个View容器的对象 * @return */ abstract protected ViewGroup getContainer(); /** * 供实现类调用,根据导航按钮id初始化按钮 * @param id */ protected void initRadioBtn(int id){ RadioButton btn = (RadioButton) findViewById(id); btn.setOnCheckedChangeListener(this); } /** * 开发者必须重写这个方法,来遍历并初始化所有的导航按钮 */ abstract protected void initRadioBtns(); /** * 为启动Activity初始化Intent信息 * @param cls * @return */ private Intent initIntent(Class<?> cls){ return new Intent(this, cls).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); } /** * 供开发者在实现类中调用,能将Activity容器内的Activity移除,再将指定的某个Activity加入 * @param activityName 加载的Activity在localActivityManager中的名字 * @param activityClassTye 要加载Activity的类型 */ protected void setContainerView(String activityName, Class<?> activityClassTye){ if(null == localActivityManager){ localActivityManager = getLocalActivityManager(); } if(null == container){ container = getContainer(); } //移除内容部分全部的View container.removeAllViews(); Activity contentActivity = localActivityManager.getActivity(activityName); if (null == contentActivity) { localActivityManager.startActivity(activityName, initIntent(activityClassTye)); } //加载Activity container.addView( localActivityManager.getActivity(activityName) .getWindow().getDecorView(), new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); } }
bc8ca7712a4fe0322bb106eca77cd6dcc2e626e9
9f1abde17ba0a9eca73b641bf759d2f44bab4546
/app/src/main/java/com/rust/aboutview/fragment/DataProgressFragment.java
d0c2a5d0f58f2abf2347f8efc47258e170de4c99
[ "MIT" ]
permissive
liushaoxiong123/aboutView
97c530678384097c09dc18a4106f6bcb1d559a23
a2fe0bc5ffee5e5f320b2413542b8495bab2243b
refs/heads/master
2023-03-15T09:51:45.001891
2021-02-01T14:46:30
2021-02-02T15:27:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,444
java
package com.rust.aboutview.fragment; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.google.android.material.tabs.TabLayout; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentPagerAdapter; import androidx.viewpager.widget.ViewPager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.rust.aboutview.R; import com.rust.aboutview.adapter.ProgressReAdapter; import java.util.ArrayList; import java.util.List; /** * 装载ViewPager显示多个Fragment * Do not use ButterKnife here * Created by Rust on 2018/5/25. */ public class DataProgressFragment extends Fragment { ProgressContentFragment mContentFragment1; ProgressContentFragment mContentFragment2; ProgressContentFragment mContentFragment3; ProgressContentFragment mContentFragment4; ProgressContentFragment mContentFragment5; private List<Fragment> mContentFragList = new ArrayList<>(); FragmentPagerAdapter mPagerAdapter; @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContentFragment1 = new ProgressContentFragment(); mContentFragment2 = new ProgressContentFragment(); mContentFragment3 = new ProgressContentFragment(); mContentFragment4 = new ProgressContentFragment(); mContentFragment5 = new ProgressContentFragment(); List<ProgressReAdapter.ProgressItem> testData = createTestData(); mContentFragment1.setDataList(0, testData); mContentFragment2.setDataList(1, testData); mContentFragment3.setDataList(2, testData); mContentFragment4.setDataList(3, testData); mContentFragment5.setDataList(4, testData); mContentFragList.add(mContentFragment1); mContentFragList.add(mContentFragment2); mContentFragList.add(mContentFragment3); mContentFragList.add(mContentFragment4); mContentFragList.add(mContentFragment5); } @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return inflater.inflate(R.layout.frag_progress, container, false); } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ViewPager viewPager = (ViewPager) view.findViewById(R.id.view_pager); TabLayout tabLayout = (TabLayout) view.findViewById(R.id.tab_layout); final String[] tabNames = {"小英雄", "雄英", "地区", "天气", "预报!"}; for (int i = 0; i < mContentFragList.size(); i++) { tabLayout.addTab(tabLayout.newTab().setText(tabNames[i])); } mPagerAdapter = new FragmentPagerAdapter(getChildFragmentManager()) { @Override public int getCount() { return mContentFragList.size(); } @Override public Fragment getItem(int position) { return mContentFragList.get(position); } @Nullable @Override public CharSequence getPageTitle(int position) { return tabNames[position]; } }; viewPager.setAdapter(mPagerAdapter); tabLayout.setupWithViewPager(viewPager); } private List<ProgressReAdapter.ProgressItem> createTestData() { List<ProgressReAdapter.ProgressItem> testList = new ArrayList<>(); final int typeCount = 5; for (int i = 0; i < typeCount; i++) { for (int j = 0; j < typeCount; j++) { testList.add(new ProgressReAdapter.ProgressItem("江南将再现高温天!" + i, i + j, (j + 2) * 3, i % typeCount)); testList.add(new ProgressReAdapter.ProgressItem("新一轮强降水来袭!", i, (i + 1) * 6, i % typeCount)); testList.add(new ProgressReAdapter.ProgressItem("晴热暴晒继续!周末或有雷阵雨热力不减~" + i, 0, 10, i % typeCount)); testList.add(new ProgressReAdapter.ProgressItem("晴转阴,阴转大雨!" + i, j, i + j, i % typeCount)); } } return testList; } }
70003a51605c16d96b68388878f6edb1edc6b199
faaeecdea4889bf619c4f4f94b638be1cde2f640
/src/stud/subh/hibernate/ex6/dao/SessionUtil.java
1bad6b4e72d4c49c3a05485ee119099241c19c70
[]
no_license
subhhub/hibernateLab
4758935d1732f1ac8ece695b3e33a9e6d432cc4c
7f5a14f14d40fc0ca47e9f74fcbb7d8f53ff1bd2
refs/heads/master
2021-09-04T15:14:29.260220
2018-01-19T18:01:54
2018-01-19T18:01:54
104,648,721
1
0
null
null
null
null
UTF-8
Java
false
false
642
java
package stud.subh.hibernate.ex6.dao; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; /** * @author subh * Session Object Provider */ public class SessionUtil { private static SessionFactory sessionFactory; //OPTION A static{ Configuration configuration = new Configuration(); // configuration.configure(); //if configuration file in root directory configuration.configure("stud/subh/hibernate/ex6/mapping/hibernate.cfg.xml"); sessionFactory = configuration.buildSessionFactory(); } public static Session getSession(){ return sessionFactory.openSession(); } }
139102b7490199d02a08c33e62bbf256db3c4ecb
688a42d1344df3d6fb3b7e7b8267ee732172cb80
/api/src/main/java/com/xzixi/rabbitmq/api/Config.java
492bb07edc8450e8439c5d25d274135292785501
[]
no_license
jinyue233/rabbitmq
2423afb9e0456a0d268abad3678e701b217d633f
558acdd9e2c032b16161f01444bab54c58bdddca
refs/heads/master
2020-09-15T13:01:02.364423
2019-08-09T02:52:47
2019-08-09T02:52:47
223,452,692
1
0
null
2019-11-22T17:26:00
2019-11-22T17:25:59
null
UTF-8
Java
false
false
112
java
package com.xzixi.rabbitmq.api; public class Config { public static final String ROUTING_KEY = "TEST"; }
729191ef38b58dd4f9617a641d3aa3a6d3ca0275
44c234c40cc4fb08b42589a114448212537d0bf8
/demo-service/src/main/java/com/demo/service/PythonService.java
fed88722555b812954a70702786bdfc0b87ff621
[]
no_license
DEVILKXH/house
731202819a2f9cc36c237266f96c50f6f87946d1
e19c3b7329c477ff97a237a096941cdf2c03b678
refs/heads/master
2020-03-15T04:25:45.367987
2018-05-31T15:04:01
2018-05-31T15:04:01
131,965,081
0
0
null
null
null
null
UTF-8
Java
false
false
221
java
package com.demo.service; public interface PythonService { public String forecast(String city,String brand,String path); public void getNew(); public void getOld(); public void getHistory(); }
66928127728f83e82441760a93e0f8cd48ecaf2d
882ad1fd6e45fc7c6c5f6881ef000dd64d674ec5
/src/com/pigmal/android/ex/accessory/Game.java
e6310e9f83e934aa20ccfb47941119391c327da0
[]
no_license
kopanitsa/ADK_acchimuite_hoi
c2a0310fd1cbc6217dc0b71d4675cd75b6bd86e9
6002a97380432ae9d7fd8f8816afb185390be127
refs/heads/master
2021-01-19T13:26:43.982824
2012-02-19T07:30:54
2012-02-19T07:30:54
3,482,866
0
1
null
null
null
null
UTF-8
Java
false
false
2,449
java
package com.pigmal.android.ex.accessory; import com.pigmal.android.ex.accessory.AcchimuiteHoi.Direction; import com.pigmal.android.ex.accessory.Zhanken.Command; public class Game { GameMode mGameMode; Zhanken mZhanken; AcchimuiteHoi mAcchi; ADKCommandSender mSender; public enum GameMode { start, zyanken, acchimuite_hoi, celemony, // win or lose }; public enum Player { you, enemy } public Game(ADKCommandSender sender, ADKCommandReceiver receiver){ mGameMode = GameMode.start; mZhanken = new Zhanken(sender); mAcchi = new AcchimuiteHoi(sender); receiver.setGame(this); } public void setGameMode(GameMode mode){ mGameMode = mode; switch (mode) { case start: startEffect(); break; case acchimuite_hoi: // nothing to do break; case zyanken: // nothing to do break; case celemony: // TODO flash LED break; } } private void startEffect(){ } public void switchStateChanged(byte sw, boolean b) { switch (mGameMode){ case zyanken: mZhanken.setSwitchStateChanged(sw, b); break; case acchimuite_hoi: mAcchi.setSwitchStateChanged(sw, b); break; } } public void setEnemyZyankenCommand(Zhanken.Command command){ mZhanken.setEnemyCommand(command); } // 0: move face (User wins) // 1: move finger (Enemy wins) public void setEnemyAcchimuiteHoiDirection(int status, AcchimuiteHoi.Direction direction){ mAcchi.setEnemyDirection(status, direction); } public void setAcchimuiteHoiListener(AcchimuiteHoiListener listener){ mAcchi.setAcchimuiteHoiListener(listener); } public void setZhankenListener(ZhankenListener listener){ mZhanken.setZhankenListener(listener); } public void setWinner(Player player){ // TODO } public void clear(){ mZhanken.clear(); mAcchi.clear(); } public interface AcchimuiteHoiListener { public void onAcchimuiteHoiSet(Direction direction); } public interface ZhankenListener { public Command onCommandSet(Command command); // FIXME should return void } }
5cd5d6ea5cb29d2959152a6b3fbb2c7cfd83337d
919454af5cf34d8fc2e1cae11c5d1371a29491d2
/src/java/adminservlets_ads/ReviewAds.java
064ae2245204800742bc422149302971ef7c50ad
[]
no_license
ThushanFernando/sad
be8105ac62439fbc9b36af04693d8a200da2a7d4
db81aeff9b7f25ba2487d4358bc36a5ade46cfa0
refs/heads/master
2021-01-10T15:13:09.361542
2015-10-30T15:11:00
2015-10-30T15:11:00
45,164,870
0
0
null
null
null
null
UTF-8
Java
false
false
3,400
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 adminservlets_ads; import classes.AdminClass_ReviewAds; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Enumeration; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * * @author SithuDewmi */ public class ReviewAds extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.sendError(HttpServletResponse.SC_NOT_FOUND); } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Enumeration<String> parameterNames = request.getParameterNames(); //checking for unappropriate parameters if (parameterNames.hasMoreElements()) { processRequest(request, response); } else { doPost(request, response); } } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(); if (session.getAttribute("loggin_state") == "success") { //checking logged in status AdminClass_ReviewAds ar = new AdminClass_ReviewAds(); ArrayList reviewAds = ar.reviewAds(); //loading ad reviews request.setAttribute("reviewAds", reviewAds); RequestDispatcher rd = request.getRequestDispatcher("ads_review.jsp"); rd.forward(request, response); } else { response.sendRedirect("superb_admin.jsp"); } } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
4a3bdcc2e2f601f12f9b03346a44900eb49a91da
2c023b5dc7236ad750ae38cfda30ec82960f7b21
/P08 Ascii Art/src/DrawingStackIterator.java
ed5758b2deb626e94789759be3e7a0f5b27d3e1f
[]
no_license
icantevxn/CS400_P1
c082f0e57b2b9689318ea20e104b4cc8c7ed38b1
01e5b9a24529436f1cff3b4563ddc18cbaa15586
refs/heads/main
2023-03-10T03:40:36.126461
2021-02-26T03:31:27
2021-02-26T03:31:27
342,449,720
0
0
null
null
null
null
UTF-8
Java
false
false
1,675
java
//////////////////// ALL ASSIGNMENTS INCLUDE THIS SECTION ///////////////////// // // Title: P08 Ascii Art // Files: AsciiArtDriver.java, AsciiArtTester.java, Canvas.java, DrawingChange.java, // DrawingStack.java, DrawingStackIterator.java, LinkedNode.java, StackADT.java // Course: COMP SCI 300 Fall 2019 // // Author: Evangeline Lim // Email: [email protected] // Lecturer's Name: Gary Dahl // // /////////////////////////////// /////////////////////////////////////////////// import java.util.Iterator; import java.util.NoSuchElementException; /** * This class implements Iterator interface and iterates through a DrawingStack of object * DrawingChange * * @author evangelinelim * */ public class DrawingStackIterator implements Iterator<DrawingChange> { private LinkedNode<DrawingChange> next; /** * Constructor that takes in specific arguments * @param next is the next node to be iterated */ public DrawingStackIterator(LinkedNode<DrawingChange> next) { this.next = next; } /** * Gets next DrawingChange object in the stack * * @return the next DrawingChange object on the top of the stack */ public DrawingChange next() { LinkedNode<DrawingChange> first; first = next; // keeps track of the first node if (next != null) { next = next.getNext(); return first.getData(); } else { throw new NoSuchElementException("End of the stack. No more elements to show."); } } /** * Check if stack still has next object * * @return true if still has next. */ @Override public boolean hasNext() { if (next != null) return true; else return false; } }
40dfab648cbb6eea516c46f21596c67647c4684f
e5c3be1fd08218d52fcc1b43085bee305d30e707
/src/main/java/org/jukeboxmc/item/ItemSmithingTable.java
a91f0776d19f09a12a5108c4483d8fda20a3405f
[]
no_license
Leontking/JukeboxMC
e6d48b1270300ea3f72eca3267ccb8b9eafcba44
89490a0cf157b2f806937ad5104cb2d4f5147d56
refs/heads/master
2023-02-23T05:47:29.714715
2021-01-20T12:10:20
2021-01-20T12:10:20
329,557,296
0
0
null
2021-01-14T08:48:11
2021-01-14T08:48:11
null
UTF-8
Java
false
false
367
java
package org.jukeboxmc.item; import org.jukeboxmc.block.BlockSmithingTable; /** * @author LucGamesYT * @version 1.0 */ public class ItemSmithingTable extends Item { public ItemSmithingTable() { super( "minecraft:smithing_table", -202 ); } @Override public BlockSmithingTable getBlock() { return new BlockSmithingTable(); } }
593a127e02b290b53f8873282b0321977e312cc5
e1e2d0d5530ff601b4efbf68dac1cd0df2c7abf0
/V1.0-7314c1ac615c86b08296bcb7843f29e6-assets/990EFFB3-E445-4DF5-9CC3-82F07DCA2717/StringAbbreviationMatching(Recursive).java
dc29aa932eb44184a4c908a55b4bd181bb9ac1b3
[]
no_license
justjazz903/myCodingPractice
4716d6fb472fad39356e52631ab78cee723e3f6f
909b61bd04af40aa56eb5fcf3f7966927f7b2ce7
refs/heads/master
2022-12-03T05:28:31.151956
2020-08-24T18:40:00
2020-08-24T18:40:00
261,282,115
0
0
null
null
null
null
UTF-8
Java
false
false
874
java
public class Solution { public boolean match(String input, String pattern) { // Write your solution here return match(input, 0, pattern, 0); } private boolean match(String input, int si, String pattern, int sp){ if(si == input.length() && sp == pattern.length()){ return true; }else if(si >= input.length() || sp >= pattern.length()){ return false; } if(pattern.charAt(sp) >= '0' && pattern.charAt(sp) <= '9'){ int count = 0; while(sp < pattern.length() && pattern.charAt(sp) >= '0' && pattern.charAt(sp) <= '9'){ count = 10 * count + (int)(pattern.charAt(sp) - '0'); sp++; } return match(input, si + count, pattern, sp); }else{ if(pattern.charAt(sp) == input.charAt(si)){ return match(input, si + 1, pattern, sp + 1); }else{ return false; } } } }
af8ef2efc51b925894ed0167f8ec3f7cb2b1fd7e
f9225f548a9f47d68f6548bb685711ee12e7c979
/app/src/main/java/com/stv/msgservice/ui/conversation/message/multimsg/MultiMessageActionManager.java
e1a34ff17aa313f99f482c2b3ddf78f482c9cca5
[]
no_license
wangjundev/MsgService
dff30de67e9c0e602de087fce5f42ef628defaae
f5733c6e8bf29f849ad4d2d6bf599febf0844e62
refs/heads/main
2023-07-09T23:11:14.819287
2021-08-24T07:01:52
2021-08-24T07:01:52
366,295,090
0
0
null
null
null
null
UTF-8
Java
false
false
1,733
java
package com.stv.msgservice.ui.conversation.message.multimsg; import com.stv.msgservice.datamodel.model.Conversation; import java.lang.reflect.Constructor; import java.util.ArrayList; import java.util.List; public class MultiMessageActionManager { private static MultiMessageActionManager instance; private List<MultiMessageAction> conversationMultiMessageActions; private MultiMessageActionManager() { conversationMultiMessageActions = new ArrayList<>(); init(); } public static synchronized MultiMessageActionManager getInstance() { if (instance == null) { instance = new MultiMessageActionManager(); } return instance; } private void init() { registerAction(DeleteMultiMessageAction.class); // registerAction(ForwardMessageAction.class); } public void registerAction(Class<? extends MultiMessageAction> clazz) { Constructor constructor; try { constructor = clazz.getConstructor(); MultiMessageAction action = (MultiMessageAction) constructor.newInstance(); conversationMultiMessageActions.add(action); } catch (Exception e) { e.printStackTrace(); } } public void unregisterAction(Class<? extends MultiMessageAction> clazz) { // TODO } public List<MultiMessageAction> getConversationActions(Conversation conversation) { List<MultiMessageAction> currentActions = new ArrayList<>(); for (MultiMessageAction ext : this.conversationMultiMessageActions) { if (!ext.filter(conversation)) { currentActions.add(ext); } } return currentActions; } }
338b136a9d152e49e48dfa29a19c774d723a7799
d7429ceea22f1c1bf9baa076d0dc34dbbbd486a2
/project/android/source/Echoii2_Client/src/com/echoii/activity/CloudFragment.java
e86014859d6cd4d9c56cf820e51da411eebaf07a
[]
no_license
leaguenew/cloud_disk
d68238adb3868841d78f87c83d4f3deaae54b324
59362f60f697c5d161595066d467e3dbda1a31c4
refs/heads/master
2020-06-27T16:24:19.540655
2017-07-13T01:17:13
2017-07-13T01:17:13
97,065,796
0
0
null
null
null
null
UTF-8
Java
false
false
5,863
java
package com.echoii.activity; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.BaseAdapter; import android.widget.GridView; import android.widget.ImageView; import android.widget.TextView; import com.echoii.activity.fragment.OnFragmentChangeListener; public class CloudFragment extends Fragment { private ImageView mTvewSetting; private TextView mTvewExit; private GridView mGridData; private AllfileGridAdapter cloudAllFileAdapter = null; private String[] itemNames = { "全部文件", "图片", "音乐", "视频", "BT种子", "文档", "数据市场", "我的群", "我的分享" }; private int[] cloudImages = { R.drawable.grid_item_allfile, R.drawable.grid_item_image, R.drawable.grid_item_music, R.drawable.grid_item_video, R.drawable.grid_item_bt, R.drawable.grid_item_document, R.drawable.grid_data_market, R.drawable.grid_item_mygroup, R.drawable.grid_item_myshare }; private GridView mGridHotResource = null; private HotResourceAdapter mHotResourceAdapter = null; private int[] hotResourceImages = { R.drawable.cloud_hot_01, R.drawable.cloud_hot_02, R.drawable.cloud_hot_03, R.drawable.cloud_hot_04, R.drawable.cloud_hot_05, R.drawable.cloud_hot_06 }; private OnFragmentChangeListener mListener; private SharedPreferences sessionStatusPreference; // 保存会话信息,包括tab切换信息,请求路径等 private MainCloudActivity mActivity; public CloudFragment(){} public CloudFragment(OnFragmentChangeListener listener){ this.mListener = listener; } @Override public void onAttach(Activity activity) { super.onAttach(activity); sessionStatusPreference = activity.getSharedPreferences(CenterFragment2.SESSION_STATUS, Context.MODE_PRIVATE); mActivity = (MainCloudActivity)activity; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { sessionStatusPreference.edit().putString(CenterFragment2.SESSION_CLOUD_PATH, "CloudFragment").commit(); sessionStatusPreference.edit().putString(CenterFragment2.SESSION_CLOUD_PARENT_PATH, "null").commit(); View view = inflater.inflate(R.layout.fragment_cloud, null); mGridData = (GridView) view.findViewById(R.id.cloud_gridview); mTvewSetting = (ImageView)view.findViewById(R.id.setting); mTvewExit = (TextView)view.findViewById(R.id.exit); cloudAllFileAdapter = new AllfileGridAdapter(getActivity(), cloudImages, itemNames); mGridData.setAdapter(cloudAllFileAdapter); mGridHotResource = (GridView) view .findViewById(R.id.cloud_hot_resource); mHotResourceAdapter = new HotResourceAdapter(hotResourceImages); mGridHotResource.setAdapter(mHotResourceAdapter); mGridData.setOnItemClickListener(gridDatalistener); mTvewSetting.setOnClickListener(titleOnClickListener); mTvewExit.setOnClickListener(titleOnClickListener); return view; } private OnClickListener titleOnClickListener = new OnClickListener() { @Override public void onClick(View arg0) { switch (arg0.getId()) { case R.id.setting: { mActivity.toggle(); break; } case R.id.exit: { mActivity.finish(); break; } default: break; } } }; private OnItemClickListener gridDatalistener = new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { if (position == 6) { mListener.onFragmentChange(CenterFragment2.DATA_MARKET_HOME , position); }else{ mListener.onFragmentChange(CenterFragment2.CLOUD_LIST_ALLFILE_FRAGMENT , position); } } }; private class AllfileGridAdapter extends BaseAdapter { LayoutInflater layoutInflater = null; int[] images = null; String[] itemNames = null; public AllfileGridAdapter(Context context, int[] images, String[] itemNames) { this.images = images; this.itemNames = itemNames; layoutInflater = LayoutInflater.from(context); } @Override public int getCount() { return images.length; } @Override public Object getItem(int arg0) { return arg0; } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = layoutInflater.inflate( R.layout.cloud_allfile_item, null); } ImageView img = (ImageView) convertView .findViewById(R.id.img_cloud_allfile_item); TextView tvew = (TextView) convertView .findViewById(R.id.tvew_cloud_allfile_item); tvew.setText(this.itemNames[position]); img.setImageResource(this.images[position]); return convertView; } } public class HotResourceAdapter extends BaseAdapter { private int[] images ; public HotResourceAdapter(int[] images) { this.images = images; } @Override public int getCount() { return images.length; } @Override public Object getItem(int position) { return images[position]; } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = getActivity().getLayoutInflater().inflate( R.layout.cloud_hot_resource, null); } ImageView imageView = (ImageView) convertView .findViewById(R.id.item_hot_resource); imageView.setImageResource(hotResourceImages[position]); return convertView; } } }
3190b1bcf7b5bf23b1a49c7416d2f20547a67af0
2153d80ad440bf5eda2391e3d339454181f565b6
/app/src/main/java/in/texasreview/gre/Models/VideoTestUnlockBodyModel.java
f0dbe611ac1fbc7e7aa17a6af9aab25aef093083
[]
no_license
TexasReviews/Android-GRE
0b9bf73383eadcde7d96791c3ac77544ef53473d
456bb764d410cabcd48fd93d940331b0bee3a1a3
refs/heads/master
2020-04-07T15:53:55.838186
2018-11-21T09:55:35
2018-11-21T09:55:35
158,505,703
0
0
null
null
null
null
UTF-8
Java
false
false
469
java
package in.texasreview.gre.Models; /** * Created by User on 23-10-2018. */ public class VideoTestUnlockBodyModel { private String userid; private String videoid; public String getUserid() { return userid; } public void setUserid(String userid) { this.userid = userid; } public String getVideoid() { return videoid; } public void setVideoid(String videoid) { this.videoid = videoid; } }
706cba6c82aeb0b2cd389c7d972e01bdc8bb6f16
a7d21d804b0be9d8db1bcd325efd7fac021335a8
/src/com/vengeful/sloths/AreaView/ViewObjects/CoordinateStrategies/CoordinateStrategy.java
4a452df5cdeb521dcd58c6caf1444a44efb31442
[]
no_license
VengefulSloths/Iteration2
89a174d43796f4cb760f2f25a76f58fcdc6a1087
da3bac53facdfcf316697f35102b56a89ffe1cc5
refs/heads/master
2021-01-10T14:33:59.243965
2016-03-18T20:12:09
2016-03-18T20:12:09
52,215,634
0
2
null
2016-03-03T06:38:43
2016-02-21T16:27:39
Java
UTF-8
Java
false
false
269
java
package com.vengeful.sloths.AreaView.ViewObjects.CoordinateStrategies; import com.vengeful.sloths.AreaView.ViewObjects.ViewObject; /** * Created by alexs on 2/20/2016. */ public interface CoordinateStrategy { void adjustXY(int r, int s, ViewObject subject); }
1f0eff9e76c995d9c15988a2285ee326a7af3b94
d19dc7e85ccddd789add06e741e8e0865fce9a76
/shuangyuan/01_API/src/com/itheima/demo06/StringBuilder/Demo03StringBuilder.java
1dc91d72701b38d873b8866081c8a19c36e77ad1
[]
no_license
sjtuwyf/java-basic-code
6cd7b812cf1e221077c551368b3260ea6d2c9ae2
51047c659f66099937e095597c7e71cf726f1ff0
refs/heads/main
2023-03-31T13:32:59.573720
2021-04-04T04:07:41
2021-04-04T04:07:41
342,221,770
0
0
null
null
null
null
UTF-8
Java
false
false
398
java
package com.itheima.demo06.StringBuilder; public class Demo03StringBuilder { public static void main(String[] args) { String hello = "Hello"; System.out.println(hello); StringBuilder builder = new StringBuilder(hello); builder.append(" World"); System.out.println(builder); String s = builder.toString(); System.out.println(s); } }
8532ecc342c9d9b2784197e8239b2212598eaa85
92b4677f3179b05640dd0fcc1d41446738e81286
/src/main/java/HelloWorld.java
0586fd5c9c2e9907665ac59e9ee455cd8e84c974
[]
no_license
lukepetercurran/junit-tests
09dfe49b7f17772d1f6e859faccd9608f8d9d526
21b0b927a5feb9c2dbf5477990f3915e133d7819
refs/heads/main
2023-05-30T10:28:52.458388
2021-06-15T16:38:02
2021-06-15T16:38:02
377,206,170
0
0
null
2021-06-15T15:13:58
2021-06-15T15:13:58
null
UTF-8
Java
false
false
285
java
public class HelloWorld { public static String hello(){ System.out.println("NoArgumentsHere"); return "Hello, World!"; } public static String hello(String name){ System.out.println("OneArgumentHere"); return "Hello, " + name + "!"; } }
9814d1b100889dc7361b18fd6df585576c12955a
1b8e31eade00ea70f5502615db66ef4535eb1f2f
/src/main/java/collection/task2/arraylist/ArrayIterator.java
4368a6bc26b56dc5bd1f92dd1186cfbea530c6b7
[]
no_license
kaon99/learnJava
4f9465cc94808550e02f60dd4cda69cef4f7a747
93f693abe6df25b5411d927ac2b82b4c6efc0fd0
refs/heads/master
2020-04-22T13:36:19.954299
2019-03-17T23:27:09
2019-03-17T23:27:09
170,412,583
0
0
null
null
null
null
UTF-8
Java
false
false
397
java
package collection.task2; import java.util.Iterator; public class ArrayIterator <E> implements Iterator<E> { private int index = 0; E[] values; public ArrayIterator(E[] values) { this.values = values; } @Override public boolean hasNext() { return index < values.length; } @Override public E next() { return values[index++]; } }
8a3eb9c432ba6878f0ac6f831b7941b50bb115e8
834b84b29972e95898953756b1704c11b4b84793
/camel-core/src/test/java/org/apache/camel/component/seda/SedaRemoveRouteThenAddAgainTest.java
53b04fbaafe8966edfa78f0cb063989ab30d736d
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-unknown", "Apache-2.0" ]
permissive
mraible/camel
9b2247cb8db25ca670837125104e5670e8ff7d94
cc8dcf4f1c7fac19d01933e92c7e6bfc756c31c1
refs/heads/master
2021-01-16T20:32:11.522309
2014-06-27T14:33:21
2014-06-27T14:33:21
21,243,968
0
0
Apache-2.0
2020-09-13T08:20:34
2014-06-26T14:42:28
Java
UTF-8
Java
false
false
2,154
java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF 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.apache.camel.component.seda; import org.apache.camel.ContextTestSupport; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; /** * @version */ public class SedaRemoveRouteThenAddAgainTest extends ContextTestSupport { public void testRemoveRouteAndThenAddAgain() throws Exception { MockEndpoint out = getMockEndpoint("mock:out"); out.expectedMessageCount(1); out.expectedBodiesReceived("before removing the route"); template.sendBody("seda:in", "before removing the route"); out.assertIsSatisfied(); out.reset(); // now stop & remove the route context.stopRoute("sedaToMock"); context.removeRoute("sedaToMock"); // and then add it back again context.addRoutes(createRouteBuilder()); out.expectedMessageCount(1); out.expectedBodiesReceived("after removing the route"); template.sendBody("seda:in", "after removing the route"); out.assertIsSatisfied(); } @Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override public void configure() throws Exception { from("seda:in").routeId("sedaToMock").to("mock:out"); } }; } }
41dda89af4a2a752b575b2cd25de55fea03aff07
6c4d77c8d91f8ccd452b5f2584d75d6291295a91
/a.java
acc4ebff1e40ec2a2fbe5bfbb34d9b223f97ae62
[]
no_license
WinHtutAung1233/Guys
2d454fcb468507969e83209ebd2fc6f49180844a
4df5e3fb2b8812eb82d24eba50ce23cc30f3d8fd
refs/heads/master
2020-12-10T04:38:23.970645
2020-01-13T07:33:30
2020-01-13T07:33:30
233,503,123
0
0
null
2020-01-13T07:16:27
2020-01-13T03:26:08
Java
UTF-8
Java
false
false
96
java
public class a{ public static void main(String args[]){ System.out.println("Hello World!"); } }
4ea5461f445e79771f64a2abdcda718a9c6d1375
08ddb2d520046c368a356bb07538de7c039be567
/Code/src/GuiManageInventory.java
af2c2559a39ca098ad2b5ae77bd5b2b16db5e01a
[]
no_license
nunominhoto/Refined-Storage
25373f62c57206924816da81653a10bb7e16be6e
9962a8c75bacdf764aba6eeb0a7a6fd574cead30
refs/heads/main
2023-09-02T13:18:09.508331
2021-11-15T10:00:30
2021-11-15T10:00:30
397,647,664
1
0
null
null
null
null
UTF-8
Java
false
false
7,530
java
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; import javax.swing.JOptionPane; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Button; import org.eclipse.wb.swt.SWTResourceManager; //import com.sun.media.sound.Toolkit; import org.eclipse.swt.widgets.Spinner; /** * This class is used to represent the stock management interface * @author Refined Storage developers * */ public class GuiManageInventory extends Composite { /** * Object super */ public Object Super; private Text inputId; /** * This method represents the stock management interface along with his functionality * @param parent the composite parent * @param style the desired style * @param name the current user name * @param Rs refined storage * @param Db the database * @throws Throwable error generating interface */ public GuiManageInventory(Composite parent, int style, String name, Refined_storage Rs, DbFunctions Db) throws Throwable { super(parent, style); setLayout(null); Super = this; this.setVisible(false); this.setVisible(true); Composite composite_1 = new Composite(this, SWT.NONE); composite_1.setForeground(SWTResourceManager.getColor(SWT.COLOR_GRAY)); composite_1.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_DARK_SHADOW)); composite_1.setBounds(0, 504, 869, 80); Composite composite = new Composite(this, SWT.NONE); composite.setForeground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_DARK_SHADOW)); composite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_DARK_SHADOW)); composite.setBounds(0, 0, 869, 80); Label labelMain_1 = new Label(composite, SWT.NONE); labelMain_1.setText("Stock Management"); labelMain_1.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); labelMain_1.setFont(SWTResourceManager.getFont("Corbel", 20, SWT.NORMAL)); labelMain_1.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_DARK_SHADOW)); labelMain_1.setBounds(342, 23, 278, 47); Button btnBack = new Button(composite, SWT.NONE); btnBack.setBounds(10, 10, 75, 25); btnBack.setText("Back"); btnBack.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { try { ((Control) Super).dispose(); if(Rs.get_user_prio() == 1) { new GuiAdminMenu(parent, style, name, Rs, Db); }else if(Rs.get_user_prio() == 2) { new GuiEmployeeMenu(parent, style, name, Rs, Db); } } catch (Throwable e1) { e1.printStackTrace(); } } }); //Element that assures correct window size Label labelSizing1 = new Label(this, SWT.NONE); labelSizing1.setBounds(766, 559, 103, 25); Label labelSizing2 = new Label(this, SWT.NONE); labelSizing2.setBounds(10, 10, 55, 15); Label labelLine = new Label(this, SWT.NONE); labelLine.setText("______________"); labelLine.setFont(SWTResourceManager.getFont("Corbel", 16, SWT.NORMAL)); labelLine.setBounds(361, 461, 147, 40); this.setVisible(true); this.pack(); this.setVisible(true); Composite composite_2_1 = new Composite(this, SWT.NONE); composite_2_1.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); composite_2_1.setBackground(SWTResourceManager.getColor(SWT.COLOR_GRAY)); composite_2_1.setBounds(402, 86, 303, 361); Label lblQuantity = new Label(composite_2_1, SWT.NONE); lblQuantity.setText("Quantity"); lblQuantity.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); lblQuantity.setBackground(SWTResourceManager.getColor(SWT.COLOR_GRAY)); lblQuantity.setBounds(73, 194, 70, 20); Button btnConfirm = new Button(composite_2_1, SWT.NONE); btnConfirm.setBounds(145, 268, 100, 32); btnConfirm.setText("Confirm"); Button btnRemove = new Button(composite_2_1, SWT.RADIO); btnRemove.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK)); btnRemove.setBounds(196, 99, 86, 28); btnRemove.setText("Remove"); Button btnAdd = new Button(composite_2_1, SWT.FLAT | SWT.RADIO); btnAdd.setSelection(true); btnAdd.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK)); btnAdd.setBounds(73, 99, 86, 28); btnAdd.setText("Add"); Spinner spinner = new Spinner(composite_2_1, SWT.BORDER); spinner.setBounds(177, 191, 105, 28); Composite composite_2_1_1 = new Composite(this, SWT.NONE); composite_2_1_1.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); composite_2_1_1.setBackground(SWTResourceManager.getColor(SWT.COLOR_GRAY)); composite_2_1_1.setBounds(146, 86, 303, 361); Label lblCurrentStock = new Label(composite_2_1_1, SWT.NONE); lblCurrentStock.setText("Current Stock"); lblCurrentStock.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); lblCurrentStock.setBackground(SWTResourceManager.getColor(SWT.COLOR_GRAY)); lblCurrentStock.setBounds(24, 190, 90, 20); Label labelStock = new Label(composite_2_1_1, SWT.NONE); labelStock.setBounds(151, 190, 90, 25); Label lblId = new Label(composite_2_1_1, SWT.NONE); lblId.setText("ID"); lblId.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); lblId.setBackground(SWTResourceManager.getColor(SWT.COLOR_GRAY)); lblId.setBounds(24, 102, 70, 20); inputId = new Text(composite_2_1_1, SWT.BORDER); inputId.setBounds(151, 99, 90, 28); Button btnCheckStock = new Button(composite_2_1_1, SWT.NONE); btnCheckStock.setBounds(104, 266, 90, 32); btnCheckStock.setText("Check Stock"); btnCheckStock.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { String input1 = inputId.getText(); int id = Db.CheckValidId(input1); boolean m = false; if(id!=0) { try { int qty = Db.getQuantityFromID(id); labelStock.setText(String.valueOf(qty)); } catch (Throwable e1) { // TODO Auto-generated catch block System.out.println(e1.getMessage()); } try { m = DbFunctions.check_id(id, "material"); } catch (Throwable e1) { // TODO Auto-generated catch block e1.printStackTrace(); } if(m==false) { JOptionPane.showMessageDialog(null, "Invalid id"); } } else if(id==0) { JOptionPane.showMessageDialog(null, "Invalid id"); } } }); btnConfirm.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { int i=1; boolean m=false; String input1 = inputId.getText(); int id = Db.CheckValidId(input1); try { m = DbFunctions.check_id(id, "material"); } catch (Throwable e1) { // TODO Auto-generated catch block e1.printStackTrace(); } if((Rs.get_user_prio() == 1) && (m == true)) { i = Rs.get_admin().manage_inventory(Db, id, spinner.getSelection(), btnAdd.getSelection(), btnRemove.getSelection()); }else if((Rs.get_user_prio() == 2)&& (m == true)){ i = Rs.get_employee().manage_inventory(Db, id, spinner.getSelection(), btnAdd.getSelection(), btnRemove.getSelection()); } else if(m == false) { JOptionPane.showMessageDialog(null, "Invalid id"); } if (i==0) { JOptionPane.showMessageDialog(null, "Not enough stock available"); } } }); } @Override protected void checkSubclass() { } }
02b4f1f348772839d5e2abd98d00b85b7b11726d
647a67f0331f9c8c09ae9adfbba7823326818ae0
/src/main/java/krystian/chat/room/RoomTime.java
d66537affe1128f4e1cf9e853d8951cd703fa110
[]
no_license
szkr/ChatBackend
f1ed9bfd1b74a494a007473ffbd1432b86b67d25
388777f4904d5013d9ad2c314c2621e03fbd6874
refs/heads/master
2020-11-24T09:42:04.459845
2019-12-17T20:06:52
2019-12-17T20:06:52
228,082,658
0
0
null
null
null
null
UTF-8
Java
false
false
406
java
package krystian.chat.room; /** * */ public class RoomTime { private long roomId; private long timeFrom; public void setRoomId(long roomId) { this.roomId = roomId; } public void setTimeFrom(long timeFrom) { this.timeFrom = timeFrom; } public long getRoomId() { return roomId; } public long getTimeFrom() { return timeFrom; } }
9be0d8748e75eadaf1504a7d79c480e456ae0c4c
8adad19ae9f7a6fc7678f07a47a2387561945bed
/cmsdb/src/com/enjoyf/mcms/bean/temp/RefreshBean.java
c031dfc374f67609de6001aeeecbe5a1b0e895d0
[]
no_license
liu67224657/toolsplatform
542231a60170c175a9933eaf159ef236be5ce60e
18b628ae2695fdfd0b111a6470437a50041cfdeb
refs/heads/master
2021-07-24T12:39:05.916958
2017-11-04T18:38:02
2017-11-04T18:38:02
109,519,814
0
0
null
null
null
null
UTF-8
Java
false
false
66
java
package com.enjoyf.mcms.bean.temp; public class RefreshBean { }
e9c5aefc4d7a2074f8ad098e843416a868bc3c04
08f83df0cec01baabce4500840166dcfec3bd6ba
/src/test/java/br/com/helpdesk/HelpDeskApplicationTests.java
fe700ec7e1be84a1aedccc0d676d82d1f11c38f7
[]
no_license
juliherms/springbootcomthymeleaf
1b1c138d8fbad9c6c7cf585f5385d23c45001d32
e9392b23461d7285b57351837360a29e42575e29
refs/heads/master
2020-09-22T07:28:24.208141
2019-12-01T13:26:56
2019-12-01T13:26:56
225,104,799
0
0
null
null
null
null
UTF-8
Java
false
false
404
java
package br.com.helpdesk; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; /** * Classe responsavel por configurar os testes de unidade */ @RunWith(SpringRunner.class) @SpringBootTest public class HelpDeskApplicationTests { @Test public void contextLoads() { } }
42b3af79a41b3a96f9874f59caff88d9d0d6e510
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/24/24_6a0a6ccf517492a3856a96627537525e563a8aef/HttpHtmlResponseView/24_6a0a6ccf517492a3856a96627537525e563a8aef_HttpHtmlResponseView_t.java
7422e1c221bae8f3eefb1c8708451bf70976e148
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
7,842
java
/* * soapUI, copyright (C) 2004-2010 eviware.com * * soapUI is free software; you can redistribute it and/or modify it under the * terms of version 2.1 of the GNU Lesser General Public License as published by * the Free Software Foundation. * * soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details at gnu.org. */ package com.eviware.soapui.impl.rest.panels.request.views.html; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.FileOutputStream; import java.io.IOException; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JToggleButton; import com.eviware.soapui.SoapUI; import com.eviware.soapui.impl.support.AbstractHttpRequestInterface; import com.eviware.soapui.impl.support.http.HttpRequestInterface; import com.eviware.soapui.impl.support.panels.AbstractHttpXmlRequestDesktopPanel.HttpResponseDocument; import com.eviware.soapui.impl.support.panels.AbstractHttpXmlRequestDesktopPanel.HttpResponseMessageEditor; import com.eviware.soapui.impl.wsdl.WsdlSubmitContext; import com.eviware.soapui.impl.wsdl.submit.transports.http.HttpResponse; import com.eviware.soapui.impl.wsdl.support.MessageExchangeModelItem; import com.eviware.soapui.model.iface.Request.SubmitException; import com.eviware.soapui.support.UISupport; import com.eviware.soapui.support.components.BrowserComponent; import com.eviware.soapui.support.components.JXToolBar; import com.eviware.soapui.support.editor.views.AbstractXmlEditorView; import com.eviware.soapui.support.editor.xml.XmlEditor; @SuppressWarnings( "unchecked" ) public class HttpHtmlResponseView extends AbstractXmlEditorView<HttpResponseDocument> implements PropertyChangeListener { private HttpRequestInterface<?> httpRequest; private JPanel panel; private BrowserComponent browser; private static JToggleButton recordButton; private boolean recordHttpTrafic; private MessageExchangeModelItem messageExchangeModelItem; private boolean hasResponseForRecording; public boolean isRecordHttpTrafic() { return recordHttpTrafic; } public void setRecordHttpTrafic( boolean recordHttpTrafic ) { // no change? if( recordHttpTrafic == this.recordHttpTrafic ) return; if( recordHttpTrafic ) { recordButton.setIcon( UISupport.createImageIcon( "/record_http_true.gif" ) ); recordButton.setToolTipText( "Stop recording" ); recordButton.setSelected( true ); browser.setRecordingHttpHtmlResponseView( HttpHtmlResponseView.this ); } else { browser.setRecordingHttpHtmlResponseView( null ); recordButton.setIcon( UISupport.createImageIcon( "/record_http_false.gif" ) ); recordButton.setToolTipText( "Start recording" ); recordButton.setSelected( false ); } this.recordHttpTrafic = recordHttpTrafic; } public HttpHtmlResponseView( HttpResponseMessageEditor httpRequestMessageEditor, HttpRequestInterface<?> httpRequest ) { super( "HTML", httpRequestMessageEditor, HttpHtmlResponseViewFactory.VIEW_ID ); this.httpRequest = httpRequest; httpRequest.addPropertyChangeListener( this ); } public HttpHtmlResponseView( XmlEditor xmlEditor, MessageExchangeModelItem messageExchangeModelItem ) { super( "HTML", xmlEditor, HttpHtmlResponseViewFactory.VIEW_ID ); this.messageExchangeModelItem = messageExchangeModelItem; this.httpRequest = ( HttpRequestInterface<?> )messageExchangeModelItem; messageExchangeModelItem.addPropertyChangeListener( this ); } public JComponent getComponent() { if( panel == null ) { panel = new JPanel( new BorderLayout() ); if( BrowserComponent.isJXBrowserDisabled() ) { panel.add( new JLabel( "Browser Component is disabled" ) ); } else { browser = new BrowserComponent( false, true ); Component component = browser.getComponent(); component.setMinimumSize( new Dimension( 100, 100 ) ); panel.add( buildToolbar(), BorderLayout.NORTH ); panel.add( component, BorderLayout.CENTER ); HttpResponse response = httpRequest.getResponse(); if( response != null ) setEditorContent( response ); } } return panel; } @Override public void release() { super.release(); if( browser != null ) browser.release(); if( messageExchangeModelItem != null ) messageExchangeModelItem.removePropertyChangeListener( this ); else httpRequest.removePropertyChangeListener( this ); httpRequest = null; messageExchangeModelItem = null; } protected void setEditorContent( HttpResponse httpResponse ) { if( httpResponse != null ) { try { browser.navigate( httpResponse.getURL().toURI().toString(), httpResponse.getRequestContent(), null ); hasResponseForRecording = true; } catch( Throwable e ) { e.printStackTrace(); } } else { browser.setContent( "<missing content>" ); hasResponseForRecording = false; } } private void writeHttpBody( byte[] rawResponse, FileOutputStream out ) throws IOException { int index = 0; byte[] divider = "\r\n\r\n".getBytes(); for( ; index < ( rawResponse.length - divider.length ); index++ ) { int i; for( i = 0; i < divider.length; i++ ) { if( rawResponse[index + i] != divider[i] ) break; } if( i == divider.length ) { out.write( rawResponse, index + divider.length, rawResponse.length - ( index + divider.length ) ); return; } } out.write( rawResponse ); } private Component buildToolbar() { JXToolBar toolbar = UISupport.createToolbar(); recordButton = new JToggleButton( new RecordHttpTraficAction() ); toolbar.addLabeledFixed( "Record HTTP trafic", recordButton ); return toolbar; } public void propertyChange( PropertyChangeEvent evt ) { if( evt.getPropertyName().equals( AbstractHttpRequestInterface.RESPONSE_PROPERTY ) ) { if( browser != null ) setEditorContent( ( ( HttpResponse )evt.getNewValue() ) ); } } @Override public void setXml( String xml ) { } public boolean saveDocument( boolean validate ) { return false; } public void setEditable( boolean enabled ) { } private class RecordHttpTraficAction extends AbstractAction { public RecordHttpTraficAction() { putValue( Action.SMALL_ICON, UISupport.createImageIcon( "/record_http_false.gif" ) ); putValue( Action.SHORT_DESCRIPTION, "Start recording" ); } @Override public void actionPerformed( ActionEvent arg0 ) { if( browser == null ) return; if( isRecordHttpTrafic() ) { setRecordHttpTrafic( false ); } else { if( !hasResponseForRecording ) { // resubmit so we have "live" content try { getHttpRequest().submit( new WsdlSubmitContext( getHttpRequest() ), false ).waitUntilFinished(); } catch( SubmitException e ) { SoapUI.logError( e ); } setRecordHttpTrafic( true ); } } } } public HttpRequestInterface<?> getHttpRequest() { return httpRequest; } }
2276fa156d94279c9e50cbb59b0eba15975b2657
41bbb3f43ff6edd9e3a040ac207b8a23190791a3
/taxonomy-manager-engine/src/main/java/com/digirati/taxman/analysis/nlp/AnnotationType.java
6b73efb0ddfce2b24e745e937e06948dbfd79bb1
[ "MIT", "Apache-2.0" ]
permissive
digirati-co-uk/taxonomy-manager
0f6607afff8d02b8bcd4543d55fd77111c9d24d1
20258e45d0f70ec1f8680288770c7bcc2ed2fa4f
refs/heads/master
2023-06-08T00:39:51.446932
2022-06-16T12:25:43
2022-06-16T12:25:43
186,396,049
0
0
Apache-2.0
2023-05-31T16:37:08
2019-05-13T10:14:59
Java
UTF-8
Java
false
false
114
java
package com.digirati.taxman.analysis.nlp; public enum AnnotationType { LEMMA, STEM, POS, TOKEN }
0e77e0133790b009285bb65b53b5c39f1a6fd086
c52fd95dab9ece89a3b836bb4e60500cdd359dce
/service_api/src/generated/java/com/thesett/auth/services/PermissionService.java
5d39b07ad9ff0c254cdcbd576ec35eaef724d785
[]
no_license
the-sett/auth-service
7691f56bf795204d06032ea8572b51316b9dc0fa
ad46aeef5860a776b7b6053008b45b70a43d3a4a
refs/heads/master
2021-01-20T05:14:17.817371
2018-02-12T11:20:53
2018-02-12T11:20:53
101,423,596
0
0
null
null
null
null
UTF-8
Java
false
false
1,339
java
package com.thesett.auth.services; import java.util.List; import com.thesett.util.entity.EntityException; import com.thesett.util.entity.CRUD; import com.thesett.util.validation.model.JsonSchema; import com.thesett.auth.model.Permission; /** * Service interface for working with Permission * * @author Generated Code */ public interface PermissionService extends CRUD<Permission, Long> { /** * Provides a json-schema describing the Permission data model. * * @return A json-schema describing the Permission data model. */ JsonSchema schema(); /** * Lists all values. * * @return A list containing all values. */ List<Permission> findAll(); /** * Lists all values that have fields that match the non-null fields in the example. * * @param example An example to match the fields of. * * @return A list of all matching values. */ List<Permission> findByExample(Permission example); /** {@inheritDoc} */ Permission create(Permission permission) throws EntityException; /** {@inheritDoc} */ Permission retrieve(Long id); /** {@inheritDoc} */ Permission update(Long id, Permission permission) throws EntityException; /** {@inheritDoc} */ void delete(Long id) throws EntityException; }
54c27d5f7bbb339b69a3cfd92d5b7bec0f7f465b
ee590de1a417ffefef342b4854e5bfe5de85e7ad
/demo/src/test/java/com.example.test.demo/service/Junit4ServiceTest.java
dee8296180dedcd0722fe9321ef4d5f0617f6a35
[]
no_license
sandeepkjl/Junit_Demo
84b92e461f0bfa7e99ee829b89c0b2ad303d566e
1af3ff7fa403123163d3a678136724be059e60b3
refs/heads/master
2022-11-09T04:58:43.832610
2020-06-27T18:17:17
2020-06-27T18:17:17
268,806,661
0
0
null
null
null
null
UTF-8
Java
false
false
2,573
java
package com.example.test.demo.service; import com.example.test.demo.Helper.Junit4Helper; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class Junit4ServiceTest { @InjectMocks Junit4Service service; @Mock Junit4Helper helper; @Test public void getSubTest(){ Mockito.when(helper.sub(10,2)).thenReturn(5); int sub=service.getSub(10,2); } @Test public void getSubTest2(){ Mockito.when(helper.sub(10,2)).thenReturn(5); int sub=service.getSub(10,2); } @Test public void getSubTest3(){ Mockito.when(helper.sub(10,2)).thenReturn(5); int sub=service.getSub(10,2); } @Test public void getSubTest4(){ Mockito.when(helper.sub(10,2)).thenReturn(5); int sub=service.getSub(10,2); } @Test public void getSubTest5(){ Mockito.when(helper.sub(10,2)).thenReturn(5); int sub=service.getSub(10,2); } @Test public void getSubTest6(){ Mockito.when(helper.sub(10,2)).thenReturn(5); int sub=service.getSub(10,2); } @Test public void getSubTest7(){ Mockito.when(helper.sub(10,2)).thenReturn(5); int sub=service.getSub(10,2); } @Test public void getSubTest8(){ Mockito.when(helper.sub(10,2)).thenReturn(5); int sub=service.getSub(10,2); } @Test public void getSubTest9(){ Mockito.when(helper.sub(10,2)).thenReturn(5); int sub=service.getSub(10,2); } @Test public void getSubTest10(){ Mockito.when(helper.sub(10,2)).thenReturn(5); int sub=service.getSub(10,2); } @Test public void getSubTest11(){ Mockito.when(helper.sub(10,2)).thenReturn(5); int sub=service.getSub(10,2); } @Test public void getSubTest12(){ Mockito.when(helper.sub(10,2)).thenReturn(5); int sub=service.getSub(10,2); } @Test public void getSubTest13(){ Mockito.when(helper.sub(10,2)).thenReturn(5); int sub=service.getSub(10,2); } @Test public void getSubTest14(){ Mockito.when(helper.sub(10,2)).thenReturn(5); int sub=service.getSub(10,2); } @Test public void getSubTest15(){ Mockito.when(helper.sub(10,2)).thenReturn(5); int sub=service.getSub(10,2); } }
e83fc7a5afa573c2448a4d602fcf4d9733b2405a
1e05d1ae18393ce00fa425c69adeb44f38d29879
/src/main/java/com/duanxi/aaron/AaronBlogApplication.java
53a2486daa0093a33af9c85387be6144e5e3158e
[]
no_license
Aaron-cdx/aaron-blog
3bbd6c33479dff7c17146f6202afa38e2abd7a24
0fa3098db74a34557ea63b9d478d28cfc0735678
refs/heads/master
2023-02-19T18:38:49.060988
2021-01-04T01:53:32
2021-01-04T01:53:32
326,541,900
0
0
null
null
null
null
UTF-8
Java
false
false
327
java
package com.duanxi.aaron; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class AaronBlogApplication { public static void main(String[] args) { SpringApplication.run(AaronBlogApplication.class, args); } }
34e04a5f3aace38b8484492c355020d112fe7967
7fa296186702dbf3877d8ed4ea4fa73d59910952
/spring-boot-admin-server-demo/src/test/java/com/abhi/springbootdemo/SpringBootDemoApplicationTests.java
c8e0ab53d5a0a68e71b54590081b042e8b58640e
[]
no_license
hubforabhi/GitHubRepo
012d16b72568df3dc794b98e4b4e6265167f7121
eb5d2bd4b85eeb1dddc3e0523db23c1c99e469c5
refs/heads/master
2023-09-03T14:30:51.141050
2023-08-19T05:17:19
2023-08-19T05:17:19
41,841,513
0
0
null
2022-12-16T00:38:18
2015-09-03T04:14:05
Java
UTF-8
Java
false
false
348
java
package com.abhi.springbootdemo; 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 SpringBootDemoApplicationTests { @Test public void contextLoads() { } }
220bf360e3114386c7c477b72abc7de281df9d4f
dad6da248a11c754e794df584223b2623fcfc21e
/ARChatRoom-Android/app/src/main/java/org/ar/audioganme/weight/CommentDialogFragment.java
9c0bdf0e2f143002a2dfee0dbc193e760dd98555
[ "MIT" ]
permissive
xiaoxing1992/ARChatRoom
097286bc2b14ba11a4ea54f330e1edfc9498dd72
65b73bb1a3093db3f0e4537f2b43490a9a08bf37
refs/heads/master
2023-04-01T23:00:32.566753
2021-04-06T11:06:00
2021-04-06T11:06:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,307
java
package org.ar.audioganme.weight; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.view.Gravity; import android.view.View; import android.view.ViewTreeObserver; import android.view.Window; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.Toast; import org.ar.audioganme.R; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.core.content.ContextCompat; import androidx.fragment.app.DialogFragment; import androidx.fragment.app.FragmentManager; public class CommentDialogFragment extends DialogFragment implements View.OnClickListener{ private EditText commentEditText; private Button sendButton; private InputMethodManager inputMethodManager; private DialogFragmentDataCallback callback; public interface DialogFragmentDataCallback { void sendText(String text); } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Dialog mDialog = new Dialog(getActivity(), R.style.BottomDialog); mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); mDialog.setContentView(R.layout.dialog_fragment_comment_layout); mDialog.setCanceledOnTouchOutside(true); Window window = mDialog.getWindow(); WindowManager.LayoutParams layoutParams; if (window != null) { layoutParams = window.getAttributes(); layoutParams.gravity = Gravity.BOTTOM; layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT; window.setAttributes(layoutParams); } commentEditText = (EditText) mDialog.findViewById(R.id.edit_comment); sendButton = (Button) mDialog.findViewById(R.id.btn_send); setSoftKeyboard(); commentEditText.addTextChangedListener(mTextWatcher); sendButton.setOnClickListener(this); sendButton.setEnabled(false); sendButton.setClickable(false); return mDialog; } private void setSoftKeyboard() { commentEditText.setFocusable(true); commentEditText.setFocusableInTouchMode(true); commentEditText.requestFocus(); commentEditText.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { inputMethodManager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); if (inputMethodManager != null) { if (inputMethodManager.showSoftInput(commentEditText, 0)) { commentEditText.getViewTreeObserver().removeOnGlobalLayoutListener(this); } } } }); } private TextWatcher mTextWatcher = new TextWatcher() { private CharSequence temp; @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { temp = s; } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { if (temp.length() > 0) { sendButton.setEnabled(true); sendButton.setClickable(true); } else { sendButton.setEnabled(false); } } }; @Override public void onClick(View v) { switch (v.getId()) { case R.id.btn_send: if (callback!=null){ callback.sendText(commentEditText.getText().toString()); } dismiss(); break; default: break; } } public void show(FragmentManager manager,DialogFragmentDataCallback callback){ this.callback=callback; show(manager,""); } }
ce4aeefcc7dcecc06d7c6bcc43547a3beb633e4b
dbe7205086a6772d25d39db6a6389db139c4e560
/service/service_edu/src/main/java/edu/fzu/eduservice/controller/EduLoginController.java
15372d3a7f8cf6845f1e877d9eeec404a1daa660
[]
no_license
x-junzhu/guli_edu
b08c63da996cfc75843217b8c9f488f50779fa75
9e6c2cc5d1735559f045bc5447a3ebefb70636e1
refs/heads/master
2023-03-31T04:52:35.588549
2021-04-03T14:19:05
2021-04-03T14:19:05
354,305,971
0
0
null
null
null
null
UTF-8
Java
false
false
1,019
java
package edu.fzu.eduservice.controller; import edu.fzu.commonutils.Result; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; /** * @author JohnCarraway * @create 2021-01-04 23:08 */ @RestController @RequestMapping("/eduservice/user") @CrossOrigin public class EduLoginController { // login @RequestMapping(value = "login", method = RequestMethod.POST) public Result login(){ return Result.ok().add("token", "admin"); } // info https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif @RequestMapping(value = "info", method = RequestMethod.GET) public Result info(){ return Result.ok().add("roles", "[admin]").add("name", "JohnRambo").add("avatar", "https://edu-guli-0514.oss-cn-beijing.aliyuncs.com/2021/01/03/2664f7ed351d455e81010abde70d150e2.jpg"); } }
9b443cc05fdeb99d7dbe86b4279470556c07d1a9
8d946330843b4c146a958f099919038648cb6c87
/Core java/OOP/Serialization-app/src/swabhav/testlabs/test/TestSerialization.java
9fef0fae92e8b9848094dd7d446f539fbd9215e4
[]
no_license
himanshu2395/swabhav-tech
402b1fd3b24348dce3db228394456274ea2ad36f
8cfccc37cf4ad5ba3dd70ad4e999c6bea50429d5
refs/heads/master
2021-05-05T17:52:36.799797
2018-12-21T11:51:38
2018-12-21T11:51:38
117,519,276
0
0
null
null
null
null
UTF-8
Java
false
false
1,502
java
package swabhav.testlabs.test; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.ArrayList; import swabhav.techlabs.Human; public class TestSerialization { public static void main(String[] args) { ArrayList<Human> al = new ArrayList<Human>(); al.add(new Human()); for (Human x : al) { // Human h = (Human) x; x.setAge(23); x.setWeight(60); // System.out.println(x.getAge()); // System.out.println(x.getWeight()); try { FileOutputStream fos = new FileOutputStream("D:\\file.txt"); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(al); oos.close(); fos.close(); System.out.println("obeject have been serialized"); } catch (IOException ioe) { ioe.printStackTrace(); } } ArrayList<Human> a1 = new ArrayList<Human>(); try { FileInputStream fis = new FileInputStream("D:\\file.txt"); ObjectInputStream ois = new ObjectInputStream(fis); a1 = (ArrayList) ois.readObject(); ois.close(); fis.close(); System.out.println("Object has been deserialized "); } catch (IOException ioe) { ioe.printStackTrace(); return; } catch (ClassNotFoundException c) { System.out.println("Class not found"); c.printStackTrace(); return; } for (Human y : a1) { System.out.println("age = " + y.getAge()); System.out.println("weight = " + y.getWeight()); } } }
138b725ce4b6c00356f49fc2d6a58f56b29682d3
600df3590cce1fe49b9a96e9ca5b5242884a2a70
/chrome/android/java/src/org/chromium/chrome/browser/FrozenNativePage.java
5e3d5d08704da83c82ad9fda72795cd69b7bbd21
[ "BSD-3-Clause" ]
permissive
metux/chromium-suckless
efd087ba4f4070a6caac5bfbfb0f7a4e2f3c438a
72a05af97787001756bae2511b7985e61498c965
refs/heads/orig
2022-12-04T23:53:58.681218
2017-04-30T10:59:06
2017-04-30T23:35:58
89,884,931
5
3
BSD-3-Clause
2022-11-23T20:52:53
2017-05-01T00:09:08
null
UTF-8
Java
false
false
1,978
java
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.chrome.browser; import android.view.View; /** * A empty stand-in for a native page. An inactive NativePage may be replaced with a * FrozenNativePage to free up resources. * * Any method may be called on this object, except for getView(), which will trigger an assert and * return null. */ public class FrozenNativePage implements NativePage { private final String mUrl; private final String mHost; private final String mTitle; private final int mBackgroundColor; private final int mThemeColor; /** * Creates a FrozenNativePage to replace the given NativePage and destroys the NativePage. */ public static FrozenNativePage freeze(NativePage nativePage) { FrozenNativePage fnp = new FrozenNativePage(nativePage); nativePage.destroy(); return fnp; } private FrozenNativePage(NativePage nativePage) { mHost = nativePage.getHost(); mUrl = nativePage.getUrl(); mTitle = nativePage.getTitle(); mBackgroundColor = nativePage.getBackgroundColor(); mThemeColor = nativePage.getThemeColor(); } @Override public View getView() { assert false; return null; } @Override public String getTitle() { return mTitle; } @Override public String getUrl() { return mUrl; } @Override public String getHost() { return mHost; } @Override public int getBackgroundColor() { return mBackgroundColor; } @Override public int getThemeColor() { return mThemeColor; } @Override public boolean needsToolbarShadow() { return true; } @Override public void updateForUrl(String url) { } @Override public void destroy() { } }
e1cdb2ea1473c00381c091af6d98979cb8ccc12d
2e05e6ff9905f9fe5e5ef350eacca69f3e6cbc87
/src/main/java/com/microsoft/graph/requests/generated/BaseCalendarCollectionResponse.java
af59cc08cd28bf99cf95cf03a69a3b8664f0afaa
[ "MIT" ]
permissive
jderuette/msgraph-sdk-java
80ca0467e0e315c41492130af345cc16674c6fdb
6ffa209739d526da3109ce0cb81a01187da95bd4
refs/heads/master
2020-04-10T22:29:23.698280
2018-03-02T18:26:57
2018-03-02T18:26:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,769
java
// ------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. // ------------------------------------------------------------------------------ package com.microsoft.graph.requests.generated; import com.microsoft.graph.concurrency.*; import com.microsoft.graph.core.*; import com.microsoft.graph.models.extensions.*; import com.microsoft.graph.models.generated.*; import com.microsoft.graph.http.*; import com.microsoft.graph.requests.extensions.*; import com.microsoft.graph.requests.generated.*; import com.microsoft.graph.options.*; import com.microsoft.graph.serializer.*; import java.util.Arrays; import java.util.EnumSet; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.annotations.*; // **NOTE** This file was generated by a tool and any changes will be overwritten. /** * The class for the Base Calendar Collection Response. */ public class BaseCalendarCollectionResponse implements IJsonBackedObject { /** * The list of Calendar within this collection page */ @SerializedName("value") @Expose public java.util.List<Calendar> value; /** * The URL to the next page of this collection, or null */ @SerializedName("@odata.nextLink") @Expose(serialize = false) public String nextLink; private transient AdditionalDataManager additionalDataManager = new AdditionalDataManager(this); @Override public final AdditionalDataManager additionalDataManager() { return additionalDataManager; } /** * The raw representation of this class */ private JsonObject rawObject; /** * The serializer */ private ISerializer serializer; /** * Gets the raw representation of this class * @return the raw representation of this class */ public JsonObject getRawObject() { return rawObject; } /** * Gets serializer * @return the serializer */ protected ISerializer getSerializer() { return serializer; } /** * Sets the raw json object * * @param serializer The serializer * @param json The json object to set this object to */ public void setRawObject(final ISerializer serializer, final JsonObject json) { this.serializer = serializer; rawObject = json; if (json.has("value")) { final JsonArray array = json.getAsJsonArray("value"); for (int i = 0; i < array.size(); i++) { value.get(i).setRawObject(serializer, (JsonObject) array.get(i)); } } } }
a3c0952d0b69ef17c51a9e26b8658481254a47c7
9c5ddbe11faf37605b961cdfe5ce4afc2a0fc102
/CIB/trunk/cda/portlet/sbg-fxt-portlet-contact-me/src/main/java/za/co/standardbank/sbg/cda/mvc/portlet/controller/ContactMeUpdateController.java
bd5d5aae1f52aeebc714c97edf744607fb77f20b
[]
no_license
srujanch/CIB
c3a386c452ac29cfd036cb5e63381aa1d4f5c5f2
e948d21b133ec3d02d023ce28b0af45018be3168
refs/heads/master
2021-01-10T03:43:37.266440
2016-03-07T10:27:59
2016-03-07T10:27:59
53,316,383
0
0
null
null
null
null
UTF-8
Java
false
false
1,493
java
package za.co.standardbank.sbg.cda.mvc.portlet.controller; import javax.portlet.ActionRequest; import javax.portlet.ActionResponse; import javax.portlet.PortletRequest; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.validation.BindException; import org.springframework.web.portlet.mvc.SimpleFormController; import za.co.standardbank.sbg.cda.mvc.portlet.domain.ContactMeInfo; public class ContactMeUpdateController extends SimpleFormController { private static Log log = LogFactory.getLog(ContactMeUpdateController.class); protected Object formBackingObject(PortletRequest request) throws Exception { if (log.isDebugEnabled()) log.debug("Entering ContactMeUpdateController.formBackingObject() "); ContactMeInfo updateContact = (ContactMeInfo) super.formBackingObject(request); // Write logic to handle formBackingObject. if (log.isDebugEnabled()) log.debug("Exiting ContactMeUpdateController.formBackingObject() " + updateContact); return updateContact; } protected void onSubmitAction(ActionRequest request, ActionResponse response, Object command, BindException errors) throws Exception { if (log.isDebugEnabled()) log.debug("Entering ContactMeUpdateController.doSubmitAction() " + command); // Write logic to handle processFormSubmission for Update. if (log.isDebugEnabled()) log.debug("Exit ContactMeUpdateController.doSubmitAction() " + command); } }
09e63c68594901ead00babac171570291f815ed4
c42634f513adf1a3cc4fa43d4b29677beaf620df
/test0403/src/main/java/com/example/service/impl/TeacherServiceImpl.java
a087e3b3e6b052b02eef70458d7c3252fc34d5ae
[]
no_license
clown121381/workspace
22bdbbac4df99d8668277d3e32afa3ca57fc5e8f
3363ad00d374f8cc9261e1d307e1c848c20064b7
refs/heads/master
2022-12-21T13:03:54.709666
2019-09-19T14:07:02
2019-09-19T14:07:02
209,569,300
0
0
null
2022-12-16T11:18:00
2019-09-19T14:03:32
Java
UTF-8
Java
false
false
654
java
package com.example.service.impl; import com.example.entity.Person; import com.example.entity.Teacher; import com.example.resources.DataBase; import com.example.service.TeacherService; public class TeacherServiceImpl implements TeacherService { @Override public Person getPersonById(int id) { for(Person p : DataBase.getTeachers()) { if(id == p.getId()) { return p; } } return null; } @Override public int getTeacherPublishCounts(String professional) { int count = 0; for(Teacher t : DataBase.getTeachers()) { if(professional.equals(t.getProfessional())) { count += t.getPublishCount(); } } return count; } }
90cf4a29e6fc310d4bfe076905b702fe4de94678
280c1d39dc4802e38f2b332c3db3dd1defce32bd
/app/src/main/java/xin/banghua/beiyuan/Main5Branch/SettingFragment.java
71be5771c5cacb856c36e234363b02097ce267b0
[]
no_license
j309999174/BeiYuan
907286a7641aa3d2325ca16c58d41b37e127ab14
cd9b68de6be71505621d372d0357aaeadb97d2db
refs/heads/master
2020-06-19T11:59:51.330700
2019-08-13T01:03:09
2019-08-13T01:03:09
196,698,971
0
1
null
null
null
null
UTF-8
Java
false
false
4,808
java
package xin.banghua.beiyuan.Main5Branch; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.Toast; import xin.banghua.beiyuan.R; import xin.banghua.beiyuan.Signin.SigninActivity; /** * A simple {@link Fragment} subclass. */ public class SettingFragment extends Fragment { Button phone_reset; Button email_reset; Button password_reset; Button private_set; Button common_set; Button feedback_btn; Button help_btn; Button version_btn; Button logout_btn; private Context mContext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.mContext = getActivity(); } public SettingFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_setting, container, false); } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); phone_reset = view.findViewById(R.id.phone_reset); email_reset = view.findViewById(R.id.email_reset); password_reset = view.findViewById(R.id.password_reset); private_set = view.findViewById(R.id.private_set); common_set = view.findViewById(R.id.common_set); feedback_btn = view.findViewById(R.id.feedback_btn); help_btn = view.findViewById(R.id.help_btn); version_btn = view.findViewById(R.id.version_btn); logout_btn = view.findViewById(R.id.logout_btn); phone_reset.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(mContext,ResetActivity.class); intent.putExtra("title","手机绑定"); startActivity(intent); } }); email_reset.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(mContext,ResetActivity.class); intent.putExtra("title","邮箱绑定"); startActivity(intent); } }); password_reset.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(mContext,ResetActivity.class); intent.putExtra("title","密码重置"); startActivity(intent); } }); private_set.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(mContext,PrivateSettingActivity.class); intent.putExtra("title","隐私设置"); startActivity(intent); } }); common_set.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(mContext,CommonSettingActivity.class); intent.putExtra("title","通用设置"); startActivity(intent); } }); feedback_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(mContext,ResetActivity.class); intent.putExtra("title","意见反馈"); startActivity(intent); } }); help_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(mContext, "功能维护中", Toast.LENGTH_LONG).show(); } }); version_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(mContext, "当前版本:1.0.0", Toast.LENGTH_LONG).show(); } }); logout_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(mContext, SigninActivity.class); startActivity(intent); } }); } }
b14b197635c6bf238cc8567cde60296a5b85f004
7a04862f8592d4b13a12643d3770b139ff1725f9
/src/main/java/com/interviewbit/practice/InsertionSort.java
29ad44430087d39a23e71943a454af48ad8ba8b5
[]
no_license
akashshukla1111/ds-practice
9c8c33ed32706848025f35a9f38d4ceb6ede4362
e768a7feb6803695c593312f1542be292868f712
refs/heads/master
2022-11-06T03:02:04.420685
2016-10-22T17:48:15
2016-10-22T17:48:15
71,654,208
0
0
null
null
null
null
UTF-8
Java
false
false
629
java
package com.interviewbit.practice; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * Created by akashshukla on 18/01/16. */ public class InsertionSort { public static List<Integer> insertionSort(List<Integer> list) { for(int i=1 ; i<list.size() ; i++){ int j=i; while( j!=0){ if(!(list.get(j)>list.get(j-1))) { int temp = list.get(j - 1); list.set(j - 1, list.get(j)); list.set(j, temp); } j--; } } return list; } }
327311e641edfbe7c51661aa0c0ca636a5ec2c91
82a9358a249eca3a468082c8d9e766f6e155840e
/webservletlistener/src/main/java/com/msr/listenter/Demo01session.java
18889a6d553defaaf2a093da635186289d7abb0c
[]
no_license
yangguixue3/web-jsp
90b7cb61e509977b56089526a231d1dba9557dcf
bc7e79ef9ecc0f12831f24459ba95f5be725a2c7
refs/heads/master
2023-01-16T01:17:02.804006
2020-11-22T15:16:02
2020-11-22T15:16:02
313,243,722
0
0
null
null
null
null
UTF-8
Java
false
false
586
java
package com.msr.listenter; import javax.servlet.annotation.WebListener; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; @WebListener() public class Demo01session implements HttpSessionListener { @Override public void sessionCreated(HttpSessionEvent se) { System.out.println("Demo02でセッションが破壊されたことを監視した"); } @Override public void sessionDestroyed(HttpSessionEvent se) { System.out.println("Demo02でセッションが破壊されたことを監視した"); } }
[ "guixueyang3.gmail.com" ]
guixueyang3.gmail.com
0b8ce62451c7d3156aae24596e5905c76703f43c
3a5d3743a450c2cc64a7174828920330317597c9
/src/ExtruturaDeRepeticaoCase/Exemplo2.java
91ebad43baa3f4eb6f923f11c5e95e35a7e855bb
[]
no_license
carlosaugustoa/AulasAlgoritmos
804871ad6326d1b3c3f569646430e81063920faa
82969832eed4bec77ec17f5f824de5dbb8b09d24
refs/heads/master
2021-01-17T17:53:41.573988
2016-06-25T00:02:07
2016-06-25T00:02:07
60,882,258
0
0
null
null
null
null
UTF-8
Java
false
false
793
java
package ExtruturaDeRepeticaoCase; import java.util.Scanner; public class Exemplo2 { public static void main(String[] args){ Scanner ent = new Scanner(System.in); String escolha = ent.next(); //System.out.println("## OPCÇOES ##\nGabriel\nCarlos\nCaio"); switch(escolha){ case "Gabriel": System.out.println("Cabra bom esse garoto"); break; case "Carlos": System.out.println("Sujeito sério e concentrado"); break; case "Caio": System.out.println("Gente fina e honesta"); break; default: System.out.println("Você [e azedp e não gosta de gente"); } } }
681715408675da66d9de38a491fb0749af6ce5e7
21631a324e3f684fba7c77864c22a6dfd0f6763e
/app/build/generated/source/r/debug/android/support/slidingpanelayout/R.java
776633475fa5bbaf21f58f24bff56f2e361b7b6c
[]
no_license
sc2225/WaterCup
1c797c05cf785df5c61515d17aff763c45eccd54
ada37bae274c9c5f6a9143ba964cf07e1976b5d1
refs/heads/master
2020-04-01T21:49:06.679502
2019-01-04T00:05:40
2019-01-04T00:05:40
153,676,703
0
0
null
2018-10-19T02:52:14
2018-10-18T19:27:40
Java
UTF-8
Java
false
false
10,178
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 android.support.slidingpanelayout; public final class R { public static final class attr { public static final int alpha = 0x7f040027; public static final int font = 0x7f0400d7; public static final int fontProviderAuthority = 0x7f0400d9; public static final int fontProviderCerts = 0x7f0400da; public static final int fontProviderFetchStrategy = 0x7f0400db; public static final int fontProviderFetchTimeout = 0x7f0400dc; public static final int fontProviderPackage = 0x7f0400dd; public static final int fontProviderQuery = 0x7f0400de; public static final int fontStyle = 0x7f0400df; public static final int fontVariationSettings = 0x7f0400e0; public static final int fontWeight = 0x7f0400e1; public static final int ttcIndex = 0x7f040208; } public static final class color { public static final int notification_action_color_filter = 0x7f06006e; public static final int notification_icon_bg_color = 0x7f06006f; public static final int ripple_material_light = 0x7f06007b; public static final int secondary_text_default_material_light = 0x7f06007d; } public static final class dimen { public static final int compat_button_inset_horizontal_material = 0x7f070051; public static final int compat_button_inset_vertical_material = 0x7f070052; public static final int compat_button_padding_horizontal_material = 0x7f070053; public static final int compat_button_padding_vertical_material = 0x7f070054; public static final int compat_control_corner_material = 0x7f070055; public static final int compat_notification_large_icon_max_height = 0x7f070056; public static final int compat_notification_large_icon_max_width = 0x7f070057; public static final int notification_action_icon_size = 0x7f0700c4; public static final int notification_action_text_size = 0x7f0700c5; public static final int notification_big_circle_margin = 0x7f0700c6; public static final int notification_content_margin_start = 0x7f0700c7; public static final int notification_large_icon_height = 0x7f0700c8; public static final int notification_large_icon_width = 0x7f0700c9; public static final int notification_main_column_padding_top = 0x7f0700ca; public static final int notification_media_narrow_margin = 0x7f0700cb; public static final int notification_right_icon_size = 0x7f0700cc; public static final int notification_right_side_padding_top = 0x7f0700cd; public static final int notification_small_icon_background_padding = 0x7f0700ce; public static final int notification_small_icon_size_as_large = 0x7f0700cf; public static final int notification_subtext_size = 0x7f0700d0; public static final int notification_top_pad = 0x7f0700d1; public static final int notification_top_pad_large_text = 0x7f0700d2; } public static final class drawable { public static final int notification_action_background = 0x7f08006f; public static final int notification_bg = 0x7f080070; public static final int notification_bg_low = 0x7f080071; public static final int notification_bg_low_normal = 0x7f080072; public static final int notification_bg_low_pressed = 0x7f080073; public static final int notification_bg_normal = 0x7f080074; public static final int notification_bg_normal_pressed = 0x7f080075; public static final int notification_icon_background = 0x7f080076; public static final int notification_template_icon_bg = 0x7f080077; public static final int notification_template_icon_low_bg = 0x7f080078; public static final int notification_tile_bg = 0x7f080079; public static final int notify_panel_notification_icon_bg = 0x7f08007a; } public static final class id { public static final int action_container = 0x7f0a0011; public static final int action_divider = 0x7f0a0013; public static final int action_image = 0x7f0a0014; public static final int action_text = 0x7f0a001a; public static final int actions = 0x7f0a001b; public static final int async = 0x7f0a0023; public static final int blocking = 0x7f0a0028; public static final int chronometer = 0x7f0a0031; public static final int forever = 0x7f0a0055; public static final int icon = 0x7f0a005d; public static final int icon_group = 0x7f0a005e; public static final int info = 0x7f0a0061; public static final int italic = 0x7f0a0063; public static final int line1 = 0x7f0a0068; public static final int line3 = 0x7f0a0069; public static final int normal = 0x7f0a007d; public static final int notification_background = 0x7f0a007e; public static final int notification_main_column = 0x7f0a007f; public static final int notification_main_column_container = 0x7f0a0080; public static final int right_icon = 0x7f0a0094; public static final int right_side = 0x7f0a0095; public static final int tag_transition_group = 0x7f0a00c8; public static final int tag_unhandled_key_event_manager = 0x7f0a00c9; public static final int tag_unhandled_key_listeners = 0x7f0a00ca; public static final int text = 0x7f0a00cb; public static final int text2 = 0x7f0a00cc; public static final int time = 0x7f0a00d6; public static final int title = 0x7f0a00d7; } public static final class integer { public static final int status_bar_notification_info_maxnum = 0x7f0b000e; } public static final class layout { public static final int notification_action = 0x7f0d0032; public static final int notification_action_tombstone = 0x7f0d0033; public static final int notification_template_custom_big = 0x7f0d003a; public static final int notification_template_icon_group = 0x7f0d003b; public static final int notification_template_part_chronometer = 0x7f0d003f; public static final int notification_template_part_time = 0x7f0d0040; } public static final class string { public static final int status_bar_notification_info_overflow = 0x7f0f0047; } public static final class style { public static final int TextAppearance_Compat_Notification = 0x7f100115; public static final int TextAppearance_Compat_Notification_Info = 0x7f100116; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f100118; public static final int TextAppearance_Compat_Notification_Time = 0x7f10011b; public static final int TextAppearance_Compat_Notification_Title = 0x7f10011d; public static final int Widget_Compat_NotificationActionContainer = 0x7f1001c4; public static final int Widget_Compat_NotificationActionText = 0x7f1001c5; } public static final class styleable { public static final int[] ColorStateListItem = { 0x010101a5, 0x0101031f, 0x7f040027 }; public static final int ColorStateListItem_android_color = 0; public static final int ColorStateListItem_android_alpha = 1; public static final int ColorStateListItem_alpha = 2; public static final int[] FontFamily = { 0x7f0400d9, 0x7f0400da, 0x7f0400db, 0x7f0400dc, 0x7f0400dd, 0x7f0400de }; 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 = { 0x01010532, 0x01010533, 0x0101053f, 0x0101056f, 0x01010570, 0x7f0400d7, 0x7f0400df, 0x7f0400e0, 0x7f0400e1, 0x7f040208 }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_android_ttcIndex = 3; public static final int FontFamilyFont_android_fontVariationSettings = 4; public static final int FontFamilyFont_font = 5; public static final int FontFamilyFont_fontStyle = 6; public static final int FontFamilyFont_fontVariationSettings = 7; public static final int FontFamilyFont_fontWeight = 8; public static final int FontFamilyFont_ttcIndex = 9; public static final int[] GradientColor = { 0x0101019d, 0x0101019e, 0x010101a1, 0x010101a2, 0x010101a3, 0x010101a4, 0x01010201, 0x0101020b, 0x01010510, 0x01010511, 0x01010512, 0x01010513 }; public static final int GradientColor_android_startColor = 0; public static final int GradientColor_android_endColor = 1; public static final int GradientColor_android_type = 2; public static final int GradientColor_android_centerX = 3; public static final int GradientColor_android_centerY = 4; public static final int GradientColor_android_gradientRadius = 5; public static final int GradientColor_android_tileMode = 6; public static final int GradientColor_android_centerColor = 7; public static final int GradientColor_android_startX = 8; public static final int GradientColor_android_startY = 9; public static final int GradientColor_android_endX = 10; public static final int GradientColor_android_endY = 11; public static final int[] GradientColorItem = { 0x010101a5, 0x01010514 }; public static final int GradientColorItem_android_color = 0; public static final int GradientColorItem_android_offset = 1; } }
acb056e9e22f2237bbb44c664223c2876cd1fa88
448b4fb6db2d09b291b7a66715bb058464ba26b5
/zyportal-system/zyportal-system-api/src/main/java/com/zkzy/zyportal/system/api/service/ChartService.java
9b534c6983c859c04b11879db3f51417435bd592
[]
no_license
yzz1990/zyportal-parent
4e5a10c2e7df7672483c8e77312be7ace9d08be9
9d6896d08475b797e2d549cc41182ad4651976e5
refs/heads/master
2021-06-29T04:35:28.392186
2017-09-14T06:44:08
2017-09-14T06:44:08
103,477,515
0
0
null
null
null
null
UTF-8
Java
false
false
226
java
package com.zkzy.zyportal.system.api.service; import java.util.Map; /** * Created by Administrator on 2017/8/8 0008. */ public interface ChartService { Map<String,Object> userOperationChart(String type, String who); }
cebdf7c7bb9597c8b30f1a9c4967530ead536bc7
90cd88d00e42f70a42fe8722008f86d747f09007
/app/src/main/java/cn/longchou/wholesale/fragment/FinanceFragment.java
de53c524f53377d3a3cc9823ba532ed1676fb00d
[]
no_license
kangkang123/HaoCheDuo
051d6c0aa07193f511dac190df6f52d5b43e992e
55150e1209d0c035a6a8fa89a1f0deba21779259
refs/heads/master
2020-12-25T06:32:41.249795
2016-07-12T09:25:48
2016-07-12T09:25:48
61,703,690
0
0
null
null
null
null
UTF-8
Java
false
false
4,420
java
package cn.longchou.wholesale.fragment; import com.bumptech.glide.Glide; import com.google.gson.Gson; import com.lidroid.xutils.HttpUtils; import com.lidroid.xutils.exception.HttpException; import com.lidroid.xutils.http.ResponseInfo; import com.lidroid.xutils.http.callback.RequestCallBack; import com.lidroid.xutils.http.client.HttpRequest.HttpMethod; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; import cn.longchou.wholesale.R; import cn.longchou.wholesale.activity.BatchFinancingPlanActivity; import cn.longchou.wholesale.activity.CarLoanPlanActivity; import cn.longchou.wholesale.activity.ConsumerLoanPlanActivity; import cn.longchou.wholesale.activity.FinancialPlanActivity; import cn.longchou.wholesale.activity.LoginActivity; import cn.longchou.wholesale.activity.MyFinanceActivity; import cn.longchou.wholesale.adapter.MyFinanceAdapter; import cn.longchou.wholesale.base.BaseFragment; import cn.longchou.wholesale.domain.FinanceBanner; import cn.longchou.wholesale.domain.FinanceFirst; import cn.longchou.wholesale.global.Constant; import cn.longchou.wholesale.utils.PreferUtils; import cn.longchou.wholesale.utils.UIUtils; import cn.longchou.wholesale.view.ListViewForScrollView; public class FinanceFragment extends BaseFragment { private LinearLayout mLLMore; private ListView mLvFinance; private ImageView mBanner; @Override public View initView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_finance, null); View header = View.inflate(getActivity(), R.layout.item_finance_fragment_title, null); mLLMore = (LinearLayout) header.findViewById(R.id.ll_my_finance_more); mBanner = (ImageView) header.findViewById(R.id.iv_finance_display); mLvFinance = (ListView) view.findViewById(R.id.lv_finance_display); mLvFinance.addHeaderView(header); return view; } @Override public void initData() { MyFinanceAdapter adapter=new MyFinanceAdapter(getActivity(), FinanceFirst.getFinanceFirst()); mLvFinance.setAdapter(adapter); //获取金融banner图片 getImageData(); } //获取金融banner图片 private void getImageData() { HttpUtils http=new HttpUtils(); http.send(HttpMethod.POST, Constant.RequestFinaceHome, new RequestCallBack<String>() { @Override public void onFailure(HttpException arg0, String arg1) { } @Override public void onSuccess(ResponseInfo<String> resultInfo) { String result=resultInfo.result; Gson gson=new Gson(); FinanceBanner json = gson.fromJson(result, FinanceBanner.class); Glide.with(getActivity()).load(json.imgUrl).placeholder(R.drawable.finance_banner).into(mBanner); } }); } @Override public void initListener() { mLLMore.setOnClickListener(this); mLvFinance.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if(position==1){ //批售融资方案 Intent stockIntent=new Intent(getActivity(),BatchFinancingPlanActivity.class); startActivity(stockIntent); } else if(position==2){ //收车贷方案 Intent carLoanIntent=new Intent(getActivity(),CarLoanPlanActivity.class); startActivity(carLoanIntent); } else if(position==3) { //消费贷方案 Intent consumeIntent=new Intent(getActivity(),ConsumerLoanPlanActivity.class); startActivity(consumeIntent); } else if(position==4) { //我要理财方案 Intent financeIntent=new Intent(getActivity(),FinancialPlanActivity.class); startActivity(financeIntent); } } }); } @Override public void processClick(View v) { switch (v.getId()) { case R.id.ll_my_finance_more: boolean isLogin = PreferUtils.getBoolean(getActivity(), "isLogin", false); if(!isLogin) { Intent intent=new Intent(getActivity(),LoginActivity.class); UIUtils.startActivity(intent); }else{ Intent intent=new Intent(getActivity(),MyFinanceActivity.class); UIUtils.startActivity(intent); } break; default: break; } } }
188884bbd9a3764c6604635f1853db72919dc92a
9f226c20deeba54c422b09b2f7f4685f101663a3
/gof23/command/Invoke.java
99123dda0e7b148cde763bf42bdd92b807ac265b
[]
no_license
quchengguo/java-improve
76ab467b4e8dbae84cbfcf009db2652f6945f791
be17f1457044a6f315375ed7df7a1949045c2490
refs/heads/master
2022-07-22T17:09:43.450864
2022-07-09T01:58:47
2022-07-09T01:58:47
124,068,271
0
0
null
null
null
null
UTF-8
Java
false
false
312
java
package gof23.command; /** * Created by admin on 2018/11/12. * 命令的调用者和发起者 */ public class Invoke { private Command command; public Invoke(Command command) { this.command = command; } public void call(){ // 执行命令 command.execute(); } }
ea766b2ba6de01e38e767a400db4d51abbc7c1ec
490990a0e97bf0ae632428d9310404f50e14bacb
/app/src/main/kotlin/com/takusemba/retrofitdownloader/UpdateVideoViewingPositionRequest.java
0d540f0ac0a6af65127b194361444a2a97d3a6a6
[]
no_license
TakuSemba/RetrofitDownloader
751e69b75822e39f825a0d26754ad06daffc06fb
1508dde6915760733f395ffa570c904d277718d5
refs/heads/master
2020-12-30T10:23:38.411141
2018-03-07T08:14:15
2018-03-07T08:14:15
98,868,788
8
2
null
null
null
null
UTF-8
Java
false
false
4,754
java
// Code generated by Wire protocol buffer compiler, do not edit. // Source file: api/video_viewing.proto at 67:1 package tv.abema.protos; import com.squareup.wire.FieldEncoding; import com.squareup.wire.Message; import com.squareup.wire.ProtoAdapter; import com.squareup.wire.ProtoReader; import com.squareup.wire.ProtoWriter; import com.squareup.wire.WireField; import com.squareup.wire.internal.Internal; import java.io.IOException; import java.lang.Long; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.lang.StringBuilder; import okio.ByteString; /** * / ビデオ視聴位置更新レスポンス */ public final class UpdateVideoViewingPositionRequest extends Message<UpdateVideoViewingPositionRequest, UpdateVideoViewingPositionRequest.Builder> { public static final ProtoAdapter<UpdateVideoViewingPositionRequest> ADAPTER = new ProtoAdapter_UpdateVideoViewingPositionRequest(); private static final long serialVersionUID = 0L; public static final Long DEFAULT_POSITION = 0L; /** * / 再生位置(先頭からの経過秒) */ @WireField( tag = 1, adapter = "com.squareup.wire.ProtoAdapter#INT64" ) public final Long position; public UpdateVideoViewingPositionRequest(Long position) { this(position, ByteString.EMPTY); } public UpdateVideoViewingPositionRequest(Long position, ByteString unknownFields) { super(ADAPTER, unknownFields); this.position = position; } @Override public Builder newBuilder() { Builder builder = new Builder(); builder.position = position; builder.addUnknownFields(unknownFields()); return builder; } @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof UpdateVideoViewingPositionRequest)) return false; UpdateVideoViewingPositionRequest o = (UpdateVideoViewingPositionRequest) other; return Internal.equals(unknownFields(), o.unknownFields()) && Internal.equals(position, o.position); } @Override public int hashCode() { int result = super.hashCode; if (result == 0) { result = unknownFields().hashCode(); result = result * 37 + (position != null ? position.hashCode() : 0); super.hashCode = result; } return result; } @Override public String toString() { StringBuilder builder = new StringBuilder(); if (position != null) builder.append(", position=").append(position); return builder.replace(0, 2, "UpdateVideoViewingPositionRequest{").append('}').toString(); } public static final class Builder extends Message.Builder<UpdateVideoViewingPositionRequest, Builder> { public Long position; public Builder() { } /** * / 再生位置(先頭からの経過秒) */ public Builder position(Long position) { this.position = position; return this; } @Override public UpdateVideoViewingPositionRequest build() { return new UpdateVideoViewingPositionRequest(position, buildUnknownFields()); } } private static final class ProtoAdapter_UpdateVideoViewingPositionRequest extends ProtoAdapter<UpdateVideoViewingPositionRequest> { ProtoAdapter_UpdateVideoViewingPositionRequest() { super(FieldEncoding.LENGTH_DELIMITED, UpdateVideoViewingPositionRequest.class); } @Override public int encodedSize(UpdateVideoViewingPositionRequest value) { return (value.position != null ? ProtoAdapter.INT64.encodedSizeWithTag(1, value.position) : 0) + value.unknownFields().size(); } @Override public void encode(ProtoWriter writer, UpdateVideoViewingPositionRequest value) throws IOException { if (value.position != null) ProtoAdapter.INT64.encodeWithTag(writer, 1, value.position); writer.writeBytes(value.unknownFields()); } @Override public UpdateVideoViewingPositionRequest decode(ProtoReader reader) throws IOException { Builder builder = new Builder(); long token = reader.beginMessage(); for (int tag; (tag = reader.nextTag()) != -1;) { switch (tag) { case 1: builder.position(ProtoAdapter.INT64.decode(reader)); break; default: { FieldEncoding fieldEncoding = reader.peekFieldEncoding(); Object value = fieldEncoding.rawProtoAdapter().decode(reader); builder.addUnknownField(tag, fieldEncoding, value); } } } reader.endMessage(token); return builder.build(); } @Override public UpdateVideoViewingPositionRequest redact(UpdateVideoViewingPositionRequest value) { Builder builder = value.newBuilder(); builder.clearUnknownFields(); return builder.build(); } } }
c138b251858115d754515bc58d8987afefffcef5
31a717eef424c2c2cf5a8b1f4178f1016bdd75a7
/services/loadbalancing/lb-persistence/src/main/java/org/daylight/pathweaver/service/domain/repository/impl/ConnectionThrottleRepositoryImpl.java
6e98eb9ba79bbff73424b1fbc1081f83fc3db48b
[ "Apache-2.0" ]
permissive
citrixsystems/pathweaver
a108007650d1299f310dc6496779496eccfd0100
dfece61775b9705bda1659ffa8d344c65d432864
refs/heads/master
2021-01-10T13:08:03.277538
2013-03-23T00:37:18
2013-03-23T00:37:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,763
java
package org.daylight.pathweaver.service.domain.repository.impl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.daylight.pathweaver.service.domain.entity.*; import org.daylight.pathweaver.service.domain.exception.EntityNotFoundException; import org.daylight.pathweaver.service.domain.repository.ConnectionThrottleRepository; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import javax.persistence.EntityManager; import javax.persistence.NoResultException; import javax.persistence.NonUniqueResultException; import javax.persistence.PersistenceContext; import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Root; @Repository @Transactional(value="core_transactionManager") public class ConnectionThrottleRepositoryImpl implements ConnectionThrottleRepository { private final Log logger = LogFactory.getLog(ConnectionThrottleRepositoryImpl.class); private static final String entityNotFound = "Connection throttle not found"; @PersistenceContext(unitName = "loadbalancing") private EntityManager entityManager; @Override public ConnectionThrottle getByLoadBalancerId(Integer loadBalancerId) throws EntityNotFoundException { LoadBalancer loadBalancer = new LoadBalancer(); loadBalancer.setId(loadBalancerId); CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery<ConnectionThrottle> criteria = builder.createQuery(ConnectionThrottle.class); Root<ConnectionThrottle> throttleRoot = criteria.from(ConnectionThrottle.class); Predicate belongsToLoadBalancer = builder.equal(throttleRoot.get(ConnectionThrottle_.loadBalancer), loadBalancer); criteria.select(throttleRoot); criteria.where(belongsToLoadBalancer); try { return entityManager.createQuery(criteria).setMaxResults(1).getSingleResult(); } catch (NoResultException e) { throw new EntityNotFoundException(entityNotFound, e); } catch (NonUniqueResultException e) { logger.error("More than one connection throttle detected!", e); throw new EntityNotFoundException(entityNotFound, e); } } @Override public void delete(ConnectionThrottle connectionThrottle) throws EntityNotFoundException { if (connectionThrottle == null) { throw new EntityNotFoundException(entityNotFound); } connectionThrottle = entityManager.merge(connectionThrottle); // Re-attach hibernate instance entityManager.remove(connectionThrottle); } }
8e2191da3bbe0acef9356ddecdc6327286498b5c
bf4a901798650cffc94d9d0e41105abef493f543
/app/src/main/java/com/example/dione/noticesapp/api/interfaces/IUsers.java
3ca4c19f9b86ebb9b0ddc70a4f791502565e8e8b
[]
no_license
alemao238/NoticesApp
9789111efe828e7bf7d999e961f668c0dae17f72
d8f698a557b90632db2fa16ac33e11c30cbf0f1b
refs/heads/master
2020-03-16T20:07:33.581874
2017-03-20T05:34:30
2017-03-20T05:34:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
968
java
package com.example.dione.noticesapp.api.interfaces; import com.example.dione.noticesapp.api.models.Weather; import com.example.dione.noticesapp.event.LoginResponseEvent; import com.example.dione.noticesapp.event.RegisterResponseEvent; import com.example.dione.noticesapp.event.RegisterTokenResponseEvent; import java.util.Map; import retrofit2.Call; import retrofit2.http.FieldMap; import retrofit2.http.FormUrlEncoded; import retrofit2.http.GET; import retrofit2.http.POST; import retrofit2.http.Path; /** * Created by dione on 11/08/2016. */ public interface IUsers { @POST("user/create") @FormUrlEncoded Call<RegisterResponseEvent> registerUser(@FieldMap Map<String, String> values); @POST("user/login") @FormUrlEncoded Call<LoginResponseEvent> loginUser(@FieldMap Map<String, String> values); @POST("fcm/register") @FormUrlEncoded Call<RegisterTokenResponseEvent> registerToken(@FieldMap Map<String, String> values); }
2500499c6299e60cd77bae256a5d3e980ec85d56
1f19aec2ecfd756934898cf0ad2758ee18d9eca2
/u-1/u-11/u-11-f9859.java
b33880583de58c4ee99ade8a4abcc1d2bff27f37
[]
no_license
apertureatf/perftest
f6c6e69efad59265197f43af5072aa7af8393a34
584257a0c1ada22e5486052c11395858a87b20d5
refs/heads/master
2020-06-07T17:52:51.172890
2019-06-21T18:53:01
2019-06-21T18:53:01
193,039,805
0
0
null
null
null
null
UTF-8
Java
false
false
106
java
mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117 5670435611422
5abca0861f45bae9a1bbacbf88ce22e29782bc34
4a13f612e56d5c8a796e7ddfc9f3d57b9bbcda4c
/src/com/stormnet/figuresfx/exceptions/figureTypeException.java
a5a6e21354dd0a052d781a091526e126fdaa154e
[]
no_license
Den4ik5742/JavaExamProject
155d4475dba0f44af46c2b266323e704b6544205
28cdd1631e448b282d0d8d8c9af26ba434c42932
refs/heads/master
2022-11-05T18:15:50.163725
2020-06-24T20:58:59
2020-06-24T20:58:59
274,767,891
0
0
null
null
null
null
UTF-8
Java
false
false
178
java
package com.stormnet.figuresfx.exceptions; public class figureTypeException extends Exception { public figureTypeException(String message) { super(message); } }
0baae940c7be0ab667ca0652038fe84d1eba5b81
7291af136492f3ab8cc47247dfe5b2b51040fdba
/src/main/java/com/example/demo/controller/MessageController.java
bfd26b7fa2db3098fc40a7aa06c043f68ed4e44b
[]
no_license
shujitakasaki/STOMP-on-SpringBoot
89279b8372bffb2ee34a86dca2caf22ff4a56406
3ead6547e5142a8d9adae8cde3e3671f7392af6b
refs/heads/master
2020-05-17T08:01:50.340716
2019-04-26T09:01:14
2019-04-26T09:01:14
183,595,730
0
0
null
null
null
null
UTF-8
Java
false
false
1,606
java
package com.example.demo.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.messaging.handler.annotation.DestinationVariable; import org.springframework.messaging.handler.annotation.MessageMapping; import org.springframework.messaging.handler.annotation.SendTo; import org.springframework.messaging.simp.SimpMessagingTemplate; import org.springframework.stereotype.Controller; import java.security.Principal; import java.util.ArrayList; import java.util.List; @Controller public class MessageController { @Autowired SimpMessagingTemplate messagingTemplate; @MessageMapping("/controller/{id}") public void handleChat(@DestinationVariable String id, String msg) { // ルームにメッセージを送信 messagingTemplate.convertAndSend("/topic/" + id, msg); // メンションがあるか確認 if(!(msg.contains("@") && msg.contains(" "))) { return; } // メンションの宛先抽出 List<String> targets = new ArrayList<String>(); String tmpMsg = msg; while(tmpMsg.contains("@") && tmpMsg.contains(" ")){ int start = tmpMsg.indexOf("@")+1; int end = tmpMsg.indexOf(" "); String target = tmpMsg.substring(start, end); tmpMsg = tmpMsg.replaceAll("@" + target + " ", ""); targets.add(target); } // 宛先にメンションを飛ばす for(String target: targets) { messagingTemplate.convertAndSend("/mention/" + target, "mention!!"); } } }
4ba72c8d243e26876431162e7573f43a5f057ad7
377c5d7656642183ad0ac11d790448bdafaae3e4
/clocker/src/test/java/aop/Test049.java
0394ba7344a738dd97bbf29531482cfa82d62237
[ "Apache-2.0" ]
permissive
myflzh119/spring-mayf
b0c8ebd048edd18d9122e8b0bc2d0bc16969f26f
167d5bb34b7676527382dffd0323e7375d458c07
refs/heads/master
2023-04-14T19:27:32.411026
2021-05-04T15:37:33
2021-05-04T15:37:33
353,094,682
0
0
Apache-2.0
2021-05-04T15:37:34
2021-03-30T18:00:13
Java
UTF-8
Java
false
false
1,645
java
package aop; import com.cn.mayf.aop.*; import com.cn.mayf.depenteach.DepentService01; import com.cn.mayf.depenteach.DepentService02; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import java.lang.reflect.Method; /** * @Author mayf * @Date 2021/4/3 11:45 * BeanPostProcessor==>改变、创建一个对象(Bean) * 不同的时机,执行不同的BeanPostProcessor的不同的方法,实现不同的功能 * 其中有一个功能需要实现==>传进一个Bean,生成一个被代理的Bean * ==>AbstractAutoProxyCreator.postProcessAfterInitialization */ public class Test049 { @Test public void test(){ AnnotationConfigApplicationContext aca = new AnnotationConfigApplicationContext(); /*aca.register(AppConfigExcludeFilters.class); aca.refresh(); DepentService01 service01 = (DepentService01) aca.getBean("service01"); System.out.println(service01.getService()); System.out.println(aca.getBean("service222")); DepentService02 service02 = (DepentService02) aca.getBean("service02");*/ aca.register(AppConfig049.class); // aca.registerBeanDefinition("myAopBeanPostProcessor", // new RootBeanDefinition(CustomAopBeanPostProcessor.class)); aca.refresh(); // aca.getBean(SourceService.class).doSomething("mayf"); TestInterface bean = aca.getBean(TestInterface.class); for (Method method : bean.getClass().getDeclaredMethods()) { System.out.println(method.getName()); } // System.out.println(aca.getBean(TestInterface.class).returnSomething()); } }
cad73a2f563d5e9e78882659faa79f8f7664cddc
d5cbab63c867ee6f02b9b1a603fedea288659e69
/src/snake/snakeAI/ga/selectionMethods/Tournament.java
c71fbf3956c43b7949539157f85847491e9b11b5
[]
no_license
leorvm/SnakeAI
ab9d6952d726161829941735ef9dd46238bd2c20
e7a3c00a81d7523babd061c7109b023b0f8312b0
refs/heads/master
2020-03-11T08:41:33.188618
2018-06-11T13:19:02
2018-06-11T13:19:02
129,890,245
0
1
null
2022-07-17T12:30:03
2018-04-17T10:52:28
Java
UTF-8
Java
false
false
1,324
java
package snake.snakeAI.ga.selectionMethods; import snake.snakeAI.ga.GeneticAlgorithm; import snake.snakeAI.ga.Individual; import snake.snakeAI.ga.Population; import snake.snakeAI.ga.Problem; public class Tournament <I extends Individual, P extends Problem<I>> extends SelectionMethod<I, P> { private int size; public Tournament(int popSize) { this(popSize, 2); } public Tournament(int popSize, int size) { super(popSize); this.size = size; } @Override public Population<I, P> run(Population<I, P> original) { Population<I, P> result = new Population<>(original.getSize()); for (int i = 0; i < popSize; i++) { result.addIndividual(tournament(original)); } return result; } private I tournament(Population<I, P> population) { I best = population.getIndividual(GeneticAlgorithm.random.nextInt(popSize)); for (int i = 1; i < size; i++) { I aux = population.getIndividual(GeneticAlgorithm.random.nextInt(popSize)); if (aux.compareTo(best) > 0) { //if aux is BETTER than best best = aux; } } return (I) best.clone(); } @Override public String toString(){ return "Tournament(" + size + ")"; } }
33cff4f2dfdc1344585490deb90545c59487ba22
6a0a09431cc6966cd4defa32e036da548f5bb700
/app/src/main/java/com/example/user/hologrammini/MainActivity.java
3c68bfd74b366502b8ddfbf319156968fcb7c735
[]
no_license
harinikshan/Hologram_mini
30b21b36ae485fdba44ae6bf4ba8c0fc7b5a5173
c9f31a0b5b5428cab1c29cfaadd92c01bcdcd9b9
refs/heads/master
2020-03-17T16:57:14.541985
2018-05-18T13:11:12
2018-05-18T13:11:12
133,769,103
0
0
null
2018-05-17T10:19:53
2018-05-17T06:30:03
Java
UTF-8
Java
false
false
1,631
java
package com.example.user.hologrammini; import android.content.Intent; import android.os.Build; import android.os.Handler; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.ImageView; import android.widget.TextClock; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getSupportActionBar().hide(); setContentView(R.layout.activity_main); ImageView imageView = (ImageView) findViewById(R.id.imageView); imageView.animate().translationX(-75f).translationY(50f).scaleX(1f).scaleY(1f).setDuration(15000).alpha(0); ImageView imageView2 = (ImageView) findViewById(R.id.imageView2); imageView2.animate().translationY(-75f).translationY(-50f).scaleX(1f).scaleY(1f).alpha(0).setDuration(15000); ImageView imageView3 = (ImageView) findViewById(R.id.imageView3); imageView3.animate().translationY(75f).translationX(50f).scaleX(1f).scaleY(1f).alpha(0).setDuration(15000); ImageView imageView4 = (ImageView) findViewById(R.id.imageView4); imageView4.animate().translationX(75f).translationY(-50f).scaleX(1f).scaleY(1f).alpha(0).setDuration(15000); Handler mHandler1 = new Handler(); mHandler1.postDelayed(new Runnable() { @Override public void run() { Intent i = new Intent(MainActivity.this, weather.class); startActivity(i); } }, 15000L); } }
46839312f5609627de8300e0eb0cf40d564dae12
ed5159d056e98d6715357d0d14a9b3f20b764f89
/test/irvine/oeis/a148/A148036Test.java
bbbb5029ccdd9450d778174aa9d763ebc5e2e48d
[]
no_license
flywind2/joeis
c5753169cf562939b04dd246f8a2958e97f74558
e5efd6971a0062ac99f4fae21a7c78c9f9e74fea
refs/heads/master
2020-09-13T18:34:35.080552
2019-11-19T05:40:55
2019-11-19T05:40:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
256
java
package irvine.oeis.a148; import irvine.oeis.AbstractSequenceTest; /** * Tests the corresponding class. * @author Sean A. Irvine */ public class A148036Test extends AbstractSequenceTest { @Override protected int maxTerms() { return 10; } }
179fc62597763067ae38bcca3c28a40be44d6d8c
905dd3a7dd7b9a4f73832ce761cfc34dd934166d
/client/src/test/java/com/alibaba/nacos/client/env/NacosEnvironmentFactoryTest.java
13bda0fab6e764d9b68c804fff60df2aabb1293a
[ "Apache-2.0" ]
permissive
johnlanni/nacos
59abfb57ace6d74e0351b6e35740721a43280fd5
8cede1cf84158adbda2eba72a881f6e958abfc81
refs/heads/develop
2022-12-31T04:45:51.602885
2022-08-11T13:40:54
2022-08-11T13:40:54
520,769,406
0
3
Apache-2.0
2022-08-11T13:45:30
2022-08-03T06:50:56
Java
UTF-8
Java
false
false
1,815
java
/* * Copyright 1999-2022 Alibaba Group Holding Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.alibaba.nacos.client.env; import org.junit.Assert; import org.junit.Test; import java.lang.reflect.Proxy; import java.util.Properties; public class NacosEnvironmentFactoryTest { @Test(expected = IllegalStateException.class) public void testCreateEnvironment() { final NacosEnvironment environment = NacosEnvironmentFactory.createEnvironment(); Assert.assertNotNull(environment); Assert.assertTrue(Proxy.isProxyClass(environment.getClass())); environment.getProperty("test.exception"); } @Test public void testNacosEnvInit() { final NacosEnvironment environment = NacosEnvironmentFactory.createEnvironment(); final NacosEnvironmentFactory.NacosEnvironmentDelegate invocationHandler = (NacosEnvironmentFactory.NacosEnvironmentDelegate) Proxy.getInvocationHandler( environment); Properties properties = new Properties(); properties.setProperty("init.nacos", "true"); invocationHandler.init(properties); final String property = environment.getProperty("init.nacos"); Assert.assertEquals("true", property); } }
e1af98efa536fc162a7741ccecd47fb9efa388d1
de12a61f864303688d2c9e748eb58e319c26e52d
/Core/SDK/org.emftext.sdk.concretesyntax/src-gen/org/emftext/sdk/concretesyntax/impl/TokenDirectiveImpl.java
a9ffb18c836c75b306a4b3b1923c0db6c59fc3a0
[]
no_license
DevBoost/EMFText
800701e60c822b9cea002f3a8ffed18d011d43b1
79d1f63411e023c2e4ee75aaba99299c60922b35
refs/heads/master
2020-05-22T01:12:40.750399
2019-06-02T17:23:44
2019-06-02T19:06:28
5,324,334
6
10
null
2016-03-21T20:05:01
2012-08-07T06:36:34
Java
UTF-8
Java
false
false
1,464
java
/** * Copyright (c) 2006-2012 * Software Technology Group, Dresden University of Technology * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026 * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Software Technology Group - TU Dresden, Germany; * DevBoost GmbH - Berlin, Germany * - initial API and implementation * */ package org.emftext.sdk.concretesyntax.impl; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.impl.EObjectImpl; import org.emftext.sdk.concretesyntax.ConcretesyntaxPackage; import org.emftext.sdk.concretesyntax.TokenDirective; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Token Directive</b></em>'. * <!-- end-user-doc --> * <p> * </p> * * @generated */ public abstract class TokenDirectiveImpl extends EObjectImpl implements TokenDirective { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected TokenDirectiveImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return ConcretesyntaxPackage.Literals.TOKEN_DIRECTIVE; } } //TokenDirectiveImpl
3ae605122c0ba91de05f4853568cae01b33fe88e
ec5ee0c75640206efcb7f7bc4a3f46f0a55b7652
/src/main/java/com/bitmovin/api/sdk/model/GcsServiceAccountInput.java
17196e1b4a7a1f2880c465caae0ec5bb0a666b86
[ "MIT" ]
permissive
mcherif/bitmovinexp
eb831c18b041c9c86f6d9520b1028dc9b2ea72f6
d4d746794f26c8e9692c834e63d5d19503693bbf
refs/heads/main
2023-04-30T08:14:33.171375
2021-05-11T11:19:04
2021-05-11T11:19:04
368,218,598
0
0
null
null
null
null
UTF-8
Java
false
false
3,545
java
package com.bitmovin.api.sdk.model; import java.util.Objects; import java.util.Arrays; import com.bitmovin.api.sdk.model.GoogleCloudRegion; import com.bitmovin.api.sdk.model.Input; import java.util.Date; import java.util.List; import java.util.Map; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; /** * GcsServiceAccountInput */ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = false, defaultImpl = GcsServiceAccountInput.class) public class GcsServiceAccountInput extends Input { @JsonProperty("serviceAccountCredentials") private String serviceAccountCredentials; @JsonProperty("bucketName") private String bucketName; @JsonProperty("cloudRegion") private GoogleCloudRegion cloudRegion; /** * GCS projectId (required) * @return serviceAccountCredentials */ public String getServiceAccountCredentials() { return serviceAccountCredentials; } /** * GCS projectId (required) * * @param serviceAccountCredentials * GCS projectId (required) */ public void setServiceAccountCredentials(String serviceAccountCredentials) { this.serviceAccountCredentials = serviceAccountCredentials; } /** * Name of the bucket (required) * @return bucketName */ public String getBucketName() { return bucketName; } /** * Name of the bucket (required) * * @param bucketName * Name of the bucket (required) */ public void setBucketName(String bucketName) { this.bucketName = bucketName; } /** * Get cloudRegion * @return cloudRegion */ public GoogleCloudRegion getCloudRegion() { return cloudRegion; } /** * Set cloudRegion * * @param cloudRegion */ public void setCloudRegion(GoogleCloudRegion cloudRegion) { this.cloudRegion = cloudRegion; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } GcsServiceAccountInput gcsServiceAccountInput = (GcsServiceAccountInput) o; return Objects.equals(this.serviceAccountCredentials, gcsServiceAccountInput.serviceAccountCredentials) && Objects.equals(this.bucketName, gcsServiceAccountInput.bucketName) && Objects.equals(this.cloudRegion, gcsServiceAccountInput.cloudRegion) && super.equals(o); } @Override public int hashCode() { return Objects.hash(serviceAccountCredentials, bucketName, cloudRegion, super.hashCode()); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class GcsServiceAccountInput {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" serviceAccountCredentials: ").append(toIndentedString(serviceAccountCredentials)).append("\n"); sb.append(" bucketName: ").append(toIndentedString(bucketName)).append("\n"); sb.append(" cloudRegion: ").append(toIndentedString(cloudRegion)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
6e21e868859166ac859fc2c2d2296fed080acdca
8af8ef822a97273c3dbf00dc9f36fc8b4120b064
/app/src/main/java/com/example/myapplication/MainActivity.java
aef48f38b74bc80c3517f70e1d16662f3b7c7831
[]
no_license
WangChaunMing/APPclassLab5
cb1f9cb55af7a42c36e2b038cad4af4dea33f06a
30f49da73f021cb128dff4b8de5d5880cd5b46d8
refs/heads/master
2023-01-08T14:16:49.714231
2020-11-06T10:16:19
2020-11-06T10:16:19
310,562,265
0
0
null
null
null
null
UTF-8
Java
false
false
2,953
java
package com.example.myapplication; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import android.content.DialogInterface; import android.os.Bundle; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.Toast; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button btn = findViewById(R.id.button); btn.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View view){ final AlertDialog.Builder dialog = new AlertDialog.Builder(MainActivity.this); dialog.setTitle("請選擇功能"); dialog.setMessage("請根據下方按鈕選擇要顯示的物件"); dialog.setNeutralButton("取消", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { Toast.makeText(MainActivity.this,"dialog關閉",Toast.LENGTH_SHORT).show(); } }); dialog.setNegativeButton("自訂義Toast", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { showToast(); } }); dialog.setPositiveButton("顯示list", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { showListDialog(); } }); dialog.show(); } }); } private void showToast(){ Toast toast = new Toast(MainActivity.this); toast.setGravity(Gravity.TOP,0,100); toast.setDuration(Toast.LENGTH_SHORT); LayoutInflater inflater = getLayoutInflater(); View layout =inflater.inflate(R.layout.custom_toast, (ViewGroup)findViewById(R.id.custom_toast_root)); toast.setView(layout); toast.show(); } private void showListDialog(){ final String[] list ={"message1","message2","message3","message4","message5"}; AlertDialog.Builder dialog_list =new AlertDialog.Builder(MainActivity.this); dialog_list.setItems(list, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { Toast.makeText(MainActivity.this, "你選擇的是"+list[i], Toast.LENGTH_SHORT).show(); } }); dialog_list.show(); } }
6a82dacafa88b569f87b506e002d18b1978ef038
69e938ddfd91d7d9e6f7fdeb6e2a0715429c20f0
/src/main/java/com/phong/poloshop/common/filters/JwtAuthenticationFilter.java
5a9a1d9c5daf9e39bb68db2b848c3e8c9bbe0094
[]
no_license
vanphong2809/POLOShop
861bd32d490bebdb0aad652555a6b0840f056a8f
055d2e2b20103d4c676c41672708b9a3754bc530
refs/heads/master
2023-05-28T11:37:01.742587
2021-06-05T18:29:20
2021-06-05T18:29:20
308,084,808
0
0
null
null
null
null
UTF-8
Java
false
false
2,984
java
package com.phong.poloshop.common.filters; import java.io.IOException; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; import org.springframework.stereotype.Component; import org.springframework.web.filter.OncePerRequestFilter; import com.phong.poloshop.services.impl.UserService; import io.jsonwebtoken.ExpiredJwtException; import io.jsonwebtoken.Jwts; @Component public class JwtAuthenticationFilter extends OncePerRequestFilter { @Autowired UserService userService; private final String SECRET = "ThisIsASecret"; private final String TOKEN_PREFIX = "Bearer"; // // @Value("${jwt.http.request.header}") // private String tokenHeader; @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { // Authentication authentication = JwtTokenProvider.getAuthentication((HttpServletRequest) request); // SecurityContextHolder.getContext().setAuthentication(authentication); // filterChain.doFilter(request, response); final String requestTokenHeader = request.getHeader("Authorization"); String username = null; String jwtToken = null; if (requestTokenHeader != null && requestTokenHeader.startsWith("Bearer ")) { jwtToken = requestTokenHeader.substring(7); try { username = Jwts.parser().setSigningKey(SECRET).parseClaimsJws(jwtToken.replace(TOKEN_PREFIX, "")) .getBody().getSubject(); } catch (IllegalArgumentException e) { logger.error("JWT_TOKEN_UNABLE_TO_GET_USERNAME", e); } catch (ExpiredJwtException e) { logger.warn("JWT_TOKEN_EXPIRED", e); } } else { logger.warn("JWT_TOKEN_DOES_NOT_START_WITH_BEARER_STRING"); } if (username != null && SecurityContextHolder.getContext().getAuthentication() == null) { UserDetails userDetails = this.userService.loadUserByUsername(username); UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken = new UsernamePasswordAuthenticationToken( userDetails, null, userDetails.getAuthorities()); System.out.println("Author: "+userDetails.getAuthorities()); usernamePasswordAuthenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request)); SecurityContextHolder.getContext().setAuthentication(usernamePasswordAuthenticationToken); } filterChain.doFilter(request, response); } }
79d1c9f2d36f6b0436ac654270fa2bf646264cdb
e461c015bd43812c75561c663641b55ed74e7cf0
/FairyOnline/src/com/fairyonline/statics/ResponseJsonUtils.java
971a3b30d0b15424e860f735ade492c37e617b8d
[]
no_license
houyuehan/FairyOnline
7536d442867a67b7aca37eb04647593ed210ae3b
388605fd13f5e07cdf6591dbfc643feb80967cc8
refs/heads/master
2022-01-08T11:30:35.485637
2018-06-26T13:28:33
2018-06-26T13:28:33
null
0
0
null
null
null
null
GB18030
Java
false
false
4,708
java
package com.fairyonline.statics; // //public class ResponseJsonUtils { // //} import java.io.IOException; import java.io.PrintWriter; import javax.servlet.http.HttpServletResponse; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.serializer.SerializerFeature; /** * * Web服务端返回JSON工具类 * 工具类依赖FastJSON * 工具类支持返回JSON和JSONP格式数据 * @author [email protected] * */ public class ResponseJsonUtils { /** * 默认字符编码 */ private static String encoding = "UTF-8"; /** * JSONP默认的回调函数 */ private static String callback = "callback"; /** * FastJSON的序列化设置 */ private static SerializerFeature[] features = new SerializerFeature[]{ //输出Map中为Null的值 SerializerFeature.WriteMapNullValue, //如果Boolean对象为Null,则输出为false SerializerFeature.WriteNullBooleanAsFalse, //如果List为Null,则输出为[] SerializerFeature.WriteNullListAsEmpty, //如果Number为Null,则输出为0 SerializerFeature.WriteNullNumberAsZero, //输出Null字符串 SerializerFeature.WriteNullStringAsEmpty, //格式化输出日期 SerializerFeature.WriteDateUseDateFormat }; /** * 把Java对象JSON序列化 * @param obj 需要JSON序列化的Java对象 * @return JSON字符串 */ private static String toJSONString(Object obj){ return JSON.toJSONString(obj, features); } /** * 返回JSON格式数据 * @param response * @param data 待返回的Java对象 * @param encoding 返回JSON字符串的编码格式 */ public static void json(HttpServletResponse response, Object data, String encoding){ //设置编码格式 response.setContentType("text/plain;charset=" + encoding); response.setCharacterEncoding(encoding); PrintWriter out = null; try{ out = response.getWriter(); out.write(toJSONString(data)); out.flush(); }catch(IOException e){ e.printStackTrace(); } } /** * 返回JSON格式数据,使用默认编码 * @param response * @param data 待返回的Java对象 */ public static void json(HttpServletResponse response, Object data){ json(response, data, encoding); } /** * 返回JSONP数据,使用默认编码和默认回调函数 * @param response * @param data JSONP数据 */ public static void jsonp(HttpServletResponse response, Object data){ jsonp(response, callback, data, encoding); } /** * 返回JSONP数据,使用默认编码 * @param response * @param callback JSONP回调函数名称 * @param data JSONP数据 */ public static void jsonp(HttpServletResponse response, String callback, Object data){ jsonp(response, callback, data, encoding); } /** * 返回JSONP数据 * @param response * @param callback JSONP回调函数名称 * @param data JSONP数据 * @param encoding JSONP数据编码 */ public static void jsonp(HttpServletResponse response, String callback, Object data, String encoding){ StringBuffer sb = new StringBuffer(callback); sb.append("("); sb.append(toJSONString(data)); sb.append(");"); // 设置编码格式 response.setContentType("text/plain;charset=" + encoding); response.setCharacterEncoding(encoding); PrintWriter out = null; try { out = response.getWriter(); out.write(sb.toString()); out.flush(); } catch (IOException e) { e.printStackTrace(); } } public static String getEncoding() { return encoding; } public static void setEncoding(String encoding) { ResponseJsonUtils.encoding = encoding; } public static String getCallback() { return callback; } public static void setCallback(String callback) { ResponseJsonUtils.callback = callback; } }
890daa647038b5935fe9b8dd78e2ad54da586c83
3377c1efcff5ada1cc4ccb4df22e960962f063f4
/LAB5/Lab5/src/saga/Produto.java
aafb79275844b44b7498fa7f45ab9c6702457a5c
[]
no_license
paulonbc/labsP2
110a8b64a016575de5b9c591fecd879b617fee37
1f5167617cbf5426d151cc5287e2702fc20493d1
refs/heads/master
2020-06-11T23:56:33.172854
2019-07-27T19:56:46
2019-07-27T19:56:46
194,128,230
0
0
null
null
null
null
UTF-8
Java
false
false
1,552
java
package saga; public class Produto { private String nome; private double preco; private String descricao; public Produto(String nome, double preco, String descricao) { super(); this.nome = nome; this.preco = preco; this.descricao = descricao; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public double getPreco() { return preco; } public void setPreco(double preco) { if(preco < 0) { throw new IllegalArgumentException("O preço não pode ser menor que 0"); } this.preco = preco; } public String getDescricao() { return descricao; } public void setDescricao(String descricao) { this.descricao = descricao; } @Override public String toString() { return nome + " - " + descricao + " - R$:"+ preco; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((descricao == null) ? 0 : descricao.hashCode()); result = prime * result + ((nome == null) ? 0 : nome.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Produto other = (Produto) obj; if (descricao == null) { if (other.descricao != null) return false; } else if (!descricao.equals(other.descricao)) return false; if (nome == null) { if (other.nome != null) return false; } else if (!nome.equals(other.nome)) return false; return true; } }
321a2b6abec886e75726fc10b094d569f59838be
8f72007d55c01d01bb4a061a7a86ed425ba18b93
/J9ConcCookBook/src/chapter02basic_thread_synchronization/lesson03lock_synchronization/PrintQueue.java
964e13d93f5f218d4d1a8a41248050037bddcf5a
[]
no_license
VictorLeonidovich/MyConcurrencyLessons
42f226b5487abd20a90a36001915eca132576a31
3aeb04b0f7e6ebdf3ccf33362ed6804709fc5cba
refs/heads/master
2020-04-01T11:28:07.351405
2018-10-15T19:34:39
2018-10-15T19:34:39
153,163,533
0
0
null
null
null
null
UTF-8
Java
false
false
1,073
java
package chapter02basic_thread_synchronization.lesson03lock_synchronization; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; public class PrintQueue { private Lock queueLock; public PrintQueue(boolean fairMode) { this.queueLock = new ReentrantLock(fairMode); } public void printJob(Object document) { queueLock.lock(); try { Long duration = (long) (Math.random() * 3000); System.out.println(Thread.currentThread().getName() + ": PrintQueue: Printing a Job during " + (duration / 1000) + " seconds"); Thread.sleep(duration); } catch (InterruptedException e) { e.printStackTrace(); } finally { queueLock.unlock(); } queueLock.lock(); try { Long duration = (long) (Math.random() * 3000); System.out.printf("%s: PrintQueue: Printing a Job during %d seconds\n", Thread.currentThread().getName(), (duration / 1000)); Thread.sleep(duration); } catch (InterruptedException e) { e.printStackTrace(); } finally { queueLock.unlock(); } } }
9ccaab59bbbdae58283496ce29ab1233bbf1802c
9a70020d409332b7db0e2e5e087f500a0e58217c
/Programmers/2019 KAKAO BLIND RECRUITMENT/B/Solution.java
253b42e042bc7b47784887c97ad62287655f0d1e
[ "MIT" ]
permissive
ISKU/Algorithm
daf5e9d5397eaf7dad2d6f7fb18c1c94d8f0246d
a51449e4757e07a9dcd1ff05f2ef4b53e25a9d2a
refs/heads/master
2021-06-22T09:42:45.033235
2021-02-01T12:45:28
2021-02-01T12:45:28
62,798,871
55
12
null
null
null
null
UTF-8
Java
false
false
1,130
java
/* * Author: Minho Kim (ISKU) * Date: September 15, 2018 * E-mail: [email protected] * * https://github.com/ISKU/Algorithm * https://programmers.co.kr/learn/courses/30/lessons/42889 */ import java.util.*; class Solution { public int[] solution(int N, int[] stages) { int[] count = new int[N + 2]; for (int i = 0; i < stages.length; i++) count[stages[i]]++; double n = stages.length; Failure[] failures = new Failure[N + 1]; for (int i = 1; i <= N; i++) { double rate = (n == 0) ? 0 : count[i] / n; failures[i] = new Failure(i, rate); n -= count[i]; } Arrays.sort(failures, 1, N + 1, new Comparator<Failure>() { @Override public int compare(Failure o1, Failure o2) { if (o1.rate == o2.rate) return Integer.compare(o1.stage, o2.stage); return Double.compare(o2.rate, o1.rate); } }); int[] answer = new int[N]; for (int i = 1; i <= N; i++) answer[i - 1] = failures[i].stage; return answer; } private class Failure { public int stage; public double rate; public Failure(int stage, double rate) { this.stage = stage; this.rate = rate; } } }
bf6afdb0e8a3ed9ec6d1a943e322d5278c8a63f9
fdc20435b0ac8b3a6c21cbdcd541e502e47d32b4
/app/src/main/java/com/example/childcare/childcare/ChildActivity.java
b5e105675643c54b6ce70fe80c9c1945d0543c15
[]
no_license
EdozdeDandez/Childcare
b46a80ba141a9ea996f129c1d54a4c33662673b3
aeba97eea8e8b7b1112ead49b0148116e65d03c7
refs/heads/master
2020-03-30T03:38:43.093523
2018-09-28T07:10:35
2018-09-28T07:10:35
150,699,923
0
0
null
null
null
null
UTF-8
Java
false
false
4,486
java
package com.example.childcare.childcare; import android.content.Intent; import android.support.design.widget.TabLayout; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.example.childcare.childcare.adapters.ChildPagerAdapter; import com.example.childcare.childcare.model.Child; import com.example.childcare.childcare.sql.DatabaseHelper; public class ChildActivity extends AppCompatActivity { private final AppCompatActivity activity = ChildActivity.this; int child_id; int user_id; String role; /** * The {@link android.support.v4.view.PagerAdapter} that will provide * fragments for each of the sections. We use a * {@link FragmentPagerAdapter} derivative, which will keep every * loaded fragment in memory. If this becomes too memory intensive, it * may be best to switch to a * {@link android.support.v4.app.FragmentStatePagerAdapter}. */ private ChildPagerAdapter mSectionsPagerAdapter; /** * The {@link ViewPager} that will host the section contents. */ private ViewPager mViewPager; private DatabaseHelper databaseHelper; private Child child; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_child); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); // Create the adapter that will return a fragment for each of the three mSectionsPagerAdapter = new ChildPagerAdapter(getSupportFragmentManager()); mViewPager = (ViewPager) findViewById(R.id.container); mViewPager.setAdapter(mSectionsPagerAdapter); TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); tabLayout.setupWithViewPager(mViewPager); initViews(); } /** * This method is to initialize views */ private void initViews() { databaseHelper = new DatabaseHelper(activity); child_id = getIntent().getIntExtra("CHILD", 0); role = getIntent().getStringExtra("ROLE"); user_id = getIntent().getIntExtra("USER_ID", 0); child = databaseHelper.getChild(child_id); } public Bundle getRole() { Bundle myRole = new Bundle(); myRole.putString("ROLE", role); return myRole; } public Bundle getChildID() { Bundle childID = new Bundle(); childID.putInt("ID", child_id); return childID; } public Bundle getChildData() { Bundle childData = new Bundle(); childData.putString("NAME",child.getName()); childData.putInt("AGE",child.getAge()); childData.putString("ADDRESS",child.getAddress()); childData.putString("SCHEDULE",child.getSchedule()); childData.putString("DOB",child.getDob()); return childData; } public void deleteChild() { databaseHelper.deleteChild(child); Intent home = new Intent(activity, HomeActivity.class); home.putExtra("USER_ID", user_id); home.putExtra("ROLE", role); startActivity(home); finish(); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_child, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
5dd2b08f3471f058ead501dfac32dfabbaf561f7
e2080aea9f62b6998ee03a44287cc905dae30506
/src/main/java/galerie/controller/TableauController.java
4d0047b959236e0af277dba78b4c832395f3822a
[]
no_license
AreAtomic/Galerie
db2e5c968d5bd563eab2404846a2cc916b336ceb
9255ec261ebec2ca33ad5e7e76367378362d4037
refs/heads/master
2023-05-18T20:20:26.612012
2021-06-10T17:32:44
2021-06-10T17:32:44
353,296,309
0
0
null
null
null
null
UTF-8
Java
false
false
4,746
java
package galerie.controller; import galerie.dao.ArtisteRepository; import galerie.dao.TableauRepository; import galerie.entity.Tableau; import lombok.extern.log4j.Log4j2; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.mvc.support.RedirectAttributes; @Log4j2 // Génère le 'logger' pour afficher les messages de trace @Controller @RequestMapping(path = "/tableau") public class TableauController { private final TableauRepository tableauDAO; private final ArtisteRepository artisteDAO; public TableauController(TableauRepository tableauDAO, ArtisteRepository artisteDAO) { this.tableauDAO = tableauDAO; this.artisteDAO = artisteDAO; } /** * Affiche toutes les tableaux dans la base * * @param model pour transmettre les informations à la vue * @return le nom de la vue à afficher ('afficheTableaux.html') */ @GetMapping(path = "show") public String afficheToutesLesTableaux(Model model) { model.addAttribute("tableaux", tableauDAO.findAll()); return "afficheTableaux"; } /** * Montre le formulaire permettant d'ajouter un tableau * * @param tableau initialisé par Spring, valeurs par défaut à afficher dans le * formulaire * @param model pour transmettre des informations à la vie * @return le nom de la vue à afficher ('formulaireTableau.html') */ @GetMapping(path = "add") public String montreLeFormulairePourAjout(@ModelAttribute("tableau") Tableau tableau, Model model) { // Tableau tableau = new Tableau(); // model.addAttribute("tableau", tableau) ; // On transmet la liste des artistes pour pouvoir choisir l'auteur du tableau model.addAttribute("artistes", artisteDAO.findAll()); return "formulaireTableau"; } /** * Appelé par 'formulaireCategorie.html', méthode POST * * @param tableau Un tableau initialisé avec les valeurs saisies dans le * formulaire * @param redirectInfo pour transmettre des paramètres lors de la redirection * @return une redirection vers l'affichage de la liste des galeries */ @PostMapping(path = "save") public String ajouteLeTableauPuisMontreLaListe(Tableau tableau, RedirectAttributes redirectInfo) { String message; // tableau.setAuteur(auteur); // cf. https://www.baeldung.com/spring-data-crud-repository-save tableauDAO.save(tableau); message = "Le tableau '" + tableau.getTitre() + "' a été correctement enregistré"; // RedirectAttributes permet de transmettre des informations lors d'une // redirection, // Ici on transmet un message de succès ou d'erreur // Ce message est accessible et affiché dans la vue 'afficheGalerie.html' redirectInfo.addFlashAttribute("message", message); return "redirect:show"; // POST-Redirect-GET : on se redirige vers l'affichage de la liste } /** * Appelé par le lien 'Supprimer' dans 'afficheTableaux.html' * * @param tableau à partir de l'id du tableau transmis en paramètre, Spring * fera une requête SQL SELECT pour chercher le tableau dans * la base * @param redirectInfo pour transmettre des paramètres lors de la redirection * @return une redirection vers l'affichage de la liste des tableaux */ @GetMapping(path = "delete") public String supprimeUnTableauPuisMontreLaListe(@RequestParam("id") Tableau tableau, RedirectAttributes redirectInfo) { String message; try { tableauDAO.delete(tableau); // Ici on peut avoir une erreur (Si il y a des produits dans cette catégorie par // exemple) message = "Le tableau '" + tableau.getTitre() + "' a bien été supprimé"; } catch (DataIntegrityViolationException e) { // Par exemple, si le tableau est dans une exposition message = "Erreur : Impossible de supprimer Le tableau '" + tableau.getTitre() + "'"; } // RedirectAttributes permet de transmettre des informations lors d'une // redirection, // Ici on transmet un message de succès ou d'erreur // Ce message est accessible et affiché dans la vue 'afficheGalerie.html' redirectInfo.addFlashAttribute("message", message); return "redirect:show"; // on se redirige vers l'affichage de la liste } }
b0baa69f32abf73f05b19506d9d0b7d164b607d0
2aef402be4d43295fd81780709430971c8211ab7
/app/src/main/java/com/peppedalterio/whatsyourwish/util/WishStrings.java
47ff040c58849360eaf934a5dad90bffd2b30b87
[]
no_license
PeppeDAlterio/WhatsYourWish
7ad6f18cb54ded316e134e0c05529abe8d6f783c
f7f8ffd21f3bcc654a4cdddf4d78f43e71d14a47
refs/heads/master
2020-04-13T01:47:18.879525
2019-04-30T20:24:35
2019-04-30T20:24:35
162,883,694
0
0
null
2019-03-14T11:41:18
2018-12-23T11:06:44
Java
UTF-8
Java
false
false
403
java
package com.peppedalterio.whatsyourwish.util; public class WishStrings { public static final String SEPARATOR_TOKEN = "\r\n"; public static final String WISH_TITLE_KEY = "TITOLO"; public static final String WISH_DESCRIPTION_KEY = "DESCRIZIONE"; public static final String WISH_ASSIGNEE = "INCARICATO"; public static final String PROCESSING_WISH_SINCE = "DATA_IN_LAVORAZIONE"; }
38de5e4a35749d0240edf5bb0caddba4e827705a
390c6001d4387ddbcca69fd75e018c875ee63861
/app/src/main/java/me/jathusan/android/fragments/MyRidesFragment.java
87f1909e734518e709f180fade67aba6c509c410
[ "Apache-2.0" ]
permissive
jathusanT/wheelzo-android
7cf95aa99b91114adca75108c8a4237484e1b5c9
3cb62d2f3bf9c358d3925063a6af996a477d9ca0
refs/heads/master
2021-01-18T18:07:28.730910
2015-09-12T04:14:38
2015-09-12T04:14:38
26,416,823
0
0
null
2015-07-11T22:01:59
2014-11-10T02:02:18
Java
UTF-8
Java
false
false
5,595
java
package me.jathusan.android.fragments; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import com.google.gson.Gson; import com.melnykov.fab.FloatingActionButton; import org.json.JSONArray; import org.json.JSONException; import java.io.IOException; import java.util.ArrayList; import me.jathusan.android.R; import me.jathusan.android.activities.CreateRideActivity; import me.jathusan.android.activities.RideInfoActivity; import me.jathusan.android.adapter.RecyclerItemClickListener; import me.jathusan.android.adapter.RidesAdapter; import me.jathusan.android.model.Ride; import me.jathusan.android.http.WheelzoHttpApi; public class MyRidesFragment extends android.support.v4.app.Fragment { private static final String TAG = "MyRidesFragment"; private RecyclerView mRecyclerView; private RecyclerView.Adapter mRecyclerViewAdapter; private RecyclerView.LayoutManager mRecyclerViewLayoutManager; private ArrayList<Ride> mAvailableRides = new ArrayList<Ride>(); private ProgressBar mSpinner; private FloatingActionButton mFAB; /* No Rides */ private TextView mNoRidesText; private ImageView mNoRidesImage; public MyRidesFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_my_rides, container, false); setHasOptionsMenu(false); mRecyclerView = (RecyclerView) rootView.findViewById(R.id.my_rides_recycler_view); mRecyclerViewLayoutManager = new LinearLayoutManager(getActivity()); mRecyclerView.setLayoutManager(mRecyclerViewLayoutManager); mRecyclerViewAdapter = new RidesAdapter(mAvailableRides); mRecyclerView.addOnItemTouchListener(new RecyclerItemClickListener(getActivity(), new RecyclerItemClickListener.OnItemClickListener() { @Override public void onItemClick(View view, int position) { Intent rideInfo = new Intent(getActivity(), RideInfoActivity.class); rideInfo.putExtra(RideInfoActivity.RIDE_PARCELABLE_KEY, mAvailableRides.get(position)); startActivity(rideInfo); } })); mRecyclerView.setAdapter(mRecyclerViewAdapter); mFAB = (FloatingActionButton) rootView.findViewById(R.id.fab); mFAB.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent createRideActivity = new Intent(getActivity(), CreateRideActivity.class); startActivity(createRideActivity); } }); mNoRidesText = (TextView) rootView.findViewById(R.id.no_rides_text); mNoRidesImage = (ImageView) rootView.findViewById(R.id.no_rides_image); mSpinner = (ProgressBar) rootView.findViewById(R.id.my_spinner); return rootView; } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public void onResume() { super.onResume(); new FetchRidesJob().execute(); } private class FetchRidesJob extends AsyncTask<Void, Void, Void> { @Override protected void onPreExecute() { super.onPreExecute(); mSpinner.setVisibility(View.VISIBLE); mNoRidesText.setVisibility(View.GONE); mNoRidesImage.setVisibility(View.GONE); mAvailableRides.clear(); mRecyclerViewAdapter.notifyDataSetChanged(); } @Override protected Void doInBackground(Void... params) { try { com.squareup.okhttp.Response response = WheelzoHttpApi.getMyRides(); if (!response.isSuccessful()) { return null; } JSONArray jsonArray = new JSONArray(response.body().string()); Gson gson = new Gson(); for (int i = 0; i < jsonArray.length(); i++) { Ride ride = gson.fromJson(jsonArray.get(i).toString(), Ride.class); ride.setColor(getResources().getColor(R.color.light_purple)); mAvailableRides.add(ride); } } catch (IOException e) { Log.e(TAG, "IOException occurred while getting myRides", e); } catch (JSONException e) { Log.e(TAG, "JSONException occurred while getting myRides", e); } return null; } @Override protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); mSpinner.setVisibility(View.GONE); if (mAvailableRides == null || mAvailableRides.isEmpty()) { mNoRidesText.setVisibility(View.VISIBLE); mNoRidesImage.setVisibility(View.VISIBLE); } else { mRecyclerViewAdapter.notifyDataSetChanged(); } } } }