blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
90145ae8755b816d8bddff6167e08cd54432a852 | ddcca3852c714d7b2794c4ee3dc66b7c436069f7 | /distribute-lock/src/main/java/com/wang/distribute/lock/redis/RedisDistributeLock.java | eb39aa73278aa4abcc72b4f86df1a12a66d86c34 | [] | no_license | WangYG3022/java-study | 09de815a9165a8f559ae3e967dcf5748d658b2df | 46ba5231971c79aedcd5a7ed2a9e0c8a256de8ec | refs/heads/master | 2022-06-25T17:56:48.302608 | 2020-06-19T11:40:51 | 2020-06-19T11:40:51 | 229,410,595 | 0 | 0 | null | 2020-05-29T11:19:18 | 2019-12-21T10:18:51 | Java | UTF-8 | Java | false | false | 1,736 | java | package com.wang.distribute.lock.redis;
import org.springframework.data.redis.core.StringRedisTemplate;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
/**
* @description: redis实现分布式锁
* @author: WANG Y.G.
* @time: 2020/05/21 15:22
* @version: V1.0
*/
public class RedisDistributeLock implements Lock {
private StringRedisTemplate stringRedisTemplate;
private String lockKey;
private String lockValue;
public RedisDistributeLock(StringRedisTemplate stringRedisTemplate, String lockKey) {
this.stringRedisTemplate = stringRedisTemplate;
this.lockKey = lockKey;
lockValue = "";
}
@Override
public void lock() {
while (!tryLock()) {
lock();
try {
Thread.sleep(1000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
@Override
public void lockInterruptibly() throws InterruptedException {
}
@Override
public boolean tryLock() {
this.lockValue = UUID.randomUUID().toString();
Boolean tryLock = stringRedisTemplate.opsForValue().setIfAbsent(lockKey, lockValue, 10, TimeUnit.SECONDS);
return tryLock;
}
@Override
public boolean tryLock(long time, TimeUnit unit) throws InterruptedException {
return false;
}
@Override
public void unlock() {
if (lockValue.equals(stringRedisTemplate.opsForValue().get(lockKey))) {
stringRedisTemplate.delete(lockKey);
}
}
@Override
public Condition newCondition() {
return null;
}
}
| [
"935203723@qq.com"
] | 935203723@qq.com |
bdcb957f868439a4da1bff21bd9a5aeb579583e9 | 842307fcb7954fbf3d8471d08619a09cf8a8be23 | /android_webview/nonembedded/java/src/org/chromium/android_webview/services/NonembeddedSafeModeActionsList.java | ce7bbfd4d7f9c68d26b33e24955f1d0c2e96c7df | [
"BSD-3-Clause"
] | permissive | wahello/chromium | 3e2ecac308f746c1ee36562776506c2ea991d606 | 4b228fefd9c51cc19978f023b96d9858e7d1da95 | refs/heads/main | 2023-04-06T02:10:37.393447 | 2023-03-25T04:12:57 | 2023-03-25T04:12:57 | 131,737,050 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 887 | java | // Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.android_webview.services;
import org.chromium.android_webview.common.SafeModeAction;
/**
* Exposes the SafeModeActions supported by nonembedded Component Updater services.
*/
public final class NonembeddedSafeModeActionsList {
// Do not instantiate this class.
private NonembeddedSafeModeActionsList() {}
/**
* A list of SafeModeActions supported by nonembedded WebView processes. The set of actions to
* be executed will be specified by the nonembedded SafeModeService, however each action (if
* specified by the service) will be executed in the order listed below.
*/
public static final SafeModeAction[] sList = {
new ComponentUpdaterResetSafeModeAction(),
};
}
| [
"chromium-scoped@luci-project-accounts.iam.gserviceaccount.com"
] | chromium-scoped@luci-project-accounts.iam.gserviceaccount.com |
0ccfa34b882b0c84c3e0a03063a03cb6f9a54bec | 54cd52a120af2766c45a423398ef78f1b809be39 | /Design/146-LRU-Cache.java | 5c2b3376cf053316940667be1a25b586340da99e | [] | no_license | sq421784321/coding-practice | 3806a196eb297115c2863278184eabf882f6875b | a7d8b155eb2481a983cee6b228128a9dd225ffb7 | refs/heads/master | 2021-09-24T20:19:18.398891 | 2018-10-14T06:53:58 | 2018-10-14T06:53:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,217 | java | class LRUCache {
class DNode {
int key;
int value;
DNode prev;
DNode next;
DNode(int key, int value) {
this.key = key;
this.value = value;
prev = null;
next = null;
}
}
private DNode head; // newest
private DNode tail; // oldest
private Map<Integer, DNode> map;
private int capacity;
public LRUCache(int capacity) {
this.capacity = capacity;
map = new HashMap<>();
head = null;
tail = null;
}
public int get(int key) {
if (!map.containsKey(key)) return -1;
DNode node = map.get(key);
remove(node);
append(node);
return node.value;
}
private void remove(DNode node) {
if (node.prev != null && node.next != null) {
node.prev.next = node.next;
node.next.prev = node.prev;
} else if (node.prev == null && node.next == null) {
head = null;
tail = null;
} else if (node.prev != null) {
head = node.prev;
node.prev.next = null;
} else {
tail = node.next;
node.next.prev = null;
}
node.prev = null;
node.next = null;
map.remove(node.key);
}
private void append(DNode node) {
if (head == null) {
head = node;
tail = node;
} else {
head.next = node;
node.prev = head;
head = node;
}
map.put(node.key, node);
}
public void put(int key, int value) {
DNode newNode = new DNode(key, value);
if (map.containsKey(key)) {
DNode oldNode = map.get(key);
remove(oldNode);
append(newNode);
} else if (map.size() < capacity) {
append(newNode);
} else {
remove(tail);
append(newNode);
}
}
}
/**
* Your LRUCache object will be instantiated and called as such:
* LRUCache obj = new LRUCache(capacity);
* int param_1 = obj.get(key);
* obj.put(key,value);
*/ | [
"quansun@usc.edu"
] | quansun@usc.edu |
9f3ea05032c1ad05558b5118c00da4e97432808f | 0dcf8d3203a6ecf518eb2dcd4e2165aee74871ff | /common/src/main/java/com/eugene/sumarry/permission/Enum/PermissionDirection.java | 9c212c7bf697c97cd7fb28c16296546fd1a5ce97 | [] | no_license | AvengerEug/permission-backend | fcd09270aa93764d492a902acfd16dcddcb3b4fb | 94c1749f60a5261ef72b2ea6b0a155bfaf734815 | refs/heads/develop | 2022-07-05T13:07:15.723413 | 2020-03-28T01:40:52 | 2020-03-28T01:40:52 | 249,621,819 | 0 | 0 | null | 2022-05-25T23:24:11 | 2020-03-24T05:34:03 | Java | UTF-8 | Java | false | false | 651 | java | package com.eugene.sumarry.permission.Enum;
public enum PermissionDirection implements BaseEnum {
BACKEND(0), FRONTEND(1);
private int value;
PermissionDirection(int value) {
this.value = value;
}
@Override
public int getValue() {
return this.value;
}
public static PermissionDirection int2Enum(int value) {
PermissionDirection[] permissionDirections = PermissionDirection.values();
for (PermissionDirection permissionDirection : permissionDirections) {
if (permissionDirection.getValue() == value) return permissionDirection;
}
return null;
}
}
| [
"eugenesumarry@163.com"
] | eugenesumarry@163.com |
ea72fb457e6ceed8f5cdd3784140edb2c26703b4 | c7dbfc9c701b9f1f94c88fe116352e4172b3d75c | /blog-server/src/main/java/cn/baiyu/system/service/CommentService.java | c17d1754f9d112e09d8a04d818246f57f5e6c015 | [] | no_license | Yxiaokuan/blog-vue | a1c79fbfc3d262d600b881e6323fb96c30e9eadd | 510e130f908b894399918dbd8522e48442e49908 | refs/heads/master | 2020-09-30T07:55:22.837499 | 2019-11-17T05:42:19 | 2019-11-17T05:42:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,450 | java | package cn.baiyu.system.service;
import cn.baiyu.common.utils.QueryPage;
import cn.baiyu.system.entity.SysComment;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
import java.util.Map;
/**
* @auther baiyu
* @date 2019/11/2
*/
public interface CommentService extends IService<SysComment> {
/**
* 查询最新的8条评论
*
* @return
*/
List<SysComment> findAll();
/**
* 分页查询
*
* @param queryPage
* @return
*/
IPage<SysComment> list(String name,String url, QueryPage queryPage);
/**
* 分页查询并过滤留言数据
*
* @param articleId 当前访问的文章ID
* @param sort 分类,规定:sort=0表示文章详情页的评论信息;sort=1表示友链页的评论信息;sort=2表示关于我页的评论信息
* @return
*/
Map<String, Object> findCommentsList(QueryPage queryPage, String articleId, int sort);
/**
* 查询指定文章下的评论量
*
* @param articleId
* @return
*/
int findCountByArticle(Long articleId);
/**
* 新增
*
* @param comment
*/
void add(SysComment comment);
/**
* 更新
*
* @param comment
*/
void update(SysComment comment);
/**
* 删除
*
* @param id
*/
void delete(Long id);
}
| [
"baixixi187@163.com"
] | baixixi187@163.com |
49af6651dbb5838116bb26d64894ce4d9addb22c | 27fadad3b8577dcee391857138dc2a17cb7e570b | /src/com/ata/dao/RouteDaoImpl.java | 5fb2cdd82debd41335057e80ff09517eebb39cc0 | [] | no_license | AasthaAgarwal/ATA-Automation-of-travel-agency | a48688f905aeaa613beb6b6f4906c9dd3f4f49d4 | dcea35d8423bef132a23bf7647496562344ba119 | refs/heads/master | 2020-03-27T01:28:11.315111 | 2018-08-22T14:03:51 | 2018-08-22T14:03:51 | 145,714,374 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,981 | java | package com.ata.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import com.ata.bean.RouteBean;
import com.ata.util.DBUtil;
public class RouteDaoImpl implements RouteDao{
private Connection con = DBUtil.getConnectio();
@Override
public String createRoute(RouteBean routeBean) {
String so = routeBean.getSource();
String des = routeBean.getDestination();
String id = getRouteId(so.substring(0, 2), des.substring(0, 2));
try {
PreparedStatement ps = con.prepareStatement("insert into ata_tbl_Route values(?,?,?,?,?)");
ps.setString(1, id);
ps.setString(2, so);
ps.setString(3, des);
ps.setInt(4, routeBean.getDistance());
ps.setDouble(5, routeBean.getTravelDuration());
int i = ps.executeUpdate();
if(i>0)
{
return id;
}
else
return "FAIL";
} catch (SQLException e) {
e.printStackTrace();
return "FAIL";
}
}
@Override
public int deleteRoute(ArrayList<String> routeIDs) {
int count=0;
try {
PreparedStatement ps = con.prepareStatement("delete from ata_tbl_route where ROUTEID = ?");
for(int i=0;i<routeIDs.size();i++)
{
ps.setString(1, routeIDs.get(i));
if(ps.executeUpdate()>0)
{
count++;
}
}
} catch (SQLException e) {
e.printStackTrace();
}
return count;
}
@Override
public boolean updateRoute(RouteBean routeBean) {
boolean flag =false;
try {
PreparedStatement ps = con.prepareStatement("update ata_tbl_route set ROUTEID=?, SOURCE=?, DESTINATION=?, DISTANCE=?, TRAVELDURATION=? where ROUTEID=?");
ps.setString(1, routeBean.getRouteID());
ps.setString(2, routeBean.getSource());
ps.setString(3, routeBean.getDestination());
ps.setInt(4, routeBean.getDistance());
ps.setDouble(5, routeBean.getTravelDuration());
ps.setString(6, routeBean.getRouteID());
int i = ps.executeUpdate();
if(i>0)
{
flag=true;
}
} catch (SQLException e) {
e.printStackTrace();
return flag;
}
return flag;
}
@Override
public RouteBean findByID(String routeID) {
RouteBean routeBean =null;
try {
PreparedStatement ps = con.prepareStatement("select * from ata_tbl_route where ROUTEID = ?");
ps.setString(1, routeID);
ResultSet rs = ps.executeQuery();
if(rs.next())
{
routeBean = new RouteBean();
routeBean.setRouteID(rs.getString(1));
routeBean.setSource(rs.getString(2));
routeBean.setDestination(rs.getString(3));
routeBean.setDistance(rs.getInt(4));
routeBean.setTravelDuration(rs.getDouble(5));
}
} catch (SQLException e) {
e.printStackTrace();
return null;
}
return routeBean;
}
@Override
public ArrayList<RouteBean> findAll() {
ArrayList<RouteBean> routes = new ArrayList<RouteBean>();
Statement statement;
try {
statement = con.createStatement();
ResultSet rs = statement.executeQuery("select * from ata_tbl_route");
while(rs.next())
{
RouteBean routeBean = new RouteBean();
routeBean.setRouteID(rs.getString(1));
routeBean.setSource(rs.getString(2));
routeBean.setDestination(rs.getString(3));
routeBean.setDistance(rs.getInt(4));
routeBean.setTravelDuration(rs.getDouble(5));
routes.add(routeBean);
}
} catch (SQLException e) {
e.printStackTrace();
return null;
}
return routes;
}
@Override
public String getRouteId(String sourcePrefix, String destinationPrefix) {
String res= null;
try {
Statement st = con.createStatement();
ResultSet rs= st.executeQuery("select route_seq from ata_database.sequences");
if(rs.next())
{
res = rs.getString(1);
res = sourcePrefix+destinationPrefix+res;
}
} catch (SQLException e) {
e.printStackTrace();
}
return res;
}
}
| [
"aastha@aastha_PC"
] | aastha@aastha_PC |
8a8e05710bd4740658efd0a850f1ec0b2ff41acf | 17ac9cf15fa821ea9c2070311f04604917bfab5e | /src/main/java/util/Either.java | 6734ea78856a7ef51cc60bbb8164ce804eef7355 | [] | no_license | mamapanda/APCS2 | 6867e1b655328866394013574ab65d84ef95a043 | 397cd0d6df71cf70007d4576521e5fd44cab68be | refs/heads/master | 2021-04-29T07:52:31.849751 | 2017-02-18T01:25:16 | 2017-02-18T01:25:16 | 77,973,242 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,230 | java | package util;
import java.util.function.Function;
/**
* @author Daniel Phan
*/
public abstract class Either<T, U> {
public abstract <V> V either(Function<T, V> lFunc, Function<U, V> rFunc);
@Override
public abstract String toString();
public boolean isLeft() {
return this instanceof Left;
}
public boolean isRight() {
return this instanceof Right;
}
public static class Left<V, W> extends Either<V, W> {
public final V value;
public Left(V value) {
this.value = value;
}
@Override
public <X> X either(Function<V, X> lFunc, Function<W, X> rFunc) {
return lFunc.apply(value);
}
@Override
public String toString() {
return value.toString();
}
}
public static class Right<V, W> extends Either<V, W> {
public final W value;
public Right(W value) {
this.value = value;
}
@Override
public <X> X either(Function<V, X> lFunc, Function<W, X> rFunc) {
return rFunc.apply(value);
}
@Override
public String toString() {
return value.toString();
}
}
}
| [
"daniel.phan36@gmail.com"
] | daniel.phan36@gmail.com |
ebe6ddc7883cfdb0d2a6c74ad1889b4e8e778d2f | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/8/8_266b4f1797244ccd8bf062de010fcc522e48601a/Preferences/8_266b4f1797244ccd8bf062de010fcc522e48601a_Preferences_t.java | 12f85dd7ab8fd32889feab795374dfbf63df45cd | [] | 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 | 4,516 | java | /*
* Copyright (C) 2010 Felix Bechstein
*
* This file is part of SMSdroid.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; If not, see <http://www.gnu.org/licenses/>.
*/
package de.ub0r.android.smsdroid;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
/**
* Preferences.
*
* @author flx
*/
public class Preferences extends PreferenceActivity {
/** Preference's name: vibrate on receive. */
static final String PREFS_VIBRATE = "receive_vibrate";
/** Preference's name: sound on receive. */
static final String PREFS_SOUND = "receive_sound";
/** Preference's name: led color. */
private static final String PREFS_LED_COLOR = "receive_led_color";
/** Preference's name: led flash. */
private static final String PREFS_LED_FLASH = "receive_led_flash";
/** Preference's name: vibrator pattern. */
private static final String PREFS_VIBRATOR_PATTERN = "receive_vibrate_mode";
/** Preference's name: hide ads. */
static final String PREFS_HIDEADS = "hideads";
/** Preference's name: enable notifications. */
static final String PREFS_NOTIFICATION_ENABLE = "notification_enable";
/** Prefernece's name: sort messages upside down. */
static final String PREFS_MSGLIST_SORT = "sort_messages_upsidedown";
/** Prefernece's name: show contact's photo. */
static final String PREFS_CONTACT_PHOTO = "show_contact_photo";
/** Preference's name: theme. */
private static final String PREFS_THEME = "theme";
/** Theme: black. */
private static final String THEME_BLACK = "black";
/** Theme: light. */
private static final String THEME_LIGHT = "light";
/**
* {@inheritDoc}
*/
@Override
public final void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// final int theme = Preferences.getTheme(this);
// this.setTheme(theme);
this.addPreferencesFromResource(R.xml.prefs);
}
/**
* Get Theme from Preferences.
*
* @param context
* {@link Context}
* @return theme
*/
static final int getTheme(final Context context) {
final SharedPreferences p = PreferenceManager
.getDefaultSharedPreferences(context);
final String s = p.getString(PREFS_THEME, THEME_BLACK);
if (s != null && THEME_LIGHT.equals(s)) {
return android.R.style.Theme_Light;
}
return android.R.style.Theme_Black;
}
/**
* Get LED color pattern from Preferences.
*
* @param context
* {@link Context}
* @return pattern
*/
static final int getLEDcolor(final Context context) {
final SharedPreferences p = PreferenceManager
.getDefaultSharedPreferences(context);
final String s = p.getString(PREFS_LED_COLOR, "65280");
return Integer.parseInt(s);
}
/**
* Get LED flash pattern from Preferences.
*
* @param context
* {@link Context}
* @return pattern
*/
static final int[] getLEDflash(final Context context) {
final SharedPreferences p = PreferenceManager
.getDefaultSharedPreferences(context);
final String s = p.getString(PREFS_LED_FLASH, "500_2000");
final String[] ss = s.split("_");
final int[] ret = new int[2];
ret[0] = Integer.parseInt(ss[0]);
ret[1] = Integer.parseInt(ss[1]);
return ret;
}
/**
* Get vibrator pattern from Preferences.
*
* @param context
* {@link Context}
* @return pattern
*/
static final long[] getVibratorPattern(final Context context) {
final SharedPreferences p = PreferenceManager
.getDefaultSharedPreferences(context);
final String s = p.getString(PREFS_VIBRATOR_PATTERN, "0");
final String[] ss = s.split("_");
final int l = ss.length;
final long[] ret = new long[l];
for (int i = 0; i < l; i++) {
ret[i] = Long.parseLong(ss[i]);
}
return ret;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
a4f73217a3b3cc1ad0ea554829e8e7f0bd1a34dc | db1743734187429391605beb5cb2b82cd6190a0d | /src/test/java/com/yi/ex02/ReplyDAOTest.java | 883aaa15f9fa5c02e6e5988bfc2036109b961d25 | [] | no_license | bmkim621/ex02 | 28d0cef84b9407b2e25f68fd675075ee6b437b34 | 897ee9607776af761656f7d52536764b62bb10f4 | refs/heads/master | 2020-04-21T11:07:44.984477 | 2019-02-11T06:03:15 | 2019-02-11T06:03:15 | 169,511,443 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,300 | java | package com.yi.ex02;
import java.util.List;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.yi.domain.ReplyVO;
import com.yi.persistence.ReplyDAO;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"file:src/main/webapp/WEB-INF/spring/root-context.xml"})
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class ReplyDAOTest {
@Autowired
private ReplyDAO dao;
//@Test
public void test01CreateReply() {
ReplyVO vo = new ReplyVO();
vo.setBno(34804);
vo.setReplyer("잠온다");
vo.setReplytext("피곤...");
dao.create(vo);
}
@Test
public void test02List() {
List<ReplyVO> list = dao.list(34804);
for(ReplyVO vo : list) {
System.out.println(vo);
}
}
//@Test
public void test03UpdateReply() {
ReplyVO vo = new ReplyVO();
vo.setReplytext("댓글 수정하기 테스트ㅎㅎ");
vo.setRno(11);
dao.update(vo);
}
//@Test
public void test04DeleteReply() {
dao.delete(6);
}
}
| [
"moonstruck0614@gmail.com"
] | moonstruck0614@gmail.com |
cae264ff4bbfb0d55f4e294f8851493dee9054ca | 06dcfa124c88bc501856b0393bffeff90febed0f | /Demo3_UsingPartition/src/CustomPartitioner.java | 45ad69352eddfd13350138640934df9c1628669f | [] | no_license | ankeshsomani/BigDataExamples | f5b79b7e3c6a98a9a61a4781fc0feb3db63e3903 | 008fc672b623c2615f6b1a9c377c3c60db393733 | refs/heads/master | 2020-12-31T05:10:02.252810 | 2017-04-26T11:35:56 | 2017-04-26T11:35:56 | 57,211,751 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 615 | java | import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Partitioner;
public class CustomPartitioner extends Partitioner<Text, Text> {
@Override
public int getPartition(Text key, Text value, int reducers) {
// TODO Auto-generated method stub
String line[]=value.toString().split("\t");
int age=new Integer(line[2]);
int reducerNumber=0;
if(reducers==0){
return 0;
}
if(age > 15 && age <=30){
reducerNumber=0;
}
else if(age >30 && age <=40){
reducerNumber=1%reducers;
}
else if(age >40 && age <50){
reducerNumber=2%reducers;
}
return reducerNumber;
}
}
| [
"ankeshsomani@gmail.com"
] | ankeshsomani@gmail.com |
890ba0218819106eab5e8425b76012025c6e2d19 | 56b68d2189d484ca3b0ae3b1af58b4892cf41ec1 | /src/core/actions/unitactions/factory/RecoverFactory.java | bd9e76d05df1869e155d00924e12f4dc72102bff | [] | no_license | GAIGResearch/Tribes | d1095930936e7b249460af0dadee92e5f9434221 | 270e7e564630e5ef3dcc04c96dd66f58ef7273f3 | refs/heads/master | 2022-09-13T14:08:21.276157 | 2022-08-25T13:05:01 | 2022-08-25T13:05:01 | 235,330,507 | 43 | 16 | null | 2022-08-25T13:05:01 | 2020-01-21T11:50:12 | Java | UTF-8 | Java | false | false | 694 | java | package core.actions.unitactions.factory;
import core.actions.Action;
import core.actions.ActionFactory;
import core.actions.unitactions.Recover;
import core.actors.Actor;
import core.actors.units.Unit;
import core.game.GameState;
import java.util.LinkedList;
public class RecoverFactory implements ActionFactory {
@Override
public LinkedList<Action> computeActionVariants(final Actor actor, final GameState gs) {
Unit unit = (Unit) actor;
LinkedList<Action> actions = new LinkedList<>();
Recover newAction = new Recover(unit.getActorId());
if(newAction.isFeasible(gs)){
actions.add(newAction);
}
return actions;
}
}
| [
"diego.perez@qmul.ac.uk"
] | diego.perez@qmul.ac.uk |
1dcbae20f498f5902dfe774394b881584a01566f | 4c09637e52c3c53a896a351c6e59dd1ad938b5b3 | /WebChatAjax/src/java/model/MessageModel.java | 89e62ccbdc019cf523db43bb18cf23df4cc71102 | [] | no_license | huyhue/PROJECTS-WEB | 20f9e3da9ef09a0565aedb97030d4003ae234103 | cadbcb6cb81aa719bc697de9e1f054ca639d84e4 | refs/heads/main | 2023-05-14T17:21:43.694583 | 2021-06-04T14:23:14 | 2021-06-04T14:23:14 | 358,826,288 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 735 | java | package model;
import dao.DatabaseDAO;
import entity.Messages;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class MessageModel {
DatabaseDAO databaseDAO = new DatabaseDAO();
public void createNewMessage(int userId, int RoomId, String content, Date dateUploaded) {
databaseDAO.createNewMessage(userId, RoomId, content, dateUploaded);
}
public ArrayList<Messages> getAllMessageInRoom(int roomID) {
return databaseDAO.getAllMessageInRoom(roomID);
}
public void AddNewBannerWord(String word){
databaseDAO.AddNewBannerWord(word);
}
public List<String> getAllBannerWords() {
return databaseDAO.getAllBannerWordst();
}
}
| [
"tpgiahuy5@gmail.com"
] | tpgiahuy5@gmail.com |
29be90db63d8c339cd90ee1e0897053209a50863 | 7dff6c11ca1d7b5fadf3eaff1ae865805ef5a14d | /Expression/app/src/main/java/demo/dhcc/com/expression/simple2/XmlUtil.java | 2f024c7633adcaebfc7ca7ef1c6c8a7162121945 | [] | no_license | heyangJob/Design-Pattern | 85a1fc0ff7058db875ceaf065e1b803ed6227a1c | a7849247139a2a00103333d56de76783ab1fabbb | refs/heads/master | 2020-03-23T12:01:08.143480 | 2018-08-22T09:21:50 | 2018-08-22T09:21:50 | 141,531,909 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 917 | java | package demo.dhcc.com.expression.simple2;
import org.w3c.dom.Document;
import java.io.InputStream;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
/**
* @author 512573717@qq.com
* @created 2018/8/16 上午10:35.
*/
public class XmlUtil {
public static Document getRoot(InputStream inputStream) throws Exception {
Document doc = null;
//建立一个解析器工厂
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
//获得一个DocumentBuilder对象,这个对象代表了具体的DOM解析器
DocumentBuilder builder = factory.newDocumentBuilder();
//得到一个表示XML文档的Document对象
doc = builder.parse(inputStream);
//去掉XML文档中作为格式化内容的空白而映射在DOM树中的TextNode对象
doc.normalize();
return doc;
}
}
| [
"512573717@qq.com"
] | 512573717@qq.com |
c128b041cf7296be97b4ce47813f6b411a9e427e | 2d0d9e75b40225ee0cf8649d173f8f32be3f1e3c | /src/main/java/com/hlebon/service/subject/SubjectMapper.java | 646283858360aa0c6b6b6339d1bfe7c92934a98c | [] | no_license | kakawi/PKPP | ff31151611f7e0b8c47555deba44ea1a4ebac441 | afd47c349ac4aaf432007e748c122423de75a893 | refs/heads/master | 2020-04-04T16:36:05.351616 | 2018-11-11T18:35:23 | 2018-11-11T18:35:23 | 156,084,624 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 342 | java | package com.hlebon.service.subject;
import com.hlebon.repository.entity.SubjectEntity;
import com.hlebon.gui.subject.SubjectModalDto;
import org.mapstruct.Mapper;
@Mapper
public interface SubjectMapper {
SubjectModalDto sourceToDestination(SubjectEntity source);
SubjectEntity destinationToSource(SubjectModalDto destination);
}
| [
"hleb.bandarenka@gmail.com"
] | hleb.bandarenka@gmail.com |
4b4abc4a99989755acf4df1ca09a41b9b67fb31b | 45d1e88d4275045417b1128b1978bb277de4136c | /A15.SpringCloud/B02.GuiGuCloud/cloud-provider-hystrix-payment8001/src/main/java/com/atguigu/springcloud/PaymentHystrixMain8001.java | 1d64aa97c391e5c45e25018d800595765a32168d | [
"Apache-2.0"
] | permissive | huaxueyihao/NoteOfStudy | 2c1f95ef30e264776d0bbf72fb724b0fe9aceee4 | 061e62c97f4fa04fa417fd08ecf1dab361c20b87 | refs/heads/master | 2022-07-12T04:11:02.960324 | 2021-01-24T02:47:54 | 2021-01-24T02:47:54 | 228,293,820 | 0 | 0 | Apache-2.0 | 2022-06-21T03:49:20 | 2019-12-16T03:19:50 | Java | UTF-8 | Java | false | false | 1,313 | java | package com.atguigu.springcloud;
import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
@EnableEurekaClient
@EnableCircuitBreaker
public class PaymentHystrixMain8001 {
public static void main(String[] args) {
SpringApplication.run(PaymentHystrixMain8001.class, args);
}
@Bean
public ServletRegistrationBean getServlet(){
HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
registrationBean.setLoadOnStartup(1);
registrationBean.addUrlMappings("/hystrix.stream");
registrationBean.setName("HystrixMetricsStreamServlet");
return registrationBean;
}
}
| [
"837403116@qq.com"
] | 837403116@qq.com |
0a27c3ff2f5f1694879d8fc6549bbd6d6f922802 | f961d6cf584b5745d170a0d7347e4a450f0e388d | /app/src/main/java/com/example/romatupkalenko/wikiresearcherapp/data/paging/PageKeyedArticleDataSourceFactory.java | 0ff61fc7b85ba6902a9c3dbfd09f31f01e1e2ca5 | [] | no_license | kakutot/WikiApp | 4420ac11d49687c05bf3139d562e6f0f9fca6a03 | 6a02e454ec6b1d1f3bddd6f76ebf2e13961d7437 | refs/heads/master | 2020-03-27T20:56:45.895223 | 2018-09-02T19:16:00 | 2018-09-02T19:16:00 | 147,104,688 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 975 | java | package com.example.romatupkalenko.wikiresearcherapp.data.paging;
import android.arch.lifecycle.MutableLiveData;
import android.arch.paging.DataSource;
import android.content.Context;
public class PageKeyedArticleDataSourceFactory extends DataSource.Factory {
private MutableLiveData<PageKeyedArticleDataSource> liveDataSource;
private PageKeyedArticleDataSource dataSource;
private String searchTitle;
private Context context;
public PageKeyedArticleDataSourceFactory(Context context,String searchTitle){
liveDataSource = new MutableLiveData<>();
this.searchTitle = searchTitle;
this.context = context;
}
@Override
public DataSource create() {
dataSource = new PageKeyedArticleDataSource(context,searchTitle);
liveDataSource.postValue(dataSource);
return dataSource;
}
public MutableLiveData<PageKeyedArticleDataSource> getLiveDataSource() {
return liveDataSource;
}
}
| [
"36713667+kakutot@users.noreply.github.com"
] | 36713667+kakutot@users.noreply.github.com |
98526b86eb340602a403135d4ed6b9e88046f333 | ae8e8f73a49fb07b24b641041185f19c0b0e5b13 | /src/Lesson12/MyPridacete.java | 944f15da5abea0dbdb4622388bf211c7fb629af3 | [] | no_license | ArtjomGG/JavaCourse | b40262630cb68262e772dc640aaceefdc0881bcf | ed9316daeb09369f3a36aba0022c1aff9f49dbe5 | refs/heads/master | 2021-02-05T16:44:14.407157 | 2020-03-25T19:21:39 | 2020-03-25T19:21:39 | 243,804,808 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 251 | java | package Lesson12;
import lesson8.L8Cars;
import java.util.function.Predicate;
public class MyPridacete implements Predicate <L8Cars> {
@Override
public boolean test(L8Cars l8_cars) {
return l8_cars.getBrand().equals("BMW");
}
}
| [
"artjom.gg@gmail.com"
] | artjom.gg@gmail.com |
ac024cb81970810d1fd3da8fbba485ba23cfaa4b | a624dcc6620892e5bd243d37e36a3e245d246f54 | /reactor-mqtt-akka/src/main/java/com/study/iot/mqtt/akka/spring/SpringActorProducer.java | 8677140f3714d01d572ac8f642bcb893a786464c | [
"Apache-2.0"
] | permissive | wuzguo/reactor-mqtt-server | d96926c678677eb75725fc8f7136b87b0bc0e769 | b5f26bac2a6bf2d643ff668a84bdf15f06bceea2 | refs/heads/master | 2023-07-01T22:32:05.430927 | 2021-08-24T03:18:59 | 2021-08-24T03:18:59 | 362,772,977 | 13 | 11 | null | null | null | null | UTF-8 | Java | false | false | 1,285 | java | package com.study.iot.mqtt.akka.spring;
import akka.actor.AbstractActor;
import akka.actor.IndirectActorProducer;
import org.springframework.context.ApplicationContext;
/**
* <B>说明:描述</B>
*
* @author zak.wu
* @version 1.0.0
* @date 2021/8/16 15:06
*/
public class SpringActorProducer implements IndirectActorProducer {
private final ApplicationContext applicationContext;
private final Class<? extends AbstractActor> actorBeanClass;
private final Object[] parameters;
public SpringActorProducer(ApplicationContext applicationContext, Class<? extends AbstractActor> actorBeanClass, Object[] parameters) {
this.applicationContext = applicationContext;
this.actorBeanClass = actorBeanClass;
this.parameters = parameters;
}
public SpringActorProducer(ApplicationContext applicationContext, Class<? extends AbstractActor> actorBeanClass) {
this.applicationContext = applicationContext;
this.actorBeanClass = actorBeanClass;
this.parameters = null;
}
@Override
public AbstractActor produce() {
return applicationContext.getBean(actorBeanClass, parameters);
}
@Override
public Class<? extends AbstractActor> actorClass() {
return actorBeanClass;
}
}
| [
"wuzguo@gmail.com"
] | wuzguo@gmail.com |
1e37f084a621694217ec838e96ed41305d086340 | 826abd18fb794c430d7e8a20cee00c416554e176 | /gcml.diagram/src/gcml/diagram/view/factories/MediumToConnectionViewFactory.java | 4d050a37cda0487175ba29385fa261be20ee6b96 | [] | no_license | radtek/rrcomssys-team-5 | bc1ce72849164d44d39d97541417ff0067a5f2e2 | 42b99d7d4318b18f7ede6b7988f4ee79ce376624 | refs/heads/master | 2021-01-19T16:27:03.444298 | 2012-02-06T01:41:27 | 2012-02-06T01:41:27 | 41,311,357 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,240 | java | package gcml.diagram.view.factories;
import gcml.diagram.edit.parts.MediumToConnectionEditPart;
import gcml.diagram.part.GcmlVisualIDRegistry;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory;
import org.eclipse.gmf.runtime.notation.NotationFactory;
import org.eclipse.gmf.runtime.notation.View;
/**
* @generated
*/
public class MediumToConnectionViewFactory extends ConnectionViewFactory {
/**
* @generated
*/
protected List createStyles(View view) {
List styles = new ArrayList();
styles.add(NotationFactory.eINSTANCE.createConnectorStyle());
styles.add(NotationFactory.eINSTANCE.createFontStyle());
return styles;
}
/**
* @generated
*/
protected void decorateView(View containerView, View view,
IAdaptable semanticAdapter, String semanticHint, int index,
boolean persisted) {
if (semanticHint == null) {
semanticHint = GcmlVisualIDRegistry
.getType(MediumToConnectionEditPart.VISUAL_ID);
view.setType(semanticHint);
}
super.decorateView(containerView, view, semanticAdapter, semanticHint,
index, persisted);
}
}
| [
"jeanrodriguez24@e25b1dc4-2701-11de-895d-8b024f6b28d7"
] | jeanrodriguez24@e25b1dc4-2701-11de-895d-8b024f6b28d7 |
d8c5aea76b87d2e785b8587534a3b62fe3cc5389 | cbb042edc985720f2f5498e81038eb4a7d16db42 | /jilinwula-design/src/main/java/com/jilinwula/design/template/Test.java | 1776cb620a6963b796eae12248e37a5f93c7b9ec | [] | no_license | jilinwula/jilinwulas | b02e80c0f9262d5ba9947f4782c9b9c6a4bf7f11 | 8dda69e36179e140fc9a18064e0afcaaba1144e6 | refs/heads/master | 2021-01-10T22:43:41.097081 | 2016-10-14T09:40:31 | 2016-10-14T09:40:31 | 70,382,798 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 356 | java | package com.jilinwula.design.template;
/**
* @author Bing Pei
* @author jilinwula@foxmail.com
* @date 2016-09-27 14:27
* @since 1.0.1
*/
public class Test {
public static void main(String[] args) {
AbstractClass c = new ConcreateClassA();
c.templateMethod();
c = new ConcreateClassB();
c.templateMethod();
}
}
| [
"jilinwula@foxmail.com"
] | jilinwula@foxmail.com |
28f211dfa1184ce6ccb8c15fb4e53a3ca3912f46 | fda2f41ff66ff6eeae2b94ef98e88a9ee3c8ff4c | /lib/src/main/java/com/qflbai/mvvm/utils/bluetooth/BluetoothUtil.java | fa0c04e8dc73d22fed4e0258ee6410868daf23e2 | [] | no_license | qflbai/AndroidJetpack | 04847dfb53b6949c9ec85fae9bc3a7c7b40d12bc | edd0375b98950e3675acf2bb1c25b8c63780fb8b | refs/heads/master | 2020-03-27T15:09:16.204116 | 2018-12-07T09:53:15 | 2018-12-07T09:53:15 | 146,700,639 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,638 | java | package com.qflbai.mvvm.utils.bluetooth;
import java.text.NumberFormat;
/**
* ProjectName: outpdaTotal
* PackageName: com.suntech.outpdatotal.util.http
* ClassDesc: 蓝牙设备
* CreateUser: Corey
* CreateDate: 2017/6/1 0001 12:01
* UpdateUser: ******
* UpdateDate: ******
* UpdateDesc: ******
* CopyRight(c) 2016 Shenzhen Sun-Tech Digital Technology Co.Ltd. All rights reserved.
*/
public class BluetoothUtil {
private static Integer maxVoltage = 4200; //蓝牙设备的最高电量值
private static Integer minVoltage = 3500; //蓝牙设备的最低电量值
private static String TAG = "BluetoothUtil";
private static final String enterChar = "\r\n";
/**
* 根据当前电压值,计算出电量的百分比
* @param currentVoltage 单位为毫伏
* @return
*/
public static String getDeviceVoltage(String currentVoltage) {
Integer current = Integer.parseInt(currentVoltage);
NumberFormat numberFormat = NumberFormat.getInstance();
// 设置精确到小数点后0位
numberFormat.setMaximumFractionDigits(0);
String result = numberFormat.format((float)(current - minVoltage) / (float)(maxVoltage - minVoltage) * 100);
result += "%";
return result;
}
/**
* 去掉data的第一个和最后一个字符串(即去掉“{”和“}”) add by corey20170527
* @param data
* @return
*/
public static String dealBluetoothString(String data){
if(null == data || data.length() == 0) return null;
//判断:如果第一个字符是 IMConfig.BLURTOOTH_LEFT_CHAR 则去掉该字符
if(data.substring(0, 1).equals("{")) {
data = data.substring(1, data.length());
}
//判断:如果最后一个字符是 IMConfig.BLURTOOTH_RIGHT_CHAR 则去掉该字符
if(data.substring(data.length()-1, data.length()).equals("}")){
data = data.substring(0, data.length()-1);
}
return data;
}
/**
* 删除回车符
* @param data
* @return
*/
public static String removeEnterChar(String data) {
String returnString;
if(data.contains(enterChar)) {
returnString = data.replace(enterChar, "");
return returnString;
}
else {
return data;
}
}
/**
* 返回扫码结果的加密文与明文
* @param data
* @return
*/
public static String[] getTwoScanResult(String data) {
String[] returnArr;
returnArr = data.split(",");
return returnArr;
}
}
| [
"qflbai@163.com"
] | qflbai@163.com |
d9240f9cbf1b60776c7ce99b1106812802d0dd3e | 821663dfdf5442f8cfb8989ff6c495f1dbec33a5 | /src/leetcode/easy/InterviewThreeFour.java | ae50850a005fe3b73f25341433ac27deb087feed | [] | no_license | mosune/leetcode | f5d40f674ffb291b3bfecf8350b827887f141957 | 48c37bc7e4b507a86168c4ddabe6165b84d9dfe4 | refs/heads/master | 2021-07-14T16:09:58.330202 | 2020-07-17T03:45:54 | 2020-07-17T03:45:54 | 187,820,365 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,491 | java | package leetcode.easy;
import java.util.Stack;
/**
* 面试题 03.04. 化栈为队
*
* 实现一个MyQueue类,该类用两个栈来实现一个队列。
*
*
* 示例:
*
* MyQueue queue = new MyQueue();
*
* queue.push(1);
* queue.push(2);
* queue.peek(); // 返回 1
* queue.pop(); // 返回 1
* queue.empty(); // 返回 false
*
* 说明:
*
* 你只能使用标准的栈操作 -- 也就是只有 push to top, peek/pop from top, size 和 is empty 操作是合法的。
* 你所使用的语言也许不支持栈。你可以使用 list 或者 deque(双端队列)来模拟一个栈,只要是标准的栈操作即可。
* 假设所有操作都是有效的 (例如,一个空的队列不会调用 pop 或者 peek 操作)。
*
* @author gcg
* @create 2020-04-27 12:36
**/
public class InterviewThreeFour {
Stack<Integer> stack1 = new Stack<>();
Stack<Integer> stack2 = new Stack<>();
public InterviewThreeFour() {
}
public void push(int x) {
while (!stack2.empty()) {
stack1.push(stack2.pop());
}
stack1.push(x);
}
public int pop() {
while (!stack1.empty()) {
stack2.push(stack1.pop());
}
return stack2.pop();
}
public int peek() {
while (!stack1.empty()) {
stack2.push(stack1.pop());
}
return stack2.peek();
}
public boolean empty() {
return stack1.empty() && stack2.empty();
}
}
| [
"cgge@best-inc.com"
] | cgge@best-inc.com |
c3c40d51d7bd3d691f6079fe7004b341abbac476 | b5c485493f675bcc19dcadfecf9e775b7bb700ed | /jee-utility/src/main/java/org/cyk/utility/log/AbstractLogEventPropertyAccessorImpl.java | 349d09da3d246903353f6b2e926ea2e5046d33fa | [] | no_license | devlopper/org.cyk.utility | 148a1aafccfc4af23a941585cae61229630b96ec | 14ec3ba5cfe0fa14f0e2b1439ef0f728c52ec775 | refs/heads/master | 2023-03-05T23:45:40.165701 | 2021-04-03T16:34:06 | 2021-04-03T16:34:06 | 16,252,993 | 1 | 0 | null | 2022-10-12T20:09:48 | 2014-01-26T12:52:24 | Java | UTF-8 | Java | false | false | 313 | java | package org.cyk.utility.log;
import java.io.Serializable;
import org.cyk.utility.__kernel__.object.dynamic.AbstractObject;
public abstract class AbstractLogEventPropertyAccessorImpl extends AbstractObject implements LogEventPropertyAccessor, Serializable {
private static final long serialVersionUID = 1L;
}
| [
"Christian@CYK-HP-LAPTOP"
] | Christian@CYK-HP-LAPTOP |
fec36275f4a009a68c0a949a98857cc67610faf3 | 4bddb8b07d9454443ba4e507b4ad9746fc5a7d42 | /02-java-oop/03-zoo-keeper-pt1/Gorilla.java | a20b54d04010b80150bd6b532d7d40d0e5b6ee6c | [] | no_license | java-july-2021/Archana-Assignments | 1a3fef697b68c53ebf8c5c9ab1267dd2f4cd7c06 | 6fc0876af1b1eadb3b9ead7fad7f26e7f8810193 | refs/heads/master | 2023-07-03T01:41:01.689144 | 2021-08-09T20:10:13 | 2021-08-09T20:10:13 | 385,363,301 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 780 | java | class Gorilla extends Mammal{
int defaultEnergyLevel=100;
public Gorilla (){
}
public setdefaultEnergyLevel(){
this.eneryLevel=defaultEnergyLevel;
}
public getdefaultEnergyLevel(){
return this.eneryLevel;
}
public void throwSomething(){
System.out.println("gorrilla has thrown somethings");
energyLevel -=5;
}
public boolean eatBananas(){
System.out.println("Gorrill's got a Banana, Increased the level by 1 " +eneryLevel);
energyLevel +=10;
}
public boolean climb(){
System.out.println("Gorrill's got a Banana, Increased the level by 1 "+eneryLevel);
energyLevel -=10;
}
}
| [
"archooworship@gmail.com"
] | archooworship@gmail.com |
4d90f43058f31228228ab8ddb38e312466c5ea25 | 69a4f2d51ebeea36c4d8192e25cfb5f3f77bef5e | /methods/Method_1006559.java | 93c107bb13b38be7811cf2fd2c295f68a612b80f | [] | no_license | P79N6A/icse_20_user_study | 5b9c42c6384502fdc9588430899f257761f1f506 | 8a3676bc96059ea2c4f6d209016f5088a5628f3c | refs/heads/master | 2020-06-24T08:25:22.606717 | 2019-07-25T15:31:16 | 2019-07-25T15:31:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 211 | java | public static String slurp(InputStream in){
Scanner s=new Scanner(in).useDelimiter("\\A");
return s.hasNext() ? s.next().replaceAll("\r\n","\n").replaceAll("\n",System.getProperty("line.separator")) : "";
}
| [
"sonnguyen@utdallas.edu"
] | sonnguyen@utdallas.edu |
a7b7c245620d4b24c7f717657ec5d036dce408fe | 58da62dfc6e145a3c836a6be8ee11e4b69ff1878 | /src/main/java/com/alipay/api/domain/FengdiePreviewQueryRespModel.java | ed306859749c7e47d231354d48acfb03004b2f16 | [
"Apache-2.0"
] | permissive | zhoujiangzi/alipay-sdk-java-all | 00ef60ed9501c74d337eb582cdc9606159a49837 | 560d30b6817a590fd9d2c53c3cecac0dca4449b3 | refs/heads/master | 2022-12-26T00:27:31.553428 | 2020-09-07T03:39:05 | 2020-09-07T03:39:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 810 | java | package com.alipay.api.domain;
import java.util.List;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.internal.mapping.ApiListField;
/**
* 获取云凤蝶站点页面预览数据返回值模型
*
* @author auto create
* @since 1.0, 2018-10-22 16:59:00
*/
public class FengdiePreviewQueryRespModel extends AlipayObject {
private static final long serialVersionUID = 3297832178412616751L;
/**
* 云凤蝶页面预览数据列表
*/
@ApiListField("list")
@ApiField("fengdie_preview_pages_model")
private List<FengdiePreviewPagesModel> list;
public List<FengdiePreviewPagesModel> getList() {
return this.list;
}
public void setList(List<FengdiePreviewPagesModel> list) {
this.list = list;
}
}
| [
"ben.zy@antfin.com"
] | ben.zy@antfin.com |
ed13a1efdd5b5efb39b5e0de5e1eadaaf28ca65c | d09a2936851974adf2a314bcb5b2ab28163b3fff | /Tree_JAVA/AVLTreeInsertion.java | 2e9f4dcb1660e23e2793c91d1f912cfbf1b3ddef | [] | no_license | rahulnishant13/geeksforgeeks | fdca49c74bc4aee186815fddb344c524247c8bd3 | 20dbaa894650dff7ca99a21c5269e89a9d0e02ca | refs/heads/master | 2021-07-20T19:30:33.219191 | 2017-10-26T08:05:18 | 2017-10-26T08:05:18 | 38,194,025 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,339 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Tree_JAVA;
import java.util.Scanner;
/**
*
* @author RAHUL
*/
class NodeAVL
{
int data;
int height;
NodeAVL left;
NodeAVL right;
NodeAVL(int data)
{
this.data = data;
this.left = null;
this.right = null;
}
}
class ALV
{
Node insertAVL(NodeAVL n, int d)
{
if(n == null)
new Node(d);
if(d > n.data)
insertAVL(n.right,d);
else
insertAVL(n.left, d);
int balance = balance(n.left, n.right);
}
private int balance(NodeAVL left, NodeAVL right)
{
return height(left) - height(right);
}
private int height(NodeAVL n)
{
if(n == null)
return 0;
return
}
}
public class AVLTreeInsertion
{
public static void main(String [] args)
{
ALV obj = new ALV();
Scanner sc = new Scanner(System.in);
System.out.println("Enter no of Data : ");
int n = sc.nextInt();
System.out.println("Enter Elements : ");
Node root;
for(int i = 0; i < n; i++)
{
int d = sc.nextInt();
root = obj.insertAVL(root, d);
}
}
}
| [
"rahulnishant13@gmail.com"
] | rahulnishant13@gmail.com |
ed8c1851b31a030b64ceb2b31a0e1224e1bec144 | c282f9b5f679da55dd85e44cbd91790da069bde4 | /modules/server/src-gen/main/java/br/com/kerubin/api/financeiro/contaspagar/entity/contabancaria/ContaBancariaController.java | 8ef4c9cf5eb061eb0c61a7a94ea45dc9d4d08294 | [] | no_license | lobokoch/contas-pagar | 54085d5488ee3a192db4dc290fa0488045673a53 | 9745856a8cd0e6d6b181bd05afc85fc179f83e62 | refs/heads/master | 2021-07-20T18:27:37.691247 | 2020-06-29T01:17:12 | 2020-06-29T01:17:12 | 189,776,592 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,013 | java | /**********************************************************************************************
Code generated by MKL Plug-in
Copyright: Kerubin - kerubin.platform@gmail.com
WARNING: DO NOT CHANGE THIS CODE BECAUSE THE CHANGES WILL BE LOST IN THE NEXT CODE GENERATION.
***********************************************************************************************/
package br.com.kerubin.api.financeiro.contaspagar.entity.contabancaria;
import java.util.stream.Collectors;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.http.ResponseEntity;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import br.com.kerubin.api.financeiro.contaspagar.common.PageResult;
import br.com.kerubin.api.financeiro.contaspagar.entity.agenciabancaria.AgenciaBancariaAutoComplete;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.Collection;
import java.util.List;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.RequestParam;
@RestController
@RequestMapping("financeiro/contas_pagar/entities/contaBancaria")
@Api(value = "ContaBancaria", tags = {"ContaBancaria"}, description = "Operations for Conta bancária")
public class ContaBancariaController {
@Autowired
private ContaBancariaService contaBancariaService;
@Autowired
ContaBancariaDTOConverter contaBancariaDTOConverter;
@Transactional
@PostMapping
@ApiOperation(value = "Creates a new Conta bancária")
public ResponseEntity<ContaBancaria> create(@Valid @RequestBody ContaBancaria contaBancaria) {
ContaBancariaEntity contaBancariaEntity = contaBancariaService.create(contaBancariaDTOConverter.convertDtoToEntity(contaBancaria));
return ResponseEntity.status(HttpStatus.CREATED).body(contaBancariaDTOConverter.convertEntityToDto(contaBancariaEntity));
}
@Transactional(readOnly = true)
@GetMapping("/{id}")
@ApiOperation(value = "Retrieves Conta bancária")
public ResponseEntity<ContaBancaria> read(@PathVariable java.util.UUID id) {
try {
ContaBancariaEntity contaBancariaEntity = contaBancariaService.read(id);
return ResponseEntity.ok(contaBancariaDTOConverter.convertEntityToDto(contaBancariaEntity));
}
catch(IllegalArgumentException e) {
return ResponseEntity.notFound().build();
}
}
@Transactional
@PutMapping("/{id}")
@ApiOperation(value = "Updates Conta bancária")
public ResponseEntity<ContaBancaria> update(@PathVariable java.util.UUID id, @Valid @RequestBody ContaBancaria contaBancaria) {
try {
ContaBancariaEntity contaBancariaEntity = contaBancariaService.update(id, contaBancariaDTOConverter.convertDtoToEntity(contaBancaria));
return ResponseEntity.ok(contaBancariaDTOConverter.convertEntityToDto(contaBancariaEntity));
}
catch(IllegalArgumentException e) {
return ResponseEntity.notFound().build();
}
}
@ResponseStatus(HttpStatus.NO_CONTENT)
@DeleteMapping("/{id}")
@ApiOperation(value = "Deletes Conta bancária")
public void delete(@PathVariable java.util.UUID id) {
contaBancariaService.delete(id);
}
@ResponseStatus(HttpStatus.NO_CONTENT)
@PostMapping("/deleteInBulk")
@ApiOperation(value = "Delete a list of Conta bancária by ids.")
public void deleteInBulk(@RequestBody java.util.List<java.util.UUID> idList) {
contaBancariaService.deleteInBulk(idList);
}
@Transactional(readOnly = true)
@GetMapping
@ApiOperation(value = "Retrieves a list of Conta bancária")
public PageResult<ContaBancaria> list(ContaBancariaListFilter contaBancariaListFilter, Pageable pageable) {
Page<ContaBancariaEntity> page = contaBancariaService.list(contaBancariaListFilter, pageable);
List<ContaBancaria> content = page.getContent().stream().map(pe -> contaBancariaDTOConverter.convertEntityToDto(pe)).collect(Collectors.toList());
PageResult<ContaBancaria> pageResult = new PageResult<>(content, page.getNumber(), page.getSize(), page.getTotalElements());
return pageResult;
}
@Transactional(readOnly = true)
@GetMapping("/autoComplete")
@ApiOperation(value = "Retrieves a list of Conta bancária with a query param")
public Collection<ContaBancariaAutoComplete> autoComplete(@RequestParam("query") String query) {
Collection<ContaBancariaAutoComplete> result = contaBancariaService.autoComplete(query);
return result;
}
@GetMapping("/contaBancariaNumeroContaAutoComplete")
@ApiOperation(value = "Retrieves a list of Conta bancária with a query param")
public Collection<ContaBancariaNumeroContaAutoComplete> contaBancariaNumeroContaAutoComplete(@RequestParam("query") String query) {
Collection<ContaBancariaNumeroContaAutoComplete> result = contaBancariaService.contaBancariaNumeroContaAutoComplete(query);
return result;
}
// Begin relationships autoComplete
@Transactional(readOnly = true)
@GetMapping("/agenciaBancariaAgenciaAutoComplete")
@ApiOperation(value = "Retrieves a list of AgenciaBancariaAutoComplete by query agenciaBancariaAgenciaAutoComplete over ContaBancaria with a query param")
public Collection<AgenciaBancariaAutoComplete> agenciaBancariaAgenciaAutoComplete(@RequestParam("query") String query) {
Collection<AgenciaBancariaAutoComplete> result = contaBancariaService.agenciaBancariaAgenciaAutoComplete(query);
return result;
}
// End relationships autoComplete
}
| [
"lobokoch@gmail.com"
] | lobokoch@gmail.com |
16b4064f5b2cca8b457fa355757546d5f4b6c2af | b5387fa140de0ac281403caee0305f24ced3bd3d | /Slithice-Origin/src/jqian/sootex/dependency/pdg/JimpleStmtNode.java | 1312ac5406d770f58e762e356ad856cd7d9b1bea | [
"MIT"
] | permissive | coder-chenzhi/Slithice | 838abce7649da33cbccb58c3ec0584fb54991c1a | a91fb7df2839f6f473311341c832599b23879a06 | refs/heads/master | 2020-12-08T10:27:48.805052 | 2020-04-13T01:56:25 | 2020-04-13T01:56:25 | 232,957,462 | 0 | 0 | MIT | 2020-01-10T03:26:04 | 2020-01-10T03:26:03 | null | UTF-8 | Java | false | false | 1,151 | java | package jqian.sootex.dependency.pdg;
import jqian.sootex.util.SootUtils;
import soot.*;
/**
*
*/
public class JimpleStmtNode extends DependenceNode{
protected Unit _stmt;
public JimpleStmtNode(MethodOrMethodContext mc,Unit unit){
super(mc);
_stmt=unit;
}
/**Get the corresponding statement.*/
public Unit getStmt(){
return _stmt;
}
public JavaStmtNode toJavaStmtNode(){
return new JavaStmtNode(_mc,SootUtils.getLine(_stmt));
}
public boolean equals(Object that){
DependenceNode thatNode = (DependenceNode)that;
if(thatNode.getNumber()!=this.getNumber())
return false;
JimpleStmtNode thatStmt=(JimpleStmtNode)that;
if(this._stmt==thatStmt._stmt)
return true;
else
return false;
}
public int hashCode(){
return _stmt.hashCode();
}
public Object clone(){
return new JimpleStmtNode(_mc,_stmt);
}
public String toString(){
return SootUtils.getStmtString(_stmt);
}
public Object getBinding(){
return _stmt;
}
}
| [
"zilingqishi@gmail.com"
] | zilingqishi@gmail.com |
8754cc53f8d7ffb607c9d4c1efa4a494b71d2a92 | 1e4f6b16d4e193fab6736b5828cc4da387b4503c | /src/application/tools/FehlerWarnMeldung.java | 187dad5e2e17cc9222dbcb2d72dd7a36d711c4b0 | [] | no_license | LyHa05/MeineApp | 51c4da27703cb192546a468a97b6cd4403d62777 | e19cdc79a3f9325823d8a75e43261e4914815fe4 | refs/heads/master | 2020-01-28T15:43:14.349907 | 2016-10-17T10:42:01 | 2016-10-17T10:42:01 | 66,087,532 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 64 | java | package application.tools;
public class FehlerWarnMeldung {
}
| [
"lpflug@NTCG57.ntcg.local"
] | lpflug@NTCG57.ntcg.local |
4500bf30efae7280bfc32a43e7bcc8637a5cfcdd | 137ed8f9732ac7ca5b0b0443dd491e9aa60954cc | /src/com/buildingLogic/arraySpecial/VarunBoxes.java | f7f3e8f5167e3f82dd4cfc6a4ebb50380ca8b257 | [] | no_license | MethukuR/geeksLogicInJava | 1e0830e90c7fc7c97da6765482a1007a0a69ef97 | 34f821eb9f7946a6e3f1085c6fdb4a1c8d35d4b9 | refs/heads/master | 2020-04-05T18:18:23.554716 | 2019-05-09T09:42:09 | 2019-05-09T09:42:09 | 157,094,865 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,306 | java | package com.buildingLogic.arraySpecial;
/**
* Varun is playing a very interesting game. He has some N different type of boxes. All boxes may have
* different number of balls (Si. 52. Sn).
Varun chose two random numbers F and K. K should be less than N. The game is that Varun wants to any K
boxes out of N boxes such that total number of balls in these K selected boxes should be some multiple
of F.
At the same time Varun wants that sum of the balls of the selected boxes should be minimum possible.
Input Format:
------------
Your function will have three arguments -1) A array S .(S1, S2., Sn) of size N
corresponding to the number of balls in N boxes(0<=hIc=1000) 2) F- value (as explained above) 3)
K- value (as explained above)
Output Format:
-------------
Minimum possible total number of balls such that the condition(s) explained in the problem statement is
satisfied. Output should be -1 if it is not possible or Invalid input.
Sample Test Case:
----------------
Sample Input:
-------------
5
1
2
3
4
5
5
3
Sample Output:
-------------
10
* @author Ranger Raju :)
*/
import java.util.Scanner;
public class VarunBoxes {
static int minBalls=Integer.MAX_VALUE;
public static void main (String[] args) {
Scanner scn = new Scanner(System.in);
int n=scn.nextInt();
int[] inputArr= new int[n];
for (int i = 0; i < n; ++i) {
inputArr[i]=scn.nextInt();
}
int f= scn.nextInt();
int k= scn .nextInt();
int ballsCount=ball_count(inputArr, f, k);
System.out.println(ballsCount);
scn.close();
}
private static void combinationUtil(int arr[], int n, int r,int f, int index,int data[], int i){
if (index == r){
int sum =0;
for (int j=0; j<r; j++){
sum+=data[j];
}
if((sum%f == 0) && sum < minBalls){
minBalls=sum;
}
return;
}
if (i >= n)
return;
data[index] = arr[i];
combinationUtil(arr, n, r,f, index+1, data, i+1);
combinationUtil(arr, n, r,f, index, data, i+1);
}
public static int ball_count(int arr[], int f, int k){
int data[]=new int[f];
int n=arr.length;
combinationUtil(arr, n, k,f, 0, data, 0);
if(minBalls == Integer.MAX_VALUE){
minBalls=-1;
}
return minBalls;
}
}
| [
"raju.mln4789@gmail.com"
] | raju.mln4789@gmail.com |
95e6a497002d4f67d8498201d3e72fe93480e0e3 | 8c2a8f03d0246d90477fcd9217eb49fc62979d3b | /xml/impl/src/com/intellij/lang/html/structureView/Html5SectionsNodeProvider.java | 49ad3fbba26ea203239538e1fcbeb017c0d1d2c6 | [
"Apache-2.0"
] | permissive | rene-schulz/github-discussions | f228f5552837ae1252165319d27a4e8ea67a21c6 | 5cf1b2cec10a2f37b2259ccb65a36e76b4f61301 | refs/heads/master | 2021-01-12T22:54:34.350896 | 2013-03-03T09:48:04 | 2013-03-03T09:48:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,066 | java | /*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.lang.html.structureView;
import com.intellij.ide.util.FileStructureNodeProvider;
import com.intellij.ide.util.treeView.smartTree.ActionPresentation;
import com.intellij.ide.util.treeView.smartTree.ActionPresentationData;
import com.intellij.ide.util.treeView.smartTree.TreeElement;
import com.intellij.openapi.actionSystem.Shortcut;
import com.intellij.openapi.keymap.KeymapManager;
import com.intellij.openapi.util.PropertyOwner;
import com.intellij.psi.filters.XmlTagFilter;
import com.intellij.psi.scope.processor.FilterElementProcessor;
import com.intellij.psi.xml.XmlDocument;
import com.intellij.psi.xml.XmlFile;
import com.intellij.psi.xml.XmlTag;
import com.intellij.xml.XmlBundle;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
public class Html5SectionsNodeProvider implements FileStructureNodeProvider<Html5SectionTreeElement>, PropertyOwner {
public static final String ACTION_ID = "HTML5_OUTLINE_MODE";
public static final String HTML5_OUTLINE_PROVIDER_PROPERTY = "html5.sections.node.provider";
@NotNull
public String getName() {
return ACTION_ID;
}
@NotNull
public ActionPresentation getPresentation() {
return new ActionPresentationData(XmlBundle.message("html5.outline.mode"), null, null);
}
public String getCheckBoxText() {
return XmlBundle.message("html5.outline.mode");
}
public Shortcut[] getShortcut() {
return KeymapManager.getInstance().getActiveKeymap().getShortcuts("FileStructurePopup");
}
@NotNull
public String getPropertyName() {
return HTML5_OUTLINE_PROVIDER_PROPERTY;
}
public Collection<Html5SectionTreeElement> provideNodes(final TreeElement node) {
if (!(node instanceof HtmlFileTreeElement)) return Collections.emptyList();
final XmlFile xmlFile = ((HtmlFileTreeElement)node).getElement();
final XmlDocument document = xmlFile == null ? null : xmlFile.getDocument();
if (document == null) return Collections.emptyList();
final List<XmlTag> rootTags = new ArrayList<XmlTag>();
document.processElements(new FilterElementProcessor(XmlTagFilter.INSTANCE, rootTags), document);
final Collection<Html5SectionTreeElement> result = new ArrayList<Html5SectionTreeElement>();
for (XmlTag tag : rootTags) {
result.addAll(Html5SectionsProcessor.processAndGetRootSections(tag));
}
return result;
}
}
| [
"alexander.doroshko@jetbrains.com"
] | alexander.doroshko@jetbrains.com |
ccff2e0cd29e57fee4fb03d3f032b5117297bec6 | 88ed9413296b9d0ebd84133bf5f1318c3ac27b65 | /oneapm-flume/flume-ng-core/src/main/java/org/apache/flume/instrumentation/MonitoredCounterGroup.java | 44e26e4aeb27f61deb28ab12d6b1f5f030dee891 | [
"BSD-3-Clause",
"Apache-2.0",
"LicenseRef-scancode-protobuf",
"MIT"
] | permissive | xincrazy/Java | d613abc33c0aef01caa9131970a2583a056d1c47 | 39607bb12574a616c8dfe0065a87786c256413c5 | refs/heads/master | 2020-12-03T09:01:15.479996 | 2016-08-31T03:00:44 | 2016-08-31T03:00:44 | 66,996,469 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,576 | 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.flume.instrumentation;
import java.lang.management.ManagementFactory;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
import javax.management.ObjectName;
import com.google.common.annotations.VisibleForTesting;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Used for keeping track of internal metrics using atomic integers</p>
*
* This is used by a variety of component types such as Sources, Channels,
* Sinks, SinkProcessors, ChannelProcessors, Interceptors and Serializers.
*/
public abstract class MonitoredCounterGroup {
private static final Logger logger =
LoggerFactory.getLogger(MonitoredCounterGroup.class);
// Key for component's start time in MonitoredCounterGroup.counterMap
private static final String COUNTER_GROUP_START_TIME = "start.time";
// key for component's stop time in MonitoredCounterGroup.counterMap
private static final String COUNTER_GROUP_STOP_TIME = "stop.time";
private final Type type;
private final String name;
private final Map<String, AtomicLong> counterMap;
private AtomicLong startTime;
private AtomicLong stopTime;
private volatile boolean registered = false;
protected MonitoredCounterGroup(Type type, String name, String... attrs) {
this.type = type;
this.name = name;
Map<String, AtomicLong> counterInitMap = new HashMap<String, AtomicLong>();
// Initialize the counters
for (String attribute : attrs) {
counterInitMap.put(attribute, new AtomicLong(0L));
}
counterMap = Collections.unmodifiableMap(counterInitMap);
startTime = new AtomicLong(0L);
stopTime = new AtomicLong(0L);
}
/**
* Starts the component
*
* Initializes the values for the stop time as well as all the keys in the
* internal map to zero and sets the start time to the current time in
* milliseconds since midnight January 1, 1970 UTC
*/
public void start() {
register();
stopTime.set(0L);
for (String counter : counterMap.keySet()) {
counterMap.get(counter).set(0L);
}
startTime.set(System.currentTimeMillis());
logger.info("Component type: " + type + ", name: " + name + " started");
}
/**
* Registers the counter.
* This method is exposed only for testing, and there should be no need for
* any implementations to call this method directly.
*/
@VisibleForTesting
void register() {
if (!registered) {
try {
ObjectName objName = new ObjectName("org.apache.flume."
+ type.name().toLowerCase(Locale.ENGLISH) + ":type=" + this.name);
if (ManagementFactory.getPlatformMBeanServer().isRegistered(objName)) {
logger.debug("Monitored counter group for type: " + type + ", name: "
+ name + ": Another MBean is already registered with this name. "
+ "Unregistering that pre-existing MBean now...");
ManagementFactory.getPlatformMBeanServer().unregisterMBean(objName);
logger.debug("Monitored counter group for type: " + type + ", name: "
+ name + ": Successfully unregistered pre-existing MBean.");
}
ManagementFactory.getPlatformMBeanServer().registerMBean(this, objName);
logger.info("Monitored counter group for type: " + type + ", name: "
+ name + ": Successfully registered new MBean.");
registered = true;
} catch (Exception ex) {
logger.error("Failed to register monitored counter group for type: "
+ type + ", name: " + name, ex);
}
}
}
/**
* Shuts Down the Component
*
* Used to indicate that the component is shutting down.
*
* Sets the stop time and then prints out the metrics from
* the internal map of keys to values for the following components:
*
* - ChannelCounter
* - ChannelProcessorCounter
* - SinkCounter
* - SinkProcessorCounter
* - SourceCounter
*/
public void stop() {
// Sets the stopTime for the component as the current time in milliseconds
stopTime.set(System.currentTimeMillis());
// Prints out a message indicating that this component has been stopped
logger.info("Component type: " + type + ", name: " + name + " stopped");
// Retrieve the type for this counter group
final String typePrefix = type.name().toLowerCase(Locale.ENGLISH);
// Print out the startTime for this component
logger.info("Shutdown Metric for type: " + type + ", "
+ "name: " + name + ". "
+ typePrefix + "." + COUNTER_GROUP_START_TIME
+ " == " + startTime);
// Print out the stopTime for this component
logger.info("Shutdown Metric for type: " + type + ", "
+ "name: " + name + ". "
+ typePrefix + "." + COUNTER_GROUP_STOP_TIME
+ " == " + stopTime);
// Retrieve and sort counter group map keys
final List<String> mapKeys = new ArrayList<String>(counterMap.keySet());
Collections.sort(mapKeys);
// Cycle through and print out all the key value pairs in counterMap
for (final String counterMapKey : mapKeys) {
// Retrieves the value from the original counterMap.
final long counterMapValue = get(counterMapKey);
logger.info("Shutdown Metric for type: " + type + ", "
+ "name: " + name + ". "
+ counterMapKey + " == " + counterMapValue);
}
}
/**
* Returns when this component was first started
*
* @return
*/
public long getStartTime() {
return startTime.get();
}
/**
* Returns when this component was stopped
*
* @return
*/
public long getStopTime() {
return stopTime.get();
}
@Override
public final String toString() {
StringBuilder sb = new StringBuilder(type.name()).append(":");
sb.append(name).append("{");
boolean first = true;
Iterator<String> counterIterator = counterMap.keySet().iterator();
while (counterIterator.hasNext()) {
if (first) {
first = false;
} else {
sb.append(", ");
}
String counterName = counterIterator.next();
sb.append(counterName).append("=").append(get(counterName));
}
sb.append("}");
return sb.toString();
}
/**
* Retrieves the current value for this key
*
* @param counter The key for this metric
* @return The current value for this key
*/
protected long get(String counter) {
return counterMap.get(counter).get();
}
/**
* Sets the value for this key to the given value
*
* @param counter The key for this metric
* @param value The new value for this key
*/
protected void set(String counter, long value) {
counterMap.get(counter).set(value);
}
/**
* Atomically adds the delta to the current value for this key
*
* @param counter The key for this metric
* @param delta
* @return The updated value for this key
*/
protected long addAndGet(String counter, long delta) {
return counterMap.get(counter).addAndGet(delta);
}
/**
* Atomically increments the current value for this key by one
*
* @param counter The key for this metric
* @return The updated value for this key
*/
protected long increment(String counter) {
return counterMap.get(counter).incrementAndGet();
}
/**
* Component Enum Constants
*
* Used by each component's constructor to distinguish which type the
* component is.
*/
public static enum Type {
SOURCE,
CHANNEL_PROCESSOR,
CHANNEL,
SINK_PROCESSOR,
SINK,
INTERCEPTOR,
SERIALIZER,
OTHER
};
public String getType(){
return type.name();
}
}
| [
"zhaoxinyanfa@oneapm.com"
] | zhaoxinyanfa@oneapm.com |
2fa2cb0b6c0d4810bf3341de4415fe7daf7a65fc | 15801699a216d69cabcf10514f6dfa6aea0d23b8 | /src/main/java/ru/javawebinar/topjava/repository/inmemory/InMemoryMealRepository.java | ef105695c3d32824da6ca441fd121a49f133a218 | [] | no_license | m-denisov/topjava | 1d02763b90f832d850209de3e6e113ff9509e5a0 | 0744e525d706f449cc1a467ba9b05d63dfff5b1f | refs/heads/master | 2023-03-12T00:05:38.836330 | 2021-03-03T22:16:46 | 2021-03-03T22:16:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 556 | java | package ru.javawebinar.topjava.repository.inmemory;
import ru.javawebinar.topjava.model.Meal;
import ru.javawebinar.topjava.repository.MealRepository;
import java.util.Collection;
public class InMemoryMealRepository implements MealRepository {
@Override
public Meal save(Meal meal) {
return null;
}
@Override
public boolean delete(int id) {
return false;
}
@Override
public Meal get(int id) {
return null;
}
@Override
public Collection<Meal> getAll() {
return null;
}
}
| [
"mezgang@gmail.com"
] | mezgang@gmail.com |
a90632babbede3b27995ac7a7a08e7c87dc6e855 | 0b7e1949386065e16e36240b8ca22aec1838b863 | /src/rin/calculate/TokenDivide.java | b6e508672900028604d93b7ca4d45deca7a1f7c7 | [] | no_license | zhenronglin/rin | ed53381ec46d5ff26e61254b3b4b42f19acc80f1 | b745481453a45e2294441f1689d9d25e9d44c7c4 | refs/heads/master | 2020-06-23T22:01:50.453178 | 2019-07-24T14:25:04 | 2019-07-24T14:25:04 | 198,766,568 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 155 | java | package rin.calculate;
public class TokenDivide extends Token {
public TokenDivide(char operator) {
super(operator, TokenType.DIVIDE);
}
}
| [
"zhenronglin@hotmail.com"
] | zhenronglin@hotmail.com |
36ded94a6ed502a131826f3d89577d9f249b6a92 | 7aab0f1f8a49d4907abc22e76fe32acd20f07e31 | /app/src/main/java/kr/elvin/androidspeksample/MainActivity.java | 20fc915b5ef2dac06537244b7aed7cd6958cac5a | [] | no_license | elvin-han/AndroidSpekSample | 5461c7841e4fc489eb50e88aa716daf239f0a531 | a6d8a87b2c93cfc604f2d759bca98c9df57d9ccd | refs/heads/master | 2021-01-17T10:13:32.418426 | 2017-06-23T14:27:33 | 2017-06-23T14:27:33 | 68,719,701 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 339 | java | package kr.elvin.androidspeksample;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"elvinhan7@gmail.com"
] | elvinhan7@gmail.com |
a816ee7c8f97a75a4c93e0b6eb737443a6227d28 | e37b4302e353571df6ad4c6af90b4dba2408923e | /src/cornerRectangles.java | 2737433eaf22ab4c9866ad89a62952711919d573 | [] | no_license | HuzAejaz75/DataStructuresandAlgortihms | 8b51a97f5215c5f10befb32c5f49d86c5ce4287b | 865218144bef53576317541507be95545813c1a2 | refs/heads/master | 2021-08-09T01:18:23.524144 | 2018-10-25T05:55:59 | 2018-10-25T05:55:59 | 136,547,876 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 681 | java | import java.util.HashMap;
import java.util.Map;
/**
* Created by huzaifa.aejaz on 7/22/18.
*/
public class cornerRectangles {
public int countCornerRectangles(int[][] grid) {
Map<Integer, Integer> count = new HashMap();
int ans = 0;
for (int[] row: grid) {
for (int c1 = 0; c1 < row.length; ++c1) if (row[c1] == 1) {
for (int c2 = c1+1; c2 < row.length; ++c2) if (row[c2] == 1) {
int pos = c1 * 200 + c2;
int c = count.getOrDefault(pos, 0);
ans += c;
count.put(pos, c+1);
}
}
}
return ans;
}
}
| [
"huzaifa.aejaz@sjsu.edu"
] | huzaifa.aejaz@sjsu.edu |
1cb166ab4475e58ce5ef741879551ae61f8e78bd | 25befc9d34c872869b31ec877c4ac3e274dd65c1 | /Algorithms/Leetcode/binaryTree/PopulatingNextRightPointersInEachNode_116_117.java | f56ae36e0518f3cae14a6693b61ba1a84c0e1e65 | [] | no_license | HongquanYu/Algorithms | f4cee90c3151ff1f1ac15ebf02ca3467e26d3aec | c79c5a189b13e798d1749694be145b0ec124cde8 | refs/heads/master | 2021-09-11T20:40:48.679769 | 2018-04-12T03:20:48 | 2018-04-12T03:20:48 | 104,603,005 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,152 | java | package binaryTree;
import java.util.LinkedList;
import java.util.Queue;
public class PopulatingNextRightPointersInEachNode_116_117 {
static class TreeLinkNode {
int val;
TreeLinkNode left;
TreeLinkNode right;
TreeLinkNode next;
TreeLinkNode(int v) {
this.val = v;
}
}
/** ---------------------Iterative: Level traversal, BFS -------------------------
* this solution works for 116 and 117 */
public void connect(TreeLinkNode root) {
Queue<TreeLinkNode> queue = new LinkedList<>();
if (root == null)
return;
queue.offer(root);
int levelNodeNumber = queue.size();
while (!queue.isEmpty()) {
while (levelNodeNumber-- > 0) { // traversal for one level
TreeLinkNode t = queue.poll();
t.next = queue.peek(); // pointing to next node of current level
if (levelNodeNumber == 0) // last node of level points null
t.next = null;
if (t.left != null)
queue.offer(t.left);
if (t.right != null)
queue.offer(t.right);
}
levelNodeNumber = queue.size();
}
}
// --------------------- Recursion -------------------------
public void connect2(TreeLinkNode root) {
if(root == null)
return;
if(root.left != null){
root.left.next = root.right;
if(root.next != null)
root.right.next = root.next.left;
}
connect2(root.left);
connect2(root.right);
}
/* 117 */
public void connect_117(TreeLinkNode root) {
TreeLinkNode head = root; // The left most node in the lower level
TreeLinkNode prev = null; // The previous node in the lower level
TreeLinkNode curr = null; // The current node in the upper level
while (head != null) {
curr = head;
prev = null;
head = null;
while (curr != null) {
if (curr.left != null) {
if (prev != null) prev.next = curr.left;
else head = curr.left;
prev = curr.left;
}
if (curr.right != null) {
if (prev != null) prev.next = curr.right;
else head = curr.right;
prev = curr.right;
}
curr = curr.next;
}
}
}
public void connect_117_2(TreeLinkNode root) {
TreeLinkNode rowHead = new TreeLinkNode(0); // 新建一个假节点,指向每一行第一个node
TreeLinkNode ptr = root; // 当前level的遍历指针
while (ptr != null) {
TreeLinkNode levelPtr = rowHead; // levelPtr 指向每一行的当前节点,指向ptr的下一个节点
while (ptr != null) { // 遍历当前level至null
if (ptr.left != null) { // 当前node首先
levelPtr.next = ptr.left; // 在这里将rowHead更新到下一行的第一个node
levelPtr = levelPtr.next;
}
if (ptr.right != null) {
levelPtr.next = ptr.right;
levelPtr = levelPtr.next;
}
ptr = ptr.next;
}
// level遍历完成,继续下一层
ptr = rowHead.next; // ptr 移到下一层的第一个rowHead节点
rowHead.next = null; // 断开rowHead和这一层首节点的链接,为下一层的遍历做准备
}
}
// --------------------- High Voted two pointer solution -------------------------
public static void connect3(TreeLinkNode root) {
if (root == null) return;
TreeLinkNode pre = root;
TreeLinkNode cur = null;
while (pre.left != null) { // If there's a next level
cur = pre;
while (cur != null) { // There is no need to process first level
cur.left.next = cur.right; // left child -> right child
if (cur.next != null) // right child -> left child of next node
cur.right.next = cur.next.left;
cur = cur.next; // move to next node
}
pre = pre.left; // move to next level
}
}
public static void main(String[] args) {
TreeLinkNode sub1 = new TreeLinkNode(1);
sub1.left = new TreeLinkNode(3);
sub1.right = new TreeLinkNode(4);
TreeLinkNode sub2 = new TreeLinkNode(2);
sub2.left = new TreeLinkNode(5);
sub2.right = new TreeLinkNode(6);
TreeLinkNode root = new TreeLinkNode(0);
root.left = sub1;
root.right = sub2;
connect3(root);
}
}
| [
"hyu12346@terpmail.umd.edu"
] | hyu12346@terpmail.umd.edu |
4d4cad0604c8a36c903d4ab0c1e1e59c5db7a215 | 3c82f3906607408bb6149811b4bd0a5d70db128d | /src/main/java/com/dsi/codingtest/loginapp/ui/models/response/UserRest.java | c87285dc6e3e9a31cb1c546482a4b4fe93cd8648 | [] | no_license | azhar-azad/login-app | c012cfb8ea8dcb0129f02039a205d80dfc830083 | 8b8880a785475252625df59892996aca216e1cfc | refs/heads/master | 2022-09-21T03:13:54.158919 | 2020-06-07T21:36:22 | 2020-06-07T21:36:22 | 270,403,249 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 680 | java | package com.dsi.codingtest.loginapp.ui.models.response;
public class UserRest {
private String userId;
private String firstName;
private String lastName;
private String email;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
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;
}
}
| [
"azhar.u.azad@gmail.com"
] | azhar.u.azad@gmail.com |
b5293161ed3ce6363b2986e495e35be0c1cac0f5 | 7287bfe3e877e67810700179a5194d678b672db7 | /src/main/java/com/campusblog/dao/CollectionDaoImpl.java | efab7d8ba2881bec5a01582f89b96a57d7804e8a | [] | no_license | guotao3/campusblog | 74ee049e46bc291621812e104d37a18ed805ce06 | cd41e1e95e2040c567d46f3ac45137b14de9112c | refs/heads/master | 2021-01-22T23:57:48.368595 | 2017-06-01T02:13:40 | 2017-06-01T02:13:40 | 85,656,167 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,321 | java | package com.campusblog.dao;
import com.campusblog.entity.CollectionTEntity;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import java.util.List;
/**
* Created by hasee on 2017/4/16.
*/
@Repository
public class CollectionDaoImpl implements CollectionDao{
@PersistenceContext
private EntityManager entityManager;
@Resource
CollectionRespository collectionRespository;
@Override
public void add(CollectionTEntity collectionTEntity) {
collectionRespository.save(collectionTEntity);
}
@Override
public List<CollectionTEntity> getcollections(Integer uId) {
return collectionRespository.getcollections(uId);
}
@Override
public void del(Integer collectionid) {
collectionRespository.delete(collectionid);
}
@Override
public List<Integer> gethotcollection(Integer size) {
String hql="select c.articleId from CollectionTEntity c order by c.createTime asc";
Query query = entityManager.createQuery(hql);
query.setFirstResult(0);
query.setMaxResults(size);
List<Integer> resultList = query.getResultList();
return resultList;
}
}
| [
"1654693613@qq.com"
] | 1654693613@qq.com |
2bc6f84f8192b4b8e73bbf7651cf7932e726cc89 | 3acecb655b3a51351f9154aeaef01d2ae1595117 | /src/main/java/de/perdian/apps/filerenamer/fx/FileRenamerApplication.java | 64dc5aa849c3c9d7f088b1d3da1be18b949f3d9a | [
"Apache-2.0"
] | permissive | perdian/filerenamer | 78bd147ed97505bcd1bd4be7af18f721e7a0ad9f | 706deb3399915b3bc46f24b0654967dc5171d239 | refs/heads/master | 2023-02-19T01:43:25.148341 | 2023-02-11T10:11:22 | 2023-02-11T10:11:22 | 105,443,722 | 1 | 0 | Apache-2.0 | 2023-02-11T10:11:22 | 2017-10-01T13:23:05 | Java | UTF-8 | Java | false | false | 1,132 | java | package de.perdian.apps.filerenamer.fx;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Screen;
import javafx.stage.Stage;
public class FileRenamerApplication extends Application {
private static final Logger log = LoggerFactory.getLogger(FileRenamerApplication.class);
@Override
public void start(Stage primaryStage) throws Exception {
FileRenamerPane mainPane = new FileRenamerPane();
log.info("Opening JavaFX stage");
primaryStage.getIcons().add(new Image(this.getClass().getClassLoader().getResourceAsStream("icons/256/application.png")));
primaryStage.setScene(new Scene(mainPane));
primaryStage.setOnCloseRequest(event -> System.exit(0));
primaryStage.setMinWidth(800);
primaryStage.setMinHeight(600);
primaryStage.setTitle("File Renamer");
primaryStage.setWidth(1200);
primaryStage.setHeight(Math.min(Screen.getPrimary().getBounds().getHeight() - 100, 900));
primaryStage.show();
}
}
| [
"dev@perdian.de"
] | dev@perdian.de |
41240aa2cdd3c0f35d5e5f2144040fc7647d24c3 | b4fcf9983e219761cc0e5c2e00198d1f6a854e3b | /app/src/main/java/com/angcyo/dexfixdemo/MainActivity.java | 6c8bde91de58572c2b8eccf74b3b4784be841c3a | [
"Apache-2.0"
] | permissive | hx-git/DexFixDemo | 4ba1540401b94f32ad4b888c5549506e65a3ee52 | 71125522d23502ed6bb40956dbd3aaa9fb72a6d3 | refs/heads/master | 2020-04-02T06:27:59.804009 | 2017-03-22T10:09:57 | 2017-03-22T10:11:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,574 | java | package com.angcyo.dexfixdemo;
import android.os.Bundle;
import android.os.Environment;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
public class MainActivity extends AppCompatActivity {
static String patchFilePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/dex/";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//测试补丁输出
Demo.test();
}
});
findViewById(R.id.button_view).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
//打补丁
Fix.injectDexElements(MainActivity.this, patchFilePath);
} catch (Exception e) {
e.printStackTrace();
T_.show(e.getMessage());
}
}
});
/**复制补丁文件到SD卡*/
UI.copyAssetsTo(this, "classes2.dex", patchFilePath + "out_dex.dex");
}
}
| [
"angcyo@126.com"
] | angcyo@126.com |
0e201d097eba638472cbbd157b2821f8356e43bd | 7d1a83e5aaf7307ff600d594b77b2e712ab7214b | /security/src/main/java/jason/app/weixin/security/translator/UserTranslator.java | daeed9a90f4dd510688f373d4d7670871a4818df | [] | no_license | jfatty/upower | 513fe8c4cc0095758327e501b80e858d1bc296f3 | 8dd9176bb3005520b749806b574b43504265c1ca | refs/heads/master | 2021-05-29T12:54:43.542805 | 2015-09-28T15:40:09 | 2015-09-28T15:40:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 980 | java | package jason.app.weixin.security.translator;
import jason.app.weixin.security.entity.RoleImpl;
import jason.app.weixin.security.entity.UserImpl;
import jason.app.weixin.security.model.Role;
import jason.app.weixin.security.model.User;
import java.util.ArrayList;
import java.util.List;
public class UserTranslator {
public static User toDTO(UserImpl userImpl) {
// TODO Auto-generated method stub
if(userImpl==null) return null;
User user = new User();
user.setId(userImpl.getId());
user.setEnabled(userImpl.isEnabled());
user.setUsername(userImpl.getUsername());
user.setExternalId(userImpl.getExternalId());
user.setPassword("***[PROTECTED]***");
if(userImpl.getRoles()!=null) {
List<Role> roles = new ArrayList<Role>();
for(RoleImpl roleImpl:userImpl.getRoles()) {
Role role = new Role();
role.setLabel(roleImpl.getLabel());
role.setName(roleImpl.getName());
roles.add(role);
}
user.setRoles(roles);
}
return user;
}
}
| [
"nk.smallbee@gmail.com"
] | nk.smallbee@gmail.com |
bbdb8dd708a7862c04a80630d24c48330d7eabcc | 7459596db5323657f0f04071f30df9a7663ef31e | /YBinhDu_XinYiLiao_COMP304Sec001_Lab4_Ex1/app/src/main/java/com/example/ybinhdu_xinyiliao_comp304sec001_lab4_ex1/NewTestActivity.java | f15b08431fad2e647fc9ad2b5ec9a67d613536b4 | [] | no_license | xinyi-07/COMP304_Lab4_v1.0 | 784e1d73dac25cababc39f2202537a5774aaeec1 | 9db1073f29ee9605347e343e5daf653babaa0e4e | refs/heads/master | 2023-06-18T04:11:47.292666 | 2021-07-14T03:02:45 | 2021-07-14T03:02:45 | 384,864,776 | 0 | 0 | null | 2021-07-14T04:33:51 | 2021-07-11T05:08:50 | Java | UTF-8 | Java | false | false | 3,211 | java | package com.example.ybinhdu_xinyiliao_comp304sec001_lab4_ex1;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.TextView;
import android.widget.Toast;
public class NewTestActivity extends AppCompatActivity {
String testResult = "Fail";
String testType = "G2";
String applicantId;
String examinerId;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_new_test);
SharedPreferences myPref = getSharedPreferences("MyShared", MODE_PRIVATE);
applicantId = myPref.getString("ApplicantId", "");
((TextView) findViewById(R.id.edtTxt_ApplicantId)).setText(applicantId);
examinerId = myPref.getString("ExaminerId", "");
((TextView) findViewById(R.id.edtTxt_ExaminerId)).setText(examinerId);
}
public void selectResult(View v){
//need to check the state of the radio btn i.e. selected or not selected
boolean checked = ((RadioButton) v).isChecked();
switch (v.getId()){
case R.id.radioBtn_Pass:
testResult = "Pass";
break;
case R.id.radioBtn_Fail:
testResult = "Fail";
break;
}
}
public void selectTestType(View v){
//need to check the state of the radio btn i.e. selected or not selected
boolean checked = ((RadioButton) v).isChecked();
switch (v.getId()){
case R.id.radioBtn_G2:
testType = "G2";
break;
case R.id.radioBtn_G:
testType = "G";
break;
case R.id.radioBtn_Motorcycle:
testType = "Motorcycle";
break;
case R.id.radioBtn_Commercial:
testType = "Commercial";
break;
}
}
public void AddTest(View v){
Intent intent = new Intent(NewTestActivity.this, ViewTestActivity.class);
String testId = ((EditText) findViewById(R.id.edtTxt_TestId)).getText().toString();
String testRoute = ((EditText) findViewById(R.id.edtTxt_TestRoute)).getText().toString();
String testDate = ((EditText) findViewById(R.id.edtTxt_TestDate)).getText().toString();
if(testId.isEmpty() | testRoute.isEmpty() | testDate.isEmpty()){
Toast.makeText(this, "Error: Empty fields found!", Toast.LENGTH_SHORT).show();
}
else{
SharedPreferences sharedPreferences = getSharedPreferences("MyShared", 0);
SharedPreferences.Editor prefEdit = sharedPreferences.edit();
prefEdit.putString("TestId", testId);
prefEdit.putString("TestType", testType);
prefEdit.putString("TestRoute", testRoute);
prefEdit.putString("TestResult", testResult);
prefEdit.putString("TestDate", testDate);
prefEdit.commit();
startActivity(intent);
}
}
} | [
"58014609+xinyiliao007@users.noreply.github.com"
] | 58014609+xinyiliao007@users.noreply.github.com |
d1cd7facce5ccd1c3e967a5dcb1dbf3630e5fd9a | b6e65bf0ba6a88fd1e96d611604eb229ecae3497 | /src/com/infotel/metier/Client.java | cdf507cb7d77753c79c99278c10bba6fb9164d66 | [] | no_license | LudivineLan/Inti-ArchitectureJpa | 3b6626588c4e61672d1f72106ab896aaf494fbd3 | 1b18c947345afb0c5eb6a67775c425e47f97ea46 | refs/heads/master | 2020-05-16T18:51:51.972322 | 2019-04-24T15:02:04 | 2019-04-24T15:02:04 | 183,242,515 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 550 | java | package com.infotel.metier;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
@Entity
//Donner la valeur de la colonne
@DiscriminatorValue("CLI")
public class Client extends Personne{
private int numeroAdherent;
public int getNumeroAdherent() {
return numeroAdherent;
}
public void setNumeroAdherent(int numeroAdherent) {
this.numeroAdherent = numeroAdherent;
}
@Override
public String toString() {
return "Client [numeroAdherent=" + numeroAdherent + ", toString() ="+ super.toString()+"]";
}
}
| [
"ludivinelanclume@gmail.com"
] | ludivinelanclume@gmail.com |
293b4f419c1098bbea1c6072bd6a753140556c48 | d1de663ecb668943fc3369dcd7c416a5249d26cd | /src/main/java/util/json/PrettyPrintJson.java | 9407d86f45812a5f99d2931539657f4469946a0a | [] | no_license | naveenpgit/mylernings | da8a29db70900387b4b71671d2abc400c9844bda | 84ca55626de33459d109b815162495fd26b19ac0 | refs/heads/master | 2023-01-25T02:07:13.050143 | 2023-01-18T15:31:22 | 2023-01-18T15:31:22 | 135,394,396 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,862 | java | package util.json;
import org.apache.commons.lang.StringUtils;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.*;
public class PrettyPrintJson {
boolean isDone = StringUtils.equalsIgnoreCase(JSONUtils
.JsonToMap(JSONUtils.fromFile("resources/Satus_Samle.json")).get("status").toString(), "done");
public static void main(String[] args) {
Map<String, Object> responseMap = JSONUtils
.JsonToMap(JSONUtils.fromFile("resources/Error_LPA_Down.json"));
System.out.println(JSONUtils.toJson(responseMap));
System.out.println("------------------------------------------------------");
System.out.println(JSONUtils.toJsonWithIndent(responseMap));
}
public Future<Object> download() {
String jobId = UUID.randomUUID().toString();
CompletableFuture<String> job = pollForCompletion(jobId);
return job.thenApply(this::downloadResult);
}
private <U> String downloadResult(String s) {
System.out.println(" +++ Downloaded ++++");
return s;
}
private CompletableFuture<String> pollForCompletion(String jobId) {
ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
CompletableFuture<String> completionFuture = new CompletableFuture<>();
ScheduledFuture<?> checkFuture = executor.scheduleAtFixedRate(() -> {
if (isDone) {
completionFuture.complete(jobId);
}
}, 0, 10, TimeUnit.SECONDS);
completionFuture
.whenComplete((result, thrown) -> {
System.out.println("XXXXXXXXXXX"); //Never happens unless thenApply is removed
checkFuture.cancel(true);
executor.shutdown();
});
return completionFuture;
}
}
| [
"naveen.p.g@gmail.com"
] | naveen.p.g@gmail.com |
2aa13ecc3c429c754edd58857cf6737bf73c19a1 | 63ee3648ee46d2d7979beed3608065ba89036e35 | /gdib-apirest/src/main/java/es/caib/arxiudigital/apirest/facade/pojos/FiltroBusquedaFacilDocumentos.java | bfe907a04b90ef0e1e99b15fc88313117443a525 | [] | no_license | ejimenez-memorandum/gdib | 30a410538159b77ecad7d8e438032f683b40c65a | e0c468842fb2c11c088238aa3b38762ce3c94699 | refs/heads/master | 2023-01-14T09:34:16.683280 | 2018-12-18T12:10:26 | 2018-12-18T12:10:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,742 | java | package es.caib.arxiudigital.apirest.facade.pojos;
public class FiltroBusquedaFacilDocumentos {
//TODO Eliminar
private String nombreAplicacion;
private String autor;
private String nombreDocumento;
private IntervaloFechas fechaCreacion;
private IntervaloFechas fechaModificacion;
private String eniId;
private String contenido;
private String mimetype;
private String docSeries;
public String getNombreAplicacion() {
return nombreAplicacion;
}
public void setNombreAplicacion(String nombreAplicacion) {
this.nombreAplicacion = nombreAplicacion;
}
public String getAutor() {
return autor;
}
public void setAutor(String autor) {
this.autor = autor;
}
public String getNombreDocumento() {
return nombreDocumento;
}
public void setNombreDocumento(String nombreDocumento) {
this.nombreDocumento = nombreDocumento;
}
public IntervaloFechas getFechaCreacion() {
return fechaCreacion;
}
public void setFechaCreacion(IntervaloFechas fechaCreacion) {
this.fechaCreacion = fechaCreacion;
}
public IntervaloFechas getFechaModificacion() {
return fechaModificacion;
}
public void setFechaModificacion(IntervaloFechas fechaModificacion) {
this.fechaModificacion = fechaModificacion;
}
public String getEniId() {
return eniId;
}
public void setEniId(String eniId) {
this.eniId = eniId;
}
public String getContenido() {
return contenido;
}
public void setContenido(String contenido) {
this.contenido = contenido;
}
public String getMimetype() {
return mimetype;
}
public void setMimetype(String mimetype) {
this.mimetype = mimetype;
}
public String getDocSeries() {
return docSeries;
}
public void setDocSeries(String docSeries) {
this.docSeries = docSeries;
}
}
| [
"anadal@fundaciobit.org"
] | anadal@fundaciobit.org |
829b265d699baf70a9ac8e2feaf4e726668fa27a | 6d9d90789f91d4010c30344409aad49fa99099e3 | /lucene-core/src/main/java/org/apache/lucene/search/FieldDocSortedHitQueue.java | 6880f985a6a1ff0032d734edb817bbd4c84036fd | [
"Apache-2.0"
] | permissive | bighaidao/lucene | 8c2340f399c60742720e323a0b0c0a70b2651147 | bd5d75e31526b599296c3721bc2081a3bde3e251 | refs/heads/master | 2021-08-07T07:01:42.438869 | 2012-08-22T09:16:08 | 2012-08-22T09:16:08 | 8,878,381 | 1 | 2 | Apache-2.0 | 2021-08-02T17:05:32 | 2013-03-19T12:48:16 | Java | UTF-8 | Java | false | false | 4,770 | java | package org.apache.lucene.search;
/**
* 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.
*/
import org.apache.lucene.util.PriorityQueue;
import java.io.IOException;
import java.text.Collator;
import java.util.Locale;
/**
* Expert: Collects sorted results from Searchable's and collates them.
* The elements put into this queue must be of type FieldDoc.
*
* <p>Created: Feb 11, 2004 2:04:21 PM
*
* @since lucene 1.4
*/
class FieldDocSortedHitQueue extends PriorityQueue<FieldDoc> {
volatile SortField[] fields = null;
// used in the case where the fields are sorted by locale
// based strings
volatile Collator[] collators = null;
volatile FieldComparator<?>[] comparators = null;
/**
* Creates a hit queue sorted by the given list of fields.
* @param fields Fieldable names, in priority order (highest priority first).
* @param size The number of hits to retain. Must be greater than zero.
*/
FieldDocSortedHitQueue (int size) {
initialize (size);
}
/**
* Allows redefinition of sort fields if they are <code>null</code>.
* This is to handle the case using ParallelMultiSearcher where the
* original list contains AUTO and we don't know the actual sort
* type until the values come back. The fields can only be set once.
* This method should be synchronized external like all other PQ methods.
* @param fields
*/
@SuppressWarnings({"unchecked","rawtypes"})
void setFields (SortField[] fields) throws IOException {
this.fields = fields;
this.collators = hasCollators (fields);
comparators = new FieldComparator[fields.length];
for(int fieldIDX=0;fieldIDX<fields.length;fieldIDX++) {
comparators[fieldIDX] = fields[fieldIDX].getComparator(1, fieldIDX);
}
}
/** Returns the fields being used to sort. */
SortField[] getFields() {
return fields;
}
/** Returns an array of collators, possibly <code>null</code>. The collators
* correspond to any SortFields which were given a specific locale.
* @param fields Array of sort fields.
* @return Array, possibly <code>null</code>.
*/
private Collator[] hasCollators (final SortField[] fields) {
if (fields == null) return null;
Collator[] ret = new Collator[fields.length];
for (int i=0; i<fields.length; ++i) {
Locale locale = fields[i].getLocale();
if (locale != null)
ret[i] = Collator.getInstance (locale);
}
return ret;
}
/**
* Returns whether <code>a</code> is less relevant than <code>b</code>.
* @param a ScoreDoc
* @param b ScoreDoc
* @return <code>true</code> if document <code>a</code> should be sorted after document <code>b</code>.
*/
@Override
@SuppressWarnings({"unchecked","rawtypes"})
protected final boolean lessThan(final FieldDoc docA, final FieldDoc docB) {
final int n = fields.length;
int c = 0;
for (int i=0; i<n && c==0; ++i) {
final int type = fields[i].getType();
if (type == SortField.STRING) {
final String s1 = (String) docA.fields[i];
final String s2 = (String) docB.fields[i];
// null values need to be sorted first, because of how FieldCache.getStringIndex()
// works - in that routine, any documents without a value in the given field are
// put first. If both are null, the next SortField is used
if (s1 == null) {
c = (s2 == null) ? 0 : -1;
} else if (s2 == null) {
c = 1;
} else if (fields[i].getLocale() == null) {
c = s1.compareTo(s2);
} else {
c = collators[i].compare(s1, s2);
}
} else {
final FieldComparator<Object> comp = (FieldComparator<Object>) comparators[i];
c = comp.compareValues(docA.fields[i], docB.fields[i]);
}
// reverse sort
if (fields[i].getReverse()) {
c = -c;
}
}
// avoid random sort order that could lead to duplicates (bug #31241):
if (c == 0)
return docA.doc > docB.doc;
return c > 0;
}
}
| [
"joergprante@gmail.com"
] | joergprante@gmail.com |
e717be07c45304b694929db1a42528d5e86a9d77 | 63930269c23c70c447b8a7ab7289e75db33c6316 | /src/test/java/in/nit/SpringBootInstituteProjectApplicationTests.java | 123aa8ec9b2751ec42783a77ab0325ee2982fdeb | [] | no_license | vinod2506/InstituteApp-Backened-Angular | ea5d557fe7593d82abbce24aa0fc7c40612985a4 | e80e2937d9eec25d5781ff107f63e7977aaa2521 | refs/heads/master | 2022-11-07T13:04:57.480613 | 2020-06-26T13:53:07 | 2020-06-26T13:53:07 | 274,927,789 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 218 | java | package in.nit;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class SpringBootInstituteProjectApplicationTests {
@Test
void contextLoads() {
}
}
| [
"vinodwus87@gmail.com"
] | vinodwus87@gmail.com |
09fc94bd2e2b915c14b6b2ba373a0519fcec80ed | 243d40ae474096370b1c74683a0505fc4b422159 | /JIIN/src/com/jiin/menu/NoticeData.java | 50f4d0111e04676faed4875efcafaaffbf0493e2 | [] | no_license | ViresseNisSJ/JIIN | 72f2eddc9b1ffba1af84962016608fde11b7737c | 2f7e86be6b51290074471e9bdd9f62e763cb4128 | refs/heads/master | 2021-01-13T12:49:13.070230 | 2016-10-30T04:48:28 | 2016-10-30T04:48:28 | 72,325,643 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 152 | java | package com.jiin.menu;
import java.util.ArrayList;
public class NoticeData {
String result;
String message;
ArrayList<NoticeGroupData> datas;
}
| [
"한수진"
] | 한수진 |
be063887c310b8ec8267bc09a95c6744324941ae | 60b879851eac6c9e4f7a62f9db60b6dc781d99ab | /SpringProject/src/main/java/com/example/mapper/DicMapper.java | 4d599da09130762c7e76c213821787d5716953dc | [] | no_license | Doro-w/curriculum-desigeII | c3813ef8cbcc5828164af70ecd5e029f6a93c44a | 6fed422ff41560c3268be3ca09b2c86ee795ed3d | refs/heads/main | 2023-07-03T15:45:59.779689 | 2021-07-22T05:41:43 | 2021-07-22T05:41:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 534 | java | package com.example.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.example.entity.Dic;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author xzc
* @since 2021-07-16
*/
@Repository
public interface DicMapper extends BaseMapper<Dic> {
List<Dic> getDicAll(int userId);
List<Dic> getDicByName(int userId, String name);
List<Dic> getDicId(int userId, String name);
}
| [
"18074799390@163.com"
] | 18074799390@163.com |
764a408b1ab9aca535b3eff5dff63aab7f23dacb | d7517616ff968b5b78682ca16432164f117f7f85 | /src/net/enjy/calculator/RomanNumeral.java | a8f75af5c93cc8d126e123bca724491abd9b1aca | [] | no_license | enjsite/Calculator | 6b5c9ca635be9b7a5360fbce0c2a4a98e2d1c9a4 | 5cab493f4ce671775f8bd7944a90ddc41d4448e3 | refs/heads/master | 2022-08-21T18:11:21.392812 | 2020-05-24T23:39:42 | 2020-05-24T23:39:42 | 266,642,636 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 716 | java | package net.enjy.calculator;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
enum RomanNumeral {
I(1), IV(4), V(5), IX(9), X(10),
XL(40), L(50), XC(90), C(100),
CD(400), D(500), CM(900), M(1000);
private int value;
RomanNumeral(int value) {
this.value = value;
}
public int getValue() {
return value;
}
public static List<RomanNumeral> getReverseSortedValues() {
return Arrays.stream(values())
.sorted(Comparator.comparing((RomanNumeral e) -> e.value).reversed())
.collect(Collectors.toList());
}
}
| [
"enjyweb@gmail.com"
] | enjyweb@gmail.com |
6c0c99f6e423b6ba43fcaaf66739b81d80f6ec1b | bd7c6ab96ec23c323016e65b73dea450ff8c4bb5 | /app/src/main/java/com/project/sahifah/model/ModelOase.java | 4cddf7254312fd6c60e6e2707d7670e2211b6469 | [] | no_license | sofiaasseggaf/Sahifah | 62bfddc8e86f9582d1a000460fe3a8f146e14d35 | 8e344ed86aa1aa9cc1fafe4ea65b5f08d41a527a | refs/heads/master | 2022-12-02T22:58:22.082682 | 2020-08-24T06:43:15 | 2020-08-24T06:43:15 | 289,850,253 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,457 | java |
package com.project.sahifah.model;
import java.io.Serializable;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class ModelOase implements Serializable, Parcelable
{
@SerializedName("id")
@Expose
private String id;
@SerializedName("title")
@Expose
private String title;
@SerializedName("group_id")
@Expose
private String groupId;
@SerializedName("content")
@Expose
private String content;
@SerializedName("image")
@Expose
private String image;
@SerializedName("created_date")
@Expose
private String createdDate;
public final static Creator<ModelOase> CREATOR = new Creator<ModelOase>() {
@SuppressWarnings({
"unchecked"
})
public ModelOase createFromParcel(Parcel in) {
return new ModelOase(in);
}
public ModelOase[] newArray(int size) {
return (new ModelOase[size]);
}
}
;
private final static long serialVersionUID = 6079080482257854836L;
protected ModelOase(Parcel in) {
this.id = ((String) in.readValue((String.class.getClassLoader())));
this.title = ((String) in.readValue((String.class.getClassLoader())));
this.groupId = ((String) in.readValue((String.class.getClassLoader())));
this.content = ((String) in.readValue((String.class.getClassLoader())));
this.image = ((String) in.readValue((String.class.getClassLoader())));
this.createdDate = ((String) in.readValue((String.class.getClassLoader())));
}
/**
* No args constructor for use in serialization
*
*/
public ModelOase() {
}
/**
*
* @param image
* @param createdDate
* @param groupId
* @param id
* @param title
* @param content
*/
public ModelOase(String id, String title, String groupId, String content, String image, String createdDate) {
super();
this.id = id;
this.title = title;
this.groupId = groupId;
this.content = content;
this.image = image;
this.createdDate = createdDate;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getGroupId() {
return groupId;
}
public void setGroupId(String groupId) {
this.groupId = groupId;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public String getCreatedDate() {
return createdDate;
}
public void setCreatedDate(String createdDate) {
this.createdDate = createdDate;
}
public void writeToParcel(Parcel dest, int flags) {
dest.writeValue(id);
dest.writeValue(title);
dest.writeValue(groupId);
dest.writeValue(content);
dest.writeValue(image);
dest.writeValue(createdDate);
}
public int describeContents() {
return 0;
}
}
| [
"sofiaasseggaf@gmail.com"
] | sofiaasseggaf@gmail.com |
7585867f92e02737ef28a04867d0359adb18bf2e | fa5d912f2ca41e4e34df63af499acd4fc16e6f99 | /src/controlador/RendererArbol.java | e1c62864215e27a3bc69e35a036ad254ae976019 | [] | no_license | geilerelias/redes-Neuronales | dc97e5c055969bf58586467093ac6ffa06c727e4 | 36418f98d831d2eee0eedf402e544103d5c1ab9c | refs/heads/master | 2023-08-02T07:37:14.303831 | 2021-09-18T23:26:49 | 2021-09-18T23:26:49 | 172,551,914 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 760 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package controlador;
import javax.swing.ImageIcon;
import javax.swing.tree.DefaultTreeCellRenderer;
/**
*
* @author eldoc
*/
public class RendererArbol extends DefaultTreeCellRenderer {
/**
* Creates a new instance of RendererArbol
*/
public RendererArbol() {
setLeafIcon(new ImageIcon("src/vista/images/icons8_JSON_15px_2.png"));
setOpenIcon(new ImageIcon("src/vista/images/icons8_Open_18px.png"));
setClosedIcon(new ImageIcon("src/vista/images/icons8_Folder_18px.png"));
}
}
| [
"geilerelias@gmail.com"
] | geilerelias@gmail.com |
579c418edf1a7c522b3c2b9e13616bc1415cd381 | 028f514ea6f7f508fd8503adb74687cb2ec7f8fb | /src/main/java/cn/momia/admin/web/controller/CouponController.java | 09cd711764a105cfe861657de205e2c5d69c15f0 | [] | no_license | lovemomia/admin | 1aacf94f95d2de15a08301e62c96a6ff94d5b88c | f90ef69474e365e19ee5f36e041afdcc91dac85d | refs/heads/master | 2021-01-23T00:14:43.802100 | 2015-07-29T05:21:33 | 2015-07-29T05:21:33 | 38,465,595 | 0 | 0 | null | 2015-07-29T05:21:34 | 2015-07-03T01:38:27 | Java | UTF-8 | Java | false | false | 4,572 | java | package cn.momia.admin.web.controller;
import cn.momia.admin.web.common.FileUtil;
import cn.momia.admin.web.common.FinalUtil;
import cn.momia.admin.web.common.PageTypeUtil;
import cn.momia.admin.web.common.StringUtil;
import cn.momia.admin.web.service.AdminUserService;
import cn.momia.admin.web.service.CouponService;
import cn.momia.admin.web.service.QueryPageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
/**
* Created by hoze on 15/7/14.
*/
@Controller
@RequestMapping("/coupon")
public class CouponController {
@Autowired
private AdminUserService adminUserService;
@Autowired
private QueryPageService queryPageService;
@Autowired
private CouponService couponService;
@RequestMapping("/info")
public ModelAndView info(@RequestParam("uid") int uid,@RequestParam("pageNo") int pageNo, HttpServletRequest req){
Map<String, Object> context = new HashMap<String, Object>();
context.put(FinalUtil.QUERY_PAGE, queryPageService.getEntitys(queryPageService.formEntity(PageTypeUtil.PAGE_TYPE_8, pageNo)));
context.put(FinalUtil.USER_ENTITY,adminUserService.get(uid));
return new ModelAndView(FileUtil.COUPON,context);
}
@RequestMapping("/oper")
public ModelAndView operation(@RequestParam("uid") int uid,@RequestParam("id") int id, @RequestParam("mark") int mark,@RequestParam("pageNo") int pageNo,HttpServletRequest req){
String reStr = FileUtil.COUPON_EDIT;
Map<String, Object> context = new HashMap<String, Object>();
if (mark == 0){
reStr = FileUtil.COUPON_ADD;
} else{
context.put(FinalUtil.ENTITY, couponService.get(id));
}
context.put("pageNo",pageNo);
context.put(FinalUtil.USER_ENTITY,adminUserService.get(uid));
return new ModelAndView(reStr,context);
}
@RequestMapping("/add")
public ModelAndView addEntity(@RequestParam("uid") int uid,@RequestParam("pageNo") int pageNo, HttpServletRequest req){
Map<String, Object> context = new HashMap<String, Object>();
int reDate = couponService.insert(couponService.formEntity(req,FinalUtil.ADD_INFO));
if (reDate > 0){
context.put(FinalUtil.RETURN_MSG,"添加红包信息数据成功!");
}else{
context.put(FinalUtil.RETURN_MSG,"添加红包信息数据失败!");
}
context.put(FinalUtil.QUERY_PAGE, queryPageService.getEntitys(queryPageService.formEntity(PageTypeUtil.PAGE_TYPE_8, pageNo)));
context.put(FinalUtil.USER_ENTITY,adminUserService.get(uid));
return new ModelAndView(FileUtil.COUPON,context);
}
@RequestMapping("/edit")
public ModelAndView editEntity(@RequestParam("uid") int uid,@RequestParam("pageNo") int pageNo,@RequestParam("id") int id, HttpServletRequest req){
Map<String, Object> context = new HashMap<String, Object>();
int reDate = couponService.update(couponService.formEntity(req, id));
if (reDate > 0){
context.put(FinalUtil.RETURN_MSG,"修改红包信息数据成功!");
}else{
context.put(FinalUtil.RETURN_MSG,"修改红包信息数据失败!");
}
context.put(FinalUtil.QUERY_PAGE, queryPageService.getEntitys(queryPageService.formEntity(PageTypeUtil.PAGE_TYPE_8, pageNo)));
context.put(FinalUtil.USER_ENTITY,adminUserService.get(uid));
return new ModelAndView(FileUtil.COUPON,context);
}
@RequestMapping("/del")
public ModelAndView delEntity(@RequestParam("uid") int uid,@RequestParam("id") int id,@RequestParam("pageNo") int pageNo, HttpServletRequest req){
Map<String, Object> context = new HashMap<String, Object>();
int reDate = couponService.delete(id);
if (reDate > 0){
context.put(FinalUtil.RETURN_MSG,"删除红包信息数据成功!");
}else{
context.put(FinalUtil.RETURN_MSG,"删除红包信息数据失败!");
}
context.put(FinalUtil.QUERY_PAGE, queryPageService.getEntitys(queryPageService.formEntity(PageTypeUtil.PAGE_TYPE_8, pageNo)));
context.put(FinalUtil.USER_ENTITY,adminUserService.get(uid));
return new ModelAndView(FileUtil.COUPON,context);
}
}
| [
"hongzhidou@163.com"
] | hongzhidou@163.com |
83fc6f1bdb3a6a9e5038daa3d87cd3a218633399 | f1a85ae8b9d5d9d9a848c4c8d9c2410b9726e194 | /library/expandablelayout_library/build/generated/source/r/androidTest/debug/android/support/compat/R.java | 5dc1b83bdbb90dce76f4f972f02cfe22df65f4cc | [] | no_license | P79N6A/as | 45dc7c76d58cdc62e3e403c9da4a1c16c4234568 | a57ee2a3eb2c73cc97c3fb130b8e389899b19d99 | refs/heads/master | 2020-04-20T05:55:10.175425 | 2019-02-01T08:49:15 | 2019-02-01T08:49:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,919 | 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.compat;
public final class R {
public static final class attr {
public static final int font = 0x7f0100c7;
public static final int fontProviderAuthority = 0x7f0100c0;
public static final int fontProviderCerts = 0x7f0100c3;
public static final int fontProviderFetchStrategy = 0x7f0100c4;
public static final int fontProviderFetchTimeout = 0x7f0100c5;
public static final int fontProviderPackage = 0x7f0100c1;
public static final int fontProviderQuery = 0x7f0100c2;
public static final int fontStyle = 0x7f0100c6;
public static final int fontWeight = 0x7f0100c8;
}
public static final class bool {
public static final int abc_action_bar_embed_tabs = 0x7f080000;
}
public static final class color {
public static final int notification_action_color_filter = 0x7f090000;
public static final int notification_icon_bg_color = 0x7f090028;
public static final int ripple_material_light = 0x7f090032;
public static final int secondary_text_default_material_light = 0x7f090034;
}
public static final class dimen {
public static final int compat_button_inset_horizontal_material = 0x7f06004f;
public static final int compat_button_inset_vertical_material = 0x7f060050;
public static final int compat_button_padding_horizontal_material = 0x7f060051;
public static final int compat_button_padding_vertical_material = 0x7f060052;
public static final int compat_control_corner_material = 0x7f060053;
public static final int notification_action_icon_size = 0x7f06005d;
public static final int notification_action_text_size = 0x7f06005e;
public static final int notification_big_circle_margin = 0x7f06005f;
public static final int notification_content_margin_start = 0x7f060012;
public static final int notification_large_icon_height = 0x7f060060;
public static final int notification_large_icon_width = 0x7f060061;
public static final int notification_main_column_padding_top = 0x7f060013;
public static final int notification_media_narrow_margin = 0x7f060014;
public static final int notification_right_icon_size = 0x7f060062;
public static final int notification_right_side_padding_top = 0x7f060010;
public static final int notification_small_icon_background_padding = 0x7f060063;
public static final int notification_small_icon_size_as_large = 0x7f060064;
public static final int notification_subtext_size = 0x7f060065;
public static final int notification_top_pad = 0x7f060066;
public static final int notification_top_pad_large_text = 0x7f060067;
}
public static final class drawable {
public static final int notification_action_background = 0x7f020053;
public static final int notification_bg = 0x7f020054;
public static final int notification_bg_low = 0x7f020055;
public static final int notification_bg_low_normal = 0x7f020056;
public static final int notification_bg_low_pressed = 0x7f020057;
public static final int notification_bg_normal = 0x7f020058;
public static final int notification_bg_normal_pressed = 0x7f020059;
public static final int notification_icon_background = 0x7f02005a;
public static final int notification_template_icon_bg = 0x7f02005f;
public static final int notification_template_icon_low_bg = 0x7f020060;
public static final int notification_tile_bg = 0x7f02005b;
public static final int notify_panel_notification_icon_bg = 0x7f02005c;
}
public static final class id {
public static final int action_container = 0x7f0a0080;
public static final int action_divider = 0x7f0a008b;
public static final int action_image = 0x7f0a0081;
public static final int action_text = 0x7f0a0082;
public static final int actions = 0x7f0a008c;
public static final int async = 0x7f0a0030;
public static final int blocking = 0x7f0a0031;
public static final int chronometer = 0x7f0a0088;
public static final int forever = 0x7f0a0032;
public static final int icon = 0x7f0a0056;
public static final int icon_group = 0x7f0a008d;
public static final int info = 0x7f0a0089;
public static final int italic = 0x7f0a0033;
public static final int line1 = 0x7f0a0005;
public static final int line3 = 0x7f0a0006;
public static final int normal = 0x7f0a0010;
public static final int notification_background = 0x7f0a0083;
public static final int notification_main_column = 0x7f0a0085;
public static final int notification_main_column_container = 0x7f0a0084;
public static final int right_icon = 0x7f0a008a;
public static final int right_side = 0x7f0a0086;
public static final int tag_transition_group = 0x7f0a000a;
public static final int text = 0x7f0a000b;
public static final int text2 = 0x7f0a000c;
public static final int time = 0x7f0a0087;
public static final int title = 0x7f0a000d;
}
public static final class integer {
public static final int status_bar_notification_info_maxnum = 0x7f0b0004;
}
public static final class layout {
public static final int notification_action = 0x7f03001b;
public static final int notification_action_tombstone = 0x7f03001c;
public static final int notification_template_custom_big = 0x7f03001d;
public static final int notification_template_icon_group = 0x7f03001e;
public static final int notification_template_part_chronometer = 0x7f03001f;
public static final int notification_template_part_time = 0x7f030020;
}
public static final class string {
public static final int status_bar_notification_info_overflow = 0x7f050012;
}
public static final class style {
public static final int TextAppearance_Compat_Notification = 0x7f070073;
public static final int TextAppearance_Compat_Notification_Info = 0x7f070074;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0700f3;
public static final int TextAppearance_Compat_Notification_Time = 0x7f070075;
public static final int TextAppearance_Compat_Notification_Title = 0x7f070076;
public static final int Widget_Compat_NotificationActionContainer = 0x7f070077;
public static final int Widget_Compat_NotificationActionText = 0x7f070078;
}
public static final class styleable {
public static final int[] FontFamily = { 0x7f0100c0, 0x7f0100c1, 0x7f0100c2, 0x7f0100c3, 0x7f0100c4, 0x7f0100c5 };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderPackage = 1;
public static final int FontFamily_fontProviderQuery = 2;
public static final int FontFamily_fontProviderCerts = 3;
public static final int FontFamily_fontProviderFetchStrategy = 4;
public static final int FontFamily_fontProviderFetchTimeout = 5;
public static final int[] FontFamilyFont = { 0x01010532, 0x01010533, 0x0101053f, 0x7f0100c6, 0x7f0100c7, 0x7f0100c8 };
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_fontStyle = 3;
public static final int FontFamilyFont_font = 4;
public static final int FontFamilyFont_fontWeight = 5;
}
}
| [
"254191389@qq.com"
] | 254191389@qq.com |
15b8f604dfec72e5a9c9d2643ddcbcd2259bbdcd | 0673650dc1f69012513958483de1b38748e72124 | /src/main/java/com/supermarket/infrastructure/persistence/InMemoryProducts.java | e08856c9eca0b3946ced8d2d292d2521a72c0d21 | [] | no_license | ivanbadia/sales-refactoring-kata | ee711227f5ae3d2abd02394c76fcbe6f94197190 | c20f1652842ad4378c94a7d19d89352cd1857c92 | refs/heads/master | 2022-11-25T18:59:42.189297 | 2020-08-06T16:51:39 | 2020-08-06T16:51:39 | 284,917,808 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,135 | java | package com.supermarket.infrastructure.persistence;
import com.supermarket.domain.product.Product;
import com.supermarket.domain.product.ProductName;
import com.supermarket.domain.product.Products;
import java.util.List;
import java.util.Optional;
import static com.supermarket.domain.product.ProductType.*;
public class InMemoryProducts implements Products {
private static final List<Product> PRODUCTS = List.of(
new Product(new ProductName("book"), BOOK),
new Product(new ProductName("packet of chips"), FOOD),
new Product(new ProductName("box of chips"), FOOD),
new Product(new ProductName("boxes of potato chips"), FOOD),
new Product(new ProductName("packet of headache tablets"), MEDICAL_ITEM),
new Product(new ProductName("box of chocolates"), FOOD),
new Product(new ProductName("packets of iodine tablets"), MEDICAL_ITEM)
);
@Override
public Optional<Product> by(ProductName name) {
return PRODUCTS.stream()
.filter(product -> product.getName().equals(name))
.findFirst();
}
}
| [
"ivanbadia@gmail.com"
] | ivanbadia@gmail.com |
2d0b43c440b9ba8d0d60fa5d7080312e92844505 | a2440dbe95b034784aa940ddc0ee0faae7869e76 | /modules/lwjgl/openxr/src/generated/java/org/lwjgl/openxr/EXTViewConfigurationDepthRange.java | 40fae60771dd79c714f3b72e70bd1b199d86c3cf | [
"LGPL-2.0-or-later",
"CC-BY-4.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-generic-cla",
"GPL-2.0-only",
"Apache-2.0",
"GPL-1.0-or-later",
"LGPL-2.0-only",
"MIT",
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-public-domain",
"BSD-2-Clau... | permissive | LWJGL/lwjgl3 | 8972338303520c5880d4a705ddeef60472a3d8e5 | 67b64ad33bdeece7c09b0f533effffb278c3ecf7 | refs/heads/master | 2023-08-26T16:21:38.090410 | 2023-08-26T16:05:52 | 2023-08-26T16:05:52 | 7,296,244 | 4,835 | 1,004 | BSD-3-Clause | 2023-09-10T12:03:24 | 2012-12-23T15:40:04 | Java | UTF-8 | Java | false | false | 2,105 | java | /*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
package org.lwjgl.openxr;
/**
* The <a href="https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#XR_EXT_view_configuration_depth_range">XR_EXT_view_configuration_depth_range</a> extension.
*
* <p>For XR systems there may exist a per view recommended min/max depth range at which content should be rendered into the virtual world. The depth range may be driven by several factors, including user comfort, or fundamental capabilities of the system.</p>
*
* <p>Displaying rendered content outside the recommended min/max depth range would violate the system requirements for a properly integrated application, and can result in a poor user experience due to observed visual artifacts, visual discomfort, or fatigue. The near/far depth values will fall in the range of (0..+infinity] where max({@code recommendedNearZ}, {@code minNearZ}) < min({@code recommendedFarZ}, {@code maxFarZ}). Infinity is defined matching the standard library definition such that std::isinf will return true for a returned infinite value.</p>
*
* <p>In order to provide the application with the appropriate depth range at which to render content for each {@link XrViewConfigurationView}, this extension provides additional view configuration information, as defined by {@link XrViewConfigurationDepthRangeEXT}, to inform the application of the min/max recommended and absolute distances at which content should be rendered for that view.</p>
*/
public final class EXTViewConfigurationDepthRange {
/** The extension specification version. */
public static final int XR_EXT_view_configuration_depth_range_SPEC_VERSION = 1;
/** The extension name. */
public static final String XR_EXT_VIEW_CONFIGURATION_DEPTH_RANGE_EXTENSION_NAME = "XR_EXT_view_configuration_depth_range";
/** Extends {@code XrStructureType}. */
public static final int XR_TYPE_VIEW_CONFIGURATION_DEPTH_RANGE_EXT = 1000046000;
private EXTViewConfigurationDepthRange() {}
} | [
"iotsakp@gmail.com"
] | iotsakp@gmail.com |
1b35d09271e5feb027dba3adfa19f25d8c2ba10b | 6a131c74fefa4052bacb44ef5aa99301d1e8dec2 | /app/src/androidTest/java/com/nick/chef/ExampleInstrumentedTest.java | c78bd66df3996592268c76bd9ed4f90ff982297a | [
"Apache-2.0"
] | permissive | 13150656724/Chef | 43dbd1665dbcd34e96cf3972fd739264f99f709e | 75d3db94daed9482bde292ddc9335679b6f0a5f2 | refs/heads/master | 2020-06-01T23:18:49.241399 | 2017-09-07T14:46:51 | 2017-09-07T14:46:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 730 | java | package com.nick.chef;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.nick.chef", appContext.getPackageName());
}
}
| [
"fergus9378@gmail.com"
] | fergus9378@gmail.com |
716658f4ba56da5ec87f26f0f376291432d81cf2 | e6cc9126285364fb6ceb4089d4a232de13a00a97 | /src/module-info.java | bc857670bead94827cf5a0a82d5d9bb2bdda264e | [] | no_license | NRA3110/REP3 | a23a245e01f2343e1c6f31bb46d9ae9e9d6d3e43 | c60eeed33c06478906ab431a20efc3d95b8623fc | refs/heads/master | 2020-07-31T00:00:45.592446 | 2019-09-23T17:01:52 | 2019-09-23T17:01:52 | 210,408,751 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 23 | java | module BuddyModule {
} | [
"nickranderson@cb5109-57.labs.sce.carleton.ca"
] | nickranderson@cb5109-57.labs.sce.carleton.ca |
b7d732fedcb0c2a10c2967c448ca7913967a69ea | fffae1fb6b6a33c62f6d3874820fd7a68e91095d | /ego/ego-passport/src/main/java/com/ego/passport/dao/impl/JedisPoolDaoImpl.java | eb22d51bdd0d579dddb12942f4b1d62a61501e19 | [] | no_license | LiXian19920/ego | 144f007d6e143893e80fdce5fbe507f6ea419662 | f6681b67238287436faf622ccdae9d8612425868 | refs/heads/master | 2020-03-27T15:49:55.677927 | 2018-08-30T11:51:34 | 2018-08-30T11:51:34 | 146,742,367 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,260 | java | package com.ego.passport.dao.impl;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import com.ego.passport.dao.JedisPoolDao;
import redis.clients.jedis.JedisCluster;
/**
* @ClassName:JedisPoolDaoImpl
* @Description:
* @Company: 北京尚学堂科技有限公司 www.bjsxt.com
* @author mengqx
* @date 2017年8月9日
* @Repository :dao 层的注解 @Component: 将类在spring 中进行自动注入,注入的名称是类的首字母小写。
* @service: 专用于service层的注解
*/
@Repository
public class JedisPoolDaoImpl implements JedisPoolDao{
// 相当取得到JedisCluster对象
@Resource
private JedisCluster jedisCluster;
@Override
public Boolean exists(String key) {
return jedisCluster.exists(key);
}
@Override
public String get(String key) {
return jedisCluster.get(key);
}
@Override
public Long del(String key) {
// TODO Auto-generated method stub
return jedisCluster.del(key);
}
@Override
public String set(String key, String value) {
// TODO Auto-generated method stub
return jedisCluster.set(key, value);
}
}
| [
"lx119112@163.com"
] | lx119112@163.com |
df92b5d530e4f28c998fab4c728036b33455727d | 73b7f36cc0ae80bb53dcd8a87f3b6dce501c8703 | /app/src/main/java/tech42/sathish/inventorymanagement/customfonts/CustomFontsTextView.java | 183f6e64f48213a3fcf3baf9caf39dc6596fd584 | [] | no_license | sathish-cse/InventoryManagement | 4d716d7c10d84cc7d756839f6c5fc2a764b9acd5 | 38cb987ebf31062992b1aaea41e8f12628697bd3 | refs/heads/master | 2021-01-11T16:27:03.112669 | 2017-02-06T11:36:10 | 2017-02-06T11:36:10 | 80,086,059 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 818 | java | package tech42.sathish.inventorymanagement.customfonts;
import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.TextView;
public class CustomFontsTextView extends TextView {
public CustomFontsTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
public CustomFontsTextView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public CustomFontsTextView(Context context) {
super(context);
init();
}
private void init() {
if (!isInEditMode()) {
Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "fonts/Lato-Light.ttf");
setTypeface(tf);
}
}
} | [
"sathishsachincse@gmail.com"
] | sathishsachincse@gmail.com |
843269da2fa0e2c637ef908a6003a08bfa23d08d | 97f4e12ff25a02ba940929311237a1760780b25c | /app/src/main/java/com/example/ccei/g/MainActivity.java | c9e17e52a3459bb05b310eb2b3763b89a5b557f1 | [] | no_license | hyejo/testRepo | f07491da08ba45edd7f7bf3edea7d96a00274bdf | a866a90bff756cd40fc32f32fa6e719b382eeeed | refs/heads/master | 2021-01-20T21:16:11.384043 | 2016-07-05T05:45:47 | 2016-07-05T05:45:47 | 62,609,298 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,173 | java | package com.example.ccei.g;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
ArrayList arrayList = new ArrayList();
int count = 0;
TextView input_text;
TextView ing;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ActionBar actionBar = getSupportActionBar();
actionBar.hide();
ing = (TextView) findViewById(R.id.ing);
input_text = (TextView) findViewById(R.id.input_text);
Button clear = (Button) findViewById(R.id.clear);
Button dot = (Button) findViewById(R.id.dot);
Button num_0 = (Button) findViewById(R.id.num_0);
Button num_1 = (Button) findViewById(R.id.num_1);
Button num_2 = (Button) findViewById(R.id.num_2);
Button num_3 = (Button) findViewById(R.id.num_3);
Button num_4 = (Button) findViewById(R.id.num_4);
Button num_5 = (Button) findViewById(R.id.num_5);
Button num_6 = (Button) findViewById(R.id.num_6);
Button num_7 = (Button) findViewById(R.id.num_7);
Button num_8 = (Button) findViewById(R.id.num_8);
Button num_9 = (Button) findViewById(R.id.num_9);
Button plus = (Button) findViewById(R.id.plus);
Button minus = (Button) findViewById(R.id.minus);
Button mul = (Button) findViewById(R.id.mul);
Button dev = (Button) findViewById(R.id.dev);
Button result = (Button) findViewById(R.id.result);
clear.setOnClickListener(this);
dot.setOnClickListener(this);
num_0.setOnClickListener(this);
num_1.setOnClickListener(this);
num_2.setOnClickListener(this);
num_3.setOnClickListener(this);
num_4.setOnClickListener(this);
num_5.setOnClickListener(this);
num_6.setOnClickListener(this);
num_7.setOnClickListener(this);
num_8.setOnClickListener(this);
num_9.setOnClickListener(this);
plus.setOnClickListener(this);
minus.setOnClickListener(this);
mul.setOnClickListener(this);
dev.setOnClickListener(this);
result.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.dot:
input_text.setText(input_text.getText().toString() + ".");
break;
case R.id.clear:
ing.setText("");
input_text.setText(null);
break;
case R.id.num_0:
input_text.setText(input_text.getText().toString() + "0");
ing.append("0");
break;
case R.id.num_1:
input_text.setText(input_text.getText().toString() + "1");
ing.append("1");
break;
case R.id.num_2:
input_text.setText(input_text.getText().toString() + "2");
ing.append("2");
break;
case R.id.num_3:
input_text.setText(input_text.getText().toString() + "3");
ing.append("3");
break;
case R.id.num_4:
input_text.setText(input_text.getText().toString() + "4");
ing.append("4");
break;
case R.id.num_5:
input_text.setText(input_text.getText().toString() + "5");
ing.append("5");
break;
case R.id.num_6:
input_text.setText(input_text.getText().toString() + "6");
ing.append("6");
break;
case R.id.num_7:
input_text.setText(input_text.getText().toString() + "7");
ing.append("7");
break;
case R.id.num_8:
input_text.setText(input_text.getText().toString() + "8");
ing.append("8");
break;
case R.id.num_9:
input_text.setText(input_text.getText().toString() + "9");
ing.append("9");
break;
case R.id.plus:
arrayList.add(input_text.getText().toString());
input_text.setText("");
ing.append("+");
count = 1;
break;
case R.id.mul:
arrayList.add(input_text.getText().toString());
input_text.setText("");
ing.append("*");
count = 3;
break;
case R.id.dev:
arrayList.add(input_text.getText().toString());
input_text.setText("");
ing.append("/");
count = 4;
break;
case R.id.result:
int sum1 = 0, sum2 = 0, sum3, count2 = 0;
double fsum1 = 0, fsum2 = 0, fsum3 = 0;
if (arrayList.isEmpty()) {
input_text.setText("");
} else {
Object obj = arrayList.get(0);
String num1 = (String) obj;
String num2 = input_text.getText().toString();
if (num1.contains(".") || num2.contains(".")) {
count2 = 1;
fsum1 = Float.parseFloat(num1);
fsum2 = Float.parseFloat(num2);
} else {
sum1 = Integer.parseInt(num1);
sum2 = Integer.parseInt(num2);
sum3 = 0;
}
String val = "";
switch (count) {
case 0:
input_text.setText("");
case 1:
if (count2 == 1) {
fsum3 = fsum1 + fsum2;
val = String.valueOf(fsum3);
} else {
sum3 = sum1 + sum2;
val = String.valueOf(sum3);
}
input_text.setText(val);
arrayList.clear();
break;
case 2:
if (count2 == 1) {
fsum3 = fsum1 - fsum2;
val = String.valueOf(fsum3);
} else {
sum3 = sum1 - sum2;
val = String.valueOf(sum3);
}
input_text.setText(val);
arrayList.clear();
break;
case 3:
if (count2 == 1) {
fsum3 = fsum1 * fsum2;
val = String.valueOf(fsum3);
} else {
sum3 = sum1 * sum2;
val = String.valueOf(sum3);
}
input_text.setText(val);
arrayList.clear();
break;
case 4:
if (count2 == 1) {
fsum3 = fsum1 / fsum2;
val = String.valueOf(fsum3);
} else {
sum3 = sum1 / sum2;
val = String.valueOf(sum3);
}
input_text.setText(val);
arrayList.clear();
break;
}
}
break;
}
}
}
| [
"kimhjbnm1@gmail.com"
] | kimhjbnm1@gmail.com |
f06161fc1a12e212b93eab01d73d54c385e2e54a | f76707f388da9455650d1944beed28f45be397de | /src/chap17/ServletEx1.java | e9936a82622db465ea1fffa520c2bb53e7d08250 | [] | no_license | chanoh-park/jsp20200706 | db7a0c378ae52a08fd008588957ced6825fe969e | 95078fac93287238f2f6d30a162a4a10620e5dcf | refs/heads/master | 2022-11-23T01:36:57.641442 | 2020-07-27T00:15:37 | 2020-07-27T00:15:37 | 277,406,917 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,585 | java | package chap17;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class ServletEx1
*/
public class ServletEx1 extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public ServletEx1() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
System.out.println("ServletEx1 요청 잘 받음");
//response.getWriter().append("Served at: ").append(request.getContextPath());
response.setContentType("text/html; charset=utf-8"); // ContentType은 제일 먼저 적어줘야 한다
PrintWriter out = response.getWriter();
out.print("<h1> 첫번째 서블릿 </h1>");
out.print("<h1>서블릿으로 html 작성은 어려워</h1>");
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| [
"cocosh6@naver.com"
] | cocosh6@naver.com |
4c0dd3fd00bac0213c3f74d31afdef22a7a99316 | 180e78725121de49801e34de358c32cf7148b0a2 | /dataset/protocol1/java-design-patterns/learning/7891/MessageCollectorMemberTest.java | e33df1d1b7aa27c458b7ede17a38324faeafcb82 | [] | no_license | ASSERT-KTH/synthetic-checkstyle-error-dataset | 40e8d1e0a7ebe7f7711def96a390891a6922f7bd | 40c057e1669584bfc6fecf789b5b2854660222f3 | refs/heads/master | 2023-03-18T12:50:55.410343 | 2019-01-25T09:54:39 | 2019-01-25T09:54:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,343 | java | /**
* The MIT License
* Copyright (c) 2014 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar.databus.members;
import com.iluwatar.databus.data.MessageData;
import com.iluwatar.databus.data.StartingData;
import org.junit.jupiter.api.Test;
import java.time.LocalDateTime;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Tests for {@link MessageCollectorMember}.
*
* @author Paul Campbell (pcampbell@kemitix.net)
*/
public class MessageCollectorMemberTest {
@Test
public void collectMessageFromMessageData() {
//given
final String message = "message";
final MessageData messageData = new MessageData(message);
final MessageCollectorMember collector = new MessageCollectorMember("collector");
//when
collector.accept(messageData);
//then
assertTrue(collector.getMessages().contains(message));
}
@Test
public void collectIgnoresMessageFromOtherDataTypes() {
//given
final StartingData startingData = new StartingData(LocalDateTime.now());
final MessageCollectorMember collector = new MessageCollectorMember("collector");
//when
collector.accept(startingData);
//then
assertEquals(0, collector.getMessages().size());
}
}
| [
"bloriot97@gmail.com"
] | bloriot97@gmail.com |
ccafee859e38deb920f8ae35209404e6fa55f6cb | 92a01aec40f81ca1c71fbb95eb1461f04bad4d01 | /java/anagram/src/test/java/AnagramTest.java | 87fd5758c5b2b4bf65fb3a84aa6f6e9b66443d5d | [] | no_license | xala3pa/exercism | 26768d28b2945ea61c282680bef3d99573d95dff | 83ad8478d72fb69c68aea52e31888f77edcf9e97 | refs/heads/master | 2020-12-24T12:33:35.065534 | 2020-09-10T13:43:45 | 2020-09-10T13:43:45 | 72,981,916 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,644 | java | import static org.assertj.core.api.Assertions.assertThat;
import java.util.Arrays;
import java.util.List;
import org.junit.Test;
import org.junit.Ignore;
public class AnagramTest {
@Test
public void testNoMatches() {
Anagram detector = new Anagram("diaper");
assertThat(detector.match(Arrays.asList("hello", "world", "zombies", "pants"))).isEmpty();
}
@Test
public void testSimpleAnagram() {
Anagram detector = new Anagram("ant");
List<String> anagram = detector.match(Arrays.asList("tan", "stand", "at"));
assertThat(anagram).containsExactly("tan");
}
@Test
public void testDetectMultipleAnagrams() {
Anagram detector = new Anagram("master");
List<String> anagrams = detector.match(Arrays.asList("stream", "pigeon", "maters"));
assertThat(anagrams).contains("maters", "stream");
}
@Test
public void testDoesNotConfuseDifferentDuplicates() {
Anagram detector = new Anagram("galea");
List<String> anagrams = detector.match(Arrays.asList("eagle"));
assertThat(anagrams).isEmpty();
}
@Test
public void testIdenticalWordIsNotAnagram() {
Anagram detector = new Anagram("corn");
List<String> anagrams = detector.match(Arrays.asList("corn", "dark", "Corn", "rank", "CORN", "cron", "park"));
assertThat(anagrams).containsExactly("cron");
}
@Test
public void testEliminateAnagramsWithSameChecksum() {
Anagram detector = new Anagram("mass");
assertThat(detector.match(Arrays.asList("last")).isEmpty());
}
@Test
public void testEliminateAnagramSubsets() {
Anagram detector = new Anagram("good");
assertThat(detector.match(Arrays.asList("dog", "goody"))).isEmpty();
}
@Test
public void testDetectAnagrams() {
Anagram detector = new Anagram("listen");
List<String> anagrams = detector.match(Arrays.asList("enlists", "google", "inlets", "banana"));
assertThat(anagrams).contains("inlets");
}
@Test
public void testMultipleAnagrams() {
Anagram detector = new Anagram("allergy");
List<String> anagrams = detector.match(Arrays.asList("gallery", "ballerina", "regally", "clergy", "largely", "leading"));
assertThat(anagrams).contains("gallery", "largely", "regally");
}
@Test
public void testAnagramsAreCaseInsensitive() {
Anagram detector = new Anagram("Orchestra");
List<String> anagrams = detector.match(Arrays.asList("cashregister", "Carthorse", "radishes"));
assertThat(anagrams).contains("Carthorse");
}
}
| [
"salazar3pa@gmail.com"
] | salazar3pa@gmail.com |
9842d0ed1e8ef70c4db30786f4c91f1797ae8c53 | 452662e456e487849aeae4231bdb3479e2b29015 | /LabLibraries/LibraryLabEquipmentEngine/src/uq/ilabs/library/labequipment/engine/LabEquipmentConfiguration.java | 409fabb3f7f1873f2ba7e443ba22a78bcdffb392 | [] | no_license | CEIT-UQ/UQ-iLab-BatchLabServer-Java | cd0d4c128e3a59f973a4eddd4c3f487b8643f60c | 9646e6cadc45dfed4f07646501ad20552e53b3f9 | refs/heads/master | 2021-01-18T17:41:30.547437 | 2013-08-22T06:53:12 | 2013-08-22T06:53:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,850 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package uq.ilabs.library.labequipment.engine;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.logging.Level;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import uq.ilabs.library.lab.utilities.Logfile;
import uq.ilabs.library.lab.utilities.XmlUtilities;
import uq.ilabs.library.lab.utilities.XmlUtilitiesException;
/**
*
* @author uqlpayne
*/
public class LabEquipmentConfiguration {
//<editor-fold defaultstate="collapsed" desc="Constants">
private static final String STR_ClassName = LabEquipmentConfiguration.class.getName();
private static final Level logLevel = Level.CONFIG;
/*
* String constants for logfile messages
*/
private static final String STRLOG_Filename_arg = "Filename: '%s'";
private static final String STRLOG_ParsingEquipmentConfiguration = "Parsing equipment configuration...";
private static final String STRLOG_TitleVersion_arg2 = "Title: '%s' Version: '%s'";
private static final String STRLOG_PowerupDelay_arg = "Powerup Delay: %d secs";
private static final String STRLOG_PowerdownTimeout_arg = "Powerdown Timeout: %d secs";
private static final String STRLOG_PoweroffDelay_arg = "Poweroff Delay: %d secs";
private static final String STRLOG_PowerdownDisabled = "Powerdown disabled";
private static final String STRLOG_DeviceName_arg = "Device: %s";
private static final String STRLOG_InitialiseDelay_arg = "Initialise Delay: %d secs";
private static final String STRLOG_DriverName_arg = "Driver: %s";
private static final String STRLOG_SetupId_arg = "Setup Id: %s";
/*
* String constants for exception messages
*/
private static final String STRERR_Filename = "filename";
private static final String STRERR_NumberIsNegative = "Number cannot be negative!";
private static final String STRERR_XmlDeviceConfigurationNotFound_arg = "XmlDeviceConfiguration mapping not found: %s";
private static final String STRERR_XmlDriverConfigurationNotFound_arg = "XmlDriverConfiguration mapping not found: %s";
private static final String STRERR_DriverNameNotFound_arg = "DriverName mapping not found: %s";
/*
* Constants
*/
/**
* Time in seconds to wait after the equipment is powered up if not already specified.
*/
private static final int DELAY_SECS_PowerupDefault = 5;
/**
* Minimum time in seconds to wait to power up the equipment after it has been powered down.
*/
private static final int DELAY_SECS_PoweroffMinimum = 5;
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Variables">
private HashMap<String, String> mapDevices;
private HashMap<String, String> mapDrivers;
private HashMap<String, String> mapSetups;
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Properties">
private String filename;
private String title;
private String version;
private int powerupDelay;
private int powerdownTimeout;
private int poweroffDelay;
private boolean powerdownEnabled;
private int initialiseDelay;
private String xmlValidation;
public String getFilename() {
return filename;
}
public String getTitle() {
return title;
}
public String getVersion() {
return version;
}
public int getPowerupDelay() {
return powerupDelay;
}
public int getPowerdownTimeout() {
return powerdownTimeout;
}
public int getPoweroffDelay() {
return poweroffDelay;
}
public boolean isPowerdownEnabled() {
return powerdownEnabled;
}
public int getInitialiseDelay() {
return initialiseDelay;
}
public String getXmlValidation() {
return xmlValidation;
}
//</editor-fold>
/**
* Constructor - Parse the equipment configuration XML string for information specific to the LabEquipment.
*
* @param xmlEquipmentConfiguration The string containing the XML to parse.
*/
public LabEquipmentConfiguration(String xmlEquipmentConfiguration) throws Exception {
this(null, null, xmlEquipmentConfiguration);
}
/**
* Constructor - Parse the equipment configuration XML file for information specific to the LabEquipment.
*
* @param filepath Path to the lab equipment configuration XML file which may be null.
* @param filename Name of the lab equipment configuration XML file which may include the path.
*/
public LabEquipmentConfiguration(String filepath, String filename) throws Exception {
this(filepath, filename, null);
}
/**
* Constructor - Parse the equipment configuration for information specific to the LabEquipment.
*
* @param filepath Path to the lab equipment configuration XML file which may be null.
* @param filename Name of the lab equipment configuration XML file which may include the path.
* @param xmlEquipmentConfiguration The string containing the XML to parse.
*/
public LabEquipmentConfiguration(String filepath, String filename, String xmlEquipmentConfiguration) throws Exception {
final String methodName = "LabEquipmentConfiguration";
Logfile.WriteCalled(logLevel, STR_ClassName, methodName);
String logMessage = Logfile.STRLOG_Newline;
try {
Document xmlDocument;
if (xmlEquipmentConfiguration != null) {
/*
* Get the equipment configuration from the XML string
*/
xmlDocument = XmlUtilities.GetDocumentFromString(xmlEquipmentConfiguration);
} else {
/*
* Check that parameters are valid
*/
if (filename == null) {
throw new NullPointerException(STRERR_Filename);
}
if (filename.trim().isEmpty()) {
throw new IllegalArgumentException(STRERR_Filename);
}
/*
* Combine the file path and name and check if the file exists
*/
File file = new File(filepath, filename);
if (file.exists() == false) {
throw new FileNotFoundException(file.getAbsolutePath());
}
this.filename = file.getAbsolutePath();
logMessage += String.format(STRLOG_Filename_arg, this.filename) + Logfile.STRLOG_Newline;
/*
* Load the equipment configuration from the file
*/
xmlDocument = XmlUtilities.GetDocumentFromFile(null, this.filename);
}
/*
* Get the document's root node
*/
Node xmlNodeEquipmentConfiguration = XmlUtilities.GetRootNode(xmlDocument, LabConsts.STRXML_EquipmentConfig);
logMessage += STRLOG_ParsingEquipmentConfiguration + Logfile.STRLOG_Newline;
/*
* Get information from the equipment configuration node
*/
this.title = XmlUtilities.GetAttributeValue(xmlNodeEquipmentConfiguration, LabConsts.STRXML_ATTR_Title, false);
this.version = XmlUtilities.GetAttributeValue(xmlNodeEquipmentConfiguration, LabConsts.STRXML_ATTR_Version, false);
logMessage += String.format(STRLOG_TitleVersion_arg2, this.title, this.version) + Logfile.STRLOG_Newline;
/*
* Get powerup delay, may not be specified
*/
try {
this.powerupDelay = XmlUtilities.GetChildValueAsInt(xmlNodeEquipmentConfiguration, LabConsts.STRXML_PowerupDelay);
if (this.powerupDelay < 0) {
throw new ArithmeticException(STRERR_NumberIsNegative);
}
} catch (XmlUtilitiesException ex) {
/*
* Powerup delay is not specified, use the default
*/
this.powerupDelay = DELAY_SECS_PowerupDefault;
}
/*
* Get powerdown timeout, may not be specified
*/
try {
this.powerdownTimeout = XmlUtilities.GetChildValueAsInt(xmlNodeEquipmentConfiguration, LabConsts.STRXML_PowerdownTimeout);
if (this.powerdownTimeout < 0) {
throw new ArithmeticException(STRERR_NumberIsNegative);
}
/*
* Powerdown timeout is specified so enable powerdown
*/
this.powerdownEnabled = true;
this.poweroffDelay = DELAY_SECS_PoweroffMinimum;
} catch (XmlUtilitiesException ex) {
/*
* Powerdown timeout is not specified, disable powerdown
*/
this.powerdownEnabled = false;
this.poweroffDelay = 0;
}
/*
* Log details
*/
logMessage += String.format(STRLOG_PowerupDelay_arg, this.powerupDelay) + Logfile.STRLOG_Newline;
if (this.powerdownEnabled == true) {
logMessage += String.format(STRLOG_PowerdownTimeout_arg, this.powerdownTimeout) + Logfile.STRLOG_Newline;
logMessage += String.format(STRLOG_PoweroffDelay_arg, this.poweroffDelay) + Logfile.STRLOG_Newline;
} else {
logMessage += STRLOG_PowerdownDisabled + Logfile.STRLOG_Newline;
}
/*
* Get the device nodes and accumulate the initialise delay
*/
this.initialiseDelay = 0;
this.mapDevices = new HashMap<>();
Node xmlNodeDevices = XmlUtilities.GetChildNode(xmlNodeEquipmentConfiguration, LabConsts.STRXML_Devices);
ArrayList xmlNodeList = XmlUtilities.GetChildNodeList(xmlNodeDevices, LabConsts.STRXML_Device);
for (int i = 0; i < xmlNodeList.size(); i++) {
Node xmlNodeDevice = (Node) xmlNodeList.get(i);
/*
* Check that the required device information exists
*/
String name = XmlUtilities.GetAttributeValue(xmlNodeDevice, LabConsts.STRXML_ATTR_Name, false);
logMessage += String.format(STRLOG_DeviceName_arg, name) + Logfile.STRLOG_Spacer;
/*
* Get the initialise delay and add to total
*/
int initialiseDelayDevice = XmlUtilities.GetChildValueAsInt(xmlNodeDevice, LabConsts.STRXML_InitialiseDelay);
this.initialiseDelay += initialiseDelayDevice;
logMessage += String.format(STRLOG_InitialiseDelay_arg, initialiseDelayDevice) + Logfile.STRLOG_Newline;
/*
* Add device XML to map
*/
String xmlDevice = XmlUtilities.ToXmlString(xmlNodeDevice);
this.mapDevices.put(name, xmlDevice);
}
/*
* Get the driver nodes
*/
this.mapDrivers = new HashMap<>();
Node xmlNodeDrivers = XmlUtilities.GetChildNode(xmlNodeEquipmentConfiguration, LabConsts.STRXML_Drivers);
xmlNodeList = XmlUtilities.GetChildNodeList(xmlNodeDrivers, LabConsts.STRXML_Driver);
for (int i = 0; i < xmlNodeList.size(); i++) {
Node xmlNodeDriver = (Node) xmlNodeList.get(i);
/*
* Check that the required driver information exists
*/
String name = XmlUtilities.GetAttributeValue(xmlNodeDriver, LabConsts.STRXML_ATTR_Name);
logMessage += String.format(STRLOG_DriverName_arg, name) + Logfile.STRLOG_Newline;
/*
* Add driver XML to map
*/
String xmlDriver = XmlUtilities.ToXmlString(xmlNodeDriver);
this.mapDrivers.put(name, xmlDriver);
}
/*
* Get the setup nodes
*/
this.mapSetups = new HashMap<>();
Node xmlNodeSetups = XmlUtilities.GetChildNode(xmlNodeEquipmentConfiguration, LabConsts.STRXML_Setups);
xmlNodeList = XmlUtilities.GetChildNodeList(xmlNodeSetups, LabConsts.STRXML_Setup);
for (int i = 0; i < xmlNodeList.size(); i++) {
Node xmlNodeSetup = (Node) xmlNodeList.get(i);
/*
* Get the setup id
*/
String id = XmlUtilities.GetAttributeValue(xmlNodeSetup, LabConsts.STRXML_ATTR_Id);
logMessage += String.format(STRLOG_SetupId_arg, id) + Logfile.STRLOG_Newline;
/*
* Get the driver and add to map
*/
String strDriver = XmlUtilities.GetChildValue(xmlNodeSetup, LabConsts.STRXML_Driver);
this.mapSetups.put(id, strDriver);
}
/*
* Get the validation node and save as an XML string
*/
Node xmlNodeValidation = XmlUtilities.GetChildNode(xmlNodeEquipmentConfiguration, LabConsts.STRXML_Validation);
this.xmlValidation = XmlUtilities.ToXmlString(xmlNodeValidation);
Logfile.Write(logLevel, logMessage);
} catch (XmlUtilitiesException | NullPointerException | IllegalArgumentException | FileNotFoundException | ArithmeticException ex) {
Logfile.WriteError(ex.toString());
throw ex;
}
Logfile.WriteCompleted(logLevel, STR_ClassName, methodName);
}
/**
*
* @param setupId
* @return
*/
public String GetDriverName(String setupId) {
String mapping;
if ((mapping = this.mapSetups.get(setupId)) == null) {
throw new RuntimeException(String.format(STRERR_DriverNameNotFound_arg, setupId));
}
return mapping;
}
/**
*
* @param deviceName
* @return
*/
public String GetXmlDeviceConfiguration(String deviceName) {
String mapping;
if ((mapping = this.mapDevices.get(deviceName)) == null) {
throw new RuntimeException(String.format(STRERR_XmlDeviceConfigurationNotFound_arg, deviceName));
}
return mapping;
}
/**
*
* @param driverName
* @return
*/
public String GetXmlDriverConfiguration(String driverName) {
String mapping;
if ((mapping = this.mapDrivers.get(driverName)) == null) {
throw new RuntimeException(String.format(STRERR_XmlDriverConfigurationNotFound_arg, driverName));
}
return mapping;
}
}
| [
"uqlpayne@uq.edu.au"
] | uqlpayne@uq.edu.au |
2b35eae7e9ca1f3661e36b0d6b1778c8334591f0 | 26c47c18ef261eec0b3377405ca492929b9d05de | /src/main/java/com/perrysummervacationmessaging/entities/Message.java | 8d724e3f512b97e27fe0a57e800091381595e8b0 | [] | no_license | DandDevy/perry_messaging | 70db8379748d44f315dd4db4c44b920c71aa6603 | 7e04a0fc45968edba3559e0575b4c9e7c209078d | refs/heads/main | 2023-02-28T14:01:52.065260 | 2021-02-12T11:37:21 | 2021-02-12T11:38:24 | 337,852,220 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,560 | java | package com.perrysummervacationmessaging.entities;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.UUID;
/**
* Message represents a message of the messaging system.
* All Messages have a unique id and its text must be between 1 and 256.
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Message {
public static final int MAX_MESSAGE_SIZE = 256;
public static final int MIN_MESSAGE_SIZE = 1;
@Id
@GeneratedValue(generator = "UUID")
@GenericGenerator(
name = "UUID",
strategy = "org.hibernate.id.UUIDGenerator"
)
private UUID messageId;
@Size(min = MIN_MESSAGE_SIZE, max = MAX_MESSAGE_SIZE)
@Column(nullable = false)
private String text;
@NotNull
@ManyToOne
@JoinColumn(name = "origin_user_id", nullable = false)
private User origin;
@NotNull
@ManyToOne
@JoinColumn(name = "destination_user_id", nullable = false)
private User destination;
public Message(@Size(min = MIN_MESSAGE_SIZE, max = MAX_MESSAGE_SIZE) String text, User originUser, User destinationUser) {
this.text = text;
this.origin = originUser;
this.destination = destinationUser;
}
public Message(UUID messageId) {
this.messageId = messageId;
}
}
| [
"dashcroft4@gmail.com"
] | dashcroft4@gmail.com |
a374b6cada19840a5f1ac13f7805df52e129c798 | 808be8d7121901d79129ca7f6d151d06647f339a | /src/main/java/com/skb/course/apis/libraryapis/publisher/PublisherService.java | 06d107690ba83498eefaa1677466e1a82a5db5f6 | [] | no_license | bharatiyas/library-apis | b9b908b70b4c1bb491910e48571fb8f978e7748e | a993766961ae922abc32e0ebf6bef3a8e679de59 | refs/heads/develop | 2021-07-17T08:11:37.899080 | 2019-12-23T04:57:38 | 2019-12-23T04:57:38 | 220,170,522 | 7 | 6 | null | 2020-10-13T17:21:31 | 2019-11-07T06:50:34 | Java | UTF-8 | Java | false | false | 4,934 | java | package com.skb.course.apis.libraryapis.publisher;
import com.skb.course.apis.libraryapis.exception.LibraryResourceAlreadyExistException;
import com.skb.course.apis.libraryapis.exception.LibraryResourceNotFoundException;
import com.skb.course.apis.libraryapis.util.LibraryApiUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@Service
public class PublisherService {
private static Logger logger = LoggerFactory.getLogger(PublisherService.class);
private PublisherRepository publisherRepository;
public PublisherService(PublisherRepository publisherRepository) {
this.publisherRepository = publisherRepository;
}
public void addPublisher(Publisher publisherToBeAdded, String traceId)
throws LibraryResourceAlreadyExistException {
logger.debug("TraceId: {}, Request to add Publisher: {}", traceId, publisherToBeAdded);
PublisherEntity publisherEntity = new PublisherEntity(
publisherToBeAdded.getName(),
publisherToBeAdded.getEmailId(),
publisherToBeAdded.getPhoneNumber()
);
PublisherEntity addedPublisher = null;
try {
addedPublisher = publisherRepository.save(publisherEntity);
} catch (DataIntegrityViolationException e) {
logger.error("TraceId: {}, Publisher already exists!!", traceId, e);
throw new LibraryResourceAlreadyExistException(traceId, "Publisher already exists!!");
}
publisherToBeAdded.setPublisherId(addedPublisher.getPublisherid());
logger.info("TraceId: {}, Publisher added: {}", traceId, publisherToBeAdded);
}
public Publisher getPublisher(Integer publisherId, String traceId) throws LibraryResourceNotFoundException {
Optional<PublisherEntity> publisherEntity = publisherRepository.findById(publisherId);
Publisher publisher = null;
if(publisherEntity.isPresent()) {
PublisherEntity pe = publisherEntity.get();
publisher = createPublisherFromEntity(pe);
} else {
throw new LibraryResourceNotFoundException(traceId, "Publisher Id: " + publisherId + " Not Found");
}
return publisher;
}
public void updatePublisher(Publisher publisherToBeUpdated, String traceId) throws LibraryResourceNotFoundException {
Optional<PublisherEntity> publisherEntity = publisherRepository.findById(publisherToBeUpdated.getPublisherId());
Publisher publisher = null;
if(publisherEntity.isPresent()) {
PublisherEntity pe = publisherEntity.get();
if(LibraryApiUtils.doesStringValueExist(publisherToBeUpdated.getEmailId())) {
pe.setEmailId(publisherToBeUpdated.getEmailId());
}
if(LibraryApiUtils.doesStringValueExist(publisherToBeUpdated.getPhoneNumber())) {
pe.setPhoneNumber(publisherToBeUpdated.getPhoneNumber());
}
publisherRepository.save(pe);
publisherToBeUpdated = createPublisherFromEntity(pe);
} else {
throw new LibraryResourceNotFoundException(traceId, "Publisher Id: " + publisherToBeUpdated.getPublisherId() + " Not Found");
}
}
public void deletePublisher(Integer publisherId, String traceId) throws LibraryResourceNotFoundException {
try {
publisherRepository.deleteById(publisherId);
} catch(EmptyResultDataAccessException e) {
logger.error("TraceId: {}, Publisher Id: {} Not Found", traceId, publisherId, e);
throw new LibraryResourceNotFoundException(traceId, "Publisher Id: " + publisherId + " Not Found");
}
}
public List<Publisher> searchPublisher(String name, String traceId) {
List<PublisherEntity> publisherEntities = null;
if(LibraryApiUtils.doesStringValueExist(name)) {
publisherEntities = publisherRepository.findByNameContaining(name);
}
if(publisherEntities != null && publisherEntities.size() > 0) {
return createPublishersForSearchResponse(publisherEntities);
} else {
return Collections.emptyList();
}
}
private List<Publisher> createPublishersForSearchResponse(List<PublisherEntity> publisherEntities) {
return publisherEntities.stream()
.map(pe -> createPublisherFromEntity(pe))
.collect(Collectors.toList());
}
private Publisher createPublisherFromEntity(PublisherEntity pe) {
return new Publisher(pe.getPublisherid(), pe.getName(), pe.getEmailId(), pe.getPhoneNumber());
}
}
| [
"sanjayfromgomia@gmail.com"
] | sanjayfromgomia@gmail.com |
4a3b9e7f045d511bd701b8aaf7e525984af55cb2 | 1164a7b25bc864543df5164630274071701c00b6 | /src/main/java/com/square_health/blog/DAO/UserDao.java | 65c9a70c7e2f06e24d7729725cb76e5f90424666 | [
"MIT"
] | permissive | osmanhassan/blog_app | e6c3b90e0e1de31bde90e902e346a09049076243 | 63fe629ab7c68ef210bc2173fe879661b8a4f4d2 | refs/heads/master | 2023-01-21T06:24:35.726049 | 2019-09-28T05:11:46 | 2019-09-28T05:11:46 | 211,442,213 | 0 | 0 | MIT | 2023-01-14T00:55:10 | 2019-09-28T04:09:02 | Java | UTF-8 | Java | false | false | 595 | java | package com.square_health.blog.DAO;
import com.square_health.blog.Entity.UserEntity;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
@Repository
public interface UserDao extends CrudRepository<UserEntity, Long> {
UserEntity findById(int id);
Optional<UserEntity> findByEmail(String email);
UserEntity findByEmailAndPassword(String email, String password);
UserEntity findByEmailAndRoleId(String email, int roleId);
List<UserEntity> findByRoleId(int roleId);
}
| [
"hassan.osman@divine-it.net"
] | hassan.osman@divine-it.net |
33ad4c8edce1c7b4bc5721d803cf3303ca4a2a50 | 1ce59fd1715d1c2792930fa8d8077157e230c7e9 | /easyhbase-client/src/main/java/cn/easyhbase/client/hbase/exception/HbaseSystemException.java | 145eda59e80a94fbad538454f48058186d98886f | [
"Apache-2.0"
] | permissive | beihuxiansheng/easyhbase | e0ef43b77dc239339bc3b07ef21803f8570bc4ce | 63f9191f4cdc06eae42770de17a38006798b08b7 | refs/heads/master | 2020-03-28T08:57:47.122431 | 2017-07-01T13:34:45 | 2017-07-01T13:34:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,010 | java | /*
* Copyright 2011-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.easyhbase.client.hbase.exception;
import org.springframework.dao.UncategorizedDataAccessException;
/**
* HBase Data Access exception.
*
* @author Costin Leau
*/
@SuppressWarnings("serial")
public class HbaseSystemException extends UncategorizedDataAccessException {
public HbaseSystemException(Exception cause) {
super(cause.getMessage(), cause);
}
}
| [
"chenxi@hmaster.(none)"
] | chenxi@hmaster.(none) |
2e59b28f758d477a5c80eebc19752696823a120c | 369fb1910ab0aee739a247b5b5ffcea04bf54da5 | /component-orm/src/main/java/com/fty1/orm/extension/injector/methods/LogicUpdateById.java | 34df095d7563d0c29f7d6702df882c0e7c6cf4a5 | [] | no_license | Cray-Bear/starters | f0318e30c239fefd1a5079a45faf1bcc0cf34d39 | b6537789af56988bcb1d617cc4e6e1a1ef7dfc92 | refs/heads/master | 2020-04-08T11:27:42.993024 | 2019-03-24T15:15:17 | 2019-03-24T15:15:17 | 159,306,956 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,462 | java | /*
* Copyright (c) 2011-2019, hubin (jobob@qq.com).
* <p>
* 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
* <p>
* https://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.fty1.orm.extension.injector.methods;
import com.fty1.orm.core.enums.SqlMethod;
import com.fty1.orm.core.metadata.TableInfo;
import com.fty1.orm.core.toolkit.StringPool;
import com.fty1.orm.extension.injector.AbstractLogicMethod;
import com.fty1.orm.extension.plugins.OptimisticLockerInterceptor;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.SqlSource;
/**
* 根据 ID 更新有值字段
*
* @author hubin
* @since 2018-04-06
*/
public class LogicUpdateById extends AbstractLogicMethod {
@Override
public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) {
String sql;
boolean logicDelete = tableInfo.isLogicDelete();
SqlMethod sqlMethod = SqlMethod.UPDATE_BY_ID;
StringBuilder append = new StringBuilder("<if test=\"et instanceof java.util.Map\">")
.append("<if test=\"et.").append(OptimisticLockerInterceptor.MP_OPTLOCK_VERSION_ORIGINAL).append("!=null\">")
.append(" AND ${et.").append(OptimisticLockerInterceptor.MP_OPTLOCK_VERSION_COLUMN)
.append("}=#{et.").append(OptimisticLockerInterceptor.MP_OPTLOCK_VERSION_ORIGINAL).append(StringPool.RIGHT_BRACE)
.append("</if></if>");
if (logicDelete) {
append.append(tableInfo.getLogicDeleteSql(true, false));
}
sql = String.format(sqlMethod.getSql(), tableInfo.getTableName(),
sqlSet(logicDelete, false, tableInfo, false, ENTITY, ENTITY_DOT),
tableInfo.getKeyColumn(), ENTITY_DOT + tableInfo.getKeyProperty(),
append);
SqlSource sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass);
return addUpdateMappedStatement(mapperClass, modelClass, sqlMethod.getMethod(), sqlSource);
}
}
| [
"1798900899@qq.com"
] | 1798900899@qq.com |
2c7d089e8ba63dedde49cd8792ee5723ba968036 | 3cb00a0ba42bcfe7b7b4e5dcdac69ed28e896ae4 | /app/src/main/java/com/dicoding/assosiate/barvolume/MainActivity.java | c7771db92ed2bfd7c3376733979d7b9954fdcf8a | [] | no_license | Raincember26/App-Hitung-Volume-Sederhana | e37aabdce4ca43fa2a51b34c0cc40998b4d95b7b | 123aa09f05106587f8588bc6937a00ec2b65ca7d | refs/heads/master | 2022-11-16T07:55:41.237194 | 2018-08-21T10:16:14 | 2018-08-21T10:16:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,524 | java | package com.dicoding.assosiate.barvolume;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity implements View.OnClickListener{
private EditText Width, Height, Length;
private Button Calculate;
private TextView tvResult;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Width = (EditText)findViewById(R.id.edt_width);
Height = (EditText)findViewById(R.id.edt_height);
Length = (EditText)findViewById(R.id.edt_length);
Calculate = (Button)findViewById(R.id.btn_calculate);
tvResult = (TextView)findViewById(R.id.tv_result);
Calculate.setOnClickListener(this);
if (savedInstanceState != null){
String hasil = savedInstanceState.getString(STATE_HASIL);
tvResult.setText(hasil);
}
}
@Override
public void onClick(View v) {
if (v.getId() == R.id.btn_calculate){
String length = Length.getText().toString().trim();
String width = Width.getText().toString().trim();
String height = Height.getText().toString().trim();
boolean isEmptyFields = false;
if (TextUtils.isEmpty(length)){
isEmptyFields = true;
Length.setError("Field ini tidak boleh kosong");
}
if (TextUtils.isEmpty(width)){
isEmptyFields = true;
Width.setError("Field ini tidak boleh kosong");
}
if (TextUtils.isEmpty(height)){
isEmptyFields = true;
Height.setError("Field ini tidak boleh kosong");
}
if (!isEmptyFields) {
double l = Double.parseDouble(length);
double w = Double.parseDouble(width);
double h = Double.parseDouble(height);
double volume = l * w * h;
tvResult.setText(String.valueOf(volume));
}
}
}
private static final String STATE_HASIL = "state_hasil";
@Override
protected void onSaveInstanceState(Bundle outState) {
outState.putString(STATE_HASIL, tvResult.getText().toString());
super.onSaveInstanceState(outState);
}
} | [
"windawan26@gmail.com"
] | windawan26@gmail.com |
da07e0c6fa99a9da0d86fa4c2a517880132017ed | f56654ab6fead71cf2ed88e1992699532f0e1218 | /src/it/ecc/main/Main.java | cd75b87a79b4d1cbb816810e50fb2347f49c1613 | [] | no_license | easycloudcompany/normalizzatore_numeri_telefonici | 23fe85b1cae4d0f53222bf9d9d771672857504ef | 30f68f66ae4e6501f4802decedd86b62c80d83a6 | refs/heads/master | 2020-06-03T20:38:26.658427 | 2019-06-13T10:23:01 | 2019-06-13T10:23:01 | 191,722,782 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,821 | java | package it.ecc.main;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
try {
System.out.print("Enter the file name with extension : ");
Scanner tastiera = new Scanner(System.in);
File file = new File(tastiera.nextLine());
tastiera.close();
Scanner input = new Scanner(file);
List<String> errori = new ArrayList<>();
List<String> normalizzati = new ArrayList<>();
List<String> duplicati = new ArrayList<>();
Map<String,String> duplicatiHM = new HashMap<>();
while (input.hasNextLine()) {
String line = normalizePhoneNumber(input.nextLine());
if(line.contains("ERROR")){
errori.add(line);
}else{
if(duplicatiHM.get(line) != null){
duplicati.add(line);
}else{
normalizzati.add(line);
duplicatiHM.put(line, line);
}
}
}
input.close();
System.out.println("NUMERI ERRATI: " + errori.size());
for (String err : errori) {
System.out.println(err);
}
System.out.println("\n\nNUMERI DUPLICATI: " + duplicati.size());
for (String dup : duplicati) {
System.out.println(dup);
}
System.out.println("\n\nNUMERI OK: " + normalizzati.size());
for (String ok : normalizzati) {
System.out.println(ok);
}
System.out.println("\n\n--------------------------");
System.out.println("NUMERI ERRATI: " + errori.size());
System.out.println("NUMERI DUPLICATI: " + duplicati.size());
System.out.println("NUMERI OK: " + normalizzati.size());
System.out.println("--------------------------");
} catch (Exception ex) {
ex.printStackTrace();
}
}
private static String normalizePhoneNumber(String number) {
try{
number = number.replaceAll("[^+0-9]", ""); // All weird characters such as /, -, ...
if(number.length()==10 || number.length()==9 ){
number = "+39" + number;
}else if(number.substring(0, 3).contains("+39")){
return number;
}else{
number = "ERROR " + number;
}
}catch (Exception e) {
if(number.length()>0){
number = "ERROR " + number;
}
}
if(number.equalsIgnoreCase("")){
return "ERROR - Empty row " + number;
}else{
return number;
}
}
}
| [
"andrea.easycloud@gmail.com"
] | andrea.easycloud@gmail.com |
b7968da3effcd133a51b980117a0e9fca2d978af | c48f357f046e4c90ab550f1af412e6180208bd19 | /src/main/java/com/wt/study/design/pattern/creational/factorymethod/JavaVideoFactory.java | d97918735e7652a868d3883815387107e5b528f0 | [] | no_license | lichking2018/demo-mode | 1bad474b4ef2d161c2479703858a9c970ae59975 | 917c2827a4d0cfca8ae84ab75493ff62238a7d18 | refs/heads/master | 2020-04-12T10:48:03.665007 | 2019-04-11T02:50:20 | 2019-04-11T02:50:20 | 162,441,235 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 417 | java | package com.wt.study.design.pattern.creational.factorymethod;
/**
* @ProjectName: idea
* @Package: com.wt.study.design.pattern.creational.factorymethod
* @Description: java视频工厂
* @Author: lichking2017@aliyun.com
* @CreateDate: 2019/1/13 8:47 PM
* @Version: v1.0
*/
public class JavaVideoFactory extends VideoFactory{
@Override
public Video getVideo() {
return new JavaVedio();
}
}
| [
"lichking2018@aliyun.com"
] | lichking2018@aliyun.com |
f44f7ed3ec4736bfae87d81ca6dbc29873d0339e | f2468a53b5c1c29b5348e063c2a60ef05c09e099 | /src/main/java/com/yibo/designpattern/creational/singleton/ThreadLocalInstance.java | 11e93a31fa2ebe852bbf8fc2fd11a5334dde991a | [] | no_license | jjhyb/design-pattern | 707d736c5076aa117a5691e2be67a4f65a6fd76d | a5a0672c5032db13ba6f48499d6b7faf262d5ebb | refs/heads/master | 2022-06-10T15:16:08.840020 | 2020-05-01T16:19:37 | 2020-05-01T16:19:37 | 260,504,237 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 594 | java | package com.yibo.designpattern.creational.singleton;
/**
* @author: huangyibo
* @Date: 2020/4/6 22:46
* @Description: 保证同一线程拿到的是同一个实例
*/
public class ThreadLocalInstance {
private static final ThreadLocal<ThreadLocalInstance> threadLocal = new ThreadLocal<ThreadLocalInstance>(){
@Override
protected ThreadLocalInstance initialValue() {
return new ThreadLocalInstance();
}
};
private ThreadLocalInstance(){
}
public static ThreadLocalInstance getInstance(){
return threadLocal.get();
}
}
| [
"718649016@qq.com"
] | 718649016@qq.com |
86a5cf67499e127d27af7bf51f2b69e9c2726e59 | 5ea3d316c9cf7bff2c5c6fad21f7db8cf9038968 | /core/src/main/java/de/gerrygames/viarewind/utils/ServerSender.java | 7a21ed37f7431bca8e5f79623663a750cb1b6d5c | [
"MIT"
] | permissive | creeper123123321/ViaRewind | f3bd373d25e8489642f4a5365be2c2c69736840d | d30537446ef58aa73acad67f262d24a33efd1fa8 | refs/heads/master | 2021-06-11T05:17:24.255262 | 2021-02-15T21:36:42 | 2021-02-15T21:36:42 | 121,270,988 | 0 | 0 | MIT | 2018-02-12T17:59:27 | 2018-02-12T16:24:24 | Java | UTF-8 | Java | false | false | 326 | java | package de.gerrygames.viarewind.utils;
import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.protocol.Protocol;
public interface ServerSender {
void sendToServer(PacketWrapper packet, Class<? extends Protocol> packetProtocol, boolean skipCurrentPipeline, boolean currentThread) throws Exception;
}
| [
"guenterwalklol@aim.com"
] | guenterwalklol@aim.com |
fdfe524c5a4df2455fbabad738105252fe663df3 | e78f253ece8f58288eb0cd10003ffe04b742983a | /src/safristas/bo/VariedadeBO.java | 5710a1c57a32c170b48e2a03681f267d6abb436b | [] | no_license | GabrielZulian/fructus_first | f927658bd22cd7cf824e8f1bf86e05476b4dc3a9 | ab254245ddea32cd3b7d070f276e69176b8e2d0c | refs/heads/master | 2022-11-17T10:57:57.334543 | 2020-07-07T17:49:39 | 2020-07-07T17:49:39 | 84,872,060 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 718 | java | package safristas.bo;
import exceptions.CodigoErradoException;
import exceptions.StringVaziaException;
public class VariedadeBO {
int codigo;
String descricao;
public VariedadeBO() {
this.codigo = 0;
this.descricao = "";
}
public int getCodigo() {
return codigo;
}
public void setCodigo(int codigo) throws CodigoErradoException {
if (codigo < 0)
throw new CodigoErradoException();
else
this.codigo = codigo;
}
public String getDescricao() {
return descricao;
}
public void setDescricao(String descricao) throws StringVaziaException {
if (descricao.equals(""))
throw new StringVaziaException();
else
this.descricao = descricao;
}
}
| [
"gzulian95@gmail.com"
] | gzulian95@gmail.com |
4fe96c3aa0405497b375438cce00ec0e6d690719 | d3eacae8754acb4355d19987839615ad5ad02560 | /Bank.java | 85764bef9bc0fa080bec202dc73f08221146719a | [] | no_license | MariyaYo/Bank | 382e1e3e69d8b0bdeaabc1aab88269c1e5c2a673 | b457e5652084842f2126c89884b35afec561ab6e | refs/heads/master | 2021-01-14T08:23:11.832269 | 2017-02-14T14:38:27 | 2017-02-14T14:38:27 | 81,954,415 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,172 | java | import java.util.ArrayList;
public class Bank {
private String name;
private String adress;
private ArrayList<Products> products;
private double money;
Bank(String name, String adress, double money) {
this.name = name;
this.adress = adress;
this.money = money;
products = new ArrayList<>();
}
void acceptDeposit(Deposit a) {
this.money += a.getMoney();
products.add(a);
}
void payDepositLihvi(Deposit a) {// this name is the best name ever
if (a.getDuration() > 0) {
a.setMoney(a.amountTOPay());
a.setDuration(a.getDuration()-1);
} else {
a.getClient().setMoney(a.getMoney());
a = null;
}
}
boolean acceptCredit(Credit a) {
if (this.checkMyMoney(a.getMoney()) && a.getClient().getSalary() / 2 > a.getMoney()) {
products.add(a);
return true;
}
return false;
}
public boolean checkMyMoney(double money) {
double moneyToCompareTo = 0;
for (Products a : products) {
if (a instanceof Deposit) {
Deposit b = (Deposit) a;
moneyToCompareTo += b.getMoney();
}
}
if (this.money > moneyToCompareTo / 10) {
return true;
}
return false;
}
public double getMoney() {
return money;
}
}
| [
"black__sea@abv.bg"
] | black__sea@abv.bg |
77c5f6468b66f0f8d8f130f9a9f40f820c96d4aa | 500c6c4a9cbb1dce692ddd471f035f0c2efd1d6e | /Codeeval/moderate/StackImplementation/Main.java | 59405ee4404d3e498b528ffbc21e6cfee5ad0d3d | [] | no_license | ayemos/algorithm | c31a0ac7ad3ee18aa626ff0d99f95f797b32fe68 | a68eb1bd3941a4809fdf417c0a082a1869782004 | refs/heads/master | 2021-01-21T13:25:42.648835 | 2016-06-03T06:16:49 | 2016-06-03T06:16:49 | 30,368,227 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 894 | java | import java.io.*;
import java.util.Deque;
import java.util.LinkedList;
public class Main {
public static void main (String[] args) throws IOException {
File file = new File(args[0]);
BufferedReader buffer = new BufferedReader(new FileReader(file));
String line;
Deque<Integer> stack = new LinkedList<Integer>();
while ((line = buffer.readLine()) != null) {
line = line.trim();
String[] nums = line.split(" ");
for(int i = 0; i < nums.length; i++)
stack.addFirst(Integer.parseInt(nums[i]));
while(!stack.isEmpty()) {
System.out.print(stack.removeFirst());
if(!stack.isEmpty()) {
stack.removeFirst();
System.out.print(" ");
}
}
System.out.println("");
}
}
}
| [
"ayemos.y@gmail.com"
] | ayemos.y@gmail.com |
68797ba59e55840225c80cdb9badf4609c33c794 | edb94a643722b3878c0f16f80f6ac8293073969b | /MyBlog/src/com/example/test/DaoTest.java | b1c84222cdfb872a83d85806906b71f95b4377ef | [] | no_license | dome2073/study_jsp | f54ddd75bf95ad03cf0e49da74b6938eca8d1c55 | 0af5d523979a23f29ae279362a02696b5a00c606 | refs/heads/master | 2022-12-29T19:00:08.282014 | 2020-10-12T10:28:29 | 2020-10-12T10:28:29 | 288,119,808 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,464 | java | package com.example.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import org.junit.Test;
import com.example.dao.UserDao;
import com.example.model.User;
import com.example.util.ApplicationListener;
public class DaoTest {
UserDao udao = UserDao.getInstance();
ServletContextEvent sce;
@Test
void ii() {
System.out.println("zz");
}
@Test
void user_insert() {
System.out.println("zz");
ApplicationListener ac = new ApplicationListener();
ac.contextInitialized(sce);
UserDao udao = UserDao.getInstance();
//insert시(회원가입) 주의사항
//1. 데이터가 notnull필드에 null값이 들어오면 안된다
User u = new User(null, "1234", "정대윤", "wjdeodbs@aaa.com");
assertEquals(udao.insertUser(u), -1);
u = new User("user01", "1234", null, "abc@abc.com");
assertEquals(udao.insertUser(u), -1);
u = new User("user01", "1234", "정대윤", "abc@abc.com");
assertEquals(udao.insertUser(u), 1);
String selectID = udao.selectUserInfo(u.getUser_id()).getUser_id();
assertTrue(selectID.equals("user01"));
udao.deleteUser(selectID);
//2. pk가 중복되는(id)값이 들어오면 안된다.
u = new User("user01", "1234", "정대윤", "abc@abc.com");
udao.insertUser(u);
int in_Result = udao.insertUser(u);
assertTrue(in_Result == -1); //사실 select로 조회 후 insert하는게 맞음
udao.deleteUser(u.getUser_id());
//3. 필드에 유효한 값이 들어와야한다.
u = new User("user010101010101010010101", "1234", "정대윤", "abc@abc.com");
//js에서 정규화처리 해야함
in_Result = udao.insertUser(u);
assertTrue(in_Result == -1);
ac.contextInitialized(sce);
// User u = new User("aaa001", "1234", "정대윤", "wjdeodbs@aaa.com");
// User u = new User();
}
@Test
void user_update() {
//update시 주의사항
//1. 변경할 값이 있어야한다.
//2. where절 값이 생략되면 안된다.
//3. not null값을 null로 바꾸면 안된다.
User u = new User("aaa001", "1234", "정대윤", "wjdeodbs@aaa.com");
udao.insertUser(u);
System.out.println("변경 전 : " +udao.selectUser("aaa001"));
User u2 = new User("aaa001", "1234567", "정대윤123", "wjdeodbs@aaa.com");
udao.updateUser(u2); //예제는 아이디를 바꾸는것이여서.. //이름변경으로..
//이름만 변경하는것으로..
System.out.println("변경 후 "+ udao.selectUser(u2.getUser_id()));
assertTrue(udao.selectUserInfo(u2.getUser_id()).getUser_name().equals(u2.getUser_name()));
udao.deleteUser(u2.getUser_id());
}
@Test
void user_select() {
User user = new User();
// user = udao.selectUser("test111");
System.out.println(user);
}
@Test
void user_login() {
// String myinput_id = "";
// String password ="";
// assertEquals(udao.selectUserOne(myinput_id, password), 0);
//아이디랑 비밀번호가 틀렸을 경우
String myinput_id = "eodbs11";
String password = "1234";
assertEquals(udao.selectUserOne(myinput_id, password), 0);
//아이디랑 비밀번호가 일치할 경우
myinput_id = "test111";
password = "1234";
assertEquals(udao.selectUserOne(myinput_id, password), 1);
}
@Test
void user_delete() {
udao.deleteUser("test116");
System.out.println(udao.selectAllUsers());
}
}
| [
"wlgns2073@gmail.com"
] | wlgns2073@gmail.com |
2c7bb4662e9dd658f87b5bc6ace513bda9636627 | 69a4f2d51ebeea36c4d8192e25cfb5f3f77bef5e | /methods/Method_54341.java | cdc2c702861416f519d2acaef4924059803c6e94 | [] | no_license | P79N6A/icse_20_user_study | 5b9c42c6384502fdc9588430899f257761f1f506 | 8a3676bc96059ea2c4f6d209016f5088a5628f3c | refs/heads/master | 2020-06-24T08:25:22.606717 | 2019-07-25T15:31:16 | 2019-07-25T15:31:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 140 | java | /**
* Returns the value of the {@code numBlit} field.
*/
@NativeType("uint32_t") public int numBlit(){
return nnumBlit(address());
}
| [
"sonnguyen@utdallas.edu"
] | sonnguyen@utdallas.edu |
02d3d04c38c81b39215984b114ec570b2586d7f5 | 20bd01e3b419cf0b3668058794e5abc1bbf294bc | /16_case_study_JSP&Servlet/src/model/DTO_khach_hang_dich_vu.java | c9a9c7f963510127d6988799b8ac80af889063e0 | [] | no_license | huyduong155/C0420G1-DuongNhatHuy-Module3 | 4fe94a23524157c021905f85c3e47c9d174347a1 | 35661270f8e6ef69275e1b79106548d1312c9e83 | refs/heads/master | 2022-12-01T14:04:22.807730 | 2020-08-14T12:57:47 | 2020-08-14T12:57:47 | 279,249,097 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,308 | java | package model;
public class DTO_khach_hang_dich_vu {
private int id_khach_hang;
private String ten_khach_hang;
private String ten_dich_vu;
private String ten_dich_vu_di_kem;
public DTO_khach_hang_dich_vu() {
}
public DTO_khach_hang_dich_vu(int id_khach_hang, String ten_khach_hang, String ten_dich_vu, String ten_dich_vu_di_kem) {
this.id_khach_hang = id_khach_hang;
this.ten_khach_hang = ten_khach_hang;
this.ten_dich_vu = ten_dich_vu;
this.ten_dich_vu_di_kem = ten_dich_vu_di_kem;
}
public int getId_khach_hang() {
return id_khach_hang;
}
public void setId_khach_hang(int id_khach_hang) {
this.id_khach_hang = id_khach_hang;
}
public String getTen_khach_hang() {
return ten_khach_hang;
}
public void setTen_khach_hang(String ten_khach_hang) {
this.ten_khach_hang = ten_khach_hang;
}
public String getTen_dich_vu() {
return ten_dich_vu;
}
public void setTen_dich_vu(String ten_dich_vu) {
this.ten_dich_vu = ten_dich_vu;
}
public String getTen_dich_vu_di_kem() {
return ten_dich_vu_di_kem;
}
public void setTen_dich_vu_di_kem(String ten_dich_vu_di_kem) {
this.ten_dich_vu_di_kem = ten_dich_vu_di_kem;
}
}
| [
"nhathuy.155@gmail.com"
] | nhathuy.155@gmail.com |
1f7608c053e3add10b7815f41482eeb5448065a9 | 9692196f5b61a63a7305977d072091c52ff6d02d | /springboot-server/src/main/java/com/yao/project/system/dict/domain/DictType.java | 49c2d2c70fe648650c7dfa27173ca6c2bc6410b0 | [] | no_license | 1445103710/yaoyao-yun | 054940612a3f6724e4e29bd3f95de7db335ab3b8 | 59744f12c99596d69a8138d35b7a0b9bd52b4e6d | refs/heads/master | 2020-03-26T03:12:53.838685 | 2018-09-18T16:35:48 | 2018-09-18T16:35:48 | 144,444,897 | 0 | 0 | null | 2018-08-27T02:03:50 | 2018-08-12T06:54:56 | JavaScript | UTF-8 | Java | false | false | 1,488 | java | package com.yao.project.system.dict.domain;
import com.yao.framework.aspectj.lang.annotation.Excel;
import com.yao.framework.web.domain.BaseEntity;
/**
* 字典类型对象 sys_dict_type
*
* @author yao
*/
public class DictType extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 字典主键 */
@Excel(name = "字典主键")
private Long dictId;
/** 字典名称 */
@Excel(name = "字典名称")
private String dictName;
/** 字典类型 */
@Excel(name = "字典类型 ")
private String dictType;
/** 状态(0正常 1停用) */
@Excel(name = "状态")
private String status;
public Long getDictId()
{
return dictId;
}
public void setDictId(Long dictId)
{
this.dictId = dictId;
}
public String getDictName()
{
return dictName;
}
public void setDictName(String dictName)
{
this.dictName = dictName;
}
public String getDictType()
{
return dictType;
}
public void setDictType(String dictType)
{
this.dictType = dictType;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
@Override
public String toString()
{
return "DictType [dictId=" + dictId + ", dictName=" + dictName + ", dictType=" + dictType + ", status=" + status
+ "]";
}
}
| [
"15656009880@163.com"
] | 15656009880@163.com |
0a29687d2d348bdabaa8005820b0d407e73b1faa | 27b052c54bcf922e1a85cad89c4a43adfca831ba | /src/lP.java | a6a011913fb98204b75570ddb225d52bf4a82fc2 | [] | no_license | dreadiscool/YikYak-Decompiled | 7169fd91f589f917b994487045916c56a261a3e8 | ebd9e9dd8dba0e657613c2c3b7036f7ecc3fc95d | refs/heads/master | 2020-04-01T10:30:36.903680 | 2015-04-14T15:40:09 | 2015-04-14T15:40:09 | 33,902,809 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,540 | java | import android.os.IBinder;
class lP
implements lN
{
private IBinder a;
lP(IBinder paramIBinder)
{
this.a = paramIBinder;
}
/* Error */
public void a(com.google.android.gms.maps.model.StreetViewPanoramaOrientation paramStreetViewPanoramaOrientation)
{
// Byte code:
// 0: invokestatic 22 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore_2
// 4: invokestatic 22 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 7: astore_3
// 8: aload_2
// 9: ldc 24
// 11: invokevirtual 28 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 14: aload_1
// 15: ifnull +41 -> 56
// 18: aload_2
// 19: iconst_1
// 20: invokevirtual 32 android/os/Parcel:writeInt (I)V
// 23: aload_1
// 24: aload_2
// 25: iconst_0
// 26: invokevirtual 38 com/google/android/gms/maps/model/StreetViewPanoramaOrientation:writeToParcel (Landroid/os/Parcel;I)V
// 29: aload_0
// 30: getfield 15 lP:a Landroid/os/IBinder;
// 33: iconst_1
// 34: aload_2
// 35: aload_3
// 36: iconst_0
// 37: invokeinterface 44 5 0
// 42: pop
// 43: aload_3
// 44: invokevirtual 47 android/os/Parcel:readException ()V
// 47: aload_3
// 48: invokevirtual 50 android/os/Parcel:recycle ()V
// 51: aload_2
// 52: invokevirtual 50 android/os/Parcel:recycle ()V
// 55: return
// 56: aload_2
// 57: iconst_0
// 58: invokevirtual 32 android/os/Parcel:writeInt (I)V
// 61: goto -32 -> 29
// 64: astore 4
// 66: aload_3
// 67: invokevirtual 50 android/os/Parcel:recycle ()V
// 70: aload_2
// 71: invokevirtual 50 android/os/Parcel:recycle ()V
// 74: aload 4
// 76: athrow
// Local variable table:
// start length slot name signature
// 0 77 0 this lP
// 0 77 1 paramStreetViewPanoramaOrientation com.google.android.gms.maps.model.StreetViewPanoramaOrientation
// 3 68 2 localParcel1 android.os.Parcel
// 7 60 3 localParcel2 android.os.Parcel
// 64 11 4 localObject Object
// Exception table:
// from to target type
// 8 47 64 finally
// 56 61 64 finally
}
public IBinder asBinder()
{
return this.a;
}
}
/* Location: C:\Users\dreadiscool\Desktop\tools\classes-dex2jar.jar
* Qualified Name: lP
* JD-Core Version: 0.7.0.1
*/ | [
"paras@protrafsolutions.com"
] | paras@protrafsolutions.com |
857c6580827e9d27de9f9132c51416247934fe98 | f8e10059feffe9d8a9b531d078bf99eed9af33af | /HeatClinic/src/test/java/com/atmecs/testscripts/HomePageAutomationScripts.java | bde21f08d2ba45b616d26b39cea55ea018a1d65d | [] | no_license | unnamalaisenthilnathan/Assignment1 | 39d22fa723a446b11a4c195915c2054b283741c6 | ead510b4d46cf472176a1620381614a807d75c88 | refs/heads/master | 2022-12-21T11:58:30.921368 | 2019-08-26T08:09:38 | 2019-08-26T08:09:38 | 190,428,117 | 0 | 0 | null | 2022-12-16T05:00:20 | 2019-06-05T16:15:16 | Rich Text Format | UTF-8 | Java | false | false | 1,083 | java | package com.atmecs.testscripts;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import com.atmecs.logreports.LogReportInformation;
import com.atmecs.testsuite.TestBase;
import com.atmecs.util.CommonUtilities;
public class HomePageAutomationScripts extends TestBase {
WebDriver driver;
LogReportInformation log=new LogReportInformation();
@BeforeTest
public void setup()
{
this.driver = invokeBrowser();
String baseUrl = configProps.getProperty("applicationurl");
driver.get(baseUrl);
this.driver = windowOperation();
}
@Test
public void homepage()
{
CommonUtilities obj=new CommonUtilities ();
obj.assertion(driver, menuprops.getProperty("loc_home_menu"), "HOME");
obj.click(driver, menuprops.getProperty("loc_home_shopforapparel_btn"));
log.info("Title is: "+driver.getTitle());
driver.navigate().back();
obj.click(driver, menuprops.getProperty("loc_home_hotsauceaficionadotxt"));
}
@AfterTest
public void teardown()
{
driver.quit();
}
}
| [
"unnamalai.senthilnathan@atmecs.com"
] | unnamalai.senthilnathan@atmecs.com |
58ea758be692b1852f7c83a7ff4bf8848027b556 | 1325cc190c5d0633ad03ef028f4ab8bf5a52c095 | /src/ClassKeduaExtendsPertama.java | a1673bb5c6af8e17f718106f7d3ea3316a747303 | [] | no_license | arfinadevi28/PBO-Inheritance | a88f9ab5678271043a2d628565733c2d21a1f4f0 | 4869b82ac778f5877e255023b860afd980792dd8 | refs/heads/master | 2020-08-30T06:49:43.016234 | 2019-10-29T14:08:11 | 2019-10-29T14:08:11 | 218,296,385 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 412 | 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.
*/
/**
*
* @author ARVINA
*/
public class ClassKeduaExtendsPertama {
private int b = 8;
protected void BacaSuper ()
{
System.out.println ("Nilai b :"+b);
terprotek ();
info ();
}
}
| [
"you@example.com"
] | you@example.com |
963793862511811f7e3ed947278eb7caa6694da7 | b25911c6c906eab91aba19561777c59644bcb45f | /core/src/main/java/com/novoda/accessibility/ActionsMenuInflater.java | a21eef90527955623df195ff57b9880f11f49c5e | [
"Apache-2.0"
] | permissive | ataulm/accessibilitools | 3fcf31382088dcc7ef661776caf238b3f2c6a761 | 91983e7986b6476f8d052e1e2eb7d72be5dc1eb2 | refs/heads/master | 2020-03-24T11:56:22.886289 | 2018-04-20T15:26:53 | 2018-04-20T15:26:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,148 | java | package com.novoda.accessibility;
import android.content.Context;
import android.content.res.Resources;
import android.support.annotation.MenuRes;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
public class ActionsMenuInflater {
private final MenuInflater menuInflater;
private final Resources resources;
public static ActionsMenuInflater from(Context context) {
MenuInflater menuInflater = new MenuInflater(context);
Resources resources = context.getResources();
return new ActionsMenuInflater(menuInflater, resources);
}
private ActionsMenuInflater(MenuInflater menuInflater, Resources resources) {
this.menuInflater = menuInflater;
this.resources = resources;
}
public Menu inflate(@MenuRes int menuRes, MenuItem.OnMenuItemClickListener menuItemClickListener) {
ActionsMenu menu = new ActionsMenu(resources);
for (int i = 0; i < menu.size(); i++) {
menu.getItem(i).setOnMenuItemClickListener(menuItemClickListener);
}
menuInflater.inflate(menuRes, menu);
return menu;
}
}
| [
"hello@ataulm.com"
] | hello@ataulm.com |
d43a36e5090f0965be5a909a5b70510d4ffa660e | 5e668d4e9b2e1bbddffce90664ae3d4eacc10745 | /Algorithms/217. Contains Duplicate.java | 24e8852ab19fe7df51d836a80d07c191d111bbf7 | [] | no_license | XinxinHuang1/Leetcode-xinxin | e3df729b64fcd8bdfe47e5f2054e294acc4a7d68 | e49119ccb301612ffdb84d8804fb0b314c8b1178 | refs/heads/master | 2021-07-16T09:17:09.058836 | 2020-06-11T17:36:08 | 2020-06-11T17:36:08 | 174,383,817 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,065 | java | //source: https://leetcode.com/problems/contains-duplicate/
//Easy
//Array
//Date: May 16 2019
/*
Given an array of integers, find if the array contains any duplicates.
Your function should return true if any value appears at least twice in the array, and it should return false if every element is distinct.
Example 1:
Input: [1,2,3,1]
Output: true
Example 2:
Input: [1,2,3,4]
Output: false
Example 3:
Input: [1,1,1,3,3,4,3,2,4,2]
Output: true
*/
//runtime 3ms, beats 99%
class Solution {
public boolean containsDuplicate(int[] nums) {
Arrays.sort(nums);
for(int i = 0; i < nums.length - 1; i++){
if(nums[i] == nums[i+1])
return true;
}
return false;
}
}
//runtime 355ms, beats 5%
class Solution {
public boolean containsDuplicate(int[] nums) {
int n = nums.length;
for(int i = 0; i < n; i++){
for(int j = i+1; j < n; j++){
if(nums[i] == nums[j])
return true;
}
}
return false;
}
}
| [
"huang.xinx@husky.neu.edu"
] | huang.xinx@husky.neu.edu |
4b8900470fdebf549f3c93163df9643c5f129463 | 5690bd5a155ec00eddff0d6fb0bc4f27ecb86ba9 | /src/lesson5/Main.java | 407b48802f82c3a5e97c66847d25aa352de5bb87 | [] | no_license | deminut/cour | 2cd2040b5647e7879045728a80b14c3601733c84 | 7c9047ea42111bec63ba5f456f15dcaace37b39b | refs/heads/master | 2020-05-05T04:31:05.812011 | 2019-05-22T17:43:00 | 2019-05-22T17:43:00 | 179,715,001 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,148 | java | package lesson5;
public class Main {
public static void main(String[] args) {
// Worker worker = new Worker();
// worker.example();
//
// Person person1 = new Person();
// person1.doWork();
// worker.doWork();
Person person2 = new Worker();
Person person1 = new Person();
Worker worker = new Worker();
person2.doWork();
person1.doWork();
worker.doWork();
System.out.println(person2.a);
System.out.println(person1.a);
System.out.println(worker.a);
// System.out.println(person1 instanceof Person);
// System.out.println(person2 instanceof Person);
// System.out.println(worker instanceof Person);
// System.out.println();
// System.out.println(person1 instanceof Worker);
// System.out.println(person2 instanceof Worker);
// System.out.println(worker instanceof Worker);
// System.out.println();
// System.out.println(person1 instanceof Worker);
// System.out.println(person1 instanceof Worker);
// System.out.println(worker instanceof Worker);
}
}
| [
"deminut@gmail.com"
] | deminut@gmail.com |
3194e4dea04ff5054433f792ca0b998a90407040 | 3621ef8769a426add70dce3ff8649081bbd037e7 | /olingo/olingo-odata4-jpa/src/main/java/com/cairone/olingo/ext/jpa/visitors/BaseExpressionVisitor.java | f0851460ecc3a7195394d954e824378c10c43115 | [] | no_license | XavierWD/olingo-odata4-jpa-ext | fe75ddc74c564c3b36d1984092200210456a5800 | 95f73169d9270c6ab71812ea9e9f7e527130eb15 | refs/heads/master | 2020-05-27T15:18:47.204940 | 2019-01-15T18:56:58 | 2019-01-15T18:56:58 | 188,678,294 | 0 | 0 | null | 2019-05-26T12:10:22 | 2019-05-26T12:10:22 | null | UTF-8 | Java | false | false | 10,379 | java | package com.cairone.olingo.ext.jpa.visitors;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.olingo.commons.api.edm.EdmEnumType;
import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.server.api.ODataApplicationException;
import org.apache.olingo.server.api.uri.queryoption.expression.BinaryOperatorKind;
import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitException;
import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitor;
import org.apache.olingo.server.api.uri.queryoption.expression.Literal;
import org.apache.olingo.server.api.uri.queryoption.expression.Member;
import org.apache.olingo.server.api.uri.queryoption.expression.MethodKind;
import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind;
import com.cairone.olingo.ext.jpa.interfaces.OdataExtendedEnum;
import com.google.common.base.CharMatcher;
import com.querydsl.core.types.Constant;
import com.querydsl.core.types.Expression;
import com.querydsl.core.types.Path;
import com.querydsl.core.types.Predicate;
import com.querydsl.core.types.dsl.BooleanExpression;
import com.querydsl.core.types.dsl.BooleanOperation;
import com.querydsl.core.types.dsl.BooleanPath;
import com.querydsl.core.types.dsl.DatePath;
import com.querydsl.core.types.dsl.EnumPath;
import com.querydsl.core.types.dsl.Expressions;
import com.querydsl.core.types.dsl.NumberPath;
import com.querydsl.core.types.dsl.SimpleExpression;
import com.querydsl.core.types.dsl.StringPath;
public abstract class BaseExpressionVisitor implements ExpressionVisitor<Expression<?>> {
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public Expression<?> visitBinaryOperator(BinaryOperatorKind operator, Expression<?> left, Expression<?> right) throws ExpressionVisitException, ODataApplicationException {
if(right == null && left != null && left instanceof Path<?>) {
SimpleExpression<?> expression = (SimpleExpression<?>) left;
return operator.equals(BinaryOperatorKind.EQ) ? expression.isNull() : operator.equals(BinaryOperatorKind.NE) ? expression.isNotNull() : null;
}
switch(operator) {
case HAS:
if(right instanceof Constant<?>) {
Constant<?> constant = (Constant<?>) right;
if(Collection.class.isAssignableFrom(constant.getType())) {
List<Enum<?>> enumList = (List<Enum<?>>) constant.getConstant();
if(left instanceof EnumPath<?>) {
EnumPath path = (EnumPath) left;
Predicate filter = path.in(enumList);
return filter;
} else {
List<?> odataExtendedEnums = enumList.stream()
.map(e -> {
OdataExtendedEnum<?,?> odataExtendedEnum = (OdataExtendedEnum<?,?>) e;
return odataExtendedEnum.getAsPrimitive();
})
.collect(Collectors.toList());
SimpleExpression path = (SimpleExpression<?>) left;
Predicate filter = path.in(odataExtendedEnums);
return filter;
}
}
}
break;
case EQ:
case NE:
case GT:
case GE:
case LT:
case LE:
if(right instanceof Constant<?>) {
Constant<?> constant = (Constant<?>) right;
if(constant.getType().isAssignableFrom(Integer.class)) {
NumberPath<Integer> path = (NumberPath<Integer>) left;
Integer value = right == null ? null : (Integer) constant.getConstant();
Predicate filter = operator.equals(BinaryOperatorKind.EQ) ? path.eq(value)
: operator.equals(BinaryOperatorKind.NE) ? path.ne(value)
: operator.equals(BinaryOperatorKind.GT) ? path.gt(value)
: operator.equals(BinaryOperatorKind.GE) ? path.goe(value)
: operator.equals(BinaryOperatorKind.LT) ? path.lt(value)
: operator.equals(BinaryOperatorKind.LE) ? path.loe(value) : null;
return filter;
} else if (constant.getType().isAssignableFrom(Long.class)) {
NumberPath<Long> path = (NumberPath<Long>) left;
Long value = right == null ? null : (Long) constant.getConstant();
Predicate filter = operator.equals(BinaryOperatorKind.EQ) ? path.eq(value)
: operator.equals(BinaryOperatorKind.NE) ? path.ne(value)
: operator.equals(BinaryOperatorKind.GT) ? path.gt(value)
: operator.equals(BinaryOperatorKind.GE) ? path.goe(value)
: operator.equals(BinaryOperatorKind.LT) ? path.lt(value)
: operator.equals(BinaryOperatorKind.LE) ? path.loe(value) : null;
return filter;
} else if (constant.getType().isAssignableFrom(LocalDate.class)) {
DatePath<LocalDate> path = (DatePath<LocalDate>) left;
LocalDate value = right == null ? null : (LocalDate) constant.getConstant();
Predicate filter = operator.equals(BinaryOperatorKind.EQ) ? path.eq(value)
: operator.equals(BinaryOperatorKind.NE) ? path.ne(value)
: operator.equals(BinaryOperatorKind.GT) ? path.gt(value)
: operator.equals(BinaryOperatorKind.GE) ? path.goe(value)
: operator.equals(BinaryOperatorKind.LT) ? path.lt(value)
: operator.equals(BinaryOperatorKind.LE) ? path.loe(value) : null;
return filter;
} else if (constant.getType().isAssignableFrom(LocalDateTime.class)) {
DatePath<LocalDateTime> path = (DatePath<LocalDateTime>) left;
LocalDateTime value = right == null ? null : (LocalDateTime) constant.getConstant();
Predicate filter = operator.equals(BinaryOperatorKind.EQ) ? path.eq(value)
: operator.equals(BinaryOperatorKind.NE) ? path.ne(value)
: operator.equals(BinaryOperatorKind.GT) ? path.gt(value)
: operator.equals(BinaryOperatorKind.GE) ? path.goe(value)
: operator.equals(BinaryOperatorKind.LT) ? path.lt(value)
: operator.equals(BinaryOperatorKind.LE) ? path.loe(value) : null;
return filter;
} else if (constant.getType().isAssignableFrom(Boolean.class)) {
BooleanPath path = (BooleanPath) left;
Boolean value = right == null ? null : (Boolean) constant.getConstant();
Predicate filter = operator.equals(BinaryOperatorKind.EQ) ? path.eq(value)
: operator.equals(BinaryOperatorKind.NE) ? path.ne(value) : null;
return filter;
} else {
StringPath path = (StringPath) left;
String value = right == null ? null : (String) constant.getConstant();
Predicate filter = operator.equals(BinaryOperatorKind.EQ) ? path.eq(value)
: operator.equals(BinaryOperatorKind.NE) ? path.ne(value)
: operator.equals(BinaryOperatorKind.GT) ? path.gt(value)
: operator.equals(BinaryOperatorKind.GE) ? path.goe(value)
: operator.equals(BinaryOperatorKind.LT) ? path.lt(value)
: operator.equals(BinaryOperatorKind.LE) ? path.loe(value) : null;
return filter;
}
}
case AND: {
BooleanExpression leftExp = (BooleanExpression) left;
BooleanExpression rightExp = (BooleanExpression) right;
BooleanExpression exp = leftExp.and(rightExp);
return exp;
}
case OR: {
BooleanExpression leftExp = (BooleanExpression) left;
BooleanExpression rightExp = (BooleanExpression) right;
BooleanExpression exp = leftExp.or(rightExp);
return exp;
}
default:
break;
}
return null;
}
@Override
public Expression<?> visitUnaryOperator(UnaryOperatorKind operator, Expression<?> operand) throws ExpressionVisitException, ODataApplicationException {
if(operator.equals(UnaryOperatorKind.NOT)) {
BooleanOperation booleanOperation = (BooleanOperation) operand;
return booleanOperation.not();
}
return null;
}
@Override
public Expression<?> visitMethodCall(MethodKind methodCall, List<Expression<?>> parameters) throws ExpressionVisitException, ODataApplicationException {
StringPath path = (StringPath) parameters.get(0);
@SuppressWarnings("unchecked")
Expression<String> value = (Expression<String>) parameters.get(1);
if(methodCall.equals(MethodKind.STARTSWITH)) {
Predicate filter = path.startsWith(value);
return filter;
} else if(methodCall.equals(MethodKind.ENDSWITH)) {
Predicate filter = path.endsWith(value);
return filter;
} else if(methodCall.equals(MethodKind.CONTAINS)) {
Predicate filter = path.contains(value);
return filter;
}
return null;
}
@Override
public Expression<?> visitLiteral(Literal literal) throws ExpressionVisitException, ODataApplicationException {
String text = literal.getText();
EdmType type = literal.getType();
if(type == null) return null;
switch(type.getName()) {
case "Int16":
case "Int32":
case "SByte":
Integer integerValue = Integer.valueOf(text);
return Expressions.constant(integerValue);
case "Int64":
Long longValue = Long.valueOf(text);
return Expressions.constant(longValue);
case "Date":
LocalDate localDateValue = LocalDate.parse(text);
return Expressions.constant(localDateValue);
case "DateTimeOffset":
LocalDateTime localDateTimeValue = LocalDateTime.parse(text);
return Expressions.constant(localDateTimeValue);
case "Boolean":
return Expressions.constant(Boolean.valueOf(text));
default:
return Expressions.constant(CharMatcher.is('\'').trimFrom(text));
}
}
@Override
public Expression<?> visitAlias(String aliasName) throws ExpressionVisitException, ODataApplicationException {
throw new ExpressionVisitException("visitAlias NOT IMPLEMENTED");
}
@Override
public Expression<?> visitTypeLiteral(EdmType type) throws ExpressionVisitException, ODataApplicationException {
throw new ExpressionVisitException("visitTypeLiteral NOT IMPLEMENTED");
}
@Override
public Expression<?> visitLambdaReference(String variableName) throws ExpressionVisitException, ODataApplicationException {
throw new ExpressionVisitException("visitLambdaReference NOT IMPLEMENTED");
}
@Override
public Expression<?> visitLambdaExpression(String lambdaFunction, String lambdaVariable, org.apache.olingo.server.api.uri.queryoption.expression.Expression expression) throws ExpressionVisitException, ODataApplicationException {
throw new ExpressionVisitException("visitLambdaExpression NOT IMPLEMENTED");
}
@Override
public abstract Expression<?> visitMember(Member member) throws ExpressionVisitException, ODataApplicationException;
@Override
public abstract Expression<?> visitEnum(EdmEnumType type, List<String> enumValues) throws ExpressionVisitException, ODataApplicationException;
}
| [
"diegocairone@gmail.com"
] | diegocairone@gmail.com |
883d028c1106930ff60f85a59a2946be5330cb7b | 9fc6d16fd1fba789fcc38b648bdd069f7a1d8b8d | /iotake-sullerj-gis/src/main/java/com/iotake/suller/sullerj/gis/provider/GeoToolsGeometryProvider.java | 21a76da86d5204aca811e362906963a222e4104d | [
"MIT"
] | permissive | enriquedacostacambio/iotake-suller | 5d7eda5b8ad9337419a6e2307fc4ba8c3cd80dbe | d2af5c23207013107823892e0c586d455bf62a6a | refs/heads/master | 2023-03-19T04:27:58.572859 | 2013-09-11T18:07:56 | 2013-09-11T18:07:56 | 12,537,899 | 0 | 0 | MIT | 2021-05-12T00:15:14 | 2013-09-02T10:45:45 | Java | UTF-8 | Java | false | false | 2,302 | java | package com.iotake.suller.sullerj.gis.provider;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import org.geotools.geometry.iso.PositionFactoryImpl;
import org.geotools.geometry.iso.coordinate.GeometryFactoryImpl;
import org.geotools.referencing.crs.DefaultGeographicCRS;
import org.opengis.geometry.DirectPosition;
import org.opengis.geometry.coordinate.Position;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
public class GeoToolsGeometryProvider implements GeometryProvider {
private final PositionFactoryImpl positionFactory;
private final GeometryFactoryImpl geometryFactory;
public GeoToolsGeometryProvider() {
this(DefaultGeographicCRS.WGS84);
}
public GeoToolsGeometryProvider(
CoordinateReferenceSystem coordinateReferenceSystem) {
checkNotNull(coordinateReferenceSystem,
"Coordinate reference system cannot be null.");
positionFactory = new PositionFactoryImpl(coordinateReferenceSystem);
geometryFactory = new GeometryFactoryImpl(
positionFactory.getCoordinateReferenceSystem(), positionFactory);
}
public Position toPositon(double longitude, double latitude) {
Position position = geometryFactory.createPosition(new double[] {
longitude, latitude });
return position;
}
public double[] toCoordinates(Position position) {
checkNotNull(position, "Position cannot be null.");
DirectPosition directPosition = position.getDirectPosition();
checkArgument(directPosition != null, "Direct position cannot be null.");
CoordinateReferenceSystem coordinateReferenceSystem = directPosition
.getCoordinateReferenceSystem();
checkArgument(coordinateReferenceSystem != null,
"Coordinate reference system cannot be null.");
checkArgument(coordinateReferenceSystem.equals(positionFactory
.getCoordinateReferenceSystem()),
"Invalid coordinate reference system: " + coordinateReferenceSystem);
double[] coordinates = directPosition.getCoordinate();
checkArgument(coordinates != null, "Coordinates cannot be null.");
checkArgument(coordinates.length == 2,
"Invalid number of Position coordinates: " + coordinates.length);
return coordinates;
}
}
| [
"enrique.dacostacambio@gmail.com"
] | enrique.dacostacambio@gmail.com |
6d6bedfe3779a94485d975671f501c0ba8959f52 | d6ee2d061163ab44566f45327629636daac3fa69 | /java23/src/com/bit/event/Ex01.java | 974f383a0ce9d89084e8f6cf39ae37be37dc71c6 | [] | no_license | bit01class/java2019 | e51cd168d45af590f03d97a0f7d99862fd79a30a | 94797a544660af4f30712bd023385a76edf1b38d | refs/heads/master | 2020-05-03T18:30:45.341761 | 2019-06-28T03:07:40 | 2019-06-28T03:07:40 | 178,764,401 | 3 | 0 | null | null | null | null | UHC | Java | false | false | 1,156 | java | package com.bit.event;
import java.awt.Frame;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
public class Ex01 extends Frame implements WindowListener{
public Ex01() {
addWindowListener(this);// 이벤트 등록
setSize(300,200);
setLocation(100-1280,100);
setVisible(true);
}
public static void main(String[] args) {
Ex01 me = new Ex01();
System.out.println("메인끝");
}
/// 이벤트 들 ///
public void windowOpened(WindowEvent e) {
System.out.println("창이 열림...");
}
public void windowClosing(WindowEvent e) {
System.out.println("창닫기...");
//System.exit(0);
dispose();
}
public void windowClosed(WindowEvent e) {
System.out.println("프로그램 종료시 수행하고 싶은 일...");
}
public void windowIconified(WindowEvent e) {
System.out.println("최소화...");
}
public void windowDeiconified(WindowEvent e) {
System.out.println("비최소화...");
}
public void windowActivated(WindowEvent e) {
System.out.println("활성화...");
}
public void windowDeactivated(WindowEvent e) {
System.out.println("비활성화...");
}
}
| [
"bit01class@gmail.com"
] | bit01class@gmail.com |
5367eb2366f330a2089d87495d6dbcdac98b3834 | f4f7192956621733adef0a0ef30f8daf4c2cbae5 | /src/main/java/com/dmitriy/test/patterns/proxy/implementations/ProxyImageViewer.java | ce327753c00725c8129cdef004c329b028575241 | [] | no_license | dmitriy-ardelyan/patterns-test | 704c17febe03177d67948460d116a674eea22250 | 58aaae611ed8e26e5f6ac31f18d00094e4d9eb06 | refs/heads/master | 2023-01-01T17:39:09.583578 | 2020-10-26T08:13:59 | 2020-10-26T08:13:59 | 303,672,964 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 643 | java | package com.dmitriy.test.patterns.proxy.implementations;
import com.dmitriy.test.patterns.proxy.interfaces.IImage;
import java.util.Objects;
public class ProxyImageViewer implements IImage {
private String filePath;
private RealImageViewer realImageViewer;
public ProxyImageViewer(String filePath){
this.filePath = filePath;
}
@Override
public void showImage() {
System.out.println("Proxy additional logic before origilan show image");
if (Objects.isNull(realImageViewer)){
realImageViewer = new RealImageViewer(filePath);
}
realImageViewer.showImage();
}
}
| [
"Dmytro_Ardelian@epam.com"
] | Dmytro_Ardelian@epam.com |
7abcd2afaa74d0c003bc07708a3bab3435d8749f | 03f92fc9c5fae177a5987f6ae267e37a2a85460b | /src/main/java/com/sun/corba/se/spi/activation/LocatorPackage/ServerLocation.java | 6ce4b704ccc517f717a53daae3125150bb4f41ac | [] | no_license | ryandonglin/jdk8src | fd656c869880f864ffcabdc08a4a507e3af8572c | 5421d1be8e5100d65b2c35524da57a908be5dba7 | refs/heads/master | 2021-05-06T17:42:03.151243 | 2017-11-25T03:05:45 | 2017-11-25T03:05:45 | 111,902,553 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 792 | java | package com.sun.corba.se.spi.activation.LocatorPackage;
/**
* com/sun/corba/se/spi/activation/LocatorPackage/ServerLocation.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from /HUDSON/workspace/8-2-build-linux-amd64/jdk8u151/9699/corba/src/share/classes/com/sun/corba/se/spi/activation/activation.idl
* Tuesday, September 5, 2017 7:21:34 PM PDT
*/
public final class ServerLocation implements org.omg.CORBA.portable.IDLEntity
{
public String hostname = null;
public com.sun.corba.se.spi.activation.ORBPortInfo ports[] = null;
public ServerLocation ()
{
} // ctor
public ServerLocation (String _hostname, com.sun.corba.se.spi.activation.ORBPortInfo[] _ports)
{
hostname = _hostname;
ports = _ports;
} // ctor
} // class ServerLocation
| [
"dongl50@ziroom.com"
] | dongl50@ziroom.com |
211a7d492aea3c923aa3ed75743a00e59c5b1075 | bb1733bd0200046f367943fb6781b5b896f44243 | /app/src/main/java/com/bmob/im/demo/adapter/PersonCenterContentAdapter.java | c4b607e9837d8a1a807da45cad48ab688d6c39c3 | [] | no_license | 15079477734/DianDi1.1.1 | 36552bc6d48aaedb54211dde4c72e78dc068b424 | 0f4413ad9788e9c35c13b9677c201aae63c18a91 | refs/heads/master | 2016-09-15T21:11:20.644847 | 2014-09-16T04:44:38 | 2014-09-16T04:44:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,842 | java | package com.bmob.im.demo.adapter;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.bmob.im.demo.CustomApplication;
import com.bmob.im.demo.R;
import com.bmob.im.demo.adapter.base.BaseContentAdapter;
import com.bmob.im.demo.bean.DianDi;
import com.bmob.im.demo.bean.User;
import com.bmob.im.demo.config.Constant;
import com.bmob.im.demo.sns.TencentShare;
import com.bmob.im.demo.sns.TencentShareConstants;
import com.bmob.im.demo.sns.TencentShareEntity;
import com.bmob.im.demo.ui.activity.CommentActivity;
import com.bmob.im.demo.ui.activity.LoginActivity;
import com.bmob.im.demo.util.ActivityUtil;
import com.bmob.im.demo.util.LogUtils;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener;
import java.util.List;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.BmobUser;
import cn.bmob.v3.datatype.BmobPointer;
import cn.bmob.v3.datatype.BmobRelation;
import cn.bmob.v3.listener.FindListener;
import cn.bmob.v3.listener.UpdateListener;
/**
* @author kingofglory
* email: kingofglory@yeah.net
* blog: http:www.google.com
* @date 2014-2-24
* TODO
*/
public class PersonCenterContentAdapter extends BaseContentAdapter<DianDi> {
public static final String TAG = "AIContentAdapter";
public static final int SAVE_FAVOURITE = 2;
private Context mContext;
private Activity mActivity;
public PersonCenterContentAdapter(Context context, List<DianDi> list) {
super(context, list);
mContext=context;
}
public PersonCenterContentAdapter(Activity activity, List<DianDi> list) {
super(activity, list);
mActivity=activity;
mContext=activity;
}
@Override
public View getConvertView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
final ViewHolder viewHolder;
if(convertView == null){
viewHolder = new ViewHolder();
convertView = mInflater.inflate(R.layout.ai_item, null);
viewHolder.userName = (TextView)convertView.findViewById(R.id.user_name);
viewHolder.userLogo = (ImageView)convertView.findViewById(R.id.user_logo);
viewHolder.favMark = (ImageView)convertView.findViewById(R.id.item_action_fav);
viewHolder.contentText = (TextView)convertView.findViewById(R.id.content_text);
viewHolder.contentImage = (ImageView)convertView.findViewById(R.id.content_image);
viewHolder.love = (TextView)convertView.findViewById(R.id.item_action_love);
viewHolder.hate = (TextView)convertView.findViewById(R.id.item_action_hate);
viewHolder.share = (TextView)convertView.findViewById(R.id.item_action_share);
viewHolder.comment = (TextView)convertView.findViewById(R.id.item_action_comment);
convertView.setTag(viewHolder);
}else{
viewHolder = (ViewHolder)convertView.getTag();
}
final DianDi entity = dataList.get(position);
LogUtils.i("user", entity.toString());
User user = entity.getAuthor();
if(user == null){
LogUtils.i("user","USER IS NULL");
}
if(user.getAvatar()==null){
LogUtils.i("user","USER avatar IS NULL");
}
String avatarUrl = null;
if(user.getAvatarImg()!=null){
avatarUrl = user.getAvatarImg().getFileUrl();
}
ImageLoader.getInstance()
.displayImage(avatarUrl, viewHolder.userLogo,
CustomApplication.getInstance().getOptions(),
new SimpleImageLoadingListener(){
@Override
public void onLoadingComplete(String imageUri, View view,
Bitmap loadedImage) {
// TODO Auto-generated method stub
super.onLoadingComplete(imageUri, view, loadedImage);
}
});
viewHolder.userLogo.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
CustomApplication.getInstance().setCurrentDianDi(entity);
// User currentUser = BmobUser.getCurrentUser(mContext,User.class);
// if(currentUser != null){//已登录
// Intent intent = new Intent();
// intent.setClass(CustomApplication.getInstance().getTopActivity(), PersonalActivity.class);
// mContext.startActivity(intent);
// }else{//未登录
// ActivityUtil.show(mContext, "请先登录。");
// Intent intent = new Intent();
// intent.setClass(CustomApplication.getInstance().getTopActivity(), RegisterAndLoginActivity.class);
// CustomApplication.getInstance().getTopActivity().startActivityForResult(intent, Constant.GO_SETTINGS);
// }
}
});
viewHolder.userName.setText(entity.getAuthor().getNick());
viewHolder.contentText.setText(entity.getContent());
if(null == entity.getContentfigureurl()){
viewHolder.contentImage.setVisibility(View.GONE);
}else{
viewHolder.contentImage.setVisibility(View.VISIBLE);
ImageLoader.getInstance()
.displayImage(entity.getContentfigureurl().getFileUrl()==null?"":entity.getContentfigureurl().getFileUrl(), viewHolder.contentImage,
CustomApplication.getInstance().getOptions(R.drawable.bg_pic_loading),
new SimpleImageLoadingListener(){
@Override
public void onLoadingComplete(String imageUri, View view,
Bitmap loadedImage) {
// TODO Auto-generated method stub
super.onLoadingComplete(imageUri, view, loadedImage);
float[] cons= ActivityUtil.getBitmapConfiguration(loadedImage, viewHolder.contentImage, 1.0f);
RelativeLayout.LayoutParams layoutParams=
new RelativeLayout.LayoutParams((int)cons[0], (int)cons[1]);
layoutParams.addRule(RelativeLayout.BELOW,R.id.content_text);
viewHolder.contentImage.setLayoutParams(layoutParams);
}
});
}
viewHolder.love.setText(entity.getLove()+"");
LogUtils.i("love",entity.getMyLove()+"..");
if(entity.getMyLove()){
viewHolder.love.setTextColor(Color.parseColor("#D95555"));
}else{
viewHolder.love.setTextColor(Color.parseColor("#000000"));
}
viewHolder.hate.setText(entity.getHate()+"");
viewHolder.love.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if(entity.getMyLove()){
return;
}
entity.setLove(entity.getLove()+1);
viewHolder.love.setTextColor(Color.parseColor("#D95555"));
viewHolder.love.setText(entity.getLove()+"");
entity.setMyLove(true);
entity.increment("love",1);
entity.update(mContext, new UpdateListener() {
@Override
public void onSuccess() {
// TODO Auto-generated method stub
LogUtils.i(TAG, "点赞成功~");
}
@Override
public void onFailure(int arg0, String arg1) {
// TODO Auto-generated method stub
}
});
}
});
viewHolder.hate.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
entity.setHate(entity.getHate()+1);
viewHolder.hate.setText(entity.getHate()+"");
entity.increment("hate",1);
entity.update(mContext, new UpdateListener() {
@Override
public void onSuccess() {
// TODO Auto-generated method stub
ActivityUtil.show(mContext, "点踩成功~");
}
@Override
public void onFailure(int arg0, String arg1) {
// TODO Auto-generated method stub
}
});
}
});
viewHolder.share.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
//share to sociaty
ActivityUtil.show(mContext, "分享给好友看哦~");
final TencentShare tencentShare=new TencentShare(mActivity,getQQShareEntity(entity));
tencentShare.shareToQQ();
}
});
viewHolder.comment.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
//评论
CustomApplication.getInstance().setCurrentDianDi(entity);
Intent intent = new Intent();
intent.setClass(mActivity, CommentActivity.class);
mContext.startActivity(intent);
}
});
if(entity.getMyFav()){
viewHolder.favMark.setImageResource(R.drawable.ic_action_fav_choose);
}else{
viewHolder.favMark.setImageResource(R.drawable.ic_action_fav_normal);
}
viewHolder.favMark.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
//收藏
ActivityUtil.show(mContext, "收藏");
onClickFav(v,entity);
}
});
return convertView;
}
private TencentShareEntity getQQShareEntity(DianDi qy) {
String title= "这里好多美丽的风景";
String comment="来领略最美的风景吧";
String img= null;
if(qy.getContentfigureurl()!=null){
img = qy.getContentfigureurl().getFileUrl();
}else{
img = TencentShareConstants.DEFAULT_IMG_URL;
}
String summary=qy.getContent();
String targetUrl="http://yuanquan.bmob.cn";
TencentShareEntity entity=new TencentShareEntity(title, img, targetUrl, summary, comment);
return entity;
}
public static class ViewHolder{
public ImageView userLogo;
public TextView userName;
public TextView contentText;
public ImageView contentImage;
public ImageView favMark;
public TextView love;
public TextView hate;
public TextView share;
public TextView comment;
}
private void onClickFav(View v,DianDi DianDi) {
// TODO Auto-generated method stub
User user = BmobUser.getCurrentUser(mContext, User.class);
if(user != null && user.getSessionToken()!=null){
BmobRelation favRelaton = new BmobRelation();
DianDi.setMyFav(!DianDi.getMyFav());
if(DianDi.getMyFav()){
((ImageView)v).setImageResource(R.drawable.ic_action_fav_choose);
favRelaton.add(DianDi);
ActivityUtil.show(mContext, "收藏成功。");
}else{
((ImageView)v).setImageResource(R.drawable.ic_action_fav_normal);
favRelaton.remove(DianDi);
ActivityUtil.show(mContext, "取消收藏。");
}
user.setFavorite(favRelaton);
user.update(mContext, new UpdateListener() {
@Override
public void onSuccess() {
// TODO Auto-generated method stub
LogUtils.i(TAG, "收藏成功。");
//try get fav to see if fav success
// getMyFavourite();
}
@Override
public void onFailure(int arg0, String arg1) {
// TODO Auto-generated method stub
LogUtils.i(TAG, "收藏失败。请检查网络~");
ActivityUtil.show(mContext, "收藏失败。请检查网络~"+arg0);
}
});
}else{
//前往登录注册界面
ActivityUtil.show(mContext, "收藏前请先登录。");
Intent intent = new Intent();
intent.setClass(mContext, LoginActivity.class);
mActivity.startActivityForResult(intent, SAVE_FAVOURITE);
}
}
private void getMyFavourite(){
User user = BmobUser.getCurrentUser(mContext, User.class);
if(user!=null){
BmobQuery<DianDi> query = new BmobQuery<DianDi>();
query.addWhereRelatedTo("favorite", new BmobPointer(user));
query.include("user");
query.order("createdAt");
query.setLimit(Constant.NUMBERS_PER_PAGE);
query.findObjects(mContext, new FindListener<DianDi>() {
@Override
public void onSuccess(List<DianDi> data) {
// TODO Auto-generated method stub
LogUtils.i(TAG,"get fav success!"+data.size());
ActivityUtil.show(mContext, "fav size:"+data.size());
}
@Override
public void onError(int arg0, String arg1) {
// TODO Auto-generated method stub
ActivityUtil.show(mContext, "获取收藏失败。请检查网络~");
}
});
}else{
//前往登录注册界面
ActivityUtil.show(mContext, "获取收藏前请先登录。");
Intent intent = new Intent();
intent.setClass(mContext, LoginActivity.class);
mActivity.startActivityForResult(intent,Constant.GET_FAVOURITE);
}
}
}
| [
"185902156@qq.com"
] | 185902156@qq.com |
b4f2ac2926c5453631b6fb28453126dceb61db37 | 020c5a019369b9ef33a125407fcfc40076522b52 | /gwtWidgets/src/com/tooooolazy/gwt/widgets/shared/SupportedLanguage.java | 42df2fff791238744b21dbd189b210b3fc6eba95 | [] | no_license | tooooolazy/gwtWidgets | 638bb4e94c1093a5bc2cdf45a9e54034d2463b31 | cd03109b6dc6c411992a959f5c322acbc8035305 | refs/heads/master | 2021-01-09T20:13:06.646027 | 2016-07-17T15:32:51 | 2016-07-17T15:32:51 | 63,538,570 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 188 | java | package com.tooooolazy.gwt.widgets.shared;
public interface SupportedLanguage {
public String getLanguage();
public String getDisplayValue();
public String getLangshort();
}
| [
"tooooolazy@tooooolazy-PC2.lan"
] | tooooolazy@tooooolazy-PC2.lan |
16cda90d41e6fba59074415dd72ca3efc0c5202f | ee3eb42ddc5b779a9c554f5bfd68f8c494d0b008 | /src/main/java/com/example/cms/mapper/KeyPersonnelMapper.java | 3e47694b5a19aca5ac02b76b8ec9247ba0892afd | [
"Apache-2.0"
] | permissive | KinghooWei/AccessControlBackend2 | c3ae878ed4da554047e3ea1ef0c9c521eb091e01 | a612af556c72a7ff39f54f6f3240ccc8e77ed52e | refs/heads/master | 2023-04-23T01:27:16.983719 | 2021-05-06T12:48:21 | 2021-05-06T12:48:21 | 364,905,430 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 226 | java | package com.example.cms.mapper;
import com.example.cms.bean.KeyPersonnelBean;
import java.util.List;
public interface KeyPersonnelMapper {
// 获取所有重点人员
List<KeyPersonnelBean> getAllKeyPersonnel();
}
| [
"shuiguyue@yeah.net"
] | shuiguyue@yeah.net |
799f13ca8feae46fb923604bb1d52583d6471f4a | 7d5f6b150995d9a929499f51105bd7c832db9a77 | /acis/aCis_gameserver/java/net/sf/l2j/gameserver/scripting/quests/Q652_AnAgedExAdventurer.java | 4d02c9707ac03aba93cf4db5a935642547f65b43 | [] | no_license | RimvydasJ/l2Server | 8d09bccc3cc8dd157026209c9a87bab7eda7c43e | 97e0434232413a779faf1157e747e243dd3735d9 | refs/heads/master | 2021-06-01T12:58:42.237727 | 2021-05-20T09:59:42 | 2021-05-20T09:59:42 | 135,552,643 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,240 | java | package net.sf.l2j.gameserver.scripting.quests;
import net.sf.l2j.commons.random.Rnd;
import net.sf.l2j.gameserver.model.Location;
import net.sf.l2j.gameserver.model.SpawnLocation;
import net.sf.l2j.gameserver.model.actor.Npc;
import net.sf.l2j.gameserver.model.actor.ai.CtrlIntention;
import net.sf.l2j.gameserver.model.actor.instance.Player;
import net.sf.l2j.gameserver.scripting.Quest;
import net.sf.l2j.gameserver.scripting.QuestState;
public class Q652_AnAgedExAdventurer extends Quest
{
private static final String qn = "Q652_AnAgedExAdventurer";
// NPCs
private static final int TANTAN = 32012;
private static final int SARA = 30180;
// Item
private static final int SOULSHOT_C = 1464;
// Reward
private static final int ENCHANT_ARMOR_D = 956;
// Table of possible spawns
private static final SpawnLocation[] SPAWNS =
{
new SpawnLocation(78355, -1325, -3659, 0),
new SpawnLocation(79890, -6132, -2922, 0),
new SpawnLocation(90012, -7217, -3085, 0),
new SpawnLocation(94500, -10129, -3290, 0),
new SpawnLocation(96534, -1237, -3677, 0)
};
// Current position
private int _currentPosition = 0;
public Q652_AnAgedExAdventurer()
{
super(652, "An Aged Ex-Adventurer");
addStartNpc(TANTAN);
addTalkId(TANTAN, SARA);
addSpawn(TANTAN, 78355, -1325, -3659, 0, false, 0, false);
}
@Override
public String onAdvEvent(String event, Npc npc, Player player)
{
String htmltext = event;
QuestState st = player.getQuestState(qn);
if (st == null)
return htmltext;
if (event.equalsIgnoreCase("32012-02.htm"))
{
if (st.getQuestItemsCount(SOULSHOT_C) >= 100)
{
st.setState(STATE_STARTED);
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
st.takeItems(SOULSHOT_C, 100);
npc.getAI().setIntention(CtrlIntention.MOVE_TO, new Location(85326, 7869, -3620));
startQuestTimer("apparition_npc", 6000, npc, player, false);
}
else
{
htmltext = "32012-02a.htm";
st.exitQuest(true);
}
}
else if (event.equalsIgnoreCase("apparition_npc"))
{
int chance = Rnd.get(5);
// Loop to avoid to spawn to the same place.
while (chance == _currentPosition)
chance = Rnd.get(5);
// Register new position.
_currentPosition = chance;
npc.deleteMe();
addSpawn(TANTAN, SPAWNS[chance], false, 0, false);
return null;
}
return htmltext;
}
@Override
public String onTalk(Npc npc, Player player)
{
QuestState st = player.getQuestState(qn);
String htmltext = getNoQuestMsg();
if (st == null)
return htmltext;
switch (st.getState())
{
case STATE_CREATED:
htmltext = (player.getLevel() < 46) ? "32012-00.htm" : "32012-01.htm";
break;
case STATE_STARTED:
switch (npc.getNpcId())
{
case SARA:
if (Rnd.get(100) < 50)
{
htmltext = "30180-01.htm";
st.rewardItems(57, 5026);
st.giveItems(ENCHANT_ARMOR_D, 1);
}
else
{
htmltext = "30180-02.htm";
st.rewardItems(57, 10000);
}
st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(true);
break;
case TANTAN:
htmltext = "32012-04a.htm";
break;
}
break;
}
return htmltext;
}
} | [
"rimvydas.janusauskas@gmail.com"
] | rimvydas.janusauskas@gmail.com |
5fc3dea17517b67cb5ea9596bc30ca014afcf746 | d525ed523d0b748285f98612b3c56e4e2a3cf91c | /src/main/java/edu/oregonstate/cs361/battleship/BattleshipModel.java | 36c5520256bdcb7d23c2de9b7e9b1828e684c59f | [] | no_license | OSU-CS361-W17/group16_project1 | c834220f11e54c5f36fe9ad742db26f209cedf05 | 68b1d8a83d5d40b16203c916a84443804936c70f | refs/heads/master | 2021-01-11T19:00:09.098373 | 2017-02-04T08:05:35 | 2017-02-04T08:05:35 | 79,286,757 | 0 | 5 | null | 2017-02-04T08:05:36 | 2017-01-18T00:26:35 | Java | UTF-8 | Java | false | false | 122 | java | package edu.oregonstate.cs361.battleship;
/**
* Created by stewa_000 on 1/30/2017.
*/
public class BattleshipModel {
}
| [
"stewartrodger24@Gmail.com"
] | stewartrodger24@Gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.