blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 132 | path stringlengths 2 382 | src_encoding stringclasses 34
values | length_bytes int64 9 3.8M | score float64 1.5 4.94 | int_score int64 2 5 | detected_licenses listlengths 0 142 | license_type stringclasses 2
values | text stringlengths 9 3.8M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
6c9080a25c0d6423e6ba7be40167a9ef7c312767 | Java | mdemers4/FoodCards | /SwipeCards/app/src/main/java/com/example/mitchell/swipecards/MainActivity.java | UTF-8 | 2,445 | 2.234375 | 2 | [] | no_license | package com.example.mitchell.swipecards;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import com.andtinder.model.CardModel;
import com.andtinder.model.Orientations;
import com.andtinder.view.CardContainer;
import com.andtinder.view.SimpleCardStackAdapter;
public class MainActivity extends AppCompatActivity {
private CardContainer mCardContainer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
mCardContainer = (CardContainer) findViewById(R.id.layoutview);
mCardContainer.setOrientation(Orientations.Orientation.Ordered);
Resources r = getResources();
SimpleCardStackAdapter adapter = new SimpleCardStackAdapter(this);
adapter.add(new CardModel("Title1", "Description goes here", r.getDrawable(R.drawable.picture1)));
adapter.add(new CardModel("Title2", "Description goes here", r.getDrawable(R.drawable.picture2)));
adapter.add(new CardModel("Title3", "Description goes here", r.getDrawable(R.drawable.picture3)));
CardModel card = new CardModel("Title1", "Description goes here", r.getDrawable(R.drawable.picture1));
card.setOnClickListener(new CardModel.OnClickListener() {
@Override
public void OnClickListener() {
Log.i("Swipeable Cards","I am pressing the card");
}
});
card.setOnCardDimissedListener(new CardModel.OnCardDimissedListener() {
@Override
public void onLike() {
Log.i("Swipeable Card", "I liked it");
}
@Override
public void onDislike() {
Log.i("Swipeable Card", "I did not liked it");
}
});
adapter.add(card);
mCardContainer.setAdapter(adapter);
//ImageView imageButton =(ImageView) findViewById(R.id.imageButton);
// imageButton.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// Intent information_page = new Intent(MainActivity.this, PictureActivity.class);
// startActivity(information_page);
// }
// });
}
}
| true |
b54bf7499bd93c9aab1f76e586bf56357c590586 | Java | Mr-Yao/web-sso | /sso-server-base/src/main/java/ly/sso/server/servlet/LogoutSetvlet.java | UTF-8 | 2,914 | 2.28125 | 2 | [] | no_license | package ly.sso.server.servlet;
import java.io.IOException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import ly.sso.server.core.Configuration;
import ly.sso.server.core.entity.ClientSystem;
import ly.sso.server.core.entity.LoginUser;
import ly.sso.server.core.token.TokenManager;
import ly.sso.server.util.CookieUtil;
import ly.sso.server.util.StaticConstants;
/**
* 处理用户注销的Servlet<br>
* 1、需要在web.xml中配置该Servlet<br>
* 2、需要实现ly.sso.server.service.AuthenticationHandler接口。并在 <b>Configuration</b>
* 中配置 <b>authenticationHandler</b> 字段值为该实现类
*
* @author liyao
*
* @date 2016年12月27日 下午10:20:22
*
*/
public class LogoutSetvlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
this.doPost(req, resp);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String backUrl = request.getParameter(StaticConstants.BACK_URL_NAME);
final String vt = CookieUtil.getCookie(StaticConstants.VALIDATE_TOKEN_NAME, request);
// 清除自动登录信息
LoginUser loginUser = TokenManager.getInstance().validate(vt);
if (loginUser != null) {
// 清除服务端自动登录状态
Configuration.getInstance().getAuthenticationHandler().clearLoginTicket(loginUser);
// 清除自动登录cookie
CookieUtil.deleteCookie(StaticConstants.LOGIN_TICKET_NAME, response, null);
}
// 移除token
TokenManager.getInstance().invalid(vt);
// 移除server端vt cookie
Cookie cookie = new Cookie(StaticConstants.VALIDATE_TOKEN_NAME, null);
cookie.setMaxAge(0);
response.addCookie(cookie);
ExecutorService cachedThread = Executors.newCachedThreadPool(new ThreadFactory() {
AtomicInteger atomic = new AtomicInteger();
@Override
public Thread newThread(Runnable r) {
return new Thread(r, "notice-client-logout-thread-" + atomic.getAndIncrement());
}
});
// 通知各客户端logout
for (final ClientSystem clientSystem : Configuration.getInstance().getClientSystems()) {
cachedThread.execute(new Runnable() {
@Override
public void run() {
clientSystem.noticeLogout(vt);
}
});
}
cachedThread.shutdown();
if (backUrl == null) {
request.getRequestDispatcher(Configuration.getInstance().getLogoutPageName()).forward(request, response);
} else {
response.sendRedirect(backUrl);
}
}
}
| true |
6768566cecafde44bbce17f525efc6085dc087a8 | Java | mateusz-dziurdziak/gis2014z | /src/main/java/pl/edu/pw/elka/gis2014z/generator/SmallWorldGraphGenerator.java | UTF-8 | 3,453 | 3.21875 | 3 | [
"MIT"
] | permissive | package pl.edu.pw.elka.gis2014z.generator;
import com.google.common.collect.Range;
import pl.edu.pw.elka.gis2014z.graph.Graph;
import java.util.Random;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkState;
/**
* Generator of small world network
*/
public class SmallWorldGraphGenerator extends AbstractGraphGenerator {
/**
* Number of vertices
*/
private final int verticesCount;
/**
* Inital graph level (how many edges has every vertex at the begining)
*/
private final int initialGraphLevel;
/**
* Probabilty of edge change
*/
private final float probabilityOfEdgeChange;
/**
* Creates generator
* @param verticesCount {@link #verticesCount}
* @param initialGraphLevel {@link #initialGraphLevel}
* @param probabilityOfEdgeChange {@link #probabilityOfEdgeChange}
* @throws java.lang.IllegalArgumentException
* <ul>
* <li>vertices count < 0</li>
* <li>initialGraphLevel < 0 or >= verticesCount</li>
* <li>initialGraphLevel is odd</li>
* <li>probabilityOfEdgeChange is not in range [0, 1]</li>
* </ul>
*/
public SmallWorldGraphGenerator(int verticesCount, int initialGraphLevel, float probabilityOfEdgeChange) {
checkArgument(verticesCount >= 0);
checkArgument(initialGraphLevel >= 0 && initialGraphLevel <= verticesCount - 1);
checkArgument(initialGraphLevel % 2 == 0);
checkArgument(Range.closed(0.0f, 1.0f).contains(probabilityOfEdgeChange));
this.verticesCount = verticesCount;
this.initialGraphLevel = initialGraphLevel;
this.probabilityOfEdgeChange = probabilityOfEdgeChange;
}
@Override
protected void doGenerate() {
checkState(graph == null);
graph = new Graph(verticesCount);
generateInitialEdges();
randomizeEdges();
}
/**
* Generates regular graph edges
*/
private void generateInitialEdges() {
for (int i = 0; i < verticesCount; i++) {
for (int j = 1; j <= initialGraphLevel / 2; j++) {
graph.addEdge(i, (i + j) % verticesCount);
}
}
}
/**
* Randomizes edges of graph with probablity {@link #probabilityOfEdgeChange}
*/
private void randomizeEdges() {
Random random = getRandomGenerator();
for (int i = 0; i < verticesCount; i++) {
for (int j = 1; j <= initialGraphLevel / 2; j++) {
float changeProb = random.nextFloat();
if (changeProb > probabilityOfEdgeChange) {
continue;
}
randomizeEdge(random, i, (i + j) % verticesCount);
}
}
}
/**
* Randomizes edges between vertices
* @param random random number generators
* @param firstVertex firstVertex number
* @param secondVertex secondVertexNumber
*/
private void randomizeEdge(Random random, int firstVertex, int secondVertex) {
graph.removeEdge(firstVertex, secondVertex);
int newSecondVertex = random.nextInt(verticesCount);
while (firstVertex == newSecondVertex
|| graph.hasEdge(firstVertex, newSecondVertex)) {
newSecondVertex = random.nextInt(verticesCount);
}
graph.addEdge(firstVertex, newSecondVertex);
}
}
| true |
6b4eaefd26698c2aa0e24cd699f848a88fe8e2c8 | Java | JonathanZwiebel/LFT-asteroid-analysis | /src/mains/PixelsToIterativeOutliers.java | UTF-8 | 2,300 | 2.921875 | 3 | [
"MIT"
] | permissive | package mains;
import java.io.*;
/**
* A top level runnable type that takes in a directory of pixel /csvs in the form x_y.csv and outputs iterative time
* series outlier .csvs at an alpha = .05 level using the Bonferroni FWER correction. A lockfile is generated by the
* rscript to indicate that a certain pixel is done being searched and this class may submit another rscript command.
*
* @author Jonathan Zwiebel
* @version 15 November 2016
*/
public class PixelsToIterativeOutliers {
public static void run(String[] args) throws IOException, InterruptedException {
assert args[0].equals("PIXELS_TO_ITERATIVE_OUTLIERS");
int current_arg = 1;
String rscript = args[current_arg];
current_arg++;
String dir_in = args[current_arg];
current_arg++;
int first_index = Integer.parseInt(args[current_arg]);
current_arg++;
int last_index = Integer.parseInt(args[current_arg]);
current_arg++;
String dir_out = args[current_arg];
current_arg++;
String block_signature = args[current_arg];
current_arg++;
int jlimit = -1;
int i = 0, j = 0;
// TODO: Don't use a while(true) loop
while(true) {
String filename_in = dir_in + "/" + i + "_" + j + ".csv";
String filename_out = dir_out + "/" + i + "_" + j + "_" + block_signature + ".csv";
String lockfilename = dir_out + "/" + i + "_" + j + "_" + block_signature + ".lftlock";
File file_in = new File(filename_in);
if(!file_in.exists()) {
if(jlimit == -1) {
jlimit = j - 1;
}
if(j > jlimit) {
++i;
j = 0;
continue;
}
break;
}
String command = "rscript.exe " + rscript + " " + filename_in + " " + first_index + " " + last_index + " "
+ filename_out + " " + lockfilename;
Runtime.getRuntime().exec(command);
File lockfile = new File(lockfilename);
do {
Thread.sleep(100);
}
while(!lockfile.exists());
lockfile.delete();
++j;
}
}
}
| true |
4d7c2f2da31d72d862387ef6d2d019b11660b692 | Java | vini2003/InGameScreenTime | /src/main/java/ingamescreentime/KeybindRegistry.java | UTF-8 | 968 | 2 | 2 | [
"MIT"
] | permissive | package ingamescreentime;
import net.fabricmc.fabric.api.client.keybinding.FabricKeyBinding;
import net.fabricmc.fabric.api.event.client.ClientTickCallback;
import net.minecraft.client.util.InputUtil;
import net.minecraft.util.Identifier;
import org.lwjgl.glfw.GLFW;
public class KeybindRegistry {
public static FabricKeyBinding INFO_KEYBIND = FabricKeyBinding.Builder.create(new Identifier("ingamescreentime", "info"), InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_I, "InGameScreenTime").build();
public static void initialize() {
ClientTickCallback.EVENT.register(tick -> {
if (INFO_KEYBIND.wasPressed()) {
ScreenRegistry.INFO_TEXT_TIME.setHidden(!ScreenRegistry.INFO_TEXT_TIME.isHidden());
ScreenRegistry.INFO_TEXT_DATE.setHidden(!ScreenRegistry.INFO_TEXT_DATE.isHidden());
ScreenRegistry.INFO_TEXT_BIOME.setHidden(!ScreenRegistry.INFO_TEXT_BIOME.isHidden());
}
});
}
}
| true |
3ca036de4cd10e74367398f50437987a85b9ca50 | Java | nastjast/BC14MorningJava | /src/day21/homework19/Hw20.java | UTF-8 | 1,745 | 3.875 | 4 | [] | no_license | package day21.homework19;
public class Hw20 {
public static void main(String[] args) {
int[] array = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int sum = getSum(array);
System.out.println("Сумма элементов массива: " + sum);
int min = findMin(array);
System.out.println("Минимальный элемент массива: " + min);
int max = giveMeMax(array);
System.out.println("Максимальный элемент массива: " + max);
double average = tellMeAverage(array);
System.out.println("Среднее арифметическое: " + average);
}
private static double tellMeAverage(int[] input) {
return (double) getSum(input) / input.length;
}
private static int giveMeMax(int[] array) {
int max = Integer.MIN_VALUE;
max = array[0];
// min = 0; ошибка
for (int i = 0; i < array.length; i++) {
// min = Math.min(min, array[i]);
max = (max > array[i]) ? max : array[i];
}
return max;
}
private static int findMin(int[] array) {
int min = Integer.MIN_VALUE;
min = array[0];
// min = 0; ошибка
for (int i = 0; i < array.length; i++) {
// min = Math.min(min, array[i]);
min = (min < array[i]) ? min : array[i];
}
return min;
}
private static int getSumSecond(int[] array) {
return (array[0] + array[array.length - 1]) * array.length / 2;
}
private static int getSum(int[] array) {
int sum = 0;
for (int elementik : array) {
sum = sum + elementik;
}
return sum;
}
}
| true |
5118990f4f3cf9a835d918cd7e0af6de6f2911a0 | Java | jinloes/secrets | /src/main/java/com/jinloes/secrets/repositories/api/SecretRepository.java | UTF-8 | 455 | 2.171875 | 2 | [] | no_license | package com.jinloes.secrets.repositories.api;
import com.jinloes.secrets.model.Secret;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
/**
* JPA repository for {@link Secret} objects.
*/
public interface SecretRepository extends MongoRepository<Secret, String> {
Page<Secret> findByCreatedBy(String createdBy, Pageable pageable);
}
| true |
9b7529453479f5443a21cfad43b2471ac683ecd8 | Java | avinashdj1979/VcentrySeleniumJava | /VcentrySeleniumJava/src/myclass/compositon/Main.java | UTF-8 | 754 | 3.296875 | 3 | [] | no_license | package myclass.compositon;
public class Main {
public static void main(String[] args) {
B b1 = new B(5);
b1.getC(); // 5
A a2 = new A(2, b1);
a2.getA();
B b2 = a2.getbObj();
b2.getC();
System.out.println(b2.getC());
System.out.println(a2.getbObj().getC()); // b1.getC();
A a = new A(2, b1);
a.getbObj();
a.getA();
/*int localA = obj1.getA();
System.out.printf("My Local A is %d\n", localA);
int c = obj1.getbObj().getC();
System.out.println("C called using A - " + c );
B b1 = new B(5);
System.out.printf("B1.getC() is %d\n", b1.getC());*/
}
}
| true |
9b382dafdbe4bc499487de9149ffb9828fa12a84 | Java | clover-research/pons | /Bridge/src/main/java/com/pons/bridge/web3j/ERC20ContractService.java | UTF-8 | 2,032 | 2.421875 | 2 | [] | no_license | package com.pons.bridge.web3j;
import java.math.BigInteger;
import org.springframework.stereotype.Service;
import org.web3j.crypto.Credentials;
import org.web3j.protocol.Web3j;
import org.web3j.quorum.Quorum;
import org.web3j.tx.gas.ContractGasProvider;
import com.pons.bridge.contracts.MonetaryToken;
@Service("erc20ContractService")
public class ERC20ContractService {
private Quorum web3j;
private Credentials credentials;
private MasterNode20 masterNode;
public ERC20ContractService(){
masterNode = MasterNode20.getInstance();
web3j = masterNode.getWeb3j();
credentials = masterNode.getCredentials();
}
public boolean createERC20(){
System.out.println("Deploying smart contract ERC20");
ContractGasProvider contractGasProvider = new DeployGasProvider();
MonetaryToken erc20contract;
try{
erc20contract = MonetaryToken.deploy(web3j, credentials, contractGasProvider).send();
}catch(Exception e){
e.printStackTrace();
return false;
}
String contractAddress = erc20contract.getContractAddress();
System.out.println("ERC20 deployed to: " + contractAddress);
masterNode.setErc20TokenAddress(erc20contract.getContractAddress());
return true;
}
public MonetaryToken loadERC20Token(Credentials credentials){
String contractAddress = masterNode.getErc20TokenAddress();
ContractGasProvider contractGasProvider = new DeployGasProvider();
return MonetaryToken.load(contractAddress, web3j, credentials, contractGasProvider);
}
public void transfer(String address, String amount) {
MonetaryToken contract = loadERC20Token(credentials);
try {
contract.transfer(address, new BigInteger(amount)).send();
} catch (Exception e) {
e.printStackTrace();
}
}
public String getBalance(String address) {
MonetaryToken contract = loadERC20Token(credentials);
try {
return contract.balanceOf(address).send().toString();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
| true |
e42f589bf2ac6feb0e7bc2a628c4425188348343 | Java | Aresong/MyDemo | /house-30/src/cn/bdqn/house/dao/IStreetDao.java | UTF-8 | 440 | 2.015625 | 2 | [] | no_license | package cn.bdqn.house.dao;
import java.io.Serializable;
import java.util.List;
import cn.bdqn.house.entity.Street;
/*
*@author:Dongming Tian
*@date:2017-6-6 ����1:56:07
*version: 1.0
*description:
*/
public interface IStreetDao {
public void save(Street street);
public void update(Street street);
public void delete(Street street);
public Street getById(Serializable id);
public List<Street> getList();
}
| true |
1cef775f36d2544637c105f71a97f1cec28d9245 | Java | patida12/Garden-Defense | /src/mrmathami/thegame/entity/bullet/NormalBullet.java | UTF-8 | 760 | 2.65625 | 3 | [] | no_license | package mrmathami.thegame.entity.bullet;
import javafx.scene.canvas.GraphicsContext;
import mrmathami.thegame.Config;
import mrmathami.thegame.drawer.bulletDrawer.NormalBulletDrawer;
import mrmathami.thegame.entity.Path;
public class NormalBullet extends AbstractBullet{
NormalBulletDrawer drawer = new NormalBulletDrawer();
public NormalBullet(double startX, double startY, double endX, double endY){
super(startX, startY, endX, endY, Config.NORMAL_BULLET_SPEED,Config.NORMAL_BULLET_STRENGTH);
}
public void draw(GraphicsContext graphicsContext){
drawer.draw(graphicsContext, getX(), getY(), 10,10);
Path.drawPath(graphicsContext);
}
@Override
public void update() {
super.update();
}
}
| true |
5254f665fc0fad3685e4a88711c60eb2312a62e6 | Java | w-cross/ModulesTest | /dubbo-provider/src/main/java/com/wzw/service/impl/DubboTestProviderImpl.java | UTF-8 | 309 | 1.757813 | 2 | [] | no_license | package com.wzw.service.impl;
import com.alibaba.dubbo.config.annotation.Service;
import com.dubbo.service.DubboTest;
@Service
public class DubboTestProviderImpl implements DubboTest {
@Override
public String dubbo() {
System.out.println("provider");
return "hello dubbo";
}
}
| true |
f0bdee8be8516138ed54213c67599317ff900e27 | Java | xiaoluozzl/BaseLibrary | /baseLibrary/src/main/java/com/xiaoluo/baselibrary/rxbus/NetReceiver.java | UTF-8 | 799 | 2.3125 | 2 | [] | no_license | package com.xiaoluo.baselibrary.rxbus;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.xiaoluo.baselibrary.R;
import com.xiaoluo.baselibrary.utils.NetworkUtil;
import com.xiaoluo.baselibrary.utils.Utils;
/**
* 监听网络状态
*
* @author: xiaoluo
* @date: 2017-01-22 16:17
*/
public class NetReceiver extends BroadcastReceiver {
private int networkType;
public NetReceiver(int networkType) {
this.networkType = networkType;
}
public NetReceiver() {
}
@Override
public void onReceive(Context context, Intent intent) {
if (!NetworkUtil.isNetworkConnected(context)) {
Utils.showToast(context.getResources().getString(R.string.error_no_network));
}
}
}
| true |
803306c1e52229bf36143e56e0f69ee7f4e658af | Java | xiaosigua1/javaWeb | /Memcached/src/cn/bdqn/util/MemcachedUtil.java | GB18030 | 3,695 | 2.734375 | 3 | [] | no_license | package cn.bdqn.util;
import java.util.Map;
import java.util.Set;
import org.apache.log4j.Logger;
import com.danga.MemCached.MemCachedClient;
import com.danga.MemCached.SockIOPool;
public class MemcachedUtil {
// memcachedͻ˶
private static MemCachedClient client = new MemCachedClient();
private static MemcachedUtil memcached = new MemcachedUtil();
private static Logger log = Logger.getLogger(MemcachedUtil.class);
static {
log.debug("ʵ");
// memcachedַΪǷֲʽΪ,memcachedĬ϶˿ںΪ11211
String[] servers = { "127.0.0.1:11211" };
// ΪserversȨأñȼ뻺бһ
Integer[] weights = { 3 };
/*
* ӳ,SchoonerSockIOPool.getInstance() ڵgetInstance(String
* s,boolean flag)s:"default",flag:true ڵܱĹ췽isTcp=flag
*/
// ĬϲTCPЭ
SockIOPool pool = SockIOPool.getInstance();
// SockIOPoolSchoonerSockIOPoolsetServers
pool.setServers(servers);// memcachedַӳ
pool.setWeights(weights);// memcachedȨظӳ
// ǷзĬֵtrue
pool.setFailover(true);
// óʼʱÿĿΪSchoonerSockIOPoolеminConnֵ
pool.setInitConn(5);
/*
* ÿСԲ̷߳ijĿСĿʱֲʣµ ĬֵΪ8
*/
pool.setMinConn(5);
// ÿĬֵ32
pool.setMaxConn(250);
// ʱ䣬λ룬Ĭ1000룬long
pool.setMaxIdle(1000 * 60 * 60 * 6);
// ߳˯ʱ䣬λ룬Ĭ30000룬long߳Թ
pool.setMaintSleep(30000);
// SocketIJtrueдʱ壬ͳȥĬֵΪfalse
pool.setNagle(false);
// öȡݳʱʱ䣬Ĭϣ3000λ
pool.setSocketTO(3000);
// ǷÿβѯǷãĬfalse
pool.setAliveCheck(true);
// ʼϣײSchoonerSockIOPoolеinitialize
pool.initialize();
}
private MemcachedUtil() {
}// ˽л췽
public static MemcachedUtil getInstance() {// ṩӿ
return memcached;
}
/**
* ĻݵɾIJ ʱ
* ײ㶼ṩ
*/
public boolean set(String key, Object value) {
log.debug("setkeyֵǣ" + key);
log.debug("ǷŽ棺" + client.set(key, value));
return client.set(key, value);// setkeyѾڣԸ¸keyӦԭݣҲʵָµá
}
public boolean add(String key, Object value) {// ӻж
return client.add(key, value);
}
public boolean delete(String key) {
return client.delete(key);
}
public boolean replace(String key, Object value) {// 滻еĶ
return client.replace(key, value);
}
public Object get(String key) {// ȡжķ
return client.get(key);
}
public boolean flushAll() {
Map map = client.stats(); // stats ڷͳϢ PID(̺)汾šȡ
Set entrySet = map.entrySet();
for (Object object : entrySet) {
log.debug(object);
}
return client.flushAll();
}
}
| true |
f185c31d8904efa13afc90540bd3c046c4af859f | Java | tnqls9582/JavaClass | /javaclass/src/day13/Board.java | UTF-8 | 1,061 | 3.234375 | 3 | [] | no_license | package day13;
public class Board {
// 필드
int bNumber;
String bTitle;
String bWriter;
String bContents;
// 기본생성자
Board() {
}
// 매개변수 생성자
Board(int bNumber, String bTitle, String bWriter, String bContents) {
this.bNumber = bNumber;
this.bTitle = bTitle;
this.bWriter = bWriter;
this.bContents = bContents;
}
// boardWrite 메소드 -> 모든 필드를 메소드로
void boardWrite(int bNumber, String bTitle,
String bWriter, String bContents) {
this.bNumber = bNumber;
this.bTitle = bTitle;
this.bWriter = bWriter;
this.bContents = bContents;
}
// boardView 메소드 -> 모든 필드값 출력
void boardView() {
System.out.println(this.bNumber);
System.out.println(this.bTitle);
System.out.println(this.bWriter);
System.out.println(this.bContents);
}
// boardUpdate 메소드 -> 제목과 내용 수정
void boardUpdate(String bTitle, String bContents) {
this.bTitle = bTitle;
this.bContents = bContents;
}
}
| true |
6edc1718ef5a6c3dc0156fdbd0a67f822d03dbba | Java | GuolinYao/HiShixi | /src/com/shixi/gaodun/inf/ScrollViewListener.java | UTF-8 | 273 | 1.90625 | 2 | [] | no_license | package com.shixi.gaodun.inf;
import com.shixi.gaodun.view.ObservableScrollView;
/**
* @author ronger
* @date:2015-11-12 上午9:24:49
*/
public interface ScrollViewListener {
void onScrollChanged(ObservableScrollView scrollView, int x, int y, int oldx, int oldy);
}
| true |
78f985f795816c6134b5c87512c844110c12edef | Java | LINKER-PNU/SummerMVC | /linker/src/main/java/ac/linker/controller/AgoraController.java | UTF-8 | 5,583 | 2.125 | 2 | [
"MIT"
] | permissive | package ac.linker.controller;
import java.util.List;
import java.util.Map;
import com.google.gson.JsonObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import ac.linker.dto.RoomDto;
import ac.linker.media.RtcTokenBuilder;
import ac.linker.media.RtcTokenBuilder.Role;
import ac.linker.service.AgoraService;
import ac.linker.vo.AgoraVo;
@RestController
public class AgoraController {
static String appId = "ee7508ef6b2042e7b6dd141a6a11895a";
static String appCertificate = "c6903f1bcc1e4097abbb1352a8fed7d7";
static int expirationTimeInSeconds = 1000;
RtcTokenBuilder token = new RtcTokenBuilder();
private final Logger logger = LoggerFactory.getLogger(this.getClass());
private AgoraService agoraService;
@Autowired
AgoraController(AgoraService agoraService) {
this.agoraService = agoraService;
}
@PostMapping(value = "/get_token", produces = "application/json; charset=utf8")
public String getToken(@RequestBody AgoraVo agoraVo) {
final String channelName = agoraVo.getRoomName();
logger.info("getToken :: {}", channelName);
final RoomDto roomDto = new RoomDto(channelName);
final List<Map<String, Object>> queryResult = agoraService.getAgoraToken(roomDto);
String agoraToken = queryResult.get(0).get("room_agora_token").toString();
final String channelNo = queryResult.get(0).get("global_room_no").toString();
if (!agoraToken.isEmpty()) {
// token exist
logger.info("Token exist!\n");
} else {
// token not exist
logger.info("Token not exist! Generate token.\n");
try {
int timestamp = (int) (System.currentTimeMillis() / 1000 + expirationTimeInSeconds);
agoraToken = token.buildTokenWithUid(appId, appCertificate, channelNo, 0, Role.Role_Publisher,
timestamp);
roomDto.setAgoraToken(agoraToken);
agoraService.updateAgoraToken(roomDto);
} catch (Exception e) {
return "-1";
}
}
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("agoraToken", agoraToken);
jsonObject.addProperty("roomId", channelNo);
return jsonObject.toString();
}
@PostMapping(value = "/check_class_exist", produces = "application/json; charset=utf8")
public String checkClassExist(@RequestBody AgoraVo agoraVo) {
final String channelName = agoraVo.getRoomName();
logger.info("checkClassExist :: {}", channelName);
final boolean agoraUidExist = !agoraService.getAgoraUid(new RoomDto(channelName)).get(0).get("room_agora_uid")
.toString().isEmpty();
if (agoraUidExist) {
logger.info("Class exist!\n");
} else {
logger.warn("checkClassExist :: Class not exist...\n");
}
return String.valueOf(agoraUidExist);
}
@PostMapping(value = "/insert_class_master", produces = "application/json; charset=utf8")
public String insertClassMaster(@RequestBody AgoraVo agoraVo) {
final String channelName = agoraVo.getRoomName();
final String uid = agoraVo.getClassMaster();
logger.info("insertClassMaster :: {} :: {}", channelName, uid);
RoomDto roomDto = new RoomDto(channelName);
roomDto.setAgoraUid(uid);
try {
agoraService.updateAgoraUid(roomDto);
logger.info("Agora class master is updated to {}.\n", uid);
return "true";
} catch (Exception e) {
agoraService.resetAgora(roomDto);
logger.error("insertClassMaster :: Agora class master insertion is failed! Reset class master.\n");
return "false";
}
}
@PostMapping(value = "/delete_class_master", produces = "application/json; charset=utf8")
public String deleteClassMaster(@RequestBody AgoraVo agoraVo) {
final String channelName = agoraVo.getRoomName();
logger.info("deleteClassMaster :: {}", channelName);
try {
agoraService.resetAgora(new RoomDto(channelName));
logger.info("Agora class master is reset at channel.\n");
return "true";
} catch (Exception e) {
logger.error("deleteClassMaster :: Agora class master resetting is failed!\n");
return "false";
}
}
@PostMapping(value = "/is_class_master", produces = "application/json; charset=utf8")
public String isClassMaster(@RequestBody AgoraVo agoraVo) {
final String channelName = agoraVo.getRoomName();
final String uid = agoraVo.getClassMaster();
logger.info("isClassMaster :: {} :: {}", channelName, uid);
final boolean equalsResult = uid
.equals(agoraService.getAgoraUid(new RoomDto(channelName)).get(0).get("room_agora_uid").toString());
if (equalsResult) {
logger.info("{} is class master of {}!\n", uid, channelName);
} else {
logger.warn("isClassMaster :: {} is not class master of {}...\n", uid, channelName);
}
return String.valueOf(equalsResult);
}
}
| true |
177e50a629f9b46869e87b4070990bb856b41a80 | Java | Dies7/Java-Repository | /Chapter5/src/exercises/EvenOdd.java | UTF-8 | 493 | 3.1875 | 3 | [] | no_license | package exercises;
import javax.swing.JOptionPane;
public class EvenOdd {
public static void main(String[] args) {
// TODO Auto-generated method stub
String userChoice;
int choiceInt;
userChoice = JOptionPane.showInputDialog(null, "Please enter a number.");
choiceInt = Integer.parseInt(userChoice);
if((choiceInt%2)==0)//even
JOptionPane.showMessageDialog(null, "You're number is even.");
else//odd
JOptionPane.showMessageDialog(null, "You're number is odd.");
}
}
| true |
078a84c94376e051db180a99dd25c2466715285c | Java | Sid654321/student | /src/main/java/com/sst/service/ScoreService.java | UTF-8 | 3,655 | 2.265625 | 2 | [] | no_license | package com.sst.service;
import com.sst.entity.Score;
import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import com.sst.entity.Student;
import com.sst.entity.Teacher;
import com.sst.mapper.*;
import com.sst.utils.PageHelperUtils;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class ScoreService {
@Resource
private ScoreMapper scoreMapper;
@Resource
private SectionMapper sectionMapper;
@Resource
private ClazzMapper clazzMapper;
@Resource
private TeacherMapper teacherMapper;
@Resource
private CourseMapper courseMapper;
@Resource
private StudentMapper studentMapper;
public int create(String sectionIds, String courseIds, HttpSession session) {
//当前的学生信息
Student student = (Student) session.getAttribute("user");
//删除该学生原有的选课信息
Score scoreBefore = new Score();
scoreBefore.setStuId(student.getId());
scoreMapper.delete(scoreBefore);
//创建该学生现在的选课信息
String[] sectionIdArrs = sectionIds.split(",");
String[] couresIdArrs = courseIds.split(",");
int flag = 0;
for (int i = 0; i < couresIdArrs.length; i++) {
Score score = new Score();
score.setStuId(student.getId());
score.setCourseId(Integer.parseInt(couresIdArrs[i]));
score.setSectionId(Integer.parseInt(sectionIdArrs[i]));
flag = scoreMapper.create(score);
}
return flag;
}
public int delete(Score score) {
return scoreMapper.delete(score);
}
public int update(Score score) {
System.out.println(score);
return scoreMapper.updateSelective(score);
}
public int updateSelective(Score score) {
return scoreMapper.updateSelective(score);
}
public List<Score> query(Score score) {
PageHelperUtils.pageHelper(score);
if (score!=null){
System.out.println(score.getStuId());
List<Score> scores = scoreMapper.query(score);
scores.forEach(score1 -> {
score1.setCourse(courseMapper.detail(score1.getCourseId()));
score1.setSection(sectionMapper.detail(score1.getSectionId()));
score1.setClazz(clazzMapper.detail(score1.getSection().getClazzId()));
score1.setTeacher(teacherMapper.detail(score1.getSection().getTeacherId()));
});
return scores;
}else {
return scoreMapper.query(null);
}
}
public List<Score> querys(Score score) {
return scoreMapper.query(score);
}
public List<Integer> distinctCourse(){
return scoreMapper.distinctCourse();
}
public List<Score> queryForTeacher(Score score) {
PageHelperUtils.pageHelper(score);
List<Score> scores = scoreMapper.queryForTeacher(score);
System.out.println("查出的scores:"+scores);
scores.forEach(score1 -> {
score1.setSection(sectionMapper.detail(score1.getSectionId()));
score1.setCourse(courseMapper.detail(score1.getCourseId()));
score1.setClazz(clazzMapper.detail(score1.getClazzId()));
score1.setStudent(studentMapper.detail(score1.getStuId()));
score1.setTeacher(teacherMapper.detail(score1.getTeacherId()));
});
return scores;
}
public Score detail(Integer id) {
return scoreMapper.detail(id);
}
public int count(Score score) {
return scoreMapper.count(score);
}
}
| true |
b744e09f3fd2ce0c79907d48d1da9a526da71640 | Java | TinaBryan/AndNowYouKnow | /app/src/main/java/com/tinabryan/andnowyouknow/FactBook.java | UTF-8 | 4,087 | 2.875 | 3 | [] | no_license | package com.tinabryan.andnowyouknow;
import java.util.Random;
/**
* Created by tinabryan on 11/27/15.
*/
public class FactBook {
// Member variables (properties about the object)
public String[] mFacts = {
"Hubble telescope delivers the deepest images of the universe ever recorded.",
"Hubble Telescope only takes pictures in shades of black and white.",
"Andromeda is hundreds of thousands of light years away form our Milky Way.",
"The Hubble Telescope is named after American astronomer, Edwin Hubble.",
"Hubble's images are colored from pairing a color with a wavelength of light.",
"Hubble technology is saving lives through better breast cancer detection.",
"Anyone can make a request to use the Hubble Telescope.",
"Hubble Telescope will be replaced by the James Webb Space Telescope.",
"The Hubble Telescope is perched at an altitude of only 350 miles.",
"The James Webb Telescope will be placed 1 million miles beyond the Moon.",
"The James Webb Telescope is set to launch in 2018.",
"The Sun is over 300,000 times larger than Earth.",
"Neptune is the most distant planet in our solar system.",
"Neptune is the eighth planet from the Sun.",
"Neptune has 14 moons, 5 rings, and surface temperature is -201°Celsius.",
"Pluto is the second closest dwarf planet to the Sun.",
"Pluto has 5 moons; Charon, Nix, Hydra, Kerberos, and Styx.",
"The surface temperature of Pluto is: -229°Celsius.",
"Uranus is the seventh planet from the Sun.",
"Uranus has 27 moons, notable: Oberon, Titania, Miranda, Ariel, and Umbriel.",
"The surface temperature of Uranus is: -197°Celsius",
"Uranus was discovered by William Herschel, Mar. 13, 1781.",
"Pluto was discovered by Clyde W. Tombaugh, Feb. 18, 1930.",
"Neptune was discovered by Urbain Le Verrier & Johann Galle Sept. 23, 1846.",
"Mercury is the closest planet to the Sun.",
"Mercury does not have any known moons.",
"Mercury has a surface temperature of -173°Celsius to 427°Celsius",
"mercury was recorded by: Assyrian astronomers.",
"Venus is the second planet from the Sun.",
"Venus does not have any known moons.",
"The surface temperature of Venus is: 462°Celsius.",
"Venus was recorded by: Babylonian astronomers.",
"Earth is the third planet from the Sun.",
"Earth has one notable moon: The Moon.",
"The surface temperature of the Earth is: -88°Celsius to 58°Celsius.",
"Mars is the fourth planet from the Sun.",
"Mars has two known moons: Phobos & Deimos.",
"The surface temperature of Mars is: -87°Celsius to -5°Celsius.",
"Mars was recorded by: Egyptian astronomers.",
"Jupiter is the fifth planet from the Sun.",
"Jupiter has 67 known moons.",
"The surface temperature of Jupiter is: -108°Celsius.",
"Jupiter was recorded by: Babylonian astronomers.",
"Saturn is the sixth planet from the Sun.",
"Saturn has 62 known moons.",
"The surface temperature of Saturn is: -139°Celsius.",
"Saturn was recorded by: Assyrians.",
"The Terrestrial planets are: Mercury, Venus, Earth, and Mars.",
"Gas giants: contain 10 times the mass of Earth.",
"Gas giants are known as: Jovian or Outer Planets.",
"Gas giants: Jupiter, Saturn, Uranus, and Neptune."};
// Method (abilities: things the object can do)
public String getFact() {
String fact = "";
// Randomly select a fact
Random randomGenerator = new Random(); // Construct a new Random number generator
int randomNumber = randomGenerator.nextInt(mFacts.length);
fact = mFacts[randomNumber];
return fact;
}
}
| true |
26cf364fc49fbed768fd28ebf9082789c70ba59d | Java | Shobhityadav99/Algorithms | /ConnectedComponentsinUndirectedGraph.java | UTF-8 | 1,072 | 3.765625 | 4 | [] | no_license | package Graphs;
import java.util.*;
public class ConnectedComponentsinUndirectedGraph {
int V;
LinkedList<Integer> adj[];
ConnectedComponentsinUndirectedGraph(int v){
V=v;
adj=new LinkedList[V];
for(int i=0;i<V;i++)
adj[i]=new LinkedList<Integer>();
}
void addEdge(int u,int v) {
adj[u].add(v);
adj[v].add(u);
}
void DFSUtil(int v,boolean visited[]) {
visited[v]=true;
System.out.print(v+" ");
for(int x: adj[v])
if(!visited[x])
DFSUtil(x,visited);
}
void ConnectedComponents() {
boolean visited[]=new boolean[V];
for(int v=0;v<V;v++) {
if(!visited[v]) {
DFSUtil(v,visited);
System.out.println();
}
}
}
public static void main(String[] args) {
ConnectedComponentsinUndirectedGraph g = new ConnectedComponentsinUndirectedGraph(5); // 5 vertices numbered from 0 to 4
g.addEdge(1, 0);
g.addEdge(2, 3);
g.addEdge(3, 4);
System.out.println("Following are connected components");
g.ConnectedComponents();
}
}
| true |
e9dc76f8b4fa109f66b92df6127bca887652f9ce | Java | leandrocgsi/Minicurso-JSF-UNIPAM-2013 | /src/java/br/com/jsf/util/FacesContextUtil.java | UTF-8 | 849 | 1.992188 | 2 | [] | no_license | package br.com.jsf.util;
import java.util.Map;
import javax.faces.application.FacesMessage;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.hibernate.Session;
public class FacesContextUtil {
private static final String HIBERNATE_SESSION = "hibernate_session";
public static void setRequestSession(Session session)
{
FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put(HIBERNATE_SESSION, session);
}
public static Session getRequestSession()
{
return (Session)FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get(HIBERNATE_SESSION);
}
} | true |
e076d0114f4184a42acdcc40949416bd6abcc537 | Java | topcoder-platform/tc-website | /src/testcases/com/topcoder/web/reg/TestUtils.java | UTF-8 | 6,459 | 2.09375 | 2 | [] | no_license | package com.topcoder.web.reg;
import com.topcoder.web.common.dao.DAOUtil;
import com.topcoder.web.common.model.*;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
/**
* @author dok
* @version $Revision$ Date: 2005/01/01 00:00:00
* Create Date: Apr 25, 2006
*/
public class TestUtils {
public static Coder makeCoder() {
Coder ret = null;
ret = new Coder();
ret.setCompCountry(DAOUtil.getFactory().getCountryDAO().find("840"));
ret.setMemberSince(new Timestamp(System.currentTimeMillis()));
ret.setCoderType(DAOUtil.getFactory().getCoderTypeDAO().find(CoderType.STUDENT));
School s = new School();
s.setName("some school");
s.setShortName("ss");
s.setType(DAOUtil.getFactory().getSchoolTypeDAO().find(SchoolType.COLLEGE));
Address a = new Address();
a.setCity("mycity");
a.setCountry(DAOUtil.getFactory().getCountryDAO().find("840"));
a.setState(DAOUtil.getFactory().getStateDAO().find("CO"));
a.setProvince("myprovince");
s.setAddress(a);
CurrentSchool cs = new CurrentSchool();
cs.setCoder(ret);
cs.setGPA(new Float(3));
cs.setGPAScale(new Float(5));
cs.setSchool(s);
cs.setViewable(Boolean.TRUE);
ret.setCurrentSchool(cs);
Team t = new Team();
t.setName(s.getName());
t.setSchool(s);
t.setType(DAOUtil.getFactory().getTeamTypeDAO().find(TeamType.HIGH_SCHOOL_TYPE));
ret.addTeam(t);
AlgoRating hs = new AlgoRating();
hs.setType(DAOUtil.getFactory().getAlgoRatingTypeDAO().find(AlgoRatingType.HIGH_SCHOOL));
hs.setCoder(ret);
hs.getId().setCoder(ret);
hs.getId().setType(hs.getType());
ret.addRating(hs);
AlgoRating tc = new AlgoRating();
tc.setType(DAOUtil.getFactory().getAlgoRatingTypeDAO().find(AlgoRatingType.TC));
tc.setCoder(ret);
tc.getId().setCoder(ret);
tc.getId().setType(tc.getType());
ret.addRating(tc);
return ret;
}
public static User makeUser() {
User ret = null;
String handle = "f" + System.currentTimeMillis();
ret = new User();
ret.setActivationCode("active");
ret.setFirstName("first name");
ret.setLastName("last_name");
ret.setHandle(handle);
ret.setMiddleName("middle name");
ret.setPassword("password");
Coder c = makeCoder();
c.setUser(ret);
ret.setCoder(c);
ret.addCreatedSchool(c.getCurrentSchool().getSchool());
Address a = new Address();
a.setAddress1("address1");
a.setAddress2("address2");
a.setAddress3("address3");
a.setAddressTypeId(Address.HOME_TYPE_ID);
a.setCity("city");
a.setState(DAOUtil.getFactory().getStateDAO().find("CO"));
a.setCountry(DAOUtil.getFactory().getCountryDAO().find("840"));
a.setProvince("province");
a.setPostalCode("zip");
ret.addAddress(a);
Email e = new Email();
e.setAddress("dok@topcoder.com");
e.setEmailTypeId(Email.TYPE_ID_PRIMARY);
e.setPrimary(Boolean.TRUE);
e.setStatusId(Email.STATUS_ID_UNACTIVE);
ret.addEmailAddress(e);
Phone p = new Phone();
p.setNumber("6666666666");
p.setPhoneTypeId(Phone.PHONE_TYPE_HOME);
p.setPrimary(Boolean.TRUE);
ret.addPhoneNumber(p);
for (Iterator it = DAOUtil.getFactory().getNotificationDAO().findAll().iterator(); it.hasNext();) {
ret.addNotification((Notification) it.next());
}
ret.setTimeZone(DAOUtil.getFactory().getTimeZoneDAO().find(java.util.TimeZone.getDefault()));
UserSchool us = new UserSchool();
us.setSchool(c.getCurrentSchool().getSchool());
us.setPrimary(true);
us.setAssociationType(DAOUtil.getFactory().getSchoolAssociationTypeDAO().find(SchoolAssociationType.STUDENT));
ret.addSchool(us);
HashSet regTypes = new HashSet();
regTypes.add(DAOUtil.getFactory().getRegistrationTypeDAO().find(new Integer(1)));
List assignments = DAOUtil.getFactory().getDemographicAssignmentDAO().getAssignments(
DAOUtil.getFactory().getCoderTypeDAO().find(new Integer(1)), ret.getHomeAddress().getState(), regTypes);
DemographicAssignment da;
DemographicResponse dr;
ArrayList responses = new ArrayList();
for (Iterator it = assignments.iterator(); it.hasNext();) {
da = (DemographicAssignment) it.next();
if (da.getQuestion().isMultipleSelect()) {
for (Iterator it1 = da.getQuestion().getAnswers().iterator(); it1.hasNext();) {
dr = new DemographicResponse();
dr.setUser(ret);
dr.setQuestion(da.getQuestion());
dr.setAnswer((DemographicAnswer) it1.next());
//dr.setId(new DemographicResponse.Identifier(ret.getId(), dr.getQuestion().getId(), dr.getAnswer().getId()));
responses.add(dr);
}
} else if (da.getQuestion().isSingleSelect()) {
dr = new DemographicResponse();
dr.setUser(ret);
dr.setQuestion(da.getQuestion());
Iterator it1 = da.getQuestion().getAnswers().iterator();
dr.setAnswer((DemographicAnswer) it1.next());
//dr.setId(new DemographicResponse.Identifier(ret.getId(), dr.getQuestion().getId(), dr.getAnswer().getId()));
responses.add(dr);
} else if (da.getQuestion().isFreeForm()) {
dr = new DemographicResponse();
dr.setUser(ret);
dr.setQuestion(da.getQuestion());
dr.setAnswer(DAOUtil.getFactory().getDemographicAnswerDAO().findFreeForm(da.getQuestion()));
dr.setResponse("hell");
//dr.setId(new DemographicResponse.Identifier(ret.getId(), dr.getQuestion().getId(), dr.getAnswer().getId()));
responses.add(dr);
}
}
ret.setTransientResponses(responses);
return ret;
}
public static User makeUser(String handle) {
User ret = makeUser();
ret.setHandle(handle);
return ret;
}
} | true |
a10b71193d8c88a507fbc3d8af359d1351d37f6d | Java | ly-del/signupstage-qb | /src/main/java/com/cb/signupstage/entity/PaperInterviewScore.java | UTF-8 | 1,192 | 1.859375 | 2 | [] | no_license | package com.cb.signupstage.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.io.Serializable;
/**
* <p>
* 论文面试评分表
* </p>
*
* @author ly
* @since 2020-12-29
*/
@Data
@TableName("paper_interview_score")
public class PaperInterviewScore implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 论文id
*/
@TableField("paper_id")
private Long paperId;
/**
* 面试得分
*/
@TableField("score")
private BigDecimal score;
/**
* 删除标识
*/
@TableField(value = "deleted",fill = FieldFill.INSERT)
private Integer deleted;
/**
* 创建账号id
*/
@TableField("account_id")
private Long accountId;
/**
* 创建时间
*/
@TableField(value = "create_time",fill = FieldFill.INSERT)
private LocalDateTime createTime;
/**
* 更新时间
*/
@TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
}
| true |
c0a692146a71be8e3eab056450a516c421dbf083 | Java | zeeshanhanif/saylanibatch4_android | /15May2016/DemoString2/src/com/company/Main.java | UTF-8 | 508 | 2.9375 | 3 | [] | no_license | package com.company;
public class Main {
public static void main(String[] args) {
String str = "XYZ";
String str1 = new String("XYZ");
String str2 = "XYZ";
str2 = "hello";
String str3 = new String(str1);
System.out.println("Str : "+str);
System.out.println("Str1 : "+str1);
System.out.println("Str2 : "+(str1==str3));
System.out.println("Str2 : "+(str1.equals(str3)));
System.out.println("Str1 : "+(str1==str));
}
}
| true |
3f5e47a791e73f512755e9595bf8f4d45f4c49ff | Java | cha63506/CompSecurity | /Shopping/target_source/src/com/pointinside/maps/MapView$AccessibilityNodeProvider.java | UTF-8 | 3,162 | 1.664063 | 2 | [] | no_license | // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package com.pointinside.maps;
import android.content.Context;
import android.graphics.Rect;
import android.os.Bundle;
import android.support.v4.view.a.d;
import android.view.accessibility.AccessibilityEvent;
import com.pointinside.accessibility.AccessibilityNodeProviderBase;
import java.util.Iterator;
import java.util.List;
// Referenced classes of package com.pointinside.maps:
// MapView
private class Base extends AccessibilityNodeProviderBase
{
final MapView this$0;
private Base getItemFromCoordinates(float f, float f1)
{
int i = (int)f;
int j = (int)f1;
for (Iterator iterator = MapView.access$500(MapView.this).iterator(); iterator.hasNext();)
{
Base base = (this._cls0)iterator.next();
if (base.Bounds.contains(i, j))
{
return base;
}
}
return null;
}
protected int getIdForItem(Bounds bounds)
{
return bounds.Id;
}
protected volatile int getIdForItem(Object obj)
{
return getIdForItem((getIdForItem)obj);
}
protected getIdForItem getItemAt(float f, float f1)
{
return getItemFromCoordinates(f, f1);
}
protected volatile Object getItemAt(float f, float f1)
{
return getItemAt(f, f1);
}
protected getItemAt getItemForId(int i)
{
if (i >= 0 && i < MapView.access$500(MapView.this).size())
{
return (this._cls0)MapView.access$500(MapView.this).get(i);
} else
{
return null;
}
}
protected volatile Object getItemForId(int i)
{
return getItemForId(i);
}
protected void getVisibleItems(List list)
{
list.addAll(MapView.access$500(MapView.this));
}
protected boolean performActionForItem(this._cls0 _pcls0, int i, Bundle bundle)
{
return false;
}
protected volatile boolean performActionForItem(Object obj, int i, Bundle bundle)
{
return performActionForItem((performActionForItem)obj, i, bundle);
}
protected void populateEventForItem(performActionForItem performactionforitem, AccessibilityEvent accessibilityevent)
{
accessibilityevent.setContentDescription(performactionforitem.Text);
}
protected volatile void populateEventForItem(Object obj, AccessibilityEvent accessibilityevent)
{
populateEventForItem((populateEventForItem)obj, accessibilityevent);
}
protected void populateNodeForItem(populateEventForItem populateeventforitem, d d1)
{
d1.b(populateeventforitem.Bounds);
d1.c(populateeventforitem.Text);
d1.a(String.valueOf(populateeventforitem.Id));
d1.a(true);
}
protected volatile void populateNodeForItem(Object obj, d d1)
{
populateNodeForItem((populateNodeForItem)obj, d1);
}
public Base(Context context)
{
this$0 = MapView.this;
super(context);
}
}
| true |
f1403ab168bbb04d20c1358b84b2087672eaf8f6 | Java | ialsghi123/java-basic | /src/practice/ch07/ch07_24.java | UTF-8 | 274 | 2.1875 | 2 | [] | no_license | /*
package practice.ch07;
class Outer {
class Inner {
int iv=100;
}
}
public class ch07_24 {
public static void main(String[] args) {
Outer o = new Outer();
Outer.Inner ii = o.new Inner();
System.out.println(ii.iv);
}
}
*/
| true |
193bcd7ba02eaaea80bfb8867ad11855d5e72e22 | Java | Skainerr/blackjack.v3 | /BlackJack3.0/src/com/company/Player.java | UTF-8 | 3,927 | 3.359375 | 3 | [] | no_license | package com.company;
import java.util.ArrayList;
import java.util.List;
public class Player implements IPlayer {
private int playerBank;
private int bet;
private int splitBet;
private String playerName;
private UserInput userInput = new UserInput();
//private List<List<ICard>> hand = new ArrayList<>();
private List<ICard> handOne = new ArrayList<>();
private List<ICard> handTwo = new ArrayList<>();
private int activeHand = 0;
public Player(String playerName){
this.playerName = playerName;
}
@Override
public String getName(){
String getName = playerName;
return getName;
}
@Override
public void changeActiveHand(){
if(activeHand == 0){
activeHand = 1;
}else {
activeHand = 0;}
}
@Override
public void eraseHands(){
handOne.clear();
handTwo.clear();
}
private List<ICard> getActiveHand(){
if(activeHand == 0){
return handOne;
}else{
return handTwo;
}
}
/**
* Add money into players bank
* @param money money to add
*/
@Override
public void addToBank(int money) {
playerBank += money;
}
@Override
public int getBank() {
return playerBank;
}
@Override
public void addCard(ICard iCard) {
getActiveHand().add(iCard);
}
@Override
public boolean wantContinue() {
return userInput.wantContinue(playerName);
}
@Override
public boolean splitHand() {
if((acesOnHand() == 2 || splittable())
&& playerBank >= bet){
if(wantSplitHand()){
handTwo.add(handOne.remove(0));
return true;
}else{return false;}
}
return false;
}
private boolean splittable(){
return handOne.get(0).getValue() == handOne.get(1).getValue() && handOne.get(0).getValue() < 10;
}
private int acesOnHand(){
List<ICard> hand = getActiveHand();
int aces = 0;
for (ICard card : hand){
if (card.getValue() == 11){
aces++;
}
}
return aces;
}
@Override
public boolean wantSplitHand() {
return userInput.wantSplit(playerName);
}
@Override
public int bet() {
bet = userInput.getBet(playerName);
while(bet > playerBank){
System.out.println("Sorry you are don't have enough money, please correct your bet");
bet = userInput.getBet(playerName);
}
playerBank = playerBank - bet;
return bet;
}
@Override
public int getBet(){
return bet;
}
@Override
public int getSplitBet(){
splitBet = this.bet;
return splitBet;
}
@Override
public boolean wantBet() {
return userInput.wantBet();
}
@Override
public int getValueOfHand(){
int valueOfHand = 0;
int counter = acesOnHand();
for (ICard cardInHand : getActiveHand()) {
valueOfHand += cardInHand.getValue();
if(valueOfHand > 21){
if(counter > 0){
valueOfHand = valueOfHand - 10;
counter -= 1;
}
}
}
return valueOfHand;
}
@Override
public boolean wannaNextCard(){
return userInput.wantNextCard();
}
@Override
public List<ICard> getHand() {
return getActiveHand();
}
/*
public List<Integer> getValueOfHand() {
List<Integer> valueOfHands = new ArrayList<>();
int valueOfHand = 0;
for (int i = 0; i < hand.size(); i++) {
ICard cardInHand = hand.get(i);
valueOfHand += cardInHand.getValue();
}
valueOfHands.add(valueOfHand);
return valueOfHands;
}*/
}
| true |
6dfb71d6bfad67beb4c382f84d62085738ea6d3c | Java | RoseWJJ/AjaxTest | /src/com/et/dao/MyFoodDaoImpl.java | UTF-8 | 1,052 | 2.3125 | 2 | [] | no_license | package com.et.dao;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
@Repository
public class MyFoodDaoImpl {
@Autowired
JdbcTemplate jdbcTemplate;
public List<Map<String,Object>> queryFood(String foodnaem) {
String sql="SELECT * FROM food WHERE foodname LIKE '%"+foodnaem+"%'";
return jdbcTemplate.queryForList(sql);
}
public void deleteFood(String foodid) {
String sql="delete FROM food WHERE foodid = "+foodid;
jdbcTemplate.execute(sql);
}
public void addFood(String foodname,String price) {
String sql=" INSERT INTO food (foodname, price) VALUES ('"+foodname+"','"+price+"')";
jdbcTemplate.execute(sql);
}
public void updateFood(String foodid,String foodname,String price) {
String sql="UPDATE food SET foodname = '"+foodname+"' , price = '"+price+"' WHERE foodid = "+foodid;
jdbcTemplate.execute(sql);
}
}
| true |
caa9000301ba45175668b7b68707dda372a30154 | Java | ModernAristotle/aristotle | /web/src/main/java/com/aristotle/web/plugin/impl/TeamPlugin.java | UTF-8 | 2,965 | 2.125 | 2 | [] | no_license | package com.aristotle.web.plugin.impl;
import java.util.Collection;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.ModelAndView;
import com.aristotle.core.persistance.Team;
import com.aristotle.core.persistance.TeamMember;
import com.aristotle.core.service.TeamService;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class TeamPlugin extends AbstractDataPlugin {
@Autowired
private TeamService teamService;
private static final String TEAM_URL_PARAMETER = "teamUrl";
public TeamPlugin() {
}
public TeamPlugin(String pluginName) {
super(pluginName);
}
@Override
public void applyPlugin(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, ModelAndView mv) {
logger.info("Applying {} plugin", name);
try {
JsonObject context = (JsonObject) mv.getModel().get("context");
String teamUrl = getStringParameterFromPathOrParams(httpServletRequest, TEAM_URL_PARAMETER);
logger.info("teamUrl = " + teamUrl);
if (teamUrl == null) {
context.addProperty(name, "{\"error\":\"No TeamUrl Specified\"}");
return;
}
JsonObject jsonObject = new JsonObject();
Team team = teamService.getTeamByUrl(teamUrl);
if (team == null) {
System.out.println("Invalid Team" + teamUrl);
jsonObject.addProperty("message", "Invalid Team");
} else {
List<TeamMember> teamMembers = teamService.getTeamMembersByTeamId(team.getId());
jsonObject.add("team", convertTeam(team));
jsonObject.add("members", convertTeamMembers(teamMembers));
}
context.add(name, jsonObject);
} catch (Exception ex) {
ex.printStackTrace();
}
}
private JsonArray convertTeamMembers(Collection<TeamMember> teamMembers) {
JsonArray teamMemberArray = new JsonArray();
if (teamMembers == null) {
return teamMemberArray;
}
for (TeamMember oneTeamMember : teamMembers) {
JsonObject oneJsonObject = new JsonObject();
oneJsonObject.addProperty("post", oneTeamMember.getPost());
oneJsonObject.addProperty("responsbility", oneTeamMember.getResponsbility());
oneJsonObject.add("user", convertUser(oneTeamMember.getUser()));
teamMemberArray.add(oneJsonObject);
}
return teamMemberArray;
}
}
| true |
2fd6f76d81eda6c03c3d577a9acc2464f9d62456 | Java | Soulballad/study | /pattern-design/pattern-singleton/src/main/java/com/gupao/pattern/singleton/threadlocal/ThreadLocalSingleton.java | UTF-8 | 738 | 3.15625 | 3 | [] | no_license | package com.gupao.pattern.singleton.threadlocal;
import java.util.concurrent.ThreadLocalRandom;
/**
* @author Soulballad
* @date 2019/3/10/0010 15:20
* @email soda931vzr@163.com
* @description 利用ThreadLocal创建单例,伪线程安全,对象在单个线程中是唯一的,多线程下无法保证单例
*/
public class ThreadLocalSingleton {
private static final ThreadLocal<ThreadLocalSingleton> threadLocal = new ThreadLocal<ThreadLocalSingleton>(){
@Override
protected ThreadLocalSingleton initialValue() {
return new ThreadLocalSingleton();
}
};
private ThreadLocalSingleton(){}
public static ThreadLocalSingleton getInstance() {
return threadLocal.get();
}
} | true |
9608086603cf105157a0a08605212eef9cc49c69 | Java | andrecastro/example_project | /src/main/java/br/com/wemob/example_project/ws/resources/config/XStreamJsonProvider.java | UTF-8 | 3,557 | 2.09375 | 2 | [] | no_license | package br.com.wemob.example_project.ws.resources.config;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.ext.Provider;
import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
import com.sun.jersey.core.provider.AbstractMessageReaderWriterProvider;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
import com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver;
import com.thoughtworks.xstream.io.json.JsonHierarchicalStreamDriver;
import com.thoughtworks.xstream.io.json.JsonWriter;
@Produces({MediaType.APPLICATION_JSON})
@Consumes({MediaType.APPLICATION_JSON})
@Provider
public class XStreamJsonProvider extends JacksonJaxbJsonProvider
{
// private static final Set<Class<?>> processed = new HashSet<Class<?>>();
// private static final XStream xstreamIn = new XStream(new JettisonMappedXmlDriver());
// private static final XStream xstreamOut = new XStream(new JsonHierarchicalStreamDriver() {
// public HierarchicalStreamWriter createWriter(Writer writer) {
// return new JsonWriter(writer, JsonWriter.DROP_ROOT_MODE);
// }
// });
// private static final String DEFAULT_ENCODING = "UTF-8";
//
// // Static Initializer
// {
// xstreamIn.setMode(XStream.NO_REFERENCES);
// xstreamOut.setMode(XStream.NO_REFERENCES);
// xstreamOut.autodetectAnnotations(true);
// }
//
// @Override
// public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType arg3) {
// return true;
// }
//
// @Override
// public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType arg3) {
// return true;
// }
//
// protected static String getCharsetAsString(MediaType m) {
// if (m == null) {
// return DEFAULT_ENCODING;
// }
// String result = m.getParameters().get("charset");
// return (result == null) ? DEFAULT_ENCODING : result;
// }
//
// protected XStream getXStreamIn(Class<?> type) {
// synchronized (processed) {
// if (!processed.contains(type)) {
// xstreamIn.processAnnotations(type);
// processed.add(type);
// }
// }
// return xstreamIn;
// }
//
// public Object readFrom(Class<Object> aClass, Type genericType, Annotation[] annotations,
// MediaType mediaType, MultivaluedMap<String, String> map, InputStream stream)
// throws IOException, WebApplicationException {
// String encoding = getCharsetAsString(mediaType);
// XStream xStream = getXStreamIn(aClass);
// return xStream.fromXML(new InputStreamReader(stream, encoding));
// }
//
// public void writeTo(Object o, Class<?> aClass, Type type, Annotation[] annotations,
// MediaType mediaType, MultivaluedMap<String, Object> map, OutputStream stream)
// throws IOException, WebApplicationException {
// String encoding = getCharsetAsString(mediaType);
// xstreamOut.toXML(o, new OutputStreamWriter(stream, encoding));
// }
} | true |
4aaf9835c23d7338035ce76c85d5726e2c7c7ec7 | Java | Miles-Hu/uml | /spring-uml/ioc/SpringIOC架构介绍与源码分析(含插件开发)/code/课程完整源代码-01/src/main/java/com/demoioc/插件线及生命周期/BeanPostProcessorImpl.java | UTF-8 | 1,009 | 2.34375 | 2 | [] | no_license | package com.demoioc.插件线及生命周期;
import lombok.extern.log4j.Log4j;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Service;
@Service
@Log4j
public class BeanPostProcessorImpl implements BeanPostProcessor {
public BeanPostProcessorImpl() {
super();
// log.info("这是BeanPostProcessor实现类构造器!!");
}
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
log.info("【容器级-BeanPostProcessor.postProcessAfterInitialization】对属性进行更改!beanName="+beanName);
return bean;
}
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
log.info("【容器级-BeanPostProcessor.postProcessBeforeInitialization】对属性进行更改!beanName="+beanName);
return bean;
}
} | true |
f56e1d04a121d51f98651cd3c9fc5ccca3481ffe | Java | sung-da/java_work | /java_work/src/example_3/example3_20.java | UHC | 718 | 4.03125 | 4 | [] | no_license | // 0,1,2 ϳ ؼ
// 0̸ "", 1̸ "", 2 "" ǥϴ α ۼϼ.
package example_3;
import java.util.Random;
public class example3_20 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Random rand = new Random();
int n = rand.nextInt(3);
System.out.println(n);
/*
if (n == 0)
System.out.println("");
else if (n == 1)
System.out.println("");
else
System.out.println("");
*/
switch(n) {
case 0:
System.out.println("");
break;
case 1:
System.out.println("");
break;
case 2:
System.out.println("");
break;
}
}
}
| true |
5937eda5026e71cbfeda3aba4f4d67240ec610b7 | Java | PlayersCommittee/gemp-swccg-public | /gemp-swccg-cards/src/main/java/com/gempukku/swccgo/cards/set7/light/Card7_030.java | UTF-8 | 3,812 | 2.234375 | 2 | [
"MIT"
] | permissive | package com.gempukku.swccgo.cards.set7.light;
import com.gempukku.swccgo.cards.AbstractRebel;
import com.gempukku.swccgo.common.ExpansionSet;
import com.gempukku.swccgo.common.Icon;
import com.gempukku.swccgo.common.Rarity;
import com.gempukku.swccgo.common.Side;
import com.gempukku.swccgo.common.Uniqueness;
import com.gempukku.swccgo.filters.Filters;
import com.gempukku.swccgo.game.PhysicalCard;
import com.gempukku.swccgo.game.SwccgGame;
import com.gempukku.swccgo.game.state.WeaponFiringState;
import com.gempukku.swccgo.logic.GameUtils;
import com.gempukku.swccgo.logic.TriggerConditions;
import com.gempukku.swccgo.logic.actions.RequiredGameTextTriggerAction;
import com.gempukku.swccgo.logic.effects.ResetForfeitUntilEndOfTurnEffect;
import com.gempukku.swccgo.logic.modifiers.AddsPowerToPilotedBySelfModifier;
import com.gempukku.swccgo.logic.modifiers.DeployCostAboardModifier;
import com.gempukku.swccgo.logic.modifiers.Modifier;
import com.gempukku.swccgo.logic.timing.EffectResult;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
/**
* Set: Special Edition
* Type: Character
* Subtype: Rebel
* Title: Lieutenant Tarn Mison
*/
public class Card7_030 extends AbstractRebel {
public Card7_030() {
super(Side.LIGHT, 3, 2, 1, 2, 4, "Lieutenant Tarn Mison", Uniqueness.UNIQUE, ExpansionSet.SPECIAL_EDITION, Rarity.R);
setLore("Former Imperial pilot. Joined the Alliance shortly after the Battle of Yavin. Flew cover for Bright Hope during the evacuation of Hoth. Expert marksman.");
setGameText("Deploys -1 aboard your unique (•) Rebel starfighter. Adds 2 to power of anything he pilots. When starfighter he pilots fires a starship weapon, characters aboard target are forfeit = 0 for remainder of turn.");
addIcons(Icon.SPECIAL_EDITION, Icon.PILOT);
}
@Override
protected List<Modifier> getGameTextAlwaysOnModifiers(SwccgGame game, PhysicalCard self) {
List<Modifier> modifiers = new LinkedList<Modifier>();
modifiers.add(new DeployCostAboardModifier(self, -1, Filters.and(Filters.your(self), Filters.unique, Filters.Rebel_starfighter)));
return modifiers;
}
@Override
protected List<Modifier> getGameTextWhileActiveInPlayModifiers(SwccgGame game, final PhysicalCard self) {
List<Modifier> modifiers = new LinkedList<Modifier>();
modifiers.add(new AddsPowerToPilotedBySelfModifier(self, 2));
return modifiers;
}
@Override
protected List<RequiredGameTextTriggerAction> getGameTextRequiredAfterTriggers(SwccgGame game, EffectResult effectResult, PhysicalCard self, int gameTextSourceCardId) {
if (TriggerConditions.weaponJustFiredBy(game, effectResult, Filters.starship_weapon, Filters.and(Filters.starfighter, Filters.hasPiloting(self)))) {
WeaponFiringState weaponFiringState = game.getGameState().getWeaponFiringState();
final Collection<PhysicalCard> characters = Filters.filterActive(game, self, Filters.and(Filters.character, Filters.aboardOrAboardCargoOf(Filters.in(weaponFiringState.getTargets())), Filters.canBeTargetedBy(self)));
if (!characters.isEmpty()) {
final RequiredGameTextTriggerAction action = new RequiredGameTextTriggerAction(self, gameTextSourceCardId);
action.setText("Reset forfeit of characters to 0");
action.setActionMsg("Reset forfeit of characters aboard " + GameUtils.getAppendedNames(weaponFiringState.getTargets()) + " to 0");
// Perform result(s)
action.appendEffect(
new ResetForfeitUntilEndOfTurnEffect(action, characters, 0));
return Collections.singletonList(action);
}
}
return null;
}
}
| true |
e7f1fe99798b1310491d101ce1da87177977c896 | Java | dimitrianos/anax | /anax-chrome-demo-app/src/main/java/org/anax/framework/examples/demotestapp/AnaxChromeDemoAppApplication.java | UTF-8 | 526 | 1.945313 | 2 | [
"BSD-3-Clause"
] | permissive | package org.anax.framework.examples.demotestapp;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
@SpringBootApplication(scanBasePackages = "org.anax.framework")
public class AnaxChromeDemoAppApplication {
public static void main(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(AnaxChromeDemoAppApplication.class);
// not needed, VideoMaker does it on its own, if enabled!
builder.run(args);
}
}
| true |
d098e7529f4d345847e626350654bcbc5f77ab34 | Java | 161250092/Drawing | /src/bussinesslogicservice/RestoreShapeService.java | UTF-8 | 268 | 1.9375 | 2 | [] | no_license | package bussinesslogicservice;
import java.util.ArrayList;
import vo.PointVO;
public interface RestoreShapeService {
/**
*
* @param pointInfo
* @param p1
* @param p2
*/
public void restoreShape(ArrayList<PointVO> pointInfo,PointVO p1,PointVO p2);
}
| true |
089254e739eb03b31ddf3530cbd885bb45f304d8 | Java | dayoungles/2013_02_PLJ_proj_bowling | /Bowling/src/gameOverException.java | UTF-8 | 103 | 2.1875 | 2 | [] | no_license |
public class gameOverException extends Exception {
gameOverException(String msg){
super(msg);
}
}
| true |
7cdd7e059a665c58ade765234109421f8364596b | Java | cotra/project-security-prototype | /Spring-Security-Database/src/main/java/pw/cotra/security/WebSecurityConfigurer.java | UTF-8 | 1,590 | 2.0625 | 2 | [
"MIT"
] | permissive | package pw.cotra.security;
import org.springframework.context.annotation.Bean;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import pw.cotra.security.point.AppAuthenticationEntryPoint;
import pw.cotra.security.service.AppUserDetailsService;
@EnableWebSecurity
public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter {
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
@Bean
public AppAuthenticationEntryPoint appAuthenticationEntryPoint () {
return new AppAuthenticationEntryPoint();
}
@Bean
public AppUserDetailsService appUserDetailsService() {
return new AppUserDetailsService();
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(appUserDetailsService());
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/role/**").permitAll().antMatchers("/user/**").hasRole("USER").anyRequest().authenticated().and().formLogin();
}
}
| true |
3d6a6b234ffd53a3231edf72168a34569742ae5f | Java | Sethucb/Smart-Sensing-using-Proximity-sensor---Android | /app/src/main/java/com/example/sethu/a12_control_media_play_cs580/MainActivity.java | UTF-8 | 2,550 | 2.3125 | 2 | [] | no_license | package com.example.sethu.a12_control_media_play_cs580;
import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.hardware.SensorManager;
import android.hardware.SensorEventListener;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.widget.Toast;
import android.media.AudioManager;
import android.content.Intent;
public class MainActivity extends AppCompatActivity implements SensorEventListener {
private SensorManager sensorManager;
private Sensor sensor;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
sensor = sensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
if(sensor == null) {
System.out.println("NO SENSORRRRR");
finish(); // Close app
}else{
System.out.println("GOTTTTTTTTT THEEEEE SENSORRRRR");
}
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
@Override
public void onSensorChanged(SensorEvent sensorEvent) {
// More code goes here
if(sensorEvent.sensor.getType() == Sensor.TYPE_PROXIMITY) {
if (sensorEvent.values[0] < sensor.getMaximumRange()) {
try{
// Detected something nearby
Toast.makeText(getApplicationContext(), "NEAR", Toast.LENGTH_SHORT).show();
AudioManager mAudioManager = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE);
System.out.println("SENSOR IN CLOSE RANGE==========" + "\n");
Intent i = new Intent("com.android.music.musicservicecommand");
i.putExtra("command", "togglepause");
MainActivity.this.sendBroadcast(i);
}catch(Exception e){
e.printStackTrace();
}
} else {
// Nothing is nearby
Toast.makeText(getApplicationContext(), "FAR", Toast.LENGTH_SHORT).show();
}
}
}
@Override
protected void onResume() {
super.onResume();
sensorManager.registerListener(this, sensor, SensorManager.SENSOR_DELAY_NORMAL);
}
@Override
protected void onPause() {
super.onPause();
sensorManager.unregisterListener(this);
}
}
| true |
bcf423f67dcb82121c4d3d4c85ba94ae9b707d99 | Java | LaoLiuTou/Check | /src/com/check/service/notice_member/Notice_memberServiceImpl.java | UTF-8 | 1,594 | 2.15625 | 2 | [] | no_license | package com.check.service.notice_member;
import java.util.List;
import java.util.Map;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import com.check.dao.notice_member.INotice_memberMapper;
import com.check.model.notice_member.Notice_member;
public class Notice_memberServiceImpl implements INotice_memberService {
@Autowired
private INotice_memberMapper iNotice_memberMapper;
/**
* 通过id选取
* @return
*/
public Notice_member selectnotice_memberById(String id){
return iNotice_memberMapper.selectnotice_memberById(id);
}
/**
* 通过查询参数获取信息
* @return
*/
@SuppressWarnings("rawtypes")
public List<Notice_member> selectnotice_memberByParam(Map paramMap){
return iNotice_memberMapper.selectnotice_memberByParam(paramMap);
}
/**
* 通过查询参数获取总条数
* @return
*/
@SuppressWarnings("rawtypes")
public int selectCountnotice_memberByParam(Map paramMap){
return iNotice_memberMapper.selectCountnotice_memberByParam(paramMap);
}
/**
* 更新
* @return
*/
@Transactional
public int updatenotice_member(Notice_member notice_member){
return iNotice_memberMapper.updatenotice_member(notice_member);
}
/**
* 添加
* @return
*/
@Transactional
public Object addnotice_member(Notice_member notice_member){
return iNotice_memberMapper.addnotice_member(notice_member);
}
/**
* 删除
* @return
*/
@Transactional
public int deletenotice_member(String id){
return iNotice_memberMapper.deletenotice_member(id);
}
}
| true |
3e69a4839d13cf4fdf6f8f69e7ddde67b94987e1 | Java | imny94/TheThrasher | /TheSmartBin_2/app/src/main/java/com/lejit/thesmartbin_2/ManagementActivity.java | UTF-8 | 3,228 | 1.804688 | 2 | [] | no_license | package com.lejit.thesmartbin_2;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import com.firebase.client.DataSnapshot;
import com.firebase.client.Firebase;
import com.firebase.client.FirebaseError;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Date;
import lecho.lib.hellocharts.animation.ChartAnimationListener;
import lecho.lib.hellocharts.listener.LineChartOnValueSelectListener;
import lecho.lib.hellocharts.model.Axis;
import lecho.lib.hellocharts.model.Line;
import lecho.lib.hellocharts.model.LineChartData;
import lecho.lib.hellocharts.model.PointValue;
import lecho.lib.hellocharts.model.ValueShape;
import lecho.lib.hellocharts.model.Viewport;
import lecho.lib.hellocharts.util.ChartUtils;
import lecho.lib.hellocharts.view.Chart;
import lecho.lib.hellocharts.view.LineChartView;
public class ManagementActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_management);
FloatingActionButton managementButton=(FloatingActionButton)findViewById(R.id.fab_arc_menu_2);
managementButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent management =new Intent(ManagementActivity.this,ManagementActivity.class);
ManagementActivity.this.startActivity(management);
}
});
FloatingActionButton logout=(FloatingActionButton)findViewById(R.id.fab_arc_menu_1);
logout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent logoutCall=new Intent(ManagementActivity.this,MainActivity.class);
ManagementActivity.this.startActivity(logoutCall);
}
});
FloatingActionButton userProfile=(FloatingActionButton)findViewById(R.id.fab_arc_menu_3);
userProfile.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent userpro=new Intent(ManagementActivity.this,Main2Activity.class);
ManagementActivity.this.startActivity(userpro);
}
});
FloatingActionButton about=(FloatingActionButton)findViewById(R.id.fab_arc_menu_4);
about.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent aboutPage=new Intent(ManagementActivity.this,About.class);
ManagementActivity.this.startActivity(aboutPage);
}
});
}
public void onDestroy() {
super.onDestroy();
}
}
| true |
0e247dc4da0117390f450b086ce7c2db359c6195 | Java | ZaeemSattar/Notifierx | /app/src/main/java/droid/zaeem/notifierx/activity/Splash.java | UTF-8 | 637 | 1.765625 | 2 | [] | no_license | package droid.zaeem.notifierx.activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import droid.zaeem.notifierx.cachememory.CacheModel;
import droid.zaeem.notifierx.helpers.Constants;
/**
* Created by Droid on 7/16/2016.
*/
public class Splash extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent i = new Intent(Splash.this, MainActivity.class);
startActivity(i);
}
}
| true |
d8f04c8c45a990ecbb855c724bd67a2bf8c4a2f6 | Java | bert-janzwanepol/Spotitube-REST-API | /src/main/java/oose/dea/spotitube/dto/LoginDTO.java | UTF-8 | 111 | 1.5625 | 2 | [] | no_license | package oose.dea.spotitube.dto;
public class LoginDTO
{
public String password;
public String user;
}
| true |
adef5cd74bf75591e74fefa468260daddde5cde0 | Java | tigergithub01/sales | /src/com/sales/service/business/impl/DrpBrandServiceImpl.java | UTF-8 | 2,242 | 2.21875 | 2 | [] | no_license | package com.sales.service.business.impl;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.sales.dao.business.DrpBrandMapper;
import com.sales.model.business.DrpBrand;
import com.sales.service.business.DrpBrandService;
import com.sales.util.pager.helper.PageInfo;
import com.sales.util.pager.helper.PaginatedListHelper;
@Service("drpBrandService")
public class DrpBrandServiceImpl implements DrpBrandService {
@Resource
private DrpBrandMapper drpBrandMapper;
@Override
public int deleteByPrimaryKey(Long id) {
return drpBrandMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(DrpBrand record) {
return drpBrandMapper.insert(record);
}
@Override
public int insertSelective(DrpBrand record) {
return drpBrandMapper.insertSelective(record);
}
@Override
public DrpBrand selectByPrimaryKey(Long id) {
return drpBrandMapper.selectByPrimaryKey(id);
}
@Override
public DrpBrand selectBySelective(DrpBrand record) {
List<DrpBrand> selectList = this.selectList(record);
if(selectList!=null && !(selectList.isEmpty())){
return selectList.get(0);
}else{
return null;
}
}
@Override
public int updateByPrimaryKeySelective(DrpBrand record) {
return drpBrandMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(DrpBrand record) {
return drpBrandMapper.updateByPrimaryKey(record);
}
@Override
public List<DrpBrand> selectList(
DrpBrand record) {
PageInfo pageInfo = new PageInfo();
pageInfo.setPageNumber(1);
pageInfo.setPageSize(Integer.MAX_VALUE);
return this.selectList(record, pageInfo).getList();
}
@Override
public PaginatedListHelper selectList(
DrpBrand record,PageInfo pageInfo) {
if(record==null){
record = new DrpBrand();
}
List<DrpBrand> list = drpBrandMapper.selectList(record,pageInfo);
PaginatedListHelper helper = new PaginatedListHelper();
// helper.setPageNumber(pageInfo.getPageNumber());
// helper.setPageSize(pageInfo.getPageSize());
helper.setList(list);
helper.setFullListSize(pageInfo.getTotalCount());
return helper;
}
}
| true |
4b74141790cfcf685b04d8e73e953efd7a10aeb7 | Java | leonel-aguirre/Graphics.Transformations-Project | /src/main/java/com/noisyapple/AbstractDialogForm.java | UTF-8 | 1,961 | 3.234375 | 3 | [] | no_license | package com.noisyapple;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.util.Arrays;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
// An abstract dialog panel which is built based on the amount of labels passed.
@SuppressWarnings("serial")
public class AbstractDialogForm extends JPanel {
public static final int TRANSLATE = 0, ROTATE = 1, SCALE = 2, SHEAR = 3;
private JPanel topPanel, centerPanel;
private JPanel[] optPanels;
private JTextField[] txtOpts;
private String instruction;
private String[] labels;
// Constructor.
public AbstractDialogForm(String instruction, String[] labels) {
topPanel = new JPanel();
centerPanel = new JPanel(new GridLayout(1, 2));
optPanels = new JPanel[labels.length];
txtOpts = new JTextField[labels.length];
for (int i = 0; i < labels.length; i++) {
optPanels[i] = new JPanel();
txtOpts[i] = new JTextField(5);
}
this.instruction = instruction;
this.labels = labels;
setAttributes();
build();
}
// Sets attributes to elements in the class.
public void setAttributes() {
this.setLayout(new BorderLayout());
}
// Builds the panel.
public void build() {
// Top Panel.
topPanel.add(new JLabel(instruction));
// Center Panel.
for (int i = 0; i < optPanels.length; i++) {
optPanels[i].add(new JLabel(labels[i]));
optPanels[i].add(txtOpts[i]);
centerPanel.add(optPanels[i]);
}
// Panel.
this.add(topPanel, BorderLayout.NORTH);
this.add(centerPanel, BorderLayout.CENTER);
}
// Returns an array with the values entered in the text inputs.
public double[] getValues() {
return Arrays.stream(txtOpts).mapToDouble(e -> Double.parseDouble(e.getText())).toArray();
}
}
| true |
f14d5f6e8be39d4afcad576776a4781691414ddd | Java | Licardo/sharediary | /app/src/main/java/we/sharediary/table/WEDiary.java | UTF-8 | 2,028 | 1.789063 | 2 | [
"Apache-2.0"
] | permissive | package we.sharediary.table;
import cn.bmob.v3.BmobObject;
import cn.bmob.v3.datatype.BmobFile;
/**
* Created by zhanghao on 2016/11/20.
*/
public class WEDiary extends BmobObject {
/**
* 附件
*/
private BmobFile attachment;
/**
* 内容
*/
private String content;
/**
* 显示日期
*/
private String date;
/**
* 最高温度
*/
private String toptemp;
/**
* 最低温度
*/
private String lowtemp;
/**
* 天气
*/
private String weather;
/**
* 温馨提示
*/
private String lovetip;
/**
* 作者
*/
private WEUser author;
private String phone;
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public BmobFile getAttachment() {
return attachment;
}
public void setAttachment(BmobFile attachment) {
this.attachment = attachment;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getWeather() {
return weather;
}
public void setWeather(String weather) {
this.weather = weather;
}
public String getLovetip() {
return lovetip;
}
public void setLovetip(String lovetip) {
this.lovetip = lovetip;
}
public String getToptemp() {
return toptemp;
}
public void setToptemp(String toptemp) {
this.toptemp = toptemp;
}
public String getLowtemp() {
return lowtemp;
}
public void setLowtemp(String lowtemp) {
this.lowtemp = lowtemp;
}
public WEUser getAuthor() {
return author;
}
public void setAuthor(WEUser author) {
this.author = author;
}
}
| true |
388eccfcc018d5310746ebca17f43352bcc00e13 | Java | kirstins/Kuluarvestus | /src/Aken.java | UTF-8 | 4,336 | 2.71875 | 3 | [] | no_license | import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import java.util.ArrayList;
import java.util.Arrays;
/**
* Created by kirstin on 01/02/2017.
*/
public class Aken {
Stage stage = new Stage();
VBox vbox;
Scene scene;
Button button;
TextField palk;
TextField kululiik;
TextField kulu;
Label label1;
Label label2;
int sissetulek;
String tekst;
String tekst2;
Kulud kulud = new Kulud();
/*ArrayList <String> kululiigid = new ArrayList<>();
ArrayList <String> kulusummad = new ArrayList <>();*/
public Aken (){
seadistaakaen ();
sisestaPalk ();
sisestaKulud ();
}
private void seadistaakaen() {
vbox = new VBox();
scene = new Scene(vbox, 500, 500);
stage.setScene(scene);
stage.show();
palk = new TextField();
palk.setPromptText("Sisesta palk");
kululiik = new TextField();
kululiik.setPromptText("Sisesta kululiik");
kulu = new TextField();
kulu.setPromptText("Sisesta kulu suurus");
button = new Button("Salvesta kulu");
label1 = new Label("Alles on kogu palk");
label2 = new Label("Maksimaalne kulu ilmub siia");
vbox.getChildren().addAll(palk, kululiik, kulu, button,label1, label2);
}
private void sisestaPalk() {
palk.textProperty().addListener((observable, vanaVaartus, uusVaartus) -> {
kulud.kustutaAndmed();
label1.setText("Alles on kogu palk");
label2.setText("Maksimaalne kulu ilmub siia");
sissetulek = Integer.parseInt(uusVaartus);
});
}
private void sisestaKulud() {
button.setOnAction(event-> {
tekst = kululiik.getText();
tekst2 = kulu.getText();
if (Integer.parseInt(tekst2)>sissetulek){
System.out.println("Kulu on suurem kui sissetulek!");
}
else if (Integer.parseInt(tekst2)<(sissetulek)- kulud.kuludkokku()){
kulud.lisaandmed(tekst, tekst2);
int rahaalles = sissetulek - kulud.kuludkokku();
String info = new String("Alles on "+rahaalles+" eurot");
String info2 = new String(kulud.maxKulu());
label1.setText(info);
kulud.maxKulu();
label2.setText(info2);
}
else{
VBox vbox2 = new VBox();
Scene scene2 = new Scene (vbox2, 500, 500);
stage.setScene(scene2);
stage.show();
Label label3=new Label();
Button button3= new Button("Jah, olen nõus!");
Button button4= new Button ("Ei ole nõus!");
vbox2.getChildren().addAll(label3, button3, button4);
label3.setText(" Kas sa oled valmis järgmisest kulust loobuma: "+kulud.randomKulu()+"?");
button3.setOnAction(event2->{
kulud.kustutaKulu();
stage.setScene(scene);
stage.show();
int rahaalles = sissetulek - kulud.kuludkokku();
String info = new String("Alles on "+rahaalles+" eurot");
String info2 = new String(kulud.maxKulu());
label1.setText(info);
kulud.maxKulu();
label2.setText(info2);
});
button4.setOnAction(event3->{
label3.setText(" Kas sa oled valmis järgmisest kulust loobuma: "+kulud.randomKulu()+"?");
});
}
kululiik.clear();
kulu.clear();
/* System.out.println(kululiigid.size());
for (int i=0; i<kululiigid.size(); i++){
System.out.println(kululiigid.get(i));
}
});
}
private void loobuKulust() {*/
});
}
} | true |
a9afc0ec457c6f5b19976e81ce83cd4300239adc | Java | TaulantFazliu/E-Purchasing | /Backend/marketManagement-service/src/main/java/com/epurchasing/marketManagement/VO/ProductCategory.java | UTF-8 | 278 | 1.71875 | 2 | [] | no_license | package com.epurchasing.marketManagement.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ProductCategory {
private int prodCategoryId;
private int prodCategoryName;
}
| true |
ced03f1835cdf1021292abe4fce4943c6b95cb32 | Java | FHI360/m360wv | /app/src/main/java/com/org/fhi360/m360wv/data/ODKInstances.java | UTF-8 | 3,177 | 2.171875 | 2 | [] | no_license | package com.org.fhi360.m360wv.data;
import android.database.Cursor;
import java.util.ArrayList;
import java.util.List;
/**
* Created by jalfaro on 5/13/17.
*/
public class ODKInstances {
private int _id;
private String displayName, submissionUri, canEditWhenComplete, instanceFilePath , jrFormId , jrVersion,
status, date, displaySubtext;
public int get_id() {
return _id;
}
public void set_id(int _id) {
this._id = _id;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public String getSubmissionUri() {
return submissionUri;
}
public void setSubmissionUri(String submissionUri) {
this.submissionUri = submissionUri;
}
public String getCanEditWhenComplete() {
return canEditWhenComplete;
}
public void setCanEditWhenComplete(String canEditWhenComplete) {
this.canEditWhenComplete = canEditWhenComplete;
}
public String getInstanceFilePath() {
return instanceFilePath;
}
public void setInstanceFilePath(String instanceFilePath) {
this.instanceFilePath = instanceFilePath;
}
public String getJrFormId() {
return jrFormId;
}
public void setJrFormId(String jrFormId) {
this.jrFormId = jrFormId;
}
public String getJrVersion() {
return jrVersion;
}
public void setJrVersion(String jrVersion) {
this.jrVersion = jrVersion;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getDisplaySubtext() {
return displaySubtext;
}
public void setDisplaySubtext(String displaySubtext) {
this.displaySubtext = displaySubtext;
}
public static List<ODKInstances> getODKInstancesFromCursor (Cursor c) {
List<ODKInstances> result = new ArrayList<ODKInstances>();
ODKInstances temp;
c.moveToFirst();
while(!c.isAfterLast()) {
temp = new ODKInstances();
temp.set_id(c.getInt(c.getColumnIndex("_id")));
temp.setDisplayName(c.getString(c.getColumnIndex("displayName")));
temp.setSubmissionUri(c.getString(c.getColumnIndex("submissionUri")));
temp.setCanEditWhenComplete(c.getString(c.getColumnIndex("canEditWhenComplete")));
temp.setInstanceFilePath(c.getString(c.getColumnIndex("instanceFilePath")));
temp.setJrFormId(c.getString(c.getColumnIndex("jrFormId")));
temp.setJrVersion(c.getString(c.getColumnIndex("jrVersion")));
temp.setStatus(c.getString(c.getColumnIndex("status")));
temp.setDate(c.getString(c.getColumnIndex("date")));
temp.setDisplaySubtext(c.getString(c.getColumnIndex("displaySubtext")));
result.add(temp);
c.moveToNext();
}
return result;
}
} | true |
43fd37fa56c8e337b035925edd4d8a4394cd7cc1 | Java | tak-hashimoto/java | /Sample/05/testSuperSubClass.java | UTF-8 | 602 | 2.890625 | 3 | [] | no_license | class testSuperSubClass{
public static void main(String args[]){
// superClassを継承するsubClass インスタンスを生成し、subClass型のobjSubに代入する。
subClass objSub = new subClass();
//superClassから継承したインスタンスメソッドdispNameSuper()を実行する。
objSub.dispNameSuper();
//superClassのインスタンスフィールド「name」を出力する。
System.out.println(objSub.name + "で" + objSub.memo);
// インスタンスメソッドdispName(Override)を実行する。
objSub.dispNameOverrideTest();
}
}
| true |
7a40a68c116ecb269a14a08f877a176138c0001b | Java | Yasinaaa/AndroidLab | /UnitTesting/app/src/main/java/ru/itis/lectures/unittesting/junit/LocalSecurePassword.java | UTF-8 | 960 | 2.671875 | 3 | [] | no_license | package ru.itis.lectures.unittesting.junit;
import android.support.annotation.NonNull;
/**
* @author Artur Vasilov
*/
public class LocalSecurePassword {
private static LocalSecurePassword sInstance;
private int mHash = 0;
private LocalSecurePassword(@NonNull String password) {
mHash = password.hashCode();
}
@NonNull
public static LocalSecurePassword getInstance() {
if (sInstance == null) {
throw new IllegalStateException("You should initialize instance fist");
}
return sInstance;
}
public static void destroy() {
sInstance = null;
}
@NonNull
public static LocalSecurePassword create(@NonNull String password) {
sInstance = new LocalSecurePassword(password);
return sInstance;
}
public boolean checkPassword(@NonNull String password) {
return mHash == password.hashCode();
}
}
| true |
db7c45302bec87a137e0c64895fa72fe17c9210b | Java | shd188/Gank | /app/src/main/java/com/aimer/shd/gank/ui/MainActivity.java | UTF-8 | 2,671 | 1.890625 | 2 | [] | no_license | package com.aimer.shd.gank.ui;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
import com.aimer.shd.gank.R;
import com.aimer.shd.gank.adapter.MainPagerAdapter;
import com.aimer.shd.gank.base.ToolbarActivity;
import butterknife.Bind;
import butterknife.BindColor;
import butterknife.ButterKnife;
public class MainActivity extends ToolbarActivity {
@BindColor(R.color.colorPrimaryDark)
int colorPrimaryDark;
@Bind(R.id.mViewPager)
ViewPager mViewPager;
@Bind(R.id.tabLayout)
TabLayout mTabLayout;
private MainPagerAdapter mPagerAdapter;
@Override
protected int provideContentViewId() {
return R.layout.activity_main;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ButterKnife.bind(this);
// configView();
initViewPager();
mTabLayout.setupWithViewPager(mViewPager);
}
private void initViewPager() {
mPagerAdapter = new MainPagerAdapter(getSupportFragmentManager());
mPagerAdapter.addFragment(ArticleFragment.getInstance(getString(R.string.Android)), getString(R.string.Android));
mPagerAdapter.addFragment(ArticleFragment.getInstance(getString(R.string.iOS)), getString(R.string.iOS));
mPagerAdapter.addFragment(ArticleFragment.getInstance(getString(R.string.resource)), getString(R.string.resource));
mPagerAdapter.addFragment(ArticleFragment.getInstance(getString(R.string.recommend)), getString(R.string.recommend));
mViewPager.setAdapter(mPagerAdapter);
}
// private void configView() {
// // 创建状态栏的管理实例
// SystemBarTintManager tintManager = new SystemBarTintManager(this);
// // 激活状态栏设置
// tintManager.setStatusBarTintEnabled(true);
// // 激活导航栏设置
// tintManager.setNavigationBarTintEnabled(true);
//
// tintManager.setStatusBarTintColor(colorPrimaryDark);
//
// }
@Override
protected boolean hasTabLayout() {
return true;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_settings:
Toast.makeText(MainActivity.this, "setting", Toast.LENGTH_SHORT).show();
break;
}
return true;
}
}
| true |
b09be2f3b9a2c7b8463cdc98db93f54d54d535fe | Java | fmotot/Devinet | /app/src/main/java/fr/eni/devinet/dal/WordListDao.java | UTF-8 | 1,614 | 2.234375 | 2 | [] | no_license | package fr.eni.devinet.dal;
import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;
import java.util.List;
import fr.eni.devinet.model.LevelWithProgress;
import fr.eni.devinet.model.Word;
import fr.eni.devinet.model.WordList;
import fr.eni.devinet.model.WordListWithProgress;
@Dao
public interface WordListDao {
@Insert
void insert(WordList wordList);
@Query("SELECT * FROM WordList")
LiveData<List<WordList>> get();
@Query("SELECT * FROM WordList WHERE name = :name AND level_id = :level_id")
WordList get(String name, int level_id);
/**
* Récupère la liste des WordList avec la progression
*
* @param levelId
* @return
*/
@Query("SELECT WordList.*, COUNT(*) as total, t.progress " +
"FROM WordList " +
"INNER JOIN Word ON WordList.id = Word.list_id " +
"LEFT JOIN ( " +
" SELECT WordList.id, COUNT(*) AS progress " +
" FROM WordList " +
" INNER JOIN Word ON WordList.id = Word.list_id " +
" WHERE Word.word = Word.proposal " +
" AND WordList.level_id = :levelId " +
" GROUP BY WordList.id " +
") AS t ON t.id = WordList.id " +
"WHERE WordList.level_id = :levelId " +
"GROUP BY WordList.id")
LiveData<List<WordListWithProgress>> getWithProgress(int levelId);
@Update
void update(WordList wordList);
@Delete
void delete(WordList wordList);
}
| true |
2f842057a160f3e1a493c75411cfb4694699c822 | Java | yangyh1012/TCNotification | /MyApplication2/app/src/main/java/com/zhangzhouhyx/myapplication/Main3Activity.java | UTF-8 | 2,327 | 2.203125 | 2 | [
"MIT"
] | permissive | package com.zhangzhouhyx.myapplication;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import com.zhangzhouhyx.myapplication.R;
import com.zhangzhouhyx.myapplication.notification.TCNotificationCenter;
import com.zhangzhouhyx.myapplication.notification.TCThreadMode;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import static com.zhangzhouhyx.myapplication.notification.TCThreadMode.ASYNC_ThreadMode;
import static com.zhangzhouhyx.myapplication.notification.TCThreadMode.MAIN_ThreadMode;
public class Main3Activity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main3);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
TCNotificationCenter.defaultCenter().addObserver(this, "printSelf", "MainActivity");
TCNotificationCenter.defaultCenter().addObserver(this, "printSelf3", "MainActivity2");
}
public void onClick(View view) {
// Intent intent = new Intent(this, Main2Activity.class);//显示intent
Intent intent = new Intent(this, Main2Activity.class);//显示intent
startActivity(intent);
}
@TCThreadMode()
public void printSelf (Map<String, String> param) {
Log.d("dddd", "Main3Activity printSelf 这个方法被调用了!");
Log.d("dddd", "Thread.currentThread().getName() " + Thread.currentThread().getName());
}
@TCThreadMode(threadMode = ASYNC_ThreadMode)
public void printSelf3 (Map<String, String> param) {
Log.d("dddd", "Main3Activity printSelf3 这个方法被调用了!");
Log.d("dddd", "Thread.currentThread().getName() " + Thread.currentThread().getName());
}
@Override
protected void onDestroy() {
super.onDestroy();
TCNotificationCenter.defaultCenter().removeObserver(this, "MainActivity2");
Log.d("dddd", "Main3Activity onDestroy 这个方法被调用了!");
}
}
| true |
70dcd49f563c18e8e4494d97f22511f9eee7976f | Java | MR-JDY/JavaStack | /vn-common-core/src/main/java/com/vaynenet/core/config/BannerInitializer.java | UTF-8 | 1,243 | 2.140625 | 2 | [] | no_license | package com.vaynenet.core.config;
import com.nepxion.banner.BannerConstant;
import com.nepxion.banner.Description;
import com.nepxion.banner.LogoBanner;
import com.taobao.text.Color;
import com.vaynenet.core.constant.CommonConstant;
import com.vaynenet.core.utils.CustomBanner;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
public class BannerInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {
@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
if (!(applicationContext instanceof AnnotationConfigApplicationContext)) {
LogoBanner logoBanner = new LogoBanner(BannerInitializer.class, "/vayne/logo.txt", "欢迎来到英雄联盟!", 3, 6, new Color[3], true);
CustomBanner.show(logoBanner, new Description(BannerConstant.VERSION + ":", CommonConstant.PROJECT_VERSION, 0, 1)
, new Description("世界第一ADC:", "薇恩-UZI", 0, 1)
, new Description("世界第一喷子:", "JOE", 0, 1)
);
}
}
}
| true |
fe7f257b0c7d691c55898e6234fde41146dcdd4c | Java | ErJaneh/PruebaProduccion | /SGII/src/main/java/cr/ac/una/reg/info/business/DistritoBusiness.java | UTF-8 | 1,944 | 2.3125 | 2 | [] | no_license | /*
* 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 cr.ac.una.reg.info.business;
import cr.ac.una.reg.info.beans.CantonBean;
import cr.ac.una.reg.info.beans.DistritoBean;
import cr.ac.una.reg.info.dao.DistritoDaoImp;
import cr.ac.una.reg.info.exceptions.ExceptionConnection;
import cr.ac.una.reg.info.exceptions.ExceptionGeneral;
import java.util.List;
/**
*
* @author sylin
*/
public class DistritoBusiness {
private final DistritoDaoImp distritoDaoImp;
public DistritoBusiness() throws ExceptionConnection {
this.distritoDaoImp = new DistritoDaoImp();
}
public List<DistritoBean> ListarDistritoPorCanton(String canton) throws ExceptionGeneral {
List<DistritoBean> listaDistritos = null;
try {
listaDistritos = this.distritoDaoImp.ListarDistritoPorCanton(canton);
} catch (ExceptionConnection exc) {
throw new ExceptionGeneral(exc.getMensajeError(), exc.getMensajeTecnico(), 1, false, 1, "distritoBusiness", 1);
} catch (Exception ex) {
throw new ExceptionGeneral("2006:" + "Problemas a consultar los registros ...", ex.toString(), 1, false, 1, "distritoBusiness", 1);
}
return listaDistritos;
}
public DistritoBean distritoPorCodigo(String distrito) throws ExceptionGeneral {
DistritoBean aux = null;
try {
aux = this.distritoDaoImp.DistritoPorCodigo(distrito);
} catch (ExceptionConnection exc) {
throw new ExceptionGeneral(exc.getMensajeError(), exc.getMensajeTecnico(), 1, false, 1, "provinciaBusiness", 1);
} catch (Exception ex) {
throw new ExceptionGeneral("2006:" + "Problemas a consultar los registros ...", ex.toString(), 1, false, 1, "provinciaBusiness", 1);
}
return aux;
}
}
| true |
03e2f25123370237bb13b2f38fd463d598f751b3 | Java | unrealwork/adaptive-java | /src/test/java/org/stepik/csc/algorithms/divcon/BinarySearchTest.java | UTF-8 | 343 | 2.515625 | 3 | [] | no_license | package org.stepik.csc.algorithms.divcon;
import org.testng.Assert;
import org.testng.annotations.Test;
public class BinarySearchTest {
@Test
public void testBinarySearch() {
Assert.assertEquals(BinarySearch.find(new Integer[]{1, 2, 3}, 3), 3);
Assert.assertEquals(BinarySearch.find(new Integer[]{1, 5, 8, 12, 13}, 8), 3);
}
} | true |
0d95ea99923eed61b5b90ca7b58a9f7a7e5e7565 | Java | typeout/Bank_accounts_honors_project | /src/accounts/AccountsView.java | UTF-8 | 43,969 | 2.015625 | 2 | [] | no_license |
package accounts;
import business.Account;
import business.Checking;
import business.MoneyMarket;
import business.Savings;
import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.NumberFormat;
import java.util.ArrayList;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.filechooser.FileNameExtensionFilter;
/**
* The application's main frame.
*/
public class AccountsView extends FrameView {
Account a;
public AccountsView(SingleFrameApplication app) {
super(app);
initComponents();
setInputLine(false);
// status bar initialization - message timeout, idle icon and busy animation, etc
ResourceMap resourceMap = getResourceMap();
int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
messageTimer = new Timer(messageTimeout, new ActionListener() {
public void actionPerformed(ActionEvent e) {
statusMessageLabel.setText("");
}
});
messageTimer.setRepeats(false);
int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
for (int i = 0; i < busyIcons.length; i++) {
busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
}
busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
public void actionPerformed(ActionEvent e) {
busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
}
});
idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
statusAnimationLabel.setIcon(idleIcon);
progressBar.setVisible(false);
// connecting action tasks to status bar via TaskMonitor
TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
public void propertyChange(java.beans.PropertyChangeEvent evt) {
String propertyName = evt.getPropertyName();
if ("started".equals(propertyName)) {
if (!busyIconTimer.isRunning()) {
statusAnimationLabel.setIcon(busyIcons[0]);
busyIconIndex = 0;
busyIconTimer.start();
}
progressBar.setVisible(true);
progressBar.setIndeterminate(true);
} else if ("done".equals(propertyName)) {
busyIconTimer.stop();
statusAnimationLabel.setIcon(idleIcon);
progressBar.setVisible(false);
progressBar.setValue(0);
} else if ("message".equals(propertyName)) {
String text = (String)(evt.getNewValue());
statusMessageLabel.setText((text == null) ? "" : text);
messageTimer.restart();
} else if ("progress".equals(propertyName)) {
int value = (Integer)(evt.getNewValue());
progressBar.setVisible(true);
progressBar.setIndeterminate(false);
progressBar.setValue(value);
}
}
});
}
@Action
public void showAboutBox() {
if (aboutBox == null) {
JFrame mainFrame = AccountsApp.getApplication().getMainFrame();
aboutBox = new AccountsAboutBox(mainFrame);
aboutBox.setLocationRelativeTo(mainFrame);
}
AccountsApp.getApplication().show(aboutBox);
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
mainPanel = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
jlblStartVal1 = new javax.swing.JLabel();
jtxtDisplayName = new javax.swing.JTextField();
jlblStartVal2 = new javax.swing.JLabel();
jtxtAcctNo = new javax.swing.JTextField();
jlblStartVal3 = new javax.swing.JLabel();
jtxtAcctTypeDesc = new javax.swing.JTextField();
jlblStartVal4 = new javax.swing.JLabel();
jtxtBalance = new javax.swing.JTextField();
jtxtAcctTypeCd = new javax.swing.JTextField();
jlblTypeCd = new javax.swing.JLabel();
jtxtTypeCd = new javax.swing.JTextField();
jlblAcctNm = new javax.swing.JLabel();
jtxtAcctNm = new javax.swing.JTextField();
jlblStartVal = new javax.swing.JLabel();
jtxtStartVal = new javax.swing.JTextField();
jbtnCreate = new javax.swing.JButton();
jbtnCancel = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jtxtChgAmt = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jtxtChgDesc = new javax.swing.JTextField();
jbtnChg = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
jtxtPmt = new javax.swing.JTextField();
jbtnPmt = new javax.swing.JButton();
jLabel4 = new javax.swing.JLabel();
jtxtRate = new javax.swing.JTextField();
jbtnIntTrans = new javax.swing.JButton();
jbtnLog = new javax.swing.JButton();
menuBar = new javax.swing.JMenuBar();
javax.swing.JMenu fileMenu = new javax.swing.JMenu();
jmnuAsset = new javax.swing.JMenu();
jmnuCK = new javax.swing.JMenuItem();
jmnuSV = new javax.swing.JMenuItem();
jmnuMM = new javax.swing.JMenuItem();
jmnuOpen = new javax.swing.JMenuItem();
javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
javax.swing.JMenu helpMenu = new javax.swing.JMenu();
javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
statusPanel = new javax.swing.JPanel();
javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();
statusMessageLabel = new javax.swing.JLabel();
statusAnimationLabel = new javax.swing.JLabel();
progressBar = new javax.swing.JProgressBar();
mainPanel.setName("mainPanel"); // NOI18N
jPanel1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
jPanel1.setName("jPanel1"); // NOI18N
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(accounts.AccountsApp.class).getContext().getResourceMap(AccountsView.class);
jlblStartVal1.setFont(resourceMap.getFont("jlblStartVal1.font")); // NOI18N
jlblStartVal1.setText(resourceMap.getString("jlblStartVal1.text")); // NOI18N
jlblStartVal1.setName("jlblStartVal1"); // NOI18N
jtxtDisplayName.setName("jtxtDisplayName"); // NOI18N
jlblStartVal2.setFont(resourceMap.getFont("jlblStartVal2.font")); // NOI18N
jlblStartVal2.setText(resourceMap.getString("jlblStartVal2.text")); // NOI18N
jlblStartVal2.setName("jlblStartVal2"); // NOI18N
jtxtAcctNo.setName("jtxtAcctNo"); // NOI18N
jlblStartVal3.setFont(resourceMap.getFont("jlblStartVal3.font")); // NOI18N
jlblStartVal3.setText(resourceMap.getString("jlblStartVal3.text")); // NOI18N
jlblStartVal3.setToolTipText(resourceMap.getString("jlblStartVal3.toolTipText")); // NOI18N
jlblStartVal3.setName("jlblStartVal3"); // NOI18N
jtxtAcctTypeDesc.setName("jtxtAcctTypeDesc"); // NOI18N
jlblStartVal4.setFont(resourceMap.getFont("jlblStartVal4.font")); // NOI18N
jlblStartVal4.setText(resourceMap.getString("jlblStartVal4.text")); // NOI18N
jlblStartVal4.setToolTipText(resourceMap.getString("jlblStartVal4.toolTipText")); // NOI18N
jlblStartVal4.setName("jlblStartVal4"); // NOI18N
jtxtBalance.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jtxtBalance.setName("jtxtBalance"); // NOI18N
jtxtAcctTypeCd.setText(resourceMap.getString("jtxtAcctTypeCd.text")); // NOI18N
jtxtAcctTypeCd.setName("jtxtAcctTypeCd"); // NOI18N
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jlblStartVal2)
.addGap(17, 17, 17)
.addComponent(jtxtAcctNo, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jlblStartVal3, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jlblStartVal1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jtxtDisplayName, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jtxtAcctTypeCd, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jtxtAcctTypeDesc, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jlblStartVal4, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jtxtBalance, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(11, 11, 11)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jtxtDisplayName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlblStartVal1))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jtxtAcctNo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlblStartVal2)
.addComponent(jlblStartVal3)
.addComponent(jtxtAcctTypeDesc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlblStartVal4)
.addComponent(jtxtBalance, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jtxtAcctTypeCd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(27, Short.MAX_VALUE))
);
jlblTypeCd.setFont(resourceMap.getFont("jlblTypeCd.font")); // NOI18N
jlblTypeCd.setText(resourceMap.getString("jlblTypeCd.text")); // NOI18N
jlblTypeCd.setName("jlblTypeCd"); // NOI18N
jtxtTypeCd.setEditable(false);
jtxtTypeCd.setBackground(resourceMap.getColor("jtxtTypeCd.background")); // NOI18N
jtxtTypeCd.setText(resourceMap.getString("jtxtTypeCd.text")); // NOI18N
jtxtTypeCd.setName("jtxtTypeCd"); // NOI18N
jlblAcctNm.setFont(resourceMap.getFont("jlblAcctNm.font")); // NOI18N
jlblAcctNm.setText(resourceMap.getString("jlblAcctNm.text")); // NOI18N
jlblAcctNm.setName("jlblAcctNm"); // NOI18N
jtxtAcctNm.setName("jtxtAcctNm"); // NOI18N
jlblStartVal.setFont(resourceMap.getFont("jlblStartVal.font")); // NOI18N
jlblStartVal.setText(resourceMap.getString("jlblStartVal.text")); // NOI18N
jlblStartVal.setName("jlblStartVal"); // NOI18N
jtxtStartVal.setName("jtxtStartVal"); // NOI18N
jbtnCreate.setText(resourceMap.getString("jbtnCreate.text")); // NOI18N
jbtnCreate.setName("jbtnCreate"); // NOI18N
jbtnCreate.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtnCreateActionPerformed(evt);
}
});
jbtnCancel.setText(resourceMap.getString("jbtnCancel.text")); // NOI18N
jbtnCancel.setName("jbtnCancel"); // NOI18N
jbtnCancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtnCancelActionPerformed(evt);
}
});
jPanel2.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
jPanel2.setName("jPanel2"); // NOI18N
jLabel1.setFont(resourceMap.getFont("jLabel1.font")); // NOI18N
jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
jLabel1.setName("jLabel1"); // NOI18N
jtxtChgAmt.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jtxtChgAmt.setText(resourceMap.getString("jtxtChgAmt.text")); // NOI18N
jtxtChgAmt.setName("jtxtChgAmt"); // NOI18N
jLabel2.setFont(resourceMap.getFont("jLabel2.font")); // NOI18N
jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
jLabel2.setName("jLabel2"); // NOI18N
jtxtChgDesc.setName("jtxtChgDesc"); // NOI18N
jbtnChg.setText(resourceMap.getString("jbtnChg.text")); // NOI18N
jbtnChg.setName("jbtnChg"); // NOI18N
jbtnChg.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtnChgActionPerformed(evt);
}
});
jLabel3.setFont(resourceMap.getFont("jLabel3.font")); // NOI18N
jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
jLabel3.setName("jLabel3"); // NOI18N
jtxtPmt.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jtxtPmt.setName("jtxtPmt"); // NOI18N
jbtnPmt.setText(resourceMap.getString("jbtnPmt.text")); // NOI18N
jbtnPmt.setName("jbtnPmt"); // NOI18N
jbtnPmt.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtnPmtActionPerformed(evt);
}
});
jLabel4.setFont(resourceMap.getFont("jLabel4.font")); // NOI18N
jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
jLabel4.setName("jLabel4"); // NOI18N
jtxtRate.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
jtxtRate.setName("jtxtRate"); // NOI18N
jbtnIntTrans.setText(resourceMap.getString("jbtnIntTrans.text")); // NOI18N
jbtnIntTrans.setToolTipText(resourceMap.getString("jbtnIntTrans.toolTipText")); // NOI18N
jbtnIntTrans.setName("jbtnIntTrans"); // NOI18N
jbtnIntTrans.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtnIntTransActionPerformed(evt);
}
});
jbtnLog.setText(resourceMap.getString("jbtnLog.text")); // NOI18N
jbtnLog.setEnabled(false);
jbtnLog.setName("jbtnLog"); // NOI18N
jbtnLog.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbtnLogActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jtxtChgAmt, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel2))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jtxtPmt, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jtxtRate, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jbtnPmt)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jtxtChgDesc, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jbtnIntTrans))
.addGap(18, 18, 18)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jbtnLog)
.addComponent(jbtnChg))))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jtxtChgAmt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jtxtChgDesc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jbtnChg))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jtxtPmt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jbtnPmt))
.addGap(18, 18, 18)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jtxtRate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jbtnIntTrans)
.addComponent(jbtnLog))
.addContainerGap(21, Short.MAX_VALUE))
);
javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(mainPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(mainPanelLayout.createSequentialGroup()
.addComponent(jlblTypeCd)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jtxtTypeCd, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jlblAcctNm)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jtxtAcctNm, javax.swing.GroupLayout.PREFERRED_SIZE, 144, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jlblStartVal, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jtxtStartVal, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jbtnCreate)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 7, Short.MAX_VALUE)
.addComponent(jbtnCancel)
.addContainerGap(27, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())))
);
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(mainPanelLayout.createSequentialGroup()
.addGap(23, 23, 23)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jlblTypeCd)
.addComponent(jtxtTypeCd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlblAcctNm)
.addComponent(jtxtAcctNm, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlblStartVal)
.addComponent(jtxtStartVal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jbtnCreate)
.addComponent(jbtnCancel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(32, Short.MAX_VALUE))
);
menuBar.setName("menuBar"); // NOI18N
fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
fileMenu.setName("fileMenu"); // NOI18N
jmnuAsset.setText(resourceMap.getString("jmnuAsset.text")); // NOI18N
jmnuAsset.setName("jmnuAsset"); // NOI18N
jmnuCK.setText(resourceMap.getString("jmnuCK.text")); // NOI18N
jmnuCK.setName("jmnuCK"); // NOI18N
jmnuCK.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jmnuCKActionPerformed(evt);
}
});
jmnuAsset.add(jmnuCK);
jmnuSV.setText(resourceMap.getString("jmnuSV.text")); // NOI18N
jmnuSV.setName("jmnuSV"); // NOI18N
jmnuSV.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jmnuSVActionPerformed(evt);
}
});
jmnuAsset.add(jmnuSV);
jmnuMM.setText(resourceMap.getString("jmnuMM.text")); // NOI18N
jmnuMM.setName("jmnuMM"); // NOI18N
jmnuMM.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jmnuMMActionPerformed(evt);
}
});
jmnuAsset.add(jmnuMM);
fileMenu.add(jmnuAsset);
jmnuOpen.setText(resourceMap.getString("jmnuOpen.text")); // NOI18N
jmnuOpen.setName("jmnuOpen"); // NOI18N
jmnuOpen.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jmnuOpenActionPerformed(evt);
}
});
fileMenu.add(jmnuOpen);
javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(accounts.AccountsApp.class).getContext().getActionMap(AccountsView.class, this);
exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
exitMenuItem.setName("exitMenuItem"); // NOI18N
fileMenu.add(exitMenuItem);
menuBar.add(fileMenu);
helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
helpMenu.setName("helpMenu"); // NOI18N
aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
aboutMenuItem.setName("aboutMenuItem"); // NOI18N
helpMenu.add(aboutMenuItem);
menuBar.add(helpMenu);
statusPanel.setName("statusPanel"); // NOI18N
statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N
statusMessageLabel.setName("statusMessageLabel"); // NOI18N
statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N
progressBar.setName("progressBar"); // NOI18N
javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(statusPanel);
statusPanel.setLayout(statusPanelLayout);
statusPanelLayout.setHorizontalGroup(
statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(statusPanelSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 682, Short.MAX_VALUE)
.addGroup(statusPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(statusMessageLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 512, Short.MAX_VALUE)
.addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(statusAnimationLabel)
.addContainerGap())
);
statusPanelLayout.setVerticalGroup(
statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(statusPanelLayout.createSequentialGroup()
.addComponent(statusPanelSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(statusMessageLabel)
.addComponent(statusAnimationLabel)
.addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(3, 3, 3))
);
setComponent(mainPanel);
setMenuBar(menuBar);
setStatusBar(statusPanel);
}// </editor-fold>//GEN-END:initComponents
private void jmnuSVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmnuSVActionPerformed
a = new Savings();
setInputLine(true);
jtxtTypeCd.setText(a.getTypeCd());
jtxtAcctNm.setText("");
jlblStartVal.setText("Initial Deposit");
jtxtStartVal.setText("");
jtxtStartVal.setEnabled(true);
jtxtAcctNm.requestFocusInWindow();
}//GEN-LAST:event_jmnuSVActionPerformed
private void jmnuCKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmnuCKActionPerformed
a = new Checking();
setInputLine(true);
jtxtTypeCd.setText(a.getTypeCd());
jtxtAcctNm.setText("");
jlblStartVal.setText("Initial Deposit");
jtxtStartVal.setText("");
jtxtStartVal.setEnabled(true);
jtxtAcctNm.requestFocusInWindow();
}//GEN-LAST:event_jmnuCKActionPerformed
private void jbtnCreateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnCreateActionPerformed
double sbal;
NumberFormat curr = NumberFormat.getCurrencyInstance();
statusMessageLabel.setText("");
if(jtxtAcctNm.getText().isEmpty()){
statusMessageLabel.setText("Missing Account Name");
jtxtAcctNm.requestFocusInWindow();
return;
}
try{
sbal = Double.parseDouble(jtxtStartVal.getText());
}catch (NumberFormatException e){
statusMessageLabel.setText("Illegal/Missing start vale");
jtxtStartVal.requestFocusInWindow();
return;
}
if (a instanceof Checking) {
a = new Checking(jtxtAcctNm.getText(),sbal, a.getTypeCd());
} else if (a instanceof Savings) {
a = new Savings(jtxtAcctNm.getText(),sbal, a.getTypeCd());
} else if ( a instanceof MoneyMarket) {
a = new MoneyMarket(jtxtAcctNm.getText(),sbal, a.getTypeCd());
} else {
statusMessageLabel.setText("unknown account type");
}
jtxtDisplayName.setText(a.getName());
jtxtAcctNo.setText(String.valueOf(a.getAcctNo()));
jtxtAcctTypeCd.setText(a.getTypeCd());
jtxtAcctTypeDesc.setText(a.getTypeDesc());
jtxtBalance.setText(curr.format(a.getBalance()));
setInputLine(false);
jtxtChgAmt.requestFocusInWindow();
jbtnLog.setEnabled(true);
}//GEN-LAST:event_jbtnCreateActionPerformed
private void jbtnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnCancelActionPerformed
setInputLine(false);
}//GEN-LAST:event_jbtnCancelActionPerformed
private void jbtnChgActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnChgActionPerformed
statusMessageLabel.setText("");
double amt;
NumberFormat curr = NumberFormat.getCurrencyInstance();
try{
amt = Double.parseDouble(jtxtChgAmt.getText());
if (jtxtAcctTypeCd.getText().equalsIgnoreCase(a.getTypeCd())) {
a.setCharge(amt, jtxtChgDesc.getText());
if (a.getErrMsg().isEmpty()) {
statusMessageLabel.setText(a.getActionMsg());
jtxtBalance.setText(curr.format(a.getBalance()));
} else {
statusMessageLabel.setText(a.getErrMsg());
}
} else {
statusMessageLabel.setText("Unknown Account type");
}
jtxtChgAmt.setText("");
jtxtChgDesc.setText("");
}catch(Exception e){
statusMessageLabel.setText("Non numeric charge amount");
}
jtxtChgAmt.requestFocusInWindow();
}//GEN-LAST:event_jbtnChgActionPerformed
private void jbtnPmtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnPmtActionPerformed
statusMessageLabel.setText("");
double amt;
NumberFormat curr = NumberFormat.getCurrencyInstance();
try{
amt = Double.parseDouble(jtxtPmt.getText());
if (jtxtAcctTypeCd.getText().equalsIgnoreCase(a.getTypeCd())) {
a.setPayment(amt);
if (a.getErrMsg().isEmpty()) {
statusMessageLabel.setText(a.getActionMsg());
jtxtBalance.setText(curr.format(a.getBalance()));
} else {
statusMessageLabel.setText(a.getErrMsg());
}
} else {
statusMessageLabel.setText("Unknown Account type");
}
jtxtPmt.setText("");
}catch(Exception e){
statusMessageLabel.setText("Non numeric charge amount");
}
jtxtPmt.requestFocusInWindow();
}//GEN-LAST:event_jbtnPmtActionPerformed
private void jbtnIntTransActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnIntTransActionPerformed
statusMessageLabel.setText("");
double rate;
NumberFormat curr = NumberFormat.getCurrencyInstance();
try{
rate = Double.parseDouble(jtxtRate.getText());
if (jtxtAcctTypeCd.getText().equalsIgnoreCase(a.getTypeCd())) {
a.setInterest(rate);
if (a.getErrMsg().isEmpty()) {
statusMessageLabel.setText(a.getActionMsg());
jtxtBalance.setText(curr.format(a.getBalance()));
} else {
statusMessageLabel.setText(a.getErrMsg());
}
} else {
statusMessageLabel.setText("Unknown Account type");
}
jtxtRate.setText("");
}catch(Exception e){
statusMessageLabel.setText("Non numeric charge amount");
}
jtxtRate.requestFocusInWindow();
}//GEN-LAST:event_jbtnIntTransActionPerformed
private void jbtnLogActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnLogActionPerformed
statusMessageLabel.setText("");
ArrayList<String> log = a.getLog();
if (!a.getErrMsg().isEmpty()) {
statusMessageLabel.setText(a.getErrMsg());
return;
}
statusMessageLabel.setText(a.getActionMsg());
JTextArea t = new JTextArea();
for (String s : log) {
t.append(s + "\n");
}
JScrollPane sp = new JScrollPane(t);
JDialog dg = new JDialog();
dg.setTitle("Log History for account: " + a.getAcctNo());
dg.add(sp);
dg.setBounds(150, 400, 800, 300);
dg.setVisible(true);
}//GEN-LAST:event_jbtnLogActionPerformed
private void jmnuOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmnuOpenActionPerformed
statusMessageLabel.setText("");
NumberFormat curr = NumberFormat.getCurrencyInstance();
JFileChooser f = new JFileChooser(".");
f.setDialogTitle("Select account file to open.");
FileNameExtensionFilter filter = new FileNameExtensionFilter("Text Files (*.txt)", "txt");
f.setFileFilter(filter);
JDialog dg = new JDialog();
int rval = f.showOpenDialog(dg);
if (rval == JFileChooser.CANCEL_OPTION) {
statusMessageLabel.setText("Open Canceled.");
return;
}
String acttype = f.getSelectedFile().getName().substring(0, 2);
String path = f.getSelectedFile().getParent() + "\\" + f.getSelectedFile().getName().replace("L", "");
String actnumber = f.getSelectedFile().getName().substring(2).replace("L", "").replace(".txt", "");
switch(acttype) {
case "CK":
a = new Checking(path, actnumber);
statusMessageLabel.setText("Checking account number - " + actnumber.toString() + " opened.");
break;
case "SV":
a = new Savings(path, actnumber);
statusMessageLabel.setText("Savings account number - " + actnumber.toString() + " opened.");
break;
case "MM":
a = new MoneyMarket(path, actnumber);
statusMessageLabel.setText("Savings account number - " + actnumber.toString() + " opened.");
break;
default:
statusMessageLabel.setText("Invalid file opened.");
break;
}
if(a.getErrMsg().isEmpty()) {
jtxtDisplayName.setText(a.getName());
jtxtAcctNo.setText(String.valueOf(a.getAcctNo()));
jtxtAcctTypeCd.setText(a.getTypeCd());
jtxtAcctTypeDesc.setText(a.getTypeDesc());
jtxtBalance.setText(curr.format(a.getBalance()));
setInputLine(false);
jtxtChgAmt.requestFocusInWindow();
jbtnLog.setEnabled(true);
} else {
statusMessageLabel.setText(a.getErrMsg());
}
//Why isn't this working?? (Maybe im tired and just don't see it)
// if (actName == "CK") {
// statusMessageLabel.setText("CK selected!");
// } else if (actName == "SV") {
// statusMessageLabel.setText("SV selected!");
// } else {
// statusMessageLabel.setText("Invalid file opened.");
// }
}//GEN-LAST:event_jmnuOpenActionPerformed
private void jmnuMMActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmnuMMActionPerformed
a = new MoneyMarket();
setInputLine(true);
jtxtTypeCd.setText(a.getTypeCd());
jtxtAcctNm.setText("");
jlblStartVal.setText("Initial Deposit");
jtxtStartVal.setText("");
jtxtStartVal.setEnabled(true);
jtxtAcctNm.requestFocusInWindow();
}//GEN-LAST:event_jmnuMMActionPerformed
private void setInputLine(boolean tf){
jlblTypeCd.setVisible(tf);
jtxtTypeCd.setVisible(tf);
jtxtAcctNm.setVisible(tf);
jlblAcctNm.setVisible(tf);
jlblStartVal.setVisible(tf);
jtxtStartVal.setVisible(tf);
jbtnCreate.setVisible(tf);
jbtnCancel.setVisible(tf);
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JButton jbtnCancel;
private javax.swing.JButton jbtnChg;
private javax.swing.JButton jbtnCreate;
private javax.swing.JButton jbtnIntTrans;
private javax.swing.JButton jbtnLog;
private javax.swing.JButton jbtnPmt;
private javax.swing.JLabel jlblAcctNm;
private javax.swing.JLabel jlblStartVal;
private javax.swing.JLabel jlblStartVal1;
private javax.swing.JLabel jlblStartVal2;
private javax.swing.JLabel jlblStartVal3;
private javax.swing.JLabel jlblStartVal4;
private javax.swing.JLabel jlblTypeCd;
private javax.swing.JMenu jmnuAsset;
private javax.swing.JMenuItem jmnuCK;
private javax.swing.JMenuItem jmnuMM;
private javax.swing.JMenuItem jmnuOpen;
private javax.swing.JMenuItem jmnuSV;
private javax.swing.JTextField jtxtAcctNm;
private javax.swing.JTextField jtxtAcctNo;
private javax.swing.JTextField jtxtAcctTypeCd;
private javax.swing.JTextField jtxtAcctTypeDesc;
private javax.swing.JTextField jtxtBalance;
private javax.swing.JTextField jtxtChgAmt;
private javax.swing.JTextField jtxtChgDesc;
private javax.swing.JTextField jtxtDisplayName;
private javax.swing.JTextField jtxtPmt;
private javax.swing.JTextField jtxtRate;
private javax.swing.JTextField jtxtStartVal;
private javax.swing.JTextField jtxtTypeCd;
private javax.swing.JPanel mainPanel;
private javax.swing.JMenuBar menuBar;
private javax.swing.JProgressBar progressBar;
private javax.swing.JLabel statusAnimationLabel;
private javax.swing.JLabel statusMessageLabel;
private javax.swing.JPanel statusPanel;
// End of variables declaration//GEN-END:variables
private final Timer messageTimer;
private final Timer busyIconTimer;
private final Icon idleIcon;
private final Icon[] busyIcons = new Icon[15];
private int busyIconIndex = 0;
private JDialog aboutBox;
}
| true |
39efd6a6c33776abbf903bc05011421b3630fcdb | Java | BBK-PiJ-2015-10/PIJ-Exercises | /day19/Exer8/ElementtransformedList.java | UTF-8 | 375 | 2.84375 | 3 | [] | no_license | import java.util.List;
import java.util.LinkedList;
import java.util.function.Function;
public class ElementtransformedList {
public static <T> List<T> transformedList (List<T> inputlist, Function<T, T> evaluator){
List<T> result = new LinkedList<T>();
for (int i=0; i<inputlist.size();i++){
result.add(evaluator.apply(inputlist.get(i)));
}
return result;
}
} | true |
996a2edf0a70705279c473a356913003492c4792 | Java | Rohit8610/HibernateProject | /HBProj2-get/src/main/java/com/nt/test/LoadObjectTest.java | UTF-8 | 767 | 2.421875 | 2 | [] | no_license | package com.nt.test;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import com.nt.entity.InsurancePolicy;
import com.nt.util.Hibernateutil;
public class LoadObjectTest {
public static void main(String arg[])
{
InsurancePolicy policy=null;
Session ses=Hibernateutil.getSession();
try {
policy=ses.get(InsurancePolicy.class,1L);
if(policy==null)
{
System.out.println("record not found");
}
else
{
System.out.println("record found and display");
System.out.println(policy);
}
}catch(HibernateException he)
{
he.printStackTrace();
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
Hibernateutil.getSessionClose(ses);
Hibernateutil.getSessionFactoryClose();
}
}
} | true |
af2c3e913894e0828b340a739d459eb23136544b | Java | mymagadsl/EvilCraft | /src/main/java/evilcraft/command/CommandEvilCraft.java | UTF-8 | 3,923 | 2.34375 | 2 | [
"CC-BY-4.0"
] | permissive | package evilcraft.command;
import evilcraft.core.helper.L10NHelpers;
import evilcraft.core.helper.ServerHelpers;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.ChatComponentText;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
/**
* The EvilCraft command.
* @author rubensworks
*
*/
public class CommandEvilCraft implements ICommand {
private static final String NAME = "evilcraft";
protected List<String> getAliases() {
List<String> list = new LinkedList<String>();
list.add(NAME);
list.add("evilCraft");
list.add("EvilCraft");
list.add("ec");
return list;
}
protected Map<String, ICommand> getSubcommands() {
Map<String, ICommand> map = new HashMap<String, ICommand>();
map.put("config", new CommandConfig());
map.put("version", new CommandVersion());
map.put("recursion", new CommandRecursion());
map.put("ignite", new CommandIgnite());
return map;
}
private List<String> getSubCommands(String cmd) {
List<String> completions = new LinkedList<String>();
for(String full : getSubcommands().keySet()) {
if(full.startsWith(cmd)) {
completions.add(full);
}
}
return completions;
}
@Override
public int compareTo(Object o) {
return 0;
}
@Override
public String getCommandName() {
return NAME;
}
@Override
public String getCommandUsage(ICommandSender icommandsender) {
String possibilities = "";
for(String full : getSubcommands().keySet()) {
possibilities += full + " ";
}
return NAME + " " + possibilities;
}
@SuppressWarnings("rawtypes")
@Override
public List getCommandAliases() {
return this.getAliases();
}
protected String[] shortenArgumentList(String[] astring) {
String[] asubstring = new String[astring.length - 1];
for(int i = 1; i < astring.length; i++) {
asubstring[i - 1] = astring[i];
}
return asubstring;
}
@Override
public void processCommand(ICommandSender icommandsender, String[] astring) {
if(astring.length == 0) {
icommandsender.addChatMessage(new ChatComponentText(L10NHelpers.localize("chat.command.invalidArguments")));
} else {
ICommand subcommand = getSubcommands().get(astring[0]);
if(subcommand != null) {
String[] asubstring = shortenArgumentList(astring);
subcommand.processCommand(icommandsender, asubstring);
} else {
icommandsender.addChatMessage(new ChatComponentText(L10NHelpers.localize("chat.command.invalidSubcommand")));
}
}
}
@Override
public boolean canCommandSenderUseCommand(ICommandSender icommandsender) {
return icommandsender.canCommandSenderUseCommand(MinecraftServer.getServer().getOpPermissionLevel(), this.getCommandName());
}
@SuppressWarnings("rawtypes")
@Override
public List addTabCompletionOptions(ICommandSender icommandsender,
String[] astring) {
if(astring.length != 0) {
ICommand subcommand = getSubcommands().get(astring[0]);
if(subcommand != null) {
String[] asubstring = shortenArgumentList(astring);
return subcommand.addTabCompletionOptions(icommandsender, asubstring);
} else {
return getSubCommands(astring[0]);
}
} else {
return getSubCommands("");
}
}
@Override
public boolean isUsernameIndex(String[] astring, int i) {
return false;
}
}
| true |
42db7ef4c539ed91d5fc8fd1dc09c82416da46fc | Java | qimolin/casino-jack | /src/main/java/casino/cashier/CardID.java | UTF-8 | 503 | 2.9375 | 3 | [] | no_license | package casino.cashier;
import casino.idfactory.GeneralID;
public class CardID extends GeneralID implements Comparable<GeneralID> {
/***
* @should Generate And Return An ID
* @should compare ids and return false
* @should compare ids and return true
* @param o
* @return
*/
@Override
public int compareTo(GeneralID o) {
if (this.getID().equals(o.getID())){
return 1; //true
}else {
return 0;//false
}
}
}
| true |
a9c6ad5cfd49ba129b81e1e007a24e63557cdb41 | Java | quarkusio/quarkus | /extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/config/StorkConfig.java | UTF-8 | 856 | 2.125 | 2 | [
"Apache-2.0"
] | permissive | package io.quarkus.grpc.runtime.config;
import io.quarkus.runtime.annotations.ConfigGroup;
import io.quarkus.runtime.annotations.ConfigItem;
/**
* Stork config for new Vert.x gRPC
*/
@ConfigGroup
public class StorkConfig {
/**
* Number of threads on a delayed gRPC ClientCall
*/
@ConfigItem(defaultValue = "10")
public int threads;
/**
* Deadline in milliseconds of delayed gRPC call
*/
@ConfigItem(defaultValue = "5000")
public long deadline;
/**
* Number of retries on a gRPC ClientCall
*/
@ConfigItem(defaultValue = "3")
public int retries;
/**
* Initial delay in seconds on refresh check
*/
@ConfigItem(defaultValue = "60")
public long delay;
/**
* Refresh period in seconds
*/
@ConfigItem(defaultValue = "120")
public long period;
}
| true |
3e2b0a307ec194979de225f32b035056a262344b | Java | jarrarte/pruebas-netty | /prueba-netty/src/main/java/com/verifone/victor/pruebas/NettyHashServerInitializer.java | UTF-8 | 1,142 | 1.976563 | 2 | [] | no_license | package com.verifone.victor.pruebas;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpObjectAggregator;
import io.netty.handler.codec.http.HttpRequestDecoder;
import io.netty.handler.codec.http.HttpResponseEncoder;
import io.netty.handler.codec.http.HttpServerCodec;
public class NettyHashServerInitializer extends
ChannelInitializer<SocketChannel> {
@Override
protected void initChannel(SocketChannel ch) throws Exception {
// TODO Auto-generated method stub
ChannelPipeline p = ch.pipeline();
p.addLast(new HttpRequestDecoder());
// Uncomment the following line if you don't want to handle HttpChunks.
p.addLast(new HttpObjectAggregator(1048576));
p.addLast(new HttpResponseEncoder());
// Remove the following line if you don't want automatic content compression.
//p.addLast(new HttpContentCompressor());
p.addLast(new HashMessageDecoder());
p.addLast(new HashMessageEncoder());
p.addLast(new NettyHashServerHandler());
}
}
| true |
2d04a919b33c03316c10bccb867da4ff64c99592 | Java | sbansa1/Java- | /workspace/LAB10/src/edu/ilstu/RoomDimension.java | UTF-8 | 965 | 3.625 | 4 | [] | no_license | /*
*RoomDimension.java
*Programmer: Saurabh Bansal
*ULID : 819654128
*Oct 20, 2016
*
*Class: IT 168
*Lecture Section:
*Lecture Instructor: Patricia Mastuda
*Lab Section: 14 & 15
*Lab Instructor: Saurabh Bansal
*/
package edu.ilstu;
/**
* Class which gives the area of the room
*
* @author Saurabh Bansal
*
*/
public class RoomDimension
{
private double length;
private double width;
/**
* Constructor which accepts Length and Width
*
* @param length makes the length of the room
* @param width makes the width of the room
*/
public RoomDimension(double length, double width)
{
super();
this.length = length;
this.width = width;
}
/**
* A method which Calculates Area
*
* @return the area of the room
* by multiplying length and width
*/
public double calculateArea()
{
return length * width;
}
@Override
public String toString()
{
return "\nlength = " + length + "\nWidth = " + width + "\nArea = "
+ calculateArea();
}
}
| true |
08a1f713045dad390660172704b0e8ea69e03c63 | Java | connectwithsagun/RoomSearching-Java-Code- | /app/src/main/java/com/example/room/Model/AllPropertyModel.java | UTF-8 | 1,048 | 2.21875 | 2 | [] | no_license | package com.example.room.Model;
import android.content.Intent;
public class AllPropertyModel {
//private String imag;
private int imag;
private String title;
private String location;
private String amount;
public AllPropertyModel() {
}
public AllPropertyModel( int imageId, String title, String location, String amount) {
this.imag = imag;
this.title = title;
this.location = location;
this.amount = amount;
}
public int getImageId() {
return imag;
}
public void setImageId(int imag) {
this.imag = imag;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public String getAmount() {
return amount;
}
public void setAmount(String amount) {
this.amount = amount;
}
}
| true |
689793fe0c9fb871a3a6b69338b2ebf1f224a3ea | Java | kkzfl22/demojava8 | /src/main/java/com/demo/effectivejava/thirty/five2/exception/Sample2.java | UTF-8 | 400 | 2.28125 | 2 | [] | no_license | package com.demo.effectivejava.thirty.five2.exception;
public class Sample2 {
@ExceptinTest(ArithmeticException.class)
public static void m1() {
int i = 0;
i = i / i;
}
@SuppressWarnings("unused")
@ExceptinTest(ArithmeticException.class)
public static void m2()
{
int[] a = new int[0];
int i = a[1];
}
@ExceptinTest(ArithmeticException.class)
public static void m3() {
}
}
| true |
08d7e623a93cd2169a28f9ad56bdf0db4e1c8d03 | Java | DevRealHard/CCM | /src/main/java/com/dhbwProject/CCM/NaviButton.java | UTF-8 | 604 | 2.28125 | 2 | [] | no_license | package com.dhbwProject.CCM;
import com.vaadin.navigator.Navigator;
import com.vaadin.ui.Button;
import com.vaadin.ui.themes.ValoTheme;
public class NaviButton extends Button {
private static final long serialVersionUID = 1L;
public NaviButton(String viewName, Navigator nav){
this.setCaptionAsHtml(true);
//this.setCaption("<font color=#35adcc><left>"+viewName+"</left></font>");
this.setCaption(viewName);
this.setWidth("100%");
//this.setStyleName(ValoTheme.BUTTON_BORDERLESS);
this.setStyleName("navi");
this.addClickListener(listener -> {
nav.navigateTo(viewName);
});
}
}
| true |
89bd07f2122f0fc28aa1b46eb742fa1fda8605a6 | Java | libardia/TRMS2 | /TRMS2/src/main/java/com/revature/data/HibernateSession.java | UTF-8 | 556 | 2.40625 | 2 | [] | no_license | package com.revature.data;
import org.hibernate.Session;
/**
* All Hibernate implementations of DAOs should implement this interface for
* automatic session management using HibernateAspect.
*/
public interface HibernateSession {
/**
* A setter method for HibernateAspect to provide a session for the implementing
* DAO. The DAO should include a private Session field that is set by this
* method.
*
* @param session
* a Hibernate Session object, provided by HibernateAspect
*/
public void setSession(Session session);
}
| true |
e97de8d612a96d3e0d2337e6eca391afe078fee5 | Java | BrainAcademy2016/AirportManagement | /storage/src/main/java/ua/com/airport/dao/RootsDao.java | UTF-8 | 507 | 2.203125 | 2 | [] | no_license | package ua.com.airport.dao;
import ua.com.airport.entities.RootsEntity;
import java.util.List;
public interface RootsDao {
/**
* @return list that contains all roots
*/
List<RootsEntity> getAllRoots();
/**
* @param rootName
* @return list that contains roots by selected root name
*/
List<RootsEntity> getRootsByName(String rootName);
void deleteRoot(int id);
void updateRoot(RootsEntity rootsEntity);
void createRoot(RootsEntity rootsEntity);
}
| true |
36c73c0e171abd54e33006fd1b0789e3e96e1fb2 | Java | Romulandiy/example | /DataTypes.java | WINDOWS-1251 | 463 | 3.25 | 3 | [] | no_license | class DataTypes
{
public static void main (String[] args)
{
char letter = 'M';
String title = "Java in easy steps";
short number = 365;
float decimal = 98.6f;
boolean result = true;
System.out.println(" " + letter);
System.out.println(" "+title);
System.out.println(" " + number);
System.out.println(" "+ decimal);
System.out.println(" "+result);
}
} | true |
615365db1f7bb600c174fb6e96f77a80a4370628 | Java | Vishnesh/CS681 | /HW1/src/edu/umb/cs681/hw01/Test.java | UTF-8 | 526 | 2.84375 | 3 | [] | no_license | package edu.umb.cs681.hw01;
public class Test {
public static void main(String args[]) {
DJIAQuoteObservable dQObs = new DJIAQuoteObservable();
dQObs.addObserver((Observable o, Object obj) -> {
System.out.println("First DJIA Observer has been notified");
});
dQObs.changeQuote("Test1", 1);
StockQuoteObservable sQObs = new StockQuoteObservable();
sQObs.addObserver((Observable o, Object obj) -> {
System.out.println("First Stock Observer has been notified.");
});
sQObs.changeQuote("Test2", 2);
}
} | true |
c13a1f949f29b004afbbd149f19481f765d84e66 | Java | Hy-Hong/Homework_Abstract | /Challenge02/Vechicle.java | UTF-8 | 200 | 2.515625 | 3 | [] | no_license | package Homework_Abstract_Challenge02;
public abstract class Vechicle {
//Attribute
String plateID;
float weight;
public abstract int getMaximalSpeed();
public abstract String toString();
}
| true |
32f5ae4c1f98a120eded2a332e969de0a3c67f75 | Java | eigen94/koroject | /koroject/src/main/java/org/kosta/note/persistence/NoteDao.java | UTF-8 | 856 | 1.992188 | 2 | [] | no_license | package org.kosta.note.persistence;
import java.util.List;
import org.kosta.note.domain.Note;
import org.kosta.note.domain.NoteSearchCriteria;
public interface NoteDao {
public List<Note> listAll() throws Exception;
public void send(Note note) throws Exception;
public Note detail(Integer n_id) throws Exception;
public void update(Note note) throws Exception;
public void delete(int n_id) throws Exception;
public List<String> searchId(String m_name) throws Exception;
public List<Note> note_receiveList(int m_id) throws Exception;
public List<Note> note_searchRec(NoteSearchCriteria cri) throws Exception;
public List<Note> note_sendList(int m_id) throws Exception;
public int getM_id(String email) throws Exception;
public List<Note> note_searchSen(NoteSearchCriteria cri) throws Exception;
}
| true |
d10253ea3ed0f420eedece60a0a5faa4433a453f | Java | AnetaBar/shoppingList | /shoppingListBackend/src/main/java/pl/anetabar/restservice/Application.java | UTF-8 | 1,135 | 2.28125 | 2 | [] | no_license | package pl.anetabar.restservice;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import pl.anetabar.restservice.domain.ListItem;
import pl.anetabar.restservice.repository.ShoppingListRepository;
/**
* Created by Aneta on 08.06.2018.
*/
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Bean
CommandLineRunner init(final ShoppingListRepository shoppingListService) {
return new CommandLineRunner() {
@Override
public void run(String... strings) throws Exception {
ListItem item1 = ListItem.builder().productName("Pomidor").productQuantity(1L).build();
ListItem item2 = ListItem.builder().productName("Mozzarella").productQuantity(2L).build();
shoppingListService.save(item1);
shoppingListService.save(item2);
}
};
}
}
| true |
4be3a9b4a9648c89682aed783f482672b74ff79e | Java | mjibson/junk | /goread-android/goread/src/main/java/com/goread/goreader/UnreadCounts.java | UTF-8 | 460 | 2.390625 | 2 | [] | no_license | package com.goread.goreader;
import java.util.HashMap;
public class UnreadCounts {
public int All = 0;
public HashMap<String, Integer> Folders = new HashMap<String, Integer>();
public HashMap<String, Integer> Feeds = new HashMap<String, Integer>();
public int Folder(String t) {
return Folders.containsKey(t) ? Folders.get(t) : 0;
}
public int Feed(String t) {
return Feeds.containsKey(t) ? Feeds.get(t) : 0;
}
} | true |
09e57f1cb24a07a08fe9b45cabb86d56d654ebd7 | Java | alibaba/jetcache | /jetcache-core/src/main/java/com/alicp/jetcache/external/MockRemoteCacheConfig.java | UTF-8 | 349 | 2.0625 | 2 | [
"Apache-2.0"
] | permissive | package com.alicp.jetcache.external;
import com.alicp.jetcache.anno.CacheConsts;
public class MockRemoteCacheConfig<K, V> extends ExternalCacheConfig<K, V> {
private int limit = CacheConsts.DEFAULT_LOCAL_LIMIT;
public int getLimit() {
return limit;
}
public void setLimit(int limit) {
this.limit = limit;
}
}
| true |
4255296f26820e0398921bbc172c4d36dcb1fe23 | Java | GeorgeAnguah/online-banking | /src/test/java/com/onlinebanking/backend/persistent/domain/base/BaseEntityTest.java | UTF-8 | 538 | 1.898438 | 2 | [] | no_license | package com.onlinebanking.backend.persistent.domain.base;
import com.onlinebanking.TestUtils;
import nl.jqno.equalsverifier.EqualsVerifier;
import org.junit.jupiter.api.Test;
/**
* Test class for the BaseEntity.
*
* @author George on 6/25/2021
* @version 1.0
* @since 1.0
*/
class BaseEntityTest {
@Test
void equalsContract() {
EqualsVerifier.forClass(BaseEntity.class)
.withIgnoredFields(TestUtils.getIgnoredFields().toArray(new String[0]))
.verify();
}
} | true |
1126c4439b6eae7e75ead8bd47c5817653c0275f | Java | lwriemen/masl | /core-java/src/main/java/org/xtuml/masl/translate/sql/main/RelationshipTranslator.java | UTF-8 | 7,570 | 2.28125 | 2 | [
"Apache-2.0"
] | permissive | /*
* Filename : RelationshipTranslator.java
*
* UK Crown Copyright (c) 2008. All Rights Reserved
*/
package org.xtuml.masl.translate.sql.main;
import org.xtuml.masl.cppgen.Class;
import org.xtuml.masl.cppgen.Namespace;
import org.xtuml.masl.metamodel.object.ObjectDeclaration;
import org.xtuml.masl.metamodel.relationship.AssociativeRelationshipDeclaration;
import org.xtuml.masl.metamodel.relationship.MultiplicityType;
import org.xtuml.masl.metamodel.relationship.NormalRelationshipDeclaration;
import org.xtuml.masl.metamodel.relationship.RelationshipDeclaration;
import org.xtuml.masl.metamodel.relationship.SubtypeRelationshipDeclaration;
/**
* For each relationship specification defined in the MASL model file an
* instance of this translator class is created to enable the generation of the
* required C++ to handle the link/unlink and navigation operations.
*
* Each relationship has an associated relationship Mapper class to handle the
* behavioural requirements of the relationship and a matching Mapper SQL class
* that provides the SQL implementation to support this behaviour.
*/
public class RelationshipTranslator
{
private final SqlFrameworkTranslator framework;
private final RelationshipMapperClass mapperClass;
private final Namespace namespace;
public RelationshipTranslator ( final SqlFrameworkTranslator framework, final RelationshipDeclaration relationship )
{
this.framework = framework;
namespace = new Namespace(framework.getDatabase().getDatabaseTraits().getName().toUpperCase());
mapperClass = new RelationshipMapperClass(this, relationship, namespace);
}
/**
*
* @return
*/
SqlFrameworkTranslator getFramework ()
{
return framework;
}
/**
*
* @return
*/
DatabaseTraits getDatabaseTraits ()
{
return framework.getDatabase().getDatabaseTraits();
}
/**
* The actual C++ class that is generated to implement the relationship Mapper
* Class needs to be accessed so that the MASL Object code generation
* component can utilise it during its operation.
*
* @return the actual C++ relationship Mapper class
*/
Class getRelationshipMapperClass ()
{
return mapperClass.getMapperClass();
}
/**
* The actual C++ class that is generated to implement the relationship
* MapperSQL Class needs to be accessed so that the MASL Object code
* generation component can utilise it during its operation.
*
* @return the actual C++ relationship MapperSQL class
*/
Class getRelationshipMapperSqlClass ()
{
return mapperClass.getMapperSqlClass();
}
/**
* For subtypeRelationship declarations multiple C++ Mapper classes are
* generated, one for each supertype/subtype pair (@see
* SubTypeRelationshipMapperSqlClass). The actual C++ class generated needs to
* be accessed so that the MASL Object code generation component can utilise
* it during its operation. Therefore return this class for the parameter
* values specified.
*
* the supertype object for the required relationship
* the derived object for the required relationship
* @return the C++ Mapper Class corresponding to the pair of supplied objects
*/
Class getSuperToSubtypeRelationshipMapperClass ( final ObjectDeclaration supertypeObjDecl, final ObjectDeclaration subtypeObjDecl )
{
return mapperClass.getSuperToSubMapperClass(supertypeObjDecl, subtypeObjDecl);
}
/**
* For subtypeRelationship declarations multiple C++ MapperSQL classes are
* generated, one for each supertype/subtype pair (@see
* SubTypeRelationshipMapperSqlClass). The actual C++ class generated needs to
* be accessed so that the MASL Object code generation component can utilise
* it during its operation. Therefore return this class for the parameter
* values specified.
*
* the supertype object for the required relationship
* the derived object for the required relationship
* @return the C++ MapperSQL Class corresponding to the pair of supplied
* objects
*/
Class getSuperToSubtypeRelationshipMapperSqlClass ( final ObjectDeclaration supertypeObjDecl,
final ObjectDeclaration subtypeObjDecl )
{
return mapperClass.getSuperToSubMapperSqlClass(supertypeObjDecl, subtypeObjDecl);
}
/**
* Decompose the specified relationship to determine the multiplicity of the
* association and return an enum representation that can be used withinin
* select constructs.
*
* the relationship to interrorgate.
* @return an enum value to represent the multiplicity of relationship
* declaration.
*/
static RelationshipType getRelationshipType ( final RelationshipDeclaration relationshipDecl )
{
RelationshipType relType = null;
if ( relationshipDecl instanceof NormalRelationshipDeclaration )
{
final NormalRelationshipDeclaration normRelationshipDecl = (NormalRelationshipDeclaration)relationshipDecl;
if ( normRelationshipDecl.getLeftMult() == MultiplicityType.ONE &&
normRelationshipDecl.getRightMult() == MultiplicityType.ONE )
{
relType = RelationshipType.OneToOne;
}
else if ( normRelationshipDecl.getLeftMult() == MultiplicityType.ONE &&
normRelationshipDecl.getRightMult() == MultiplicityType.MANY )
{
relType = RelationshipType.OneToMany;
}
else if ( normRelationshipDecl.getLeftMult() == MultiplicityType.MANY &&
normRelationshipDecl.getRightMult() == MultiplicityType.ONE )
{
relType = RelationshipType.ManyToOne;
}
}
else if ( relationshipDecl instanceof AssociativeRelationshipDeclaration )
{
final AssociativeRelationshipDeclaration assoRelationshipDecl = (AssociativeRelationshipDeclaration)relationshipDecl;
if ( assoRelationshipDecl.getLeftMult() == MultiplicityType.ONE &&
assoRelationshipDecl.getRightMult() == MultiplicityType.ONE )
{
relType = RelationshipType.AssocOneToOne;
}
else if ( assoRelationshipDecl.getLeftMult() == MultiplicityType.ONE &&
assoRelationshipDecl.getRightMult() == MultiplicityType.MANY )
{
relType = RelationshipType.AssocOneToMany;
}
else if ( assoRelationshipDecl.getLeftMult() == MultiplicityType.MANY &&
assoRelationshipDecl.getRightMult() == MultiplicityType.ONE )
{
relType = RelationshipType.AssocManyToOne;
}
else if ( assoRelationshipDecl.getLeftMult() == MultiplicityType.MANY &&
assoRelationshipDecl.getRightMult() == MultiplicityType.MANY )
{
relType = RelationshipType.AssocManyToMany;
}
}
else if ( relationshipDecl instanceof SubtypeRelationshipDeclaration )
{
relType = RelationshipType.SubToSuper;
}
return relType;
}
/**
*
* the relationship declaration
* @return The actual relationship number for the specified relationship.
*/
static int getRelationshipNumber ( final RelationshipDeclaration relationshipDecl )
{
return Integer.parseInt(relationshipDecl.getName().substring(1)); // move
// past
// the 'R'
// character.
}
}
| true |
a6d173f9fcbd2089d125ca89c3ba9c0bf3c14845 | Java | drajer-health/eCRNow | /src/test/java/com/drajer/cdafromr4/CdaPlanOfTreatmentGeneratorTest.java | UTF-8 | 3,982 | 1.742188 | 2 | [
"Apache-2.0"
] | permissive | package com.drajer.cdafromr4;
import static org.junit.Assert.*;
import com.drajer.cda.utils.CdaGeneratorConstants;
import com.drajer.cda.utils.CdaGeneratorUtils;
import com.drajer.eca.model.PatientExecutionState;
import com.drajer.sof.model.LaunchDetails;
import com.drajer.sof.model.R4FhirData;
import com.drajer.test.util.TestUtils;
import org.hl7.fhir.r4.model.CodeableConcept;
import org.hl7.fhir.r4.model.Coding;
import org.hl7.fhir.r4.model.DiagnosticReport;
import org.hl7.fhir.r4.model.ServiceRequest;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
@PrepareForTest({CdaGeneratorUtils.class})
public class CdaPlanOfTreatmentGeneratorTest extends BaseGeneratorTest {
static final String PLAN_OF_TREATMENT_BUNDLE_RESOURCE_FILE =
"CdaTestData/PlanOfTreatment/plan_of_treatment_bundle_resource.json";
static final String PLAN_OF_TREATMENT_CDA_FILE =
"CdaTestData//cda//PlanOfTreatment//PlanOfTreatment.xml";
@Test
public void testGeneratePlanOfTreatmentSection() {
R4FhirData r4Data = createResourceData(PLAN_OF_TREATMENT_BUNDLE_RESOURCE_FILE);
String expectedXml = TestUtils.getFileContentAsString(PLAN_OF_TREATMENT_CDA_FILE);
PowerMockito.mockStatic(CdaGeneratorUtils.class, Mockito.CALLS_REAL_METHODS);
PowerMockito.when(CdaGeneratorUtils.getXmlForIIUsingGuid()).thenReturn(XML_FOR_II_USING_GUID);
String actualXml =
CdaPlanOfTreatmentGenerator.generatePlanOfTreatmentSection(r4Data, launchDetails);
assertNotNull(actualXml);
assertXmlEquals(expectedXml, actualXml);
}
@Test
public void testGetPlannedObservationXml() {
LaunchDetails details = new LaunchDetails();
ServiceRequest sr = new ServiceRequest();
Coding coding = new Coding();
coding.setCode("68518-0");
coding.setSystem(CdaGeneratorConstants.FHIR_LOINC_URL);
sr.setCode(new CodeableConcept().addCoding(coding));
PatientExecutionState state =
createPatientExecutionState("ServiceRequest", "http://loinc.org|68518-0");
details.setStatus(TestUtils.toJsonString(state));
String contentRef = "contentRef";
String actual = CdaPlanOfTreatmentGenerator.getPlannedObservationXml(sr, details, contentRef);
assertNotNull(actual);
}
@Test
public void testGetDiagnosticReportXml() {
LaunchDetails details = new LaunchDetails();
DiagnosticReport dr = new DiagnosticReport();
Coding coding = new Coding();
coding.setCode("68518-0");
coding.setSystem(CdaGeneratorConstants.FHIR_LOINC_URL);
dr.setCode(new CodeableConcept().addCoding(coding));
PatientExecutionState state =
createPatientExecutionState("DiagnosticReport", "http://loinc.org|68518-0");
details.setStatus(TestUtils.toJsonString(state));
String contentRef = "contentRef";
String actual = CdaPlanOfTreatmentGenerator.getDiagnosticReportXml(dr, details, contentRef);
assertNotNull(actual);
}
@Test
public void testGenerateEmptyPlanOfTreatmentSection() {
String expectedXml =
"<component>\r\n"
+ "<section nullFlavor=\"NI\">\r\n"
+ "<templateId root=\"2.16.840.1.113883.10.20.22.2.10\"/>\r\n"
+ "<templateId root=\"2.16.840.1.113883.10.20.22.2.10\" extension=\"2014-06-09\"/>\r\n"
+ "<code code=\"18776-5\" codeSystem=\"2.16.840.1.113883.6.1\" codeSystemName=\"LOINC\" displayName=\"Treatment Plan\"/>\r\n"
+ "<title>Plan of Treatment</title>\r\n"
+ "<text>No Plan Of Treatment Information</text>\r\n"
+ "</section>\r\n"
+ "</component>\r\n"
+ "";
String actualXml = CdaPlanOfTreatmentGenerator.generateEmptyPlanOfTreatmentSection();
assertNotNull(actualXml);
assertXmlEquals(expectedXml, actualXml);
}
}
| true |
559eeb21ec6ec767155c26a028345f0bbc3327f0 | Java | nubiofs/mapfaces | /library/components/ajax-components/map/src/main/java/org/mapfaces/models/tree/TreeNodeModel.java | UTF-8 | 3,061 | 2.59375 | 3 | [] | no_license | /*
* Mapfaces -
* http://www.mapfaces.org
*
* (C) 2007 - 2008, Geomatys
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
package org.mapfaces.models.tree;
import javax.swing.tree.DefaultMutableTreeNode;
/**
* A simple TreeNode with an id as a String to identify him
* @author Kevin Delfour (Geomatys)
*/
public class TreeNodeModel extends DefaultMutableTreeNode {
private static final long serialVersionUID = 1537732742707197904L;
private int id;
private int depth = 0;
private int row = 0;
private boolean checked;
public TreeNodeModel(Object userobj, int id, int depth, int row) {
super(userobj);
this.id = id;
this.row= row;
this.depth = depth;
this.checked = true;
}
public TreeNodeModel(Object userobj, int id, int depth, boolean check) {
super(userobj);
this.id = id;
this.depth = depth;
this.checked = check;
}
public TreeNodeModel(Object userobj, int id, int depth, int row, boolean check) {
super(userobj);
this.id = id;
this.row = row;
this.depth = depth;
this.checked = check;
}
/**
* Get the text display for this node
* @return String name of the node
*/
public String getText() {
return getUserObject().toString();
}
/**
* Get the id of the node who invoke the method
* @return a string representation of node's Id
*/
public int getId() {
return id;
}
/**
* Returns depth of this node ( the root node has a depth of 0)
* @return Int
*/
@Override
public int getDepth() {
return depth;
}
/**
* Set the depth of this node
* @param depth of the node
*/
public void setDepth(final int depth) {
this.depth = depth;
}
/**
* Give a string representation of a node
* @return a string
*/
@Override
public String toString() {
return this.getText();
}
public boolean isChecked() {
return checked;
}
public void setChecked(final boolean checked) {
this.checked = checked;
}
/**
* {@inheritDoc }
*/
@Override
public Object getUserObject() {
return super.getUserObject();
}
/**
* {@inheritDoc }
*/
@Override
public void setUserObject(final Object obj){
super.setUserObject(obj);
}
public int getRow() {
return row;
}
public void setRow(int row) {
this.row = row;
}
}
| true |
d4c4fac71b0889ef810952707086cca6943a02c2 | Java | dante7qx/microservice-spirit | /project-syslog-ui/src/main/java/com/spirit/project/syslog/ui/client/fallback/SysLogFeignClientFallback.java | UTF-8 | 1,225 | 2.03125 | 2 | [] | no_license | package com.spirit.project.syslog.ui.client.fallback;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import com.spirit.project.commom.dto.req.PageReq;
import com.spirit.project.commom.dto.resp.BaseResp;
import com.spirit.project.commom.dto.resp.PageResp;
import com.spirit.project.commom.dto.resp.RespCodeEnum;
import com.spirit.project.syslog.ui.client.SysLogFeignClient;
import com.spirit.project.syslog.ui.vo.syslog.SysLogVO;
@Component
public class SysLogFeignClientFallback implements SysLogFeignClient {
private static final Logger LOGGER = LoggerFactory.getLogger(SysLogFeignClientFallback.class);
@Override
public BaseResp<PageResp<SysLogVO>> findPage(PageReq pageReq) {
LOGGER.error("findByPage pageReq {} fallback.", pageReq);
BaseResp<PageResp<SysLogVO>> resp = new BaseResp<PageResp<SysLogVO>>();
resp.setResultCode(RespCodeEnum.REMOTE_FAILURE.code());
return resp;
}
@Override
public BaseResp<SysLogVO> addSysLog(SysLogVO sysLogVO) {
LOGGER.error("addSysLog sysLogVO {} fallback.", sysLogVO);
BaseResp<SysLogVO> resp = new BaseResp<SysLogVO>();
resp.setResultCode(RespCodeEnum.REMOTE_FAILURE.code());
return resp;
}
}
| true |
e708666181e2ba0356c789b0a21c26d80af13be4 | Java | DanielRMiller/InsightJournal | /CS246_InsightJournal/src/InsightJournal/Term.java | UTF-8 | 1,236 | 3.046875 | 3 | [] | no_license | /*
* 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 InsightJournal;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author Xandron
*/
public class Term {
String key;
List<String> synList = new ArrayList<>();
public String getKey() {
return key;
}
public List<String> getSynList() {
return synList;
}
public void setKey(String newKey) {
key = newKey;
}
public void setSynList(List<String> newSynList) {
synList = newSynList;
}
public boolean matches(String content) {
// System.out.println("Entered matches");
for (String syn : synList) {
// System.out.println("Trying to match " + syn + " to \"" + content + "\"");
if (content.toLowerCase().contains(syn.toLowerCase())) {
// System.out.println("Found a match in matches!");
return true;
}
}
return false;
}
public String display(){
return key + " " + synList;
}
}
| true |
dd42f171ff6ff49f128745cda3658f9802bd7974 | Java | chandlerFan/vipkid-server | /qxy-bean/src/main/java/com/quxueyuan/bean/vo/res/SellerResponse.java | UTF-8 | 2,428 | 2.390625 | 2 | [] | no_license | package com.quxueyuan.bean.vo.res;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.http.HttpStatus;
/**
* @Title: SellerResponse
* @Company: 北京桔子分期电子商务有限公司
* @Author Li Zhe lizhe@juzifenqi.com
* @Date 2018年07月06日 15:00
* @Description: 小程序商户端端返回
*/
@Getter
@Setter
@ToString
public class SellerResponse {
/**
* 返回成功或失败 1:成功,0:失败
*/
private Integer result;
/**
* 描述信息
*/
private String message;
/**
* 错误code
*/
private String errorCode;
/**
* 返回数据
*/
private Object data;
public SellerResponse() {
}
public SellerResponse(Integer result, String message, String errorCode, Object data) {
this.result = result;
this.message = message;
this.errorCode = errorCode;
this.data = data;
}
public static SellerResponse success(String message, Object data) {
return new SellerResponse(1, message, HttpStatus.OK.toString(), data);
}
public static SellerResponse success(String message) {
return new SellerResponse(1, message, HttpStatus.OK.toString(), null);
}
public static SellerResponse success(Object data) {
return new SellerResponse(1, HttpStatus.OK.getReasonPhrase(), HttpStatus.OK.toString(), data);
}
public static SellerResponse error(String message, Object data) {
return new SellerResponse(0, message, HttpStatus.INTERNAL_SERVER_ERROR.toString(), data);
}
public static SellerResponse error(String message, Object data, HttpStatus status) {
return new SellerResponse(0, message, status.toString(), data);
}
public static SellerResponse error(String message) {
return new SellerResponse(0, message, HttpStatus.INTERNAL_SERVER_ERROR.toString(), null);
}
public static SellerResponse error(String message, HttpStatus status) {
return new SellerResponse(0, message, status.toString(), null);
}
public static SellerResponse error(Object data) {
return new SellerResponse(0, HttpStatus.OK.getReasonPhrase(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), data);
}
public static SellerResponse error(Object data, HttpStatus status) {
return new SellerResponse(0, status.getReasonPhrase(), status.toString(), data);
}
}
| true |
1fc71bab6990c58198e5ebef632f0aad00532b0a | Java | JinoGeorge/AddressBook | /src/main/java/com/addressbook/phonenumber/PhoneNumberEntity.java | UTF-8 | 1,312 | 2.265625 | 2 | [] | no_license | package com.addressbook.phonenumber;
import com.addressbook.common.BaseEntity;
import com.addressbook.contact.ContactEntity;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@Getter
@Setter
@EqualsAndHashCode(callSuper = true, onlyExplicitlyIncluded = true)
@AllArgsConstructor
@NoArgsConstructor(access = AccessLevel.PACKAGE, force = true)
@RequiredArgsConstructor
@ToString(callSuper = true, onlyExplicitlyIncluded = true)
@Entity(name = "phone_number")
public class PhoneNumberEntity extends BaseEntity {
@NotNull
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "contact_id", nullable = false)
private ContactEntity contact;
@Enumerated(EnumType.STRING)
private final Type type;
@NotBlank
private final String number;
public enum Type {
HOME, WORK, MOBILE
}
}
| true |
bcfa91630c24f74d0b8432adf57c0daac49c17bb | Java | cunhazera/coderadar | /coderadar-graph/src/main/java/io/reflectoring/coderadar/graph/query/repository/GetAvailableMetricsInProjectRepository.java | UTF-8 | 566 | 1.773438 | 2 | [
"MIT"
] | permissive | package io.reflectoring.coderadar.graph.query.repository;
import java.util.List;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface GetAvailableMetricsInProjectRepository extends Neo4jRepository {
@Query(
"MATCH (p1:ProjectEntity)-[:CONTAINS*]-(f1:FileEntity)-[:MEASURED_BY]->(n:MetricValueEntity) WHERE ID(p1) = {0} RETURN DISTINCT n.name")
List<String> getAvailableMetricsInProject(long projectId);
}
| true |
d88a1e6100847c1e2faebd69057fc61007ee01c5 | Java | junyuanz123/ctci | /src/Question722.java | UTF-8 | 1,357 | 2.953125 | 3 | [] | no_license | import java.util.ArrayList;
import java.util.List;
public class Question722 {
public List<String> removeComments(String[] source) {
List<String> result = new ArrayList<>();
boolean isBlockCommentDetected = false;
StringBuilder sb = new StringBuilder();
for (String s : source) {
char[] chars = s.toCharArray();
if (!isBlockCommentDetected)
sb = new StringBuilder();
int idx = 0;
int size = chars.length;
while (idx < chars.length) {
if (!isBlockCommentDetected && idx + 1 < size && chars[idx] == '/' && chars[idx + 1] == '*') {
isBlockCommentDetected = true;
idx += 1;
} else if (isBlockCommentDetected && idx + 1 < size && chars[idx] == '*' && chars[idx + 1] == '/') {
isBlockCommentDetected = false;
idx += 1;
} else if (!isBlockCommentDetected && idx + 1 < size && chars[idx] == '/' && chars[idx + 1] == '/')
break;
else if (!isBlockCommentDetected)
sb.append(chars[idx]);
idx += 1;
}
if (!isBlockCommentDetected && sb.length() != 0)
result.add(sb.toString());
}
return result;
}
} | true |
5333c3b89343c29ccaa5d6c154d7f424f754acfc | Java | abacusresearch/ebanking-commons | /src/main/java/ch/deeppay/spring/constraints/ExtendedFileFormatValidatorInterface.java | UTF-8 | 220 | 1.742188 | 2 | [] | no_license | package ch.deeppay.spring.constraints;
import javax.validation.ConstraintValidatorContext;
public interface ExtendedFileFormatValidatorInterface {
boolean isValid(String value, ConstraintValidatorContext context);
}
| true |
198640e10ae8ec5c62b4f7003973fead04f593c7 | Java | cjp472/crm | /src/com/ulane/monitor/action/unim/UnimThrlevlAction.java | UTF-8 | 6,839 | 1.898438 | 2 | [] | no_license | package com.ulane.monitor.action.unim;
/*
* 北京优创融联科技有限公司 综合客服管理系统 -- http://www.ulane.cn
* Copyright (C) 2008-2010 Beijing Ulane Technology Co., LTD
*/
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.htsoft.core.command.QueryFilter;
import com.htsoft.core.util.BeanUtil;
import com.htsoft.core.web.action.BaseAction;
import com.ulane.monitor.model.unim.UnimCategory;
import com.ulane.monitor.model.unim.UnimThrLevlDTO;
import com.ulane.monitor.model.unim.UnimThrlevl;
import com.ulane.monitor.service.unim.UnimCategoryService;
import com.ulane.monitor.service.unim.UnimThrlevlService;
/**
*
* @author cf0666@gmail.com
*
*/
public class UnimThrlevlAction extends BaseAction {
@Resource
private UnimThrlevlService unimThrlevlService;
@Resource
private UnimCategoryService unimCategoryService;
private UnimThrlevl unimThrlevl;
private Long thrlevlId;
public Long getThrlevlId() {
return thrlevlId;
}
public void setThrlevlId(Long thrlevlId) {
this.thrlevlId = thrlevlId;
}
public UnimThrlevl getUnimThrlevl() {
return unimThrlevl;
}
public void setUnimThrlevl(UnimThrlevl unimThrlevl) {
this.unimThrlevl = unimThrlevl;
}
/**
* 显示列表
*/
public String list() {
QueryFilter filterstatus = new QueryFilter(getRequest());
QueryFilter filterfazhi = new QueryFilter(getRequest());
List<UnimThrlevl> list = unimThrlevlService.getAll(filterfazhi);
filterstatus.addFilter("Q_typeId_SN_EQ", "2");
List<UnimCategory> listca = unimCategoryService.getAll(filterstatus);
// for(UnimThrlevl levl:list){
// if(levl.get)
// }
Type type = new TypeToken<List<UnimThrlevl>>() {
}.getType();
StringBuffer buff = new StringBuffer("{success:true,'totalCounts':")
.append(filterstatus.getPagingBean().getTotalItems()).append(
",result:");
// JSONSerializer serializer = new JSONSerializer();
// serializer.transform(new DateTransformer("yyyy-MM-dd HH:mm:ss"),new
// String[] { "applyTime"});
// buff.append(serializer.exclude(new
// String[]{"class","conHiss","conBwListBusRuls"}).serialize(list));
Gson gson = new Gson();
buff.append(gson.toJson(listca, type));
buff.append("}");
jsonString = buff.toString();
return SUCCESS;
}
/**
* 批量删除
*
* @return
*/
public String multiDel() {
String[] ids = getRequest().getParameterValues("ids");
if (ids != null) {
for (String id : ids) {
unimThrlevlService.remove(new Long(id));
}
}
jsonString = "{success:true}";
return SUCCESS;
}
/**
* 显示详细信息
*
* @return
*/
public String get() {
UnimThrlevl unimThrlevl = unimThrlevlService.get(thrlevlId);
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd").create();
// 将数据转成JSON格式
StringBuffer sb = new StringBuffer("{success:true,data:");
sb.append(gson.toJson(unimThrlevl));
sb.append("}");
setJsonString(sb.toString());
return SUCCESS;
}
/**
* 置空阀值操作
*/
public String clearFZ() {
String[] ids = getRequest().getParameterValues("ids");
try {
if (ids != null) {
for (String id : ids) {
UnimCategory cat = unimCategoryService.get(new Long(id));
List<UnimThrlevl> listlevl = unimThrlevlService
.getByCatId(new Long(id));
for(UnimThrlevl levl:listlevl){
unimThrlevlService.remove(levl);
}
}
}
// unimCategoryService.save(cat);
} catch (Exception ex) {
logger.error(ex.getMessage());
}
setJsonString("{success:true}");
return SUCCESS;
}
/**
* 添加及保存操作
*/
public String save() {
String shi = getRequest().getParameter("shi");
String fen = getRequest().getParameter("fen");
String miao = getRequest().getParameter("miao");
String catid = getRequest().getParameter("catid");
String oneshi = getRequest().getParameter("oneshi");
String onefen = getRequest().getParameter("onefen");
String onemiao = getRequest().getParameter("onemiao");
if (null == unimThrlevl.getThrlevlId()) {
unimThrlevl.setThrlevladv(shi + "," + fen + "," + miao); // 注意阀值
unimThrlevl.setThrlevlwar(oneshi + "," + onefen + "," + onemiao); // 警告阀值
UnimCategory cat = unimCategoryService.get(new Long(catid));
unimThrlevl.setUnimCategory(cat);
unimThrlevlService.save(unimThrlevl);
} else {
UnimThrlevl orgUnimThrlevl = unimThrlevlService.get(unimThrlevl
.getThrlevlId());
try {
BeanUtil.copyNotNullProperties(orgUnimThrlevl, unimThrlevl);
orgUnimThrlevl.setThrlevladv(shi + "," + fen + "," + miao); // 注意阀值
orgUnimThrlevl.setThrlevlwar(oneshi + "," + onefen + ","
+ onemiao); // 警告阀值
UnimCategory cat = unimCategoryService.get(new Long(catid));
orgUnimThrlevl.setUnimCategory(cat);
unimThrlevlService.save(orgUnimThrlevl);
} catch (Exception ex) {
logger.error(ex.getMessage());
}
}
setJsonString("{success:true}");
return SUCCESS;
}
//HTTP接口
public void getByMonitorId() {
try {
//Long MonitorId = Long.valueOf(getRequest().getParameter("MonitorId"));
// List list = unimThrlevlService.getByMonitorId(MonitorId);
// if (list.size() == 0) {
// List categoryList = unimCategoryService.listGetCategory(Short
// .valueOf("2"));
// unimThrlevlService.initThrlevl(MonitorId, categoryList);
// }
// list = unimThrlevlService.getByMonitorId(MonitorId);
// List list2 = convert_ThrLevlDTO(list);
List<UnimThrlevl> listThr = unimThrlevlService.getAll();
List<UnimCategory> listca = unimCategoryService.listGetCategory(new Short("2"));//unimCategoryService.getAll();
List<UnimThrLevlDTO> listDto = new ArrayList<UnimThrLevlDTO>();
for(UnimCategory sta:listca){
//if(sta.getTypeId()==null || !sta.getTypeId().toString().equals("2")) continue;
//if(sta.getStatus()==null || !sta.getStatus().toString().equals(UnimCategory.STA_ENABLE.toString())) continue;
UnimThrLevlDTO dto = new UnimThrLevlDTO();
//状态信息
dto.setCategoryId(sta.getCatId());
dto.setName(sta.getCatName());
dto.setCode(sta.getCatCode());
dto.setAgentColor(sta.getExtend1());
//阀值信息
for(UnimThrlevl thr:listThr){
if(sta.getCatId().equals(thr.getStatusId())){
dto.setId(thr.getThrlevlId());
dto.setThrLevlAdv(thr.getThrlevladv());
dto.setThrLevlWar(thr.getThrlevlwar());
break;
}
}
listDto.add(dto);
}
writeToPage(Boolean.valueOf(true), "状态及阀值查询成功", listDto);
} catch (Exception e) {
e.printStackTrace();
writeToPage(Boolean.valueOf(false), "操作失败,请重新操作或联系管理员", null);
}
}
}
| true |
ffc1f50d82162eeb474b26a9c8e7c1aacd45f960 | Java | tobiasbaum/pitclipse | /pitclipse-plugin/org.pitest.pitclipse.core/src/org/pitest/pitclipse/core/extension/point/PitRuntimeOptions.java | UTF-8 | 717 | 1.8125 | 2 | [] | no_license | package org.pitest.pitclipse.core.extension.point;
import java.util.List;
import org.pitest.pitclipse.pitrunner.PitOptions;
import org.pitest.pitclipse.reloc.guava.collect.ImmutableList;
public class PitRuntimeOptions {
private final int portNumber;
private final PitOptions options;
private final ImmutableList<String> projects;
public PitRuntimeOptions(int portNumber, PitOptions options, List<String> projects) {
this.portNumber = portNumber;
this.options = options;
this.projects = ImmutableList.copyOf(projects);
}
public int getPortNumber() {
return portNumber;
}
public PitOptions getOptions() {
return options;
}
public List<String> getMutatedProjects() {
return projects;
}
}
| true |
63eee071a824ca6f4fa9eac1e5c4ec910f490469 | Java | 6638112/propertyERP-2 | /commbusi_api/src/main/java/com/cnfantasia/server/api/point/dao/IPointDao.java | UTF-8 | 1,375 | 2.21875 | 2 | [] | no_license | /**
* Filename: IPointDao.java
* @version: 1.0
* Create at: 2014年12月30日 下午1:44:14
* Description:
*
* Modification History:
* Date Author Version Description
* -----------------------------------------------------------------
* 2014年12月30日 shiyl 1.0 1.0 Version
*/
package com.cnfantasia.server.api.point.dao;
import java.math.BigInteger;
import com.cnfantasia.server.domainbase.pointSourceRecord.entity.PointSourceRecord;
/**
* Filename: IPointDao.java
* @version: 1.0.0
* Create at: 2014年12月30日 下午1:44:14
* Description:
*
* Modification History:
* Date Author Version Description
* ------------------------------------------------------------------
* 2014年12月30日 shiyl 1.0 1.0 Version
*/
public interface IPointDao {
/**
* 增加积分
* @param userId
* @param value
* @return
*/
public Integer addPointData(BigInteger userId,Long value);
/**
* 扣除积分
* @param userId
* @param value
* @return
*/
public Integer costPointData(BigInteger userId,Long value);
/**
* 查询最近一次获取对应类别的积分信息
* @param userId
* @param type
* @return
*/
public PointSourceRecord selectLastPointSourceRecord(BigInteger userId,Integer type);
}
| true |
c79ca208e32bf18751f6dbcb1f3aee004a6cd199 | Java | roronoafour/Baseball-Yeah | /trunk/baseball-yeah/src/main/java/com/rofour/baseball/controller/manager/FocusPicController.java | UTF-8 | 5,813 | 1.929688 | 2 | [] | no_license | package com.rofour.baseball.controller.manager;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.fasterxml.jackson.core.type.TypeReference;
import com.rofour.baseball.common.*;
import com.rofour.baseball.dao.user.bean.UserManagerLoginBean;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.multipart.MultipartFile;
import com.rofour.baseball.controller.base.BaseController;
import com.rofour.baseball.controller.model.DataGrid;
import com.rofour.baseball.controller.model.ResultInfo;
import com.rofour.baseball.dao.manager.bean.FocusPicBean;
import com.rofour.baseball.service.manager.FocusPicService;
import com.rofour.baseball.service.resource.impl.ResourceServiceImpl;
/**
* Created by Administrator on 2016-06-30.
*/
@Controller
@RequestMapping("/manage/focuspic")
public class FocusPicController extends BaseController {
private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
@Qualifier("focusPicService")
private FocusPicService focusPicService;
@Autowired
@Qualifier("resourceService")
private ResourceServiceImpl resourceService;
@RequestMapping(value = "/getall", method = RequestMethod.POST)
public void getMenuList(HttpServletRequest request, HttpServletResponse response, @RequestBody FocusPicBean bean) {
if (StringUtils.isBlank(bean.getSort())) {
bean.setSort("create_time");//默认以id排序
bean.setOrder("desc");
}
DataGrid<FocusPicBean> grid = new DataGrid<FocusPicBean>();
try {
List<FocusPicBean> picList = focusPicService.getAll(bean);
grid.setRows(picList);
grid.setTotal(focusPicService.selectAllCount(bean));
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
writeJson(grid, response);
}
@ResponseBody
@RequestMapping(value = "del", method = RequestMethod.POST)
public ResultInfo<Object> del(HttpServletRequest req, HttpServletResponse response, FocusPicBean bean) {
int i = 0;
i = focusPicService.del(bean);
// ResultInfo<Object> result = new ResultInfo<Object>();
if (i > 0) {
return new ResultInfo<Object>(0, "0", "删除成功");
} else {
return new ResultInfo<Object>(-1, "0", "删除失败");
}
}
@ResponseBody
@RequestMapping(value = "add", method = RequestMethod.POST)
public ResultInfo<Object> add(HttpServletRequest req, HttpServletResponse response, FocusPicBean bean) {
try {
int i = 0;
bean.setCreateTime(new Date());
i = focusPicService.insert(bean);
Map<String, Object> map = new HashMap<String, Object>();
map.put("bizId", bean.getUrl());
map.put("attachIds", bean.getAdImg());
String url = Constant.axpurl.get("resource_updattachbizinfo_serv");
// 定义反序列化 数据格式
final TypeReference<ResultInfo<?>> TypeRef = new TypeReference<ResultInfo<?>>() {
};
ResultInfo<?> data = (ResultInfo<?>) HttpClientUtils.post(url, map, TypeRef);
if (i > 0) {
return new ResultInfo<Object>(0, "0", "添加成功");
} else {
return new ResultInfo<Object>(-1, "0", "添加失败");
}
} catch (Exception e) {
return new ResultInfo<Object>(-1, "0", "添加失败");
}
}
@RequestMapping(value = "/uploadFile", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
public ResultInfo<Object> uploadSampleFiles(HttpServletRequest request, @RequestParam(value = "file") MultipartFile file,
HttpServletResponse response, Model model) {
try {
UserManagerLoginBean userManagerLoginBean = (UserManagerLoginBean) request.getSession().getAttribute("user");
Map<String, Object> map = new HashMap<String, Object>();
map.put("attachmentType", AttachConstant.TYPE_AD);
map.put("file", AxpStream.getImageStr(file.getInputStream()));
map.put("fileName", file.getOriginalFilename());
map.put("userId", userManagerLoginBean.getUserManagerId());
map.put("userName", userManagerLoginBean.getUserName());
map.put("sourceId", "operation");
String url = Constant.axpurl.get("resource_upload_serv");
// 定义反序列化 数据格式
final TypeReference<ResultInfo<?>> TypeRef = new TypeReference<ResultInfo<?>>() {
};
ResultInfo<?> data = (ResultInfo<?>) HttpClientUtils.post(url, map, TypeRef);
if (data.getSuccess() < 0) {
return new ResultInfo(-1, "0", "调用AXP接口失败", "");
}
return new ResultInfo(0, "0", "", data.getData());
} catch (Exception e) {
return new ResultInfo(-1, "0", "调用AXP接口失败", "");
}
}
}
| true |
f29fd2c54ae2d9b9b21d82f5baa2a2ee19daaa3c | Java | Pivansm/javaless | /src/main/java/com/ifmo/lesson5/snape/Circle.java | UTF-8 | 224 | 2.734375 | 3 | [] | no_license | package com.ifmo.lesson5.snape;
public class Circle extends Oval{
public Circle(double r) {
super(0,0, r);
}
@Override
public double area() {
return Math.PI*radius*radius;
}
}
| true |
d770cd30778a3f418a44bf8482f7535f9ef3f296 | Java | yqf3139/dolphinframework | /src/seu/lab/dolphin/sysplugin/EventRecordWatcher.java | UTF-8 | 822 | 2.265625 | 2 | [] | no_license | package seu.lab.dolphin.sysplugin;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import seu.lab.dolphin.utility.ShellUtils;
import android.util.Log;
public class EventRecordWatcher extends Thread{
static String TAG = "EventRecordStopper";
private EventRecorder recorder;
static ShellUtils shell = new ShellUtils();
public EventRecordWatcher(EventRecorder recorder){
this.recorder = recorder;
}
@Override
public void run() {
if(recorder == null)return;
if(recorder.isAlive())return;
Log.i(TAG, "start");
recorder.start();
try {
sleep((recorder.recordSeconds+1)*1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Log.i(TAG, "after sleep");
recorder.stopNow();
Log.i(TAG, "stop");
}
}
| true |
f4988355e4103c326b5ff0cb8d6b0d3490484642 | Java | liwen666/springcloud_new | /h2_cache_redis/src/main/java/vip/dcpay/cache/infrastructure/model/ExDigitalMoneyAsset.java | UTF-8 | 1,568 | 1.867188 | 2 | [] | no_license | package vip.dcpay.cache.infrastructure.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* <p>
* 资产表
* </p>
*
* @author zys
* @since 2019-05-18
*/
@Accessors(chain = true)
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("ex_digitalmoney_asset")
public class ExDigitalMoneyAsset implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 商户Id
*/
@TableField("accountId")
private Long accountId;
/**
* 平台账户类型(1:平台;2:商家)
*/
@TableField("accountType")
private Integer accountType;
/**
* 币种名称
*/
@TableField("coinCode")
private String coinCode;
/**
* 热钱
*/
@TableField("hotMoney")
private BigDecimal hotMoney;
/**
* 冷钱
*/
@TableField("coldMoney")
private BigDecimal coldMoney;
/**
* 状态
*/
@TableField("status")
private Integer status;
@TableField("createTime")
private Date createTime;
@TableField("modifyTime")
private Date modifyTime;
}
| true |
18f5cecd99ed802e42012466fe016f6021d64e93 | Java | AllanMonje/Probando-antes-de-examen | /Probando/src/com/monje/Main.java | UTF-8 | 280 | 2.921875 | 3 | [] | no_license | package com.monje;
public class Main {
public static void main(String[] args) {
int[] numeros = new int[5];
for (int i = 0; i < 5; i++){
numeros[i] =i*2;
}
for (int temp: numeros){
System.out.print(temp);
}
}
}
| true |
8798b4b26d9a247d7abeb0d1fb58a1429ec7da04 | Java | ssomani7/Algorithm | /src/OA/Quora/IsPrefix10.java | UTF-8 | 1,509 | 3.5 | 4 | [] | no_license | package OA.Quora;
import java.util.HashSet;
import java.util.Set;
public class IsPrefix10 {
public boolean isPrefix(String[] a, String[] b){
//corner case
if (a == null || a.length == 0){
return false;
}
if (b == null || b.length == 0){
return false;
}
//dfs store all permutation of a in hashSet
Set<String> aset = new HashSet<>();
StringBuilder str = new StringBuilder();
dfspermu(aset, str, a, 0);
for (String ele : b){
if (!aset.contains(ele)){
return false;
}
}
return true;
}
private void dfspermu(Set<String> set,StringBuilder str, String[] a, int level){
// base case
if (level == a.length){
return;
}
for (int i = level; i < a.length; i++){
str.append(a[i]);
swap(a,i,level);
set.add(new String(str));
dfspermu(set, str, a, level+1);
if (str.length()!=0) {
str.delete(str.length() - a[i].length(), str.length());
}
swap(a,i,level);
}
}
private void swap(String[] a, int i, int j){
String temp = a[i];
a[i] = a[j];
a[j] = temp;
}
public static void main(String[] args){
IsPrefix10 test = new IsPrefix10();
System.out.println(test.isPrefix(new String[]{"ab","c","d"}, new String[]{"abc","abd","cd","dab"}));
}
}
| true |
ef75528e763c01712345dea494e05c361d5b3986 | Java | sadisusalisu/SafeBloodDonors | /app/src/main/java/ng/org/ddhub/kanoblooddonation/MainActivity.java | UTF-8 | 992 | 1.960938 | 2 | [] | no_license | package ng.org.ddhub.kanoblooddonation;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
public class MainActivity extends AppCompatActivity {
private FirebaseAuth firebaseAuth;
private Button Logout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
firebaseAuth = FirebaseAuth.getInstance();
Logout = (Button)findViewById(R.id.btnLogout);
Logout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
firebaseAuth.signOut();
finish();
startActivity(new Intent(MainActivity.this,Login.class));
}
});
}}
| true |
b7626af3e86a65a1c5b5a4d69296d3d8adf208cb | Java | JetBrains/intellij-community | /plugins/lombok/testData/inspection/lombokGetterMayBeUsed/afterFieldInInnerClass.java | UTF-8 | 185 | 2.28125 | 2 | [
"Apache-2.0"
] | permissive | // "Use lombok @Getter for 'InnerClass'" "true"
import lombok.Getter;
public class Foo {
@Getter
public class InnerClass {
// Keep this comment
private int bar;
}
} | true |