blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e03048104a3f846525b19cc1eb71cf9c977f98af | 90112891b3d9c823b670383802dd637552ae28fa | /Careercup/FacebookInterview.java | 5bda4065e93264dc66f38370f207bc3d420ea009 | [] | no_license | herat/DSA | 1fde274b90078ab2e68ed08d35328fdac509f398 | b18e15b3c27e78f9adba5ab95b88a393aa31d89a | refs/heads/master | 2016-08-04T10:05:24.173537 | 2013-07-28T14:31:45 | 2013-07-28T14:31:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,180 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Careercup;
import java.util.*;
/**
*
* @author Herat
*/
public class FacebookInterview {
static boolean match(char[] pattern, char[] string,int i,int j,ArrayList<Character> expected) {
if(string.length == 0 && pattern.length != 0)
return false;
if(j >= string.length) {
for(int g = 0;g < expected.size();g += 2) {
if(!((g+1) < expected.size() && expected.get(g+1) == '*'))
return false;
}
return true;
}
if(i < pattern.length) {
expected.add(pattern[i]);
i++;
while(i < pattern.length) {
if(pattern[i] == '*') {
i++;
expected.add(pattern[i-1]);
if(i < pattern.length) {
expected.add(pattern[i]);
i++;
}
} else if(pattern[i] != '*') {
break;
}
}
}
if(expected.contains(string[j])) {
int ind = expected.indexOf(string[j]);
if((ind-1) >= 0) {
if(ind - 1 <= 0)
return false;
int h = 1;
while(h <= ind-1) {
if(expected.get(h) != '*')
return false;
h += 2;
}
}
if(!((ind+1) < expected.size() && expected.get(ind+1) == '*')) {
for(int d = 0;d <= ind;d++)
expected.remove(0);
} else {
for(int d = 0;d <= ind-1;d++)
expected.remove(0);
}
return match(pattern, string, i, ++j, expected);
}
return false;
}
public static void main(String[] args) {
System.out.println(match("a*bbbc*".toCharArray(),
"abbb".toCharArray(),
0,0, new ArrayList<Character>()));
}
}
| [
"hag59@cornell.edu"
] | hag59@cornell.edu |
201e7260039293aae7063e52dde78bc4dadda080 | 2b675fd33d8481c88409b2dcaff55500d86efaaa | /infinispan/lucene-directory/src/test/java/org/infinispan/lucene/profiling/SharedState.java | 7b6f1554ac39ca2470937663e300f921d5e028f1 | [
"LGPL-2.0-or-later",
"Apache-2.0"
] | permissive | nmldiegues/stibt | d3d761464aaf97e41dcc9cc1d43f0e3234a1269b | 1ee662b7d4ed1f80e6092c22e235a3c994d1d393 | refs/heads/master | 2022-12-21T23:08:11.452962 | 2015-09-30T16:01:43 | 2015-09-30T16:01:43 | 42,459,902 | 0 | 2 | Apache-2.0 | 2022-12-13T19:15:31 | 2015-09-14T16:02:52 | Java | UTF-8 | Java | false | false | 3,240 | java | /*
* JBoss, Home of Professional Open Source
* Copyright 2009 Red Hat Inc. and/or its affiliates and other
* contributors as indicated by the @author tags. All rights reserved.
* See the copyright.txt in the distribution for a full listing of
* individual contributors.
*
* This 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 2.1 of
* the License, or (at your option) any later version.
*
* This software 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.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.infinispan.lucene.profiling;
import java.util.HashSet;
import java.util.concurrent.BlockingDeque;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
/**
* SharedState is used by LuceneUserThread when used concurrently to coordinate
* the assertions: different threads need a shared state to know what to assert
* about the Index contents.
*
* @author Sanne Grinovero
* @since 4.0
*/
public class SharedState {
final BlockingDeque<String> stringsInIndex = new LinkedBlockingDeque<String>();
final BlockingDeque<String> stringsOutOfIndex = new LinkedBlockingDeque<String>();
private final AtomicLong indexWriterActionCount = new AtomicLong();
private final AtomicLong searchingActionCount = new AtomicLong();
private final AtomicInteger errors = new AtomicInteger(0);
private volatile boolean quit = false;
private final CountDownLatch startSignal = new CountDownLatch(1);
public SharedState(int initialDictionarySize) {
HashSet<String> strings = new HashSet<String>();
for (int i=1; i<=initialDictionarySize; i++){
strings.add( String.valueOf(i));
}
stringsOutOfIndex.addAll(strings);
}
public boolean needToQuit() {
return quit || (errors.get()!=0);
}
public void errorManage(Exception e){
errors.incrementAndGet();
e.printStackTrace();
}
public long incrementIndexWriterTaskCount(long delta) {
return indexWriterActionCount.addAndGet(delta);
}
public long incrementIndexSearchesCount(long delta) {
return searchingActionCount.addAndGet(delta);
}
public String getStringToAddToIndex() throws InterruptedException {
return stringsOutOfIndex.take();
}
public void quit() {
quit = true;
}
public void addStringWrittenToIndex(String termToAdd) {
stringsInIndex.add(termToAdd);
}
public void waitForStart() throws InterruptedException {
startSignal.await();
}
public void startWaitingThreads() {
startSignal.countDown();
}
}
| [
"nmld@ist.utl.pt"
] | nmld@ist.utl.pt |
d54480850c439225456f83a6434e4e0f0595bf22 | c714670c7adf9d62eef5a21c182e098256dd43f3 | /java/Ex/src/Ex5.java | 650185644e93e4c9bcfff0f69258b6254c592293 | [] | no_license | Hongsomang/JAVA | 20dd8f3d278f07489aaa484f9df10c660a297688 | 3daf92f12b281467f290f9b6740d50ff9d07110d | refs/heads/master | 2021-01-01T16:09:06.846207 | 2017-07-20T03:38:29 | 2017-07-20T03:38:29 | 97,780,356 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 366 | java |
public class Ex5 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int num[]={5,2,1,4,3};
int temp=0;
for(int i=0;i<5;i++){
for(int j=0;j<5-1;i++){
if(num[i+1]>num[i]){
temp=num[i];
num[i]=num[i+1];
num[i+1]=temp;
}
}
}
for(int i=0;i<5;i++){
System.out.println(num[i]);
}
}
}
| [
"ghdthakd12@naver.com"
] | ghdthakd12@naver.com |
fcce6c8349fd115ab3719e445b0720d08777d76b | 5e2dd99100bbeca94b38363e560020c18c81b9f6 | /src/main/java/recruitmenttask/librarymanagement/api/BookPanel.java | 913026b9e59336180fc8fa5c92e09a9241a1ef8f | [] | no_license | Bartula/library-management | d4d33c46b4dd1ca99dae621db7a94696bd0dc874 | 7f42ee1cc98973541d49e45b89b487cc36aea665 | refs/heads/master | 2021-01-22T21:38:32.946482 | 2017-03-21T00:20:47 | 2017-03-21T00:20:47 | 85,458,516 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,001 | java | package recruitmenttask.librarymanagement.api;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import recruitmenttask.librarymanagement.domain.*;
import java.util.List;
import static recruitmenttask.librarymanagement.domain.BookStatus.AVAILABLE;
@Service
public class BookPanel {
private BookRepository bookRepository;
private BookCatalog bookCatalog;
private CustomerRepository customerRepository;
private BookAdmin bookAdmin;
private BookLender bookLender;
public BookPanel(BookRepository bookRepository, BookCatalog bookCatalog, CustomerRepository customerRepository, BookAdmin bookAdmin, BookLender bookLender) {
this.bookRepository = bookRepository;
this.bookCatalog = bookCatalog;
this.customerRepository = customerRepository;
this.bookAdmin = bookAdmin;
this.bookLender = bookLender;
}
@Transactional
public void createNewBook(BookDto bookDto) {
bookDto.validate();
Book book = new Book(bookDto.getTitle(), bookDto.getAuthor(), bookDto.getYear());
bookAdmin.createNewBook(book);
}
@Transactional
public void removeBook(Long bookId) {
Book book = bookRepository.findById(bookId);
if (book.getStatus().equals(AVAILABLE))
bookRepository.remove(book);
else throw new IllegalArgumentException("Can not remove book from library");
}
@Transactional
public List<BookDao> getBooksList() {
return bookCatalog.listAllBooks();
}
@Transactional
public void lendBook(Long customerId, Long bookId) {
Customer customer = customerRepository.findById(customerId);
Book book = bookRepository.findById(bookId);
bookLender.lendBook(book,customer);
bookAdmin.updateBook(book);
}
@Transactional
public List<BookDao> searchBooks(BookSearchCriteria criteria) {
return bookCatalog.searchBooks(criteria);
}
}
| [
"bartula87@gmail.com"
] | bartula87@gmail.com |
56e3098e43e9bd03c498c85c0e585ce68c86c38c | 0c968f52e21e5dc9b7dd5ea3a2cfa4842bd1a5a2 | /common/src/main/java/com/ejiaoyi/common/constant/BidDetailConstant.java | a43455379049b8317cece5abb1c61085065dcb47 | [] | no_license | Dido1960/fangjian | bee9ec9a21c061e1596f6d13efeaa12ed0dc36d6 | 24b34fe95cb4a1620280043a143b2b0bab3d1e7e | refs/heads/master | 2023-05-26T23:18:43.759613 | 2021-06-07T05:16:44 | 2021-06-07T05:16:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,595 | java | package com.ejiaoyi.common.constant;
/**
* 招标项目详细信息 xml节点 及属性
*
* @Auther: liuguoqiang
* @Date: 2020-11-17 14:45
*/
public interface BidDetailConstant {
/**
* 投标工具版本号
*/
String VERSION = "Version";
/**
* 项目编号
*/
String PROJECT_CODE = "ProjectCode";
/**
* 项目名称
*/
String PROJECT_NAME = "ProjectName";
/**
* 招标项目编号
*/
String TENDER_PROJECT_CODE = "TenderProjectCode";
/**
* 招标项目编号
*/
String TENDER_PROJECT_NAME = "TenderProjectName";
/**
* 标段名称
*/
String SECT_NAME = "SectName";
/**
* 标段编码
*/
String SECT_CODE = "SectCode";
/**
* 项目交易平台
*/
String TRADING_PLATFORM = "TradingPlatform";
/**
* 招标人
*/
String CO_NAME_INV = "CoName_Inv";
/**
* 招标代理机构
*/
String IPB_NAME = "IPBName";
/**
* 招标代理组织机构代码
*/
String IPB_CODE = "IPBCode";
/**
* 招标代表人数
*/
String TENDER_REPRE = "TenderRepre";
/**
* 评标委员会总人数
*/
String EXPERT = "Expert";
/**
* 投标文件递交截止时间
*/
String BID_DOC_REFER_END_TIME = "BidDocReferEndTime";
/**
* 开标时间
*/
String BID_OPEN_TIME = "BidOpenTime";
/**
* 投标保证金
*/
String MARGIN_AMOUNT = "MarginAmount";
/**
* 资格审查方式
*/
String QUALIFICATION_TYPE = "QualificationType";
/**
* 招标方式
*/
String BID_METHOD = "BidMethod";
/**
* 合同价款方式
*/
String CONTRACT_METHOD = "ContractMethod";
/**
* 评标办法
*/
String BID_EVAL_METHOD = "BidEvalMethod";
/**
* 计价方式
*/
String CALC_METHOD = "CalcMethod";
/*******************************子节点*******************************/
/**
* 节点子项
*/
String ITEM = "item";
/*******************************属性值*******************************/
/**
* 标题
*/
String TITLE = "title";
/**
* 提示
*/
String TIP = "tip";
/**
* 提示
*/
String WATERTEXT = "watertext";
/**
* 属性值
*/
String VALUE = "value";
/**
* 类型
*/
String TYPE = "type";
/**
* 可见
*/
String VISIBLE = "visible";
/**
* 类型
*/
String CLASSTYPE = "classtype";
}
| [
"827037560@qq.com"
] | 827037560@qq.com |
052b6bef5221d9093bab29b266f39b5def1e96ed | 8897666c4f669421bcf2af4d69745142ad366c41 | /src/com/iesvirgendelcarmen/teoria/ExcepcionesEjemplo.java | a93e0feb7f8cb1e8728c69a822e7b1b907e649cd | [] | no_license | programacionDAMVC/excepciones | 1eb2518a46518e9ed5e71d0c3a55f0b73385758b | cb5b7e3aa1597d78de07b731952ede4e20aa7c03 | refs/heads/master | 2021-04-30T15:49:42.787287 | 2018-02-19T13:23:21 | 2018-02-19T13:23:21 | 121,250,571 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,496 | java | package com.iesvirgendelcarmen.teoria;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Scanner;
public class ExcepcionesEjemplo {
public static void main(String[] args) {
//excepcion no declarativa
int numerador = 6;
int denominador = 0;
if (denominador != 0) {
int division = numerador / denominador;
}
//excepcion no declarativa
System.out.println("Introduce un boolean");
Scanner in = new Scanner(System.in);
String valorBoolean = in.next();
if (!valorBoolean.toUpperCase().matches("(TRUE|FALSE)")) {
System.out.println("Valor incorrecto");
}
in.close();
//excepcion no declarativa
int [] coleccionEnteros = new int[10];
for (int i = 0; i <= 10; i++) {
if (i < coleccionEnteros.length) {
coleccionEnteros[i] = i;
System.out.println("posición " + i + ": " +
coleccionEnteros[i]);
}
}
try { //no declarativa, pero si manejada
System.out.println(coleccionEnteros[10]);
} catch (ArrayIndexOutOfBoundsException exc) {
System.out.println("Posición no existente");
System.out.println(exc);
}
//excepción declarativa
try {
FileReader fileReader = new FileReader(
"/home/programacion/numeros.jar");
System.out.println("fichero existe");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
//e.printStackTrace();
System.out.println("No encuetro el fichero");
} finally {
System.out.println("Dentro del bloque finally");
}
}
}
| [
"programacionDAMVC@gmail.com"
] | programacionDAMVC@gmail.com |
9dfe7c66fd40150e30c1fb2b74301fd85860a930 | d4c12000089a34a9933beca89cf97bce4bcef5bb | /app/src/main/java/com/lemon/carmonitor/old/ui/DeviceSettingActivity.java | 89e513113d4cf1eadcd433cc4d9fecac74c87afb | [] | no_license | luxiaofeng544/CarMagic | f52d3d5cde467b6cc365444499771c4136193799 | 56d4500354d63935b7cd8b58dece2b418bc3cee9 | refs/heads/master | 2021-05-06T23:41:11.179723 | 2018-04-26T14:06:19 | 2018-04-26T14:06:19 | 112,938,858 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,011 | java | package com.lemon.carmonitor.old.ui;
import android.content.Intent;
import android.view.View;
import com.lemon.LemonActivity;
import com.lemon.carmonitor.R;
import com.lemon.carmonitor.old.ui.DeviceInfoActivity;
/**
* 项目名称: [CarMonitor]
* 包: [com.lemon.carmonitor.ui]
* 类描述: [类描述]
* 创建人: [XiaoFeng]
* 创建时间: [2015/12/21 20:39]
* 修改人: [XiaoFeng]
* 修改时间: [2015/12/21 20:39]
* 修改备注: [说明本次修改内容]
* 版本: [v1.0]
*/
public class DeviceSettingActivity extends LemonActivity {
@Override
protected void setLayout() {
layout = R.layout.activity_device_setting;
}
@Override
protected void initView() {
if(!checkDevice()){
finish();
return;
}
}
public void deviceInfoClick(View v) {
startNextActivity(DeviceInfoActivity.class, false);
}
public void gprsClick(View v){
cacheManager.putBean("command_connection_type","gprs");
Intent intent = new Intent(mContext,CommandCategoryActivity.class);
intent.putExtra("type","gprs");
startNextActivity(intent, false);
}
public void smsClick(View v){
cacheManager.putBean("command_connection_type","sms");
Intent intent = new Intent(mContext,CommandCategoryActivity.class);
intent.putExtra("type","sms");
startNextActivity(intent, false);
}
public void alarmClick(View v) {
startNextActivity(AlarmsetActivity.class, false);
}
public void workModelClick(View v) {
startNextActivity(DeviceWorkModelSettingActivity.class, false);
}
public void deviceClick(View v) {
startNextActivity(DeviceCmdSettingActivity.class, false);
}
public void baseClick(View v) {
startNextActivity(DeviceBaseSettingActivity.class, false);
}
public void phoneClick(View v) {
startNextActivity(DevicePhoneSettingActivity.class, false);
}
}
| [
"454162034@qq.com"
] | 454162034@qq.com |
29b3043bc85d919c72acf806e76ebcaf55197f3b | 36d23fdfad147c15c22307127dce847cbdf919d5 | /UdemyNative/moreexample/android/app/src/main/java/com/moreexample/MainApplication.java | 67375a5562c8effdc100254ad18d97ad15b44ef7 | [] | no_license | yusufDemir9110/react-native-1 | 36febb39c6a623eed6d0c9f05e2078fe9d443463 | c5b7584855bf1121bc29ed3ba56c73dece6972eb | refs/heads/main | 2023-05-06T00:42:15.621014 | 2021-06-02T11:14:27 | 2021-06-02T11:14:27 | 372,041,805 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,605 | java | package com.moreexample;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.moreexample.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
| [
"79963365+yusufDemir9110@users.noreply.github.com"
] | 79963365+yusufDemir9110@users.noreply.github.com |
0213113156315943c52bfdbbcebadfdd406e4418 | b976a1df955f242cdeb32e6b3785b1b82d9f330e | /eclipse-workspace/Typecasting/src/com/testyantra/typecasting/reference/Marker.java | 4966c858667941ffd9df81660a65ca7ba5c35004 | [] | no_license | shrinivas333/TYSS-17sep19-shrinivas | 1ad5be5b76d04c857e1c7459fb1519438b371c7e | 0ee7ffd532dbab582db91fa7883f86d5888111dd | refs/heads/master | 2023-01-13T18:51:47.822327 | 2019-12-20T14:52:42 | 2019-12-20T14:52:42 | 224,578,327 | 0 | 0 | null | 2023-01-07T12:15:04 | 2019-11-28T05:43:27 | JavaScript | UTF-8 | Java | false | false | 227 | java | package com.testyantra.typecasting.reference;
public class Marker extends Pen {
double size;
void color() {
System.out.println("Marker Color()");
}
@Override
void write() {
System.out.println("Marker Write()");
}
}
| [
"21shrin@gmail.com"
] | 21shrin@gmail.com |
f40b7bdefcc2de05ed69ac6ecbcc3d56af4cfbeb | c36727d9f01d42ae3fc819f107bbfbd96587cc50 | /projectEra/Input/KeyboardListener.java | 007da516267697ba2599a53ae5602fe710cf5e32 | [] | no_license | Kirbk/Projects | 30e3a56260bdfc4f5adc3fa4debdf0e285e19f00 | 57f0a6bd1320aa6244c9d6b04116e13d67f243f4 | refs/heads/master | 2020-12-25T19:03:54.025798 | 2014-02-19T02:02:05 | 2014-02-19T02:02:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 197 | java | package projectEra.Input;
import org.lwjgl.input.Keyboard;
public class KeyboardListener {
public void startMenu() {
if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
System.exit(0);
}
}
}
| [
"milkproducktionskirby@gmail.com"
] | milkproducktionskirby@gmail.com |
1062268b63d4b1c5b9a12acae229f8b6e283fb2a | c22cab46ac11e307573e5193ed2a7686c3a41b02 | /src/com/sean/scratch/codeeval/easy/Divisibility.java | 73e1bd8594921ec920b78b619d923e8829c33582 | [] | no_license | SeanRoy/CODERANK | e0cf4e28bd499fe7696d994fb183a39a4d3b0df9 | 5b3c0413193548aa1ee464730d42d082ca9c04fc | refs/heads/master | 2020-05-17T14:41:02.824029 | 2016-09-24T01:47:16 | 2016-09-24T01:47:16 | 26,388,431 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,576 | java | package com.sean.scratch.codeeval.easy;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class Divisibility
{
public static void main(String [] args)
{
if ( args.length >= 1 )
{
String fileName = args[0];
BufferedReader bReader = null;
try
{
bReader = new BufferedReader(new FileReader(fileName) );
String line = null;
while( ( line = bReader.readLine() ) != null )
{
String [] parms = line.split("\\s+");
int A = Integer.parseInt(parms[0]);
int B = Integer.parseInt(parms[1]);
int N = Integer.parseInt(parms[2]);
StringBuilder builder = new StringBuilder();
for( int i = 1, Ai = A, Bi = B; i <= N; i++ )
{
Ai--;
Bi--;
if ( Ai == 0 || Bi == 0 )
{
if ( Ai == 0 )
{
Ai = A;
builder.append("F");
}
if ( Bi == 0 )
{
Bi = B;
builder.append("B");
}
}
else
{
builder.append(i);
}
if ( i < N )
{
builder.append(" ");
}
}
System.out.println(builder.toString());
}
}
catch(FileNotFoundException fnfe)
{
System.err.println("File not found: " + fnfe.getMessage());
}
catch(IOException ioe)
{
System.err.println("Error reading file: " + ioe.getMessage() );
}
finally
{
try
{
bReader.close();
}
catch(Exception e){}
}
}
}
}
| [
"Sean.Roy@gmail.com"
] | Sean.Roy@gmail.com |
933c2e3e97b6d58b6a7a90f21f112f216ae1bc46 | da71f6a9b8a4949c8de43c738fa61730129bdf5e | /temp/src/minecraft/net/minecraft/src/GuiButtonMerchant.java | 73ae5b9896a8c26e9ac1eb4fedd80c4bf0f3adce | [] | no_license | nmg43/mcp70-src | 1c7b8938178a08f70d3e21b02fe1c2f21c2a3329 | 030db5929c75f4096b12b1c5a8a2282aeea7545d | refs/heads/master | 2020-12-30T09:57:42.156980 | 2012-09-09T20:59:42 | 2012-09-09T20:59:42 | 5,654,713 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,508 | java | // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode fieldsfirst
package net.minecraft.src;
import net.minecraft.client.Minecraft;
import org.lwjgl.opengl.GL11;
// Referenced classes of package net.minecraft.src:
// GuiButton, RenderEngine
class GuiButtonMerchant extends GuiButton
{
private final boolean field_73749_j;
public GuiButtonMerchant(int p_i3086_1_, int p_i3086_2_, int p_i3086_3_, boolean p_i3086_4_)
{
super(p_i3086_1_, p_i3086_2_, p_i3086_3_, 12, 19, "");
field_73749_j = p_i3086_4_;
}
public void func_73737_a(Minecraft p_73737_1_, int p_73737_2_, int p_73737_3_)
{
if(!field_73748_h)
{
return;
}
GL11.glBindTexture(3553, p_73737_1_.field_71446_o.func_78341_b("/gui/trading.png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
boolean flag = p_73737_2_ >= field_73746_c && p_73737_3_ >= field_73743_d && p_73737_2_ < field_73746_c + field_73747_a && p_73737_3_ < field_73743_d + field_73745_b;
int i = 0;
int j = 176;
if(!field_73742_g)
{
j += field_73747_a * 2;
} else
if(flag)
{
j += field_73747_a;
}
if(!field_73749_j)
{
i += field_73745_b;
}
func_73729_b(field_73746_c, field_73743_d, j, i, field_73747_a, field_73745_b);
}
}
| [
"nmg43@cornell.edu"
] | nmg43@cornell.edu |
dcad1d9789f958d367474f46083c71194be16fa9 | 04aa74719f9f6e71f129ab2681f0bf174c02d03a | /ui/src/com/alee/laf/desktoppane/WebInternalFrameUI.java | 3de1dd1d7d17a6097a4dadbfb8c9e805c4f52f78 | [] | no_license | jxl-taylor/rpa-master | a963269f3136d08474c06536ed4ba115f558146a | 52fab1d69478c9129a80c67d84dc836bd2ab7fc7 | refs/heads/master | 2022-02-08T23:13:19.372274 | 2020-01-19T06:22:10 | 2020-01-19T06:22:10 | 233,237,950 | 1 | 0 | null | 2022-02-01T01:00:39 | 2020-01-11T13:41:30 | Java | UTF-8 | Java | false | false | 4,514 | java | /*
* This file is part of WebLookAndFeel library.
*
* WebLookAndFeel library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* WebLookAndFeel 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WebLookAndFeel library. If not, see <http://www.gnu.org/licenses/>.
*/
package com.alee.laf.desktoppane;
import com.alee.api.annotations.NotNull;
import com.alee.api.annotations.Nullable;
import com.alee.managers.style.*;
import com.alee.painter.PainterSupport;
import javax.swing.*;
import javax.swing.plaf.ComponentUI;
import java.awt.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
/**
* Custom UI for {@link JInternalFrame} component.
*
* @param <C> component type
* @author Mikle Garin
*/
public class WebInternalFrameUI<C extends JInternalFrame> extends WInternalFrameUI<C>
{
/**
* Listeners.
*/
protected transient PropertyChangeListener rootPaneTracker;
/**
* Returns an instance of the {@link WebInternalFrameUI} for the specified component.
* This tricky method is used by {@link UIManager} to create component UIs when needed.
*
* @param c component that will use UI instance
* @return instance of the {@link WebInternalFrameUI}
*/
@NotNull
public static ComponentUI createUI ( @NotNull final JComponent c )
{
return new WebInternalFrameUI ();
}
@Override
public void installUI ( @NotNull final JComponent c )
{
super.installUI ( c );
// Applying skin
StyleManager.installSkin ( internalFrame );
// Installing title pane
if ( northPane instanceof WebInternalFrameTitlePane )
{
( ( WebInternalFrameTitlePane ) northPane ).install ();
}
// Root pane style updates
updateRootPaneStyle ();
rootPaneTracker = new PropertyChangeListener ()
{
@Override
public void propertyChange ( @NotNull final PropertyChangeEvent evt )
{
updateRootPaneStyle ();
}
};
internalFrame.addPropertyChangeListener ( JInternalFrame.ROOT_PANE_PROPERTY, rootPaneTracker );
}
@Override
public void uninstallUI ( @NotNull final JComponent c )
{
// Uninstalling listeners
internalFrame.removePropertyChangeListener ( JInternalFrame.ROOT_PANE_PROPERTY, rootPaneTracker );
// Uninstalling title pane
if ( northPane instanceof WebInternalFrameTitlePane )
{
( ( WebInternalFrameTitlePane ) northPane ).uninstall ();
}
// Uninstalling applied skin
StyleManager.uninstallSkin ( internalFrame );
super.uninstallUI ( c );
}
/**
* Performs root pane style update.
*/
protected void updateRootPaneStyle ()
{
StyleId.internalframeRootpane.at ( internalFrame ).set ( internalFrame.getRootPane () );
}
@NotNull
@Override
protected LayoutManager createLayoutManager ()
{
return new InternalFrameLayout ();
}
@Override
public boolean contains ( @NotNull final JComponent c, final int x, final int y )
{
return PainterSupport.contains ( c, this, x, y );
}
@Override
public int getBaseline ( @NotNull final JComponent c, final int width, final int height )
{
return PainterSupport.getBaseline ( c, this, width, height );
}
@NotNull
@Override
public Component.BaselineResizeBehavior getBaselineResizeBehavior ( @NotNull final JComponent c )
{
return PainterSupport.getBaselineResizeBehavior ( c, this );
}
@Override
public void paint ( @NotNull final Graphics g, @NotNull final JComponent c )
{
PainterSupport.paint ( g, c, this );
}
@Nullable
@Override
public Dimension getMinimumSize ( @NotNull final JComponent c )
{
return null;
}
@Nullable
@Override
public Dimension getPreferredSize ( @NotNull final JComponent c )
{
return null;
}
} | [
"taylor@jxltech.com"
] | taylor@jxltech.com |
da01074ab2283f9303b966951ad9148e15b668ca | 87755dc4e437bea7e9cea8bd2e8957f0d9cac543 | /job/src/main/java/com/search/job/domain/posts/PostsRepository.java | 94a2dcc4302850913f09b18684cf6159af694a35 | [] | no_license | choisaelim/jobsearch_jpa | d4cf78f6f30ca05211b66698184d9de91ba85a8d | 73cb8387f54f9d0429272e9c04ffee785c299e3a | refs/heads/main | 2023-02-20T12:11:43.722810 | 2021-01-24T09:34:05 | 2021-01-24T09:34:05 | 331,948,747 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 190 | java | package com.search.job.domain.posts;
import org.springframework.data.jpa.repository.JpaRepository;
public interface PostsRepository extends JpaRepository<Posts, Long> { // long type id
}
| [
"choisaelim@gmail.com"
] | choisaelim@gmail.com |
cc11da0aca5d9632f9e92be01c7e4c35c59e334d | dfd3673e6049f198566f280ca8ef1124818d74be | /Project/src/jdbc/examples/JdbcTest31.java | 9c8826c05d4b09f79674b7868024c4e0308f6555 | [] | no_license | devajdev/JDBC | 57692afb70e7b7aa16a5e4210540d279b4108215 | 89209f7566255398d1d6a2410385f49da3ea1d35 | refs/heads/master | 2020-07-26T04:43:13.491203 | 2019-09-15T03:52:56 | 2019-09-15T03:52:56 | 208,537,204 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 634 | java | package jdbc.examples;
import java.sql.*;
public class JdbcTest31 {
public static void main(String[] args) throws Exception {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection cn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","dev","dev");
PreparedStatement ps=cn.prepareStatement("insert into person_table values(?,?)");
ps.setString(1, "Devaj");
Address a=new Address("101","Amreetpet","Hyd","ADDRESS_TYPE");
ps.setObject(2, a); // set the value of the designated parameter using the given object
int c=ps.executeUpdate();
System.out.println("Row Updated :"+c);
}
}
| [
"devaj04@gmail.com"
] | devaj04@gmail.com |
cae3ab11c543335d07dd824056be690f1065e916 | 0ec2603a84e59b065ec9b567976371a7b2de8bfc | /DesignPatterns/src/nullObjectPattern/Run.java | 9d4f2c3e8e081a582b5e320906ff667bfcb10c0b | [] | no_license | DenLilleMand/legacy_code | 9391c9145716f896dddd802645658d016d44a317 | a09936ea7ae4c82c76aa3a5f4baa1fc782e10203 | refs/heads/master | 2016-08-13T00:51:27.964654 | 2016-02-17T23:06:33 | 2016-02-17T23:06:33 | 51,962,165 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 297 | java | package nullObjectPattern;
/**
* tror ikke at der kommer noget konkret kode eksempel i den her pakke, men jeg kan hvertfald henvise
* til side 218 i bogen.
* Og til klassen RemoteControl i vores CommandPattern projekt.
* @author DenLilleMand
*
*/
public class Run
{
}
| [
"mattinielsen5@hotmail.com"
] | mattinielsen5@hotmail.com |
b22fc6bbbafcf9f932670d4687fa63a4f529c905 | a86f09c18f5fcc78da2ee4d50f0db067cdd8956b | /app/src/main/java/com/example/facebook/ui/main/PostsAdapter.java | 6e2e2c1ccccd9066f328888ca89a962b5f4e685d | [] | no_license | MostafaMohamedMokhtar/PostsAPP | 47abffbc4c324611487cff02b92d1ffcb3d1d149 | 043dd5573001ab4002422c0c8d2b2662348013fd | refs/heads/master | 2022-11-10T15:42:59.264180 | 2020-06-26T09:50:31 | 2020-06-26T09:50:31 | 275,123,029 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,948 | java | package com.example.facebook.ui.main;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.facebook.R;
import com.example.facebook.pojo.PostModel;
import java.util.ArrayList;
import java.util.List;
public class PostsAdapter extends RecyclerView.Adapter<PostsAdapter.postViewHolde> {
private List<PostModel> postsList = new ArrayList<>();
private Context context;
@NonNull
@Override
public postViewHolde onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.post_item_row, parent, false);
return new postViewHolde(view);
} // end onCreateViewHolder()
@Override
public void onBindViewHolder(@NonNull postViewHolde holder, int position) {
holder.titleTV.setText(postsList.get(position).getTitle());
holder.userTV.setText(postsList.get(position).getUserId()+"");
holder.bodyTV.setText(postsList.get(position).getBody());
} // end onBindViewHolder()
@Override
public int getItemCount() {
return postsList.size();
} // end getItemCount()
public void setList(List<PostModel> postsList) {
this.postsList = postsList;
notifyDataSetChanged();
} // end setPostsList()
public class postViewHolde extends RecyclerView.ViewHolder {
TextView titleTV , userTV , bodyTV ;
public postViewHolde(@NonNull View itemView) {
super(itemView);
titleTV = itemView.findViewById(R.id.titleTV_id);
userTV = itemView.findViewById(R.id.userID);
bodyTV = itemView.findViewById(R.id.bodyTV_id);
} // end constructor
} // end inner class postViewHolde(class)
} // end outer class
| [
"mokhtarmostafa13@gmail.com"
] | mokhtarmostafa13@gmail.com |
8ac4818742851e6ec94eb66d8f0330611aa43cb5 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/25/25_b585ccdd3a900a3536a2a06b8046c26a1f807cc8/Navbar/25_b585ccdd3a900a3536a2a06b8046c26a1f807cc8_Navbar_t.java | 1f51bf37f40ea4ecd0c351958d3456563db2d427 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 7,652 | java | package de.agilecoders.wicket.markup.html.bootstrap.navbar;
import com.google.common.collect.Lists;
import de.agilecoders.wicket.markup.html.bootstrap.behavior.CssClassNameAppender;
import de.agilecoders.wicket.markup.html.bootstrap.button.Activateable;
import de.agilecoders.wicket.markup.html.bootstrap.button.Bookmarkable;
import org.apache.wicket.Component;
import org.apache.wicket.Page;
import org.apache.wicket.markup.html.TransparentWebMarkupContainer;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import java.util.List;
/**
* TODO: document
* <p/>
* <pre><div wicket:id="navbar" class="navbar"></div></pre>
*
* @author miha
* @version 1.0
*/
public class Navbar extends Panel {
/**
* indicates the position of a button inside the navigation bar.
*/
public enum Position {
LEFT, RIGHT
}
private final WebMarkupContainer container;
private final BookmarkablePageLink<Page> brandNameLink;
private final Component navRightList;
private final Component navLeftList;
private boolean fluid = false;
private boolean fixedTop = false;
private boolean fixedBottom = false;
private final List<Component> buttonLeftList = Lists.newArrayList();
private final List<Component> buttonRightList = Lists.newArrayList();
/**
* TODO document
*
* @param componentId The non-null id of this component
*/
public Navbar(final String componentId) {
this(componentId, Model.of());
}
/**
* TODO document
*
* @param componentId The non-null id of this component
* @param model The component's model
*/
public Navbar(final String componentId, final IModel<?> model) {
super(componentId, model);
container = newContainer("container");
brandNameLink = newBrandNameLink("brandName");
navLeftList = newNavigation("navLeftList", buttonLeftList);
navRightList = newNavigation("navRightList", buttonRightList);
add(container, brandNameLink, navLeftList, navRightList);
}
/**
* TODO document
*
* @param componentId The non-null id of a new navigation component
* @param listModel The component's model
* @return a new navigation list view instance
*/
private Component newNavigation(final String componentId, final List<Component> listModel) {
return new ListView<Component>(componentId, listModel) {
@Override
protected void populateItem(ListItem<Component> components) {
Component button = components.getModelObject();
components.add(button);
Page page = getPage();
if (button instanceof Activateable) {
Activateable activateable = (Activateable) button;
if (activateable.isActive(button)) {
components.add(new CssClassNameAppender("active"));
}
}
// TODO consider removing Bookmarkable. Often the PageParameters are needed as well to make this next check.
// Activateable can handle all of this
else if (button instanceof Bookmarkable && page.getClass().equals(((Bookmarkable)button).getPageClass())) {
components.add(new CssClassNameAppender("active"));
}
}
};
}
/**
* creates a new brand name button.
*
* @param componentId The non-null id of a new navigation component
* @return a new brand name page link instance
*/
private BookmarkablePageLink<Page> newBrandNameLink(String componentId) {
return new BookmarkablePageLink<Page>(componentId, getHomePage());
}
/**
* @return the page class which is used for the brand name link. The
* application's homepage is used by default.
*/
protected Class<? extends Page> getHomePage() {
return getApplication().getHomePage();
}
/**
* {@inheritDoc}
*/
@Override
protected void onConfigure() {
super.onConfigure();
add(new CssClassNameAppender("navbar"));
container.add(new CssClassNameAppender(isFluid() ? "container-fluid" : "container"));
if (isFixedTop()) {
add(new CssClassNameAppender("navbar-fixed-top"));
} else if (isFixedBootom()) {
add(new CssClassNameAppender("navbar-fixed-bottom"));
}
brandNameLink.setVisible(brandNameLink.getBody() != null);
navLeftList.setVisible(buttonLeftList.size() > 0);
navRightList.setVisible(buttonRightList.size() > 0);
}
/**
* @return true, if the navigation is fixed on the top of the screen.
*/
public boolean isFixedTop() {
return fixedTop;
}
/**
* @return true, if the navigation is fixed on the bottom of the screen.
*/
public boolean isFixedBootom() {
return fixedBottom;
}
/**
* @return true, if the navigation is rendered for a fluid page layout.
*/
public boolean isFluid() {
return fluid;
}
/**
* adds a button to the given position inside the navbar
*
* @param position The position of the button (left, right)
* @param buttons the buttons to add
* @return this component
*/
public final Navbar addButton(Position position, Component... buttons) {
if (Position.LEFT.equals(position)) {
buttonLeftList.addAll(Lists.newArrayList(buttons));
} else if (Position.RIGHT.equals(position)) {
buttonRightList.addAll(Lists.newArrayList(buttons));
}
return this;
}
/**
* creates a new transparent inner container which is used to append some
* css classes.
*
* @param componentId The non-null id of a new navigation component
* @return a new inner container of the navigation bar.
*/
private TransparentWebMarkupContainer newContainer(String componentId) {
return new TransparentWebMarkupContainer(componentId);
}
/**
* sets the label of the brand name button
*
* @param brandName the brand name label
* @return the component's current instance
*/
public Navbar brandName(IModel<String> brandName) {
this.brandNameLink.setBody(brandName);
return this;
}
/**
* marks the navigation to be rendered inside a fluid page layout.
*
* @return the component's current instance.
*/
public Navbar fluid() {
this.fluid = true;
return this;
}
/**
* fixates the navigation on the top of the screen.
*
* @return the component's current instance.
*/
public Navbar fixedTop() {
this.fixedTop = true;
this.fixedBottom = false;
return this;
}
/**
* fixates the navigation on the top of the screen.
*
* @return the component's current instance.
*/
public Navbar fixedBottom() {
this.fixedTop = false;
this.fixedBottom = true;
return this;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
60f000c6ce3349ffdf678470e3015adac1eb9e4d | 20cd9f382f475460a0d311656a1d32e861fd7e63 | /commonLibs/src/main/java/com/yysc/commomlibary/net/CustomerInterceptorListener.java | ed7533be1725932e4b2a042f999ed5f8e39f97ef | [] | no_license | unbanSysin/Yysc | 9e95b766905db3bd2904731f395d4cc1cdce7f13 | 35dcfdca58706c89b0021ffb1224cfb8042bfe1a | refs/heads/master | 2021-04-27T03:43:05.710701 | 2018-02-24T08:06:52 | 2018-02-24T08:06:52 | 122,717,596 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 201 | java | package com.yysc.commomlibary.net;
import okhttp3.Interceptor;
/**
* Created by kj00037 on 2017/12/29.
*/
public interface CustomerInterceptorListener {
public Interceptor getInterceptor();
}
| [
"kj00037@UAF.com.cn"
] | kj00037@UAF.com.cn |
68bae6b31ccd096c7250ae309aef6e87a4d3c94c | 6df097c5c36bbfd49d2941800da4ba4c6f0220e5 | /hazelcast/src/test/java/com/hazelcast/map/EntryProcessorBouncingNodesTest.java | d7724a8b6c70c93585d6a94a6f89d74423f13907 | [] | no_license | JiangYongPlus/easycache | cd625afb27dc5dd20c1709727e89a6e5218b2d74 | 93e6bae20dcfa97ae9c57b9581c75e5a055cd831 | refs/heads/master | 2021-01-10T16:37:41.790505 | 2016-01-27T02:41:34 | 2016-01-27T02:41:34 | 50,475,643 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,278 | java | /*
* Copyright (c) 2008-2014, Hazelcast, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hazelcast.map;
import com.hazelcast.config.Config;
import com.hazelcast.config.MapConfig;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.IMap;
import com.hazelcast.test.AssertTask;
import com.hazelcast.test.HazelcastSerialClassRunner;
import com.hazelcast.test.HazelcastTestSupport;
import com.hazelcast.test.TestHazelcastInstanceFactory;
import com.hazelcast.test.annotation.QuickTest;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@RunWith(HazelcastSerialClassRunner.class)
@Category(QuickTest.class)
public class EntryProcessorBouncingNodesTest extends HazelcastTestSupport {
private static final int ENTRIES = 10;
private static final long ITERATIONS = 50;
private static String MAP_NAME = "test-map";
private TestHazelcastInstanceFactory instanceFactory;
@Before
public void setUp() throws Exception {
if (instanceFactory != null) {
instanceFactory.shutdownAll();
}
instanceFactory = new TestHazelcastInstanceFactory(500);
}
@Test
@Ignore // https://github.com/hazelcast/hazelcast/issues/3683
public void testEntryProcessorWhile2NodesAreBouncing() throws InterruptedException {
CountDownLatch startLatch = new CountDownLatch(1);
AtomicBoolean isRunning = new AtomicBoolean(true);
// start up three instances
HazelcastInstance instance = newInstance();
HazelcastInstance instance2 = newInstance();
HazelcastInstance instance3 = newInstance();
// Create a map that we'll use to test data consistency while nodes are joining and leaving the cluster
// The basic idea is pretty simple. In a loop, for each key in the IMap, we'll add a number to a list.
// This allows us to verify whether the numbers are added in the correct order and also whether there's
// any data loss as nodes leave or join the cluster.
final IMap<Integer, List<Integer>> map = instance.getMap(MAP_NAME);
final List<Integer> expected = new ArrayList<Integer>();
// initialize the list synchronously to ensure the map is correctly initialized
InitListProcessor initProcessor = new InitListProcessor();
for (int i = 0; i < ENTRIES; ++i) {
map.executeOnKey(i, initProcessor);
}
assertEquals(ENTRIES, map.size());
// spin up the threads that stop/start the instance2 and instance3, leaving one instance always running
Thread bounceThread1 = new Thread(new TwoNodesRestartingRunnable(instance2, instance3, startLatch, isRunning));
bounceThread1.start();
// now, with nodes joining and leaving the cluster concurrently, start adding numbers to the lists
int iteration = 0;
while (iteration < ITERATIONS) {
if (iteration == 30) {
// let the bounce threads start bouncing
startLatch.countDown();
}
IncrementProcessor processor = new IncrementProcessor(iteration);
expected.add(iteration);
for (int i = 0; i < ENTRIES; ++i) {
map.executeOnKey(i, processor);
}
// give processing time to catch up
++iteration;
}
// signal the bounce threads that we're done
isRunning.set(false);
// wait for the instance bounces to complete
bounceThread1.join();
final CountDownLatch latch = new CountDownLatch(ENTRIES);
for (int i = 0; i < ENTRIES; ++i) {
final int id = i;
new Thread(new Runnable() {
@Override
public void run() {
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
assertTrue(expected.size() <= map.get(id).size());
}
});
latch.countDown();
}
}).start();
}
assertOpenEventually(latch);
}
private HazelcastInstance newInstance() {
final Config config = new Config();
final MapConfig mapConfig = new MapConfig(MAP_NAME);
mapConfig.setBackupCount(2);
config.addMapConfig(mapConfig);
return instanceFactory.newHazelcastInstance(config);
}
private class TwoNodesRestartingRunnable implements Runnable {
private final CountDownLatch start;
private final AtomicBoolean isRunning;
private HazelcastInstance instance1;
private HazelcastInstance instance2;
private TwoNodesRestartingRunnable(HazelcastInstance h1, HazelcastInstance h2, CountDownLatch startLatch, AtomicBoolean isRunning) {
this.instance1 = h1;
this.instance2 = h2;
this.start = startLatch;
this.isRunning = isRunning;
}
@Override
public void run() {
try {
start.await();
while (isRunning.get()) {
instance1.shutdown();
instance2.shutdown();
Thread.sleep(10l);
instance1 = newInstance();
instance2 = newInstance();
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
private static class IncrementProcessor extends AbstractEntryProcessor<Integer, List<Integer>> {
private final int nextVal;
private IncrementProcessor(int nextVal) {
this.nextVal = nextVal;
}
@Override
public Object process(Map.Entry<Integer, List<Integer>> entry) {
List<Integer> list = entry.getValue();
if (list == null) {
list = new ArrayList<Integer>();
}
list.add(nextVal);
entry.setValue(list);
return null;
}
}
private static class InitListProcessor extends AbstractEntryProcessor<Integer, List<Integer>> {
@Override
public Object process(Map.Entry<Integer, List<Integer>> entry) {
entry.setValue(new ArrayList<Integer>());
return null;
}
}
}
| [
"jiangyongplus@gmail.com"
] | jiangyongplus@gmail.com |
00f9d569ffead07485c13c2fe3523b7663a0df85 | e8898a897e9335886219638f48e1b0837300fe51 | /ReceiveBroadCast/app/src/test/java/com/example/deepanshu/receivebroadcast/ExampleUnitTest.java | 4d9fa84b56d36111998fb9fcf2406a4a08d78b00 | [] | no_license | Deepanshu2017/Android_learning | 4452286f35a9cd29ea2f4664e0400dffdf66d43a | 86761179eac23af00ce02865ac349d0458c61071 | refs/heads/master | 2016-08-13T00:48:23.788778 | 2016-03-13T22:07:14 | 2016-03-13T22:07:14 | 52,102,253 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 331 | java | package com.example.deepanshu.receivebroadcast;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"deepanshu2017@hotmail.com"
] | deepanshu2017@hotmail.com |
2e8c0e64c4a90b5ef2120be3f58e8e796ed03d52 | daeaf2bafee818bb892e95af7cf1e6da1e07abea | /src/com/zyh/fivechess0628/ServeOneClient.java | a17e302ca4c6b21b9d0cd5f91fec34ea44cdbec2 | [] | no_license | ziyonghong/java- | 14aba1c12d5fed20751a4e008ffc6ed9be9d6c8b | 3086503610754690bece7d107920eee0719f4a4e | refs/heads/master | 2020-05-25T04:33:04.164029 | 2019-05-20T12:49:23 | 2019-05-20T12:49:23 | 187,628,348 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 24,826 | java | package com.zyh.fivechess0628;
import java.io.*;
import java.net.*;
/**
* <p>Title: chess server</p>
* <p>Description: chess server</p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: e-top</p>
* @author cylix
* @version 1.0
*/
public class ServeOneClient extends Thread{
private Socket socket;
private String player=null;
protected ObjectInputStream in;
protected ObjectOutputStream out;
public ServeOneClient(Socket s)
throws IOException {
socket = s;
//System.out.println("server socket begin ...");
in =new ObjectInputStream(
socket.getInputStream());
// Enable auto-flush:
out = new ObjectOutputStream(
socket.getOutputStream());
//System.out.println("server socket in and out ...");
// If any of the above calls throw an
// exception, the caller is responsible for
// closing the socket. Otherwise the thread
// will close it.
start(); // Calls run()
}
public void run() {
Message obj=new Message();
while (true) {
try {
obj =(Message)in.readObject();
// write message by doMessage() function
doMessage(obj);
}catch(ClassNotFoundException er){}
catch(IOException e){}
}
/*
System.out.println("closing...");
try {
socket.close();
}catch (IOException e) {}
*/
}
/**
* deal with messages
* @param msg
* @return 1= victory request 2=socket closeed
*/
public int doMessage(Message msg){
//System.out.println("doMessage begin...type="+msg.type);
switch(msg.type){
case 1:{//new connect to the server
sendNewPlayer(msg); //here client must reply with type==10
addPlayer(msg); // msg.msg == new player's name
break;
}
case 2:{// put chessman
putChessman(msg);
break;
}
case 3:{//request for another to play
requestAnother(msg);
break;
}
case 4:{
denyRequest(msg);
break;
}
case 5:{
acceptRequest(msg);
break;
}
case 6:{//send victory
checkVictory(msg);
break;
}
case 7:{//send disconnection
getdisconnect(msg);
break;
}
case 8:{//save game
break;
}
case 12:{//setting information
boolean flag=true;
setting(msg,flag);
break;
}
case 13:{
boolean flag=false;
setting(msg,flag);
break;
}
case 19:{
playerRefresh(msg);
break;
}
case 20:{
try{
this.out.writeObject(msg);
}catch(IOException e){
e.printStackTrace();
}
break;
}
default:{
}
}//end switch
return 0; // end correctly
}
/**
* judge game and update all client's panel
* type = 7 sender will close game
* @param msg
*/
public void getdisconnect(Message msg){
Group gg = null;
Player pp = null;
String str=null;
//if disconnector in a group
for(int i=0;i<Server.groupList.size();i++){
gg = (Group)Server.groupList.get(i);
if(this.equals(gg.selfSocket)==true){
//send gg.player win
msg.type=6; // gg.player win
try{
gg.playerSocket.out.writeObject(msg);
}catch(IOException e){
e.printStackTrace();
}
sendLeftMsg(gg.self);
//update groupList
Server.groupList.remove(gg);
return;
}
if(this.equals(gg.playerSocket)==true){
msg.type=6;
try{
gg.selfSocket.out.writeObject(msg);
}catch(IOException e){
e.printStackTrace();
}
sendLeftMsg(gg.player);
Server.groupList.remove(gg);
return;
}
}
// if disconnector in the playerList
for(int i=0;i<Server.playerList.size();i++){// find disconnector
pp = (Player)Server.playerList.get(i);
if(this.equals(pp.selfSocket)==true){
break;
}
}
sendLeftMsg(pp.self);
Server.playerList.remove(pp); // remove disconnector from list
updateClient();
}
private void sendLeftMsg(String str){
char cc;
for(int i=0;i<50;i++){
cc=str.charAt(i);
if(cc!='\0')
System.out.print(cc);
else break;
}
System.out.print(" has left server ...\n");
}
/**
* deny request of play
* type ==4 msg == requestor's name
* @param msg
*/
public void denyRequest(Message msg){
String denyName=null;
Player pp=null;
for(int i=0;i<Server.playerList.size();i++){
pp = (Player)Server.playerList.get(i);
if(this.equals(pp.selfSocket)==true){
denyName = new String(pp.self);
break;
}
}
for(int i=0;i<Server.playerList.size();i++){
pp = (Player)Server.playerList.get(i);
if(arrayMatchString(msg.msg,pp.self)==true){
Message ms = new Message();
ms.type=4;
strToCharArray(denyName,ms.msg);
try{// requestor 's socket send msg to it's client
pp.selfSocket.out.writeObject(ms);
}catch(IOException er){
er.printStackTrace();
}
break;
}
}
}
/**
* B accept request of A server will update List
* type ==5 msg == A's name
* @param msg
*/
public void acceptRequest(Message msg){
Player pps=null,ppd=null;//ppd = B pps = A
String acceptName=null;
for(int i=0;i<Server.playerList.size();i++){
ppd = (Player)Server.playerList.get(i);
if(this.equals(ppd.selfSocket)==true){
break;
}
}
for(int i=0;i<Server.playerList.size();i++){
pps = (Player)Server.playerList.get(i);
if(arrayMatchString(msg.msg,pps.self)==true){
break;
}
}
Message ss = new Message();
ss.type=14; // for B to set color and settings
ss.color=msg.color;
try{
ppd.selfSocket.out.writeObject(ss);
}catch(IOException e){
e.printStackTrace();
}
ss.type=5; // B's accept A's requestion
strToCharArray(ppd.self,ss.msg);
try{
pps.selfSocket.out.writeObject(ss);
}catch(IOException e){
e.printStackTrace();
}
//upload list display here, server will update Arraylist
Group p1 = new Group();
p1.self=new String(pps.self);
p1.selfSocket = pps.selfSocket;
p1.selfColor = pps.color;
p1.player = new String(ppd.self);
p1.playerSocket = ppd.selfSocket;
if(p1.selfColor==1){
p1.playerColor = 2;
}else{
p1.playerColor = 1;
}
p1.Setting = pps.setting;
Server.groupList.add(p1);
///System.out.println(p1.self+p1.selfColor+" player "+p1.player+p1.playerColor);
if(Server.playerList.size()==2){
msg.type=15;
try{
pps.selfSocket.out.writeObject(msg);
ppd.selfSocket.out.writeObject(msg);
}catch(IOException e){
e.printStackTrace();
}
}
Server.playerList.remove(pps);
Server.playerList.remove(ppd);
//System.out.println(" after create a group,playerlist size = "+Server.playerList.size());
updateClient();
}
/**
* update client List when new group create or player left
*/
public void updateClient(){
Message msg = new Message();
Player pp = null,ppm = null;
for(int i=0;i<Server.playerList.size();i++){
pp = (Player)Server.playerList.get(i);
msg.type=15; //update client player list box
try{ //clear client list box
// System.out.println("clear "+pp.self+"'s list box");
pp.selfSocket.out.writeObject(msg);
}catch(IOException e){
e.printStackTrace();
}
for(int j=0;j<Server.playerList.size();j++){
ppm=(Player)Server.playerList.get(j);
strToCharArray(ppm.self,msg.msg);
msg.type=9;
try{
//System.out.println("updating ..."+pp.self+" list box about"+ppm.self);
pp.selfSocket.out.writeObject(msg);
}catch(IOException e){
e.printStackTrace();
}
}
}
// later ,group player 's list box will be updateed here
}
/**
* judge whether arr[] is equal to str
* @param arr
* @param str
* @return
*/
private boolean arrayMatchString(char []arr,String str){
for(int i=0; i<50 && str.charAt(i)!='\0';i++){
if(arr[i]!=str.charAt(i))
return false;
}
return true;
}
/**
* type ==3
* @param msg
*/
public void requestAnother(Message msg){
Player pp = null; // receiver
Player spp = null; // sender
String senderName=null;
// get sender's name
for(int i=0;i<Server.playerList.size();i++){
spp = (Player)Server.playerList.get(i);
if(this.equals(spp.selfSocket)==true){
senderName = new String(spp.self);
//System.out.println("requestor 's name = "+senderName);
break;
}
}
for(int i=0;i<Server.playerList.size();i++){
pp = (Player)Server.playerList.get(i);
if(arrayMatchString(msg.msg,pp.self)==true){
Message ms = new Message();
strToCharArray(senderName,ms.msg);
ms.type=3;
if(spp.color==1){
ms.color = 2; //set another's color
}
else{
ms.color = 1;
}
ms.setting=spp.setting;
try{// player B socket send msg to B's Client
pp.selfSocket.out.writeObject(ms);
//System.out.println("type= "+ms.type+" "+pp.self+ " send msg to name = "+ms.msg[0]+"with B's color"+ms.color);
}catch(IOException er){
er.printStackTrace();
}
break;
}
}
}
// convert string to array which is end with '\0'
public void strToCharArray(String str,char [] arr){
int i=0;
for(i=0;i<str.length()&&i<49;i++){
arr[i] = str.charAt(i);
}
arr[i]='\0';
}
/**
* setting information flag
* @param msg
*/
public void setting(Message msg,boolean flag){
int i=0;
Player pp=null;
for(i=0;i<Server.playerList.size();i++){
pp =(Player) Server.playerList.get(i);
if(this.equals(pp.selfSocket)==true){
if(flag==true)
pp.setting=msg.setting;
else
pp.color=msg.color;
//System.out.println("setting "+pp.setting+"color = "+pp.color);
}
}
}
/**
* filter array 's black space which is end of the array
* @param arr
* @param str
*/
public String arrayToString(char [] arr){
int i=0,length=0;
while(arr[i]!='\0' && i<50){
i++;
}
length=i;
char [] ss = new char[length];
for(i=0;i<length;i++){
ss[i]=arr[i];
}
String str = new String(ss);
return str;
//System.out.println("arraytoString "+str+"length = "+length);
}
/**
* add new player to all client's Player List
* ... read server player list and send msg to everyone of them
* @param player
*/
public void sendNewPlayer(Message player){
Player pp=null;
player.type=9;
// System.out.println("send new Player ...");
for(int i=0;i<Server.playerList.size();i++){
pp=(Player)Server.playerList.get(i);
try{
if(pp.self!=null){//send message to all but itself
//System.out.println(pp.self+" add list "+player.msg[0]+"i = "+i);
pp.selfSocket.out.writeObject(player);
}
}catch(IOException e){
e.printStackTrace();
}
}
}
/**
* a player end a game and wait for a new one
* @param msg
*/
public void playerRefresh(Message player){
Player ppo = new Player();
Player pp = null;
ppo.color = player.color;
ppo.self = new String(player.msg);
ppo.selfSocket = this;
Server.playerList.add(ppo);
for(int i=0;i<Server.playerList.size();i++){
pp = (Player)Server.playerList.get(i);
if(this.equals(pp.selfSocket)==false){
Message msg = new Message();
strToCharArray(pp.self, msg.msg);
msg.type = 9;
msg.color = pp.color;
// System.out.println("refresh " + pp.self + "serverlist size " +
// Server.playerList.size());
try {
this.out.writeObject(msg);
}
catch (IOException e) {
e.printStackTrace();
}
}
}
Message ms = new Message();
strToCharArray(ppo.self, ms.msg);
ms.type=10;
try{
this.out.writeObject(ms);
}catch(IOException e){
e.printStackTrace();
}
//Message ms = new Message();
player.type=10;
for(int i=0 ;i<Server.playerList.size();i++){
pp = (Player)Server.playerList.get(i);
if(this.equals(pp.selfSocket)!=true){
try{
pp.selfSocket.out.writeObject(player);
}catch(IOException e){
e.printStackTrace();
}
}
}
}
/**
* add the new player to server playerList
* @param player
*/
public void addPlayer(Message player){
int i=0;
Player pp=null,tp=null;
for(i=0;i<Server.playerList.size();i++){
pp=(Player)Server.playerList.get(i);
if(this.equals(pp.selfSocket)==true){
//System.out.println("match socket ok and send to itself...");
pp.self = new String(player.msg);
try{
for (int j = 0; j < Server.playerList.size(); j++) {
Message temp = new Message();
tp = (Player) Server.playerList.get(j);
if (tp.self != null) {
strToCharArray(tp.self, temp.msg);
//temp.coordinateX=(byte)j;
temp.type = 10; //reply for type==1
//System.out.println("host "+pp.self+" add list to client name = "+temp.coordinateX+temp.msg[0]);
pp.selfSocket.out.writeObject(temp);
}
}
// out.writeObject(player);
}catch(IOException e){
e.printStackTrace();
}
break;
}
}/*
System.out.print("welcome ");
int k=0;
while(true){
if(player.msg[k]!='\0')
System.out.print(player.msg[k++]);
else break;
}
System.out.println();*/
//System.out.println(" at "+pp.selfSocket.socket.toString());
}
public Socket getSocket(){
return socket;
}
/**
* check whether msg sender is win
* type=6 msg = winner 's name
* @param msg
*/
public void checkVictory(Message msg){
}
/**
* type = 2 ,(msg.coordinateX,msg.coordinateY).msg.color
* @param msg
*/
public void putChessman(Message msg){
Group gg = new Group();
ServeOneClient soc=null;
String tName=null;
int color=0;
// modify server board
for(int i=0;i<Server.groupList.size();i++){
gg = (Group)Server.groupList.get(i);
if(this.equals(gg.selfSocket)==true){
soc = gg.playerSocket;
tName = new String(gg.player);
color = gg.selfColor;
break;
}
if(this.equals(gg.playerSocket)==true){
soc = gg.selfSocket;
tName = new String(gg.self);
color = gg.playerColor;
break;
}
}
gg.board[msg.coordinateX][msg.coordinateY]=color;
// whether someone win the game
if(judge(gg,msg.coordinateX,msg.coordinateY)==true){// a man win
// tell the two and remove them form the group list
try{
msg.type=6; // win the game
this.out.writeObject(msg);// tell this ,he win the game
msg.type=17; // failed in the game
soc.out.writeObject(msg); // tell soc ,he failed
// System.out.println("send failed to "+tName);
}catch(IOException e){
e.printStackTrace();
}
Server.groupList.remove(gg); // remove from list
return;
}
// send msg to another player
try{
//System.out.println("server put chess man "+msg.coordinateX+","+msg.coordinateY);
soc.out.writeObject(msg);
}catch(IOException e){
e.printStackTrace();
}
}
/**
* judge if a man win the game
* @param gg a group for judge
* @param x the newest kid's x coordinate
* @param y the newest kid's y coordinate
* @return
*/
private boolean judge(Group gg,int x,int y){
int i = 0, j = 0, count = 0;
int color=gg.board[x][y];
// x direction
for (i = 0, count = 0; x - i >= 0 && i < 5; i++) {
if (color == gg.board[x - i][y]) {
count++;
}
else {
break;
}
// System.out.println("( "+x+" , "+y+" )"+"count = "+count);
if (count == 5)
return true;
}
for (i = 1; x + i < 15 && i < 5; i++) {
if (color == gg.board[x + i][y]) {
count++;
}
else {
break;
}
if (count == 5)
return true;
}
// y direction
for (i = 0, count = 0; y - i >= 0 && i < 5; i++) {
if (color == gg.board[x][y - i]) {
count++;
}
else {
break;
}
// System.out.println("( "+x+" , "+y+" )"+"count = "+count);
if (count == 5)
return true;
}
for (i = 1; y + i < 15 && i < 5; i++) {
if (color == gg.board[x][y + i]) {
count++;
}
else {
break;
}
// System.out.println("( "+x+" , "+y+" )"+"count = "+count);
if (count == 5)
return true;
}
// '\' direction
for (i = 0, count = 0; x - i >= 0 && y - i >= 0 && i < 5; i++) {
if (color == gg.board[x - i][y - i]) {
count++;
}
else {
break;
}
// System.out.println("( "+x+" , "+y+" )"+"count = "+count);
if (count == 5)
return true;
}
for (i = 1; x + i < 15 && y + i < 15 && i < 5; i++) {
if (color == gg.board[x + i][y + i]) {
count++;
}
else {
break;
}
// System.out.println("( "+x+" , "+y+" )"+"count = "+count);
if (count == 5) {
return true;
}
}
// '/' direction
for (i = 0, count = 0; x + i < 15 && y - i >= 0 && i < 5; i++) {
if (color == gg.board[x + i][y - i]) {
count++;
}
else {
count = 0;
}
// System.out.println("( "+x+" , "+y+" )"+"count = "+count);
if (count == 5)
return true;
}
for (i = 1; x - i >= 0 && y + i < 15 && i < 5; i++) {
if (color == gg.board[x - i][y + i]) {
count++;
}
else {
break;
}
// System.out.println("( "+x+" , "+y+" )"+"count = "+count);
if (count == 5) {
return true;
}
}
return false;
}
/**
* judge if a man win the game
* @param gg a group for judge
* @param x the newest kid's x coordinate
* @param y the newest kid's y coordinate
* @return
*/
/* private boolean judge(Group gg,int x,int y){
int borderX=0,borderY=0,counter=0,i=0;
int color=gg.board[x][y];
if(x-4<0) borderX=0;
else borderX=x-4;
if(y-4<0) borderY=0;
else borderY=y-4;
// x direction
while(borderX+i<x+5 && borderX+i<15){
if(color==gg.board[borderX+i][y]){
counter++;
}else{
counter=0;
}
i++;
if(counter==5){
// System.out.println("color "+color+gg.board[borderX+i][y]+"return form x "+(borderX+i)+","+y+"x,y"+x+","+y);
return true;
}
}
// y direction
i=0;counter=0;
while(borderY+i<y+5 && borderY+i<15){
if(color==gg.board[x][borderY+i]){
counter++;
}else{
counter=0;
}
i++;
if(counter==5){
// System.out.println("color "+color+gg.board[x][borderY+i]+"return form y "+x+","+(borderY+i)+","+y+"x,y"+x+","+y);
return true;
}
}
// '\' direction
if(borderX>borderY)
borderX = x-(y-borderY);
else
borderY = y-(x-borderX);
i=0;counter=0;
while(borderX+i<x+5 && borderY+i<y+5 && borderY+i<15&&borderX+i<15){
if(color==gg.board[borderX+i][borderY+i]){
// System.out.println("coordinate \\ "+(borderX+i)+","+(borderY+i)+","+y+"x,y"+x+","+y);
counter++;
}else{
counter=0;
}
i++;
if(counter==5){
// System.out.println("return form \\ "+(borderX+i)+","+(borderY+i)+","+y+"x,y"+x+","+y);
return true;
}
}
// '/' direction
if(x+4>=15){
borderX = 14;
}
else{
borderX = x+4;
}
if(borderX-x<y-borderY){
borderY = y - (borderX - x);
}
else{
borderX = x + (y - borderY);
}
i=0;counter=0;
while(borderX-i>x-5 && borderY+i<y+5 && borderX-i>=0 && borderY+i<15){
if(color==gg.board[borderX-i][borderY+i]){
counter++;
}else{
counter=0;
}
i++;
if(counter==5){
// System.out.println("color "+color+gg.board[borderX-i][borderY+i]+"return form '/' "+(borderX-i)+","+(borderY+i)+","+y+"x,y"+x+","+y);
return true;
}
}
return false;
}
*/
} ///:-)
| [
"zyh1131002466@qq.com"
] | zyh1131002466@qq.com |
2ba50d86dcb421478092fb225d0bcf0485195cd9 | 46d6c2e849edeaa7010240197307bdd80bdc24bd | /src/com/ccmdevel/sbisolver/model/CalculationTree.java | 076c730308efabe8e7c28cf0563d7af33d6cc9b7 | [] | no_license | CCMDevel/SmartBigIntegerSolver | 1c2d2d746f5f7d4a431d122aedd4cf061df0d0ad | 22216740dbbd34c7923ed1287c5cb08eefd66474 | refs/heads/master | 2021-01-19T14:56:54.535563 | 2014-09-30T00:44:31 | 2014-09-30T00:44:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,241 | java | package com.ccmdevel.sbisolver.model;
import java.math.BigInteger;
import com.ccmdevel.sbisolver.model.SBISExceptions.ExceptionDivideZero;
import com.ccmdevel.sbisolver.model.SBISExceptions.ExceptionExponentNegative;
import com.ccmdevel.sbisolver.model.SBISExceptions.ExceptionModuloZero;
public class CalculationTree {
Node root;
public CalculationTree(){
this.root = null;
}
public BigInteger solve() throws ExceptionExponentNegative, ExceptionModuloZero, ExceptionDivideZero {
if (root != null){
return getNodeAnswer(root);
} else {
return new BigInteger("0");
}
}
private BigInteger getNodeAnswer(Node n) throws ExceptionExponentNegative, ExceptionModuloZero, ExceptionDivideZero {
if (n instanceof OperandNode){
return ((OperandNode)n).operand;
} else {
BigInteger left = getNodeAnswer(n.left);
BigInteger right = getNodeAnswer(n.right);
switch (((OperationNode)n).operation){
case (OpCode.ADD):
left = left.add(right);
break;
case (OpCode.SUB):
left = left.subtract(right);
break;
case (OpCode.MULTIPLY):
left = left.multiply(right);
break;
case (OpCode.DIVIDE):
SBISExceptions.checkDivideZero(right);
left = left.divide(right);
break;
case (OpCode.EXP):
SBISExceptions.checkExponent(left, right);
left = left.pow(right.intValue());
break;
case (OpCode.MOD):
SBISExceptions.checkModuloZero(right);
left = left.mod(right.abs());
}
return left;
}
}
/*
public void printTree(){
int treeHeight = this.getTreeHeight();
System.out.println();
for (int i = 0; i < treeHeight; i += 1){
System.out.print(i + ": \t");
printTreeSubLevel(this.root, 0, i);
System.out.print('\n');
}
System.out.println();
} */
public void printTreeSubLevel(Node currentNode, int currentDepth, int stopDepth){
if (currentDepth == stopDepth){
if (currentNode == null){
System.out.print("[] ");
} else {
System.out.print(currentNode.toString() + " ");
}
} else {
if (currentNode == null){
return;
}
printTreeSubLevel(currentNode.left, currentDepth + 1, stopDepth);
printTreeSubLevel(currentNode.right, currentDepth + 1, stopDepth);
}
}
public int getTreeHeight(){
if (this.root == null){
return 0;
} else {
int heightRight = getBranchHeight(root.left, 1);
int heightLeft = getBranchHeight(root.right, 1);
return heightLeft > heightRight ? heightLeft : heightRight;
}
}
public int getBranchHeight(Node node, int depth){
if (node == null){
return depth;
}
int heightLeft = getBranchHeight(node.left, depth + 1);
int heightRight = getBranchHeight(node.right, depth + 1);
return heightLeft > heightRight ? heightLeft : heightRight;
}
public void insert(Node newNode){
if (this.root == null){
this.root = newNode;
return;
}
if (newNode instanceof OperationNode){
Node p = findOpPos((OperationNode)newNode, this.root);
if (p instanceof OperandNode){
if (p == this.root){
this.root = newNode;
}
newNode.left = p;
newNode.parent = p.parent;
if (p.parent != null) {
p.parent.right = newNode;
}
p.parent = newNode;
} else {
if (p == this.root){
this.root = newNode;
}
newNode.left = p;
newNode.parent = p.parent;
if (newNode.parent != null){
newNode.parent.right = newNode;
}
p.parent = newNode;
}
} else {
Node p = findLeafPos((OperandNode)newNode, this.root);
if (p.left == null){
p.left = newNode;
} else {
p.right = newNode;
}
newNode.parent = p;
}
}
public static Node findOpPos(OperationNode newNode, Node pos){
if (pos instanceof OperandNode){
return pos;
}
int comparison = newNode.compare((OperationNode)pos);
if (comparison > 0){
return findOpPos(newNode, pos.right);
} else {
return pos;
}
}
public static Node findLeafPos(OperandNode newNode, Node pos){
if (pos.left == null){
return pos;
} else if (pos.right == null){
return pos;
} else {
return findLeafPos(newNode, pos.right);
}
}
}
| [
"chris.j.mcgrath@gmail.com"
] | chris.j.mcgrath@gmail.com |
7a16bbfdd5af283aaf9f5da65f9c86a196256232 | e26f54e0e1ddd2edc081af3dfcc534b7e03fdc29 | /week-08/day-5/presentation-examples/src/Example.java | 70d130f5e1568f7dc5da17c5357e1200071ca294 | [] | no_license | green-fox-academy/RBKoronczi | c7456bd3ad83cb6b18be112fefe7eeb36429fd8f | b7fec112d9bf43796f8f96290eed751a97bacff4 | refs/heads/master | 2020-04-02T22:20:14.940470 | 2019-01-31T14:37:37 | 2019-01-31T14:37:37 | 154,830,129 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,527 | java | import java.util.ArrayList;
import java.util.DoubleSummaryStatistics;
import java.util.List;
import java.util.stream.Collectors;
public class Example {
List<ExampleObject> objectList;
public static void main(String[] args) {
Example example = new Example();
System.out.println(example.getObjectList());
System.out.println();
System.out.println(example.Filter());
System.out.println();
System.out.println(example.Distinct());
System.out.println();
System.out.println(example.SortWithComparable());
System.out.println();
System.out.println(example.Map());
System.out.println();
System.out.println(example.Statistics());
System.out.println();
System.out.println(example.Chain());
}
public List<ExampleObject> getObjectList() {
return objectList;
}
public Example() {
objectList = new ArrayList<>();
ExampleObject Béla = new ExampleObject("Béla", 4);
objectList.add(new ExampleObject("Józsi", 1));
objectList.add(new ExampleObject("Whatever", 0));
objectList.add(Béla);
objectList.add(new ExampleObject("GreenFox", 1));
objectList.add(new ExampleObject("Beer", 1));
objectList.add(Béla);
objectList.add(new ExampleObject("Béla", 5));
}
List Filter() {
return
this.objectList.stream()
.filter(exampleObject -> exampleObject.getQty() > 2)
.collect(Collectors.toList());
}
List Distinct() {
return
this.objectList.stream()
.distinct()
.collect(Collectors.toList());
}
List SortWithComparable() {
return
this.objectList.stream()
.sorted(ExampleObject::compareTo)
.collect(Collectors.toList());
}
List Map() {
return
this.objectList.stream()
.map(exampleObject -> exampleObject.getName())
.collect(Collectors.toList());
}
String Statistics() {
DoubleSummaryStatistics stat =
this.objectList.stream()
.mapToDouble(exampleObject -> exampleObject.getQty())
.summaryStatistics();
stat.getAverage();
stat.getCount();
stat.getMax();
stat.getMin();
stat.getSum();
stat.toString();
return stat.toString();
}
List Chain() {
return
this.objectList.stream()
.map(exampleObject -> exampleObject.getName())
.distinct()
.sorted(String::compareTo)
.filter(name -> name.equals("Béla"))
.collect(Collectors.toList());
}
}
| [
"rbkoronczi@gmail.com"
] | rbkoronczi@gmail.com |
829bd049c854d22a0f6b01b0e65425dc40e89508 | 4fd0f481356d46751b8ddc6ff13897d388ed259d | /com.oxygenxml.pdf.css/src/test/java/com/oxygenxml/pdf/css/BasicXSLTestCase.java | 0af00cda6da7f1f521608b2c5b2b87bcbc4d0a76 | [
"Apache-2.0"
] | permissive | paperdigits/dita-ot-css-pdf | 636a1c4c090d8c9cae13fb0095f3e8250ce1855e | 09eb49bc3cba81c629221c19e73d3a04dbed7ed5 | refs/heads/master | 2020-07-04T08:55:50.098985 | 2019-07-05T12:40:40 | 2019-07-05T12:40:40 | 202,230,900 | 1 | 0 | Apache-2.0 | 2019-08-13T22:12:59 | 2019-08-13T22:12:58 | null | UTF-8 | Java | false | false | 12,550 | java | package com.oxygenxml.pdf.css;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Properties;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.TransformerFactoryConfigurationError;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.apache.log4j.Logger;
import org.apache.xml.resolver.CatalogManager;
import org.apache.xml.resolver.tools.CatalogResolver;
import junit.framework.TestCase;
import ro.sync.basic.io.IOUtil;
import ro.sync.basic.prettyprint.SimplePrettyPrinter;
import ro.sync.basic.prettyprint.SimplePrettyPrinterException;
/**
* Tests the /eXml/frameworks/dita/DITA-OT/plugins/com.oxygenxml.pdf.prince/post-process.xsl stylesheet.
*
* @author dan
*
*/
public abstract class BasicXSLTestCase extends TestCase {
/**
* Constructor.
*
* @param name
* @throws TransformerFactoryConfigurationError
* @throws TransformerConfigurationException
*/
public BasicXSLTestCase(String name) throws TransformerConfigurationException, TransformerFactoryConfigurationError {
super(name);
}
/**
* Logger for logging.
*/
private static final Logger logger = Logger.getLogger(BasicXSLTestCase.class
.getName());
/**
* Infer some parameters from it. Used to create absolute paths to the images.
*/
private File mapFile = new File("test/dita/samples/flowers/flowers.ditamap");
/**
* The test directory, contains pairs of in/out files.
*/
protected File dir;
/**
* Use this to update the out files.
*/
protected boolean doNotFailUpdateTests = false;
/**
* Runs the test by loading the test class into the Oxygen
* LateDelegationClassloader.
*
* @param testMethod The name of the method to be run.
* @param additionalCLUrl Additional URLs to be loaded by class loader.
* @throws Exception when it fails.
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
protected void runTestInURLClassLoader(String testMethod, URL[] urls) throws Exception{
if(logger.isDebugEnabled()){
logger.debug("Running in oXygen class loader method: " + testMethod);
}
Thread cThread = Thread.currentThread();
// Get system properties to be restored
Properties systemProp = System.getProperties();
Properties toRestore = new Properties();
for (Iterator iter = systemProp.keySet().iterator(); iter.hasNext();) {
Object key = iter.next();
toRestore.put(key, systemProp.get(key));
}
// Use SAXParserFactory from Xerces
System.setProperty(
"javax.xml.parsers.SAXParserFactory",
"org.apache.xerces.jaxp.SAXParserFactoryImpl");
ClassLoader oldCL = cThread.getContextClassLoader();
if(logger.isDebugEnabled()){
logger.debug("The old class loader: " + oldCL);
}
// Optimization. Avoid loading the same jars in multiple class loaders.
// Was: ClassLoader classLoader = new LateDelegationClassLoader(urls);
ClassLoader classLoader = new URLClassLoader(urls,
this.getClass().getClassLoader());
if(logger.isDebugEnabled()){
logger.debug("Using the classloader " + classLoader);
}
cThread.setContextClassLoader(classLoader);
try {
Class cl = classLoader.loadClass(this.getClass().getName());
Object obj = cl.getConstructor(new Class[]{String.class}).newInstance(new Object[]{"test"});
// Run setUp
Method m = cl.getMethod("setUp", new Class[]{});
m.invoke(obj, new Object[]{});
try{
// The test
m = cl.getMethod(testMethod, new Class[]{});
m.invoke(obj, new Object[]{});
}catch(InvocationTargetException ex){
Throwable cause = ex.getCause();
if(cause instanceof Exception){
throw (Exception) cause;
} else if(cause instanceof Error){
throw (Error) cause;
} else {
throw ex;
}
}finally{
// End.
m = cl.getMethod("tearDown", new Class[]{});
m.invoke(obj, new Object[]{});
}
} finally {
cThread.setContextClassLoader(oldCL);
// Restore system properties
System.setProperties(toRestore);
}
}
/**
* The main stylesheet to be applied over the input.
*/
protected File style;
/**
* The second stylesheet to be applied.
*/
protected File style2;
/**
* The real test. It is run in the Oxygen class loader, because we use saxon:parse extension function, and
* this requires the Saxon EE, (or a version less than 9 as is used from DITA-OT) .
*
* @throws Exception
*/
public void tProcessing() throws Exception {
TransformerFactory transformerFactory = TransformerFactory.newInstance("net.sf.saxon.TransformerFactoryImpl", getClass().getClassLoader());
transformerFactory.setURIResolver(getDitaCatalogResolver());
String[] list = dir.list(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.endsWith(".in.xml");
}
});
for (String path : list) {
File inputFile = new File(dir, path).getAbsoluteFile();
File expectFile = new File(inputFile.getAbsolutePath().replace(".in.xml", ".out.xml"));
File ppDisableFile = new File(inputFile.getAbsolutePath().replace(".in.xml", ".out.no.pp"));
logger.info("------------------------" );
logger.info("Asserting " + path);
logger.info("Input " + inputFile);
logger.info("Expected " + expectFile);
// Stage 1.
Transformer transformer = transformerFactory.newTransformer(new StreamSource(style));
setUpParameters(transformer, inputFile, mapFile);
String string = IOUtil.readFile(inputFile, "UTF-8");
string = string.replace("MAP_FILE_DIR", mapFile.getParentFile().getAbsolutePath());
Reader reader = new StringReader(string);
Source xmlSource = new StreamSource(reader);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
StreamResult outputTarget = new StreamResult(bos);
transformer.transform(xmlSource, outputTarget);
bos.close();
String intermediate = new String(bos.toByteArray(), "UTF-8");
// Stage 2: Structuring the oxy:oxy-comment as a discussion thread.
if (style2 != null) {
System.out.println(intermediate);
Transformer transformer2 = transformerFactory.newTransformer(new StreamSource(style2));
xmlSource = new StreamSource(new ByteArrayInputStream(bos.toByteArray()));
bos = new ByteArrayOutputStream();
outputTarget = new StreamResult(bos);
transformer2.transform(xmlSource, outputTarget);
}
String expected = filter(IOUtil.readFile(expectFile, "UTF-8"), path, true, ppDisableFile.exists());
String obtained = filter(new String(bos.toByteArray(), "UTF-8"), path, false, ppDisableFile.exists());
obtained = remapIDs(obtained);
if (doNotFailUpdateTests) {
FileOutputStream fos = new FileOutputStream(expectFile);
fos.write(obtained.getBytes("UTF-8"));
fos.close();
}
if (!doNotFailUpdateTests && !expected.equals(obtained)){
// Dump the obtained.
logger.info("Obtained \n" + obtained);
logger.info("Intermediate was \n" + intermediate);
assertEquals("The stylesheet changed behaviour. Failed in " + inputFile.getName(), expected, obtained);
}
logger.info("Ok.");
logger.info("------------------------" );
}
}
/**
* Gets the DITA catalog resolver.
*
* @return The catalog resolver.
* @throws MalformedURLException
* @throws IOException
*/
protected CatalogResolver getDitaCatalogResolver() throws MalformedURLException, IOException {
CatalogManager.getStaticManager().setIgnoreMissingProperties(true);
CatalogResolver catalogResolver = new CatalogResolver(true);
// This is good when the plugin is checked-out from plugins dir of a full DITA-OT
File relativeCatalog = new File ("../../catalog-dita.xml");
URL catalogUrl = relativeCatalog.getCanonicalFile().toURI().toURL();
catalogResolver.getCatalog().parseCatalog(catalogUrl);
File publishingTemplateCatalog = new File ("xsl/template_catalog.xml");
URL publishingTemplateCatalogUrl = publishingTemplateCatalog.getCanonicalFile().toURI().toURL();
catalogResolver.getCatalog().parseCatalog(publishingTemplateCatalogUrl);
return catalogResolver;
}
/**
* Map the random XSLT generated IDs to foreseeable sequential numbers.
* We need to decouple them because the Linux and Windows XSLT transformation generate different IDs,
* and we need to have fix values in the assertion "expected" values.
*
* @param obtained The content of the merged document, as it comes processed by the plugin.
*
* @return The content, with changed IDs.
*/
private String remapIDs(String obtained) {
// Identify all the unique IDs from the XML source
LinkedHashMap<String, Integer> ids = new LinkedHashMap<String, Integer>();
Pattern idPattern = Pattern.compile("[\"|#|\\[]d([A-Fa-f0-9]*?)[\"|\\]]");
int cnt = 0;
Matcher matcher = idPattern.matcher(obtained);
while(matcher.find()) {
String idInSource = matcher.group(1);
if (!ids.containsKey(idInSource)) {
// An unknown ID, let's assign it a sequence number.
cnt ++;
ids.put(idInSource, cnt);
}
}
// Now replace all the IDs by the sequence number.
Set<String> keySet = ids.keySet();
for (String key : keySet) {
obtained = obtained.replace("d" + key, "remapped_id_" + ids.get(key));
}
return obtained;
}
/**
* Gives a chance of setting parameters to the transformer. You can
* use this to also set different parameters depending on the input file.
*
* @param transformer The trasformer to set up parameters on.
* @param inputFile The input file of the XSLT tranformation.
* @param mapFile The main map file.
* @throws MalformedURLException Should not happen.
*/
protected void setUpParameters(Transformer transformer, File inputFile, File mapFile) throws MalformedURLException {
transformer.setParameter("html5.links.content", "x");
}
/**
* Filters some whitespaces, so the asserts are more reliable.
* @param in The string to be filtered.
* @param isExpectedString <code>true</code> if the <code>in</code> parameter
* is the expected string. Otherwise, is a XSLT result and further processing
* can be performed, in order to change variable parts to fixed (generated IDs,
* paths, etc..) that otherwise could not be asserted.
* @param disablePrettyPrint <code>true</code> if the PP should be disabled.
* @return
* @throws Exception
* @throws PrettyPrintException
*/
private String filter(String in, String path, boolean isExpectedString, boolean disablePrettyPrint) throws Exception {
if (!isExpectedString){
if ("images.in.xml".equals(path)){
in = in.replaceAll("file\\:/(.*?)/" + mapFile.getParentFile().getName(), "MAP_DIR_URI");
}
}
String out;
in = in.replace("\r", "");
if (disablePrettyPrint) {
out = in;
} else {
try {
out = SimplePrettyPrinter.prettyPrint(in).replaceAll("\r", "").trim();
} catch (SimplePrettyPrinterException ex) {
logger.error("Cannot PP content: \n" + in);
throw ex;
}
}
return out;
}
@Override
public void setUp() throws Exception {
super.setUp();
}
@Override
public void tearDown() throws Exception {
super.tearDown();
}
}
| [
"dan@sync.ro"
] | dan@sync.ro |
cbef3484c7ec3221267f8ac82076ba07855a4e2d | 9b8beb762d4ba3f9a902c649ee5e9ea7b097097b | /src/java/main/com/conferma/cpapi/FilterOption.java | cda68e522ba3f160449748e427460c29a42c81f4 | [] | no_license | assertis/conferma-connector | 14f5b2dfcef83931b16ebf6e35e01e084658e49c | 90de591171be1841c021e1764131c0ad1fff675c | refs/heads/master | 2020-04-10T16:55:19.753578 | 2017-07-11T09:32:00 | 2017-07-11T09:32:00 | 3,386,971 | 0 | 0 | null | 2017-06-29T10:15:03 | 2012-02-08T12:25:07 | Java | UTF-8 | Java | false | false | 10,101 | java | /*
* XML Type: FilterOption
* Namespace: http://cpapi.conferma.com/
* Java type: com.conferma.cpapi.FilterOption
*
* Automatically generated - do not modify.
*/
package com.conferma.cpapi;
/**
* An XML FilterOption(@http://cpapi.conferma.com/).
*
* This is an atomic type that is a restriction of com.conferma.cpapi.FilterOption.
*/
public interface FilterOption extends org.apache.xmlbeans.XmlString
{
public static final org.apache.xmlbeans.SchemaType type = (org.apache.xmlbeans.SchemaType)
org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(FilterOption.class.getClassLoader(), "schemaorg_apache_xmlbeans.system.s4840EABFCCE2902204A6F8C9414298CB").resolveHandle("filteroption9d6etype");
org.apache.xmlbeans.StringEnumAbstractBase enumValue();
void set(org.apache.xmlbeans.StringEnumAbstractBase e);
static final Enum EXCLUDE = Enum.forString("Exclude");
static final Enum INCLUDE = Enum.forString("Include");
static final Enum ONLY = Enum.forString("Only");
static final int INT_EXCLUDE = Enum.INT_EXCLUDE;
static final int INT_INCLUDE = Enum.INT_INCLUDE;
static final int INT_ONLY = Enum.INT_ONLY;
/**
* Enumeration value class for com.conferma.cpapi.FilterOption.
* These enum values can be used as follows:
* <pre>
* enum.toString(); // returns the string value of the enum
* enum.intValue(); // returns an int value, useful for switches
* // e.g., case Enum.INT_EXCLUDE
* Enum.forString(s); // returns the enum value for a string
* Enum.forInt(i); // returns the enum value for an int
* </pre>
* Enumeration objects are immutable singleton objects that
* can be compared using == object equality. They have no
* public constructor. See the constants defined within this
* class for all the valid values.
*/
static final class Enum extends org.apache.xmlbeans.StringEnumAbstractBase
{
/**
* Returns the enum value for a string, or null if none.
*/
public static Enum forString(java.lang.String s)
{ return (Enum)table.forString(s); }
/**
* Returns the enum value corresponding to an int, or null if none.
*/
public static Enum forInt(int i)
{ return (Enum)table.forInt(i); }
private Enum(java.lang.String s, int i)
{ super(s, i); }
static final int INT_EXCLUDE = 1;
static final int INT_INCLUDE = 2;
static final int INT_ONLY = 3;
public static final org.apache.xmlbeans.StringEnumAbstractBase.Table table =
new org.apache.xmlbeans.StringEnumAbstractBase.Table
(
new Enum[]
{
new Enum("Exclude", INT_EXCLUDE),
new Enum("Include", INT_INCLUDE),
new Enum("Only", INT_ONLY),
}
);
private static final long serialVersionUID = 1L;
private java.lang.Object readResolve() { return forInt(intValue()); }
}
/**
* A factory class with static methods for creating instances
* of this type.
*/
public static final class Factory
{
public static com.conferma.cpapi.FilterOption newValue(java.lang.Object obj) {
return (com.conferma.cpapi.FilterOption) type.newValue( obj ); }
public static com.conferma.cpapi.FilterOption newInstance() {
return (com.conferma.cpapi.FilterOption) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, null ); }
public static com.conferma.cpapi.FilterOption newInstance(org.apache.xmlbeans.XmlOptions options) {
return (com.conferma.cpapi.FilterOption) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, options ); }
/** @param xmlAsString the string value to parse */
public static com.conferma.cpapi.FilterOption parse(java.lang.String xmlAsString) throws org.apache.xmlbeans.XmlException {
return (com.conferma.cpapi.FilterOption) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, null ); }
public static com.conferma.cpapi.FilterOption parse(java.lang.String xmlAsString, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (com.conferma.cpapi.FilterOption) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, options ); }
/** @param file the file from which to load an xml document */
public static com.conferma.cpapi.FilterOption parse(java.io.File file) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (com.conferma.cpapi.FilterOption) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, null ); }
public static com.conferma.cpapi.FilterOption parse(java.io.File file, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (com.conferma.cpapi.FilterOption) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, options ); }
public static com.conferma.cpapi.FilterOption parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (com.conferma.cpapi.FilterOption) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, null ); }
public static com.conferma.cpapi.FilterOption parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (com.conferma.cpapi.FilterOption) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, options ); }
public static com.conferma.cpapi.FilterOption parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (com.conferma.cpapi.FilterOption) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, null ); }
public static com.conferma.cpapi.FilterOption parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (com.conferma.cpapi.FilterOption) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, options ); }
public static com.conferma.cpapi.FilterOption parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (com.conferma.cpapi.FilterOption) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, null ); }
public static com.conferma.cpapi.FilterOption parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (com.conferma.cpapi.FilterOption) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, options ); }
public static com.conferma.cpapi.FilterOption parse(javax.xml.stream.XMLStreamReader sr) throws org.apache.xmlbeans.XmlException {
return (com.conferma.cpapi.FilterOption) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, null ); }
public static com.conferma.cpapi.FilterOption parse(javax.xml.stream.XMLStreamReader sr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (com.conferma.cpapi.FilterOption) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, options ); }
public static com.conferma.cpapi.FilterOption parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
return (com.conferma.cpapi.FilterOption) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, null ); }
public static com.conferma.cpapi.FilterOption parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (com.conferma.cpapi.FilterOption) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, options ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static com.conferma.cpapi.FilterOption parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return (com.conferma.cpapi.FilterOption) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static com.conferma.cpapi.FilterOption parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return (com.conferma.cpapi.FilterOption) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
private Factory() { } // No instance of this class allowed
}
}
| [
"dan@rectangularsoftware.com"
] | dan@rectangularsoftware.com |
e273b66cb2b4836a0a0b9638315c254a933eb650 | 16cdf841a6de7361db4f5d86a22a98b887621d7a | /Projet2/src/main/java/com/ensta/librarymanager/dao/MembreDaoImpl.java | 597c65d11f05759117951744ad308f1c9b03fd35 | [] | no_license | pires-sobreira/Projet_pires-sobreira_gabriel | 626061195f45b5144ac21d3c8b653b2f7d8a3dd9 | 175b89f5d2f0eedf81e7f824dedbbfe025fa7f6d | refs/heads/main | 2023-03-27T15:15:51.774043 | 2021-04-02T21:20:23 | 2021-04-02T21:20:23 | 345,933,187 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,742 | java | package com.ensta.librarymanager.dao;
import java.util.List;
import java.util.ArrayList;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import com.ensta.librarymanager.exception.DaoException;
import com.ensta.librarymanager.model.Membre;
import com.ensta.librarymanager.model.Abonnement;
import com.ensta.librarymanager.persistence.ConnectionManager;
public class MembreDaoImpl {
//Singleton
private static MembreDaoImpl instance;
private MembreDaoImpl(){};
public static MembreDaoImpl getInstance(){
if (instance == null) instance = new MembreDaoImpl();
return instance;
}
private final String SelectAllMembreQuery = "SELECT id, nom, prenom, adresse, email, telephone, abonnement FROM membre ORDER BY nom, prenom;";
private final String SelectIDMembreQuery = "SELECT id, nom, prenom, adresse, email, telephone, abonnement FROM membre WHERE id=?;";
private final String CreateMembreQuery = "INSERT INTO membre(nom, prenom, adresse, email, telephone, abonnement) VALUES (?, ?, ?, ?, ?, ?);";
private final String UpdateMembreQuery = "UPDATE membre SET nom=?, prenom=?, adresse=?, email=?, telephone=?, abonnement=? WHERE id=?;";
private final String DeleteMembreQuery = "DELETE FROM membre WHERE id=?;";
private final String CounterMembreQuery = "SELECT COUNT(id) AS count FROM membre;";
public List<Membre> getList() throws DaoException{
List<Membre> membre = new ArrayList<Membre>();
try(Connection connection = ConnectionManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement(SelectAllMembreQuery);
ResultSet result = preparedStatement.executeQuery();) {
while (result.next()){
membre.add(new Membre(result.getInt("id"), result.getString("nom"), result.getString("prenom"), result.getString("email"), result.getString("telephone"), result.getString("adresse"), Abonnement.valueOf(result.getString("abonnement"))));
}
}catch (SQLException e) {
throw new DaoException("Erreur lors du téléchargement de la liste des membres de la base de données", e);
}
return membre;
}
public ResultSet GetByIdStatement(PreparedStatement preparedStatement, int id) throws SQLException {
preparedStatement.setInt(1, id);
return preparedStatement.executeQuery();
}
public Membre getById(int id) throws DaoException{
Membre membre = new Membre();
try (Connection connection = ConnectionManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement(SelectIDMembreQuery);
ResultSet result = GetByIdStatement(preparedStatement, id);){
if (result.next()) {
membre = new Membre(result.getInt("id"), result.getString("nom"), result.getString("prenom"), result.getString("email"), result.getString("telephone"), result.getString("adresse"), Abonnement.valueOf(result.getString("abonnement")));
}
} catch (SQLException e) {
throw new DaoException("Error while uploading a membre whose id is " + id, e);
}
return membre;
}
public ResultSet CreateStatement(PreparedStatement preparedStatement, String nom, String prenom, String adresse, String email, String telephone, Abonnement abonnement) throws SQLException {
preparedStatement.setString(1, nom);
preparedStatement.setString(2, prenom);
preparedStatement.setString(3, adresse);
preparedStatement.setString(4, email);
preparedStatement.setString(5, telephone);
preparedStatement.setString(6, abonnement.toString());
preparedStatement.executeUpdate();
return preparedStatement.getGeneratedKeys();
}
public int create(String nom, String prenom, String adresse, String email, String telephone, Abonnement abonnement) throws DaoException{
int id = -1;
try (Connection connection = ConnectionManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement(CreateMembreQuery, Statement.RETURN_GENERATED_KEYS);
ResultSet result = CreateStatement(preparedStatement, nom, prenom, adresse, email, telephone, abonnement);) {
if (result.next()) {
id = result.getInt(1);
}
} catch (SQLException e) {
throw new DaoException("Erreur. Impossible de créer le membre " + nom, e);
}
return id;
}
public void update(Membre membre_) throws DaoException{
try (Connection connection = ConnectionManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement(UpdateMembreQuery);) {
preparedStatement.setString(1, membre_.getNom());
preparedStatement.setString(2, membre_.getPrenom());
preparedStatement.setString(3, membre_.getAdress());
preparedStatement.setString(4, membre_.getEmail());
preparedStatement.setString(5, membre_.getTelephone());
preparedStatement.setString(6, membre_.getAbonement().toString());
preparedStatement.setInt(7, membre_.getId());
preparedStatement.executeUpdate();
} catch (SQLException e) {
throw new DaoException("Erreur lors de la mise à jour d'un membre " + membre_, e);
}
}
public void delete(int id) throws DaoException{
try (Connection connection = ConnectionManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement(DeleteMembreQuery);) {
preparedStatement.setInt(1, id);
preparedStatement.executeUpdate();
} catch (SQLException e) {
throw new DaoException("Error while deleting a Membre whose id is " + id, e);
}
}
public int count() throws DaoException{
int n = -1;
try (Connection connection = ConnectionManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement(CounterMembreQuery);
ResultSet result = preparedStatement.executeQuery();) {
if (result.next()) {
n = result.getInt(1);
}
} catch (SQLException e) {
throw new DaoException("Erreur lors du comptage du nombre de membres dans la base de données", e);
}
return n;
}
} | [
"gabriel.pires-sobreira@ensta-paris.fr"
] | gabriel.pires-sobreira@ensta-paris.fr |
c1bb102f140647ba6d4bb637242c8c6c319236fc | a7a40f9720225374043f8e15209f926626d35c0a | /src/test/java/cn/pei/logistics/test/UserServiceTest.java | 6746effb785040877c4eb9c2cff91fcfaf835059 | [] | no_license | classg/logistics_system | 0ce4ac2ae3cf86866ff12f25198c074c04abf4b5 | af77af1c1db12c2c94089a90338b05ce87526f63 | refs/heads/master | 2022-12-25T15:01:49.620074 | 2019-11-12T10:15:36 | 2019-11-12T10:15:36 | 220,967,287 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 809 | java | package cn.pei.logistics.test;
import cn.pei.logistics.pojo.User;
import cn.pei.logistics.pojo.UserExample;
import cn.pei.logistics.service.UserService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:spring.xml")
public class UserServiceTest {
@Autowired
private UserService userService;
@Test
public void testSelectByExample(){
UserExample example = new UserExample();
List<User> users = userService.selectByExample(example);
System.out.println(users);
}
}
| [
"715163756Ing?"
] | 715163756Ing? |
fd856b1fa223be63a9eb366ac4f31d730fb700e0 | f3b5eaed296a6ced5b144cff28350ec80be49694 | /src/main/java/api/rest/security/common/filter/AuthenticatedUserDetails.java | 86fe4c0c57a5932303e975ed694ea10007cae3bb | [] | no_license | tomasperezmolina/lfg | 2a87cca54dba4c438bc4092b286de8b1807aade0 | 52d142984308e1bac4e6520a27dcd9c4168d73c2 | refs/heads/master | 2021-10-28T22:31:33.584508 | 2018-07-19T12:41:01 | 2018-07-19T12:41:01 | 143,557,874 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 780 | java | package api.rest.security.common.filter;
import api.rest.security.common.domain.Authority;
import java.security.Principal;
import java.util.Collections;
import java.util.Set;
/**
* {@link Principal} implementation with a set of {@link Authority}.
*
* @author cassiomolin
*/
public final class AuthenticatedUserDetails implements Principal {
private final String username;
private final Set<Authority> authorities;
public AuthenticatedUserDetails(String username, Set<Authority> authorities) {
this.username = username;
this.authorities = Collections.unmodifiableSet(authorities);
}
public Set<Authority> getAuthorities() {
return authorities;
}
@Override
public String getName() {
return username;
}
} | [
"tomas.perezmolina@ing.austral.edu.ar"
] | tomas.perezmolina@ing.austral.edu.ar |
325f52e5c88dd808adc6053218b5a5e3b1f73e32 | e3c4a0133b3b29d40c3b743e573f642a3b05b690 | /src/model/data_structures/Lists/LinkedList.java | 31afa31081eeca8b29ec5afd2db23c6f98b25f01 | [] | no_license | albayona/Proyecto_3_al.bayona_ra.rodriguezn | b8fc3f528ebd8116f24be162310a5f117f47aea4 | 92504b43b646853edfe0018ee354b88f6cc5c68b | refs/heads/master | 2020-09-16T17:43:04.228542 | 2019-12-09T04:20:20 | 2019-12-09T04:20:20 | 223,844,472 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,034 | java | package model.data_structures.Lists;
import java.lang.reflect.Array;
import java.util.Iterator;
public class LinkedList<E> implements Iterable<E> {
//=======================================================
// Atributos
//=======================================================
private Node<E> headNode;
private Node<E> lastNode;
private int size;
//=======================================================
// Constructores
//=======================================================
//Creates an empty list
public LinkedList(){
size = 0;
headNode = null;
lastNode = null;
}
//Creates a list with one node(with element e)
public LinkedList(E e) {
headNode = new Node<E>(e);
lastNode = headNode;
}
//=======================================================
// M�todos
//=======================================================
//Retorna un iterador ue comienza en el primer nodo de la lista
public Iterator<E> iterator() {
return new IteratorList<E>(headNode);
}
//Retorna un iterador ue comienza en el ultimo nodo de la lista
public Iterator<E> iteratorLastNode(){
return new IteratorList<E>(lastNode);
}
//Adds the element at the beginning of the list
public boolean add(E e) {
boolean res = false;
if(e!=null) {
Node<E> nuevo = new Node<E>(e);
if(size == 0) {
headNode = nuevo;
lastNode = nuevo;
res=true;
}
else {
headNode.cambiarAnterior(nuevo);
nuevo.cambiarSiguiente(headNode);
headNode = nuevo;
}
size++;
}
else {
throw new NullPointerException("El elemento es nulo");
}
return res;
}
public void addAll(int index, LinkedList<E> doublyLinkedList)
{
for(Object o : doublyLinkedList)
{
this.add((E) o );
++index;
}
}
//Adds the element at the end of the list
public boolean addAtEnd(E e) {
boolean res = false;
if(e!= null) {
Node<E> nuevo = new Node<E>(e);
if(size == 0) {
headNode = nuevo;
lastNode = nuevo;
res=true;
}
else {
lastNode.cambiarSiguiente(nuevo);
nuevo.cambiarAnterior(lastNode);
lastNode = nuevo;
res=true;
}
size ++;
}
else {
throw new NullPointerException("El elemento es nulo");
}
return res;
}
//0 basado
public E getElement(int index) {
if(index < 0 || index >= size)
{
throw new IndexOutOfBoundsException("Se est� pidiendo el indice: " + index + " y el tama�o de la lista es de " + size);
}
Node<E> actual = headNode;
int posActual = 0;
while(actual != null && posActual < index)
{
actual = actual.darSiguiente();
posActual ++;
}
return actual.darElemento();
}
public Node<E> getHeadNode() {
return headNode;
}
public Node<E> getTailNode() {
return lastNode;
}
public E lastElement() {
return lastNode.darElemento();
}
public E element() {
return headNode.darElemento();
}
public int getSize() {
return size;
}
public E delete(int index) {
E eliminado = null;
Node<E> actual = (Node<E>) this.headNode;
if(index < 0 || index >= size) {
throw new IndexOutOfBoundsException("Se est� pidiendo el indice: " + index + " y el tama�o de la lista es de " + size);
}
if(index == 0) {
eliminado = headNode.darElemento();
headNode = headNode.darSiguiente();
this.size --;
}
else {
int contador = 0;
while(contador + 1 < index){
actual = (Node<E>) actual.darSiguiente();
contador++;
}
eliminado = actual.darSiguiente().darElemento();
actual.cambiarSiguiente(actual.darSiguiente().darSiguiente());
if(actual.darSiguiente() == null) {
lastNode = actual;
}
else {
Node<E> c = (Node<E>) actual.darSiguiente();
c.cambiarAnterior(actual);
}
this.size --;
}
return eliminado;
}
public E remove(Object obj) {
E eliminado = null;
Node<E> actual = (Node<E>) this.headNode;
if(obj.equals(this.getHeadNode())) {
eliminado = headNode.darElemento();
headNode = headNode.darSiguiente();
this.size --;
}
else {
Iterator<E> iter = this.iterator();
while(iter.hasNext() && eliminado == null){
actual = (Node<E>) actual.darSiguiente();
if(obj.equals(actual)) {
eliminado = (E) actual;
}
}
Node<E> anterior = (Node<E>) actual.darAnterior();
anterior.cambiarSiguiente(anterior.darSiguiente().darSiguiente());
if(anterior.darSiguiente() == null) {
lastNode = anterior;
}
else {
Node<E> c = (Node<E>) anterior.darSiguiente();
c.cambiarAnterior(anterior);
}
this.size --;
}
return eliminado;
}
public boolean contains(Object o) {
for (E e : this) {
if(o==null ? e==null : o.equals(e))
return true;
}
return false;
}
public boolean isEmpty() {
return headNode == null;
}
public E[] toArray(Class<E> type) {
@SuppressWarnings("unchecked")
E[] elementos = (E[]) Array.newInstance(type, this.size);
int i = 0;
Node<E> actual = headNode;
while(i < size) {
elementos[i] = actual.darElemento();
actual = actual.darSiguiente();
i++;
}
return elementos;
}
}
| [
"al.bayona@uniandes.edu.co"
] | al.bayona@uniandes.edu.co |
0edf965dd25fc996c7486894ebf0cd98f3641a7f | a55ddeec74066af0136c2d24536711d5f05940af | /src/GameScanners/SourceEngineQuery/SourceEngineQueryDemo.java | b86705e143b32d90f16c18870437f42d594de44b | [] | no_license | amit9oct/world-negative-one | b966e00d8dacf6c68df889c7aa5b4e0408bb5494 | 08d00b66aa477078bfcd9e63a19b978e4e14b1a1 | refs/heads/master | 2020-12-25T19:39:40.274923 | 2014-06-21T20:26:56 | 2014-06-21T20:26:56 | 16,247,274 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,821 | java | import java.io.FileWriter;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.HashMap;
public class SourceEngineQueryDemo {
private static final byte[] SERVER_REQUEST = { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x54, (byte) 0x53, (byte) 0x6F, (byte) 0x75, (byte) 0x72, (byte) 0x63, (byte) 0x65,
(byte) 0x20, (byte) 0x45, (byte) 0x6E, (byte) 0x67, (byte) 0x69, (byte) 0x6E, (byte) 0x65, (byte) 0x20, (byte) 0x51, (byte) 0x75, (byte) 0x65, (byte) 0x72, (byte) 0x79, (byte) 0x00 };
private static final String[] ROOT_IP_ADDRESSES = { "172.17.1.", "172.17.2.", "172.17.9.", "172.17.11.", "172.17.12.", "172.17.13.", "172.17.14.", "172.17.15.", "172.17.16.", "172.17.17.",
"172.17.18.", "172.17.19.", "172.17.20.", "172.17.21.", "172.17.22.", "172.17.23.", "172.17.24.", "172.17.25.", "172.17.26.", "172.17.27.", "172.17.28.", "172.17.29.", "172.17.30.",
"172.17.31.", "172.17.32.", "172.17.33.", "172.17.34.", "172.17.35.", "172.17.36.", "172.17.37." };
private static final int PORT = 27015;
private static String CS_FILE_PATH = "..\\..\\tmp\\cs_server_list.txt";
private static String CSGO_FILE_PATH = "..\\..\\tmp\\csgo_server_list.txt";
private static String DOTA_FILE_PATH = "..\\..\\tmp\\dota_server_list.txt";
private static DatagramSocket[] sockets = new DatagramSocket[255 * ROOT_IP_ADDRESSES.length];
private static ArrayList<String> excludedIPList = new ArrayList<>();
public static void main(String[] args) throws IOException, InterruptedException {
prepareSockets();
prepareExclusiveIPList();
byte[] buffer = new byte[255];
// Create Request Packet
DatagramPacket requestPacket = new DatagramPacket(buffer, 1); // Packet for Sending Request
requestPacket.setData(SERVER_REQUEST);
sendRequests(requestPacket, buffer);
Thread.sleep(20);
getResponse(buffer);
closeSockets();
}
private static void prepareExclusiveIPList() {
// EMPTY LIST
}
private static void getResponse(byte[] buffer) throws IOException {
for (int rootAddress = 0; rootAddress < ROOT_IP_ADDRESSES.length; rootAddress++) {
for (int machineAddress = 0; machineAddress <= 254; machineAddress++) {
// Create Address
int socketIndex = (rootAddress * 255) + machineAddress;
String address = ROOT_IP_ADDRESSES[rootAddress] + machineAddress;
// Check if IP is in Excluded IP List
if (excludedIPList.contains(address))
continue;
// Request Packet for Receiving Information
buffer = new byte[255];
DatagramPacket serverInfoPacket = new DatagramPacket(buffer, 255);
sockets[socketIndex].setSoTimeout(1);
// Try receiving packet. If found, Display Server Information.
try {
sockets[socketIndex].receive(serverInfoPacket);
// Determine GameType
String gameType = SourceEngineServerInfo.getGameType(serverInfoPacket.getData());
if (gameType.equals("cs")) {
appendServerInfo(gameType, new CSServerInfo(serverInfoPacket.getData(), address).toString());
} else if (gameType.equals("csgo")) {
appendServerInfo(gameType, new CSGOServerInfo(serverInfoPacket.getData(), address).toString());
} else if (gameType.equals("dota")) {
appendServerInfo(gameType, new DOTAServerInfo(serverInfoPacket.getData(), address).toString());
} else {
// At the moment never gets executed as CSGO determiner always return true.
System.out.println("\n[WARNING] Unresolved Game Type FOUND at address = " + address + ":27015\n");
}
} catch (Exception e) {
// DO NOTHING.
}
}
}
}
private static void sendRequests(DatagramPacket requestPacket, byte[] buffer) {
for (int rootAddress = 0; rootAddress < ROOT_IP_ADDRESSES.length; rootAddress++) {
for (int machineAddress = 0; machineAddress <= 254; machineAddress++) {
// Create Address
int socketIndex = (rootAddress * 255) + machineAddress;
String address = ROOT_IP_ADDRESSES[rootAddress] + machineAddress;
// Check if IP is in Excluded IP List
if (excludedIPList.contains(address))
continue;
buffer = new byte[255];
// Prepare socket for Broadcast
try {
sockets[socketIndex].setBroadcast(true);
// Prepare Server Request Packet
requestPacket.setAddress(InetAddress.getByName(address));
requestPacket.setPort(PORT);
// Send Request Packet
sockets[socketIndex].send(requestPacket);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
private static void appendServerInfo(String gameType, String appendData) {
if (gameType.equals("cs")) {
try {
FileWriter CS_WRITER = new FileWriter(CS_FILE_PATH, true);
CS_WRITER.write(appendData);
CS_WRITER.close();
} catch (Exception exception) {
exception.printStackTrace();
}
} else if (gameType.equals("csgo")) {
try {
FileWriter CSGO_WRITER = new FileWriter(CSGO_FILE_PATH, true);
CSGO_WRITER.write(appendData);
CSGO_WRITER.close();
} catch (Exception exception) {
exception.printStackTrace();
}
} else if (gameType.equals("dota")) {
try {
FileWriter DOTA_WRITER = new FileWriter(DOTA_FILE_PATH, true);
DOTA_WRITER.write(appendData);
DOTA_WRITER.close();
} catch (Exception exception) {
exception.printStackTrace();
}
}
}
private static void closeSockets() {
try {
for (int i = 0; i < sockets.length; i++) {
sockets[i].close();
}
} catch (Exception exception) {
exception.printStackTrace();
}
}
private static void prepareSockets() {
try {
for (int i = 0; i < sockets.length; i++) {
sockets[i] = new DatagramSocket();
sockets[i].setBroadcast(true);
}
} catch (Exception exception) {
exception.printStackTrace();
}
}
}
| [
"nilaybinjola@gmail.com"
] | nilaybinjola@gmail.com |
168958f261d906f7ed35012e4e2a838618e51b89 | e51bee1a2889026452da44569f74dc75f2ce2008 | /gen/org/intellij/plugins/hcl/terraform/il/psi/ILSelectExpression.java | 9fa6e075e3b900982a5b09c8b1f6a1d0cf8a2079 | [
"Apache-2.0"
] | permissive | KostyaSha/intellij-hcl | f9ad8e656be1fb80a8a80ebcf78e0e74fb1bd600 | 5464630c347cc09bc6d41e87d0d29e3441b02bf1 | refs/heads/master | 2021-01-16T21:45:03.640500 | 2015-12-30T17:30:31 | 2015-12-30T17:30:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | true | 350 | java | // This is a generated file. Not intended for manual editing.
package org.intellij.plugins.hcl.terraform.il.psi;
import java.util.List;
import org.jetbrains.annotations.*;
import com.intellij.psi.PsiElement;
public interface ILSelectExpression extends ILExpression {
@NotNull
ILExpression getFrom();
@Nullable
ILExpression getField();
}
| [
"vladislav.rassokhin@jetbrains.com"
] | vladislav.rassokhin@jetbrains.com |
53612e8d272b160d4c4f856381f115500873cb60 | 47d8ff8623a2479d90f55db973a38c5e07269b50 | /src/fr/miage/m1/thread/solution/RaceCondition.java | 11368ef217e5bf3b95ef74782e3c3c7894deeb6c | [] | no_license | fabricehuet/programmationAvancee | 3198ba25f83da64dce20e7a725be569dd817b4c8 | 768f3ddc05bef375cc0db8f709d0da519030a0b3 | refs/heads/master | 2021-07-08T02:09:22.382707 | 2017-10-04T14:44:49 | 2017-10-04T14:44:49 | 105,778,971 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 820 | java | package fr.miage.m1.thread.solution;
public class RaceCondition {
private static int RUN = 900000;
private int t = 0;
public void inc() {
t += 1;
}
public void dec() {
t -= 1;
}
public static void main(String[] args) {
RaceCondition r = new RaceCondition();
new Thread() {
@Override
public void run() {
for (int i = 0; i < RUN; i++) {
r.inc();
}
System.out.println("RaceCondition.main() inc finis!");
}
}.start();
new Thread() {
@Override
public void run() {
for (int i = 0; i < RUN; i++) {
r.dec();
}
System.out.println("RaceCondition.main(...) dec finis");
}
}.start();
// try {
// Thread.sleep(2000);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
System.out.println("RaceCondition.main() " + r.t);
}
}
| [
"fabrice.huet@gmail.com"
] | fabrice.huet@gmail.com |
3caba1d34c056386a14e9216f6fc128e982fa28e | f467b19449758cfb92a4a2c7d4150bf3a38315d9 | /connectors/kafka/src/main/java/forklift/connectors/KafkaController.java | 9a8099891ea9e2531c7b6f32aae6708f2e6ee360 | [
"MIT"
] | permissive | AFrieze/forklift | 97043ab55731178355065f87117be34dee06b5b2 | 95e49d24d2d08ce3605ba0da725152edd4b44442 | refs/heads/master | 2020-12-31T06:23:04.097114 | 2017-03-07T18:09:58 | 2017-03-07T18:09:58 | 48,124,399 | 0 | 0 | null | 2017-03-07T18:09:59 | 2015-12-16T17:18:48 | Java | UTF-8 | Java | false | false | 9,612 | java | package forklift.connectors;
import forklift.message.KafkaMessage;
import org.apache.kafka.clients.consumer.ConsumerRebalanceListener;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.ConsumerRecords;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.clients.consumer.OffsetAndMetadata;
import org.apache.kafka.common.TopicPartition;
import org.apache.kafka.common.errors.WakeupException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import javax.jms.JMSException;
/**
* Manages the {@link org.apache.kafka.clients.consumer.KafkaConsumer} thread. Polled records are sent to the MessageStream. Commits
* are batched and performed on any {@link #acknowledge(org.apache.kafka.clients.consumer.ConsumerRecord) acknowledged records}. Best
* performance is usually achieved using one controller instance for all topic subscriptions.
* <p>
* <strong>WARNING: </strong>Kafka does not lend itself well to message level commits. For this reason, the controller sends commits
* as a batch once every poll cycle. It should be noted that it is possible for a message to be
* processed twice should an error occur after the acknowledgement and processing of a message but before the commit takes place.
*/
public class KafkaController {
private static final Logger log = LoggerFactory.getLogger(KafkaController.class);
private volatile boolean running = false;
private final Set<String> topics = ConcurrentHashMap.newKeySet();
private final ExecutorService executor = Executors.newSingleThreadExecutor();
private final KafkaConsumer<?, ?> kafkaConsumer;
private final MessageStream messageStream;
private volatile boolean topicsChanged = false;
private Object topicsMonitor = new Object();
private AcknowledgedRecordHandler acknowlegmentHandler = new AcknowledgedRecordHandler();
public KafkaController(KafkaConsumer<?, ?> kafkaConsumer, MessageStream messageStream) {
this.kafkaConsumer = kafkaConsumer;
this.messageStream = messageStream;
}
/**
* Adds a topic which the underlying {@link org.apache.kafka.clients.consumer.KafkaConsumer} will be subscribed to. Adds
* the topic to the messageStream.
*
* @param topic the topic to subscribe to
* @return true if the topic was added, false if already added
*/
public boolean addTopic(String topic) {
if (!topics.contains(topic)) {
messageStream.addTopic(topic);
topics.add(topic);
topicsChanged = true;
synchronized (topicsMonitor) {
topicsMonitor.notify();
}
return true;
}
return false;
}
/**
* Unsubscribes the underlying {@link org.apache.kafka.clients.consumer.KafkaConsumer} from the passed in topic and removes the
* topic from the message stream.
*
* @param topic the topic to remove
* @return true if the topic was removed, false if it wasn't present
*/
public boolean removeTopic(String topic) {
boolean removed = topics.remove(topic);
if (removed) {
messageStream.removeTopic(topic);
topicsChanged = true;
}
return removed;
}
/**
* Whether or not this service is running.
*
* @return true if this service is running, else false
*/
public boolean isRunning() {
return running;
}
/**
* Acknowledge that processing is beginning on a record. True is returned if this controller is still managing the
* partition the record originated from. If the partition is no longer owned by this controller, false is returned
* and the message should not be processed.
*
* @param record the record to acknowledge
* @return true if the record should be processed, else false
* @throws InterruptedException
* @throws JMSException
*/
public boolean acknowledge(ConsumerRecord<?, ?> record) throws InterruptedException, JMSException {
log.debug("Acknowledge message with topic {} partition {} offset {}", record.topic(), record.partition(), record.offset());
return running && this.acknowlegmentHandler.acknowledgeRecord(record);
}
/**
* Starts the controller. Must be called before any other methods.
* <p>
* <strong>WARNING: </strong>Avoid starting a service which has already run and been stopped. No attempt is made
* to recover a stopped controller.
*/
public void start() {
running = true;
executor.submit(() -> controlLoop());
}
/**
* Stops the controller.
*
* @param timeout the time to wait for the service to stop
* @param timeUnit the TimeUnit of timeout
* @throws InterruptedException
*/
public void stop(long timeout, TimeUnit timeUnit) throws InterruptedException {
running = false;
kafkaConsumer.wakeup();
executor.shutdownNow();
executor.awaitTermination(timeout, timeUnit);
}
private void controlLoop() {
try {
while (running) {
boolean updatedAssignment = false;
if (topics.size() == 0) {
//check if the last remaining topic was removed
if (kafkaConsumer.assignment().size() > 0) {
kafkaConsumer.unsubscribe();
}
synchronized (topicsMonitor) {
//recheck wait condition inside synchronized block
if (topics.size() == 0) {
//pause the polling thread until a topic comes in
topicsMonitor.wait();
}
}
}
if (topicsChanged) {
topicsChanged = false;
kafkaConsumer.subscribe(topics, new RebalanceListener());
updatedAssignment = true;
}
ConsumerRecords<?, ?> records = kafkaConsumer.poll(100);
if (updatedAssignment) {
this.acknowlegmentHandler.addPartitions(kafkaConsumer.assignment());
}
if (records.count() > 0) {
log.debug("Adding: " + records.count() + " to record stream");
messageStream.addRecords(consumerRecordsToKafkaMessages(records));
}
Map<TopicPartition, OffsetAndMetadata> offsetData = this.acknowlegmentHandler.flushAcknowledged();
if (offsetData.size() > 0) {
String offsetDescription =
offsetData.entrySet()
.stream()
.map(entry -> "topic: " + entry.getKey().topic() + ", " +
"partition: " + entry.getKey().partition() + ", " +
"offset: " + entry.getValue().offset())
.collect(Collectors.joining("|"));
log.debug("Commiting offsets {}", offsetDescription);
kafkaConsumer.commitSync(offsetData);
}
}
} catch (WakeupException | InterruptedException e) {
log.info("Control Loop exiting");
} catch (Throwable t) {
log.error("Control Loop error, exiting", t);
throw t;
} finally {
running = false;
//the kafkaConsumer must be closed in the poll thread
log.info("KafkaConsumer closing");
kafkaConsumer.close();
}
}
private Map<TopicPartition, List<KafkaMessage>> consumerRecordsToKafkaMessages(ConsumerRecords<?, ?> records) {
Map<TopicPartition, List<KafkaMessage>> messages = new HashMap<>();
records.partitions().forEach(tp -> messages.put(tp, new ArrayList<>()));
for (ConsumerRecord<?, ?> record : records) {
TopicPartition partition = new TopicPartition(record.topic(), record.partition());
messages.get(partition).add(new KafkaMessage(this, record));
}
return messages;
}
private class RebalanceListener implements ConsumerRebalanceListener {
@Override public void onPartitionsRevoked(Collection<TopicPartition> partitions) {
log.debug("Partitions revoked");
try {
Map<TopicPartition, OffsetAndMetadata>
removedOffsetData =
acknowlegmentHandler.removePartitions(partitions);
kafkaConsumer.commitSync(removedOffsetData);
} catch (InterruptedException e) {
log.info("Partition rebalance interrupted", e);
Thread.currentThread().interrupt();
}
}
@Override
public void onPartitionsAssigned(Collection<TopicPartition> partitions) {
log.debug("partitions assigned");
acknowlegmentHandler.addPartitions(partitions);
}
}
}
| [
"afrieze@sofi.org"
] | afrieze@sofi.org |
78848c44c796240d7e884b58018afbfc505253e5 | 1c194ed9df4c4de97b51fb7a1b8a33207a244597 | /simpleapp/core/src/main/java/com/cap/simpleapp/general/logic/base/UcManageBinaryObject.java | 7e5ec53e2553f56aa7bbb1baa16268bd94707483 | [] | no_license | pablo-parra/app-winauthsso | efa78d7b3c27b5505ca4ae42e89f747007cb46a2 | 28c77ae0dbb405cbf029144caa9c8bd85d699aeb | refs/heads/master | 2021-01-01T20:31:20.946113 | 2017-07-31T10:52:42 | 2017-07-31T10:52:42 | 98,878,476 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 958 | java | package com.cap.simpleapp.general.logic.base;
import com.cap.simpleapp.general.logic.api.to.BinaryObjectEto;
import java.sql.Blob;
/**
* Use case for managing BinaryObject.
*
*/
public interface UcManageBinaryObject {
/**
* @param data the Blob data to save
* @param binaryObjectEto the {@link BinaryObjectEto}
* @return {@link BinaryObjectEto}
*/
BinaryObjectEto saveBinaryObject(Blob data, BinaryObjectEto binaryObjectEto);
/**
* @param binaryObjectId the ID of the {@link BinaryObjectEto} that should be deleted
*/
void deleteBinaryObject(Long binaryObjectId);
/**
* @param binaryObjectId the ID of the {@link BinaryObjectEto} to find
* @return {@link BinaryObjectEto}
*/
BinaryObjectEto findBinaryObject(Long binaryObjectId);
/**
* @param binaryObjectId the ID of the {@link BinaryObjectEto} the blob corresponds to
* @return {@link Blob}
*/
Blob getBinaryObjectBlob(Long binaryObjectId);
}
| [
"pablo.parra-dominguez@capgemini.com"
] | pablo.parra-dominguez@capgemini.com |
9c921c24788b710dd3a25beb7295af263d273b51 | 32b72e1dc8b6ee1be2e80bb70a03a021c83db550 | /ast_results/AnySoftKeyboard_AnySoftKeyboard/app/src/test/java/com/anysoftkeyboard/AnySoftKeyboardGimmicksTest.java | 93243e2ee2986e7e71a0195ed24397aec82515b0 | [] | no_license | cmFodWx5YWRhdjEyMTA5/smell-and-machine-learning | d90c41a17e88fcd99d543124eeb6e93f9133cb4a | 0564143d92f8024ff5fa6b659c2baebf827582b1 | refs/heads/master | 2020-07-13T13:53:40.297493 | 2019-01-11T11:51:18 | 2019-01-11T11:51:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 40,846 | java | // isComment
package com.anysoftkeyboard;
import static com.anysoftkeyboard.keyboards.ExternalAnyKeyboardTest.SIMPLE_KeyboardDimens;
import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
import android.content.res.Configuration;
import android.os.SystemClock;
import android.text.InputType;
import android.view.KeyEvent;
import android.view.inputmethod.EditorInfo;
import com.anysoftkeyboard.api.KeyCodes;
import com.anysoftkeyboard.keyboards.AnyKeyboard;
import com.anysoftkeyboard.keyboards.ExternalAnyKeyboard;
import com.anysoftkeyboard.keyboards.Keyboard;
import com.anysoftkeyboard.test.SharedPrefsHelper;
import com.menny.android.anysoftkeyboard.R;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
import org.robolectric.annotation.Config;
import androidx.test.core.app.ApplicationProvider;
@RunWith(AnySoftKeyboardRobolectricTestRunner.class)
public class isClassOrIsInterface extends AnySoftKeyboardBaseTest {
@Test
public void isMethod() {
TestInputConnection isVariable = isMethod();
final String isVariable = "isStringConstant";
isNameExpr.isMethod(isNameExpr, isIntegerConstant);
isNameExpr.isMethod(isNameExpr, isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod(isNameExpr + "isStringConstant", isNameExpr.isMethod());
// isComment
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod(isNameExpr + "isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() {
TestInputConnection isVariable = isMethod();
final String isVariable = "isStringConstant";
isNameExpr.isMethod(isNameExpr, isIntegerConstant);
isNameExpr.isMethod(isNameExpr, isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod(isNameExpr + "isStringConstant", isNameExpr.isMethod());
// isComment
isNameExpr.isMethod(isNameExpr.isMethod(isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr).isMethod()) + isIntegerConstant);
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod(isNameExpr + "isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() {
TestInputConnection isVariable = isMethod();
final String isVariable = "isStringConstant";
isNameExpr.isMethod(isNameExpr, isIntegerConstant);
isNameExpr.isMethod(isNameExpr, isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod(isNameExpr + "isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod(isNameExpr + "isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod(isNameExpr + "isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod(isNameExpr + "isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() {
TestInputConnection isVariable = isMethod();
final String isVariable = "isStringConstant";
isNameExpr.isMethod(isNameExpr, isIntegerConstant);
isNameExpr.isMethod(isNameExpr, isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod(isNameExpr + "isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod(isNameExpr + "isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod(isNameExpr + "isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod(isNameExpr + "isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() {
TestableAnySoftKeyboard.TestableSuggest isVariable = (TestableAnySoftKeyboard.TestableSuggest) isNameExpr.isMethod();
isNameExpr.isMethod("isStringConstant", "isStringConstant", "isStringConstant", "isStringConstant");
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod("isStringConstant");
isNameExpr.isMethod("isStringConstant");
isNameExpr.isMethod(isIntegerConstant, "isStringConstant");
// isComment
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
// isComment
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() {
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod("isStringConstant");
isMethod(true, "isStringConstant", "isStringConstant", "isStringConstant");
isNameExpr.isMethod(isIntegerConstant, "isStringConstant");
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
// isComment
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() {
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod("isStringConstant");
isMethod(true, "isStringConstant", "isStringConstant", "isStringConstant");
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
// isComment
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() {
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod("isStringConstant");
isMethod(true, "isStringConstant", "isStringConstant", "isStringConstant");
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
// isComment
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant");
isMethod(true, "isStringConstant", "isStringConstant", "isStringConstant");
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
// isComment
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() {
isNameExpr.isMethod("isStringConstant");
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isMethod().isMethod());
// isComment
isNameExpr.isMethod(null, "isStringConstant");
isNameExpr.isMethod("isStringConstant", isMethod().isMethod());
}
@Test
public void isMethod() {
isNameExpr.isMethod(isMethod().isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr), true);
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod("isStringConstant");
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
// isComment
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() {
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod("isStringConstant");
isMethod(true, "isStringConstant", "isStringConstant", "isStringConstant");
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
// isComment
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() {
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
ArgumentCaptor<KeyEvent> isVariable = isNameExpr.isMethod(KeyEvent.class);
isNameExpr.isMethod(isNameExpr, isNameExpr.isMethod(isIntegerConstant)).isMethod(isNameExpr.isMethod());
isNameExpr.isMethod(isIntegerConstant, /*isComment*/
isNameExpr.isMethod().isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr.isMethod().isMethod(isIntegerConstant).isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr.isMethod().isMethod(isIntegerConstant).isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr.isMethod().isMethod(isIntegerConstant).isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr.isMethod().isMethod(isIntegerConstant).isMethod());
// isComment
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() {
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
ArgumentCaptor<KeyEvent> isVariable = isNameExpr.isMethod(KeyEvent.class);
isNameExpr.isMethod(isNameExpr, isNameExpr.isMethod(isIntegerConstant)).isMethod(isNameExpr.isMethod());
isNameExpr.isMethod(isIntegerConstant, /*isComment*/
isNameExpr.isMethod().isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr.isMethod().isMethod(isIntegerConstant).isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr.isMethod().isMethod(isIntegerConstant).isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr.isMethod().isMethod(isIntegerConstant).isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr.isMethod().isMethod(isIntegerConstant).isMethod());
// isComment
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() {
isNameExpr.isMethod(true);
isNameExpr.isMethod();
EditorInfo isVariable = isMethod();
isNameExpr.isFieldAccessExpr = isNameExpr.isFieldAccessExpr;
isNameExpr.isMethod(isNameExpr, true);
isNameExpr.isMethod(isNameExpr, true);
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr).isMethod("isStringConstant", isIntegerConstant);
// isComment
isNameExpr.isMethod(isNameExpr, isNameExpr.isMethod()).isMethod(isNameExpr.isMethod(KeyEvent.class));
}
@Test
public void isMethod() {
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod("isStringConstant");
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() {
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod("isStringConstant");
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant");
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod().isMethod(isIntegerConstant, isIntegerConstant);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isIntegerConstant, (isMethod()).isMethod());
}
@Test
public void isMethod() {
isMethod();
isNameExpr.isMethod().isMethod().isFieldAccessExpr = isNameExpr.isFieldAccessExpr;
isMethod(true, isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr.isFieldAccessExpr | isNameExpr.isFieldAccessExpr));
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod("isStringConstant");
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant");
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod().isMethod(isIntegerConstant, isIntegerConstant);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isIntegerConstant, (isMethod()).isMethod());
}
@Test
public void isMethod() {
isMethod();
isNameExpr.isMethod().isMethod().isFieldAccessExpr = isNameExpr.isFieldAccessExpr;
isMethod(true, isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr.isFieldAccessExpr | isNameExpr.isFieldAccessExpr));
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod("isStringConstant");
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant");
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() {
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod("isStringConstant");
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant");
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() {
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod("isStringConstant");
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() {
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod("isStringConstant");
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(null, "isStringConstant");
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() {
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, true);
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod("isStringConstant");
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() {
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod("isStringConstant");
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isMethod().isMethod());
isNameExpr.isMethod(isNameExpr.isMethod().isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr.isMethod().isMethod());
isNameExpr.isMethod(isNameExpr.isMethod().isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
// isComment
isNameExpr.isMethod(isNameExpr.isMethod().isMethod());
isNameExpr.isMethod(isNameExpr.isMethod().isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() {
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod("isStringConstant");
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isMethod().isMethod());
isNameExpr.isMethod(isNameExpr.isMethod().isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr.isMethod().isMethod());
isNameExpr.isMethod(isNameExpr.isMethod().isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
// isComment
isNameExpr.isMethod(isNameExpr.isMethod().isMethod());
isNameExpr.isMethod(isNameExpr.isMethod().isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() {
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, true);
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod("isStringConstant");
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() {
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod("isStringConstant");
isMethod(true, "isStringConstant", "isStringConstant", "isStringConstant");
// isComment
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() {
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod("isStringConstant");
isMethod(true, "isStringConstant", "isStringConstant", "isStringConstant");
// isComment
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
// isComment
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() {
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod("isStringConstant");
isMethod(true, "isStringConstant", "isStringConstant", "isStringConstant");
// isComment
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() {
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() {
TestInputConnection isVariable = isMethod();
AnyKeyboard isVariable = isNameExpr.isMethod(isNameExpr.isMethod());
isNameExpr.isMethod(true).isMethod(isNameExpr).isMethod();
isNameExpr.isMethod(isNameExpr);
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() throws Exception {
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() throws Exception {
final int isVariable = isNameExpr.isMethod(isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr).isMethod()) + isIntegerConstant;
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
// isComment
AnyKeyboard.AnyKey isVariable = (AnyKeyboard.AnyKey) isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
// isComment
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
// isComment
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr);
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() throws Exception {
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod().isMethod().isMethod();
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod().isMethod().isMethod();
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() throws Exception {
isNameExpr.isMethod(true);
isNameExpr.isMethod();
EditorInfo isVariable = isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr.isFieldAccessExpr | isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr, true);
isNameExpr.isMethod(isNameExpr, true);
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod(isIntegerConstant, isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr.isMethod());
// isComment
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() throws Exception {
isNameExpr.isMethod(true);
isNameExpr.isMethod();
EditorInfo isVariable = isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr.isFieldAccessExpr | isNameExpr.isFieldAccessExpr);
isNameExpr.isFieldAccessExpr = isIntegerConstant;
isNameExpr.isFieldAccessExpr = "isStringConstant";
isNameExpr.isMethod(isNameExpr, true);
isNameExpr.isMethod(isNameExpr, true);
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod(isIntegerConstant, isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isIntegerConstant, isNameExpr.isMethod());
// isComment
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() throws Exception {
isNameExpr.isMethod(true);
isNameExpr.isMethod();
EditorInfo isVariable = isNameExpr.isMethod(isNameExpr.isFieldAccessExpr | isNameExpr.isFieldAccessExpr, isNameExpr.isFieldAccessExpr | isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr, true);
isNameExpr.isMethod(isNameExpr, true);
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod(isIntegerConstant, isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
// isComment
isNameExpr.isMethod(isIntegerConstant, isNameExpr.isMethod());
// isComment
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() throws Exception {
isNameExpr.isMethod(true);
isNameExpr.isMethod();
EditorInfo isVariable = isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr.isFieldAccessExpr | isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr, true);
isNameExpr.isMethod(isNameExpr, true);
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod(isIntegerConstant, isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
// isComment
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr.isMethod());
// isComment
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() throws Exception {
isNameExpr.isMethod(true);
isNameExpr.isMethod();
EditorInfo isVariable = isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr.isFieldAccessExpr | isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr, true);
isNameExpr.isMethod(isNameExpr, true);
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod(isIntegerConstant, isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isIntegerConstant, isNameExpr.isMethod());
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() throws Exception {
isNameExpr.isMethod(true);
isNameExpr.isMethod();
EditorInfo isVariable = isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr.isFieldAccessExpr | isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr, true);
isNameExpr.isMethod(isNameExpr, true);
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod(isIntegerConstant, isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isIntegerConstant, isNameExpr.isMethod());
// isComment
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() throws Exception {
isNameExpr.isMethod(true);
isNameExpr.isMethod();
EditorInfo isVariable = isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isIntegerConstant);
isNameExpr.isMethod(isNameExpr, true);
isNameExpr.isMethod(isNameExpr, true);
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod(isIntegerConstant, isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod(isIntegerConstant, isNameExpr.isMethod());
}
@Test
@Config(qualifiers = "isStringConstant")
public void isMethod() {
isMethod().isMethod().isMethod().isFieldAccessExpr = isNameExpr.isFieldAccessExpr;
// isComment
isNameExpr.isMethod(isIntegerConstant, isMethod().isMethod().isMethod().isFieldAccessExpr);
isNameExpr.isMethod(isIntegerConstant, isMethod().isMethod().isMethod().isFieldAccessExpr);
isNameExpr.isMethod(isIntegerConstant, isMethod().isMethod().isMethod().isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isMethod().isMethod().isMethod().isFieldAccessExpr);
isMethod();
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, "isStringConstant");
isNameExpr.isMethod(isNameExpr.isMethod());
isMethod(true, isMethod());
isNameExpr.isMethod(isNameExpr.isMethod());
isNameExpr.isMethod().isMethod();
isMethod(isNameExpr.isMethod().isMethod().isMethod(isIntegerConstant), isIntegerConstant, isIntegerConstant, isIntegerConstant);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, "isStringConstant");
isNameExpr.isMethod(isNameExpr.isMethod());
isMethod(true, isMethod());
isNameExpr.isMethod(isNameExpr.isMethod());
isNameExpr.isMethod().isMethod();
isMethod(isNameExpr.isMethod().isMethod().isMethod(isIntegerConstant), isIntegerConstant, isIntegerConstant, isIntegerConstant);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, "isStringConstant");
isNameExpr.isMethod(isNameExpr.isMethod());
isMethod(true, isMethod());
isNameExpr.isMethod(isNameExpr.isMethod());
isNameExpr.isMethod().isMethod();
isMethod(isNameExpr.isMethod().isMethod().isMethod(isIntegerConstant), isIntegerConstant, isIntegerConstant, isIntegerConstant);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, "isStringConstant");
isNameExpr.isMethod(isNameExpr.isMethod());
isMethod(true, isMethod());
isNameExpr.isMethod(isNameExpr.isMethod());
isNameExpr.isMethod().isMethod();
isMethod(isNameExpr.isMethod().isMethod().isMethod(isIntegerConstant), isIntegerConstant, isIntegerConstant, isIntegerConstant);
}
@Test
@Config(qualifiers = "isStringConstant")
public void isMethod() {
isMethod().isMethod().isMethod().isFieldAccessExpr = isNameExpr.isFieldAccessExpr;
// isComment
isNameExpr.isMethod(isIntegerConstant, isMethod().isMethod().isMethod().isFieldAccessExpr);
isNameExpr.isMethod(isIntegerConstant, isMethod().isMethod().isMethod().isFieldAccessExpr);
isNameExpr.isMethod(isIntegerConstant, isMethod().isMethod().isMethod().isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isMethod().isMethod().isMethod().isFieldAccessExpr);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, "isStringConstant");
isNameExpr.isMethod(isNameExpr.isMethod());
isMethod(true, isMethod());
isNameExpr.isMethod(isNameExpr.isMethod());
isNameExpr.isMethod().isMethod();
// isComment
isMethod(isNameExpr.isMethod().isMethod().isMethod(isIntegerConstant), isIntegerConstant, isIntegerConstant, isIntegerConstant);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, "isStringConstant");
isNameExpr.isMethod(isNameExpr.isMethod());
isMethod(true, isMethod());
isNameExpr.isMethod(isNameExpr.isMethod());
isNameExpr.isMethod().isMethod();
isMethod(isNameExpr.isMethod().isMethod().isMethod(isIntegerConstant), isIntegerConstant, isIntegerConstant, isIntegerConstant);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, "isStringConstant");
isNameExpr.isMethod(isNameExpr.isMethod());
isMethod(true, isMethod());
isNameExpr.isMethod(isNameExpr.isMethod());
isNameExpr.isMethod().isMethod();
isMethod(isNameExpr.isMethod().isMethod().isMethod(isIntegerConstant), isIntegerConstant, isIntegerConstant, isIntegerConstant);
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, "isStringConstant");
isNameExpr.isMethod(isNameExpr.isMethod());
isMethod(true, isMethod());
isNameExpr.isMethod(isNameExpr.isMethod());
isNameExpr.isMethod().isMethod();
isMethod(isNameExpr.isMethod().isMethod().isMethod(isIntegerConstant), isIntegerConstant, isIntegerConstant, isIntegerConstant);
}
@Test
public void isMethod() {
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod("isStringConstant");
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
// isComment
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod("isStringConstant");
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
// isComment
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod("isStringConstant");
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
// isComment
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
@Test
public void isMethod() {
final AnyKeyboard isVariable = isNameExpr.isMethod();
ExternalAnyKeyboard isVariable = new ExternalAnyKeyboard(isNameExpr.isMethod(), isNameExpr.isMethod(), isNameExpr.isMethod(), isNameExpr.isFieldAccessExpr.isFieldAccessExpr, isNameExpr.isFieldAccessExpr.isFieldAccessExpr, "isStringConstant", isNameExpr.isFieldAccessExpr.isFieldAccessExpr, isIntegerConstant, "isStringConstant", "isStringConstant", new String(isNameExpr.isMethod()), isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr);
isNameExpr.isMethod(isNameExpr);
TestInputConnection isVariable = isMethod();
isNameExpr.isMethod("isStringConstant");
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
// isComment
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant");
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
// isComment
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant");
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
// isComment
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant");
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
// isComment
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod("isStringConstant", isNameExpr.isMethod());
}
private void isMethod(Keyboard.Key isParameter, int isParameter, int isParameter, int isParameter) {
isNameExpr.isMethod("isStringConstant", isNameExpr, isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr, isNameExpr.isFieldAccessExpr);
isNameExpr.isMethod("isStringConstant", isNameExpr, isNameExpr.isFieldAccessExpr);
}
}
| [
"matheus@melsolucoes.net"
] | matheus@melsolucoes.net |
86a8d8e8831db61a8525670c25260782ee4aaa7e | 0a2df03558cea6a332c2f4e506e7f03125d07143 | /src/br/com/agenda/enlaces/LoginUserForm.java | 993479c1d337bb2e668005c6de1772ffe2240760 | [] | no_license | ymritchie/newagenda | 98ac64a874ea514d60b65ed1bbcfeab6f94a489e | 3f50bb573e5e42a12daab4a1c086682cecee2585 | refs/heads/master | 2016-09-13T17:21:08.584147 | 2016-04-22T08:47:49 | 2016-04-22T08:47:49 | 56,840,574 | 0 | 0 | null | null | null | null | ISO-8859-2 | Java | false | false | 843 | java | package br.com.agenda.enlaces;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import br.com.agenda.nucleo.LoginUser;
@ManagedBean
@SessionScoped
public class LoginUserForm {
private LoginUser user;
public LoginUserForm (){
user = new LoginUser();
}
public LoginUser getUser() {
return user;
}
public void setUser(LoginUser user) {
this.user = user;
}
public String logonUser() {
String result = null;
try {
if (!getUser().getNomeUser().toLowerCase().equals("yanisley") ||
getUser().getNomeUser().equals(null) || getUser().getSenha().equals(null) ||
!getUser().getSenha().equals("mora")){
throw new Exception();
} else {
result = "logar";
}
} catch (Exception ex){
FacesUtil.addErro("Usuário ou senha Inválido");
}
return result;
}
}
| [
"ymritchie@gmail.com"
] | ymritchie@gmail.com |
67a4b6aac64b1aafe4c5c4b69360567454f8af33 | 59b492bb248b50bf23950d4ff68f444b650805ec | /src/StacksQueues/arrays.stack/Main.java | 7c0a86bbd00eb9289f4c6ec523f17bc8e81d42a2 | [] | no_license | mtianyan/AlgoPlay | be9ec594015508801739b334e2017701813ccfd8 | 166106dbb71cf8a0a8495e08174f97a48a0fa8c6 | refs/heads/master | 2023-02-21T08:59:47.475121 | 2021-01-15T22:33:12 | 2021-01-15T22:33:12 | 325,931,862 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 340 | java | package StacksQueues.arrays.stack;
public class Main {
public static void main(String[] args) {
ArrayStack<Integer> stack = new ArrayStack<>();
for(int i = 0 ; i < 5 ; i ++){
stack.push(i);
System.out.println(stack);
}
stack.pop();
System.out.println(stack);
}
}
| [
"1147727180@qq.com"
] | 1147727180@qq.com |
40580f18228a081f02cff05a779faa678d18f218 | 4d6f6e1a157d0a9cefe9047239db0d5b331951ff | /sweetlib1/src/main/java/layout/LoginFragment.java | c46826094e50eb79eb4d2813dc2df1af21ec8eb3 | [] | no_license | hdnvd/Sweet-Android-Framework | 1e9ad1e5a35f4881f5bf675d791edd6ac7a7cf99 | f630e1bbd281763ba6c99758c6e9c662ec8dd160 | refs/heads/master | 2021-06-12T13:13:34.870085 | 2020-05-12T20:29:00 | 2020-05-12T20:29:00 | 128,638,331 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,532 | java | package layout;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.widget.DrawerLayout;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.afollestad.bridge.Bridge;
import com.afollestad.bridge.BridgeException;
import com.afollestad.bridge.Request;
import com.afollestad.bridge.Response;
import com.yarolegovich.lovelydialog.LovelyStandardDialog;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import common.SweetDeviceManager;
import ir.sweetsoft.sweetlibone.Activities.LocalUserInfo;
import ir.sweetsoft.sweetlibone.Activities.Constants;
import ir.sweetsoft.sweetlibone.Activities.MainActivity;
import ir.sweetsoft.sweetlibone.R;
public class LoginFragment extends Fragment {
private EditText txtusername,txtpassword;
private TextView lblusername,lblpassword;
private Button btnLogin;
private ImageView PageBG;
private ProgressBar WaitBar;
private OnFragmentInteractionListener mListener;
public LoginFragment() {
}
public static LoginFragment newInstance(String param1, String param2) {
LoginFragment fragment = new LoginFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_login, container, false);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
btnLogin=(Button)getView().findViewById(R.id.btnlogin);
txtusername=(EditText) getView().findViewById(R.id.txtusername);
txtpassword=(EditText) getView().findViewById(R.id.txtpassword);
lblusername=(TextView) getView().findViewById(R.id.lblusername);
lblpassword=(TextView) getView().findViewById(R.id.lblpassword);
PageBG=(ImageView) getView().findViewById(R.id.pagebg);
WaitBar=(ProgressBar)getView().findViewById(R.id.progressbar);
WaitBar.setVisibility(View.GONE);
Bitmap bitmap= BitmapFactory.decodeResource(getActivity().getResources(),
R.drawable.bg3);
int nh = (int) ( bitmap.getHeight() * (512.0 / bitmap.getWidth()) );
Bitmap scaled = Bitmap.createScaledBitmap(bitmap, 512, nh, true);
PageBG.setImageBitmap(scaled);
Typeface face= Typeface.createFromAsset(getActivity().getAssets(),"fonts/IRANSansMobile.ttf");
btnLogin.setTypeface(face);
txtusername.setTypeface(face);
txtpassword.setTypeface(face);
lblusername.setTypeface(face);
lblpassword.setTypeface(face);
btnLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
WaitBar.setVisibility(View.VISIBLE);
AsyncTask.execute(new Runnable() {
@Override
public void run() {
CheckLogin(txtusername.getText().toString(),txtpassword.getText().toString());
}
});
}
});
MainActivity mainActivity=(MainActivity) getActivity();
mainActivity.setNavigationDrawerLockState(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
}
public void CheckLogin(String UserName,String Password)
{
try {
String DeviceID= SweetDeviceManager.getDeviceID(this.getActivity());
String URL=Constants.SIGNINURL+"&username="+ URLEncoder.encode(UserName,"utf-8")+"&password="+URLEncoder.encode(Password,"utf-8")+"&deviceid="+URLEncoder.encode(DeviceID,"utf-8");
Log.d("URL",URL);
Request request = Bridge.get(URL).throwIfNotSuccess().retries(5, 6000).request();
Response response = request.response();
int Status=-1;
if (response.isSuccess()) {
Status=Integer.parseInt(response.asAsonObject().get("status").toString());
}
if(Status==404)//NotFound
{
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
new LovelyStandardDialog(getActivity())
.setButtonsColor(Color.parseColor("#FFC01059"))
.setTitle("خطا")
.setMessage("کاربری با مشخصات وارد شده پیدا نشد.")
.setPositiveButton(android.R.string.ok,null)
.show();
WaitBar.setVisibility(View.GONE);
}
});
}
else if(Status>0)
{
int Role=Integer.parseInt(response.asAsonObject().get("role").toString());
LocalUserInfo.SetUserInfo(getActivity(),UserName,Password,"","",Role);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
((MainActivity)getActivity()).routeToIndex();
WaitBar.setVisibility(View.GONE);
}
});
}
else
{
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
new LovelyStandardDialog(getActivity())
.setButtonsColor(Color.parseColor("#FFC01059"))
.setTitle("خطا")
.setMessage("خطایی در ارتباط با سرور به وجود آمد.")
.setPositiveButton(android.R.string.ok,null)
.show();
WaitBar.setVisibility(View.GONE);
}
});
}
}
catch (BridgeException ex){
ex.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
public void onButtonPressed(Uri uri) {
if (mListener != null) {
mListener.onFragmentInteraction(uri);
}
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof OnFragmentInteractionListener) {
mListener = (OnFragmentInteractionListener) context;
} else {
}
}
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
public interface OnFragmentInteractionListener {
// TODO: Update argument type and name
void onFragmentInteraction(Uri uri);
}
}
| [
"Hadi.nahavandi2010@gmail.com"
] | Hadi.nahavandi2010@gmail.com |
92e4200f9688f4d9f23bc2d97de17ec1aadc1fee | 203cf7c66d1558e59d4d3bf825319cdc897167b8 | /kol-coin/src/main/java/com/coin/dao/GiftDao.java | fb95ec63722f63a14de7fc51a29eb067af14f198 | [] | no_license | xiaotao-github/KOL | 7b226964f4482df7d34fdc0c7729094e6f715629 | 000137f7d91ced70a0b70610e031aa7dc47dddda | refs/heads/master | 2020-05-15T15:34:33.944130 | 2019-04-20T08:26:52 | 2019-04-20T08:27:00 | 182,377,278 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 544 | java | package com.coin.dao;
import com.coin.dto.Gift;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper
public interface GiftDao {
// 后台模块开始
// 模糊查询
List findByProp(Map map);
// 精确查询
Gift findOneById(String id);
// 添加
boolean add(Gift gift);
// 根据ID删除
boolean delete(String[] id);
// 根据ID修改
boolean update(Gift gift);
// 后台模块结束
//礼物列表
List getGiftListToRoom();
}
| [
"913888619@qq.com"
] | 913888619@qq.com |
f7f0a3108b62880eda218a6f5f6117998c2fa17e | 49099431e3ec5eab5f1a520a39c43ff7bc996afe | /src/com/chess/board/FENFormatException.java | f8bda6ac4e4a4d1392952ce004b3fe47b59526e5 | [] | no_license | hartmc/sample | 7b41717c6a6d81cd0f97ad4180635c0773138d0d | a0d1c3ee9f978e0219dcaf130a745a0e9dff2e14 | refs/heads/master | 2020-06-01T13:33:07.738399 | 2014-10-09T13:02:40 | 2014-10-09T13:02:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 314 | java | package com.chess.board;
public class FENFormatException extends RuntimeException {
private static final long serialVersionUID = 1L;
public FENFormatException(String badFEN, RuntimeException re) {
super("\"" + badFEN + "\" is not a properly formatted FEN string.", re);
}
}
| [
"re*member"
] | re*member |
fae9852f09870bcbd6ca95cc2ff87f4b2ec92007 | 23ec52180e445c39a0b357d5b3a99154ba681ed7 | /ComputerMusicLab/src/com/ibm/nili/music/Note.java | e8ed8f4bdcde4e423ca3c7caaf7df8f9e0ab4e0c | [] | no_license | pisces312/MyJavaProjects | 1408c5f33f1f39fc3929ebe34d39b6bcd6a5d166 | 0529ba813350e710d8aaca2d89c453570b244a64 | refs/heads/master | 2021-01-18T03:59:42.190929 | 2017-12-16T15:58:13 | 2017-12-16T15:58:13 | 84,271,420 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,913 | java | package com.ibm.nili.music;
import java.util.Comparator;
public class Note implements Comparable<Note> {
public final static Comparator<Note> noteComparator = new Comparator<Note>() {
@Override
public int compare(Note arg0, Note arg1) {
return arg0.pitch.noteOrder - arg1.pitch.noteOrder;
}
};
Pitch pitch;
double rhythmValue;
//the number of delta time
// int timeCount;
// float db = Float.NEGATIVE_INFINITY;
//mili
// int durationMiliSecond;
public Note(Pitch pitch, double rhythmValue) {
this.pitch = pitch;
this.rhythmValue = rhythmValue;
// updateDBValue(db);
}
public Note(Pitch pitch) {
this(pitch, Float.NEGATIVE_INFINITY);
}
// public float getDB() {
// return db;
// }
//
// public void updateDBValue(float db) {
// if (db > this.db)
// this.db = db;
// }
// public void addTimeCount(int d) {
// timeCount += d;
// }
@Override
public String toString() {
return pitch.name.toString() + pitch.octave;
// return pitch.name.toString() + pitch.octave + "(" + timeCount + "," + db + "dB)";
}
@Override
public int compareTo(Note o) {
return pitch.noteOrder - o.pitch.noteOrder;
}
@Override
public boolean equals(Object arg0) {
Note n = (Note)arg0;
return pitch.equals(n.pitch);
}
}
| [
"lee.ni@emc.com"
] | lee.ni@emc.com |
7bf7ff0ae5e46022bcda8f7b989b3c5bb608f7d8 | 2bf991ee51e8f7ba17b8668c4d217b9834af42e9 | /ktor-utils/src/io/ktor/org/apache/commons/collections4/map/AbstractHashedMap.java | b87318b6959c106b73bec0cb5b498bacaf19c9dd | [
"Apache-2.0"
] | permissive | Zddie/ktor | 89327440cd267fcd9cbd45257ceb3b3fc67eb626 | afa45ccd42011ff5f73e639aca12795cd7f267b0 | refs/heads/master | 2020-03-24T21:15:46.164430 | 2018-07-25T14:09:01 | 2018-07-27T09:25:00 | 143,022,166 | 0 | 0 | Apache-2.0 | 2018-08-02T19:15:43 | 2018-07-31T14:01:55 | Kotlin | UTF-8 | Java | false | false | 42,400 | java | // copied from Apache Commons Collections 4.1. See https://commons.apache.org/proper/commons-collections/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.ktor.org.apache.commons.collections4.map;
import java.util.*;
/**
* An abstract implementation of a hash-based map which provides numerous points for
* subclasses to override.
* <p>
* This class implements all the features necessary for a subclass hash-based map.
* Key-value entries are stored in instances of the <code>HashEntry</code> class,
* which can be overridden and replaced. The iterators can similarly be replaced,
* without the need to replace the KeySet, EntrySet and Values view classes.
* <p>
* Overridable methods are provided to change the default hashing behaviour, and
* to change how entries are added to and removed from the map. Hopefully, all you
* need for unusual subclasses is here.
* <p>
* NOTE: From Commons Collections 3.1 this class extends AbstractMap.
* This is to provide backwards compatibility for ReferenceMap between v3.0 and v3.1.
* This extends clause will be removed in v5.0.
*
* @since 3.0
* @version $Id: AbstractHashedMap.java 1649010 2015-01-02 12:32:37Z tn $
*/
public class AbstractHashedMap<K, V> extends AbstractMap<K, V> {
protected static final String NO_NEXT_ENTRY = "No next() entry in the iteration";
protected static final String NO_PREVIOUS_ENTRY = "No previous() entry in the iteration";
protected static final String REMOVE_INVALID = "remove() can only be called once after next()";
protected static final String GETKEY_INVALID = "getKey() can only be called after next() and before remove()";
protected static final String GETVALUE_INVALID = "getValue() can only be called after next() and before remove()";
protected static final String SETVALUE_INVALID = "setValue() can only be called after next() and before remove()";
/** The default capacity to use */
protected static final int DEFAULT_CAPACITY = 16;
/** The default threshold to use */
protected static final int DEFAULT_THRESHOLD = 12;
/** The default load factor to use */
protected static final float DEFAULT_LOAD_FACTOR = 0.75f;
/** The maximum capacity allowed */
protected static final int MAXIMUM_CAPACITY = 1 << 30;
/** An object for masking null */
protected static final Object NULL = new Object();
/** Load factor, normally 0.75 */
transient float loadFactor;
/** The size of the map */
transient int size;
/** Map entries */
transient HashEntry<K, V>[] data;
/** Size at which to rehash */
transient int threshold;
/** Modification count for iterators */
transient int modCount;
/** Entry set */
transient EntrySet<K, V> entrySet;
/** Key set */
transient KeySet<K> keySet;
/** Values */
transient Values<V> values;
/**
* Constructor only used in deserialization, do not use otherwise.
*/
protected AbstractHashedMap() {
super();
}
/**
* Constructor which performs no validation on the passed in parameters.
*
* @param initialCapacity the initial capacity, must be a power of two
* @param loadFactor the load factor, must be > 0.0f and generally < 1.0f
* @param threshold the threshold, must be sensible
*/
@SuppressWarnings("unchecked")
protected AbstractHashedMap(final int initialCapacity, final float loadFactor, final int threshold) {
super();
this.loadFactor = loadFactor;
this.data = new HashEntry[initialCapacity];
this.threshold = threshold;
init();
}
/**
* Constructs a new, empty map with the specified initial capacity and
* default load factor.
*
* @param initialCapacity the initial capacity
* @throws IllegalArgumentException if the initial capacity is negative
*/
protected AbstractHashedMap(final int initialCapacity) {
this(initialCapacity, DEFAULT_LOAD_FACTOR);
}
/**
* Constructs a new, empty map with the specified initial capacity and
* load factor.
*
* @param initialCapacity the initial capacity
* @param loadFactor the load factor
* @throws IllegalArgumentException if the initial capacity is negative
* @throws IllegalArgumentException if the load factor is less than or equal to zero
*/
@SuppressWarnings("unchecked")
protected AbstractHashedMap(int initialCapacity, final float loadFactor) {
super();
if (initialCapacity < 0) {
throw new IllegalArgumentException("Initial capacity must be a non negative number");
}
if (loadFactor <= 0.0f || Float.isNaN(loadFactor)) {
throw new IllegalArgumentException("Load factor must be greater than 0");
}
this.loadFactor = loadFactor;
initialCapacity = calculateNewCapacity(initialCapacity);
this.threshold = calculateThreshold(initialCapacity, loadFactor);
this.data = new HashEntry[initialCapacity];
init();
}
/**
* Constructor copying elements from another map.
*
* @param map the map to copy
* @throws NullPointerException if the map is null
*/
protected AbstractHashedMap(final Map<? extends K, ? extends V> map) {
this(Math.max(2 * map.size(), DEFAULT_CAPACITY), DEFAULT_LOAD_FACTOR);
_putAll(map);
}
/**
* Initialise subclasses during construction, cloning or deserialization.
*/
protected void init() {
}
//-----------------------------------------------------------------------
/**
* Gets the value mapped to the key specified.
*
* @param key the key
* @return the mapped value, null if no match
*/
@Override
public V get(Object key) {
key = convertKey(key);
final int hashCode = hash(key);
HashEntry<K, V> entry = data[hashIndex(hashCode, data.length)]; // no local for hash index
while (entry != null) {
if (entry.hashCode == hashCode && isEqualKey(key, entry.key)) {
return entry.getValue();
}
entry = entry.next;
}
return null;
}
/**
* Gets the size of the map.
*
* @return the size
*/
@Override
public int size() {
return size;
}
/**
* Checks whether the map is currently empty.
*
* @return true if the map is currently size zero
*/
@Override
public boolean isEmpty() {
return size == 0;
}
//-----------------------------------------------------------------------
/**
* Checks whether the map contains the specified key.
*
* @param key the key to search for
* @return true if the map contains the key
*/
@Override
public boolean containsKey(Object key) {
key = convertKey(key);
final int hashCode = hash(key);
HashEntry<K, V> entry = data[hashIndex(hashCode, data.length)]; // no local for hash index
while (entry != null) {
if (entry.hashCode == hashCode && isEqualKey(key, entry.key)) {
return true;
}
entry = entry.next;
}
return false;
}
/**
* Checks whether the map contains the specified value.
*
* @param value the value to search for
* @return true if the map contains the value
*/
@Override
public boolean containsValue(final Object value) {
if (value == null) {
for (final HashEntry<K, V> element : data) {
HashEntry<K, V> entry = element;
while (entry != null) {
if (entry.getValue() == null) {
return true;
}
entry = entry.next;
}
}
} else {
for (final HashEntry<K, V> element : data) {
HashEntry<K, V> entry = element;
while (entry != null) {
if (isEqualValue(value, entry.getValue())) {
return true;
}
entry = entry.next;
}
}
}
return false;
}
//-----------------------------------------------------------------------
/**
* Puts a key-value mapping into this map.
*
* @param key the key to add
* @param value the value to add
* @return the value previously mapped to this key, null if none
*/
@Override
public V put(final K key, final V value) {
final Object convertedKey = convertKey(key);
final int hashCode = hash(convertedKey);
final int index = hashIndex(hashCode, data.length);
HashEntry<K, V> entry = data[index];
while (entry != null) {
if (entry.hashCode == hashCode && isEqualKey(convertedKey, entry.key)) {
final V oldValue = entry.getValue();
updateEntry(entry, value);
return oldValue;
}
entry = entry.next;
}
addMapping(index, hashCode, key, value);
return null;
}
/**
* Puts all the values from the specified map into this map.
* <p>
* This implementation iterates around the specified map and
* uses {@link #put(Object, Object)}.
*
* @param map the map to add
* @throws NullPointerException if the map is null
*/
@Override
public void putAll(final Map<? extends K, ? extends V> map) {
_putAll(map);
}
/**
* Puts all the values from the specified map into this map.
* <p>
* This implementation iterates around the specified map and
* uses {@link #put(Object, Object)}.
* <p>
* It is private to allow the constructor to still call it
* even when putAll is overriden.
*
* @param map the map to add
* @throws NullPointerException if the map is null
*/
private void _putAll(final Map<? extends K, ? extends V> map) {
final int mapSize = map.size();
if (mapSize == 0) {
return;
}
final int newSize = (int) ((size + mapSize) / loadFactor + 1);
ensureCapacity(calculateNewCapacity(newSize));
for (final Entry<? extends K, ? extends V> entry: map.entrySet()) {
put(entry.getKey(), entry.getValue());
}
}
/**
* Removes the specified mapping from this map.
*
* @param key the mapping to remove
* @return the value mapped to the removed key, null if key not in map
*/
@Override
public V remove(Object key) {
key = convertKey(key);
final int hashCode = hash(key);
final int index = hashIndex(hashCode, data.length);
HashEntry<K, V> entry = data[index];
HashEntry<K, V> previous = null;
while (entry != null) {
if (entry.hashCode == hashCode && isEqualKey(key, entry.key)) {
final V oldValue = entry.getValue();
removeMapping(entry, index, previous);
return oldValue;
}
previous = entry;
entry = entry.next;
}
return null;
}
/**
* Clears the map, resetting the size to zero and nullifying references
* to avoid garbage collection issues.
*/
@Override
public void clear() {
modCount++;
final HashEntry<K, V>[] data = this.data;
for (int i = data.length - 1; i >= 0; i--) {
data[i] = null;
}
size = 0;
}
//-----------------------------------------------------------------------
/**
* Converts input keys to another object for storage in the map.
* This implementation masks nulls.
* Subclasses can override this to perform alternate key conversions.
* <p>
* The reverse conversion can be changed, if required, by overriding the
* getKey() method in the hash entry.
*
* @param key the key convert
* @return the converted key
*/
protected Object convertKey(final Object key) {
return key == null ? NULL : key;
}
/**
* Gets the hash code for the key specified.
* This implementation uses the additional hashing routine from JDK1.4.
* Subclasses can override this to return alternate hash codes.
*
* @param key the key to get a hash code for
* @return the hash code
*/
protected int hash(final Object key) {
// same as JDK 1.4
int h = key.hashCode();
h += ~(h << 9);
h ^= h >>> 14;
h += h << 4;
h ^= h >>> 10;
return h;
}
/**
* Compares two keys, in internal converted form, to see if they are equal.
* This implementation uses the equals method and assumes neither key is null.
* Subclasses can override this to match differently.
*
* @param key1 the first key to compare passed in from outside
* @param key2 the second key extracted from the entry via <code>entry.key</code>
* @return true if equal
*/
protected boolean isEqualKey(final Object key1, final Object key2) {
return key1 == key2 || key1.equals(key2);
}
/**
* Compares two values, in external form, to see if they are equal.
* This implementation uses the equals method and assumes neither value is null.
* Subclasses can override this to match differently.
*
* @param value1 the first value to compare passed in from outside
* @param value2 the second value extracted from the entry via <code>getValue()</code>
* @return true if equal
*/
protected boolean isEqualValue(final Object value1, final Object value2) {
return value1 == value2 || value1.equals(value2);
}
/**
* Gets the index into the data storage for the hashCode specified.
* This implementation uses the least significant bits of the hashCode.
* Subclasses can override this to return alternate bucketing.
*
* @param hashCode the hash code to use
* @param dataSize the size of the data to pick a bucket from
* @return the bucket index
*/
protected int hashIndex(final int hashCode, final int dataSize) {
return hashCode & dataSize - 1;
}
//-----------------------------------------------------------------------
/**
* Gets the entry mapped to the key specified.
* <p>
* This method exists for subclasses that may need to perform a multi-step
* process accessing the entry. The public methods in this class don't use this
* method to gain a small performance boost.
*
* @param key the key
* @return the entry, null if no match
*/
protected HashEntry<K, V> getEntry(Object key) {
key = convertKey(key);
final int hashCode = hash(key);
HashEntry<K, V> entry = data[hashIndex(hashCode, data.length)]; // no local for hash index
while (entry != null) {
if (entry.hashCode == hashCode && isEqualKey(key, entry.key)) {
return entry;
}
entry = entry.next;
}
return null;
}
//-----------------------------------------------------------------------
/**
* Updates an existing key-value mapping to change the value.
* <p>
* This implementation calls <code>setValue()</code> on the entry.
* Subclasses could override to handle changes to the map.
*
* @param entry the entry to update
* @param newValue the new value to store
*/
protected void updateEntry(final HashEntry<K, V> entry, final V newValue) {
entry.setValue(newValue);
}
/**
* Reuses an existing key-value mapping, storing completely new data.
* <p>
* This implementation sets all the data fields on the entry.
* Subclasses could populate additional entry fields.
*
* @param entry the entry to update, not null
* @param hashIndex the index in the data array
* @param hashCode the hash code of the key to add
* @param key the key to add
* @param value the value to add
*/
protected void reuseEntry(final HashEntry<K, V> entry, final int hashIndex, final int hashCode,
final K key, final V value) {
entry.next = data[hashIndex];
entry.hashCode = hashCode;
entry.key = key;
entry.value = value;
}
//-----------------------------------------------------------------------
/**
* Adds a new key-value mapping into this map.
* <p>
* This implementation calls <code>createEntry()</code>, <code>addEntry()</code>
* and <code>checkCapacity()</code>.
* It also handles changes to <code>modCount</code> and <code>size</code>.
* Subclasses could override to fully control adds to the map.
*
* @param hashIndex the index into the data array to store at
* @param hashCode the hash code of the key to add
* @param key the key to add
* @param value the value to add
*/
protected void addMapping(final int hashIndex, final int hashCode, final K key, final V value) {
modCount++;
final HashEntry<K, V> entry = createEntry(data[hashIndex], hashCode, key, value);
addEntry(entry, hashIndex);
size++;
checkCapacity();
}
/**
* Creates an entry to store the key-value data.
* <p>
* This implementation creates a new HashEntry instance.
* Subclasses can override this to return a different storage class,
* or implement caching.
*
* @param next the next entry in sequence
* @param hashCode the hash code to use
* @param key the key to store
* @param value the value to store
* @return the newly created entry
*/
protected HashEntry<K, V> createEntry(final HashEntry<K, V> next, final int hashCode, final K key, final V value) {
return new HashEntry<K, V>(next, hashCode, convertKey(key), value);
}
/**
* Adds an entry into this map.
* <p>
* This implementation adds the entry to the data storage table.
* Subclasses could override to handle changes to the map.
*
* @param entry the entry to add
* @param hashIndex the index into the data array to store at
*/
protected void addEntry(final HashEntry<K, V> entry, final int hashIndex) {
data[hashIndex] = entry;
}
//-----------------------------------------------------------------------
/**
* Removes a mapping from the map.
* <p>
* This implementation calls <code>removeEntry()</code> and <code>destroyEntry()</code>.
* It also handles changes to <code>modCount</code> and <code>size</code>.
* Subclasses could override to fully control removals from the map.
*
* @param entry the entry to remove
* @param hashIndex the index into the data structure
* @param previous the previous entry in the chain
*/
protected void removeMapping(final HashEntry<K, V> entry, final int hashIndex, final HashEntry<K, V> previous) {
modCount++;
removeEntry(entry, hashIndex, previous);
size--;
destroyEntry(entry);
}
/**
* Removes an entry from the chain stored in a particular index.
* <p>
* This implementation removes the entry from the data storage table.
* The size is not updated.
* Subclasses could override to handle changes to the map.
*
* @param entry the entry to remove
* @param hashIndex the index into the data structure
* @param previous the previous entry in the chain
*/
protected void removeEntry(final HashEntry<K, V> entry, final int hashIndex, final HashEntry<K, V> previous) {
if (previous == null) {
data[hashIndex] = entry.next;
} else {
previous.next = entry.next;
}
}
/**
* Kills an entry ready for the garbage collector.
* <p>
* This implementation prepares the HashEntry for garbage collection.
* Subclasses can override this to implement caching (override clear as well).
*
* @param entry the entry to destroy
*/
protected void destroyEntry(final HashEntry<K, V> entry) {
entry.next = null;
entry.key = null;
entry.value = null;
}
//-----------------------------------------------------------------------
/**
* Checks the capacity of the map and enlarges it if necessary.
* <p>
* This implementation uses the threshold to check if the map needs enlarging
*/
protected void checkCapacity() {
if (size >= threshold) {
final int newCapacity = data.length * 2;
if (newCapacity <= MAXIMUM_CAPACITY) {
ensureCapacity(newCapacity);
}
}
}
/**
* Changes the size of the data structure to the capacity proposed.
*
* @param newCapacity the new capacity of the array (a power of two, less or equal to max)
*/
@SuppressWarnings("unchecked")
protected void ensureCapacity(final int newCapacity) {
final int oldCapacity = data.length;
if (newCapacity <= oldCapacity) {
return;
}
if (size == 0) {
threshold = calculateThreshold(newCapacity, loadFactor);
data = new HashEntry[newCapacity];
} else {
final HashEntry<K, V> oldEntries[] = data;
final HashEntry<K, V> newEntries[] = new HashEntry[newCapacity];
modCount++;
for (int i = oldCapacity - 1; i >= 0; i--) {
HashEntry<K, V> entry = oldEntries[i];
if (entry != null) {
oldEntries[i] = null; // gc
do {
final HashEntry<K, V> next = entry.next;
final int index = hashIndex(entry.hashCode, newCapacity);
entry.next = newEntries[index];
newEntries[index] = entry;
entry = next;
} while (entry != null);
}
}
threshold = calculateThreshold(newCapacity, loadFactor);
data = newEntries;
}
}
/**
* Calculates the new capacity of the map.
* This implementation normalizes the capacity to a power of two.
*
* @param proposedCapacity the proposed capacity
* @return the normalized new capacity
*/
protected int calculateNewCapacity(final int proposedCapacity) {
int newCapacity = 1;
if (proposedCapacity > MAXIMUM_CAPACITY) {
newCapacity = MAXIMUM_CAPACITY;
} else {
while (newCapacity < proposedCapacity) {
newCapacity <<= 1; // multiply by two
}
if (newCapacity > MAXIMUM_CAPACITY) {
newCapacity = MAXIMUM_CAPACITY;
}
}
return newCapacity;
}
/**
* Calculates the new threshold of the map, where it will be resized.
* This implementation uses the load factor.
*
* @param newCapacity the new capacity
* @param factor the load factor
* @return the new resize threshold
*/
protected int calculateThreshold(final int newCapacity, final float factor) {
return (int) (newCapacity * factor);
}
//-----------------------------------------------------------------------
/**
* Gets the <code>next</code> field from a <code>HashEntry</code>.
* Used in subclasses that have no visibility of the field.
*
* @param entry the entry to query, must not be null
* @return the <code>next</code> field of the entry
* @throws NullPointerException if the entry is null
* @since 3.1
*/
protected HashEntry<K, V> entryNext(final HashEntry<K, V> entry) {
return entry.next;
}
/**
* Gets the <code>hashCode</code> field from a <code>HashEntry</code>.
* Used in subclasses that have no visibility of the field.
*
* @param entry the entry to query, must not be null
* @return the <code>hashCode</code> field of the entry
* @throws NullPointerException if the entry is null
* @since 3.1
*/
protected int entryHashCode(final HashEntry<K, V> entry) {
return entry.hashCode;
}
/**
* Gets the <code>key</code> field from a <code>HashEntry</code>.
* Used in subclasses that have no visibility of the field.
*
* @param entry the entry to query, must not be null
* @return the <code>key</code> field of the entry
* @throws NullPointerException if the entry is null
* @since 3.1
*/
protected K entryKey(final HashEntry<K, V> entry) {
return entry.getKey();
}
/**
* Gets the <code>value</code> field from a <code>HashEntry</code>.
* Used in subclasses that have no visibility of the field.
*
* @param entry the entry to query, must not be null
* @return the <code>value</code> field of the entry
* @throws NullPointerException if the entry is null
* @since 3.1
*/
protected V entryValue(final HashEntry<K, V> entry) {
return entry.getValue();
}
//-----------------------------------------------------------------------
/**
* MapIterator implementation.
*/
protected static class HashMapIterator<K, V> extends HashIterator<K, V> {
protected HashMapIterator(final AbstractHashedMap<K, V> parent) {
super(parent);
}
public K next() {
return super.nextEntry().getKey();
}
public K getKey() {
final HashEntry<K, V> current = currentEntry();
if (current == null) {
throw new IllegalStateException(AbstractHashedMap.GETKEY_INVALID);
}
return current.getKey();
}
public V getValue() {
final HashEntry<K, V> current = currentEntry();
if (current == null) {
throw new IllegalStateException(AbstractHashedMap.GETVALUE_INVALID);
}
return current.getValue();
}
public V setValue(final V value) {
final HashEntry<K, V> current = currentEntry();
if (current == null) {
throw new IllegalStateException(AbstractHashedMap.SETVALUE_INVALID);
}
return current.setValue(value);
}
}
//-----------------------------------------------------------------------
/**
* Gets the entrySet view of the map.
* Changes made to the view affect this map.
*
* @return the entrySet view
*/
@Override
public Set<Entry<K, V>> entrySet() {
if (entrySet == null) {
entrySet = new EntrySet<K, V>(this);
}
return entrySet;
}
/**
* Creates an entry set iterator.
* Subclasses can override this to return iterators with different properties.
*
* @return the entrySet iterator
*/
protected Iterator<Entry<K, V>> createEntrySetIterator() {
if (size() == 0) {
return Collections.<Entry<K, V>>emptySet().iterator();
}
return new EntrySetIterator<K, V>(this);
}
/**
* EntrySet implementation.
*/
protected static class EntrySet<K, V> extends AbstractSet<Entry<K, V>> {
/** The parent map */
private final AbstractHashedMap<K, V> parent;
protected EntrySet(final AbstractHashedMap<K, V> parent) {
super();
this.parent = parent;
}
@Override
public int size() {
return parent.size();
}
@Override
public void clear() {
parent.clear();
}
@Override
public boolean contains(final Object entry) {
if (entry instanceof Map.Entry) {
final Entry<?, ?> e = (Entry<?, ?>) entry;
final Entry<K, V> match = parent.getEntry(e.getKey());
return match != null && match.equals(e);
}
return false;
}
@Override
public boolean remove(final Object obj) {
if (obj instanceof Map.Entry == false) {
return false;
}
if (contains(obj) == false) {
return false;
}
final Entry<?, ?> entry = (Entry<?, ?>) obj;
parent.remove(entry.getKey());
return true;
}
@Override
public Iterator<Entry<K, V>> iterator() {
return parent.createEntrySetIterator();
}
}
/**
* EntrySet iterator.
*/
protected static class EntrySetIterator<K, V> extends HashIterator<K, V> implements Iterator<Entry<K, V>> {
protected EntrySetIterator(final AbstractHashedMap<K, V> parent) {
super(parent);
}
public Entry<K, V> next() {
return super.nextEntry();
}
}
//-----------------------------------------------------------------------
/**
* Gets the keySet view of the map.
* Changes made to the view affect this map.
*
* @return the keySet view
*/
@Override
public Set<K> keySet() {
if (keySet == null) {
keySet = new KeySet<K>(this);
}
return keySet;
}
/**
* Creates a key set iterator.
* Subclasses can override this to return iterators with different properties.
*
* @return the keySet iterator
*/
protected Iterator<K> createKeySetIterator() {
if (size() == 0) {
return Collections.<K>emptySet().iterator();
}
return new KeySetIterator<K>(this);
}
/**
* KeySet implementation.
*/
protected static class KeySet<K> extends AbstractSet<K> {
/** The parent map */
private final AbstractHashedMap<K, ?> parent;
protected KeySet(final AbstractHashedMap<K, ?> parent) {
super();
this.parent = parent;
}
@Override
public int size() {
return parent.size();
}
@Override
public void clear() {
parent.clear();
}
@Override
public boolean contains(final Object key) {
return parent.containsKey(key);
}
@Override
public boolean remove(final Object key) {
final boolean result = parent.containsKey(key);
parent.remove(key);
return result;
}
@Override
public Iterator<K> iterator() {
return parent.createKeySetIterator();
}
}
/**
* KeySet iterator.
*/
protected static class KeySetIterator<K> extends HashIterator<K, Object> implements Iterator<K> {
@SuppressWarnings("unchecked")
protected KeySetIterator(final AbstractHashedMap<K, ?> parent) {
super((AbstractHashedMap<K, Object>) parent);
}
public K next() {
return super.nextEntry().getKey();
}
}
//-----------------------------------------------------------------------
/**
* Gets the values view of the map.
* Changes made to the view affect this map.
*
* @return the values view
*/
@Override
public Collection<V> values() {
if (values == null) {
values = new Values<V>(this);
}
return values;
}
/**
* Creates a values iterator.
* Subclasses can override this to return iterators with different properties.
*
* @return the values iterator
*/
protected Iterator<V> createValuesIterator() {
if (size() == 0) {
return Collections.<V>emptySet().iterator();
}
return new ValuesIterator<V>(this);
}
/**
* Values implementation.
*/
protected static class Values<V> extends AbstractCollection<V> {
/** The parent map */
private final AbstractHashedMap<?, V> parent;
protected Values(final AbstractHashedMap<?, V> parent) {
super();
this.parent = parent;
}
@Override
public int size() {
return parent.size();
}
@Override
public void clear() {
parent.clear();
}
@Override
public boolean contains(final Object value) {
return parent.containsValue(value);
}
@Override
public Iterator<V> iterator() {
return parent.createValuesIterator();
}
}
/**
* Values iterator.
*/
protected static class ValuesIterator<V> extends HashIterator<Object, V> implements Iterator<V> {
@SuppressWarnings("unchecked")
protected ValuesIterator(final AbstractHashedMap<?, V> parent) {
super((AbstractHashedMap<Object, V>) parent);
}
public V next() {
return super.nextEntry().getValue();
}
}
//-----------------------------------------------------------------------
/**
* HashEntry used to store the data.
* <p>
* If you subclass <code>AbstractHashedMap</code> but not <code>HashEntry</code>
* then you will not be able to access the protected fields.
* The <code>entryXxx()</code> methods on <code>AbstractHashedMap</code> exist
* to provide the necessary access.
*/
protected static class HashEntry<K, V> implements Entry<K, V> {
/** The next entry in the hash chain */
protected HashEntry<K, V> next;
/** The hash code of the key */
protected int hashCode;
/** The key */
protected Object key;
/** The value */
protected Object value;
protected HashEntry(final HashEntry<K, V> next, final int hashCode, final Object key, final V value) {
super();
this.next = next;
this.hashCode = hashCode;
this.key = key;
this.value = value;
}
@SuppressWarnings("unchecked")
public K getKey() {
if (key == NULL) {
return null;
}
return (K) key;
}
@SuppressWarnings("unchecked")
public V getValue() {
return (V) value;
}
@SuppressWarnings("unchecked")
public V setValue(final V value) {
final Object old = this.value;
this.value = value;
return (V) old;
}
@Override
public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof Map.Entry == false) {
return false;
}
final Entry<?, ?> other = (Entry<?, ?>) obj;
return
(getKey() == null ? other.getKey() == null : getKey().equals(other.getKey())) &&
(getValue() == null ? other.getValue() == null : getValue().equals(other.getValue()));
}
@Override
public int hashCode() {
return (getKey() == null ? 0 : getKey().hashCode()) ^
(getValue() == null ? 0 : getValue().hashCode());
}
@Override
public String toString() {
return new StringBuilder().append(getKey()).append('=').append(getValue()).toString();
}
}
/**
* Base Iterator
*/
protected static abstract class HashIterator<K, V> {
/** The parent map */
private final AbstractHashedMap<K, V> parent;
/** The current index into the array of buckets */
private int hashIndex;
/** The last returned entry */
private HashEntry<K, V> last;
/** The next entry */
private HashEntry<K, V> next;
/** The modification count expected */
private int expectedModCount;
protected HashIterator(final AbstractHashedMap<K, V> parent) {
super();
this.parent = parent;
final HashEntry<K, V>[] data = parent.data;
int i = data.length;
HashEntry<K, V> next = null;
while (i > 0 && next == null) {
next = data[--i];
}
this.next = next;
this.hashIndex = i;
this.expectedModCount = parent.modCount;
}
public boolean hasNext() {
return next != null;
}
protected HashEntry<K, V> nextEntry() {
if (parent.modCount != expectedModCount) {
throw new ConcurrentModificationException();
}
final HashEntry<K, V> newCurrent = next;
if (newCurrent == null) {
throw new NoSuchElementException(AbstractHashedMap.NO_NEXT_ENTRY);
}
final HashEntry<K, V>[] data = parent.data;
int i = hashIndex;
HashEntry<K, V> n = newCurrent.next;
while (n == null && i > 0) {
n = data[--i];
}
next = n;
hashIndex = i;
last = newCurrent;
return newCurrent;
}
protected HashEntry<K, V> currentEntry() {
return last;
}
public void remove() {
if (last == null) {
throw new IllegalStateException(AbstractHashedMap.REMOVE_INVALID);
}
if (parent.modCount != expectedModCount) {
throw new ConcurrentModificationException();
}
parent.remove(last.getKey());
last = null;
expectedModCount = parent.modCount;
}
@Override
public String toString() {
if (last != null) {
return "Iterator[" + last.getKey() + "=" + last.getValue() + "]";
}
return "Iterator[]";
}
}
//-----------------------------------------------------------------------
/**
* Clones the map without cloning the keys or values.
* <p>
* To implement <code>clone()</code>, a subclass must implement the
* <code>Cloneable</code> interface and make this method public.
*
* @return a shallow clone
* @throws InternalError if {@link AbstractMap#clone()} failed
*/
@Override
@SuppressWarnings("unchecked")
protected AbstractHashedMap<K, V> clone() {
try {
final AbstractHashedMap<K, V> cloned = (AbstractHashedMap<K, V>) super.clone();
cloned.data = new HashEntry[data.length];
cloned.entrySet = null;
cloned.keySet = null;
cloned.values = null;
cloned.modCount = 0;
cloned.size = 0;
cloned.init();
cloned.putAll(this);
return cloned;
} catch (final CloneNotSupportedException ex) {
throw new InternalError();
}
}
/**
* Compares this map with another.
*
* @param obj the object to compare to
* @return true if equal
*/
@Override
public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof Map == false) {
return false;
}
final Map<?,?> map = (Map<?,?>) obj;
if (map.size() != size()) {
return false;
}
final HashMapIterator<?,?> it = new HashMapIterator(this);
try {
while (it.hasNext()) {
final Object key = it.next();
final Object value = it.getValue();
if (value == null) {
if (map.get(key) != null || map.containsKey(key) == false) {
return false;
}
} else {
if (value.equals(map.get(key)) == false) {
return false;
}
}
}
} catch (final ClassCastException ignored) {
return false;
} catch (final NullPointerException ignored) {
return false;
}
return true;
}
/**
* Gets the standard Map hashCode.
*
* @return the hash code defined in the Map interface
*/
@Override
public int hashCode() {
int total = 0;
final Iterator<Entry<K, V>> it = createEntrySetIterator();
while (it.hasNext()) {
total += it.next().hashCode();
}
return total;
}
/**
* Gets the map as a String.
*
* @return a string version of the map
*/
@Override
public String toString() {
if (size() == 0) {
return "{}";
}
final StringBuilder buf = new StringBuilder(32 * size());
buf.append('{');
final HashMapIterator<K, V> it = new HashMapIterator(this);
boolean hasNext = it.hasNext();
while (hasNext) {
final K key = it.next();
final V value = it.getValue();
buf.append(key == this ? "(this Map)" : key)
.append('=')
.append(value == this ? "(this Map)" : value);
hasNext = it.hasNext();
if (hasNext) {
buf.append(',').append(' ');
}
}
buf.append('}');
return buf.toString();
}
}
| [
"sergey.mashkov@jetbrains.com"
] | sergey.mashkov@jetbrains.com |
3dbd3e77a5d11c9faf374f3c0ec39c33cb2655f5 | def65e60efd1ad39013c19bdc50f67347cbe557e | /app/src/main/java/com/pbids/sanqin/session/activity/WatchSnapChatPictureActivity.java | aec6c29a3c8b7e6655c08d412f4b1332c726f5b0 | [] | no_license | dengluo/SanQin-Version-1.2.4 | b60ac2cf58968b23c807101c3f35fc3609095049 | e02166ac3bf6180e6c403420f71ac6eb4bd46b73 | refs/heads/master | 2020-04-02T09:15:22.337720 | 2018-10-23T08:02:43 | 2018-10-23T08:36:22 | 154,284,164 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,771 | java | package com.pbids.sanqin.session.activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.view.View;
import android.view.WindowManager;
import android.widget.Toast;
import com.pbids.sanqin.R;
import com.pbids.sanqin.session.extension.SnapChatAttachment;
import com.netease.nim.uikit.common.activity.UI;
import com.netease.nim.uikit.common.ui.dialog.CustomAlertDialog;
import com.netease.nim.uikit.common.ui.imageview.BaseZoomableImageView;
import com.netease.nim.uikit.common.util.media.BitmapDecoder;
import com.netease.nim.uikit.common.util.media.ImageUtil;
import com.netease.nimlib.sdk.NIMClient;
import com.netease.nimlib.sdk.Observer;
import com.netease.nimlib.sdk.msg.MsgService;
import com.netease.nimlib.sdk.msg.MsgServiceObserve;
import com.netease.nimlib.sdk.msg.constant.AttachStatusEnum;
import com.netease.nimlib.sdk.msg.model.IMMessage;
/**
* 查看阅后即焚消息原图
*/
public class WatchSnapChatPictureActivity extends UI {
private static final String INTENT_EXTRA_IMAGE = "INTENT_EXTRA_IMAGE";
private Handler handler;
private IMMessage message;
private View loadingLayout;
private BaseZoomableImageView image;
protected CustomAlertDialog alertDialog;
private static WatchSnapChatPictureActivity instance;
public static void start(Context context, IMMessage message) {
Intent intent = new Intent();
intent.putExtra(INTENT_EXTRA_IMAGE, message);
intent.setClass(context, WatchSnapChatPictureActivity.class);
context.startActivity(intent);
}
public static void destroy() {
if (instance != null) {
instance.finish();
instance = null;
}
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//取消全屏 不加这名会出现全屏问题
getWindow().clearFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.nim_watch_snapchat_activity);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
onParseIntent();
findViews();
handler = new Handler();
registerObservers(true);
requestOriImage();
instance = this;
}
@Override
protected void onDestroy() {
registerObservers(false);
super.onDestroy();
instance = null;
}
private void onParseIntent() {
this.message = (IMMessage) getIntent().getSerializableExtra(INTENT_EXTRA_IMAGE);
}
private void findViews() {
alertDialog = new CustomAlertDialog(this);
loadingLayout = findViewById(R.id.loading_layout);
image = (BaseZoomableImageView) findViewById(R.id.watch_image_view);
}
private void requestOriImage() {
if (isOriginImageHasDownloaded(message)) {
onDownloadSuccess(message);
return;
}
// async download original image
onDownloadStart(message);
NIMClient.getService(MsgService.class).downloadAttachment(message, false);
}
private boolean isOriginImageHasDownloaded(final IMMessage message) {
if (message.getAttachStatus() == AttachStatusEnum.transferred &&
!TextUtils.isEmpty(((SnapChatAttachment) message.getAttachment()).getPath())) {
return true;
}
return false;
}
/**
* ******************************** 设置图片 *********************************
*/
private void setThumbnail() {
String path = ((SnapChatAttachment) message.getAttachment()).getThumbPath();
if (!TextUtils.isEmpty(path)) {
Bitmap bitmap = BitmapDecoder.decodeSampledForDisplay(path);
bitmap = ImageUtil.rotateBitmapInNeeded(path, bitmap);
if (bitmap != null) {
image.setImageBitmap(bitmap);
return;
}
}
image.setImageBitmap(ImageUtil.getBitmapFromDrawableRes(getImageResOnLoading()));
}
private void setImageView(final IMMessage msg) {
String path = ((SnapChatAttachment) msg.getAttachment()).getPath();
if (TextUtils.isEmpty(path)) {
image.setImageBitmap(ImageUtil.getBitmapFromDrawableRes(getImageResOnLoading()));
return;
}
Bitmap bitmap = BitmapDecoder.decodeSampledForDisplay(path, false);
bitmap = ImageUtil.rotateBitmapInNeeded(path, bitmap);
if (bitmap == null) {
Toast.makeText(this, R.string.picker_image_error, Toast.LENGTH_LONG).show();
image.setImageBitmap(ImageUtil.getBitmapFromDrawableRes(getImageResOnFailed()));
} else {
image.setImageBitmap(bitmap);
}
}
private int getImageResOnLoading() {
return R.drawable.nim_image_default;
}
private int getImageResOnFailed() {
return R.drawable.nim_image_download_failed;
}
/**
* ********************************* 下载 ****************************************
*/
private void registerObservers(boolean register) {
NIMClient.getService(MsgServiceObserve.class).observeMsgStatus(statusObserver, register);
}
private Observer<IMMessage> statusObserver = new Observer<IMMessage>() {
@Override
public void onEvent(IMMessage msg) {
if (!msg.isTheSame(message) || isDestroyedCompatible()) {
return;
}
if (msg.getAttachStatus() == AttachStatusEnum.transferred && isOriginImageHasDownloaded(msg)) {
onDownloadSuccess(msg);
} else if (msg.getAttachStatus() == AttachStatusEnum.fail) {
onDownloadFailed();
}
}
};
private void onDownloadStart(final IMMessage msg) {
setThumbnail();
if (TextUtils.isEmpty(((SnapChatAttachment) msg.getAttachment()).getPath())) {
loadingLayout.setVisibility(View.VISIBLE);
} else {
loadingLayout.setVisibility(View.GONE);
}
}
private void onDownloadSuccess(final IMMessage msg) {
loadingLayout.setVisibility(View.GONE);
handler.post(new Runnable() {
@Override
public void run() {
setImageView(msg);
}
});
}
private void onDownloadFailed() {
loadingLayout.setVisibility(View.GONE);
image.setImageBitmap(ImageUtil.getBitmapFromDrawableRes(getImageResOnFailed()));
Toast.makeText(this, R.string.download_picture_fail, Toast.LENGTH_LONG).show();
}
}
| [
"dengluo2008@163.com"
] | dengluo2008@163.com |
b50afecc562439cc7d2878758f56d1d417bf9a63 | 2b92302fc02f8034961beb841f13d7d96c1d21d7 | /SelfPay-hotel/Timer/tops-hotel-order-schedule/src/main/java/com/travelzen/tops/hotel/order/schedule/selfpay/staticfile/updater/ElongStaticFileUpdateScheduler.java | 5e0867d803791ff5e4f40781668681ad43188be3 | [] | no_license | fangleu/tops-hotel | 6761fbbaa4984d6e8ea7c9df9a992bf90fd25e3f | 6dae9939ab672d920dad7a7f33adbb3ab2fa20ef | refs/heads/master | 2021-01-21T04:39:52.045526 | 2016-07-15T05:24:30 | 2016-07-15T05:25:38 | 34,242,862 | 1 | 4 | null | null | null | null | UTF-8 | Java | false | false | 1,517 | java | package com.travelzen.tops.hotel.order.schedule.selfpay.staticfile.updater;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.travelzen.tops.hotel.elong.staticdata.service.IHotelGeoUpdateService;
import com.travelzen.tops.hotel.elong.staticdata.service.IHotelUpdateService;
@Component("elongStaticFileScheduler")
public class ElongStaticFileUpdateScheduler {
private Logger LOG = LoggerFactory.getLogger(this.getClass());
@Resource
private IHotelUpdateService hotelUpdateService = null;
@Resource
private IHotelGeoUpdateService hotelGeoUpdateService = null;
//每天凌晨1点运行
@Scheduled(cron = "${elong.hotelindex.and.details.updater.cron.expression}")
public void hotelIndexAndDetailsUpdater(){
try {
LOG.info("[Elong酒店静态数据更新开始]");
hotelUpdateService.hotelDetailStaticFileUpdate();
LOG.info("[Elong酒店静态数据更新结束]");
} catch (Exception e) {
LOG.error(e.getMessage(),e);
}
}
//每周五凌晨3点运行,更新Elong酒店地理、行政区等信息
@Scheduled(cron = "${elong.geo.updater.cron.expression}")
public void geoUpdater(){
try {
LOG.info("[Elong酒店地理信息更新开始]");
hotelGeoUpdateService.hotelGeoStaticFileUpdate();
LOG.info("[Elong酒店地理信息更新结束]");
} catch (Exception e) {
LOG.error(e.getMessage(),e);
}
}
}
| [
"fanglei.lou@travelzen.com"
] | fanglei.lou@travelzen.com |
a5077f1dc9d7c72a0d8ad8ccde2c220ff07a4ad8 | 40e9092dc121d611ee6c7f768419c536e4787fe5 | /Testes/Teste1/tests/verao_2018_2019/LenValidator.java | 92f5ec172ca37cb7c5af8a5462fe49e4f0fdf824 | [] | no_license | FS-Rocha/PG3-1 | 6941c5f09638552fc7e5b32cd5058d771240cfe0 | 7ea1bbe6bfcd3f315169a5adba9c8a06031adefa | refs/heads/main | 2023-06-24T14:26:44.492828 | 2021-07-26T15:16:23 | 2021-07-26T15:16:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 796 | java | package testes.test1;
/**
* Created by msousa on 4/17/2019.
*/
public class LenValidator extends Validator {
private final int minimum;
private final int maximun;
private LenValidator(String desc, int min, int max ) throws IllegalValidator {
super( desc );
if ( min < 0 || max < 0 )
throw new IllegalValidator( "invalid length");
minimum = min;
maximun = max;
}
public LenValidator(int min, int max ) throws IllegalValidator {
this("length in [" + min + ", " + max + ']', min, max);
}
public LenValidator( int max ) throws IllegalValidator{
this("length less than " + max, 0, max );
}
@Override
public boolean validate(String s) {
return s.length() >= minimum && s.length() <= maximun;
}
}
| [
"bernardocb.pineda@gmail.com"
] | bernardocb.pineda@gmail.com |
8a73ea106d1a097f0027e380180fdb0e1458a5ca | 8c4011fcf86f0ce53e4e71af9b233e59ab8fde91 | /UsbCam/app/src/main/java/com/icatch/usbcam/sdkapi/PanoramaControl.java | 2dd3f747a71f1058d02812b3f555c5232aa3c3f8 | [] | no_license | allenchuang2002/USBCam | 90fa239d4c268c80aae5da3d849b1e027f80039b | 60293beec7644b234dff743b42d5fc6ad3736224 | refs/heads/master | 2023-08-30T03:18:01.828197 | 2020-07-24T02:38:59 | 2020-07-24T02:38:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,545 | java | package com.icatch.usbcam.sdkapi;
import com.icatchtek.pancam.customer.ICatchIPancamControl;
import com.icatchtek.pancam.customer.ICatchIPancamListener;
import com.icatchtek.pancam.customer.ICatchPancamSession;
import com.icatchtek.reliant.customer.exception.IchInvalidSessionException;
import com.icatchtek.reliant.customer.exception.IchListenerExistsException;
import com.icatchtek.reliant.customer.exception.IchListenerNotExistsException;
/**
* Created by b.jiang on 2017/9/15.
*/
public class PanoramaControl {
private ICatchIPancamControl iCatchIPancamControl;
public PanoramaControl(ICatchPancamSession iCatchPancamSession) {
this.iCatchIPancamControl = iCatchPancamSession.getControl();
}
public void addEventListener(int var1, ICatchIPancamListener var2) {
if (iCatchIPancamControl == null) {
return;
}
try {
iCatchIPancamControl.addEventListener(var1, var2);
} catch (IchListenerExistsException e) {
e.printStackTrace();
} catch (IchInvalidSessionException e) {
e.printStackTrace();
}
}
public void removeEventListener(int var1, ICatchIPancamListener var2) {
if (iCatchIPancamControl == null) {
return;
}
try {
iCatchIPancamControl.removeEventListener(var1, var2);
} catch (IchListenerNotExistsException e) {
e.printStackTrace();
} catch (IchInvalidSessionException e) {
e.printStackTrace();
}
}
}
| [
"b.jiang@sunmedia.com.cn"
] | b.jiang@sunmedia.com.cn |
3a6a4dfc02b5886be44ca46feefd4cddec950ed4 | 61602d4b976db2084059453edeafe63865f96ec5 | /com/alipay/android/phone/mrpc/core/d.java | c445fd969246a361c78af9f5a238d0bc15f80a8d | [] | no_license | ZoranLi/thunder | 9d18fd0a0ec0a5bb3b3f920f9413c1ace2beb4d0 | 0778679ef03ba1103b1d9d9a626c8449b19be14b | refs/heads/master | 2020-03-20T23:29:27.131636 | 2018-06-19T06:43:26 | 2018-06-19T06:43:26 | 137,848,886 | 12 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,635 | java | package com.alipay.android.phone.mrpc.core;
import org.apache.http.client.RedirectHandler;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.ConnectionKeepAliveStrategy;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.HttpParams;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.BasicHttpProcessor;
import org.apache.http.protocol.HttpContext;
final class d extends DefaultHttpClient {
final /* synthetic */ b a;
d(b bVar, ClientConnectionManager clientConnectionManager, HttpParams httpParams) {
this.a = bVar;
super(clientConnectionManager, httpParams);
}
protected final ConnectionKeepAliveStrategy createConnectionKeepAliveStrategy() {
return new f(this);
}
protected final HttpContext createHttpContext() {
HttpContext basicHttpContext = new BasicHttpContext();
basicHttpContext.setAttribute("http.authscheme-registry", getAuthSchemes());
basicHttpContext.setAttribute("http.cookiespec-registry", getCookieSpecs());
basicHttpContext.setAttribute("http.auth.credentials-provider", getCredentialsProvider());
return basicHttpContext;
}
protected final BasicHttpProcessor createHttpProcessor() {
BasicHttpProcessor createHttpProcessor = super.createHttpProcessor();
createHttpProcessor.addRequestInterceptor(b.c);
createHttpProcessor.addRequestInterceptor(new a());
return createHttpProcessor;
}
protected final RedirectHandler createRedirectHandler() {
return new e(this);
}
}
| [
"lizhangliao@xiaohongchun.com"
] | lizhangliao@xiaohongchun.com |
644cc826a0f62817ceb8d0569b1ec7619e467eb9 | 3e000f99384dd4acd125bc7d6cdb5b941752e101 | /Students/30221/Muresan M. Eduard/zoowsome/src/models/animals/FireAnt.java | 4d57851551c1519222a9c30994a4274d55e8caf5 | [] | no_license | tudorpalade/OOP-2016 | d04e3afc5f3038cac709652ad45a41ccf5be509c | c20959880ef345eccc4427d03b280754a363d14f | refs/heads/master | 2021-01-12T16:05:07.708550 | 2016-12-01T14:28:24 | 2016-12-01T14:28:24 | 71,931,332 | 0 | 0 | null | 2016-10-25T19:24:00 | 2016-10-25T19:24:00 | null | UTF-8 | Java | false | false | 391 | java | package models.animals;
public class FireAnt extends Insect{
enum Role{queen, drone, other};
private Role role;
public FireAnt()
{
super(false, true, "Unknown");
this.role = null;
}
public FireAnt(String name, Role role)
{
super(false, true, name);
this.role = role;
}
public Role getRole()
{
return role;
}
public void setRole(Role role)
{
this.role = role;
}
}
| [
"m13edi@gmail.com"
] | m13edi@gmail.com |
e432db120559bde09b95310d697c86bee667e7a9 | eda762c6769e68107ba2859fd401569d421908c7 | /src/main/java/za/ac/cput/projects/assignment7crud/repositories/soccergame_repository/CupTournamentRepository.java | 33e04a38fdf85fb4fdab1816a4c5df80e5874824 | [] | no_license | Philranti/assignment7crud | 25fc7a9fbb5b34ead17a7143ec16d039dcbc9ae3 | e15a8f26c9dc65a5a9ca53b2b9f33574df0ff30e | refs/heads/master | 2022-01-30T19:17:01.509147 | 2019-10-20T19:10:37 | 2019-10-20T19:10:37 | 184,562,609 | 0 | 0 | null | 2022-01-21T23:32:12 | 2019-05-02T10:36:10 | Java | UTF-8 | Java | false | false | 405 | java | package za.ac.cput.projects.assignment7crud.repositories.soccergame_repository;
import za.ac.cput.projects.assignment7crud.domains.SoccerGame.CupTournaments;
import za.ac.cput.projects.assignment7crud.repositories.SoccerGameMainRepository;
import java.util.Set;
public interface CupTournamentRepository extends SoccerGameMainRepository<CupTournaments, String> {
Set<CupTournaments> getAll();
}
| [
"philranti@gmail.com"
] | philranti@gmail.com |
764390fe84e4096e88aac27225bcbd4bbf020ee8 | f1942f6cf26b8f56a63e95874f674c94d727e56b | /bin/My_Programs/src/com/bridgelabz/utility/Stack.java | 93e566898a33d890665e57db3277c0eb8c803704 | [] | no_license | nikhil725/BridgeLabz | 38ecd801a6f4c541130a8c8078261dde02a9d847 | c95709619d67402510b978889013186f166eaa20 | refs/heads/master | 2021-09-16T04:25:28.641659 | 2018-06-16T13:05:00 | 2018-06-16T13:05:00 | 116,950,967 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 946 | java | package com.bridgelabz.utility;
import java.util.EmptyStackException;
public class Stack {
public ListNode top;
int length;
public int length(){
return length;
}
public boolean isEmpty(){
return length == 0;
}
public void push(int data){
ListNode temp = new ListNode(data);
temp.next = top;
top = temp;
length++;
}
public int pop(){
if(isEmpty()) {
throw new EmptyStackException();
}
int result = top.data;
top = top.next;
length--;
return result;
}
public int peek()
{
if(isEmpty()){
throw new EmptyStackException();
}
return top.data;
}
public void reverse()
{
if(isEmpty())
{
throw new EmptyStackException();
}
}
public void print()
{
if(isEmpty())
{
return;
}
ListNode current = top;
while(current!= null)
{
System.out.print(current.data + "--> ");
current = current.next;
}
}
}
| [
"nik703.v@gmail.com"
] | nik703.v@gmail.com |
f06e971ed7ed35a679b5a5b9771620941e2aa765 | 7e26598d3f6fc9628411981ab3ea3f1486fbb030 | /src/test/java/com/relationalcloud/routing/SystemWideRouterTest.java | cd33b6117e2035cd870f8becae5ea5b4e982e16f | [] | no_license | curino/relationalcloud | 684acfe05a006980cad19b3556415759a395aff3 | c3b8118b3bc2d65165a3915dac937fc915224b31 | refs/heads/master | 2021-01-21T17:46:05.995231 | 2011-08-20T17:09:31 | 2011-08-20T17:09:31 | 42,575,037 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,888 | java | /*******************************************************************************
* relationalcloud.com
*
* Project Info: http://relationalcloud.com
* Project Members: Carlo Curino <carlo.curino@gmail.com>
* Evan Jones <ej@evanjones.ca>
* Yang Zhang <yaaang@gmail.com>
* Sam Madden <madden@csail.mit.edu>
* This library is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation;
* either version 3.0 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 General Public License for more details.
******************************************************************************/
package com.relationalcloud.routing;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import org.junit.Before;
import org.junit.Test;
import com.relationalcloud.tsqlparser.loader.Schema;
import com.relationalcloud.tsqlparser.loader.SchemaTable;
public class SystemWideRouterTest {
private SystemWideRouter router;
public static final String DBNAME = "dbname";
public static final String VERSION_STRING = "0";
public static final DBVersion dbVersion = new DBVersion(DBNAME, VERSION_STRING);
public static final String TABLE = "t1";
public static final String TABLE2 = "t2";
public static final int PARTITION_ID = 32;
public static final String PARTITION_STRING = Integer.toString(PARTITION_ID);
public static final String SELECT = "SELECT b FROM " + TABLE + " WHERE a = 1";
public static final Schema makeSchema() {
Schema schema = new Schema(null, DBNAME, null, null, null, null);
SchemaTable t = new SchemaTable(TABLE);
t.addColumn("a");
t.addColumn("b");
t.addColumn("c");
t.addColumn("d");
schema.addTable(t);
t = new SchemaTable(TABLE2);
t.addColumn("a");
t.addColumn("b");
t.addColumn("c");
t.addColumn("d");
schema.addTable(t);
return schema;
}
@Before
public void setUp() throws Exception {
router = new SystemWideRouter();
Schema schema = makeSchema();
DBWideRouter dbwr = new DBWideRouter(dbVersion, schema);
dbwr.setUniquePartition(PARTITION_ID);
router.addDBWideRouter(dbwr);
}
@Test
public void testGetStatementMetadata() {
PartitionMap pm = router.getStatementMetadata(DBNAME, VERSION_STRING, SELECT);
assertEquals(1, pm.getNumPartitions());
try {
router.getStatementMetadata("baddb", VERSION_STRING, SELECT);
fail("expected exception");
} catch (RuntimeException e) {
// TODO: throw something more specific?
}
assertEquals(1, pm.getNumPartitions());
}
}
| [
"carlo.curino@gmail.com"
] | carlo.curino@gmail.com |
9b12f522852e73b45e2d1b91b15655b137feee85 | 197b851f5b397f53e144388638de8a3840943a13 | /kodilla testing/src/main/java/com/kodilla/testing/user/TestingMain.java | 6aa01763cf29b94b4947c89e48923485fcecc00f | [] | no_license | MalczewskiKarol/Karol-Malczewski-kodilla-java | 5252f66fcb27dda716a7baac185184678020ab48 | 5bee53d56aaa997eae7dfc65a50ef4b482a31757 | refs/heads/master | 2021-03-30T16:17:53.996652 | 2018-02-18T22:14:09 | 2018-02-18T22:14:09 | 102,531,412 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,035 | java | package com.kodilla.testing.user;
import com.kodilla.testing.user.SimpleUser;
import com.kodilla.testing.calculator.Calculator;
public class TestingMain {
public static void main(String[] args) {
System.out.println("Test - pierwszy test jednostkowy: ");
SimpleUser simpleUser = new SimpleUser("theForumUser", "John Smith"); // dodane realname zeby dzialalo :)
String result = simpleUser.getUserName();
if(result.equals("theForumUser")) {
System.out.println("test OK");
} else {
System.out.println("Error!");
}
System.out.println("===============================================");
System.out.println("Calculator - test: ");
Calculator calculator = new Calculator();
int add = calculator.add(5, 5);
int substract = calculator.substract(10, 5);
if(add == 10 && substract == 5) {
System.out.println("test OK");
} else {
System.out.println("Error!");
}
}
}
| [
"karolmalczewski2@o2.pl"
] | karolmalczewski2@o2.pl |
6d5a78320ab63f167487adee619be5457f6d9418 | f65f61efeb5d1115953e99a32ca5c1aaf5efbf9f | /src/main/java/com/edugility/jaxb/DateAdapter.java | b4a8970b20f4b69652e24eced9cf8d12eaa2f81d | [
"MIT"
] | permissive | ljnelson/jaxb-tools | 75bcceba0c2e1b82376f8b6bd1404934e5efac55 | 4faa074adece0a8ed756bad3356ff0e3c1f9aa7c | refs/heads/master | 2016-09-05T14:41:50.650345 | 2013-08-05T06:25:33 | 2013-08-05T06:25:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,306 | java | /* -*- mode: Java; c-basic-offset: 2; indent-tabs-mode: nil; coding: utf-8-unix -*-
*
* Copyright (c) 2013 Edugility LLC.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* The original copy of this license is available at
* http://www.opensource.org/license/mit-license.html.
*/
package com.edugility.jaxb;
import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;
import javax.xml.bind.annotation.adapters.XmlAdapter;
/**
* An {@link XmlAdapter} that can {@linkplain #marshal(Date) marshal}
* a {@link Date} into a {@link Locale}-sensitive {@link String}.
*
* @author <a href="http://about.me/lairdnelson"
* target="_parent">Laird Nelson</a>
*/
public class DateAdapter extends XmlAdapter<String, Date> {
/*
* Instance fields.
*/
/**
* The {@link DateFormat} to use to format an arbitrary {@link Date}
* into a {@link Date} suitable for consumption by a client.
*
* <p>This field may be {@code null}.</p>
*/
private DateFormat marshalingDateFormat;
/**
* The {@link DateFormat} to use to format an arbitrary {@link
* String} coming from a client into a {@link Date} suitable for
* consumption by the {@link Locale}-independent server.
*
* <p>This field may be {@code null}, in which case the return value
* from {@link DateFormat#getInstance(Locale)
* DateFormat#getInstance(Locale.getDefault())} will be used
* instead.</p>
*/
private DateFormat unmarshalingDateFormat;
private boolean synchronize;
/*
* Constructors.
*/
public DateAdapter() {
this(null, false);
}
public DateAdapter(final DateFormat marshalingDateFormat) {
this(marshalingDateFormat, false);
}
public DateAdapter(final DateFormat marshalingDateFormat, final boolean synchronize) {
super();
this.setSynchronize(synchronize);
this.setMarshalingDateFormat(marshalingDateFormat);
}
/*
* Instance methods.
*/
public boolean getSynchronize() {
return this.synchronize;
}
public void setSynchronize(final boolean synchronize) {
this.synchronize = synchronize;
}
public DateFormat getMarshalingDateFormat() {
return this.marshalingDateFormat;
}
public void setMarshalingDateFormat(final DateFormat marshalingDateFormat) {
this.marshalingDateFormat = marshalingDateFormat;
}
public DateFormat getUnmarshalingDateFormat() {
return this.unmarshalingDateFormat;
}
public void setUnmarshalingDateFormat(final DateFormat unmarshalingDateFormat) {
this.unmarshalingDateFormat = unmarshalingDateFormat;
}
@Override
public String marshal(Date date) throws Exception {
final String localizedDate;
if (date == null) {
date = new Date(0L);
}
assert date != null;
DateFormat marshalingDateFormat = this.getMarshalingDateFormat();
if (marshalingDateFormat == null) {
marshalingDateFormat = DateFormat.getInstance();
}
if (marshalingDateFormat == null) {
localizedDate = date.toString();
} else if (this.synchronize) {
synchronized (marshalingDateFormat) {
localizedDate = marshalingDateFormat.format(date);
}
} else {
localizedDate = marshalingDateFormat.format(date);
}
return localizedDate;
}
@Override
public Date unmarshal(String localizedDate) throws Exception {
final Date date;
if (localizedDate == null) {
date = new Date(0L);
} else {
localizedDate = localizedDate.trim();
DateFormat unmarshalingDateFormat = this.getUnmarshalingDateFormat();
if (unmarshalingDateFormat == null) {
unmarshalingDateFormat = DateFormat.getInstance();
}
if (unmarshalingDateFormat == null) {
final DateFormat dateFormat = DateFormat.getInstance();
if (dateFormat == null) {
@SuppressWarnings("deprecation")
final Date d = new Date(Date.parse(localizedDate));
date = d;
} else {
date = dateFormat.parse(localizedDate);
}
} else if (this.synchronize) {
synchronized (unmarshalingDateFormat) {
date = unmarshalingDateFormat.parse(localizedDate);
}
} else {
date = unmarshalingDateFormat.parse(localizedDate);
}
}
return date;
}
}
| [
"ljnelson@gmail.com"
] | ljnelson@gmail.com |
a2abdd44d72fdec8335774e4bd0024efa67b894d | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /api-vs-impl-small/domain/src/main/java/org/gradle/testdomain/performancenull_24/Productionnull_2350.java | 8e527113dc63c21fd46d47c7fa3e8a11c9c60960 | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 591 | java | package org.gradle.testdomain.performancenull_24;
public class Productionnull_2350 {
private final String property;
public Productionnull_2350(String param) {
this.property = param;
}
public String getProperty() {
return property;
}
private String prop0;
public String getProp0() {
return prop0;
}
public void setProp0(String value) {
prop0 = value;
}
private String prop1;
public String getProp1() {
return prop1;
}
public void setProp1(String value) {
prop1 = value;
}
}
| [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
3a9dc9952ca3310b57162e6eb2b1205d1ea76c86 | 033bdb40120ac60441f09218a193a8cf433c04e0 | /src/com/hisrv/android/netusage/MainActivity.java | 920881800af504283a709cac6905a900631040bd | [] | no_license | iamzhaozheng/NetFlowUsage | 41396e72e61f516d59d1e87b899a1a262f8dba2d | 8f83b9278d21fbc789a29f25f9ea898c370db544 | refs/heads/master | 2021-01-25T07:08:15.279811 | 2014-04-04T09:51:00 | 2014-04-04T09:51:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,458 | java | package com.hisrv.android.netusage;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.Header;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends Activity {
private ImageView mImageRand;
private ProgressDialog mProgressDialog;
private EditText mEditRand, mEditPhone;
private TextView mTextStatus, mTextType, mTextPeriod, mTextUsage,
mTextTotal;
private String mSession;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mImageRand = (ImageView) findViewById(R.id.image_rand);
mEditRand = (EditText) findViewById(R.id.edit_rand);
mEditPhone = (EditText) findViewById(R.id.edit_phone);
mTextType = (TextView) findViewById(R.id.text_type);
mTextPeriod = (TextView) findViewById(R.id.text_period);
mTextUsage = (TextView) findViewById(R.id.text_usage);
mTextTotal = (TextView) findViewById(R.id.text_total);
mTextStatus = (TextView) findViewById(R.id.text_status);
mEditPhone.setText(loadPhoneNumber());
mImageRand.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
new RandTask().execute();
}
});
findViewById(R.id.btn_query).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
savePhoneNumber(mEditPhone.getText().toString());
new QueryTask().execute();
}
});
new RandTask().execute();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
private Bitmap getRandImage() {
HttpGet httpGet = new HttpGet(Urls.CAPTCHA);
HttpClient httpClient = new DefaultHttpClient();
try {
HttpResponse resp = httpClient.execute(httpGet);
Header[] headers = resp.getHeaders("Set-Cookie");
if (headers.length > 0) {
mSession = headers[0].getValue();
}
if (resp.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
InputStream is = resp.getEntity().getContent();
return BitmapFactory.decodeStream(is);
} else {
return null;
}
} catch (ClientProtocolException e) {
e.printStackTrace();
return null;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
private FlowInfo queryFlowInfo(String phone, String captcha) {
try {
List<BasicNameValuePair> list = new ArrayList<BasicNameValuePair>();
list.add(new BasicNameValuePair("num", phone));
list.add(new BasicNameValuePair("code", captcha));
HttpPost post = new HttpPost(Urls.QUERY);
post.setEntity(new UrlEncodedFormEntity(list, HTTP.UTF_8));
post.setHeader("Cookie", mSession);
HttpClient httpClient = new DefaultHttpClient();
HttpResponse resp = httpClient.execute(post);
String data = EntityUtils.toString(resp.getEntity(), HTTP.UTF_8);
JSONObject json = new JSONObject(data);
int ret = json.getInt("ret");
FlowInfo info = new FlowInfo();
info.error = ret;
if (ret == 0) {
JSONObject item = json.getJSONObject("item");
info.type = item.getString("tctype");
info.usage = item.getString("usedflow");
info.total = item.getString("totalamount");
info.period = item.getString("createtime") + "~"
+ item.getString("etime");
info.status = item.getString("status");
}
return info;
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
private void showProgressDialog(int strId) {
mProgressDialog = ProgressDialog.show(this, null, getString(strId));
}
private void hideProgressDialog() {
mProgressDialog.dismiss();
}
private void savePhoneNumber(String number) {
SharedPreferences sp = PreferenceManager
.getDefaultSharedPreferences(this);
sp.edit().putString("phone", number).commit();
}
private String loadPhoneNumber() {
SharedPreferences sp = PreferenceManager
.getDefaultSharedPreferences(this);
return sp.getString("phone", "");
}
private class RandTask extends AsyncTask<Void, Void, Bitmap> {
@Override
protected void onPreExecute() {
showProgressDialog(R.string.fetching_captcha);
}
@Override
protected Bitmap doInBackground(Void... params) {
return getRandImage();
}
@Override
protected void onPostExecute(Bitmap result) {
hideProgressDialog();
if (result == null) {
Toast.makeText(MainActivity.this, R.string.err_network,
Toast.LENGTH_LONG).show();
finish();
} else {
mImageRand.setImageBitmap(result);
}
}
}
private class QueryTask extends AsyncTask<Void, Void, FlowInfo> {
@Override
protected void onPreExecute() {
showProgressDialog(R.string.querying);
}
@Override
protected FlowInfo doInBackground(Void... params) {
return queryFlowInfo(mEditPhone.getText().toString(), mEditRand
.getText().toString());
}
@Override
protected void onPostExecute(FlowInfo result) {
hideProgressDialog();
new RandTask().execute();
if (result == null) {
Toast.makeText(MainActivity.this, R.string.err_network,
Toast.LENGTH_SHORT).show();
} else if (result.error == FlowInfo.ERR_PHONE) {
Toast.makeText(MainActivity.this, R.string.err_phone,
Toast.LENGTH_SHORT).show();
} else if (result.error == FlowInfo.ERR_CAPTCHA) {
Toast.makeText(MainActivity.this, R.string.err_captcha,
Toast.LENGTH_SHORT).show();
} else if (result.error == FlowInfo.SUCCESSED) {
mTextUsage.setText(result.usage);
mTextTotal.setText(result.total);
mTextStatus.setText(result.status);
mTextPeriod.setText(result.period);
mTextType.setText(result.type);
} else {
Toast.makeText(MainActivity.this, R.string.err_network,
Toast.LENGTH_SHORT).show();
}
}
}
}
| [
"zhengzhaomail@gmail.com"
] | zhengzhaomail@gmail.com |
a2edba8c046138e9e85792f26e66a3163dbd906e | 08f52146f0640cb4fd859ed37f40094ccf270171 | /src/models/datatypes/CharType.java | ab67567d8b6331323b06b3be70da91108a4cca39 | [] | no_license | dzimiks/InfViewer | 091111f463e37c151295a5f11effef3dd2aa6707 | 5e45c8a7f967e82cdb1f335fbc84b52c93e89c88 | refs/heads/master | 2020-03-23T16:28:53.411246 | 2020-03-01T14:21:02 | 2020-03-01T14:21:02 | 141,811,991 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 961 | java | package models.datatypes;
import java.io.Serializable;
@SuppressWarnings("serial")
public class CharType implements Comparable<CharType>, Serializable {
private String string;
private int length;
public CharType(int length, String data) {
this.length = length;
this.string = data;
}
public String get() {
return string;
}
public void set(String s) throws Exception {
if (s.length() != length) {
throw new Exception("String of length " + s.length() +
" cannot be assigned to char (" + length + ")");
}
this.string = s;
}
public String getString() {
return string;
}
@Override
public String toString() {
return string;
}
@Override
public int compareTo(CharType type) {
return string.compareTo(type.string);
}
@Override
public boolean equals(Object obj) {
if(!(obj instanceof CharType))
return false;
CharType charType = (CharType) obj;
return this.string.equals(charType.getString());
}
}
| [
"vana997@gmail.com"
] | vana997@gmail.com |
c297aa8ef8ccefd95d3150021bd57e13442ef3f0 | d79267db937d2a83979b6915b3dda9652b9bd854 | /src/main/java/com/codegym/cms/AppConfig.java | 033cbafd9d2e0b21276abf158c387d7319edfe23 | [] | no_license | spring-web-backend/restful-customer-management | 8d3a0d1b2212c33b3a739e14bd8d56f7d168337d | fbd29c06d94e83bd7187f1cc732bb67c1e471bad | refs/heads/master | 2020-03-27T17:17:30.374405 | 2018-08-31T04:28:50 | 2018-08-31T04:28:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,729 | java | package com.codegym.cms;
import com.codegym.cms.repository.CustomerRepository;
import com.codegym.cms.repository.CustomerRepositoryImpl;
import com.codegym.cms.repository.CustomerRepositoryImpl;
import com.codegym.cms.service.CustomerService;
import com.codegym.cms.service.CustomerServiceImpl;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.JpaVendorAdapter;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import java.util.Properties;
@Configuration
@EnableWebMvc
@EnableTransactionManagement
@ComponentScan("com.codegym.cms")
public class AppConfig extends WebMvcConfigurerAdapter implements ApplicationContextAware {
private ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
@Bean
public CustomerRepository customerRepository(){
return new CustomerRepositoryImpl();
}
@Bean
public CustomerService customerService(){
return new CustomerServiceImpl();
}
//JPA configuration
@Bean
@Qualifier(value = "entityManager")
public EntityManager entityManager(EntityManagerFactory entityManagerFactory) {
return entityManagerFactory.createEntityManager();
}
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource());
em.setPackagesToScan("com.codegym.cms.model");
JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
em.setJpaVendorAdapter(vendorAdapter);
em.setJpaProperties(additionalProperties());
return em;
}
@Bean
public DataSource dataSource(){
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://localhost:3306/cms");
dataSource.setUsername( "root" );
dataSource.setPassword( "123456" );
return dataSource;
}
@Bean
public PlatformTransactionManager transactionManager(EntityManagerFactory emf){
JpaTransactionManager transactionManager = new JpaTransactionManager();
transactionManager.setEntityManagerFactory(emf);
return transactionManager;
}
Properties additionalProperties() {
Properties properties = new Properties();
properties.setProperty("hibernate.hbm2ddl.auto", "update");
properties.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect");
return properties;
}
} | [
"minhlee.fre.mta@gmail.com"
] | minhlee.fre.mta@gmail.com |
c2fe981fbf9e036b49139bee1eb66efea38b3833 | aa0d4d64ff3b2641692e609e52407b7ecd211dd9 | /src/main/java/com/bolsadeideas/springboot/app/MvcConfig.java | 4a214c20e0aa5408484846fb6f1e9df54704f874 | [] | no_license | prietomoral/spring-boot-jwt | a31a64e16a029f866510e879e4cadbb906d0629b | bad955eddb23d441e125eaa8f3589aeb4c84862e | refs/heads/master | 2020-03-27T07:53:10.036871 | 2018-08-30T15:33:18 | 2018-08-30T15:33:18 | 146,201,301 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,568 | java | package com.bolsadeideas.springboot.app;
import java.util.Locale;
import org.springframework.context.annotation.Bean;
//import java.nio.file.Paths;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.oxm.jaxb.Jaxb2Marshaller;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
import org.springframework.web.servlet.i18n.SessionLocaleResolver;
//import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
@Configuration
public class MvcConfig implements WebMvcConfigurer {
/*private final Logger log = LoggerFactory.getLogger(getClass());
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
// TODO Auto-generated method stub
super.addResourceHandlers(registry);
String resourcePath = Paths.get("uploads").toAbsolutePath().toUri().toString();
log.info(resourcePath);
registry.addResourceHandler("/uploads/**")
.addResourceLocations(resourcePath);
}*/
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/error_403").setViewName("error_403");
}
@Bean
public BCryptPasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
@Bean
public LocaleResolver localeResolver() {
SessionLocaleResolver localeResolver = new SessionLocaleResolver();
localeResolver.setDefaultLocale(new Locale("es", "ES"));
return localeResolver;
}
@Bean
public LocaleChangeInterceptor localeChangeInterceptor() {
LocaleChangeInterceptor localeInterceptor = new LocaleChangeInterceptor();
localeInterceptor.setParamName("lang");
return localeInterceptor;
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
// TODO Auto-generated method stub
registry.addInterceptor(localeChangeInterceptor());
}
@Bean
public Jaxb2Marshaller jaxb2Marshaller() {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
marshaller.setClassesToBeBound(new Class[] {com.bolsadeideas.springboot.app.view.xml.ClienteList.class});
return marshaller;
}
}
| [
"Luis@DESKTOP-6P5KRML.home"
] | Luis@DESKTOP-6P5KRML.home |
49d7dc90565ce3c962de7c87766e690f64ea5ff5 | 5582e7b84b2331a623f483b3b8f53ded9a2e7ed2 | /weather/src/main/java/com/aibabel/weather/utils/NetUtil.java | 6144094997bed1158493717051166a8448557581 | [] | no_license | 571034884/zhuner | 451fc9b2ecae06d83ed32b20e4ddb780095b5582 | 6879d978f0c55fe33a46b46117a097131e3b1b65 | refs/heads/master | 2022-01-14T07:08:13.537239 | 2019-03-26T07:09:44 | 2019-03-26T07:09:44 | 189,947,004 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,500 | java | package com.aibabel.weather.utils;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
/**
* 作者 : 张文颖
* 时间: 2018/3/14
* 描述:
*/
public class NetUtil {
/* 网络状态 */
public static boolean isNet = true;
public static enum netType
{
wifi, CMNET, CMWAP, noneNet
}
/**
* @方法说明:判断WIFI网络是否可用
* @方法名称:isWifiConnected
* @param context
* @return
* @返回值:boolean
*/
public static boolean isWifiConnected(Context context)
{
if (context != null)
{
ConnectivityManager mConnectivityManager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mWiFiNetworkInfo = mConnectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
if (mWiFiNetworkInfo != null)
{
return mWiFiNetworkInfo.isAvailable();
}
}
return false;
}
/**
* @方法说明:判断MOBILE网络是否可用
* @方法名称:isMobileConnected
* @param context
* @return
* @返回值:boolean
*/
public static boolean isMobileConnected(Context context)
{
if (context != null)
{
ConnectivityManager mConnectivityManager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mMobileNetworkInfo = mConnectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
if (mMobileNetworkInfo != null)
{
return mMobileNetworkInfo.isAvailable();
}
}
return false;
}
/**
* @方法说明:获取当前网络连接的类型信息
* @方法名称:getConnectedType
* @param context
* @return
* @返回值:int
*/
public static int getConnectedType(Context context)
{
if (context != null)
{
ConnectivityManager mConnectivityManager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mNetworkInfo = mConnectivityManager
.getActiveNetworkInfo();
if (mNetworkInfo != null && mNetworkInfo.isAvailable())
{
return mNetworkInfo.getType();
}
}
return -1;
}
/**
* @方法说明:获取当前的网络状态 -1:没有网络 1:WIFI网络2:wap 网络3:net网络
* @方法名称:getAPNType
* @param context
* @return
* @返回值:netType
*/
public static netType getAPNType(Context context)
{
ConnectivityManager connMgr = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
if (networkInfo == null)
{
return netType.noneNet;
}
int nType = networkInfo.getType();
if (nType == ConnectivityManager.TYPE_MOBILE)
{
if (networkInfo.getExtraInfo().toLowerCase().equals("cmnet"))
{
return netType.CMNET;
}
else
{
return netType.CMWAP;
}
} else if (nType == ConnectivityManager.TYPE_WIFI)
{
return netType.wifi;
}
return netType.noneNet;
}
/**
* @方法说明:判断是否有网络连接
* @方法名称:isNetworkConnected
* @param context
* @return
* @返回值:boolean
*/
public static boolean isNetworkConnected(Context context) {
if (context != null) {
ConnectivityManager mConnectivityManager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mNetworkInfo = mConnectivityManager
.getActiveNetworkInfo();
if (mNetworkInfo != null) {
return mNetworkInfo.isAvailable();
}
}
return false;
}
/**
* @方法说明:网络是否可用
* @方法名称:isNetworkAvailable
* @param context
* @return
* @返回值:boolean
*/
public static boolean isNetworkAvailable(Context context)
{
ConnectivityManager mgr = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo[] info = mgr.getAllNetworkInfo();
if (info != null)
{
for (int i = 0; i < info.length; i++)
{
if (info[i].getState() == NetworkInfo.State.CONNECTED)
{
return true;
}
}
}
return false;
}
/**
* @方法说明:判断是否是手机网络
* @方法名称:is4GNet
* @param context
* @return
* @返回值:boolean
*/
public static boolean is4GNet(Context context) {
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetInfo = connectivityManager.getActiveNetworkInfo();
if (activeNetInfo != null && activeNetInfo.getType() == ConnectivityManager.TYPE_MOBILE) {
return true;
}
return false;
}
}
| [
"644959577@qq.com"
] | 644959577@qq.com |
ba04f4e76855dbbedc2e68136e866fa833a2729c | d8b5bb2b6f57cc859ad54e070d822e4287bd1f4e | /src/test/java/WishListTest.java | ab2d9d380be78035fd803b0c4999dd4ea7f8ac35 | [] | no_license | chirilut/FirstSeleniumProject | da694fdc7da90cf75668e2171ac532458b8b6cd5 | eec36713a508e42dea5e7a736b6ee47bc66a82db | refs/heads/master | 2021-02-16T13:25:18.625469 | 2020-03-05T18:30:24 | 2020-03-05T18:30:24 | 244,999,871 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,257 | java | import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class WishListTest {
public static void main(String[] args) {
// addWishlistfirefox();
addWishlist();
}
// NU REUSESC SA DESCHID CU FIREFOX. NU-i BUNA SINTAXA ???
public static void addWishlistfirefox() {
System.setProperty("webdriver.firefox.driver", "resources/geckodriver.exe");
WebDriver driverfirefox = new FirefoxDriver();
driverfirefox.get("http://testfasttrackit.info/selenium-test/");
}
public static void addWishlist() {
System.setProperty("webdriver.chrome.driver", "resources/chromedriver.exe");
WebDriver driverchrome = new ChromeDriver();
driverchrome.get("http://testfasttrackit.info/selenium-test/");
driverchrome.findElement(By.cssSelector("li.level0:nth-child(5) > a:nth-child(1)")).click();
driverchrome.findElement(By.cssSelector("li.item:nth-child(1) > div:nth-child(2) > h2:nth-child(1) > a:nth-child(1)")).click();
driverchrome.findElement(By.cssSelector(".link-wishlist")).click();
driverchrome.quit();
}
}
| [
"chirilut_mihai@uahoo.com"
] | chirilut_mihai@uahoo.com |
db9b25ce259d467ff425a72c21f6bedc41a1ee8b | 89b55f8191698de5ad135623fa17f24cf268b2c9 | /src/main/java/UIComponents/BaseComponent.java | 889daa67d2fafa4eb6037bf13cf3557acf8634f2 | [] | no_license | Viateur/HVtesting | 7a779494a707dd8dc5e6706787fd5337be104a94 | bba8ddfcf688a426a8842b3a5c5b296bcc0e2602 | refs/heads/master | 2022-01-18T10:59:25.366990 | 2020-03-16T20:00:16 | 2020-03-16T20:00:16 | 247,786,270 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,572 | java | package UIComponents;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import java.util.List;
import static Selenium.SeleniumDriver.driver;
import static org.assertj.core.api.Assertions.assertThat;
public class BaseComponent {
public static WebElement getWebElement (By locator){
return driver.findElement(locator);
}
public List<WebElement> getListWebElements (By locator){
return driver.findElements(locator);
}
/** Actions **/
public static void setText(By locator, String text) {
getWebElement(locator).sendKeys(text);
}
public static void clickButton(By locator) {
getWebElement(locator).click();
}
/**read data**/
public static String getText(By locator){
return getWebElement (locator).getText ();
}
/**Check value**/
public static void checkStringValue ( String expectedValue, String obtainedValue){
//String obtainedValueTrimed = obtainedValue.trim();
assertThat(expectedValue).isEqualTo(obtainedValue);
}
public static void checkStringArrayValue ( String[] expectedValue, String[] obtainedValue){
assertThat(expectedValue).isEqualTo(obtainedValue);
}
public static boolean checkWebElementIsDisplayed (By locator){
return getWebElement(locator).isDisplayed ();
}
public static void hoverOn(By locator){
Actions actions = new Actions (driver);
actions.moveToElement(getWebElement(locator)).perform();
}
}
| [
"viateur.ayegnon@gmail.com"
] | viateur.ayegnon@gmail.com |
f5bf4baf7f4b012338342b3d5ab9343d1518d0d5 | 26b525b23a12b88bed5589ff04bf4aebd991d089 | /src/main/java/com/company/gateway/domain/AbstractAuditingEntity.java | 8eeab427efb1bc2791529e0073d8842bd81cf1b2 | [] | no_license | WasimAhmad/GatewayUsingUAA | 801ef4308a45f895234d16411e32a3fe8171ef00 | e79a44993bafd1ea46681bdbda4cd22d8009dfed | refs/heads/master | 2021-05-10T12:13:58.877654 | 2018-01-22T08:47:09 | 2018-01-22T08:47:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,215 | java | package com.company.gateway.domain;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.hibernate.envers.Audited;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import java.time.Instant;
import javax.persistence.Column;
import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
/**
* Base abstract class for entities which will hold definitions for created, last modified by and created,
* last modified by date.
*/
@MappedSuperclass
@Audited
@EntityListeners(AuditingEntityListener.class)
public abstract class AbstractAuditingEntity implements Serializable {
private static final long serialVersionUID = 1L;
@CreatedBy
@Column(name = "created_by", nullable = false, length = 50, updatable = false)
@JsonIgnore
private String createdBy;
@CreatedDate
@Column(name = "created_date", nullable = false)
@JsonIgnore
private Instant createdDate = Instant.now();
@LastModifiedBy
@Column(name = "last_modified_by", length = 50)
@JsonIgnore
private String lastModifiedBy;
@LastModifiedDate
@Column(name = "last_modified_date")
@JsonIgnore
private Instant lastModifiedDate = Instant.now();
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public Instant getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Instant createdDate) {
this.createdDate = createdDate;
}
public String getLastModifiedBy() {
return lastModifiedBy;
}
public void setLastModifiedBy(String lastModifiedBy) {
this.lastModifiedBy = lastModifiedBy;
}
public Instant getLastModifiedDate() {
return lastModifiedDate;
}
public void setLastModifiedDate(Instant lastModifiedDate) {
this.lastModifiedDate = lastModifiedDate;
}
}
| [
"jhipster-bot@users.noreply.github.com"
] | jhipster-bot@users.noreply.github.com |
ea658acaa93014fb06232107015f6db3b7b6a545 | 464b273fb19475f563961330578b2e4477a15fdc | /src/main/java/com/canxue/day/exception/AutoClose.java | cb2ddc27151920acd9a4bc94c34d4571b899742a | [] | no_license | canxueliunian/javathink | 76ad3a449eafabdaa9219bacdc472b4cd6f918c9 | 2a79d3979aaf24cb4299d37ee17208439613e4b8 | refs/heads/master | 2022-06-21T09:35:41.038878 | 2020-04-15T08:38:31 | 2020-04-15T08:38:31 | 213,668,449 | 0 | 0 | null | 2022-06-17T02:33:21 | 2019-10-08T14:37:49 | Java | UTF-8 | Java | false | false | 608 | java | package com.canxue.day.exception;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.PrintWriter;
import java.nio.file.Files;
/**
* @Author Lishuntao
* @Date 2019/10/22
*/
public class AutoClose {
public static void main(String[] args) {
try (
InputStream in = new FileInputStream(new File(""));
PrintWriter outfile = new PrintWriter(
"Results.txt"); // [1]
) {
int read = in.read();
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"1419761729@qq.com"
] | 1419761729@qq.com |
d421fda74a2dc7d30eacbd115ba91bee103ea4e5 | 80e85c4b2929ef6ad4882f3b5e055f6d3ef279f7 | /src/com/company/Lecture6/SubstringIntro.java | d14d190f8c6661d17e2d7bdf7fd47e140fe89960 | [] | no_license | darecoder/Crux-DS-Algo-In-Java | 83b31c508443b5813ad973044854759b7019c526 | cbdf92eaf52cdfc369147c147c637e98e1173389 | refs/heads/master | 2023-04-16T11:02:43.555353 | 2021-04-20T05:10:01 | 2021-04-20T05:10:01 | 195,169,317 | 13 | 5 | null | null | null | null | UTF-8 | Java | false | false | 509 | java | package com.company.Lecture6;
public class SubstringIntro {
public static void main(String[] args) {
String greet = "Hello";
// System.out.println(greet.substring(5, 5)); Gives Empty String
subStrings(greet);
}
public static void subStrings(String line){
for (int i = 0; i < line.length(); i++) {
for (int j = i; j < line.length() ; j++) {
System.out.println(line.substring(i,j+1));
}
}
}
}
| [
"ektamishra1999@gmail.com"
] | ektamishra1999@gmail.com |
4abc6c4dec2c47cb6c0ca632ed391bc357df1aef | aa91f6fae3aca2e93fc06afc43dee9c7985ea733 | /teams/zephyr27_pastrcamp/Bfs.java | 4531bf9b1af3bb9971265cc1eae744bb72536002 | [] | no_license | TheDuck314/battlecode2014 | 6a962a6658c917ed72c15a94c54181d44cadbd9b | 7814de854706484ad9025b7532fb3cc7340971b5 | refs/heads/master | 2016-08-06T16:09:49.119776 | 2014-02-10T02:59:55 | 2014-02-10T02:59:55 | 15,696,204 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 9,067 | java | package zephyr27_pastrcamp;
import battlecode.common.*;
public class Bfs {
private static int NUM_PAGES;
private static int PAGE_SIZE;
private static int MAP_HEIGHT;
private static final int MAX_PAGES = 5;
private static RobotController rc;
public static void init(RobotController theRC) {
rc = theRC;
MAP_HEIGHT = rc.getMapHeight();
PAGE_SIZE = rc.getMapWidth() * MAP_HEIGHT;
NUM_PAGES = Math.min(40000 / PAGE_SIZE, MAX_PAGES);
}
private static final int pageMetadataBaseChannel = GameConstants.BROADCAST_MAX_CHANNELS - 100;
public static final int PRIORITY_HIGH = 2;
public static final int PRIORITY_LOW = 1;
// Page allocation:
// From time to time various different robots will want to use the Bfs class to
// calculate pathing information for various different destinations. In each case, we need
// to be able to answer the following questions:
// - Does a complete, undamaged pathfinding map already exist in some page for the specified destination?
// If so, no point doing any more work on that destination.
// - Is there another robot that is at this very moment computing pathing information for the specified destination?
// If so, no point duplicating their work
// - If no complete undamaged map exists and no other robot is working on the specified destination, is
// there a free page that can be used to build a map for the specified destination? By "free" we mean a
// page that (a) is not at this very moment being added to by another robot and (b) does not contain
// pathing information for a destination more important than the specified one.
// If such a free page exists, we can work on it.
// metadata format:
// fprrrrxxyy
// f = finished or not
// p = priority
// rrrr = round last updated
// xx = dest x coordinate
// yy = dest y coordinate
private static void writePageMetadata(int page, int roundLastUpdated, MapLocation dest, int priority, boolean finished)
throws GameActionException {
int channel = pageMetadataBaseChannel + page;
int data = (finished ? 1000000000 : 0) + 100000000 * priority + 10000 * roundLastUpdated + MAP_HEIGHT * dest.x + dest.y;
rc.broadcast(channel, data);
}
private static boolean getMetadataIsFinished(int metadata) {
return metadata >= 1000000000;
}
private static int getMetadataPriority(int metadata) {
return (metadata % 1000000000) / 100000000;
}
private static int getMetadataRoundLastUpdated(int metadata) {
return (metadata % 100000000) / 10000;
}
private static MapLocation getMetadataDestination(int metadata) {
metadata %= 10000;
return new MapLocation(metadata / MAP_HEIGHT, metadata % MAP_HEIGHT);
}
private static int readPageMetadata(int page) throws GameActionException {
int channel = pageMetadataBaseChannel + page;
int data = rc.readBroadcast(channel);
return data;
}
private static int findFreePage(MapLocation dest, int priority) throws GameActionException {
// see if we can reuse a page we used before
if (dest.equals(previousDest) && previousPage != -1) {
int previousPageMetadata = readPageMetadata(previousPage);
if (getMetadataRoundLastUpdated(previousPageMetadata) == previousRoundWorked && getMetadataDestination(previousPageMetadata).equals(dest)) {
if (getMetadataIsFinished(previousPageMetadata)) {
return -1; // we're done! don't do any work!
} else {
return previousPage;
}
}
}
// Check to see if anyone else is working on this destination. If so, don't bother doing anything.
// But as we loop over pages, look for the page that hasn't been touched in the longest time
int lastRound = Clock.getRoundNum() - 1;
int oldestPage = -1;
int oldestPageRoundUpdated = 999999;
for (int page = 0; page < NUM_PAGES; page++) {
int metadata = readPageMetadata(page);
if (metadata == 0) { // untouched page
if (oldestPageRoundUpdated > 0) {
oldestPage = page;
oldestPageRoundUpdated = 0;
}
} else {
int roundUpdated = getMetadataRoundLastUpdated(metadata);
boolean isFinished = getMetadataIsFinished(metadata);
if (roundUpdated >= lastRound || isFinished) {
if (getMetadataDestination(metadata).equals(dest)) {
return -1; // someone else is on the case!
}
}
if (roundUpdated < oldestPageRoundUpdated) {
oldestPageRoundUpdated = roundUpdated;
oldestPage = page;
}
}
}
// No one else is working on our dest. If we found an inactive page, use that one.
if (oldestPage != -1 && oldestPageRoundUpdated < lastRound) return oldestPage;
// If there aren't any inactive pages, and we have high priority, just trash page 0:
if (priority == PRIORITY_HIGH) return 0;
// otherwise, give up:
return -1;
}
// Set up the queue
private static MapLocation[] locQueue = new MapLocation[GameConstants.MAP_MAX_WIDTH * GameConstants.MAP_MAX_HEIGHT];
private static int locQueueHead = 0;
private static int locQueueTail = 0;
private static boolean[][] wasQueued = new boolean[GameConstants.MAP_MAX_WIDTH][GameConstants.MAP_MAX_HEIGHT];
private static Direction[] dirs = new Direction[] { Direction.NORTH_WEST, Direction.SOUTH_WEST, Direction.SOUTH_EAST, Direction.NORTH_EAST,
Direction.NORTH, Direction.WEST, Direction.SOUTH, Direction.EAST };
private static int[] dirsX = new int[] { 1, 1, -1, -1, 0, 1, 0, -1 };
private static int[] dirsY = new int[] { 1, -1, -1, 1, 1, 0, -1, 0 };
private static MapLocation previousDest = null;
private static int previousRoundWorked = -1;
private static int previousPage = -1;
// initialize the BFS algorithm
private static void initQueue(MapLocation dest) {
locQueueHead = 0;
locQueueTail = 0;
wasQueued = new boolean[GameConstants.MAP_MAX_WIDTH][GameConstants.MAP_MAX_HEIGHT];
// Push dest onto queue
locQueue[locQueueTail] = dest;
locQueueTail++;
wasQueued[dest.x][dest.y] = true;
}
// HQ or pastr calls this function to spend spare bytecodes computing paths for soldiers
public static void work(MapLocation dest, int priority, int bytecodeLimit) throws GameActionException {
int page = findFreePage(dest, priority);
Debug.indicate("path", 1, "BFS Pathing to " + dest.toString() + "; using page " + page);
if (page == -1) return; // We can't do any work, or don't have to
if (!dest.equals(previousDest)) {
Debug.indicate("path", 0, "BFS initingQueue");
initQueue(dest);
} else {
Debug.indicate("path", 0, "BFS queue already inited");
}
previousDest = dest;
previousRoundWorked = Clock.getRoundNum();
previousPage = page;
int mapWidth = rc.getMapWidth();
int mapHeight = rc.getMapHeight();
MapLocation enemyHQ = rc.senseEnemyHQLocation();
boolean destInSpawn = dest.distanceSquaredTo(enemyHQ) <= 25;
while (locQueueHead != locQueueTail && Clock.getBytecodeNum() < bytecodeLimit) {
// pop a location from the queue
MapLocation loc = locQueue[locQueueHead];
locQueueHead++;
int locX = loc.x;
int locY = loc.y;
for (int i = 8; i-- > 0;) {
int x = locX + dirsX[i];
int y = locY + dirsY[i];
if (x >= 0 && y >= 0 && x < mapWidth && y < mapHeight && !wasQueued[x][y]) {
MapLocation newLoc = new MapLocation(x, y);
if (rc.senseTerrainTile(newLoc) != TerrainTile.VOID && (destInSpawn || !Bot.isInTheirHQAttackRange(newLoc))) {
publishResult(page, newLoc, dest, dirs[i]);
// push newLoc onto queue
locQueue[locQueueTail] = newLoc;
locQueueTail++;
wasQueued[x][y] = true;
}
}
}
}
boolean finished = locQueueHead == locQueueTail;
Debug.indicate("path", 2, "BFS finished = " + finished + "; locQueueHead = " + locQueueHead);
writePageMetadata(page, Clock.getRoundNum(), dest, priority, finished);
}
private static int locChannel(int page, MapLocation loc) {
return PAGE_SIZE * page + MAP_HEIGHT * loc.x + loc.y;
}
// We store the data in this format:
// 10d0xxyy
// 1 = validation to prevent mistaking the initial 0 value for a valid pathing instruction
// d = direction to move
// xx = x coordinate of destination
// yy = y coordinate of destination
private static void publishResult(int page, MapLocation here, MapLocation dest, Direction dir) throws GameActionException {
int data = 10000000 + (dir.ordinal() * 100000) + (dest.x * MAP_HEIGHT) + (dest.y);
int channel = locChannel(page, here);
rc.broadcast(channel, data);
}
// Soldiers call this to get pathing directions
public static Direction readResult(MapLocation here, MapLocation dest) throws GameActionException {
for (int page = 0; page < NUM_PAGES; page++) {
int data = rc.readBroadcast(locChannel(page, here));
if (data != 0) { // all valid published results are != 0
data -= 10000000;
if (((dest.x * MAP_HEIGHT) + (dest.y)) == (data % 100000)) {
return Direction.values()[data / 100000];
}
}
}
return null;
}
}
| [
"gem2128@columbia.edu"
] | gem2128@columbia.edu |
5dacb3a3dfb485f651992393ea5cbe79f2c19418 | c3d31e0b12f7619a077c86ffb1a503c3799111c2 | /spring_mvc_board/src/main/java/com/javalec/spring_pjt_board_command/BReplyCommand.java | 36aaf12d5a51c92c2e2ba0beee0739abce91b0ae | [] | no_license | sUpniverse/worm_spring | 89b011027f8a0de26da1250bd523f2abb141742f | b6afd4314082ba472128212aa325fd03d6e3f828 | refs/heads/master | 2021-04-28T17:01:39.638329 | 2018-07-04T13:44:35 | 2018-07-04T13:44:35 | 121,844,858 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 854 | java | package com.javalec.spring_pjt_board_command;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.ui.Model;
import com.javalec.spring_pjt_board_dao.BDao;
public class BReplyCommand implements BCommand{
@Override
public void execute(Model model) {
Map<String, Object> map = model.asMap();
HttpServletRequest request = (HttpServletRequest)map.get("request");
String bId = request.getParameter("bId");
String bName = request.getParameter("bName");
String bTitle = request.getParameter("bTitle");
String bContent = request.getParameter("bContent");
String bGroup = request.getParameter("bGroup");
String bStep = request.getParameter("bStep");
String bIndent = request.getParameter("bIndent");
BDao dao = new BDao();
dao.reply(bId,bName,bTitle,bContent,bGroup,bStep,bIndent);
}
}
| [
"kmsup2@gmail.com"
] | kmsup2@gmail.com |
a334a1cdc2554a38e5b013a931e20574cd1bf921 | bbf5ce34f6a0ea1444b0d6c09d3beca2e541e17d | /src/main/java/Ui.java | b5ea81c7f1de4a314b77e306883201264234e90b | [] | no_license | jinwentay/duke | ade3430844097655668d9e9405039f25d480ab97 | df7e7b13fa6cf0c5256ee5259a0b1055d6cf5d2f | refs/heads/master | 2020-07-09T09:08:01.003630 | 2019-09-12T06:07:03 | 2019-09-12T06:07:03 | 203,936,479 | 0 | 0 | null | 2019-08-23T06:20:33 | 2019-08-23T06:20:32 | null | UTF-8 | Java | false | false | 821 | java | import java.util.Scanner;
public class Ui {
public void showError(String e) {
System.out.println(e);
}
public void showWelcome() {
String logo = " ____ _ \n"
+ "| _ \\ _ _| | _____ \n"
+ "| | | | | | | |/ / _ \\\n"
+ "| |_| | |_| | < __/\n"
+ "|____/ \\__,_|_|\\_\\___|\n";
System.out.println("____________________________________________________________\n"
+ logo);
System.out.println("Hello! I'm Duke\n" +
"What can I do for you?");
System.out.println("____________________________________________________________");
}
public String readCommand() {
Scanner input = new Scanner(System.in);
return input.nextLine();
}
}
| [
"jinwentay@Jins-MacBook-Pro-8.local"
] | jinwentay@Jins-MacBook-Pro-8.local |
729129f69423c857d977aa304d075d01a0a9de9c | 7ba7356ba8e85c43ffcfc3b0590a51e0352797ef | /src/test/java/com/cx/travelrequirements/TravelRequirementsApplicationTests.java | 2e751add55344b1a3611ca6545047f4a5a3a54a8 | [] | no_license | ckymichael/TravelRequirements | a8f08799fb407cec87d8837928d35599b33691ab | ca610c280385cf46eaa3fd4fc256698a10a576a4 | refs/heads/master | 2023-09-02T18:43:56.431907 | 2021-11-14T07:55:41 | 2021-11-14T07:55:41 | 427,869,554 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 238 | java | package com.cx.travelrequirements;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class TravelRequirementsApplicationTests {
@Test
void contextLoads() {
}
}
| [
"michaelcheung1998@gmail.com"
] | michaelcheung1998@gmail.com |
cdedc5410b1ff371f36aee176cc807260870f6fe | 3990e8f0011a2f0093158dbc343b320ee96ab2a2 | /src/suneido/runtime/builtin/Use.java | 9948f2fc51c192cdd03c96c53f01107efd98a6be | [] | no_license | apmckinlay/jsuneido | f73f4a0eea606bba5c9ee1c5f395a67597c50889 | 2534d02ffb4385f59389f86c2fec112bf9a1acfc | refs/heads/master | 2023-08-22T15:18:03.596461 | 2023-08-11T02:24:51 | 2023-08-11T02:24:51 | 28,690,143 | 6 | 26 | null | 2019-03-01T20:01:22 | 2015-01-01T16:22:31 | Java | UTF-8 | Java | false | false | 428 | java | /* Copyright 2009 (c) Suneido Software Corp. All rights reserved.
* Licensed under GPLv2.
*/
package suneido.runtime.builtin;
import suneido.Suneido;
import suneido.TheDbms;
import suneido.runtime.Ops;
import suneido.runtime.Params;
public class Use {
@Params("library")
public static Boolean Use(Object a) {
if (! TheDbms.dbms().use(Ops.toStr(a)))
return false;
Suneido.context.clearAll();
return true;
}
}
| [
"vcschapp@users.noreply.github.com"
] | vcschapp@users.noreply.github.com |
2cdc41c7804862e86f7676e21f75998340ae60c1 | 6c19894c5232fd907214996f96e6d0a6c1f84def | /src/test/java/LocationsTest.java | eb2b3a4b4d901150f5de0bdd9797772381a0f0f0 | [
"MIT"
] | permissive | anzalmohamed/Kanairo | cc2ba77a52782d7d2fbe21ce6351ca32336e1144 | 15e07114f25221bc05039743dc6b3a8ab9fa217d | refs/heads/master | 2023-04-12T02:22:54.384071 | 2021-05-05T21:00:22 | 2021-05-05T21:00:22 | 364,628,350 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,241 | java | import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class LocationsTest {
@BeforeEach
void setUp() {
}
@AfterEach
void tearDown() {
}
private Locations newLocation() {
return new Locations("West","KenCom","KBS",50);
}
@Test
public void locations_canInstantiateCorrectly_boolean() {
Locations locations = newLocation();
assertTrue(locations instanceof Locations);
}
@Test
public void locations_canGetBusNameCorrectly_KBS() {
Locations locations = newLocation();
assertEquals("KBS",locations.getBusName());
}
@Test
public void locations_canGetBusStageCorrectly_KenCom() {
Locations locations = newLocation();
assertEquals("KenCom",locations.getBusStage());
}
@Test
public void locations_canGetLocationCorrectly_west() {
Locations locations = newLocation();
assertEquals("West",locations.getLocation());
}
@Test
public void locations_canGetCostCorrectly_50() {
Locations locations = newLocation();
assertEquals(50,locations.getCost());
}
}
| [
"anzaldidah@gmail.com"
] | anzaldidah@gmail.com |
62c6c8ccc9b88622c67fc1024f88a95a8290e017 | 6c53faaba8d72d7dbab4666923ce7c9e1eef0900 | /src/com/w2a/cucumber/testRunner.java | 13fb419a81ec4f55120fcbe3872a4db09ce0b51c | [] | no_license | yvrkiran/CucumberBasics | 09d7a4f12447d06ebb297ab84d4e945fa11640dd | 3216dab91911c94fff1025037caa38c1ea0e3841 | refs/heads/master | 2021-07-06T11:59:52.773439 | 2021-05-04T23:11:41 | 2021-05-04T23:11:41 | 99,454,449 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 230 | java | package com.w2a.cucumber;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(format = "html:format")
public class testRunner {
}
| [
"yvrkiran@users.noreply.github.com"
] | yvrkiran@users.noreply.github.com |
22613e4c0647fd71ccaf347aa04782905c2929bb | 6b652c78cc0bd67364dbf57e3ee3b41726a3e5bf | /src/main/java/com/hualing365/jiuxiu/controller/UserLogController.java | 820ea484db4e98158377e17029083e86b4f81be0 | [] | no_license | 727288151/jiuxiu | 6b5a9fabccec389b007fc2e7084a009687a2fe1f | 3b1e960f332327d157edf21d31dc529346bf4c18 | refs/heads/master | 2021-04-26T22:20:58.127699 | 2018-07-01T03:42:02 | 2018-07-01T03:42:02 | 124,076,433 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 877 | java | /**
*
*/
package com.hualing365.jiuxiu.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import com.hualing365.jiuxiu.entity.UserLog;
import com.hualing365.jiuxiu.service.IUserLogService;
/**
* 用户日志Controller
* @author im.harley.lee@qq.com
* @since Mar 13, 2018 11:50:49 PM
*/
@RestController
public class UserLogController {
@Autowired
IUserLogService userLogService;
@GetMapping("/querylog/{roomId}/{uid}/{count}")
public List<UserLog> queryUserLog(@PathVariable int roomId, @PathVariable int uid, @PathVariable int count){
return userLogService.queryUserLog(roomId, uid, count);
}
}
| [
"727288151@qq.com"
] | 727288151@qq.com |
e498d5a268bbd91e234b65ec6cf8b1f0c19e4e67 | 5ea191d974fef976eaeeb3ba4b2eb91eca0cdbe6 | /mall-manager-web/src/main/java/com/beemall/manager/controller/SellerController.java | 802ac18ce9557c9c5c03dd796644c8432297493a | [] | no_license | huxiaofeng1995/BeeMall | ad9f41e6b5995a24da48709741e30f46410d5207 | 8d26f747ef5520ba7e23746968af58994def2f8e | refs/heads/master | 2022-07-10T09:15:24.670969 | 2019-07-22T06:45:17 | 2019-07-22T06:45:17 | 192,475,159 | 0 | 0 | null | 2022-06-21T01:18:35 | 2019-06-18T05:58:59 | JavaScript | UTF-8 | Java | false | false | 1,899 | java | package com.beemall.manager.controller;
import java.util.List;
import com.beemall.entity.ResponseData;
import org.springframework.web.bind.annotation.*;
import com.alibaba.dubbo.config.annotation.Reference;
import com.beemall.pojo.TbSeller;
import com.beemall.sellergoods.service.SellerService;
/**
* controller
* @author Administrator
*
*/
@RestController
@RequestMapping("/seller")
public class SellerController {
@Reference
private SellerService sellerService;
/**
* 返回全部列表
* @return
*/
@RequestMapping("/findAll")
public List<TbSeller> findAll(){
return sellerService.findAll();
}
/**
* 返回全部列表
* @return
*/
@GetMapping("/findPage")
public ResponseData findPage(int page, int size){
return sellerService.findPage(page, size);
}
/**
* 增加
* @param seller
* @return
*/
@PostMapping("/add")
public ResponseData add(@RequestBody TbSeller seller){
return sellerService.add(seller);
}
/**
* 修改
* @param seller
* @return
*/
@PostMapping("/update")
public ResponseData update(@RequestBody TbSeller seller){
return sellerService.update(seller);
}
/**
* 获取实体
* @param id
* @return
*/
@GetMapping("/findOne")
public TbSeller findOne(String id){
return sellerService.findOne(id);
}
/**
* 批量删除
* @param ids
* @return
*/
@GetMapping("/delete")
public ResponseData delete(String [] ids){
return sellerService.delete(ids);
}
/**
* 查询+分页
* @param seller
* @param page
* @param size
* @return
*/
@PostMapping("/search")
public ResponseData search(@RequestBody TbSeller seller, int page, int size ){
return sellerService.findPageByExample(seller, page, size);
}
@PostMapping("/updateStatus")
public ResponseData updateStatus(String sellerId, String status){
return sellerService.updateStatus(sellerId, status);
}
}
| [
"huxiaofeng@agree.com.cn"
] | huxiaofeng@agree.com.cn |
283d9c66d270f440d2a3a3263235b4af71ae7b0f | 4905777ec14acf55113524c90fdb9b0ed0ea5d15 | /app/src/main/java/com/example/dyju/thesisapplication/LoginActivity.java | 5c41e0d5a0b532d7791752e613c50dcd3d1862de | [] | no_license | dyju1992/thesisAplication | 7ee8871b780e75cc61b1189f076fcd2d19737508 | 38e825881eb54ce524d9aed67d2ddff0e7fc15c9 | refs/heads/master | 2020-05-24T21:01:37.072645 | 2017-06-04T20:55:08 | 2017-06-04T20:55:08 | 84,880,417 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,850 | java | package com.example.dyju.thesisapplication;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.example.dyju.thesisapplication.ProUsersClasses.ProMenuActivity;
import com.mobsandgeeks.saripaar.ValidationError;
import com.mobsandgeeks.saripaar.Validator;
import com.mobsandgeeks.saripaar.annotation.NotEmpty;
import java.util.List;
import DatabasePackage.DbHandler;
import UsersPackage.User;
public class LoginActivity extends AppCompatActivity implements Validator.ValidationListener {
Validator validator;
Button loginButton;
@NotEmpty(message = "Proszę wprowadzić login")
EditText login;
@NotEmpty(message = "Proszę wprowadzić hasło")
EditText password;
@Override
protected void onCreate(Bundle savedInstanceState){
setTheme(R.style.AppTheme);
super.onCreate(savedInstanceState);
setContentView(R.layout.login_activity);
init();
}
public void init(){
loginButton = (Button)findViewById(R.id.loginUser);
password = (EditText)findViewById(R.id.password);
login = (EditText)findViewById(R.id.login);
validator = new Validator(this);
validator.setValidationListener(this);
loginButton.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
validator.validate();
}
});
}
@Override
public void onValidationSucceeded() {
try{
User user = showUser(getNameValue());
String pass = getPasswordFromTextEdit();
if(pass.equals(user.get_password())){
Toast.makeText(this, "Wprowadzone dane są prawidłowe", Toast.LENGTH_SHORT).show();
loginToValidVersionMenu(user);
}
}catch (NullPointerException e){
Log.e("getUser", "Użytkownik o takim loginie nie istnieje");
Intent intent = new Intent(LoginActivity.this, RegisterActivity.class);
startActivity(intent);
}
}
public User showUser(String name){
DbHandler dbHandler = new DbHandler(this, null, null, 1);
return dbHandler.findUser(name);
}
public void loginToValidVersionMenu(User user){
switch (user.getAccountVersion().getName()){
case "Edukacyjne":
Intent intent = new Intent(LoginActivity.this, EducationMenuActivity.class);
intent.putExtra("user", user);
startActivity(intent);
break;
case "PRO":
Intent intentPro = new Intent(LoginActivity.this, ProMenuActivity.class);
intentPro.putExtra("user", user);
startActivity(intentPro);
break;
default:
Toast.makeText(this, "Twoje konto nie jest poprawne", Toast.LENGTH_LONG).show();
break;
}
}
public void onValidationFailed(List<ValidationError> errors) {
for (ValidationError error : errors) {
View view = error.getView();
String message = error.getCollatedErrorMessage(this);
if (view instanceof EditText) {
((EditText) view).setError(message);
} else {
Toast.makeText(this, message, Toast.LENGTH_LONG).show();
}
}
}
public String getNameValue(){
return String.valueOf(login.getText());
}
public String getPasswordFromTextEdit(){
return String.valueOf(password.getText());
}
}
| [
"dyju1992@gmail.com"
] | dyju1992@gmail.com |
c9b85ada0fde5b20d676751603bc51f23e04b62d | 466abbf8514dde7a104b8c8a0acfe47f942e0618 | /src/com/zhang/json/serializer/BooleanArraySerializer.java | 7ce71d08526d66621594f54235a0a07a3eecaabd | [] | no_license | duyouhua/Auto | 4244ff0c92215567408567852eb0e7b2fc2a86d6 | b721014ab1387296168495b5c228ab2f185e936e | refs/heads/master | 2021-04-29T08:16:08.868407 | 2013-12-08T08:41:41 | 2013-12-08T08:41:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,595 | java | /*
* Copyright 1999-2101 Alibaba Group.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zhang.json.serializer;
import java.io.IOException;
import java.lang.reflect.Type;
/**
* @author wenshao<szujobs@hotmail.com>
*/
public class BooleanArraySerializer implements ObjectSerializer {
public static BooleanArraySerializer instance = new BooleanArraySerializer();
public final void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType) throws IOException {
SerializeWriter out = serializer.getWriter();
if (object == null) {
if (out.isEnabled(SerializerFeature.WriteNullListAsEmpty)) {
out.write("[]");
} else {
out.writeNull();
}
return;
}
boolean[] array = (boolean[]) object;
out.write('[');
for (int i = 0; i < array.length; ++i) {
if (i != 0) {
out.write(',');
}
out.write(array[i]);
}
out.write(']');
}
}
| [
"972803116@qq.com"
] | 972803116@qq.com |
c30881a3a3a95463a7ddb374f1357e0482bc6622 | 5e0000acc9e925fa25078d74487de9d357f4fa09 | /src/main/java/com/bw/pojo/Order.java | 3054060254b67df4b4b1fb3b9cb74d5143a967d2 | [] | no_license | 77muzi/muzi | 240eb021f0acf2202e4abcc9530015956b8dd28c | c06b6388fc996ba93e9659bc672cc9c42199f240 | refs/heads/master | 2021-01-23T14:42:07.240478 | 2017-09-02T01:04:21 | 2017-09-02T01:04:21 | 102,695,838 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 795 | java | package com.bw.pojo;
/**
* @Author:lihongqiong
* @Description:
* @Date:create in 16:01 2017/8/30
*/
public class Order {
private Integer id;
private User user;
private Goods goods;
private Integer goodsAccount;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public Goods getGoods() {
return goods;
}
public void setGoods(Goods goods) {
this.goods = goods;
}
public Integer getGoodsAccount() {
return goodsAccount;
}
public void setGoodsAccount(Integer goodsAccount) {
this.goodsAccount = goodsAccount;
}
}
| [
"you@example.com"
] | you@example.com |
d0ab3d1cebe649eed101c53bdf02ce33c42240ca | db498922f033056092bea67428c28735bdc02783 | /src/main/java/com/example/demo/Services/TKLoaiDTServiceImpl.java | 92b82164594b96896675ad2e964fe74b63e4e0ba | [] | no_license | haubeo1111/doanjava2 | f9794143bf7dd147d62b467f74987dcbcea2c800 | a7b981055e79eb9dc237aea2afd9fcfbfa2c51b1 | refs/heads/master | 2023-01-21T04:45:14.462104 | 2020-11-30T02:28:03 | 2020-11-30T02:28:03 | 317,088,855 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,858 | java | package com.example.demo.Services;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.example.demo.Repository.TKLoaiDTRepository;
import com.example.demo.models.TKLoaiDT;
@Service
public class TKLoaiDTServiceImpl implements TKLoaiDTService {
@Autowired
TKLoaiDTRepository tkLoaiDTRepository;
@Override
public List<TKLoaiDT> getAll() {
return tkLoaiDTRepository.getAll();
}
@Override
public Optional<TKLoaiDT> find(long id) {
return tkLoaiDTRepository.find(id);
}
@Override
public List<TKLoaiDT> findup(String name) {
return tkLoaiDTRepository.findup(name);
}
@Override
public List<TKLoaiDT> findlk(String name) {
return tkLoaiDTRepository.findlk(name);
}
@Override
public TKLoaiDT save(TKLoaiDT entity) {
return tkLoaiDTRepository.save(entity);
}
@Override
public List<TKLoaiDT> saveAll(List<TKLoaiDT> entities) {
return (List<TKLoaiDT>) tkLoaiDTRepository.saveAll(entities);
}
@Override
public Optional<TKLoaiDT> findById(Long id) {
return tkLoaiDTRepository.findById(id);
}
@Override
public boolean existsById(Long id) {
return tkLoaiDTRepository.existsById(id);
}
@Override
public List<TKLoaiDT> findAll() {
return (List<TKLoaiDT>) tkLoaiDTRepository.findAll();
}
@Override
public List<TKLoaiDT> findAllById(List<Long> ids) {
return (List<TKLoaiDT>) tkLoaiDTRepository.findAllById(ids);
}
@Override
public long count() {
return tkLoaiDTRepository.count();
}
@Override
public void deleteById(Long id) {
tkLoaiDTRepository.deleteById(id);
}
@Override
public void delete(TKLoaiDT entity) {
tkLoaiDTRepository.delete(entity);
}
@Override
public void deleteAll(List<TKLoaiDT> entities) {
tkLoaiDTRepository.deleteAll(entities);
}
@Override
public void deleteAll() {
tkLoaiDTRepository.deleteAll();
}
}
| [
"haubeo1111@gmail.com"
] | haubeo1111@gmail.com |
e278acebf245a936b92747bb29b0ca5859d93cfb | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/2/2_1e290a9cb83f798df2844a6d3601f6ba2f0d13c9/CoreMethods/2_1e290a9cb83f798df2844a6d3601f6ba2f0d13c9_CoreMethods_t.java | 0149ee27f9f1be31338d745cb0dda9efbd970f19 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 2,272 | java | package com.runetooncraft.plugins.EasyMobArmory.core;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import com.bergerkiller.bukkit.common.entity.CommonEntity;
public class CoreMethods {
public static Location CheckIfAirBlock(Location loc) {
if(loc.getBlock().getTypeId() == 0) {
return loc;
}else{
loc.setY(loc.getBlockY() + 1);
return CheckIfAirBlock(loc);
}
}
public static List<Entity> GetEntitiesInChunk(Location Chunkloc) {
int x = (int) Chunkloc.getX();
int y = (int) Chunkloc.getY();
int z = (int) Chunkloc.getZ();
List<Entity> Entities = new ArrayList<Entity>();
Chunk chunk = Chunkloc.getWorld().getChunkAt(Chunkloc);
Entity[] ChunkEntities = chunk.getEntities();
for(Entity e : ChunkEntities) {
Entities.add(e);
}
return Entities;
}
public static List<Entity> GetEntitiesInRadius(Location CenterPoint, int Radius) {
List<Entity> EntityList = null;
if(Bukkit.getServer().getPluginManager().getPlugin("BKCommonLib") != null) {
int x = (int) CenterPoint.getX();
int y = (int) CenterPoint.getY();
int z = (int) CenterPoint.getZ();
World BukkitWorld = CenterPoint.getWorld();
CommonEntity entity = CommonEntity.create(EntityType.UNKNOWN);
entity.setLocation(x, y, z,0,0);
entity.spawn(CenterPoint);
EntityList = entity.getNearbyEntities(Radius);
}
return EntityList;
}
public static List<Player> GetPlayersInRadius(Location CenterPoint, int Radius) {
List<Entity> EntityList = GetEntitiesInRadius(CenterPoint,Radius);
List<Player> PlayerList = new ArrayList<Player>();
for(Entity e : EntityList) {
if(e.getType().equals(EntityType.PLAYER)) {
PlayerList.add((Player) e);
}
}
return PlayerList;
}
public static boolean PlayerIsInRadius(Location CenterPoint, int Radius) {
if(GetPlayersInRadius(CenterPoint,Radius).isEmpty()) {
return false;
}else{
return true;
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
b5c10cf63688354349c10dcf311c1e672811645e | 1ce518b09521578e26e79a1beef350e7485ced8c | /source/app/src/main/java/com/google/android/gms/internal/jm.java | 3fb4abc70220da2178a142a77edabea86ab79d89 | [] | no_license | yash2710/AndroidStudioProjects | 7180eb25e0f83d3f14db2713cd46cd89e927db20 | e8ba4f5c00664f9084f6154f69f314c374551e51 | refs/heads/master | 2021-01-10T01:15:07.615329 | 2016-04-03T09:19:01 | 2016-04-03T09:19:01 | 55,338,306 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,375 | java | // 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.google.android.gms.internal;
import android.os.Parcel;
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
// Referenced classes of package com.google.android.gms.internal:
// jn, hk
public final class jm
implements SafeParcelable
{
public static final jn CREATOR = new jn();
final List Wc;
private final String Wd;
private final boolean We;
final List Wf;
private final String Wg;
final List Wh;
private final Set Wi;
private final Set Wj;
private final Set Wk;
final int xM;
jm(int i, List list, String s, boolean flag, List list1, String s1, List list2)
{
xM = i;
List list3;
List list4;
List list5;
if (list == null)
{
list3 = Collections.emptyList();
} else
{
list3 = Collections.unmodifiableList(list);
}
Wc = list3;
if (s == null)
{
s = "";
}
Wd = s;
We = flag;
if (list1 == null)
{
list4 = Collections.emptyList();
} else
{
list4 = Collections.unmodifiableList(list1);
}
Wf = list4;
if (s1 == null)
{
s1 = "";
}
Wg = s1;
if (list2 == null)
{
list5 = Collections.emptyList();
} else
{
list5 = Collections.unmodifiableList(list2);
}
Wh = list5;
Wi = c(Wc);
Wj = c(Wf);
Wk = c(Wh);
}
private static Set c(List list)
{
if (list.isEmpty())
{
return Collections.emptySet();
} else
{
return Collections.unmodifiableSet(new HashSet(list));
}
}
public final int describeContents()
{
jn _tmp = CREATOR;
return 0;
}
public final boolean equals(Object obj)
{
if (this != obj)
{
if (!(obj instanceof jm))
{
return false;
}
jm jm1 = (jm)obj;
if (!Wi.equals(jm1.Wi) || We != jm1.We || !Wg.equals(jm1.Wg) || !Wj.equals(jm1.Wj) || !Wk.equals(jm1.Wk))
{
return false;
}
}
return true;
}
public final int hashCode()
{
Object aobj[] = new Object[5];
aobj[0] = Wi;
aobj[1] = Boolean.valueOf(We);
aobj[2] = Wj;
aobj[3] = Wg;
aobj[4] = Wk;
return hk.hashCode(aobj);
}
public final String jg()
{
return Wd;
}
public final boolean jh()
{
return We;
}
public final String ji()
{
return Wg;
}
public final String toString()
{
return hk.e(this).a("types", Wi).a("placeIds", Wk).a("requireOpenNow", Boolean.valueOf(We)).a("userAccountName", Wg).a("requestedUserDataTypes", Wj).toString();
}
public final void writeToParcel(Parcel parcel, int i)
{
jn _tmp = CREATOR;
jn.a(this, parcel, i);
}
}
| [
"13bce123@nirmauni.ac.in"
] | 13bce123@nirmauni.ac.in |
60b43987e073368d795d001b1321a90af86a790c | 5f5f9c9f1e6c0342fad176a320bb8864559b0b64 | /module-1/12_Polymorphism/lecture-final/java/src/main/java/com/techelevator/farm/OldMacdonald.java | 2b05e0404e69da2c03a0cec678ee23326252e412 | [] | no_license | annakatarina1994/TE | efcf4cd9bc6f8d282b95f7aa5642ef285718ce4d | b95e70994a765057b24e1c835c84e0f83887e50c | refs/heads/master | 2023-02-28T20:06:08.893596 | 2021-02-13T17:39:11 | 2021-02-13T17:39:11 | 331,450,432 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,073 | java | package com.techelevator.farm;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class OldMacdonald {
public static void main(String[] args) {
// FarmAnimal[] farmAnimals = new FarmAnimal[] { new Cow(), new Chicken(), new Pig(),
// new Sheep() };
Singable[] farmAnimals2 = new Singable[] { new Cow(), new Tractor()};
List<Singable> farmAnimals = new ArrayList<>(); // changed T from FarmAnimal(parent) to Singable (interface)
farmAnimals.add(new Cow());
farmAnimals.add(new Pig());
farmAnimals.add(new Unicorn());
farmAnimals.add(new Elephant());
farmAnimals.add(new Chicken());
farmAnimals.add(new Sheep());
farmAnimals.add(new Tractor());
// Singable sing = new Singable(); //-- not allowed to create single object
for (Singable animal : farmAnimals) {
String name = animal.getName();
String sound = animal.getSound();
System.out.println("Old MacDonald had a farm, ee, ay, ee, ay, oh!");
System.out.println("And on his farm he had a " + name + ", ee, ay, ee, ay, oh!");
System.out.println("With a " + sound + " " + sound + " here");
System.out.println("And a " + sound + " " + sound + " there");
System.out.println("Here a " + sound + " there a " + sound + " everywhere a " + sound + " " + sound);
System.out.println();
// animal.getPrice(); // cannot do this
}
Cow cow = (Cow) farmAnimals.get(0); // Cast to convert from Singable to Cow
Chicken chicken = (Chicken) farmAnimals.get(4);
Scanner input = new Scanner(System.in);
System.out.println("Want to buy my cow? ");
System.out.println("Price is " + cow.getPrice());
String answer = input.nextLine();
if (answer.toLowerCase().charAt(0) == 'y') {
System.out.println("The cow is yours!! (good riddance!)");
}
else {
System.out.println("How about some products from my animals: ");
Product[] products = new Product[] { cow, chicken };
for (Product p : products) {
System.out.println("For sale: " + p.getByProductName() +
" Price: " + p.getByProductCost());
}
}
}
} | [
"margaret@techelevator.com"
] | margaret@techelevator.com |
80d0326f82fb4c9cc5af6adc4eb0da82f8d10c3d | e9bb00c35f2005a14d25158263049c7ec74c882b | /src/com/gra/entity/Finance.java | edf7aad03179ef9e9a7accf941a21906e5e8f0e3 | [] | no_license | susuie/SusieMusic | cdf0b565087e10420f5ac0b71cbff9af9dc05feb | 825a30ea98d941599790c6eaad76c99246dcef18 | refs/heads/master | 2020-07-21T17:26:41.770961 | 2019-09-07T09:33:32 | 2019-09-07T09:33:32 | 206,931,335 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,887 | java | package com.gra.entity;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
/**
*
* @author johnn
*财务表实体类
*/
@Entity
@Table(name = "finance")
public class Finance {
/**
* 主键
*/
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name="p_id",nullable=false,unique = true)
private Integer p_id;
/**
* 时间
*/
@Column(name="p_time",nullable=false)
private String p_time;
/**
* 入账金额
*/
@Column(name="p_in",nullable=false)
private String p_in;
/**
* 出账金额
*/
@Column(name="p_out",nullable=false)
private String p_out;
/**
* 当天金额计算
*/
@Column(name="p_balance",nullable=false)
private String p_balance;
public Finance(){
}
public Finance(String p_in,String p_out,String p_balance){
this.p_time = new SimpleDateFormat("yyyy/MM/dd").format(new Date());
this.p_in = p_in;
this.p_out = p_out;
this.p_balance = p_balance;
}
public Integer getP_id() {
return p_id;
}
public void setP_id(Integer p_id) {
this.p_id = p_id;
}
public String getP_time() {
return p_time;
}
public void setP_time(String p_time) {
this.p_time = p_time;
}
public String getP_in() {
return p_in;
}
public void setP_in(String p_in) {
this.p_in = p_in;
}
public String getP_out() {
return p_out;
}
public void setP_out(String p_out) {
this.p_out = p_out;
}
public String getP_balance() {
return p_balance;
}
public void setP_balance(String p_balance) {
this.p_balance = p_balance;
}
@Override
public String toString(){
return "Finance [p_id="+ p_id +",p_time=" + p_time +
",p_in="+ p_in +",p_out="+p_out+"p_balance"+ "]";
}
}
| [
"susie8711@163.com"
] | susie8711@163.com |
0fd6257604d3daa1ff3d81ab5161ce9c3ccecd9b | a5a6f745f45860bc45c7a3c816ba421cb209015d | /src/main/java/org/example/domain/appraiser/events/Updated_phone_number.java | c610ffc0d2c2eddc69697b7fc065f442d4658dae | [] | no_license | santiagoalar/appraisalReport | e71151a3c3ac5a98a57510d1250d23a747b72621 | 1bf3f116c7d93a8f525c0cd3046add362378c19c | refs/heads/main | 2023-06-08T17:00:46.576613 | 2021-06-15T15:10:19 | 2021-06-15T15:10:19 | 376,723,454 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 491 | java | package org.example.domain.appraiser.events;
import co.com.sofka.domain.generic.DomainEvent;
import org.example.generic_values.Phone_number;
public class Updated_phone_number extends DomainEvent {
private final Phone_number phone_number;
public Updated_phone_number(Phone_number phone_number) {
super("sofka.appraiser.phone_number_updated");
this.phone_number = phone_number;
}
public Phone_number getPhone_number() {
return phone_number;
}
}
| [
"santiago-alar@hotmail.com"
] | santiago-alar@hotmail.com |
331dae28af94d3665de2ce227dd2183f7381cd40 | ec2202d176dc55c5dfd863a47f073bb1d09098ba | /src/windows/SwitchableWindow.java | 863b8c04dd2ac97a2389f5246273ac97598ed952 | [] | no_license | Marwix/Tower-Defence | 5cfe4538678299615ec41e94be7a114e53be0636 | 114fb51d6cfd63a59fd340aa529e22e647312b6a | refs/heads/master | 2022-04-10T12:11:27.282413 | 2020-03-18T18:09:33 | 2020-03-18T18:09:33 | 236,981,842 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 426 | java | package windows;
import java.awt.Container;
public interface SwitchableWindow {
/**
* Every switchable window needs to be able to return the content to be shown
*
* @return Container that can be displayed
*/
public Container getContent();
/**
* Window switch function
*
* @param newcontent - New content to be displayed
*/
public void switchWindow(SwitchableWindow newcontent);
}
| [
"noreply@github.com"
] | Marwix.noreply@github.com |
6fb32a70a07fd1d58b17f30812556aa47357ff49 | 486f231682e2e9a5a0b1af8301ee2807bd818239 | /demoproject/src/com/controller/SalarySlips.java | a2562187da6221806ee58fed51097c0e76e51a76 | [] | no_license | xiyiji/my-eij | 3ab60c48c678c0687b84776e7754ff0a6fdf1772 | aba578a6e27a1ead434e32263ea1b02ac617d4b3 | refs/heads/master | 2023-06-28T19:25:01.393525 | 2021-08-01T02:33:32 | 2021-08-01T02:33:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,694 | java | /*Example of how to use the different page for different user.*/
package com.controller;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.websocket.Session;
public class SalarySlips extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// TODO Auto-generated method stub
HttpSession httpSession=req.getSession();
String username=(String) httpSession.getAttribute("username");
PrintWriter printWriter=resp.getWriter();
if(username.equals("hemendra")) {
printWriter.print("<!DOCTYPE html>\n" +
"<html>\n" +
"<head>\n" +
"<meta charset=\"UTF-8\">\n" +
"<title>Salary Details</title>\n" +
"</head>\n" +
"<body>\n" +
" Welcome: "+username.substring(0, 1).toUpperCase()+username.substring(1, username.length())+"\n" +
"<h4>Please click the lin below to download the Salary Slips</h4><br><a href='#'>Download</a></body>\n" +
"</html>");
}else if(username.equals("aditi")) {
printWriter.print("<!DOCTYPE html>\n" +
"<html>\n" +
"<head>\n" +
"<meta charset=\"UTF-8\">\n" +
"<title>Salary Details</title>\n" +
"</head>\n" +
"<body>\n" +
" Welcome: "+username.substring(0, 1).toUpperCase()+username.substring(1, username.length())+"\n" +
"<h4>Sorry!!!!<br>Salary-slips not generated yet.</h4></body>\n" +
"</html>");
}
}
}
| [
"hemendra.singh.c@outlook.com"
] | hemendra.singh.c@outlook.com |
c1bde67a83159a25ae10d7c2f22a93adb8d20bd6 | e3294cacfc2399d75174f7da2f8b3739fcd1cd63 | /springrest/src/main/java/com/springrest/springrest/dao/CoursePlatformsDao.java | 8ece305b4fbd5072969c90b857b25729e8b64890 | [] | no_license | Teja7799/SpringRepo | 0d54bc1ba26919ac43311a2a215fc95744d5b16b | 396115be0f613b2a9152063c5efed06fb15e3aad | refs/heads/master | 2023-06-24T06:10:50.585769 | 2021-07-19T12:15:39 | 2021-07-19T12:15:39 | 387,443,387 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 309 | java | package com.springrest.springrest.dao;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.springrest.springrest.entities.CoursePlatforms;
@Repository
public interface CoursePlatformsDao extends JpaRepository<CoursePlatforms,Long> {
}
| [
"ubuntu@ubuntu-Latitude-3400"
] | ubuntu@ubuntu-Latitude-3400 |
d25e7923691b4648731dfa0eadd53d6ce020c193 | 66c90b16cdcb03ccf667eb66d9849afef3eb3525 | /src/main/java/me/peter/irio/physics/collision/Collision.java | 3dfa1bc3db568493bd10cb5e21677d26bf5eeb5f | [] | no_license | Pet0203/Irio | 0540b566c363cadffa41af91494dee97b2048a24 | 6c7d38d632f8ea7d855412b751808e7a6f08e9de | refs/heads/master | 2022-09-02T16:50:43.244549 | 2020-04-21T13:17:09 | 2020-04-21T13:17:09 | 239,766,889 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 305 | java | package me.peter.irio.physics.collision;
import org.joml.Vector2f;
public class Collision {
public Vector2f distance;
public boolean isIntersecting;
public Collision(Vector2f distance, boolean intersects) {
this.distance = distance;
this.isIntersecting = intersects;
}
}
| [
"Pet0203@users.noreply.github.com"
] | Pet0203@users.noreply.github.com |
53e676d22c3cd7f73083f235d051595e2f90d317 | 8a98cc407615778511f7564a5bb2a97ccfdaeedf | /src/main/java/com/brainacad/andreyaa/labs/lab7/polymorphism/Simple.java | 21ba1fe3aae3f101228613f9cdad8770548d2e29 | [] | no_license | AndreyAleshin/JavaProjects | d893d1476e11260c6329f508dafe14f6e22fe154 | 9115dea56fdacff05b8cbc3d598106bb2dddd2d4 | refs/heads/master | 2021-06-30T02:51:30.087696 | 2020-12-31T12:17:04 | 2020-12-31T12:17:04 | 194,950,927 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 173 | java | package com.brainacad.andreyaa.labs.lab7.polymorphism;
public class Simple {
public String data = "Simple";
public String getData() {
return data;
}
}
| [
"andrey12.aa@gmail.com"
] | andrey12.aa@gmail.com |
98fbdc568d4ccacdfaa807a2e8a1d052f66b4f3e | 052d648a7b0f6c249804bc026db19075d7975aed | /Entitybean/src/com/dtv/oss/domain/CAProductPK.java | 9dd1a1c643cf9b67d8d2a47d7b7b54ecfe94a98d | [] | no_license | worldup/boss | 84fa357934a7a374d3d0617607391d0446e3b37d | 667dc568c35c3f38b506d21375e298819e58bc33 | refs/heads/master | 2021-01-13T01:36:56.187120 | 2015-02-10T14:01:37 | 2015-02-10T14:01:37 | 30,594,799 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 643 | java | package com.dtv.oss.domain;
import java.io.Serializable;
public class CAProductPK implements Serializable {
public int productId;
public int conditionId;
public CAProductPK() {
}
public CAProductPK(int productId, int conditionId) {
this.productId = productId;
this.conditionId = conditionId;
}
public boolean equals(Object obj) {
if (obj != null) {
if (this.getClass().equals(obj.getClass())) {
CAProductPK that = (CAProductPK) obj;
return this.productId == that.productId
&& this.conditionId == that.conditionId;
}
}
return false;
}
public int hashCode() {
return productId | conditionId;
}
} | [
"worldup@163.com"
] | worldup@163.com |
563d30dbaea68335ed805f2ec54773bc3c08f5b9 | 70b88b0f81b7f31b935169db2d669aebc4a8a7d8 | /pacPersistencia/src/main/java/br/ufg/inf/fabrica/pac/persistencia/pesquisa/operacoes/texto/NaoContem.java | 9fc953cc5d6b3c2464e7f1352f3727851dcfdf73 | [] | no_license | glilco/pac022015 | 1f50934f32b9fd3a80df7bd3af97709c59d9946e | 311e1a93e08d7fe1ea4765576e2f4431e852a115 | refs/heads/master | 2021-01-17T23:21:16.907243 | 2016-10-11T13:13:20 | 2016-10-11T13:13:20 | 55,626,349 | 0 | 0 | null | 2016-10-11T13:13:20 | 2016-04-06T17:24:40 | Java | UTF-8 | Java | false | false | 600 | java | package br.ufg.inf.fabrica.pac.persistencia.pesquisa.operacoes.texto;
import br.ufg.inf.fabrica.pac.persistencia.pesquisa.operacoes.OperacaoFiltroTexto;
/**
*
* @author Danillo
*/
public class NaoContem extends OperacaoFiltroTexto {
private static final String OPERADOR = "not like ";
public NaoContem(String valor) {
super(valor);
}
@Override
public String getOperadorEValor() {
StringBuilder sb = new StringBuilder();
sb.append(OPERADOR).append(" '%").append(getValor()).append("%'");
return sb.toString();
}
}
| [
"danillo@danilloguimaraes.com.br"
] | danillo@danilloguimaraes.com.br |
ea23a99ae1ed32b149a4f8244997617fcb33e91a | 137154d2d454cdae7f59e64681b7fcd47ec5a78b | /src/main/java/com/erp/service/IWaresWholepriceGroupService.java | 37d729f06c23ec00d1c1a891057120cd49c88d3d | [] | no_license | xiaodnn/erp | 19371bd69c0a06fb815f022b6b11dc189321811f | 9ef0eb7f015f2279fd0e129ceb7a8ef08dc88db6 | refs/heads/master | 2020-03-07T23:05:43.394184 | 2018-04-03T14:49:04 | 2018-04-03T14:49:04 | 127,772,053 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 746 | java | package com.erp.service;
import java.util.List;
import com.erp.orm.entity.WaresWholepriceGroup;
import com.erp.orm.entity.WaresWholepriceGroupKey;
public interface IWaresWholepriceGroupService {
int delById(WaresWholepriceGroupKey key);
int save(WaresWholepriceGroup waresWholepriceGroup);
int saveNotNull(WaresWholepriceGroup waresWholepriceGroup);
WaresWholepriceGroup findById(WaresWholepriceGroupKey key);
int modifyByIdNotNull(WaresWholepriceGroup waresWholepriceGroup);
int modifyById(WaresWholepriceGroup waresWholepriceGroup);
List<WaresWholepriceGroup> findByName(String name);
List<WaresWholepriceGroup> findByPage(Integer page, Integer rows);
Integer findCount( );
}
| [
"Administrator@scy.lan"
] | Administrator@scy.lan |
d0f1b00fd6dd9652ccd89bce19355c05d950fc07 | 4ae577ee583dddc9199074f311e886daf58cefc2 | /13_FilesAndNetwork/homework_11.3/src/main/java/Main.java | abec6467314c4bf358116cd3f84ccb3cc95b8ac9 | [] | no_license | Yuri018/education_java | bd8c3e35888a26f8931cdbe498183a2162e60dd0 | 843e5afa93c8583a6e9962e34d3010e688640cce | refs/heads/master | 2023-01-30T17:31:07.336541 | 2023-01-23T15:47:45 | 2023-01-23T15:47:45 | 250,708,887 | 0 | 0 | null | 2022-12-27T13:16:17 | 2020-03-28T03:48:51 | Java | UTF-8 | Java | false | false | 443 | java | public class Main {
public static final String PATH_TO_FILE = "files/movementList.csv";
public static void main(String[] args) {
Movements movements = new Movements(PATH_TO_FILE);
System.out.println("Сумма расходов: " + movements.getExpenseSum() + " руб.");
System.out.println("Сумма доходов: " + movements.getIncomeSum() + " руб.");
movements.groupExpense();
}
}
| [
"plktmn@gmail.com"
] | plktmn@gmail.com |
93d0f1a1c42290423bb06afd806af1bda8fae673 | 519828c35b327929c648f5ebbec1e91f22057ca5 | /src/ninja/farhood/exercises/jav810/GeometricObject.java | f61e86108e0b50566936754c82a85882ce56c472 | [] | no_license | farrhood/first-java-project | 6060192993ea9cf5e1fe45d167537fa4b18b5a62 | dda65111e520da64957ab3088097e783f95fa3e6 | refs/heads/master | 2021-01-25T09:31:34.752245 | 2017-06-20T14:09:51 | 2017-06-20T14:09:51 | 93,842,824 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 145 | java | package ninja.farhood.exercises.jav810;
public interface GeometricObject {
public double getPerimeter();
public double getArea();
}
| [
"farhood.fazeli@gmail.com"
] | farhood.fazeli@gmail.com |
8c0a6e5934a30e00c8a87dfb24a7e2102361b2f5 | 51cda11c50043f3b28363551970550e928ba83a4 | /src/main/java/hu/unideb/gol/hex/shared/CustomLog.java | 89864a5cf60ff4b30a2eda88bed8fe9a0beee90a | [] | no_license | HardBlaster/GoL_Web_BE | 8c6c041735b8163be93fd71faf7f89d6cd0a35ee | 312bf41c23fbbd279562d102473cc6bd37c7f22a | refs/heads/master | 2022-06-15T07:44:26.133441 | 2020-03-23T19:09:17 | 2020-03-23T19:09:17 | 244,708,880 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,337 | java | package hu.unideb.gol.hex.shared;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
public class CustomLog {
private String url;
private String fileName;
public void setURL(String url) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy.MM.dd_HH.mm");
this.url = url + (url.charAt(url.length() - 1) == '/' ? "" : "/");
this.fileName = LocalDateTime.now().format(formatter) + ".log";
System.out.println("\nURL: " + this.url +
"\nFormat: " + LocalDateTime.now().format(formatter) +
"\nFile: " + this.fileName);
try {
File file = new File(this.url + fileName);
file.createNewFile();
file.setWritable(true);
file.setReadable(true);
} catch (IOException e) {
e.printStackTrace();
}
}
public void log(String message) {
try (FileWriter fw = new FileWriter(this.url + this.fileName, true);
BufferedWriter bw = new BufferedWriter(fw)) {
bw.write(message);
bw.newLine();
} catch (Exception e) {
e.printStackTrace();
}
}
} | [
"hidieric@gmail.com"
] | hidieric@gmail.com |
849e4caa875dfdd6dad6dab0b732f1985ac95dc1 | c43f9ff44e0e6f543ae4ed4bf9c4f8eb96444258 | /src/com/tutorialspoint/MainApp.java | 4496b84268dbb548f4bc78e175e42ec958c3d655 | [] | no_license | Clappe/Spring_IOC_Contain | 624452dc98d4c356c5378706aa4b41e747dc5d6a | 63b79ea4a6dbcf239200d9ce64cd19b06f424db5 | refs/heads/master | 2020-06-06T07:35:51.998946 | 2019-06-19T09:27:55 | 2019-06-19T09:27:55 | 192,679,570 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 419 | java | package com.tutorialspoint;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
public class MainApp {
public static void main(String[] args) {
XmlBeanFactory xmlBeanFactory = new XmlBeanFactory(new ClassPathResource("Beans.xml"));
HelloWorld obj = (HelloWorld) xmlBeanFactory.getBean("helloWorld");
obj.getMessage();
}
}
| [
"634898382@qq.com"
] | 634898382@qq.com |
1be70aee4bfdf3cfde29bb31227436dd261a04e3 | c885ef92397be9d54b87741f01557f61d3f794f3 | /tests-without-trycatch/Chart-6/org.jfree.chart.util.ShapeList/BBC-F0-opt-60/25/org/jfree/chart/util/ShapeList_ESTest.java | 01f996533f2f7fd8edbd76b5952d8a1551a9cce9 | [
"CC-BY-4.0",
"MIT"
] | permissive | pderakhshanfar/EMSE-BBC-experiment | f60ac5f7664dd9a85f755a00a57ec12c7551e8c6 | fea1a92c2e7ba7080b8529e2052259c9b697bbda | refs/heads/main | 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null | UTF-8 | Java | false | false | 3,288 | java | /*
* This file was automatically generated by EvoSuite
* Fri Oct 22 20:49:55 GMT 2021
*/
package org.jfree.chart.util;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import java.awt.Polygon;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.geom.Rectangle2D;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.jfree.chart.util.ShapeList;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true)
public class ShapeList_ESTest extends ShapeList_ESTest_scaffolding {
@Test(timeout = 4000)
public void test0() throws Throwable {
ShapeList shapeList0 = new ShapeList();
Polygon polygon0 = new Polygon();
// Undeclared exception!
// try {
shapeList0.setShape((-650), polygon0);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Requires index >= 0.
// //
// verifyException("org.jfree.chart.util.AbstractObjectList", e);
// }
}
@Test(timeout = 4000)
public void test1() throws Throwable {
ShapeList shapeList0 = new ShapeList();
shapeList0.set(0, shapeList0);
// Undeclared exception!
// try {
shapeList0.getShape(0);
// fail("Expecting exception: ClassCastException");
// } catch(ClassCastException e) {
// //
// // org.jfree.chart.util.ShapeList cannot be cast to java.awt.Shape
// //
// verifyException("org.jfree.chart.util.ShapeList", e);
// }
}
@Test(timeout = 4000)
public void test2() throws Throwable {
ShapeList shapeList0 = new ShapeList();
Object object0 = shapeList0.clone();
Polygon polygon0 = new Polygon();
shapeList0.setShape(65535, polygon0);
// Undeclared exception!
shapeList0.equals(object0);
}
@Test(timeout = 4000)
public void test3() throws Throwable {
ShapeList shapeList0 = new ShapeList();
boolean boolean0 = shapeList0.equals(shapeList0);
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test4() throws Throwable {
ShapeList shapeList0 = new ShapeList();
Polygon polygon0 = new Polygon();
boolean boolean0 = shapeList0.equals(polygon0);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test5() throws Throwable {
ShapeList shapeList0 = new ShapeList();
Rectangle2D.Double rectangle2D_Double0 = new Rectangle2D.Double(0.0, 2295.142563637281, 2295.142563637281, (-982.2868473137));
Rectangle rectangle0 = rectangle2D_Double0.getBounds();
shapeList0.setShape(0, rectangle0);
shapeList0.getShape(0);
assertEquals(1, shapeList0.size());
}
@Test(timeout = 4000)
public void test6() throws Throwable {
ShapeList shapeList0 = new ShapeList();
Shape shape0 = shapeList0.getShape(0);
assertNull(shape0);
}
@Test(timeout = 4000)
public void test7() throws Throwable {
ShapeList shapeList0 = new ShapeList();
shapeList0.hashCode();
}
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
f36b5f7129e50aa0ec5e7e675e488781a4d6da07 | 5fe52d78577e546cc97ed2cce5942bc222868cda | /Hello.java | 2f8344d86ee5dd3f13e7794eea0e5689e83032c0 | [] | no_license | 170198/Hello | 14449664117f26cff4ce9c669194c3f009f720e8 | 53c3b77cb0c18d5debdcb479bf03997307c5d59b | refs/heads/master | 2021-01-22T12:20:53.394092 | 2017-05-29T08:28:15 | 2017-05-29T08:28:15 | 92,720,773 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,471 | java | import java.util.Scanner;
class Hello {
public static void main(String[] args) {
System.out.println(litresToGallons(6));
}
static double litresToGallons(double litres) {
litres *= 0.268;
return litres;
}
}
private static void correspondence() {
String polynomial = "";
String trignometric;
String logarithmic;
String expontential;
boolean poly = false;
boolean trig = false;
boolean loga = false;
boolean expo = false;
Scanner input= new Scanner(System.in);
System.out.println("This is an integral calculator. \nPlease follow the instructions and enter what is asked for, as entering anything else will not recieve an answer.");
System.out.println("Are you entering a polynomial? If yes type yes. If no type no");
polynomial = input.nextLine();
if(polynomial.equalsIgnoreCase("yes"))
poly = polynomial.equalsIgnoreCase("yes");
if(!(polynomial.equalsIgnoreCase("yes") || polynomial.equalsIgnoreCase("no"))) {
System.out.println("Neither yes or no has been entered please restart");
return;
}
if (polynomial.equalsIgnoreCase("no")) {
System.out.println("Are you entering a trignometric function? If yes type yes. If no type no");
trignometric = input.nextLine();
if(trignometric.equalsIgnoreCase("yes"))
trig = trignometric.equalsIgnoreCase("yes");
if(!(trignometric.equalsIgnoreCase("yes") || trignometric.equalsIgnoreCase("no"))) {
System.out.println("Neither yes or no has been entered please restart");
return;
}
if (trignometric.equalsIgnoreCase("no")) {
System.out.println("Are you entering a logarithmic function? (including natural logarithm) If yes type yes. If no type no");
logarithmic = input.nextLine();
if(logarithmic.equalsIgnoreCase("yes"))
loga=logarithmic.equalsIgnoreCase("yes");
if(!(logarithmic.equalsIgnoreCase("yes") || logarithmic.equalsIgnoreCase("no"))){
System.out.println("Neither yes or no has been entered please restart");
return;
}
if (logarithmic.equalsIgnoreCase("no")) {
System.out.println("Are you entering a exponential function? (including natural logarithm) If yes type yes. If no type no");
expontential = input.nextLine();
if(expontential.equalsIgnoreCase("yes"))
expo=expontential.equalsIgnoreCase("yes");
if(!(expontential.equalsIgnoreCase("yes") || expontential.equalsIgnoreCase("no"))) {
System.out.println("Neither yes or no has been entered please restart");
return;
}
}
}
}
System.out.println("\nPlease enter your integral with the variable x. IE: integral of f(x)dx");
System.out.println("If you are entering it as an polynomial please enter it like this example. 2x^2+3x-2");
System.out.println("Please enter your equation: ");
String integral = input.nextLine();
System.out.println("Are you looking for the definite integral? If yes type yes. If no type no");
String defindef = input.next();
if (defindef.equalsIgnoreCase("no")){
if(trig){
System.out.println(trig(integral) + " + C");
}
else if (poly){
System.out.println(polynomial(integral) + " + C");
}
else if (loga){
System.out.println(log(integral) + " + C");
}
else if (expo){
System.out.println(exponetial(integral) + " + C");
}
}
else{
System.out.println("Please enter the upper limit: ");
double upperlim = input.nextInt();
System.out.println("Please enter the lower limit: ");
double lowerlim = input.nextInt();
if(lowerlim!=upperlim){
defintegralcalc(integral, upperlim, lowerlim);
if(trig){
System.out.println("The indefinite integral is: " + trig(integral) + " + C");
System.out.println("The definite integral is: " + defintegralcalc(trig(integral), upperlim, lowerlim));
}
else if (poly){
System.out.println("The indefinite integral is: " + polynomial(integral) + " + C");
System.out.println("The definite integral is: " + defintegralcalc(polynomial(integral), upperlim, lowerlim));
}
else if (loga){
System.out.println("The indefinite integral is: " + log(integral) + " + C");
System.out.println("The definite integral is: " + defintegralcalc(log(integral), upperlim, lowerlim));
}
else if (expo){
System.out.println("The indefinite integral is: " + exponetial(integral) + " + C");
System.out.println("The definite integral is: " + defintegralcalc(exponetial(integral), upperlim, lowerlim));
}
}
else{
System.out.println("You've entered the same value for the upper and lower limit. Therefore the value of the definit integral is 0");
}
}
} | [
"benmowat@me.com"
] | benmowat@me.com |
31f0134793e0ef00d32c4b590c1aecb581571713 | 61e6a33627452038f1e2f24c0cb7b2ae29ce62e2 | /ToolsQA/src/Basic/WebelementCommands.java | 40f85804e43547ffc6fbba8fde8011f9db27fbc5 | [] | no_license | kumarabhilash/selenium | 821cee724eb3290c1c5aedac2651d134e42243bc | d45a6f8da5627bf5aeeef17ea0573cea6154eb99 | refs/heads/master | 2021-01-12T10:32:32.132580 | 2017-02-12T08:38:14 | 2017-02-12T08:38:14 | 81,711,589 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,263 | java | package Basic;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.Point;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
//import org.openqa.selenium.firefox.FirefoxDriver;
public class WebelementCommands {
public static WebDriver driver;
public static void main(String[] args) {
// Create a new instance of the FireFox driver
String exePath = "C:\\Users\\AbhilashKumar\\workspace\\jars and plugins\\chromedriver_win32\\chromedriver.exe";
System.setProperty("webdriver.chrome.driver", exePath);
driver = new ChromeDriver();
// Open ToolsQA web site
String appUrl = "https://login.salesforce.com";
driver.get(appUrl);
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.findElement(By.id("username")).sendKeys("Pavanakn@cognizant.com");
//clear()
driver.findElement(By.id("username")).clear();
//isDisplayed
System.out.println("Is the Username field is displayed?? " +driver.findElement(By.id("username")).isDisplayed());
//IsSelected()
driver.findElement(By.id("rememberUn")).click();
System.out.println("Is the Remember me is selected?? " +driver.findElement(By.id("rememberUn")).isSelected());
driver.findElement(By.id("rememberUn")).click();
System.out.println("Is the Remember me is selected?? " +driver.findElement(By.id("rememberUn")).isSelected());
//getText()
System.out.println("The text at Use custom domain : " +driver.findElement(By.id("mydomainLink")).getText());
//getAttribute
System.out.println("Attribute of forgot link id is : " +driver.findElement(By.id("forgot_password_link")).getAttribute("href"));
//getSize
WebElement element = driver.findElement(By.id("username"));
Dimension dimension = element.getSize();
System.out.println("Height : " + dimension.height + " Width : "+ dimension.width);
//getLocation
Point point = element.getLocation();
System.out.println("X cordinate : " + point.x + " Y cordinate: " + point.y);
}
} | [
"kumarabhilash460@gmail.com"
] | kumarabhilash460@gmail.com |
e29caa2b171d2b907e9cf9ca2bdfa1db8f284b85 | fc653dfa4fececb9f6d15f639d99862bab62e47d | /frontend-xtext/dk.sdu.mmmi.tjep/src-gen/dk/sdu/mmmi/tjep/tJ/DynamicValue.java | 10e0df95a6c42108cf8c0eaab07649efaca0f2ad | [] | no_license | ulrikpaghschultz/tjep | 2476164f3851f94ac70dc1fac17c7040ec4bb056 | 9ce06149bd675d936095178d6986b901e9dcf4cc | refs/heads/master | 2021-01-13T02:23:13.984506 | 2013-07-10T19:16:12 | 2013-07-10T19:16:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,097 | java | /**
*/
package dk.sdu.mmmi.tjep.tJ;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Dynamic Value</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link dk.sdu.mmmi.tjep.tJ.DynamicValue#getType <em>Type</em>}</li>
* <li>{@link dk.sdu.mmmi.tjep.tJ.DynamicValue#getName <em>Name</em>}</li>
* </ul>
* </p>
*
* @see dk.sdu.mmmi.tjep.tJ.TJPackage#getDynamicValue()
* @model
* @generated
*/
public interface DynamicValue extends BaseExp
{
/**
* Returns the value of the '<em><b>Type</b></em>' reference.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Type</em>' reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Type</em>' reference.
* @see #setType(Type)
* @see dk.sdu.mmmi.tjep.tJ.TJPackage#getDynamicValue_Type()
* @model
* @generated
*/
Type getType();
/**
* Sets the value of the '{@link dk.sdu.mmmi.tjep.tJ.DynamicValue#getType <em>Type</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Type</em>' reference.
* @see #getType()
* @generated
*/
void setType(Type value);
/**
* Returns the value of the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Name</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Name</em>' attribute.
* @see #setName(String)
* @see dk.sdu.mmmi.tjep.tJ.TJPackage#getDynamicValue_Name()
* @model
* @generated
*/
String getName();
/**
* Sets the value of the '{@link dk.sdu.mmmi.tjep.tJ.DynamicValue#getName <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Name</em>' attribute.
* @see #getName()
* @generated
*/
void setName(String value);
} // DynamicValue
| [
"ups@mmmi.sdu.dk"
] | ups@mmmi.sdu.dk |
23bdd742cd047b8f4615ab4be14ef753412624e6 | ecdde67d5cd664b16de05c4f7ca8e175337edf9c | /A.java | 039192b86366cfc6dfefe894548fcab568906b3f | [] | no_license | anjalirana19/anjali | e2dc726c0b6193e855b1ef7b3fb913b505c59aa2 | ee4ff790511b308ff2bc7c177ec2affdbe4e112c | refs/heads/master | 2020-07-07T23:18:54.104377 | 2019-08-20T05:33:59 | 2019-08-20T05:33:59 | 203,502,957 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 108 | java | class A
{
public static void main(String agrs[])
{
System.out.println("hello");
}
}
| [
"ranaanjali072@gmail.com"
] | ranaanjali072@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.