blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M โ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
08c5652c8bd4fd6dee7f4d357caa43b989c0112d | 0f35cd99303b8789f94cc767eba2c59feffd5b80 | /basic/src/day36/StackQueue/StackExample.java | d972196393ce0f936162a0b6bd2b58d19a20bed0 | [] | no_license | seungzz/java2020 | 6f8bae23fa3903e6df3aceaeb042ad31f0b5cc08 | eb85d4ba04d69da267574e443a93cdcd59896527 | refs/heads/master | 2023-01-20T13:48:34.427394 | 2020-10-29T03:04:00 | 2020-10-29T03:04:00 | 297,261,422 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 766 | java | package day36.StackQueue;
import java.util.Stack;
public class StackExample {
public static void main(String[] args) {
Stack<Coin> coinBox = new Stack<Coin>();
coinBox.push(new Coin(100));
coinBox.push(new Coin(50));
coinBox.push(new Coin(500));
coinBox.push(new Coin(10)); //push() ๋ฉ์๋๋ฅผ ํตํด์ ์คํ์ ๊ฐ์ ๋ฃ์ด์ค๋ค.
while(!coinBox.isEmpty()) {
Coin coin2 = coinBox.peek(); //peek()๋ฉ์๋๋ ๊บผ๋ด์ง๋ง ๊ฐ์ ์ญ์ ํ์ง๋ ์๋๋ค.
System.out.println("๊บผ๋ด์จ ๋์ : "+coin2.getValue());
Coin coin = coinBox.pop(); //pop() ๋ฉ์๋๋ฅผ ์ฌ์ฉํ๋ฉด ๋งจ์ ์คํ์์ ๊ฐ์ ๊บผ๋ด์ค๋ฉด์ ๊ฐ์ ์ญ์ .
System.out.println("๊บผ๋ด์จ ๋์ : "+coin.getValue());
}
}
}
| [
"KW505@505-07"
] | KW505@505-07 |
618351ea78ffd8d19d5a973e3c43261d96f649ce | 3f4ba6e28519661b1077fb5ccdaa149328014515 | /app/src/main/java/com/androiddev/artemqa/gototrip/modules/chat/view/ChatViewHolder.java | 717c6efcc1b027033e6b920ded5e02071ebbfaa0 | [] | no_license | artjkee73/GoToTrip | 71369cfdb3d67a20f08551762a91dab80fb6e6dc | 3789c5893a0b815d48488ee49414da286d3f4372 | refs/heads/master | 2021-01-24T13:12:46.098799 | 2018-06-05T08:59:30 | 2018-06-05T08:59:30 | 123,164,212 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,303 | java | package com.androiddev.artemqa.gototrip.modules.chat.view;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;
import com.androiddev.artemqa.gototrip.R;
import com.androiddev.artemqa.gototrip.common.models.Chat;
import com.androiddev.artemqa.gototrip.common.models.Message;
import com.androiddev.artemqa.gototrip.common.models.User;
import com.androiddev.artemqa.gototrip.helper.Constants;
import com.androiddev.artemqa.gototrip.helper.Utils;
import com.androiddev.artemqa.gototrip.modules.chat.ContractChat;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import de.hdodenhof.circleimageview.CircleImageView;
/**
* Created by artemqa on 08.04.2018.
*/
public class ChatViewHolder extends RecyclerView.ViewHolder {
CircleImageView mIvInterlocutorAvatar, mIvAuthorLastMessageAvatar;
TextView mTvIntelocutorName, mTvTextLastMessage;
private ContractChat.Presenter mPresenter;
private FirebaseAuth mAuth = FirebaseAuth.getInstance();
private FirebaseUser mCurrentUser = mAuth.getCurrentUser();
private FirebaseDatabase mDatabase = FirebaseDatabase.getInstance();
private DatabaseReference mRefDatabaseBase = mDatabase.getReference();
private String mInterlocutorUrlAvatar;
private String mAuthorUrlAvatar;
public ChatViewHolder(View itemView) {
super(itemView);
mIvInterlocutorAvatar = itemView.findViewById(R.id.iv_avatar_interlocutor_chat_item);
mIvAuthorLastMessageAvatar = itemView.findViewById(R.id.iv_avatar_last_message_chat_item);
mTvIntelocutorName = itemView.findViewById(R.id.tv_name_interlocutor_chat_item);
mTvTextLastMessage = itemView.findViewById(R.id.tv_last_message_chat_chat_item);
}
public void bind(Chat currentChat) {
String mInterlocutorId = Utils.getInterlocutorId(currentChat.getMembers(),mCurrentUser.getUid());
DatabaseReference refInterlocutor = mRefDatabaseBase.child(Constants.USERS_LOCATION).child(mInterlocutorId);
refInterlocutor.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if(dataSnapshot!=null){
User interlocutorUser = dataSnapshot.getValue(User.class);
setAvatarInterlocutor(interlocutorUser.getUriAvatarThumbnail());
setNameInterlocutor(interlocutorUser.getName());
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
DatabaseReference refLastMessage = mRefDatabaseBase.child(Constants.MESSAGES_LOCATION).child(currentChat.getLastMessageId());
refLastMessage.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot != null) {
Message lastMessage = dataSnapshot.getValue(Message.class);
setTextLastMessage(lastMessage.getText());
setAvatarAuthorLastMessage(lastMessage.getAuthorUrlAvatar());
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
private void setAvatarInterlocutor(String urlAvatarInterlocutor) {
mInterlocutorUrlAvatar = urlAvatarInterlocutor;
Utils.loadImage(itemView.getContext(),mInterlocutorUrlAvatar,mIvInterlocutorAvatar);
}
private void setNameInterlocutor(String nameInterlocutor) {
mTvIntelocutorName.setText(nameInterlocutor);
}
private void setTextLastMessage(String text) {
mTvTextLastMessage.setText(text);
}
private void setAvatarAuthorLastMessage(String urlAvatar) {
mAuthorUrlAvatar = urlAvatar;
Utils.loadImage(itemView.getContext(),mAuthorUrlAvatar,mIvAuthorLastMessageAvatar);
}
}
| [
"artjkee73@gmail.com"
] | artjkee73@gmail.com |
ab489cd9b1a1d874f1475da5f61b1554ab003586 | fe58e0f141b3437f12e11f9a9026f86313f305f6 | /src/main/java/com/cosateca/apirest/servicios/UsuarioService.java | 23162d5ef82bc4e448ab8cf6d814effb74613af1 | [] | no_license | raurodmen1997/tfg_cosateca_backend | 15f8b45fa1d7b0e205f839b67750d01728ba6edc | df058fb273221ded57ad4dadf2eda7ac18a39866 | refs/heads/master | 2023-06-05T20:02:24.040946 | 2021-06-18T14:52:33 | 2021-06-18T14:52:33 | 317,005,838 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,130 | java | package com.cosateca.apirest.servicios;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.cosateca.apirest.entidades.Usuario;
import com.cosateca.apirest.repositorios.UsuarioRepository;
@Service
public class UsuarioService implements IUsuarioService{
@Autowired
private UsuarioRepository usuarioRepository;
@Autowired
private ListaFavoritoService listaService;
@Autowired
private PeticionDonacionService peticionDonacionService;
@Autowired
private ValoracionService valoracionService;
@Autowired
private PeticionReservaService peticionReservaService;
@Override
public Usuario findUsuarioByCuenta(Long id) {
return this.usuarioRepository.findUsuarioByCuenta(id);
}
@Override
public Usuario guardarUsuario(Usuario usuario) {
return this.usuarioRepository.save(usuario);
}
@Override
public Usuario findOne(Long id) {
return this.usuarioRepository.findById(id).orElse(null);
}
/*
@Override
public List<Usuario> usuarioASerOlvidados() {
return this.usuarioRepository.usuariosASerOlvidados();
}
*/
@Override
@Transactional
public void eliminarUsuario(Usuario usuario) {
this.valoracionService.eliminarValoracionesUsuario(usuario.getId());
this.peticionDonacionService.eliminarPeticionesDonacionUsuario(usuario.getId());
this.peticionReservaService.eliminarPeticionesReservaUsuario(usuario.getId());
this.listaService.eliminarListasUsuario(usuario.getId());
this.usuarioRepository.delete(usuario);
}
@Override
public Page<Usuario> usuariosASerOlvidados(Pageable pageable) {
return this.usuarioRepository.usuariosASerOlvidados(pageable);
}
@Override
public List<Usuario> usuarioASerOlvidados() {
return null;
}
@Override
public Usuario usuarioPorCodigoIdentificacion(String codigo_identificacion) {
return this.usuarioRepository.usuarioPorCodigoIdentificacion(codigo_identificacion);
}
}
| [
"raulrodriguezmendez1997@gmail.com"
] | raulrodriguezmendez1997@gmail.com |
d20049aeaf8cb10efadc515da0255eb2c0d50ee1 | 896cca57024190fc3fbb62f2bd0188fff24b24c8 | /2.7.x/choicemaker-cm/choicemaker-j2ee/com.choicemaker.cm.transitivity/src/main/java/com/choicemaker/cm/transitivity/util/GraphFilter.java | 6da5595d93d174ae3477956e7def11fa65b2a27c | [] | no_license | fgregg/cm | 0d4f50f92fde2a0bed465f2bec8eb7f2fad8362c | c0ab489285938f14cdf0a6ed64bbda9ac4d04532 | refs/heads/master | 2021-01-10T11:27:00.663407 | 2015-08-11T19:35:00 | 2015-08-11T19:35:00 | 55,807,163 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,000 | java | /*
* Copyright (c) 2001, 2009 ChoiceMaker Technologies, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License
* v1.0 which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* ChoiceMaker Technologies, Inc. - initial API and implementation
*/
package com.choicemaker.cm.transitivity.util;
import java.util.List;
import com.choicemaker.cm.io.blocking.automated.offline.data.MatchRecord2;
import com.choicemaker.cm.transitivity.core.CompositeEntity;
import com.choicemaker.cm.transitivity.core.EdgeProperty;
import com.choicemaker.cm.transitivity.core.Link;
/**
* This object takes in a graph (CompositeEntity) and an EdgeProperty and
* returns a graph satisfying that EdgeProperty.
*
* @author pcheung
*
* ChoiceMaker Technologies, Inc.
*/
@SuppressWarnings({"rawtypes", "unchecked"})
public class GraphFilter {
private static GraphFilter filter = new GraphFilter();
private GraphFilter() {
}
public static GraphFilter getInstance() {
return filter;
}
/**
* This method returns a graph where the edges satisfy the given
* EdgeProperty.
*
* @param ce
* - input graph
* @param ep
* - property which the edges need to satisfy
* @return CompositeEnity - new graph.
*/
public <T extends Comparable<T>> CompositeEntity<T> filter(
CompositeEntity<T> ce, EdgeProperty ep) {
UniqueSequence seq = UniqueSequence.getInstance();
CompositeEntity<T> ret = new CompositeEntity(seq.getNextInteger());
// get all the links
List links = ce.getAllLinks();
for (int i = 0; i < links.size(); i++) {
Link link = (Link) links.get(i);
List mrs = link.getLinkDefinition();
for (int j = 0; j < mrs.size(); j++) {
MatchRecord2 mr = (MatchRecord2) mrs.get(j);
if (ep.hasProperty(mr)) {
ret.addMatchRecord(mr);
}
}
}
return ret;
}
}
| [
"rick@rphall.com"
] | rick@rphall.com |
c1f84a1c21f30a9c63f83b14d9da0917e9670f71 | 76442002859bf46b713a94797f3d21a18ca7b370 | /src/test/java/stepDefinitions/Initializer.java | 64c7eb931bd5c303ace22c350159abdbd9a71cb1 | [] | no_license | sayed-nizami08/testRepo | 8d21a3f0eff2b18e7e23fa25a69ffe880e8fb80f | b33f15853615ce4ada67c42a5ef3cea0c67e2ea8 | refs/heads/master | 2022-07-07T05:47:44.883194 | 2019-12-15T20:14:13 | 2019-12-15T20:14:13 | 228,243,276 | 0 | 0 | null | 2022-06-29T17:51:03 | 2019-12-15T19:57:34 | HTML | UTF-8 | Java | false | false | 1,513 | java | package stepDefinitions;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import core.Base;
import cucumber.api.java.After;
import cucumber.api.java.Before;
import io.github.bonigarcia.wdm.WebDriverManager;
import utilities.ScreenRecordUtility;
public class Initializer extends Base{
@Before
public void beforeHooks() {
if(Base.browserName().contentEquals("chrome")) {
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();
} else if (Base.browserName().contentEquals("FF")) {
WebDriverManager.firefoxdriver().setup();
driver = new FirefoxDriver();
} else if (Base.browserName().contains("IE")) {
WebDriverManager.iedriver().setup();
driver = new InternetExplorerDriver();
}
driver.manage().window().maximize();
driver.manage().deleteAllCookies();
driver.manage().timeouts().pageLoadTimeout(getPageLoadTimeout(), TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(getImplicitlyWait(), TimeUnit.SECONDS);
try {
ScreenRecordUtility.startRecording("TekSchoolScenarios");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@After
public void afterHooks () {
try {
ScreenRecordUtility.stopRecording();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
driver.close();
driver.quit();
}
}
| [
"sayed.nizami08@gmail.com"
] | sayed.nizami08@gmail.com |
305aecad8d559685345cffbea51d3988c377db81 | 1ed0e7930d6027aa893e1ecd4c5bba79484b7c95 | /keiji/source/java/com/vungle/publisher/qe.java | 010152c109f58a71d65c1ad765481cfe83227264 | [] | no_license | AnKoushinist/hikaru-bottakuri-slot | 36f1821e355a76865057a81221ce2c6f873f04e5 | 7ed60c6d53086243002785538076478c82616802 | refs/heads/master | 2021-01-20T05:47:00.966573 | 2017-08-26T06:58:25 | 2017-08-26T06:58:25 | 101,468,394 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,343 | java | package com.vungle.publisher;
import com.vungle.log.Logger;
import javax.inject.Inject;
/* compiled from: vungle */
public class qe implements qn {
private boolean a;
@Inject
public ql eventBus;
public void register() {
if (this.a) {
Logger.w(Logger.EVENT_TAG, getClass().getName() + " already listening");
return;
}
Logger.d(Logger.EVENT_TAG, getClass().getName() + " listening");
this.eventBus.b(this);
this.a = true;
}
public void registerSticky() {
if (this.a) {
Logger.w(Logger.EVENT_TAG, getClass().getName() + " already listening sticky");
return;
}
Logger.d(Logger.EVENT_TAG, getClass().getName() + " listening sticky");
this.eventBus.a.a((Object) this, "onEvent", true);
this.a = true;
}
public void unregister() {
Logger.d(Logger.EVENT_TAG, getClass().getName() + " unregistered");
this.eventBus.a.a((Object) this);
this.a = false;
}
public void registerOnce() {
if (this.a) {
Logger.v(Logger.EVENT_TAG, getClass().getName() + " already listening");
return;
}
Logger.d(Logger.EVENT_TAG, getClass().getName() + " listening");
this.eventBus.b(this);
this.a = true;
}
}
| [
"09f713c@sigaint.org"
] | 09f713c@sigaint.org |
0b79684189231eefb361178cb32b834fd23e34cf | c885ef92397be9d54b87741f01557f61d3f794f3 | /tests-without-trycatch/Time-9/org.joda.time.DateTimeZone/BBC-F0-opt-50/3/org/joda/time/DateTimeZone_ESTest_scaffolding.java | 87c5937ddad7325de6853cca39ce6b007407400b | [
"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 | 18,477 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Wed Oct 20 01:32:21 GMT 2021
*/
package org.joda.time;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.junit.AfterClass;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
@EvoSuiteClassExclude
public class DateTimeZone_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "org.joda.time.DateTimeZone";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT();
org.evosuite.runtime.classhandling.JDKClassResetter.init();
setSystemProperties();
initializeClasses();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
}
@AfterClass
public static void clearEvoSuiteFramework(){
Sandbox.resetDefaultSecurityManager();
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode();
setSystemProperties();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
org.evosuite.runtime.classhandling.JDKClassResetter.reset();
resetClasses();
org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
public static void setSystemProperties() {
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
java.lang.System.setProperty("user.timezone", "Etc/UTC");
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(DateTimeZone_ESTest_scaffolding.class.getClassLoader() ,
"org.joda.time.DateTimeZone",
"org.joda.time.tz.DateTimeZoneBuilder$Recurrence",
"org.joda.time.DateTimeUtils$MillisProvider",
"org.joda.time.chrono.GJYearOfEraDateTimeField",
"org.joda.time.field.RemainderDateTimeField",
"org.joda.time.JodaTimePermission",
"org.joda.time.chrono.BasicWeekOfWeekyearDateTimeField",
"org.joda.time.DateTimeFieldType",
"org.joda.time.format.DateTimeFormatterBuilder$Fraction",
"org.joda.time.DateTimeFieldType$StandardDateTimeFieldType",
"org.joda.time.ReadableInterval",
"org.joda.time.chrono.BasicChronology$HalfdayField",
"org.joda.time.chrono.LimitChronology$LimitDateTimeField",
"org.joda.time.tz.DateTimeZoneBuilder$PrecalculatedZone",
"org.joda.time.chrono.BasicChronology$YearInfo",
"org.joda.time.field.UnsupportedDurationField",
"org.joda.time.DateMidnight$Property",
"org.joda.time.field.SkipUndoDateTimeField",
"org.joda.time.base.AbstractDateTime",
"org.joda.time.format.DateTimePrinter",
"org.joda.time.base.BaseLocal",
"org.joda.time.field.DelegatedDateTimeField",
"org.joda.time.chrono.ISOChronology",
"org.joda.time.chrono.BasicChronology",
"org.joda.time.chrono.BasicYearDateTimeField",
"org.joda.time.field.DividedDateTimeField",
"org.joda.time.chrono.ZonedChronology",
"org.joda.time.format.DateTimeFormatterBuilder$TimeZoneOffset",
"org.joda.time.field.BaseDateTimeField",
"org.joda.time.field.ZeroIsMaxDateTimeField",
"org.joda.time.format.DateTimeFormatterBuilder",
"org.joda.time.tz.CachedDateTimeZone$Info",
"org.joda.time.base.BaseInterval",
"org.joda.time.format.FormatUtils",
"org.joda.time.field.MillisDurationField",
"org.joda.time.chrono.GJChronology",
"org.joda.time.Interval",
"org.joda.time.base.AbstractInstant",
"org.joda.time.LocalDateTime$Property",
"org.joda.time.tz.DateTimeZoneBuilder",
"org.joda.time.format.DateTimeParserBucket",
"org.joda.time.field.UnsupportedDateTimeField",
"org.joda.time.field.ScaledDurationField",
"org.joda.time.chrono.ISOYearOfEraDateTimeField",
"org.joda.time.field.PreciseDurationDateTimeField",
"org.joda.time.LocalDateTime",
"org.joda.time.tz.FixedDateTimeZone",
"org.joda.time.MutableDateTime",
"org.joda.time.tz.CachedDateTimeZone",
"org.joda.time.field.PreciseDateTimeField",
"org.joda.time.chrono.LimitChronology$LimitException",
"org.joda.time.ReadableDateTime",
"org.joda.time.DateMidnight",
"org.joda.time.field.DecoratedDateTimeField",
"org.joda.time.YearMonthDay",
"org.joda.time.format.DateTimeParser",
"org.joda.time.format.DateTimeFormatterBuilder$CharacterLiteral",
"org.joda.time.chrono.GJChronology$CutoverField",
"org.joda.time.field.OffsetDateTimeField",
"org.joda.time.chrono.GJMonthOfYearDateTimeField",
"org.joda.time.chrono.BasicWeekyearDateTimeField",
"org.joda.time.DateTimeField",
"org.joda.time.field.FieldUtils",
"org.joda.time.chrono.BasicSingleEraDateTimeField",
"org.joda.time.format.DateTimeFormat",
"org.joda.time.field.SkipDateTimeField",
"org.joda.time.chrono.LimitChronology",
"org.joda.time.tz.UTCProvider",
"org.joda.time.ReadableInstant",
"org.joda.time.DateTimeUtils$SystemMillisProvider",
"org.joda.time.chrono.GJDayOfWeekDateTimeField",
"org.joda.time.IllegalInstantException",
"org.joda.time.IllegalFieldValueException",
"org.joda.time.tz.DefaultNameProvider",
"org.joda.time.format.DateTimeFormatterBuilder$Composite",
"org.joda.time.tz.Provider",
"org.joda.time.field.ImpreciseDateTimeField$LinkedDurationField",
"org.joda.time.ReadablePeriod",
"org.joda.time.DateTimeZone$Stub",
"org.joda.time.chrono.ZonedChronology$ZonedDateTimeField",
"org.joda.time.chrono.AssembledChronology$Fields",
"org.joda.time.chrono.GregorianChronology",
"org.joda.time.DurationFieldType",
"org.joda.time.ReadWritableInstant",
"org.joda.time.tz.NameProvider",
"org.joda.time.chrono.GJChronology$LinkedDurationField",
"org.joda.time.format.DateTimeFormatterBuilder$PaddedNumber",
"org.joda.time.chrono.BasicMonthOfYearDateTimeField",
"org.joda.time.base.AbstractPartial",
"org.joda.time.base.BasePartial",
"org.joda.time.base.BaseDateTime",
"org.joda.time.DateTimeUtils",
"org.joda.time.LocalTime",
"org.joda.time.base.AbstractInterval",
"org.joda.time.field.DecoratedDurationField",
"org.joda.time.tz.DateTimeZoneBuilder$DSTZone",
"org.joda.time.chrono.AssembledChronology",
"org.joda.time.tz.ZoneInfoProvider",
"org.joda.time.chrono.GJEraDateTimeField",
"org.joda.time.DateTimeZone$1",
"org.joda.time.chrono.BaseChronology",
"org.joda.time.chrono.JulianChronology",
"org.joda.time.field.ImpreciseDateTimeField",
"org.joda.time.field.PreciseDurationField",
"org.joda.time.tz.DateTimeZoneBuilder$OfYear",
"org.joda.time.ReadableDuration",
"org.joda.time.chrono.BasicGJChronology",
"org.joda.time.format.DateTimeFormatterBuilder$NumberFormatter",
"org.joda.time.format.DateTimeFormatter",
"org.joda.time.DurationField",
"org.joda.time.Chronology",
"org.joda.time.DateTime",
"org.joda.time.field.AbstractReadableInstantFieldProperty",
"org.joda.time.format.DateTimeParserBucket$SavedField",
"org.joda.time.LocalDate",
"org.joda.time.chrono.BasicDayOfMonthDateTimeField",
"org.joda.time.ReadWritableDateTime",
"org.joda.time.chrono.ZonedChronology$ZonedDurationField",
"org.joda.time.Instant",
"org.joda.time.ReadablePartial",
"org.joda.time.chrono.LimitChronology$LimitDurationField",
"org.joda.time.chrono.GJChronology$ImpreciseCutoverField",
"org.joda.time.DurationFieldType$StandardDurationFieldType",
"org.joda.time.chrono.BasicDayOfYearDateTimeField",
"org.joda.time.field.BaseDurationField",
"org.joda.time.chrono.BuddhistChronology"
);
}
private static void resetClasses() {
org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(DateTimeZone_ESTest_scaffolding.class.getClassLoader());
org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
"org.joda.time.tz.FixedDateTimeZone",
"org.joda.time.tz.ZoneInfoProvider",
"org.joda.time.tz.DefaultNameProvider",
"org.joda.time.DateTimeZone",
"org.joda.time.Chronology",
"org.joda.time.chrono.BaseChronology",
"org.joda.time.DateTimeZone$1",
"org.joda.time.DateTimeZone$Stub",
"org.joda.time.format.FormatUtils",
"org.joda.time.DateTimeUtils$SystemMillisProvider",
"org.joda.time.tz.DateTimeZoneBuilder",
"org.joda.time.tz.DateTimeZoneBuilder$PrecalculatedZone",
"org.joda.time.tz.DateTimeZoneBuilder$DSTZone",
"org.joda.time.tz.DateTimeZoneBuilder$Recurrence",
"org.joda.time.tz.DateTimeZoneBuilder$OfYear",
"org.joda.time.tz.CachedDateTimeZone",
"org.joda.time.DateTimeUtils",
"org.joda.time.chrono.AssembledChronology",
"org.joda.time.DateTimeField",
"org.joda.time.field.BaseDateTimeField",
"org.joda.time.chrono.BasicSingleEraDateTimeField",
"org.joda.time.DateTimeFieldType$StandardDateTimeFieldType",
"org.joda.time.DurationFieldType$StandardDurationFieldType",
"org.joda.time.DurationFieldType",
"org.joda.time.DateTimeFieldType",
"org.joda.time.base.AbstractInstant",
"org.joda.time.Instant",
"org.joda.time.chrono.GJChronology",
"org.joda.time.DurationField",
"org.joda.time.field.MillisDurationField",
"org.joda.time.field.BaseDurationField",
"org.joda.time.field.PreciseDurationField",
"org.joda.time.field.PreciseDurationDateTimeField",
"org.joda.time.field.PreciseDateTimeField",
"org.joda.time.field.DecoratedDateTimeField",
"org.joda.time.field.ZeroIsMaxDateTimeField",
"org.joda.time.chrono.BasicChronology$HalfdayField",
"org.joda.time.chrono.BasicChronology",
"org.joda.time.chrono.BasicGJChronology",
"org.joda.time.chrono.AssembledChronology$Fields",
"org.joda.time.field.ImpreciseDateTimeField",
"org.joda.time.chrono.BasicYearDateTimeField",
"org.joda.time.field.ImpreciseDateTimeField$LinkedDurationField",
"org.joda.time.chrono.GJYearOfEraDateTimeField",
"org.joda.time.field.OffsetDateTimeField",
"org.joda.time.field.DividedDateTimeField",
"org.joda.time.field.DecoratedDurationField",
"org.joda.time.field.ScaledDurationField",
"org.joda.time.field.RemainderDateTimeField",
"org.joda.time.chrono.GJEraDateTimeField",
"org.joda.time.chrono.GJDayOfWeekDateTimeField",
"org.joda.time.chrono.BasicDayOfMonthDateTimeField",
"org.joda.time.chrono.BasicDayOfYearDateTimeField",
"org.joda.time.chrono.BasicMonthOfYearDateTimeField",
"org.joda.time.chrono.GJMonthOfYearDateTimeField",
"org.joda.time.chrono.BasicWeekyearDateTimeField",
"org.joda.time.chrono.BasicWeekOfWeekyearDateTimeField",
"org.joda.time.field.DelegatedDateTimeField",
"org.joda.time.field.SkipDateTimeField",
"org.joda.time.field.UnsupportedDurationField",
"org.joda.time.chrono.JulianChronology",
"org.joda.time.chrono.GregorianChronology",
"org.joda.time.chrono.BasicChronology$YearInfo",
"org.joda.time.field.FieldUtils",
"org.joda.time.chrono.GJChronology$CutoverField",
"org.joda.time.chrono.GJChronology$ImpreciseCutoverField",
"org.joda.time.chrono.GJChronology$LinkedDurationField",
"org.joda.time.field.SkipUndoDateTimeField",
"org.joda.time.base.AbstractDateTime",
"org.joda.time.base.BaseDateTime",
"org.joda.time.DateTime",
"org.joda.time.chrono.LimitChronology",
"org.joda.time.chrono.LimitChronology$LimitDurationField",
"org.joda.time.chrono.LimitChronology$LimitDateTimeField",
"org.joda.time.chrono.BuddhistChronology",
"org.joda.time.chrono.ZonedChronology",
"org.joda.time.chrono.ZonedChronology$ZonedDurationField",
"org.joda.time.chrono.ZonedChronology$ZonedDateTimeField",
"org.joda.time.tz.UTCProvider",
"org.joda.time.base.AbstractPartial",
"org.joda.time.base.BaseLocal",
"org.joda.time.LocalDate",
"org.joda.time.chrono.ISOYearOfEraDateTimeField",
"org.joda.time.chrono.ISOChronology",
"org.joda.time.tz.CachedDateTimeZone$Info",
"org.joda.time.base.AbstractPeriod",
"org.joda.time.base.BasePeriod$1",
"org.joda.time.base.BasePeriod",
"org.joda.time.PeriodType",
"org.joda.time.Period",
"org.joda.time.base.BaseSingleFieldPeriod",
"org.joda.time.format.ISOPeriodFormat",
"org.joda.time.format.PeriodFormatterBuilder",
"org.joda.time.format.PeriodFormatterBuilder$Literal",
"org.joda.time.format.PeriodFormatterBuilder$FieldFormatter",
"org.joda.time.format.PeriodFormatterBuilder$SimpleAffix",
"org.joda.time.format.PeriodFormatterBuilder$Composite",
"org.joda.time.format.PeriodFormatterBuilder$Separator",
"org.joda.time.format.PeriodFormatter",
"org.joda.time.Weeks",
"org.joda.time.DateMidnight",
"org.joda.time.IllegalFieldValueException",
"org.joda.time.format.DateTimeFormatter",
"org.joda.time.LocalDateTime",
"org.joda.time.format.DateTimeParserBucket",
"org.joda.time.MutableDateTime",
"org.joda.time.base.AbstractDuration",
"org.joda.time.base.BaseDuration",
"org.joda.time.Duration",
"org.joda.time.DateTimeUtils$OffsetMillisProvider",
"org.joda.time.MutablePeriod",
"org.joda.time.chrono.IslamicChronology$LeapYearPatternType",
"org.joda.time.chrono.IslamicChronology",
"org.joda.time.chrono.LenientChronology",
"org.joda.time.field.LenientDateTimeField",
"org.joda.time.convert.ConverterManager",
"org.joda.time.convert.ConverterSet",
"org.joda.time.convert.AbstractConverter",
"org.joda.time.convert.ReadableInstantConverter",
"org.joda.time.convert.StringConverter",
"org.joda.time.convert.CalendarConverter",
"org.joda.time.convert.DateConverter",
"org.joda.time.convert.LongConverter",
"org.joda.time.convert.NullConverter",
"org.joda.time.convert.ReadablePartialConverter",
"org.joda.time.convert.ReadableDurationConverter",
"org.joda.time.convert.ReadableIntervalConverter",
"org.joda.time.convert.ReadablePeriodConverter",
"org.joda.time.convert.ConverterSet$Entry",
"org.joda.time.DateTimeUtils$FixedMillisProvider",
"org.joda.time.chrono.BasicFixedMonthChronology",
"org.joda.time.chrono.CopticChronology",
"org.joda.time.chrono.LimitChronology$LimitException",
"org.joda.time.Months",
"org.joda.time.Days",
"org.joda.time.format.DateTimeFormatterBuilder",
"org.joda.time.format.DateTimeFormatterBuilder$TimeZoneOffset",
"org.joda.time.Partial",
"org.joda.time.LocalTime",
"org.joda.time.Seconds",
"org.joda.time.base.BasePartial",
"org.joda.time.format.ISODateTimeFormat",
"org.joda.time.format.DateTimeFormatterBuilder$NumberFormatter",
"org.joda.time.format.DateTimeFormatterBuilder$PaddedNumber",
"org.joda.time.format.DateTimeFormatterBuilder$CharacterLiteral",
"org.joda.time.format.DateTimeFormatterBuilder$Composite",
"org.joda.time.format.DateTimeFormatterBuilder$MatchingParser",
"org.joda.time.format.DateTimeFormatterBuilder$StringLiteral",
"org.joda.time.format.DateTimeFormatterBuilder$UnpaddedNumber",
"org.joda.time.format.DateTimeFormat",
"org.joda.time.MonthDay",
"org.joda.time.YearMonth",
"org.joda.time.Minutes",
"org.joda.time.chrono.EthiopicChronology",
"org.joda.time.base.AbstractInterval",
"org.joda.time.base.BaseInterval",
"org.joda.time.Interval",
"org.joda.time.format.DateTimeParserBucket$SavedState",
"org.joda.time.MutableInterval",
"org.joda.time.field.AbstractReadableInstantFieldProperty",
"org.joda.time.MutableDateTime$Property",
"org.joda.time.chrono.StrictChronology",
"org.joda.time.field.StrictDateTimeField",
"org.joda.time.format.DateTimeFormatterBuilder$Fraction",
"org.joda.time.Years",
"org.joda.time.LocalDate$Property",
"org.joda.time.DateTime$Property",
"org.joda.time.format.DateTimeParserBucket$SavedField",
"org.joda.time.LocalDateTime$Property",
"org.joda.time.Hours",
"org.joda.time.field.UnsupportedDateTimeField",
"org.joda.time.IllegalInstantException",
"org.joda.time.DateMidnight$Property",
"org.joda.time.format.DateTimeFormatterBuilder$TextField",
"org.joda.time.LocalTime$Property",
"org.joda.time.JodaTimePermission"
);
}
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
90e734e4ae052fb995b66a65c7cbf4787d43a014 | 900327a0032689db225cb1a971c19869d30921bc | /com.yz.edu.bms/src/main/java/com/yz/service/educational/OaTaskAsynAddStuService.java | 33ca9271dafe81da84f777026afa4ef784b1e00a | [] | no_license | ZhaoYu1105/yz | 4d4c5e907110905bc65ebbce864f1d12de72a176 | 3c1fded07c536cf5bda225010a9e9cf7b8336eea | refs/heads/master | 2023-01-05T17:08:46.279083 | 2020-08-04T09:01:55 | 2020-08-04T09:01:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,191 | java | package com.yz.service.educational;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.dubbo.config.annotation.Reference;
import com.yz.api.UsInfoApi;
import com.yz.dao.educational.OaTaskInfoMapper;
import com.yz.dao.gk.StudentCityAffirmGKMapper;
import com.yz.dao.gk.StudentGraduateExamGKMapper;
import com.yz.dao.refund.UsInfoMapper;
import com.yz.dao.stdService.StudentCollectMapper;
import com.yz.dao.stdService.StudentDegreeEnglishMapper;
import com.yz.dao.stdService.StudentExamAffirmMapper;
import com.yz.dao.stdService.StudentGraduateDataMapper;
import com.yz.dao.stdService.StudentGraduatePaperMapper;
import com.yz.dao.stdService.StudentLectureNoticeMapper;
import com.yz.dao.stdService.StudentQingshuMapper;
import com.yz.dao.stdService.StudentXuexinMapper;
import com.yz.generator.IDGenerator;
import com.yz.model.educational.OaTaskInfo;
import com.yz.model.educational.OaTaskStudentInfo;
import com.yz.model.gk.StudentCityAffirmGKInfo;
import com.yz.model.gk.StudentGraduateExamGKInfo;
import com.yz.model.gk.StudentGraduateExamGKInfoSub;
import com.yz.model.stdService.StudentCollectInfo;
import com.yz.model.stdService.StudentDegreeEnglishInfo;
import com.yz.model.stdService.StudentExamAffirmInfo;
import com.yz.model.stdService.StudentGraduateDataInfo;
import com.yz.model.stdService.StudentGraduatePaperInfo;
import com.yz.model.stdService.StudentLectureNoticeInfo;
import com.yz.model.stdService.StudentQingshuInfo;
import com.yz.model.stdService.StudentXuexinInfo;
import com.yz.util.StringUtil;
/**
* ๅผๆญฅๆทปๅ ๆ่
ๅ ้คๅญฆๅไฟกๆฏ
* @author lx
* @date 2017ๅนด12ๆ15ๆฅ ไธๅ12:13:10
*/
@Service
public class OaTaskAsynAddStuService
{
private static final Logger log = LoggerFactory.getLogger(OaTaskAsynAddStuService.class);
@Autowired
private OaTaskInfoMapper oaTaskInfoMapper;
@Autowired
private StudentExamAffirmMapper examAffirmMapper;
@Autowired
private StudentGraduateDataMapper graduateDataMapper;
@Autowired
private StudentXuexinMapper studentXueXinMapper;
@Reference(version="1.0")
private UsInfoApi usInfoApi;
@Autowired
private StudentDegreeEnglishMapper stuDegreeEnglishMapper;
@Autowired
private StudentGraduatePaperMapper stuGraduatePaperMapper;
@Autowired
private StudentLectureNoticeMapper stuLectureNoticeMapper;
@Autowired
private StudentCollectMapper stuCollectMapper;
@Autowired
private StudentQingshuMapper stuQingShuMapper;
@Autowired
private UsInfoMapper usInfoMapper;
@Autowired
private StudentCityAffirmGKMapper ctiyAffirmGKMapper;
@Autowired
private StudentGraduateExamGKMapper gkUnifiedExamMapper;
private int tSize = 5;
private int isDone = 0;
private static final ExecutorService executor = Executors.newCachedThreadPool();
/*******************ๅผๆญฅๆทปๅ **********************************/
public void addStuInfoAsyn(List<OaTaskStudentInfo> list,OaTaskInfo taskInfo) {
final int count = list.size();
final int eSize = count / tSize;
for (int i = 1; i <= tSize; i++) {
final int ii = i;
executor.execute(new Runnable() {
@Override
public void run() {
addAllStu(ii, eSize, count, list,taskInfo);
isDone++;
log.error("----------------------------------- ๅญฆๆไปปๅกๆ นๆฎๆกไปถๆทปๅ ๅญฆๅ๏ผ ็บฟ็จ[" + ii + "] is done! | " + isDone);
}
});
}
}
private void addAllStu(int num, int eSize, int all,List<OaTaskStudentInfo> importList, OaTaskInfo taskInfo) {
int _size = 400;
int _count = num == tSize ? all : eSize * num;
int _start = num == 1 ? 0 : ((num - 1) * eSize);
log.error("------------------------------- ๅญฆๆไปปๅกๆ นๆฎๆกไปถๆทปๅ ๅญฆๅ๏ผ ็บฟ็จ[" + num + "] ๏ผ่ตทๅง๏ผ" + _start + " | ๆปๆฐ๏ผ" + _count + " | ๆฏ้กต๏ผ"
+ _size);
int batch = 1;
while (_start < _count) {
int __size = 0;
if (_start + _size > _count) {
__size = _count - _start;
} else {
__size = _size;
}
List<OaTaskStudentInfo> list = importList.subList(_start, _start + __size);
if (list != null) {
for (OaTaskStudentInfo stuInfo : list) {
try {
int count = oaTaskInfoMapper.getCountByLearnIdAndTaskId(stuInfo.getLearnId(), taskInfo.getTaskId());
if(count ==0){
String userId = oaTaskInfoMapper.getUserIdByLearnId(stuInfo.getLearnId());
if (StringUtil.hasValue(userId)) {
//่ฐ็จๆฅๅฃ่ทๅopenId;
Object openId = usInfoMapper.selectUserOpenId(userId);
if(null != openId){
stuInfo.setOpenId(openId.toString());
}
}
stuInfo.setTaskId(taskInfo.getTaskId());
oaTaskInfoMapper.singleAddStu(stuInfo);
//้ๅฏน่ๅบ็กฎ่ฎค็ไปปๅกๆง่ก
if(taskInfo.getTaskType().equals("4")){
StudentExamAffirmInfo affirmInfo =new StudentExamAffirmInfo();
affirmInfo.setLearnId(stuInfo.getLearnId());
affirmInfo.setTaskId(taskInfo.getTaskId());
affirmInfo.setEyId(taskInfo.getEyId());
affirmInfo.setAffirmId(IDGenerator.generatorId());
examAffirmMapper.singleAddStuExamAffirm(affirmInfo);
}else if(taskInfo.getTaskType().equals("6")){ //ๆฏไธ่ตๆๆไบค
StudentGraduateDataInfo dataInfo = new StudentGraduateDataInfo();
dataInfo.setLearnId(stuInfo.getLearnId());
dataInfo.setTaskId(taskInfo.getTaskId());
dataInfo.setStdId(stuInfo.getStdId());
dataInfo.setId(IDGenerator.generatorId());
graduateDataMapper.singleAddStuGraduateData(dataInfo);
}else if(taskInfo.getTaskType().equals("7")){ //ๅญฆไฟก็ฝไฟกๆฏๆ ธๅฏน
StudentXuexinInfo xueXinInfo = new StudentXuexinInfo();
xueXinInfo.setLearnId(stuInfo.getLearnId());
xueXinInfo.setTaskId(taskInfo.getTaskId());
xueXinInfo.setXuexinId(IDGenerator.generatorId());
studentXueXinMapper.singleAddStuXueXinInfo(xueXinInfo);
}else if(taskInfo.getTaskType().equals("8")){ //ๅญฆไฝ่ฑ่ฏญ
StudentDegreeEnglishInfo englishInfo = new StudentDegreeEnglishInfo();
englishInfo.setLearnId(stuInfo.getLearnId());
englishInfo.setTaskId(taskInfo.getTaskId());
englishInfo.setDegreeId(IDGenerator.generatorId());
stuDegreeEnglishMapper.singleAddStuEnglishInfo(englishInfo);
}else if(taskInfo.getTaskType().equals("9")){ //ๆฏไธ่ฎบๆๅๆฅๅ
int cunt =stuGraduatePaperMapper.checkIfExistByLearnId(stuInfo.getLearnId());
if (cunt == 0) {
StudentGraduatePaperInfo paperInfo = new StudentGraduatePaperInfo();
paperInfo.setLearnId(stuInfo.getLearnId());
paperInfo.setTaskId(taskInfo.getTaskId());
paperInfo.setGpId(IDGenerator.generatorId());
stuGraduatePaperMapper.singleAddStuGraduatePaperInfo(paperInfo);
}
}else if(taskInfo.getTaskType().equals("10")){ //ๅผ่ฏพ้็ฅ
StudentLectureNoticeInfo noticeInfo = new StudentLectureNoticeInfo();
noticeInfo.setLearnId(stuInfo.getLearnId());
noticeInfo.setTaskId(taskInfo.getTaskId());
noticeInfo.setLectureId(IDGenerator.generatorId());
stuLectureNoticeMapper.singleAddStuLectureNotcieInfo(noticeInfo);
}else if(taskInfo.getTaskType().equals("11")){ //ๆฐ็ๅญฆ็ฑ่ตๆๆไบค
int cunt =stuCollectMapper.checkIfExistByLearnId(stuInfo.getLearnId());
if(cunt ==0){
StudentCollectInfo collInfo = new StudentCollectInfo();
collInfo.setLearnId(stuInfo.getLearnId());
collInfo.setTaskId(taskInfo.getTaskId());
collInfo.setCtId(IDGenerator.generatorId());
stuCollectMapper.singleAddStuCollectInfo(collInfo);
}
}else if(taskInfo.getTaskType().equals("12")){ //้ไนฆๅญฆๅ
int cunt = stuQingShuMapper.checkIfExistByLearnId(stuInfo.getLearnId());
if(cunt ==0){
StudentQingshuInfo shuInfo = new StudentQingshuInfo();
shuInfo.setLearnId(stuInfo.getLearnId());
shuInfo.setTaskId(taskInfo.getTaskId());
shuInfo.setQingshuId(IDGenerator.generatorId());
stuQingShuMapper.singleAddStuQingShuInfo(shuInfo);
}
}else if(taskInfo.getTaskType().equals("13")){ //ๅฝๅผๅๅธ็กฎ่ฎค
int cunt = ctiyAffirmGKMapper.checkIfExistByLearnId(taskInfo.getEyId(),stuInfo.getLearnId());
if(cunt ==0){
StudentCityAffirmGKInfo cityAffirmInfo = new StudentCityAffirmGKInfo();
cityAffirmInfo.setLearnId(stuInfo.getLearnId());
cityAffirmInfo.setTaskId(taskInfo.getTaskId());
cityAffirmInfo.setEyId(taskInfo.getEyId());
cityAffirmInfo.setAffirmId(IDGenerator.generatorId());
ctiyAffirmGKMapper.singleAddStuCityAffirmInfo(cityAffirmInfo);
}
}else if(taskInfo.getTaskType().equals("14")){ //ๅฝๅผ็ป่
StudentGraduateExamGKInfo gkUnifiedInfo = gkUnifiedExamMapper.getStudentGraduateExamGKById(stuInfo.getLearnId());
if(gkUnifiedInfo == null){
StudentGraduateExamGKInfo gkUnifiedExam = new StudentGraduateExamGKInfo();
gkUnifiedExam.setLearnId(stuInfo.getLearnId());
gkUnifiedExam.setTaskId(taskInfo.getTaskId());
gkUnifiedExam.setFollowId(IDGenerator.generatorId());
gkUnifiedExamMapper.singleAddStuUnifiedExamInfo(gkUnifiedExam);
//้ป่ฎคๅๅงๅไธคไธช็ง็ฎ
List<StudentGraduateExamGKInfoSub> gkUnifiedExmaSub = new ArrayList<>(); //ๅฝๅผ็ป่ๅฏนๅบ็็ง็ฎ
for(int i=1;i<=2;i++){
StudentGraduateExamGKInfoSub subInfo = new StudentGraduateExamGKInfoSub();
subInfo.setId(IDGenerator.generatorId());
subInfo.setFollowId(gkUnifiedExam.getFollowId());
subInfo.setEnrollSubject(i+"");
gkUnifiedExmaSub.add(subInfo);
}
gkUnifiedExamMapper.addStuGkUnifiedExamSubInfo(gkUnifiedExmaSub);
}else{
gkUnifiedInfo.setTaskId(taskInfo.getTaskId());
gkUnifiedExamMapper.singleUpdateStuUnifiedExamInfo(gkUnifiedInfo);
}
}
}
} catch (Exception e) {
log.error("------------ ๅญฆๆไปปๅกๆ นๆฎๆกไปถๆทปๅ ๅญฆๅ๏ผๆทปๅ ๅผๅธธ="+stuInfo.getLearnId()+"ไฟกๆฏ:"+e.getMessage());
}
}
_start += _size;
batch++;
log.error("------------------------------- ๅญฆๆไปปๅกๆ นๆฎๆกไปถๆทปๅ ๅญฆๅ๏ผ [" + batch + "] ็บฟ็จ [" + num + "] ๏ผๅฝๅ่ฎฐๅฝๆฐ ๏ผ" + _start);
}
}
}
/**********************ๅผๆญฅๅ ้ค*************************************/
public void delStuInfoAsyn(List<OaTaskStudentInfo> list,OaTaskInfo taskInfo) {
final int count = list.size();
final int eSize = count / tSize;
for (int i = 1; i <= tSize; i++) {
final int ii = i;
executor.execute(new Runnable() {
@Override
public void run() {
delAllStu(ii, eSize, count, list,taskInfo);
isDone++;
log.error("----------------------------------- ๅญฆๆไปปๅกๆ นๆฎๆกไปถๅ ้คๅญฆๅ๏ผ ็บฟ็จ[" + ii + "] is done! | " + isDone);
}
});
}
}
private void delAllStu(int num, int eSize, int all,List<OaTaskStudentInfo> importList, OaTaskInfo taskInfo) {
int _size = 400;
int _count = num == tSize ? all : eSize * num;
int _start = num == 1 ? 0 : ((num - 1) * eSize);
log.error("------------------------------- ๅญฆๆไปปๅกๆ นๆฎๆกไปถๅ ้คๅญฆๅ๏ผ ็บฟ็จ[" + num + "] ๏ผ่ตทๅง๏ผ" + _start + " | ๆปๆฐ๏ผ" + _count + " | ๆฏ้กต๏ผ"
+ _size);
int batch = 1;
while (_start < _count) {
int __size = 0;
if (_start + _size > _count) {
__size = _count - _start;
} else {
__size = _size;
}
List<OaTaskStudentInfo> list = importList.subList(_start, _start + __size);
if (list != null) {
for (OaTaskStudentInfo stuInfo : list) {
try {
oaTaskInfoMapper.aloneDelStu(stuInfo.getLearnId(), taskInfo.getTaskId());
if (taskInfo.getTaskType().equals("4")) {
// ๅ ้ค่ๅบ็กฎ่ฎค็ไฟกๆฏ
examAffirmMapper.aloneDelStuExamAffirm(stuInfo.getLearnId(), taskInfo.getTaskId());
}else if(taskInfo.getTaskType().equals("6")){
//ๅ ้คๆฏไธ่ตๆๆไบค
graduateDataMapper.aloneDelStuGraduateData(stuInfo.getLearnId(), taskInfo.getTaskId());
}else if(taskInfo.getTaskType().equals("7")){
//ๅ ้คไฟกๆฏ็ฝไฟกๆฏๆ ธๅฏน
studentXueXinMapper.aloneDelStuXueXinInfo(stuInfo.getLearnId(), taskInfo.getTaskId());
}else if(taskInfo.getTaskType().equals("8")){
//ๅญฆไฝ่ฑ่ฏญ
stuDegreeEnglishMapper.aloneDelStuDegreeEnglishInfo(stuInfo.getLearnId(), taskInfo.getTaskId());
}else if(taskInfo.getTaskType().equals("9")){
//ๆฏไธ่ฎบๆๅๆฅๅ
stuGraduatePaperMapper.aloneDelStuGraduatePaperInfo(stuInfo.getLearnId(), taskInfo.getTaskId());
}else if(taskInfo.getTaskType().equals("10")){
//ๅผ่ฏพ้็ฅ
stuLectureNoticeMapper.aloneDelStuLectureNotcieInfo(stuInfo.getLearnId(), taskInfo.getTaskId());
}else if(taskInfo.getTaskType().equals("11")){
//ๅญฆ็ฑ่ตๆๆถ้
stuCollectMapper.aloneDelStuCollectInfo(stuInfo.getLearnId(), taskInfo.getTaskId());
}else if(taskInfo.getTaskType().equals("12")){
//้ไนฆๅญฆๅ
stuQingShuMapper.aloneDelStuQingShuInfo(stuInfo.getLearnId(), taskInfo.getTaskId());
}else if(taskInfo.getTaskType().equals("13")){
//ๅฝๅผๅๅธ็กฎ่ฎค
ctiyAffirmGKMapper.aloneDelStuCityAffirmInfo(stuInfo.getLearnId(), taskInfo.getTaskId());
}else if(taskInfo.getTaskType().equals("14")){
gkUnifiedExamMapper.aloneDelStuGkUnifiedExamInfo(stuInfo.getLearnId(), taskInfo.getTaskId());
}
} catch (Exception e) {
log.error("------------ ๅญฆๆไปปๅกๆ นๆฎๆกไปถๅ ้คๅญฆๅ๏ผๆทปๅ ๅผๅธธ="+stuInfo.getLearnId()+"ไฟกๆฏ:"+e.getMessage());
}
}
_start += _size;
batch++;
log.error("------------------------------- ๅญฆๆไปปๅกๆ นๆฎๆกไปถๅ ้คๅญฆๅ๏ผ [" + batch + "] ็บฟ็จ [" + num + "] ๏ผๅฝๅ่ฎฐๅฝๆฐ ๏ผ" + _start);
}
}
}
}
| [
"donggua131432@sina.cn"
] | donggua131432@sina.cn |
f3ae6a28a5dad05df8b5ade8e25bf0cb03ff4b04 | e152c5bdae47b94392dc0e0d9cc5aa2b0e2bccc7 | /project-management/src/main/java/com/kaush/pma/api/controllers/EmployeeApiController.java | 7fc1d8701c84a791a33bee3a8c010f5f9933c96f | [] | no_license | kaush-at/project-management-app | 2b61f0f90597af57d56550a7d0793858d69a5d78 | 55d243bd8ddefdfb8c64fab6357086f784c2fe6a | refs/heads/master | 2022-12-19T14:59:21.507624 | 2020-09-13T02:18:37 | 2020-09-13T02:18:37 | 280,997,510 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,810 | java | package com.kaush.pma.api.controllers;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import com.kaush.pma.dao.EmployeeRepository;
import com.kaush.pma.entities.Employee;
@RestController
@RequestMapping("/app-api/employees")
public class EmployeeApiController {
@Autowired
EmployeeRepository empRepo;
@GetMapping
public Iterable<Employee> getEmployees(){
return empRepo.findAll();
}
@GetMapping("/{id}")
public Employee getEmployeeById(@PathVariable("id") Long id) {
return empRepo.findById(id).get();
}
@PostMapping(consumes = "application/json")
@ResponseStatus(HttpStatus.CREATED)
public Employee create(@RequestBody @Valid Employee emp) {
return empRepo.save(emp);
}
@PutMapping(consumes = "application/json")
@ResponseStatus(HttpStatus.OK)
public Employee update(@RequestBody @Valid Employee employee) {
return empRepo.save(employee);
}
@PatchMapping(path="/{id}", consumes="application/json")
public Employee partialUpdate(@PathVariable("id") Long id, @RequestBody Employee emp) {
Employee employee = empRepo.findById(id).get();
if(emp.getEmail() != null) {
employee.setEmail(emp.getEmail());
}
if(emp.getFirstName() != null) {
employee.setFirstName(emp.getFirstName());
}
if(emp.getLastName() != null) {
employee.setLastName(emp.getLastName());
}
return empRepo.save(employee);
}
@DeleteMapping("/{id}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void delete(@PathVariable("id") Long id) {
try {
empRepo.deleteById(id);
}catch(EmptyResultDataAccessException e){
}
}
// paging feature
@GetMapping(params= {"page", "size"})
@ResponseStatus(HttpStatus.OK)
public Iterable<Employee> findPaginatedEmployees(@RequestParam("page") int page, @RequestParam("size") int size){
Pageable pageAndSize = PageRequest.of(page, size);
return empRepo.findAll(pageAndSize);
}
}
| [
"emailtokaush@gmail.com"
] | emailtokaush@gmail.com |
dda2017b9fc1a742820020d3891e997f1b17b2dc | 06b0bdf184da7952f87be6fb94a16bd2f9683a29 | /src/main/java/ma/ousama/demo/service/GitHubRepoService.java | e3c798428635ae5462f36cc84833189e018769a9 | [] | no_license | OusamaELIDRISSI/BackendCodingChallenge | 607abe807ed6b464a859d1aea72232ccba1dbda8 | e6d51f2a7a7cee6b2fd5ff9c964c8d1f68ec1a22 | refs/heads/master | 2023-05-13T14:25:03.571328 | 2021-06-05T10:10:32 | 2021-06-05T10:10:32 | 373,874,962 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 762 | java | package ma.ousama.demo.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import ma.ousama.demo.domain.SearchResult;
@Service
public class GitHubRepoService {
@Autowired
private RestTemplate restTemplate;
@Value("${search.repo.url}")
private String baseUrl;
public SearchResult getRepositoriesByUser(String userName) {
return restTemplate.getForObject(baseUrl+"?q=user:" + userName, SearchResult.class);
}
public SearchResult getRepositoriesByLanguage(String language) {
return restTemplate.getForObject(baseUrl+"?q=language:" + language, SearchResult.class);
}
}
| [
"elidrissi.ousama.ma@gmail.com"
] | elidrissi.ousama.ma@gmail.com |
4c041c359dfe2c8001dd198af88fb5f56395ae50 | 1c671fb525a8a4f3d7a48f3092017d26917f99d6 | /src/main/java/nl/ramondevaan/taskestimation/web/task/TaskEditForm.java | 6ce9363f45d12e2cbfe589662453a244f96e55e7 | [] | no_license | ramondevaancapgemini/taskestimation | 6bf4e237fe99fabd0e1572bef57e5ec3c71b7cea | dd3e6bdd951f3f24a86f00efdc9351eecaae878a | refs/heads/master | 2021-09-06T14:19:12.542072 | 2018-02-07T12:20:02 | 2018-02-07T12:20:02 | 114,659,226 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,463 | java | package nl.ramondevaan.taskestimation.web.task;
import nl.ramondevaan.taskestimation.model.domain.Task;
import nl.ramondevaan.taskestimation.service.TaskService;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextArea;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.validation.validator.StringValidator;
import javax.inject.Inject;
public class TaskEditForm extends Form<Task> {
@Inject
private TaskService service;
public TaskEditForm(String id, IModel<Task> model) {
super(id, new CompoundPropertyModel<>(model));
}
@Override
protected void onInitialize() {
super.onInitialize();
TextField<String> name = new TextField<>("name");
name.setRequired(true);
name.add(StringValidator.minimumLength(1));
add(name);
TextArea<String> description = new TextArea<>("description");
description.setRequired(true);
description.add(StringValidator.minimumLength(1));
add(description);
FeedbackPanel feedbackPanel = new FeedbackPanel("feedbackErrors");
add(feedbackPanel);
}
@Override
protected void onSubmit() {
service.addTask(getModelObject());
setResponsePage(new TaskIndexPage());
}
}
| [
"ramon.de.vaan@capgemini.com"
] | ramon.de.vaan@capgemini.com |
70ce2c65d890def2ddb1843687380892c586e40e | 7d895978f0a59360b67d675cff0742d68b5b9095 | /src/NaryTree/Codec.java | 8bc7868093ff53fa2aa56b54b292b24c5eabe00c | [] | no_license | sureshrmdec/Algorithm-Java | b77ce99988b895377382c804f9fafe56a20a0521 | 4674652f2e0fc3a9c41dd0045c41fb0da95d8e5c | refs/heads/master | 2023-07-05T08:54:55.926110 | 2021-08-11T23:31:48 | 2021-08-11T23:31:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,698 | java | package NaryTree;
import java.util.ArrayList;
import java.util.List;
/**
* Created by xhu on 6/23/17.
*/
public class Codec {
final char endMarker = ')';
int index = 0;
public String serialize(NTreeNode root){
if( root == null){
return "";
}
StringBuilder result = new StringBuilder();
serializeHelper(root, result);
return result.toString();
}
private void serializeHelper(NTreeNode root, StringBuilder result){
if(root == null){
result.append(endMarker);
}
result.append(String.valueOf(root.vaule));
if(root.children == null || root.children.size() == 0){
result.append(endMarker);
}else {
for (NTreeNode n : root.children) {
serializeHelper(n, result);
}
result.append(endMarker);
}
}
public NTreeNode deserialize(String code){
if(code == null || code.length() == 0){
return null;
}
NTreeNode root = deserializeHelper(code);
return root;
}
private NTreeNode deserializeHelper(String code){
if(index >= code.length() ){
return null;
}
if(code.charAt(index) == endMarker){
return null;
}
NTreeNode root = new NTreeNode(Character.getNumericValue(code.charAt(index)));
index++;
for(int i = 0; i<code.length() && index<code.length(); i++){
if(code.charAt(index) == endMarker){
break;
}
root.children.add(deserializeHelper(code));
index++;
}
return root;
}
}
| [
"huyoucai.huxin@gmail.com"
] | huyoucai.huxin@gmail.com |
dea03a882d9230ced4f003de994f17b76cadaf3f | fa34634b84455bf809dbfeeee19f8fb7e26b6f76 | /4.JavaCollections/src/com/javarush/task/task38/task3810/Date.java | 6100a458cf05c5bd045f8c0d954da95ab33711f0 | [
"Apache-2.0"
] | permissive | Ponser2000/JavaRushTasks | 3b4bdd2fa82ead3c72638f0f2826db9f871038cc | e6eb2e8ee2eb7df77273f2f0f860f524400f72a2 | refs/heads/main | 2023-04-04T13:23:52.626862 | 2021-03-25T10:43:04 | 2021-03-25T10:43:04 | 322,064,721 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 419 | java | package com.javarush.task.task38.task3810;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Date {
//ะฝะฐะฟะธัะธ ัะฒะพะน ะบะพะด
int year();
int month();
int day();
int hour();
int minute();
int second();
}
| [
"ponser2000@gmail.com"
] | ponser2000@gmail.com |
9ce805be5a5c9940009c386987142ce62c3fd8fd | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Math/58/org/apache/commons/math/random/MersenneTwister_setSeed_209.java | 394f89bd949763a3ede7f1f5c3fc891721e715ae | [] | no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 1,856 | java |
org apach common math random
power pseudo random number gener
develop makoto matsumoto takuji nishimura
gener featur extrem period
dimension equidistribut
bit accuraci home page gener locat
href http www math sci hiroshima mat emt html
http www math sci hiroshima mat emt html
gener paper makoto matsumoto
takuji nishimura
href http www math sci hiroshima mat articl pdf mersenn
twister dimension equidistribut uniform pseudo random
number gener acm transact model comput
simul vol januari
java port version
gener written makoto matsumoto takuji
nishimura origin copyright
tabl border width cellpad align center bgcolor e0e0e0
copyright makoto matsumoto takuji nishimura
right reserv
redistribut sourc binari form
modif permit provid condit
met
redistribut sourc code retain copyright
notic list condit disclaim
redistribut binari form reproduc copyright
notic list condit disclaim
document materi provid distribut
name contributor endors promot
product deriv softwar specif prior written
permiss
strong softwar provid copyright holder
contributor express impli warranti
includ limit impli warranti
merchant fit purpos
disclaim event copyright owner contributor
liabl direct indirect incident special exemplari
consequenti damag includ limit
procur substitut good servic loss data
profit busi interrupt caus theori
liabil contract strict liabil tort
includ neglig aris
softwar advis possibl
damag strong
tabl
version revis date
mersenn twister mersennetwist bit stream gener bitsstreamgener serializ
reiniti gener built seed
state gener
gener built seed
param seed initi seed bit integ
overrid
set seed setse seed
set seed setse seed seed 0xffffffffl
| [
"hvdthong@gmail.com"
] | hvdthong@gmail.com |
92057c94617037c89549234d465aa62fc9e52d4c | 291541f10e39214307d21e7cc77f13bed5ffbe30 | /app/src/main/java/com/ipd/xiangzui/utils/NavigationBarUtil.java | f15e9c8b5af187d6ee323545c71307fe407c295e | [] | no_license | RenVeCf/XiangZui | ae8ed965f749bfeadf9f2f2c07b4c1705a29656c | 456679cd1be9e4949db2fbfa78aa5493bdd3d890 | refs/heads/master | 2020-06-27T13:43:42.509152 | 2019-10-11T05:49:23 | 2019-10-11T05:49:23 | 199,968,238 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,982 | java | package com.ipd.xiangzui.utils;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Rect;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import java.lang.reflect.Method;
/**
* Description ๏ผ
* Author ๏ผ MengYang
* Email ๏ผ 942685687@qq.com
* Time ๏ผ 2018/9/2.
*/
public class NavigationBarUtil {
public static void initActivity(View content) {
new NavigationBarUtil(content);
}
private View mObserved;//่ขซ็ๅฌ็่งๅพ
private int usableHeightView;//่งๅพๅๅๅ็ๅฏ็จ้ซๅบฆ
private ViewGroup.LayoutParams layoutParams;
private NavigationBarUtil(View content) {
mObserved = content;
//็ปViewๆทปๅ ๅ
จๅฑ็ๅธๅฑ็ๅฌๅจ็ๅฌ่งๅพ็ๅๅ
mObserved.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
public void onGlobalLayout() {
resetViewHeight();
}
});
layoutParams = mObserved.getLayoutParams();
}
/**
* ้็ฝฎ่งๅพ็้ซๅบฆ๏ผไฝฟไธ่ขซๅบ้จ่ๆ้ฎ้ฎๆก
*/
private void resetViewHeight() {
int usableHeightViewNow = CalculateAvailableHeight();
//ๆฏ่พๅธๅฑๅๅๅๅ็View็ๅฏ็จ้ซๅบฆ
if (usableHeightViewNow != usableHeightView) {
//ๅฆๆไธคๆฌก้ซๅบฆไธไธ่ด
//ๅฐๅฝๅ็View็ๅฏ็จ้ซๅบฆ่ฎพ็ฝฎๆView็ๅฎ้
้ซๅบฆ
layoutParams.height = usableHeightViewNow;
mObserved.requestLayout();//่ฏทๆฑ้ๆฐๅธๅฑ
usableHeightView = usableHeightViewNow;
}
}
/**
* ่ฎก็ฎ่งๅพ้ซๅบฆ
*
* @return
*/
private int CalculateAvailableHeight() {
Rect r = new Rect();
mObserved.getWindowVisibleDisplayFrame(r);
// return (r.bottom - r.top);//ๅฆๆไธๆฏๆฒๆตธ็ถๆๆ ๏ผ้่ฆๅๅป้กถ้จ้ซๅบฆ
return (r.bottom);//ๅฆๆๆฏๆฒๆตธ็ถๆๆ
}
/**
* ๅคๆญๅบ้จๆฏๅฆๆ่ๆ้ฎ
*
* @param context
* @return
*/
public static boolean hasNavigationBar(Context context) {
boolean hasNavigationBar = false;
Resources rs = context.getResources();
int id = rs.getIdentifier("config_showNavigationBar", "bool", "android");
if (id > 0) {
hasNavigationBar = rs.getBoolean(id);
}
try {
Class systemPropertiesClass = Class.forName("android.os.SystemProperties");
Method m = systemPropertiesClass.getMethod("get", String.class);
String navBarOverride = (String) m.invoke(systemPropertiesClass, "qemu.hw.mainkeys");
if ("1".equals(navBarOverride)) {
hasNavigationBar = false;
} else if ("0".equals(navBarOverride)) {
hasNavigationBar = true;
}
} catch (Exception e) {
}
return hasNavigationBar;
}
}
| [
"942685687@qq.com"
] | 942685687@qq.com |
366488bbee426651c2d4891f50b2f430903c7bc4 | 346159f32db47ae6a2532ef256df54388f042e71 | /niaobulashi-system/src/main/java/com/niaobulashi/system/service/impl/SysDeptServiceImpl.java | eeee5f1cdc5996c69769c17fee72998099d1aa7c | [
"MIT"
] | permissive | weiweidong1993/niaobulashi-fast | 2c709cddb7f921aa7d125f145a2fe52019526ec8 | 5024892d8f547f4ec4a7e331849e1ba0290ad3c3 | refs/heads/master | 2021-03-14T04:19:08.805096 | 2019-08-19T14:45:29 | 2019-08-19T14:45:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,693 | java | package com.niaobulashi.system.service.impl;
import com.niaobulashi.common.annotation.DataScope;
import com.niaobulashi.common.constant.UserConstants;
import com.niaobulashi.common.core.domain.Ztree;
import com.niaobulashi.common.exception.BusinessException;
import com.niaobulashi.common.utils.StringUtils;
import com.niaobulashi.system.domain.SysDept;
import com.niaobulashi.system.domain.SysRole;
import com.niaobulashi.system.mapper.SysDeptMapper;
import com.niaobulashi.system.service.SysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
* @program: niaobulashi-fast
* @description:
* @author: ้ธไธๆๅฑ https://niaobulashi.com
* @create: 2019-08-03 18:00
*/
@Service
public class SysDeptServiceImpl implements SysDeptService {
@Autowired
private SysDeptMapper deptMapper;
/**
* ๆฅ่ฏข้จ้จ็ฎก็ๆฐๆฎ
*
* @param dept ้จ้จไฟกๆฏ
* @return ้จ้จไฟกๆฏ้ๅ
*/
@Override
@DataScope(deptAlias = "d")
public List<SysDept> selectDeptList(SysDept dept) {
return deptMapper.selectDeptList(dept);
}
/**
* ๆฅ่ฏข้จ้จ็ฎก็ๆ
*
* @param dept ้จ้จไฟกๆฏ
* @return ๆๆ้จ้จไฟกๆฏ
*/
@Override
@DataScope(deptAlias = "d")
public List<Ztree> selectDeptTree(SysDept dept) {
List<SysDept> deptList = deptMapper.selectDeptList(dept);
List<Ztree> ztrees = initZtree(deptList);
return ztrees;
}
/**
* ๆ นๆฎ่ง่ฒIDๆฅ่ฏข้จ้จ๏ผๆฐๆฎๆ้๏ผ
*
* @param role ่ง่ฒๅฏน่ฑก
* @return ้จ้จๅ่กจ๏ผๆฐๆฎๆ้๏ผ
*/
@Override
public List<Ztree> roleDeptTreeData(SysRole role) {
Long roleId = role.getRoleId();
List<Ztree> ztrees = new ArrayList<Ztree>();
List<SysDept> deptList = selectDeptList(new SysDept());
if (StringUtils.isNotNull(roleId)) {
List<String> roleDeptList = deptMapper.selectRoleDeptTree(roleId);
ztrees = initZtree(deptList, roleDeptList);
} else {
ztrees = initZtree(deptList);
}
return ztrees;
}
/**
* ๅฏน่ฑก่ฝฌ้จ้จๆ
*
* @param deptList ้จ้จๅ่กจ
* @return ๆ ็ปๆๅ่กจ
*/
public List<Ztree> initZtree(List<SysDept> deptList) {
return initZtree(deptList, null);
}
/**
* ๅฏน่ฑก่ฝฌ้จ้จๆ
*
* @param deptList ้จ้จๅ่กจ
* @param roleDeptList ่ง่ฒๅทฒๅญๅจ่ๅๅ่กจ
* @return ๆ ็ปๆๅ่กจ
*/
public List<Ztree> initZtree(List<SysDept> deptList, List<String> roleDeptList) {
List<Ztree> ztrees = new ArrayList<Ztree>();
boolean isCheck = StringUtils.isNotNull(roleDeptList);
for (SysDept dept : deptList) {
if (UserConstants.DEPT_NORMAL.equals(dept.getStatus())) {
Ztree ztree = new Ztree();
ztree.setId(dept.getDeptId());
ztree.setpId(dept.getParentId());
ztree.setName(dept.getDeptName());
ztree.setTitle(dept.getDeptName());
if (isCheck) {
ztree.setChecked(roleDeptList.contains(dept.getDeptId() + dept.getDeptName()));
}
ztrees.add(ztree);
}
}
return ztrees;
}
/**
* ๆฅ่ฏข้จ้จไบบๆฐ
*
* @param parentId ้จ้จID
* @return ็ปๆ
*/
@Override
public int selectDeptCount(Long parentId) {
SysDept dept = new SysDept();
dept.setParentId(parentId);
return deptMapper.selectDeptCount(dept);
}
/**
* ๆฅ่ฏข้จ้จๆฏๅฆๅญๅจ็จๆท
*
* @param deptId ้จ้จID
* @return ็ปๆ true ๅญๅจ false ไธๅญๅจ
*/
@Override
public boolean checkDeptExistUser(Long deptId) {
int result = deptMapper.checkDeptExistUser(deptId);
return result > 0 ? true : false;
}
/**
* ๅ ้ค้จ้จ็ฎก็ไฟกๆฏ
*
* @param deptId ้จ้จID
* @return ็ปๆ
*/
@Override
public int deleteDeptById(Long deptId)
{
return deptMapper.deleteDeptById(deptId);
}
/**
* ๆฐๅขไฟๅญ้จ้จไฟกๆฏ
*
* @param dept ้จ้จไฟกๆฏ
* @return ็ปๆ
*/
@Override
public int insertDept(SysDept dept) {
SysDept info = deptMapper.selectDeptById(dept.getParentId());
// ๅฆๆ็ถ่็นไธไธบ"ๆญฃๅธธ"็ถๆ,ๅไธๅ
่ฎธๆฐๅขๅญ่็น
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) {
throw new BusinessException("้จ้จๅ็จ๏ผไธๅ
่ฎธๆฐๅข");
}
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
return deptMapper.insertDept(dept);
}
/**
* ไฟฎๆนไฟๅญ้จ้จไฟกๆฏ
*
* @param dept ้จ้จไฟกๆฏ
* @return ็ปๆ
*/
@Override
@Transactional
public int updateDept(SysDept dept) {
SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId());
SysDept oldDept = selectDeptById(dept.getDeptId());
if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) {
String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId();
String oldAncestors = oldDept.getAncestors();
dept.setAncestors(newAncestors);
updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors);
}
int result = deptMapper.updateDept(dept);
if (UserConstants.DEPT_NORMAL.equals(dept.getStatus())) {
// ๅฆๆ่ฏฅ้จ้จๆฏๅฏ็จ็ถๆ๏ผๅๅฏ็จ่ฏฅ้จ้จ็ๆๆไธ็บง้จ้จ
updateParentDeptStatus(dept);
}
return result;
}
/**
* ไฟฎๆน่ฏฅ้จ้จ็็ถ็บง้จ้จ็ถๆ
*
* @param dept ๅฝๅ้จ้จ
*/
private void updateParentDeptStatus(SysDept dept)
{
String updateBy = dept.getUpdateBy();
dept = deptMapper.selectDeptById(dept.getDeptId());
dept.setUpdateBy(updateBy);
deptMapper.updateDeptStatus(dept);
}
/**
* ไฟฎๆนๅญๅ
็ด ๅ
ณ็ณป
*
* @param deptId ่ขซไฟฎๆน็้จ้จID
* @param newAncestors ๆฐ็็ถID้ๅ
* @param oldAncestors ๆง็็ถID้ๅ
*/
public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors)
{
List<SysDept> children = deptMapper.selectChildrenDeptById(deptId);
for (SysDept child : children)
{
child.setAncestors(child.getAncestors().replace(oldAncestors, newAncestors));
}
if (children.size() > 0)
{
deptMapper.updateDeptChildren(children);
}
}
/**
* ๆ นๆฎ้จ้จIDๆฅ่ฏขไฟกๆฏ
*
* @param deptId ้จ้จID
* @return ้จ้จไฟกๆฏ
*/
@Override
public SysDept selectDeptById(Long deptId)
{
return deptMapper.selectDeptById(deptId);
}
/**
* ๆ ก้ช้จ้จๅ็งฐๆฏๅฆๅฏไธ
*
* @param dept ้จ้จไฟกๆฏ
* @return ็ปๆ
*/
@Override
public String checkDeptNameUnique(SysDept dept)
{
Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId();
SysDept info = deptMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId());
if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue())
{
return UserConstants.DEPT_NAME_NOT_UNIQUE;
}
return UserConstants.DEPT_NAME_UNIQUE;
}
}
| [
"hulang6666@qq.com"
] | hulang6666@qq.com |
c01d05bab43df8ed1451d420f3caea3c1b57f884 | 727a3f90471606a48d19b83431b3cb938806e70a | /demo/gen/com/example/NavItem.java | 76bad2848750414081c7cbde62d6d920d6118e7b | [] | no_license | audinue/jtg | 4f85d3844a8b9b0a2f5001c3135eccf9df9e0b5e | 7a7180af7107787dbacc4e60dbfb7471db9d76c2 | refs/heads/master | 2021-01-07T07:18:16.016569 | 2020-02-20T06:50:17 | 2020-02-20T06:50:17 | 241,617,321 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 743 | java | package com.example;
public final class NavItem extends jtg.Template {
private jtg.Text _href = jtg.Text.EMPTY;
private jtg.Text _text = jtg.Text.EMPTY;
public NavItem withHref(jtg.Text value) {
_href = value;
return this;
}
public NavItem withText(jtg.Text value) {
_text = value;
return this;
}
@Override
public void appendTo(java.lang.StringBuilder sb, java.lang.String indentation) {
sb.append(indentation).append("<li>\n");
sb.append(indentation);
sb.append("\t<a href=\"");
_href.appendTo(sb);
sb.append("\">");
_text.appendTo(sb);
sb.append("</a>\n");
sb.append(indentation).append("</li>\n");
}
}
| [
"audinue@gmail.com"
] | audinue@gmail.com |
9de52ee6f3a7d06dfb7c9a076cbf34dbc9330bd5 | 50d52797092095b880530f19962070eb1c26495d | /src/com/ningdali/web/servlet/AdminInfoServlet.java | 7620589ec614c4a450f3af8302769fd60f8866f3 | [] | no_license | MrDalili/kexie | 42cd9297873279564df4374a54eb8b98609853b0 | b40e1a3050d09cabe210eb71669ae37d3224ab37 | refs/heads/master | 2020-05-14T06:11:10.096098 | 2019-04-16T14:22:29 | 2019-04-16T14:22:29 | 181,704,819 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,127 | java | package com.ningdali.web.servlet;
import com.ningdali.domain.Competition;
import com.ningdali.domain.User;
import com.ningdali.service.AdminInfoService;
import com.ningdali.service.CompetitionService;
import com.ningdali.service.serviceImp.AdminInfoServiceImp;
import com.ningdali.service.serviceImp.CompetitionServiceImp;
import com.ningdali.utils.MyUtils;
import com.ningdali.web.base.BaseServlet;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@WebServlet("/AdminInfoServlet")
public class AdminInfoServlet extends BaseServlet {
AdminInfoService adminInfoService = new AdminInfoServiceImp();
CompetitionService competitionService = new CompetitionServiceImp();
public String login(HttpServletRequest req, HttpServletResponse resp) throws Exception {
//่ทๅ็ป้้กต้ขไผ ่พ็่ดฆๅทๅฏ็
String account = req.getParameter("account");
String key = req.getParameter("password");
//ๅๅปบไธไธชๅฎไฝๅฏน่ฑก๏ผๅฐ่ดฆๅทๅฏ็ ๆพๅ
ฅๅฏน่ฑกไธญ
User user = new User();
user.setAaccount(account);
user.setApassword(key);
//่ฐ็จไธๅกๅฑๅคๆญ่ดฆๅทๅฏ็ ๆฏๅฆๆญฃ็กฎ
User user1 = adminInfoService.login(user);
//ๅคๆญuser1ๅ
ถไปๅฑๆงๆฏๅฆไธบ็ฉบ๏ผๅฆๆไธบ็ฉบ้ฃไน่ดฆๅทๅฏ็ ้่ฏฏ๏ผ็ป็ป้็ไบบ่ดฆๅทๆๅฏ็ ้่ฏฏ็ๆ็คบไฟกๆฏ
if (user1 == null){
req.setAttribute("msg","่ดฆๅทๆๅฏ็ ้่ฏฏ๏ผ่ฏท้ๆฐ่พๅ
ฅ");
//่ฏทๆฑ่ฝฌๅ่ณๅฝๅ้กต้ข๏ผๆพ็คบ่ฏฅไฟกๆฏ
return "admin/login.jsp";
}
user1.setAaccount(account);
//่ฐ็จไธๅกๅฑ่ทๅๅฐ่ฏฅ็จๆทๅๅธ็ๆดปๅจ
//่ฟๅไธไธชlist้ๅ
List<Competition> list = adminInfoService.queryAdminInfoByAaccount(user1);
//่ฐ็จไธๅกๅฑๆนๆณๅฐlistไธญ็ๆๆๆฏ่ตไธญ็ๆฏ่ตไบบๆฐ่ฎฐๅฝๆพ่ฟๅป
competitionService.setCompetitionTotalOfList(list);
//ๅฐๅฏนๅบ็ๆฏ่ต็ฎๅฝไธuserๅ
ณ่
user1.setCompetitionList(list);
//่ฐ็จไธๅกๅฑ่ทๅ่ฏฅuserไธ็ๆฏ่ตไธญ็ๆฅๅไบบไฟกๆฏ
competitionService.getCompetitionMember(user1);
//ๅฐๆปๅๅธๆฏ่ตไธชๆฐไธๆปๆฅๅไบบๆฐๆพๅ
ฅuserไธญ
adminInfoService.setMemberCount(user1);
//่ทๅ่ฏฅ็จๆทๆๅๅธๆฏ่ตไธญๆฅๅไบบๅๆๆฅๅ็ๆฏ่ตๅ็งฐ
MyUtils.setCompetitionNameForPersonOfUser(user1);
//ๅฐ็จๆทไฟกๆฏๅญๅ
ฅsessionไธญไปฅๆนไพฟๅๅป็ฎก็
req.getSession().setAttribute("user",user1);
//่ฝฌๅๅฐadmin/home.jsp
return "admin/jsp/welcome.jsp";
}
//ๆฅ่ฏขๆๅๅธ็ๆฏ่ต
//queryCompetitionInfoByAaccount
public String queryCompetitionInfoByAaccount(HttpServletRequest req, HttpServletResponse resp) throws Exception {
//่ทๅๅฐๆฐๆฎ่ฝฌๅๅฐ่ฟไธช็้ข
return "admin/jsp/competitionList.jsp";
}
//ๆฅ่ฏขๅๅธๆฏ่ตไธญ็ๆฅๅไบบๅไฟกๆฏ
//queryMemberOfCid
public String queryMemberOfCid(HttpServletRequest req, HttpServletResponse resp) throws Exception {
//่ฝฌๅๅฐๅๅบ็้กต้ข
return "admin/jsp/CompetitionInfo.jsp";
}
//ไธชไบบไฟกๆฏ้กต้ข
//queryMemberOfCid
public String queryAdminInfo(HttpServletRequest req, HttpServletResponse resp) throws Exception {
//่ฝฌๅๅฐๅๅบ็้กต้ข
return "admin/jsp/AdminInfo.jsp";
}
//ๆณจ้
public String signOut(HttpServletRequest req, HttpServletResponse resp) throws Exception {
//ๆถ้คsession
req.getSession().invalidate();
//่ฝฌๅๅฐ็ป้้กต้ข
return "admin/login.jsp";
}
//่ทณ่ฝฌๅฐไธป้กต
//method=goHomePage
public String goHomePage(HttpServletRequest req, HttpServletResponse resp) throws Exception {
//่ฝฌๅๅฐไธป้กต้ข
return "admin/jsp/welcome.jsp";
}
@Override
public void init() throws ServletException {
System.out.println("admin");
}
}
| [
"goodMorning@atgui.com"
] | goodMorning@atgui.com |
b23a808dc643d60553ba0873be657afb709c3460 | 3303e0e547d13e984a01da9dfe6fe6df4ea42097 | /app/src/main/java/com/store/inventory/adapters/RecommendedProductAdapter.java | fc4e7b02591770ff551b32774a8af49e67eb54b3 | [] | no_license | rg0699/BTP-Inventory-Recommender-App | 3e5849b6d08f95d39c6dc9fe27491f3c084f7ab1 | 178568ac398e51a329acb76cc91751ee637dd2db | refs/heads/master | 2023-04-22T17:59:41.966304 | 2021-04-29T17:23:16 | 2021-04-29T17:23:16 | 325,567,186 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,110 | java | package com.store.inventory.adapters;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.store.inventory.R;
import com.store.inventory.activities.DetailsActivity;
import com.store.inventory.models.Product;
import java.util.List;
public class RecommendedProductAdapter extends RecyclerView.Adapter<RecommendedProductAdapter.ProductsViewHolder> {
private Context mContext;
private List<Product> products;
public RecommendedProductAdapter(Context mContext, List<Product> products) {
setHasStableIds(true);
this.mContext = mContext;
this.products = products;
}
@NonNull
@Override
public RecommendedProductAdapter.ProductsViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View row = LayoutInflater.from(mContext).inflate(R.layout.recommended_list_item,parent,false);
return new ProductsViewHolder(row);
}
@Override
public void onBindViewHolder(@NonNull final ProductsViewHolder holder, int position) {
// String s = products.get(position).getProduct_id();
// DatabaseReference mDatabaseUsers = FirebaseDatabase.getInstance().getReference("products").child(s);
// mDatabaseUsers.keepSynced(true);
// mDatabaseUsers.addListenerForSingleValueEvent(new ValueEventListener() {
// @Override
// public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
// Product product = dataSnapshot.getValue(Product.class);
//
// if (product == null) {
//
// Toast.makeText(
// mContext,
// "Product data is null!",
// Toast.LENGTH_SHORT)
// .show();
// }
// else {
// holder.product_name.setText(product.product_name);
// holder.product_qauntity.setText(product.product_qauntity);
// holder.product_price.setText(product.product_selling_price);
// if(product.product_image != null){
// Glide.with(mContext).load(product.product_image).into(holder.product_image);
// }
// }
// }
//
// @Override
// public void onCancelled(@NonNull DatabaseError error) {
//
// }
// });
holder.product_name.setText(products.get(position).getProduct_name());
holder.product_qauntity.setText(String.valueOf(products.get(position).getProduct_qauntity()));
holder.product_price.setText(String.valueOf(products.get(position).getProduct_selling_price()));
if(products.get(position).getProduct_image() != null){
Glide.with(mContext).load(products.get(position).getProduct_image()).into(holder.product_image);
}
}
@Override
public int getItemCount() {
return products.size();
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public int getItemViewType(int position) {
return position;
}
public class ProductsViewHolder extends RecyclerView.ViewHolder{
LinearLayout product_layout;
ImageView product_image;
TextView product_qauntity, product_price, product_name;
int position;
FirebaseAuth mAuth;
public ProductsViewHolder(View itemView) {
super(itemView);
product_image = itemView.findViewById(R.id.product_image);
product_qauntity = itemView.findViewById(R.id.product_quantity);
product_price = itemView.findViewById(R.id.product_price);
product_name = itemView.findViewById(R.id.product_name);
product_layout = itemView.findViewById(R.id.product_layout);
mAuth = FirebaseAuth.getInstance();
product_layout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(mContext, DetailsActivity.class);
position = getAdapterPosition();
i.putExtra("productId", products.get(position).getProduct_id());
//i.putExtra("supplierId", products.get(position).getSupplier_id());
mContext.startActivity(i);
}
});
}
}
}
| [
"guptarahul0699@gmail.com"
] | guptarahul0699@gmail.com |
7eece30b4727ade57c3713375ac0dbb7c2dfe748 | e19f67e118a73a08833c6e9e439398c7982e0753 | /gtfsLIC/src/main/java/com/gtfs/dao/interfaces/PrintRcptMstDao.java | f58dd026f0b2b8472fe84661efd4457c6369e86e | [] | no_license | dipankarduttajava/l1 | 048be0f0502598cc8660a0960948170c6d963a6b | 357ec6c0d05bd221b04d137acda5924058cba53c | refs/heads/master | 2021-01-10T12:05:48.728872 | 2015-05-28T05:08:49 | 2015-05-28T05:08:49 | 36,415,056 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 491 | java | package com.gtfs.dao.interfaces;
import java.util.List;
import com.gtfs.bean.PrintRcptMst;
public interface PrintRcptMstDao {
Boolean saveForPrintReceipt(PrintRcptMst printRcptMst);
List<Long> findMaximunReceiptNoByPrefix(String prefix);
List<String> findPrintRcptPrefixByBranchParentTieupCoId(Long branchId,Long tieupCompyId,Long parentCompyId);
List<PrintRcptMst> findPrintRcptMstByPrefixBranchIdTieupCoIdParentCoId(String prefix,Long branchId,Long tieupCoId,Long parentCoId);
}
| [
"java-dev@java-dev"
] | java-dev@java-dev |
21e68e5594f49983bf229144370e3842dc1d7968 | 9c7a0315cc406210e7c5c3670633798552d6ab4d | /rxjava/src/test/java/io/reactivex/internal/operators/flowable/FlowableSerializeTest.java | 7af36b8d8dbf3473cf6457a07adfeeb3abef9bf7 | [
"Apache-2.0"
] | permissive | IMLaoJI/RxDemo | 6e0c44c0cc5c3fb33593e7053410568d8eb33871 | d2b0a33955bdc245ac6a13b8f601dbf9393b6e99 | refs/heads/master | 2020-12-02T15:22:42.728306 | 2018-04-18T14:35:35 | 2018-04-18T14:35:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,520 | java | /**
* Copyright (c) 2016-present, RxJava Contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
* the License for the specific language governing permissions and limitations under the License.
*/
package io.reactivex.internal.operators.flowable;
import org.junit.Before;
import org.junit.Test;
import org.reactivestreams.Publisher;
import org.reactivestreams.Subscriber;
import java.util.concurrent.atomic.AtomicInteger;
import io.reactivex.Flowable;
import io.reactivex.TestHelper;
import io.reactivex.internal.subscriptions.BooleanSubscription;
import io.reactivex.subscribers.DefaultSubscriber;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
public class FlowableSerializeTest {
Subscriber<String> observer;
@Before
public void before() {
observer = TestHelper.mockSubscriber();
}
@Test
public void testSingleThreadedBasic() {
TestSingleThreadedObservable onSubscribe = new TestSingleThreadedObservable("one", "two", "three");
Flowable<String> w = Flowable.unsafeCreate(onSubscribe);
w.serialize().subscribe(observer);
onSubscribe.waitToFinish();
verify(observer, times(1)).onNext("one");
verify(observer, times(1)).onNext("two");
verify(observer, times(1)).onNext("three");
verify(observer, never()).onError(any(Throwable.class));
verify(observer, times(1)).onComplete();
// non-deterministic because unsubscribe happens after 'waitToFinish' releases
// so commenting out for now as this is not a critical thing to test here
// verify(s, times(1)).unsubscribe();
}
@Test
public void testMultiThreadedBasic() {
TestMultiThreadedObservable onSubscribe = new TestMultiThreadedObservable("one", "two", "three");
Flowable<String> w = Flowable.unsafeCreate(onSubscribe);
BusyObserver busyobserver = new BusyObserver();
w.serialize().subscribe(busyobserver);
onSubscribe.waitToFinish();
assertEquals(3, busyobserver.onNextCount.get());
assertFalse(busyobserver.onError);
assertTrue(busyobserver.onComplete);
// non-deterministic because unsubscribe happens after 'waitToFinish' releases
// so commenting out for now as this is not a critical thing to test here
// verify(s, times(1)).unsubscribe();
// we can have concurrency ...
assertTrue(onSubscribe.maxConcurrentThreads.get() > 1);
// ... but the onNext execution should be single threaded
assertEquals(1, busyobserver.maxConcurrentThreads.get());
}
@Test
public void testMultiThreadedWithNPE() {
TestMultiThreadedObservable onSubscribe = new TestMultiThreadedObservable("one", "two", "three", null);
Flowable<String> w = Flowable.unsafeCreate(onSubscribe);
BusyObserver busyobserver = new BusyObserver();
w.serialize().subscribe(busyobserver);
onSubscribe.waitToFinish();
System.out.println("maxConcurrentThreads: " + onSubscribe.maxConcurrentThreads.get());
// we can't know how many onNext calls will occur since they each run on a separate thread
// that depends on thread scheduling so 0, 1, 2 and 3 are all valid options
// assertEquals(3, busyobserver.onNextCount.get());
assertTrue(busyobserver.onNextCount.get() < 4);
assertTrue(busyobserver.onError);
// no onComplete because onError was invoked
assertFalse(busyobserver.onComplete);
// non-deterministic because unsubscribe happens after 'waitToFinish' releases
// so commenting out for now as this is not a critical thing to test here
//verify(s, times(1)).unsubscribe();
// we can have concurrency ...
assertTrue(onSubscribe.maxConcurrentThreads.get() > 1);
// ... but the onNext execution should be single threaded
assertEquals(1, busyobserver.maxConcurrentThreads.get());
}
@Test
public void testMultiThreadedWithNPEinMiddle() {
boolean lessThan9 = false;
for (int i = 0; i < 3; i++) {
TestMultiThreadedObservable onSubscribe = new TestMultiThreadedObservable("one", "two", "three", null, "four", "five", "six", "seven", "eight", "nine");
Flowable<String> w = Flowable.unsafeCreate(onSubscribe);
BusyObserver busyobserver = new BusyObserver();
w.serialize().subscribe(busyobserver);
onSubscribe.waitToFinish();
System.out.println("maxConcurrentThreads: " + onSubscribe.maxConcurrentThreads.get());
// this should not always be the full number of items since the error should (very often)
// stop it before it completes all 9
System.out.println("onNext count: " + busyobserver.onNextCount.get());
if (busyobserver.onNextCount.get() < 9) {
lessThan9 = true;
}
assertTrue(busyobserver.onError);
// no onComplete because onError was invoked
assertFalse(busyobserver.onComplete);
// non-deterministic because unsubscribe happens after 'waitToFinish' releases
// so commenting out for now as this is not a critical thing to test here
// verify(s, times(1)).unsubscribe();
// we can have concurrency ...
assertTrue(onSubscribe.maxConcurrentThreads.get() > 1);
// ... but the onNext execution should be single threaded
assertEquals(1, busyobserver.maxConcurrentThreads.get());
}
assertTrue(lessThan9);
}
/**
* A thread that will pass data to onNext.
*/
static class OnNextThread implements Runnable {
private final DefaultSubscriber<String> observer;
private final int numStringsToSend;
OnNextThread(DefaultSubscriber<String> observer, int numStringsToSend) {
this.observer = observer;
this.numStringsToSend = numStringsToSend;
}
@Override
public void run() {
for (int i = 0; i < numStringsToSend; i++) {
observer.onNext("aString");
}
}
}
/**
* A thread that will call onError or onNext.
*/
static class CompletionThread implements Runnable {
private final DefaultSubscriber<String> observer;
private final TestConcurrencyobserverEvent event;
private final Future<?>[] waitOnThese;
CompletionThread(DefaultSubscriber<String> observer, TestConcurrencyobserverEvent event, Future<?>... waitOnThese) {
this.observer = observer;
this.event = event;
this.waitOnThese = waitOnThese;
}
@Override
public void run() {
/* if we have 'waitOnThese' futures, we'll wait on them before proceeding */
if (waitOnThese != null) {
for (Future<?> f : waitOnThese) {
try {
f.get();
} catch (Throwable e) {
System.err.println("Error while waiting on future in CompletionThread");
}
}
}
/* send the event */
if (event == TestConcurrencyobserverEvent.onError) {
observer.onError(new RuntimeException("mocked exception"));
} else if (event == TestConcurrencyobserverEvent.onComplete) {
observer.onComplete();
} else {
throw new IllegalArgumentException("Expecting either onError or onComplete");
}
}
}
enum TestConcurrencyobserverEvent {
onComplete, onError, onNext
}
/**
* This spawns a single thread for the subscribe execution.
*/
private static class TestSingleThreadedObservable implements Publisher<String> {
final String[] values;
private Thread t;
TestSingleThreadedObservable(final String... values) {
this.values = values;
}
@Override
public void subscribe(final Subscriber<? super String> observer) {
observer.onSubscribe(new BooleanSubscription());
System.out.println("TestSingleThreadedObservable subscribed to ...");
t = new Thread(new Runnable() {
@Override
public void run() {
try {
System.out.println("running TestSingleThreadedObservable thread");
for (String s : values) {
System.out.println("TestSingleThreadedObservable onNext: " + s);
observer.onNext(s);
}
observer.onComplete();
} catch (Throwable e) {
throw new RuntimeException(e);
}
}
});
System.out.println("starting TestSingleThreadedObservable thread");
t.start();
System.out.println("done starting TestSingleThreadedObservable thread");
}
public void waitToFinish() {
try {
t.join();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
/**
* This spawns a thread for the subscription, then a separate thread for each onNext call.
*/
private static class TestMultiThreadedObservable implements Publisher<String> {
final String[] values;
Thread t;
AtomicInteger threadsRunning = new AtomicInteger();
AtomicInteger maxConcurrentThreads = new AtomicInteger();
ExecutorService threadPool;
TestMultiThreadedObservable(String... values) {
this.values = values;
this.threadPool = Executors.newCachedThreadPool();
}
@Override
public void subscribe(final Subscriber<? super String> observer) {
observer.onSubscribe(new BooleanSubscription());
System.out.println("TestMultiThreadedObservable subscribed to ...");
final NullPointerException npe = new NullPointerException();
t = new Thread(new Runnable() {
@Override
public void run() {
try {
System.out.println("running TestMultiThreadedObservable thread");
for (final String s : values) {
threadPool.execute(new Runnable() {
@Override
public void run() {
threadsRunning.incrementAndGet();
try {
// perform onNext call
if (s == null) {
System.out.println("TestMultiThreadedObservable onNext: null");
// force an error
throw npe;
} else {
try {
Thread.sleep(10);
} catch (InterruptedException ex) {
// ignored
}
System.out.println("TestMultiThreadedObservable onNext: " + s);
}
observer.onNext(s);
// capture 'maxThreads'
int concurrentThreads = threadsRunning.get();
int maxThreads = maxConcurrentThreads.get();
if (concurrentThreads > maxThreads) {
maxConcurrentThreads.compareAndSet(maxThreads, concurrentThreads);
}
} catch (Throwable e) {
observer.onError(e);
} finally {
threadsRunning.decrementAndGet();
}
}
});
}
// we are done spawning threads
threadPool.shutdown();
} catch (Throwable e) {
throw new RuntimeException(e);
}
// wait until all threads are done, then mark it as COMPLETED
try {
// wait for all the threads to finish
threadPool.awaitTermination(2, TimeUnit.SECONDS);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
observer.onComplete();
}
});
System.out.println("starting TestMultiThreadedObservable thread");
t.start();
System.out.println("done starting TestMultiThreadedObservable thread");
}
public void waitToFinish() {
try {
t.join();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
private static class BusyObserver extends DefaultSubscriber<String> {
volatile boolean onComplete;
volatile boolean onError;
AtomicInteger onNextCount = new AtomicInteger();
AtomicInteger threadsRunning = new AtomicInteger();
AtomicInteger maxConcurrentThreads = new AtomicInteger();
@Override
public void onComplete() {
threadsRunning.incrementAndGet();
System.out.println(">>> Busyobserver received onComplete");
onComplete = true;
int concurrentThreads = threadsRunning.get();
int maxThreads = maxConcurrentThreads.get();
if (concurrentThreads > maxThreads) {
maxConcurrentThreads.compareAndSet(maxThreads, concurrentThreads);
}
threadsRunning.decrementAndGet();
}
@Override
public void onError(Throwable e) {
threadsRunning.incrementAndGet();
System.out.println(">>> Busyobserver received onError: " + e.getMessage());
onError = true;
int concurrentThreads = threadsRunning.get();
int maxThreads = maxConcurrentThreads.get();
if (concurrentThreads > maxThreads) {
maxConcurrentThreads.compareAndSet(maxThreads, concurrentThreads);
}
threadsRunning.decrementAndGet();
}
@Override
public void onNext(String args) {
threadsRunning.incrementAndGet();
try {
onNextCount.incrementAndGet();
System.out.println(">>> Busyobserver received onNext: " + args);
try {
// simulate doing something computational
Thread.sleep(200);
} catch (InterruptedException e) {
e.printStackTrace();
}
} finally {
// capture 'maxThreads'
int concurrentThreads = threadsRunning.get();
int maxThreads = maxConcurrentThreads.get();
if (concurrentThreads > maxThreads) {
maxConcurrentThreads.compareAndSet(maxThreads, concurrentThreads);
}
threadsRunning.decrementAndGet();
}
}
}
}
| [
"haoliu@thoughtworks.com"
] | haoliu@thoughtworks.com |
3e2b9f67a52f4a48dddc799123322d79fac83052 | c59bfcf64f44d59679613320bfb34f696eb0ed37 | /src/de/unidue/iem/tdr/nis/client/solutions/Solution20.java | 8bfc3b0c009c1b97b184cd3c1586bf5862bbce4c | [] | no_license | Tontah/NIS | ffc91f2c00ab043fb61be5f0413214a6a2762882 | e1a81d2ec66dea0e0a4c5481f252353217e19ffa | refs/heads/master | 2023-08-29T05:54:20.113005 | 2021-10-27T12:04:03 | 2021-10-27T12:04:03 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 823 | java | package de.unidue.iem.tdr.nis.client.solutions;
import de.unidue.iem.tdr.nis.client.Connection;
import de.unidue.iem.tdr.nis.client.TaskObject;
import de.unidue.iem.tdr.nis.client.AbstractSolution;
public class Solution20 extends AbstractSolution {
/** Aufgabe 20 - RSA Entschlรผsselung
* Key: String[] {n, e} Public Key
* Parameter: String[0] Chiffretext
* Lรถsung: String Klartext (nicht case-sensitive)
*/
/* Konstruktor - NICHT verรคndern */
public Solution20(Connection con, TaskObject task) {
super(con, task);
}
@Override
public String run() {
return null;
}
/**
* Diese Aufgabe erfordert das รbergeben eines Keys.
* Geben Sie in dieser Methode Ihren generierten public key zurรผck.
* @return String[] Alle Key Werte
*/
@Override
public String[] getKey() {
return null;
}
}
| [
"tchana.nikita@stud.uni-due.de"
] | tchana.nikita@stud.uni-due.de |
a6606b724a1846d2f7480db083ffc62f3b758bea | dc19317ed99865000fe0169be96e03ea14dfede5 | /app/src/main/java/vn/harry/callrecorder/ui/donate/DonateOptionPresenter.java | 454b93a6ee29b87bd145c5760c31b536a798c10d | [] | no_license | PratikSurela/Call-Recorder-master | fb5385c172a8fdd99371ca3caa11a9e17acd1c8a | f0c31e1d2febf73b2d59f05ddc5c88d73619487f | refs/heads/master | 2022-02-03T15:38:09.659406 | 2019-07-20T11:49:21 | 2019-07-20T11:49:21 | 197,923,318 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 212 | java | package vn.harry.callrecorder.ui.donate;
import vn.harry.callrecorder.mvp.BasePresenter;
/**
* Created by hainm on 2/21/2018.
*/
public class DonateOptionPresenter extends BasePresenter<DonateOptionMvp> {
}
| [
"surelapratik@gmail.com"
] | surelapratik@gmail.com |
71da47c3ceb09dadd959ffd3cc3deb010edbdc6c | 31d2635886834ef0ea30348f304787e683f64e8b | /Principal/src/ur/informaticamovil7/movies/JuegoNivel1.java | 7c5b038b886bd4abcda6ea6ee3ed389c342bbb7b | [] | no_license | whatsmovieadmin/whatsmovie | 722138d7f421257d2fc60834f45d0f1d171e8ce8 | e832c61b168875333f7afc8a2a8316fb0d1d3efb | refs/heads/master | 2021-01-10T02:15:22.574941 | 2013-04-22T21:08:03 | 2013-04-22T21:08:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 27,975 | java | package ur.informaticamovil7.movies;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Random;
import java.util.Vector;
import Utils.GestorJuego;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler;
import android.app.Activity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextView;
import android.support.v4.app.NavUtils;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Intent;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Build;
public class JuegoNivel1 extends Activity {
private String correcta;
private int numeroPregunta = 1;
private int numeroRacha = 0;
private int numeroPuntuacion = 0;
private int mejorRacha = 0;
private int numCorrectas = 0;
private String carpeta = "01Fotogramas";
private TextView countdown;
private TextView tv_respuesta1;
private TextView tv_respuesta2;
private TextView tv_respuesta3;
private TextView tv_respuesta4;
private ImageView imageView;
private Animation fadeOutAnimation;
private Animation fadeInAnimation;
private TextView tv_nivel1_racha;
private TextView tv_nivel1_highscore;
private TextView tv_nivel1_numpregunta;
private GestorJuego gestorJuego;
private MyCount counter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_juego_nivel1);
Typeface sansation = Typeface.createFromAsset(getAssets(),"fonts/Sansation_Regular.ttf");
tv_respuesta1 = (TextView) findViewById(R.id.bt_nivel1_respuesta1);
tv_respuesta2 = (TextView) findViewById(R.id.bt_nivel1_respuesta2);
tv_respuesta3 = (TextView) findViewById(R.id.bt_nivel1_respuesta3);
tv_respuesta4 = (TextView) findViewById(R.id.bt_nivel1_respuesta4);
imageView = (ImageView) findViewById(R.id.iv_nivel1_imagen);
countdown = (TextView) findViewById(R.id.countdown);
fadeOutAnimation = AnimationUtils.loadAnimation(JuegoNivel1.this, R.anim.fadeout);
fadeInAnimation = AnimationUtils.loadAnimation(JuegoNivel1.this, R.anim.fadein);
tv_nivel1_racha = (TextView) findViewById(R.id.tv_nivel1_racha);
tv_nivel1_highscore = (TextView) findViewById(R.id.tv_nivel1_highscore);
tv_nivel1_numpregunta = (TextView) findViewById(R.id.tv_nivel1_numpregunta);
tv_respuesta1.setTypeface(sansation);
tv_respuesta2.setTypeface(sansation);
tv_respuesta3.setTypeface(sansation);
tv_respuesta4.setTypeface(sansation);
counter = new MyCount(11000,1000);
tv_nivel1_racha.setTypeface(sansation);
tv_nivel1_highscore.setTypeface(sansation);
tv_nivel1_numpregunta.setTypeface(sansation);
gestorJuego = new GestorJuego();
gestorJuego.cargarMemoria("nivel1", this.getApplicationContext());
String[] dei = gestorJuego.peliculaYTitulosCorrectoYAleatorios();
imageView.setImageBitmap(getBitmapFromAsset(carpeta + "/" + dei[0]));
Random r = new Random();
tv_nivel1_numpregunta.setText(numeroPregunta + "/15");
tv_nivel1_highscore.setText(numeroPuntuacion + "");
tv_nivel1_racha.setText(numeroRacha + "X");
correcta = dei[1];
int posicion = ((r.nextInt(4)) + 1);
List<Integer> a = new Vector<Integer>();
a.add(posicion);
tv_respuesta1.setText(dei[posicion]);
posicion = ((r.nextInt(4)) + 1);
while (a.contains(posicion)) {
posicion = ((r.nextInt(4)) + 1);
}
tv_respuesta2.setText(dei[posicion]);
a.add(posicion);
posicion = ((r.nextInt(4)) + 1);
while (a.contains(posicion)) {
posicion = ((r.nextInt(4)) + 1);
}
tv_respuesta3.setText(dei[posicion]);
a.add(posicion);
posicion = ((r.nextInt(4)) + 1);
while (a.contains(posicion)) {
posicion = ((r.nextInt(4)) + 1);
}
tv_respuesta4.setText(dei[posicion]);
counter.start();
tv_respuesta1.setOnClickListener(new View.OnClickListener() {
public void onClick(final View view) {
counter.cancel();
tv_respuesta1.setClickable(false);
tv_respuesta1.setEnabled(false);
tv_respuesta2.setClickable(false);
tv_respuesta2.setEnabled(false);
tv_respuesta3.setClickable(false);
tv_respuesta3.setEnabled(false);
tv_respuesta4.setClickable(false);
tv_respuesta4.setEnabled(false);
if (tv_respuesta1.getText().toString().compareTo(correcta) == 0) {
tv_respuesta1.setBackgroundResource(R.anim.main_button_respuesta_correcta);
numCorrectas++;
numeroRacha = numeroRacha + 1;
if(mejorRacha < numeroRacha) {
mejorRacha = numeroRacha;
}
numeroPuntuacion = numeroPuntuacion
+ (numeroRacha * 100);
} else {
tv_respuesta1
.setBackgroundResource(R.anim.main_button_respuesta_fallida);
numeroRacha = 0;
numeroPuntuacion = numeroPuntuacion
+ (numeroRacha * 100);
}
numeroPregunta = numeroPregunta + 1;
view.postDelayed(new Runnable() {
@Override
public void run() {
if (numeroPregunta > 15) {
Intent myIntent = new Intent(JuegoNivel1.this,
Resultados.class);
myIntent.putExtra("numcorrectas", numCorrectas);
myIntent.putExtra("racha", mejorRacha);
myIntent.putExtra("puntuacion", numeroPuntuacion);
myIntent.putExtra("nivel", 1);
startActivity(myIntent);
} else {
imageView.startAnimation(fadeOutAnimation);
tv_respuesta1.startAnimation(fadeOutAnimation);
tv_respuesta2.startAnimation(fadeOutAnimation);
tv_respuesta3.startAnimation(fadeOutAnimation);
tv_respuesta4.startAnimation(fadeOutAnimation);
}
}
}, 1500);
view.postDelayed(new Runnable() {
@SuppressLint("NewApi")
@Override
public void run() {
String[] dei = gestorJuego
.peliculaYTitulosCorrectoYAleatorios();
imageView.setImageBitmap(getBitmapFromAsset(carpeta
+ "/" + dei[0]));
Random r = new Random();
correcta = dei[1];
int posicion = ((r.nextInt(4)) + 1);
List<Integer> a = new Vector<Integer>();
a.add(posicion);
tv_respuesta1.setText(dei[posicion]);
posicion = ((r.nextInt(4)) + 1);
while (a.contains(posicion)) {
posicion = ((r.nextInt(4)) + 1);
}
tv_respuesta2.setText(dei[posicion]);
a.add(posicion);
posicion = ((r.nextInt(4)) + 1);
while (a.contains(posicion)) {
posicion = ((r.nextInt(4)) + 1);
}
tv_respuesta3.setText(dei[posicion]);
a.add(posicion);
posicion = ((r.nextInt(4)) + 1);
while (a.contains(posicion)) {
posicion = ((r.nextInt(4)) + 1);
}
tv_respuesta4.setText(dei[posicion]);
tv_nivel1_numpregunta.setText(numeroPregunta
+ "/15");
tv_nivel1_racha.setText(numeroRacha + "X");
tv_respuesta1
.setBackgroundResource(R.anim.main_button_respuesta);
imageView.startAnimation(fadeInAnimation);
tv_respuesta1.startAnimation(fadeInAnimation);
tv_respuesta2.startAnimation(fadeInAnimation);
tv_respuesta3.startAnimation(fadeInAnimation);
tv_respuesta4.startAnimation(fadeInAnimation);
int anterior = Integer.parseInt((String)tv_nivel1_highscore.getText());
if(Build.VERSION.SDK_INT >= 11.0){
ValueAnimator va = ValueAnimator.ofInt(anterior, numeroPuntuacion);
va.setDuration(700);
va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
Integer value = (Integer) animation.getAnimatedValue();
tv_nivel1_highscore.setText(value + "");
}
});
va.start();
} else {
tv_nivel1_highscore.setText(numeroPuntuacion + "");
}
tv_respuesta1.setClickable(true);
tv_respuesta1.setEnabled(true);
tv_respuesta2.setClickable(true);
tv_respuesta2.setEnabled(true);
tv_respuesta3.setClickable(true);
tv_respuesta3.setEnabled(true);
tv_respuesta4.setClickable(true);
tv_respuesta4.setEnabled(true);
if (numeroPregunta <= 15) {
counter.start();
}
}
}, 3000);
}
});
tv_respuesta2.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
counter.cancel();
tv_respuesta1.setClickable(false);
tv_respuesta1.setEnabled(false);
tv_respuesta2.setClickable(false);
tv_respuesta2.setEnabled(false);
tv_respuesta3.setClickable(false);
tv_respuesta3.setEnabled(false);
tv_respuesta4.setClickable(false);
tv_respuesta4.setEnabled(false);
if (tv_respuesta2.getText().toString().compareTo(correcta) == 0) {
tv_respuesta2
.setBackgroundResource(R.anim.main_button_respuesta_correcta);
numCorrectas++;
numeroRacha = numeroRacha + 1;
if(mejorRacha < numeroRacha) {
mejorRacha = numeroRacha;
}
numeroPuntuacion = numeroPuntuacion
+ (numeroRacha * 100);
} else {
tv_respuesta2
.setBackgroundResource(R.anim.main_button_respuesta_fallida);
numeroRacha = 0;
numeroPuntuacion = numeroPuntuacion
+ (numeroRacha * 100);
}
numeroPregunta = numeroPregunta + 1;
view.postDelayed(new Runnable() {
@Override
public void run() {
if (numeroPregunta > 15) {
Intent myIntent = new Intent(JuegoNivel1.this,
Resultados.class);
myIntent.putExtra("numcorrectas", numCorrectas);
myIntent.putExtra("racha", mejorRacha);
myIntent.putExtra("puntuacion", numeroPuntuacion);
myIntent.putExtra("nivel", 1);
startActivity(myIntent);
} else {
imageView.startAnimation(fadeOutAnimation);
tv_respuesta1.startAnimation(fadeOutAnimation);
tv_respuesta2.startAnimation(fadeOutAnimation);
tv_respuesta3.startAnimation(fadeOutAnimation);
tv_respuesta4.startAnimation(fadeOutAnimation);
}
}
}, 1500);
view.postDelayed(new Runnable() {
@SuppressLint("NewApi")
@Override
public void run() {
String[] dei = gestorJuego
.peliculaYTitulosCorrectoYAleatorios();
imageView.setImageBitmap(getBitmapFromAsset(carpeta
+ "/" + dei[0]));
Random r = new Random();
correcta = dei[1];
int posicion = ((r.nextInt(4)) + 1);
List<Integer> a = new Vector<Integer>();
a.add(posicion);
tv_respuesta1.setText(dei[posicion]);
posicion = ((r.nextInt(4)) + 1);
while (a.contains(posicion)) {
posicion = ((r.nextInt(4)) + 1);
}
tv_respuesta2.setText(dei[posicion]);
a.add(posicion);
posicion = ((r.nextInt(4)) + 1);
while (a.contains(posicion)) {
posicion = ((r.nextInt(4)) + 1);
}
tv_respuesta3.setText(dei[posicion]);
a.add(posicion);
posicion = ((r.nextInt(4)) + 1);
while (a.contains(posicion)) {
posicion = ((r.nextInt(4)) + 1);
}
tv_respuesta4.setText(dei[posicion]);
tv_nivel1_numpregunta.setText(numeroPregunta
+ "/15");
tv_nivel1_racha.setText(numeroRacha + "X");
tv_respuesta2
.setBackgroundResource(R.anim.main_button_respuesta);
imageView.startAnimation(fadeInAnimation);
tv_respuesta1.startAnimation(fadeInAnimation);
tv_respuesta2.startAnimation(fadeInAnimation);
tv_respuesta3.startAnimation(fadeInAnimation);
tv_respuesta4.startAnimation(fadeInAnimation);
int anterior = Integer.parseInt((String)tv_nivel1_highscore.getText());
if(Build.VERSION.SDK_INT >= 11.0){
ValueAnimator va = ValueAnimator.ofInt(anterior, numeroPuntuacion);
va.setDuration(700);
va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
Integer value = (Integer) animation.getAnimatedValue();
tv_nivel1_highscore.setText(value + "");
}
});
va.start();
} else {
tv_nivel1_highscore.setText(numeroPuntuacion + "");
}
tv_respuesta1.setClickable(true);
tv_respuesta1.setEnabled(true);
tv_respuesta2.setClickable(true);
tv_respuesta2.setEnabled(true);
tv_respuesta3.setClickable(true);
tv_respuesta3.setEnabled(true);
tv_respuesta4.setClickable(true);
tv_respuesta4.setEnabled(true);
if (numeroPregunta <= 15) {
counter.start();
}
}
}, 3000);
}
});
tv_respuesta3.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
counter.cancel();
tv_respuesta1.setClickable(false);
tv_respuesta1.setEnabled(false);
tv_respuesta2.setClickable(false);
tv_respuesta2.setEnabled(false);
tv_respuesta3.setClickable(false);
tv_respuesta3.setEnabled(false);
tv_respuesta4.setClickable(false);
tv_respuesta4.setEnabled(false);
if (tv_respuesta3.getText().toString().compareTo(correcta) == 0) {
tv_respuesta3
.setBackgroundResource(R.anim.main_button_respuesta_correcta);
numCorrectas++;
numeroRacha = numeroRacha + 1;
if(mejorRacha < numeroRacha) {
mejorRacha = numeroRacha;
}
numeroPuntuacion = numeroPuntuacion
+ (numeroRacha * 100);
} else {
tv_respuesta3
.setBackgroundResource(R.anim.main_button_respuesta_fallida);
numeroRacha = 0;
numeroPuntuacion = numeroPuntuacion
+ (numeroRacha * 100);
}
numeroPregunta = numeroPregunta + 1;
view.postDelayed(new Runnable() {
@Override
public void run() {
if (numeroPregunta > 15) {
Intent myIntent = new Intent(JuegoNivel1.this,
Resultados.class);
myIntent.putExtra("numcorrectas", numCorrectas);
myIntent.putExtra("racha", mejorRacha);
myIntent.putExtra("puntuacion", numeroPuntuacion);
myIntent.putExtra("nivel", 1);
startActivity(myIntent);
} else {
imageView.startAnimation(fadeOutAnimation);
tv_respuesta1.startAnimation(fadeOutAnimation);
tv_respuesta2.startAnimation(fadeOutAnimation);
tv_respuesta3.startAnimation(fadeOutAnimation);
tv_respuesta4.startAnimation(fadeOutAnimation);
}
}
}, 1500);
view.postDelayed(new Runnable() {
@SuppressLint("NewApi")
@Override
public void run() {
String[] dei = gestorJuego
.peliculaYTitulosCorrectoYAleatorios();
imageView.setImageBitmap(getBitmapFromAsset(carpeta
+ "/" + dei[0]));
Random r = new Random();
correcta = dei[1];
int posicion = ((r.nextInt(4)) + 1);
List<Integer> a = new Vector<Integer>();
a.add(posicion);
tv_respuesta1.setText(dei[posicion]);
posicion = ((r.nextInt(4)) + 1);
while (a.contains(posicion)) {
posicion = ((r.nextInt(4)) + 1);
}
tv_respuesta2.setText(dei[posicion]);
a.add(posicion);
posicion = ((r.nextInt(4)) + 1);
while (a.contains(posicion)) {
posicion = ((r.nextInt(4)) + 1);
}
tv_respuesta3.setText(dei[posicion]);
a.add(posicion);
posicion = ((r.nextInt(4)) + 1);
while (a.contains(posicion)) {
posicion = ((r.nextInt(4)) + 1);
}
tv_respuesta4.setText(dei[posicion]);
tv_nivel1_numpregunta.setText(numeroPregunta
+ "/15");
tv_nivel1_racha.setText(numeroRacha + "X");
tv_respuesta3
.setBackgroundResource(R.anim.main_button_respuesta);
imageView.startAnimation(fadeInAnimation);
tv_respuesta1.startAnimation(fadeInAnimation);
tv_respuesta2.startAnimation(fadeInAnimation);
tv_respuesta3.startAnimation(fadeInAnimation);
tv_respuesta4.startAnimation(fadeInAnimation);
int anterior = Integer.parseInt((String)tv_nivel1_highscore.getText());
if(Build.VERSION.SDK_INT >= 11.0){
ValueAnimator va = ValueAnimator.ofInt(anterior, numeroPuntuacion);
va.setDuration(700);
va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
Integer value = (Integer) animation.getAnimatedValue();
tv_nivel1_highscore.setText(value + "");
}
});
va.start();
} else {
tv_nivel1_highscore.setText(numeroPuntuacion + "");
}
tv_respuesta1.setClickable(true);
tv_respuesta1.setEnabled(true);
tv_respuesta2.setClickable(true);
tv_respuesta2.setEnabled(true);
tv_respuesta3.setClickable(true);
tv_respuesta3.setEnabled(true);
tv_respuesta4.setClickable(true);
tv_respuesta4.setEnabled(true);
if (numeroPregunta <= 15) {
counter.start();
}
}
}, 3000);
}
});
tv_respuesta4.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
counter.cancel();
tv_respuesta1.setClickable(false);
tv_respuesta1.setEnabled(false);
tv_respuesta2.setClickable(false);
tv_respuesta2.setEnabled(false);
tv_respuesta3.setClickable(false);
tv_respuesta3.setEnabled(false);
tv_respuesta4.setClickable(false);
tv_respuesta4.setEnabled(false);
if (tv_respuesta4.getText().toString().compareTo(correcta) == 0) {
tv_respuesta4
.setBackgroundResource(R.anim.main_button_respuesta_correcta);
numCorrectas++;
numeroRacha = numeroRacha + 1;
if(mejorRacha < numeroRacha) {
mejorRacha = numeroRacha;
}
numeroPuntuacion = numeroPuntuacion
+ (numeroRacha * 100);
} else {
tv_respuesta4
.setBackgroundResource(R.anim.main_button_respuesta_fallida);
numeroRacha = 0;
numeroPuntuacion = numeroPuntuacion
+ (numeroRacha * 100);
}
numeroPregunta = numeroPregunta + 1;
view.postDelayed(new Runnable() {
@Override
public void run() {
if (numeroPregunta > 15) {
Intent myIntent = new Intent(JuegoNivel1.this,
Resultados.class);
myIntent.putExtra("numcorrectas", numCorrectas);
myIntent.putExtra("racha", mejorRacha);
myIntent.putExtra("puntuacion", numeroPuntuacion);
myIntent.putExtra("nivel", 1);
startActivity(myIntent);
} else {
imageView.startAnimation(fadeOutAnimation);
tv_respuesta1.startAnimation(fadeOutAnimation);
tv_respuesta2.startAnimation(fadeOutAnimation);
tv_respuesta3.startAnimation(fadeOutAnimation);
tv_respuesta4.startAnimation(fadeOutAnimation);
}
}
}, 1500);
view.postDelayed(new Runnable() {
@SuppressLint("NewApi")
@Override
public void run() {
String[] dei = gestorJuego
.peliculaYTitulosCorrectoYAleatorios();
imageView.setImageBitmap(getBitmapFromAsset(carpeta
+ "/" + dei[0]));
Random r = new Random();
correcta = dei[1];
int posicion = ((r.nextInt(4)) + 1);
List<Integer> a = new Vector<Integer>();
a.add(posicion);
tv_respuesta1.setText(dei[posicion]);
posicion = ((r.nextInt(4)) + 1);
while (a.contains(posicion)) {
posicion = ((r.nextInt(4)) + 1);
}
tv_respuesta2.setText(dei[posicion]);
a.add(posicion);
posicion = ((r.nextInt(4)) + 1);
while (a.contains(posicion)) {
posicion = ((r.nextInt(4)) + 1);
}
tv_respuesta3.setText(dei[posicion]);
a.add(posicion);
posicion = ((r.nextInt(4)) + 1);
while (a.contains(posicion)) {
posicion = ((r.nextInt(4)) + 1);
}
tv_respuesta4.setText(dei[posicion]);
tv_nivel1_numpregunta.setText(numeroPregunta
+ "/15");
tv_nivel1_racha.setText(numeroRacha + "X");
tv_respuesta4
.setBackgroundResource(R.anim.main_button_respuesta);
imageView.startAnimation(fadeInAnimation);
tv_respuesta1.startAnimation(fadeInAnimation);
tv_respuesta2.startAnimation(fadeInAnimation);
tv_respuesta3.startAnimation(fadeInAnimation);
tv_respuesta4.startAnimation(fadeInAnimation);
int anterior = Integer.parseInt((String)tv_nivel1_highscore.getText());
if(Build.VERSION.SDK_INT >= 11.0){
ValueAnimator va = ValueAnimator.ofInt(anterior, numeroPuntuacion);
va.setDuration(700);
va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
Integer value = (Integer) animation.getAnimatedValue();
tv_nivel1_highscore.setText(value + "");
}
});
va.start();
} else {
tv_nivel1_highscore.setText(numeroPuntuacion + "");
}
tv_respuesta1.setClickable(true);
tv_respuesta1.setEnabled(true);
tv_respuesta2.setClickable(true);
tv_respuesta2.setEnabled(true);
tv_respuesta3.setClickable(true);
tv_respuesta3.setEnabled(true);
tv_respuesta4.setClickable(true);
tv_respuesta4.setEnabled(true);
if (numeroPregunta <= 15) {
counter.start();
}
}
}, 3000);
}
});
setupActionBar();
}
/**
* Set up the {@link android.app.ActionBar}, if the API is available.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void setupActionBar() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
getActionBar().setDisplayHomeAsUpEnabled(true);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.juego_nivel1, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// This ID represents the Home or Up button. In the case of this
// activity, the Up button is shown. Use NavUtils to allow users
// to navigate up one level in the application structure. For
// more details, see the Navigation pattern on Android Design:
//
// http://developer.android.com/design/patterns/navigation.html#up-vs-back
//
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}
private Bitmap getBitmapFromAsset(String strName) {
AssetManager assetManager = getAssets();
InputStream istr = null;
try {
istr = assetManager.open(strName);
} catch (IOException e) {
e.printStackTrace();
}
Bitmap bitmap = BitmapFactory.decodeStream(istr);
return bitmap;
}
public class MyCount extends CountDownTimer
{
public MyCount(long millisInFuture, long countDownInterval)
{
super(millisInFuture, countDownInterval);
}
public void onFinish()
{
countdown.setText("00");
counter.cancel();
tv_respuesta1.setClickable(false);
tv_respuesta1.setEnabled(false);
tv_respuesta2.setClickable(false);
tv_respuesta2.setEnabled(false);
tv_respuesta3.setClickable(false);
tv_respuesta3.setEnabled(false);
tv_respuesta4.setClickable(false);
tv_respuesta4.setEnabled(false);
numeroRacha = 0;
numeroPuntuacion = numeroPuntuacion + (numeroRacha * 100);
numeroPregunta = numeroPregunta + 1;
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
if (numeroPregunta > 15) {
Intent myIntent = new Intent(JuegoNivel1.this,
Resultados.class);
myIntent.putExtra("numcorrectas", numCorrectas);
myIntent.putExtra("racha", mejorRacha);
myIntent.putExtra("puntuacion", numeroPuntuacion);
myIntent.putExtra("nivel", 1);
startActivity(myIntent);
} else {
imageView.startAnimation(fadeOutAnimation);
tv_respuesta1.startAnimation(fadeOutAnimation);
tv_respuesta2.startAnimation(fadeOutAnimation);
tv_respuesta3.startAnimation(fadeOutAnimation);
tv_respuesta4.startAnimation(fadeOutAnimation);
}
}
}, 1500);
handler.postDelayed(new Runnable() {
@SuppressLint("NewApi")
@Override
public void run() {
String[] dei = gestorJuego
.peliculaYTitulosCorrectoYAleatorios();
imageView.setImageBitmap(getBitmapFromAsset(carpeta
+ "/" + dei[0]));
Random r = new Random();
correcta = dei[1];
int posicion = ((r.nextInt(4)) + 1);
List<Integer> a = new Vector<Integer>();
a.add(posicion);
tv_respuesta1.setText(dei[posicion]);
posicion = ((r.nextInt(4)) + 1);
while (a.contains(posicion)) {
posicion = ((r.nextInt(4)) + 1);
}
tv_respuesta2.setText(dei[posicion]);
a.add(posicion);
posicion = ((r.nextInt(4)) + 1);
while (a.contains(posicion)) {
posicion = ((r.nextInt(4)) + 1);
}
tv_respuesta3.setText(dei[posicion]);
a.add(posicion);
posicion = ((r.nextInt(4)) + 1);
while (a.contains(posicion)) {
posicion = ((r.nextInt(4)) + 1);
}
tv_respuesta4.setText(dei[posicion]);
tv_nivel1_numpregunta.setText(numeroPregunta
+ "/15");
tv_nivel1_racha.setText(numeroRacha + "X");
imageView.startAnimation(fadeInAnimation);
tv_respuesta1.startAnimation(fadeInAnimation);
tv_respuesta2.startAnimation(fadeInAnimation);
tv_respuesta3.startAnimation(fadeInAnimation);
tv_respuesta4.startAnimation(fadeInAnimation);
int anterior = Integer.parseInt((String)tv_nivel1_highscore.getText());
if(Build.VERSION.SDK_INT >= 11.0){
ValueAnimator va = ValueAnimator.ofInt(anterior, numeroPuntuacion);
va.setDuration(700);
va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
Integer value = (Integer) animation.getAnimatedValue();
tv_nivel1_highscore.setText(value + "");
}
});
va.start();
} else {
tv_nivel1_highscore.setText(numeroPuntuacion + "");
}
tv_respuesta1.setClickable(true);
tv_respuesta1.setEnabled(true);
tv_respuesta2.setClickable(true);
tv_respuesta2.setEnabled(true);
tv_respuesta3.setClickable(true);
tv_respuesta3.setEnabled(true);
tv_respuesta4.setClickable(true);
tv_respuesta4.setEnabled(true);
if (numeroPregunta <= 15) {
counter.start();
}
}
}, 3000);
}
public void onTick(long millisUntilFinished)
{
if(millisUntilFinished/1000 < 6) {
countdown.setTextColor(Color.RED);
} else {
countdown.setTextColor(Color.parseColor("#373737"));
}
if (millisUntilFinished/1000 == 10) {
countdown.setText(""+millisUntilFinished/1000);
} else {
countdown.setText("0"+millisUntilFinished/1000);
}
}
}
}
| [
"whatsmovie2d@gmail.com"
] | whatsmovie2d@gmail.com |
0abbdbcbf9c051e24f7a86839a4588afdee03981 | c16d0a58c727595645cdb8787c62bbbf6cbb55e8 | /digitounico-domain/src/main/java/br/com/digitounico/repositories/DigitoUnicoRepository.java | c1003dd7e48bedd3720123325990ac07b468a558 | [] | no_license | mathmferreira/digitounico | baddebf6f59d833f0366994f4eecf33ca98c7be9 | ee06a8bcda63aca3d3f3d6e0bb287fcbc2c65604 | refs/heads/master | 2023-01-15T11:01:32.015086 | 2020-11-09T13:01:57 | 2020-11-09T13:01:57 | 302,458,544 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 524 | java | package br.com.digitounico.repositories;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import br.com.digitounico.entities.DigitoUnico;
@Repository
public interface DigitoUnicoRepository extends JpaRepository<DigitoUnico, Long> {
@Query("Select d From DigitoUnico d Inner Join d.usuario u Where u.id = :idUsuario")
public List<DigitoUnico> findByUsuario(Long idUsuario);
}
| [
"mathmferreira@hotmail.com"
] | mathmferreira@hotmail.com |
76447d3b289517a181f8888deee9ca264916b812 | b2ac08091476e3498e68ac4bc6ce02382d5933f0 | /Spring/Spring-data/spring-data-redis/src/main/java/org/springframework/data/redis/core/convert/IndexedData.java | 717a329eec7c16ef04e9484570ced46c37317e67 | [
"LicenseRef-scancode-generic-cla"
] | no_license | xuqb981956807/bagdata-study | 3f4ffbbf6afee15981badec4c9947d11462585a5 | 944217eb7b8dee2d414f55341d36f0332e278cbc | refs/heads/master | 2023-05-28T12:46:04.712048 | 2021-06-03T06:04:34 | 2021-06-03T06:04:34 | 373,395,925 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,115 | java | /*
* Copyright 2015-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.redis.core.convert;
/**
* {@link IndexedData} represents a secondary index for a property path in a given keyspace.
*
* @author Christoph Strobl
* @author Rob Winch
* @since 1.7
*/
public interface IndexedData {
/**
* Get the {@link String} representation of the index name.
*
* @return never {@literal null}.
*/
String getIndexName();
/**
* Get the associated keyspace the index resides in.
*
* @return
*/
String getKeyspace();
}
| [
"981956807@qq.com"
] | 981956807@qq.com |
161c6c0b886acc81ae129380e9eb82a9525bba11 | c7e6c912725b194ab088b0c8aaa3973ee5f245f2 | /crm/crm_service_impl/src/main/java/com/kaishengit/crm/service/impl/TaskServiceImpl.java | 6042b4abb148fe2d6a069f32d736224d6fc8dfc2 | [] | no_license | yuanqiqi/java23 | b158cfae1a2a26ce439d0891b8389b2edd1688a0 | baab049f2f09e4a7ecb6f99fff781bf759720c3f | refs/heads/master | 2021-01-01T18:40:06.978494 | 2017-07-26T02:12:16 | 2017-07-26T02:12:16 | 96,080,135 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,950 | java | package com.kaishengit.crm.service.impl;
import com.kaishengit.crm.entity.Task;
import com.kaishengit.crm.entity.TaskExample;
import com.kaishengit.crm.mapper.TaskMapper;
import com.kaishengit.crm.service.TaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Service
public class TaskServiceImpl implements TaskService {
@Autowired
private TaskMapper taskMapper;
/**
* ๆ นๆฎ่ดฆๅทIDๆฅๆพๅฏนๅบ็ๅพ
ๅไปปๅก
* @param accountId
* @param showAll
* @return
*/
@Override
public List<Task> findTaskByAccountId(Integer accountId, boolean showAll) {
return taskMapper.findByAccountId(accountId,showAll);
}
/**
* ๆฐๅขไปปๅก
* @param task
*/
@Override
public void saveNewTask(Task task) {
task.setCreateTime(new Date());
task.setDone(false);
taskMapper.insert(task);
}
/**
* ๆ นๆฎๅฎขๆทIDๆฅๆพๆชๅฎๆ็ๅพ
ๅไบ้กน
* @param id
* @return
*/
@Override
public List<Task> findUnDoneTaskByCustId(Integer id) {
TaskExample example = new TaskExample();
example.createCriteria().andCustIdEqualTo(id).andDoneEqualTo(false);
example.setOrderByClause("finish_time asc");
return taskMapper.selectByExample(example);
}
/**
* ๆ นๆฎIDๆฅๆพๅฏนๅบ็ๅพ
ๅไบ้กน
* @param id
* @return
*/
@Override
public Task findById(Integer id) {
return taskMapper.selectByPrimaryKey(id);
}
/**
* ไฟฎๆนTaskๅฏน่ฑก
* @param task
*/
@Override
public void updateTask(Task task) {
taskMapper.updateByPrimaryKey(task);
}
/**
* ๅ ้คๅพ
ๅๅฏน่ฑก
* @param task
*/
@Override
public void delTask(Task task) {
taskMapper.deleteByPrimaryKey(task.getId());
}
}
| [
"fankai@kaishengit.com"
] | fankai@kaishengit.com |
d4c2dba7f334cc463efc02475c849fe81ec09a25 | 15e2dd26a28a1243b56661035f3cc81683f08439 | /main/recognition/test/boofcv/alg/tracker/meanshift/TestMeanShiftLikelihood.java | 9d8ceecc90d385ead09fc76d54fe98a8dddf334b | [
"Apache-2.0"
] | permissive | agamsarup/BoofCV | acbf6b5e67f09b253150f7066988ae0ca86499f3 | 0d6f64c5b10f094c6ff85ecd540b80b5e81dcee4 | refs/heads/master | 2020-04-03T04:24:11.227975 | 2013-09-21T23:03:02 | 2013-09-21T23:03:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 230 | java | package boofcv.alg.tracker.meanshift;
import org.junit.Test;
import static org.junit.Assert.fail;
/**
* @author Peter Abeles
*/
public class TestMeanShiftLikelihood {
@Test
public void stuff() {
fail("Implement");
}
}
| [
"peter.abeles@gmail.com"
] | peter.abeles@gmail.com |
c46fc5afbc1dcb31918cf48f447a2356b594ef51 | d070b49010dc46b9293d78c8e2d8253be659c5fd | /src/test/java/APNumberToStringUnitTests.java | d5a914e25867000b816a582b96f7a7d50ac2552e | [
"MIT"
] | permissive | mes32/aplib | 51616971eb3843ecd1addda84c85b05c2eb433ee | 2033bc734e02fd8e7d2d12499a277355c8fb300c | refs/heads/master | 2021-01-11T18:41:45.111599 | 2017-01-23T23:23:58 | 2017-01-23T23:23:58 | 79,602,974 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,195 | java | /*
APNumberToStringUnitTests.java - aplib
*/
import com.github.mes32.aplib.*;
import com.github.mes32.aplib.exception.*;
import org.junit.*;
import org.junit.Assert.*;
public class APNumberToStringUnitTests {
@Test
public void testToString1() throws APNumberParseException {
String inputString = "5";
APNumber num = new APNumber(inputString);
Assert.assertEquals(inputString, num.toString());
}
@Test
public void testToString2() throws APNumberParseException {
String inputString = "5.001";
APNumber num = new APNumber(inputString);
Assert.assertEquals(inputString, num.toString());
}
@Test
public void testToString3() throws APNumberParseException {
String inputString = "5.";
String outputString = "5";
APNumber num = new APNumber(inputString);
Assert.assertEquals(outputString, num.toString());
}
/*@Test
public void testToString4() throws APNumberParseException {
String inputString = "5.000";
String outputString = "5";
APNumber num = new APNumber(inputString);
Assert.assertEquals(outputString, num.toString());
}*/
} | [
"stockman.mike@gmail.com"
] | stockman.mike@gmail.com |
53e1f965603533fe62d6db5d46c1602da6eb6747 | 79c9a4de7eec900aa3d8fa4433872cf1beb92621 | /app/src/main/java/com/example/genet42/kubaruchan/communication/WiPort.java | dfc8b4f8b9d5e3e42a0a2b765c971fc07fcf97dd | [] | no_license | bovini/Kubaruchan | 48b417ea8dd8d2a06ab641768cfb0ab4fa09c920 | 81a9a1a3dfbd7cf0099810b453d880eabcea0343 | refs/heads/master | 2021-01-10T14:15:47.862920 | 2016-04-28T07:17:07 | 2016-04-28T07:17:07 | 47,730,958 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,662 | java | package com.example.genet42.kubaruchan.communication;
import android.util.Log;
import com.example.genet42.kubaruchan.statistics.Evaluation;
import java.io.IOException;
import java.net.InetAddress;
import java.util.Timer;
import java.util.TimerTask;
/**
* ใใใฝใผใจ๏ผๆจกๅ่ปใฎ WiFi ใคใณใฟใใงใผใน๏ผ
*/
public class WiPort {
/**
* Interface definition for a callback to be invoked when the state of emergency has been changed.
*/
public interface EmergencyChangeListener {
/**
* Called when the state of emergency has been changed.
*/
void onEmergencyChanged(boolean isEmergency);
}
/**
* Interface definition for a callback to be invoked when the evaluation has been voted.
*/
public interface EvaluationListener {
/**
* Called when the evaluation has been voted.
*/
void onEvaluation(Evaluation evaluation);
}
private EmergencyChangeListener emergencyChangeListener;
private EvaluationListener evaluationListener;
/**
* ๆจกๅ่ปใฎๅไฝใๆๅนใใฉใใ๏ผ
*/
private boolean active = false;
/**
* WiPortไธใฎใในใ็จใฎLEDใ็น็ฏใใใใใฉใใ
*/
private boolean test = false;
/**
* ็ทๆฅใใฉใใ
*/
private boolean emergency= false;
/**
* ่ฉไพกๅค
*/
private Evaluation evaluation = Evaluation.NULL;
/**
* ใชใฏใจในใใฎใใใฎ TimerTask
*/
private class RequestTimerTask extends TimerTask {
private final InetAddress address;
private final int port;
private final int timeout;
public RequestTimerTask(InetAddress address, int port, int timeout) {
this.address = address;
this.port = port;
this.timeout = timeout;
Log.v("RequestTimerTask", "create");
}
@Override
public void run() {
Log.v("RequestTimerTask", "run");
WiPortRequest request = new WiPortRequest(address, port);
// ๆจกๅ่ปใฎๅไฝใๆๅนใใฉใใใฎ่จญๅฎ
request.setVehicleActive(active);
// ใในใ็จLEDใฎ็น็ฏ็ถๆ
ใฎ่จญๅฎ
request.setLEDTest(test);
// ้ไฟก
try {
request.send(timeout);
} catch (Exception e) {
Log.e("WiPortRequest", e.toString());
return;
}
// ็ทๆฅใใฉใใใๅๅพใใฆๅคใซๅคๅใใใใฐ้็ฅ
boolean emgcy = request.isEmergency();
if (emgcy != emergency) {
emergencyChangeListener.onEmergencyChanged(emgcy);
}
emergency = emgcy;
// ่ฉไพกๅคใๅๅพใใฆๅคใ NULL ใใๅคๅใใใจใ(ใฉใใใๆผใใใใจใ)ใ ใ้็ฅ
Evaluation eval = request.getEvaluation();
if (evaluation == Evaluation.NULL && eval != Evaluation.NULL) {
evaluationListener.onEvaluation(eval);
}
evaluation = eval;
}
}
/**
* WiPortใฎIPใขใใฌในใจใชใขใผใใขใใฌในใใใณ CP ใฎ็ขบ่ช้้ใๆๅฎใใฆ็ๆ๏ผ
*
* @param address IPใขใใฌใน.
* @param port ใใผใ็ชๅท.
* @param period CP ใ็ขบ่ชใใ้้ [ms]
* @param timeout ใฟใคใ ใขใฆใ [ms]
*/
public WiPort(InetAddress address, int port, int period, int timeout) {
Timer timer = new Timer(true);
timer.scheduleAtFixedRate(new RequestTimerTask(address, port, timeout), 0, period);
}
/**
* Register a callback to be invoked when the state of emergency has been changed.
*
* @param listener the callback that will be run
*/
public void setOnEmergencyChangeListener(EmergencyChangeListener listener)
{
emergencyChangeListener = listener;
}
/**
* Register a callback to be invoked when the evaluation has been voted.
*
* @param listener the callback that will be run
*/
public void setOnEvaluationListener(EvaluationListener listener)
{
evaluationListener = listener;
}
/**
* ๆจกๅ่ปใฎๅไฝใๆๅนใพใใฏ็กๅนใซใใ๏ผ
*
* @param active true ใงๆจกๅ่ปใฎๅไฝใๆๅน
*/
public void setActive(boolean active) {
this.active = active;
}
/**
* WiPortไธใฎใในใ็จLEDใ็น็ฏใพใใฏๆป
็ฏใใใ๏ผ
*
* @param test true ใง LED ใ็น็ฏ
*/
public void setTest(boolean test) {
this.test = test;
}
}
| [
"bovini@baldr.jp"
] | bovini@baldr.jp |
0b1f29913996ce69255c177fc1fe215c69afa90a | 988c0235486d04aa09cc4c060fa3959ba6aa4cb9 | /app/src/main/java/com/tanuj/recyclercardview/CustomAdapter.java | 9ae291b3f9c864c61c5c4d350e9b672ab02c4ff0 | [] | no_license | tanujraj08/assignment15.1 | 5bed98ef68da14c516b701fbbe97594d9d5142a8 | a9188285136a7e2ee21187c58faefff93e9232e5 | refs/heads/master | 2020-03-19T08:34:15.414512 | 2018-06-18T09:36:38 | 2018-06-18T09:36:38 | 136,215,715 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,944 | java | package com.tanuj.recyclercardview;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.ViewHolder> {
// Item Data Object Collection.
private ItemData[] itemData;
// Create Constructor which will assign data to ItemData Variable.
public CustomAdapter(ItemData[] itemData) {
this.itemData = itemData;
}
// Override OnCreateView Holder Method which will assign the Layout to Recycler View.
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
// Inflate Layout to display number of rows based on the available data in Item Data Collection.
View itemLayout = LayoutInflater.from(parent.getContext()).inflate(R.layout.version_row,null,false);
// Set The Layout to ViewHolder
ViewHolder viewHolder = new ViewHolder(itemLayout);
// return view holder.
return viewHolder;
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
// On Bind View Holder set Android Version Name text to TextView.
holder.nameTextView.setText(itemData[position].getAndroidVersionName());
}
// Return Item Data Array Count.
@Override
public int getItemCount() {
return itemData.length;
}
// Create View HOlder Extends from RecyclerView View Holder Class
public class ViewHolder extends RecyclerView.ViewHolder{
// Create TextView Type Object.
public TextView nameTextView;
// View Holder class Constructor
public ViewHolder(View itemView) {
super(itemView);
// TypeCast as Java Object TextView From version_row.xml
nameTextView = itemView.findViewById(R.id.versionNameTextView);
}
}
}
| [
"36482135+tanujraj08@users.noreply.github.com"
] | 36482135+tanujraj08@users.noreply.github.com |
85ad865e68d659a4c7b36b4a83aeadac67c7a1b0 | 31a8331017a1b4992e40581df46a7dc0117c02b7 | /src/Composite/Company.java | 1e8f40bdaa0e168dfb3eeeed7123451fb2f65109 | [] | no_license | Bossy-Zeng/DesignPattern | a7cbce1bb1b7751973e526713ad429dd9cf6e870 | 2ebd64bf55a2f9232b2c2dd82734996beefb5a74 | refs/heads/master | 2021-01-20T03:41:48.583253 | 2017-04-27T08:08:25 | 2017-04-27T09:13:48 | 89,574,813 | 1 | 0 | null | null | null | null | GB18030 | Java | false | false | 434 | java | package Composite;
/**
* ๅ
ฌๅธ็ฑป ๅฎไนไธบๆฝ่ฑก็ฑปๆๆฏๆฅๅฃ
* */
public abstract class Company {
protected String nameString;
public Company(String name) {
// TODO Auto-generated constructor stub
this.nameString=name;
}
public abstract void Add(Company c);//ๅขๅ
public abstract void Remove(Company c);//็งป้ค
public abstract void Display(int depth);//ๆพ็คบ
public abstract void LineOfDuty();//ๅฑฅ่ก่ดฃไปป
}
| [
"1939783160@qq.com"
] | 1939783160@qq.com |
f4827dd01d7f0afa916a79011bc047790e9bf862 | ea1a32fbf80d1a9dd1b6779e4eea320731ca8038 | /src/java/lk/studentsmanage/services/LoginAPI.java | d76ef0ac9ed0055dde435f70b3e5425fccfbb8aa | [] | no_license | AtheeshRathnaweera/Hands-on-JSP | caf29dabf24279e0d5472244655b69bbe3c3b247 | 3618caea29d98f7cd342b5ba5cf09dc714cb6a25 | refs/heads/master | 2020-08-13T09:28:25.925486 | 2019-12-08T15:41:23 | 2019-12-08T15:41:23 | 214,946,148 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 717 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package lk.studentsmanage.services;
import lk.studentsmanage.models.UserModel;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.POST;
public interface LoginAPI {
@POST("login")
Call<UserModel> login(@Body UserModel uLog);
@POST("signin/student")
Call<UserModel> signInStudent(@Body UserModel uSign);
@POST("signin/teacher")
Call<UserModel> signInTeacher(@Body UserModel tSign);
@POST("signin/operator")
Call<UserModel> signInOperator(@Body UserModel pSign);
}
| [
"rathnaweeraatheesh72@gmail.com"
] | rathnaweeraatheesh72@gmail.com |
621ca8eb790cde61c391fa0f4c219c163ba3a0ed | ee8498fc96d492c5e2a96f86b2aa9b2cca5341e0 | /src/main/java/hu/noherczeg/necora/domain/user/UserServiceImpl.java | d6381ed4e529d2da8d18404782b8103f855f8ca4 | [] | no_license | noherczeg/necora | 8984d08a3faf7d17bc90054aeb59a681a08eb7f4 | a00bf762fb04ca0b8d1a7d6373d1ebfc941d383e | refs/heads/master | 2021-01-21T00:47:43.422807 | 2014-04-17T10:55:57 | 2014-04-17T10:55:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,943 | java | package hu.noherczeg.necora.domain.user;
import hu.noherczeg.necora.security.authority.Authority;
import hu.noherczeg.necora.security.authority.RoleConstants;
import org.springframework.beans.BeanUtils;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
class UserServiceImpl implements UserService {
private UserRepository userRepository;
public UserServiceImpl(UserRepository userRepository) {
this.userRepository = userRepository;
}
@PreAuthorize("hasRole('ROLE_ADMIN')")
@Transactional(readOnly = true)
//@Cacheable(value="users")
public List<User> listUsers() {
return userRepository.findAll();
}
@Transactional(readOnly = false)
public void addUser(User newUser) {
User user = new User();
BeanUtils.copyProperties(newUser, user);
Authority auth = new Authority(RoleConstants.ROLE_USER);
if(!this.isAuthorityPresent(user, auth)) {
user.getAuthorities().add(auth);
}
userRepository.save(user);
}
@Transactional(readOnly = false)
public void deleteUser(User userToDelete) {
User user = new User();
BeanUtils.copyProperties(userToDelete, user);
userRepository.delete(user);
}
@Override
@Transactional(readOnly = true)
public User findById(Long id) {
User user = userRepository.findByIdWithAll(id);
return user;
}
private boolean isAuthorityPresent(User user, GrantedAuthority auth) {
boolean result = false;
for (GrantedAuthority authority: user.getAuthorities()) {
if (auth.getAuthority().toLowerCase().equals(authority.getAuthority().toLowerCase())) {
result = true;
break;
}
}
return result;
}
}
| [
"noherczeg@gmail.com"
] | noherczeg@gmail.com |
42a3276929293355f9f151bf1fb1d1a10260bd44 | def639ce5b361c3c2da1f69c019f2b3382d5f68f | /eureka-framework/eureka-client/src/main/java/com/netflix/discovery/converters/jackson/mixin/ApplicationsXmlMixIn.java | 27bca39e377f19201b5248aa25afd46edf609ca4 | [] | no_license | baosiling/cola-template | c85eb632d11b96fb180f809f1bf858caba73d87a | d4ac6cd6aeadbe503fd8ceb3413147c106bb47f9 | refs/heads/master | 2023-01-07T05:51:35.372306 | 2020-10-20T03:01:05 | 2020-10-20T03:01:05 | 289,162,270 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,378 | java | /*
* Copyright 2015 Netflix, Inc.
*
* 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.netflix.discovery.converters.jackson.mixin;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.netflix.discovery.converters.jackson.builder.ApplicationsXmlJacksonBuilder;
import com.netflix.discovery.shared.Application;
import java.util.List;
/**
* Attach custom builder that deals with configurable property name formatting.
* {@link Application} objects are unwrapped in XML document. The necessary Jackson instrumentation is provided here.
*/
@JsonDeserialize(builder = ApplicationsXmlJacksonBuilder.class)
public interface ApplicationsXmlMixIn {
@JacksonXmlElementWrapper(useWrapping = false)
List<Application> getRegisteredApplications();
}
| [
"1257593080@qq.com"
] | 1257593080@qq.com |
32d5e869e40c8640e9da079d35f976dee957abeb | 73fb3212274525b1ad47c4eeca7082a6a0a97250 | /commonlibs/bhunheku/liblinkagerecyclerview/src/main/java/com/kunminx/linkagelistview/ui/DialogSampleFragment.java | 1d32260d766fb7569a72d3c1087b841e51e0b506 | [] | no_license | dahui888/androidkuangjia2021 | d6ba565e14b50f2a484154d8fffdb486ee56f433 | 624e212b97bb4b47d4763f644be30ef2a26d244d | refs/heads/main | 2023-07-18T00:00:43.079443 | 2021-08-26T10:15:53 | 2021-08-26T10:15:53 | 383,725,172 | 1 | 0 | null | 2021-07-07T08:18:31 | 2021-07-07T08:18:30 | null | UTF-8 | Java | false | false | 3,830 | java | package com.kunminx.linkagelistview.ui;
/*
* Copyright (c) 2018-present. KunMinX
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.snackbar.Snackbar;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.kunminx.linkage.LinkageRecyclerView;
import com.kunminx.linkage.bean.DefaultGroupedItem;
import com.kunminx.linkagelistview.R;
import java.util.List;
/**
* Create by KunMinX at 19/5/8
*/
public class DialogSampleFragment extends Fragment {
private RecyclerView rv;
private MaterialButton btn_preview;
private static float DIALOG_HEIGHT = 400;
private AlertDialog mDialog;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_dialogelm, container, false);
rv = view.findViewById(R.id.rv);
btn_preview = view.findViewById(R.id.btn_preview);
setHasOptionsMenu(true);
return view;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
btn_preview.setOnClickListener(v -> {
View view2 = View.inflate(getContext(), R.layout.layout_linkage, null);
LinkageRecyclerView linkage = view2.findViewById(R.id.linkage);
initLinkageData(linkage);
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getActivity());
mDialog = builder.setView(linkage).show();
linkage.setLayoutHeight(DIALOG_HEIGHT);
});
}
private void initLinkageData(LinkageRecyclerView linkage) {
Gson gson = new Gson();
List<DefaultGroupedItem> items = gson.fromJson(getString(R.string.operators_json),
new TypeToken<List<DefaultGroupedItem>>() {
}.getType());
linkage.init(items);
linkage.setScrollSmoothly(false);
linkage.setDefaultOnItemBindListener(
(primaryHolder, primaryClickView, title) -> {
Snackbar.make(primaryClickView, title, Snackbar.LENGTH_SHORT).show();
},
(primaryHolder, title) -> {
//TODO
},
(secondaryHolder, item) -> {
secondaryHolder.getView(R.id.level_2_item).setOnClickListener(v -> {
if (mDialog != null && mDialog.isShowing()) {
mDialog.dismiss();
}
});
},
(headerHolder, item) -> {
//TODO
},
(footerHolder, item) -> {
//TODO
}
);
}
}
| [
"liangxiao6@live.com"
] | liangxiao6@live.com |
4b762b1e8002ee3e30bd8671536acfb794e6eccc | 96dd16c7262d9b62725af71e7a97168b07848196 | /src/main/java/com/freedotech/app/ztly/cache/BaseCacheService.java | 63a3c6c4ca068cfddbd534017588cc6885ea5cd2 | [] | no_license | linglihanWX/ztly-bim_v1.2 | f7d6af72a8e264ed71a1a37ff46bfcefabe75faf | 0d1f0f3e09ec8a65f4c2dd3774d4b25e160c0b35 | refs/heads/master | 2021-01-25T11:15:05.279261 | 2018-03-01T00:43:26 | 2018-03-01T00:43:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,981 | java | package com.freedotech.app.ztly.cache;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
/**
* Created by liwei on 16/9/21.
* ๆณจๆ:่ฏฅๅบ็ก็ผๅญๆๅก็ฑปไธญไฝฟ็จ็็ผๅญ้ฝๆฏ Spring ๆกๆถๆไพ็็ผๅญ
*
*/
public class BaseCacheService implements InitializingBean{
/**
* Spring ็ Cache
*/
@Autowired
private CacheManager cacheManager;
private Cache cache;
private String cacheName;
public void setCacheManager(CacheManager cacheManager) {
this.cacheManager = cacheManager;
}
public void setCache(Cache cache) {
this.cache = cache;
}
public void setCacheName(String cacheName) {
this.cacheName = cacheName;
}
/**
* ๅจๆๆ็ๅฑๆง่ฎพ็ฝฎๅฎๆไปฅๅ,
* ๅฑๆง cacheName ๅฐฑ้็ฉบ
* cacheName ่ฟไธช String ๅฏน่ฑกๅจๆไปฌ็้กน็ฎไธญๅฐฑๆฏ ehcache.xml ไธญ้
็ฝฎ็ๅญ็ฌฆไธฒ
* cache ๅฐฑๅฏไปฅ่ทๅพไธไธช็ผๅญๅฏน่ฑก
*
* @throws Exception
*/
@Override
public void afterPropertiesSet() throws Exception {
cache = cacheManager.getCache(cacheName);
}
// ไปฅไธๆฏ่ชๅฎไน็ๆนๆณ
/**
* ๆธ
็ฉบ็ผๅญไธญๆๆ็ๅฏน่ฑก
*/
public void clear(){
cache.clear();
}
/**
* ๅฐไธไธชๅฏน่ฑกๆพๅ
ฅ็ผๅญ
* @param key
* @param value
*/
public void put(String key,Object value){
cache.put(key,value);
}
/**
* ๅฐไธไธชๅฏน่ฑก็งปๅบ็ผๅญ
* @param key
*/
public void evict(String key){
cache.evict(key);
}
/**
* ไป็ผๅญไธญ่ทๅพไธไธชๅฏน่ฑก
* @param key
* @return
*/
public Object get(String key){
Cache.ValueWrapper vw = cache.get(key);
if(vw!=null){
return vw.get();
}
return null;
}
}
| [
"18210732768@163.com"
] | 18210732768@163.com |
da478092ae267afc8362b7e6be9650d43bf992f5 | af4749013bbdbd420bae3373b9b091d5fe29ffa9 | /src/test/java/genericsTest/Shippable.java | 51c661afbe3d1ef86202cb710469a6eabf7ccb6f | [] | no_license | Sanya912/MyMavenProject | 21938f1efdd93716cb734084d84d39fe7e856ed8 | 2053a167f7df3c5e57c482db7a12fa58047de8a0 | refs/heads/master | 2023-05-26T22:13:26.787574 | 2020-02-11T05:48:14 | 2020-02-11T05:48:14 | 219,353,876 | 0 | 0 | null | 2023-05-09T18:15:45 | 2019-11-03T19:28:41 | Java | UTF-8 | Java | false | false | 542 | java | package genericsTest;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.List;
public class Shippable implements Shipping<Shoes> {
private static Shoes shoes;
public void ship(Shoes shoes){
}
List<?> list = new ArrayList<>();
@Test
void impleTestGenerics(){
// ship(new Shoes("nike"));
// ship(new Shoes("nikes"));
ship(new Shoes("Nike",100));
ship(new Shoes("Nike",1300));
System.out.println(shoes.list);
// ship(new Shoes(100));
}
}
| [
"melikhov912@gmail.com"
] | melikhov912@gmail.com |
9b7e83b0aa70b5c94a71f3ec62997c8680590786 | 87e64726a116a644650907ae4de0b40a2cb817a7 | /src/main/java/com/bae/persistence/domain/Riders.java | 487b7ea07db23f647f4c1d5e56c5642f01a9a817 | [] | no_license | Matt25969/tempProject | 93b81f431ca7b09053468ce2c02502e31604833c | 26b8d4644f0453a3ad960076a5bd9071db5f314e | refs/heads/master | 2022-05-28T03:44:13.004672 | 2019-10-02T15:17:17 | 2019-10-02T15:17:17 | 212,317,385 | 0 | 0 | null | 2022-05-20T21:10:52 | 2019-10-02T11:06:22 | HTML | UTF-8 | Java | false | false | 1,605 | java | package com.bae.persistence.domain;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
@Entity
public class Riders {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int riderID;
@Column(length = 50)
private String firstName;
@Column(length = 50)
private String lastName;
@Column(length = 3)
private int riderNumber;
@Column(length = 3)
//@OneToOne
private int riderTeamID;
public Riders() {/*Empty Constructor*/}
public Riders(int riderID, String firstName, String lastName, int riderRaceNumber, int riderTeamID) {
this.riderID = riderID;
this.firstName = firstName;
this.lastName = lastName;
this.riderNumber = riderRaceNumber;
this.riderTeamID = riderTeamID;
}
public int getRiderID() {
return riderID;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public int getRiderRaceNumber() {
return riderNumber;
}
public int getRiderTeamID() {
return riderTeamID;
}
public void setRiderID(int riderID) {
this.riderID = riderID;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public void setRiderRaceNumber(int riderRaceNumber) {
this.riderNumber = riderRaceNumber;
}
public void setRiderTeamID(int riderTeamID) {
this.riderTeamID = riderTeamID;
}
}
| [
"matt.jo.hunt@gmail.com"
] | matt.jo.hunt@gmail.com |
c4d1044c7862315a3f4ac348be406d6bfd43b92d | 2d7d11ce6b0b5404f1d756cdd3036104c8db86bf | /ๆบ็ /Interestclass/src/com/interest/util/ApplicationUtil.java | 265020a85f8748bd7885b5b43fec9452887aff48 | [] | no_license | 15879346017-jwz/Interest-class | 5ac3d431415ffdd27818355c492e6d0a21f43f68 | f4b10fee9d9592cfe8c45691bb6f4fc5864408d4 | refs/heads/master | 2022-12-09T13:23:27.669743 | 2020-09-08T01:25:02 | 2020-09-08T01:25:02 | 293,668,678 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,729 | java | package com.interest.util;
public class ApplicationUtil {
private static final String imageWebrootKey = "conf.global.upload.image.webroot";
private static final String fileWebrootKey = "conf.global.upload.file.webroot";
private static final String imageDirKey = "conf.global.upload.image.dir";
private static final String fileDirKey = "conf.global.upload.file.dir";
private static final String defaultUserImage = "conf.default.user.image";
private static final String defaultUserIbmclubface = "conf.default.user.ibmclubface";
private static final String defaultActivityposter = "conf.default.activity.image";
private static final String decryptkey = "conf.global.decrypt.key";//ๆฅๅฃๅ ๅฏๅฏๆ
public static String getDecryptkey() {
return PropertiesUtils.getValue(decryptkey);
}
public static String getImageWebroot() {
return PropertiesUtils.getValue(imageWebrootKey);
}
public static String getDefaultUserImage() {
return PropertiesUtils.getValue(defaultUserImage);
}
public static String getDefaultUserIbmclubface() {
return PropertiesUtils.getValue(defaultUserIbmclubface);
}
public static String getDefaultActivityposter() {
return PropertiesUtils.getValue(defaultActivityposter);
}
public static String getImageDir() {
return PropertiesUtils.getValue(imageDirKey);
}
public static String getFileDir() {
return PropertiesUtils.getValue(fileDirKey);
}
public static String getFileWebroot() {
return PropertiesUtils.getValue(fileWebrootKey);
}
public static String getSystemDomain() {
return PropertiesUtils.getValue(imageDirKey);
}
public static String getFileSuffix(String filename) {
return filename.substring(filename.lastIndexOf(".") + 1);
}
}
| [
"59361127+15879346017-jwz@users.noreply.github.com"
] | 59361127+15879346017-jwz@users.noreply.github.com |
b1d69e2e5b76952e125104dccc4e8246ba6f5590 | 516a77e445c42eb6fe234e1d5f66e524261e269f | /pullClient/Pull.java | 176516189ee7fb3de3fbe9ccbb0233ddcc76b220 | [] | no_license | PanosRCng/SystemMonitoring | 0453f3a55811f55b87a64122fe3f74bba6b7f9f2 | 4968ff435300eab892e0e3c7e709c6a5bd152d6d | refs/heads/master | 2020-04-07T04:12:19.276962 | 2017-01-14T06:17:29 | 2017-01-14T06:17:29 | 26,277,462 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 355 | java | import java.util.ArrayList;
import java.util.Map;
public class Pull
{
private Map<String, ArrayList<Report>> machinesReports;
// constructor
public Pull(Map<String, ArrayList<Report>> machinesReports)
{
this.machinesReports = machinesReports;
}
public Map<String, ArrayList<Report>> getMachinesReports()
{
return this.machinesReports;
}
}
| [
"panosracing@hotmail.com"
] | panosracing@hotmail.com |
c318d7fa5596cbcd88fe216b158f2ec2b5888ee4 | 18644dae6df26cca0aaa428e828a2f7348f1d239 | /src/main/java/com/dav/javacore/java/util/resourceBundle/ResourceBundleDemo.java | b97b8fc9cddbcdde75ba4cef0baa1c802d831d97 | [] | no_license | DuongVu089x/JavaCore | bd592dce70f8baaca4c44f634bd387427d9f018a | b4170c11be4a42c5f860330b1511dd8b7ed874d7 | refs/heads/master | 2021-01-21T12:27:29.410363 | 2017-09-07T04:20:36 | 2017-09-07T04:20:36 | 102,068,946 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 533 | java | package com.dav.javacore.java.util.resourceBundle;
import java.util.Locale;
import java.util.ResourceBundle;
public class ResourceBundleDemo {
public static void main(String[] args) {
Locale.setDefault(new Locale("vn","VN"));
//ResourceBundle resourcebundle = ResourceBundle.getBundle("demoResource_en_US");
ResourceBundle resourcebundle = ResourceBundle.getBundle("demoResource_en_US");
//Print out value of username
System.out.println( resourcebundle.getString("username"));
}
}
| [
"duonganhvu089x@gmail.com"
] | duonganhvu089x@gmail.com |
c7ffb936c18af33060316f38ed1059141029f0eb | bd1f3decd59ade0efcc8980eff6f97203311abf9 | /src/main/java/com/areatecnica/sigf/converters/ModeloMarcaBusConverter.java | 42110d32f88f5fe4ff993ab3ffcf14543ad511cb | [] | no_license | ianfranco/nanduapp | f4318755d859f57f50b94f0b67f02797a91634e6 | 330682a8666d0d30ac332caabe75eefee822f2d4 | refs/heads/master | 2021-03-24T12:48:03.761910 | 2018-01-08T16:58:06 | 2018-01-08T16:58:06 | 112,971,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,922 | java | package com.areatecnica.sigf.converters;
import com.areatecnica.sigf.entities.ModeloMarcaBus;
import com.areatecnica.sigf.controllers.ModeloMarcaBusFacade;
import com.areatecnica.sigf.beans.util.JsfUtil;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.convert.FacesConverter;
import javax.inject.Inject;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
@FacesConverter(value = "modeloMarcaBusConverter")
public class ModeloMarcaBusConverter implements Converter {
@Inject
private ModeloMarcaBusFacade ejbFacade;
@Override
public Object getAsObject(FacesContext facesContext, UIComponent component, String value) {
if (value == null || value.length() == 0 || JsfUtil.isDummySelectItem(component, value)) {
return null;
}
return this.ejbFacade.find(getKey(value));
}
java.lang.Integer getKey(String value) {
java.lang.Integer key;
key = Integer.valueOf(value);
return key;
}
String getStringKey(java.lang.Integer value) {
StringBuffer sb = new StringBuffer();
sb.append(value);
return sb.toString();
}
@Override
public String getAsString(FacesContext facesContext, UIComponent component, Object object) {
if (object == null
|| (object instanceof String && ((String) object).length() == 0)) {
return null;
}
if (object instanceof ModeloMarcaBus) {
ModeloMarcaBus o = (ModeloMarcaBus) object;
return getStringKey(o.getModeloMarcaBusId());
} else {
Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "object {0} is of type {1}; expected type: {2}", new Object[]{object, object.getClass().getName(), ModeloMarcaBus.class.getName()});
return null;
}
}
}
| [
"ianfr@DESKTOP-6NFGECR"
] | ianfr@DESKTOP-6NFGECR |
8b52d76d7ce6ed57ab897f2144b2593249eac835 | b5f09e447815fe0ce242467ecc729bf23bd9f497 | /src/main/java/com/cts/ptms/model/confirm/request/LabelStockSizeType.java | 52a61f67014600f2d67ccaa689160826e5fc3829 | [] | no_license | Innovlab/COMS | c6d386b6eb6aea503fda7c39aa2f9e17459f1df6 | 3a05dc7c48e54bd7ac5f98b1aaf960f73b092db0 | refs/heads/master | 2016-08-12T21:10:43.525613 | 2016-04-08T04:18:34 | 2016-04-08T04:18:34 | 52,105,167 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,407 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2016.01.27 at 04:45:15 PM CST
//
package com.cts.ptms.model.confirm.request;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for LabelStockSizeType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="LabelStockSizeType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Height" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="Width" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "LabelStockSizeType", propOrder = {
"height",
"width"
})
public class LabelStockSizeType {
@XmlElement(name = "Height", required = true)
protected String height;
@XmlElement(name = "Width", required = true)
protected String width;
/**
* Gets the value of the height property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getHeight() {
return height;
}
/**
* Sets the value of the height property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setHeight(String value) {
this.height = value;
}
/**
* Gets the value of the width property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getWidth() {
return width;
}
/**
* Sets the value of the width property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setWidth(String value) {
this.width = value;
}
}
| [
"ragavendran.s2@cognizant.com"
] | ragavendran.s2@cognizant.com |
696191f06352fffa172f5083c81984f66e607409 | 628f9eb20726d3b265d025e5b314d7e11f2914bf | /src/java/controlador/NacionalidadesControlador.java | f98dbba32a53fb38fd6c905f148ab41949ab9b5f | [] | no_license | davidarmoa123456/cedus | f08bfef7d1bf07057774499e6fb602b2f4a5b983 | 64b154f39cf10b6f45a50906ccd69bb847ab794c | refs/heads/master | 2020-11-25T22:45:38.904517 | 2019-12-18T16:33:21 | 2019-12-18T16:33:21 | 228,878,145 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,682 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package controlador;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.swing.JOptionPane;
import modelo.Nacionalidades;
import utiles.Conexion;
import utiles.utiles;
/**
*
* @author Administrator
*/
public class NacionalidadesControlador {
public static boolean agregar (Nacionalidades nacionalidad){
boolean valor= false;
if(Conexion.conectar ()){
String sql = "insert into nacionalidades(nombre_nacionalidad)"
+ "values('" + nacionalidad.getNombre_nacionalidad() + "')";
try {
Conexion.getSt().executeUpdate(sql);
valor = true;
} catch (SQLException ex) {
System.err.println("Error:" + ex);
}
}
return valor;
}
public static Nacionalidades buscarId(Nacionalidades nacionalidad){
if (Conexion.conectar()){
String sql = "select * from nacionalidades where id_nacionalidad='" + nacionalidad.getId_nacionalidad() + "'";
System.out.println("sql "+sql);
try {
ResultSet rs = Conexion.getSt().executeQuery(sql);
if (rs.next()){
nacionalidad.setId_nacionalidad(rs.getInt("id_nacionalidad"));
nacionalidad.setNombre_nacionalidad(rs.getString("nombre_nacionalidad"));
}else{
nacionalidad.setId_nacionalidad(0);
nacionalidad.setNombre_nacionalidad("");
//return null;
//return nacionalidad;
}
} catch (SQLException ex) {
System.out.println("ERROR...." + ex);
}
}
return nacionalidad;
}
public static String buscarNombre(String nombre, int pagina){
int offset = (pagina - 1)*utiles.REGISTRO_PAGINA;
String valor = "";
if (Conexion.conectar()){
try {
String sql = "select * from nacionalidades where upper(nombre_nacionalidad) like '%" +
nombre.toUpperCase() + "%'" + "order by id_nacionalidad offset " + offset + " limit " +
utiles.REGISTRO_PAGINA;
System.out.println("Llega");
try (PreparedStatement ps = Conexion.getConn().prepareStatement(sql)){
ResultSet rs = ps.executeQuery();
String tabla = "";
while (rs.next()) {
tabla += "<tr>"
+ "<td>" + rs.getString("id_nacionalidad") + "</td>"
+ "<td>" + rs.getString("nombre_nacionalidad") + "</td>"
+ "</tr>";
}
if (tabla.equals("")){
tabla = "<tr><td> colspan=2>No exixten registros...</td></tr>";
}
ps.close();
valor = tabla;
} catch (SQLException ex) {
System.err.println("ERROR: " + ex);
}
Conexion.cerrar();
} catch (Exception ex) {
System.err.println("ERROR: " + ex);
}
}
Conexion.cerrar();
return valor;
}
public static boolean modificarnacionalidad(Nacionalidades nacionalidad) {
boolean valor= false;
if (Conexion.conectar()){
String sql = "update nacionalidades set nombre_nacionalidad='" + nacionalidad.getNombre_nacionalidad() + "'"
+ " where id_nacionalidad=" + nacionalidad.getId_nacionalidad();
try {
Conexion.getSt().executeUpdate(sql);
valor = true;
} catch (SQLException ex) {
System.out.println("Error:" + ex);
}
}
return valor;
}
public static boolean eliminar(Nacionalidades nacionalidad){
boolean valor = false;
if (Conexion.conectar()){
String sql = "delete from nacionalidades where id_nacionalidad=" + nacionalidad.getId_nacionalidad();
try {
Conexion.getSt().executeUpdate(sql);
valor = true;
} catch (SQLException ex) {
System.err.println("ERROR:" + ex);
}
}
return valor;
}
}
| [
"David@LAPTOP-1R5PQ4VJ"
] | David@LAPTOP-1R5PQ4VJ |
e7d5cae59051bf4b047bcf7175cd678a66b736cd | 26f522cf638887c35dd0de87bddf443d63640402 | /src/main/java/com/cczu/aqzf/model/service/AqzfJcnrService.java | dadca354d720c36de0ad4b887b18a6f955ce6f6b | [] | no_license | wuyufei2019/JSLYG | 4861ae1b78c1a5d311f45e3ee708e52a0b955838 | 93c4f8da81cecb7b71c2d47951a829dbf37c9bcc | refs/heads/master | 2022-12-25T06:01:07.872153 | 2019-11-20T03:10:18 | 2019-11-20T03:10:18 | 222,839,794 | 0 | 0 | null | 2022-12-16T05:03:09 | 2019-11-20T03:08:29 | JavaScript | UTF-8 | Java | false | false | 2,749 | java | package com.cczu.aqzf.model.service;
import com.cczu.aqzf.model.dao.AqzfJcnrDao;
import com.cczu.aqzf.model.entity.AQZF_SafetyCheckContentEntity;
import com.cczu.sys.comm.utils.DateUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.sql.Timestamp;
import java.util.List;
import java.util.Map;
/**
* ๅฎๅ
จๆงๆณ_ๆฃๆฅๅ
ๅฎนService
*/
@Transactional(readOnly = true)
@Service("AqzfJcnrService")
public class AqzfJcnrService {
@Resource
private AqzfJcnrDao aqzfJcnrDao;
//ๆทปๅ ไฟกๆฏ
public void addInfo(AQZF_SafetyCheckContentEntity jcnr) {
//ๆทปๅ ๆฃๆฅๆนๆก
Timestamp t = DateUtils.getSysTimestamp();
jcnr.setS1(t);
jcnr.setS2(t);
jcnr.setS3(0);
aqzfJcnrDao.save(jcnr);
}
//ๆดๆฐไฟกๆฏ
public void updateInfo(AQZF_SafetyCheckContentEntity jcnr) {
Timestamp t = DateUtils.getSysTimestamp();
jcnr.setS2(t);
jcnr.setS3(0);
aqzfJcnrDao.save(jcnr);
}
/**
* ๆ นๆฎๆฃๆฅ่ฎฐๅฝidๅๆฃๆฅๅ
ๅฎนid่ทๅๆฃๆฅๅ
ๅฎนๅฏน่ฑก
*
* @param id2
* @return
*/
public AQZF_SafetyCheckContentEntity findNr(Long id1, String id2) {
//่ทๅไธญ้ด่กจๅญๆฎตๅนถไฟฎๆนๆไฝ็ถๆ
AQZF_SafetyCheckContentEntity a = aqzfJcnrDao.findNr(id1, id2);
return a;
}
/**
* ๆ นๆฎๆฃๆฅ่ฎฐๅฝidๅ ้คๅญๅจ้ฎ้ข
*
* @param id1
* @return
*/
public void deleteCzwt(Long id1) {
//่ทๅไธญ้ด่กจๅญๆฎตๅนถไฟฎๆนๆไฝ็ถๆ
aqzfJcnrDao.deleteCzwt(id1);
}
/**
* ๆ นๆฎๆฃๆฅ่ฎฐๅฝid่ทๅlist
*
* @param id
* @return
*/
public List<AQZF_SafetyCheckContentEntity> findByJlid(Long id) {
return aqzfJcnrDao.findByJlid(id);
}
public List<Map<String, Object>> findAllByJlid(Long id, String version) {
if (version.equals("2")) {
return aqzfJcnrDao.findAllByJlidTwo(id);
} else {
return aqzfJcnrDao.findAllByJlid(id);
}
}
public List<Map<String, Object>> findAllByids(String ids, String version) {
if (version.equals("2")) {
return aqzfJcnrDao.findAllByidsTwo(ids);
} else {
return aqzfJcnrDao.findAllByids(ids);
}
}
public List<AQZF_SafetyCheckContentEntity> listHiddenContent(Long recordId) {
return aqzfJcnrDao.listHiddenContent(recordId);
}
public List<Map<String, Object>> listHiddenMap(Long recordId) {
return aqzfJcnrDao.listHiddenMap(recordId);
}
public void deleteByids(String ids) {
aqzfJcnrDao.deleteByids(ids);
}
}
| [
"wuyufei2019@sina.com"
] | wuyufei2019@sina.com |
a0d039e0a5333981002546a7f7fd429c6fdf26ca | c225b85e686aefdb4797eab81593396fa140580c | /api/src/test/java/com/withblacks/api/rest/toolbox/RestActionResponseTest.java | 26a7cd718d29900fa3b51081a9c9dc6eff4f7baf | [] | no_license | utnas/with-blacks | 525c1b567779feebc72bc1fdcfc93a470215c943 | ef8e416b9cd7798e6467adf91b92bf39bf74f514 | refs/heads/master | 2020-04-23T17:19:50.387949 | 2015-11-02T21:27:36 | 2015-11-02T21:27:36 | 35,647,337 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,469 | java | package com.withblacks.api.rest.toolbox;
import com.withblacks.api.business.entities.user.GENDER;
import com.withblacks.api.facade.user.dto.UserDto;
import com.withblacks.api.business.layers.user.UserMockHelper;
import org.junit.Before;
import org.junit.Test;
import org.springframework.http.ResponseEntity;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.springframework.http.HttpStatus.OK;
public class RestActionResponseTest {
private RestActionResponse actionResponse;
private UserDto dto;
@Before
public void setUp() {
dto = UserMockHelper.mockUserDto("Iron", "Man", GENDER.MALE);
RestUpdateResponse updateResponse = mock(RestUpdateResponse.class);
doReturn(new ResponseEntity(OK)).when(updateResponse).getResponseEntity(1L, dto);
RestRemoveResponse removeResponse = mock(RestRemoveResponse.class);
doReturn(new ResponseEntity(OK)).when(removeResponse).getResponseEntity(1L);
actionResponse = new RestActionResponse(updateResponse, removeResponse);
}
@Test
public void testUpdateEntity() throws Exception {
assertThat(actionResponse.updateEntity(1L, dto).getStatusCode(), is(OK));
}
@Test
public void testDeleteEntity() throws Exception {
assertThat(actionResponse.deleteEntity(1L).getStatusCode(), is(OK));
}
} | [
"nsewolo@gmail.com"
] | nsewolo@gmail.com |
783f891927512dfee0c31cf72bf82a9194e2b1bc | 65fd6837b176867d8a15f4b294bf840cd38ac970 | /src/main/java/org/chenguoyu/leetcode/array/Solution53.java | 4063a81e3d227563e0fc1ed61256443895621551 | [] | no_license | chenguoyu96/leetcode | b34d43450c454accff7be9cfa2dd78b8664f143d | b007564154bf4b91a941f824021b74d4462bffbd | refs/heads/master | 2022-06-24T17:16:14.236808 | 2020-05-18T14:18:27 | 2020-05-18T14:18:27 | 237,926,589 | 0 | 0 | null | 2020-10-13T19:14:09 | 2020-02-03T09:17:02 | Java | UTF-8 | Java | false | false | 787 | java | package org.chenguoyu.leetcode.array;
import org.junit.Test;
/**
* 53. ๆๅคงๅญๅบๅ
* ็ปๅฎไธไธชๆดๆฐๆฐ็ป nums ๏ผๆพๅฐไธไธชๅ
ทๆๆๅคงๅ็่ฟ็ปญๅญๆฐ็ป๏ผๅญๆฐ็ปๆๅฐๅ
ๅซไธไธชๅ
็ด ๏ผ๏ผ่ฟๅๅ
ถๆๅคงๅใ
*/
public class Solution53 {
/**
* ่พๅ
ฅ: [-2,1,-3,4,-1,2,1,-5,4],
* ่พๅบ: 6
* ่งฃ้: ่ฟ็ปญๅญๆฐ็ป [4,-1,2,1] ็ๅๆๅคง๏ผไธบ 6ใ
*
* @param nums
* @return
*/
public int maxSubArray(int[] nums) {
int maxSum = nums[0];
int currSum = nums[0];
for (int i = 1; i < nums.length; i++) {
currSum = Math.max(nums[i], currSum + nums[i]);
maxSum = Math.max(currSum, maxSum);
}
return maxSum;
}
@Test
public void main() {
}
}
| [
"chenguoyu96@foxmail.com"
] | chenguoyu96@foxmail.com |
412bf38f55a98b9551b856e2dc6b96a2f3368a9e | 1cc7be95f1de8d54459261ff914f224537c42756 | /jpa-support/src/test/java/org/zxb/JpaApplication.java | b46c525418221f96f734506c26f50dee670bbc8d | [] | no_license | zeixiaobai/zxb | a5d167fe127646a30512aa96230f844c8d52c1b6 | d1d8b9aeced2f8b66ebf8aa98226403d76d9e133 | refs/heads/master | 2022-07-08T16:14:26.031876 | 2020-10-30T11:48:06 | 2020-10-30T11:48:06 | 231,355,044 | 0 | 0 | null | 2021-09-02T07:15:39 | 2020-01-02T10:04:36 | Java | UTF-8 | Java | false | false | 424 | java | package org.zxb;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@SpringBootApplication
@EnableTransactionManagement
public class JpaApplication {
public static void main(String[] args) {
SpringApplication.run(JpaApplication.class,args);
}
}
| [
"1250145226@qq.com"
] | 1250145226@qq.com |
db7d90efe387febd91253a8078c021d59ba054a7 | e679e9f563cef53abcbc956ea7d966fd181fe170 | /src/eap-common/src/main/java/com/mk/eap/common/cache/RedisCallback.java | acc7e8ef51a713f9e5fd663658945fe5c24a8f94 | [
"MIT"
] | permissive | mk-js/mk-eap | 312d25ca9100fdbd6e655514868fbb669a5462f5 | e2dca4a0dfc252ed99347170813e64e4fcf12dde | refs/heads/master | 2020-04-12T22:00:45.334523 | 2018-12-27T08:55:04 | 2018-12-27T08:55:04 | 162,778,800 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 215 | java | package com.mk.eap.common.cache;
import org.springframework.data.redis.connection.RedisConnection;
/**
* @author gaoxue
*/
public interface RedisCallback {
Object doWithRedis(RedisConnection connection);
}
| [
"lsg@rrtimes.com"
] | lsg@rrtimes.com |
e9f6708b7c5d985055d81ca7a6ca5977a761851e | 78348f3d385a2d1eddcf3d7bfee7eaf1259d3c6e | /examples/protocol-languages/FMPL/src/fmpl/State.java | 6381343a191a107c0880b8de54d7b8448787471c | [] | no_license | damenac/puzzle | 6ac0a2fba6eb531ccfa7bec3a5ecabf6abb5795e | f74b23fd14ed5d6024667bf5fbcfe0418dc696fa | refs/heads/master | 2021-06-14T21:23:05.874869 | 2017-03-27T10:24:31 | 2017-03-27T10:24:31 | 40,361,967 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,153 | java | /**
*/
package fmpl;
import org.eclipse.emf.ecore.EObject;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>State</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link fmpl.State#getName <em>Name</em>}</li>
* </ul>
* </p>
*
* @see fmpl.FmplPackage#getState()
* @model
* @generated
*/
public interface State extends EObject {
/**
* 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 fmpl.FmplPackage#getState_Name()
* @model id="true"
* @generated
*/
String getName();
/**
* Sets the value of the '{@link fmpl.State#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);
} // State
| [
"damenac@gmail.com"
] | damenac@gmail.com |
4465c94ed86558d0e42da21f40fe47609cec426d | fe09a8e183ac72c1ddd1d69af691aa5d924a9120 | /rezervaceHotel/src/test/java/com/github/pehovorka/rezervaceHotel/TestRezervace.java | 36dcf4f8820a0ae353218bd247791616a1a31958 | [] | no_license | pehovorka/rezervaceHotel | 9861436a606438cb79a3542b7e8ae3f2835d8331 | 9c8ab65849c0132d88ac11698ff67b0d100efbf6 | refs/heads/master | 2021-04-12T09:34:27.808962 | 2018-06-03T19:57:51 | 2018-06-03T19:57:51 | 126,342,434 | 1 | 0 | null | 2018-06-03T19:57:52 | 2018-03-22T13:51:00 | Java | UTF-8 | Java | false | false | 1,804 | java | package com.github.pehovorka.rezervaceHotel;
import static org.junit.Assert.assertTrue;
import java.time.LocalDate;
import org.junit.Before;
import org.junit.Test;
import com.github.pehovorka.rezervaceHotel.logika.Hotel;
import com.github.pehovorka.rezervaceHotel.logika.NovaRezervace;
import com.github.pehovorka.rezervaceHotel.logika.Klient;
import com.github.pehovorka.rezervaceHotel.logika.Pokoj;
/*******************************************************************************
* Testovacรญ tลรญda NacitaniTest slouลพรญ ke komplexnรญmu otestovรกnรญ
* naฤรญtรกnรญ vstupnรญch dat
*
* @author Aleksandr Kadesnikov
*
*/
public class TestRezervace {
private Hotel hotel;
String klientiSoubor = "./hotelData/klienti.csv";
String pokojeSoubor = "./hotelData/pokoje.csv";
String rezervaceSoubor = "./hotelData/rezervace.csv";
/**
* Metoda pro vytvoลenรญ podkladลฏ pro testovรกnรญ
*
*/
@Before
public void setUp() {
hotel = new Hotel();
}
/**
* Metoda pro testovรกnรญ zda rezervace existuje.
*
*
*/
@Test
public void existujeRezervace() {
LocalDate date = LocalDate.now();
LocalDate date2 = LocalDate.now().plusDays(1);
Pokoj pokoj = hotel.getPokoj("A001");
Klient klient = hotel.getKlient(664542832);
NovaRezervace r = new NovaRezervace(6, date, date2, pokoj, klient, 333);
hotel.vlozRezervaci(r);
System.out.println(hotel.getSeznamRezervaci());
assertTrue(hotel.getSeznamRezervaci().containsKey(6));
hotel.odeberRezervaci(r);
System.out.println(hotel.getSeznamRezervaci());
assertTrue(!hotel.getSeznamRezervaci().containsKey(6));
// pozn. test projde jelikoลพ se vytvoลรญ zadanรฝ soubor.
}
} | [
"36510532+kadesnikov@users.noreply.github.com"
] | 36510532+kadesnikov@users.noreply.github.com |
8b3aefa1b5558a2b18846b38e701e69d6d2d8de9 | 0bf5c8a42ecbdd8ba2bebff09d14e0a8c09bf869 | /DeBasis/src/h03volgendeDag/Main.java | 01818e7f81148c7141aaf45bc5f06611d90593a7 | [] | no_license | reshadf/Java | 8b92e22c877ae0cb4bda5873e2971f6ca9e63819 | 9de57a32fdf3b7ed689ab954cf90c830e1397079 | refs/heads/master | 2016-09-06T19:21:01.645495 | 2013-09-04T08:54:03 | 2013-09-04T08:54:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 145 | java | package h03volgendeDag;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
new VolgendeDag();
}
}
| [
"reshadfar@gmail.com"
] | reshadfar@gmail.com |
ae0ca8b40bc3e23d7f8318e3e0944738af38754a | 192cb8f7c6dac62a455940b6efbf98d002458ce0 | /src/com/px/common/dao/CommonDao.java | 0a21df7c4dbaf4af39a6c14987d32fdca8c762ed | [] | no_license | vivian123an/px_management_web | a1c526ccc53adc84063b9161229eeb831f56f338 | 062297fd0fa05d4f1149d1fcd1114e081819099f | refs/heads/master | 2021-03-12T23:35:33.873558 | 2015-05-19T10:26:25 | 2015-05-19T10:26:25 | 35,771,024 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 454 | java | package com.px.common.dao;
import java.io.Serializable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.NoRepositoryBean;
/**
* ๅบ็กdao
* @author jeff
* @param <E>
* @param <ID>
*/
@NoRepositoryBean
public interface CommonDao<E,ID extends Serializable> extends JpaRepository<E,ID>, JpaSpecificationExecutor<E>{
}
| [
"543201721@qq.com"
] | 543201721@qq.com |
edb6e4012238cfdc6646fd6326e07e462961128b | 8716ca2c09c820bc79b2baaed21e74738e8448da | /Proj-90_AssocationMapping_XmlDriven_UsingMap/src/main/java/com/rj/entity/Persion.java | 573cfa5e99d953c7ffae42cfe94adf49105fc8ce | [] | no_license | RjJavaTemple/Hibernate-Repo | 7153f5be10bad978a4a1edebd432d1d787b79c18 | 2aa4356b3c6dc0847f30f1829819010fe8eeb72b | refs/heads/main | 2023-08-26T05:24:12.148477 | 2021-11-11T13:57:54 | 2021-11-11T13:57:54 | 426,880,789 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 737 | java | package com.rj.entity;
import java.util.List;
import java.util.Map;
import java.util.Set;
import lombok.Getter;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
@Setter
@Getter
@RequiredArgsConstructor
public class Persion
{
private Integer PId;
@NonNull
private String Pname;
@NonNull
private String Paddress;
@NonNull
private Map<String,BankAccount> Account;
//Create The Constructure
public Persion()
{
System.out.println("0-Parms Constructure");
}
//Create The To String Method
@Override
public String toString()
{
return "Persion [PId=" + PId + ", Pname=" + Pname + ", Paddress=" + Paddress + ", Account=" + Account + "]";
}
}
| [
"javatemplerjdjman@gmail.com"
] | javatemplerjdjman@gmail.com |
4674e2de6cf3ae4ec43af794781688b8b066190b | ea146c9aeeb11fcbafaf7cc5fc8ad47fe4360a91 | /src/main/java/pt/paulosantos/betfair/aping/enums/ApiNgOperation.java | 36f7a3ef8fa0d376f851f4f205d0e3fd2312f8cd | [] | no_license | paulo-santos/bf-aping-client | 6cb748aa2f7d0804687de0d98eca83106367209b | dcbe9e8223f3c5d0348795f5149154a38288b655 | refs/heads/master | 2021-01-01T19:24:27.019373 | 2015-05-25T08:45:10 | 2015-05-25T08:45:10 | 18,497,428 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,455 | java | package pt.paulosantos.betfair.aping.enums;
import com.betfair.aping.betting.entities.*;
import com.fasterxml.jackson.core.type.TypeReference;
import pt.paulosantos.betfair.aping.dto.rpc.container.*;
import java.util.List;
/**
* Created by Paulo. 19-04-2014.
*/
public enum ApiNgOperation {
LIST_EVENT_TYPES(
"listEventTypes",
EventTypeResultContainer.class,
new TypeReference<List<EventTypeResult>>() {}),
LIST_COMPETITIONS(
"listCompetitions",
CompetitionResultContainer.class,
new TypeReference<List<CompetitionResult>>() {}),
LIST_TIME_RANGES(
"listTimeRanges",
TimeRangeResultContainer.class,
new TypeReference<List<TimeRangeResult>>() {}),
LIST_EVENTS(
"listEvents",
EventResultContainer.class,
new TypeReference<List<EventResult>>() {}),
LIST_MARKET_TYPES(
"listMarketTypes",
MarketTypeResultContainer.class,
new TypeReference<List<MarketTypeResult>>() {}),
LIST_COUNTRIES("listCountries",
CountryCodeResultContainer.class,
new TypeReference<List<CountryCodeResult>>() {}),
LIST_VENUES(
"listVenues",
VenueResultContainer.class,
new TypeReference<List<VenueResult>>() {}),
LIST_MARKET_CATALOGUE(
"listMarketCatalogue",
MarketCatalogueContainer.class,
new TypeReference<List<MarketCatalogue>>() {}),
LIST_MARKET_BOOK(
"listMarketBook",
MarketBookContainer.class,
new TypeReference<List<MarketBook>>() {}),
PLACE_ORDERS(
"placeOrders",
PlaceExecutionReportContainer.class,
new TypeReference<PlaceExecutionReport>() {}),
CANCEL_ORDERS(
"cancelOrders",
CancelExecutionReportContainer.class,
new TypeReference<CancelExecutionReport>() {}),
REPLACE_ORDERS(
"replaceOrders",
ReplaceExecutionReportContainer.class,
new TypeReference<ReplaceExecutionReport>() {}),
UPDATE_ORDERS(
"updateOrders",
UpdateExecutionReportContainer.class,
new TypeReference<UpdateExecutionReport>() {}),
LIST_CURRENT_ORDERS(
"listCurrentOrders",
CurrentOrderSummaryReportContainer.class,
new TypeReference<CurrentOrderSummaryReport>() {}),
LIST_MARKET_PROFIT_AND_LOSS(
"listMarketProfitAndLoss",
MarketProfitAndLossContainer.class,
new TypeReference<List<MarketProfitAndLoss>>(){} ),
LIST_CLEARED_ORDERS(
"listClearedOrders",
ClearedOrderSummaryReportContainer.class,
new TypeReference<ClearedOrderSummaryReport>(){});
private String operation;
private Class<? extends Container> rpcResponseType;
private TypeReference responseType;
ApiNgOperation(String operation, Class<? extends Container> rpcResponseType, TypeReference responseType){
this.operation = operation;
this.responseType=responseType;
this.rpcResponseType = rpcResponseType;
}
public String toString(){
return operation;
}
public TypeReference getResponseType(){
return responseType;
}
public Class<? extends Container> getRpcResponseType(){
return rpcResponseType;
}
}
| [
"email@paulosantos.pt"
] | email@paulosantos.pt |
fcbbc42f16abc972c759931fdf1816d949ab08df | 5515530c08384ee8c006b8d6300911b84271a09e | /day24-code/src/com/xpzt/day24/demo04/Demo01Reader.java | 167a40b5f0dc6a653be4307b23b8ab5cf695ce86 | [] | no_license | Xpccccc/Java | abb86278ba3b0c3929e0871768750c7147e03647 | 3a7c9da3577e051c142f57c0b8dac60e0cb73026 | refs/heads/master | 2023-03-01T21:13:49.637574 | 2021-01-30T09:14:28 | 2021-01-30T09:14:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,355 | java | package com.xpzt.day24.demo04;
import java.io.FileReader;
import java.io.IOException;
/*
* java.io.Reader:ๅญ็ฌฆ่พๅ
ฅๆต,ๆฏๅญ็ฌฆ่พๅ
ฅๆต็ๆ้กถๅฑ็็ถ็ฑป,ๅฎไนไบไธไบๅ
ฑๆง็ๆๅๆนๆณ,ๆฏไธไธชๆฝ่ฑก็ฑป
*
* ๅ
ฑๆง็ๆๅๆนๆณ:
* int read() ่ฏปๅๅไธชๅญ็ฌฆๅนถ่ฟๅ
* int read(char[] cbuf) ไธๆฌก่ฏปๅๅคไธชๅญ็ฌฆ,ๅฐๅญ็ฌฆ่ฏปๅ
ฅๆฐ็ป
* void close() ๅ
ณ้ญ่ฏฅ็ๅนถ้ๆพไธไนๅ
ณ่็ๆๆ่ตๆบ
*
* java.io.FileReader extends InputStreamReader extends Reader
* FileReader:ๆไปถๅญ็ฌฆ่พๅ
ฅๆต
* ไฝ็จ:ๆ็กฌ็ๆไปถไธญ็ๆฐๆฎไปฅๅญ็ฌฆ็ๆนๅผ่ฏปๅๅฐๅ
ๅญไธญ
*
* ๆ้ ๆนๆณ:
* FileReader(String filename)
* FileReader(File file)
* ๅๆฐ:่ฏปๅๆไปถ็ๆฐๆฎๆบ
* String filename:ๆไปถ็่ทฏๅพ
* File file:ไธไธชๆไปถ
* FileReadๆ้ ๆนๆณ็ไฝ็จ:
* 1.ไผๅๅปบไธไธชFileReaderๅฏน่ฑก
* 2.ไผๆFileReaderๅฏน่ฑกๆๅ่ฆ่ฏปๅๅฐๆไปถ
*
* ๅญ็ฌฆ่พๅ
ฅๆต็ไฝฟ็จๆญฅ้ชค:
* 1.ๅๅปบFileReaderๅฏน่ฑก,ๆ้ ๆนๆณไธญ็ปๅฎ่ฆ่ฏปๅ็ๆฐๆฎๆบ
* 2.ไฝฟ็จFileReaderๅฏน่ฑกไธญ็ๆนๆณread่ฏปๅๆไปถ
* 3.้ๆพ่ตๆบ
*
* */
public class Demo01Reader {
public static void main(String[] args) throws IOException {
//1.ๅๅปบFileReaderๅฏน่ฑก,ๆ้ ๆนๆณไธญ็ปๅฎ่ฆ่ฏปๅ็ๆฐๆฎๆบ
FileReader fr = new FileReader("D:\\IdeaProjects\\basic-code\\a.txt");
//2.ไฝฟ็จFileReaderๅฏน่ฑกไธญ็ๆนๆณread่ฏปๅๆไปถ
//int read() ่ฏปๅๅไธชๅญ็ฌฆ่ฟๅ
/*int len = 0;
while((len = fr.read()) != -1) {
System.out.print((char)len);
}*/
//int read(char[] cbuf) ไธๆฌก่ฏปๅๅคไธชๅญ็ฌฆ,ๅฐๅญ็ฌฆ่ฏปๅ
ฅๆฐ็ป
char[] cs = new char[1024];//ๅญๅจๅฐ่ฏปๅๅฐ็ๅคไธชๅญ็ฌฆ
int len = 0;//่ฎฐๅฝ็ๆฏๆฏๆฌก่ฏปๅๅฐ็ๆๆๅญ็ฌฆ็ไธชๆฐ
while ((len = fr.read(cs)) != -1) {
/*
* String็ฑป็ๆ้ ๆนๆณ
* String (char[] value) ๆๅญ็ฌฆๆฐ็ป่ฝฌๆขไธบๅญ็ฌฆไธฒ
* String (char[] value,int offset,int count ):ๆๅญ็ฌฆๆฐ็ป็ไธ้จๅ่ฝฌๆขไธบๅญ็ฌฆไธฒ,offsetๆฐ็ป็ๅผๅง็ดขๅผ,count ่ฝฌๆข็ไธชๆฐ
* */
System.out.println(new String(cs, 0, len));
}
//3.้ๆพ่ตๆบ
fr.close();
}
}
| [
"1014647664@qq.com"
] | 1014647664@qq.com |
b5c74b76038047cca76306af0e6cf7ab47217edb | 366bc1e3848f2291ffcb270c36d71b44df1fcec1 | /app/src/main/java/smartassist/appreciate/be/smartassist/utils/TypefaceHelper.java | 28ab0c9ad5128d54bdb2574fe0cef3658df53495 | [] | no_license | henridev/City-Assistant | 0e208cacd9e1180500b60bdf3bc4a629ac906bfb | 841804fed77f6d2f33ef5fe81f178eff97eb1fe5 | refs/heads/master | 2021-06-10T13:12:13.057279 | 2016-11-08T09:45:32 | 2016-11-08T09:45:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,644 | java | package smartassist.appreciate.be.smartassist.utils;
import android.content.Context;
import android.graphics.Typeface;
/**
* Created by Inneke De Clippel on 19/01/2016.
*/
public class TypefaceHelper
{
private static Typeface typefaceRegular;
private static Typeface typefaceBold;
private static Typeface typefaceBlack;
private static Typeface typefaceLight;
private static Typeface typefaceHairline;
public static final int MONTSERRAT_REGULAR = 1;
public static final int MONTSERRAT_BOLD = 2;
public static final int MONTSERRAT_BLACK = 3;
public static final int MONTSERRAT_LIGHT = 4;
public static final int MONTSERRAT_HAIRLINE = 5;
public static Typeface getTypeface(Context context, int typefaceNumber)
{
switch (typefaceNumber)
{
case MONTSERRAT_REGULAR:
return getTypefaceRegular(context);
case MONTSERRAT_BOLD:
return getTypefaceBold(context);
case MONTSERRAT_BLACK:
return getTypefaceBlack(context);
case MONTSERRAT_LIGHT:
return getTypefaceLight(context);
case MONTSERRAT_HAIRLINE:
return getTypefaceHairline(context);
default:
return getTypefaceRegular(context);
}
}
public static Typeface getTypefaceRegular(Context context)
{
if(typefaceRegular == null)
{
typefaceRegular = Typeface.createFromAsset(context.getAssets(), "Montserrat-Regular.otf");
}
return typefaceRegular;
}
public static Typeface getTypefaceBold(Context context)
{
if(typefaceBold == null)
{
typefaceBold = Typeface.createFromAsset(context.getAssets(), "Montserrat-Bold.otf");
}
return typefaceBold;
}
public static Typeface getTypefaceBlack(Context context)
{
if(typefaceBlack == null)
{
typefaceBlack = Typeface.createFromAsset(context.getAssets(), "Montserrat-Black.otf");
}
return typefaceBlack;
}
public static Typeface getTypefaceLight(Context context)
{
if(typefaceLight == null)
{
typefaceLight = Typeface.createFromAsset(context.getAssets(), "Montserrat-Light.otf");
}
return typefaceLight;
}
public static Typeface getTypefaceHairline(Context context)
{
if(typefaceHairline == null)
{
typefaceHairline = Typeface.createFromAsset(context.getAssets(), "Montserrat-Hairline.otf");
}
return typefaceHairline;
}
}
| [
"ismael@silverback-it.be"
] | ismael@silverback-it.be |
9dfa1121b4a3652b7f8ddb01f5450860bc3a592e | e1fb43466c81143a5d0353fac5b48ae9ebca8583 | /src/main/java/me/learmonth/iain/onionoo/Pair.java | daefd53e7a63418d07c398c5a80666e477fb2bc5 | [] | no_license | irl/java-onionoo | b26e06e8079fb1e87f8e749d59d51be34845ae68 | a63007d25b9863df1853cf3370eb0cec3cf74626 | refs/heads/master | 2021-04-26T00:31:07.148370 | 2017-10-17T20:50:49 | 2017-10-17T20:50:49 | 107,322,334 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,111 | java | /*
* Onionoo
* Onionoo
*
* OpenAPI spec version: 4.2
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package me.learmonth.iain.onionoo;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2017-10-17T21:49:33.054+01:00")
public class Pair {
private String name = "";
private String value = "";
public Pair (String name, String value) {
setName(name);
setValue(value);
}
private void setName(String name) {
if (!isValidString(name)) return;
this.name = name;
}
private void setValue(String value) {
if (!isValidString(value)) return;
this.value = value;
}
public String getName() {
return this.name;
}
public String getValue() {
return this.value;
}
private boolean isValidString(String arg) {
if (arg == null) return false;
if (arg.trim().isEmpty()) return false;
return true;
}
}
| [
"irl@fsfe.org"
] | irl@fsfe.org |
526fe7c07da7e4332ffb0e0c8959c569edaca356 | b083122c392406f3f8d646dae6ad7ba21fee8d12 | /app/src/main/java/com/croteam/crobird/adapter/MenuAdapter.java | 202633b187d5a5c70efcf104c30fd839c5e5e442 | [] | no_license | mthu1006/crobird | 0df57221d271469b1ab25adf0946cf37c1a59b00 | 5ca590f9d629048a42a64a534865b6ab733a0511 | refs/heads/master | 2020-04-23T15:48:16.023866 | 2019-05-05T14:43:56 | 2019-05-05T14:43:56 | 171,277,158 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,260 | java | package com.croteam.crobird.adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.croteam.crobird.R;
import com.croteam.crobird.model.CommonClass;
import java.util.ArrayList;
public class MenuAdapter extends RecyclerView.Adapter<MenuAdapter.MyViewHolder> {
private ArrayList<CommonClass> list;
private Context context;
private ClickListener clickListener;
public class MyViewHolder extends RecyclerView.ViewHolder {
public TextView name;
public ImageView img;
public MyViewHolder(View view) {
super(view);
name = (TextView) view.findViewById(R.id.tv_name);
img = (ImageView) view.findViewById(R.id.icon);
}
}
public MenuAdapter(Context context, ArrayList<CommonClass> list, ClickListener clickListener) {
this.list = list;
this.context = context;
this.clickListener = clickListener;
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.item_menu, parent, false);
return new MyViewHolder(itemView);
}
@Override
public void onBindViewHolder(MyViewHolder holder, final int position) {
final CommonClass menu = list.get(position);
holder.name.setText(menu.getField1());
holder.img.setImageResource(menu.getNum1());
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
v.setTag(position);
clickListener.onItemClick(v);
}
});
holder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
v.setTag(position);
clickListener.onItemLongClick(v);
return true;
}
});
}
@Override
public int getItemCount() {
return list.size();
}
}
| [
"mthu1006@gmail.com"
] | mthu1006@gmail.com |
4175b0effc32bfce61d5f9c093ab4cb5052ff7a7 | e752d93e5e89541c3fdea16ba055d6dd4986a396 | /src/com/snap/beans/NearbyKey.java | 8cedc1b19238d4a0479a23edff815b63edca89f3 | [] | no_license | weaveranoop/shopping-around | 6fec0ef6fe286ee28bc9671780a99adb4cb6816f | 4612c917222d610507fe86fdef7cc0d6426ed79d | refs/heads/master | 2021-01-10T21:56:05.112425 | 2015-08-14T17:28:31 | 2015-08-14T17:28:31 | 40,611,173 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 433 | java | package com.snap.beans;
import java.io.Serializable;
public class NearbyKey implements Serializable{
private int sector;
private int nearby_sector;
public int getSector() {
return sector;
}
public void setSector(int sector) {
this.sector = sector;
}
public int getNearby_sector() {
return nearby_sector;
}
public void setNearby_sector(int nearby_sector) {
this.nearby_sector = nearby_sector;
}
}
| [
"anoop.shukla@L-G5Z6152.jasperindia.local"
] | anoop.shukla@L-G5Z6152.jasperindia.local |
9f7ef80a3834e0622c3b2f1a36e605f3713475c6 | 51f18acb95ca43fa3dd0eb0345f0c6b5f3f56a2e | /app/src/main/java/com/hcmut/admin/bktrafficsystem/repository/remote/model/request/ReportRequest.java | 2147392d923b289382d8902a67320569c83d1180 | [] | no_license | daipham2506/trafficsystemclient | 0070e572e4f28bf741aeea6d0bb608f39ce64dc1 | aef1d7947ef728bda960ada0589e7583850aeb0e | refs/heads/master | 2023-03-06T02:24:32.704785 | 2021-02-22T12:32:40 | 2021-02-22T12:32:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,779 | java | package com.hcmut.admin.bktrafficsystem.repository.remote.model.request;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.util.Log;
import android.widget.Toast;
import androidx.annotation.NonNull;
import com.google.android.gms.maps.model.LatLng;
import com.hcmut.admin.bktrafficsystem.repository.remote.model.BaseResponse;
import com.hcmut.admin.bktrafficsystem.repository.remote.model.response.ReportResponse;
import com.hcmut.admin.bktrafficsystem.business.UserLocation;
import com.hcmut.admin.bktrafficsystem.repository.remote.RetrofitClient;
import com.hcmut.admin.bktrafficsystem.service.AppForegroundService;
import com.hcmut.admin.bktrafficsystem.ui.map.MapActivity;
import com.hcmut.admin.bktrafficsystem.ui.report.traffic.TrafficReportFragment;
import com.hcmut.admin.bktrafficsystem.util.SharedPrefUtils;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class ReportRequest {
public static final int MAX_VELOCITY = 80;
public static final String [] reasons = {
"Tแบฏc ฤฦฐแปng", "Ngแบญp lแปฅt", "Cรณ vแบญt cแบฃn", "Tai nแบกn", "Cรดng an", "ฤฦฐแปng cแบฅm"
};
private int velocity;
private Double currentLat = null;
private Double currentLng = null;
private Double nextLat = null;
private Double nextLng = null;
private List<String> causes;
private String description;
private List<String> images;
private String type = "user";
private String token;
private String active;
private String path_id;
private String is_update_current_location;
private String address;
@NonNull
@Override
public String toString() {
return "type: " + type + "; active: " + active + "; path_id: "+ path_id + "; is_update: " + is_update_current_location;
}
public ReportRequest() {
if (velocity < 1) {
velocity = 1;
}
}
/**
* Contructor for post GPS data
* @param prevLocation
* @param currentLocation
*/
public ReportRequest(@NotNull UserLocation prevLocation, @NotNull UserLocation currentLocation) {
this.currentLat = prevLocation.getLatitude();
this.currentLng = prevLocation.getLongitude();
this.nextLat = currentLocation.getLatitude();
this.nextLng = currentLocation.getLongitude();
this.velocity = Math.round(UserLocation.calculateSpeed(prevLocation, currentLocation));
this.type = "system";
if (velocity < 1) {
velocity = 1;
}
}
public ReportRequest(int velocity, double currentLat, double currentLng, double nextLat, double nextLng, List<String> causes, String description, List<String> images) {
this.velocity = velocity;
this.currentLat = currentLat;
this.currentLng = currentLng;
this.nextLat = nextLat;
this.nextLng = nextLng;
this.causes = causes;
this.description = description;
this.images = images;
if (this.velocity < 1) {
this.velocity = 1;
}
}
/**
* Model for stop notification
* @param userLocation
*/
private ReportRequest(@NotNull UserLocation userLocation, Context context) {
this.currentLat = userLocation.getLatitude();
this.currentLng = userLocation.getLongitude();
this.nextLat = userLocation.getLatitude();
this.nextLng = userLocation.getLongitude();
this.velocity = 50;
this.type = "system";
token = SharedPrefUtils.getNotiToken(context);
active = "false";
path_id = AppForegroundService.path_id;
is_update_current_location = "true";
}
public static ReportRequest getStopNotificationModel(@NotNull UserLocation userLocation, Context context) {
return new ReportRequest(userLocation, context);
}
public static ReportRequest getStartReportNotificationModel(@NotNull UserLocation userLocation, Context context) {
ReportRequest reportRequest = new ReportRequest(userLocation, context);
reportRequest.active = "true";
reportRequest.path_id = null;
return reportRequest;
}
public void checkUpdateCurrentLocation(Context context) {
if (AppForegroundService.isUpdateCurrentLocation()) {
token = SharedPrefUtils.getNotiToken(context);
active = "true";
path_id = AppForegroundService.path_id;
is_update_current_location = "true";
} else {
is_update_current_location = "false";
}
}
public boolean checkValidData(Context context) {
if (currentLat == null || currentLng == null || nextLat == null || nextLng == null) {
Toast.makeText(context,
"Vแป trรญ cแบฃnh bรกo chฦฐa ฤฦฐแปฃc chแปn, vui lรฒng thแปญ lแบกi",
Toast.LENGTH_SHORT).show();
return false;
}
if (velocity < 0 || velocity > MAX_VELOCITY) {
Toast.makeText(context,
"Vแบญn tแปc phแบฃi lแปn hฦกn 0 vร nhแป hฦกn " + MAX_VELOCITY,
Toast.LENGTH_SHORT).show();
return false;
}
return true;
}
public void sendReport(final TrafficReportFragment fragment) {
final Activity activity = fragment.getActivity();
if (activity == null) return;
final ProgressDialog progressDialog = ProgressDialog.show(activity, "", "ฤang xแปญ lรฝ..!", true);
RetrofitClient.getApiService().postTrafficReport(MapActivity.currentUser.getAccessToken(), this)
.enqueue(new Callback<BaseResponse<ReportResponse>>() {
@Override
public void onResponse(Call<BaseResponse<ReportResponse>> call, Response<BaseResponse<ReportResponse>> response) {
progressDialog.dismiss();
if (response.code() == 200 && response.body() != null && response.body().getCode() == 200) {
Log.e("ggg", response.body().getMessage());
MapActivity.androidExt.showSuccess(activity, "Gแปญi cแบฃnh bรกo thร nh cรดng");
fragment.clearReport();
} else {
MapActivity.androidExt.showErrorDialog(activity, "Gแปญi cแบฃnh bรกo thแบฅt bแบกi, vui lรฒng thแปญ lแบกi");
}
}
@Override
public void onFailure(Call<BaseResponse<ReportResponse>> call, Throwable t) {
progressDialog.dismiss();
MapActivity.androidExt.showErrorDialog(activity, "Gแปญi cแบฃnh bรกo thแบฅt bแบกi, vui lรฒng thแปญ lแบกi");
}
});
}
public int getVelocity() {
return velocity;
}
public void setVelocity(int velocity) {
if (velocity > 0) {
this.velocity = velocity;
} else {
this.velocity = 1;
}
}
public void setCurrentLatLng(LatLng latLng) {
if (latLng != null) {
currentLat = latLng.latitude;
currentLng = latLng.longitude;
}
}
public void setNextLatLng(LatLng latLng) {
if (latLng != null) {
nextLat = latLng.latitude;
nextLng = latLng.longitude;
}
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public double getCurrentLat() {
return currentLat;
}
public void setCurrentLat(double currentLat) {
this.currentLat = currentLat;
}
public double getCurrentLng() {
return currentLng;
}
public void setCurrentLng(double currentLng) {
this.currentLng = currentLng;
}
public double getNextLat() {
return nextLat;
}
public void setNextLat(double nextLat) {
this.nextLat = nextLat;
}
public double getNextLng() {
return nextLng;
}
public void setNextLng(double nextLng) {
this.nextLng = nextLng;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public String getActive() {
return active;
}
public void setActive(String active) {
this.active = active;
}
public String getPath_id() {
return path_id;
}
public void setPath_id(String path_id) {
this.path_id = path_id;
}
public String getIs_update_current_location() {
return is_update_current_location;
}
public void setIs_update_current_location(String is_update_current_location) {
this.is_update_current_location = is_update_current_location;
}
public List<String> getCauses() {
return causes;
}
public void setCauses(List<String> causes) {
if (causes != null && causes.size() > 0) {
this.causes = causes;
}
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
if (description != null && description.length() > 0) {
this.description = description;
}
}
public List<String> getImages() {
return images;
}
public void setImages(List<String> images) {
if (images != null && images.size() > 0) {
this.images = images;
}
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
| [
"duonghoaiphong65@gmail.com"
] | duonghoaiphong65@gmail.com |
14d158ae268173ab6242a5da458afd03e6de6bcf | cece74aaf88a8563ca91fb9e12fff553839f7179 | /src/main/java/com/dastex/javaword/utils/CreateDataBAse.java | 91bac44a685a0fef5d8639930fbd1b3b1209120c | [] | no_license | aymenlaadhari/WordJava | d490b809f04cc321a8765d8afd7bdc97c8827d20 | f7b8aeb74f9c6ce16d1c2a39fc8f9d71a6f8427a | refs/heads/master | 2021-01-01T05:06:40.503721 | 2016-05-23T15:02:59 | 2016-05-23T15:02:59 | 57,960,962 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,965 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.dastex.javaword.utils;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author aladhari
*/
public class CreateDataBAse {
static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
static final String DB_URL = "jdbc:mysql://localhost:3306/produkte?zeroDateTimeBehavior=convertToNull";
static String dburlProdukt = "jdbc:sqlanywhere:uid=dba;pwd=sql;eng=DBSRV5;database=Produkt5;links=tcpip(host = 10.152.1.203)";
// Database credentials
static final String USER = "root";
static final String PASS = "aymen";
Connection conProdukt;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
try (
// Connect to Sybase Database
Connection conProdukt = DriverManager.getConnection(dburlProdukt);
Statement statementPro = conProdukt.createStatement();
) {
getDatabaseMetaData(conProdukt, statementPro);
} catch (SQLException ex) {
System.out.println(ex.toString());
}
}
private static void getDatabaseMetaData(Connection conn, Statement statementPro) {
try {
DatabaseMetaData dbmd = conn.getMetaData();
statementPro = conn.createStatement();
String[] types = {"TABLE"};
ResultSet rs = dbmd.getTables(null, null, "%", types);
while (rs.next()) {
//System.out.println(rs.getString("TABLE_NAME"));
ResultSet rs1 = statementPro.executeQuery("SELECT * FROM " + rs.getString("TABLE_NAME"));
ResultSetMetaData rsmd = rs1.getMetaData();
createTable(rs.getString("TABLE_NAME"), rsmd, rs1);
}
} catch (SQLException e) {
System.out.println(e.toString());
}
}
private static void createTable(String tableName, ResultSetMetaData rsmd, ResultSet rs1) {
Connection conn = null;
Statement stmt = null;
try {
//STEP 2: Register JDBC driver
Class.forName("com.mysql.jdbc.Driver");
//STEP 3: Open a connection
System.out.println("Connecting to a selected database...");
conn = DriverManager.getConnection(DB_URL, USER, PASS);
System.out.println("Connected database successfully...");
//STEP 4: Execute a query
System.out.println("Creating table in given database...");
stmt = conn.createStatement();
String sqlCreate = "CREATE TABLE " + tableName + " (idNew INTEGER not NULL,PRIMARY KEY ( idNew ))";
stmt.executeUpdate(sqlCreate);
createTableColumns(rsmd,tableName, stmt,conn, rs1);
System.out.println("Created table in given database...");
} catch (SQLException se) {
//Handle errors for JDBC
se.printStackTrace();
} catch (Exception e) {
//Handle errors for Class.forName
e.printStackTrace();
} finally {
//finally block used to close resources
try {
if (stmt != null) {
conn.close();
}
} catch (SQLException se) {
}// do nothing
try {
if (conn != null) {
conn.close();
}
} catch (SQLException se) {
se.printStackTrace();
}//end finally try
}//end try
System.out.println("Goodbye!");
}
private static void createTableColumns(ResultSetMetaData rsmd, String tableName, Statement stmt, Connection conn, ResultSet rs1) throws SQLException {
//int columnCount = rsmd.getColumnCount();
int i = 1;
// The column count starts from 1
while (rs1.next())
{
String name = rsmd.getColumnName(i);
stmt = conn.createStatement();
String sqlCreate = "ALTER TABLE "+tableName+" ADD "+name+" varchar(200) NULL";
String sqlInsert = "INSERT INTO "+tableName+" "+name+" VALUES "+rs1.getNString(name)+"";
stmt.executeUpdate(sqlCreate);
stmt.executeUpdate(sqlInsert);
System.out.println(name);
i = i+1;
// Do stuff with name
}
}
}
| [
"aladhari@WS_57.domdtx01.dastex.de"
] | aladhari@WS_57.domdtx01.dastex.de |
d127ea32eadae0e1ae64ba4a34250daff62545f9 | 47fca40b9c30c23f8e3f4d7339730db0caed2921 | /xiupuling_android/app/src/main/java/com/gohoc/xiupuling/ui/terminal/InputTerminalNumberActivity.java | d4784a4ef909f80b4bb0d0f7939969cf5b3f9820 | [] | no_license | KenSuperboy/xiupuling_wjj | 8787d6a19d0226fb6b41bee0c0bba3c9c078cd0d | a2ae4828937fafc9503317aaaed851c9b8ee9380 | refs/heads/master | 2021-08-15T04:35:29.275110 | 2017-11-17T10:02:39 | 2017-11-17T10:02:39 | 111,085,935 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,226 | java | package com.gohoc.xiupuling.ui.terminal;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.TextView;
import android.widget.Toast;
import com.gohoc.xiupuling.R;
import com.gohoc.xiupuling.bean.ShopDetailsBean;
import com.gohoc.xiupuling.bean.VCodeBenan;
import com.gohoc.xiupuling.net.RxRetrofitClient;
import com.gohoc.xiupuling.ui.BasicActivity;
import com.gohoc.xiupuling.utils.ClearEditText;
import com.gohoc.xiupuling.utils.Utils;
import com.gohoc.xiupuling.utils.ViewUtils;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import rx.Observer;
public class InputTerminalNumberActivity extends BasicActivity {
@BindView(R.id.toolbar_left_title)
TextView toolbarLeftTitle;
@BindView(R.id.toolbar_title)
TextView toolbarTitle;
@BindView(R.id.shop_mobile_et)
ClearEditText shopMobileEt;
@BindView(R.id.toolbar_right)
TextView toolbar_right;
private String terminalId;
private ShopDetailsBean shopDetailsBeans;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_terminal_layout);
ButterKnife.bind(this);
setStatusColor(R.color.colorPrimary);
shopMobileEt.setFocusable(true);
toolbarTitle.setText("็ป็ซฏ็ผๅท");
Utils.showSoftInputFromWindow(this, shopMobileEt);
shopMobileEt.setImeOptions(EditorInfo.IME_ACTION_GO);
shopMobileEt.setOnEditorActionListener(new TextView.OnEditorActionListener() {
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEND ||
(event != null && event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
switch (event.getAction()) {
case KeyEvent.ACTION_UP:
if(TextUtils.isEmpty(shopMobileEt.getText().toString())){
Toast.makeText(InputTerminalNumberActivity.this,"่ฏท่พๅ
ฅ็ป็ซฏ็ผๅท",Toast.LENGTH_SHORT).show();
}else {
if (null == terminalId)
accesstokencheck(shopMobileEt.getText().toString());//ๆทปๅ ็ป็ซฏ
else
fixtermianl(shopMobileEt.getText().toString(), terminalId);//ๆขๅค็ป็ซฏ
//accesstokencheck(shopMobileEt.getText().toString());
}
return true;
default:
return true;
}
}
return false;
}
});
initData();
}
private void initData()
{
terminalId = getIntent().getStringExtra("terminalId");
if (null == terminalId)
toolbarTitle.setText("ๆทปๅ ็ป็ซฏ");
else
toolbarTitle.setText("ๆขๅค็ป็ซฏ");
try {
shopDetailsBeans = (ShopDetailsBean) getIntent().getExtras().get("shopDetailsBeans");
} catch (Exception e) {
}
}
private void goback() {
InputTerminalNumberActivity.this.finish();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
goback();
}
return false;
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (ViewUtils.isTouchedViewOutSideView(shopMobileEt, event)) {
showInput(false);
}
return super.onTouchEvent(event);
}
@OnClick({R.id.toolbar_left_title, R.id.toolbar_right})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.toolbar_left_title:
goback();
break;
case R.id.toolbar_right:
if(TextUtils.isEmpty(shopMobileEt.getText().toString())){
Toast.makeText(InputTerminalNumberActivity.this,"่ฏท่พๅ
ฅ็ป็ซฏ็ผๅท",Toast.LENGTH_SHORT).show();
return;
}
if (null == terminalId)
accesstokencheck(shopMobileEt.getText().toString());//ๆทปๅ ็ป็ซฏ
else
fixtermianl(shopMobileEt.getText().toString(), terminalId);//ๆขๅค็ป็ซฏ
break;
}
}
//ๆทปๅ ็ต็ซฏ
private void accesstokencheck(final String result) {
RxRetrofitClient.getInstance(InputTerminalNumberActivity.this).accesstokencheck(result, "1000", new Observer<VCodeBenan>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
Utils.toast(InputTerminalNumberActivity.this, "่ฏทๆฃๆฅ็ฝ็ปๆฏๅฆๆญฃๅธธ");
try {
throw e;
} catch (Throwable throwable) {
throwable.printStackTrace();
}
}
@Override
public void onNext(VCodeBenan vCodeBenan) {
//Utils.toast(AddTerminalActivity.this, vCodeBenan.getMessage());
if (vCodeBenan.getCode() == 1) {
if (TextUtils.isEmpty(terminalId))
startActivity(new Intent(InputTerminalNumberActivity.this, AddTerminal2Activity.class).putExtra("token", result).putExtra("shopDetailsBeans", shopDetailsBeans));
else
Utils.toast(InputTerminalNumberActivity.this, vCodeBenan.getMessage());
finish();
} else
Utils.toast(InputTerminalNumberActivity.this, vCodeBenan.getMessage());
}
});
}
//ๆขๅพฉ็ต็ซฏ
private void fixtermianl(String token, String terminalId) {
//Utils.toast(this,"fixtermianl");
RxRetrofitClient.getInstance(InputTerminalNumberActivity.this).recovery(token, "1000", terminalId, new Observer<VCodeBenan>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
Utils.toast(InputTerminalNumberActivity.this, "่ฏทๆฃๆฅ็ฝ็ปๆฏๅฆๆญฃๅธธ");
try {
throw e;
} catch (Throwable throwable) {
throwable.printStackTrace();
}
}
@Override
public void onNext(VCodeBenan vCodeBenan) {
// Utils.toast(AddTerminalActivity.this,vCodeBenan.getMessage());
if (vCodeBenan.getCode() == 1) {
Utils.toast(InputTerminalNumberActivity.this, "็ป็ซฏๆขๅคๆๅ");
finish();
} else
Utils.toast(InputTerminalNumberActivity.this, vCodeBenan.getMessage());
}
});
}
}
| [
"623712402@qq.com"
] | 623712402@qq.com |
18b98a88771005ca6c1c1bde728a8d4d273294f9 | 54ff1e25087a5660f034342bcbccd4c645a65f0c | /lesson7hw/src/main/java/ru/geekbrains/android3_6/di/AppComponent.java | 3d10ded412eccfa2206701c62b331210215c6254 | [] | no_license | Keos99/GU_Android_Popular_Libraries | 2229592cbcc2b46086a55f6587cfc7874c5a566f | f5cd75e890e675dd9aed6e364f5839dc8047f3a9 | refs/heads/master | 2020-04-16T18:56:04.783894 | 2019-02-27T14:00:03 | 2019-02-27T14:00:03 | 165,840,566 | 0 | 0 | null | 2019-02-27T14:00:04 | 2019-01-15T11:39:11 | Java | UTF-8 | Java | false | false | 502 | java | package ru.geekbrains.android3_6.di;
import dagger.Component;
import ru.geekbrains.android3_6.di.modules.*;
import ru.geekbrains.android3_6.mvp.presenter.MainPresenter;
import ru.geekbrains.android3_6.ui.activity.MainActivity;
import javax.inject.Singleton;
@Singleton
@Component(modules = {
AppModule.class,
RepoModule.class,
CiceroneModule.class
})
public interface AppComponent {
void inject(MainPresenter mainPresenter);
void inject(MainActivity mainActivity);
}
| [
"keos99@bk.ru"
] | keos99@bk.ru |
ca56f5c7647cfb89c417b77e626a1a910a14c23b | 0ecfe09cd606fbb8a4f2853e6ed88ca55c215264 | /ICS-2101-master/LAB 0/Calculations/src/operations/Calculator.java | ccd4a66560d36168b8e9bbf710ee0ed62a3182a4 | [] | no_license | munene04/lab5-6 | 4fe10cd0c64f075863b88455b8a276bfb3901d21 | f60c7b8218f1ec20ee62aa165d76dd4d05fe4b7c | refs/heads/master | 2021-05-06T10:41:37.012307 | 2017-12-13T19:42:16 | 2017-12-13T19:42:16 | 114,160,416 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 625 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package operations;
/**
*
* @author Don Stefan
*/
public class Calculator extends Arithmetic {
public int sub;
@Override
public int difference(){
if (getFirst_number()>getSecond_number())
{sub = getFirst_number()-getSecond_number();
return sub;}
return 0;}
public int difference(int a){
if (getSecond_number()>getFirst_number())
{sub = getSecond_number()-getFirst_number();
return sub;}
return 0;}
}
| [
"muneneevans04@gmail.com"
] | muneneevans04@gmail.com |
cec0e79efec70c6c6392f9167d48364f48325feb | 8f79a1de34fb80e44bb3494c11ae327385fd6e7f | /cloudalibaba-consumer-nacos-order83/src/main/java/com/atguigu/springcloud/OrderMain83.java | ba15d2d8d7640d98a4dfbd3836a0dd07586563b9 | [
"Apache-2.0"
] | permissive | luwenjit/SpringCloud-2020-Hoxton-SpringCloud-alibaba | fe6571025f008f98d22447c881e82967d96fbec1 | 3cd3782d187ba2d56ea6afbfd7c130348b5116f3 | refs/heads/master | 2022-04-26T06:31:24.986904 | 2020-04-24T05:46:02 | 2020-04-24T05:46:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 461 | java | package com.atguigu.springcloud;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
/**
* @author ็ๆณ
* @date 2020/4/21 11:47
*/
@SpringBootApplication
@EnableDiscoveryClient
public class OrderMain83 {
public static void main(String[] args) {
SpringApplication.run(OrderMain83.class,args);
}
}
| [
"wangliu.ah@qq.com"
] | wangliu.ah@qq.com |
591d747e0da2cec287c0a4262b3fccf5306c2b26 | e9652137be9ce957a7a75973bfa512e7a00aa91d | /src/main/java/com/romkudev/api/test/Item.java | 44e006be47455db55f9e9349720cfb86b51f4261 | [] | no_license | vo0a/bithumb-spring-boot-webflux-mongo | 2be9e8ddc7eeea04d2585c8707f94e9bfbedfdcd | bc890fcce1e1167b9f5f1c15098cf0335e534152 | refs/heads/main | 2023-08-16T09:04:12.271732 | 2021-09-24T17:13:03 | 2021-09-24T17:13:03 | 406,099,414 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,055 | java | package com.romkudev.api.test;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
@NoArgsConstructor
@Entity
@Data
@Table(name = "items")
public class Item {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "item_id")
private Long itemId;
@Column(name = "item_brand")
private String itemBrand;
@Column(name = "model_no")
private String modelNo;
@Column(name = "item_name")
private String itemName;
@Column(name = "item_color")
private String itemColor;
@Column(name = "release_date")
private String releaseDate;
@Column(name = "sold_out")
private Boolean soldOut;
@Builder
public Item(String itemBrand, String itemName, String itemColor) {
this.itemBrand = itemBrand;
this.itemName = itemName;
this.itemColor = itemColor;
}
@Override
public String toString() {
return String.format("์์ดํ
์คํ : %s, %s, %s ", itemBrand, itemName, itemColor);
}
}
| [
"vo0a195@gmail.com"
] | vo0a195@gmail.com |
86c1192f4febe22ee8592ecc1f1291d51ea3327e | 50763b587be4463b91dd8a7888e6698c6fcac849 | /app/src/main/java/com/ets/gd/NetworkLayer/ResponseDTOs/SyncPostEquipment.java | 3107da7fdcdf21bdcd547fc36d95d52efff86001 | [] | no_license | hassan-akhtar/GD | b0ddc0afaf4437a02d818929093dfe863a83d267 | 743f5d4dc1759d9a001cf48f04386bd14111e98e | refs/heads/master | 2021-01-22T19:25:56.739977 | 2017-08-25T10:30:34 | 2017-08-25T10:30:34 | 85,197,313 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,104 | java | package com.ets.gd.NetworkLayer.ResponseDTOs;
public class SyncPostEquipment {
private int ID;
private String Code;
private String status;
private String Operation;
private String ErrorMessage;
private int ErrorCode;
public int getID() {
return ID;
}
public void setID(int ID) {
this.ID = ID;
}
public String getOperation() {
return Operation;
}
public void setOperation(String operation) {
Operation = operation;
}
public String getErrorMessage() {
return ErrorMessage;
}
public void setErrorMessage(String errorMessage) {
ErrorMessage = errorMessage;
}
public int getErrorCode() {
return ErrorCode;
}
public void setErrorCode(int errorCode) {
ErrorCode = errorCode;
}
public String getCode() {
return Code;
}
public void setCode(String code) {
Code = code;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}
| [
"hakhtar@cinnova.com"
] | hakhtar@cinnova.com |
3ece116a37a396eb8e5a409d4fdae659ea5c1b9b | 484aa8477633739f34dbbcc8e2decf62c88c8175 | /JavaBasic/src/com/syntax/class05/ScannerAndLogical.java | 05a50a90e45d86218924a72a4f5f72ac4c3c11f9 | [] | no_license | samuelwoldegiorgis/Sam-s-Batch6 | d3bfdef6b29086107e9ac5b3c2299479fad6b30e | 37f6079eb7b443b833ea115151a87455e6796fd0 | refs/heads/master | 2021-05-18T22:21:09.342286 | 2020-04-13T23:52:35 | 2020-04-13T23:52:35 | 251,451,863 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 118 | java | package com.syntax.class05;
public class ScannerAndLogical {
public static void main(String[] args) {
//*
}
}
| [
"samgmil19@gmail.com"
] | samgmil19@gmail.com |
4f0234306013563caece989f7a470b2a171c3eef | 210e85f44adc4c12cfe7e506c2e9cbe8e05d27ed | /cloud-consumer-order80/src/main/java/com/springcloud/lb/ILoadBalancer.java | 34a6cd51a84ba12e1e4f39d7fe2f988b5ca327e0 | [] | no_license | xu-hao-tian/springCloud | e11f8ca2b57c3ee6c4e5b92d08ffcadf5190348d | 5f5b295c1ebca35f1fa8a3c7678acdae668adc31 | refs/heads/master | 2023-07-17T13:43:01.374762 | 2021-08-29T09:38:59 | 2021-08-29T09:38:59 | 392,572,992 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 400 | java | package com.springcloud.lb;
import org.springframework.cloud.client.ServiceInstance;
import java.util.List;
/**
* Created with IntelliJ IDEA.
*
* @Author: ่ฎธๆๅคฉ
* @Date: 2021/08/10/11:25
* @Description:
*/
public interface ILoadBalancer {
/**
* ไผ ๅ
ฅๅ
ทไฝๅฎไพ็้ๅ๏ผ่ฟๅ้ไธญ็ๅฎไพ
*/
ServiceInstance instances(List<ServiceInstance> serviceInstance);
}
| [
"ithation@163.com"
] | ithation@163.com |
b1802d35a522ee5dfb461e7c05f098401640a7a4 | 1ff75fd4bbc4aedd4148d3a5ce2839d24c4f7f2e | /app/src/main/java/me/gavin/riverislandapp/categoryFragments/TopsFragment.java | f703075d8ffc1888bc9dffabb3a40a6382aa4c06 | [] | no_license | girvain/RiverIslandApp | 9d61ae94ce65cbdf9a466c7d6845a7ee1555c3f0 | 96794d1d55d6903a8820e976639bc5a2c637748d | refs/heads/master | 2022-12-19T14:00:00.090435 | 2020-09-30T11:11:27 | 2020-09-30T11:11:27 | 296,173,235 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 930 | java | package me.gavin.riverislandapp.categoryFragments;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.navigation.NavDirections;
import androidx.navigation.Navigation;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import me.gavin.riverislandapp.AbstractProductListFragment;
import me.gavin.riverislandapp.ProductFetch;
import me.gavin.riverislandapp.R;
import me.gavin.riverislandapp.model.Product;
public class TopsFragment extends AbstractProductListFragment {
@Override
public List<Product> getProducts() {
return new ProductFetch().fetchAndFilterByCategory("Tops");
}
@Override
public void navigationImp(View v, Product p) {
NavDirections action = TopsFragmentDirections.actionTopsFragmentToSingleProductFragment(p);
Navigation.findNavController(v).navigate(action);
}
} | [
"gavinross88@hotmail.co.uk"
] | gavinross88@hotmail.co.uk |
7694c1dea4b201a9b3ff5a3b31cdd52702853bdf | b6c8328795a028735f98a8c81e3bc95b1caadf4c | /app/src/main/java/com/example/coustombanner/view/CornerImageView.java | e0f8d1309b2b0c5c4c99030b14f41eeee9e26b1f | [] | no_license | CasWen/coustombanner | 1d7221e048a05b983ee331b822e9c089abcb85c0 | dff7b11e179396fbd539b70eab09b9def4872cf3 | refs/heads/master | 2020-07-11T16:52:21.400342 | 2019-08-27T02:10:29 | 2019-08-27T02:10:29 | 204,599,169 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,414 | java | package com.example.coustombanner.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;
import com.example.coustombanner.R;
public class CornerImageView extends View {
/**
* ๆฒกๆๅ่ง
*/
private static final int ALL = 0;
/**
* ๅทฆไธ่งๅ่ง
*/
public static final int TOP_LEFT = 1;
/**
* ๅณไธ่งๅ่ง
*/
public static final int TOP_RIGHT = 2;
/**
* ๅทฆไธ่งๅ่ง
*/
public static final int BOTTOM_LEFT = 3;
/**
* ๅณไธ่งๅ่ง
*/
public static final int BOTTOM_RIGHT = 4;
/**
* ๅชไธชไฝ็ฝฎๅ่ง
*/
private int CCornerWhich;
/**
* ๅ่งๅคงๅฐ
*/
private int CCornerRadius;
/**
* ่ๆฏ
*/
private Bitmap CBackground;
/**
* ๅฎฝ
*/
private int mWidth;
/**
* ้ซ
*/
private int mHeight;
public CornerImageView(Context context) {
this(context,null);
}
public CornerImageView(Context context, AttributeSet attrs) {
this(context, attrs,0);
}
public CornerImageView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context, attrs, defStyleAttr);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// super.onMeasure(widthMeasureSpec, heightMeasureSpec);
mWidth = getMeasureWidth(widthMeasureSpec);
mHeight = getMeasureHeight(heightMeasureSpec);
//่ฎพ็ฝฎๅฎฝ้ซ
setMeasuredDimension(mWidth, mHeight);
}
/**
* ๆต้ๅฎฝๅบฆ
* @param measureSpec Spec
* @return ๅฎฝๅบฆ
*/
private int getMeasureWidth(int measureSpec) {
int measureSize = 0;
int specMode = MeasureSpec.getMode(measureSpec);
int specSize = MeasureSpec.getSize(measureSpec);
if (specMode == MeasureSpec.EXACTLY) {
measureSize = specSize;
} else {
int desireByImg = getPaddingLeft() + getPaddingRight() + CBackground.getWidth();
if (specMode == MeasureSpec.AT_MOST)// wrap_content
{
measureSize = Math.min(desireByImg, specSize);
}
}
return measureSize;
}
/**
* ๆต้้ซๅบฆ
* @param measureSpec spec
* @return ้ซๅบฆ
*/
private int getMeasureHeight(int measureSpec) {
int measureSize = 0;
int specMode = MeasureSpec.getMode(measureSpec);
int specSize = MeasureSpec.getSize(measureSpec);
if (specMode == MeasureSpec.EXACTLY) {
measureSize = specSize;
} else {
int desireByImg = getPaddingTop() + getPaddingBottom() + CBackground.getHeight();
if (specMode == MeasureSpec.AT_MOST)// wrap_content
{
measureSize = Math.min(desireByImg, specSize);
}
}
return measureSize;
}
@Override
protected void onDraw(Canvas canvas) {
//็ปๅพ
canvas.drawBitmap(createBitmapByCorner(CBackground, CCornerWhich, CCornerRadius), 0, 0, null);
super.onDraw(canvas);
}
/**
* ๅๅงๅ
* @param context ไธไธๆ
* @param attrs attrs
* @param defStyle defStyle
*/
private void init(Context context, AttributeSet attrs, int defStyle) {
TypedArray
ta =
context.getTheme().obtainStyledAttributes(attrs, R.styleable.cornerImageView, defStyle, 0);
int n = ta.getIndexCount();
for (int i = 0; i < n; i++) {
int attr = ta.getIndex(i);
if (attr == R.styleable.cornerImageView_CBackground) {
CBackground = BitmapFactory.decodeResource(getResources(), ta.getResourceId(attr, 0));
if (null == CBackground) {
Bitmap bitmap = Bitmap.createBitmap(50, 50,
Bitmap.Config.ARGB_8888);
bitmap.eraseColor(ta.getColor(attr, 0));//ๅกซๅ
้ข่ฒ
// Log.e("CornerView","color="+ta.getColor(attr,0)+" R.color.color1="+getResources().getColor(R.color.colorMain));
CBackground = bitmap;
}
} else if (attr == R.styleable.cornerImageView_CCornerRadius) {
CCornerRadius =
ta.getDimensionPixelSize(attr,
(int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
10f,
getResources().getDisplayMetrics()));
} else if (attr == R.styleable.cornerImageView_CCornerWhich) {
CCornerWhich = ta.getInt(attr, 0);
}
}
ta.recycle();
}
/**
* ๅๅปบๅ่งๅพ
* @param bitmap bitmap
* @param cornerWhich ้ฃไธช่งๅ่ง
* @param radius ๅ่งๅคงๅฐ
* @return ๅ่งๅพ
*/
private Bitmap createBitmapByCorner(Bitmap bitmap, int cornerWhich, int radius) {
/**
* ๅ็ๅพ็ฎๅ๏ผๅณ็จไธคๅพๅ ๅ ไฝฟ็จSRC_OUT็mode
*/
int width = mWidth;
int height = mHeight;
Bitmap target = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(target);
Paint paint = new Paint();
paint.setAntiAlias(true);
if (cornerWhich == ALL) {
Rect rect = new Rect(0, 0, width, height);
canvas.drawRect(rect, paint);
} else if (cornerWhich == TOP_LEFT) {
Rect rect = new Rect(radius, 0, width, height);
canvas.drawRect(rect, paint);
Rect rect2 = new Rect(0, height - radius, width, height);
canvas.drawRect(rect2, paint);
RectF rectF = new RectF(0, 0, 2 * radius, height);
canvas.drawRoundRect(rectF, radius, radius, paint);
} else if (cornerWhich == TOP_RIGHT) {
Rect rect = new Rect(0, 0, width - radius, height);
canvas.drawRect(rect, paint);
Rect rect2 = new Rect(0, radius, width, height);
canvas.drawRect(rect2, paint);
RectF rectF = new RectF(width - 2 * radius, 0, width, height);
canvas.drawRoundRect(rectF, radius, radius, paint);
} else if (cornerWhich == BOTTOM_LEFT) {
Rect rect = new Rect(radius, 0, width, height);
canvas.drawRect(rect, paint);
Rect rect2 = new Rect(0, 0, width , radius);
canvas.drawRect(rect2, paint);
RectF rectF = new RectF(0, 0, 2*radius, height);
canvas.drawRoundRect(rectF, radius, radius, paint);
} else if (cornerWhich == BOTTOM_RIGHT) {
Rect rect = new Rect(0, 0, width, height - radius);
canvas.drawRect(rect, paint);
Rect rect2 = new Rect(0, 0, radius, height);
canvas.drawRect(rect2, paint);
RectF rectF = new RectF(0, height - 2 * radius, width, height);
canvas.drawRoundRect(rectF, radius, radius, paint);
}
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OUT));
// canvas.drawBitmap(bitmap, 0, 0, paint);
// Rect src = new Rect(0, 0, mWidth, mHeight);
// canvas.drawBitmap(bitmap, src, src, paint);
Matrix mMatrix = new Matrix();
mMatrix.postScale(mWidth,mHeight);
canvas.drawBitmap(bitmap,mMatrix,paint);
return target;
}
/**
* ไปฃ็ ่ฎพ็ฝฎ่ๆฏ
* @param color ่ๆฏ้ข่ฒ
*/
public void setCBackground(int color){
Bitmap bitmap = Bitmap.createBitmap(50, 50,
Bitmap.Config.ARGB_8888);
bitmap.eraseColor(color);//ๅกซๅ
้ข่ฒ
CBackground = bitmap;
invalidate();//ๅทๆฐ
}
}
| [
"kevin.zhong@foreo.com"
] | kevin.zhong@foreo.com |
20aefce39560a7fe46a420b8f2f5d6608b0ffc8e | 6cb6e62958de2869ac75d6a94d8648069decb22d | /SunShine/app/src/main/java/org/airpic/clinton/sunshine/MainActivity.java | a24f27a977d11e65fe3323fdbf6131fb1322639e | [] | no_license | inferno1005/Android | b815965ce2e9ed09f26b96393c1a4795d2da958a | b3f95e6dc0abf07396622b22e4abc16e8c897c9c | refs/heads/master | 2021-01-25T03:54:58.691073 | 2014-08-07T22:07:24 | 2014-08-07T22:07:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,282 | java | package org.airpic.clinton.sunshine;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new ForecastFragment())
.commit();
}
}
@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;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"inferno1005@gmail.com"
] | inferno1005@gmail.com |
80a7fb6c0933b75f1eb2924f94ab5be1bf3119c1 | ced962b409105817fad8e5ebf400a763ffdc1e77 | /src/main/java/com/qwazr/cluster/client/ClusterSingleClient.java | eea3563c370cc6f94e6575a2096d1f81d98dd15e | [
"Apache-2.0"
] | permissive | Sebastien-Andrivet/qwazr-cluster | 0472bdf88ea97cae729c41db4e553dc99b3539a6 | 3efcc7965a5a95eb37a30e99faaa50be3afbe394 | refs/heads/master | 2021-01-22T01:18:37.508807 | 2015-04-20T08:32:29 | 2015-04-20T08:32:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,457 | java | /**
* Copyright 2015 OpenSearchServer Inc.
*
* 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.qwazr.cluster.client;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.fluent.Request;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.entity.ContentType;
import com.fasterxml.jackson.core.type.TypeReference;
import com.qwazr.cluster.service.ClusterNodeRegisterJson;
import com.qwazr.cluster.service.ClusterNodeStatusJson;
import com.qwazr.cluster.service.ClusterServiceInterface;
import com.qwazr.cluster.service.ClusterServiceStatusJson;
import com.qwazr.cluster.service.ClusterStatusJson;
import com.qwazr.utils.http.HttpUtils;
import com.qwazr.utils.json.client.JsonClientAbstract;
public class ClusterSingleClient extends JsonClientAbstract implements
ClusterServiceInterface {
public ClusterSingleClient(String url, int msTimeOut)
throws URISyntaxException {
super(url, msTimeOut);
}
@Override
public ClusterStatusJson list() {
try {
URIBuilder uriBuilder = getBaseUrl("/cluster");
Request request = Request.Get(uriBuilder.build());
return execute(request, null, msTimeOut, ClusterStatusJson.class,
200);
} catch (URISyntaxException | IOException e) {
throw new WebApplicationException(e.getMessage(), e,
Status.INTERNAL_SERVER_ERROR);
}
}
public final static TypeReference<Map<String, Set<String>>> MapStringSetStringTypeRef = new TypeReference<Map<String, Set<String>>>() {
};
@Override
public Map<String, Set<String>> getNodes() {
try {
URIBuilder uriBuilder = getBaseUrl("/cluster/nodes");
Request request = Request.Get(uriBuilder.build());
return (Map<String, Set<String>>) execute(request, null, msTimeOut,
MapStringSetStringTypeRef, 200);
} catch (URISyntaxException | IOException e) {
throw new WebApplicationException(e.getMessage(), e,
Status.INTERNAL_SERVER_ERROR);
}
}
@Override
public ClusterNodeStatusJson register(ClusterNodeRegisterJson register) {
try {
URIBuilder uriBuilder = getBaseUrl("/cluster");
Request request = Request.Post(uriBuilder.build());
return execute(request, register, msTimeOut,
ClusterNodeStatusJson.class, 200);
} catch (URISyntaxException | IOException e) {
throw new WebApplicationException(e.getMessage(), e,
Status.INTERNAL_SERVER_ERROR);
}
}
@Override
public Response unregister(String address) {
try {
URIBuilder uriBuilder = getBaseUrl("/cluster");
uriBuilder.setParameter("address", address);
Request request = Request.Delete(uriBuilder.build());
HttpResponse response = execute(request, null, msTimeOut);
HttpUtils.checkStatusCodes(response, 200);
return Response.status(response.getStatusLine().getStatusCode())
.build();
} catch (URISyntaxException | IOException e) {
throw new WebApplicationException(e.getMessage(), e,
Status.INTERNAL_SERVER_ERROR);
}
}
@Override
public Response check(String checkValue) {
return Response.status(Status.NOT_IMPLEMENTED).build();
}
@Override
public ClusterServiceStatusJson getServiceStatus(String service_name) {
try {
URIBuilder uriBuilder = getBaseUrl("/cluster/services/",
service_name);
Request request = Request.Get(uriBuilder.build());
return execute(request, null, msTimeOut,
ClusterServiceStatusJson.class, 200);
} catch (URISyntaxException | IOException e) {
throw new WebApplicationException(e.getMessage(), e,
Status.INTERNAL_SERVER_ERROR);
}
}
public final static TypeReference<List<String>> ListStringTypeRef = new TypeReference<List<String>>() {
};
@Override
public List<String> getActiveNodes(String service_name) {
try {
URIBuilder uriBuilder = getBaseUrl("/cluster/services/",
service_name, "/active");
Request request = Request.Get(uriBuilder.build());
return (List<String>) execute(request, null, msTimeOut,
ListStringTypeRef, 200);
} catch (URISyntaxException | IOException e) {
throw new WebApplicationException(e.getMessage(), e,
Status.INTERNAL_SERVER_ERROR);
}
}
@Override
public String getActiveNodeRandom(String service_name) {
try {
URIBuilder uriBuilder = getBaseUrl("/cluster/services/",
service_name, "/active/random");
Request request = Request.Get(uriBuilder.build());
HttpResponse response = execute(request, null, msTimeOut);
HttpUtils.checkStatusCodes(response, 200);
return IOUtils.toString(HttpUtils.checkIsEntity(response,
ContentType.TEXT_PLAIN).getContent());
} catch (URISyntaxException | IOException e) {
throw new WebApplicationException(e.getMessage(), e,
Status.INTERNAL_SERVER_ERROR);
}
}
}
| [
"ekeller@open-search-server.com"
] | ekeller@open-search-server.com |
59d6c03f8f9005d91491917576372c963fea2268 | cfe0817b8498055dc7b07800195e0fcefdd24e1a | /src/day08_IfStatement/Timer.java | 0256b7224f0be20e2751f1b4f638eb2637e3807f | [] | no_license | faatihyucel/Spring2020B18_Java | f689b2ce7ad360c1f751f266dc9b0286c4450fa7 | d5f7668cf81bbde2047ad7ce63719ffdea6df925 | refs/heads/master | 2022-04-24T01:46:42.378610 | 2020-04-27T15:50:14 | 2020-04-27T15:50:14 | 257,792,116 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,035 | java | package day08_IfStatement;
import java.util.Scanner;
public class Timer {
public static void main(String[] args) throws Exception {
Scanner scan = new Scanner(System.in);
System.out.println("please enter the number of minutes");
int minutes = scan.nextInt();
for (int i = minutes; i > 0; --i) {
if (i < 0)
break;
for (int z = 59; z > 0; --z) {
System.out.println((i - 1) + " minutes and " + z + " seconds left");
Thread.sleep(1000); // the speed in milliseconds
}
}
System.out.println(" \n \t \t********************************************* ");
System.out.println(" \t \t*** *** ");
System.out.println(" \t \t*** Times is Up, Please take your seats! *** ");
System.out.println(" \t \t*** *** ");
System.out.println(" \t \t********************************************* ");
}
} | [
"faatihyucel@gmail.com"
] | faatihyucel@gmail.com |
1cb75c52a42743a133a5993292d0fae2a8480ce8 | 0654c43e9e1d000dd40b203f8745e936c4850d25 | /app/src/main/java/com/android/sampleArch/contract/IIpresenter.java | 62e76db7ab8683820589073897e0f218bcd3648e | [] | no_license | amitkumar0000/android-arch-webservices | 8b694c90e01f34e567068cac04af142a04370d8c | 9a050df7593c96c7f77237dce2101625b3f55eca | refs/heads/master | 2020-03-28T14:12:11.093533 | 2018-09-12T11:16:51 | 2018-09-12T11:16:51 | 148,466,463 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 133 | java | package com.android.sampleArch.contract;
import android.view.View;
public interface IIpresenter {
void getImage(String url);
}
| [
"amit.ap1924@gmail.com"
] | amit.ap1924@gmail.com |
2e78d547e0cd82ac05f4db884eb3fe07889c8ddd | e9a505a52e6b423ecf8427154f4c292ee78974c8 | /src/test/java/apicode/PostRequest.java | 20c8dc4debf5d47a7f67917be1a7f491ea6f8ea7 | [] | no_license | vinjavarapu/RestAssured | b6e4324c9edf6668c5edc6956f867763d31be7fc | 2e8cb5c2929ff6b99c49d502e80dcf7c27895862 | refs/heads/master | 2023-05-13T19:14:58.813718 | 2020-07-25T16:48:44 | 2020-07-25T16:48:44 | 282,484,164 | 0 | 0 | null | 2023-05-09T18:52:09 | 2020-07-25T16:39:13 | HTML | UTF-8 | Java | false | false | 1,197 | java | package apicode;
import org.json.simple.JSONObject;
import org.testng.Assert;
import org.testng.annotations.Test;
import io.restassured.RestAssured;
import io.restassured.http.Method;
import io.restassured.response.Response;
import io.restassured.specification.RequestSpecification;
public class PostRequest {
@SuppressWarnings("unchecked")
@Test
void PostData() {
// RestAssured.baseURI="localhost";
RestAssured.port=9200;
//Request Object
RequestSpecification httpRequest = RestAssured.given();
//Response Object
JSONObject requestparam = new JSONObject();
requestparam.put("name", "John Doe");
httpRequest.header("Content-Type", "application/json");
httpRequest.body(requestparam.toJSONString());
Response response = httpRequest.request(Method.POST,"/customer/_doc/2");
//Print response in console
String responseBody = response.getBody().asString();
System.out.println("The response body is " + responseBody);
int statuscode = response.getStatusCode();
System.out.println("The status code value is " +statuscode);
Assert.assertEquals(statuscode, 201);
String statusLine = response.getStatusLine();
System.out.println("The status Line is " + statusLine);
}
} | [
"vinjavarapu@gmail.com"
] | vinjavarapu@gmail.com |
ee7ff856f837dae58527e8fbfafcb127ac596d7d | a57628360262f535dddca028008ee723ca8ff23d | /.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/bookWEB/org/apache/jsp/check_jsp.java | 17d1eaf0826e65908b5c97a0a4cc9a087acf6650 | [] | no_license | linya1311/BookStore | 31d00ed949d7e9ac601bc723397cffb74d3ccc82 | 0d6602a07e16a08f1ecaad1879018e1969adbc7d | refs/heads/master | 2020-06-09T23:58:07.798317 | 2019-06-24T15:46:20 | 2019-06-24T15:46:20 | 193,530,376 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,601 | java | /*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/8.5.34
* Generated at: 2019-05-29 19:31:26 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;
public final class check_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent,
org.apache.jasper.runtime.JspSourceImports {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
private static final java.util.Set<java.lang.String> _jspx_imports_packages;
private static final java.util.Set<java.lang.String> _jspx_imports_classes;
static {
_jspx_imports_packages = new java.util.HashSet<>();
_jspx_imports_packages.add("java.sql");
_jspx_imports_packages.add("javax.servlet");
_jspx_imports_packages.add("javax.servlet.http");
_jspx_imports_packages.add("javax.servlet.jsp");
_jspx_imports_classes = null;
}
private volatile javax.el.ExpressionFactory _el_expressionfactory;
private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public java.util.Set<java.lang.String> getPackageImports() {
return _jspx_imports_packages;
}
public java.util.Set<java.lang.String> getClassImports() {
return _jspx_imports_classes;
}
public javax.el.ExpressionFactory _jsp_getExpressionFactory() {
if (_el_expressionfactory == null) {
synchronized (this) {
if (_el_expressionfactory == null) {
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
}
}
}
return _el_expressionfactory;
}
public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() {
if (_jsp_instancemanager == null) {
synchronized (this) {
if (_jsp_instancemanager == null) {
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
}
}
return _jsp_instancemanager;
}
public void _jspInit() {
}
public void _jspDestroy() {
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
final java.lang.String _jspx_method = request.getMethod();
if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method) && !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) {
response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSPs only permit GET POST or HEAD");
return;
}
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html; charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("<!DOCTYPE html>\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<meta charset=\"UTF-8\">\r\n");
out.write("<title>้ฉ่ญ้ ้ข</title>\r\n");
out.write("</head>\r\n");
out.write("<body>\r\n");
out.write("\r\n");
String rand = (String)session.getAttribute("rand");
String input = request.getParameter("rand");
out.write("\r\n");
out.write("็ณป็ตฑ็ข็็่ช่ญ็ขผ็บ๏ผ ");
out.print( rand );
out.write("<br>\r\n");
out.write("ๆจ่ผธๅ
ฅ็่ช่ญ็ขผ็บ๏ผ ");
out.print( input );
out.write("<br>\r\n");
out.write("<br>\r\n");
if (rand.equals(input)) {
out.write("\r\n");
out.write("<font color=green>่ผธๅ
ฅ็ธๅ๏ผ่ช่ญๆๅ๏ผ</font>\r\n");
} else {
out.write("\r\n");
out.write("<font color=red>่ผธๅ
ฅไธๅ๏ผ่ช่ญๅคฑๆ๏ผ</font>\r\n");
}
out.write("\r\n");
out.write("\r\n");
out.write("</body>\r\n");
out.write("</html>");
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try {
if (response.isCommitted()) {
out.flush();
} else {
out.clearBuffer();
}
} catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
| [
"linya1311@gmail.com"
] | linya1311@gmail.com |
8a588f78508937d8b145d8f359a97ba28d90d7c5 | bd2a2fe9337a3c49045698707699acedf9b548a0 | /CS480_GRP/src/map/EMAMapper.java | 25b876dc6193c9675448300a0129a21b1cfbef5a | [] | no_license | sparkison/cs480gp | f4fb0892573c2fbe24561608930f2dde05100955 | 6dfc147a99350dcaf9272524ffc59fd458e6771d | refs/heads/master | 2021-01-01T16:40:11.941660 | 2015-05-08T01:44:41 | 2015-05-08T01:44:41 | 34,696,877 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,295 | java | package map;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.StringReader;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import writable.CompositeKey;
import writable.DayStatsWritable;
public class EMAMapper extends Mapper<Object, Text, CompositeKey, DayStatsWritable>{
private static CompositeKey tickerDate = new CompositeKey();
public void map(Object key, Text value, Context context) throws IOException, InterruptedException {
DayStatsWritable dayStat;
// DayStatsWritable valout = new DayStatsWritable(value);
// mapkey.set(valout.getTicker());
// context.write(mapkey, valout);
BufferedReader bufReader = new BufferedReader(new StringReader(value.toString()));
String line = null;
Text ticker = new Text();
Text date = new Text();
while( (line = bufReader.readLine()) != null ) {
try{
dayStat = new DayStatsWritable(new Text(line));
ticker.set(dayStat.getTicker());
date.set(dayStat.getDate());
if (!(ticker == null || date == null)){
tickerDate.setTicker(ticker);
tickerDate.setDate(date);
context.write(tickerDate, dayStat);
}
}catch(Exception e){
System.out.println("\n\n" + line + "\n\n");
e.printStackTrace();
System.exit(0);
}
}
}
} | [
"shacklefurd@gmail.com"
] | shacklefurd@gmail.com |
b047947d7421dae80910aebe4199f9e208526e97 | a5d618e6c13ee82f115e1a0a48baf97ceb5bbaa4 | /web/resource-server-1/src/main/java/com/sp/sec/web/config/SecurityConfig.java | cf2ca452cdf6f0c2a2ab05c38be3f11a33967ddf | [] | no_license | coolwis/spring-security-junit5-test | 3e390ab8baa9cec111d6a1177883a373c39941d4 | 8398bcfcc938cf1709496b099cd8e50270ec3dcf | refs/heads/main | 2023-07-14T14:34:44.977032 | 2020-11-20T14:19:36 | 2020-11-20T14:19:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,230 | java | package com.sp.sec.web.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.sp.sec.user.service.UserService;
import org.springframework.context.annotation.Bean;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SecurityConfig extends WebSecurityConfigurerAdapter {
private final UserService userService;
private final ObjectMapper objectMapper;
private final JWTUtil jwtUtil;
public SecurityConfig(UserService userService, ObjectMapper objectMapper, JWTUtil jwtUtil) {
this.userService = userService;
this.objectMapper = objectMapper;
this.jwtUtil = jwtUtil;
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userService)
.passwordEncoder(passwordEncoder());
}
@Bean
BCryptPasswordEncoder passwordEncoder(){
return new BCryptPasswordEncoder();
}
@Override
protected AuthenticationManager authenticationManager() throws Exception {
return super.authenticationManager();
}
@Override
protected void configure(HttpSecurity http) throws Exception {
final JWTCheckFilter checkFilter = new JWTCheckFilter(authenticationManager(), userService, jwtUtil);
http
.csrf().disable()
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.addFilter(checkFilter)
;
}
}
| [
"jongwons.choi@gmail.com"
] | jongwons.choi@gmail.com |
be08c4b5fbc53c1009bcb8197bf00f8d8794f403 | 649980384dfade1ccd4ff788b82f58e7081fef44 | /cs142GivenCode/SnowmanII.java | 6fcd32f413542b0133648ef9b77f563955a85976 | [] | no_license | zenwattage/jav142 | 3d6e4290f40bffb140b626cddba22395817a6213 | 5e9e96e68d80785b65f19ca7fe00b9260d2e079c | refs/heads/master | 2022-11-07T19:10:34.676840 | 2020-06-20T19:15:57 | 2020-06-20T19:15:57 | 267,398,199 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,187 | java | /**
* This is a sample class showing how to use the Nsc graphics components.
*
* @author Dan Jinguji
* @version 1.0
*/
public class SnowmanII {
/*
* Here are some member variables. They are shared by all of the
* members of this class. They are called "fields" by the documentation.
*/
// The window to display the snowman
private NscWindow win;
// The parts of the snowman
private NscEllipse head;
private NscEllipse body;
/**
* This creates the window and places the snowman within it.
*/
public void SnowmanII() {
// create the window
win = new NscWindow(50, 50, 160, 250);
win.setTitle("My Snowman");
// create and place the head
head = new NscEllipse();
head.setLocation(50, 40);
head.setSize(50, 50);
win.add(head);
// create and place the body
body = new NscEllipse();
body.setLocation(25, 90);
body.setSize(100, 100);
win.add(body);
// request a repaint of the window
win.repaint();
}
/**
* This method colors the head and body of the snowman.
*/
public void colorSnowman() {
// make them "filled" shapes
head.setFilled(true);
body.setFilled(true);
// change the background (fill) colors
head.setBackground(java.awt.Color.white);
body.setBackground(java.awt.Color.white);
// request a repaint of the components
head.repaint();
body.repaint();
}
/**
* This method adds some buttons to the snowman.
*/
public void addButtons() {
// declare the buttons
NscDiamond button1, button2, button3;
// create the buttons
button1 = new NscDiamond();
button1.setLocation(70, 105);
button1.setSize(10, 14);
button1.setForeground(java.awt.Color.red);
win.add(button1);
button2 = new NscDiamond();
button2.setLocation(70, 125);
button2.setSize(10, 14);
button2.setFilled(true);
button2.setBackground(java.awt.Color.green);
win.add(button2);
button3 = new NscDiamond();
button3.setLocation(70, 145);
button3.setSize(10, 14);
button3.setFilled(true);
java.awt.Color navy = new java.awt.Color(0, 0, 128);
button3.setForeground(navy);
button3.setBackground(new java.awt.Color(255, 255, 255));
win.add(button3);
// request a repaint of the window
win.repaint();
}
/**
* This method adds the face to the snowman.
*/
public void addFace() {
// declare the eyes
NscUpTriangle eye1, eye2;
// create the eyes and add them
eye1 = new NscUpTriangle(16, 19, 6, 6);
eye1.setFilled(true);
eye1.setBackground(java.awt.Color.black);
head.add(eye1);
eye2 = new NscUpTriangle(28, 19, 6, 6);
eye2.setFilled(true);
eye2.setBackground(java.awt.Color.black);
head.add(eye2);
// declare the mouth
NscRectangle smile;
// create the mouth and add it
smile = new NscRectangle(13, 31, 4, 4);
smile.setFilled(true);
smile.setBackground(java.awt.Color.black);
head.add(smile);
smile = new NscRectangle(18, 33, 4, 4);
smile.setFilled(true);
smile.setBackground(java.awt.Color.black);
head.add(smile);
smile = new NscRectangle(23, 34, 4, 4);
smile.setFilled(true);
smile.setBackground(java.awt.Color.black);
head.add(smile);
smile = new NscRectangle(28, 33, 4, 4);
smile.setFilled(true);
smile.setBackground(java.awt.Color.black);
head.add(smile);
smile = new NscRectangle(33, 31, 4, 4);
smile.setFilled(true);
smile.setBackground(java.awt.Color.black);
head.add(smile);
// request a repaint of the window
win.repaint();
}
}
| [
"zenwattage@gmail.com"
] | zenwattage@gmail.com |
8edbfd29d1c1ee460259de0853c7637d27b6ce28 | cb042f14f60a89a8b03fc61be20164163bd22d97 | /src/hue/edu/xiong/lc0700/lc0700/Main0729.java | e6e102d9bad955ebdc2460e8bb00f4fc47259862 | [] | no_license | XiongYuSong/LeetCode | e9af35142d016ffc956654aa40967c7abb41e819 | c5b4d71a5e731b22ce5c75be594c0a996623db35 | refs/heads/master | 2023-04-12T22:11:59.494683 | 2023-04-10T06:08:21 | 2023-04-10T06:08:21 | 178,651,747 | 1 | 2 | null | 2021-02-05T07:41:10 | 2019-03-31T06:34:43 | Java | UTF-8 | Java | false | false | 2,595 | java | package hue.edu.xiong.lc0700.lc0700;
import java.util.*;
/**
* @author Xiong YuSong
* @date 2020/12/11
*/
public class Main0729 {
public static void main(String[] args) {
MyCalendar obj = new MyCalendar();
boolean param_1 = obj.book(20, 29);
param_1 = obj.book(13, 22);
param_1 = obj.book(44, 50);
param_1 = obj.book(1, 7);
param_1 = obj.book(2, 10);
param_1 = obj.book(14, 20);
param_1 = obj.book(19, 25);
param_1 = obj.book(19, 25);
}
}
class MyCalendar {
HashMap<Integer, Integer> map;
ArrayList<Integer> list;
public MyCalendar() {
map = new HashMap<>();
list = new ArrayList<>();
}
public boolean book(int start, int end) {
if (list.size() == 0) {
list.add(start);
map.put(start, end);
return true;
}
// ่ทๅๅฐไบๅฝๅ็ปๆๆถ้ด็็ฌฌไธไธชๆถ้ด็นstart0๏ผend0
int index0 = fun2(list, end, 0, list.size() - 1);
int start0 = list.get(index0);
int end0 = map.get(start0);
if (end >= start0) {
if (end == start0 && index0 != 0) {
index0--;
start0 = list.get(index0);
end0 = map.get(start0);
}
if (end == start0) {
if (index0 == 0) {
fun1(list, start);
map.put(start, end);
return true;
} else {
}
}
// ็ฐๅจ end ่ฏๅฎๅคงไบ start0 ๏ผ่ฟไธชๆถๅend0 <= start
if (end > start0) {
if (start >= end0) {
fun1(list, start);
map.put(start, end);
return true;
} else {
return false;
}
}
}
fun1(list, start);
map.put(start, end);
return true;
}
private void fun1(ArrayList<Integer> list, int start) {
int index0 = fun2(list, start, 0, list.size() - 1);
if (index0 == 0 && list.get(index0) > start) {
list.add(index0, start);
} else {
list.add(index0 + 1, start);
}
}
//ไบๅๆฅๆพๆณๆจกๆฟไธ:ๆฅๆพ็ญไบๆ่
ๅฐไบtarget็ๆๅไธไธชๅผ
private int fun2(ArrayList<Integer> arr, int target, int l, int r) {
while (l < r) {
int mid = (l + r + 1) >> 1;
if (target < arr.get(mid)) r = mid - 1;
else l = mid;
}
return l;
}
} | [
"โxiongys@feifanuniv.comโ"
] | โxiongys@feifanuniv.comโ |
160125297dd43347f78cb5afce7a8843c7911be5 | af58debce137ae704eb573c2671b89d6aa44f3f9 | /src/main/java/com/waterelephant/dto/BaiduSuccess.java | 9a1ba514138ea1944259d85cf4d491e82b7f27f0 | [] | no_license | String-name-ren/cms | fa547201c00b11f1cd0c77cc3e230645d19e031d | 31a2d7377a72a62a2cfa26c8d3f90351731b4fb9 | refs/heads/master | 2020-05-16T02:56:32.045605 | 2019-04-22T07:41:47 | 2019-04-22T07:41:47 | 182,642,853 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 315 | java | package com.waterelephant.dto;
import lombok.Data;
import java.util.List;
/**
* ๆ่ฟฐ
*
* @author: renpenghui
* @date: 2019-03-28 11:26
**/
@Data
public class BaiduSuccess {
private int success;
private int remain;
private List<String> not_same_site;
private List<String> not_valid;
}
| [
"renpenghui@beadwallet.com"
] | renpenghui@beadwallet.com |
3364e40eea82efe9c3705f55f96cf0d4364e2c09 | 7fbc568f5f502eb0ae405022f7f34c79e0c49234 | /baifei-boot-base-common/src/main/java/org/baifei/common/system/util/JwtUtil.java | 05524270c748526977aeebc56957d7ff7ab046fc | [
"MIT"
] | permissive | yourant/logistics | c6271bae3e2d6add20df0ee7c815652f423e50de | 3989d2f7b3213c6973bc76e7031248b8643ab5b1 | refs/heads/master | 2023-03-23T16:44:34.938698 | 2020-07-03T04:42:31 | 2020-07-03T04:42:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,235 | java | package org.baifei.common.system.util;
import com.auth0.jwt.JWT;
import com.auth0.jwt.JWTVerifier;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.exceptions.JWTDecodeException;
import com.auth0.jwt.interfaces.DecodedJWT;
import com.google.common.base.Joiner;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.shiro.SecurityUtils;
import org.baifei.common.constant.DataBaseConstant;
import org.baifei.common.exception.JeecgBootException;
import org.baifei.common.system.vo.LoginUser;
import org.baifei.common.system.vo.SysUserCacheInfo;
import org.baifei.common.util.SpringContextUtils;
import org.baifei.common.util.oConvertUtils;
/**
* @Author Scott
* @Date 2018-07-12 14:23
* @Desc JWTๅทฅๅ
ท็ฑป
**/
public class JwtUtil {
// Token่ฟๆๆถ้ด30ๅ้๏ผ็จๆท็ปๅฝ่ฟๆๆถ้ดๆฏๆญคๆถ้ด็ไธคๅ๏ผไปฅtokenๅจreids็ผๅญๆถ้ดไธบๅ๏ผ
public static final long EXPIRE_TIME = 30 * 60 * 1000;
/**
* ๆ ก้ชtokenๆฏๅฆๆญฃ็กฎ
*
* @param token ๅฏ้ฅ
* @param secret ็จๆท็ๅฏ็
* @return ๆฏๅฆๆญฃ็กฎ
*/
public static boolean verify(String token, String username, String secret) {
try {
// ๆ นๆฎๅฏ็ ็ๆJWTๆ้ชๅจ
Algorithm algorithm = Algorithm.HMAC256(secret);
JWTVerifier verifier = JWT.require(algorithm).withClaim("username", username).build();
// ๆ้ชTOKEN
DecodedJWT jwt = verifier.verify(token);
return true;
} catch (Exception exception) {
return false;
}
}
/**
* ่ทๅพtokenไธญ็ไฟกๆฏๆ ้secret่งฃๅฏไน่ฝ่ทๅพ
*
* @return tokenไธญๅ
ๅซ็็จๆทๅ
*/
public static String getUsername(String token) {
try {
DecodedJWT jwt = JWT.decode(token);
return jwt.getClaim("username").asString();
} catch (JWTDecodeException e) {
return null;
}
}
/**
* ็ๆ็ญพๅ,5minๅ่ฟๆ
*
* @param username ็จๆทๅ
* @param secret ็จๆท็ๅฏ็
* @return ๅ ๅฏ็token
*/
public static String sign(String username, String secret) {
Date date = new Date(System.currentTimeMillis() + EXPIRE_TIME);
Algorithm algorithm = Algorithm.HMAC256(secret);
// ้ๅธฆusernameไฟกๆฏ
return JWT.create().withClaim("username", username).withExpiresAt(date).sign(algorithm);
}
/**
* ๆ นๆฎrequestไธญ็token่ทๅ็จๆท่ดฆๅท
*
* @param request
* @return
* @throws JeecgBootException
*/
public static String getUserNameByToken(HttpServletRequest request) throws JeecgBootException {
String accessToken = request.getHeader("X-Access-Token");
String username = getUsername(accessToken);
if (oConvertUtils.isEmpty(username)) {
throw new JeecgBootException("ๆช่ทๅๅฐ็จๆท");
}
return username;
}
/**
* ไปsessionไธญ่ทๅๅ้
* @param key
* @return
*/
public static String getSessionData(String key) {
//${myVar}%
//ๅพๅฐ${} ๅ้ข็ๅผ
String moshi = "";
if(key.indexOf("}")!=-1){
moshi = key.substring(key.indexOf("}")+1);
}
String returnValue = null;
if (key.contains("#{")) {
key = key.substring(2,key.indexOf("}"));
}
if (oConvertUtils.isNotEmpty(key)) {
HttpSession session = SpringContextUtils.getHttpServletRequest().getSession();
returnValue = (String) session.getAttribute(key);
}
//็ปๆๅ ไธ${} ๅ้ข็ๅผ
if(returnValue!=null){returnValue = returnValue + moshi;}
return returnValue;
}
/**
* ไปๅฝๅ็จๆทไธญ่ทๅๅ้
* @param key
* @param user
* @return
*/
//TODO ๆฅๅพ
ๆน้ sckjkdsjsfjdk
public static String getUserSystemData(String key,SysUserCacheInfo user) {
if(user==null) {
user = JeecgDataAutorUtils.loadUserInfo();
}
//#{sys_user_code}%
// ่ทๅ็ปๅฝ็จๆทไฟกๆฏ
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String moshi = "";
if(key.indexOf("}")!=-1){
moshi = key.substring(key.indexOf("}")+1);
}
String returnValue = null;
//้ๅฏน็นๆฎๆ ็คบๅค็#{sysOrgCode}๏ผๅคๆญๆฟๆข
if (key.contains("#{")) {
key = key.substring(2,key.indexOf("}"));
} else {
key = key;
}
//ๆฟๆขไธบ็ณป็ป็ปๅฝ็จๆทๅธๅท
if (key.equals(DataBaseConstant.SYS_USER_CODE)|| key.toLowerCase().equals(DataBaseConstant.SYS_USER_CODE_TABLE)) {
if(user==null) {
returnValue = sysUser.getUsername();
}else {
returnValue = user.getSysUserCode();
}
}
//ๆฟๆขไธบ็ณป็ป็ปๅฝ็จๆท็ๅฎๅๅญ
else if (key.equals(DataBaseConstant.SYS_USER_NAME)|| key.toLowerCase().equals(DataBaseConstant.SYS_USER_NAME_TABLE)) {
if(user==null) {
returnValue = sysUser.getRealname();
}else {
returnValue = user.getSysUserName();
}
}
//ๆฟๆขไธบ็ณป็ป็จๆท็ปๅฝๆไฝฟ็จ็ๆบๆ็ผ็
else if (key.equals(DataBaseConstant.SYS_ORG_CODE)|| key.toLowerCase().equals(DataBaseConstant.SYS_ORG_CODE_TABLE)) {
if(user==null) {
returnValue = sysUser.getOrgCode();
}else {
returnValue = user.getSysOrgCode();
}
}
//ๆฟๆขไธบ็ณป็ป็จๆทๆๆฅๆ็ๆๆๆบๆ็ผ็
else if (key.equals(DataBaseConstant.SYS_MULTI_ORG_CODE)|| key.toLowerCase().equals(DataBaseConstant.SYS_MULTI_ORG_CODE_TABLE)) {
if(user.isOneDepart()) {
returnValue = user.getSysMultiOrgCode().get(0);
}else {
returnValue = Joiner.on(",").join(user.getSysMultiOrgCode());
}
}
//ๆฟๆขไธบๅฝๅ็ณป็ปๆถ้ด(ๅนดๆๆฅ)
else if (key.equals(DataBaseConstant.SYS_DATE)|| key.toLowerCase().equals(DataBaseConstant.SYS_DATE_TABLE)) {
returnValue = user.getSysDate();
}
//ๆฟๆขไธบๅฝๅ็ณป็ปๆถ้ด๏ผๅนดๆๆฅๆถๅ็ง๏ผ
else if (key.equals(DataBaseConstant.SYS_TIME)|| key.toLowerCase().equals(DataBaseConstant.SYS_TIME_TABLE)) {
returnValue = user.getSysTime();
}
//ๆต็จ็ถๆ้ป่ฎคๅผ๏ผ้ป่ฎคๆชๅ่ตท๏ผ
else if (key.equals(DataBaseConstant.BPM_STATUS)|| key.toLowerCase().equals(DataBaseConstant.BPM_STATUS_TABLE)) {
returnValue = "1";
}
if(returnValue!=null){returnValue = returnValue + moshi;}
return returnValue;
}
public static void main(String[] args) {
String token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NjUzMzY1MTMsInVzZXJuYW1lIjoiYWRtaW4ifQ.xjhud_tWCNYBOg_aRlMgOdlZoWFFKB_givNElHNw3X0";
System.out.println(JwtUtil.getUsername(token));
}
}
| [
"56526925@qq.com"
] | 56526925@qq.com |
cd6b3d30835501ce799a09b032d884429b68bb9b | 6ad4113f016bb17c7bba27db0026cd2c7140c53b | /src/test/java/org/googlesearch/utils/SearchGoogle.java | 18af01d8e91c91791cb5c20e1949d291ca3d57c1 | [] | no_license | vaskocuturilo/GoogleSearch-Selenium | 75dce068d80009bc845fdd4f4881b94121efc8e2 | ddabf081a7e3cb4b94ccb2ca13e268828c93dc69 | refs/heads/master | 2023-04-17T20:01:50.429163 | 2021-04-27T15:21:15 | 2021-04-27T15:21:15 | 83,881,014 | 0 | 0 | null | 2021-04-27T15:21:16 | 2017-03-04T09:04:57 | Java | UTF-8 | Java | false | false | 818 | java | package org.googlesearch.utils;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import static org.googlesearch.utils.DriverMaster.*;
public class SearchGoogle {
private final WebDriver driver;
public SearchGoogle(WebDriver driver) {
this.driver = driver;
}
public ResultSearch doSearch(String text) {
driver.findElement(By.id(MainField)).sendKeys(text + "\n");
return new ResultSearch(driver);
}
public ResultSearch doSearchImage() {
driver.findElement(By.linkText(LinkImages)).click();
driver.findElement(By.id(MainField)).click();
return new ResultSearch(driver);
}
public ResultSearch doSearch() {
driver.findElement(By.linkText(LinkAll)).click();
return new ResultSearch(driver);
}
}
| [
"vaskocuturilo@rambler.ru"
] | vaskocuturilo@rambler.ru |
aa2bc4ed6a19f4566d9bfc95d3dc13f1e6f6e40c | 141efae2dec343c0ae75147b5da11ea65ffd7e76 | /src/test/java/com/forum/dao/ForumMapperTest.java | 0e0e543aadfba56603dab7d8b008bf1b07391751 | [] | no_license | yanhanwen/cusb-forum | e3017f10d3128dc5ee3745d8e5e1f5b573c48581 | 518189831402d297080ef8da3fd95b551c0307b8 | refs/heads/master | 2020-03-27T15:26:47.180449 | 2018-09-19T07:26:26 | 2018-09-19T07:26:26 | 146,718,457 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 978 | java | package com.forum.dao;
import com.forum.ForumApplication;
import com.forum.entity.Forum;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.Commit;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;
import static org.junit.Assert.*;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = ForumApplication.class)
@Transactional
public class ForumMapperTest {
@Autowired
ForumMapper forumDao;
@Test
@Rollback
public void insert() {
Forum record = new Forum();
record.setFid("14");
record.setForumId("125");
record.setForumName("ๆต่ฏ่ฎบๅ3");
record.setForumText("ๅๅฆ");
forumDao.insert(record);
}
} | [
"913352504@qq.com"
] | 913352504@qq.com |
7d9ae4fd2e6e2875e81521e68a794965e322d728 | 94cf7ad61511961c94ea8ea90ba0a69417c1070f | /nozama/src/main/java/com/nozama/nozama/controller/PictureController.java | be28093abbbea9a4a103e5ce11a25b45bdca1551 | [] | no_license | kjf1245/my-jenkins-app | f94c9d33949b2a8d68c3aff5f77521d43613729f | fb202c832a4423605756f64b58cf36fd47ea17a8 | refs/heads/master | 2021-08-22T11:12:11.293334 | 2017-11-28T20:33:51 | 2017-11-28T20:33:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 74 | java | package com.nozama.nozama.controller;
public class PictureController {
}
| [
"jeffreywu0216@gmail.com"
] | jeffreywu0216@gmail.com |
94e68fbf506ec8a0fb95ebf6bd8d696f84926227 | 40adc51b981134e70a75e5541e1951ca8ef5a32a | /src/main/java/com/zlj/oss/controller/OssDemoController.java | a0f7b73df570b76b6e3d8cf4c3004814e67e9035 | [] | no_license | jiangge0720/oss-demo | 6eb134865f40ce0b0357cde7d031fc2d13daa54d | 06b5a3dd48a5cd9d17de4b36f2177c192d70e4c3 | refs/heads/master | 2022-05-03T09:21:40.427215 | 2020-11-30T08:16:03 | 2020-11-30T08:16:03 | 228,630,323 | 0 | 0 | null | 2022-03-31T18:59:22 | 2019-12-17T14:08:37 | Java | UTF-8 | Java | false | false | 725 | java | package com.zlj.oss.controller;
import com.zlj.oss.sevice.OssDemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
/**
* @author Jiang-gege
* 2019/12/1517:43
*/
@RestController
public class OssDemoController {
@Autowired
private OssDemoService service;
//@RequestParam("file")MultipartFile file
@GetMapping("upload")
public void uploadImage(){
service.uploadImage();
}
} | [
"486875780@qq.com"
] | 486875780@qq.com |
0d32eef4ad40c62633b4a079097e7fbba748ae22 | 880ab2c8160b5aa2469d094c8f319e37937eec8e | /src/test/java/shop/data/DataTest.java | bdff21ed2ce4eb66ee6d0613cac8b0a41e1eb22f | [] | no_license | Jonathan-Martyka/SE333-project-rental-revamp | 8119fed9c3a7b1338d8d5f6a864dfc9df5ef1c8e | 3ed2caaa9548e864469dc8eacbb0e9b47a529dc9 | refs/heads/master | 2022-11-27T18:57:58.186480 | 2020-07-31T20:41:52 | 2020-07-31T20:41:52 | 259,667,534 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,566 | java | package shop.data;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.junit.jupiter.params.provider.Arguments;
import java.util.stream.Stream;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
// TODO: complete the tests
public class DataTest {
@Test
@DisplayName("Test attributes created with correct values")
public void testConstructorAndAttributes() {
String title1 = "XX";
String director1 = "XY";
String title2 = " XX ";
String director2 = " XY ";
int year = 2002;
Video v1 = Data.newVideo(title1, year, director1); //video title, year, director
assertSame(title1, v1.title());
assertEquals(year, v1.year());
assertSame(director1, v1.director());
Video v2 = Data.newVideo(title2, year, director2);
assertEquals(title1, v2.title());
assertEquals(director1, v2.director());
}
@ParameterizedTest
@DisplayName("Strong normal testing of video creation")
@MethodSource("StrongNormalInput")
void testVideoStrongNormal(String title, int year, String director) {
Video v = Data.newVideo(title, year, director);
assertEquals(title, v.title());
assertEquals(year, v.year());
assertEquals(director, v.director());
}
private static Stream<Arguments> StrongNormalInput() {
return Stream.of(
Arguments.of("Inception 5", 3012, "Christopher Nolan Jr."),
Arguments.of("Inception 5", 1801, "Christopher Nolan Jr."),
Arguments.of("Inception 5", 4999, "Christopher Nolan Jr.")
);
}
@ParameterizedTest
@DisplayName("Strong robust testing additions of video creation")
@MethodSource("StrongRobustInput")
void testVideoStrongRobust(String title, int year, String director) {
assertThrows(IllegalArgumentException.class, () -> Data.newVideo(title, year, director));
}
private static Stream<Arguments> StrongRobustInput() {
return Stream.of(
Arguments.of(" ", 3012, "Christopher Nolan Jr."),
Arguments.of(null, 3012, "Christopher Nolan Jr."),
Arguments.of("Inception 5", 100, "Christopher Nolan Jr."),
Arguments.of("Inception 5", 15000, "Christopher Nolan Jr."),
Arguments.of("Inception 5", 3012, " "),
Arguments.of("Inception 5", 3012, null),
Arguments.of("Inception 5", 1800, "Christopher Nolan Jr."),
Arguments.of("Inception 5", 5000, "Christopher Nolan Jr.")
);
}
}
| [
"jonathanmartyka@gmail.com"
] | jonathanmartyka@gmail.com |
6fae5b3ec0cf874cdfb0b37e7e16897bc1db25e5 | 04946e092f75af3040106fa53d82d6510c3709c3 | /src/com/nath/dao/IUserDao.java | 49b50a45f0a4dc195f68f1f52747f71b8de611b9 | [] | no_license | terracottainnovation/Portal | 3554afee9ec4e26ccd4de6fcbae61f3579de2511 | 923fa549c652c3f01e2b2b93ec86b2e37d80bced | refs/heads/master | 2021-01-01T16:13:53.005330 | 2015-08-24T18:17:57 | 2015-08-24T18:17:57 | 32,214,129 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 152 | java | package com.nath.dao;
import com.nath.model.User;
public interface IUserDao /*extends AbstractDAO*/{
public User getUserByName(String userName) ;
}
| [
"tejas5mahajan@terracottainnovation.com"
] | tejas5mahajan@terracottainnovation.com |
2bf6dfe4b7116b6e7f1016811e44ab515498ae0b | 323d2b1cd2aaf4b74ac751852814ec3b08f3e7ea | /app/src/main/java/com/example/pc_0775/naugthyvideo/ui/ActivityLogin.java | b9a559bfbc5ae1fb77c7ceb0711db64f428cc4ed | [] | no_license | GtLeaf/NaugthyVideo | 3a070838a09ef027abc14d277735ba97379dff21 | 62358a9e62306824d2b291f9c0b26674abc036d8 | refs/heads/master | 2020-03-29T22:30:29.918764 | 2019-04-19T03:17:40 | 2019-04-19T03:17:40 | 150,419,559 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,382 | java | package com.example.pc_0775.naugthyvideo.ui;
import android.annotation.SuppressLint;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.TextView;
import com.example.pc_0775.naugthyvideo.Anno.ViewInject;
import com.example.pc_0775.naugthyvideo.R;
import com.example.pc_0775.naugthyvideo.ui.base.BaseActivity;
import com.example.pc_0775.naugthyvideo.ui.fragment.FragmentLogin;
import com.example.pc_0775.naugthyvideo.ui.fragment.FragmentRegister;
public class ActivityLogin extends BaseActivity implements FragmentLogin.OnFragmentInteractionListener{
//view
@ViewInject(R.id.fl_login_register)
private FrameLayout fl_loginRegister;
@ViewInject(R.id.tv_login)
private TextView tv_login;
@ViewInject(R.id.tv_register)
private TextView tv_register;
@ViewInject(R.id.btn_register_get_identifying_code)
private Button btn_registergetidentifyingCode;
//fragment
private FragmentManager fragmentManager;
private FragmentLogin fragmentLogin;
private FragmentRegister fragmentRegister;
@Override
public void initParams(Bundle params) {
}
@Override
public int bindLayout() {
return R.layout.activity_login;
}
@Override
public View bindView() {
return null;
}
@Override
public void initView(View view) {
fragmentManager = getFragmentManager();
fragmentLogin = new FragmentLogin();
fragmentManager.beginTransaction().add(R.id.fl_login_register, fragmentLogin).commit();
tv_login.setTextColor(getResources().getColor(R.color.black));
}
@Override
public void setListener() {
tv_login.setOnClickListener(this);
tv_register.setOnClickListener(this);
/*btn_registergetidentifyingCode.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});*/
}
@Override
public void widgetClick(View v) throws Exception {
reset();
switch (v.getId()){
case R.id.tv_login:
((TextView)v).setTextColor(getResources().getColor(R.color.black));
if (null == fragmentLogin) {
fragmentLogin = new FragmentLogin();
fragmentManager.beginTransaction().add(R.id.fl_login_register, fragmentLogin).commit();
}else {
fragmentManager.beginTransaction().show(fragmentLogin).commit();
}
break;
case R.id.tv_register:
((TextView)v).setTextColor(getResources().getColor(R.color.black));
if (null == fragmentRegister){
fragmentRegister = new FragmentRegister();
fragmentManager.beginTransaction().add(R.id.fl_login_register, fragmentRegister).commit();
}else {
fragmentManager.beginTransaction().show(fragmentRegister).commit();
}
break;
default:
break;
}
}
@Override
public void doBusiness(Context mContext) {
}
@SuppressLint("MissingSuperCall")
@Override
public void onSaveInstanceState(Bundle outState) {
// super.onSaveInstanceState(outState, outPersistentState);
}
@Override
protected void onDestroy() {
super.onDestroy();
}
/**
* ้็ฝฎFragmentๅTextView็็ถๆ
*/
public void reset(){
//้็ฝฎtextView็้ข่ฒ
tv_login.setTextColor(getResources().getColor(R.color.gray));
tv_register.setTextColor(getResources().getColor(R.color.gray));
//้่Fragment้ฒๆญข้ๅฝฑ
FragmentTransaction transaction = fragmentManager.beginTransaction();
if (null != fragmentLogin) {
transaction.hide(fragmentLogin);
}
if (null != fragmentRegister) {
transaction.hide(fragmentRegister);
}
transaction.commit();
}
@Override
public void onFragmentInteraction(Uri uri) {
}
@Override
public void onBackPressed() {
super.onBackPressed();
finish();
}
}
| [
"962755614@qq.com"
] | 962755614@qq.com |
76c27e4c0e4de7e28fc139dda4bebaccf7ec4d68 | 2b6e70470567692d2e32a8b109be355c9a7bdb00 | /colormipsearch-api/src/main/java/org/janelia/colormipsearch/model/PPPmURLs.java | 0cb1758ac3d2b190598b1b7938bf8c26ab99c4fa | [
"BSD-3-Clause"
] | permissive | JaneliaSciComp/colormipsearch | 3896c7f6546fa7e3f74f475e4b3a71df974092d9 | d630475bade9f2050307f75ed20c114c4f073796 | refs/heads/main | 2023-07-20T14:33:46.790144 | 2023-07-13T21:13:50 | 2023-07-13T21:13:50 | 98,349,943 | 0 | 0 | BSD-3-Clause | 2023-07-07T18:46:33 | 2017-07-25T21:05:18 | Java | UTF-8 | Java | false | false | 862 | java | package org.janelia.colormipsearch.model;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.janelia.colormipsearch.model.annotations.PersistenceInfo;
@PersistenceInfo(storeName ="pppmURL")
public class PPPmURLs extends AbstractPublishedURLs {
private Map<String, String> thumbnailUrls = new HashMap<>();
@JsonProperty("uploadedFiles")
protected Map<String, String> getUrls() {
return super.getUrls();
}
protected Map<String, String> getThumbnailUrls() {
return thumbnailUrls;
}
@JsonProperty("uploadedThumbnails")
protected void setThumbnailUrls(Map<String, String> thumbnailUrls) {
this.thumbnailUrls = thumbnailUrls;
}
public String getThumbnailURLFor(String fileType) {
return thumbnailUrls.get(fileType);
}
}
| [
"goinac@hhmi.org"
] | goinac@hhmi.org |
47107a8703d44d3d34246d11b364ac95d1970fcd | 64b47f83d313af33804b946d0613760b8ff23840 | /tags/dev-3-7-5/weka/src/main/java/weka/gui/beans/Loader.java | 91e1b07228c9c4bc851f3fed59a7542ef08b0f9e | [] | no_license | hackerastra/weka | afde1c7ab0fbf374e6d6ac6d07220bfaffb9488c | c8366c454e9718d0e1634ddf4a72319dac3ce559 | refs/heads/master | 2021-05-28T08:25:33.811203 | 2015-01-22T03:12:18 | 2015-01-22T03:12:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 24,598 | java | /*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* Loader.java
* Copyright (C) 2002 University of Waikato, Hamilton, New Zealand
*
*/
package weka.gui.beans;
import weka.core.Environment;
import weka.core.EnvironmentHandler;
import weka.core.Instance;
import weka.core.Instances;
import weka.core.OptionHandler;
import weka.core.Utils;
import weka.core.converters.ArffLoader;
import weka.core.converters.DatabaseLoader;
import weka.core.converters.FileSourcedConverter;
import weka.gui.Logger;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.EventSetDescriptor;
import java.beans.beancontext.BeanContext;
import java.io.File;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectStreamException;
import java.util.Enumeration;
import java.util.Vector;
import javax.swing.JButton;
/**
* Loads data sets using weka.core.converter classes
*
* @author <a href="mailto:mhall@cs.waikato.ac.nz">Mark Hall</a>
* @version $Revision$
* @since 1.0
* @see AbstractDataSource
* @see UserRequestAcceptor
*/
public class Loader
extends AbstractDataSource
implements Startable, /*UserRequestAcceptor,*/ WekaWrapper,
EventConstraints, BeanCommon, EnvironmentHandler,
StructureProducer {
/** for serialization */
private static final long serialVersionUID = 1993738191961163027L;
/**
* Holds the instances loaded
*/
private transient Instances m_dataSet;
/**
* Holds the format of the last loaded data set
*/
private transient Instances m_dataFormat;
/**
* Global info for the wrapped loader (if it exists).
*/
protected String m_globalInfo;
/**
* Thread for doing IO in
*/
private LoadThread m_ioThread;
private static int IDLE = 0;
private static int BATCH_LOADING = 1;
private static int INCREMENTAL_LOADING = 2;
private int m_state = IDLE;
/**
* Loader
*/
private weka.core.converters.Loader m_Loader = new ArffLoader();
private InstanceEvent m_ie = new InstanceEvent(this);
/**
* Keep track of how many listeners for different types of events there are.
*/
private int m_instanceEventTargets = 0;
private int m_dataSetEventTargets = 0;
/** Flag indicating that a database has already been configured*/
private boolean m_dbSet = false;
/**
* Logging
*/
protected transient Logger m_log;
/**
* The environment variables.
*/
protected transient Environment m_env;
/**
* Asked to stop?
*/
protected boolean m_stopped = false;
private class LoadThread extends Thread {
private DataSource m_DP;
public LoadThread(DataSource dp) {
m_DP = dp;
}
public void run() {
try {
m_visual.setAnimated();
// m_visual.setText("Loading...");
boolean instanceGeneration = true;
// determine if we are going to produce data set or instance events
/* for (int i = 0; i < m_listeners.size(); i++) {
if (m_listeners.elementAt(i) instanceof DataSourceListener) {
instanceGeneration = false;
break;
}
} */
if (m_dataSetEventTargets > 0) {
instanceGeneration = false;
m_state = BATCH_LOADING;
}
// Set environment variables
if (m_Loader instanceof EnvironmentHandler && m_env != null) {
((EnvironmentHandler)m_Loader).setEnvironment(m_env);
}
String msg = statusMessagePrefix();
if (m_Loader instanceof FileSourcedConverter) {
msg += "Loading " + ((FileSourcedConverter)m_Loader).retrieveFile().getName();
} else {
msg += "Loading...";
}
if (m_log != null) {
m_log.statusMessage(msg);
}
if (instanceGeneration) {
m_state = INCREMENTAL_LOADING;
// boolean start = true;
Instance nextInstance = null;
// load and pass on the structure first
Instances structure = null;
try {
m_Loader.reset();
m_Loader.setRetrieval(weka.core.converters.Loader.INCREMENTAL);
// System.err.println("NOTIFYING STRUCTURE AVAIL");
structure = m_Loader.getStructure();
notifyStructureAvailable(structure);
} catch (IOException e) {
if (m_log != null) {
m_log.statusMessage(statusMessagePrefix()
+"ERROR (See log for details");
m_log.logMessage("[Loader] " + statusMessagePrefix()
+ " " + e.getMessage());
}
e.printStackTrace();
}
try {
nextInstance = m_Loader.getNextInstance(structure);
} catch (IOException e) {
if (m_log != null) {
m_log.statusMessage(statusMessagePrefix()
+"ERROR (See log for details");
m_log.logMessage("[Loader] " + statusMessagePrefix()
+ " " + e.getMessage());
}
e.printStackTrace();
}
int z = 0;
while (nextInstance != null) {
if (m_stopped) {
break;
}
nextInstance.setDataset(structure);
// format.add(nextInstance);
/* InstanceEvent ie = (start)
? new InstanceEvent(m_DP, nextInstance,
InstanceEvent.FORMAT_AVAILABLE)
: new InstanceEvent(m_DP, nextInstance,
InstanceEvent.INSTANCE_AVAILABLE); */
// if (start) {
// m_ie.setStatus(InstanceEvent.FORMAT_AVAILABLE);
// } else {
m_ie.setStatus(InstanceEvent.INSTANCE_AVAILABLE);
// }
m_ie.setInstance(nextInstance);
// start = false;
// System.err.println(z);
nextInstance = m_Loader.getNextInstance(structure);
if (nextInstance == null) {
m_ie.setStatus(InstanceEvent.BATCH_FINISHED);
}
notifyInstanceLoaded(m_ie);
z++;
if (z % 10000 == 0) {
// m_visual.setText("" + z + " instances...");
if (m_log != null) {
m_log.statusMessage(statusMessagePrefix()
+ "Loaded " + z + " instances");
}
}
}
m_visual.setStatic();
// m_visual.setText(structure.relationName());
} else {
m_Loader.reset();
m_Loader.setRetrieval(weka.core.converters.Loader.BATCH);
m_dataSet = m_Loader.getDataSet();
m_visual.setStatic();
if (m_log != null) {
m_log.logMessage("[Loader] " + statusMessagePrefix()
+ " loaded " + m_dataSet.relationName());
}
// m_visual.setText(m_dataSet.relationName());
notifyDataSetLoaded(new DataSetEvent(m_DP, m_dataSet));
}
} catch (Exception ex) {
if (m_log != null) {
m_log.statusMessage(statusMessagePrefix()
+"ERROR (See log for details");
m_log.logMessage("[Loader] " + statusMessagePrefix()
+ " " + ex.getMessage());
}
ex.printStackTrace();
} finally {
if (Thread.currentThread().isInterrupted()) {
if (m_log != null) {
m_log.logMessage("[Loader] " + statusMessagePrefix()
+ " loading interrupted!");
}
}
m_ioThread = null;
// m_visual.setText("Finished");
// m_visual.setIcon(m_inactive.getVisual());
m_visual.setStatic();
m_state = IDLE;
m_stopped = false;
if (m_log != null) {
m_log.statusMessage(statusMessagePrefix() + "Finished.");
}
block(false);
}
}
}
/**
* Global info (if it exists) for the wrapped loader
*
* @return the global info
*/
public String globalInfo() {
return m_globalInfo;
}
public Loader() {
super();
setLoader(m_Loader);
appearanceFinal();
}
public void setDB(boolean flag){
m_dbSet = flag;
}
protected void appearanceFinal() {
removeAll();
setLayout(new BorderLayout());
JButton goButton = new JButton("Start...");
add(goButton, BorderLayout.CENTER);
goButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
startLoading();
}
});
}
protected void appearanceDesign() {
removeAll();
setLayout(new BorderLayout());
add(m_visual, BorderLayout.CENTER);
}
/**
* Set a bean context for this bean
*
* @param bc a <code>BeanContext</code> value
*/
public void setBeanContext(BeanContext bc) {
super.setBeanContext(bc);
if (m_design) {
appearanceDesign();
} else {
appearanceFinal();
}
}
/**
* Set the loader to use
*
* @param loader a <code>weka.core.converters.Loader</code> value
*/
public void setLoader(weka.core.converters.Loader loader) {
boolean loadImages = true;
if (loader.getClass().getName().
compareTo(m_Loader.getClass().getName()) == 0) {
loadImages = false;
}
m_Loader = loader;
String loaderName = loader.getClass().toString();
loaderName = loaderName.substring(loaderName.
lastIndexOf('.')+1,
loaderName.length());
if (loadImages) {
if (m_Loader instanceof Visible) {
m_visual = ((Visible) m_Loader).getVisual();
} else {
if (!m_visual.loadIcons(BeanVisual.ICON_PATH+loaderName+".gif",
BeanVisual.ICON_PATH+loaderName+"_animated.gif")) {
useDefaultVisual();
}
}
}
m_visual.setText(loaderName);
// get global info
m_globalInfo = KnowledgeFlowApp.getGlobalInfo(m_Loader);
}
protected void newFileSelected() throws Exception {
if(! (m_Loader instanceof DatabaseLoader)) {
newStructure();
/* // try to load structure (if possible) and notify any listeners
// Set environment variables
if (m_Loader instanceof EnvironmentHandler && m_env != null) {
try {
((EnvironmentHandler)m_Loader).setEnvironment(m_env);
}catch (Exception ex) {
}
}
m_dataFormat = m_Loader.getStructure();
// System.err.println(m_dataFormat);
System.out.println("[Loader] Notifying listeners of instance structure avail.");
notifyStructureAvailable(m_dataFormat); */
}
}
protected void newStructure() throws Exception {
m_Loader.reset();
// Set environment variables
if (m_Loader instanceof EnvironmentHandler && m_env != null) {
try {
((EnvironmentHandler)m_Loader).setEnvironment(m_env);
}catch (Exception ex) {
}
}
m_dataFormat = m_Loader.getStructure();
// System.out.println("[Loader] Notifying listeners of instance structure avail.");
// notifyStructureAvailable(m_dataFormat);
}
/**
* Get the structure of the output encapsulated in the named
* event. If the structure can't be determined in advance of
* seeing input, or this StructureProducer does not generate
* the named event, null should be returned.
*
* @param eventName the name of the output event that encapsulates
* the requested output.
*
* @return the structure of the output encapsulated in the named
* event or null if it can't be determined in advance of seeing input
* or the named event is not generated by this StructureProduce.
*/
public Instances getStructure(String eventName) {
if (!eventName.equals("dataSet") && !eventName.equals("instance")) {
return null;
}
if (m_dataSetEventTargets > 0 && !eventName.equals("dataSet")) {
return null;
}
if (m_dataSetEventTargets == 0 && !eventName.equals("instance")) {
return null;
}
try {
newStructure();
} catch (Exception ex) {
//ex.printStackTrace();
System.err.println("[KnowledgeFlow/Loader] Warning: " + ex.getMessage());
m_dataFormat = null;
}
return m_dataFormat;
}
/**
* Get the loader
*
* @return a <code>weka.core.converters.Loader</code> value
*/
public weka.core.converters.Loader getLoader() {
return m_Loader;
}
/**
* Set the loader
*
* @param algorithm a Loader
* @exception IllegalArgumentException if an error occurs
*/
public void setWrappedAlgorithm(Object algorithm)
{
if (!(algorithm instanceof weka.core.converters.Loader)) {
throw new IllegalArgumentException(algorithm.getClass()+" : incorrect "
+"type of algorithm (Loader)");
}
setLoader((weka.core.converters.Loader)algorithm);
}
/**
* Get the loader
*
* @return a Loader
*/
public Object getWrappedAlgorithm() {
return getLoader();
}
/**
* Notify all listeners that the structure of a data set
* is available.
*
* @param structure an <code>Instances</code> value
*/
protected void notifyStructureAvailable(Instances structure) {
if (m_dataSetEventTargets > 0 && structure != null) {
DataSetEvent dse = new DataSetEvent(this, structure);
notifyDataSetLoaded(dse);
} else if (m_instanceEventTargets > 0 && structure != null) {
m_ie.setStructure(structure);
notifyInstanceLoaded(m_ie);
}
}
/**
* Notify all Data source listeners that a data set has been loaded
*
* @param e a <code>DataSetEvent</code> value
*/
protected void notifyDataSetLoaded(DataSetEvent e) {
Vector l;
synchronized (this) {
l = (Vector)m_listeners.clone();
}
if (l.size() > 0) {
for(int i = 0; i < l.size(); i++) {
((DataSourceListener)l.elementAt(i)).acceptDataSet(e);
}
m_dataSet = null;
}
}
/**
* Notify all instance listeners that a new instance is available
*
* @param e an <code>InstanceEvent</code> value
*/
protected void notifyInstanceLoaded(InstanceEvent e) {
Vector l;
synchronized (this) {
l = (Vector)m_listeners.clone();
}
if (l.size() > 0) {
for(int i = 0; i < l.size(); i++) {
((InstanceListener)l.elementAt(i)).acceptInstance(e);
}
m_dataSet = null;
}
}
/**
* Start loading data
*/
public void startLoading() {
if (m_ioThread == null) {
// m_visual.setText(m_dataSetFile.getName());
m_state = BATCH_LOADING;
m_ioThread = new LoadThread(Loader.this);
m_ioThread.setPriority(Thread.MIN_PRIORITY);
m_ioThread.start();
} else {
m_ioThread = null;
m_state = IDLE;
}
}
/**
* Get a list of user requests
*
* @return an <code>Enumeration</code> value
*/
/*public Enumeration enumerateRequests() {
Vector newVector = new Vector(0);
boolean ok = true;
if (m_ioThread == null) {
if (m_Loader instanceof FileSourcedConverter) {
String temp = ((FileSourcedConverter) m_Loader).retrieveFile().getPath();
Environment env = (m_env == null) ? Environment.getSystemWide() : m_env;
try {
temp = env.substitute(temp);
} catch (Exception ex) {}
File tempF = new File(temp);
if (!tempF.isFile()) {
ok = false;
}
}
String entry = "Start loading";
if (!ok) {
entry = "$"+entry;
}
newVector.addElement(entry);
}
return newVector.elements();
} */
/**
* Perform the named request
*
* @param request a <code>String</code> value
* @exception IllegalArgumentException if an error occurs
*/
/*public void performRequest(String request) {
if (request.compareTo("Start loading") == 0) {
startLoading();
} else {
throw new IllegalArgumentException(request
+ " not supported (Loader)");
}
} */
/**
* Start loading
*
* @exception Exception if something goes wrong
*/
public void start() throws Exception {
startLoading();
block(true);
}
/**
* Gets a string that describes the start action. The
* KnowledgeFlow uses this in the popup contextual menu
* for the component. The string can be proceeded by
* a '$' character to indicate that the component can't
* be started at present.
*
* @return a string describing the start action.
*/
public String getStartMessage() {
boolean ok = true;
String entry = "Start loading";
if (m_ioThread == null) {
if (m_Loader instanceof FileSourcedConverter) {
String temp = ((FileSourcedConverter) m_Loader).retrieveFile().getPath();
Environment env = (m_env == null) ? Environment.getSystemWide() : m_env;
try {
temp = env.substitute(temp);
} catch (Exception ex) {}
File tempF = new File(temp);
// forward slashes are platform independent for resources read from the
// classpath
String tempFixedPathSepForResource = temp.replace(File.separatorChar, '/');
if (!tempF.isFile() &&
this.getClass().getClassLoader().getResource(tempFixedPathSepForResource) == null) {
ok = false;
}
}
if (!ok) {
entry = "$"+entry;
}
}
return entry;
}
/**
* Function used to stop code that calls acceptTrainingSet. This is
* needed as classifier construction is performed inside a separate
* thread of execution.
*
* @param tf a <code>boolean</code> value
*/
private synchronized void block(boolean tf) {
if (tf) {
try {
// only block if thread is still doing something useful!
if (m_ioThread.isAlive() && m_state != IDLE) {
wait();
}
} catch (InterruptedException ex) {
}
} else {
notifyAll();
}
}
/**
* Returns true if the named event can be generated at this time
*
* @param eventName the event
* @return a <code>boolean</code> value
*/
public boolean eventGeneratable(String eventName) {
if (eventName.compareTo("instance") == 0) {
if (!(m_Loader instanceof weka.core.converters.IncrementalConverter)) {
return false;
}
if (m_dataSetEventTargets > 0) {
return false;
}
/* for (int i = 0; i < m_listeners.size(); i++) {
if (m_listeners.elementAt(i) instanceof DataSourceListener) {
return false;
}
} */
}
if (eventName.compareTo("dataSet") == 0) {
if (!(m_Loader instanceof weka.core.converters.BatchConverter)) {
return false;
}
if (m_instanceEventTargets > 0) {
return false;
}
/* for (int i = 0; i < m_listeners.size(); i++) {
if (m_listeners.elementAt(i) instanceof InstanceListener) {
return false;
}
} */
}
return true;
}
/**
* Add a listener
*
* @param dsl a <code>DataSourceListener</code> value
*/
public synchronized void addDataSourceListener(DataSourceListener dsl) {
super.addDataSourceListener(dsl);
m_dataSetEventTargets ++;
// pass on any current instance format
try{
if((m_Loader instanceof DatabaseLoader && m_dbSet && m_dataFormat == null) ||
(!(m_Loader instanceof DatabaseLoader) && m_dataFormat == null)) {
m_dataFormat = m_Loader.getStructure();
m_dbSet = false;
}
}catch(Exception ex){
}
notifyStructureAvailable(m_dataFormat);
}
/**
* Remove a listener
*
* @param dsl a <code>DataSourceListener</code> value
*/
public synchronized void removeDataSourceListener(DataSourceListener dsl) {
super.removeDataSourceListener(dsl);
m_dataSetEventTargets --;
}
/**
* Add an instance listener
*
* @param dsl a <code>InstanceListener</code> value
*/
public synchronized void addInstanceListener(InstanceListener dsl) {
super.addInstanceListener(dsl);
m_instanceEventTargets ++;
try{
if((m_Loader instanceof DatabaseLoader && m_dbSet && m_dataFormat == null) ||
(!(m_Loader instanceof DatabaseLoader) && m_dataFormat == null)) {
m_dataFormat = m_Loader.getStructure();
m_dbSet = false;
}
}catch(Exception ex){
}
// pass on any current instance format
notifyStructureAvailable(m_dataFormat);
}
/**
* Remove an instance listener
*
* @param dsl a <code>InstanceListener</code> value
*/
public synchronized void removeInstanceListener(InstanceListener dsl) {
super.removeInstanceListener(dsl);
m_instanceEventTargets --;
}
public static void main(String [] args) {
try {
final javax.swing.JFrame jf = new javax.swing.JFrame();
jf.getContentPane().setLayout(new java.awt.BorderLayout());
final Loader tv = new Loader();
jf.getContentPane().add(tv, java.awt.BorderLayout.CENTER);
jf.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent e) {
jf.dispose();
System.exit(0);
}
});
jf.setSize(800,600);
jf.setVisible(true);
} catch (Exception ex) {
ex.printStackTrace();
}
}
private Object readResolve() throws ObjectStreamException {
// try and reset the Loader
if (m_Loader != null) {
try {
m_Loader.reset();
} catch (Exception ex) {
}
}
return this;
}
/**
* Set a custom (descriptive) name for this bean
*
* @param name the name to use
*/
public void setCustomName(String name) {
m_visual.setText(name);
}
/**
* Get the custom (descriptive) name for this bean (if one has been set)
*
* @return the custom name (or the default name)
*/
public String getCustomName() {
return m_visual.getText();
}
/**
* Set a logger
*
* @param logger a <code>weka.gui.Logger</code> value
*/
public void setLog(Logger logger) {
m_log = logger;
}
/**
* Set environment variables to use.
*
* @param env the environment variables to
* use
*/
public void setEnvironment(Environment env) {
m_env = env;
}
/**
* Returns true if, at this time,
* the object will accept a connection via the supplied
* EventSetDescriptor. Always returns false for loader.
*
* @param esd the EventSetDescriptor
* @return true if the object will accept a connection
*/
public boolean connectionAllowed(EventSetDescriptor esd) {
return false;
}
/**
* Returns true if, at this time,
* the object will accept a connection via the named event
*
* @param eventName the name of the event
* @return true if the object will accept a connection
*/
public boolean connectionAllowed(String eventName) {
return false;
}
/**
* Notify this object that it has been registered as a listener with
* a source for receiving events described by the named event
* This object is responsible for recording this fact.
*
* @param eventName the event
* @param source the source with which this object has been registered as
* a listener
*/
public void connectionNotification(String eventName, Object source) {
// this should never get called for us.
}
/**
* Notify this object that it has been deregistered as a listener with
* a source for named event. This object is responsible
* for recording this fact.
*
* @param eventName the event
* @param source the source with which this object has been registered as
* a listener
*/
public void disconnectionNotification(String eventName, Object source) {
// this should never get called for us.
}
/**
* Stop any loading action.
*/
public void stop() {
m_stopped = true;
}
/**
* Returns true if. at this time, the bean is busy with some
* (i.e. perhaps a worker thread is performing some calculation).
*
* @return true if the bean is busy.
*/
public boolean isBusy() {
return (m_ioThread != null);
}
private String statusMessagePrefix() {
return getCustomName() + "$" + hashCode() + "|"
+ ((m_Loader instanceof OptionHandler)
? Utils.joinOptions(((OptionHandler)m_Loader).getOptions()) + "|"
: "");
}
// Custom de-serialization in order to set default
// environment variables on de-serialization
private void readObject(ObjectInputStream aStream)
throws IOException, ClassNotFoundException {
aStream.defaultReadObject();
// set a default environment to use
m_env = Environment.getSystemWide();
}
}
| [
"mhall@e0a1b77d-ad91-4216-81b1-defd5f83fa92"
] | mhall@e0a1b77d-ad91-4216-81b1-defd5f83fa92 |
ccc8d00d15f1980243baaa5790f7a1b4f1afe8fc | cc1701cadaa3b0e138e30740f98d48264e2010bd | /chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/promo/HomepagePromoController.java | 746adb0c7b45c77a97a40e856c3121af5ea3ec6d | [
"BSD-3-Clause"
] | permissive | dbuskariol-org/chromium | 35d3d7a441009c6f8961227f1f7f7d4823a4207e | e91a999f13a0bda0aff594961762668196c4d22a | refs/heads/master | 2023-05-03T10:50:11.717004 | 2020-06-26T03:33:12 | 2020-06-26T03:33:12 | 275,070,037 | 1 | 3 | BSD-3-Clause | 2020-06-26T04:04:30 | 2020-06-26T04:04:29 | null | UTF-8 | Java | false | false | 10,672 | java | // Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.ntp.cards.promo;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.view.View;
import androidx.annotation.Nullable;
import androidx.appcompat.content.res.AppCompatResources;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.homepage.HomepageManager;
import org.chromium.chrome.browser.homepage.HomepageManager.HomepageStateListener;
import org.chromium.chrome.browser.ntp.cards.promo.HomepagePromoUtils.HomepagePromoAction;
import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager;
import org.chromium.components.browser_ui.widget.promo.PromoCardCoordinator;
import org.chromium.components.browser_ui.widget.promo.PromoCardCoordinator.LayoutStyle;
import org.chromium.components.browser_ui.widget.promo.PromoCardProperties;
import org.chromium.components.feature_engagement.EventConstants;
import org.chromium.components.feature_engagement.FeatureConstants;
import org.chromium.components.feature_engagement.Tracker;
import org.chromium.ui.modelutil.PropertyModel;
/**
* Controller for the homepage promo component, managing the creation of homepage promo.
* The logic for creating and managing the promo is relatively simple, so this class merges the duty
* of mediator and coordinator.
*
* TODO(wenyufu): Consider making the promo controller an {@link
* org.chromium.chrome.browser.ntp.cards.OptionalLeaf} similar to {@link
* org.chromium.chrome.browser.ntp.cards.SignInPromo}.
*/
public class HomepagePromoController implements HomepageStateListener {
/**
* Interface that represents the holder of HomepagePromo. When the promo has state changes due
* to homepage changes / being dismissed, {@link #onPromoDataChange()} will be called.
*/
public interface HomepagePromoStateListener {
/**
* Called when promo has state changes due to homepage changes / being dismissed.
*/
void onHomepagePromoStateChange();
}
private final Context mContext;
private final HomepagePromoSnackbarController mSnackbarController;
private final Tracker mTracker;
// Created only when creation criteria is met.
private HomepagePromoStateListener mStateListener;
private PromoCardCoordinator mPromoCoordinator;
private PropertyModel mModel;
private boolean mIsPromoShowing;
/**
* Build the HomepagePromoController that handles the set up / tear down for the homepage promo.
* @param context Context from the activity.
* @param snackbarManager SnackbarManager used to display snackbar.
* @param tracker Tracker for the feature engagement system.
* @param listener Listener to be notified when the promo should be removed from the parent
* view.
*/
public HomepagePromoController(Context context, SnackbarManager snackbarManager,
Tracker tracker, HomepagePromoStateListener listener) {
mContext = context;
mSnackbarController = new HomepagePromoSnackbarController(context, snackbarManager);
// Inform event of creation.
mTracker = tracker;
mStateListener = listener;
}
/**
* Retrieve the view representing HomepagePromo.
*
* Internally, this function will check the creation criteria from SharedPreference and feature
* engagement system. If the creation criteria is not met, this function will return null;
* otherwise, promo controller will create the view lazily if not yet created, and return.
*
* Note that the same View will be returned until the promo is dismissed by internal or external
* signal.
*
* @return View represent HomepagePromo if creation criteria is meet; null If the criteria is
* not meet.
*/
public @Nullable View getPromoView() {
if (mIsPromoShowing || HomepagePromoUtils.shouldCreatePromo(mTracker)) {
mIsPromoShowing = true;
return getPromoCoordinator().getView();
} else {
return null;
}
}
/**
* Destroy the HomepagePromo and release its dependencies.
*/
public void destroy() {
mStateListener = null;
// Early return if promo coordinator is not initialized.
if (mPromoCoordinator == null) return;
mPromoCoordinator.destroy();
HomepageManager.getInstance().removeListener(this);
// Update the tracker if the promo is shown and not yet dismissed
if (mIsPromoShowing) dismissPromoInternal();
}
/**
* @return The PromoCardCoordinator for homepage promo. If the coordinator is not created,
* create it lazily.
*/
private PromoCardCoordinator getPromoCoordinator() {
if (mPromoCoordinator != null) return mPromoCoordinator;
@LayoutStyle
int layoutStyle = HomepagePromoVariationManager.getInstance().getLayoutVariation();
mModel = buildModel(layoutStyle);
mPromoCoordinator = new PromoCardCoordinator(
mContext, mModel, FeatureConstants.HOMEPAGE_PROMO_CARD_FEATURE, layoutStyle);
mPromoCoordinator.getView().setId(R.id.homepage_promo);
// Subscribe to homepage update only when view is created.
HomepageManager.getInstance().addListener(this);
HomepagePromoUtils.recordHomepagePromoEvent(HomepagePromoAction.CREATED);
return mPromoCoordinator;
}
private PropertyModel buildModel(@LayoutStyle int layoutStyle) {
Resources r = mContext.getResources();
PropertyModel.Builder builder = new PropertyModel.Builder(PromoCardProperties.ALL_KEYS);
builder.with(PromoCardProperties.PRIMARY_BUTTON_CALLBACK, (v) -> onPrimaryButtonClicked())
.with(PromoCardProperties.IMPRESSION_SEEN_CALLBACK, this::onPromoSeen)
.with(PromoCardProperties.IS_IMPRESSION_ON_PRIMARY_BUTTON, true);
if (layoutStyle == LayoutStyle.SLIM) {
Drawable homeIcon =
AppCompatResources.getDrawable(mContext, R.drawable.btn_toolbar_home);
ColorStateList tint =
AppCompatResources.getColorStateList(mContext, R.color.default_icon_color_blue);
builder.with(PromoCardProperties.IMAGE, homeIcon)
.with(PromoCardProperties.ICON_TINT, tint)
.with(PromoCardProperties.TITLE,
r.getString(R.string.homepage_promo_title_slim))
.with(PromoCardProperties.PRIMARY_BUTTON_TEXT,
r.getString(R.string.homepage_promo_primary_button_slim));
} else if (layoutStyle == LayoutStyle.LARGE) {
Drawable illustration = AppCompatResources.getDrawable(
mContext, R.drawable.homepage_promo_illustration_vector);
builder.with(PromoCardProperties.IMAGE, illustration)
.with(PromoCardProperties.TITLE, r.getString(R.string.homepage_promo_title))
.with(PromoCardProperties.DESCRIPTION,
r.getString(R.string.homepage_promo_description))
.with(PromoCardProperties.PRIMARY_BUTTON_TEXT,
r.getString(R.string.homepage_promo_primary_button))
.with(PromoCardProperties.HAS_SECONDARY_BUTTON, true)
.with(PromoCardProperties.SECONDARY_BUTTON_TEXT,
r.getString(R.string.no_thanks))
.with(PromoCardProperties.SECONDARY_BUTTON_CALLBACK, (v) -> dismissPromo());
} else { // layoutStyle == LayoutStyle.COMPACT
Drawable homeIcon =
AppCompatResources.getDrawable(mContext, R.drawable.btn_toolbar_home);
ColorStateList tint =
AppCompatResources.getColorStateList(mContext, R.color.default_icon_color_blue);
builder.with(PromoCardProperties.IMAGE, homeIcon)
.with(PromoCardProperties.ICON_TINT, tint)
.with(PromoCardProperties.TITLE, r.getString(R.string.homepage_promo_title))
.with(PromoCardProperties.DESCRIPTION,
r.getString(R.string.homepage_promo_description))
.with(PromoCardProperties.PRIMARY_BUTTON_TEXT,
r.getString(R.string.homepage_promo_primary_button))
.with(PromoCardProperties.HAS_SECONDARY_BUTTON, true)
.with(PromoCardProperties.SECONDARY_BUTTON_TEXT,
r.getString(R.string.no_thanks))
.with(PromoCardProperties.SECONDARY_BUTTON_CALLBACK, (v) -> dismissPromo());
}
return builder.build();
}
/**
* Dismissed the promo and record the user action.
*/
public void dismissPromo() {
HomepagePromoUtils.setPromoDismissedInSharedPreference(true);
HomepagePromoUtils.recordHomepagePromoEvent(HomepagePromoAction.DISMISSED);
dismissPromoInternal();
}
private void dismissPromoInternal() {
mIsPromoShowing = false;
mTracker.dismissed(FeatureConstants.HOMEPAGE_PROMO_CARD_FEATURE);
if (mStateListener != null) mStateListener.onHomepagePromoStateChange();
}
private void onPrimaryButtonClicked() {
HomepageManager manager = HomepageManager.getInstance();
boolean wasUsingNtp = manager.getPrefHomepageUseChromeNTP();
boolean wasUsingDefaultUri = manager.getPrefHomepageUseDefaultUri();
String originalCustomUri = manager.getPrefHomepageCustomUri();
mTracker.notifyEvent(EventConstants.HOMEPAGE_PROMO_ACCEPTED);
HomepagePromoUtils.recordHomepagePromoEvent(HomepagePromoAction.ACCEPTED);
manager.setHomepagePreferences(true, false, originalCustomUri);
mSnackbarController.showUndoSnackbar(wasUsingNtp, wasUsingDefaultUri, originalCustomUri);
}
private void onPromoSeen() {
mTracker.notifyEvent(EventConstants.HOMEPAGE_PROMO_SEEN);
HomepagePromoUtils.recordHomepagePromoEvent(HomepagePromoAction.SEEN);
}
/**
* When the homepage is no longer using default NTP, update the visibility of promo.
*/
@Override
public void onHomepageStateUpdated() {
if (mIsPromoShowing && !HomepagePromoUtils.shouldCreatePromo(null)) {
dismissPromoInternal();
}
}
}
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
94c2001c7bb433854b952f07ad9e2fccbd873ee7 | 831d8e0f794485bfcc4fdaa3986a9ced1018ea11 | /TorchAssignment/src/main/java/com/torch/model/LineUptime.java | a62af51c7ea0146a0f57cb834ca29d767ff82c53 | [] | no_license | SansStef/TorchAssignment | 64204e52c807b773e02ccaa78cc20abf5fabffdd | fb7fd27dd54c51675b67f059cff320d88a82ccf7 | refs/heads/master | 2020-04-11T10:17:19.939200 | 2018-12-14T00:24:20 | 2018-12-14T00:24:20 | 161,709,671 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 724 | java | package com.torch.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
public class LineUptime {
private SubwayLine line;
private double uptime;
public LineUptime() {
}
public LineUptime(SubwayLine line, double uptime) {
this.line = line;
this.uptime = uptime;
}
@JsonProperty("line_name")
public String getLineName() {
return line.getName();
}
@JsonIgnore
public SubwayLine getSubwayLine() {
return line;
}
public void setSubwayLine(SubwayLine line) {
this.line = line;
}
public double getUptime() {
return uptime;
}
public void setUptime(double uptime) {
this.uptime = uptime;
}
}
| [
"sesansone@gmail.com"
] | sesansone@gmail.com |
c3c8687b5fe322cf09ef99d7b8154b8c20fa0361 | 22a3a24dc090636d6b25f71020608352436aeb6c | /src/main/java/org/hudsonci/tools/plugintester/pages/job/CreateJob.java | 95a6533267a5e5efe810702cde19956e30d49b3d | [] | no_license | hudson2-plugins/plugin-tester | 0a53c24e5fe7b37547f4495109c83d131df7e3b4 | 1b172f6b1806a952b246f04214801da0d85adf18 | refs/heads/master | 2016-09-06T02:51:30.346361 | 2012-04-22T20:25:57 | 2012-04-22T20:25:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,739 | java | package org.hudsonci.tools.plugintester.pages.job;
import org.hudsonci.tools.plugintester.Page;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
/**
*
* @author henrik
*/
public class CreateJob extends Page {
@FindBy(id = "name")
WebElement nameField;
@FindBy(xpath="//input[@type='radio'][@name='mode'][@value='hudson.model.FreeStyleProject$DescriptorImpl']")
WebElement freestyleJobRadio;
@FindBy(xpath="//input[@type='radio'][@name='mode'][@value='hudson.model.FreeStyleProject$DescriptorImpl']")
WebElement matrixJobRadio;
@FindBy(xpath="//input[@type='radio'][@name='mode'][@value='hudson.model.FreeStyleProject$DescriptorImpl']")
WebElement copyJobRadio;
@FindBy(id = "copy")
WebElement copyFromField;
public CreateJob(WebDriver driver) {
super(driver,"New Job [Hudson]");
PageFactory.initElements(driver, this);
}
public ConfigureJob createFreestyleJob(String name) {
nameField.clear();
nameField.sendKeys(name);
freestyleJobRadio.click();
freestyleJobRadio.submit();
return new ConfigureJob(driver,name);
}
public ConfigureJob createMatrixJob(String name) {
nameField.clear();
nameField.sendKeys(name);
matrixJobRadio.click();
matrixJobRadio.submit();
return new ConfigureJob(driver,name);
}
public ConfigureJob copyJob(String oldName,String newName) {
nameField.clear();
nameField.sendKeys(newName);
copyFromField.clear();
copyFromField.sendKeys(oldName);
copyJobRadio.click();
copyJobRadio.submit();
return new ConfigureJob(driver, newName);
}
}
| [
"henrik@hlyh.dk"
] | henrik@hlyh.dk |
c4b0c2310f2dd11b2a9d1f2a7c7a724d0ce73fc5 | aeebbce4730c95cae394ad25d1daea2527aa1611 | /app/src/main/java/rice/pastry/testing/MemoryTest.java | efa38d8a430754c569fe48b1fb45d7f6d75c33eb | [] | no_license | lordcanete/tfmteleco | 504cb73275c69455f2febb67bc6072cf83c32b0b | 34fbc8f78248b88521d5ee672aea51ed04f8b58b | refs/heads/master | 2020-12-19T06:42:55.781474 | 2020-11-25T19:02:11 | 2020-11-25T19:02:11 | 235,651,842 | 1 | 0 | null | 2020-11-25T19:02:12 | 2020-01-22T19:40:48 | Java | UTF-8 | Java | false | false | 6,526 | java | /*******************************************************************************
"FreePastry" Peer-to-Peer Application Development Substrate
Copyright 2002-2007, Rice University. Copyright 2006-2007, Max Planck Institute
for Software Systems. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of Rice University (RICE), Max Planck Institute for Software
Systems (MPI-SWS) nor the names of its contributors may be used to endorse or
promote products derived from this software without specific prior written
permission.
This software is provided by RICE, MPI-SWS and the contributors on an "as is"
basis, without any representations or warranties of any kind, express or implied
including, but not limited to, representations or warranties of
non-infringement, merchantability or fitness for a particular purpose. In no
event shall RICE, MPI-SWS or contributors be liable for any direct, indirect,
incidental, special, exemplary, or consequential damages (including, but not
limited to, procurement of substitute goods or services; loss of use, data, or
profits; or business interruption) however caused and on any theory of
liability, whether in contract, strict liability, or tort (including negligence
or otherwise) arising in any way out of the use of this software, even if
advised of the possibility of such damage.
*******************************************************************************/
/*
* Created on Aug 8, 2005
*/
package rice.pastry.testing;
import java.io.FileOutputStream;
import java.io.PrintStream;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.util.LinkedList;
import rice.environment.Environment;
import rice.pastry.NodeHandle;
import rice.pastry.NodeIdFactory;
import rice.pastry.PastryNode;
import rice.pastry.PastryNodeFactory;
import rice.pastry.socket.SocketNodeHandle;
import rice.pastry.socket.SocketPastryNodeFactory;
import rice.pastry.standard.RandomNodeIdFactory;
/**
* The purpose of this test is to verify that FreePastry is properly shutting down, without having
* to destroy the JVM.
*
* @author Jeff Hoye
*/
public class MemoryTest {
/**
* The idea is to keep a ring of about 10 nodes alive, but one by one recycle the nodes out. In the end,
* creating a whole lot of nodes, to see if they are being properly cleaned up.
*
* TODO: make this return a boolean:
*
* Record the memory at start (M1), then after creating the ringSize*2 nodes (M2)
* (M2-M1/ringSize) is the approx memory for 1 node.
*
* M3 = (M2-M1) which is basically the amount of memory that our ring of 10 should take up.
*
* at the end of the test, record M4.
*
* if M4 > (M1+2*M3) then we probably have a leak, fail.
*
* TODO: test this with other environment settings
*/
public static void testOneEnvironment() throws Exception {
//System.setOut(new PrintStream(new FileOutputStream("memtest.txt")));
// setup
int startPort = 5438;
int ringSize = 10;
int numNodes = 100;
LinkedList nodes = new LinkedList();
Runtime run = Runtime.getRuntime();
long memUsed = run.totalMemory()-run.freeMemory();
System.out.println("Memory:"+memUsed);
Environment env = new Environment();
env.getParameters().setBoolean("pastry_factory_selectorPerNode", false);
env.getParameters().setBoolean("pastry_factory_processorPerNode", false);
env.getParameters().setInt("pastry_socket_srm_num_source_route_attempts", 0);
env.getParameters().setInt("pastry_socket_scm_ping_delay", 500);
env.getParameters().setInt("pastry_socket_scm_num_ping_tries", 5);
env.getParameters().setInt("pastry_protocol_periodicLeafSet_ping_neighbor_period", 8000);
env.getParameters().setInt("pastry_protocol_periodicLeafSet_lease_period", 10000);
NodeIdFactory nidFactory = new RandomNodeIdFactory(env);
//InetAddress localAddress = InetAddress.getByName("139.19.64.79");
InetAddress localAddress = InetAddress.getLocalHost();
PastryNodeFactory factory = new SocketPastryNodeFactory(nidFactory, localAddress, startPort, env);
InetSocketAddress bootaddress = new InetSocketAddress(localAddress, startPort);
int curNode = 0;
// make initial ring of 10 nodes
for (;curNode < numNodes; curNode++) {
NodeHandle bootHandle = ((SocketPastryNodeFactory) factory).getNodeHandle(bootaddress);
PastryNode node = factory.newNode((rice.pastry.NodeHandle) bootHandle);
long waitTime = env.getTimeSource().currentTimeMillis();
while (!node.isReady()) {
Thread.sleep(1000);
long waitedFor = env.getTimeSource().currentTimeMillis() - waitTime;
//System.out.println("Waited for "+waitedFor+" millis.");
}
// print the current status
long waitedFor = env.getTimeSource().currentTimeMillis() - waitTime;
memUsed = run.totalMemory()-run.freeMemory();
System.out.println(curNode+"/"+numNodes+" Memory:"+memUsed+" leafset size:"+node.getLeafSet().size()+" "+node+" after "+waitedFor);
// always boot off of the previous node
bootaddress = ((SocketNodeHandle)node.getLocalHandle()).getInetSocketAddress();
// store the node
nodes.addLast(node);
// kill a node
if (curNode > ringSize) {
PastryNode pn = (PastryNode)nodes.removeFirst();
System.out.println("Destroying pastry node "+pn);
pn.destroy();
//System.out.println("Done destroying.");
}
}
env.destroy();
}
/**
* Same test as testOneEnvironment, but also creates/destroys the environment for each node.
*
*/
public static void testMultiEnvironment() {
}
/**
* Same thing, but with direct
*
*/
public static void testDirect() {
}
public static void main(String[] args) throws Exception {
System.setOut(new PrintStream(new FileOutputStream("mem.txt")));
System.setErr(System.out);
testOneEnvironment();
testMultiEnvironment();
}
}
| [
"pedcanvaz@gmail.com"
] | pedcanvaz@gmail.com |
6108f096e2094c363d6465a02c7f5fe7c2744bcc | cb0a2da55cec590f67738ca60700f7c4da7583c9 | /src/Pension/model/DAO/reserveDAO.java | aa230e4d8036e0dc3ae8d8c7c5fd91e483148449 | [] | no_license | haein147/java_MVC_project | c7ca89798d12605016e42360ce1e334068845af5 | 9e3ead9bf64907fb6c641daf76a0a5657ff5a0de | refs/heads/master | 2020-04-27T16:16:18.743643 | 2019-03-08T06:11:49 | 2019-03-08T06:11:49 | 174,479,225 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 5,298 | java | package Pension.model.DAO;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import Pension.model.DTO.payDTO;
import Pension.model.DTO.reserveDTO;
import Pension.model.util.DBUtil;
/*CREATE TABLE reserve (
reserve_no NUMBER(5) PRIMARY KEY,
customer_name VARCHAR2(10) NOT NULL,
reserve_date DATE NOT NULL,
reserve_how VARCHAR2(30) NOT NULL,
room_name VARCHAR2(20) NOT NULL,
pay_no NUMBER(5) NOT NULL
);*/
public class reserveDAO {
public static reserveDTO getReserve(int reserveNo) throws SQLException {
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rset = null;
reserveDTO user = null;
try {
con = DBUtil.getConnection();
pstmt = con.prepareStatement("select * from reserve where reserve_no =?");
pstmt.setInt(1, reserveNo);
rset = pstmt.executeQuery();
if (rset.next()) {
user = new reserveDTO(rset.getInt(1), rset.getString(2), rset.getDate(3), rset.getString(4),
rset.getString(5), rset.getInt(6));
}
} catch (SQLException s) {
s.printStackTrace();
throw s;
} finally {
DBUtil.close(con, pstmt, rset);
}
return user;
}
// ์์ฝ ์ถ๊ฐ
public static boolean addReserve(int reserveNo,String customerName, String reserveDate, String reserveHow, String roomName, int payNo ) throws SQLException {
Connection con = null;
PreparedStatement pstmt = null;
try {
con = DBUtil.getConnection();
pstmt = con.prepareStatement("insert into reserve values(?, ?,?,?,?,?)");
pstmt.setInt(1, reserveNo);
pstmt.setString(2, customerName);
pstmt.setString(3, reserveDate);
pstmt.setString(4, reserveHow);
pstmt.setString(5, roomName);
pstmt.setInt(6, payNo);
int result = pstmt.executeUpdate();
if (result == 1) {
return true;
}
} catch (SQLException s) {
s.printStackTrace();
throw s;
}finally{
DBUtil.close(con, pstmt);
}
return false;
}
// ์์ฝ name์ผ๋ก ๋ฐฉ ๋ณ๊ฒฝ
public static boolean updateRoomName(String roomName, String customerName) throws SQLException {
Connection con = null;
PreparedStatement pstmt = null;
try {
con = DBUtil.getConnection();
pstmt = con.prepareStatement("update reserve set room_name = ? where customer_name = ?");
pstmt.setString(1, roomName);
pstmt.setString(2, customerName);
int result = pstmt.executeUpdate();
if (result == 1) {
return true;
}
} catch (SQLException s) {
s.printStackTrace();
throw s;
}finally{
DBUtil.close(con, pstmt);
}
return false;
}
public static boolean updatePayNo(String price, String customerName) throws SQLException {
Connection con = null;
PreparedStatement pstmt = null;
try {
con = DBUtil.getConnection();
pstmt = con.prepareStatement("update pay set price = ? "
+ "where payNo = (select payNo from reserve where customer_name = ?)");
pstmt.setString(1, price);
pstmt.setString(2, customerName);
int result = pstmt.executeUpdate();
if (result == 1) {
return true;
}
} catch (SQLException s) {
s.printStackTrace();
throw s;
}finally{
DBUtil.close(con, pstmt);
}
return false;
}
// ์์ฝ no๋ก ์์ฝ ์ทจ์
public static boolean deletePensionReserve(int reserveNo) throws SQLException {
Connection con = null;
PreparedStatement pstmt = null;
try {
con = DBUtil.getConnection();
pstmt = con.prepareStatement("delete from reserve where reserve_no=?");
pstmt.setInt(1, reserveNo);
int result = pstmt.executeUpdate();
if (result == 1) {
return true;
}
} catch (SQLException s) {
s.printStackTrace();
throw s;
} finally {
DBUtil.close(con, pstmt);
}
return false;
}
// ์์ฝ์ ๋ช
์ผ๋ก ์์ฝํ
์ด๋ธ ๊ฒ์
public static reserveDTO selectReserveName(String customerName) throws SQLException {
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rset = null;
reserveDTO user = null;
try {
con = DBUtil.getConnection();
pstmt = con.prepareStatement("select * from reserve where customer_name =?");
pstmt.setString(1, customerName);
rset = pstmt.executeQuery();
if (rset.next()) {
user = new reserveDTO(rset.getInt(1), rset.getString(2), rset.getDate(3), rset.getString(4),
rset.getString(5), rset.getInt(6));
}
} catch (SQLException s) {
s.printStackTrace();
throw s;
} finally {
DBUtil.close(con, pstmt, rset);
}
return user;
}
// ๋ชจ๋ ์์ฝ ๊ฒ์
public static ArrayList<reserveDTO> getAllReserve() throws SQLException {
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rset = null;
ArrayList<reserveDTO> list = null;
try {
con = DBUtil.getConnection();
pstmt = con.prepareStatement("select * from reserve");
rset = pstmt.executeQuery();
list = new ArrayList<reserveDTO>();
while (rset.next()) {
list.add(new reserveDTO(rset.getInt(1), rset.getString(2), rset.getDate(3), rset.getString(4),
rset.getString(5), rset.getInt(6)));
}
} catch (SQLException s) {
s.printStackTrace();
throw s;
} finally {
DBUtil.close(con, pstmt, rset);
}
return list;
}
}
| [
"dlgodls147@gmail.com"
] | dlgodls147@gmail.com |
9e1f615e7e4eb6b06e0d572bf3545a995f0988a6 | e211b6ddad463bd64bf132c7deb9c6f0788d0d5c | /app/src/main/java/io/github/vzer/sharevegetable/mine/activity/WalletActivity.java | 13cbd007ee61c5e20e990c0a75b54adc9c49facd | [] | no_license | LRdeath/QingVegetable | 8d2d8b2c6a76791513987f2f0f6d42227a83c4a8 | 0d4bbf7c71f2071d2dade271e7aab16fd4c56d56 | refs/heads/master | 2021-01-01T18:20:36.175534 | 2017-08-23T08:12:52 | 2017-08-23T08:12:52 | 98,312,836 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,793 | java | package io.github.vzer.sharevegetable.mine.activity;
import android.content.Intent;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import butterknife.BindView;
import butterknife.OnClick;
import io.github.vzer.common.app.ActivityPresenter;
import io.github.vzer.factory.presenter.mine.WalletContract;
import io.github.vzer.factory.presenter.mine.WalletPresenter;
import io.github.vzer.sharevegetable.R;
/**
* ้ฑๅ
่ฏฆๆ
*
* @author YangCihang
* @since 17/8/21.
* email yangcihang@hrsoft.net
*/
public class WalletActivity extends ActivityPresenter<WalletContract.Presenter>
implements WalletContract.View {
@BindView(R.id.img_back)
ImageView backImg;
@BindView(R.id.ly_recharge)
RelativeLayout rechargeLy;
@BindView(R.id.ly_wallet_order)
RelativeLayout orderLy;
@Override
public void showError(int strId) {
}
@Override
public void showLoading() {
}
@Override
public WalletContract.Presenter initPresenter() {
return new WalletPresenter(this);
}
@Override
public void initWidget() {
}
@Override
protected void initWindows() {
}
@Override
protected void initData() {
}
@Override
protected int getContentLayoutId() {
return R.layout.activity_wallet;
}
/**
* ็นๅป่ฟๅ
*/
@OnClick(R.id.img_back)
void onBackClicked() {
this.finish();
}
/**
* ็นๅปๅ
ๅผ
*/
@OnClick(R.id.ly_recharge)
void onRecharge() {
startActivity(new Intent(this, RechargeActivity.class));
}
/**
* ็นๅปๆฅ็ไบคๆ่ฏฆๆ
*/
@OnClick(R.id.ly_wallet_order)
void onOrder() {
startActivity(new Intent(this, WalletOrderActivity.class));
}
}
| [
"yangcihang@hrsoft.net"
] | yangcihang@hrsoft.net |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.