blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 7
332
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
50
| license_type
stringclasses 2
values | repo_name
stringlengths 7
115
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 557
values | visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
684M
⌀ | star_events_count
int64 0
77.7k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 17
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 82
values | src_encoding
stringclasses 28
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 7
5.41M
| extension
stringclasses 11
values | content
stringlengths 7
5.41M
| authors
listlengths 1
1
| author
stringlengths 0
161
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d467b3ea7e12d7f9e97d19529212c62d8cac007b
|
b965158342b979c24c3e56f7acc0d747fe218eb7
|
/ViewPager/app/src/test/java/com/karengryg/viewpager/ExampleUnitTest.java
|
3e4012d293748cef3253271510fc39a65f19f5f7
|
[] |
no_license
|
KGRYG/android-demo
|
1e1307f60c54c3b099c7ec952ba2387b0883ed87
|
57990a81b1981c742b7bcb662d6a724e3ef1d13a
|
refs/heads/master
| 2022-12-16T17:05:43.152344 | 2018-01-05T16:41:11 | 2018-01-05T16:41:11 | 112,139,982 | 0 | 1 | null | 2022-11-23T19:40:08 | 2017-11-27T02:57:39 |
Java
|
UTF-8
|
Java
| false | false | 401 |
java
|
package com.karengryg.viewpager;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
|
[
"[email protected]"
] | |
1a58ae15f8229a7c3a05e426e826394f87e46362
|
1a9675b5c51e63e1d9e5121df3ca85d5a1824b96
|
/src/main/java/com/spr3nk3ls/telegram/bot/AbstractBot.java
|
6db6195c4682230db71c4a8099fd1487eb3db5d7
|
[] |
no_license
|
spr3nk3ls/telegrambots
|
912935ade7db3cfdf27336614f3dfc4f12cef413
|
ea0332ca477a0b42705f6b170e8340dec2c7adcb
|
refs/heads/master
| 2020-03-21T23:42:06.483238 | 2018-08-03T14:33:21 | 2018-08-03T14:33:21 | 139,201,637 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,391 |
java
|
package com.spr3nk3ls.telegram.bot;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestStreamHandler;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.telegram.telegrambots.api.methods.send.SendMessage;
import org.telegram.telegrambots.api.objects.Message;
import org.telegram.telegrambots.api.objects.Update;
import org.telegram.telegrambots.api.objects.User;
import org.telegram.telegrambots.bots.AbsSender;
import org.telegram.telegrambots.exceptions.TelegramApiException;
import java.io.*;
import static com.vsubhuman.telegram.TelegramFactory.sender;
import static java.lang.System.getenv;
public abstract class AbstractBot implements RequestStreamHandler {
private static final ObjectMapper MAPPER = new ObjectMapper();
// Init the util that will send messages for us
private static final AbsSender SENDER = sender(getenv("bot_token"), getenv("bot_username"));
protected AbstractBot() {
}
@Override
public void handleRequest(InputStream input, OutputStream output, Context context) throws IOException {
Update update;
try {
update = MAPPER.readValue(input, Update.class);
} catch (Exception e) {
System.err.println("Failed to parse update: " + e);
throw new RuntimeException("Failed to parse update!", e);
}
System.out.println("Starting handling update " + update.getUpdateId());
System.out.println("Starting handling update " + update);
try {
handleUpdate(update);
} catch (Exception e) {
System.err.println("Failed to handle update: " + e);
throw new RuntimeException("Failed to handle update!", e);
}
System.out.println("Finished handling update " + update.getUpdateId());
}
private void handleUpdate(Update update) throws Exception {
Message message = update.getMessage();
if (message == null) {
return;
}
String responseText;
if(isGroupAdd(message)){
responseText = handleGroupAdd(message);
} else if(message.isGroupMessage() || message.isSuperGroupMessage()){
responseText = handleGroupResponse(message);
} else {
responseText = handlePrivateResponse(message);
}
if(responseText != null) {
sendMessage(message.getChatId(), responseText);
}
}
protected void sendMessage(Long chatId, String responseText) {
SendMessage sendMessage = new SendMessage()
.setChatId(chatId)
.setText(responseText);
System.out.println("Sending message: " + sendMessage);
try {
Message message = SENDER.execute(sendMessage);
System.out.println("Message sent: " + message);
} catch (Exception e) {
System.err.println("Failed to send mesage: " + e);
throw new RuntimeException("Failed to send message!", e);
}
}
protected boolean isGroupAdd(Message message){
if((message.isGroupMessage() || message.isSuperGroupMessage())
&& ((message.getGroupchatCreated() != null && message.getGroupchatCreated()) ||
(message.getNewChatMembers() != null
&& !message.getNewChatMembers().isEmpty()
&& message.getNewChatMembers().stream().map(User::getUserName).anyMatch(x -> x.equals("blikbierbot"))))){
return true;
}
return false;
}
protected abstract String handleGroupAdd(Message message);
protected abstract String handlePrivateResponse(Message message);
protected abstract String handleGroupResponse(Message message);
protected AbsSender getSender(){
return SENDER;
}
}
|
[
"[email protected]"
] | |
ae0b8dc2b21961aa729a2facf8c1815b41b23f67
|
af7adffd6af90284d69f68cdfd1625021c823006
|
/Week_07/week-work/src/main/java/com/lzc/weekwork/week7/Test.java
|
6b3164892d91b8ac05ba4ed50d07fc3f8ff598a0
|
[] |
no_license
|
w350727743/JAVA-01
|
1dd5c2b2f956f2af8fde84a947592ebbb8bda9a3
|
799a606f3ca85a9026c9145d69bdae997a962420
|
refs/heads/main
| 2023-04-27T01:34:21.614099 | 2021-05-14T09:01:29 | 2021-05-14T09:01:29 | 327,349,172 | 0 | 0 | null | 2021-01-06T15:14:57 | 2021-01-06T15:14:56 | null |
UTF-8
|
Java
| false | false | 999 |
java
|
package com.lzc.weekwork.week7;
import com.google.common.collect.Lists;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
/**
* @author:luzaichun
* @Date:2021/5/4
* @Time:17:22
**/
public class Test {
public static void main(String[] args) {
List<Integer> orderIdList = IntStream.rangeClosed(1, 500000).boxed().collect(Collectors.toList());
List<List<Integer>> lists = Lists.partition(orderIdList, 100000);
CopyOnWriteArraySet<Integer> set = new CopyOnWriteArraySet<>();
lists.parallelStream().forEach(s->{
for (Integer integer : s) {
if (set.contains(integer)){
System.err.println(integer);
}
set.add(integer);
}
});
System.out.println("====");
}
}
|
[
"[email protected]"
] | |
42cd3b227538200fb716207dabd6ac481f6e29c7
|
3aef8659ec225b1a137fb37e6cf12bb04cb03eac
|
/services/accesscontrol-ejb/src/main/java/org/dejava/service/accesscontrol/model/User.java
|
d554143d3cd0fb4f0a9cfaaa809b5090208c9d54
|
[] |
no_license
|
rvcoutinho/dejava
|
20eec232a91d8b59e1bd26c6095fbf15520e4977
|
f469fbf6f9ad530ab46ea552ae6e62e146be6a4c
|
refs/heads/master
| 2016-09-05T20:09:45.738539 | 2014-06-14T14:15:23 | 2014-06-14T14:16:39 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 9,948 |
java
|
package org.dejava.service.accesscontrol.model;
import java.util.ArrayList;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.dejava.component.ejb.entity.AbstractIdentifiedEntity;
import org.dejava.component.i18n.source.annotation.MessageSource;
import org.dejava.component.i18n.source.annotation.MessageSources;
import org.dejava.service.accesscontrol.model.credentials.Credentials;
import org.dejava.service.accesscontrol.model.credentials.Password;
import org.dejava.service.accesscontrol.model.principal.Email;
import org.dejava.service.accesscontrol.model.principal.Facebook;
import org.dejava.service.accesscontrol.model.principal.Name;
import org.dejava.service.accesscontrol.model.principal.Principal;
/**
* Represents a system user.
*/
@Entity
@Table(name = "u5er")
@MessageSources(sources = {
@MessageSource(sourcePath = "../service-properties/src/main/resources", bundleBaseName = "org.dejava.service.accesscontrol.properties.model", entriesAffix = {
"", ".description" }, processors = { "org.dejava.component.i18n.source.processor.impl.PublicGettersEntryProcessor" }),
@MessageSource(sourcePath = "../service-properties/src/main/resources", bundleBaseName = "org.dejava.service.accesscontrol.properties.error", processors = { "org.dejava.component.i18n.source.processor.impl.GetterConstraintEntryProcessor" }) })
public class User extends AbstractIdentifiedEntity {
/**
* Generated serial.
*/
private static final long serialVersionUID = -2762159417756393897L;
/**
* Gets the object (first found) from the given collection with the desired type.
*
* @param <Type>
* Type of the object being searched.
* @param collection
* Collection to search the object from.
* @param type
* The type for the searched object.
* @return The object (first found) from the given collection with the desired type. Or null, if no object
* exists for the given type.
*/
@Transient
@SuppressWarnings("unchecked")
private <Type> Type getObjectByClass(final Collection<?> collection, final Class<Type> type) {
// If the collection is not null.
if (collection != null) {
// For each object in the collection.
for (final Object currentObject : collection) {
// If the current object is not null.
if (currentObject != null) {
// If the object is an instance from the class.
if (currentObject.getClass().equals(type)) {
// Returns the current object.
return (Type) currentObject;
}
}
}
}
// If no object is found, return null.
return null;
}
/**
* Principals for this user.
*/
private Collection<Principal> principals;
/**
* Gets the principals for this user.
*
* @return The principals for this user.
*/
@OneToMany(mappedBy = "user", cascade = { CascadeType.ALL }, fetch = FetchType.EAGER, orphanRemoval = true)
public Collection<Principal> getPrincipals() {
// If the collection is null.
if (principals == null) {
// Creates a new list for the collection.
principals = new ArrayList<>();
}
// Returns the collection.
return principals;
}
/**
* Gets the principal with the given type (there should not be more than an object for given type).
*
* @param <ConcretePrincipal>
* A concrete principal type.
* @param principalType
* The type for the principal being searched.
* @return The principal with the given type (there should not be more than an object for given type).
*/
@Transient
public <ConcretePrincipal extends Principal> ConcretePrincipal getPrincipal(
final Class<ConcretePrincipal> principalType) {
// Returns the principal with the given type.
return getObjectByClass(getPrincipals(), principalType);
}
/**
* Sets the principals for this user.
*
* @param principals
* New principals for this user.
* @param updateRelationship
* If the relationship of the given principals should be updated.
*/
public void setPrincipals(final Collection<Principal> principals, final Boolean updateRelationship) {
// If there are principals (and they should be updated).
if ((principals != null) && (updateRelationship)) {
// For each principal.
for (final Principal currentPrincipal : principals) {
// Sets the user for the current principal.
currentPrincipal.setUser(this);
}
}
// Sets the principals.
this.principals = principals;
}
/**
* Sets the principals for this user.
*
* @param principals
* New principals for this user.
*/
public void setPrincipals(final Collection<Principal> principals) {
setPrincipals(principals, false);
}
/**
* Adds a principal to the user.
*
* @param principal
* Principal to be added to the user.
*/
public void addPrincipal(final Principal principal) {
// If the principal is not null.
if (principal != null) {
// Sets the user for the principal.
principal.setUser(this);
// Adds the principal to the user.
getPrincipals().add(principal);
}
}
/**
* Gets the user name.
*
* @return The user name.
*/
@Transient
public String getName() {
// Gets the user name (principal).
final Name name = getPrincipal(Name.class);
// If there is no user name.
if (name == null) {
// Returns null.
return null;
}
// If there is a user name.
else {
// Returns the user name.
return name.getName();
}
}
/**
* Credentials for this user.
*
*/
private Collection<Credentials> credentials;
/**
* Gets the credentials for this user.
*
* @return The credentials for this user.
*/
@OneToMany(mappedBy = "user", cascade = { CascadeType.ALL }, orphanRemoval = true)
public Collection<Credentials> getCredentials() {
// If the collection is null.
if (credentials == null) {
// Creates a new list for the collection.
credentials = new ArrayList<>();
}
// Returns the collection.
return credentials;
}
/**
* Gets the credentials with the given type (there should not be more than an object for given type).
*
* @param <ConcreteCredentials>
* A concrete credentials type.
* @param credentialsType
* The type for the credentials being searched.
* @return The credentials with the given type (there should not be more than an object for given type).
*/
@Transient
public <ConcreteCredentials extends Credentials> ConcreteCredentials getCredentials(
final Class<ConcreteCredentials> credentialsType) {
// Returns the credentials with the given type.
return getObjectByClass(getCredentials(), credentialsType);
}
/**
* Sets the credentials for this user.
*
* @param credentials
* New credentials for this user.
* @param updateRelationship
* If the relationship of the given principals should be updated.
*/
public void setCredentials(final Collection<Credentials> credentials, final Boolean updateRelationship) {
// If there are credentials (and they should be updated).
if ((credentials != null) && updateRelationship) {
// For each credentials.
for (final Credentials currentCredentials : credentials) {
// Sets the user for the current credentials.
currentCredentials.setUser(this);
}
}
// Sets the credentials.
this.credentials = credentials;
}
/**
* Sets the credentials for this user.
*
* @param credentials
* New credentials for this user.
*/
public void setCredentials(final Collection<Credentials> credentials) {
setCredentials(credentials, false);
}
/**
* Adds credentials to the user.
*
* @param credentials
* Credentials to be added to the user.
*/
public void addCredentials(final Credentials credentials) {
// If the credentials are not null.
if (credentials != null) {
// Sets the user for the credentials.
credentials.setUser(this);
// Adds the credentials to the user.
getCredentials().add(credentials);
}
}
/**
* Default constructor.
*/
public User() {
super();
}
/**
* Default constructor.
*
* @param identifier
* The user identifier.
*/
public User(final Integer identifier) {
super();
// Sets the user identifier.
setIdentifier(identifier);
}
/**
* Creates a new user with the given name and password.
*
* @param name
* Name of the user.
* @param email
* Email of the user.
* @param rawPassword
* Password of the user.
*/
public User(final String name, final String email, final String rawPassword) {
// Adds the name to the user principals.
addPrincipal(new Name(name));
// Adds the email to the user principals.
addPrincipal(new Email(email));
// Adds the password to the user credentials.
addCredentials(new Password(rawPassword));
}
/**
* Creates a new user with the facebook user information.
*
* @param facebookUser
* Facebook user information.
*/
public User(final com.restfb.types.User facebookUser) {
// If the facebook user is given.
if (facebookUser != null) {
// If there is a given user name.
if ((facebookUser.getUsername() != null) && (!facebookUser.getUsername().isEmpty())) {
// Adds the name to the user principals.
addPrincipal(new Name(facebookUser.getUsername()));
}
// If there is a given email.
if ((facebookUser.getEmail() != null) && (!facebookUser.getEmail().isEmpty())) {
// Adds the email to the user principals.
addPrincipal(new Email(facebookUser.getEmail()));
}
// Adds the facebook id to the user principals.
addPrincipal(new Facebook(facebookUser.getId()));
}
}
/**
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
// FIXME
return null;
}
}
|
[
"[email protected]"
] | |
5a0b95e0746b3010a399f89c3931bbebe3d0f568
|
62734194ba9276d640a029f661799b82864da89a
|
/src/main/java/com/gewei/model/UserRole.java
|
a69569c1597bef94cd9e68a653e9b5ca82543999
|
[
"MIT"
] |
permissive
|
gw-mgr/gw-mgr
|
c4ade01e17a0332b11c6cc9b544574eac993caa4
|
c530d02d909c69a223afb6427d7714df7f5780fa
|
refs/heads/master
| 2020-03-10T18:38:14.279845 | 2018-04-19T13:01:46 | 2018-04-19T13:01:46 | 129,530,325 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 820 |
java
|
package com.gewei.model;
import java.io.Serializable;
import com.gewei.commons.utils.JsonUtils;
/**
* 用户角色
*/
public class UserRole implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
private Long id;
/**
* 用户id
*/
private String userId;
/**
* 角色id
*/
private Long roleId;
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public String getUserId() {
return this.userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public Long getRoleId() {
return this.roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
@Override
public String toString() {
return JsonUtils.toJson(this);
}
}
|
[
"[email protected]"
] | |
70743b42b0902cb992b45b9db9122eca9e3f06f3
|
58efea6e22eff1169031f21dbb2d2ff6e297bf50
|
/src/co/edu/icesi/activitytopeopleupdater/peoplenet/dao/M4ccbCvCapLibJpaController.java
|
8f3e9fbb20fee32464764279aca5935710a0edf3
|
[] |
no_license
|
DesarrolloWebIcesi/ActivityToPeopleUpdater
|
99a77c735a631746f0301698cca16f100caf565d
|
62cdd23002d85d6bd66947ef2a6e8be281fe415b
|
refs/heads/master
| 2021-01-15T18:14:26.993872 | 2015-01-16T21:40:34 | 2015-01-16T21:40:34 | 26,455,197 | 0 | 2 | null | 2015-01-27T20:05:28 | 2014-11-10T20:53:32 |
Java
|
UTF-8
|
Java
| false | false | 6,765 |
java
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package co.edu.icesi.activitytopeopleupdater.peoplenet.dao;
import co.edu.icesi.activitytopeopleupdater.peoplenet.dao.exceptions.NonexistentEntityException;
import co.edu.icesi.activitytopeopleupdater.peoplenet.dao.exceptions.PreexistingEntityException;
import co.edu.icesi.activitytopeopleupdater.peoplenet.model.M4ccbCvCapLib;
import co.edu.icesi.activitytopeopleupdater.peoplenet.model.M4ccbCvCapLibPK;
import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
/**
*
* @author 38555240
*/
public class M4ccbCvCapLibJpaController implements Serializable {
public M4ccbCvCapLibJpaController(EntityManagerFactory emf) {
this.emf = emf;
}
private EntityManagerFactory emf = null;
public EntityManager getEntityManager() {
return emf.createEntityManager();
}
public void create(M4ccbCvCapLib m4ccbCvCapLib) throws PreexistingEntityException, Exception {
if (m4ccbCvCapLib.getM4ccbCvCapLibPK() == null) {
m4ccbCvCapLib.setM4ccbCvCapLibPK(new M4ccbCvCapLibPK());
}
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
em.persist(m4ccbCvCapLib);
em.getTransaction().commit();
} catch (Exception ex) {
if (findM4ccbCvCapLib(m4ccbCvCapLib.getM4ccbCvCapLibPK()) != null) {
throw new PreexistingEntityException("M4ccbCvCapLib " + m4ccbCvCapLib + " already exists.", ex);
}
throw ex;
} finally {
if (em != null) {
em.close();
}
}
}
public void edit(M4ccbCvCapLib m4ccbCvCapLib) throws NonexistentEntityException, Exception {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
m4ccbCvCapLib = em.merge(m4ccbCvCapLib);
em.getTransaction().commit();
} catch (Exception ex) {
String msg = ex.getLocalizedMessage();
if (msg == null || msg.length() == 0) {
M4ccbCvCapLibPK id = m4ccbCvCapLib.getM4ccbCvCapLibPK();
if (findM4ccbCvCapLib(id) == null) {
throw new NonexistentEntityException("The m4ccbCvCapLib with id " + id + " no longer exists.");
}
}
throw ex;
} finally {
if (em != null) {
em.close();
}
}
}
public void destroy(M4ccbCvCapLibPK id) throws NonexistentEntityException {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
M4ccbCvCapLib m4ccbCvCapLib;
try {
m4ccbCvCapLib = em.getReference(M4ccbCvCapLib.class, id);
m4ccbCvCapLib.getM4ccbCvCapLibPK();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The m4ccbCvCapLib with id " + id + " no longer exists.", enfe);
}
em.remove(m4ccbCvCapLib);
em.getTransaction().commit();
} finally {
if (em != null) {
em.close();
}
}
}
public List<M4ccbCvCapLib> findM4ccbCvCapLibEntities() {
return findM4ccbCvCapLibEntities(true, -1, -1);
}
public List<M4ccbCvCapLib> findM4ccbCvCapLibEntities(int maxResults, int firstResult) {
return findM4ccbCvCapLibEntities(false, maxResults, firstResult);
}
private List<M4ccbCvCapLib> findM4ccbCvCapLibEntities(boolean all, int maxResults, int firstResult) {
EntityManager em = getEntityManager();
try {
CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
cq.select(cq.from(M4ccbCvCapLib.class));
Query q = em.createQuery(cq);
if (!all) {
q.setMaxResults(maxResults);
q.setFirstResult(firstResult);
}
return q.getResultList();
} finally {
em.close();
}
}
public M4ccbCvCapLib findM4ccbCvCapLib(M4ccbCvCapLibPK id) {
EntityManager em = getEntityManager();
try {
return em.find(M4ccbCvCapLib.class, id);
} finally {
em.close();
}
}
public int getM4ccbCvCapLibCount() {
EntityManager em = getEntityManager();
try {
CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
Root<M4ccbCvCapLib> rt = cq.from(M4ccbCvCapLib.class);
cq.select(em.getCriteriaBuilder().count(rt));
Query q = em.createQuery(cq);
return ((Long) q.getSingleResult()).intValue();
} finally {
em.close();
}
}
public M4ccbCvCapLib findM4ccBActCapLibByCcbCargueAct(String activityId) {
EntityManager em=getEntityManager();
try{
TypedQuery<M4ccbCvCapLib> q= em.createNamedQuery("M4ccbCvCapLib.findByCcbCargueAct", M4ccbCvCapLib.class);
q.setParameter("ccbCargueAct", activityId);
M4ccbCvCapLib activity = q.getSingleResult();
return activity;
}catch(NoResultException | NonUniqueResultException ex){
throw ex;
}finally{
em.close();
}
}
/**
* Get tha max value of CCB_OR_CAP_LIB for an user-organization key
*
* @return The max value of CCB_OR_CAP_LIB,
* 1 if there are not result for the query
* @param stdIdHr PeopleNet user Id
* @param idOrganization PeopleNet organization id most of time is "0000"
*/
public short getMaxCcbOrActCapLib(String stdIdHr, String idOrganization){
EntityManager em=getEntityManager();
try{
Query q=em.createQuery("select max(m.m4ccbCvCapLibPK.ccbOrCapLib) "+
"from M4ccbCvCapLib m "+
"where m.m4ccbCvCapLibPK.stdIdHr = :stdIdHr "+
"and m.m4ccbCvCapLibPK.idOrganization = :idOrganization");
q.setParameter("stdIdHr", stdIdHr);
q.setParameter("idOrganization", idOrganization);
Object maxObject= q.getSingleResult();
if(maxObject==null){
return 0;
}
return (Short)maxObject;
}catch(NoResultException ex){
//if there are no registries, this is the first one.
return 0;
}
}
}
|
[
"[email protected]"
] | |
9f11e467332b5688570f61417a92de4f9d65fff0
|
40665051fadf3fb75e5a8f655362126c1a2a3af6
|
/eclipse-jubula.core/0d287c2f09997e47901e24e65515129a474839dd/561/OMLogicNameGUIPropertySource.java
|
4972406af4120ae9595b9c8e0bb09ad0e94b0fee
|
[] |
no_license
|
fermadeiral/StyleErrors
|
6f44379207e8490ba618365c54bdfef554fc4fde
|
d1a6149d9526eb757cf053bc971dbd92b2bfcdf1
|
refs/heads/master
| 2020-07-15T12:55:10.564494 | 2019-10-24T02:30:45 | 2019-10-24T02:30:45 | 205,546,543 | 2 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 7,741 |
java
|
/*******************************************************************************
* Copyright (c) 2004, 2010 BREDEX GmbH.
* 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:
* BREDEX GmbH - initial API and implementation and/or initial documentation
*******************************************************************************/
package org.eclipse.jubula.client.ui.rcp.controllers.propertysources;
import org.eclipse.jubula.client.core.businessprocess.IComponentNameCache;
import org.eclipse.jubula.client.core.businessprocess.ProjectNameBP;
import org.eclipse.jubula.client.core.model.IComponentNamePO;
import org.eclipse.jubula.client.core.model.IProjectPO;
import org.eclipse.jubula.client.core.persistence.GeneralStorage;
import org.eclipse.jubula.client.core.persistence.ProjectPM;
import org.eclipse.jubula.client.ui.constants.IconConstants;
import org.eclipse.jubula.client.ui.rcp.Plugin;
import org.eclipse.jubula.client.ui.rcp.controllers.propertydescriptors.JBPropertyDescriptor;
import org.eclipse.jubula.client.ui.rcp.i18n.Messages;
import org.eclipse.jubula.client.ui.rcp.provider.labelprovider.PropertyControllerLabelProvider;
import org.eclipse.jubula.tools.internal.constants.StringConstants;
import org.eclipse.jubula.tools.internal.exception.JBException;
import org.eclipse.jubula.tools.internal.i18n.CompSystemI18n;
import org.eclipse.swt.graphics.Image;
/**
* @author BREDEX GmbH
* @created 21.04.2005
*/
@SuppressWarnings("synthetic-access")
public class OMLogicNameGUIPropertySource
extends AbstractPropertySource<IComponentNamePO> {
/** Property m_text on display */
public static final String P_ELEMENT_DISPLAY_COMPNAME =
Messages.OMLogicNameGUIPropertySourceComponentName;
/** Property m_text on display */
public static final String P_ELEMENT_DISPLAY_COMPTYPE =
Messages.OMLogicNameGUIPropertySourceCompType;
/** Label for parent project property */
public static final String P_ELEMENT_DISPLAY_PARENTPROJECT =
Messages.OMLogicNameGUIPropertySourceParentProject;
/** Constant for Category Component */
public static final String P_COMPONENT_CAT =
Messages.OMLogicNameGUIPropertySourceComponent;
/**
* Constructor
*
* @param compName The Component Name from which properties are obtained.
*/
public OMLogicNameGUIPropertySource(IComponentNamePO compName) {
super(compName);
initPropDescriptor();
}
/**
* Inits the PropertyDescriptors
*/
protected void initPropDescriptor() {
clearPropertyDescriptors();
JBPropertyDescriptor propDes = null;
// Component Name
propDes = new JBPropertyDescriptor(
new ComponentNameController(), P_ELEMENT_DISPLAY_COMPNAME);
propDes.setCategory(P_COMPONENT_CAT);
propDes.setLabelProvider(new PropertyControllerLabelProvider());
addPropertyDescriptor(propDes);
// Component Type
propDes = new JBPropertyDescriptor(
new ComponentTypeController(), P_ELEMENT_DISPLAY_COMPTYPE);
propDes.setCategory(P_COMPONENT_CAT);
propDes.setLabelProvider(new PropertyControllerLabelProvider());
addPropertyDescriptor(propDes);
// Parent Project
propDes = new JBPropertyDescriptor(
new ParentProjectController(), P_ELEMENT_DISPLAY_PARENTPROJECT);
propDes.setCategory(P_COMPONENT_CAT);
propDes.setLabelProvider(new PropertyControllerLabelProvider());
addPropertyDescriptor(propDes);
}
/**
* {@inheritDoc}
*/
public boolean isPropertySet(Object id) {
boolean isPropSet = false;
return isPropSet;
}
/**
* Class to control component name.
* @author BREDEX GmbH
* @created 07.01.2005
*/
private class ComponentNameController extends AbstractPropertyController {
/**
* {@inheritDoc}
*/
public boolean setProperty(Object value) {
return true;
}
/**
* {@inheritDoc}
*/
public Object getProperty() {
IComponentNamePO compName = getNode();
IComponentNameCache compCache = Plugin.getActiveCompCache();
compName = compCache.getResCompNamePOByGuid(compName.getGuid());
if (compName != null && compName.getName() != null) {
return compName.getName();
}
return StringConstants.EMPTY;
}
/**
* {@inheritDoc}
*/
public Image getImage() {
return IconConstants.LOGICAL_NAME_IMAGE;
}
}
/**
* Class to control component name.
* @author BREDEX GmbH
* @created 07.01.2005
*/
private class ComponentTypeController extends AbstractPropertyController {
/**
* {@inheritDoc}
*/
public boolean setProperty(Object value) {
return true;
}
/**
* {@inheritDoc}
*/
public Object getProperty() {
IComponentNamePO compName = getNode();
IComponentNameCache compCache = Plugin.getActiveCompCache();
compName = compCache.getResCompNamePOByGuid(compName.getGuid());
if (compName != null && compName.getComponentType() != null) {
return CompSystemI18n.getString(
compName.getComponentType(), true);
}
return StringConstants.EMPTY;
}
/**
* {@inheritDoc}
*/
public Image getImage() {
return DEFAULT_IMAGE;
}
}
/**
* Class to control parent project.
* @author BREDEX GmbH
* @created 07.01.2005
*/
private class ParentProjectController extends AbstractPropertyController {
/**
* {@inheritDoc}
*/
public boolean setProperty(Object value) {
return true;
}
/**
* {@inheritDoc}
*/
public Object getProperty() {
IComponentNamePO compName = getNode();
Long parentProjectId = compName.getParentProjectId();
IProjectPO currentProject = GeneralStorage.getInstance()
.getProject();
if (currentProject != null) {
Long currentProjectId = currentProject.getId();
String parentProjectGuid = null;
if (parentProjectId == null
|| parentProjectId.equals(currentProjectId)) {
parentProjectGuid = currentProject.getGuid();
} else {
try {
parentProjectGuid = ProjectPM
.getGuidOfProjectId(compName
.getParentProjectId());
} catch (JBException e) {
// No problem. We just won't be able to show the
// parent project.
}
}
if (parentProjectGuid != null) {
return ProjectNameBP.getInstance().getName(
parentProjectGuid);
}
}
return Messages.OMLogicNameGUIPropertySourceUnknownParentProject;
}
/**
* {@inheritDoc}
*/
public Image getImage() {
return DEFAULT_IMAGE;
}
}
}
|
[
"[email protected]"
] | |
ba9b02595dc9befe419eb87b5bf7eefdb78c920f
|
cbbe0916357c1e0ead870ed7ac5909680e30cc91
|
/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/MetadataCacheTest.java
|
6f0d39fe0797ffcedee29ee87d49eb6dcde53ab8
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown",
"Zlib",
"LicenseRef-scancode-protobuf",
"BSD-2-Clause"
] |
permissive
|
Renkai/pulsar
|
35f448dcea7b96134fbff2cc0c7ff2223ccbc9ca
|
f711969960a143489d0ac8f2b48b8950f2754ce5
|
refs/heads/master
| 2023-03-14T14:23:43.433880 | 2021-02-02T04:41:51 | 2021-02-02T04:41:51 | 288,925,982 | 0 | 0 |
Apache-2.0
| 2021-02-02T08:13:22 | 2020-08-20T06:32:19 |
Java
|
UTF-8
|
Java
| false | false | 10,878 |
java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.pulsar.metadata;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
import com.fasterxml.jackson.core.type.TypeReference;
import java.util.Map;
import java.util.Optional;
import java.util.TreeMap;
import java.util.concurrent.CompletionException;
import lombok.AllArgsConstructor;
import lombok.Cleanup;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.pulsar.common.util.ObjectMapperFactory;
import org.apache.pulsar.metadata.api.MetadataCache;
import org.apache.pulsar.metadata.api.MetadataStore;
import org.apache.pulsar.metadata.api.MetadataStoreConfig;
import org.apache.pulsar.metadata.api.MetadataStoreException.AlreadyExistsException;
import org.apache.pulsar.metadata.api.MetadataStoreException.ContentDeserializationException;
import org.apache.pulsar.metadata.api.MetadataStoreException.NotFoundException;
import org.apache.pulsar.metadata.api.MetadataStoreFactory;
import org.testng.annotations.Test;
public class MetadataCacheTest extends BaseMetadataStoreTest {
@Data
@AllArgsConstructor
@NoArgsConstructor
static class MyClass {
String a;
int b;
}
@Test(dataProvider = "impl")
public void emptyCacheTest(String provider, String url) throws Exception {
@Cleanup
MetadataStore store = MetadataStoreFactory.create(url, MetadataStoreConfig.builder().build());
MetadataCache<MyClass> objCache = store.getMetadataCache(MyClass.class);
assertEquals(objCache.getIfCached("/non-existing-key"), Optional.empty());
assertEquals(objCache.getIfCached("/non-existing-key/child"), Optional.empty());
assertEquals(objCache.get("/non-existing-key").join(), Optional.empty());
assertEquals(objCache.get("/non-existing-key/child").join(), Optional.empty());
try {
objCache.delete("/non-existing-key").join();
fail("should have failed");
} catch (CompletionException e) {
assertEquals(e.getCause().getClass(), NotFoundException.class);
}
try {
objCache.delete("/non-existing-key/child").join();
fail("should have failed");
} catch (CompletionException e) {
assertEquals(e.getCause().getClass(), NotFoundException.class);
}
}
@Test(dataProvider = "impl")
public void insertionDeletionWitGenericType(String provider, String url) throws Exception {
@Cleanup
MetadataStore store = MetadataStoreFactory.create(url, MetadataStoreConfig.builder().build());
MetadataCache<Map<String, String>> objCache = store.getMetadataCache(new TypeReference<Map<String, String>>() {
});
String key1 = newKey();
assertEquals(objCache.getIfCached(key1), Optional.empty());
Map<String, String> v = new TreeMap<>();
v.put("a", "1");
v.put("b", "2");
objCache.create(key1, v).join();
assertEquals(objCache.getIfCached(key1), Optional.of(v));
assertEquals(objCache.get(key1).join(), Optional.of(v));
objCache.delete(key1).join();
assertEquals(objCache.getIfCached(key1), Optional.empty());
assertEquals(objCache.get(key1).join(), Optional.empty());
}
@Test(dataProvider = "impl")
public void insertionDeletion(String provider, String url) throws Exception {
@Cleanup
MetadataStore store = MetadataStoreFactory.create(url, MetadataStoreConfig.builder().build());
MetadataCache<MyClass> objCache = store.getMetadataCache(MyClass.class);
String key1 = newKey();
assertEquals(objCache.getIfCached(key1), Optional.empty());
MyClass value1 = new MyClass("a", 1);
objCache.create(key1, value1).join();
MyClass value2 = new MyClass("a", 2);
try {
objCache.create(key1, value2).join();
fail("should have failed to create");
} catch (CompletionException e) {
assertEquals(e.getCause().getClass(), AlreadyExistsException.class);
}
assertEquals(objCache.getIfCached(key1), Optional.of(value1));
assertEquals(objCache.get(key1).join(), Optional.of(value1));
objCache.delete(key1).join();
assertEquals(objCache.getIfCached(key1), Optional.empty());
assertEquals(objCache.get(key1).join(), Optional.empty());
}
@Test(dataProvider = "impl")
public void insertionOutsideCache(String provider, String url) throws Exception {
@Cleanup
MetadataStore store = MetadataStoreFactory.create(url, MetadataStoreConfig.builder().build());
MetadataCache<MyClass> objCache = store.getMetadataCache(MyClass.class);
String key1 = newKey();
MyClass value1 = new MyClass("a", 1);
store.put(key1, ObjectMapperFactory.getThreadLocal().writeValueAsBytes(value1), Optional.of(-1L)).join();
assertEquals(objCache.getIfCached(key1), Optional.empty());
assertEquals(objCache.get(key1).join(), Optional.of(value1));
}
@Test(dataProvider = "impl")
public void insertionOutsideCacheWithGenericType(String provider, String url) throws Exception {
@Cleanup
MetadataStore store = MetadataStoreFactory.create(url, MetadataStoreConfig.builder().build());
MetadataCache<Map<String, String>> objCache = store.getMetadataCache(new TypeReference<Map<String, String>>() {
});
String key1 = newKey();
Map<String, String> v = new TreeMap<>();
v.put("a", "1");
v.put("b", "2");
store.put(key1, ObjectMapperFactory.getThreadLocal().writeValueAsBytes(v), Optional.of(-1L)).join();
assertEquals(objCache.getIfCached(key1), Optional.empty());
assertEquals(objCache.get(key1).join(), Optional.of(v));
}
@Test(dataProvider = "impl")
public void invalidJsonContent(String provider, String url) throws Exception {
@Cleanup
MetadataStore store = MetadataStoreFactory.create(url, MetadataStoreConfig.builder().build());
MetadataCache<MyClass> objCache = store.getMetadataCache(MyClass.class);
String key1 = newKey();
store.put(key1, "-------".getBytes(), Optional.of(-1L)).join();
try {
objCache.get(key1).join();
fail("should have failed to deserialize");
} catch (CompletionException e) {
assertEquals(e.getCause().getClass(), ContentDeserializationException.class);
}
assertEquals(objCache.getIfCached(key1), Optional.empty());
}
@Test(dataProvider = "impl")
public void readModifyUpdate(String provider, String url) throws Exception {
@Cleanup
MetadataStore store = MetadataStoreFactory.create(url, MetadataStoreConfig.builder().build());
MetadataCache<MyClass> objCache = store.getMetadataCache(MyClass.class);
String key1 = newKey();
MyClass value1 = new MyClass("a", 1);
objCache.create(key1, value1).join();
objCache.readModifyUpdate(key1, v -> {
return new MyClass(v.a, v.b + 1);
}).join();
Optional<MyClass> newValue1 = objCache.get(key1).join();
assertTrue(newValue1.isPresent());
assertEquals(newValue1.get().a, "a");
assertEquals(newValue1.get().b, 2);
// Should fail if the key does not exist
try {
objCache.readModifyUpdate(newKey(), v -> {
return new MyClass(v.a, v.b + 1);
}).join();
} catch (CompletionException e) {
assertEquals(e.getCause().getClass(), NotFoundException.class);
}
}
@Test(dataProvider = "impl")
public void readModifyUpdateOrCreate(String provider, String url) throws Exception {
@Cleanup
MetadataStore store = MetadataStoreFactory.create(url, MetadataStoreConfig.builder().build());
MetadataCache<MyClass> objCache = store.getMetadataCache(MyClass.class);
String key1 = newKey();
objCache.readModifyUpdateOrCreate(key1, optValue -> {
if (optValue.isPresent()) {
return new MyClass(optValue.get().a, optValue.get().b + 1);
} else {
return new MyClass("a", 1);
}
}).join();
Optional<MyClass> newValue1 = objCache.get(key1).join();
assertTrue(newValue1.isPresent());
assertEquals(newValue1.get().a, "a");
assertEquals(newValue1.get().b, 1);
objCache.readModifyUpdateOrCreate(key1, optValue -> {
assertTrue(optValue.isPresent());
return new MyClass(optValue.get().a, optValue.get().b + 1);
}).join();
newValue1 = objCache.get(key1).join();
assertTrue(newValue1.isPresent());
assertEquals(newValue1.get().a, "a");
assertEquals(newValue1.get().b, 2);
}
/**
* This test validates that metadata-cache can handle BadVersion failure if other cache/metadata-source updates the
* data with different version.
*
* @throws Exception
*/
@Test
public void readModifyUpdateBadVersionRetry() throws Exception {
String url = zks.getConnectionString();
@Cleanup
MetadataStore sourceStore1 = MetadataStoreFactory.create(url, MetadataStoreConfig.builder().build());
MetadataStore sourceStore2 = MetadataStoreFactory.create(url, MetadataStoreConfig.builder().build());
MetadataCache<MyClass> objCache1 = sourceStore1.getMetadataCache(MyClass.class);
MetadataCache<MyClass> objCache2 = sourceStore2.getMetadataCache(MyClass.class);
String key1 = newKey();
MyClass value1 = new MyClass("a", 1);
objCache1.create(key1, value1).join();
objCache1.get(key1).join();
objCache2.readModifyUpdate(key1, v -> {
return new MyClass(v.a, v.b + 1);
}).join();
objCache1.readModifyUpdate(key1, v -> {
return new MyClass(v.a, v.b + 1);
}).join();
}
}
|
[
"[email protected]"
] | |
d8efecdf5ad02f2ca2caf6ac08516a76b5da070d
|
68b958b4a75f47914719d806e5d4e7ee1e757500
|
/src/simpl/parser/ast/Ref.java
|
139e81aaa560b89a6e63df6637cfb3d7657f71b3
|
[] |
no_license
|
linzebing/simPL
|
28e12297eff86e5465ef2d834eee0f8dec54dae5
|
cc0b693d3855cac3a57deaddfbcdc98257d1f823
|
refs/heads/master
| 2021-01-16T18:23:12.536306 | 2015-12-21T06:04:00 | 2015-12-21T06:04:00 | 47,447,031 | 1 | 3 | null | null | null | null |
UTF-8
|
Java
| false | false | 878 |
java
|
package simpl.parser.ast;
import simpl.interpreter.RefValue;
import simpl.interpreter.RuntimeError;
import simpl.interpreter.State;
import simpl.interpreter.Value;
import simpl.typing.RefType;
import simpl.typing.TypeEnv;
import simpl.typing.TypeError;
import simpl.typing.TypeResult;
public class Ref extends UnaryExpr {
public Ref(Expr e) {
super(e);
}
public String toString() {
return "(ref " + e + ")";
}
@Override
public TypeResult typecheck(TypeEnv E) throws TypeError {
TypeResult l_type = e.typecheck(E);
return TypeResult.of(l_type.s,new RefType(l_type.t));
}
@Override
public Value eval(State s) throws RuntimeError {
Value v = e.eval(s);
int current_p = s.p.get();
s.M.put(current_p, v);
s.p.set(current_p + 4);
return new RefValue(current_p);
}
}
|
[
"[email protected]"
] | |
9be690f46fee06dbe3bf5bc9208dc0401c1b92cd
|
dedd8b238961dbb6889a864884e011ce152d1d5c
|
/src/com/squareup/okhttp/Request$Builder.java
|
51890fdfbcebccd6c6788601bef4080f65dc9232
|
[] |
no_license
|
reverseengineeringer/gov.cityofboston.commonwealthconnect
|
d553a8a7a4fcd7b846eebadb6c1e3e9294919eb7
|
1a829995d5527f4d5798fa578ca1b0fe499839e1
|
refs/heads/master
| 2021-01-10T05:08:31.188375 | 2016-03-19T20:37:17 | 2016-03-19T20:37:17 | 54,285,966 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,079 |
java
|
package com.squareup.okhttp;
import com.squareup.okhttp.internal.http.HttpMethod;
import java.net.URL;
public class Request$Builder
{
private RequestBody body;
private Headers.Builder headers;
private String method;
private Object tag;
private URL url;
private String urlString;
public Request$Builder()
{
method = "GET";
headers = new Headers.Builder();
}
private Request$Builder(Request paramRequest)
{
urlString = Request.access$700(paramRequest);
url = Request.access$800(paramRequest);
method = Request.access$900(paramRequest);
body = Request.access$1000(paramRequest);
tag = Request.access$1100(paramRequest);
headers = Request.access$1200(paramRequest).newBuilder();
}
public Builder addHeader(String paramString1, String paramString2)
{
headers.add(paramString1, paramString2);
return this;
}
public Request build()
{
if (urlString == null) {
throw new IllegalStateException("url == null");
}
return new Request(this, null);
}
public Builder delete()
{
return method("DELETE", null);
}
public Builder get()
{
return method("GET", null);
}
public Builder head()
{
return method("HEAD", null);
}
public Builder header(String paramString1, String paramString2)
{
headers.set(paramString1, paramString2);
return this;
}
public Builder headers(Headers paramHeaders)
{
headers = paramHeaders.newBuilder();
return this;
}
public Builder method(String paramString, RequestBody paramRequestBody)
{
if ((paramString == null) || (paramString.length() == 0)) {
throw new IllegalArgumentException("method == null || method.length() == 0");
}
if ((paramRequestBody != null) && (!HttpMethod.hasRequestBody(paramString))) {
throw new IllegalArgumentException("method " + paramString + " must not have a request body.");
}
method = paramString;
body = paramRequestBody;
return this;
}
public Builder patch(RequestBody paramRequestBody)
{
return method("PATCH", paramRequestBody);
}
public Builder post(RequestBody paramRequestBody)
{
return method("POST", paramRequestBody);
}
public Builder put(RequestBody paramRequestBody)
{
return method("PUT", paramRequestBody);
}
public Builder removeHeader(String paramString)
{
headers.removeAll(paramString);
return this;
}
public Builder tag(Object paramObject)
{
tag = paramObject;
return this;
}
public Builder url(String paramString)
{
if (paramString == null) {
throw new IllegalArgumentException("url == null");
}
urlString = paramString;
return this;
}
public Builder url(URL paramURL)
{
if (paramURL == null) {
throw new IllegalArgumentException("url == null");
}
url = paramURL;
urlString = paramURL.toString();
return this;
}
}
/* Location:
* Qualified Name: com.squareup.okhttp.Request.Builder
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/
|
[
"[email protected]"
] | |
af4c312ff67567f5ddded7ca88d260dab535bcac
|
745c8a48d3675175afb79753798fc893e7777ba7
|
/sample/3/simple-service-3/src/main/java/com/example/annotation/param/FormResource.java
|
25bb68982a7a3e0e3a90bfa18722075a79dacf0c
|
[] |
no_license
|
feuyeux/jax-rs2-guide
|
73eeff61044b61729c5ffe892429a60d8d1b0075
|
815350cfdd622a359f3ed0fd2e5fd075e604c2f6
|
refs/heads/master
| 2022-10-26T14:26:51.794784 | 2022-09-23T04:13:53 | 2022-09-23T04:13:53 | 17,752,793 | 212 | 331 | null | 2022-09-23T04:13:53 | 2014-03-14T16:40:14 |
Java
|
UTF-8
|
Java
| false | false | 803 |
java
|
package com.example.annotation.param;
import javax.ws.rs.*;
/**
* Root resource (exposed at "myresource" path)
*/
@Path("form-resource")
public class FormResource {
public static final String USER = "user";
public static final String PW = "password";
public static final String NPW = "newPassword";
public static final String VNPW = "verification";
@POST
public String newPassword(
@DefaultValue("feuyeux") @FormParam(FormResource.USER) final String user,
@Encoded @FormParam(FormResource.PW) final String password,
@Encoded @FormParam(FormResource.NPW) final String newPassword,
@FormParam(FormResource.VNPW) final String verification) {
return user + ":" + password + ":" + newPassword + ":" + verification;
}
}
|
[
"eric@mars-64.(none)"
] |
eric@mars-64.(none)
|
7d5cbed3623e787bbbadcec3db1c772c928378c7
|
52c5075e6fb9b5d98247b4df13e5e0e1d442599a
|
/src/main/kanto/json/Read.java
|
f886c90044992fb5da590648d2c858c71c5c0b6b
|
[] |
no_license
|
VexMihir/Portable-Pokedex
|
904d8ff0bf0667145d4a74f03421df66cca09cfa
|
cbaf67b3f62702a0946bb6bb80349752db43b0bb
|
refs/heads/master
| 2023-04-11T16:16:20.129896 | 2021-05-11T10:00:55 | 2021-05-11T10:00:55 | 366,335,022 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,948 |
java
|
package kanto.json;
import kanto.exceptions.AllBadges;
import kanto.model.Pokemon;
import kanto.model.Trainer;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
// Represents a JSON file reader that reads through a file and returns key value pairs
public class Read extends Write {
private static String jsonFilePokemon = "data/pokemon.json";
private static String jsonFileTrainer = "data/trainer.json";
//REQUIRES: An input of the trainer's file
//EFFECTS: Reads the json file for the trainer's details and returns it as a Trainer object
public Trainer readTrainer(String file) throws IOException, ParseException {
Trainer trainer = new Trainer();
JSONParser jsonParser = new JSONParser();
FileReader reader = new FileReader(file);
Object obj = jsonParser.parse(reader);
JSONObject jsonObject = (JSONObject) obj;
trainer.setTrainerID(Integer.parseInt(String.valueOf(jsonObject.get("ID"))));
trainer.setTrainerLastName((String) jsonObject.get("LName"));
trainer.setTotalBadge(Integer.parseInt(String.valueOf(jsonObject.get("Badge"))));
//Do nothing
trainer.setTotalPokemon(Integer.parseInt(String.valueOf(jsonObject.get("TotalPokemon"))));
trainer.setTrainerFirstName((String) jsonObject.get("FName"));
trainer.setNew(false);
ArrayList<Integer> ids = new ArrayList<>();
JSONArray jsonArray = (JSONArray) jsonObject.get("Pokemon");
//Iterating the contents of the array
for (Object o : jsonArray) {
String values = String.valueOf(o);
int pokeID = Integer.parseInt(values);
ids.add(pokeID);
trainer.setPokemon(ids);
}
return trainer;
}
//REQUIRES: An input of a Pokemon's ID between 1 and 151
//EFFECTS: Searches the JSON file for the pokemon with the same ID and returns a Pokemon object
public Pokemon searchPokemon(String file, int id) {
Pokemon poke2 = new Pokemon();
//Iterate over employee array
//JSON parser object to parse read file
JSONParser jsonParser = new JSONParser();
try {
//Read JSON file
FileReader reader = new FileReader(file);
Object obj = jsonParser.parse(reader);
JSONObject jsonObject = (JSONObject) obj;
JSONArray pokemonList = (JSONArray) jsonObject.get("Pokemon");
for (Object i : pokemonList) {
poke2 = parsePokemonObject(id, (JSONObject) i);
if (poke2.getPokeID() == id) {
break;
} else {
poke2 = new Pokemon();
}
}
} catch (IOException | ParseException e) {
e.printStackTrace();
}
return poke2;
}
//ALL BELOW ARE HELPER
//EFFECTS: Compares the pokemon's ID held in the JSONObject with the given ID.
// If found then, sets the values to a new Pokemon object
public Pokemon parsePokemonObject(int id, JSONObject pokemon) {
Pokemon poke = new Pokemon();
if (id == Integer.parseInt(getID(pokemon))) {
poke.setPokeID((Integer.parseInt(getNum(pokemon))));
poke.setPokemonName(getName(pokemon));
poke.setPokemonType(getType(pokemon));
poke.setHeight(getHeight(pokemon));
poke.setWeight(getWeight(pokemon));
}
return poke;
}
//HELPER
//EFFECTS: Returns the pokemon's name held in the JSONObject
public String getName(JSONObject obj) {
return (String) obj.get("name");
}
//HELPER
//EFFECTS: Returns the pokemon's num held in the JSONObject
public String getNum(JSONObject obj) {
return (String) obj.get("num");
}
//HELPER
//EFFECTS: Returns the pokemon's height held in the JSONObject
public String getHeight(JSONObject obj) {
return (String) obj.get("height");
}
//HELPER
//EFFECTS: Returns the pokemon's weight held in the JSONObject
public String getWeight(JSONObject obj) {
return (String) obj.get("weight");
}
//HELPER
//EFFECTS: Returns the pokemon's types held in the JSONObject
public ArrayList<String> getType(JSONObject obj) {
JSONArray types = (JSONArray) obj.get("type");
ArrayList<String> type = new ArrayList<>();
for (Object o : types) {
//System.out.println(types.get(i));
type.add((String) o);
}
return type;
}
//HELPER
//EFFECTS: Returns the pokemon's ID held in the JSONObject
public String getID(JSONObject obj) {
return String.valueOf(obj.get("id"));
}
}
|
[
"[email protected]"
] | |
56648daf6e669b4a4f3858b8b92b6b4275a1ed88
|
e50aae2f4053ef2e51d501885174a6e516d5097b
|
/src/Page/Loginpages.java
|
67f3ff5b196ce32ebd06242623e3f2da46cd1dec
|
[] |
no_license
|
satyam-IET/small_maven_Framework
|
d4e398980c53d5c5aabcd99eb6162b7f3ce46325
|
71b0e900640c6d6ceea805c5a96848051a703cf1
|
refs/heads/master
| 2023-06-04T22:30:37.560523 | 2021-06-27T05:04:31 | 2021-06-27T05:04:31 | 380,655,336 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,260 |
java
|
package Page;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.testng.Assert;
import com.relevantcodes.extentreports.ExtentReports;
import com.relevantcodes.extentreports.ExtentTest;
import com.relevantcodes.extentreports.LogStatus;
import test.Logintest;
public class Loginpages {
WebDriver driver;
ExtentReports reports;
ExtentTest test;
// ==================================WebElements===================================
@FindBy(linkText="Log in")
WebElement LoginLink;
@FindBy(name="user_login")
WebElement UserName;
@FindBy(name="user_pwd")
WebElement UserPassword;
@FindBy(className="rememberMe")
WebElement RememberMe;
@FindBy(name="btn_login")
WebElement LoginName;
@FindBy(id="msg_box")
WebElement Error;
// ===============================Constructor ====================================
public Loginpages() {
driver = Logintest.driver;
reports = Logintest.reports;
test = Logintest.test;
PageFactory.initElements(driver, this);
}
//================ Methods ========================================
public void Login(String usrnm , String Pass) {
test = reports.startTest("Login Test Case");
// To click on Login Button
LoginLink.click();
test.log(LogStatus.PASS, "Successfully clicked on the login button");
//to enter email / to enter any name in webpage
UserName.sendKeys(usrnm);
test.log(LogStatus.PASS, "Successfully Entered Username");
// Enter Password
UserPassword.sendKeys(Pass);
test.log(LogStatus.PASS, "Successfully Entered Username");
//Click on Remember me check box
RememberMe.click();
test.log(LogStatus.PASS, "Successfully clicked on remember me checkbox");
//WebElement LoginName = driver.findElement(By.name("btn_login"));
LoginName.click();
test.log(LogStatus.PASS, "Successfully clicked on login button");
// Check Error Message
String Actmsg = Error.getText();
String expectmsg = "The email or password you have entered is invalid.";
Assert.assertTrue(Error.isDisplayed());
Assert.assertEquals(Actmsg, expectmsg);
}}
|
[
"[email protected]"
] | |
1575304b7f84ac2a2c4ac00da735a80fbaa9d9f9
|
3d8df64a7f7fbf56d971a732f14e32b57b9e84e1
|
/MavenProject/src/test/java/pages/WelcomeScreen.java
|
08cb568e5798cc7004ec68626a6b1221fa7e8020
|
[] |
no_license
|
tarunHub/OLXScrips
|
172c521286e43d3793045ec0ddbd987b6704254f
|
02d0a99f09a2536192cd078856dea6bad92077f1
|
refs/heads/master
| 2020-04-10T00:30:43.400650 | 2017-03-15T10:38:53 | 2017-03-15T10:38:53 | 68,199,790 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,473 |
java
|
package pages;
import org.openqa.selenium.By;
import io.appium.java_client.android.AndroidDriver;
public class WelcomeScreen extends BasePage {
By permissionAllow = By.id("com.android.packageinstaller:id/permission_allow_button");
By permissionDeny = By.id("com.android.packageinstaller:id/permission_deny_button");
By neverAskAgain = By.id("com.android.packageinstaller:id/do_not_ask_checkbox");
By nextBtn = By.id("com.olx.southasia:id/btnNext");
By skipBtn = By.id("com.olx.southasia:id/tvSkip");
By doneBtn = By.id("com.olx.southasia:id/tvSkip");
public WelcomeScreen(AndroidDriver driver) {
super(driver);
}
// Click on login button
public void allowPermission() {
driver.findElement(permissionAllow).click();
}
public void denyPermission() {
driver.findElement(permissionDeny).click();
}
public void neverAskAgainCheck() {
driver.findElement(neverAskAgain).click();
}
public void clickNextBtn() {
driver.findElement(nextBtn).click();
}
public void navigatingToDashBoard() {
waitForVisibilityOf(nextBtn);
for (int i = 0; i < 5; i++) {
if (driver.findElement(nextBtn).getText().equals("Next")) {
clickNextBtn();
waitForVisibilityOf(permissionAllow);
if (driver.findElement(permissionAllow).isEnabled()) {
if (i == 3) {
denyPermission();
} else {
allowPermission();
}
}
} else if (driver.findElement(nextBtn).getText().equals("Done")) {
clickNextBtn();
}
}
}
}
|
[
"[email protected]"
] | |
039a209366783563a0861afd9749e9c6b8287bde
|
dc12f678172695132831df7e193d330bcb100c16
|
/src/main/java/com/ucams/modules/ams/dao/AmsGuidanceDao.java
|
4348964fcb4fc2523e19327d461e6e0c139b166e
|
[] |
no_license
|
sunjxer/UCAMS
|
d50b791c37d6c4e6587b7ad8d59b3e1d53d3ea20
|
46ad194aaa8a370e2d97c6c62d7a946ee2c54d3d
|
refs/heads/master
| 2021-04-12T11:41:51.511193 | 2018-03-21T09:20:58 | 2018-03-21T09:20:58 | 126,133,325 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 812 |
java
|
/**
* Copyright © Ucams All rights reserved.
*/
package com.ucams.modules.ams.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ucams.common.persistence.CrudDao;
import com.ucams.common.persistence.Page;
import com.ucams.common.persistence.annotation.MyBatisDao;
import com.ucams.modules.ams.entity.AmsGuidance;
/**
* 业务指导内容管理DAO接口
* @author gyl
* @version 2017-06-26
*/
@MyBatisDao
public interface AmsGuidanceDao extends CrudDao<AmsGuidance> {
public int updateOpinion(AmsGuidance amsGuidance);
public int updateGuidance(AmsGuidance amsGuidance);
public List<AmsGuidance> findAmsGuidanceList(AmsGuidance amsGuidance);
/**
* 根据项目工程查询业务指导是否添加
*/
public String getAmsGuidanceId(String id);
}
|
[
"[email protected]"
] | |
a66680b219ee8d0cca1290bd4c130334847da6be
|
5eb59f9bfd3ef499a275662e76dc3eb95b2e7588
|
/springlist/src/Address.java
|
c4457ac0074abe65941b41bf077ad2d0b5f9f7f7
|
[] |
no_license
|
gadalayaditya/cdk2
|
e34348b54043b48ca23fa475342dcb780f719c55
|
e399bdf7ac2ee306eff4768ce96cecf4d6e81dc6
|
refs/heads/master
| 2020-03-22T23:33:19.109728 | 2018-07-13T08:49:33 | 2018-07-13T08:49:33 | 140,817,135 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 502 |
java
|
import java.util.Iterator;
import java.util.List;
public class Address{
private List<String> addresss;
public Address() {}
public Address( List<String> address) {
this.addresss = address;
System.out.println("Address() constructor invoked");
}
public void displayInfo(){
System.out.println("address are:");
for(Iterator<String> itr=addresss.iterator();itr.hasNext();){
System.out.println(itr.next());
}
}
}
|
[
"[email protected]"
] | |
3ecc88632c072d2452a4c8204b6093660b415556
|
10645398b245bd0f0b39186cb55cda057570115a
|
/src/qsp/ConversionSetToList.java
|
12ad9438f608cf89cd40bba48fdfc986c0f6fa04
|
[] |
no_license
|
Divyashkhatri/actiTime
|
2a9b8261a849e42e18a95d16ff20a439db06a6c6
|
f53b02dc920267a181f808e89257d61bef3ae476
|
refs/heads/master
| 2021-01-18T20:11:46.912792 | 2017-08-21T00:50:17 | 2017-08-21T00:50:17 | 100,545,851 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,006 |
java
|
package qsp;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
public class ConversionSetToList {
public static void main(String[] args) {
//How do you convert a set to a list ?
Set<Long> ls=new TreeSet<Long>();
ls.add((long) 21);
ls.add((long) 22);
ls.add((long) 22);
ls.add((long) 20);
ls.add((long) 23);
ls.add((long) 19);
//1st way to convert
List<Long> ll=new LinkedList<Long>(ls);
Object value;
for(Long val:ll)
System.out.println(val);
//2nd way to convert
System.out.print("enhance for loop---------->");
System.out.println(ll.getClass());
// here in link list we cannot find the size by in build size() functions so we can use iterator
System.out.println(ll.get(0));// in this we can't use value by for loop for(;;)
System.out.print("iterator---------->");
Iterator<Long> itr=ll.iterator();
while(itr.hasNext())
{
System.out.println(itr.next());
}
}
}
|
[
"[email protected]"
] | |
f1955aa8eed81b142e9e0baf8986b88c1d81dfe3
|
fe6d0b519988da0944e561449e4ed303e3776bf3
|
/src/test/java/com/mkyong/common/AppTest.java
|
eb382aacde7f41a1c708b445203818d3c78173c8
|
[] |
no_license
|
Shauryasimplilearn/GITPROJECT
|
4cc2e88c46149113a5645151ddc02cb32f9b1c6b
|
d7ab71e92d21a82d5f2e370f0b16abbb22a65c23
|
refs/heads/master
| 2021-01-21T02:10:10.030309 | 2017-08-30T12:45:07 | 2017-08-30T12:45:07 | 101,880,382 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 789 |
java
|
package com.mkyong.common;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
System.out.println("Inside test suit");
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
System.out.println("Inside test suit");
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
System.out.println("Inside test App Test Case");
assertTrue( true );
}
}
|
[
"[email protected]"
] | |
767285b0f0a1a6e32971404d61bfcb37ac6cac73
|
478251676409031d26a5081d2308274decf40bd8
|
/sanguosha20130613/sanguosha20130613/src/org/wangfuyuan/sgs/gui/main/Panel_Prompt.java
|
bb23e3cc0b5888d1e1a17caaefd738d8f33c9212
|
[] |
no_license
|
darren4ten/JavaSanguosha
|
8159f594441273b6d66d655cfc1237ab49cfbd1b
|
73362330190ddbdb5f97a2ee5ee5268a949d19a0
|
refs/heads/master
| 2021-01-13T10:20:25.954200 | 2016-10-28T11:48:55 | 2016-10-28T11:48:55 | 72,200,056 | 11 | 8 | null | null | null | null |
GB18030
|
Java
| false | false | 2,090 |
java
|
package org.wangfuyuan.sgs.gui.main;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import javax.swing.JPanel;
/**
* 显示操作提示信息的面板
*
* @author user
*
*/
public class Panel_Prompt extends JPanel {
private static final long serialVersionUID = 8764890627705088325L;
private static final String[] types = { "杀", "闪", "桃" };
private String message = "测试--提示信息面板";
private Font font;
/**
* 构造
*/
public Panel_Prompt() {
this.setSize(550, 40);
this.setOpaque(false);
this.font = new Font("楷体", Font.BOLD, 30);
}
/**
* 绘制内容
*/
public synchronized void paintComponent(Graphics g) {
g.setFont(font);
g.setColor(Color.white);
if (message != null) {
g.drawString(message, 10, 30);
}
}
/**
* 重写paint
*//*
public void paint1(Graphics g) {
if (isPainting()) { // 根据当前帧显示当前透明度的内容组件
float alpha = (float) index / (float) FRAMENUMBER;
Graphics2D g2d = (Graphics2D) g;
g2d.setComposite(AlphaComposite.getInstance(
AlphaComposite.SRC_OVER, alpha));
// Renderer渲染机制
super.paint(g2d);
} else {
// 如果是第一次,启动动画时钟
index = 0;
timer = new Timer(INTERVAL, this);
timer.start();
}
}*/
/**
* 提示:需要出某种牌型n张
*
* @param type
* @param num
*/
public void show_RemindToUse(int type, int num) {
message = "您需要出" + num + "张" + types[type-1];
repaint();
}
/**
* 提示弃牌
*/
public void show_RemindToThrow(int num) {
message = "您需要丢弃" + num + "张手牌";
repaint();
}
/**
* 显示消息
*/
public void show_Message(String msg){
message = msg;
repaint();
}
/**
* 清空提示
*
* @return
*/
public void clear() {
message = null;
repaint();
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
|
[
"[email protected]"
] | |
86bebfb32c795cf368b4f89a36fc3ec793f63785
|
ca59718f60865008bb8909094a9e75f78c003a92
|
/src/main/java/org/oasis_open/docs/wsn/b_2/CreatePullPointResponse.java
|
8b66e25184d243c475cc155028b9cf3c49cd4ff4
|
[] |
no_license
|
yanxinorg/MyPTZTest
|
ea6a3457796d320e6f45393634fc428905bf9758
|
882448f7bfe3c191f5b3951d31178e7fcabb9944
|
refs/heads/master
| 2021-04-03T08:01:19.247051 | 2018-03-12T08:28:43 | 2018-03-12T08:28:43 | 124,856,618 | 3 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,605 |
java
|
//
// Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2 generiert
// Siehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// �nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren.
// Generiert: 2014.02.04 um 12:22:03 PM CET
//
package org.oasis_open.docs.wsn.b_2;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName;
import org.w3._2005._08.addressing.EndpointReferenceType;
import org.w3c.dom.Element;
/**
* <p>
* Java-Klasse f�r anonymous complex type.
*
* <p>
* Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="PullPoint" type="{http://www.w3.org/2005/08/addressing}EndpointReferenceType"/>
* <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* <anyAttribute/>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = { "pullPoint", "any" })
@XmlRootElement(name = "CreatePullPointResponse")
public class CreatePullPointResponse {
@XmlElement(name = "PullPoint", required = true)
protected EndpointReferenceType pullPoint;
@XmlAnyElement(lax = true)
protected List<Object> any;
@XmlAnyAttribute
private Map<QName, String> otherAttributes = new HashMap<QName, String>();
/**
* Ruft den Wert der pullPoint-Eigenschaft ab.
*
* @return possible object is {@link EndpointReferenceType }
*
*/
public EndpointReferenceType getPullPoint() {
return pullPoint;
}
/**
* Legt den Wert der pullPoint-Eigenschaft fest.
*
* @param value
* allowed object is {@link EndpointReferenceType }
*
*/
public void setPullPoint(EndpointReferenceType value) {
this.pullPoint = value;
}
/**
* Gets the value of the any property.
*
* <p>
* This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to the returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the any property.
*
* <p>
* For example, to add a new item, do as follows:
*
* <pre>
* getAny().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list {@link Element } {@link Object }
*
*
*/
public List<Object> getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return this.any;
}
/**
* Gets a map that contains attributes that aren't bound to any typed property on this class.
*
* <p>
* the map is keyed by the name of the attribute and the value is the string value of the attribute.
*
* the map returned by this method is live, and you can add new attribute by updating the map directly. Because of this design, there's no setter.
*
*
* @return always non-null
*/
public Map<QName, String> getOtherAttributes() {
return otherAttributes;
}
}
|
[
"[email protected]"
] | |
4ea99d87d592dff4a8d3c13c26582a0ad55dec59
|
1b7ce955f1707021c9efdf9912e92cce6e6e1038
|
/app/src/main/java/com/pentilmis/pen_tix/Fragment/PlayingNowFragment.java
|
2a9333431baed7cfb31f93ad0c0b80a5f5b4785c
|
[] |
no_license
|
ariya01/Belajar-APIPublik-PenTIX
|
a66710c5423080e5971465301af51530e8b40481
|
d1cd34d41e01da7fc17d8a7eebe9a695ae93bbe8
|
refs/heads/master
| 2020-04-21T14:21:56.510189 | 2019-03-24T09:05:49 | 2019-03-24T09:05:49 | 169,632,632 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 7,532 |
java
|
package com.pentilmis.pen_tix.Fragment;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.pentilmis.pen_tix.Activity.DetailMovieActivity;
import com.pentilmis.pen_tix.Activity.MainActivity.Adapter;
import com.pentilmis.pen_tix.BuildConfig;
import com.pentilmis.pen_tix.DatabaseGenre.Genre;
import com.pentilmis.pen_tix.DatabaseGenre.GenreHepler;
import com.pentilmis.pen_tix.Object.Movie;
import com.pentilmis.pen_tix.R;
import com.pentilmis.pen_tix.Retrofit.Client;
import com.pentilmis.pen_tix.Retrofit.Server;
import com.pentilmis.pen_tix.Return.Movie.Film;
import com.pentilmis.pen_tix.Return.Movie.ReturnPlay;
import com.yarolegovich.discretescrollview.DSVOrientation;
import com.yarolegovich.discretescrollview.DiscreteScrollView;
import com.yarolegovich.discretescrollview.InfiniteScrollAdapter;
import com.yarolegovich.discretescrollview.transform.ScaleTransformer;
import java.util.ArrayList;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
/**
* A simple {@link Fragment} subclass.
*/
public class PlayingNowFragment extends Fragment implements DiscreteScrollView.OnItemChangedListener{
TextView titile,genre1,numberrating,valuelanguage,languae,rating,view1;
private DiscreteScrollView itemPicker;
private InfiniteScrollAdapter infiniteAdapter;
List<Movie> movies = new ArrayList<>();
List<Film> films;
List<Integer> genre;
GenreHepler genreHepler;
Genre cek,cek1;
ProgressBar progressBar;
LinearLayout linearLayout,detail;
public PlayingNowFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_playing_now, container, false);
titile = view.findViewById(R.id.title);
Typeface custom_font = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Quicksand-Bold.ttf");
Typeface custom_font1 = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Roboto-Regular.ttf");
titile.setTypeface(custom_font);
itemPicker = (DiscreteScrollView) view.findViewById(R.id.item_picker);
itemPicker.setOrientation(DSVOrientation.HORIZONTAL);
itemPicker.addOnItemChangedListener(this);
itemPicker.setItemTransformer(new ScaleTransformer.Builder()
.setMinScale(0.8f)
.build());
progressBar = view.findViewById(R.id.loading);
detail = view.findViewById(R.id.detail);
genre1 = view.findViewById(R.id.genre);
genre1.setTypeface(custom_font1);
numberrating = view.findViewById(R.id.numberrating);
numberrating.setTypeface(custom_font);
valuelanguage = view.findViewById(R.id.valuelanguage);
valuelanguage.setTypeface(custom_font);
languae = view.findViewById(R.id.language);
languae.setTypeface(custom_font1);
rating = view.findViewById(R.id.rating);
rating.setTypeface(custom_font1);
view1 = view.findViewById(R.id.view);
view1.setTypeface(custom_font);
linearLayout = view.findViewById(R.id.klik);
return view;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onActivityCreated(savedInstanceState);
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
// Do something after 5s = 5000ms
new Load().execute();
}
}, 500);
}
@Override
public void onCurrentItemChanged(@Nullable RecyclerView.ViewHolder viewHolder, int position) {
int positionInDataSet = infiniteAdapter.getRealPosition(position);
onItemChanged(movies.get(positionInDataSet));
}
private void onItemChanged(final Movie movie) {
if (movie.getTitle().length()>22)
{
titile.setText(movie.getTitle().substring(0,22)+"...");
}
else
{
titile.setText(movie.getTitle());
}
genre1.setText(movie.getGenre1());
numberrating.setText(movie.getRating());
valuelanguage.setText(movie.getBahasa());
linearLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(getContext(), DetailMovieActivity.class);
i.putExtra("id_movie",movie.getId());
startActivity(i);
}
});
}
public class Load extends AsyncTask<Void, Integer, Void> {
@Override
protected void onPreExecute() {
progressBar.setVisibility(View.VISIBLE);
detail.setVisibility(View.INVISIBLE);
}
@Override
protected void onPostExecute(Void aVoid) {
}
@Override
protected Void doInBackground(Void... voids) {
Client api = Server.builder().create(Client.class);
Call<ReturnPlay> cari = api.now(BuildConfig.TMDB_API_KEY);
genreHepler = new GenreHepler(getContext());
genreHepler.open();
cari.enqueue(new Callback<ReturnPlay>() {
@Override
public void onResponse(Call<ReturnPlay> call, Response<ReturnPlay> response) {
films = response.body().getFilms();
for(int i =0;i<films.size();i++)
{
Movie movie = new Movie();
movie.setId(films.get(i).getId_movie());
movie.setTitle(films.get(i).getTitle());
movie.setBahasa(films.get(i).getLanguage());
movie.setPoster("https://image.tmdb.org/t/p/w500"+films.get(i).getPoster());
movie.setRating(films.get(i).getRating());
genre = films.get(i).getGenre();
cek =genreHepler.find(genre.get(0).toString());
movie.setGenre1(cek.getGenre());
if(genre.size()>1)
{
cek1 =genreHepler.find(genre.get(1).toString());
movie.setGenre2(cek1.getGenre());
}
movies.add(movie);
infiniteAdapter = InfiniteScrollAdapter.wrap(new Adapter(movies,getContext()));
itemPicker.setAdapter(infiniteAdapter);
detail.setVisibility(View.VISIBLE);
progressBar.setVisibility(View.INVISIBLE);
}
}
@Override
public void onFailure(Call<ReturnPlay> call, Throwable t) {
t.printStackTrace();
}
});
return null;
}
}
}
|
[
"[email protected]"
] | |
8c12e24f380e80c804b3d182988333b689ac1664
|
7eac53bdd4ee73813d7123e2eeb2d2f2127d0dc5
|
/UnitTestingLab/src/main/java/rpg_lab/Target.java
|
bcdb95f258be90efafa01a0dadb32974cad5f155
|
[] |
no_license
|
gtsenkov/JavaOOP
|
2f91baeedd5f9b8f26ba16673bc2311df56c3baa
|
6f1d8f5025c7844aff17a861a26e404d88a9b560
|
refs/heads/main
| 2023-02-11T22:39:37.615916 | 2021-01-04T07:09:36 | 2021-01-04T07:09:36 | 313,689,767 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 215 |
java
|
package rpg_lab;
import java.util.Random;
public interface Target {
void takeAttack(int attackPoints);
int giveExperience();
boolean isDead();
Weapon dropWeapon(Random random);
}
|
[
"[email protected]"
] | |
af1c4becdfcc7594ca74dd2425487b83df4b69a4
|
9db612e76152fe6c7024bfc60c7ce6e4ca200c21
|
/ontwerpen__inleidingDP_1/src/domein/MallardDuck.java
|
d0f51f316a14bc327ff9bfbe2aa982243cb09c21
|
[] |
no_license
|
guustysebie/2C1OO2
|
46e4cb8c0476b4a2f4cfb98fcf1eb8eea149defd
|
b573eda53fcd903a6dff5b56f1639f05c3e2b90c
|
refs/heads/master
| 2020-03-31T02:36:17.250268 | 2018-10-19T14:32:43 | 2018-10-19T14:32:43 | 151,832,053 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 430 |
java
|
package domein;
public class MallardDuck extends Duck {
// public MallardDuck() {
// setQuackBehavior(new Quack());
// setFlyBehavior(new FlyWithWings());
// }
public MallardDuck(QuackBehavior quackBehavior, FlyBehavior flyBehavior) {
super(quackBehavior, flyBehavior);
}
@Override
public String display() {
return "Ik ben een echte wilde eend";
}
}
|
[
"[email protected]"
] | |
c857d2280c85729547d1be9aa4ebb82a9c0396c7
|
5c5415db9a39cb988876a916bc57ec84e998b186
|
/ticketbooksystem/ticketbooksystem/src/main/java/com/ticketcookingsystem/ticketbooksystem/controller/SeatController.java
|
d582795deb13ac417f4e31090c058f38a2b6e481
|
[] |
no_license
|
sowmya-beluraiah/low-level-design
|
99015f1a8cc0b97ba8d38a07de9cea49e8918da4
|
53fc2060eeaeae9faa7bb4a1e9f4f4fb849bd9db
|
refs/heads/master
| 2023-06-04T12:27:16.053514 | 2021-06-20T10:07:53 | 2021-06-20T10:07:53 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,391 |
java
|
package com.ticketcookingsystem.ticketbooksystem.controller;
import java.sql.Timestamp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.ticketcookingsystem.ticketbooksystem.service.SeatService;
import com.ticketcookingsystem.ticketbooksystem.utils.BookingSession;
import com.ticketcookingsystem.ticketbooksystem.utils.SeatUtil;
@RestController
@RequestMapping("path=/seat")
public class SeatController {
@Autowired
SeatService seatService;
@GetMapping("path=/selectSeats/{userId}/{showId}")
@ResponseBody
public String selectSeats(@PathVariable Integer showId,
@PathVariable Integer userId,
@RequestParam Integer from,
@RequestParam Integer to) {
BookingSession.startSession(userId, new Timestamp(System.currentTimeMillis()));
if(seatService.checkSeats(showId, from, to) &&
SeatUtil.lockSeats(showId, userId, from, to)) {
seatService.lockSeatsinDB(from,to);
return "Seats Locked";
} else {
//TODO Exception
return "Seats not available";
}
}
}
|
[
"[email protected]"
] | |
3d7c61be4418c74fc49e13f2498bb8fe8fa282ff
|
03f38f29d7ee5e62fdfdb286b211d34206a9e95f
|
/usermngrStrutsHibernateTest/src/AllTests.java
|
4343e3f422ec2a18204753df9bcc70acad72231c
|
[] |
no_license
|
mythread/my_code
|
71e58133044a70f45b7185cb86230f2ed37cdfcc
|
3f4edadf1c4241b0e80ebfac15f7b91827a1a1b7
|
refs/heads/master
| 2021-01-20T15:36:14.700459 | 2015-04-17T09:32:00 | 2015-04-17T09:32:00 | 34,107,730 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 559 |
java
|
import com.ibm.etp.action.LoginActionTest;
import com.ibm.etp.dao.UserDaoTest;
import com.ibm.etp.dao.UserDaoTest1;
import junit.framework.Test;
import junit.framework.TestSuite;
public class AllTests {
public static Test suite() {
TestSuite suite = new TestSuite("Test for default package");
//$JUnit-BEGIN$
//添加测试类
suite.addTestSuite(LoginActionTest.class);
suite.addTestSuite(UserDaoTest.class);
suite.addTestSuite(UserDaoTest1.class);
//$JUnit-END$
return suite;
}
}
|
[
"[email protected]"
] | |
0574211205e5395776352998664c9d33d70fa054
|
af8402741a6330c7a8a2286f78f9965b20995b62
|
/src/java/org/xlattice/node/UdpXLFuncOverlay.java
|
506ebaf4ed35b55b7d670b8015194a0b6b0b66b1
|
[] |
no_license
|
jddixon/xlNode_java
|
e88bc5e2cdca6a0562a9f98b122bab9e49cef595
|
f832923abbd35d5e3ebbac7225f772b0ca2b6fb0
|
refs/heads/master
| 2021-01-19T00:56:43.828900 | 2016-09-28T18:46:34 | 2016-09-28T18:46:34 | 59,864,816 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,351 |
java
|
/* UdpXLFuncOverlay.java */
package org.xlattice.node;
import java.util.Timer;
import java.util.TimerTask;
import org.xlattice.Address;
import org.xlattice.Overlay;
import org.xlattice.NodeID;
import org.xlattice.Protocol;
import org.xlattice.protocol.stun.NattedAddress;
import org.xlattice.protocol.xl.*;
/**
* XXX TNode argument to constructor is a nonsense. This gets passed
* XXX to the TNode construtor!
*
* XXX Capitalization is inconsistent; should be UdpXl.
*/
public class UdpXLFuncOverlay extends NattedOverlay implements XLConst {
protected static final XL xl = new XL(); // yes, ridiculous
// INSTANCE VARIABLES ///////////////////////////////////////////
protected final TNode myNode;
protected final NodeID myNodeID;
protected final Timer timer;
// CONSTRUCTORS /////////////////////////////////////////////////
public UdpXLFuncOverlay (TNode t, NattedAddress a) {
super(xl, a);
if (t == null)
throw new IllegalArgumentException("null parent TNode");
myNode = t;
myNodeID = t.getNodeID(); // convenience
timer = t.getTimer(); // likewise
}
// INTERFACE XLFunc /////////////////////////////////////////////
public void ping( NodeID target ) {
if (target == null)
throw new IllegalArgumentException("null ping target");
XLMsg msg = new Ping();
msg.add( new Source(myNodeID) );
msg.add( new Destination(target) );
// get msg length and encode into buffer
// schedule a send with the IOScheduler
// schedule a timeout, which needs to know how to report the event
// need to have database of outstanding pings, with EITHER the
// pong OR the timeout removing the entry; should collect ping
// time
}
/**
* Pongs could be handled at a lower level, since they can be
* completely stateless - unless we learn NodeIDs from incoming
* pings, adding them to the Peer database.
*
* XXX Need a TTL.
* XXX Copying the msgID over and over again is silly.
*/
public void pong( NodeID target, byte[] msgID ) {
// POSSIBLY add the sender to our Peer database
// construct a packet as above
// schedule a send with the IOScheduler
}
}
|
[
"[email protected]"
] | |
7528120bbf0245792cad46776d7d08cfd9bfd8bc
|
7868b6492c99b96585a24b34824bdc2f3bd3345a
|
/MyApplication/app/src/androidTest/java/br/gov/sc/ciasc/myapplication/ApplicationTest.java
|
271b90a8291a7f131b3594b230c7a296d3326d78
|
[] |
no_license
|
carlosnakazawa/ciasc-android
|
a06df1398816e2ab2dc929a4c68cbbf9512a8ae0
|
628d3141483a549312e146f5d5a0c299d2b80b1b
|
refs/heads/master
| 2021-01-19T06:53:36.843248 | 2015-08-04T05:25:56 | 2015-08-04T05:25:56 | 38,820,426 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 360 |
java
|
package br.gov.sc.ciasc.myapplication;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}
|
[
"[email protected]"
] | |
0054a9a4dd204946be323eeea756cb2c1c433eda
|
f451367bc78c4f1a383680148519a091d00d3b80
|
/app/src/androidTest/java/com/example/tracnghiemta/ExampleInstrumentedTest.java
|
baa0375131938da08508bbd63848384e5e9298ab
|
[] |
no_license
|
pipysk/MaiTapCode-master
|
9c056cc44d76a38dd33c8d5b80c216262f54d82f
|
6c7ec53e2981cde8761bdc1875a224b9ed9b84ac
|
refs/heads/master
| 2020-09-29T14:11:04.625724 | 2019-12-10T07:12:14 | 2019-12-10T07:12:14 | 227,052,633 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 732 |
java
|
package com.example.tracnghiemta;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.tracnghiemta", appContext.getPackageName());
}
}
|
[
"[email protected]"
] | |
7b52143bf0894d0e7a8024f51f78d2c3a6e26348
|
ef544bbd742ea519b9f030f5570a41e5d01b52c3
|
/src/com/neo/cs106aclass/Roulette.java
|
03a39cf6cfadba3c91d79aa3d5d2323025ece49b
|
[] |
no_license
|
ovieu/stanford-cs106a-lecture11-code
|
7007d4ed088ebd95573c4ba5c2a6c8d041a4eefb
|
73a8357ec44081a31af8e1b6ae339367ac354ad1
|
refs/heads/master
| 2021-05-14T02:18:26.211767 | 2018-01-21T19:03:13 | 2018-01-21T19:03:13 | 116,592,470 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,623 |
java
|
/*
* File: Roulette.java
* -------------------
* This program simulates a small part of the casino game of
* roulette.
*/
package com.neo.cs106aclass;
import acm.program.ConsoleProgram;
import acm.program.*;
import acm.util.*;
public class Roulette extends ConsoleProgram {
/**
* Amount of cash with which the player starts
*/
private static final int STARTING_MONEY = 100;
/**
* Amount wagered in each game
*/
private static final int WAGER_AMOUNT = 10;
/* Private instance variables */
private RandomGenerator rgen = new RandomGenerator();
public static void main(String[] args) {
new Roulette().start(args);
}
/**
* Runs the program
*/
public void run() {
giveInstructions();
playRoulette();
}
/**
* Plays roulette until the user runs out of money.
*/
private void playRoulette() {
int money = STARTING_MONEY;
while (money > 0) {
println("You now have $" + money + ".");
String bet = readLine("Enter betting category: ");
int outcome = spinRouletteWheel();
if (isWinningCategory(outcome, bet)) {
println("That number is " + bet + " so you win.");
money += WAGER_AMOUNT;
} else {
println("That number is not " + bet + " so you lose.");
money -= WAGER_AMOUNT;
}
}
println("You ran out of money.");
}
/**
* Simulates the spinning of the roulette wheel. The method
* returns the number of the slot into which the ball fell.
*/
private int spinRouletteWheel() {
int spin = rgen.nextInt(0, 36);
println("The ball lands in " + spin + ".");
return spin;
}
/*
* Returns true if the outcome matches the category specified
* by bet. If the player chooses an illegal betting
* category, this function always returns false.
*/
private boolean isWinningCategory(int outcome, String bet) {
if (bet.equalsIgnoreCase("odd")) {
return outcome % 2 == 1;
} else if (bet.equalsIgnoreCase("even") && outcome != 0) {
return (outcome % 2 == 0);
} else if (bet.equalsIgnoreCase("low")) {
return (1 <= outcome && outcome <= 18);
} else if (bet.equalsIgnoreCase("high")) {
return (19 <= outcome && outcome <= 36);
} else {
return (false);
}
}
/**
* Welcomes the player to the game and gives instructions on
* the rules of roulette.
*/
private void giveInstructions() {
println("Welcome to the roulette table!");
println("Roulette is played with a large wheel divided into");
println("compartments numbered from 0 to 36. Each player");
println("places bets on a playing field marked with the");
println("numbers and various categories. In this game,");
println("the only legal bets are the following categories:");
println("odd, even, low, or high. Note that 0 is not in any");
println("category. After the bet is placed, the wheel is");
println("spun, and a marble is dropped inside, which bounces");
println("around until it lands in a compartment. If the");
println("compartment matches the betting category you chose,");
println("you win back your wager plus an equal amount. If");
println("not, you lose your wager.");
}
}
|
[
"[email protected]"
] | |
815f028a7121276223f23c15a35d45d88fcaa572
|
511114e4431531cd58a26b9b09bf16a7c90e3c73
|
/src/main/java/org/glassfish/tyrus/core/coder/PrimitiveDecoders.java
|
905387c8d32d26f4f60718a343c02150a27842b7
|
[] |
no_license
|
rappazzo/Soundboard
|
597a9b43dd6275564b9823e6062ffc2014a444be
|
045966b197a58e4e82b41478601546a8ff34ea8d
|
refs/heads/master
| 2021-01-18T21:32:46.401784 | 2016-03-31T11:50:12 | 2016-04-02T11:05:01 | 4,149,757 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 7,210 |
java
|
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2011-2014 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* http://glassfish.java.net/public/CDDL+GPL_1_1.html
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package org.glassfish.tyrus.core.coder;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.websocket.DecodeException;
import javax.websocket.Decoder;
import org.glassfish.tyrus.core.ReflectionHelper;
/**
* Collection of decoders for all primitive types.
*
* @author Martin Matula (martin.matula at oracle.com)
* @author Danny Coward (danny.coward at oracle.com)
* @author Stepan Kopriva (stepan.kopriva at oracle.com)
*/
public abstract class PrimitiveDecoders<T> extends CoderAdapter implements Decoder.Text<T> {
public static final List<Class<? extends Decoder>> ALL;
public static final Map<Class<?>, Decoder.Text<?>> ALL_INSTANCES;
static {
ALL = Collections.unmodifiableList(Arrays.<Class<? extends Decoder>>asList(
BooleanDecoder.class,
ByteDecoder.class,
CharacterDecoder.class,
DoubleDecoder.class,
FloatDecoder.class,
IntegerDecoder.class,
LongDecoder.class,
ShortDecoder.class
));
ALL_INSTANCES = getAllInstances();
}
@Override
public boolean willDecode(String s) {
return true;
}
public static class BooleanDecoder extends PrimitiveDecoders<Boolean> {
@Override
public Boolean decode(String s) throws DecodeException {
Boolean result;
try {
result = Boolean.valueOf(s);
} catch (Exception e) {
throw new DecodeException(s, "Decoding failed", e);
}
return result;
}
}
public static class ByteDecoder extends PrimitiveDecoders<Byte> {
@Override
public Byte decode(String s) throws DecodeException {
Byte result;
try {
result = Byte.valueOf(s);
} catch (Exception e) {
throw new DecodeException(s, "Decoding failed", e);
}
return result;
}
}
public static class CharacterDecoder extends PrimitiveDecoders<Character> {
@Override
public Character decode(String s) throws DecodeException {
Character result;
try {
result = s.charAt(0);
} catch (Exception e) {
throw new DecodeException(s, "Decoding failed", e);
}
return result;
}
}
public static class DoubleDecoder extends PrimitiveDecoders<Double> {
@Override
public Double decode(String s) throws DecodeException {
Double result;
try {
result = Double.valueOf(s);
} catch (Exception e) {
throw new DecodeException(s, "Decoding failed", e);
}
return result;
}
}
public static class FloatDecoder extends PrimitiveDecoders<Float> {
@Override
public Float decode(String s) throws DecodeException {
Float result;
try {
result = Float.valueOf(s);
} catch (Exception e) {
throw new DecodeException(s, "Decoding failed", e);
}
return result;
}
}
public static class IntegerDecoder extends PrimitiveDecoders<Integer> {
@Override
public Integer decode(String s) throws DecodeException {
Integer result;
try {
result = Integer.valueOf(s);
} catch (Exception e) {
throw new DecodeException(s, "Decoding failed", e);
}
return result;
}
}
public static class LongDecoder extends PrimitiveDecoders<Long> {
@Override
public Long decode(String s) throws DecodeException {
Long result;
try {
result = Long.valueOf(s);
} catch (Exception e) {
throw new DecodeException(s, "Decoding failed", e);
}
return result;
}
}
public static class ShortDecoder extends PrimitiveDecoders<Short> {
@Override
public Short decode(String s) throws DecodeException {
Short result;
try {
result = Short.valueOf(s);
} catch (Exception e) {
throw new DecodeException(s, "Decoding failed", e);
}
return result;
}
}
private static Map<Class<?>, Decoder.Text<?>> getAllInstances() {
Map<Class<?>, Decoder.Text<?>> map = new HashMap<Class<?>, Decoder.Text<?>>();
for (Class<? extends Decoder> dec : ALL) {
Class<?> type = ReflectionHelper.getClassType(dec, Decoder.Text.class);
try {
map.put(type, (Decoder.Text<?>) dec.newInstance());
} catch (Exception e) {
Logger.getLogger(PrimitiveDecoders.class.getName()).log(Level.WARNING, String.format("Decoder %s could not have been instantiated.", dec));
}
}
return map;
}
}
|
[
"[email protected]"
] | |
f2b684687a40cddc4c5917fef3d626048a3d783c
|
c89333d091f152c8c36623065cf6974997530876
|
/sa.elm.ob.scm/src/sa/elm/ob/scm/ad_process/IssueRequest/UpdateOnHandQty.java
|
f58c770b4ce207a8ba29fc085ace93b93ab4f0ea
|
[] |
no_license
|
Orkhan42/openbravotest
|
24cb0f35986732c41a21963d7aa7a0910e7b4afd
|
82c7bfb60dda7a30be276a2b07e5ca2b4a92c585
|
refs/heads/master
| 2023-03-01T00:35:37.463178 | 2021-02-04T12:55:45 | 2021-02-04T12:55:45 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,302 |
java
|
package sa.elm.ob.scm.ad_process.IssueRequest;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import org.apache.log4j.Logger;
import org.openbravo.base.exception.OBException;
import org.openbravo.dal.service.OBDal;
import org.openbravo.erpCommon.businessUtility.Preferences;
import org.openbravo.erpCommon.utility.OBMessageUtils;
import org.openbravo.erpCommon.utility.PropertyException;
import sa.elm.ob.scm.MaterialIssueRequest;
public class UpdateOnHandQty {
private static final Logger log4j = Logger.getLogger(UpdateOnHandQty.class);
/**
* Update on hand quantity
*
* @param warehouseId
* @return boolean
*/
public static boolean updateOnHandQty(String warehouseId, String mirId) {
PreparedStatement ps = null;
ResultSet rs = null;
boolean update = false;
try {
ps = OBDal.getInstance().getConnection().prepareStatement(
"select sum(qtyonhand) as qtyonhand, m_product_id from m_storage_detail strdt "
+ " left join m_locator loc on loc.m_locator_id=strdt.m_locator_id "
+ " where loc.m_warehouse_id = ? group by m_warehouse_id, m_product_id ");
ps.setString(1, warehouseId);
log4j.debug("onhnd qty>" + ps.toString());
rs = ps.executeQuery();
while (rs.next()) {
ps = OBDal.getInstance().getConnection().prepareStatement(
"update escm_material_reqln set onhand_qty=?, updated=now() where m_product_id=? and escm_material_request_id=?");
ps.setBigDecimal(1, rs.getBigDecimal("qtyonhand"));
ps.setString(2, rs.getString("m_product_id"));
ps.setString(3, mirId);
log4j.debug("Update matln>" + ps.toString());
ps.executeUpdate();
update = true;
}
} catch (final Exception e) {
log4j.error("Exception in updateOnHandQty() : ", e);
return update;
} finally {
try {
if (rs != null) {
rs.close();
}
if (ps != null) {
ps.close();
}
} catch (Exception e) {
throw new OBException(OBMessageUtils.messageBD("HB_INTERNAL_ERROR"));
}
}
return update;
}
/**
* Check Access for MIR on hand qty update
*
* @param roleId
* @param mirId
* @param clientId
* @param orgId
* @param userId
* @return boolean
*/
public static boolean checkMIROnHandQtyUpdateAccess(String roleId, String clientId, String orgId,
String userId, String mirId) {
boolean enable = false;
MaterialIssueRequest objRequest = null;
String preferenceValue = "";
try {
objRequest = OBDal.getInstance().get(MaterialIssueRequest.class, mirId);
if (objRequest.getEUTNextRole() == null) {
enable = true;
} else {
try {
preferenceValue = Preferences.getPreferenceValue("ESCM_WarehouseKeeper", true, clientId,
orgId, userId, roleId, "800092");
if (!preferenceValue.equals("") && preferenceValue.equals("Y")) {
enable = true;
}
} catch (PropertyException e) {
log4j.debug("Exeception in checkMIROnHandQtyUpdateAccess:" + e);
}
}
} catch (final Exception e) {
log4j.error("Exception in identifyBPartner() : ", e);
return false;
}
return enable;
}
}
|
[
"[email protected]"
] | |
26eba6bb20012a3f856e508c77d0e54f95418e03
|
e0d66fe6ee8d974cadffe1358afc155e45c1821e
|
/SpringBoot_HBase-master/src/main/java/com/springboot/hbase/utli/HBaseConfig.java
|
1c451d951c88ed5a172cc6eb84ee3943cbbc4f0c
|
[] |
no_license
|
shiguri/SpringBoot-HBase
|
d6698a03d8b8fc026c55f57c33bd4badded32c86
|
360ca119efe0b0c7037f6a22587f342a1b1f35b6
|
refs/heads/main
| 2023-02-15T13:23:17.947150 | 2021-01-14T15:24:15 | 2021-01-14T15:24:15 | 329,576,447 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,135 |
java
|
package com.springboot.hbase.utli;
import com.springboot.hbase.service.HBaseService;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import java.io.IOException;
@Configuration
public class HBaseConfig {
@Bean(name = "hBaseService")
public HBaseService getHbaseService() {
//设置临时的hadoop环境变量,之后程序会去这个目录下的\bin目录下找winutils.exe工具,windows连接hadoop时会用到
//System.setProperty("hadoop.home.dir", "D:\\Program Files\\Hadoop");
//执行此步时,会去resources目录下找相应的配置文件,例如hbase-site.xml
org.apache.hadoop.conf.Configuration conf = HBaseConfiguration.create();
return new HBaseService(conf);
}
}
|
[
"[email protected]"
] | |
bb783e53eace7a505c310c01b46b579125ce08d6
|
2d8f64374c90556277818e809bc9a8896a7aa44a
|
/src/main/java/com/grzechwa/model/cards/character/Merchant.java
|
f21ee7f3bdce0febacd7076f2c133950009bddad
|
[] |
no_license
|
Frearexis/Citadel_Card_Game
|
9d29fd7266c2959e9eadf262d1ece3e62c7b41c9
|
062386234160f7feec09dc995f221ed301e27877
|
refs/heads/master
| 2021-09-12T14:48:17.876319 | 2018-04-17T21:00:01 | 2018-04-17T21:00:01 | 121,278,409 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 404 |
java
|
package com.grzechwa.model.cards.character;
import com.grzechwa.model.Character;
public final class Merchant extends Character {
public Merchant() {
super("Merchant",
"green",
true,
6,
false,
false,
false,
false,
"/card_images/characters/Merchant.png");
}
}
|
[
"[email protected]"
] | |
eddbb3066196acd423edf34cc7b98c401f073e55
|
803a51939457e5cfed11625b959560ec1b3a6e36
|
/src/main/java/com/sample/testsample/DateUtils.java
|
d24187a21f61ec938031b7b466fabaaf53d74d3e
|
[
"Apache-2.0"
] |
permissive
|
RichterAstell/junit-sample
|
67d7082197aead0ad0b3bbf928af49bf77f9ce0f
|
cb0a50ff1804f2876c279f93179e8fd6cf1eecde
|
refs/heads/main
| 2023-02-22T09:58:46.379784 | 2021-01-28T16:22:48 | 2021-01-28T16:22:48 | 329,012,777 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 223 |
java
|
package com.sample.testsample;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
@Component
public class DateUtils {
public LocalDate getNowDate() {
return LocalDate.now();
}
}
|
[
"[email protected]"
] | |
be18558f8bc1cb362496e798a601dffc654bb025
|
578099960461d37e6404f212ed2af255de5834ca
|
/dp/src/test/java/test/BeverageTest.java
|
c1150ebbe866507ef73fed38b84fc468d891944c
|
[] |
no_license
|
anythingbyme/designpatterns
|
9f30fd09c56799fd52dcce424c5efa6c128f283a
|
c7d00ceee83115670e8db4d207687c20303eba37
|
refs/heads/master
| 2021-04-15T13:14:29.163268 | 2018-03-25T09:26:56 | 2018-03-25T09:26:56 | 126,606,833 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,304 |
java
|
package test;
import decorator.model.Beverage;
import decorator.model.Condiment;
import decorator.model.Decaf;
import org.junit.Assert;
import org.junit.Test;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
public class BeverageTest {
@Test
public void beverage() {
Beverage beverage = new Decaf();
Assert.assertEquals(new BigDecimal(1.5), beverage.getPrice());
}
@Test
public void condimentAdd() {
Beverage beverage = new Decaf();
beverage.setPrice(BigDecimal.ONE);
Condiment condiment = new Condiment();
condiment.setPrice(BigDecimal.ONE);
beverage.addCondiment(condiment);
Assert.assertEquals(BigDecimal.valueOf(1), beverage.getCondimentsPrice());
Assert.assertEquals(BigDecimal.valueOf(2), beverage.getPrice());
}
@Test
public void orderDecafWithMochaAndWhip() {
Beverage decaf = new Decaf();
decaf.setPrice(BigDecimal.ONE);
// Mocha
Condiment mocha = new Condiment();
mocha.setPrice(BigDecimal.ONE);
Condiment whip = new Condiment();
whip.setPrice(BigDecimal.ONE);
decaf.addCondiments(Arrays.asList(mocha, whip));
Assert.assertEquals(BigDecimal.valueOf(3), decaf.getPrice());
}
}
|
[
"[email protected]"
] | |
4593293dc0139ca6d39648fbff951a9e00089672
|
0d86a98cd6a6477d84152026ffc6e33e23399713
|
/kata/7-kyu/are-the-numbers-in-order/main/Solution.java
|
f7536bb5f30572a00ccb1c62845070df3383d57e
|
[
"MIT"
] |
permissive
|
ParanoidUser/codewars-handbook
|
0ce82c23d9586d356b53070d13b11a6b15f2d6f7
|
692bb717aa0033e67995859f80bc7d034978e5b9
|
refs/heads/main
| 2023-07-28T02:42:21.165107 | 2023-07-27T12:33:47 | 2023-07-27T12:33:47 | 174,944,458 | 224 | 65 |
MIT
| 2023-09-14T11:26:10 | 2019-03-11T07:07:34 |
Java
|
UTF-8
|
Java
| false | false | 190 |
java
|
import static java.util.stream.IntStream.range;
interface Solution {
static boolean isAscOrder(int[] arr) {
return range(0, arr.length - 1).allMatch(i -> arr[i] <= arr[i + 1]);
}
}
|
[
"[email protected]"
] | |
7bdcfde591a0ec7beec0408c7011b0af25ecbbcf
|
cc474c354acafea0ca0c3fd926d0d38c52d78cb9
|
/COVID-19/src/tray/notification/TrayNotification.java
|
72940a1063641f09e8cf641f79c7af7d3c1e3681
|
[] |
no_license
|
Taehyun06-Dev/COVID-INFOv1.0
|
aa559caf687724277799c4a273c0c964c81fdd4f
|
05aaf3deef740597281e3f938bbc503731975d70
|
refs/heads/master
| 2021-02-19T03:31:16.956915 | 2020-03-05T21:49:51 | 2020-03-05T21:49:51 | 245,273,202 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 8,549 |
java
|
package tray.notification;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.paint.Paint;
import javafx.scene.shape.Rectangle;
import javafx.stage.StageStyle;
import javafx.util.Duration;
import tray.animations.*;
import tray.models.CustomStage;
import java.io.IOException;
import java.net.URL;
public final class TrayNotification {
@FXML
private Label lblTitle, lblMessage, lblClose;
@FXML
private ImageView imageIcon;
@FXML
private Rectangle rectangleColor;
@FXML
private AnchorPane rootNode;
private CustomStage stage;
private NotificationType notificationType;
private AnimationType animationType;
private EventHandler<ActionEvent> onDismissedCallBack, onShownCallback;
private TrayAnimation animator;
private AnimationProvider animationProvider;
/**
* Initializes an instance of the tray notification object
* @param title The title text to assign to the tray
* @param body The body text to assign to the tray
* @param img The image to show on the tray
* @param rectangleFill The fill for the rectangle
*/
public TrayNotification(String title, String body, Image img, Paint rectangleFill) {
initTrayNotification(title, body, NotificationType.CUSTOM);
setImage(img);
setRectangleFill(rectangleFill);
}
/**
* Initializes an instance of the tray notification object
* @param title The title text to assign to the tray
* @param body The body text to assign to the tray
* @param notificationType The notification type to assign to the tray
*/
public TrayNotification(String title, String body, NotificationType notificationType ) {
initTrayNotification(title, body, notificationType);
}
/**
* Initializes an empty instance of the tray notification
*/
public TrayNotification() {
initTrayNotification("", "", NotificationType.CUSTOM);
}
private void initTrayNotification(String title, String message, NotificationType type) {
try {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/tray/views/TrayNotification.fxml"));
fxmlLoader.setController(this);
fxmlLoader.load();
initStage();
initAnimations();
setTray(title, message, type);
} catch (IOException e) {
e.printStackTrace();
}
}
private void initAnimations() {
animationProvider =
new AnimationProvider(new FadeAnimation(stage), new SlideAnimation(stage), new PopupAnimation(stage));
//Default animation type
setAnimationType(AnimationType.SLIDE);
}
private void initStage() {
stage = new CustomStage(rootNode, StageStyle.UNDECORATED);
stage.setScene(new Scene(rootNode));
stage.setAlwaysOnTop(true);
stage.setLocation(stage.getBottomRight());
lblClose.setOnMouseClicked(e -> dismiss());
}
public void setNotificationType(NotificationType nType) {
notificationType = nType;
URL imageLocation = null;
String paintHex = null;
switch (nType) {
case INFORMATION:
imageLocation = getClass().getResource("/tray/resources/info.png");
paintHex = "#2C54AB";
break;
case NOTICE:
imageLocation = getClass().getResource("/tray/resources/notice.png");
paintHex = "#8D9695";
break;
case SUCCESS:
imageLocation = getClass().getResource("/tray/resources/success.png");
paintHex = "#009961";
break;
case WARNING:
imageLocation = getClass().getResource("/tray/resources/warning.png");
paintHex = "#E23E0A";
break;
case ERROR:
imageLocation = getClass().getResource("/tray/resources/error.png");
paintHex = "#CC0033";
break;
case CUSTOM:
return;
}
setRectangleFill(Paint.valueOf(paintHex));
setImage(new Image(imageLocation.toString()));
setTrayIcon(imageIcon.getImage());
}
public NotificationType getNotificationType() {
return notificationType;
}
public void setTray(String title, String message, NotificationType type) {
setTitle(title);
setMessage(message);
setNotificationType(type);
}
public void setTray(String title, String message, Image img, Paint rectangleFill, AnimationType animType) {
setTitle(title);
setMessage(message);
setImage(img);
setRectangleFill(rectangleFill);
setAnimationType(animType);
}
public boolean isTrayShowing() {
return animator.isShowing();
}
/**
* Shows and dismisses the tray notification
* @param dismissDelay How long to delay the start of the dismiss animation
*/
public void showAndDismiss(Duration dismissDelay) {
if (isTrayShowing()) {
dismiss();
} else {
stage.show();
onShown();
animator.playSequential(dismissDelay);
}
onDismissed();
}
/**
* Displays the notification tray
*/
public void showAndWait() {
if (! isTrayShowing()) {
stage.show();
animator.playShowAnimation();
onShown();
}
}
/**
* Dismisses the notifcation tray
*/
public void dismiss() {
if (isTrayShowing()) {
animator.playDismissAnimation();
onDismissed();
}
}
private void onShown() {
if (onShownCallback != null)
onShownCallback.handle(new ActionEvent());
}
private void onDismissed() {
if (onDismissedCallBack != null)
onDismissedCallBack.handle(new ActionEvent());
}
/**
* Sets an action event for when the tray has been dismissed
* @param event The event to occur when the tray has been dismissed
*/
public void setOnDismiss(EventHandler<ActionEvent> event) {
onDismissedCallBack = event;
}
/**
* Sets an action event for when the tray has been shown
* @param event The event to occur after the tray has been shown
*/
public void setOnShown(EventHandler<ActionEvent> event) {
onShownCallback = event;
}
/**
* Sets a new task bar image for the tray
* @param img The image to assign
*/
public void setTrayIcon(Image img) {
stage.getIcons().clear();
stage.getIcons().add(img);
}
public Image getTrayIcon() {
return stage.getIcons().get(0);
}
/**
* Sets a title to the tray
* @param txt The text to assign to the tray icon
*/
public void setTitle(String txt) {
lblTitle.setText(txt);
}
public String getTitle() {
return lblTitle.getText();
}
/**
* Sets the message for the tray notification
* @param txt The text to assign to the body of the tray notification
*/
public void setMessage(String txt) {
lblMessage.setText(txt);
}
public String getMessage() {
return lblMessage.getText();
}
public void setImage (Image img) {
imageIcon.setImage(img);
setTrayIcon(img);
}
public Image getImage() {
return imageIcon.getImage();
}
public void setRectangleFill(Paint value) {
rectangleColor.setFill(value);
}
public Paint getRectangleFill() {
return rectangleColor.getFill();
}
public void setAnimationType(AnimationType type) {
animator = animationProvider.findFirstWhere(a -> a.getAnimationType() == type);
animationType = type;
}
public AnimationType getAnimationType() {
return animationType;
}
}
|
[
"bkcha@DESKTOP-0TIJ2NP"
] |
bkcha@DESKTOP-0TIJ2NP
|
cb31f7e08e3d4a27f25f73548e64e1bd81b03163
|
1353e291b7eae3fe0172ee1598396ba1577be6fd
|
/BroadcastActivity2/gen/com/learning/broadcastactivity2/BuildConfig.java
|
c5ea195b86ac9774192f9199969e58c1b182b52e
|
[] |
no_license
|
hwang122/android
|
28acd221be7d0b874ce0478af891996bcd2be5db
|
2e4a446005fcfbe448dda239b4bfdb6438a9e938
|
refs/heads/master
| 2020-06-05T09:42:00.402848 | 2013-08-22T17:22:46 | 2013-08-22T17:22:46 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 173 |
java
|
/** Automatically generated file. DO NOT MODIFY */
package com.learning.broadcastactivity2;
public final class BuildConfig {
public final static boolean DEBUG = true;
}
|
[
"[email protected]"
] | |
34bbcebab2f1d31ad81da6d3e31b46eb30b25d40
|
023c92e42d9c473cd5da7733997f05f63171760a
|
/com.vtiger/src/main/java/com/vtiger/objectRepository/CampaignPage_Pom.java
|
d0ab0f27d0f99018e7d3a7f362d3e47552a82389
|
[] |
no_license
|
sachinpai/vtigerhybridframework
|
764b55e5e887ecdcc1daef5cdb1d81e59285f9a1
|
f7c77aa78df69c5a33846097e199278fb5115b03
|
refs/heads/master
| 2020-12-05T01:55:24.187380 | 2020-01-05T20:40:06 | 2020-01-05T20:40:06 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,075 |
java
|
package com.vtiger.objectRepository;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import com.vtiger.genericLib.BaseClass;
public class CampaignPage_Pom {
public CampaignPage_Pom (WebDriver driver) {
PageFactory.initElements(driver, this);
}
@FindBy(xpath = "//img[@title='Create Campaign...']")
private WebElement newCampaignIcon;
@FindBy(name= "selected_id")
private WebElement firstCampaign;
@FindBy(xpath = "//input[@value='Delete']")
private WebElement deleteButton;
//Getters Method
public WebElement getNewCampaignIcon() {
return newCampaignIcon;
}
public WebElement getFirstCampaign() {
return firstCampaign;
}
public WebElement getDeleteButton() {
return deleteButton;
}
//Business Logic
public void clickOnNewCampaign() {
newCampaignIcon.click();
}
public void deleteFirstCampaign() {
firstCampaign.click();
deleteButton.click();
BaseClass.driver.switchTo().alert().accept();
}
}
|
[
"[email protected]"
] | |
9e277dac1b3fe19c17bd9b7bc33fd69ec2964501
|
e30bfa8173f2e4f9605dd28cff134dfb10da1030
|
/src/main/java/pl/antygravity/recipeproject/RecipeProjectApplication.java
|
c515a91d30a0b68c4fcd4d8ec865f0108d1caa0b
|
[] |
no_license
|
araws/RecipeProject
|
ec4c95c63399b1df657133c3950f13bb584ed2e6
|
72e442a5fccfa617bd9bb78ddfc4cd731d8fc2ce
|
refs/heads/master
| 2021-07-16T13:34:36.638058 | 2021-02-09T08:36:04 | 2021-02-09T08:36:04 | 236,462,467 | 1 | 0 | null | 2020-04-08T11:33:22 | 2020-01-27T10:06:54 |
Java
|
UTF-8
|
Java
| false | false | 347 |
java
|
package pl.antygravity.recipeproject;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class RecipeProjectApplication {
public static void main(String[] args) {
SpringApplication.run(RecipeProjectApplication.class, args);
}
}
|
[
"[email protected]"
] | |
164ed9eede21c1896f3c53d867bc5983e7d8a62a
|
94ddd3e683caac72b5188e46f91e4d8f951c387d
|
/src/boletin24paleta/Boletin24Paleta.java
|
7f86513f9b1f58cf278a2538ed076976791b75c9
|
[] |
no_license
|
apinodominguez/Boletin24
|
d5190b526a0f699ae7510665c605435ee257a503
|
2b55407047514e7db63678349f8d74ff39df8932
|
refs/heads/master
| 2020-05-04T08:33:50.722192 | 2019-04-02T09:58:35 | 2019-04-02T09:58:35 | 179,049,177 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 467 |
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 boletin24paleta;
/**
*
* @author apinodominguez
*/
public class Boletin24Paleta {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Ventana ven = new Ventana();
ven.setVisible(true);
}
}
|
[
"[email protected]"
] | |
a10b64bf9c651f7f6d5c2d73fc478afaf06577b3
|
8f55b7751afab6d6b2f7ea294ef8072dcfc7f1b7
|
/src/main/java/team/baymax/ui/dashboard/Dashboard.java
|
a90c62418a3f615d0161f808c7c0161ec13ad459
|
[
"MIT",
"LicenseRef-scancode-other-permissive"
] |
permissive
|
porkeypine/tp
|
bde20f1ee61978b39c48f02d8c246ea4239754ba
|
abd1515fdaecf8804f480d42c5e7e8895bf716c4
|
refs/heads/master
| 2023-01-09T05:04:20.104987 | 2020-11-12T17:55:42 | 2020-11-12T17:55:42 | 294,732,055 | 1 | 0 |
NOASSERTION
| 2020-09-11T15:27:00 | 2020-09-11T15:26:59 | null |
UTF-8
|
Java
| false | false | 1,550 |
java
|
package team.baymax.ui.dashboard;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane;
import team.baymax.model.appointment.Appointment;
import team.baymax.model.util.datetime.Date;
import team.baymax.model.util.datetime.DateTimeUtil;
import team.baymax.ui.UiPart;
import team.baymax.ui.appointment.AppointmentListPanel;
/**
* A ui for the dashboard in the application.
*/
public class Dashboard extends UiPart<Region> {
private static final String FXML = "dashboard/Dashboard.fxml";
@FXML
private StackPane timePanel;
@FXML
private StackPane appointmentListPanelPlaceholder;
@FXML
private Label dateLabel;
private AppointmentListPanel appointmentListPanel;
private DigitalClock clock;
/**
* Constructs a dashboard with the given {@code ObservableList}.
* @param appointmentsToday
*/
public Dashboard(ObservableList<Appointment> appointmentsToday) {
super(FXML);
clock = new DigitalClock();
timePanel.getChildren().add(clock);
Date currentDate = new Date(
DateTimeUtil.getCurrentDay(),
DateTimeUtil.getCurrentMonth(),
DateTimeUtil.getCurrentYear());
dateLabel.setText(currentDate.toString());
appointmentListPanel = new AppointmentListPanel(appointmentsToday);
appointmentListPanelPlaceholder.getChildren().add(appointmentListPanel.getRoot());
}
}
|
[
"[email protected]"
] | |
f3c506953e7ab851d6095ee5cbe0f0caf31f05b1
|
ddd38972d2e73c464ee77024f6ba4d6e11aac97b
|
/common/arcus-drivers/groovy-bindings/src/main/java/com/iris/driver/groovy/ClasspathResourceConnector.java
|
e520926ffd0db2dc4b162e9b95cab47ac3130a27
|
[
"Apache-2.0"
] |
permissive
|
arcus-smart-home/arcusplatform
|
bc5a3bde6dc4268b9aaf9082c75482e6599dfb16
|
a2293efa1cd8e884e6bedbe9c51bf29832ba8652
|
refs/heads/master
| 2022-04-27T02:58:20.720270 | 2021-09-05T01:36:12 | 2021-09-05T01:36:12 | 168,190,985 | 104 | 50 |
Apache-2.0
| 2022-03-10T01:33:34 | 2019-01-29T16:49:10 |
Java
|
UTF-8
|
Java
| false | false | 2,603 |
java
|
/*
* Copyright 2019 Arcus Project
*
* 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.iris.driver.groovy;
import groovy.util.ResourceConnector;
import groovy.util.ResourceException;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
/**
*
*/
public class ClasspathResourceConnector implements ResourceConnector {
private final ClassLoader loader;
private final String directory;
public ClasspathResourceConnector() {
this(null, (String) null);
}
public ClasspathResourceConnector(Class<?> relativeTo) {
this(relativeTo.getClassLoader(), relativeTo);
}
public ClasspathResourceConnector(ClassLoader loader) {
this(loader, (String) null);
}
public ClasspathResourceConnector(ClassLoader loader, Class<?> relativeTo) {
this(loader, relativeTo.getPackage().getName().replace('.', '/') + '/');
}
protected ClasspathResourceConnector(ClassLoader loader, String directory) {
this.loader = loader != null ? loader: getClass().getClassLoader();
this.directory = directory;
}
/* (non-Javadoc)
* @see groovy.util.ResourceConnector#getResourceConnection(java.lang.String)
*/
@Override
public URLConnection getResourceConnection(String name) throws ResourceException {
try {
if(this.directory != null) {
name = this.directory + name;
}
URL conn = loader.getResource(name);
if(conn == null) {
if (name.startsWith("file:")) {
URI fileUri = URI.create(name);
File file = new File(fileUri);
if (file.isFile()) {
conn = fileUri.toURL();
return conn.openConnection();
}
}
throw new ResourceException("Resource not found [classpath:/" + name + "]");
}
return conn.openConnection();
}
catch (IOException e) {
throw new ResourceException("Unable to open classpath:/" + name, e);
}
}
}
|
[
"[email protected]"
] | |
aa1c81938630a98901bf82278896892020af2f9b
|
f05ce58140ec9316e2449cda141d3df089fdd363
|
/target/generated-sources/antlr4/java/translator/DataBaseListener.java
|
fc710b2b2f3603696191c92edaff2ea1a65224db
|
[] |
no_license
|
zhekunz2/Stan2IRTranslator
|
e50448745642215c5803d7a1e000ca1f7b10e80c
|
5e710a3589e30981568b3dde8ed6cd90556bb8bd
|
refs/heads/master
| 2021-08-05T16:55:24.818560 | 2019-12-03T17:41:51 | 2019-12-03T17:41:51 | 225,680,232 | 0 | 0 | null | 2020-10-13T17:56:36 | 2019-12-03T17:39:38 |
Java
|
UTF-8
|
Java
| false | false | 3,167 |
java
|
// Generated from Data.g4 by ANTLR 4.7.1
package translator;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.tree.ErrorNode;
import org.antlr.v4.runtime.tree.TerminalNode;
/**
* This class provides an empty implementation of {@link DataListener},
* which can be extended to create a listener which only needs to handle a subset
* of the available methods.
*/
public class DataBaseListener implements DataListener {
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPrimitive(DataParser.PrimitiveContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPrimitive(DataParser.PrimitiveContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterDim(DataParser.DimContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitDim(DataParser.DimContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterStructure(DataParser.StructureContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitStructure(DataParser.StructureContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterArray(DataParser.ArrayContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitArray(DataParser.ArrayContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterDt(DataParser.DtContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitDt(DataParser.DtContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterAssign(DataParser.AssignContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitAssign(DataParser.AssignContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterDatafile(DataParser.DatafileContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitDatafile(DataParser.DatafileContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterEveryRule(ParserRuleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitEveryRule(ParserRuleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void visitTerminal(TerminalNode node) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void visitErrorNode(ErrorNode node) { }
}
|
[
"[email protected]"
] | |
fea354dae12190006f0a05ddf39caf6916c153ab
|
d9a463052348ac7040c7e2131bf2c5217b0b2a63
|
/src/yeah/o/punch/linkedlist/LinkedListSort.java
|
67a8f5341b15ceebdcba42320e33f11b7cccacd8
|
[] |
no_license
|
cherrypisces/leetcode
|
67f6ccc6f628883949a2facf420416fc813e76d3
|
ab5df1057ed252dbf5ffb34148c3c4a3d5674a9a
|
refs/heads/master
| 2016-09-06T16:45:32.697234 | 2014-11-16T08:26:17 | 2014-11-16T08:26:17 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,034 |
java
|
package yeah.o.punch.linkedlist;
import yeah.o.punch.Utilities;
class ListNode {
int val;
ListNode next;
ListNode(int x) {
val = x;
next = null;
}
public String toString() {
if (next != null)
return val + " --> ";
else
return val + " \n";
}
}
class LinkedList {
ListNode head;
public void appendToTail(int d) {
ListNode end = new ListNode(d);
appendNode(end);
}
public void appendNode(ListNode d) {
if (d==null) return;
if (head == null) {
head = d;
return;
}
ListNode n = head;
while(n.next != null) { n = n.next; }
n.next = d;
}
public static void printFromNode(ListNode d) {
ListNode curr = d;
while(curr != null) {
System.out.print(curr);
curr = curr.next;
}
}
public String toString() {
StringBuilder sb = new StringBuilder();
ListNode curr = head;
while(curr != null) {
sb.append(curr);
curr = curr.next;
}
return sb.toString();
}
}
public class LinkedListSort {
/*
* http://oj.leetcode.com/problems/sort-list/
*
* Sort a linked list in O(nlogn) time using constant space complexity.
*
* Similar to MergeSort
*
*/
public static ListNode sortList(ListNode head) {
if (head == null) {
return null;
} else if (head.next == null) {
return head;
}
int count = 1;
ListNode end = head;
while(end != null) {
end = end.next;
count++;
}
int k = count / 2;
end = head;
while(k > 1) {
end = end.next;
k--;
}
ListNode leftEnd = end;
ListNode rightStart = end.next;
leftEnd.next = null;
ListNode leftHead = sortList(head);
ListNode rightHead = sortList(rightStart);
ListNode newHead = merge(leftHead, rightHead);
return newHead;
}
public static ListNode merge(ListNode h_left, ListNode h_right) {
if (h_left==null && h_right==null)
return null;
else if (h_left==null) {
return h_right;
} else if (h_right==null) {
return h_left;
}
ListNode head = (h_left.val<=h_right.val) ? h_left : h_right;
ListNode curr = head;
ListNode left = (head == h_left) ? h_left.next : h_left;
ListNode right = (head == h_right) ? h_right.next : h_right;
while(left!=null && right!=null) {
if(left.val <= right.val) {
curr.next = left;
left = left.next;
} else {
curr.next = right;
right = right.next;
}
curr = curr.next;
}
if (left!=null) {
curr.next = left;
}
if (right!=null) {
curr.next = right;
}
return head;
}
/*
* http://oj.leetcode.com/problems/insertion-sort-list/
* Sort a linked list using insertion sort.
*
*/
public static ListNode insertionSortList(ListNode head) {
if (head == null)
return null;
else if (head.next == null)
return head;
ListNode currNode = head.next;
ListNode sortList = head;
sortList.next = null;
while(currNode != null) {
ListNode next = currNode.next;
currNode.next = null;
ListNode p = sortList;
ListNode pre = p;
while(p!=null) {
if (p.val <= currNode.val) {
pre = p;
p = p.next;
}
else {
if(p == sortList) {
currNode.next = sortList;
sortList = currNode;
} else {
pre.next = currNode;
currNode.next = p;
}
break;
}
}
if (p == null) {
pre.next = currNode;
}
currNode = next;
}
return sortList;
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
LinkedList list = new LinkedList();
int num = Utilities.randomIntInRange(5, 10);
for (int i=0; i<num; i++) {
int n = Utilities.randomIntInRange(0, 50);
list.appendToTail(n);
}
System.out.println("The linked list is: ");
System.out.println(list);
// ListNode head = insertionSortList(list.head);
// System.out.println("After insertion sort: ");
// LinkedList.printFromNode(head);
ListNode head = sortList(list.head);
System.out.println("After quick sort: ");
LinkedList.printFromNode(head);
}
}
|
[
"[email protected]"
] | |
25ffc2c453ea670b071b51e19f76a320e4785896
|
7e735bc662ac850a408b30d6a9179efe1c19d371
|
/src/main/java/com/neosono/assignment/jsfandspring/service/DeveloperSkillsService.java
|
d4a9aa650fdbea5cddfd16a010c08e87a58a0270
|
[] |
no_license
|
Neosono/NeoSonoAssignmentJSFandSpringboot
|
436e0d1bc007f5617790674443765bd358153129
|
a46f279c062e50c78153a15eeb3573f80d2d18e3
|
refs/heads/master
| 2023-07-13T18:15:17.461105 | 2021-08-21T09:30:41 | 2021-08-21T09:30:41 | 398,513,998 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 609 |
java
|
package com.neosono.assignment.jsfandspring.service;
import com.neosono.assignment.jsfandspring.model.DeveloperSkills;
import com.neosono.assignment.jsfandspring.repository.DeveloperSkillsRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional;
@Service
public class DeveloperSkillsService {
@Autowired
DeveloperSkillsRepository repo;
public void addSkill(DeveloperSkills skill) { repo.save(skill); }
public Optional<DeveloperSkills> getSkill(Long id) {
return repo.findById(id);
}
}
|
[
"[email protected]"
] | |
e7b3e93c5d3b7ce03b0cbe5e5165387afb97ab7c
|
d512270b9dcb19f76f9efa13af9f7e295faeb2e6
|
/server/gateway-server/src/test/java/br/com/jnetocurti/gatewayserver/GatewayServerApplicationTests.java
|
1b9fc0869f6a2b2724e5d4f5dbe9886e2bb9e747
|
[] |
no_license
|
jnetocurti/spring-cloud-getting-started
|
0bd82624bb6f8f06f958e6ef7f89f3ea69a1a279
|
b7f6fa82959614cb5a051c508374b2e030050d3c
|
refs/heads/master
| 2023-01-20T15:21:53.419315 | 2017-12-14T01:10:45 | 2017-12-14T01:10:45 | 114,007,711 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 355 |
java
|
package br.com.jnetocurti.gatewayserver;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class GatewayServerApplicationTests {
@Test
public void contextLoads() {
}
}
|
[
"[email protected]"
] | |
330018de925381f759a9cd092962c3ff84199cc9
|
3f82761cf581836cfd82b90f6144dbc1313fe3ea
|
/backend/Cube/src/com/cube/utils/LoaderResourceElements.java
|
7a29e75f746f02fe3e27037e1e42837995c3678e
|
[] |
no_license
|
Bekor90/cube
|
9091c0ea49392c37f0da3d975ff78056cb78cc38
|
5a8a1e10d4ffe7d3e2823cc4ec6ae694f304fec8
|
refs/heads/master
| 2023-01-24T01:12:37.488840 | 2019-10-30T14:56:54 | 2019-10-30T14:56:54 | 211,002,633 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 362 |
java
|
package com.cube.utils;
public class LoaderResourceElements {
private static LoaderResourceElements loaderResourceElements;
private LoaderResourceElements() {
}
public static LoaderResourceElements getInstance() {
if (loaderResourceElements == null) {
loaderResourceElements = new LoaderResourceElements();
}
return loaderResourceElements;
}
}
|
[
"[email protected]"
] | |
498e98a73f23256d7395143fcd89879530cfdae7
|
3b1dab51b8675c21905ab528e7148d80fe2ecdf2
|
/src/streaming/entity/Film.java
|
14f77173dc9edc35a45ad2e65fddb9af5a93b925
|
[] |
no_license
|
siku18/Streaming
|
423af8b7772e6fb3569d13d4e523c899f478d4f3
|
23a6239a05bd885ade278ca29620369bc8ffa3d7
|
refs/heads/master
| 2021-01-10T03:20:30.131412 | 2016-02-22T13:45:45 | 2016-02-22T13:45:45 | 52,268,539 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,744 |
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 streaming.entity;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import org.eclipse.persistence.annotations.CascadeOnDelete;
/**
* Entité gérant les films blbobll
* @author admin
*/
@Entity
public class Film implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String titre;
private String synopsis;
private Long annee;
@ManyToOne
@JoinColumn(name = "PAYS_ID")
private Pays pays;
@ManyToOne
@JoinColumn(name = "GENRE_ID")
private Genre genre;
@OneToMany(mappedBy = "film", cascade = {CascadeType.PERSIST, CascadeType.REMOVE})
@CascadeOnDelete
private List<Lien> liens = new ArrayList<>();
@ManyToMany
@JoinTable(name = "Film_Realisateur")
private List<Realisateur> realisateurs = new ArrayList<>();
public Film(Long id, String titre, String synopsis, Long annee, Pays pays, Genre genre) {
this.id = id;
this.titre = titre;
this.synopsis = synopsis;
this.annee = annee;
this.pays = pays;
this.genre = genre;
}
public Film() {
}
public String getTitre() {
return titre;
}
public void setTitre(String titre) {
this.titre = titre;
}
public Long getAnnee() {
return annee;
}
public void setAnnee(Long annee) {
this.annee = annee;
}
public Pays getPays() {
return pays;
}
public void setPays(Pays pays) {
this.pays = pays;
}
public Genre getGenre() {
return genre;
}
public void setGenre(Genre genre) {
this.genre = genre;
}
public List<Lien> getLiens() {
return liens;
}
public void setLiens(List<Lien> liens) {
this.liens = liens;
}
public List<Realisateur> getRealisateurs() {
return realisateurs;
}
public void setRealisateurs(List<Realisateur> realisateurs) {
this.realisateurs = realisateurs;
}
public String getSynopsis() {
return synopsis;
}
public void setSynopsis(String synopsis) {
this.synopsis = synopsis;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Film)) {
return false;
}
Film other = (Film) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "streaming.entity.FILM[ id=" + id + " ]";
}
}
|
[
"[email protected]"
] | |
b877c3fae3d9c0480d97459f55d8cf092976f780
|
c0789df2ffeb04f394d9e095af4ec6fc44e613ed
|
/src/test/java/com/plenigo/sdk/models/LoginConfigTest.java
|
5b256e145712db2acea6d4415d433af2d824a5f8
|
[] |
no_license
|
plenigo/plenigo_java_sdk
|
f9237a50c7cc2699010e2c226dd5b80ac9cd435e
|
e39c0767523936a8ca58afa02ce6000a3cc483e1
|
refs/heads/master
| 2021-01-10T21:49:18.232147 | 2018-09-05T04:19:04 | 2018-09-05T04:19:04 | 35,675,377 | 4 | 0 | null | 2017-05-04T08:06:38 | 2015-05-15T13:26:28 |
Java
|
UTF-8
|
Java
| false | false | 329 |
java
|
package com.plenigo.sdk.models;
import org.junit.Test;
import static org.junit.Assert.assertNotNull;
/**
* <p>
* Tests for {@link LoginConfig}.
* </p>
*/
public class LoginConfigTest {
@Test
public void testToString() {
assertNotNull(new LoginConfig("redUri", DataAccessScope.PROFILE).toString());
}
}
|
[
"[email protected]"
] | |
ce127ef8d5b8c754de4beaaa8314386a530e9552
|
3b56fdf6aa5f4595860eedb73d0e7ced8bf33d2b
|
/DukesOfRealm/src/SampleGame/player/PlayerMenu.java
|
7066ab63d0fe2a3de953e561e28252a1de9d0479
|
[] |
no_license
|
ElliotRenel/Projet_POO
|
50ebb2722d2395fc0b33bfe001db31f496a32ee9
|
2a77858736c640a16023388e61c20d3e608932be
|
refs/heads/master
| 2020-09-14T15:58:22.122192 | 2020-01-06T22:46:01 | 2020-01-06T22:46:01 | 223,176,152 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,478 |
java
|
package SampleGame.player;
import SampleGame.Main;
import SampleGame.Settings;
import SampleGame.army.Soldier.SoldierType;
import SampleGame.tiles.Castle;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuItem;
public class PlayerMenu extends ContextMenu {
Castle castle;
Human owner;
public PlayerMenu(Castle castle) {
this.castle = castle;
this.owner = (Human)castle.getOwner();
// Castle Infos
MenuItem infos = new MenuItem();
infos.setText("Owner : You\n"
+ "Treasure : "+castle.getTreasure()+"\n"
+ "Castle Level :"+castle.getLevel()+" ("+castle.getLevel()*Settings.CASTLE_REVENUE+" coins per round)\n"
+ "Army count : \n"
+ "\t> Stinger : "+castle.getNbTroupe(SoldierType.P)+"\n"
+ "\t> Knights : "+castle.getNbTroupe(SoldierType.C)+"\n"
+ "\t> Onagra : "+castle.getNbTroupe(SoldierType.O)+"\n"
);
// Produce Army
Menu army = new Menu("Produce Army");
Menu piquier = new Menu("Piquier");
Menu chevalier = new Menu("Chevalier");
Menu onagre = new Menu("Onagre");
assignProducer(piquier, SoldierType.P);
assignProducer(chevalier, SoldierType.C);
assignProducer(onagre, SoldierType.O);
army.getItems().addAll(piquier,chevalier,onagre);
// Upgrade Castle
MenuItem upgrade = new MenuItem("Upgrade Castle to Lvl "+(castle.getLevel()+1)+" (cost:"+1000*(castle.getLevel()+1)+")");
upgrade.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
castle.upgradeCastle();
}
});;
upgrade.setDisable(!castle.upgradeCastle(true) || castle.isUpgrading());
this.getItems().addAll(infos,army,upgrade);
}
private void assignProducer(Menu soldier, SoldierType type) {
MenuItem produce1 = new MenuItem("1");
produce1.setOnAction(e -> {
castle.produceArmy(type, 1);
});
MenuItem produce10 = new MenuItem("10");
produce10.setOnAction(e -> {
castle.produceArmy(type, 10);
});
MenuItem produce100 = new MenuItem("100");
produce100.setOnAction(e -> {
castle.produceArmy(type, 100);
});
produce1.setDisable(!castle.produceArmy(type, 1, true));
produce10.setDisable(!castle.produceArmy(type, 10, true));
produce100.setDisable(!castle.produceArmy(type, 100, true));
soldier.getItems().addAll(produce1,produce10,produce100);
}
}
|
[
"[email protected]"
] | |
9e363c94c7f017dd417828f9a5f67287c3e54152
|
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
|
/data_defect4j/preprossed_method_corpus/Math/67/org/apache/commons/math/transform/FastHadamardTransformer_fht_206.java
|
7530832d374f77c1a26215997d022f55a5abdc5b
|
[] |
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,566 |
java
|
org apach common math transform
implement href http www archiv chipcent dsp dsp000517 dsp000517f1 html fast hadamard transform fht
transform input vector output vector
addit transform real vector hadamard transform
transform integ vector integ vector integ transform
invert directli due scale factor lead ration result
invers transform integ vector ration
vector
version revis date
fast hadamard transform fasthadamardtransform real transform realtransform
fht fast hadamard transform subtract addit
param input vector
output vector
except illeg argument except illegalargumentexcept input arrai power
fht illeg argument except illegalargumentexcept
row count input vector
length
half halfn
form
fast fourier transform fastfouriertransform power of2 ispowerof2
math runtim except mathruntimeexcept creat illeg argument except createillegalargumentexcept
local format localizedformat power
creat matrix column row
singl dimens arrai altern
previou ypreviou
current ycurrent clone
iter left column
column
tmp ytmp current ycurrent
current ycurrent previou ypreviou
previou ypreviou tmp ytmp
iter top bottom row
half halfn
top
top part work addit
twoi
current ycurrent previou ypreviou twoi previou ypreviou twoi
half halfn
bottom
bottom part work subtract
twoi
current ycurrent previou ypreviou twoi previou ypreviou twoi
comput output vector
current ycurrent
|
[
"[email protected]"
] | |
881a5e14ff4fad24ea30a7bcd20a27aeb4bdb1fb
|
d03056a844254d11e369309089df7b9817b4bcc3
|
/rmi-framework/FileServer/src/com/woyao/system/spring/interceptor/PagePluginInterceptor.java
|
1c4ed6c92ef0b7b37d1bdea0451e4cae228ce9d5
|
[] |
no_license
|
initMe/rmi-framework
|
419cb5a6429567681f57b59470cc674b482a6fc5
|
a7aba950baf711c316446914feababca538b1c8e
|
refs/heads/master
| 2020-12-24T12:06:22.582392 | 2016-11-07T11:44:52 | 2016-11-07T11:44:52 | 73,072,369 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 8,263 |
java
|
package com.woyao.system.spring.interceptor;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import javax.xml.bind.PropertyException;
import org.apache.ibatis.executor.ErrorContext;
import org.apache.ibatis.executor.ExecutorException;
import org.apache.ibatis.executor.statement.BaseStatementHandler;
import org.apache.ibatis.executor.statement.RoutingStatementHandler;
import org.apache.ibatis.executor.statement.StatementHandler;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.ParameterMapping;
import org.apache.ibatis.mapping.ParameterMode;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.plugin.Intercepts;
import org.apache.ibatis.plugin.Invocation;
import org.apache.ibatis.plugin.Plugin;
import org.apache.ibatis.plugin.Signature;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.reflection.property.PropertyTokenizer;
import org.apache.ibatis.scripting.xmltags.ForEachSqlNode;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.type.TypeHandler;
import org.apache.ibatis.type.TypeHandlerRegistry;
import com.bean.db.Page;
import com.utils.LoggerUtil;
import com.utils.ObjectUtil;
import com.utils.StringUtil;
@Intercepts({@Signature(type=StatementHandler.class,method="prepare",args={Connection.class})})
public class PagePluginInterceptor implements Interceptor {
private static String dialect = "";
private static String pageSqlId = ".*istPage.*";
@SuppressWarnings("unchecked")
public Object intercept(Invocation ivk) throws Throwable {
if(ivk.getTarget() instanceof RoutingStatementHandler){
RoutingStatementHandler statementHandler = (RoutingStatementHandler)ivk.getTarget();
BaseStatementHandler delegate = (BaseStatementHandler) ObjectUtil.getAttributeValue(statementHandler, "delegate");
MappedStatement mappedStatement = (MappedStatement) ObjectUtil.getAttributeValue(delegate, "mappedStatement");
// 重新设定编码集
// ((Connection) ivk.getArgs()[0]).prepareStatement("set names 'utf8mb4'").executeQuery();
// 补充创建时间(create_time)字段
if(mappedStatement.getId().indexOf("add")>-1 || mappedStatement.getId().indexOf("insert")>-1) {
Object parameterObject = delegate.getBoundSql().getParameterObject();
Object createTime = ObjectUtil.getAttributeValue(parameterObject, "create_time");
if(createTime == null) {
ObjectUtil.setAttribute(parameterObject, "create_time", System.currentTimeMillis());
}
}
// 分页istPageLoad
if(mappedStatement.getId().matches(pageSqlId)){
BoundSql boundSql = delegate.getBoundSql();
Object parameterObject = boundSql.getParameterObject();
if(parameterObject==null){
throw new NullPointerException("parameterObject尚未实例化!");
// System.out.println("parameterObject尚未实例化!");
}else{
Connection connection = (Connection) ivk.getArgs()[0];
String sql = boundSql.getSql();
String countSql = "select count(0) from (" + sql+ ") as total";
PreparedStatement countStmt = connection.prepareStatement(countSql);
BoundSql countBS = new BoundSql(mappedStatement.getConfiguration(),countSql,boundSql.getParameterMappings(),parameterObject);
setParameters(countStmt,mappedStatement,countBS,parameterObject);
ResultSet rs = countStmt.executeQuery();
int count = 0;
if (rs.next()) {
count = rs.getInt(1);
}
rs.close();
countStmt.close();
Page page = null;
if(parameterObject instanceof Page){
page = (Page) parameterObject;
page.setEntityOrField(true);
page.setTotalResult(count);
}else{
Map<String, Class> pageField = ObjectUtil.getFieldNames(parameterObject.getClass());
if(pageField.containsKey("page")){
page = (Page) ObjectUtil.getAttributeValue(parameterObject,"page");
if(page==null) {
page = new Page();
}
page.setEntityOrField(false);
page.setTotalResult(count);
ObjectUtil.setAttribute(parameterObject,"page", page);
}else{
// throw new NoSuchFieldException(parameterObject.getClass().getName()+"不存 page 属性!");
LoggerUtil.error(this.getClass(),"无page属性");
}
}
String pageSql = generatePageSql(sql,page);
//
// LoggerUtil.info(this.getClass(),"==================================");
// LoggerUtil.info(this.getClass(),pageSql);
// LoggerUtil.info(this.getClass(),"==================================");
//
ObjectUtil.setAttribute(boundSql, "sql", pageSql);
}
}
}
return ivk.proceed();
}
@SuppressWarnings("unchecked")
private void setParameters(PreparedStatement ps,MappedStatement mappedStatement,BoundSql boundSql,Object parameterObject) throws SQLException {
ErrorContext.instance().activity("setting parameters").object(mappedStatement.getParameterMap().getId());
List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
if (parameterMappings != null) {
Configuration configuration = mappedStatement.getConfiguration();
TypeHandlerRegistry typeHandlerRegistry = configuration.getTypeHandlerRegistry();
MetaObject metaObject = parameterObject == null ? null: configuration.newMetaObject(parameterObject);
for (int i = 0; i < parameterMappings.size(); i++) {
ParameterMapping parameterMapping = parameterMappings.get(i);
if (parameterMapping.getMode() != ParameterMode.OUT) {
Object value;
String propertyName = parameterMapping.getProperty();
PropertyTokenizer prop = new PropertyTokenizer(propertyName);
if (parameterObject == null) {
value = null;
} else if (typeHandlerRegistry.hasTypeHandler(parameterObject.getClass())) {
value = parameterObject;
} else if (boundSql.hasAdditionalParameter(propertyName)) {
value = boundSql.getAdditionalParameter(propertyName);
} else if (propertyName.startsWith(ForEachSqlNode.ITEM_PREFIX)&& boundSql.hasAdditionalParameter(prop.getName())) {
value = boundSql.getAdditionalParameter(prop.getName());
if (value != null) {
value = configuration.newMetaObject(value).getValue(propertyName.substring(prop.getName().length()));
}
} else {
value = metaObject == null ? null : metaObject.getValue(propertyName);
}
TypeHandler typeHandler = parameterMapping.getTypeHandler();
if (typeHandler == null) {
throw new ExecutorException("There was no TypeHandler found for parameter "+ propertyName + " of statement "+ mappedStatement.getId());
}
typeHandler.setParameter(ps, i + 1, value, parameterMapping.getJdbcType());
}
}
}
}
private String generatePageSql(String sql,Page page){
if(page!=null && !StringUtil.isEmpty(dialect)){
StringBuffer pageSql = new StringBuffer();
if("oracle".equals(dialect)){
pageSql.append("select * from (select tmp_tb.*,ROWNUM row_id from (");
pageSql.append(sql);
pageSql.append(") as tmp_tb where ROWNUM<=");
pageSql.append(page.getCurrentResult()+page.getShowCount());
pageSql.append(") where row_id>");
pageSql.append(page.getCurrentResult());
}else if("mysql".equalsIgnoreCase(dialect)){
pageSql.append("select * from (");
pageSql.append(sql);
pageSql.append(" limit ").append((page.getCurrentPage()-1)*page.getShowCount()).append(",").append(page.getShowCount());
pageSql.append(") as tmp_tb ");
}
return pageSql.toString();
}else{
return sql;
}
}
public Object plugin(Object arg0) {
return Plugin.wrap(arg0, this);
}
public void setProperties(Properties p) {
dialect = p.getProperty("dialect");
if (StringUtil.isEmpty(dialect)) {
try {
throw new PropertyException("dialect property is not found!");
} catch (PropertyException e) {
e.printStackTrace();
}
}
pageSqlId = p.getProperty("pageSqlId");
if (StringUtil.isEmpty(pageSqlId)) {
try {
throw new PropertyException("pageSqlId property is not found!");
} catch (PropertyException e) {
e.printStackTrace();
}
}
}
}
|
[
"[email protected]"
] | |
69aade1ffab6630c36d5608da6a50cb4a9197fb8
|
6d61d5f02e5e0db8b6e379fb62431dc42bd19fec
|
/aCis_gameserver/java/net/sf/l2j/gameserver/model/olympiad/AbstractOlympiadGame.java
|
aa456938c97fa52c40ec9883b46e46cfd8bbf9f2
|
[] |
no_license
|
blackale21/Lineage_aCis
|
e9908574a8735f237cb13f7b6e2b88c44389189c
|
da183baaac39e5b68288dc871f1bb928fc396d60
|
refs/heads/master
| 2021-05-23T13:58:36.425521 | 2020-04-05T21:13:49 | 2020-04-05T21:13:49 | 253,324,943 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 12,985 |
java
|
package net.sf.l2j.gameserver.model.olympiad;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.sf.l2j.gameserver.data.MapRegionTable;
import net.sf.l2j.gameserver.data.SkillTable;
import net.sf.l2j.gameserver.model.L2Skill;
import net.sf.l2j.gameserver.model.actor.Creature;
import net.sf.l2j.gameserver.model.actor.Summon;
import net.sf.l2j.gameserver.model.actor.ai.CtrlIntention;
import net.sf.l2j.gameserver.model.actor.instance.Pet;
import net.sf.l2j.gameserver.model.actor.instance.Player;
import net.sf.l2j.gameserver.model.group.Party;
import net.sf.l2j.gameserver.model.group.Party.MessageType;
import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
import net.sf.l2j.gameserver.model.location.Location;
import net.sf.l2j.gameserver.model.zone.type.L2OlympiadStadiumZone;
import net.sf.l2j.gameserver.model.zone.type.L2TownZone;
import net.sf.l2j.gameserver.network.SystemMessageId;
import net.sf.l2j.gameserver.network.serverpackets.ExOlympiadMode;
import net.sf.l2j.gameserver.network.serverpackets.InventoryUpdate;
import net.sf.l2j.gameserver.network.serverpackets.L2GameServerPacket;
import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
/**
* @author godson, GodKratos, Pere, DS
*/
public abstract class AbstractOlympiadGame
{
protected static final Logger _log = Logger.getLogger(AbstractOlympiadGame.class.getName());
protected static final String POINTS = "olympiad_points";
protected static final String COMP_DONE = "competitions_done";
protected static final String COMP_WON = "competitions_won";
protected static final String COMP_LOST = "competitions_lost";
protected static final String COMP_DRAWN = "competitions_drawn";
protected long _startTime = 0;
protected boolean _aborted = false;
protected final int _stadiumID;
protected AbstractOlympiadGame(int id)
{
_stadiumID = id;
}
public final boolean isAborted()
{
return _aborted;
}
public final int getStadiumId()
{
return _stadiumID;
}
protected boolean makeCompetitionStart()
{
_startTime = System.currentTimeMillis();
return !_aborted;
}
protected final void addPointsToParticipant(Participant par, int points)
{
par.updateStat(POINTS, points);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_GAINED_S2_OLYMPIAD_POINTS);
sm.addString(par.name);
sm.addNumber(points);
broadcastPacket(sm);
}
protected final void removePointsFromParticipant(Participant par, int points)
{
par.updateStat(POINTS, -points);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_LOST_S2_OLYMPIAD_POINTS);
sm.addString(par.name);
sm.addNumber(points);
broadcastPacket(sm);
}
/**
* Return null if player passed all checks or broadcast the reason to opponent.
* @param player to check.
* @return null or reason.
*/
protected static SystemMessage checkDefaulted(Player player)
{
if (player == null || !player.isOnline())
return SystemMessage.getSystemMessage(SystemMessageId.THE_GAME_HAS_BEEN_CANCELLED_BECAUSE_THE_OTHER_PARTY_ENDS_THE_GAME);
if (player.getClient() == null || player.getClient().isDetached())
return SystemMessage.getSystemMessage(SystemMessageId.THE_GAME_HAS_BEEN_CANCELLED_BECAUSE_THE_OTHER_PARTY_ENDS_THE_GAME);
// safety precautions
if (player.isInObserverMode())
return SystemMessage.getSystemMessage(SystemMessageId.THE_GAME_HAS_BEEN_CANCELLED_BECAUSE_THE_OTHER_PARTY_DOES_NOT_MEET_THE_REQUIREMENTS_FOR_JOINING_THE_GAME);
if (player.isDead())
{
player.sendPacket(SystemMessageId.CANNOT_PARTICIPATE_OLYMPIAD_WHILE_DEAD);
return SystemMessage.getSystemMessage(SystemMessageId.THE_GAME_HAS_BEEN_CANCELLED_BECAUSE_THE_OTHER_PARTY_DOES_NOT_MEET_THE_REQUIREMENTS_FOR_JOINING_THE_GAME);
}
if (player.isSubClassActive())
{
player.sendPacket(SystemMessageId.SINCE_YOU_HAVE_CHANGED_YOUR_CLASS_INTO_A_SUB_JOB_YOU_CANNOT_PARTICIPATE_IN_THE_OLYMPIAD);
return SystemMessage.getSystemMessage(SystemMessageId.THE_GAME_HAS_BEEN_CANCELLED_BECAUSE_THE_OTHER_PARTY_DOES_NOT_MEET_THE_REQUIREMENTS_FOR_JOINING_THE_GAME);
}
if (player.isCursedWeaponEquipped())
{
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CANNOT_JOIN_OLYMPIAD_POSSESSING_S1).addItemName(player.getCursedWeaponEquippedId()));
return SystemMessage.getSystemMessage(SystemMessageId.THE_GAME_HAS_BEEN_CANCELLED_BECAUSE_THE_OTHER_PARTY_DOES_NOT_MEET_THE_REQUIREMENTS_FOR_JOINING_THE_GAME);
}
if (player.getInventoryLimit() * 0.8 <= player.getInventory().getSize())
{
player.sendPacket(SystemMessageId.SINCE_80_PERCENT_OR_MORE_OF_YOUR_INVENTORY_SLOTS_ARE_FULL_YOU_CANNOT_PARTICIPATE_IN_THE_OLYMPIAD);
return SystemMessage.getSystemMessage(SystemMessageId.THE_GAME_HAS_BEEN_CANCELLED_BECAUSE_THE_OTHER_PARTY_DOES_NOT_MEET_THE_REQUIREMENTS_FOR_JOINING_THE_GAME);
}
return null;
}
protected static final boolean portPlayerToArena(Participant par, Location loc, int id)
{
final Player player = par.player;
if (player == null || !player.isOnline())
return false;
try
{
player.getSavedLocation().set(player.getX(), player.getY(), player.getZ());
player.setTarget(null);
player.setOlympiadGameId(id);
player.setOlympiadMode(true);
player.setOlympiadStart(false);
player.setOlympiadSide(par.side);
player.teleToLocation(loc, 0);
player.sendPacket(new ExOlympiadMode(par.side));
}
catch (Exception e)
{
_log.log(Level.WARNING, e.getMessage(), e);
return false;
}
return true;
}
protected static final void removals(Player player, boolean removeParty)
{
try
{
if (player == null)
return;
// Remove Buffs
player.stopAllEffectsExceptThoseThatLastThroughDeath();
// Remove Clan Skills
if (player.getClan() != null)
{
for (L2Skill skill : player.getClan().getClanSkills())
player.removeSkill(skill, false);
}
// Abort casting if player casting
player.abortAttack();
player.abortCast();
// Force the character to be visible
player.getAppearance().setVisible();
// Remove Hero Skills
if (player.isHero())
{
for (L2Skill skill : SkillTable.getHeroSkills())
player.removeSkill(skill, false);
}
// Heal Player fully
player.setCurrentCp(player.getMaxCp());
player.setCurrentHp(player.getMaxHp());
player.setCurrentMp(player.getMaxMp());
// Remove Summon's Buffs
final Summon summon = player.getPet();
if (summon != null)
{
summon.stopAllEffectsExceptThoseThatLastThroughDeath();
summon.abortAttack();
summon.abortCast();
if (summon instanceof Pet)
summon.unSummon(player);
}
// stop any cubic that has been given by other player.
player.stopCubicsByOthers();
// Remove player from his party
if (removeParty)
{
final Party party = player.getParty();
if (party != null)
party.removePartyMember(player, MessageType.EXPELLED);
}
player.checkItemRestriction();
// Remove shot automation
player.disableAutoShotsAll();
// Discharge any active shots
ItemInstance item = player.getActiveWeaponInstance();
if (item != null)
item.unChargeAllShots();
player.sendSkillList();
}
catch (Exception e)
{
_log.log(Level.WARNING, e.getMessage(), e);
}
}
/**
* Buff the player. WW2 for fighter/mage + haste 1 if fighter.
* @param player : the happy benefactor.
*/
protected static final void buffPlayer(Player player)
{
L2Skill skill = SkillTable.getInstance().getInfo(1204, 2); // Windwalk 2
if (skill != null)
{
skill.getEffects(player, player);
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT).addSkillName(1204));
}
if (!player.isMageClass())
{
skill = SkillTable.getInstance().getInfo(1086, 1); // Haste 1
if (skill != null)
{
skill.getEffects(player, player);
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT).addSkillName(1086));
}
}
}
/**
* Heal the player.
* @param player : the happy benefactor.
*/
protected static final void healPlayer(Player player)
{
player.setCurrentCp(player.getMaxCp());
player.setCurrentHp(player.getMaxHp());
player.setCurrentMp(player.getMaxMp());
}
protected static final void cleanEffects(Player player)
{
try
{
// prevent players kill each other
player.setOlympiadStart(false);
player.setTarget(null);
player.abortAttack();
player.abortCast();
player.getAI().setIntention(CtrlIntention.IDLE);
if (player.isDead())
player.setIsDead(false);
final Summon summon = player.getPet();
if (summon != null && !summon.isDead())
{
summon.setTarget(null);
summon.abortAttack();
summon.abortCast();
summon.getAI().setIntention(CtrlIntention.IDLE);
}
player.setCurrentCp(player.getMaxCp());
player.setCurrentHp(player.getMaxHp());
player.setCurrentMp(player.getMaxMp());
player.getStatus().startHpMpRegeneration();
}
catch (Exception e)
{
_log.log(Level.WARNING, e.getMessage(), e);
}
}
protected static final void playerStatusBack(Player player)
{
try
{
player.setOlympiadMode(false);
player.setOlympiadStart(false);
player.setOlympiadSide(-1);
player.setOlympiadGameId(-1);
player.sendPacket(new ExOlympiadMode(0));
player.stopAllEffectsExceptThoseThatLastThroughDeath();
player.clearCharges();
final Summon summon = player.getPet();
if (summon != null && !summon.isDead())
summon.stopAllEffectsExceptThoseThatLastThroughDeath();
// Add Clan Skills
if (player.getClan() != null)
{
player.getClan().addSkillEffects(player);
// heal again after adding clan skills
player.setCurrentCp(player.getMaxCp());
player.setCurrentHp(player.getMaxHp());
player.setCurrentMp(player.getMaxMp());
}
// Add Hero Skills
if (player.isHero())
{
for (L2Skill skill : SkillTable.getHeroSkills())
player.addSkill(skill, false);
}
player.sendSkillList();
}
catch (Exception e)
{
_log.log(Level.WARNING, e.getMessage(), e);
}
}
protected static final void portPlayerBack(Player player)
{
if (player == null)
return;
Location loc = player.getSavedLocation();
if (loc.equals(Location.DUMMY_LOC))
return;
final L2TownZone town = MapRegionTable.getTown(loc.getX(), loc.getY(), loc.getZ());
if (town != null)
loc = town.getSpawnLoc();
player.teleToLocation(loc, 0);
player.getSavedLocation().clean();
}
public static final void rewardParticipant(Player player, int[][] reward)
{
if (player == null || !player.isOnline() || reward == null)
return;
try
{
final InventoryUpdate iu = new InventoryUpdate();
for (int[] it : reward)
{
if (it == null || it.length != 2)
continue;
final ItemInstance item = player.getInventory().addItem("Olympiad", it[0], it[1], player, null);
if (item == null)
continue;
iu.addModifiedItem(item);
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.EARNED_S2_S1_S).addItemName(it[0]).addNumber(it[1]));
}
player.sendPacket(iu);
}
catch (Exception e)
{
_log.log(Level.WARNING, e.getMessage(), e);
}
}
public abstract CompetitionType getType();
public abstract String[] getPlayerNames();
public abstract boolean containsParticipant(int playerId);
public abstract void sendOlympiadInfo(Creature player);
public abstract void broadcastOlympiadInfo(L2OlympiadStadiumZone stadium);
protected abstract void broadcastPacket(L2GameServerPacket packet);
protected abstract boolean checkDefaulted();
protected abstract void removals();
protected abstract void buffPlayers();
protected abstract void healPlayers();
protected abstract boolean portPlayersToArena(List<Location> spawns);
protected abstract void cleanEffects();
protected abstract void portPlayersBack();
protected abstract void playersStatusBack();
protected abstract void clearPlayers();
protected abstract void handleDisconnect(Player player);
protected abstract void resetDamage();
protected abstract void addDamage(Player player, int damage);
protected abstract boolean checkBattleStatus();
protected abstract boolean haveWinner();
protected abstract void validateWinner(L2OlympiadStadiumZone stadium);
protected abstract int getDivider();
protected abstract int[][] getReward();
}
|
[
"[email protected]"
] | |
2ff9e010d70b76adc0b7331e3a1c8e9fcc3ccb64
|
6a2465141d3b03818c4f33bf15fdd2799ec6e3ac
|
/src/main/java/com/regissantana/spring/skeleton/infrastructure/error/SkeletonErrorDefinition.java
|
61bba0524c12f11682073a96975ab90ab304e612
|
[] |
no_license
|
santanaregis/spring-reactive-skeleton
|
fb45ec7f691ae21e1741f151a1c7e57909cb910c
|
2b7f49bc040979abb40c3372d1df86dfedb1b9d8
|
refs/heads/master
| 2022-11-13T12:14:03.560750 | 2020-07-06T13:48:29 | 2020-07-06T13:48:29 | 273,516,864 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 520 |
java
|
package com.regissantana.spring.skeleton.infrastructure.error;
public enum SkeletonErrorDefinition implements ErrorDefinition{
ZIP_CODE_MANDATORY("RS-SK-01", "o CEP é um campo obrigatório."),
;
private String code;
private String message;
SkeletonErrorDefinition(final String code, final String message) {
this.code = code;
this.message = message;
}
public String getCode() {
return code;
}
public String getMessage() {
return message;
}
}
|
[
"[email protected]"
] | |
30cff8d1d68942e04c437f8c64b1f2aae00c460f
|
573b9c497f644aeefd5c05def17315f497bd9536
|
/src/main/java/com/alipay/api/response/KoubeiQualityTestCloudacptBatchQueryResponse.java
|
9bfa0c6ee4017a0b49230a78df692486d1aaddbb
|
[
"Apache-2.0"
] |
permissive
|
zzzyw-work/alipay-sdk-java-all
|
44d72874f95cd70ca42083b927a31a277694b672
|
294cc314cd40f5446a0f7f10acbb5e9740c9cce4
|
refs/heads/master
| 2022-04-15T21:17:33.204840 | 2020-04-14T12:17:20 | 2020-04-14T12:17:20 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,312 |
java
|
package com.alipay.api.response;
import java.util.List;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.internal.mapping.ApiListField;
import com.alipay.api.domain.OpenBatch;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: koubei.quality.test.cloudacpt.batch.query response.
*
* @author auto create
* @since 1.0, 2019-01-07 20:51:15
*/
public class KoubeiQualityTestCloudacptBatchQueryResponse extends AlipayResponse {
private static final long serialVersionUID = 1664854289338979666L;
/**
* 活动id
*/
@ApiField("activity_id")
private String activityId;
/**
* 批次列表
*/
@ApiListField("batch_list")
@ApiField("open_batch")
private List<OpenBatch> batchList;
/**
* 单品批次数
*/
@ApiField("batch_num")
private String batchNum;
public void setActivityId(String activityId) {
this.activityId = activityId;
}
public String getActivityId( ) {
return this.activityId;
}
public void setBatchList(List<OpenBatch> batchList) {
this.batchList = batchList;
}
public List<OpenBatch> getBatchList( ) {
return this.batchList;
}
public void setBatchNum(String batchNum) {
this.batchNum = batchNum;
}
public String getBatchNum( ) {
return this.batchNum;
}
}
|
[
"[email protected]"
] | |
739566effe21f2a65f1f82c59d16cfbd762c9104
|
042342f9dc0e8662a1a7da671ab5dc9d82ccd835
|
/esb/org.wso2.developerstudio.eclipse.gmf.esb.diagram/src/org/wso2/developerstudio/eclipse/gmf/esb/diagram/edit/commands/ProxyServiceSequenceContainerCreateCommand.java
|
227e52a457bd7e4903094f1188a0eff10c896de3
|
[
"Apache-2.0"
] |
permissive
|
ksdperera/developer-studio
|
6fe6d50a66e4fb73de3a4dbeef8d68b461da1ab6
|
9c0f601b91cc34dda036c660598a93c232260e08
|
refs/heads/developer-studio-3.8.0
| 2021-01-15T08:50:21.571267 | 2018-10-26T12:59:17 | 2018-10-26T12:59:17 | 39,486,894 | 0 | 1 |
Apache-2.0
| 2018-10-26T12:59:18 | 2015-07-22T05:13:13 |
Java
|
UTF-8
|
Java
| false | false | 3,108 |
java
|
/*package org.wso2.developerstudio.eclipse.gmf.esb.diagram.edit.commands;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.gmf.runtime.notation.View;
import org.wso2.developerstudio.eclipse.gmf.esb.EsbFactory;
import org.wso2.developerstudio.eclipse.gmf.esb.ProxyServiceSequenceAndEndpointContainer;
import org.wso2.developerstudio.eclipse.gmf.esb.ProxyServiceSequenceContainer;
*//**
* @generated
*//*
public class ProxyServiceSequenceContainerCreateCommand extends
EditElementCommand {
*//**
* @generated
*//*
public ProxyServiceSequenceContainerCreateCommand(CreateElementRequest req) {
super(req.getLabel(), null, req);
}
*//**
* FIXME: replace with setElementToEdit()
* @generated
*//*
protected EObject getElementToEdit() {
EObject container = ((CreateElementRequest) getRequest())
.getContainer();
if (container instanceof View) {
container = ((View) container).getElement();
}
return container;
}
*//**
* @generated
*//*
public boolean canExecute() {
ProxyServiceSequenceAndEndpointContainer container = (ProxyServiceSequenceAndEndpointContainer) getElementToEdit();
if (container.getSequenceContainer() != null) {
return false;
}
return true;
}
*//**
* @generated
*//*
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {
ProxyServiceSequenceContainer newElement = EsbFactory.eINSTANCE
.createProxyServiceSequenceContainer();
ProxyServiceSequenceAndEndpointContainer owner = (ProxyServiceSequenceAndEndpointContainer) getElementToEdit();
owner.setSequenceContainer(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
*//**
* @generated
*//*
protected void doConfigure(ProxyServiceSequenceContainer newElement,
IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
IElementType elementType = ((CreateElementRequest) getRequest())
.getElementType();
ConfigureRequest configureRequest = new ConfigureRequest(
getEditingDomain(), newElement, elementType);
configureRequest.setClientContext(((CreateElementRequest) getRequest())
.getClientContext());
configureRequest.addParameters(getRequest().getParameters());
ICommand configureCommand = elementType
.getEditCommand(configureRequest);
if (configureCommand != null && configureCommand.canExecute()) {
configureCommand.execute(monitor, info);
}
}
}
*/
|
[
"[email protected]"
] | |
6d743f5323a0d2d9fc4ac62fe9185f1333ea2a2d
|
1a869df36dbc921e6bfeda7d1a43487fbead5751
|
/app/src/test/java/com/prod/usuario/pikers/ExampleUnitTest.java
|
ad44af456a8b06391f661657f620460da70f8cdf
|
[] |
no_license
|
sergio-manes-globant/pikers
|
f8fac0ed93ec2c81cf08c9484d14ab6346b5296b
|
4afc0b1428c6831c7b7c2f17171dbe3c72d8ecec
|
refs/heads/master
| 2020-03-27T16:22:23.618620 | 2018-08-31T13:12:16 | 2018-08-31T13:12:16 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 401 |
java
|
package com.prod.usuario.pikers;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
|
[
"[email protected]"
] | |
a24bb9da0b3bfec4f0900dfc88d603c2bfce0288
|
8fd8630a31188c6feadf2fddbbc03c1eb21d4db7
|
/src/main/java/ru/mzaynutdinov/notes/controller/ExceptionHandlingController.java
|
c2e126402f72d2e635ada783b0a78789b6b9b286
|
[] |
no_license
|
mzaynutdinov/notes-manager
|
0c0734a6cee29b76df822ee7f1dcb6e26c8abdac
|
9b24548a2138d8a24515a81ddaa51458f7cbbe1b
|
refs/heads/master
| 2021-01-19T22:04:41.536357 | 2017-03-01T08:17:15 | 2017-03-01T08:17:15 | 82,556,770 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,881 |
java
|
package ru.mzaynutdinov.notes.controller;
import org.apache.log4j.Logger;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import ru.mzaynutdinov.notes.dto.ResponseDto;
import ru.mzaynutdinov.notes.utils.ApiException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ControllerAdvice
public class ExceptionHandlingController {
private final static Logger logger = Logger.getLogger(ExceptionHandlingController.class);
/**
* Перехватывает исключение типа <code>ApiException</code> и возвращает <code>ResponseDto</code>
* с заполенным полем <code>error</code>
*/
@ResponseBody
@ExceptionHandler(ApiException.class)
public ResponseDto handleError(HttpServletRequest req, HttpServletResponse resp, ApiException ex) {
logger.error("Request: " + req.getRequestURL() + " raised " + ex.getClass().getSimpleName(), ex);
resp.setStatus(ex.getType().httpStatus);
return ResponseDto.error(ex.getType().code, ex.getType().name());
}
/**
* Перехватывает все оставшиеся исключения и возвращает <code>ResponseDto</code>
* с заполенным полем <code>error</code>. Исключение помечается как INTERNAL_ERROR с кодом 9000.
*/
@ResponseBody
@ExceptionHandler(Exception.class)
public ResponseDto handleError(HttpServletRequest req, HttpServletResponse resp, Exception ex) {
logger.error("Request: " + req.getRequestURL() + " raised " + ex.getClass().getSimpleName(), ex);
resp.setStatus(500);
return ResponseDto.error(9000, "INTERNAL_ERROR");
}
}
|
[
"[email protected]"
] | |
3ec3521c9b3d55dbb6c791623d70aac89e7870cd
|
43c1eb4788a3b4f3e134fb8974237499c37388e0
|
/src/main/JVC_2/lesson_2/App.java
|
619a9f2493de705487e29b832c9dd11c2a7df56a
|
[] |
no_license
|
Nu1Lifier/JavaCore_1_2
|
603da5b7ae3eea5984c2a453aa5f81e549a82501
|
249821593e0f9ed52d72ebd934311a31f5f321a9
|
refs/heads/master
| 2023-01-07T01:40:10.613202 | 2020-11-05T11:57:19 | 2020-11-05T11:57:19 | 274,675,953 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 724 |
java
|
package JVC_2.lesson_2;
public class App {
public static void main(String[] args) {
String[][] array = new String[4][3];
array[0][0] = "ewq";
for (int i = 0; i < array.length ; i++) {
for (int j = 0; j <array[i].length ; j++) {
array[i][j] = String.valueOf(i + j);
System.out.println(array[i][j]);
}
System.out.println();
}
try {
try {
int sum = ArraySize.getArray(array);
} catch (MyArraySizeException e) {
e.printStackTrace();
}
} catch (MyArrayDataException e) {
System.out.println(e.getMessage());
}
}
}
|
[
"[email protected]"
] | |
9629565377b0fadd12e13a4b0c65b6bbc89fd4fe
|
6359a7f23855000761f5e3e97c5464caf2ebb8b4
|
/Algorithms/src/main/codility/BinaryGap.java
|
356cf0093adb3cb7680bcfe4fd63ccec6b07e188
|
[] |
no_license
|
sklocheva/FundamentalsExercises
|
86d8f2894f62c97360e2eec1ff01950ad82b98f0
|
87b2f0475f3631f93711714aacd05183ee456d04
|
refs/heads/master
| 2023-01-22T22:02:13.788971 | 2020-12-03T09:23:08 | 2020-12-03T09:23:08 | 76,842,774 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 543 |
java
|
package main.codility;
public class BinaryGap {
public int solution(int N) {
String s = Integer.toBinaryString(N);
int maxCount = 0;
if (s.contains("0")) {
int count = 0;
for (int i = 1; i < s.length() - 1; i++) {
if (s.charAt(i) == '0') {
count++;
} else {
if (count != 0) {
if (maxCount < count) {
maxCount = count;
}
count = 0;
}
}
}
if (s.charAt(s.length() - 1) == '1') {
if (maxCount < count) {
maxCount = count;
}
}
}
return maxCount;
}
}
|
[
"[email protected]"
] | |
f8ff3fa17b6bc0d4c29cf6332c6d17ec107b0a7a
|
be140374b397ad4e6f05f900b98ad2dde09c38dc
|
/src/com/zizibujuan/server/git/exception/GitNoHeadException.java
|
40ffe524a9b52175bbb71c2fdcaf4cabc1fe51d3
|
[] |
no_license
|
zizibujuan/server.jgit
|
530f81781e0784c31d99dca3efaf5761644c4a2d
|
61b29d304de9b2512a771a0aefd022aab38dd719
|
refs/heads/master
| 2020-05-20T00:31:13.537043 | 2014-12-10T07:05:56 | 2014-12-10T07:05:56 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 479 |
java
|
package com.zizibujuan.server.git.exception;
/**
* 指定的git分支不存在
*
* @author jzw
* @since 0.0.1
*/
public class GitNoHeadException extends RuntimeException{
private static final long serialVersionUID = 6065335839523476102L;
public GitNoHeadException(String msg){
super(msg);
}
public GitNoHeadException(Throwable cause){
super(cause);
}
public GitNoHeadException(String msg, Throwable cause) {
super(msg, cause);
}
}
|
[
"[email protected]"
] | |
03bf2a0ec4bd5cbfd06926025d3cb50790e484ac
|
3d12834b12e5c2fbb4758527a3f453393b69a5fc
|
/backendninja_jHipster/src/main/java/com/udemy/security/SecurityUtils.java
|
69b2a20d202f9382e574e57a21deb28c73763fd4
|
[] |
no_license
|
DavidHuertas/Udemy-Spring-Backendninja
|
3bb44678505e033daad278da02427334b3748779
|
0a34abd940e37ac593bd2bc895dab5b7c02c62de
|
refs/heads/master
| 2020-03-27T21:56:25.739936 | 2018-09-03T11:01:01 | 2018-09-03T11:01:01 | 147,188,876 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,969 |
java
|
package com.udemy.security;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import java.util.Optional;
/**
* Utility class for Spring Security.
*/
public final class SecurityUtils {
private SecurityUtils() {
}
/**
* Get the login of the current user.
*
* @return the login of the current user
*/
public static Optional<String> getCurrentUserLogin() {
SecurityContext securityContext = SecurityContextHolder.getContext();
return Optional.ofNullable(securityContext.getAuthentication())
.map(authentication -> {
if (authentication.getPrincipal() instanceof UserDetails) {
UserDetails springSecurityUser = (UserDetails) authentication.getPrincipal();
return springSecurityUser.getUsername();
} else if (authentication.getPrincipal() instanceof String) {
return (String) authentication.getPrincipal();
}
return null;
});
}
/**
* Get the JWT of the current user.
*
* @return the JWT of the current user
*/
public static Optional<String> getCurrentUserJWT() {
SecurityContext securityContext = SecurityContextHolder.getContext();
return Optional.ofNullable(securityContext.getAuthentication())
.filter(authentication -> authentication.getCredentials() instanceof String)
.map(authentication -> (String) authentication.getCredentials());
}
/**
* Check if a user is authenticated.
*
* @return true if the user is authenticated, false otherwise
*/
public static boolean isAuthenticated() {
SecurityContext securityContext = SecurityContextHolder.getContext();
return Optional.ofNullable(securityContext.getAuthentication())
.map(authentication -> authentication.getAuthorities().stream()
.noneMatch(grantedAuthority -> grantedAuthority.getAuthority().equals(AuthoritiesConstants.ANONYMOUS)))
.orElse(false);
}
/**
* If the current user has a specific authority (security role).
* <p>
* The name of this method comes from the isUserInRole() method in the Servlet API
*
* @param authority the authority to check
* @return true if the current user has the authority, false otherwise
*/
public static boolean isCurrentUserInRole(String authority) {
SecurityContext securityContext = SecurityContextHolder.getContext();
return Optional.ofNullable(securityContext.getAuthentication())
.map(authentication -> authentication.getAuthorities().stream()
.anyMatch(grantedAuthority -> grantedAuthority.getAuthority().equals(authority)))
.orElse(false);
}
}
|
[
"[email protected]"
] | |
e5891f2c3acc88d7db88e356b03285ea4242d5d7
|
45e4e35bfad1adc3376773296e497f80fccc0349
|
/web-api/src/main/java/com/wyyl/study/skywalking/controller/UserController.java
|
0de0f62b67275766798dc862d2a038646768f8be
|
[] |
no_license
|
wyyl1/wyyl1-study-skywalking
|
6cd667c58d9a7a2abf981369e02ce328c8ade7f2
|
a5897fb0d1d3354a3b5f8712d8f7cf9fbbfffb37
|
refs/heads/master
| 2023-08-11T23:33:27.902078 | 2021-10-11T01:06:00 | 2021-10-11T01:06:00 | 409,300,064 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,202 |
java
|
package com.wyyl.study.skywalking.controller;
import com.wyyl.study.skywalking.common.bean.UserDO;
import com.wyyl.study.skywalking.common.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Reference;
import org.apache.skywalking.apm.toolkit.trace.TraceContext;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author aoe
* @date 2021/9/19
*/
@RestController
@RequestMapping("/user")
@Slf4j
public class UserController {
@Reference(version = "1.0.0")
private UserService userService;
@GetMapping(value = "/{id}")
public UserDO getUser(@PathVariable int id) {
UserDO user = new UserDO();
user.setId(id);
String traceId = TraceContext.traceId();
user.setName("traceId=" + traceId);
log.info("traceId={}", traceId);
return user;
}
@GetMapping(value = "/cache/{id}")
public UserDO getUserByCache(@PathVariable int id) {
return userService.getByCache(id);
}
}
|
[
"[email protected]"
] | |
eb72afe9a89a135f2526a7081f5bc30af999ef86
|
575d45a614b23968779a2c2ef1a866403adcafd3
|
/src/main/java/com/mitocode/controller/indexController.java
|
b9deaeb65e28e1385949e03d0af9373f0c9b5d9c
|
[] |
no_license
|
enlil25/Agenda-con-jsf-jpa-ejb-cdi-primefaces
|
0948d3e5c8717a6106bcbe58b2fb86a2e607d808
|
fe9077f9911c7745791c6997566976ef41ba8aff
|
refs/heads/master
| 2021-01-22T23:05:30.426488 | 2017-05-30T10:06:17 | 2017-05-30T10:06:17 | 92,798,312 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,755 |
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.mitocode.controller;
import com.mitocode.ejb.UsuarioFacadeLocal;
import com.mitocode.model.Usuario;
import java.io.Serializable;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.view.ViewScoped;
import javax.inject.Named;
/**
*
* @author cesar
*/
@Named("indexcontroller")
@ViewScoped
public class indexController implements Serializable {
@EJB
private UsuarioFacadeLocal usuarioEJB;
private Usuario usuario;
@PostConstruct
private void init() {
usuario = new Usuario();
}
public String iniciarSesion() {
String redireccion = null;
Usuario us = null;
try {
us = usuarioEJB.iniciarSesion(usuario);
if (null == us) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN, "Aviso", "Credenciales incorrectos"));
} else {
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("usuario", us);
redireccion = "/protegido/principal.xhtml?faces-redirect=true";
}
} catch (Exception e) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Aviso", "Error"));
}
return redireccion;
}
public Usuario getUsuario() {
return usuario;
}
public void setUsuario(Usuario usuario) {
this.usuario = usuario;
}
}
|
[
"[email protected]"
] | |
af506264a7ee3fb8e3854556647100b8377f00ec
|
bfd9407ff85dca85c255fddc14d645f50f808db6
|
/src/main/java/com/automationpractice/steptostep/exeptions/LoginIncorrect.java
|
7bda337107ce8eade1a53c527393f2e6ef3b20cb
|
[] |
no_license
|
esteban2050/AutomationPracticePage
|
48c9288a94db994ec4c0d8b0a5eeabee1f2d4575
|
44e70299f2f09365c2317073606289ae001071ee
|
refs/heads/master
| 2020-07-07T06:38:55.738618 | 2019-08-20T01:58:36 | 2019-08-20T01:58:36 | 203,279,558 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 446 |
java
|
package com.automationpractice.steptostep.exeptions;
public class LoginIncorrect extends AssertionError{
/**
*
* @author Juan Esteban Lopez Giraldo
*
*/
private static final long serialVersionUID=1L;
//Mensaje que sera mostrado cuando el loggeo sea incorrecto
public static final String LOGGIN_INCORRECT = "No fue posible iniciar sesion";
public LoginIncorrect(String message, Throwable cause) {
super(message, cause);
}
}
|
[
"[email protected]"
] | |
29e127974249bce23c1a346b98878fdfab2e0c25
|
d6421d3ed973c76721051c80f555870bfb4ca4c5
|
/src/main/java/com/ileir/proxyPatterns/ProxyTest.java
|
d0bda2362a16bc1b20c0cc4c2b23cddb8cb9bbeb
|
[] |
no_license
|
leizihaisir/DesignPatterns
|
ec291ac3c833b7922ad9885a862f72b4cf6e215d
|
7111b7a8833c61a4421e8e8e84ff179e7c41ffe0
|
refs/heads/master
| 2021-07-09T20:14:00.464943 | 2017-10-08T14:34:39 | 2017-10-08T14:34:39 | 106,011,455 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 224 |
java
|
package com.ileir.proxyPatterns;
/**
* Created by zihailei on 2017/10/8.
*/
public class ProxyTest {
public static void main(String[] args) {
Sourceable source = new Proxy();
source.method();
}
}
|
[
"[email protected]"
] | |
096847e7f8d6ef719fd331b0c34286946b319b91
|
4930c905b4beb60cbac4ec39c2aa728a3bdf8f92
|
/src/com/headFirstOop/Guitar_Inventory_Application/Main.java
|
aee0325eeecfb93aa35b869a218b11d74a5600ed
|
[] |
no_license
|
harshalnrn/Intellij_upgrad_codes
|
8d2833bc8d64d785610a37d53033c8859732227b
|
af9d60d34badc642485e6e8b1747eae38584fda2
|
refs/heads/master
| 2020-04-08T04:43:33.693004 | 2018-11-28T17:07:13 | 2018-11-28T17:07:13 | 159,029,180 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,324 |
java
|
package com.headFirstOop.Guitar_Inventory_Application;
import com.sun.deploy.security.ValidationState;
import java.util.ArrayList;
import java.util.List;
public class Main {
public static void main(String[] args) {
//1. first add instruments to inventory
Inventory inventory = new Inventory();
List<Instrument> list = new ArrayList<Instrument>();
initializeInventory(inventory);
//2.try to search this added with serail number
Instrument retreivedIns=inventory.get("1001");
System.out.println("Received following details from inventory for searched serial number: " +'\n'+retreivedIns.getPrice()); // owner entry
System.out.println("-----------------------------------------------------------------------------");
//3.client searches to get the added guitar as matched result
GuitarSpec guitarSpecs = new GuitarSpec("2018",Builder.FENDER, Type.ACOUSTIC, Wood.BRAZILIAN_ROSEWOOD, Wood.INDIAN_ROSEWOOD, 6); //client entry
MandolinSpecs mandolinSpecs = new MandolinSpecs("2018USA",Builder.FENDER, Type.ACOUSTIC, Wood.BRAZILIAN_ROSEWOOD, Wood.INDIAN_ROSEWOOD, Style.Indian); //client entry
//Improvement.
//1)Facilitating client search, where bugs dont occur dues so spell mistake/case ??. Eighter using String methods / replacing string altogether by enums .(Enums helps categorize constants, where compilation errors occur whenever type/value violated).
//Each enum take place of class properties(instance variables),giving type/value safety during their usage as inputs.
//2) Also returning nearing matching alternatives, apart from matched search results.
list = inventory.search(guitarSpecs);
System.out.println("Hello Client. Total matching guitars are : " + list.size() + "Prices of matching instruments are as follows" + '\n');
for (Instrument instru : list) {
System.out.println(instru.getPrice());
System.out.println(instru.getSpecification().getType());
System.out.println(instru.getSpecification().getModel());
}
list = inventory.search(mandolinSpecs);
System.out.println("Hello Client. Total matching mandolins are : " + list.size() + ". Prices of matching instruments are as follows" + '\n');
for (Instrument instru : list) {
System.out.println(instru.getPrice());
}
}
private static void initializeInventory(Inventory inventory) {
GuitarSpec spec = new GuitarSpec("2018",Builder.FENDER,Type.ACOUSTIC,Wood.BRAZILIAN_ROSEWOOD, Wood.INDIAN_ROSEWOOD,6);
GuitarSpec spec1 = new GuitarSpec("2018",Builder.FENDER,Type.ELECTRIC ,Wood.BRAZILIAN_ROSEWOOD, Wood.INDIAN_ROSEWOOD,7);
GuitarSpec spec2 = new GuitarSpec("2017",Builder.FENDER,Type.ACOUSTIC,Wood.MAHOGANY, Wood.INDIAN_ROSEWOOD,8);
GuitarSpec spec3 = new GuitarSpec("2017",Builder.FENDER,Type.ACOUSTIC,Wood.BRAZILIAN_ROSEWOOD, Wood.SITKA,9);
MandolinSpecs mandolinSpecs = new MandolinSpecs("2018USA",Builder.FENDER, Type.ACOUSTIC, Wood.BRAZILIAN_ROSEWOOD, Wood.INDIAN_ROSEWOOD, Style.Indian);
MandolinSpecs mandolinSpecs1 = new MandolinSpecs("2018UK",Builder.GIBSON, Type.ACOUSTIC, Wood.BRAZILIAN_ROSEWOOD, Wood.INDIAN_ROSEWOOD, Style.Afghani);
MandolinSpecs mandolinSpecs2 = new MandolinSpecs("2018AUS",Builder.OLSON, Type.ACOUSTIC, Wood.BRAZILIAN_ROSEWOOD, Wood.INDIAN_ROSEWOOD, Style.israeli);
Guitar obj=new Guitar("1000",15000,spec);
Guitar obj1=new Guitar("1001",18000.50,spec1);
Guitar obj2=new Guitar("1002",20000.20,spec2);
Guitar obj3=new Guitar("1003",22000,spec3);
Mandolin obj4=new Mandolin("1003",22000,mandolinSpecs);
Mandolin obj5=new Mandolin("1003",24000,mandolinSpecs1);
Mandolin obj6=new Mandolin("1003",26000,mandolinSpecs2);
inventory.addInstrument(obj);
inventory.addInstrument(obj1);
inventory.addInstrument(obj2);
inventory.addInstrument(obj3);
inventory.addInstrument(obj4);
inventory.addInstrument(obj5);
inventory.addInstrument(obj6);
System.out.println("New guitars added");
System.out.println("-----------------------------------------------------------------------------");
}
}
|
[
"[email protected]"
] | |
91665cf4a85ee04f1a0048931563990d9c4a54e7
|
a606c74392ed56c7fae891feaaabcfc592cfc19c
|
/FirstTeam/src/main/java/com/study/springboot/service/MypageService.java
|
5f3602d7702021af93c4875f7fe8a9d4dd582e72
|
[] |
no_license
|
thdwlgk123/meetup
|
02e698d532e8f44e289470f7be5caef28f9434d9
|
284bd61b60b76a8d1b5a024e925c3fc5bee0e000
|
refs/heads/master
| 2023-08-13T00:50:35.851844 | 2021-09-30T13:23:45 | 2021-09-30T13:23:45 | 360,462,018 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,390 |
java
|
package com.study.springboot.service;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Service;
import org.springframework.web.servlet.ModelAndView;
import com.study.springboot.dao.IBoardDao;
import com.study.springboot.dao.IClassLikeManagerDao;
import com.study.springboot.dao.IClassManagerDao;
import com.study.springboot.dao.IUserDao;
import com.study.springboot.dto.BoardDto;
import com.study.springboot.dto.ClassLikeManagerDto;
import com.study.springboot.dto.UserDto;
@Service
public class MypageService implements IMypageService{
@Autowired
IUserDao userdao;
@Autowired
IBoardDao boarddao;
@Autowired
IClassManagerDao classdao;
@Autowired
IClassLikeManagerDao classlikedao;
public ModelAndView goMypage() {
Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserDetails userDetails = (UserDetails)principal;
String userid = userDetails.getUsername();
ModelAndView mv=new ModelAndView();
List<UserDto> usi=userdao.getUserInfo(userid);
//핸드폰 번호 형식
String userphone="";
if(usi.get(0).getTxtMobile1()!=null) {
userphone=usi.get(0).getTxtMobile1()+"-"+usi.get(0).getTxtMobile2()+"-"+usi.get(0).getTxtMobile3();
System.out.println("txtMobile concat: "+userphone);
}else {
userphone="등록된 번호가 없습니다.";
}
//성별 출력
if(usi.get(0).getUsergender()==null) {
usi.get(0).setUsergender("성별을 입력하지 않았습니다.");
System.out.println("usergender null: "+usi.get(0).getUsergender());
}else if(usi.get(0).getUsergender().equals("woman")) {
System.out.println("usergender woman: "+usi.get(0).getUsergender());
usi.get(0).setUsergender("여성");
}else if(usi.get(0).getUsergender().equals("man")){
System.out.println("usergender man: "+usi.get(0).getUsergender());
usi.get(0).setUsergender("남성");
}
//프로필 사진 없을시
if(usi.get(0).getUserprofile()==null) {
System.out.println("Service getuserprofile: null");
usi.get(0).setUserprofile("not-available.png");
}
//회원정보조회
mv.addObject("userinfo", usi);
mv.addObject("userphone", userphone);
//신청한 클래스 개수
mv.addObject("joinclass", classdao.countJoinClassDao(userid));
//좋아요한 클래스 개수
mv.addObject("likecount", classlikedao.userLikeCountCheckDao(userid));
//개설한 클래스 개수
mv.addObject("openclass", boarddao.countOpenClassDao(userid));
mv.setViewName("mypage/mypage");
return mv;
}
public ModelAndView getLikeClassInfo(){
Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserDetails userDetails = (UserDetails)principal;
String userid = userDetails.getUsername();
ModelAndView mv=new ModelAndView();
List<ClassLikeManagerDto> list=new ArrayList<>();
list=classlikedao.getLikeClassInfoDao(userid);
System.out.println("좋아요 list: "+list);
System.out.println("좋아요 list.size() : "+ list.size());
List<BoardDto> classinfo=new ArrayList<BoardDto>();
for(int i=0; i<list.size();i++ ) {
classinfo.add(boarddao.getClassInfoDao(list.get(i).getClassid()));
}
mv.addObject("likeclassinfo",classinfo);
return mv;
}
public ModelAndView getOpenClassInfo(){
Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserDetails userDetails = (UserDetails)principal;
String userid = userDetails.getUsername();
ModelAndView mv=new ModelAndView();
mv.addObject("openclassinfo",boarddao.getOpenClassInfoDao(userid));
return mv;
}
public ModelAndView doDeleteClass(String tid) {
int classid=Integer.parseInt(tid);
ModelAndView mv=new ModelAndView();
mv.addObject("classinfo", boarddao.getClassInfoDao(classid));
mv.addObject("memberinfo", classdao.getApplyMemberDao(classid));
mv.addObject("countmem", classdao.countNowmemDao(classid));
return mv;
}
public ModelAndView modifyClass(String tid) {
System.out.println("Service: modifyClass");
int classid=Integer.parseInt(tid);
ModelAndView mv=new ModelAndView();
BoardDto dto=boarddao.getClassInfoDao(classid);
String pattern = "yyyy-MM-dd";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
mv.addObject("classstartdate",simpleDateFormat.format(dto.getClassstartdate()));
mv.addObject("classenddate",simpleDateFormat.format(dto.getClassenddate()));
mv.addObject("regstartdate",simpleDateFormat.format(dto.getRegstartdate()));
mv.addObject("regenddate",simpleDateFormat.format(dto.getRegenddate()));
//tSpacetype=locfix일 시 주소와 상세주소 분리
if(dto.getTspacetype().equals("locfix")) {
String tSpace=dto.getTspace().substring(0, dto.getTspace().indexOf("/")-1);
String tSpaceDetail=dto.getTspace().substring(dto.getTspace().indexOf("/")+2);
if(tSpaceDetail==null) {
tSpaceDetail="";
}
mv.addObject("tspace", tSpace);
mv.addObject("tspacedetail", tSpaceDetail);
}
mv.addObject("classinfo", dto);
return mv;
}
}
|
[
"[email protected]"
] | |
6c8467d12d704abcfbf10c1187046bb0ab2b8d89
|
35813ca6ee251af99869e3341c17b20e838dfd13
|
/src/main/java/annotation/imooc/Table.java
|
846ab4bb908c8e2e104da578ae3d78bd24943354
|
[
"MIT"
] |
permissive
|
tangwwk/java-8-lambdas-exercises
|
c02d16b12ac4cbd536fadd62d5cb1db2fe7fe834
|
c2330cd331585c214e763079171cc854f33e5e50
|
refs/heads/master
| 2020-12-25T18:08:39.441042 | 2017-05-08T13:11:17 | 2017-05-08T13:11:17 | 47,375,865 | 0 | 0 | null | 2015-12-04T02:31:37 | 2015-12-04T02:31:37 | null |
UTF-8
|
Java
| false | false | 302 |
java
|
package annotation.imooc;
import java.lang.annotation.*;
/**
* Created with IntelliJ IDEA.
* User: TangWenWu
* Date: 2015/12/26
* Time: 10:03
* CopyRight:HuiMei Engine
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Table {
String value();
}
|
[
"[email protected]"
] | |
182447e4f36d0a2e76d4a0d39765a937993ee853
|
764bd980530648a7bb25cd43a383ed364b1639f0
|
/src/main/java/com/poc/trainingmanager/repository/DepartmentRepository.java
|
8deb07b74830cedf119e573ec96b3bb35aa6323c
|
[] |
no_license
|
kai18/trainingmanager
|
a9209e05d08343777c591ae2cffb8fa8f399d980
|
3c64d3b5c4ad64624c858bf3a084d1f851942d52
|
refs/heads/master
| 2021-03-16T09:12:47.113273 | 2017-12-13T11:36:57 | 2017-12-13T11:36:57 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 403 |
java
|
package com.poc.trainingmanager.repository;
import java.util.UUID;
import org.springframework.data.cassandra.repository.CassandraRepository;
import org.springframework.stereotype.Repository;
import com.poc.trainingmanager.model.Department;
@Repository
public interface DepartmentRepository extends CassandraRepository<Department> {
public Department findByDepartmentId(UUID uuid);
}
|
[
"[email protected]"
] | |
75358d171e23d54416e493aeec2b1f3f07390999
|
3bf68b881fe925332e09900e9124ea38d31a6609
|
/src/main/java/com/main/repository/ArticleRepository.java
|
87c4369391b298c1e70fd2d9f74661ded675e55a
|
[] |
no_license
|
Dimon4uk/RestApi
|
7e1bde0650deb52f348b7de8817d60943f74595a
|
149a6b01a620d3afccc556f395782522effe9ede
|
refs/heads/master
| 2020-07-03T23:42:51.005346 | 2016-11-25T00:48:14 | 2016-11-25T00:48:14 | 74,222,917 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 251 |
java
|
package com.main.repository;
import com.main.model.Article;
import org.springframework.data.repository.CrudRepository;
/**
* Created by Дмитрий on 21.11.2016.
*/
public interface ArticleRepository extends CrudRepository<Article,Long> {
}
|
[
"[email protected]"
] | |
79dabce5481dd509d88e24de4c525b1df5ef8b02
|
200b5b163c22ee53f2bec078b066c2f74f0247d9
|
/BaseGdx/src/com/kargames/basegdx/manager/Control.java
|
18b3b696da03969d5d88fd247fd6b5975301be69
|
[
"Apache-2.0"
] |
permissive
|
karsc22/BaseGDX
|
5900fde89fa49e3314c63386657e7bdc8ef380ae
|
abcee7b664afa86d3a2aedd75f91a7e96dcd1485
|
refs/heads/master
| 2020-04-26T18:43:25.249197 | 2014-04-25T07:37:46 | 2014-04-25T07:37:46 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 952 |
java
|
package com.kargames.basegdx.manager;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.Input.Keys;
public enum Control {
UP("Move up", Keys.UP, Keys.W),
DOWN("Move down", Keys.DOWN, Keys.S),
LEFT("Move left", Keys.LEFT, Keys.A),
RIGHT("Move right", Keys.RIGHT, Keys.D),
JUMP("Jump", Keys.SPACE, Keys.Z);
public int key0;
public int key1;
private int defaultKey0;
private int defaultKey1;
private String name;
private Control(String name, int key0, int key1) {
this.name = name;
this.key0 = key0;
this.key1 = key1;
defaultKey0 = key0;
defaultKey1 = key1;
}
public boolean isPressed() {
return Gdx.input.isKeyPressed(key0) || Gdx.input.isKeyPressed(key1);
}
public void restoreDefaults() {
key0 = defaultKey0;
key1 = defaultKey1;
}
public String getString(int num) {
return Input.Keys.toString(num == 0 ? key0 : key1);
}
public String getName() {
return name;
}
}
|
[
"[email protected]"
] | |
448cdc6f2c3d993e9f2d9dcfd620184a5e3e56e3
|
c885ef92397be9d54b87741f01557f61d3f794f3
|
/tests-without-trycatch/JacksonDatabind-103/com.fasterxml.jackson.databind.deser.std.StdValueInstantiator/BBC-F0-opt-30/11/com/fasterxml/jackson/databind/deser/std/StdValueInstantiator_ESTest.java
|
a074f0cc138a33e3befa197b51994d27fbb58de4
|
[
"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 | 45,306 |
java
|
/*
* This file was automatically generated by EvoSuite
* Thu Oct 21 22:26:54 GMT 2021
*/
package com.fasterxml.jackson.databind.deser.std;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import com.fasterxml.jackson.annotation.ObjectIdResolver;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.AnnotationIntrospector;
import com.fasterxml.jackson.databind.BeanProperty;
import com.fasterxml.jackson.databind.DeserializationConfig;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
import com.fasterxml.jackson.databind.PropertyName;
import com.fasterxml.jackson.databind.cfg.BaseSettings;
import com.fasterxml.jackson.databind.cfg.ConfigOverrides;
import com.fasterxml.jackson.databind.cfg.DeserializerFactoryConfig;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.deser.BeanDeserializerFactory;
import com.fasterxml.jackson.databind.deser.DefaultDeserializationContext;
import com.fasterxml.jackson.databind.deser.SettableBeanProperty;
import com.fasterxml.jackson.databind.deser.std.StdValueInstantiator;
import com.fasterxml.jackson.databind.introspect.AnnotatedParameter;
import com.fasterxml.jackson.databind.introspect.AnnotatedWithParams;
import com.fasterxml.jackson.databind.introspect.AnnotationMap;
import com.fasterxml.jackson.databind.introspect.ClassIntrospector;
import com.fasterxml.jackson.databind.introspect.POJOPropertyBuilder;
import com.fasterxml.jackson.databind.introspect.SimpleMixInResolver;
import com.fasterxml.jackson.databind.introspect.TypeResolutionContext;
import com.fasterxml.jackson.databind.jsontype.NamedType;
import com.fasterxml.jackson.databind.jsontype.TypeIdResolver;
import com.fasterxml.jackson.databind.jsontype.impl.StdSubtypeResolver;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.type.ArrayType;
import com.fasterxml.jackson.databind.type.MapLikeType;
import com.fasterxml.jackson.databind.type.PlaceholderForType;
import com.fasterxml.jackson.databind.type.SimpleType;
import com.fasterxml.jackson.databind.type.TypeFactory;
import com.fasterxml.jackson.databind.util.RootNameLookup;
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.sql.SQLIntegrityConstraintViolationException;
import java.sql.SQLNonTransientException;
import java.sql.SQLTimeoutException;
import java.sql.SQLTransactionRollbackException;
import java.sql.SQLTransientConnectionException;
import java.sql.SQLTransientException;
import java.sql.SQLWarning;
import java.time.format.ResolverStyle;
import java.util.List;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true)
public class StdValueInstantiator_ESTest extends StdValueInstantiator_ESTest_scaffolding {
@Test(timeout = 4000)
public void test00() throws Throwable {
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, (JavaType) null);
BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance;
DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0);
JsonMappingException jsonMappingException0 = defaultDeserializationContext_Impl0.invalidTypeIdException((JavaType) null, "", "com.fasterxml.jackson.databind.deser.std.StdValueInstantiator");
SQLNonTransientException sQLNonTransientException0 = new SQLNonTransientException("bx", jsonMappingException0);
stdValueInstantiator0.unwrapAndWrapException(defaultDeserializationContext_Impl0, sQLNonTransientException0);
assertEquals("UNKNOWN TYPE", stdValueInstantiator0.getValueTypeDesc());
}
@Test(timeout = 4000)
public void test01() throws Throwable {
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, (JavaType) null);
BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance;
DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0);
SettableBeanProperty[] settableBeanPropertyArray0 = new SettableBeanProperty[0];
stdValueInstantiator0.configureFromObjectSettings((AnnotatedWithParams) null, (AnnotatedWithParams) null, (JavaType) null, settableBeanPropertyArray0, (AnnotatedWithParams) null, settableBeanPropertyArray0);
// Undeclared exception!
// try {
stdValueInstantiator0.createUsingArrayDelegate(defaultDeserializationContext_Impl0, beanDeserializerFactory0);
// fail("Expecting exception: IllegalStateException");
// } catch(IllegalStateException e) {
// //
// // No delegate constructor for UNKNOWN TYPE
// //
// verifyException("com.fasterxml.jackson.databind.deser.std.StdValueInstantiator", e);
// }
}
@Test(timeout = 4000)
public void test02() throws Throwable {
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, (JavaType) null);
BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance;
DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0);
SettableBeanProperty[] settableBeanPropertyArray0 = new SettableBeanProperty[0];
stdValueInstantiator0.configureFromObjectSettings((AnnotatedWithParams) null, (AnnotatedWithParams) null, (JavaType) null, settableBeanPropertyArray0, (AnnotatedWithParams) null, settableBeanPropertyArray0);
// Undeclared exception!
// try {
stdValueInstantiator0.createUsingDelegate(defaultDeserializationContext_Impl0, "!mX#O}XP:=0c 'Y");
// fail("Expecting exception: IllegalStateException");
// } catch(IllegalStateException e) {
// //
// // No delegate constructor for UNKNOWN TYPE
// //
// verifyException("com.fasterxml.jackson.databind.deser.std.StdValueInstantiator", e);
// }
}
@Test(timeout = 4000)
public void test03() throws Throwable {
JsonFactory jsonFactory0 = new JsonFactory();
ObjectMapper objectMapper0 = new ObjectMapper(jsonFactory0);
JavaType javaType0 = TypeFactory.unknownType();
ObjectReader objectReader0 = objectMapper0.readerFor(javaType0);
assertNotNull(objectReader0);
}
@Test(timeout = 4000)
public void test04() throws Throwable {
ObjectMapper objectMapper0 = new ObjectMapper();
Class<JsonMappingException> class0 = JsonMappingException.class;
ObjectReader objectReader0 = objectMapper0.readerFor(class0);
assertNotNull(objectReader0);
}
@Test(timeout = 4000)
public void test05() throws Throwable {
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, (JavaType) null);
SettableBeanProperty[] settableBeanPropertyArray0 = new SettableBeanProperty[1];
stdValueInstantiator0.configureFromObjectSettings((AnnotatedWithParams) null, (AnnotatedWithParams) null, (JavaType) null, (SettableBeanProperty[]) null, (AnnotatedWithParams) null, settableBeanPropertyArray0);
assertEquals("UNKNOWN TYPE", stdValueInstantiator0.getValueTypeDesc());
}
@Test(timeout = 4000)
public void test06() throws Throwable {
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, (JavaType) null);
SettableBeanProperty[] settableBeanPropertyArray0 = new SettableBeanProperty[0];
stdValueInstantiator0.configureFromObjectSettings((AnnotatedWithParams) null, (AnnotatedWithParams) null, (JavaType) null, settableBeanPropertyArray0, (AnnotatedWithParams) null, settableBeanPropertyArray0);
StdValueInstantiator stdValueInstantiator1 = new StdValueInstantiator(stdValueInstantiator0);
assertFalse(stdValueInstantiator1.canCreateFromDouble());
}
@Test(timeout = 4000)
public void test07() throws Throwable {
Class<ResolverStyle> class0 = ResolverStyle.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
JavaType javaType0 = TypeFactory.unknownType();
stdValueInstantiator0.configureFromObjectSettings((AnnotatedWithParams) null, (AnnotatedWithParams) null, javaType0, (SettableBeanProperty[]) null, (AnnotatedWithParams) null, (SettableBeanProperty[]) null);
StdValueInstantiator stdValueInstantiator1 = new StdValueInstantiator(stdValueInstantiator0);
assertTrue(stdValueInstantiator0.canCreateUsingDelegate());
assertTrue(stdValueInstantiator0.canInstantiate());
}
@Test(timeout = 4000)
public void test08() throws Throwable {
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, (JavaType) null);
SettableBeanProperty[] settableBeanPropertyArray0 = new SettableBeanProperty[0];
stdValueInstantiator0._constructorArguments = settableBeanPropertyArray0;
StdValueInstantiator stdValueInstantiator1 = new StdValueInstantiator(stdValueInstantiator0);
assertEquals("UNKNOWN TYPE", stdValueInstantiator1.getValueTypeDesc());
}
@Test(timeout = 4000)
public void test09() throws Throwable {
Class<ObjectIdResolver> class0 = ObjectIdResolver.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
stdValueInstantiator0.configureFromStringCreator((AnnotatedWithParams) null);
assertEquals("`com.fasterxml.jackson.annotation.ObjectIdResolver`", stdValueInstantiator0.getValueTypeDesc());
}
@Test(timeout = 4000)
public void test10() throws Throwable {
Class<InvocationTargetException> class0 = InvocationTargetException.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
stdValueInstantiator0.configureFromLongCreator((AnnotatedWithParams) null);
assertEquals("`java.lang.reflect.InvocationTargetException`", stdValueInstantiator0.getValueTypeDesc());
}
@Test(timeout = 4000)
public void test11() throws Throwable {
Class<InvocationTargetException> class0 = InvocationTargetException.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
stdValueInstantiator0.configureFromIntCreator((AnnotatedWithParams) null);
assertEquals("`java.lang.reflect.InvocationTargetException`", stdValueInstantiator0.getValueTypeDesc());
}
@Test(timeout = 4000)
public void test12() throws Throwable {
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, (JavaType) null);
stdValueInstantiator0.configureFromDoubleCreator((AnnotatedWithParams) null);
assertEquals("UNKNOWN TYPE", stdValueInstantiator0.getValueTypeDesc());
}
@Test(timeout = 4000)
public void test13() throws Throwable {
Class<InvocationTargetException> class0 = InvocationTargetException.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
stdValueInstantiator0.configureFromBooleanCreator((AnnotatedWithParams) null);
assertEquals("`java.lang.reflect.InvocationTargetException`", stdValueInstantiator0.getValueTypeDesc());
}
@Test(timeout = 4000)
public void test14() throws Throwable {
Class<Integer> class0 = Integer.TYPE;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
Class<?> class1 = stdValueInstantiator0.getValueClass();
assertNotNull(class1);
assertEquals(1041, class1.getModifiers());
assertEquals("`int`", stdValueInstantiator0.getValueTypeDesc());
}
@Test(timeout = 4000)
public void test15() throws Throwable {
Class<TypeIdResolver> class0 = TypeIdResolver.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
Class<?> class1 = stdValueInstantiator0.getValueClass();
assertNotNull(class1);
assertEquals("`com.fasterxml.jackson.databind.jsontype.TypeIdResolver`", stdValueInstantiator0.getValueTypeDesc());
assertTrue(class1.isInterface());
}
@Test(timeout = 4000)
public void test16() throws Throwable {
TypeFactory typeFactory0 = TypeFactory.defaultInstance();
Class<TypeIdResolver> class0 = TypeIdResolver.class;
SimpleType simpleType0 = SimpleType.constructUnsafe(class0);
MapLikeType mapLikeType0 = MapLikeType.upgradeFrom(simpleType0, simpleType0, simpleType0);
ArrayType arrayType0 = typeFactory0.constructArrayType((JavaType) mapLikeType0);
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, arrayType0);
Class<?> class1 = stdValueInstantiator0.getValueClass();
assertEquals("[array type, component type: [map-like type; class com.fasterxml.jackson.databind.jsontype.TypeIdResolver, [simple type, class com.fasterxml.jackson.databind.jsontype.TypeIdResolver] -> [simple type, class com.fasterxml.jackson.databind.jsontype.TypeIdResolver]]]", stdValueInstantiator0.getValueTypeDesc());
assertEquals("class [Lcom.fasterxml.jackson.databind.jsontype.TypeIdResolver;", class1.toString());
}
@Test(timeout = 4000)
public void test17() throws Throwable {
Class<Object> class0 = Object.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
stdValueInstantiator0.getIncompleteParameter();
assertEquals("`java.lang.Object`", stdValueInstantiator0.getValueTypeDesc());
}
@Test(timeout = 4000)
public void test18() throws Throwable {
Class<Object> class0 = Object.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
stdValueInstantiator0.getFromObjectArguments((DeserializationConfig) null);
assertEquals("`java.lang.Object`", stdValueInstantiator0.getValueTypeDesc());
}
@Test(timeout = 4000)
public void test19() throws Throwable {
Class<ObjectIdResolver> class0 = ObjectIdResolver.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
SettableBeanProperty[] settableBeanPropertyArray0 = new SettableBeanProperty[1];
stdValueInstantiator0._constructorArguments = settableBeanPropertyArray0;
SettableBeanProperty[] settableBeanPropertyArray1 = stdValueInstantiator0.getFromObjectArguments((DeserializationConfig) null);
assertNotNull(settableBeanPropertyArray1);
assertEquals("`com.fasterxml.jackson.annotation.ObjectIdResolver`", stdValueInstantiator0.getValueTypeDesc());
}
@Test(timeout = 4000)
public void test20() throws Throwable {
Class<ObjectIdResolver> class0 = ObjectIdResolver.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
SettableBeanProperty[] settableBeanPropertyArray0 = new SettableBeanProperty[0];
stdValueInstantiator0._constructorArguments = settableBeanPropertyArray0;
SettableBeanProperty[] settableBeanPropertyArray1 = stdValueInstantiator0.getFromObjectArguments((DeserializationConfig) null);
assertEquals("`com.fasterxml.jackson.annotation.ObjectIdResolver`", stdValueInstantiator0.getValueTypeDesc());
assertNotNull(settableBeanPropertyArray1);
}
@Test(timeout = 4000)
public void test21() throws Throwable {
Class<ResolverStyle> class0 = ResolverStyle.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
JavaType javaType0 = TypeFactory.unknownType();
stdValueInstantiator0.configureFromObjectSettings((AnnotatedWithParams) null, (AnnotatedWithParams) null, javaType0, (SettableBeanProperty[]) null, (AnnotatedWithParams) null, (SettableBeanProperty[]) null);
stdValueInstantiator0.getDelegateType((DeserializationConfig) null);
assertTrue(stdValueInstantiator0.canInstantiate());
}
@Test(timeout = 4000)
public void test22() throws Throwable {
PlaceholderForType placeholderForType0 = new PlaceholderForType((-79));
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, (JavaType) null);
stdValueInstantiator0.configureFromArraySettings((AnnotatedWithParams) null, placeholderForType0, (SettableBeanProperty[]) null);
stdValueInstantiator0.getArrayDelegateType((DeserializationConfig) null);
assertTrue(stdValueInstantiator0.canInstantiate());
}
@Test(timeout = 4000)
public void test23() throws Throwable {
Class<List> class0 = List.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
ObjectMapper objectMapper0 = new ObjectMapper();
Class<Boolean> class1 = Boolean.TYPE;
JavaType javaType0 = objectMapper0.constructType(class1);
stdValueInstantiator0.configureFromArraySettings((AnnotatedWithParams) null, javaType0, (SettableBeanProperty[]) null);
stdValueInstantiator0.getArrayDelegateType((DeserializationConfig) null);
assertTrue(stdValueInstantiator0.canCreateUsingArrayDelegate());
}
@Test(timeout = 4000)
public void test24() throws Throwable {
Class<Object> class0 = Object.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
boolean boolean0 = stdValueInstantiator0.canInstantiate();
assertFalse(boolean0);
assertEquals("`java.lang.Object`", stdValueInstantiator0.getValueTypeDesc());
}
@Test(timeout = 4000)
public void test25() throws Throwable {
Class<InvocationTargetException> class0 = InvocationTargetException.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
boolean boolean0 = stdValueInstantiator0.canCreateUsingDelegate();
assertFalse(boolean0);
assertEquals("`java.lang.reflect.InvocationTargetException`", stdValueInstantiator0.getValueTypeDesc());
}
@Test(timeout = 4000)
public void test26() throws Throwable {
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, (JavaType) null);
boolean boolean0 = stdValueInstantiator0.canCreateUsingArrayDelegate();
assertEquals("UNKNOWN TYPE", stdValueInstantiator0.getValueTypeDesc());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test27() throws Throwable {
Class<ResolverStyle> class0 = ResolverStyle.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
boolean boolean0 = stdValueInstantiator0.canCreateFromObjectWith();
assertFalse(boolean0);
assertEquals("`java.time.format.ResolverStyle`", stdValueInstantiator0.getValueTypeDesc());
}
@Test(timeout = 4000)
public void test28() throws Throwable {
Class<JsonMappingException> class0 = JsonMappingException.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
SQLTimeoutException sQLTimeoutException0 = new SQLTimeoutException("Nf#uaqbrdX+K;.eoR", "Nf#uaqbrdX+K;.eoR", 0);
SQLTransientConnectionException sQLTransientConnectionException0 = new SQLTransientConnectionException("", "", 1064, sQLTimeoutException0);
Throwable throwable0 = sQLTimeoutException0.initCause(sQLTransientConnectionException0);
// Undeclared exception!
stdValueInstantiator0.wrapException(throwable0);
}
@Test(timeout = 4000)
public void test29() throws Throwable {
Class<JsonMappingException> class0 = JsonMappingException.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
// Undeclared exception!
// try {
stdValueInstantiator0.wrapException((Throwable) null);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("com.fasterxml.jackson.databind.deser.std.StdValueInstantiator", e);
// }
}
@Test(timeout = 4000)
public void test30() throws Throwable {
Class<InvocationTargetException> class0 = InvocationTargetException.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
SQLTransactionRollbackException sQLTransactionRollbackException0 = new SQLTransactionRollbackException("com.fasterxml.jackson.databind.deser.std.StdValueInstantiator", "com.fasterxml.jackson.databind.deser.std.StdValueInstantiator");
// Undeclared exception!
// try {
stdValueInstantiator0.wrapAsJsonMappingException((DeserializationContext) null, sQLTransactionRollbackException0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("com.fasterxml.jackson.databind.deser.std.StdValueInstantiator", e);
// }
}
@Test(timeout = 4000)
public void test31() throws Throwable {
Class<ResolverStyle> class0 = ResolverStyle.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException0 = new SQLIntegrityConstraintViolationException("LJ#A>'I", "LJ#A>'I", 828);
InvocationTargetException invocationTargetException0 = new InvocationTargetException(sQLIntegrityConstraintViolationException0, "LJ#A>'I");
sQLIntegrityConstraintViolationException0.initCause(invocationTargetException0);
// Undeclared exception!
stdValueInstantiator0.unwrapAndWrapException((DeserializationContext) null, sQLIntegrityConstraintViolationException0);
}
@Test(timeout = 4000)
public void test32() throws Throwable {
StdValueInstantiator stdValueInstantiator0 = null;
// try {
stdValueInstantiator0 = new StdValueInstantiator((StdValueInstantiator) null);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("com.fasterxml.jackson.databind.deser.std.StdValueInstantiator", e);
// }
}
@Test(timeout = 4000)
public void test33() throws Throwable {
StdSubtypeResolver stdSubtypeResolver0 = new StdSubtypeResolver();
SimpleMixInResolver simpleMixInResolver0 = new SimpleMixInResolver((ClassIntrospector.MixInResolver) null);
RootNameLookup rootNameLookup0 = new RootNameLookup();
ConfigOverrides configOverrides0 = new ConfigOverrides();
DeserializationConfig deserializationConfig0 = new DeserializationConfig((BaseSettings) null, stdSubtypeResolver0, simpleMixInResolver0, rootNameLookup0, configOverrides0);
BeanProperty.Bogus beanProperty_Bogus0 = new BeanProperty.Bogus();
JavaType javaType0 = beanProperty_Bogus0.getType();
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator(deserializationConfig0, javaType0);
stdValueInstantiator0._arrayDelegateType = javaType0;
boolean boolean0 = stdValueInstantiator0.canCreateUsingArrayDelegate();
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test34() throws Throwable {
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, (JavaType) null);
boolean boolean0 = stdValueInstantiator0.canCreateUsingDefault();
assertEquals("UNKNOWN TYPE", stdValueInstantiator0.getValueTypeDesc());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test35() throws Throwable {
Class<ExceptionInInitializerError> class0 = ExceptionInInitializerError.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
boolean boolean0 = stdValueInstantiator0.canCreateFromBoolean();
assertEquals("`java.lang.ExceptionInInitializerError`", stdValueInstantiator0.getValueTypeDesc());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test36() throws Throwable {
Class<InvocationTargetException> class0 = InvocationTargetException.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
boolean boolean0 = stdValueInstantiator0.canCreateFromDouble();
assertFalse(boolean0);
assertEquals("`java.lang.reflect.InvocationTargetException`", stdValueInstantiator0.getValueTypeDesc());
}
@Test(timeout = 4000)
public void test37() throws Throwable {
Class<Object> class0 = Object.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
boolean boolean0 = stdValueInstantiator0.canCreateFromLong();
assertFalse(boolean0);
assertEquals("`java.lang.Object`", stdValueInstantiator0.getValueTypeDesc());
}
@Test(timeout = 4000)
public void test38() throws Throwable {
Class<TypeIdResolver> class0 = TypeIdResolver.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
boolean boolean0 = stdValueInstantiator0.canCreateFromInt();
assertFalse(boolean0);
assertEquals("`com.fasterxml.jackson.databind.jsontype.TypeIdResolver`", stdValueInstantiator0.getValueTypeDesc());
}
@Test(timeout = 4000)
public void test39() throws Throwable {
Class<TypeIdResolver> class0 = TypeIdResolver.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
boolean boolean0 = stdValueInstantiator0.canCreateFromString();
assertFalse(boolean0);
assertEquals("`com.fasterxml.jackson.databind.jsontype.TypeIdResolver`", stdValueInstantiator0.getValueTypeDesc());
}
@Test(timeout = 4000)
public void test40() throws Throwable {
Class<ResolverStyle> class0 = ResolverStyle.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
Class<?> class1 = stdValueInstantiator0.getValueClass();
assertNotNull(class1);
assertEquals("`java.time.format.ResolverStyle`", stdValueInstantiator0.getValueTypeDesc());
assertEquals("class java.time.format.ResolverStyle", class1.toString());
}
@Test(timeout = 4000)
public void test41() throws Throwable {
Class<ResolverStyle> class0 = ResolverStyle.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
String string0 = stdValueInstantiator0.getValueTypeDesc();
assertEquals("`java.time.format.ResolverStyle`", string0);
}
@Test(timeout = 4000)
public void test42() throws Throwable {
Class<Object> class0 = Object.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig();
BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory(deserializerFactoryConfig0);
DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0);
JsonMappingException jsonMappingException0 = defaultDeserializationContext_Impl0.invalidTypeIdException((JavaType) null, ";lw2pH9!", ";lw2pH9!");
stdValueInstantiator0.rewrapCtorProblem(defaultDeserializationContext_Impl0, jsonMappingException0);
assertEquals("`java.lang.Object`", stdValueInstantiator0.getValueTypeDesc());
}
@Test(timeout = 4000)
public void test43() throws Throwable {
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, (JavaType) null);
SQLTransientConnectionException sQLTransientConnectionException0 = new SQLTransientConnectionException();
ExceptionInInitializerError exceptionInInitializerError0 = new ExceptionInInitializerError(sQLTransientConnectionException0);
// Undeclared exception!
// try {
stdValueInstantiator0.rewrapCtorProblem((DeserializationContext) null, exceptionInInitializerError0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("com.fasterxml.jackson.databind.deser.std.StdValueInstantiator", e);
// }
}
@Test(timeout = 4000)
public void test44() throws Throwable {
Class<String> class0 = String.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
ObjectMapper objectMapper0 = new ObjectMapper();
ArrayNode arrayNode0 = objectMapper0.createArrayNode();
JsonParser jsonParser0 = arrayNode0.traverse();
JsonMappingException jsonMappingException0 = JsonMappingException.from(jsonParser0, (String) null);
stdValueInstantiator0.wrapAsJsonMappingException((DeserializationContext) null, jsonMappingException0);
assertEquals("`java.lang.String`", stdValueInstantiator0.getValueTypeDesc());
}
@Test(timeout = 4000)
public void test45() throws Throwable {
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, (JavaType) null);
InvocationTargetException invocationTargetException0 = new InvocationTargetException((Throwable) null);
// Undeclared exception!
// try {
stdValueInstantiator0.rewrapCtorProblem((DeserializationContext) null, invocationTargetException0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("com.fasterxml.jackson.databind.deser.std.StdValueInstantiator", e);
// }
}
@Test(timeout = 4000)
public void test46() throws Throwable {
Class<String> class0 = String.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig();
BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory(deserializerFactoryConfig0);
DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0);
SQLTransientException sQLTransientException0 = new SQLTransientException(" m^N)i~^<|l@u)+");
SQLWarning sQLWarning0 = new SQLWarning("Qs&3e=Y(!o+", "Nn", sQLTransientException0);
// Undeclared exception!
// try {
stdValueInstantiator0.unwrapAndWrapException(defaultDeserializationContext_Impl0, sQLWarning0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("com.fasterxml.jackson.databind.DeserializationContext", e);
// }
}
@Test(timeout = 4000)
public void test47() throws Throwable {
SQLNonTransientException sQLNonTransientException0 = new SQLNonTransientException();
Class<Object> class0 = Object.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
Class<JsonMappingException> class1 = JsonMappingException.class;
NamedType namedType0 = new NamedType(class1);
JsonMappingException.Reference jsonMappingException_Reference0 = new JsonMappingException.Reference(namedType0, "");
JsonMappingException jsonMappingException0 = JsonMappingException.wrapWithPath((Throwable) sQLNonTransientException0, jsonMappingException_Reference0);
SQLException sQLException0 = new SQLException((String) null, "No delegate constructor for ", jsonMappingException0);
JsonMappingException jsonMappingException1 = stdValueInstantiator0.wrapException(sQLException0);
assertEquals("`java.lang.Object`", stdValueInstantiator0.getValueTypeDesc());
assertSame(jsonMappingException1, jsonMappingException0);
}
@Test(timeout = 4000)
public void test48() throws Throwable {
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, (JavaType) null);
// Undeclared exception!
// try {
stdValueInstantiator0.createFromBoolean((DeserializationContext) null, false);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("com.fasterxml.jackson.databind.deser.ValueInstantiator", e);
// }
}
@Test(timeout = 4000)
public void test49() throws Throwable {
DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig();
BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory(deserializerFactoryConfig0);
DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0);
Class<String> class0 = String.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
// Undeclared exception!
// try {
stdValueInstantiator0.createFromDouble(defaultDeserializationContext_Impl0, 1017.3125543514476);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("com.fasterxml.jackson.databind.DeserializationContext", e);
// }
}
@Test(timeout = 4000)
public void test50() throws Throwable {
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, (JavaType) null);
DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig();
BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory(deserializerFactoryConfig0);
DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0);
// Undeclared exception!
// try {
stdValueInstantiator0.createFromLong(defaultDeserializationContext_Impl0, 0L);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("com.fasterxml.jackson.databind.DeserializationContext", e);
// }
}
@Test(timeout = 4000)
public void test51() throws Throwable {
Class<JsonMappingException> class0 = JsonMappingException.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
DeserializerFactoryConfig deserializerFactoryConfig0 = new DeserializerFactoryConfig();
BeanDeserializerFactory beanDeserializerFactory0 = new BeanDeserializerFactory(deserializerFactoryConfig0);
DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0);
// Undeclared exception!
// try {
stdValueInstantiator0.createFromString(defaultDeserializationContext_Impl0, "M6'G)?e8mE]N:ndszVA");
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("com.fasterxml.jackson.databind.DeserializationContext", e);
// }
}
@Test(timeout = 4000)
public void test52() throws Throwable {
Class<ResolverStyle> class0 = ResolverStyle.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance;
DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0);
// Undeclared exception!
// try {
stdValueInstantiator0.createFromObjectWith((DeserializationContext) defaultDeserializationContext_Impl0, (Object[]) null);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("com.fasterxml.jackson.databind.DeserializationContext", e);
// }
}
@Test(timeout = 4000)
public void test53() throws Throwable {
Class<Object> class0 = Object.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
// Undeclared exception!
// try {
stdValueInstantiator0.createUsingDefault((DeserializationContext) null);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("com.fasterxml.jackson.databind.deser.ValueInstantiator", e);
// }
}
@Test(timeout = 4000)
public void test54() throws Throwable {
Class<Object> class0 = Object.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
AnnotationIntrospector annotationIntrospector0 = AnnotationIntrospector.nopInstance();
POJOPropertyBuilder pOJOPropertyBuilder0 = new POJOPropertyBuilder((MapperConfig<?>) null, annotationIntrospector0, false, (PropertyName) null);
JavaType javaType0 = pOJOPropertyBuilder0.getPrimaryType();
stdValueInstantiator0._delegateType = javaType0;
boolean boolean0 = stdValueInstantiator0.canInstantiate();
assertTrue(stdValueInstantiator0.canCreateUsingDelegate());
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test55() throws Throwable {
Class<ResolverStyle> class0 = ResolverStyle.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
JavaType javaType0 = TypeFactory.unknownType();
SettableBeanProperty[] settableBeanPropertyArray0 = new SettableBeanProperty[1];
stdValueInstantiator0.configureFromArraySettings((AnnotatedWithParams) null, javaType0, settableBeanPropertyArray0);
boolean boolean0 = stdValueInstantiator0.canInstantiate();
assertTrue(stdValueInstantiator0.canCreateUsingArrayDelegate());
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test56() throws Throwable {
Class<Object> class0 = Object.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
AnnotationIntrospector annotationIntrospector0 = AnnotationIntrospector.nopInstance();
POJOPropertyBuilder pOJOPropertyBuilder0 = new POJOPropertyBuilder((MapperConfig<?>) null, annotationIntrospector0, false, (PropertyName) null);
JavaType javaType0 = pOJOPropertyBuilder0.getPrimaryType();
stdValueInstantiator0._delegateType = javaType0;
boolean boolean0 = stdValueInstantiator0.canCreateUsingDelegate();
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test57() throws Throwable {
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, (Class<?>) null);
assertFalse(stdValueInstantiator0.canCreateFromBoolean());
}
@Test(timeout = 4000)
public void test58() throws Throwable {
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, (JavaType) null);
stdValueInstantiator0.getWithArgsCreator();
assertEquals("UNKNOWN TYPE", stdValueInstantiator0.getValueTypeDesc());
}
@Test(timeout = 4000)
public void test59() throws Throwable {
Class<String> class0 = String.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
stdValueInstantiator0.getDefaultCreator();
assertEquals("`java.lang.String`", stdValueInstantiator0.getValueTypeDesc());
}
@Test(timeout = 4000)
public void test60() throws Throwable {
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, (JavaType) null);
stdValueInstantiator0.getArrayDelegateType((DeserializationConfig) null);
assertEquals("UNKNOWN TYPE", stdValueInstantiator0.getValueTypeDesc());
}
@Test(timeout = 4000)
public void test61() throws Throwable {
Class<ResolverStyle> class0 = ResolverStyle.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance;
DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0);
// Undeclared exception!
// try {
stdValueInstantiator0.createFromInt(defaultDeserializationContext_Impl0, (-769));
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("com.fasterxml.jackson.databind.DeserializationContext", e);
// }
}
@Test(timeout = 4000)
public void test62() throws Throwable {
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, (JavaType) null);
stdValueInstantiator0.getArrayDelegateCreator();
assertEquals("UNKNOWN TYPE", stdValueInstantiator0.getValueTypeDesc());
}
@Test(timeout = 4000)
public void test63() throws Throwable {
Class<ExceptionInInitializerError> class0 = ExceptionInInitializerError.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
stdValueInstantiator0.getDelegateCreator();
assertEquals("`java.lang.ExceptionInInitializerError`", stdValueInstantiator0.getValueTypeDesc());
}
@Test(timeout = 4000)
public void test64() throws Throwable {
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, (JavaType) null);
AnnotationMap annotationMap0 = new AnnotationMap();
AnnotatedParameter annotatedParameter0 = new AnnotatedParameter((AnnotatedWithParams) null, (JavaType) null, (TypeResolutionContext) null, annotationMap0, (-2041));
stdValueInstantiator0.configureIncompleteParameter(annotatedParameter0);
AnnotatedParameter annotatedParameter1 = stdValueInstantiator0.getIncompleteParameter();
assertEquals("UNKNOWN TYPE", stdValueInstantiator0.getValueTypeDesc());
assertNotNull(annotatedParameter1);
}
@Test(timeout = 4000)
public void test65() throws Throwable {
Class<ResolverStyle> class0 = ResolverStyle.class;
StdValueInstantiator stdValueInstantiator0 = new StdValueInstantiator((DeserializationConfig) null, class0);
stdValueInstantiator0.getDelegateType((DeserializationConfig) null);
assertEquals("`java.time.format.ResolverStyle`", stdValueInstantiator0.getValueTypeDesc());
}
}
|
[
"[email protected]"
] | |
aca70a9ab263b5400aa331270b4f1ef73c63ba04
|
381ec9753852e597f27f29163d821ba61d57a784
|
/main/Calculator.java
|
530a3a4f087df7420bf8be568b6f4e05b2b8ecd7
|
[] |
no_license
|
kem41k/simpleclac
|
97956204841051c8a625b3e67d51b34ea61f77ff
|
9a02338f13ec96953569e1c5f8bb1a77028f8c13
|
refs/heads/master
| 2020-03-12T12:00:40.470787 | 2018-03-19T21:05:57 | 2018-03-19T21:05:57 | 130,609,092 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 8,675 |
java
|
package calculator;
import java.util.ArrayList;
import java.util.List;
public class Calculator {
/**
* Evaluate statement represented as string.
*
* @param statement mathematical statement containing digits, '.' (dot) as decimal mark,
* parentheses, operations signs '+', '-', '*', '/'<br>
* Example: <code>(1 + 38) * 4.5 - 1 / 2.</code>
* @return string value containing result of evaluation or null if statement is invalid
*/
public String evaluate(String statement) {
if (statement == null || statement.length() == 0) return null;
statement = statement.replace(" ", "");
if (!checkPermittedSymbols(statement)) return null;
List<String> tokens = extractTokens(statement);
if (tokens == null) return null;
List<String> tokensRPN = reversePolishNotation(tokens);
if (tokensRPN == null) return null;
return calculateRPN(tokensRPN);
}
/**
* Permitted symbols are '(', ')', '*', '+', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
* so the symbol unicode should be 40-43 or 45-57.
*
* @param input mathematical statement
* @return true if input string contains only permitted symbols, otherwise false
*/
private static boolean checkPermittedSymbols(String input) {
for (int i = 0; i < input.length(); i++) {
int symbolCode = (int)input.charAt(i);
if (symbolCode < 40 || symbolCode == 44 || symbolCode > 57)
return false;
// Check that there are no two sequent operators (e.g. "+-")
if (i > 1 && "+-*/".contains(String.valueOf(input.charAt(i - 1))) && "+-*/".contains(String.valueOf(input.charAt(i))))
return false;
}
return true;
}
/**
* Extract tokens from an input string.
*
* @param input mathematical statement
* @return List<String> containing extracted tokens or null if statement is invalid
*/
private static List<String> extractTokens(String input) {
int pos = 0; // Position of char in input string
List<String> tokens = new ArrayList<>();
String temp = "";
// Extracting tokens
while (pos < input.length()) {
int symbolCode = (int)input.charAt(pos);
// '(', ')', '*', '+', '-', '/'
if ((symbolCode >= 40 && symbolCode <= 43) || symbolCode == 45 || symbolCode == 47) {
if (temp.length() > 0) {
if (!isDouble(temp)) return null;
tokens.add(temp);
temp = "";
}
tokens.add(String.valueOf(input.charAt(pos)));
}
// '.', '0' - '9'
else temp += input.charAt(pos);
pos++;
}
// Checking last temp string
if (temp.length() > 0) {
if (!isDouble(temp)) return null;
tokens.add(temp);
temp = "";
}
// If last token is '+', '-', '*' or '/', then mathematical statement is not correct
if ("+-*/".contains(tokens.get(tokens.size() - 1))) return null;
return tokens;
}
/**
* Check the double number for correctness (like '1.2', not '1..2').
*
* @param number string that should be converted to double
* @return true if number is double, otherwise false
*/
private static boolean isDouble(String number) {
try {
double temp = Double.parseDouble(number);
return true;
}
catch (NumberFormatException e) {
return false;
}
}
/**
* Transform mathematical statement into reverse Polish notation
*
* @param tokens List of input tokens
* @return List<String> containing tokens in reverse Polish notation or null if mathematical statement is invalid
*/
public static List<String> reversePolishNotation(List<String> tokens) {
List<String> result = new ArrayList<>();
List<String> stack = new ArrayList<>();
for(String token : tokens)
if ("+-*/".contains(token)) {
if (stack.size() > 0) {
// Moving top tokens from stack to result while priority(token) <= priority(top token in stack)
while (stack.size() > 0 && priority(token) <= priority(stack.get(stack.size() - 1))) {
result.add(stack.get(stack.size() - 1));
stack.remove(stack.size() - 1);
}
}
stack.add(token);
}
else if (token.equals("(")) {
stack.add(token);
}
else if (token.equals(")")) {
// Find the position of "(" in stack
int pos = -1;
for (int i = 0; i < stack.size(); i++)
if (stack.get(i).equals("(")) {
pos = i;
break;
}
// If there is no "(", then mathematical statement is wrong
if (pos == -1) return null;
// Moving top tokens from stack to result till "("
int i = 0;
for (i = stack.size() - 1; i > pos; i--) {
result.add(stack.get(i));
stack.remove(i);
}
// Deleting "(" from stack
stack.remove(i);
}
// Numbers
else {
result.add(token);
}
// Moving stack to result. If remaining tokens in stack are not operators, then mathematical statement is wrong
for (int i = stack.size() - 1; i >= 0; i--)
if ("()0123456789.".contains(stack.get(i))) return null;
else {
result.add(stack.get(i));
stack.remove(i);
}
return result;
}
/**
* Get the priority of an operation.
*
* @param token current operator
* @return priority
*/
private static byte priority(String token) {
if (token.equals("(")) return 1;
if (token.equals("+") || token.equals("-")) return 2;
if (token.equals("*") || token.equals("/")) return 3;
return 4;
}
/**
* Get the result of mathematical statement in reverse Polish notation
*
* @param tokens List of tokens in reverse Polish notation
* @return result of mathematical statement or null
*/
private static String calculateRPN(List<String> tokens) {
List<String> stack = new ArrayList<>();
for(String token : tokens)
if ("+-*/".contains(token)) {
switch (stack.size()) {
case 0:
return null;
case 1:
if (token.equals("-"))
stack.set(0, "-" + stack.get(0));
else
return null;
break;
default:
try {
double elem1 = Double.parseDouble(stack.get(stack.size() - 2));
double elem2 = Double.parseDouble(stack.get(stack.size() - 1));
double res = 0;
if (token.equals("+")) res = elem1 + elem2;
else if (token.equals("-")) res = elem1 - elem2;
else if (token.equals("*")) res = elem1 * elem2;
else {
// Check for 0 in denominator
if (elem2 == 0.0) return null;
else res = elem1 / elem2;
}
stack.remove(stack.size() - 1);
stack.set(stack.size() - 1, String.valueOf(res));
}
catch (NumberFormatException e) {
return null;
}
}
}
else {
stack.add(token);
}
// Round to 4 significant digits
double res = Double.parseDouble(stack.get(stack.size() - 1));
res = Math.round(res * 10000d) / 10000d;
// If rounded result is integer, then symbols ".0" in the end should be removed
if (res % 1 == 0) return String.valueOf(res).substring(0, String.valueOf(res).length() - 2);
return String.valueOf(res);
}
}
|
[
"[email protected]"
] | |
1216e9b2e55e388dbc002bae624e332aa033dc6e
|
aaf7453c0a37cf8a759bf2113511f40b12e6fda6
|
/Jewel Loan Report 18BCB0016/Permission_to_access_reports.java
|
09e7e956c93f1e2f8c031e18b6f9633a65df981d
|
[] |
no_license
|
cjsatishvit/team5
|
0d816c92fa0372d6fb16ec843935a87834604fce
|
f26e0838d69bbff5cfec2f4212adb4cea62069bb
|
refs/heads/master
| 2021-03-23T02:07:28.682224 | 2020-06-06T04:01:54 | 2020-06-06T04:01:54 | 247,414,673 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,466 |
java
|
import java.io.File;
public class SetExecuteTest{
public static void main(String[] args)throws SecurityException {
File file = new File("C:/setExecuteTest.txt");
if (file.exists()) {
boolean bval = file.setExecutable(true);
System.out.println("set the owner's execute permission: "+ bval);
} else {
System.out.println("File cannot exists: ");
}
if (file.exists()) {
boolean bval = file.setExecutable(true,false);
System.out.println("set the everybody execute permission: "+ bval);
} else {
System.out.println("File cannot exists: ");
}
//set read-only permissions
if (file.exists()) {
boolean bval_1 = file.setReadable(true);
System.out.println("set the Owner Read permission: "+ bval_1);
} else {
System.out.println("File cannot exists: ");
}
if (file.exists()) {
boolean bval_2 = file.setReadable(true,false);
System.out.println("set the every user Read permission: "+ bval_2);
} else {
System.out.println("File cannot exists: ");
}
//Set write permission on File for all.
if (file.exists()) {
boolean bval = file.setWritable(true,false);
System.out.println("set the every user write permission: "+ bval);
} else {
System.out.println("File cannot exists: ");
}
}
}
|
[
"[email protected]"
] | |
065a75616d1d117d9e89adb59cd107c7df570782
|
a2cab81f1027c7eb9a727302f11f327eddc6a044
|
/APBDOO/Boardgames/src/com/DAO/Implementations/JocTipImpl.java
|
39236fc252d875a3aa1430dfc384fac676456ca3
|
[] |
no_license
|
ciprianceausescu/Master_materiale
|
bc9397265a50c13b4e6359a0fab5d5a18bf2c79a
|
c4dc350c54e2a8c151f7800bf63c773a40609bae
|
refs/heads/master
| 2021-10-23T05:57:06.901517 | 2019-03-15T08:10:25 | 2019-03-15T08:10:25 | 111,453,004 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,203 |
java
|
package com.DAO.Implementations;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import com.DaoInterfaces.JocTipDAO;
import com.Tables.Angajat;
import com.Tables.JocTip;
import com.dbConnection.MySQLConnection;
public class JocTipImpl implements JocTipDAO{
@Override
public List<JocTip> getAllTypes() {
String sql = "Select * from joc_tip order by joc_tip_id asc";
List<JocTip> gameTypeList = new ArrayList<JocTip>();
try {
Connection conn = MySQLConnection.startConnection();
System.out.println("Connected.");
PreparedStatement pstm = conn.prepareStatement(sql);
ResultSet rs = pstm.executeQuery();
while (rs.next()) {
JocTip jocTip = new JocTip();
// get the parameters selected in the table
int joc_tip_id = rs.getInt("joc_tip_id");
String nume = rs.getString("nume");
String descriere = rs.getString("descriere");
// add to list
jocTip.setJoc_tip_id(joc_tip_id);
jocTip.setNume(nume);
jocTip.setDescriere(descriere);
// add to list
gameTypeList.add(jocTip);
}
pstm.close();
rs.close();
} catch (Exception e) {
System.out.println("Not connected.");
e.printStackTrace();
}
// ! remember to return the new List
return gameTypeList;
}
@Override
public JocTip getGameType(long id) {
String sql = "Select * from joc_tip where joc_tip_id=?";
try {
Connection conn = MySQLConnection.startConnection();
System.out.println("Connected.");
PreparedStatement pstm = conn.prepareStatement(sql);
pstm.setLong(1, id);
ResultSet rs = pstm.executeQuery();
if (rs.next()) {
JocTip jocTip = new JocTip();
// get the parameters selected in the table
int joc_tip_id = rs.getInt("joc_tip_id");
String nume = rs.getString("nume");
String descriere = rs.getString("descriere");
// add to list
jocTip.setJoc_tip_id(joc_tip_id);
jocTip.setNume(nume);
jocTip.setDescriere(descriere);
return jocTip;
}
pstm.close();
rs.close();
} catch (Exception e) {
System.out.println("Not connected.");
e.printStackTrace();
}
return null;
}
}
|
[
"[email protected]"
] | |
f84a33f2686d660b255002c80041273dbefd62a7
|
e789b24521a376b67568266f3a528ada993c03b2
|
/src/main/java/com/oneweb/model/Page.java
|
0d0723349e495ff163e6e54463061743e784bb66
|
[] |
no_license
|
iatpatelishan/cs5200-java-data-model
|
99fb735581f5dae1baaa887474eb9f364c60badb
|
16a98cda46f87c2874f62615a3f778ef1a1e667f
|
refs/heads/master
| 2021-03-16T09:10:39.211244 | 2018-03-08T08:32:02 | 2018-03-08T08:32:02 | 124,304,307 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,572 |
java
|
package com.oneweb.model;
import java.sql.Date;
import java.util.List;
public class Page {
private int id;
private String title;
private String description;
private Date created;
private Date updated;
private int views;
private List<Widget> widgets;
public Page() {
super();
}
public Page(int id, String title, String description, Date created, Date updated, int views, List<Widget> widgets) {
super();
this.id = id;
this.title = title;
this.description = description;
this.created = created;
this.updated = updated;
this.views = views;
this.widgets = widgets;
}
public Page(String title, String description, int views) {
super();
this.title = title;
this.description = description;
this.views = views;
}
public int getId() {
return id;
}
public String getTitle() {
return title;
}
public String getDescription() {
return description;
}
public Date getCreated() {
return created;
}
public Date getUpdated() {
return updated;
}
public int getViews() {
return views;
}
public List<Widget> getWidgets() {
return widgets;
}
public void setId(int id) {
this.id = id;
}
public void setTitle(String title) {
this.title = title;
}
public void setDescription(String description) {
this.description = description;
}
public void setCreated(Date created) {
this.created = created;
}
public void setUpdated(Date updated) {
this.updated = updated;
}
public void setViews(int views) {
this.views = views;
}
public void setWidgets(List<Widget> widgets) {
this.widgets = widgets;
}
}
|
[
"[email protected]"
] | |
f30dfccf992ae6906841df3af9a22916568fb003
|
096e862f59cf0d2acf0ce05578f913a148cc653d
|
/code/services/Telephony/src/com/android/phone/PhoneSearchIndexablesProvider.java
|
c71ab49009a3f0676e70b314c03c15e3425be6cc
|
[
"Apache-2.0"
] |
permissive
|
Phenix-Collection/Android-6.0-packages
|
e2ba7f7950c5df258c86032f8fbdff42d2dfc26a
|
ac1a67c36f90013ac1de82309f84bd215d5fdca9
|
refs/heads/master
| 2021-10-10T20:52:24.087442 | 2017-05-27T05:52:42 | 2017-05-27T05:52:42 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,719 |
java
|
/*
* Copyright (C) 2014 The Android Open Source Project
*
* 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.android.phone;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.os.UserHandle;
import android.provider.SearchIndexableResource;
import android.provider.SearchIndexablesProvider;
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_RANK;
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_RESID;
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_CLASS_NAME;
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_ICON_RESID;
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_INTENT_ACTION;
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_INTENT_TARGET_PACKAGE;
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_INTENT_TARGET_CLASS;
import static android.provider.SearchIndexablesContract.INDEXABLES_RAW_COLUMNS;
import static android.provider.SearchIndexablesContract.INDEXABLES_XML_RES_COLUMNS;
import static android.provider.SearchIndexablesContract.NON_INDEXABLES_KEYS_COLUMNS;
public class PhoneSearchIndexablesProvider extends SearchIndexablesProvider {
private static final String TAG = "PhoneSearchIndexablesProvider";
private static SearchIndexableResource[] INDEXABLE_RES = new SearchIndexableResource[] {
new SearchIndexableResource(1, R.xml.network_setting,
MobileNetworkSettings.class.getName(),
R.mipmap.ic_launcher_phone),
};
@Override
public boolean onCreate() {
return true;
}
@Override
public Cursor queryXmlResources(String[] projection) {
MatrixCursor cursor = new MatrixCursor(INDEXABLES_XML_RES_COLUMNS);
/* SPRD: In visitor mode,don't show phone items in search for bug 493289. @{ */
boolean mIsPrimary = UserHandle.myUserId() == UserHandle.USER_OWNER;
if (!mIsPrimary) {
return cursor;
}
/* @} */
final int count = INDEXABLE_RES.length;
for (int n = 0; n < count; n++) {
Object[] ref = new Object[7];
ref[COLUMN_INDEX_XML_RES_RANK] = INDEXABLE_RES[n].rank;
ref[COLUMN_INDEX_XML_RES_RESID] = INDEXABLE_RES[n].xmlResId;
ref[COLUMN_INDEX_XML_RES_CLASS_NAME] = null;
ref[COLUMN_INDEX_XML_RES_ICON_RESID] = INDEXABLE_RES[n].iconResId;
ref[COLUMN_INDEX_XML_RES_INTENT_ACTION] = "android.intent.action.MAIN";
ref[COLUMN_INDEX_XML_RES_INTENT_TARGET_PACKAGE] = "com.android.phone";
ref[COLUMN_INDEX_XML_RES_INTENT_TARGET_CLASS] = INDEXABLE_RES[n].className;
cursor.addRow(ref);
}
return cursor;
}
@Override
public Cursor queryRawData(String[] projection) {
MatrixCursor cursor = new MatrixCursor(INDEXABLES_RAW_COLUMNS);
return cursor;
}
@Override
public Cursor queryNonIndexableKeys(String[] projection) {
MatrixCursor cursor = new MatrixCursor(NON_INDEXABLES_KEYS_COLUMNS);
return cursor;
}
}
|
[
"[email protected]"
] | |
a45f76e61497fa5b70e25a1feeda157448cc7f79
|
f6feeb62e43ecd3e0f4807cadb6418fa4f761200
|
/src/main/java/com/hz/pojo/SlickIndustry.java
|
daec290c15d716e34b19e0585eab680e294fee04
|
[] |
no_license
|
zyz1326738995/readpaale
|
7ce7ad8ace3d044f80fc30423fff5a556f4d77ad
|
1411ced818f03f4d8976ef346c36b17418779240
|
refs/heads/master
| 2022-07-08T10:17:23.400572 | 2020-04-08T11:14:18 | 2020-04-08T11:14:18 | 243,222,478 | 0 | 0 | null | 2022-06-29T17:59:08 | 2020-02-26T09:25:56 |
JavaScript
|
UTF-8
|
Java
| false | false | 1,729 |
java
|
package com.hz.pojo;
public class SlickIndustry {
private long industry_id;
private String industry_name;
private long industry_app_id;
private String industry_introduce;
private String industry_icon;
private long company_id;
private SlickCompany slickCompany;
public SlickIndustry() {
}
public SlickIndustry(long industry_id, String industry_name, String industry_introduce) {
super();
this.industry_id = industry_id;
this.industry_name = industry_name;
this.industry_introduce = industry_introduce;
}
public SlickCompany getSlickCompany() {
return slickCompany;
}
public void setSlickCompany(SlickCompany slickCompany) {
this.slickCompany = slickCompany;
}
public long getCompany_id() {
return company_id;
}
public void setCompany_id(long company_id) {
this.company_id = company_id;
}
public String getIndustry_icon() {
return industry_icon;
}
public void setIndustry_icon(String industry_icon) {
this.industry_icon = industry_icon;
}
public long getIndustry_id() {
return industry_id;
}
public void setIndustry_id(long industry_id) {
this.industry_id = industry_id;
}
public String getIndustry_name() {
return industry_name;
}
public void setIndustry_name(String industry_name) {
this.industry_name = industry_name;
}
public long getIndustry_app_id() {
return industry_app_id;
}
public void setIndustry_app_id(long industry_app_id) {
this.industry_app_id = industry_app_id;
}
public String getIndustry_introduce() {
return industry_introduce;
}
public void setIndustry_introduce(String industry_introduce) {
this.industry_introduce = industry_introduce;
}
}
|
[
"[email protected]"
] | |
60ac4357bd06eaca85c68772b886cd54091613c6
|
0af8b92686a58eb0b64e319b22411432aca7a8f3
|
/large-multiproject/project22/src/test/java/org/gradle/test/performance22_3/Test22_222.java
|
e6bb1900348c4dffb737b71b5c757668807dcae9
|
[] |
no_license
|
gradle/performance-comparisons
|
b0d38db37c326e0ce271abebdb3c91769b860799
|
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
|
refs/heads/master
| 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null |
UTF-8
|
Java
| false | false | 292 |
java
|
package org.gradle.test.performance22_3;
import static org.junit.Assert.*;
public class Test22_222 {
private final Production22_222 production = new Production22_222("value");
@org.junit.Test
public void test() {
assertEquals(production.getProperty(), "value");
}
}
|
[
"[email protected]"
] | |
4cde91a899718f50f1b9f373d6b4e3f051590488
|
cae35cf07360f0eb36fedfaf1e43334b94b25f38
|
/JobComponent/src/test/java/com/cqx/myjob/jobcomponent/impl/SplitPackageJobTest.java
|
545f97fb021954764da63115c48d96f91deeb4af
|
[
"Apache-2.0"
] |
permissive
|
chenqixu/MyJob
|
28d9e0a17abaf69cfc2f77039b1b021d7f716927
|
dfda16b45624b581602c72747cf3ab606e428faf
|
refs/heads/master
| 2021-05-19T00:13:20.308576 | 2021-03-23T07:15:49 | 2021-03-23T07:15:49 | 251,489,785 | 0 | 0 |
Apache-2.0
| 2020-10-13T20:48:59 | 2020-03-31T03:21:14 |
Java
|
UTF-8
|
Java
| false | false | 1,475 |
java
|
package com.cqx.myjob.jobcomponent.impl;
import com.cqx.myjob.jobcomponent.test.BaseJobTest;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
public class SplitPackageJobTest extends BaseJobTest {
@Before
public void setUp() throws Throwable {
job = new SplitPackageJob();
super.init();
}
@After
public void tearDown() throws Throwable {
job.release();
}
@Test
public void run() throws Throwable {
job.run();
}
@Override
protected Map<String, String> assembleParam() {
Map<String, String> param = new HashMap<>();
param.put("local_bak_path", "d:/tmp/bi/databackup/if_upload_hb_netlog/${run_date}/");
param.put("extension", "01-${device_id}-${seq}-${file_start_time}-${file_end_time}-${record_count}-${md5}-${file_size}.txt.gz");
param.put("max_line", "10000");
param.put("hadoop_conf", "d:\\tmp\\etc\\hadoop\\conf75\\");
param.put("hdfs_file_path", "/cqx/data/hbidc/000000_1");
param.put("zookeeper", "10.1.4.186:2183");
param.put("seq_zk_path", "/computecenter/task_context/if_upload_iptrace_jitian/infoId");
param.put("host", "10.1.8.204");
param.put("port", "22");
param.put("user", "edc_base");
param.put("password", "fLyxp1s*");
param.put("remote_path", "/bi/user/cqx/data/hblog/");
return param;
}
}
|
[
"[email protected]"
] | |
cc6255ed493f47c93db4a37a9c4cd41610a719b8
|
117a24dc265bbc965dc4f8b14ce4399b8e0f8ba6
|
/src/main/java/DSA/Arrays2/FindFrequentCharacter.java
|
a65caadc4a5f0e2f452eb7fc8a06101b14ce5edf
|
[] |
no_license
|
sureshrmdec/Preparation26EatSleepDrinkCode
|
e240393eabdc3343bb1165d5c432217f085aa353
|
aa5b81907205f9d435835e2150100e8f53027212
|
refs/heads/master
| 2021-09-29T14:28:24.691090 | 2018-11-25T13:52:43 | 2018-11-25T13:52:43 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 731 |
java
|
/**
*
*/
package DSA.Arrays2;
/**
* @author Raj
*
*
*/
public class FindFrequentCharacter {
/**
* @param args
*/
public static void main(String[] args) {
FindFrequentCharacter obj = new FindFrequentCharacter();
String str = "Connections";
char result;
// Time : O(n)
result = obj.findFrequentCharacer(str.toCharArray(), str.length());
System.out.println(result);
}
public char findFrequentCharacer(char[] a, int n) {
int count[] = new int[256];
for (int i = 0; i < n; i++) {
count[a[i]]++;
}
int max = 0;
char frequentChar = 0;
for (int i = 0; i < count.length; i++) {
if (count[i] > max) {
max = count[i];
frequentChar = (char) i;
}
}
return frequentChar;
}
}
|
[
"[email protected]"
] | |
475ce5d6231827d0acab3dc3714d1cdae1ee8058
|
0d0b4fccc61b4e17ca198172d2d799da9965cb00
|
/ds/src/ds/list/linkedList/MergetwoSortedLL.java
|
8b07abb0a82b28047e783e673d0f9c4c2f9bfd91
|
[] |
no_license
|
mathpalanmol/practice
|
3fc71c0c812ab452dbb0278e6716e912d95c8100
|
2f9a807bc0205c167ba5c3ee122995024a799a26
|
refs/heads/master
| 2021-07-21T22:46:45.416606 | 2021-07-13T07:58:42 | 2021-07-13T07:58:42 | 109,954,627 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,791 |
java
|
package ds.list.linkedList;
public class MergetwoSortedLL {
public static void main(String[] args) {
LinkList list1 = new LinkList();
list1.insertElement(5); /* Insertion */
list1.insertElement(7);
list1.insertElement(9);
LinkList list2 = new LinkList();
list2.insertElement(6); /* Insertion */
list2.insertElement(8);
list2.insertElement(10);
list1.insertElement(12);
Link start = mergeIterative(list1.first, list2.first);
display(start);
}
private static void display(Link start) {
Link current = start;
while (current != null) {
System.out.println(current.key);
current = current.next;
}
}
/* Recursive */
static Link mergeLists(Link list1, Link list2) {
if (list1 == null)
return list2;
if (list2 == null) //similar to lca
return list1;
if (list1.key <= list2.key) {
list1.next = mergeLists(list1.next, list2);
return list1;
} else {
list2.next = mergeLists(list1, list2.next);
return list2;
}
}
/* Iterative */
static Link mergeIterative(Link link1, Link link2) {
Link start = null;
Link current = null;
while (link1 != null && link2 != null) {
if (link1.key <= link2.key) {
if (start == null) {
start = link1;
current = link1;
} else {
current.next = link1;
current = current.next;
}
link1 = link1.next;
} else {
if (start == null) {
start = link2;
current = link2;
} else {
current.next = link2;
current = current.next;
}
link2 = link2.next;
}
} // same approach we use while merging
if (link1 != null) {
current.next = link1;
link1 = link1.next;
current = current.next;
}
if (link2 != null) {
current.next = link2;
link2 = link2.next;
current = current.next;
}
return start;
}
}
|
[
"[email protected]"
] | |
f3cd1bcd064a8040cdd2cfdfbdbc64677d9bb798
|
8d4117dd57f420c64c3315cf638315d1579c182e
|
/week-4/day-3/src/main/java/music/Violin.java
|
7a1f50289aa0bf84763010681bd7f1f83abe88d6
|
[] |
no_license
|
green-fox-academy/krisztianhor
|
8dbca3c17dc67bc0b9c976bca12a958c47aebd44
|
daabcd2fb8c195451569d9429d3a2f5277c367ec
|
refs/heads/master
| 2020-04-02T22:48:41.393160 | 2018-12-06T18:30:19 | 2018-12-06T18:30:19 | 154,845,247 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 222 |
java
|
package main.java.music;
public class Violin extends StringedInstrument {
public Violin() {
this.name = "Violin";
this.numberOfStrings = 4;
}
@Override
public String sound() {
return "Screech";
}
}
|
[
"[email protected]"
] | |
df8480c87d234938ec65fcf24748555ba192f7df
|
49f4a5d1b477d82d5cbb8cd062dda370e9a192a3
|
/src/Sauce.java
|
45615c36ef3bf9d3fceb022b5e5630c94096417d
|
[] |
no_license
|
syuchan1005/Mili-world-search-you
|
a9643c462a8422527f44f10de5211ac97e27a510
|
131d9679580a517cb81c3a46b01a48bcc7db8784
|
refs/heads/master
| 2021-01-21T19:39:51.509152 | 2017-05-23T08:32:22 | 2017-05-23T08:32:22 | 92,148,841 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 111 |
java
|
/**
* Created by syuchan on 2017/05/23.
*/
public class Sauce {
public String getName() {
return "";
}
}
|
[
"[email protected]"
] | |
c9fc340bdf7d23e4dce27ae827df46c159ca7e9f
|
33369f5d0ffd8568443d7ebe6efe529635f88421
|
/rlg/rlg_2/src/main/java/com/mappers/ProductMapper.java
|
73278ac8313b65137b95f8faa8788ca7b5c888ad
|
[] |
no_license
|
sun654321/itdrrlg2019
|
be6b0a105c37cd1be24b7fe442f23a89adfcfeb6
|
9daf383718c7c9dad0d1cc342ed7d85b79f40a3a
|
refs/heads/master
| 2020-07-23T06:37:28.336559 | 2019-09-25T11:15:13 | 2019-09-25T11:15:13 | 207,475,584 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,068 |
java
|
package com.mappers;
import com.pojo.Product;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ProductMapper {
int deleteByPrimaryKey(Integer id);
int insert(Product record);
int insertSelective(Product record);
int updateByPrimaryKeySelective(Product record);
int updateByPrimaryKey(Product record);
//产品搜索及动态排序List
List<Product> list(@Param("categoryId") Integer categoryId, @Param("keyword") String keyword,
@Param("split1")String split1, @Param("split2") String split2);
//产品detail
Product detail(@Param("productId") Integer productId, @Param("is_new")Integer is_new,
@Param("is_hot")Integer is_hot, @Param("is_banner")Integer is_banner);
//根据商品id进行查询
Product selectByproductId(Integer productId);
//查询商品的信息
Product selectProductId(Integer productId);
//根据id进行修改信息
int updateId(@Param("productId")Integer productId, @Param("Stock")Integer Stock);
}
|
[
"[email protected]"
] | |
8b6fdb2f93568c5f40fd47c821c5d8906f7d04e4
|
8e67fdab6f3a030f38fa127a79050b8667259d01
|
/JavaStudyHalUk/src/TECHNOSTUDY_SAMILBY/gun3/Double.java
|
003334b24b83e4ee0bebee467b50c924b34a2661
|
[] |
no_license
|
mosmant/JavaStudyHalUk
|
07e38ade6c7a31d923519a267a63318263c5910f
|
a41e16cb91ef307b50cfc497535126aa1e4035e5
|
refs/heads/master
| 2023-07-27T13:31:11.004490 | 2021-09-12T14:59:25 | 2021-09-12T14:59:25 | 405,671,965 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 211 |
java
|
package TECHNOSTUDY_SAMILBY.gun3;
public class Double {
public static void main(String[] args) {
double tax = 6.012345678912345; // noktadan sonra 15 deger
System.out.println(tax);
}
}
|
[
"[email protected]"
] | |
fe71f8509fdbc5fa53c0c63a6eaa234927d09e9f
|
a6eb9fe7ae34fac729f48af96074e22ad4a88351
|
/uftasks/uftasks-showcase/uftasks-webapp/src/main/java/org/uberfire/client/screens/popup/NewFolderContentView.java
|
8d06b581e0cd7da473155011715df6ca612e7074
|
[] |
no_license
|
javawangfei2015/uberfire-tutorial
|
05a3034f7c7fe85a5c5382f8294cc9499bd7e58e
|
e2a645eae5715fdac3c6943de18b30c26e2381ba
|
refs/heads/master
| 2020-05-29T13:28:25.646208 | 2016-07-12T17:20:25 | 2016-07-12T17:20:25 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,249 |
java
|
/*
* Copyright 2016 Red Hat, Inc. and/or its affiliates.
*
* 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.uberfire.client.screens.popup;
import com.google.gwt.user.client.Event;
import org.jboss.errai.common.client.dom.Button;
import org.jboss.errai.common.client.dom.Div;
import org.jboss.errai.common.client.dom.HTMLElement;
import org.jboss.errai.common.client.dom.Input;
import org.jboss.errai.ui.client.local.api.IsElement;
import org.jboss.errai.ui.shared.api.annotations.DataField;
import org.jboss.errai.ui.shared.api.annotations.EventHandler;
import org.jboss.errai.ui.shared.api.annotations.SinkNative;
import org.jboss.errai.ui.shared.api.annotations.Templated;
import org.uberfire.mvp.Command;
import org.uberfire.mvp.ParameterizedCommand;
import javax.enterprise.context.Dependent;
import javax.inject.Inject;
@Dependent
@Templated
public class NewFolderContentView implements IsElement {
@Inject
@DataField( "folder-name" )
Input folderNameTextBox;
@Inject
@DataField( "ok-button" )
Button okButton;
@Inject
@DataField( "cancel-button" )
Button cancelButton;
private ParameterizedCommand<String> addFolder;
private Command cancel;
public void init( ParameterizedCommand<String> addFolder, Command cancel ) {
this.addFolder = addFolder;
this.cancel = cancel;
}
public void clearContent() {
folderNameTextBox.setValue( "" );
}
@SinkNative( Event.ONCLICK )
@EventHandler( "ok-button" )
public void addFolder( Event event ) {
addFolder.execute( folderNameTextBox.getValue() );
}
@EventHandler( "cancel-button" )
public void cancel( Event event ) {
cancel.execute();
}
}
|
[
"[email protected]"
] | |
247831c887a1d244e5ada2896e9564d101e336eb
|
c355d68b0ce660c25bf830f86a74955441dc96fe
|
/src/java/org/apache/cassandra/gms/HeartBeatState.java
|
0ae48bfcecf29ad78da54309849b957cb407a174
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] |
permissive
|
mourao666/cassandra-sim
|
a8f8b0bddda2f9de55d2044574629fd9918d886c
|
5143b8d5a3f1c3362e2c169963991fa1a0238f9d
|
refs/heads/master
| 2021-01-10T06:09:05.413739 | 2016-04-17T17:27:19 | 2016-04-17T17:27:19 | 43,784,866 | 1 | 2 |
Apache-2.0
| 2023-03-20T11:52:12 | 2015-10-06T23:30:50 |
Java
|
UTF-8
|
Java
| false | false | 2,605 |
java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.cassandra.gms;
import java.io.*;
import org.apache.cassandra.db.TypeSizes;
import org.apache.cassandra.io.IVersionedSerializer;
import org.apache.cassandra.io.util.DataOutputPlus;
/**
* HeartBeat State associated with any given endpoint.
*/
class HeartBeatState
{
public static final IVersionedSerializer<HeartBeatState> serializer = new HeartBeatStateSerializer();
private int generation;
private int version;
HeartBeatState(int gen)
{
this(gen, 0);
}
HeartBeatState(int gen, int ver)
{
generation = gen;
version = ver;
}
int getGeneration()
{
return generation;
}
void updateHeartBeat()
{
version = VersionGenerator.getNextVersion();
}
int getHeartBeatVersion()
{
return version;
}
void forceNewerGenerationUnsafe()
{
generation += 1;
}
void forceHighestPossibleVersionUnsafe()
{
version = Integer.MAX_VALUE;
}
public String toString()
{
return String.format("HeartBeat: generation = %d, version = %d", generation, version);
}
}
class HeartBeatStateSerializer implements IVersionedSerializer<HeartBeatState>
{
public void serialize(HeartBeatState hbState, DataOutputPlus out, int version) throws IOException
{
out.writeInt(hbState.getGeneration());
out.writeInt(hbState.getHeartBeatVersion());
}
public HeartBeatState deserialize(DataInput in, int version) throws IOException
{
return new HeartBeatState(in.readInt(), in.readInt());
}
public long serializedSize(HeartBeatState state, int version)
{
return TypeSizes.NATIVE.sizeof(state.getGeneration()) + TypeSizes.NATIVE.sizeof(state.getHeartBeatVersion());
}
}
|
[
"[email protected]"
] | |
7606d6dae31324c611e04687ac98b21a6c117362
|
afb04ab6275bd442da72bc72af687ab8309c42c9
|
/BlazeDemoCucumberJava_1/src/test/java/pages/BlazeDemo_FlightSelectPage.java
|
cd34e5d2c4caec8619e0c85c72e070d5c26072ea
|
[] |
no_license
|
SushmaShivananjappa/BlazeDemo_SeleniumJavaCucumberBDD
|
f4e7c30fe8d49e3f648841707a658465bb60cda9
|
cc45421c60fa25f62c73718094795a1af5b022f3
|
refs/heads/master
| 2023-05-30T07:54:14.905633 | 2021-06-12T06:52:51 | 2021-06-12T06:52:51 | 376,216,013 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,836 |
java
|
package pages;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.Select;
public class BlazeDemo_FlightSelectPage {
WebDriver driver1;
JavascriptExecutor js = (JavascriptExecutor)driver1;
// By selFlight = By.xpath("//tbody/child::tr[1]/child::input[@value='43']/preceding-sibling::td[6]/input[@type='submit']");
By selFlight = By.xpath("//tbody/child::tr[1]/child::td[1]/input[@type='submit']");
By nav_purchase = By.xpath("@input[id='inputName']");
public BlazeDemo_FlightSelectPage(WebDriver driver){
this.driver1 = driver;
}
// public Actions chooseFlight() {
// // driver.findElement(selFlight).click();
//
// Actions act = new Actions(driver1);
// return act.click(driver1.findElement(selFlight)).clickAndHold().release();
//
// driver.findElement(selFlight).sendKeys(Keys.ENTER);
// driver1.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
// System.out.println("user chose a Flight");
// return act;
// }
public void chooseFlight() {
// driver1.findElement(selFlight).sendKeys(Keys.RETURN);
driver1.findElement(selFlight).click();
// js.executeScript("arguments[0].click();",selFlight);
driver1.manage().timeouts().implicitlyWait(20,TimeUnit.SECONDS);
System.out.println("User Chose a Flight");
}
public void purCnfrLanding(){
driver1.findElement(nav_purchase).isDisplayed();
System.out.println("User lands to Purchase page");
driver1.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
driver1.close();
driver1.quit();
}
}
|
[
"[email protected]"
] | |
6f52e87aedbc3303a74c3bb39734da45c9272a91
|
f60ae20c0e59a2810f0ee1f9cc48314493c484f2
|
/src/com/mymusic/MyMusicActivity.java
|
c08c1e0eb1893b1b36c478657bd97fb1411e9d25
|
[] |
no_license
|
etcpe9/simple-music-player
|
e399c0989b6068af01c3c2ee42b3e47a22b83297
|
731b371c23dcecced6591a3b7b91aea0d97fc4b0
|
refs/heads/master
| 2020-05-20T15:44:42.418101 | 2012-06-24T16:23:03 | 2012-06-24T16:23:03 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,939 |
java
|
package com.mymusic;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import android.app.ListActivity;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import android.media.MediaPlayer;
public class MyMusicActivity extends ListActivity
{
private List<String> files = new ArrayList<String>();
private MediaPlayer mp = new MediaPlayer();
File sdcard = Environment.getExternalStorageDirectory();
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
//setContentView(R.layout.main);
if(!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
Toast.makeText(this, "Oops! SD Card is unmount.", Toast.LENGTH_SHORT).show();
} else {
File allFiles = new File(sdcard, "Music/");
searchingFile(allFiles);
setListAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,files));
}
}
public void searchingFile(File path) {
if(path.isDirectory()){
String[] subNode = path.list();
for(String filename : subNode) {
searchingFile(new File(path, filename));
}
} else {
files.add(path.getAbsoluteFile().toString());
}
}
public void onListItemClick(ListView parent, View v, int position, long id)
{
try {
FileDescriptor fd = null;
String audioPath = files.get(position);
FileInputStream fis = new FileInputStream(audioPath);
fd = fis.getFD();
mp.reset();
mp.setDataSource(fd);
mp.prepare();
mp.start();
Toast.makeText(this, "Now Playing " + files.get(position), Toast.LENGTH_SHORT).show();
} catch (IOException e) {
Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
}
|
[
"[email protected]"
] | |
487f312660a7d15ff0400b78f4032d7f5265fe8a
|
aa960346e5e8c93a1bba31d6981894cac31f37d0
|
/Git.java
|
db43d707834aed9fb6a6a41d9660e5cad8f3422b
|
[] |
no_license
|
Testerpartha/AADevelopment
|
c5d8d6cb3c320e7d80a3761c84b39062951b909e
|
4eba2ac92d07c077a13290fa08996d9a27dab93c
|
refs/heads/master
| 2020-12-06T18:43:58.565873 | 2020-03-05T09:15:59 | 2020-03-05T09:15:59 | 232,528,642 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 292 |
java
|
class Sample
{
public static void main(String args[])
{
System.out.println("welcome to jenkins");
System.out.println(""test");
System.out.println("welcome to git");
System.out.println("welcome to jenkins integration with github");
System.out.println("not committed");
}
}
|
[
"[email protected]"
] | |
5d6f18dd140d94a957af35292c0af99403b7181a
|
3d52be264554bf86304467e75f830c1ef286d22a
|
/app/src/main/java/com/xing/progressandroid/customview/XfermodeBitmapView.java
|
9f4d9b84e804b8c09993dbec3916a65df33adefd
|
[] |
no_license
|
xing16/ProgressAndroid
|
77c7dbff8fe504206528ca612e3e0be99d7659d8
|
e260f0ff75a61da5470bcb1c93a3ce37aa2ca657
|
refs/heads/master
| 2020-04-18T06:13:12.298722 | 2020-02-19T11:29:21 | 2020-02-19T11:29:21 | 167,310,580 | 8 | 3 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,147 |
java
|
package com.xing.progressandroid.customview;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.util.AttributeSet;
import android.view.View;
import com.xing.progressandroid.R;
public class XfermodeBitmapView extends View {
private Paint textPaint;
private Paint paint;
private int mode;
private Bitmap destBitmap;
private Bitmap srcBitmap;
public XfermodeBitmapView(Context context) {
this(context, null);
}
public XfermodeBitmapView(Context context, AttributeSet attrs) {
super(context, attrs);
readAttrs(context, attrs);
init();
}
private void readAttrs(Context context, AttributeSet attrs) {
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.XfermodeView);
mode = typedArray.getInt(R.styleable.XfermodeView_mode, 0);
typedArray.recycle();
}
private void init() {
textPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
textPaint.setColor(Color.BLACK);
textPaint.setTextSize(60);
paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setStyle(Paint.Style.FILL);
destBitmap = BitmapFactory.decodeResource(getContext().getResources(), R.drawable.red);
srcBitmap = BitmapFactory.decodeResource(getContext().getResources(), R.drawable.blue);
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
// 设置背景
canvas.drawColor(Color.DKGRAY);
//将绘制操作保存到新的图层,因为图像合成是很昂贵的操作,将用到硬件加速,这里将图像合成的处理放到离屏缓存中进行
int saveCount = canvas.saveLayer(0, 0, getWidth(), getHeight(), paint, Canvas.ALL_SAVE_FLAG);
// 绘制 dest
canvas.drawBitmap(destBitmap, 0, 0, paint);
// 设置 xfermode
if (mode != 0) {
paint.setXfermode(new PorterDuffXfermode(getMode(mode)));
}
// 绘制 src
canvas.drawBitmap(srcBitmap, 0, 0, paint);
paint.setXfermode(null);
canvas.restoreToCount(saveCount);
canvas.drawText(getMode(mode).toString(), getWidth() - 300, getHeight() / 2f, textPaint);
}
private PorterDuff.Mode getMode(int value) {
PorterDuff.Mode mode = null;
switch (value) {
case 1:
mode = PorterDuff.Mode.CLEAR;
break;
case 2:
mode = PorterDuff.Mode.SRC;
break;
case 3:
mode = PorterDuff.Mode.DST;
break;
case 4:
mode = PorterDuff.Mode.SRC_OVER;
break;
case 5:
mode = PorterDuff.Mode.DST_OVER;
break;
case 6:
mode = PorterDuff.Mode.SRC_IN;
break;
case 7:
mode = PorterDuff.Mode.DST_IN;
break;
case 8:
mode = PorterDuff.Mode.SRC_OUT;
break;
case 9:
mode = PorterDuff.Mode.DST_OUT;
break;
case 10:
mode = PorterDuff.Mode.SRC_ATOP;
break;
case 11:
mode = PorterDuff.Mode.DST_ATOP;
break;
case 12:
mode = PorterDuff.Mode.XOR;
break;
case 13:
mode = PorterDuff.Mode.DARKEN;
break;
case 14:
mode = PorterDuff.Mode.LIGHTEN;
break;
case 15:
mode = PorterDuff.Mode.MULTIPLY;
break;
case 16:
mode = PorterDuff.Mode.SCREEN;
break;
}
return mode;
}
}
|
[
"[email protected]"
] | |
816b96e57e497c0ca5b7916985721ad5a0ef0a4b
|
7b156aa578f1f8a0ff1db08c07cc1f2ac86001c6
|
/VolleyTest/app/src/main/java/com/example/ratanakpek/volleytest/recyclervs/GetDataRecycler.java
|
2187743d4d2f66dd0d3ba873bf0ddf0cae90bdd5
|
[] |
no_license
|
ratanakpek/RetrofitTest
|
3bebc89fb59b7f11d0a885eb2410cd5ff369c06c
|
27357ed440b670d234937540c91265948b0695ba
|
refs/heads/master
| 2020-06-28T19:28:35.854067 | 2016-12-23T13:34:39 | 2016-12-23T13:34:39 | 74,481,228 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,988 |
java
|
package com.example.ratanakpek.volleytest.recyclervs;
import android.app.Activity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Base64;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonArrayRequest;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.StringRequest;
import com.example.ratanakpek.volleytest.API.APIClass;
import com.example.ratanakpek.volleytest.JSONs.GsonObjectRequest;
import com.example.ratanakpek.volleytest.R;
import com.example.ratanakpek.volleytest.message.Message;
import com.example.ratanakpek.volleytest.vol.MySingleTon;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.security.AccessControlContext;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by RatanakPek on 11/20/2016.
*/
public class GetDataRecycler extends Activity {
private ArrayList<Product> productList = new ArrayList<>();
MyRecycler myRecycler;
RecyclerView recyclerView;
RequestQueue requestQueue;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.getdatarecycler);
requestQueue= MySingleTon.getInstance().getRequestQueue();
recyclerView = (RecyclerView) findViewById(R.id.recylcer);
myRecycler = new MyRecycler(productList);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getApplicationContext());
recyclerView.setLayoutManager(layoutManager);
recyclerView.setHasFixedSize(true);
recyclerView.setAdapter(myRecycler);
Toast.makeText(GetDataRecycler.this, "Size : " + productList.toString() + "ddd", Toast.LENGTH_SHORT).show();
Log.d("x", "oncreate");
}
public void onClick(View view){
GsonObjectRequest gson = new GsonObjectRequest(Request.Method.GET, APIClass.url, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Message.msg(GetDataRecycler.this, response.toString());
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Message.msg(GetDataRecycler.this, error.toString());
}
});
requestQueue.add(gson);
}
public void postData(View view) {
GsonObjectRequest gson = new GsonObjectRequest(Request.Method.POST, APIClass.posturl, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Message.msg(GetDataRecycler.this, response.toString());
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Message.msg(GetDataRecycler.this, error.toString());
}
}){
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> jsonBody = new HashMap<String, String>();
jsonBody.put("b_id", "33");
jsonBody.put("description", "myid");
jsonBody.put("end_date", "myid");
jsonBody.put("image", "myid");
jsonBody.put("order_id", "myid");
jsonBody.put("start_date", "myid");
jsonBody.put("title", "myid");
jsonBody.put("url", "myid");
return jsonBody;
}
};
requestQueue.add(gson);
}
public void deleteData(View view) {
// Map<String, String> param = new HashMap<>();
// param.put("id", "2");
final JSONObject obj = new JSONObject();
try {
obj.put("id", "2");
} catch (JSONException e) {
e.printStackTrace();
}
GsonObjectRequest delete = new GsonObjectRequest(Request.Method.DELETE, APIClass.delete+"?id=3", obj, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Message.msg(GetDataRecycler.this, response.toString());
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Message.msg(GetDataRecycler.this, error.toString());
error.printStackTrace();
}
});
//
requestQueue.add(delete);
}
public void delete(){
//Map<String, String> jsonBody = new HashMap<String, String>();
JSONObject jsonBody= new JSONObject();
try {
jsonBody.put("TITLE", "TEst");
jsonBody.put("AUTHOR", 2);
jsonBody.put("CATEGORY_ID", 4);
jsonBody.put("STATUS", "TEst");
jsonBody.put("IMAGE", "TEst");
} catch (JSONException e) {
e.printStackTrace();
}
GsonObjectRequest gson = new GsonObjectRequest(Request.Method.PUT, APIClass.update, jsonBody, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Message.msg(GetDataRecycler.this, response.toString());
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Message.msg(GetDataRecycler.this, error.toString());
}
});
requestQueue.add(gson);
}
public void updateData(View view) {
delete();
}
}
|
[
"[email protected]"
] | |
c719b4cb4f4d0c6f2a9531bf242ddead482a9853
|
a801f487161419cfbd41c59667417715d3ad8366
|
/src/main/java/designPattern/behavior/visitor/doubleDispatch/good/KungFuRole.java
|
f53297c57caceb69327a518c6fc13e4837c3f328
|
[] |
no_license
|
sos303sos/DesignPatten
|
60319f25046cf306984b1d863da62cc2f819b3d0
|
a6c98251cd6887fef9cee904c5db4b79e1925dd8
|
refs/heads/master
| 2020-04-01T06:06:51.510153 | 2018-12-31T07:22:22 | 2018-12-31T07:22:22 | 152,933,712 | 3 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,171 |
java
|
/**
* project: designPatten
* package: designPattern.behavior.visitor.doubleDispatch
* file: KungFuRole.java
* description: TODO
* Senyint
* Copyright 2018 All rights Reserved
*
* author: 95129
* version: V3.0
* date: 2018年11月6日 下午1:55:35
*
* history:
* date author version description
* -----------------------------------------------------------------------------------
* 2018年11月6日 95129 3.0 1.0
* modification
*/
package designPattern.behavior.visitor.doubleDispatch.good;
/**
* class: KungFuRole<BR>
* description: TODO<BR>
* author: 95129<BR>
* date: 2018年11月6日 下午1:55:35<BR>
*
*/
public class KungFuRole implements Role {
/**
*<p>
* description: TODO<BR>
* author: 95129<BR>
* overriding_date: 2018年11月7日 上午11:37:18<BR></p>
* @param actor Role
* @see designPattern.behavior.visitor.doubleDispatch.good.Role#accept(designPattern.behavior.visitor.doubleDispatch.good.AbsActor)
*/
public void accept(AbsActor actor) {
actor.act(this);
}
}
|
[
"[email protected]"
] | |
d4a5761dded23bae9f84986d6c3e4be591b40c5d
|
19dee72bfe60d2cd81b14f5b709f37f9b0e8112e
|
/src/dao/TrabajadorDAO.java
|
9a2b4c071f1b9467abb80bc042f2d8a7faddd13f
|
[] |
no_license
|
AccesoDatos21-22/ejercicios_ficheros_4-brahyan
|
d088766e7a14dbe9114981b89930caf0cdaa6f37
|
17cd9e7caae3d6474faa61dbf7d7dfd0d6f302d7
|
refs/heads/main
| 2023-09-03T03:47:43.823023 | 2021-11-17T09:59:53 | 2021-11-17T09:59:53 | 417,108,351 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 318 |
java
|
package dao;
import modelo.NoExisteTrabajador;
import modelo.Trabajador;
public interface TrabajadorDAO {
public boolean insertar(Trabajador e);
public boolean actualizar(Trabajador e);
public Trabajador leer(int id) throws NoExisteTrabajador;
public boolean borrar(int id) throws NoExisteTrabajador;
}
|
[
"[email protected]"
] | |
e1b2263547186033c88283f3f8ad55a76f89849c
|
8112198af3a7bf28dc5070331f350ee8d1d20154
|
/app/src/main/java/com/example/mystudentapp/base/BaseMeassage.java
|
0c6911bed89000f48b1939b820d85993aa8a63c3
|
[] |
no_license
|
aheng1996/MyStudentApp
|
2f65d65c773b88cfc1cfc23a1ef573c1c7d684d1
|
a2dde9f63f536331ec612f69f36075e3b463e3f8
|
refs/heads/master
| 2021-02-06T11:24:08.351962 | 2020-05-15T13:32:36 | 2020-05-15T13:32:36 | 243,909,840 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 382 |
java
|
package com.example.mystudentapp.base;
import android.provider.CalendarContract;
import com.example.mystudentapp.bean.User;
import java.util.List;
public enum BaseMeassage {
INSTANCE;
/**
* 人员选择
*/
private User user;
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
}
|
[
"[email protected]"
] | |
8ee0bb8c54b58e73c85c8e917f7cc6fc12c179d0
|
3b73bce1abd83e66482f406e65789303efaa0c3a
|
/app/src/main/java/com/example/carj/MainActivity.java
|
1ffa3c0590c63ecb7bd65433b3b56e06b5df282d
|
[] |
no_license
|
Gekosan2019/CarJ
|
0910513d4d20ceb90ce19c6716e8f8742de98440
|
54fad8e18c7aef750b840ac78c871a18a6ea9de2
|
refs/heads/master
| 2023-01-27T13:15:50.376874 | 2020-12-13T21:10:46 | 2020-12-13T21:10:46 | 321,160,744 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 329 |
java
|
package com.example.carj;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
|
[
"[email protected]"
] | |
b13f38f1f7af08c8d904b6d21f55b808a76ac4d6
|
39a073ee24247e83926dfadf83d701b5b7052fe4
|
/leyou-item/leyou-item-interface/src/main/java/com/leyou/item/pojo/Category.java
|
22e34723dfc20010397a45a163180439677eddc2
|
[] |
no_license
|
BangRicky/leyou
|
0bb20a4bad80eeec40b38062c1e2c1a7e0bdb159
|
9f8a9578fe0a5231aa0d785654da05cfe3b08fa6
|
refs/heads/master
| 2022-07-07T14:31:51.397586 | 2020-10-26T01:20:25 | 2020-10-26T01:20:25 | 198,541,068 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,135 |
java
|
package com.leyou.item.pojo;
import javax.persistence.*;
/**
* @author: jinbang
* @create: 2019/8/9 10:27
*/
@Entity
@Table(name="tb_category")
public class Category {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Long id;
private String name;
private Long parentId;
private Boolean isParent; // 注意isParent生成的getter和setter方法需要手动加上Is
private Integer sort;
// getter和setter略
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public Boolean getISParent() {
return isParent;
}
public void setIsParent(Boolean parent) {
isParent = parent;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
}
|
[
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.