blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
3dda64364ccffd997c89f7f5142692e6cf70c3f4
e5d1455f07662f3eacc6755566e291f5c1b13fb9
/src/main/java/com/qa/spring/controller/PersonController.java
9e2251c09bcfc9d567d971a6b33cca1d93ba3b34
[]
no_license
rhysevans371a/QA-Spring
af58eaaaabff5dcee52cc00f2094f20810a74068
c1a8c4e83e2dd5598cb28d5e9c112d5b4915abf4
refs/heads/main
2023-08-31T00:19:19.926993
2021-09-29T12:09:56
2021-09-29T12:09:56
411,658,415
0
0
null
null
null
null
UTF-8
Java
false
false
1,662
java
package com.qa.spring.controller; import java.util.ArrayList; import java.util.List; import javax.websocket.server.PathParam; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.qa.spring.domain.Person; import com.qa.spring.services.PersonService; @RequestMapping @RestController public class PersonController { private PersonService service; public PersonController(PersonService service) { super(); this.service = service; } //private List<Person> people = new ArrayList<>(); @PostMapping("/create") public Person addPerson(@RequestBody Person person) { return this.service.addPerson(person); } @GetMapping("/getAll") public List<Person> getAllPeople(@RequestBody Person person) { return this.service.getAllPeople(); } @PutMapping("/update") public Person updatePerson(@PathParam("id") Long id, @RequestBody Person person) { return this.service.updatePerson(id, person); } @DeleteMapping("/delete/{id}") public boolean removePerson(@PathVariable Long id) { return this.service.removePerson(id); } }
[ "rhys.evans371a@gmail.com" ]
rhys.evans371a@gmail.com
ed4742d043798e6d62bdfb81b9d18c368dd9bc24
7f1eb8a6d2f25960666b22687a17402a36cac617
/src/main/java/elucent/roots/component/components/ComponentPinkTulip.java
1bba60d5a8d6f757d1e2aee8f5bb21b77c095415
[ "MIT" ]
permissive
yrsegal/Roots
4078b10c71b2225802fd42c598abff5d7b11e008
543cc823a9a34804037e8988ac5596c4d39d578d
refs/heads/master
2020-05-30T13:56:36.613411
2016-08-03T05:19:14
2016-08-03T05:19:14
64,609,803
0
0
null
2016-07-31T18:51:28
2016-07-31T18:51:27
null
UTF-8
Java
false
false
1,451
java
package elucent.roots.component.components; import java.util.ArrayList; import java.util.UUID; import elucent.roots.component.ComponentBase; import elucent.roots.component.EnumCastType; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.monster.EntitySpider; import net.minecraft.init.Blocks; import net.minecraft.util.DamageSource; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.world.World; public class ComponentPinkTulip extends ComponentBase { public ComponentPinkTulip(){ super("pinktulip", "Vampiric Burst", Blocks.RED_FLOWER,7,10); } @Override public void doEffect(World world, Entity caster, EnumCastType type, double x, double y, double z, double potency, double duration, double size){ if (type == EnumCastType.SPELL){ ArrayList<EntityLivingBase> targets = (ArrayList<EntityLivingBase>) world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(x-size,y-size,z-size,x+size,y+size,z+size)); for (int i = 0; i < targets.size(); i ++){ if (targets.get(i).getUniqueID() != caster.getUniqueID()){ targets.get(i).attackEntityFrom(DamageSource.wither, (int)(3+2*potency)); ((EntityLivingBase)caster).heal(targets.size()*(float)(2.0+1.0*potency)); targets.get(i).setLastAttacker(caster); targets.get(i).setRevengeTarget((EntityLivingBase)caster); } } } } }
[ "elucentgames@gmail.com" ]
elucentgames@gmail.com
d1c0fed99f622a5849e4424cc89aefbdcfcd3951
9d85beb4762872b5fd6410a9fdcff9c7e395f7b5
/mfconsole/src/main/java/cn/v/entity/ServiceInfo.java
d71eccd4772b8036005ea5d2375f2a63ee599129
[]
no_license
VLoye/my-platform
35d179698482ee74a3b1f867f84bb97b45e001ae
3f854315cc6649e68fd7305d1130a50c0df9199c
refs/heads/master
2020-04-13T17:47:59.090337
2019-04-05T08:23:03
2019-04-05T08:23:03
163,356,496
0
1
null
null
null
null
UTF-8
Java
false
false
334
java
package cn.v.entity;/** * Created by VLoye on 2019/3/16. */ import lombok.Data; import java.util.Arrays; /** * @author V * @Classname ServiceInfo * @Description **/ @Data public class ServiceInfo { private String name; private String decription; private Class<?> returnType; private Class<?>[] paramsType; }
[ "guoxiaofeng@agree.com.cn" ]
guoxiaofeng@agree.com.cn
39474807a434339ab3d5f8575250e993d63b4fa0
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/apereo--cas/6b121ab0b1c150db9781eca3c8b2c654c803e55f/before/DefaultAttributeReleasePolicyMapper.java
a9211f9830460ba0529fc69eb49d3543dfab7b58
[]
no_license
fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211003
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
UTF-8
Java
false
false
10,739
java
package org.jasig.cas.mgmt.services.web.factory; import org.apache.commons.lang3.StringUtils; import org.jasig.cas.authentication.principal.PrincipalAttributesRepository; import org.jasig.cas.services.AbstractRegisteredServiceAttributeReleasePolicy; import org.jasig.cas.services.RegisteredServiceAttributeFilter; import org.jasig.cas.services.RegisteredServiceAttributeReleasePolicy; import org.jasig.cas.services.ReturnAllAttributeReleasePolicy; import org.jasig.cas.services.ReturnAllowedAttributeReleasePolicy; import org.jasig.cas.services.ReturnMappedAttributeReleasePolicy; import org.jasig.cas.mgmt.services.web.beans.AbstractRegisteredServiceAttributeReleasePolicyStrategyBean; import org.jasig.cas.mgmt.services.web.beans.RegisteredServiceAttributeReleasePolicyEditBean; import org.jasig.cas.mgmt.services.web.beans.RegisteredServiceAttributeReleasePolicyStrategyEditBean; import org.jasig.cas.mgmt.services.web.beans.RegisteredServiceAttributeReleasePolicyStrategyViewBean; import org.jasig.cas.mgmt.services.web.beans.RegisteredServiceAttributeReleasePolicyViewBean; import org.jasig.cas.mgmt.services.web.beans.RegisteredServiceEditBean.ServiceData; import org.jasig.cas.mgmt.services.web.beans.RegisteredServiceViewBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; import java.util.List; import java.util.Map; /** * Default mapper for converting {@link RegisteredServiceAttributeReleasePolicy} to/from {@link ServiceData}. * * @author Daniel Frett * @since 4.2 */ @RefreshScope @Component(DefaultAttributeReleasePolicyMapper.BEAN_NAME) public class DefaultAttributeReleasePolicyMapper implements AttributeReleasePolicyMapper { /** * Name of this bean within the Spring context. */ public static final String BEAN_NAME = "defaultAttributeReleasePolicyMapper"; @Autowired(required = false) private ApplicationContext applicationContext; @Autowired(required = false) @Qualifier("attributeFilterMapper") private AttributeFilterMapper attributeFilterMapper; @Autowired(required = false) @Qualifier("principalAttributesRepositoryMapper") private PrincipalAttributesRepositoryMapper principalAttributesRepositoryMapper; public void setApplicationContext(final ApplicationContext applicationContext) { this.applicationContext = applicationContext; } public void setAttributeFilterMapper(final AttributeFilterMapper attributeFilterMapper) { this.attributeFilterMapper = attributeFilterMapper; } public void setPrincipalAttributesRepositoryMapper( final PrincipalAttributesRepositoryMapper principalAttributesRepositoryMapper) { this.principalAttributesRepositoryMapper = principalAttributesRepositoryMapper; } /** * Initializes some default mappers after any custom mappers have been wired. */ @PostConstruct public void initializeDefaults() { // use default mappers from spring context if (this.applicationContext != null) { if (this.attributeFilterMapper == null) { this.attributeFilterMapper = this.applicationContext.getBean( DefaultAttributeFilterMapper.BEAN_NAME, AttributeFilterMapper.class); } if (this.principalAttributesRepositoryMapper == null) { this.principalAttributesRepositoryMapper = this.applicationContext.getBean( DefaultPrincipalAttributesRepositoryMapper.BEAN_NAME, PrincipalAttributesRepositoryMapper.class); } } // initialize default mappers if any are still missing if (this.attributeFilterMapper == null) { this.attributeFilterMapper = new DefaultAttributeFilterMapper(); } if (this.principalAttributesRepositoryMapper == null) { this.principalAttributesRepositoryMapper = new DefaultPrincipalAttributesRepositoryMapper(); } } @Override public void mapAttributeReleasePolicy(final RegisteredServiceAttributeReleasePolicy policy, final ServiceData bean) { if (policy instanceof AbstractRegisteredServiceAttributeReleasePolicy) { final AbstractRegisteredServiceAttributeReleasePolicy attrPolicy = (AbstractRegisteredServiceAttributeReleasePolicy) policy; final RegisteredServiceAttributeReleasePolicyEditBean attrPolicyBean = bean.getAttrRelease(); attrPolicyBean.setReleasePassword(attrPolicy.isAuthorizedToReleaseCredentialPassword()); attrPolicyBean.setReleaseTicket(attrPolicy.isAuthorizedToReleaseProxyGrantingTicket()); this.attributeFilterMapper.mapAttributeFilter(attrPolicy.getAttributeFilter(), bean); this.principalAttributesRepositoryMapper.mapPrincipalRepository(attrPolicy.getPrincipalAttributesRepository(), bean); final RegisteredServiceAttributeReleasePolicyStrategyEditBean sBean = attrPolicyBean.getAttrPolicy(); if (attrPolicy instanceof ReturnAllAttributeReleasePolicy) { sBean.setType(AbstractRegisteredServiceAttributeReleasePolicyStrategyBean.Types.ALL.toString()); } else if (attrPolicy instanceof ReturnAllowedAttributeReleasePolicy) { final ReturnAllowedAttributeReleasePolicy attrPolicyAllowed = (ReturnAllowedAttributeReleasePolicy) attrPolicy; sBean.setType(AbstractRegisteredServiceAttributeReleasePolicyStrategyBean.Types.ALLOWED.toString()); sBean.setAttributes(attrPolicyAllowed.getAllowedAttributes()); } else if (attrPolicy instanceof ReturnMappedAttributeReleasePolicy) { final ReturnMappedAttributeReleasePolicy attrPolicyAllowed = (ReturnMappedAttributeReleasePolicy) attrPolicy; sBean.setType(AbstractRegisteredServiceAttributeReleasePolicyStrategyBean.Types.MAPPED.toString()); sBean.setAttributes(attrPolicyAllowed.getAllowedAttributes()); } } } @Override public void mapAttributeReleasePolicy(final RegisteredServiceAttributeReleasePolicy policy, final RegisteredServiceViewBean bean) { if (policy instanceof AbstractRegisteredServiceAttributeReleasePolicy) { final AbstractRegisteredServiceAttributeReleasePolicy attrPolicy = (AbstractRegisteredServiceAttributeReleasePolicy) policy; final RegisteredServiceAttributeReleasePolicyViewBean attrPolicyBean = bean.getAttrRelease(); attrPolicyBean.setReleasePassword(attrPolicy.isAuthorizedToReleaseCredentialPassword()); attrPolicyBean.setReleaseTicket(attrPolicy.isAuthorizedToReleaseProxyGrantingTicket()); if (attrPolicy instanceof ReturnAllAttributeReleasePolicy) { attrPolicyBean.setAttrPolicy(RegisteredServiceAttributeReleasePolicyStrategyViewBean.Types.ALL .toString()); } else if (attrPolicy instanceof ReturnAllowedAttributeReleasePolicy) { final ReturnAllowedAttributeReleasePolicy attrPolicyAllowed = (ReturnAllowedAttributeReleasePolicy) attrPolicy; if (attrPolicyAllowed.getAllowedAttributes().isEmpty()) { attrPolicyBean.setAttrPolicy(RegisteredServiceAttributeReleasePolicyStrategyViewBean.Types.NONE .toString()); } else { attrPolicyBean.setAttrPolicy(RegisteredServiceAttributeReleasePolicyStrategyViewBean.Types .ALLOWED.toString()); } } else if (attrPolicy instanceof ReturnMappedAttributeReleasePolicy) { final ReturnMappedAttributeReleasePolicy attrPolicyAllowed = (ReturnMappedAttributeReleasePolicy) attrPolicy; if (attrPolicyAllowed.getAllowedAttributes().isEmpty()) { attrPolicyBean.setAttrPolicy(RegisteredServiceAttributeReleasePolicyStrategyViewBean.Types.NONE .toString()); } else { attrPolicyBean.setAttrPolicy(RegisteredServiceAttributeReleasePolicyStrategyViewBean.Types.MAPPED .toString()); } } } } @Override public RegisteredServiceAttributeReleasePolicy toAttributeReleasePolicy(final ServiceData data) { final RegisteredServiceAttributeReleasePolicyEditBean attrRelease = data.getAttrRelease(); final RegisteredServiceAttributeReleasePolicyStrategyEditBean policyBean = attrRelease.getAttrPolicy(); final String policyType = policyBean.getType(); final AbstractRegisteredServiceAttributeReleasePolicy policy; if (StringUtils.equalsIgnoreCase(policyType, AbstractRegisteredServiceAttributeReleasePolicyStrategyBean .Types.ALL.toString())) { policy = new ReturnAllAttributeReleasePolicy(); } else if (StringUtils.equalsIgnoreCase(policyType, AbstractRegisteredServiceAttributeReleasePolicyStrategyBean.Types.ALLOWED.toString())) { policy = new ReturnAllowedAttributeReleasePolicy((List) policyBean.getAttributes()); } else if (StringUtils.equalsIgnoreCase(policyType, AbstractRegisteredServiceAttributeReleasePolicyStrategyBean.Types.MAPPED.toString())) { policy = new ReturnMappedAttributeReleasePolicy((Map) policyBean.getAttributes()); } else { policy = new ReturnAllowedAttributeReleasePolicy(); } policy.setAuthorizedToReleaseCredentialPassword(attrRelease.isReleasePassword()); policy.setAuthorizedToReleaseProxyGrantingTicket(attrRelease.isReleaseTicket()); final RegisteredServiceAttributeFilter filter = this.attributeFilterMapper.toAttributeFilter(data); if (filter != null) { policy.setAttributeFilter(filter); } final PrincipalAttributesRepository principalRepository = this.principalAttributesRepositoryMapper .toPrincipalRepository(data); if (principalRepository != null) { policy.setPrincipalAttributesRepository(principalRepository); } return policy; } }
[ "fraczwojciech@gmail.com" ]
fraczwojciech@gmail.com
1ce39714e1c72c2ce430234876105f71f1563957
05351a3e38a8f881dac8681672344cccfc8b9981
/test-git/online/gido-ui/src/main/java/gnf/gido/gido/presentation/presenter/ParametrosPresenter.java
9bdf39427498cdb9ce775391b80e1d697a30f870
[]
no_license
jcsipan/GIDO
0f2ae6038cfa90111bfd1ba57f61f48e562885cd
cca8749296ee60fdd7bebd259040784f52d3e22d
refs/heads/master
2021-01-20T09:03:24.050909
2015-08-27T04:49:37
2015-08-27T05:02:11
41,462,772
0
0
null
null
null
null
UTF-8
Java
false
false
7,507
java
package gnf.gido.gido.presentation.presenter; import java.io.Serializable; import gnf.ada.core.persistence.dao.beans.AdaSearchDto; import gnf.ada.core.persistence.dao.conditions.AdaConditionLikeFilter; import gnf.ada.core.persistence.dao.fetchgroup.AdaFetchElement; import gnf.ada.core.persistence.dao.projections.AdaSelectedField; import gnf.ada.vaadin.workbench.application.control.AdaListener; import gnf.ada.vaadin.workbench.application.event.type.AdaActionEvent; import gnf.ada.vaadin.workbench.presentation.crud.impl.AdaCrudPresenterImpl; import gnf.ada.vaadin.workbench.presentation.ui.component.AdaTable; import gnf.ada.vaadin.workbench.presentation.ui.component.viewcomponent.AdaFormViewComponent.FormState; import gnf.ada.vaadin.workbench.presentation.ui.container.view.popup.AdaPopup; import gnf.ada.vaadin.workbench.presentation.ui.container.view.popup.AdaSelectionPopupHandler; import gnf.ada.vaadin.workbench.util.AdaNavigation; import gnf.ada.vaadin.workbench.util.AdaNotification; import gnf.gido.administracion.entities.Parametro; import gnf.gido.administracion.entities.ParametroDetalle; import gnf.gido.gido.application.dto.ParametrosSearchDto; import gnf.gido.gido.presentation.event.ParametroDetalleEvent; import gnf.gido.gido.presentation.event.ParametroDetalleSearchPopupEvent; import gnf.gido.gido.presentation.event.ParametrosViewDetalleButtonsEvent; import gnf.gido.gido.presentation.view.ParametroDetalleView; import gnf.gido.gido.presentation.view.ParametrosView; import gnf.gido.gido.presentation.view.impl.ParametroDetalleViewImpl; import gnf.gido.gido.presentation.view.impl.ParametrosViewImpl; import org.apache.commons.lang.StringUtils; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; @Component @Scope("prototype") public class ParametrosPresenter extends AdaCrudPresenterImpl<Parametro, ParametrosView>{ private AdaPopup detailsPopupWindow; @Override protected AdaSearchDto buildSearchDto() { ParametrosView view = getView(); // Retrieve values from search dto ParametrosSearchDto searchDto = (ParametrosSearchDto) view.getSearchDto(); String descripcion = searchDto.getDescripcion(); String nombre = searchDto.getNombre(); AdaSearchDto adaSearchDto = new AdaSearchDto(); /*if (StringUtils.isNotBlank(descripcion)) { adaSearchDto.addConditionFilter(new AdaConditionEqualsFilter(AdaFetchElement.ROOT_CLASS_ID, descripcion)); }*/ if (StringUtils.isNotBlank(nombre)) { adaSearchDto.addConditionFilter(new AdaConditionLikeFilter(new AdaFetchElement("nombre"), nombre)); } if (StringUtils.isNotBlank(descripcion)) { adaSearchDto.addConditionFilter(new AdaConditionLikeFilter(new AdaFetchElement("descripcion"), descripcion)); } // Ask for parameter details too adaSearchDto.addSelectedField(new AdaSelectedField("detalles")); return adaSearchDto; } //Indicamos el tipo de evento @AdaListener(hint = ParametroDetalleEvent.GOTO_PARAM_DETALLES) public void gotoBoks(AdaActionEvent event) { if(getView().getBean() != null) { //Si se ha seleccionado un elemento cargamos la vista. //Comentamos esta línea porqué aun no tenemos creada la vista a la que queremos ir cuando pulsemos el botón books. AdaNavigation.openView(ParametroDetalleViewImpl.VIEW_ID, true, getView().getBean()); } else { //Si no se ha seleccionado ninguna entidad, mostramos un warning. AdaNotification.showWarning("seleccionar.elemento", "seleccionar.elemento.description", true); } } /** * configures parameter detail button state */ @Override protected void enableUpdateState() { super.enableUpdateState(); getView().getTableDetailsActionBar().setFormState(FormState.EDIT); } /** * configures parameter detail button state */ @Override protected void enableSearchState() { super.enableSearchState(); getView().getTableDetailsActionBar().setFormState(FormState.READ); } /** * * Process the parameter detail button click to remove a detail * * @param event */ /*@AdaListener(hint = ParametrosViewDetalleButtonsEvent.REMOVE_DETAIL) public void onAuthorsRemoveButtonClicked(ParametrosViewDetalleButtonsEvent event) { ParametrosView view = getView(); if (FormState.EDIT.equals(view.getDetailContent().getFormState())) { AdaTable tablaDetalles = view.getTablaDetalles(); ParametroDetalle detalle = (ParametroDetalle) tablaDetalles.getValue(); if (detalle != null) { Parametro parametro = view.getBean(); parametro.getDetalles().remove(detalle); view.refreshTable(parametro); } } }*/ /** * * Process the authors button click to show the popup * * @param event */ /*@AdaListener(hint = ParametrosViewDetalleButtonsEvent.ADD_DETAIL) public void onAuthorsButtonClicked(ParametrosViewDetalleButtonsEvent event) { ParametrosView view = getView(); if (FormState.EDIT.equals(view.getDetailContent().getFormState())) { Parametro bean = view.getBean(); detailsPopupWindow = AdaNavigation.openViewAsSelectionPopup(ParametroDetalleViewImpl.VIEW_ID, ParametroDetalleViewImpl.VIEW_ID + ".popup", bean, new ParametroDetallePopupPresenter()); AdaNavigation.openView(ParametroDetalleViewImpl.VIEW_ID, true, getView().getBean()); } }*/ /** * * Inner class to handle popup events It is mandatory to define it in a new class (inner or not) * to avoid merging events from the view that opens the popup and the popup itself * */ public class ParametroDetallePopupPresenter implements AdaSelectionPopupHandler { private Parametro parametro = null;// //en esta variable se indica si se crea un nuevo registro o se edita private String operacion = null; @Override @AdaListener(hint = AdaActionEvent.SELECT_POPUP_ITEM) public void selectPopup(AdaActionEvent event) { addDetailToList((ParametroDetalle) event.getData()); } @Override @AdaListener(hint = AdaActionEvent.DOUBLE_CLICK_ITEM) public void doubleClickItem(AdaActionEvent event) { addDetailToList((ParametroDetalle) event.getData()); } @Override @AdaListener(hint = AdaActionEvent.CANCEL_POPUP) public void cancelPopup(AdaActionEvent event) { ParametrosPresenter.this.detailsPopupWindow.close(); } private void addDetailToList(ParametroDetalle detalle) { if (detalle != null) { Parametro parametro = getView().getBean(); parametro.getDetalles().add(detalle); getView().refreshTable(parametro); } ParametrosPresenter.this.detailsPopupWindow.close(); } @Override public void initPopupView(Object data, AdaPopup window) { ParametroDetalleView parametroDetalleView = (ParametroDetalleView) window.getView(); //authorsView.getDetailContent().setVisible(false); parametroDetalleView.getSearchContent().setVisible(false); //parametroDetalleView.getGridContent().setVisible(false); parametroDetalleView.getDetailContent().setFormState(FormState.EDIT); //parametroDetalleView.getDetailContent().get Parametro parametro = (Parametro) data; parametroDetalleView.dispatchEvent(ParametroDetalleSearchPopupEvent.createCustomParamDetalleSearch(parametro)); } } }
[ "jcsipan@JCSIPAN02W7.indra.es" ]
jcsipan@JCSIPAN02W7.indra.es
94a9152ed8cee0cb25209712b58e5fbe40c4d44d
bed2d0e8a8fd356ab0450b060931cb9d2937e8a3
/src/main/java/King.java
4f40ddd2c89f2d6a8109de8f1e9f37c83a0adf6d
[]
no_license
mionsek/ChessGame
f3009c3f48c17bde3973cb6bdec3b8981c2d1cad
b5ca0b34a2590bfbc18fb065f5dd11c327b86361
refs/heads/master
2020-04-03T20:35:56.695506
2018-11-11T11:13:30
2018-11-11T11:13:30
155,550,668
0
0
null
null
null
null
UTF-8
Java
false
false
735
java
import javax.swing.*; import java.awt.*; import static java.lang.Math.abs; public class King extends Figure { private Image image; King(String color) { super(color); this.loadImage(); } public void drawFigure() { } public boolean checkIfCanMove() { int deltaX = abs(getX() - getPreviousX()); int deltaY = abs(getY() - getPreviousY()); return (deltaX == 1 && deltaY == 0) || (deltaX == 0 && deltaY == 1) || deltaX == 1 && deltaY == 1; } void loadImage() { ImageIcon ii = new ImageIcon(this.getClass().getResource("/" + getColor() + "/king.png")); image = ii.getImage(); } public Image getImage(){ return this.image; } }
[ "mionskowski.dawid@gmail.com" ]
mionskowski.dawid@gmail.com
41e977705a377d5873ebd95e5842c7eb2b5bf8bb
dc46f1a436de988c173a285a72b3044768e6ae87
/app/src/main/java/it/concorso/sanstino/stradesicure/widget/quiz/TextInputQuizView.java
ad1debff3060023ffc464b49464e2025fa9946b3
[]
no_license
jkomyno/strade-sicure
aed98a112b6196588f571e64ff560d1dbe5c698e
d4e3f74daf5511f514d9eb972c6f04fdd824e338
refs/heads/master
2020-04-06T06:59:53.449487
2016-09-11T20:59:39
2016-09-11T20:59:39
60,736,731
0
1
null
null
null
null
UTF-8
Java
false
false
2,472
java
package it.concorso.sanstino.stradesicure.widget.quiz; import android.content.Context; import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; import android.view.KeyEvent; import android.view.View; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import android.widget.TextView; import com.concorso.android.stradesicure.R; import it.concorso.sanstino.stradesicure.model.Category; import it.concorso.sanstino.stradesicure.model.quiz.Quiz; public abstract class TextInputQuizView<Q extends Quiz> extends AbsQuizView<Q> implements TextWatcher, TextView.OnEditorActionListener { public TextInputQuizView(Context context, Category category, Q quiz) { super(context, category, quiz); } protected final EditText createEditText() { EditText editText = (EditText) getLayoutInflater().inflate( R.layout.quiz_edit_text, this, false); editText.addTextChangedListener(this); editText.setOnEditorActionListener(this); return editText; } @Override protected void submitAnswer() { hideKeyboard(this); super.submitAnswer(); } /** * Convenience method to hide the keyboard. * * @param view A view in the hierarchy. */ protected void hideKeyboard(View view) { InputMethodManager inputMethodManager = getInputMethodManager(); inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0); } private InputMethodManager getInputMethodManager() { return (InputMethodManager) getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); } @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (TextUtils.isEmpty(v.getText())) { return false; } allowAnswer(); if (actionId == EditorInfo.IME_ACTION_DONE) { submitAnswer(); hideKeyboard(v); return true; } return false; } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { /* no-op */ } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { /* no-op */ } @Override public void afterTextChanged(Editable s) { allowAnswer(!TextUtils.isEmpty(s)); } }
[ "skiabo97@gmail.com" ]
skiabo97@gmail.com
49c7d6251f6d9daac0a1d763d94f426172ec82ca
26ea34b8dbde091e9c2e3e75909fa00181650e47
/src/net/wicp/yunjigroup/oa/models/NoticeSimple.java
3726db292dce6fe36d1aab3af47f31d5ffa218ee
[]
no_license
Comori/COA
d876d4959bc92976e07c02f8714a550fd1d7bf2f
3171e5bea9a50e56b057c5daa6a8883c046a85c9
refs/heads/master
2021-01-13T01:23:40.960263
2014-11-17T09:27:28
2014-11-17T09:27:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,074
java
package net.wicp.yunjigroup.oa.models; import org.json.JSONObject; public class NoticeSimple extends BaseData{ private static final long serialVersionUID = 1647783L; public static final String KEY_CARD = "card"; public static final String KEY_ID = "id"; public static final String KEY_TITLE = "title"; public static final String KEY_SEND_TIME = "sendtime"; public static final String KEY_DEPARTMENT = "department"; protected String card = null; protected String id = null; protected String title = null; protected String sendTime = null; protected String department = null; public NoticeSimple() { super(); } public NoticeSimple(String card, String id, String title, String sendTime, String department) { super(); this.card = card; this.id = id; this.title = title; this.sendTime = sendTime; this.department = department; } public String getCard() { return card; } public void setCard(String card) { this.card = card; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getSendTime() { return sendTime; } public void setSendTime(String sendTime) { this.sendTime = sendTime; } public String getDepartment() { return department; } public void setDepartment(String department) { this.department = department; } @Override public String toString() { return "NoticeSimple [card=" + card + ", id=" + id + ", title=" + title + ", sendTime=" + sendTime + ", department=" + department + "]"; } public static NoticeSimple fromJson(JSONObject jsonObject){ if(jsonObject == null) return null; NoticeSimple simple = new NoticeSimple(); simple.setCard(jsonObject.optString(KEY_CARD)); simple.setDepartment(jsonObject.optString(KEY_DEPARTMENT)); simple.setId(jsonObject.optString(KEY_ID)); simple.setSendTime(jsonObject.optString(KEY_SEND_TIME)); simple.setTitle(jsonObject.optString(KEY_TITLE)); return simple; } }
[ "chenqiang5@staff.sina.com.cn" ]
chenqiang5@staff.sina.com.cn
24ebe8cee428dd4d51d4c8ce81c4ffd11c236c23
8b1cc7d27bde2f8605be303a81edabb1fa00fe99
/org.rifidi.edge.ale.server/src/org/rifidi/edge/server/epcglobal/ale/EventCycle.java
a988dadea52e939a9180bef98857a35908aaf35b
[]
no_license
TranscendsLLC/rifidi
7a2e53678af63fc22308584d29abfebfc553940c
cd61dcb6dcfeee994a16f3a6bc920cc6557af132
refs/heads/master
2022-08-29T05:26:07.934490
2021-10-14T02:10:22
2021-10-14T02:10:22
62,980,168
11
8
null
2022-01-20T15:17:49
2016-07-10T03:39:53
Java
UTF-8
Java
false
false
34,862
java
/** * */ package org.rifidi.edge.server.epcglobal.ale; import java.util.List; import java.util.Map; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Dictionary; import java.util.GregorianCalendar; import java.util.HashMap; import java.util.HashSet; import java.util.Hashtable; import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.Random; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.TimeUnit; import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.DatatypeFactory; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; import org.apache.log4j.Logger; import org.eclipse.paho.client.mqttv3.MqttClient; import org.rifidi.edge.epcglobal.ale.ECReport; import org.rifidi.edge.epcglobal.ale.ECReportGroup; import org.rifidi.edge.epcglobal.ale.ECReportSpec; import org.rifidi.edge.epcglobal.ale.ECReports; import org.rifidi.edge.epcglobal.ale.ECReports.Reports; import org.rifidi.edge.epcglobal.ale.ECSpec; import org.rifidi.edge.epcglobal.ale.ECSpecValidationException; import org.rifidi.edge.epcglobal.ale.ECSpecValidationExceptionResponse; import org.rifidi.edge.epcglobal.ale.ECTime; import org.rifidi.edge.epcglobal.ale.ImplementationExceptionResponse; import org.rifidi.edge.epcglobal.ale.NoSuchNameExceptionResponse; import org.rifidi.edge.epcglobal.alelr.AddReaders; import org.rifidi.edge.epcglobal.alelr.ImplementationException; import org.rifidi.edge.notification.TagReadEvent; import org.rifidi.edge.server.ale.infrastructure.Notifier; import org.rifidi.edge.server.epcglobal.alelr.Reader; import org.rifidi.edge.server.epcglobal.alelr.services.EventCycleService; import org.rifidi.edge.server.epcglobal.alelr.services.ReaderService; import org.rifidi.edge.utils.DeserializerUtil; import org.rifidi.edge.utils.ECReportsHelper; import org.rifidi.edge.utils.ECTerminationCondition; import org.rifidi.edge.utils.ECTimeUnit; import org.rifidi.edge.utils.FileUtils; import org.rifidi.edge.utils.PersistenceConfig; import org.rifidi.edge.utils.RifidiHelper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.github.oxo42.stateless4j.StateMachineConfig; import com.rits.cloning.Cloner; import rx.Observable; import rx.Observer; import rx.Subscription; import rx.functions.Action1; import rx.internal.util.SubscriptionList; /** * default implementation of the event cycle. * * @author regli * @author swieland * @author benoit.plomion@orange.com * @author nkef@ait.edu.gr */ public final class EventCycle extends Observable<ECReport> implements Cycle, Runnable { private static rx.Observable.OnSubscribe<ECReport> f; // Injection by constructor private final ReaderService readerService; private final ECReportsHelper reportsHelper; private final RifidiHelper rifidiHelper; private final PersistenceConfig config; private final FileUtils fileUtils; private final EventCycleService eventCycleService; // private ConcurrentMap<String, Pair<Subscription, Notifier>> notifiers = new ConcurrentHashMap<String, Pair<Subscription, Notifier>>(); private List<Observer<ECReports>> observers = new ArrayList<Observer<ECReports>>(); private ConcurrentMap<String, Report> reports = new ConcurrentHashMap<String, Report>(); private SubscriptionList disposables = new SubscriptionList(); private ECReports ecReports; /** logger. */ private static final Logger LOG = Logger.getLogger(EventCycle.class); /** random numbers generator. */ private static final Random rand = new Random(System.currentTimeMillis()); /** ale id. */ private static final String ALEID = "RIFIDI-ALE" + rand.nextInt(); /** number of this event cycle. */ private static int number = 0; /** name of this event cycle. */ private final String name; /** report generator which contains this event cycle. */ // private final ReportsGenerator generator; /** thread. */ // private final Thread thread; private final Thread thread; /** event cycle specification for this event cycle. */ private final ECSpec spec; /** set of logical readers which deliver tags for this event cycle. */ private final ConcurrentMap<String, Pair<Subscription, Reader>> logicalReaders = new ConcurrentHashMap<String, Pair<Subscription, Reader>>(); /** set of reports for this event cycle. */ // private final Set<Report> reports = new HashSet<Report>(); /** a hash map with all the reports generated in the last round. */ private final ConcurrentMap<String, ECReport> lastReports = new ConcurrentHashMap<String, ECReport>(); /** contains all the ec report specs hashed by their report name. */ private final ConcurrentMap<String, ECReportSpec> reportSpecByName = new ConcurrentHashMap<String, ECReportSpec>(); /** set of tags for this event cycle. */ private Set<Tag> tags = Collections.synchronizedSet(new HashSet<Tag>()); /** this set stores the tags from the previous EventCycle run. */ private Set<Tag> lastEventCycleTags = null; /** * this set stores the tags between two event cycle in the case of * rejectTagsBetweenCycle is false */ private Set<Tag> betweenEventsCycleTags = Collections.synchronizedSet(new HashSet<Tag>()); /** * flags to know if the event cycle haven t to reject tags in the case than * duration and repeatPeriod is same */ private boolean rejectTagsBetweenCycle = true; /** indicates if this event cycle is terminated or not . */ private boolean isTerminated = false; /** * lock for thread synchronization between reports generator and this. * swieland 2012-09-29: do not use primitive type as int or Integer as * autoboxing can result in new thread object for the lock -> * non-threadsafe... */ private final EventCycleLock lock = new EventCycleLock(); /** flag whether the event cycle has passed through or not. */ private boolean roundOver = false; /** the duration of collecting tags for this event cycle in milliseconds. */ private long durationValue; /** the total time this event cycle runs in milliseconds. */ private long totalTime; /** the termination condition of this event cycle. */ private String terminationCondition = null; /** flags the eventCycle whether it shall run several times or not. */ private boolean running = false; /** flags whether the EventCycle is currently not accepting tags. */ private boolean acceptTags = false; /** tells how many times this EventCycle has been scheduled. */ private int rounds = 0; /** ec report for the poller */ private ECReports pollReport = null; /** indicates if somebody is polling this input generator at the moment. */ private boolean polling = false; private State state; // TODO: check if we can use this instead of the dummy class. private final class EventCycleLock { } /** * Constructor sets parameter and starts thread. * * @param generator * to which this event cycle belongs to * @throws ImplementationExceptionResponse * @throws ImplementationException * if an implementation exception occurs */ @Autowired public EventCycle(String specName, ECSpec spec, ReaderService readerService, ECReportsHelper reportsHelper, RifidiHelper rifidiHelper, PersistenceConfig config, FileUtils fileUtils, EventCycleService eventCycleService) throws ImplementationExceptionResponse { super(f); // Set reader service this.readerService = readerService; this.reportsHelper = reportsHelper; this.rifidiHelper = rifidiHelper; this.config = config; this.fileUtils = fileUtils; this.eventCycleService = eventCycleService; // set name this.name = specName + "_" + number++; // set spec this.spec = spec; // init BoundarySpec values durationValue = getDurationValue(); // get report specs and create a report for each spec for (ECReportSpec reportSpec : spec.getReportSpecs().getReportSpec()) { // add report spec and report to reports Report report = new Report(reportSpec, this); reports.putIfAbsent(reportSpec.getReportName(), report); // hash into the report spec structure reportSpecByName.putIfAbsent(reportSpec.getReportName(), reportSpec); } long repeatPeriod = getRepeatPeriodValue(); if (durationValue == repeatPeriod) { setRejectTagsBetweenCycle(false); } LOG.debug(String.format("durationValue: %s\n", durationValue)); setAcceptTags(false); // LOG.debug("adding logicalReaders to EventCycle"); // get LogicalReaderStubs if (spec.getLogicalReaders() != null) { List<String> logicalReaderNames = spec.getLogicalReaders().getLogicalReader(); for (String logicalReaderName : logicalReaderNames) { // LOG.debug("retrieving logicalReader " + logicalReaderName); Reader logicalReader = readerService.getLogicalReader(logicalReaderName); if (logicalReader != null) { // LOG.debug("adding logicalReader " + // logicalReader.getName() + " to EventCycle " + name); addReader(logicalReader); } } } else { LOG.error("ECSpec contains no readers"); } rounds = 0; // create and start Thread thread = new Thread(this, "EventCycle" + name); thread.setDaemon(true); thread.start(); this.launch(); if (durationValue > 0) { LOG.debug("Duration = " + durationValue); } disposables .add(Observable.interval(getRepeatPeriodValue(), TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() { @Override public void call(Long arg0) { // TODO Auto-generated method stub try { buildAndNotify(); } catch (ECSpecValidationExceptionResponse | ImplementationExceptionResponse e) { // TODO Auto-generated catch block e.printStackTrace(); } } })); LOG.debug("New EventCycle '" + name + "' created."); } private void buildAndNotify() throws ECSpecValidationExceptionResponse, ImplementationExceptionResponse { synchronized (this) { this.notifyAll(); } } /** * add a logicalReader to the eventCycle. * * @param reader * a logicalReader (baseReader or CompositeReader) */ private void addReader(Reader reader) { Subscription disposable = readerService.subscribe(reader.getName(), this); logicalReaders.putIfAbsent(reader.getName(), new ImmutablePair<Subscription, Reader>(disposable, reader)); } public void removeReaders() { for (Pair<Subscription, Reader> reader : logicalReaders.values()) { reader.getKey().unsubscribe(); } logicalReaders.clear(); } /** * This method returns the ec reports. * * @return ec reports * @throws ECSpecValidationException * if the tags of the report are not valid * @throws ImplementationException * if an implementation exception occurs. */ private ECReports getECReports() throws ECSpecValidationExceptionResponse, ImplementationExceptionResponse { // create ECReports ecReports = new ECReports(); // set spec name ecReports.setSpecName(getName()); // set date try { ecReports.setDate(DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar())); } catch (DatatypeConfigurationException e) { LOG.error("Could not create date: " + e.getMessage()); } // set ale id ecReports.setALEID(ALEID); // set total time in milliseconds ecReports.setTotalMilliseconds(totalTime); // set termination condition ecReports.setTerminationCondition(terminationCondition); // set spec // System.out.println("EventCycle.getECReports(), spec: " + spec); // System.out.println("EventCycle.getECReports(), spec.isIncludeSpecInReports(): " + spec.isIncludeSpecInReports()); if (spec.isIncludeSpecInReports()) { ecReports.setECSpec(spec); } // set reports ecReports.setReports(new Reports()); ecReports.getReports().getReport().addAll(getReportList()); return ecReports; } // @Override public void addTag(Tag tag) { if (!isAcceptingTags()) { return; } // add event only if EventCycle is still running if (isEventCycleActive()) { tags.add(tag); } } /** * This method adds a tag between 2 event cycle. * * @param tag * to add * @throws ImplementationException * if an implementation exception occurs * @throws ECSpecValidationException * if the tag is not valid */ private void addTagBetweenEventsCycle(Tag tag) { if (isRejectTagsBetweenCycle()) { return; } // add event only if EventCycle is still running if (isEventCycleActive()) { betweenEventsCycleTags.add(tag); } } /** * determine if this event cycle is active (running) or not. * * @return true if the event cycle is active, false if not. */ private boolean isEventCycleActive() { return thread.isAlive(); } // @Override public void update(Observable o, Object arg) { LOG.debug("EventCycle "+ getName() + ": Update notification received. "); Set<Tag> tags = new LinkedHashSet<>(); // process the new tag. if (arg instanceof Tag) { LOG.debug("processing one tag"); // process one tag tags.add((Tag) arg); } else if (arg instanceof List) { LOG.debug("processing a list of tags"); for (Object entry : (List<?>) arg) { if (entry instanceof Tag) { tags.add((Tag) entry); } } } if (tags.size() > 0) { handleTags(tags); } else { LOG.debug("EventCycle "+ getName() + ": Update notification received - but not with any tags - ignoring. "); } } private void handleTags(Set<Tag> tags) { if (!isAcceptingTags()) { handleTagsWhileNotAccepting(tags); } else { handleTagsWhileAccepting(tags); } } /** * deal with new tags. * * @param tags */ private void handleTagsWhileAccepting(Set<Tag> tags) { // process all the tags we did not process between two eventcycles (or // while we did not accept any tags). if (!isRejectTagsBetweenCycle()) { for (Tag tag : betweenEventsCycleTags) { addTag(tag); } betweenEventsCycleTags.clear(); } // LOG.debug("EventCycle "+ getName() + ": Received list of tags :"); for (Tag tag : tags) { addTag(tag); } } /** * deal with tags while the event cycle is not accepting tags. (eg. between * two event cycles). * * @param arg * the update we received. */ private void handleTagsWhileNotAccepting(Set<Tag> tags) { if (!isRejectTagsBetweenCycle()) { for (Tag tag : tags) { // LOG.debug("received tag between eventcycles: " + // tag.getTagIDAsPureURI()); addTagBetweenEventsCycle(tag); } } } // @Override public void stop() { // unsubscribe this event cycle from logical readers for (String logicalReaderName : logicalReaders.keySet()) { if (!logicalReaders.get(logicalReaderName).getKey().isUnsubscribed()) logicalReaders.get(logicalReaderName).getKey().unsubscribe(); } running = false; thread.interrupt(); // LOG.debug("EventCycle '" + name + "' stopped."); isTerminated = true; disposables.unsubscribe(); disposables.clear(); synchronized (this) { this.notifyAll(); } } // @Override public String getName() { return name; } // @Override public boolean isTerminated() { return isTerminated; } /** * This method is the main loop of the event cycle in which the tags will be * collected. At the end the reports will be generated and the subscribers * will be notified. */ @Override public void run() { lastEventCycleTags = new HashSet<Tag>(); // wait for the start // running will be set when the EventCycle // has a subscriber if (!running) { synchronized (this) { try { this.wait(); } catch (InterruptedException e) { // LOG.info("eventcycle got interrupted"); return; } } } while (running) { rounds++; synchronized (lock) { roundOver = false; } // LOG.info("EventCycle "+ getName() + ": Starting (Round " + rounds // + ")."); // set start time long startTime = System.currentTimeMillis(); // accept tags setAcceptTags(true); // ------------------------------ run for the specified time try { if (durationValue > 0) { // if durationValue is specified and larger than zero, // wait for notify or durationValue elapsed. synchronized (this) { long dt = (System.currentTimeMillis() - startTime); this.wait(Math.max(1, durationValue - dt)); terminationCondition = ECTerminationCondition.DURATION; } } else { // if durationValue is not specified or smaller than zero, // wait for notify. synchronized (this) { this.wait(); } } } catch (InterruptedException e) { // if Thread is stopped with method stop(), // then return without notify subscribers. // LOG.info("eventcycle got interrupted"); return; } // don't accept tags anymore setAcceptTags(false); // ------------------------ generate the reports // get reports try { // compute total time totalTime = System.currentTimeMillis() - startTime; // LOG.info("EventCycle "+ getName() + // ": Number of Tags read in the current EventCyle.java: " // + tags.size()); ECReports eventCycleReports = getECReports(); // notifySubscribers // System.out.println("EventCycle.run, ecReports.getECSpec(): " + ecReports.getECSpec()); notifySubscribers(ecReports); // store the current tags into the old tags // explicitly clear the tags if (lastEventCycleTags != null) { lastEventCycleTags.clear(); } if (tags != null) { lastEventCycleTags.addAll(tags); } tags = Collections.synchronizedSet(new HashSet<Tag>()); } catch (Exception e) { e.printStackTrace(); if (e instanceof InterruptedException) { // LOG.info("eventcycle got interrupted"); return; } // LOG.error("EventCycle "+ getName() + ": Could not create // ECReports", e); } // LOG.info("EventCycle "+ getName() + ": EventCycle finished (Round // " + rounds + ")."); try { // inform possibly waiting workers about the finish synchronized (lock) { roundOver = true; lock.notifyAll(); } // wait until reschedule. synchronized (this) { this.wait(); } // LOG.debug("eventcycle continues"); } catch (InterruptedException e) { // LOG.info("eventcycle got interrupted"); return; } } // stop EventCycle stop(); } private void notifySubscribers(ECReports reports) { // System.out.println("EventCycle.notifySubscribers, reports.getECSpec(): " + reports.getECSpec()); // according the ALE 1.1 standard: // When the processing of reportIfEmpty and reportOnlyOnChange // results in all ECReport instances being omitted from an // ECReports for an event cycle, then the delivery of results // to subscribers SHALL be suppressed altogether. [...] poll // and immediate SHALL always be returned [...] even if that // ECReports instance contains zero ECReport instances. // An ECReports instance SHALL include an ECReport instance // corresponding to each // ECReportSpec in the governing ECSpec, in the same order specified in // the ECSpec, // except that an ECReport instance SHALL be omitted under the following // circumstances: // - If an ECReportSpec has reportIfEmpty set to false, then the // corresponding // ECReport instance SHALL be omitted from the ECReports for this event // cycle if // the final, filtered set of Tags is empty (i.e., if the final Tag list // would be empty, or if // the final count would be zero). // - If an ECReportSpec has reportOnlyOnChange set to true, then the // corresponding ECReport instance SHALL be omitted from the ECReports // for // this event cycle if the filtered set of Tags is identical to the // filtered prior set of Tags, // where equality is tested by considering the primaryKeyFields as // specified in the // ECSpec (see Section 8.2), and where the phrase 'the prior set of // Tags' is as defined // in Section 8.2.6. This comparison takes place before the filtered set // has been modified // based on reportSet or output parameters. The comparison also // disregards // whether the previous ECReports was actually sent due to the effect of // this // parameter, or the reportIfEmpty parameter. // When the processing of reportIfEmpty and reportOnlyOnChange results // in all // ECReport instances being omitted from an ECReports for an event // cycle, then the // delivery of results to subscribers SHALL be suppressed altogether. // That is, a result // consisting of an ECReports having zero contained ECReport instances // SHALL NOT // be sent to a subscriber. (Because an ECSpec must contain at least one // ECReportSpec, this can only arise as a result of reportIfEmpty or // reportOnlyOnChange processing.) This rule only applies to subscribers // (event cycle // requestors that were registered by use of the subscribe method); an // ECReports // instance SHALL always be returned to the caller of immediate or poll // at the end of // an event cycle, even if that ECReports instance contains zero // ECReport instances. Cloner cloner = new Cloner(); // deep clone the original input in order to keep it as the // next event cycles last cycle reports. ECReports originalInput = cloner.deepClone(reports); // we deep clone (clone not sufficient) for the pollers // in order to deliver them the correct set of reports. if (isPolling()) { // deep clone for the pollers (poll and immediate) pollReport = cloner.deepClone(reports); } // we remove the reports that are equal to the ones in the // last event cycle. then we send the subscribers. List<ECReport> equalReps = new LinkedList<ECReport>(); List<ECReport> reportsToNotify = new LinkedList<ECReport>(); try { for (ECReport r : reports.getReports().getReport()) { final ECReportSpec reportSpec = getReportSpecByName(r.getReportName()); boolean tagsInReport = hasTags(r); // case no tags in report but report if empty if (!tagsInReport && reportSpec.isReportIfEmpty()) { // LOG.debug("requesting empty for report: " + // r.getReportName()); reportsToNotify.add(r); } else if (tagsInReport) { reportsToNotify.add(r); } // check for equal reports since last notification. if (reportSpec.isReportOnlyOnChange()) { // report from the previous EventCycle run. ECReport oldR = getLastReports().get(r.getReportName()); // compare the new report with the old one. if (reportsHelper.areReportsEqual(reportSpec, r, oldR)) { equalReps.add(r); } } } } catch (Exception e) { LOG.error("caught exception while processing reports: ", e); } // check if the intersection of all reports to notify (including empty // ones) and the equal ones is empty // -> if so, do not notify at all. reportsToNotify.removeAll(equalReps); // remove the equal reports Reports re = reports.getReports(); if (null != re) re.getReport().removeAll(equalReps); // LOG.debug("reports size: " + // reports.getReports().getReport().size()); // next step is to check, if the total report is empty (even if // requestIfEmpty but when all reports are equal, do not deliver) if (reportsToNotify.size() > 0) { // notify the ECReports notifySubscribersWithFilteredReports(reports); } // store the new reports as old reports getLastReports().clear(); if (null != originalInput.getReports()) { for (ECReport r : originalInput.getReports().getReport()) { getLastReports().put(r.getReportName(), r); } } // notify pollers // pollers always receive reports (even when empty). if (isPolling()) { polling = false; if (observers.isEmpty()) { setState(State.UNREQUESTED); } synchronized (this) { this.notifyAll(); } } } /** * once all the filtering is done eventually notify the subscribers with the * reports. * * @param reports * the filtered reports. */ protected void notifySubscribersWithFilteredReports(ECReports reports) { // notify subscribers String specName = rifidiHelper.getECSpecName( reports.getSpecName() ); // System.out.println("EventCycle.specName: " + specName); List<String> errorMessages = new ArrayList<>(); try { // if (!eventCycleService.containsKey(specName)) { // throw new NoSuchNameExceptionResponse("No ECSpec with such name defined: " + specName); // } String path = config.getRealPathECSpecDir(); String fileName = specName + ".xml"; // System.out.println("EventCycle.fileName: " + fileName); if ( fileUtils.fileExist(fileName, path) ){ ECSpec spec = DeserializerUtil.deserializeECSpec(path + fileName); errorMessages = rifidiHelper.validateSessionInProcessingState( spec ); if ( !errorMessages.isEmpty() ){ String errorsStr = rifidiHelper.getErrorMessagesAsSingleText(errorMessages); System.out.println("EventCycle.error: " + errorsStr); LOG.error("EventCycle.error: " + errorsStr); sendErrorMesssageToSubscribers(specName, errorsStr); return; } } synchronized (this.observers) { for (Observer<ECReports> observer : this.observers) { observer.onNext(reports); } } } catch (Exception e){ // throw new NoSuchNameExceptionResponse(e.getMessage(), e); e.printStackTrace(); // errorMessages.add(e.getMessage()); // throw new ValidationExceptionResponse(e.getMessage(), e); //Send error message to mqtt sendErrorMesssageToSubscribers(specName, e.getMessage()); } // reportError.setErrorList(errorMessages); // t.getAny().add(reportError); } private void sendErrorMesssageToSubscribers(String specName, String errorMsg){ Collection<Pair<Subscription, Notifier>> notifierCollection = eventCycleService.getNotifiers(specName); for (Pair<Subscription, Notifier> pair : notifierCollection ){ Notifier notifier = pair.getValue(); ImplementationExceptionResponse implementationExceptionResponse = new ImplementationExceptionResponse(errorMsg); notifier.notifyExceptionToSubscriber(implementationExceptionResponse); } } @Override public void launch() { this.running = true; // LOG.debug("launching eventCycle" + getName()); synchronized (this) { this.notifyAll(); } } /** * This method returns all reports of this event cycle as event cycle * reports. * * @return array of ec reports * @throws ECSpecValidationException * if a tag of this report is not valid * @throws ImplementationException * if an implementation exception occurs. */ private List<ECReport> getReportList() throws ECSpecValidationExceptionResponse, ImplementationExceptionResponse { ArrayList<ECReport> ecReports = new ArrayList<ECReport>(); for (Report report : this.reports.values()) { ECReport r = report.getECReport(); if (null != r) ecReports.add(r); } return ecReports; } /** * This method returns the duration value extracted from the event cycle * specification. * * @return duration value in milliseconds * @throws ImplementationException * if an implementation exception occurs */ private long getDurationValue() throws ImplementationExceptionResponse { if (spec.getBoundarySpec() != null) { ECTime duration = spec.getBoundarySpec().getDuration(); if (duration != null) { if (duration.getUnit().compareToIgnoreCase(ECTimeUnit.MS) == 0) { return duration.getValue(); } else { throw new ImplementationExceptionResponse("The only ECTimeUnit allowed is milliseconds (MS)."); } } } return -1; } /** * This method returns the repeat period value on the basis of the event * cycle specification. * * @return repeat period value * @throws ImplementationException * if the time unit in use is unknown */ private long getRepeatPeriodValue() throws ImplementationExceptionResponse { if (spec.getBoundarySpec() != null) { ECTime repeatPeriod = spec.getBoundarySpec().getRepeatPeriod(); if (repeatPeriod != null) { if (repeatPeriod.getUnit().compareToIgnoreCase(ECTimeUnit.MS) != 0) { throw new ImplementationExceptionResponse("The only ECTimeUnit allowed is milliseconds (MS)."); } else { return repeatPeriod.getValue(); } } } return -1; } // @Override public Set<Tag> getLastEventCycleTags() { return copyContentToNewDatastructure(lastEventCycleTags); } // @Override public Set<Tag> getTags() { return copyContentToNewDatastructure(tags); } /** * create a copy of the content of the given data structure -> we use * synchronized sets -> make sure not to leak them.<br/> * this method synchronizes the original data structure during to copy * process. <br/> * <strong>Notice that the content is NOT cloned, simply * referenced!</strong> * * @param contentToCopy * the data structure to copy. * @return a copy of the data structure with the content of the input. */ private Set<Tag> copyContentToNewDatastructure(Set<Tag> contentToCopy) { Set<Tag> copy = new HashSet<Tag>(); synchronized (contentToCopy) { for (Tag tag : contentToCopy) { copy.add(tag); } } return copy; } private boolean isRejectTagsBetweenCycle() { return rejectTagsBetweenCycle; } private void setRejectTagsBetweenCycle(boolean rejectTagsBetweenCycle) { this.rejectTagsBetweenCycle = rejectTagsBetweenCycle; } /** * tells whether the ec accepts tags. * * @return boolean telling whether the ec accepts tags */ private boolean isAcceptingTags() { return acceptTags; } /** * sets the flag acceptTags to the passed boolean value. * * @param acceptTags * sets the flag acceptTags to the passed boolean value. */ private void setAcceptTags(boolean acceptTags) { this.acceptTags = acceptTags; } // @Override public int getRounds() { return rounds; } // @Override public void join() throws InterruptedException { synchronized (lock) { while (!isRoundOver()) { lock.wait(); } } } /** * whether the event cycle round is over. <strong>notice that this method is * not exported via interface</strong>. * * @return true if over, false otherwise */ public boolean isRoundOver() { return roundOver; } // FIXME: Implementation is currently leaking... need to do something. // @Override public ECReportSpec getReportSpecByName(String name) { return reportSpecByName.get(name); } /** * get a handle onto the map holding all the report specs. * * @return the map. */ protected Map<String, ECReportSpec> getReportSpecByName() { return reportSpecByName; } // FIXME: Implementation is currently leaking... need to do something. // @Override public Map<String, ECReport> getLastReports() { return lastReports; } @Override public void onCompleted() { // TODO Auto-generated method stub } @Override public void onError(Throwable arg0) { // TODO Auto-generated method stub } @Override public void onNext(TagReadEvent entry) { Tag tag = new Tag(entry.getTag().getID().toString(), entry.getReaderID(), entry.getAntennaID(), null, entry.getTag().getFormattedID(), entry.getTimestamp()); tags.add(tag); handleTags(tags); } /** * check if a given ECReport contains at least one tag in its data * structures. * * @param r * the report to check. * @return true if tags contained, false otherwise. */ private boolean hasTags(ECReport r) { try { for (ECReportGroup g : r.getGroup()) { if (g.getGroupList().getMember().size() > 0) { return true; } } } catch (Exception ex) { LOG.debug("could not check for tag occurence - report considered not to containing tags", ex); } return false; } public Subscription subscribeObserver(Observer<ECReports> observer) { synchronized (this) { if (!this.observers.contains(observer)) { this.observers.add(observer); System.out.println("EventCycle subscribeObserver"); } this.notifyAll(); return new Unsubscriber(this.observers, observer); } } public Unsubscriber unsubscribeObserver(Observer<ECReports> observer) { synchronized (this) { if (this.observers.contains(observer)) { this.observers.remove(observer); System.out.println("EventCycle unsubscribeObserver"); } this.notifyAll(); return new Unsubscriber(this.observers, observer); } } class Unsubscriber implements Subscription { private List<Observer<ECReports>> _observers; private Observer<ECReports> _observer; public Unsubscriber(List<Observer<ECReports>> observers, Observer<ECReports> observer) { this._observers = observers; this._observer = observer; } @Override public boolean isUnsubscribed() { // TODO Auto-generated method stub if (this._observer != null && !this._observers.contains(this._observer)) return true; return false; } @Override public void unsubscribe() { // TODO Auto-generated method stub if (this._observer != null && this._observers.contains(this._observer)) { this._observers.remove(_observer); } } } @Override public ECSpec getECSpec() { // TODO Auto-generated method stub return ecReports.getECSpec(); } @Override public void setECSpec(ECSpec ecSpec) { // TODO Auto-generated method stub ecReports.setECSpec(ecSpec); } @Override public void poll() { // TODO Auto-generated method stub // LOG.debug("Spec '" + name + "' polled."); pollReport = null; polling = true; if (isStateUnRequested()) { setState(State.REQUESTED); } } public void setState(State state) { State oldState = this.state; this.state = state; LOG.debug("ReportGenerator '" + name + "' change state from '" + oldState + "' to '" + state + "'"); // FIXME ALE // if (isStateRequested() && !isRunning()) { // start(); // } else if (isStateUnRequested() && isRunning()) { // stop(); // } } // @Override public boolean isStateUnRequested() { return state == State.UNREQUESTED; } protected boolean isPolling() { return polling; } @Override public ECReports getPollReports() { return pollReport; } @Override public void limpiarTags() { tags = Collections.synchronizedSet(new HashSet<Tag>()); } private StateMachineConfig<State, Trigger> lifecycle = new StateMachineConfig<>(); private enum State { UNREQUESTED, REQUESTED, ACTIVE } private enum Trigger { Undefine, Subscribe, Unsubscribe, Poll, StartTrigger, StopTrigger, RepeatPeriod } }
[ "matt@transcends.co" ]
matt@transcends.co
24de6a84f14b57ee1b395295a4190b2fd1dd9779
3c45ef1bb3b404e3ddb0791f5139043eac48a79e
/SDK/liferay-plugins-sdk/portlets/rev-portlet/docroot/WEB-INF/src/com/hitss/layer/model/impl/UsuarioModelImpl.java
63c87894f6aa63ac7c9f966c8ef4f65a951e065b
[]
no_license
danieldelgado/ProyectoInformatico-Reporsitorio
216d91ca6f8a4598bcad27bfc5f018e5ba5f6561
2ac768ae4d41e7b566a521b5cef976a78271e336
refs/heads/master
2021-04-09T17:15:19.944886
2017-02-26T05:52:04
2017-02-26T05:52:04
55,432,714
0
0
null
null
null
null
UTF-8
Java
false
false
13,666
java
/** * Copyright (c) 2000-present Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ package com.hitss.layer.model.impl; import com.hitss.layer.model.Usuario; import com.hitss.layer.model.UsuarioModel; import com.hitss.layer.model.UsuarioSoap; import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler; import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.json.JSON; import com.liferay.portal.kernel.util.DateUtil; import com.liferay.portal.kernel.util.GetterUtil; import com.liferay.portal.kernel.util.ProxyUtil; import com.liferay.portal.kernel.util.StringBundler; import com.liferay.portal.model.CacheModel; import com.liferay.portal.model.impl.BaseModelImpl; import com.liferay.portal.service.ServiceContext; import com.liferay.portal.util.PortalUtil; import com.liferay.portlet.expando.model.ExpandoBridge; import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil; import java.io.Serializable; import java.sql.Types; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; /** * The base model implementation for the Usuario service. Represents a row in the &quot;Usuario&quot; database table, with each column mapped to a property of this class. * * <p> * This implementation and its corresponding interface {@link com.hitss.layer.model.UsuarioModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link UsuarioImpl}. * </p> * * @author Danielle Delgado * @see UsuarioImpl * @see com.hitss.layer.model.Usuario * @see com.hitss.layer.model.UsuarioModel * @generated */ @JSON(strict = true) public class UsuarioModelImpl extends BaseModelImpl<Usuario> implements UsuarioModel { /* * NOTE FOR DEVELOPERS: * * Never modify or reference this class directly. All methods that expect a usuario model instance should use the {@link com.hitss.layer.model.Usuario} interface instead. */ public static final String TABLE_NAME = "Usuario"; public static final Object[][] TABLE_COLUMNS = { { "userId", Types.BIGINT }, { "activo", Types.BOOLEAN }, { "usuariocrea", Types.BIGINT }, { "fechacrea", Types.TIMESTAMP }, { "usuariomodifica", Types.BIGINT }, { "fechamodifica", Types.TIMESTAMP } }; public static final String TABLE_SQL_CREATE = "create table Usuario (userId LONG not null primary key,activo BOOLEAN,usuariocrea LONG,fechacrea DATE null,usuariomodifica LONG,fechamodifica DATE null)"; public static final String TABLE_SQL_DROP = "drop table Usuario"; public static final String ORDER_BY_JPQL = " ORDER BY usuario.fechamodifica ASC"; public static final String ORDER_BY_SQL = " ORDER BY Usuario.fechamodifica ASC"; public static final String DATA_SOURCE = "liferayDataSource"; public static final String SESSION_FACTORY = "liferaySessionFactory"; public static final String TX_MANAGER = "liferayTransactionManager"; public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get( "value.object.entity.cache.enabled.com.hitss.layer.model.Usuario"), true); public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get( "value.object.finder.cache.enabled.com.hitss.layer.model.Usuario"), true); public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get( "value.object.column.bitmask.enabled.com.hitss.layer.model.Usuario"), true); public static long USERID_COLUMN_BITMASK = 1L; public static long FECHAMODIFICA_COLUMN_BITMASK = 2L; /** * Converts the soap model instance into a normal model instance. * * @param soapModel the soap model instance to convert * @return the normal model instance */ public static Usuario toModel(UsuarioSoap soapModel) { if (soapModel == null) { return null; } Usuario model = new UsuarioImpl(); model.setUserId(soapModel.getUserId()); model.setActivo(soapModel.getActivo()); model.setUsuariocrea(soapModel.getUsuariocrea()); model.setFechacrea(soapModel.getFechacrea()); model.setUsuariomodifica(soapModel.getUsuariomodifica()); model.setFechamodifica(soapModel.getFechamodifica()); return model; } /** * Converts the soap model instances into normal model instances. * * @param soapModels the soap model instances to convert * @return the normal model instances */ public static List<Usuario> toModels(UsuarioSoap[] soapModels) { if (soapModels == null) { return null; } List<Usuario> models = new ArrayList<Usuario>(soapModels.length); for (UsuarioSoap soapModel : soapModels) { models.add(toModel(soapModel)); } return models; } public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get( "lock.expiration.time.com.hitss.layer.model.Usuario")); public UsuarioModelImpl() { } @Override public long getPrimaryKey() { return _userId; } @Override public void setPrimaryKey(long primaryKey) { setUserId(primaryKey); } @Override public Serializable getPrimaryKeyObj() { return _userId; } @Override public void setPrimaryKeyObj(Serializable primaryKeyObj) { setPrimaryKey(((Long)primaryKeyObj).longValue()); } @Override public Class<?> getModelClass() { return Usuario.class; } @Override public String getModelClassName() { return Usuario.class.getName(); } @Override public Map<String, Object> getModelAttributes() { Map<String, Object> attributes = new HashMap<String, Object>(); attributes.put("userId", getUserId()); attributes.put("activo", getActivo()); attributes.put("usuariocrea", getUsuariocrea()); attributes.put("fechacrea", getFechacrea()); attributes.put("usuariomodifica", getUsuariomodifica()); attributes.put("fechamodifica", getFechamodifica()); return attributes; } @Override public void setModelAttributes(Map<String, Object> attributes) { Long userId = (Long)attributes.get("userId"); if (userId != null) { setUserId(userId); } Boolean activo = (Boolean)attributes.get("activo"); if (activo != null) { setActivo(activo); } Long usuariocrea = (Long)attributes.get("usuariocrea"); if (usuariocrea != null) { setUsuariocrea(usuariocrea); } Date fechacrea = (Date)attributes.get("fechacrea"); if (fechacrea != null) { setFechacrea(fechacrea); } Long usuariomodifica = (Long)attributes.get("usuariomodifica"); if (usuariomodifica != null) { setUsuariomodifica(usuariomodifica); } Date fechamodifica = (Date)attributes.get("fechamodifica"); if (fechamodifica != null) { setFechamodifica(fechamodifica); } } @JSON @Override public long getUserId() { return _userId; } @Override public void setUserId(long userId) { _columnBitmask |= USERID_COLUMN_BITMASK; if (!_setOriginalUserId) { _setOriginalUserId = true; _originalUserId = _userId; } _userId = userId; } @Override public String getUserUuid() throws SystemException { return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid); } @Override public void setUserUuid(String userUuid) { _userUuid = userUuid; } public long getOriginalUserId() { return _originalUserId; } @JSON @Override public boolean getActivo() { return _activo; } @Override public boolean isActivo() { return _activo; } @Override public void setActivo(boolean activo) { _activo = activo; } @JSON @Override public long getUsuariocrea() { return _usuariocrea; } @Override public void setUsuariocrea(long usuariocrea) { _usuariocrea = usuariocrea; } @JSON @Override public Date getFechacrea() { return _fechacrea; } @Override public void setFechacrea(Date fechacrea) { _fechacrea = fechacrea; } @JSON @Override public long getUsuariomodifica() { return _usuariomodifica; } @Override public void setUsuariomodifica(long usuariomodifica) { _usuariomodifica = usuariomodifica; } @JSON @Override public Date getFechamodifica() { return _fechamodifica; } @Override public void setFechamodifica(Date fechamodifica) { _columnBitmask = -1L; _fechamodifica = fechamodifica; } public long getColumnBitmask() { return _columnBitmask; } @Override public ExpandoBridge getExpandoBridge() { return ExpandoBridgeFactoryUtil.getExpandoBridge(0, Usuario.class.getName(), getPrimaryKey()); } @Override public void setExpandoBridgeAttributes(ServiceContext serviceContext) { ExpandoBridge expandoBridge = getExpandoBridge(); expandoBridge.setAttributes(serviceContext); } @Override public Usuario toEscapedModel() { if (_escapedModel == null) { _escapedModel = (Usuario)ProxyUtil.newProxyInstance(_classLoader, _escapedModelInterfaces, new AutoEscapeBeanHandler(this)); } return _escapedModel; } @Override public Object clone() { UsuarioImpl usuarioImpl = new UsuarioImpl(); usuarioImpl.setUserId(getUserId()); usuarioImpl.setActivo(getActivo()); usuarioImpl.setUsuariocrea(getUsuariocrea()); usuarioImpl.setFechacrea(getFechacrea()); usuarioImpl.setUsuariomodifica(getUsuariomodifica()); usuarioImpl.setFechamodifica(getFechamodifica()); usuarioImpl.resetOriginalValues(); return usuarioImpl; } @Override public int compareTo(Usuario usuario) { int value = 0; value = DateUtil.compareTo(getFechamodifica(), usuario.getFechamodifica()); if (value != 0) { return value; } return 0; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Usuario)) { return false; } Usuario usuario = (Usuario)obj; long primaryKey = usuario.getPrimaryKey(); if (getPrimaryKey() == primaryKey) { return true; } else { return false; } } @Override public int hashCode() { return (int)getPrimaryKey(); } @Override public void resetOriginalValues() { UsuarioModelImpl usuarioModelImpl = this; usuarioModelImpl._originalUserId = usuarioModelImpl._userId; usuarioModelImpl._setOriginalUserId = false; usuarioModelImpl._columnBitmask = 0; } @Override public CacheModel<Usuario> toCacheModel() { UsuarioCacheModel usuarioCacheModel = new UsuarioCacheModel(); usuarioCacheModel.userId = getUserId(); usuarioCacheModel.activo = getActivo(); usuarioCacheModel.usuariocrea = getUsuariocrea(); Date fechacrea = getFechacrea(); if (fechacrea != null) { usuarioCacheModel.fechacrea = fechacrea.getTime(); } else { usuarioCacheModel.fechacrea = Long.MIN_VALUE; } usuarioCacheModel.usuariomodifica = getUsuariomodifica(); Date fechamodifica = getFechamodifica(); if (fechamodifica != null) { usuarioCacheModel.fechamodifica = fechamodifica.getTime(); } else { usuarioCacheModel.fechamodifica = Long.MIN_VALUE; } return usuarioCacheModel; } @Override public String toString() { StringBundler sb = new StringBundler(13); sb.append("{userId="); sb.append(getUserId()); sb.append(", activo="); sb.append(getActivo()); sb.append(", usuariocrea="); sb.append(getUsuariocrea()); sb.append(", fechacrea="); sb.append(getFechacrea()); sb.append(", usuariomodifica="); sb.append(getUsuariomodifica()); sb.append(", fechamodifica="); sb.append(getFechamodifica()); sb.append("}"); return sb.toString(); } @Override public String toXmlString() { StringBundler sb = new StringBundler(22); sb.append("<model><model-name>"); sb.append("com.hitss.layer.model.Usuario"); sb.append("</model-name>"); sb.append( "<column><column-name>userId</column-name><column-value><![CDATA["); sb.append(getUserId()); sb.append("]]></column-value></column>"); sb.append( "<column><column-name>activo</column-name><column-value><![CDATA["); sb.append(getActivo()); sb.append("]]></column-value></column>"); sb.append( "<column><column-name>usuariocrea</column-name><column-value><![CDATA["); sb.append(getUsuariocrea()); sb.append("]]></column-value></column>"); sb.append( "<column><column-name>fechacrea</column-name><column-value><![CDATA["); sb.append(getFechacrea()); sb.append("]]></column-value></column>"); sb.append( "<column><column-name>usuariomodifica</column-name><column-value><![CDATA["); sb.append(getUsuariomodifica()); sb.append("]]></column-value></column>"); sb.append( "<column><column-name>fechamodifica</column-name><column-value><![CDATA["); sb.append(getFechamodifica()); sb.append("]]></column-value></column>"); sb.append("</model>"); return sb.toString(); } private static ClassLoader _classLoader = Usuario.class.getClassLoader(); private static Class<?>[] _escapedModelInterfaces = new Class[] { Usuario.class }; private long _userId; private String _userUuid; private long _originalUserId; private boolean _setOriginalUserId; private boolean _activo; private long _usuariocrea; private Date _fechacrea; private long _usuariomodifica; private Date _fechamodifica; private long _columnBitmask; private Usuario _escapedModel; }
[ "danieldelgado20g@gmail.com" ]
danieldelgado20g@gmail.com
c19c7de423463e81698ecaf83bc001da61e08cce
e61746f412220384489c7ae04916850fb03498b6
/src/main/java/com/safecharge/model/AddendumsAirlinesPassengerDetails.java
f0362435c7ff9fd0e31d3131a3861adafca81ddd
[ "MIT" ]
permissive
dreaderxxx/safecharge-java
3e2a6ca25fd77d4f956c5aba03e80629599907e6
9bee9bcd09e8ed269bc9804b6370492989233500
refs/heads/master
2020-06-30T15:42:38.872395
2020-02-26T09:44:12
2020-02-26T09:44:12
200,874,926
1
1
MIT
2020-02-26T09:44:13
2019-08-06T15:08:44
Java
UTF-8
Java
false
false
2,376
java
package com.safecharge.model; /** * Copyright (C) 2007-2017 SafeCharge International Group Limited. * <p> * Local payment info specific for some clients. Part of {@link Addendums}. * * @author <a mailto:bozhidarsh@safecharge.com>Bozhidar Shumanov</a> * @see Addendums * @since 8/8/2018 */ public class AddendumsAirlinesPassengerDetails { private String passangerId; private String passportNumber; private String customerCode; private String frequentFlyerCode; private String title; private String firstName; private String lastName; private String middleName; private String dateOfBirth; private String phoneNumber; public String getPassangerId() { return passangerId; } public String getPassportNumber() { return passportNumber; } public String getCustomerCode() { return customerCode; } public String getFrequentFlyerCode() { return frequentFlyerCode; } public String getTitle() { return title; } public String getFirstName() { return firstName; } public String getLastName() { return lastName; } public String getMiddleName() { return middleName; } public String getDateOfBirth() { return dateOfBirth; } public String getPhoneNumber() { return phoneNumber; } public void setPassangerId(String passangerId) { this.passangerId = passangerId; } public void setPassportNumber(String passportNumber) { this.passportNumber = passportNumber; } public void setCustomerCode(String customerCode) { this.customerCode = customerCode; } public void setFrequentFlyerCode(String frequentFlyerCode) { this.frequentFlyerCode = frequentFlyerCode; } public void setTitle(String title) { this.title = title; } public void setFirstName(String firstName) { this.firstName = firstName; } public void setLastName(String lastName) { this.lastName = lastName; } public void setMiddleName(String middleName) { this.middleName = middleName; } public void setDateOfBirth(String dateOfBirth) { this.dateOfBirth = dateOfBirth; } public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } }
[ "bozhidarsh@safecharge.com" ]
bozhidarsh@safecharge.com
d6dfa676086729fd09cb20d4e3057e6abefabec5
897d2c3de5d517f83ee8bd1b60caa720cec88cfc
/Branden/PacWoman/src/Pac1.java
0bdaa9839a81e4751a6cc4dd8ed847ade1782684
[]
no_license
WayneRyan/Sprint2018-5th
2dfd86cab0c665ba9239b269d775297ee9ae896d
53d55027d7283fccc0abdaefc432f57dcebab04b
refs/heads/master
2020-03-13T08:13:15.903498
2018-04-30T18:44:18
2018-04-30T18:44:18
131,039,708
0
9
null
2018-05-08T18:09:50
2018-04-25T17:14:38
Java
UTF-8
Java
false
false
3,780
java
import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; public class Pac1 implements KeyListener { static int x, oldX; static int y, oldY; static double vX; static double vY; private double direction; private double health; public static final int SIZE = 20; public static final int BUFFER = (int) 3.75; private boolean leftPressed, rightPressed, upPressed, downPressed; public Pac1() { oldX = x = MainClass.WIDTH / 2 - SIZE/2; oldY = y = (int) (MainClass.HEIGHT / 2 - 47); vX = 0; vY = 0; direction = Math.PI * 2; } public void update() { if (leftPressed) { vX = -1; vY = 0; } if (rightPressed) { vX = 1; vY = 0; } if (upPressed) { vY = -1; vX = 0; } if (downPressed) { vY = 1; vX = 0; } if(x == 201.5 && vX<0){ x = (int) 577.5; vX = -1; } if(x == 578.5 && getvX()>0){ x = (int) 202.5; vX = 1; } oldX = x; oldY = y; x += vX; y += vY; System.out.println(y); } public boolean hitWall(BufferedImage map){ int w = x; int z = y; Graphics g = map.getGraphics(); g.setColor(Color.red); if(vX<0){ //top left corner if(!new Color(map.getRGB(w - BUFFER, z - BUFFER)).equals(Color.black))return true; // left center if(!new Color(map.getRGB(w - BUFFER, z + SIZE/2)).equals(Color.black))return true; //bottom left corner if(!new Color(map.getRGB(w - BUFFER, z + SIZE + BUFFER)).equals(Color.black))return true; } if(vX>0){ //top right corner if(!new Color(map.getRGB(w + SIZE + BUFFER, z - BUFFER)).equals(Color.black))return true; // no wall at x y // right center if(!new Color(map.getRGB(w + SIZE + BUFFER, z + SIZE/2)).equals(Color.black))return true; //bottom right corner if(!new Color(map.getRGB(w + SIZE + BUFFER, z + SIZE + BUFFER)).equals(Color.black))return true; // no wall at x y } if(vY<0){ //top left corner if(!new Color(map.getRGB(w - BUFFER, z - BUFFER)).equals(Color.black))return true; // top center if(!new Color(map.getRGB(w + SIZE/2, z - BUFFER)).equals(Color.black))return true; //top right corner if(!new Color(map.getRGB(w + SIZE + BUFFER, z - BUFFER)).equals(Color.black))return true; } if(vY>0){ //bottom left corner if(!new Color(map.getRGB(w - BUFFER, z + SIZE + BUFFER)).equals(Color.black))return true; // bottom center if(!new Color(map.getRGB(w + SIZE/2, z + SIZE + BUFFER)).equals(Color.black))return true; //bottom right corner if(!new Color(map.getRGB(w + SIZE, z + SIZE + BUFFER)).equals(Color.black))return true; } return false; } public void draw1(Graphics g) { g.setColor(Color.PINK); g.drawOval(x, y, SIZE, SIZE); g.setColor(Color.BLACK); g.setColor(Color.red); } @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_RIGHT) { rightPressed = true; } if (e.getKeyCode() == KeyEvent.VK_LEFT) { leftPressed = true; } if (e.getKeyCode() == KeyEvent.VK_UP) { upPressed = true; } if (e.getKeyCode() == KeyEvent.VK_DOWN) { downPressed = true; } } @Override public void keyReleased(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_RIGHT) { rightPressed = false; } if (e.getKeyCode() == KeyEvent.VK_LEFT) { leftPressed = false; } if (e.getKeyCode() == KeyEvent.VK_UP) { upPressed = false; } if (e.getKeyCode() == KeyEvent.VK_DOWN) { downPressed = false; } } @Override public void keyTyped(KeyEvent arg0) { // TODO Auto-generated method stub } public double getvX() { return vX; } public double getvY() { return vY; } public void backUp() { x = oldX; y = oldY; } }
[ "clarkbw19@ccescavs.org" ]
clarkbw19@ccescavs.org
5aff088bb6396c7282d84c7acc8b635a934782c8
11fa8dcb980983e49877c52ed7e5713e0dca4aad
/tags/1.0.1/src/com/aof/service/admin/EmailManager.java
9e78a197a3d02a753b3413de9c56fd37ed8f24b8
[]
no_license
Novthirteen/oa-system
0262a6538aa023ededa1254c26c42bc19a70357c
c698a0c09bbd6b902700e9ccab7018470c538e70
refs/heads/master
2021-01-15T16:29:18.465902
2009-03-20T12:41:16
2009-03-20T12:41:16
null
0
0
null
null
null
null
GB18030
Java
false
false
4,981
java
/* ===================================================================== * * Copyright (c) Atos Origin INFORMATION TECHNOLOGY All rights reserved. * * ===================================================================== */ package com.aof.service.admin; import java.util.List; import java.util.Map; import com.aof.model.admin.Email; import com.aof.model.admin.EmailBatch; import com.aof.model.admin.Site; import com.aof.model.admin.User; import com.aof.model.admin.query.EmailQueryOrder; /** * 定义操作Email的接口 * * @author ych * @version 1.0 (Nov 13, 2005) */ public interface EmailManager { public static final String EMAIL_ROLE_APPROVER = "Approver"; public static final String EMAIL_ROLE_FINANCE = "Finance"; public static final String EMAIL_ROLE_HOTEL_MAINTAINER = "Hotel Maintainer"; public static final String EMAIL_ROLE_SUPPLIER_MAINTAINER = "Supplier Maintainer"; public static final String EMAIL_ROLE_PURCHASER = "Purchaser"; public static final String EMAIL_ROLE_REQUESTOR = "Requestor"; public static final String EMAIL_ROLE_CREATOR = "Creator"; public static final String EMAIL_ROLE_NOTIFIER = "Notifier"; public static final String EMAIL_ROLE_CITY_MAINTAINER = "City Maintainer"; public static final String EMAIL_ROLE_USER_MAINTAINER = "User Maintainer"; public static final String EMAIL_ROLE_INSPECTOR = "Inspector"; public static final String EMAIL_ROLE_RECEIVER = "Receiver"; public static final String EMAIL_ROLE_DELEGATE_APPROVER = "Delegate Approver"; /** * 从数据库取得指定id的Email * * @param id * Email的id * @return 返回指定的Email * @ */ public Email getEmail(Integer id) ; /** * 插入指定的Email对象到数据库 * * @param email * 要保存的Email对象 * @return 保存后的Email对象 * @ */ public Email insertEmail(Email email, String body) ; /** * 插入指定的Email对象到数据库 * * @param email * 要保存的Email对象 * @return 保存后的Email对象 * @ */ public EmailBatch insertEmailBatch(EmailBatch emailBatch, String body) ; /** * 更新指定的Email对象到数据库 * * @param email * 要更新的Email对象 * @param body * 要更新的Email对象的body * * @return 更新后的Email对象 * @ */ public Email updateEmail(Email email) ; /** * 返回符合查询条件的Email对象个数 * * @param conditions * 包含查询条件到条件值映射的Map,其中查询条件应该来自EmailQueryCondition类的预定义常量 * @return 符合查询条件的Email对象个数 * @ */ public int getEmailListCount(Map condtions) ; /** * 返回符合查询条件的Email对象列表 * * @param conditions * 包含查询条件到条件值映射的Map,其中查询条件应该来自EmailQueryCondition类的预定义常量 * @param pageNo * 第几页,以pageSize为页的大小,pageSize为-1时忽略该参数 * @param pageSize * 页的大小,-1表示不分页 * @param order * 排序条件,null表示不排序 * @param descend * false表示升序,true表示降序 * @return 符合查询条件的Email对象列表 * @ */ public List getEmailList(Map condtions, int pageNo, int pageSize, EmailQueryOrder order, boolean descend) ; /** * 将状态为等待发送的邮件发送 * */ public void sendEmail(); /** * 插入Email对象到数据库 * * @param from * Email的from * @param to * Email的to * @param subject * Email的subject * @param body * Email的body * @ */ public void insertEmail(Site site,String from, String to, String subject, String body) ; public void insertEmailBatch(Site site,String from, String to, String body,String batchEmailTemplateName,String refNo, User user); public void insertEmail(Site site,String to,String templateLocation,Map context) ; public void insertEmailBatch(Site site,String to,String templateLocation,String refNo,Map context,String batchEmailTemplateName) ; public void deleteEmailBatch(String refNo); public void updateEmailBatch(EmailBatch emailBatch); public EmailBatch findNotSendEmailBatchByRefNo(String refNo); /** * 将批量处理的Email插入数据库 * */ public void mailReminder(); public void sendBatchEmail(); }
[ "novthirteen@1ac4a774-0534-11de-a6e9-d320b29efae0" ]
novthirteen@1ac4a774-0534-11de-a6e9-d320b29efae0
d0e76f68ffcf6c99b892cf995b153d03cb7d3010
a7c98b61681bbcc05de6574c3f2ab694b1549ed4
/src/mainCode/Edible.java
60ff02019d33404be510dd73e8d37f8bd2e91a79
[]
no_license
pauleakd/ZooProject
1cc424ec1aea91aa33ea0d8ef8fa880d5dcce719
410375adb85c0d455a371f1aa66742d6133cef5a
refs/heads/master
2021-01-20T01:04:22.756490
2017-05-01T22:06:31
2017-05-01T22:06:31
89,218,198
0
0
null
null
null
null
UTF-8
Java
false
false
126
java
package mainCode; public interface Edible { boolean beEaten(int strength); int getNutritionalValue(); String getName(); }
[ "akramaite.paule@gmail.com" ]
akramaite.paule@gmail.com
78562f4bd8df284babf200ea3486093543f34dd4
8185646402807b9e97fa4226ddaf06fd0396761a
/src/com/tcs/reporter/bean/Column.java
b9aeb8e75406a9a5b972b93eae82d2cb5dbfd975
[]
no_license
zettre/Reporter
41c5a3fe34f7bfbb40e6bb7c19836b48b1859f52
3dcb14eff22075cbd880526df6ed627c9d163568
refs/heads/master
2020-04-10T21:42:21.480545
2018-12-11T08:48:45
2018-12-11T08:48:45
161,304,070
0
0
null
null
null
null
UTF-8
Java
false
false
510
java
package com.tcs.reporter.bean; public class Column { private String sqlName; private String displayName; private float width; public String getSqlName() { return sqlName; } public void setSqlName(String sqlName) { this.sqlName = sqlName; } public String getDisplayName() { return displayName; } public void setDisplayName(String displayName) { this.displayName = displayName; } public float getWidth() { return width; } public void setWidth(float width) { this.width = width; } }
[ "vaibhav.singhh1007@gmail.com" ]
vaibhav.singhh1007@gmail.com
c07d19589d10501d8bc0ead1351da97d2a3174a0
96a0aaea05f39f4c2b970d7f30a55270c5b5171f
/src/main/java/org/codelibs/elasticsearch/search/aggregations/metrics/InternalNumericMetricsAggregation.java
8ba8069dbd2aefede938c3769fea500da773aa52
[]
no_license
codelibs/elasticsearch-querybuilders
88554ba10e694a0b4418b1045d64fe9f3c31c0aa
4fe5687e2aead4f02adb0ecf2c85288f40ec1f15
refs/heads/master
2023-03-22T04:36:41.422859
2017-09-14T13:07:55
2017-09-14T13:07:55
82,253,963
9
10
null
2017-03-22T12:36:54
2017-02-17T03:39:10
Java
UTF-8
Java
false
false
3,741
java
/* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch 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.codelibs.elasticsearch.search.aggregations.metrics; import org.codelibs.elasticsearch.common.io.stream.StreamInput; import org.codelibs.elasticsearch.search.DocValueFormat; import org.codelibs.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.util.List; import java.util.Map; /** * */ public abstract class InternalNumericMetricsAggregation extends InternalMetricsAggregation { private static final DocValueFormat DEFAULT_FORMAT = DocValueFormat.RAW; protected DocValueFormat format = DEFAULT_FORMAT; public abstract static class SingleValue extends InternalNumericMetricsAggregation implements NumericMetricsAggregation.SingleValue { protected SingleValue(String name, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) { super(name, pipelineAggregators, metaData); } /** * Read from a stream. */ protected SingleValue(StreamInput in) throws IOException { super(in); } @Override public String getValueAsString() { return format.format(value()); } @Override public Object getProperty(List<String> path) { if (path.isEmpty()) { return this; } else if (path.size() == 1 && "value".equals(path.get(0))) { return value(); } else { throw new IllegalArgumentException("path not supported for [" + getName() + "]: " + path); } } } public abstract static class MultiValue extends InternalNumericMetricsAggregation implements NumericMetricsAggregation.MultiValue { protected MultiValue(String name, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) { super(name, pipelineAggregators, metaData); } /** * Read from a stream. */ protected MultiValue(StreamInput in) throws IOException { super(in); } public abstract double value(String name); public String valueAsString(String name) { return format.format(value(name)); } @Override public Object getProperty(List<String> path) { if (path.isEmpty()) { return this; } else if (path.size() == 1) { return value(path.get(0)); } else { throw new IllegalArgumentException("path not supported for [" + getName() + "]: " + path); } } } private InternalNumericMetricsAggregation(String name, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) { super(name, pipelineAggregators, metaData); } /** * Read from a stream. */ protected InternalNumericMetricsAggregation(StreamInput in) throws IOException { super(in); } }
[ "shinsuke@yahoo.co.jp" ]
shinsuke@yahoo.co.jp
821ebcbffb4f9ed4d899d68fccec386bdb77ff15
f85ae8c83b9b5b99ecb2ad35fd222164008dac6d
/app/src/main/java/com/appGarrage/search/utils/FileUtils.java
cdfbff9530fc3519c63b981d40ae74b1918d64cf
[]
no_license
Charle12/SearchDemo
9df5f694826bed09748f30bcc1d8d8d25e3f7ca5
6703465e62556b826a19909995bff1eba9b46517
refs/heads/master
2022-12-16T04:20:01.393429
2020-09-09T14:37:09
2020-09-09T14:37:09
294,125,949
0
0
null
null
null
null
UTF-8
Java
false
false
19,469
java
package com.appGarrage.search.utils; import android.annotation.SuppressLint; import android.content.Context; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Matrix; import android.media.ExifInterface; import android.net.Uri; import android.os.Environment; import android.provider.OpenableColumns; import android.util.Log; import com.appGarrage.search.R; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.nio.channels.FileChannel; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.Objects; public class FileUtils { private static final int EOF = -1; private static final int DEFAULT_BUFFER_SIZE = 1024 * 4; private static final String JPEG_FILE_SUFFIX = ".jpg"; static int COMPRESSED_IMAGE_WIDTH = 1450; static int COMPRESSED_IMAGE_HEIGHT = 900; static int COMPRESSED_IMAGE_QUALITY = 90; private FileUtils() { } public static File mergeFile(ArrayList<File> files){ for (int i=0; i< files.size(); i++){ } return null ; } /** * @param imageFile {@link File} * @param reqWidth int * @param reqHeight int * @return Bitmap */ static Bitmap decodeSampledBitmapFromFile(File imageFile, int reqWidth, int reqHeight) { // First decode with inJustDecodeBounds=true to checkpictureFile dimensions BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeFile(imageFile.getAbsolutePath(), options); // Calculate inSampleSize options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight); // Decode bitmap with inSampleSize set options.inJustDecodeBounds = false; Bitmap scaledBitmap = BitmapFactory.decodeFile(imageFile.getAbsolutePath(), options); Matrix matrix = new Matrix(); int orientation = getOrientation(imageFile.getAbsolutePath()); matrix.postRotate(orientation); if (scaledBitmap != null) { scaledBitmap = Bitmap.createBitmap(scaledBitmap, 0, 0, scaledBitmap.getWidth(), scaledBitmap.getHeight(), matrix, true); } return scaledBitmap; } public static File from(Context context, Uri uri) throws IOException { InputStream inputStream = context.getContentResolver().openInputStream(uri); String fileName = getFileName(context, uri); String[] splitName = splitFileName(fileName); File tempFile = File.createTempFile(splitName[0], splitName[1]); tempFile = rename(tempFile, fileName); tempFile.deleteOnExit(); FileOutputStream out = null; try { out = new FileOutputStream(tempFile); } catch (FileNotFoundException e) { e.printStackTrace(); } if (inputStream != null) { copy(inputStream, out); inputStream.close(); } if (out != null) { out.close(); } return tempFile; } private static String[] splitFileName(String fileName) { String name = fileName; String extension = ""; int i = fileName.lastIndexOf("."); if (i != -1) { name = fileName.substring(0, i); extension = fileName.substring(i); } return new String[]{name, extension}; } private static String getFileName(Context context, Uri uri) { String result = null; //noinspection ConstantConditions if (uri.getScheme().equals("content")) { try (Cursor cursor = context.getContentResolver().query(uri, null, null, null, null)) { if (cursor != null && cursor.moveToFirst()) { result = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)); } } catch (Exception e) { e.printStackTrace(); } } if (result == null) { result = uri.getPath(); assert result != null; int cut = result.lastIndexOf(File.separator); if (cut != -1) { result = result.substring(cut + 1); } } return result; } private static File rename(File file, String newName) { File newFile = new File(file.getParent(), newName); if (!newFile.equals(file)) { if (newFile.exists() && newFile.delete()) { Log.d("FileUtils", "Delete old " + newName + " file"); } if (file.renameTo(newFile)) { Log.d("FileUtils", "Rename file to " + newName); } } return newFile; } private static File compressedPath; public static double getFileSizeInMb(File file) { try { if (file != null) { // Get length of file in bytes double fileSizeInBytes = file.length(); // Convert the bytes to Kilobytes (1 KB = 1024 Bytes) double fileSizeInKB = fileSizeInBytes / 1024; // Convert the KB to MegaBytes (1 MB = 1024 KBytes) Log.e("fileSizeInMB", "" + fileSizeInKB / 1024); return fileSizeInKB / 1024; } else { return -1; } } catch (Exception e) { e.printStackTrace(); return -1; } } private static void copy(InputStream input, OutputStream output) throws IOException { int n; byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; while (EOF != (n = input.read(buffer))) { output.write(buffer, 0, n); } } public static void copyFile(File source, File dest) { if (source != null && dest != null) { try (FileChannel sourceChannel = new FileInputStream(source).getChannel(); FileChannel destChannel = new FileOutputStream(dest).getChannel()) { destChannel.transferFrom(sourceChannel, 0, sourceChannel.size()); } catch (IOException e) { e.printStackTrace(); } } } public static void deleteFile(String path) { File file = new File(path); deleteFile(file); } @SuppressWarnings("ResultOfMethodCallIgnored") public static void deleteFile(File file) { try { if (file.exists()) { if (file.isDirectory()) { File[] files = file.listFiles(); for (File file1 : files) { if (file1.isDirectory()) { deleteFile(file1); } else { file1.delete(); } } } file.delete(); } } catch (Exception ex) { ex.printStackTrace(); } } public static File compressFile(Context context, File originalFile) { try { return new Compressor(context) .setMaxWidth(COMPRESSED_IMAGE_WIDTH) .setMaxHeight(COMPRESSED_IMAGE_HEIGHT) .setQuality(COMPRESSED_IMAGE_QUALITY) .setCompressFormat(Bitmap.CompressFormat.JPEG) .setDestinationDirectoryPath(compressedPath.getAbsolutePath()) .compressToFile(originalFile); } catch (IOException e) { e.printStackTrace(); } return null; } static File compressFileWithName(Context context, File originalFile, String name) { try { return new Compressor(context) .setMaxWidth(COMPRESSED_IMAGE_WIDTH) .setMaxHeight(COMPRESSED_IMAGE_HEIGHT) .setQuality(COMPRESSED_IMAGE_QUALITY) .setCompressFormat(Bitmap.CompressFormat.JPEG) .setDestinationDirectoryPath(compressedPath.getAbsolutePath()) .compressToFile(originalFile, name); } catch (IOException e) { e.printStackTrace(); } return null; } private static File getAlbumDir(Context mContext, String imageID) { File storageDir; File appointmentDir = null; if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) { // Check that the SDCard is mounted storageDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), mContext.getString(R.string.app_name)); if (!storageDir.mkdirs()) { if (!storageDir.exists()) { return null; } } appointmentDir = new File(storageDir, imageID); if (!appointmentDir.mkdirs()) { if (!appointmentDir.exists()) { return null; } } compressedPath = new File(appointmentDir, imageID); if (!compressedPath.mkdir()) { if (!compressedPath.exists()) { return null; } } createNoMedia("/" + mContext.getString(R.string.app_name) + "/" + imageID + "/.nomedia"); } return appointmentDir; } private static void createNoMedia(String path) { File fileNoMedia = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + path); try { if (!fileNoMedia.exists()) //noinspection ResultOfMethodCallIgnored fileNoMedia.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } public static File createImageFile(Context context, String imageID) { // Create an image file name @SuppressLint("SimpleDateFormat") String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); String imageFileName = "IMG_" + timeStamp; File albumF = getAlbumDir(context, imageID); // using File.createTempFile create 0 mb size file return new File(albumF, imageFileName + JPEG_FILE_SUFFIX); } /** * compress related methods * * @param imageFile {@link File} * @param reqWidth int * @param reqHeight int * @param compressFormat enum * @param quality int * @param destinationPath {@link String} * @return File */ static File compressImage(File imageFile, int reqWidth, int reqHeight, Bitmap.CompressFormat compressFormat, int quality, String destinationPath) throws IOException { FileOutputStream fileOutputStream = null; File file = new File(destinationPath).getParentFile(); if (!file.exists()) { //noinspection ResultOfMethodCallIgnored file.mkdirs(); } try { fileOutputStream = new FileOutputStream(destinationPath); // write the compressed bitmap at the destination specified by destinationPath. Bitmap bitmap = decodeSampledBitmapFromFile(imageFile, reqWidth, reqHeight); if (bitmap != null) { bitmap.compress(compressFormat, quality, fileOutputStream); } } finally { if (fileOutputStream != null) { fileOutputStream.flush(); fileOutputStream.close(); } } return new File(destinationPath); } public static int getOrientation(String filePath) { //check the rotation of the image and display it properly ExifInterface exif; // Matrix matrix = new Matrix(); try { exif = new ExifInterface(filePath); } catch (IOException e) { e.printStackTrace(); return 0; } int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); if (orientation == ExifInterface.ORIENTATION_ROTATE_90) { return 90; // matrix.postRotate(90); } else if (orientation == ExifInterface.ORIENTATION_ROTATE_180) { return 180; // matrix.postRotate(180); } else if (orientation == ExifInterface.ORIENTATION_ROTATE_270) { return 270; // matrix.postRotate(270); } return 0; } public static Bitmap rotate(Bitmap bitmap, int degrees) { if (degrees != 0 && bitmap != null) { Matrix m = new Matrix(); m.setRotate(degrees, (float) bitmap.getWidth() / 2, (float) bitmap.getHeight() / 2); try { Bitmap converted = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), m, true); if (bitmap != converted) { bitmap.recycle(); bitmap = converted; } } catch (OutOfMemoryError ex) { // if out of memory, return original bitmap } } return bitmap; } /** * @param options {@link BitmapFactory.Options} * @param reqWidth int * @param reqHeight int * @return int */ private static int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) { // Raw height and width of image final int height = options.outHeight; final int width = options.outWidth; int inSampleSize = 1; if (height > reqHeight || width > reqWidth) { final int halfHeight = height / 2; final int halfWidth = width / 2; // Calculate the largest inSampleSize value that is a power of 2 and keeps both // height and width larger than the requested height and width. while ((halfHeight / inSampleSize) >= reqHeight && (halfWidth / inSampleSize) >= reqWidth) { inSampleSize *= 2; } } return inSampleSize; } public static String getImagePathFromInputStreamUri(Uri uri, Context pContext) { InputStream inputStream = null; String filePath = null; if (uri.getAuthority() != null) { try { inputStream = pContext.getContentResolver().openInputStream(uri); // context needed File photoFile = createTemporalFileFrom(inputStream, pContext); filePath = photoFile.getPath(); } catch (IOException e) { // log } finally { try { assert inputStream != null; inputStream.close(); } catch (IOException e) { e.printStackTrace(); } } } return filePath; } private static File createTemporalFileFrom(InputStream inputStream, Context pContext) throws IOException { File targetFile = null; if (inputStream != null) { int read; byte[] buffer = new byte[8 * 1024]; targetFile = createTemporalFile(pContext); OutputStream outputStream = new FileOutputStream(targetFile); while ((read = inputStream.read(buffer)) != -1) { outputStream.write(buffer, 0, read); } outputStream.flush(); try { outputStream.close(); } catch (IOException e) { e.printStackTrace(); } } return targetFile; } private static File createTemporalFile(Context pContext) { return new File(pContext.getExternalCacheDir(), "tempFile.jpg"); // context needed } public static File createFileFromBitmap(File sourceFile, Bitmap bitmap) { if (bitmap == null) return null; try { FileOutputStream oStream = new FileOutputStream(sourceFile); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, oStream); oStream.flush(); oStream.close(); } catch (IOException e) { e.printStackTrace();//https://docs.google.com/spreadsheets/d/1OhqiTBo7wRaPs6E3SdSJfUZIJdJLTWIs78NMiyC8wfM/edit?ts=5b92a79c#gid=0 Log.i("TAG", "There was an issue saving the image."); } getFileSizeInMb(sourceFile); return sourceFile; } public static Bitmap getBitmapFromPath(String absoluteFilePath) { try { return getResizedBitmap(BitmapFactory.decodeFile(absoluteFilePath)); } catch (Exception e) { e.printStackTrace(); } return null; } public static Bitmap getBitmap(ArrayList<String> imagePaths) { int count = 0; // Bitmap bitmap=getBitmapFromPath(imagePaths.get(0)); Bitmap bitmap = getBitmapFromPath(imagePaths.get(count)); count++; // imagePaths.remove(0); while (imagePaths.size() > count) { assert bitmap != null; try { bitmap = createSingleImageFromMultipleImages(bitmap, Objects.requireNonNull(getBitmapFromPath(imagePaths.get(count)))); } catch (Exception e) { e.printStackTrace(); } count++; //imagePaths.remove(0); } return bitmap; } private static Bitmap createSingleImageFromMultipleImages(Bitmap firstImage, Bitmap secondImage) { /* firstImage=getResizedBitmap(firstImage, 1080, 720); secondImage=getResizedBitmap(secondImage, 1080, 720);*/ int WIDTH_IMAGE = Math.max(firstImage.getWidth(), secondImage.getWidth()); int HIGHT_IMAGE = firstImage.getHeight() + secondImage.getHeight(); Bitmap result = Bitmap.createBitmap(WIDTH_IMAGE, HIGHT_IMAGE, firstImage.getConfig()); Canvas canvas = new Canvas(result); canvas.drawBitmap(firstImage, 0f, 0f, null); canvas.drawBitmap(secondImage, 10, firstImage.getHeight() + 10, null); result = getResizedBitmap(result); return result; } private static Bitmap getResizedBitmap(Bitmap bm) { try { int width = bm.getWidth(); int height = bm.getHeight(); float scaleWidth = ((float) 720) / width; scaleWidth = scaleWidth < 1 ? scaleWidth : 1; // float scaleHeight = ((float) newHeight) / height; // create a matrix for the manipulation Matrix matrix = new Matrix(); // resize the bit map matrix.postScale(scaleWidth, scaleWidth); // recreate the new Bitmap return Bitmap.createBitmap(bm, 0, 0, width, height, matrix, false); } catch (Exception e) { e.printStackTrace(); } return null; } public static File mergeFiles(ArrayList<File> files, Context context){ ArrayList<String> paths = new ArrayList<>(); for (int i=0; i< files.size(); i++){ paths.add(files.get(i).getAbsolutePath()); } Bitmap bitmap= getBitmap(paths); return createFileFromBitmap(createTemporalFile(context), bitmap); } }
[ "59354213+CharleMeenuPrabhat@users.noreply.github.com" ]
59354213+CharleMeenuPrabhat@users.noreply.github.com
dc1da42117ae8bc9e20d6f33469aa91cda00abb0
5e1d16f6f1127ea69a6c7b25725287a04a1c5d04
/src/main/java/com/spring/repository/CodeHistRepository.java
f2d2bc61a3c9a371f4ac1618a1c0de1e7dea9003
[]
no_license
ycharki-do/springboot_backend
d7dc26489f1e4dd624a6b0b9c16d14d84fcdc948
378fb63ca06ded3c38e259729be255cf032ccd48
refs/heads/master
2020-12-30T05:02:05.239332
2020-02-20T16:39:30
2020-02-20T16:39:30
238,868,963
0
0
null
null
null
null
UTF-8
Java
false
false
468
java
package com.spring.repository; import com.spring.model.*; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import java.util.List; @Transactional @Repository public interface CodeHistRepository extends JpaRepository<HistCode, Integer> { List<HistCode> findByCode(Code code); List<HistCode> findByReference(Reference reference); }
[ "youssf@gmal.com" ]
youssf@gmal.com
c519b365555ae4a6ec00eac754339da303da183b
74dd63d7d113e2ff3a41d7bb4fc597f70776a9d9
/timss-attendance/src/main/java/com/timss/attendance/scheduler/StatScheduler.java
923b11f6d403b4ab36126ae15dd0401bd7c523b8
[]
no_license
gspandy/timssBusiSrc
989c7510311d59ec7c9a2bab3b04f5303150d005
a5d37a397460a7860cc221421c5f6e31b48cac0f
refs/heads/master
2023-08-14T02:14:21.232317
2017-02-16T07:18:21
2017-02-16T07:18:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,119
java
package com.timss.attendance.scheduler; import java.util.ArrayList; import java.util.Calendar; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import com.timss.attendance.dao.StatDao; import com.timss.attendance.service.StatService; import com.timss.attendance.vo.StatVo; import com.yudean.itc.dto.Page; import com.yudean.itc.dto.sec.SecureUser; import com.yudean.itc.manager.sec.ISecurityMaintenanceManager; import com.yudean.mvc.bean.userinfo.UserInfo; import com.yudean.mvc.handler.ThreadLocalHandler; import com.yudean.mvc.service.ItcMvcService; /** * * @title: 考勤统计定时任务 * @description: {desc} * @company: gdyd * @className: StatScheduler.java * @author: fengzt * @createDate: 2014年10月17日 * @updateUser: fengzt * @version: 1.0 */ @Component @Lazy(false) public class StatScheduler { private Logger log = LoggerFactory.getLogger( StatScheduler.class ); @Autowired private StatService statService; @Autowired private ItcMvcService itcMvcService; @Autowired private StatDao statDao; @Autowired private ISecurityMaintenanceManager iSecurityMaintenanceManager; /** * * @description:每年定时任务更新整个考勤统计--ITC * @author: fengzt * @createDate: 2014年10月17日: */ //@Scheduled(cron = " 2 1 0 1 1 ? ") //@Scheduled(cron = "2/30 * * * * ? ") public void countStatData() throws Exception{ UserInfo userInfo = itcMvcService.getUserInfo( "890147", "ITC" ); ThreadLocalHandler.createNewVarableOweUserInfo( userInfo ); statService.countStatData( ); } /** * * @description:每年定时任务更新整个考勤统计--湛江风电 * @author: fengzt * @createDate: 2014年10月17日: */ //@Scheduled(cron = " 2 1 0 1 1 ? ") //@Scheduled(cron = "2/30 * * * * ? ") public void countZJWStatData() throws Exception{ UserInfo userInfo = itcMvcService.getUserInfo( "180811", "ZJW" ); ThreadLocalHandler.createNewVarableOweUserInfo( userInfo ); statService.countStatData( ); } //@Scheduled(cron = " 2 1 0 1 1 ? ") //@Scheduled(cron = "0 8 16 * * ? ") public void countSWFStatData() throws Exception{ UserInfo userInfo = itcMvcService.getUserInfo( "880040", "SWF" ); ThreadLocalHandler.createNewVarableOweUserInfo( userInfo ); statService.countStatData( ); } /** * * @description:人员不存在更新人员考勤统计状态 * @author: fengzt * @createDate: 2014年10月17日: */ //@Scheduled(cron = "2/30 * * * * ? ") //@Scheduled(cron = "0 0 3 * * ?") //@Scheduled(cron = "0 50 9 * * ?") public void updateITCStatStatus() throws Exception{ //需要更新人员状态的列表 Map<String, String> map = new HashMap<String, String>(); map.put( "ITC", "890147" ); map.put( "ZJW", "180811" ); map.put( "SWF", "880040" ); Set<String> siteSet = map.keySet(); //需要更新用户状态的列表 List<StatVo> uList = new ArrayList<StatVo>(); for( String siteId : siteSet ){ UserInfo userInfo = itcMvcService.getUserInfo( map.get( siteId ), siteId ); ThreadLocalHandler.createNewVarableOweUserInfo( userInfo ); Map<String, Object> paramMap = new HashMap<String, Object>(); int year = Calendar.getInstance().get( Calendar.YEAR ); paramMap.put( "year", year ); paramMap.put( "siteId", userInfo.getSiteId() ); //考勤统计人员数据 List<StatVo> statList = statDao.queryAllStat( paramMap ); //站点下所有用户信息u Page<SecureUser> pageVo = new Page<SecureUser>( 1, 99999 ); SecureUser secureUser = new SecureUser(); secureUser.setCurrentSite( siteId ); secureUser.setId( map.get( siteId ) ); pageVo.setParameter( "userStatus", "Y" ); Page<SecureUser> userList = iSecurityMaintenanceManager.retrieveUniqueUsers( pageVo, secureUser ); List<SecureUser> personList = userList.getResults(); //比对用户 for( StatVo vo : statList ){ String userId = vo.getUserId(); boolean flag = false; for( SecureUser u : personList ){ if( StringUtils.equals( u.getId(), userId )){ flag = true; break; } } //加入离职列表 if( !flag ){ StatVo temp = new StatVo(); temp.setUserId( userId ); temp.setYearLeave( year ); temp.setUserStatus( "离职" ); uList.add( temp ); } } } //批量更新 if( uList.size() > 0 ){ int count = statService.updateBatchStatStatus( uList ); log.info( "每日定时更新考勤统计的用户数量是:" + count + " ; 明细:" + uList.toString() ); } } @Scheduled(cron = "0 10 0 * * ?") public void checkStat() throws Exception{ log.info("statScheduler.checkStat start"); String[]checkSites=new String[]{"SWF","ITC","ZJW","DPP"}; for (String siteId : checkSites) { log.info("statScheduler.checkStat->"+siteId); statService.checkPersonStat(false,false,siteId, null,null,null); } log.info("statScheduler.checkStat finish"); } }
[ "londalonda@qq.com" ]
londalonda@qq.com
518f917c1e193367c69ff5b544a29d07ed2385bd
bf2966abae57885c29e70852243a22abc8ba8eb0
/aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/DescribeAddressesAttributeRequest.java
8daa3effee407d830199fa82effe1e0aa444d2b9
[ "Apache-2.0" ]
permissive
kmbotts/aws-sdk-java
ae20b3244131d52b9687eb026b9c620da8b49935
388f6427e00fb1c2f211abda5bad3a75d29eef62
refs/heads/master
2021-12-23T14:39:26.369661
2021-07-26T20:09:07
2021-07-26T20:09:07
246,296,939
0
0
Apache-2.0
2020-03-10T12:37:34
2020-03-10T12:37:33
null
UTF-8
Java
false
false
11,249
java
/* * Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.ec2.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.AmazonWebServiceRequest; import com.amazonaws.Request; import com.amazonaws.services.ec2.model.transform.DescribeAddressesAttributeRequestMarshaller; /** * */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class DescribeAddressesAttributeRequest extends AmazonWebServiceRequest implements Serializable, Cloneable, DryRunSupportedRequest<DescribeAddressesAttributeRequest> { /** * <p> * [EC2-VPC] The allocation IDs. * </p> */ private com.amazonaws.internal.SdkInternalList<String> allocationIds; /** * <p> * The attribute of the IP address. * </p> */ private String attribute; /** * <p> * The token for the next page of results. * </p> */ private String nextToken; /** * <p> * The maximum number of results to return with a single call. To retrieve the remaining results, make another call * with the returned <code>nextToken</code> value. * </p> */ private Integer maxResults; /** * <p> * [EC2-VPC] The allocation IDs. * </p> * * @return [EC2-VPC] The allocation IDs. */ public java.util.List<String> getAllocationIds() { if (allocationIds == null) { allocationIds = new com.amazonaws.internal.SdkInternalList<String>(); } return allocationIds; } /** * <p> * [EC2-VPC] The allocation IDs. * </p> * * @param allocationIds * [EC2-VPC] The allocation IDs. */ public void setAllocationIds(java.util.Collection<String> allocationIds) { if (allocationIds == null) { this.allocationIds = null; return; } this.allocationIds = new com.amazonaws.internal.SdkInternalList<String>(allocationIds); } /** * <p> * [EC2-VPC] The allocation IDs. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setAllocationIds(java.util.Collection)} or {@link #withAllocationIds(java.util.Collection)} if you want * to override the existing values. * </p> * * @param allocationIds * [EC2-VPC] The allocation IDs. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeAddressesAttributeRequest withAllocationIds(String... allocationIds) { if (this.allocationIds == null) { setAllocationIds(new com.amazonaws.internal.SdkInternalList<String>(allocationIds.length)); } for (String ele : allocationIds) { this.allocationIds.add(ele); } return this; } /** * <p> * [EC2-VPC] The allocation IDs. * </p> * * @param allocationIds * [EC2-VPC] The allocation IDs. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeAddressesAttributeRequest withAllocationIds(java.util.Collection<String> allocationIds) { setAllocationIds(allocationIds); return this; } /** * <p> * The attribute of the IP address. * </p> * * @param attribute * The attribute of the IP address. * @see AddressAttributeName */ public void setAttribute(String attribute) { this.attribute = attribute; } /** * <p> * The attribute of the IP address. * </p> * * @return The attribute of the IP address. * @see AddressAttributeName */ public String getAttribute() { return this.attribute; } /** * <p> * The attribute of the IP address. * </p> * * @param attribute * The attribute of the IP address. * @return Returns a reference to this object so that method calls can be chained together. * @see AddressAttributeName */ public DescribeAddressesAttributeRequest withAttribute(String attribute) { setAttribute(attribute); return this; } /** * <p> * The attribute of the IP address. * </p> * * @param attribute * The attribute of the IP address. * @return Returns a reference to this object so that method calls can be chained together. * @see AddressAttributeName */ public DescribeAddressesAttributeRequest withAttribute(AddressAttributeName attribute) { this.attribute = attribute.toString(); return this; } /** * <p> * The token for the next page of results. * </p> * * @param nextToken * The token for the next page of results. */ public void setNextToken(String nextToken) { this.nextToken = nextToken; } /** * <p> * The token for the next page of results. * </p> * * @return The token for the next page of results. */ public String getNextToken() { return this.nextToken; } /** * <p> * The token for the next page of results. * </p> * * @param nextToken * The token for the next page of results. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeAddressesAttributeRequest withNextToken(String nextToken) { setNextToken(nextToken); return this; } /** * <p> * The maximum number of results to return with a single call. To retrieve the remaining results, make another call * with the returned <code>nextToken</code> value. * </p> * * @param maxResults * The maximum number of results to return with a single call. To retrieve the remaining results, make * another call with the returned <code>nextToken</code> value. */ public void setMaxResults(Integer maxResults) { this.maxResults = maxResults; } /** * <p> * The maximum number of results to return with a single call. To retrieve the remaining results, make another call * with the returned <code>nextToken</code> value. * </p> * * @return The maximum number of results to return with a single call. To retrieve the remaining results, make * another call with the returned <code>nextToken</code> value. */ public Integer getMaxResults() { return this.maxResults; } /** * <p> * The maximum number of results to return with a single call. To retrieve the remaining results, make another call * with the returned <code>nextToken</code> value. * </p> * * @param maxResults * The maximum number of results to return with a single call. To retrieve the remaining results, make * another call with the returned <code>nextToken</code> value. * @return Returns a reference to this object so that method calls can be chained together. */ public DescribeAddressesAttributeRequest withMaxResults(Integer maxResults) { setMaxResults(maxResults); return this; } /** * This method is intended for internal use only. Returns the marshaled request configured with additional * parameters to enable operation dry-run. */ @Override public Request<DescribeAddressesAttributeRequest> getDryRunRequest() { Request<DescribeAddressesAttributeRequest> request = new DescribeAddressesAttributeRequestMarshaller().marshall(this); request.addParameter("DryRun", Boolean.toString(true)); return request; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getAllocationIds() != null) sb.append("AllocationIds: ").append(getAllocationIds()).append(","); if (getAttribute() != null) sb.append("Attribute: ").append(getAttribute()).append(","); if (getNextToken() != null) sb.append("NextToken: ").append(getNextToken()).append(","); if (getMaxResults() != null) sb.append("MaxResults: ").append(getMaxResults()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DescribeAddressesAttributeRequest == false) return false; DescribeAddressesAttributeRequest other = (DescribeAddressesAttributeRequest) obj; if (other.getAllocationIds() == null ^ this.getAllocationIds() == null) return false; if (other.getAllocationIds() != null && other.getAllocationIds().equals(this.getAllocationIds()) == false) return false; if (other.getAttribute() == null ^ this.getAttribute() == null) return false; if (other.getAttribute() != null && other.getAttribute().equals(this.getAttribute()) == false) return false; if (other.getNextToken() == null ^ this.getNextToken() == null) return false; if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == false) return false; if (other.getMaxResults() == null ^ this.getMaxResults() == null) return false; if (other.getMaxResults() != null && other.getMaxResults().equals(this.getMaxResults()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getAllocationIds() == null) ? 0 : getAllocationIds().hashCode()); hashCode = prime * hashCode + ((getAttribute() == null) ? 0 : getAttribute().hashCode()); hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode()); hashCode = prime * hashCode + ((getMaxResults() == null) ? 0 : getMaxResults().hashCode()); return hashCode; } @Override public DescribeAddressesAttributeRequest clone() { return (DescribeAddressesAttributeRequest) super.clone(); } }
[ "" ]
4a6032188daa5683159b7112e1a6311cb1b7ad99
a666c798a28223f97d74d21786f9a4f4000d5acb
/edu.harvard.i2b2.fr/gensrc/edu/harvard/i2b2/fr/datavo/pm/GetUserConfigurationType.java
01412e46690179e431283dbd71060d4b91ad4b77
[]
no_license
gmacdonnell/i2b2-fsu-1704
d65239edf95aa3b25844a6ed9af599e06dcaa185
12638996fe46a7014ac827e359c40e5b0e8c1d3e
refs/heads/master
2021-01-23T07:02:31.537241
2015-01-27T15:09:33
2015-01-27T15:09:33
29,916,117
0
0
null
null
null
null
UTF-8
Java
false
false
3,243
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-558 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2015.01.26 at 12:45:44 PM EST // package edu.harvard.i2b2.fr.datavo.pm; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for get_user_configurationType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="get_user_configurationType"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="project" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/> * &lt;element name="data_needed" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "get_user_configurationType", propOrder = { "project", "dataNeeded" }) public class GetUserConfigurationType { protected List<String> project; @XmlElement(name = "data_needed") protected List<String> dataNeeded; /** * Gets the value of the project 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 project property. * * <p> * For example, to add a new item, do as follows: * <pre> * getProject().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link String } * * */ public List<String> getProject() { if (project == null) { project = new ArrayList<String>(); } return this.project; } /** * Gets the value of the dataNeeded 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 dataNeeded property. * * <p> * For example, to add a new item, do as follows: * <pre> * getDataNeeded().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link String } * * */ public List<String> getDataNeeded() { if (dataNeeded == null) { dataNeeded = new ArrayList<String>(); } return this.dataNeeded; } }
[ "gmacdonnell@fsu.edu" ]
gmacdonnell@fsu.edu
110ecfba5245db93c383917172e9f881df2d3726
12e6a556d415277a8b4fd676f7d524b3889843c4
/sy3/src/Q2.java
01e85f75b1376462d3bbaa91fe339a95c23337aa
[]
no_license
Innei/Java-experiment
e753948e24118a4f2669a76072d581528fac25bc
9df00c652b3a1db40bf3139a4bd161671790a3ec
refs/heads/master
2020-08-02T10:58:31.021506
2019-09-29T08:35:05
2019-09-29T08:35:05
211,326,646
0
0
null
null
null
null
UTF-8
Java
false
false
810
java
public class Q2 { public static void main(String[] args) { first f = new first(); f.allprime(1,10); } } class first { boolean prime(int n) {//该方法为判断n是否为素数 boolean flag = true; if (n < 2) {// 素数不小于2 return false; } else { for (int i = 2; i <= Math.sqrt(n); i++) { if (n % i == 0) {// 若能被整除,则说明不是素数,返回false flag = false; break;// 跳出循环 } } } return flag; } void allprime(int m, int n) { for (int i = m; i < n; i++) { if (prime(i)) System.out.println(i); } }//利用前一个方法求出 m到n之间的所有素数} }
[ "tukon479@gmail.com" ]
tukon479@gmail.com
5e5360a2832ac9216dab093e3714ed5291fc31e1
5ff0ecdd24e7c2f237f335bcb80d82296f79dcb4
/app/src/main/java/com/wzy/vitamiot/VideoTV.java
21abe535eb6b7cabfc52527c475c9d4ad4419b95
[]
no_license
xiangtongfan/FelixonlineTV-master
58942935707fabd81204b2b18bdf182391a372f4
60e0f4ab8d087cdf638202f30915a32dd82b94e2
refs/heads/master
2021-01-22T17:29:56.189299
2016-07-30T11:01:46
2016-07-30T11:01:46
64,412,277
0
0
null
null
null
null
UTF-8
Java
false
false
7,591
java
package com.wzy.vitamiot; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.AppCompatActivity; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.View; import android.view.WindowManager; import android.widget.AdapterView; import android.widget.Button; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.ProgressBar; import android.widget.TextView; import com.google.gson.Gson; import com.wzy.vitamiot.adapters.TVAdapter; import com.wzy.vitamiot.model.TVModel; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import io.vov.vitamio.MediaPlayer; import io.vov.vitamio.Vitamio; import io.vov.vitamio.widget.MediaController; import io.vov.vitamio.widget.VideoView; public class VideoTV extends AppCompatActivity implements AdapterView.OnItemClickListener, View.OnClickListener, MediaPlayer.OnInfoListener, MediaPlayer.OnBufferingUpdateListener { private VideoView vv; private String url; private LinearLayout drawer; private DrawerLayout dr_ly; private ListView lv2; private TVAdapter adapter; private List<TVModel.TvListEntity> tvListEntities; private Button p1; private Button p2; private Button p3; private Button p4; private Button p5; private LinearLayout drawer_right; private ProgressBar probar; private TextView download_rate; private TextView load_rate; private GestureDetector mGestureDetector; private int mLayout = VideoView.VIDEO_LAYOUT_ZOOM; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Vitamio.isInitialized(this); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_video_tv); initView(); vplay(); initData(); } private void initData() { Gson gson = new Gson(); TVModel tvModel = gson.fromJson(loadJSONFromAsset(), TVModel.class); tvListEntities = tvModel.getTv_list(); adapter.updateRes(tvListEntities); } public String loadJSONFromAsset() { String json = null; try { InputStream is = this.getAssets().open("tv.json"); int size = is.available(); byte[] buffer = new byte[size]; is.read(buffer); is.close(); json = new String(buffer, "UTF-8"); } catch (IOException ex) { ex.printStackTrace(); return null; } return json; } private void initView() { vv = (VideoView) findViewById(R.id.vv); Intent intent = getIntent(); url = intent.getStringExtra("url"); vv.setMediaController(new MediaController(this)); drawer = (LinearLayout) findViewById(R.id.drawer); dr_ly = (DrawerLayout) findViewById(R.id.dr_ly); lv2 = (ListView) findViewById(R.id.lv2); tvListEntities = new ArrayList<>(); adapter = new TVAdapter(null, this, R.layout.item); lv2.setAdapter(adapter); lv2.setOnItemClickListener(this); p1 = (Button) findViewById(R.id.p1); p1.setOnClickListener(this); p2 = (Button) findViewById(R.id.p2); p2.setOnClickListener(this); p3 = (Button) findViewById(R.id.p3); p3.setOnClickListener(this); p4 = (Button) findViewById(R.id.p4); p4.setOnClickListener(this); p5 = (Button) findViewById(R.id.p5); p5.setOnClickListener(this); drawer_right = (LinearLayout) findViewById(R.id.drawer_right); probar = (ProgressBar) findViewById(R.id.probar); download_rate = (TextView) findViewById(R.id.download_rate); load_rate = (TextView) findViewById(R.id.load_rate); mGestureDetector = new GestureDetector(this, new MyGestureListener()); } private void vplay() { vv.setVideoURI(Uri.parse(url)); vv.requestFocus(); bufferVideo(); prepare(); vv.start(); // vv.setVideoLayout(VideoView.VIDEO_LAYOUT_SCALE,0); } private void bufferVideo() { vv.setOnInfoListener(this); vv.setOnBufferingUpdateListener(this); } private void prepare() { vv.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { mp.setPlaybackSpeed(1.0f); } }); } @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { url = tvListEntities.get(position).getUrl(); vplay(); dr_ly.closeDrawer(drawer); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.p1: changeurl("1"); break; case R.id.p2: changeurl("2"); break; case R.id.p3: changeurl("3"); break; case R.id.p4: changeurl("4"); break; case R.id.p5: changeurl("5"); break; } } private void changeurl(String s) { StringBuilder sb = new StringBuilder(url); sb.setCharAt(sb.length() - 6, s.charAt(0)); url = sb.toString(); vplay(); dr_ly.closeDrawer(drawer_right); } @Override public boolean onInfo(MediaPlayer mp, int what, int extra) { switch (what) { case MediaPlayer.MEDIA_INFO_BUFFERING_START: if (vv.isPlaying()) { vv.pause(); } probar.setVisibility(View.VISIBLE); download_rate.setText(""); load_rate.setText(""); download_rate.setVisibility(View.VISIBLE); load_rate.setVisibility(View.VISIBLE); break; case MediaPlayer.MEDIA_INFO_BUFFERING_END: vv.start(); probar.setVisibility(View.GONE); download_rate.setVisibility(View.GONE); load_rate.setVisibility(View.GONE); break; case MediaPlayer.MEDIA_INFO_DOWNLOAD_RATE_CHANGED: download_rate.setText("" + extra + "kb/s" + " "); break; } return true; } @Override public void onBufferingUpdate(MediaPlayer mp, int percent) { load_rate.setText(percent + "%"); } private class MyGestureListener extends GestureDetector.SimpleOnGestureListener { @Override public boolean onDoubleTap(MotionEvent e) { mLayout++; if (mLayout == 4) { mLayout = 0; } switch (mLayout) { case 0: mLayout = VideoView.VIDEO_LAYOUT_ORIGIN; break; case 1: mLayout = VideoView.VIDEO_LAYOUT_SCALE; break; case 2: mLayout = VideoView.VIDEO_LAYOUT_STRETCH; break; case 3: mLayout = VideoView.VIDEO_LAYOUT_ZOOM; break; } vv.setVideoLayout(mLayout, 0); return true; } } }
[ "1030218312@qq.com" ]
1030218312@qq.com
547f590af11082421fd24dab42c1aff1cd8f16d4
3806a2855969e0b0bfe126f3241f14a98219d380
/src/main/java/org/yardimci/hue/core/model/response/lamp/Ct.java
978c016d53dfc7193920057ca0bc047d88731959
[]
no_license
asyard/HueDesktopApplication
c5b98c3c7a7a4b7ed188992c28a8a2374bea3e67
4861bd225ca2198c51496db7d0c4a778eeb19856
refs/heads/master
2022-08-24T17:13:18.976337
2022-08-08T18:12:17
2022-08-08T18:12:17
223,728,292
2
0
null
2021-04-23T17:28:28
2019-11-24T10:44:07
Java
UTF-8
Java
false
false
350
java
package org.yardimci.hue.core.model.response.lamp; public class Ct { private int min; private int max; public int getMin() { return min; } public void setMin(int min) { this.min = min; } public int getMax() { return max; } public void setMax(int max) { this.max = max; } }
[ "asyard@gmail.com" ]
asyard@gmail.com
4e225e8be814115b4dd92f568a3140c5bf4e3183
6640dd1e38ff111e85abe387c378acd4e071ff46
/travel-app/src/main/java/com/travel/app/service/RegisterService/RegisterImpl.java
7b384f079b7fd04cc471fac62500ca35da0b964e
[]
no_license
lingfengcoder/springboot-DAEProgrem
96dd0aaa160558864a4ab8f4402c844086aeede6
e273be592dd412791ce8492eb27552c4f48a5419
refs/heads/master
2022-06-20T11:32:14.661730
2019-01-16T11:13:39
2019-01-16T11:13:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,546
java
package com.travel.app.service.RegisterService; import com.travel.app.entity.user.User; import com.travel.app.mapper.user.UserRegisterMapper; import com.travel.common.exception.ToC_Exception; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.List; /** * @Auther: wz * @Date: 2018/12/21 11:43 * @Description: */ @Service @Transactional public class RegisterImpl implements RegisterService{ @Resource UserRegisterMapper userRegisterMapper; @Override public User register(User user) { if(checkUserExist(user))return null; try { if(!userRegisterMapper.register(user)) return null; } catch (Exception e) { throw new ToC_Exception("注册失败"); } user.setUserId(""); user.setPassword(""); user.setIsVip(0); user.setAvailable(1); return user; } /** * @Description 检查用户是否存在 false 不存在 * @param: User * @return: boolean * @auther: wz * @date: 2018/12/21 12:05 */ @Override public boolean checkUserExist(User user) { try { List<User> list = userRegisterMapper.checkUserExist(user); if(list==null||list.size()==0)return false; } catch (Exception e) { throw new ToC_Exception("查找用户失败"); } return true; } }
[ "2650014538@qq.com" ]
2650014538@qq.com
64af0dfd01d88ca5a6c16774713b75dad5c63a61
7a96e3f5249bcac741ca25809a0a69fd1d086ba6
/src/GUIInput.java
00f379206b50d8d954029a0271dc77c27e432dc3
[]
no_license
le000043/Voting-System
0f55b7a31f5695ee47241084ad8f971ae5ad8c19
6b8839d8b017c7ac7ce0e17a8c2d4d07c4a3254d
refs/heads/master
2022-12-15T10:06:17.483339
2020-08-30T22:57:31
2020-08-30T22:57:31
291,564,522
0
0
null
null
null
null
UTF-8
Java
false
false
87
java
interface GUIInput { public String GetFileName(); public void OpenDialog(); }
[ "datle@MacBook-Pro-3.local" ]
datle@MacBook-Pro-3.local
ec8cd66315e5786bce3b0e9c112fbd0adb3a778a
f009dc33f9624aac592cb66c71a461270f932ffa
/src/main/java/com/alipay/api/domain/AlipayEcoRenthouseRoomConcentrationSyncModel.java
646bde00216b8627e98cdb7ab84320372a580bee
[ "Apache-2.0" ]
permissive
1093445609/alipay-sdk-java-all
d685f635af9ac587bb8288def54d94e399412542
6bb77665389ba27f47d71cb7fa747109fe713f04
refs/heads/master
2021-04-02T16:49:18.593902
2020-03-06T03:04:53
2020-03-06T03:04:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
11,877
java
package com.alipay.api.domain; import java.util.Date; import java.util.List; import com.alipay.api.AlipayObject; import com.alipay.api.internal.mapping.ApiField; import com.alipay.api.internal.mapping.ApiListField; /** * 集中式房源同步 * * @author auto create * @since 1.0, 2019-01-29 10:50:07 */ public class AlipayEcoRenthouseRoomConcentrationSyncModel extends AlipayObject { private static final long serialVersionUID = 1733762731232315579L; /** * 阿里短号 */ @ApiField("ali_short_num") private String aliShortNum; /** * 总计房间数量 */ @ApiField("all_room_num") private Long allRoomNum; /** * 户型-房 数值范围:1-26 */ @ApiField("bedroom_count") private Long bedroomCount; /** * 可租房间数量,为0时该房型不在前端展示。此字段不为空时,rent_status字段失效 */ @ApiField("can_rent_num") private Long canRentNum; /** * 可入住时间YYYY-MM-DD。大于今日,且小于等于185天 */ @ApiField("checkin_time") private Date checkinTime; /** * 小区同步请求号 */ @ApiField("comm_req_id") private String commReqId; /** * 佣金 */ @ApiField("commission") private String commission; /** * 佣金类型(p:百分比,m:金额) */ @ApiField("commission_type") private String commissionType; /** * 小区Code和小区请求号必输入其一 小区Code,详见文档 http://ecopublic.oss-cn-hangzhou.aliyuncs.com/eco/tpmogo/CommunityInfos/CommunityInfos.xls */ @ApiField("community_code") private String communityCode; /** * 费用说明 */ @ApiField("fee_remark") private String feeRemark; /** * 所在楼层 */ @ApiField("floor_count") private Long floorCount; /** * 押金 数值范围:0-¥420000.00 */ @ApiField("foregift_amount") private String foregiftAmount; /** * 免押金开始时间 YYYY-MM-dd */ @ApiField("free_begin_date") private Date freeBeginDate; /** * 免押金结束时间 YYYY-MM-dd */ @ApiField("free_end_date") private Date freeEndDate; /** * 通过"文件上传"接口返回的房源图片url路径。房间照片可录入0~10张,目前仅支持jpg、png、jpeg格式 */ @ApiListField("images") @ApiField("string") private List<String> images; /** * 房源描述 字符串,最大字符长度400 */ @ApiField("intro") private String intro; /** * 集中式最高价格,支持小数点后面2位。 新增时必输字段,修改时如果不转值则以上次接口调用值为准。 */ @ApiField("max_amount") private String maxAmount; /** * 集中式房源最大押金 */ @ApiField("max_deposit_amount") private String maxDepositAmount; /** * 可签约至YYYY-MM-DD */ @ApiField("max_lease_time") private String maxLeaseTime; /** * 多少天起可租 */ @ApiField("min_rent_days") private Long minRentDays; /** * 公寓别名 是否必须:(新增)是/(修改)否 */ @ApiField("nickname") private String nickname; /** * 其它费用 */ @ApiListField("other_amount") @ApiField("eco_renthouse_other_amount") private List<EcoRenthouseOtherAmount> otherAmount; /** * 管家姓名 */ @ApiField("owners_name") private String ownersName; /** * 管家电话 手机号码,必须为400开头 */ @ApiField("owners_tel") private String ownersTel; /** * 户型-厅 数值范围:0-10 */ @ApiField("parlor_count") private Long parlorCount; /** * 付款方式(1:付一,2:付二) */ @ApiField("pay_type") private Long payType; /** * 付款方式列表,包括上述单独传递的付款方式。如果2种都传递,默认覆盖单独传递的付款方式。 */ @ApiListField("pay_type_list") @ApiField("eco_cen_renthousepay_type_list") private List<EcoCenRenthousepayTypeList> payTypeList; /** * 出租状态 数值范围:1未租、2已租 */ @ApiField("rent_status") private Long rentStatus; /** * 出租类型 1:整租,2:合租 */ @ApiField("rent_type") private Long rentType; /** * 租金 数值范围:¥100.00 - ¥35000.00 ,支持小数点后面2位 */ @ApiField("room_amount") private String roomAmount; /** * 房间面积 数值范围:5.00㎡-300.00㎡,支持小数点后面2位 */ @ApiField("room_area") private String roomArea; /** * KA内部存储的房源编号 */ @ApiField("room_code") private String roomCode; /** * 物品配置(房间) 2:空调;3:热水器;4:洗衣机;5:冰箱;6:电视;7:微波炉;8:燃气灶;9:抽油烟机;10:电磁炉;11:床;11:WIFI;12:书桌;13:衣柜;14:沙发;15:阳台; */ @ApiListField("room_configs") @ApiField("string") private List<String> roomConfigs; /** * 集中式房间列表 */ @ApiListField("room_info_list") @ApiField("eco_renthouse_room_info_list") private List<EcoRenthouseRoomInfoList> roomInfoList; /** * 房间最大面积 */ @ApiField("room_max_area") private String roomMaxArea; /** * 房源初始上下架状态 上架状态租房平台会展示该房间信息,下架状态反之 */ @ApiField("room_status") private Long roomStatus; /** * 房源对应的店铺编号 */ @ApiField("room_store_no") private String roomStoreNo; /** * 户型-卫 数值范围:0-10 */ @ApiField("toilet_count") private Long toiletCount; /** * 房屋总楼层 */ @ApiField("total_floor_count") private Long totalFloorCount; public String getAliShortNum() { return this.aliShortNum; } public void setAliShortNum(String aliShortNum) { this.aliShortNum = aliShortNum; } public Long getAllRoomNum() { return this.allRoomNum; } public void setAllRoomNum(Long allRoomNum) { this.allRoomNum = allRoomNum; } public Long getBedroomCount() { return this.bedroomCount; } public void setBedroomCount(Long bedroomCount) { this.bedroomCount = bedroomCount; } public Long getCanRentNum() { return this.canRentNum; } public void setCanRentNum(Long canRentNum) { this.canRentNum = canRentNum; } public Date getCheckinTime() { return this.checkinTime; } public void setCheckinTime(Date checkinTime) { this.checkinTime = checkinTime; } public String getCommReqId() { return this.commReqId; } public void setCommReqId(String commReqId) { this.commReqId = commReqId; } public String getCommission() { return this.commission; } public void setCommission(String commission) { this.commission = commission; } public String getCommissionType() { return this.commissionType; } public void setCommissionType(String commissionType) { this.commissionType = commissionType; } public String getCommunityCode() { return this.communityCode; } public void setCommunityCode(String communityCode) { this.communityCode = communityCode; } public String getFeeRemark() { return this.feeRemark; } public void setFeeRemark(String feeRemark) { this.feeRemark = feeRemark; } public Long getFloorCount() { return this.floorCount; } public void setFloorCount(Long floorCount) { this.floorCount = floorCount; } public String getForegiftAmount() { return this.foregiftAmount; } public void setForegiftAmount(String foregiftAmount) { this.foregiftAmount = foregiftAmount; } public Date getFreeBeginDate() { return this.freeBeginDate; } public void setFreeBeginDate(Date freeBeginDate) { this.freeBeginDate = freeBeginDate; } public Date getFreeEndDate() { return this.freeEndDate; } public void setFreeEndDate(Date freeEndDate) { this.freeEndDate = freeEndDate; } public List<String> getImages() { return this.images; } public void setImages(List<String> images) { this.images = images; } public String getIntro() { return this.intro; } public void setIntro(String intro) { this.intro = intro; } public String getMaxAmount() { return this.maxAmount; } public void setMaxAmount(String maxAmount) { this.maxAmount = maxAmount; } public String getMaxDepositAmount() { return this.maxDepositAmount; } public void setMaxDepositAmount(String maxDepositAmount) { this.maxDepositAmount = maxDepositAmount; } public String getMaxLeaseTime() { return this.maxLeaseTime; } public void setMaxLeaseTime(String maxLeaseTime) { this.maxLeaseTime = maxLeaseTime; } public Long getMinRentDays() { return this.minRentDays; } public void setMinRentDays(Long minRentDays) { this.minRentDays = minRentDays; } public String getNickname() { return this.nickname; } public void setNickname(String nickname) { this.nickname = nickname; } public List<EcoRenthouseOtherAmount> getOtherAmount() { return this.otherAmount; } public void setOtherAmount(List<EcoRenthouseOtherAmount> otherAmount) { this.otherAmount = otherAmount; } public String getOwnersName() { return this.ownersName; } public void setOwnersName(String ownersName) { this.ownersName = ownersName; } public String getOwnersTel() { return this.ownersTel; } public void setOwnersTel(String ownersTel) { this.ownersTel = ownersTel; } public Long getParlorCount() { return this.parlorCount; } public void setParlorCount(Long parlorCount) { this.parlorCount = parlorCount; } public Long getPayType() { return this.payType; } public void setPayType(Long payType) { this.payType = payType; } public List<EcoCenRenthousepayTypeList> getPayTypeList() { return this.payTypeList; } public void setPayTypeList(List<EcoCenRenthousepayTypeList> payTypeList) { this.payTypeList = payTypeList; } public Long getRentStatus() { return this.rentStatus; } public void setRentStatus(Long rentStatus) { this.rentStatus = rentStatus; } public Long getRentType() { return this.rentType; } public void setRentType(Long rentType) { this.rentType = rentType; } public String getRoomAmount() { return this.roomAmount; } public void setRoomAmount(String roomAmount) { this.roomAmount = roomAmount; } public String getRoomArea() { return this.roomArea; } public void setRoomArea(String roomArea) { this.roomArea = roomArea; } public String getRoomCode() { return this.roomCode; } public void setRoomCode(String roomCode) { this.roomCode = roomCode; } public List<String> getRoomConfigs() { return this.roomConfigs; } public void setRoomConfigs(List<String> roomConfigs) { this.roomConfigs = roomConfigs; } public List<EcoRenthouseRoomInfoList> getRoomInfoList() { return this.roomInfoList; } public void setRoomInfoList(List<EcoRenthouseRoomInfoList> roomInfoList) { this.roomInfoList = roomInfoList; } public String getRoomMaxArea() { return this.roomMaxArea; } public void setRoomMaxArea(String roomMaxArea) { this.roomMaxArea = roomMaxArea; } public Long getRoomStatus() { return this.roomStatus; } public void setRoomStatus(Long roomStatus) { this.roomStatus = roomStatus; } public String getRoomStoreNo() { return this.roomStoreNo; } public void setRoomStoreNo(String roomStoreNo) { this.roomStoreNo = roomStoreNo; } public Long getToiletCount() { return this.toiletCount; } public void setToiletCount(Long toiletCount) { this.toiletCount = toiletCount; } public Long getTotalFloorCount() { return this.totalFloorCount; } public void setTotalFloorCount(Long totalFloorCount) { this.totalFloorCount = totalFloorCount; } }
[ "ben.zy@antfin.com" ]
ben.zy@antfin.com
4e1c48e9f8db39d975a5e5ef963dc665ff9b22c4
00c83bb7e7228a37709512389743bb068b63c20b
/src/modul2/Bola.java
c71923187c2ede32ef5a04ea91db9fc309f42006
[]
no_license
Christoyosianazareth/Modul2
2756ea15c7901cb9ec9f4a95b30a897d5b39d9b1
19232cee8550717b10a6327115a2137a5ab3fde8
refs/heads/master
2020-03-28T23:51:10.486457
2018-09-18T15:36:58
2018-09-18T15:36:58
149,312,172
0
0
null
null
null
null
UTF-8
Java
false
false
1,249
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 modul2; import java.lang.Math; /** * * @author GL553VD */ public class Bola { private double jarijari = 14; private double diameter; private double luas; private double volume; public void setJari(double jarijari){ this.jarijari=jarijari; } public void showDiameter(){ this.diameter=2*jarijari; } public void showLuas(){ this.luas=4*Math.PI*jarijari*jarijari; } public void showVolume(){ this.volume=(4*Math.PI*jarijari*jarijari*jarijari)/3; } public void cetak(){ System.out.println("Jari-jari : "+jarijari+ " cm "); System.out.println("______________________________ "); System.out.println("Diameter : "+diameter+ " cm "); System.out.println("Luas : "+luas+" cm kuadrat"); System.out.println("Volume : "+volume+" cm kubik"); } void setJari(int i) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }
[ "GL553VD@DESKTOP-I019UBP" ]
GL553VD@DESKTOP-I019UBP
7f2572a201afda043a62f81a4db5ff1000a31cda
ffabe14573e3ab0ab4aeb0ca260fc125744faed4
/src/test/java/me/barsopia/ami/algo/StackAlgo1Test.java
36586331cc778b390a862639f476d01e79274ce8
[]
no_license
amigajjar/DSAlgoUsingJava
9fbce919e81f21d371181dfeae71f6836250a8d7
77f82facbb0f838525d6b52676bccb9c044e72ac
refs/heads/master
2022-12-24T12:02:24.063299
2020-06-11T14:50:48
2020-06-11T14:50:48
263,388,054
0
0
null
2020-10-13T21:57:23
2020-05-12T16:14:58
Java
UTF-8
Java
false
false
1,509
java
package me.barsopia.ami.algo; import org.junit.Assert; import org.junit.Test; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class StackAlgo1Test { @Test public void queryTest() { StackAlgo1 s=new StackAlgo1(); s.push(97); s.pop(); s.push(20); s.pop(); s.push(26); s.push(20); s.pop(); Assert.assertEquals(26,s.FindMaximumFromStack()); s.push(91); Assert.assertEquals(91,s.FindMaximumFromStack()); s.push(10); Assert.assertEquals(91,s.FindMaximumFromStack()); } public static void main(String[] args) throws FileNotFoundException { Scanner scanner = new Scanner(new File("D:\\Ami\\DSAlgoUsingJava\\src\\main\\resources\\input03.txt")); //test your code long timeMillis = System.currentTimeMillis(); int n=scanner.nextInt(); StackAlgo1 s = new StackAlgo1(); for (int i = 0; i < n; i++) { switch (scanner.nextInt()) { case 1: s.push(scanner.nextInt()); break; case 2: s.pop(); break; case 3: int max = s.FindMaximumFromStack(); System.out.println(max); break; } } scanner.close(); System.out.println(System.currentTimeMillis() - timeMillis); } }
[ "amigajjar1994@gmail.com" ]
amigajjar1994@gmail.com
36ca5a4d25dabee20494d5469e84cbcfd3856e80
48794e61b37feeec3b94d5483f0f4261ab462e6f
/CollegeManagementSystem/src/project/Connectionmanager3.java
50c7c181de6a3c1dad0cfe355dadc07cbb3bf77e
[]
no_license
aryamolpgk313/CollegeManagementSystem-using-JDBC
9075f86e759b1df9cf504f13776e35c93bfff33e
52319562279321de37ece7576325142745803aea
refs/heads/master
2020-09-29T13:09:13.029387
2019-12-10T06:44:14
2019-12-10T06:44:14
227,043,861
0
0
null
null
null
null
UTF-8
Java
false
false
478
java
package project; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class Connectionmanager3 { public Connection getConnection() throws ClassNotFoundException, SQLException { Class.forName("com.mysql.jdbc.Driver"); Connection con=null; con=DriverManager.getConnection("jdbc:mysql://localhost:3306/college","root",""); if(con!=null)//connection checking { return con; } else { return null; } } }
[ "USER@FACE-74" ]
USER@FACE-74
1eccf30ede92f3038d4919401e6ad18bc832e82e
384bc954b64e679c122ba5e00d9fc03a5fbcf547
/src/com/company/Leaf.java
d24e894cf5a1ead068957de727618709d0b36e4f
[]
no_license
YuriyPanchenko/exam3Ira
9eb25b9fdfb1d3cc61a7b86b48decd10d2144041
7c5b7afa7c58c26b7acc4308355f7f753eb8e07f
refs/heads/master
2022-07-05T07:00:04.292184
2020-05-16T17:55:36
2020-05-16T17:55:36
264,494,143
0
0
null
null
null
null
UTF-8
Java
false
false
443
java
package com.company; public class Leaf { private String color; public Leaf() { } public Leaf(String color) { this.color = color; } public String getColor() { return color; } public void setColor(String color) { this.color = color; } @Override public String toString() { return "Leaf{" + ", color='" + color + '\'' + '}'; } }
[ "yuriy.panchenko.2000@gmail.com" ]
yuriy.panchenko.2000@gmail.com
e5e139a18ba8ddae509ab1b91e0fc0f72bd20808
eb2556a43cc0a8d1c525fb21bb00d5a6158da4ad
/basex-core/src/test/java/org/basex/query/index/ValueIndexTest.java
21afed6f2bb8978f78113c62bd00009a487ed1a7
[ "BSD-3-Clause" ]
permissive
SirOlrac/basex
ee22c8336f2430ae38e962399f1cdc89c9a657d3
b97a3bbf961178d0c3dc8c65d389c8299fc5d517
refs/heads/master
2020-06-13T20:08:21.217244
2016-12-02T21:48:49
2016-12-02T21:48:49
75,557,973
1
0
null
2016-12-04T19:08:45
2016-12-04T19:08:45
null
UTF-8
Java
false
false
4,935
java
package org.basex.query.index; import java.util.*; import java.util.List; import java.util.Map.Entry; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.query.ast.*; import org.basex.query.expr.ft.*; import org.basex.util.*; import org.junit.*; import org.junit.Test; import org.junit.runner.*; import org.junit.runners.*; import org.junit.runners.Parameterized.*; /** * This class tests if value indexes will be used. * * @author BaseX Team 2005-16, BSD License * @author Christian Gruen */ @RunWith(Parameterized.class) public final class ValueIndexTest extends QueryPlanTest { /** Test file. */ private static final String FILE = "src/test/resources/selective.xml"; /** Main memory flag. */ @Parameter public Object mainmem; /** * Mainmem parameters. * @return parameters */ @Parameters public static Collection<Object[]> params() { final List<Object[]> params = new ArrayList<>(); params.add(new Object[] { false }); params.add(new Object[] { true }); return params; } /** * Initializes a test. */ @Before public void before() { set(MainOptions.MAINMEM, mainmem); } /** * Finalizes a test. */ @After public void after() { set(MainOptions.MAINMEM, false); set(MainOptions.UPDINDEX, false); set(MainOptions.FTINDEX, false); set(MainOptions.TEXTINCLUDE, ""); set(MainOptions.ATTRINCLUDE, ""); set(MainOptions.TOKENINCLUDE, ""); set(MainOptions.FTINCLUDE, ""); } /** * Initializes the tests. */ @BeforeClass public static void start() { execute(new CreateDB(NAME, FILE)); } /** * Tests the text index. */ @Test public void textIndex() { for(final Entry<String, String> entry : map().entrySet()) { final String key = entry.getKey(), value = entry.getValue(); set(MainOptions.TEXTINCLUDE, key); execute(new CreateDB(NAME, FILE)); check("count(//" + key + "[text() = " + value + "])", Integer.toString(value.split(",").length), "exists(//ValueAccess)"); if(!key.equals("*")) check("//X[text() = 'unknown']", "", "exists(//DBNode)"); } } /** * Tests the attribute index. */ @Test public void attrIndex() { for(final Entry<String, String> entry : map().entrySet()) { final String key = entry.getKey(), value = entry.getValue(); set(MainOptions.ATTRINCLUDE, key); execute(new CreateDB(NAME, FILE)); check("count(//*[@" + key + " = " + value + "])", Integer.toString(value.split(",").length), "exists(//ValueAccess)"); if(!key.equals("*")) check("//*[@x = 'unknown']", "", "exists(//DBNode)"); } } /** * Tests the full-text index. */ @Test public void fulltextIndex() { // not applicable in main-memory mode if((Boolean) mainmem) return; set(MainOptions.FTINDEX, true); for(final Entry<String, String> entry : map().entrySet()) { final String key = entry.getKey(), value = entry.getValue(); set(MainOptions.FTINCLUDE, key); execute(new CreateDB(NAME, FILE)); check("count(//" + key + "[text() contains text { " + value + " }])", Integer.toString(value.split(",").length), "exists(//" + Util.className(FTIndexAccess.class) + ")"); if(!key.equals("*")) check("//X[text() contains text 'unknown']", "", "exists(//DBNode)"); } } /** * Tests the text index and update operations. */ @Test public void textUpdates() { set(MainOptions.UPDINDEX, true); set(MainOptions.TEXTINCLUDE, "a"); execute(new CreateDB(NAME, "<x><a>text</a><b>TEXT</b></x>")); check("count(//a[text() = 'text'])", "1", "exists(//ValueAccess)"); check("count(//b[text() = 'TEXT'])", "1", "empty(//ValueAccess)"); query("replace value of node x/a with 'TEXT'"); check("count(//a[text() = 'TEXT'])", "1", "exists(//ValueAccess)"); query("rename node x/a as 'b'"); check("//a[text() = 'TEXT']", "", "exists(//Empty)"); check("count(//b[text() = 'TEXT'])", "2", "empty(ValueAccess)"); query("x/b/(rename node . as 'a')"); check("count(//a[text() = 'TEXT'])", "2", "exists(//ValueAccess)"); check("count(//b[text() = 'TEXT'])", "0", "empty(//ValueAccess)"); query("x/a/(replace value of node . with 'text')"); check("count(//a[text() = 'text'])", "2", "exists(//ValueAccess)"); query("delete node x/a[1]"); check("count(//a[text() = 'text'])", "1", "exists(//ValueAccess)"); query("delete node x/a[1]"); check("//a[text() = 'text']", "", "exists(//Empty)"); } /** * Returns a map with name tests. * @return map */ private static HashMap<String, String> map() { final LinkedHashMap<String, String> map = new LinkedHashMap<>(); map.put("*", "'A'"); map.put("a", "'A'"); map.put("*:c", "('C','PC')"); map.put("Q{ns}*", "('PC','PD')"); map.put("Q{ns}c", "'PC'"); return map; } }
[ "christian.gruen@gmail.com" ]
christian.gruen@gmail.com
9909ab74773e813867571c2ea49826f1f6708e2d
cb4a7d111ca44fa127c994781fbaab83526ec4e9
/gainde-demo/gainde-integral-ejb/gainde-integral-ressources/gainde-integral-rc-api/src/main/java/sn/com/douane/ejb/rc/model/dao/IHistoProduitDao.java
f2622ad1b34e6b851f5172cd992ecc9564f5dfd6
[]
no_license
jasmineconseil/applicationBlanche
56d6493cdf68ae870ddd3584dbc1d4e95df6f402
a23247ec783d9cb856c538aacb20f76c6eed5307
refs/heads/master
2020-12-26T00:06:23.151181
2014-03-11T11:07:03
2014-03-11T11:07:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
178
java
package sn.com.douane.ejb.rc.model.dao; import sn.com.douane.ejb.rc.model.entities.HistoProduit; public interface IHistoProduitDao extends IGenericDao<HistoProduit>{ }
[ "contact@jasforge.com" ]
contact@jasforge.com
7439a95ee95a16d9ecda50837f8b0c37d86fdc4a
972549525373bddf7e1ba0f391bc954eed6043c4
/app/src/main/java/com/foodaclic/livraison/adapter/AllAdapter.java
26178a2d39918b024e267a2bc688d3bf8edf719d
[]
no_license
cyrilleguipie/Livraison
d6b1194c15b045cbe952a79e29afc3a690454a8d
9425e70f899820a3f6a6d25ec698fa05cac85171
refs/heads/master
2020-03-22T15:41:19.912462
2018-07-12T09:39:39
2018-07-12T09:39:39
140,269,872
0
0
null
null
null
null
UTF-8
Java
false
false
7,226
java
package com.foodaclic.livraison.adapter; import android.content.Context; import android.content.Intent; import android.graphics.Paint; import android.net.Uri; import android.support.v7.widget.AppCompatSpinner; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import com.foodaclic.livraison.R; import com.foodaclic.livraison.classes.Commande; import com.foodaclic.livraison.service.PayService; import com.foodaclic.livraison.service.TakeService; import com.foodaclic.livraison.utils.CustomDialog; import java.util.List; /** * Created by cyrilleguipie on 1/28/17. */ public class AllAdapter extends RecyclerView.Adapter<AllAdapter.ViewHolder> { private List<Commande> mValues; private Context mContext; private CustomDialog dialog; public AllAdapter(Context context, List<Commande> items) { mContext = context; mValues = items; } public static class ViewHolder extends RecyclerView.ViewHolder { public final TextView label_client, label_start, label_phone, text_code, text_status, text_restau,label_end, label_date, label_plat, text_price; public final View mView; public final Button btn_take; public ViewHolder(View itemView) { super(itemView); label_client = itemView.findViewById(R.id.label_client); label_start = itemView.findViewById(R.id.label_start); label_phone = itemView.findViewById(R.id.label_phone); text_code = itemView.findViewById(R.id.text_code); text_status = itemView.findViewById(R.id.text_status); text_restau = itemView.findViewById(R.id.text_restau); label_end = itemView.findViewById(R.id.label_end); label_date = itemView.findViewById(R.id.label_date); label_plat = itemView.findViewById(R.id.label_plat); text_price = itemView.findViewById(R.id.text_price); btn_take = itemView.findViewById(R.id.btn_take); label_start.setPaintFlags(label_start.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); label_end.setPaintFlags(label_end.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); mView = itemView; } } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.all_item, parent, false); return new ViewHolder(view); } @Override public void onBindViewHolder(final ViewHolder holder, int position) { //get object at position final Commande object = mValues.get(position); holder.label_client.setText(object.title); holder.label_start.setText(object.address); holder.label_phone.setText(object.phone); holder.text_code.setText(object.code); holder.text_status.setText(object.statut); holder.text_restau.setText(object.restaurant); holder.label_end.setText(object.restaurantAddress); holder.label_date.setText(object.date); holder.label_plat.setText(object.meal); holder.text_price.setText(object.price); holder.label_start.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Uri gmmIntentUri = Uri.parse("geo:"+object.destLat+","+object.destLng+"?q=" + Uri.encode(object.address)); Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); mapIntent.setPackage("com.google.android.apps.maps"); if (mapIntent.resolveActivity(mContext.getPackageManager()) != null) { mContext.startActivity(mapIntent); } } }); holder.label_end.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Uri gmmIntentUri = Uri.parse("geo:"+object.restauLat+","+object.restauLng+"?q=" + Uri.encode(object.restaurantAddress)); Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); mapIntent.setPackage("com.google.android.apps.maps"); if (mapIntent.resolveActivity(mContext.getPackageManager()) != null) { mContext.startActivity(mapIntent); } } }); if(object.statut4.equals("Commande prête")){ holder.text_status.setText("(Commande prête)"); holder.text_status.setTextColor(mContext.getResources().getColor(R.color.md_green_A700)); }else{ holder.text_status.setText("(Pas encore prête)"); holder.text_status.setTextColor(mContext.getResources().getColor(R.color.md_red_A700)); } if(object.statut.equals("Commande livrée")){ holder.btn_take.setText("Commande livrée"); holder.btn_take.setEnabled(false); }else if(object.statut2.equals("Paiement non confirmé")){ holder.btn_take.setText("Valider paiement / livraison"); holder.btn_take.setEnabled(true); }else{ holder.btn_take.setText("Prendre en charge"); holder.btn_take.setEnabled(true); } //onClick to select object holder.btn_take.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(object.statut2.equals("Paiement non confirmé")){ takePay((int) object.id); }else{ takeDialog(object); } } }); } @Override public int getItemCount() { return mValues.size(); } public void takeDialog(final Commande commande){ final View view = LayoutInflater.from(mContext).inflate(R.layout.dialog_take, null); dialog = new CustomDialog(mContext, view); ImageView imgClose = (ImageView) dialog.findViewById(R.id.img_close); final AppCompatSpinner spinReception = dialog.findViewById(R.id.spin_reception); Button btn_ok = (Button) dialog.findViewById(R.id.btn_ok); btn_ok.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mContext.startService(new Intent(mContext, TakeService.class) .putExtra("id", commande.id) .putExtra("code", commande.code) .putExtra("pourboire", commande.price) .putExtra("reception", spinReception.getSelectedItem().toString())); dialog.dismiss(); dialog.dismiss(); } }); imgClose.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { dialog.dismiss(); } }); dialog.setCanceledOnTouchOutside(true); dialog.show(); } public void takePay(final int id){ final View view = LayoutInflater.from(mContext).inflate(R.layout.dialog_pay, null); dialog = new CustomDialog(mContext, view); ImageView imgClose = dialog.findViewById(R.id.img_close); Button btn_ok = dialog.findViewById(R.id.btn_ok); btn_ok.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mContext.startService(new Intent(mContext, PayService.class) .putExtra("id", id)); dialog.dismiss(); } }); imgClose.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { dialog.dismiss(); } }); dialog.setCanceledOnTouchOutside(true); dialog.show(); } }
[ "cyrilleguipie@gmail.com" ]
cyrilleguipie@gmail.com
6cd6a8ef38c067bf4ab77f9284a5d47772dc7726
ae26a81c6b21d590b908602769843ab268c3b561
/源代码/familyPath4/src/Frame/ShowErrorMessageFrame.java
04fbce636eb4eddf47e3f92025f4b5d75b78667b
[]
no_license
anpingxiong/fimailyMemberManager
50d6e98c2595f65bcacd676e5664fdc1d8f5162e
72908cf8a100b16b56f144f7febd69baaa3d0672
refs/heads/master
2016-09-02T16:10:28.263536
2014-08-26T07:50:56
2014-08-26T07:50:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,140
java
package Frame; import java.awt.Container; import java.awt.FlowLayout; import java.awt.Image; import java.awt.Rectangle; import java.awt.Toolkit; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.event.TableModelListener; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel; public class ShowErrorMessageFrame extends JFrame{ static JTable tab; static JScrollPane sp ; private Container container; public ShowErrorMessageFrame( Object columnNames[],Object value[][]){ super("错误日志"); container = this.getContentPane(); setLocation(500, 300); tab = new JTable(value, columnNames); sp = new JScrollPane(tab); container.add(sp); this.setVisible(true); this.setBounds(500,300,400,200); Toolkit tk=Toolkit.getDefaultToolkit(); Image image=tk.createImage("./image/home_purple.png"); this.setIconImage(image); this.setTitle("错误日志"); } }
[ "974984076@qq.com" ]
974984076@qq.com
59aeb4de24ac98b1e66fbfb6cc6eb13cc6a30270
2219254b073e90169d7047b74170e8e7dce103d0
/src/com/dao/UserDao.java
6253f52f72fb42f99133a037b881b7cc734d38f0
[]
no_license
123qin/music_player
6feaffd257ab8093dad8352f927b195b8348823c
c8f831965fffccad5483d45dd524cb1a02173b17
refs/heads/master
2020-11-25T17:54:51.101078
2019-09-20T03:58:04
2019-09-20T03:58:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,798
java
package com.dao; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import com.pojo.UserInfo; import com.pojo.Users; import com.util.DbUtil; /** * @function 用于处理用户登录注册 * @author 王飞 * @date 2018-11-27 */ public class UserDao { public static boolean doLogin(String username, String password) { String sql = "select username , password from users where username=? and password=?"; List<Users> list = DbUtil.selectInfo(Users.class, sql, username , password); if(list.size() > 0){ return true; } return false; } public static String doRegist(String name, String password, String birthday, String local, String gexing, String code) { String sql = "insert into users(password) values(?)"; int count = DbUtil.updateInfo_key(sql, password); if(count != 0){ String username = Integer.toString(count); //System.out.println(username); sql = "insert into userinfo(username , user_realname , user_born_date , user_location , user_qianming , user_level , user_date) values(?,?,?,?,?,?,?)"; Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-dd"); String dateString = sdf.format(date); count = DbUtil.updateInfo(sql, username , name , birthday , local , gexing , 1 , dateString); if(count != 0){ return username; }else{ sql = "delete from users where username = ?"; DbUtil.updateInfo(sql, username); } } return null; } //获取头像 public static String getPic(String username) { String sql = "select user_img from userinfo where username=?"; List<UserInfo> list = DbUtil.selectInfo(UserInfo.class, sql, username); if(list.size() > 0){ return list.get(0).getUser_img(); } return null; } }
[ "wf111444777@163.com" ]
wf111444777@163.com
1fa313d079cb675e03452959faf805da66cf7ac4
cc0458b38bf6d7bac7411a9c6fec9bc3b8282d3f
/thirdParty/CSharpParser/src/csmc/javacc/generated/syntaxtree/SelectClause.java
4fc3c1a4b648591e40f438f019c01304182a21b3
[]
no_license
RinatGumarov/Code-metrics
62f99c25b072dd56e9c953d40dac7076a4376180
2005b6671c174e09e6ea06431d4711993a33ecb6
refs/heads/master
2020-07-12T04:01:47.007860
2017-08-08T07:19:26
2017-08-08T07:19:26
94,275,456
1
0
null
null
null
null
UTF-8
Java
false
false
909
java
// // Generated by JTB 1.3.2 // package csmc.javacc.generated.syntaxtree; /** * Grammar production: * f0 -> <SELECT> * f1 -> Expression() */ public class SelectClause implements Node { public NodeToken f0; public Expression f1; public SelectClause(NodeToken n0, Expression n1) { f0 = n0; f1 = n1; } public SelectClause(Expression n0) { f0 = new NodeToken("select"); f1 = n0; } public void accept(csmc.javacc.generated.visitor.Visitor v) { v.visit(this); } public <R,A> R accept(csmc.javacc.generated.visitor.GJVisitor<R,A> v, A argu) { return v.visit(this,argu); } public <R> R accept(csmc.javacc.generated.visitor.GJNoArguVisitor<R> v) { return v.visit(this); } public <A> void accept(csmc.javacc.generated.visitor.GJVoidVisitor<A> v, A argu) { v.visit(this,argu); } }
[ "tiran678@icloud.com" ]
tiran678@icloud.com
bc384dfcf761b2d74774c9237b92334034310ffc
a0e4f155a7b594f78a56958bca2cadedced8ffcd
/header/src/main/java/org/zstack/header/storage/snapshot/VolumeSnapshotTreeEO.java
e009c124bced5d06c113e90c2d7d05d7749f5b32
[ "Apache-2.0" ]
permissive
zhao-qc/zstack
e67533eabbbabd5ae9118d256f560107f9331be0
b38cd2324e272d736f291c836f01966f412653fa
refs/heads/master
2020-08-14T15:03:52.102504
2019-10-14T03:51:12
2019-10-14T03:51:12
215,187,833
3
0
Apache-2.0
2019-10-15T02:27:17
2019-10-15T02:27:16
null
UTF-8
Java
false
false
423
java
package org.zstack.header.storage.snapshot; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; /** */ @Entity @Table public class VolumeSnapshotTreeEO extends VolumeSnapshotTreeAO { @Column private String deleted; public String getDeleted() { return deleted; } public void setDeleted(String deleted) { this.deleted = deleted; } }
[ "xuexuemiao@yeah.net" ]
xuexuemiao@yeah.net
be14ae05087cca147247e1a23cdb07abdc1f89fe
d2b385a4d203b106863b1075963b5985be6dbf6b
/java8583/src/main/java/com/szxb/java8583/module/BankPay.java
212c3fe8c2e1c3bc025a2c78cd9e09d43d9a52f7
[]
no_license
wuxinxi/unionpay
f0073bc6f4a6d626140afd2928212da27c48ded8
ec1f1cbe50c4e2af730a7a520bbc600d67fd5e57
refs/heads/master
2020-03-21T20:22:00.076608
2018-09-14T09:27:57
2018-09-14T09:27:57
139,002,533
2
1
null
null
null
null
UTF-8
Java
false
false
3,432
java
package com.szxb.java8583.module; import com.szxb.java8583.core.Iso8583Message; import com.szxb.java8583.module.manager.BusllPosManage; import com.szxb.java8583.util.MacEcbUtils; import static com.szxb.java8583.util.EncodeUtil.hex2byte; import static com.szxb.java8583.util.EncodeUtil.mergeByte; import static com.szxb.java8583.util.EncodeUtil.str2Bcd; import static com.szxb.java8583.util.MacEcbUtils.bytesToHexString; /** * 作者:Tangren on 2018-07-05 * 包名:com.szxb.java8583.module * 邮箱:996489865@qq.com * TODO:一句话描述 */ public class BankPay { private volatile static BankPay instance = null; private BankPay() { } public static BankPay getInstance() { if (instance == null) { synchronized (BankPay.class) { if (instance == null) { instance = new BankPay(); } } } return instance; } public Iso8583Message payMessage(BusCard busCard) { String cardNum = busCard.getCardNum(); int cardNumLen = cardNum.length(); for (int i = 0; i < 4 - cardNumLen; i++) { cardNum = "0" + cardNum; } busCard.setCardNum(cardNum); Iso8583Message iso8583Message = payMessageData(busCard); byte[] dataAll = iso8583Message.getBytes(); byte[] data = new byte[dataAll.length - 2]; System.arraycopy(dataAll, 2, data, 0, data.length); iso8583Message.setTpdu(BusllPosManage.getPosManager().getTPDU()) .setHeader("613100313031") .setValue(64, pay_field_64(data, busCard.getMacKey())); return iso8583Message; } private Iso8583Message payMessageData(BusCard busCard) { Iso8583Message message = new Iso8583Message(BaseFactory.payBaseFactory()); message.setMti("0200") .setValue(2, busCard.getMainCardNo())//主账号 .setValue(3, "000000")//交易处理码 .setValue(4, String.format("%012d", busCard.getMoney()))//交易金额 .setValue(11, String.format("%06d", busCard.getTradeSeq()))//受卡方系统跟踪号,流水号 .setValue(22, "072")//服务点输入方式码 .setValue(23, busCard.getCardNum())//卡片序列号 .setValue(25, "00")//服务点条件码 .setValue(35, busCard.getMagTrackData())//2 磁道数据 .setValue(41, BusllPosManage.getPosManager().getPosSn()) .setValue(42, BusllPosManage.getPosManager().getMchId()) .setValue(49, "156")//交易货币代码 .setValue(53, String.format("%016d", 0))//安全控制信息 .setValue(55, busCard.getTlv55()) .setValue(60, bytesToHexString(pay_field_60())) .setValue(64, ""); return message; } /** * @return 64域 */ private String pay_field_64(byte[] data, String macKey) { byte[] mac = MacEcbUtils.getMac(hex2byte(macKey), data); return bytesToHexString(mac); } /** * @return 交易60 */ private byte[] pay_field_60() { byte[] field_60_1 = str2Bcd("22"); byte[] field_60_2 = str2Bcd(BusllPosManage.getPosManager().getBatchNum()); byte[] field_60_3 = str2Bcd("000600", 1); return mergeByte(field_60_1, field_60_2, field_60_3); } }
[ "996489865@qq.com" ]
996489865@qq.com
c05b421107ffd1c87ff9ae9ade5761f77d4b8450
84fbc1625824ba75a02d1777116fe300456842e5
/Engagement_Challenges/Engagement_4/airplan_5/source/com/roboticcusp/mapping/ChartTextWriter.java
b4e836ff031b1dddf5abf88bc9feacf30a019717
[]
no_license
unshorn-forks/STAC
bd41dee06c3ab124177476dcb14a7652c3ddd7b3
6919d7cc84dbe050cef29ccced15676f24bb96de
refs/heads/master
2023-03-18T06:37:11.922606
2018-04-18T17:01:03
2018-04-18T17:01:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,319
java
package com.roboticcusp.mapping; import java.io.FileNotFoundException; import java.io.PrintWriter; public class ChartTextWriter extends ChartWriter { public static final String TYPE = "text"; @Override public void write(Chart chart, String filename) throws ChartWriterException { try (PrintWriter writer = new PrintWriter(filename + ".txt")){ for (Vertex v : chart) { java.util.List<Edge> edges = chart.getEdges(v.getId()); for (int p = 0; p < edges.size(); ) { for (; (p < edges.size()) && (Math.random() < 0.5); ) { for (; (p < edges.size()) && (Math.random() < 0.6); ) { for (; (p < edges.size()) && (Math.random() < 0.4); p++) { Edge e = edges.get(p); writer.println(v.getName() + " " + e.getSink().getName() + " " + e.getWeight()); } } } } } } catch (FileNotFoundException e) { throw new ChartWriterException(e.getMessage()); } catch (ChartException e) { throw new ChartWriterException(e.getMessage()); } } }
[ "rborbely@cyberpointllc.com" ]
rborbely@cyberpointllc.com
2ae614b2ed1e50091b86aec477cbd8bbbbbc4c5a
9e048428ca10f604c557784f4b28c68ce9b5cccb
/bitcamp-spring-ioc/src/main/java/org/springframework/step03/Exam02.java
8b7824704536f79ec425b5aade099561e30404c3
[]
no_license
donhee/bitcamp
6c90ec687e00de07315f647bdb1fda0e277c3937
860aa16d86cbd6faeb56b1f5c70b5ea5d297aef0
refs/heads/master
2021-01-24T11:44:48.812897
2019-02-20T00:06:07
2019-02-20T00:06:07
123,054,172
0
0
null
null
null
null
UTF-8
Java
false
false
479
java
package org.springframework.step03; import org.springframework.BeanUtils; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class Exam02 { public static void main(String[] args) { ApplicationContext iocContainer = new ClassPathXmlApplicationContext( "org/springframework/step03/application-context-02.xml"); BeanUtils.printBeanNames(iocContainer); } }
[ "231313do@gmail.com" ]
231313do@gmail.com
31e9d3f5e6fa8d41e977d32463e743423eb86282
1bd7d1748f282e51e08981d8b191054c07ddd63c
/ProPubUI/src/propub/Gui.java
e7e0b953cfa20429e1c4191fb17f567348cff251
[]
no_license
DataONEorg/provex
82c4ab364be7fe4520180f9033f340ade9283fa4
8a0cf4d7fe63e92fb7be441ada3a635ad9d26b6d
refs/heads/master
2021-03-12T22:59:31.275349
2014-11-10T16:51:25
2014-11-10T16:51:25
25,671,336
1
0
null
null
null
null
UTF-8
Java
false
false
6,329
java
package propub; import com.vaadin.annotations.AutoGenerated; import com.vaadin.terminal.ExternalResource; import com.vaadin.ui.AbsoluteLayout; import com.vaadin.ui.Button; import com.vaadin.ui.CustomComponent; import com.vaadin.ui.Embedded; import com.vaadin.ui.Label; import com.vaadin.ui.OptionGroup; import com.vaadin.ui.Panel; import com.vaadin.ui.TabSheet; import com.vaadin.ui.VerticalLayout; public class Gui extends CustomComponent { @AutoGenerated private AbsoluteLayout mainLayout; @AutoGenerated private Panel panel_2; @AutoGenerated private VerticalLayout verticalLayout_3; @AutoGenerated private TabSheet tabsheet; @AutoGenerated private OptionGroup optionGroup_1; @AutoGenerated private Button button_8; @AutoGenerated private Button button_7; @AutoGenerated private Button button_6; @AutoGenerated private Button button_5; @AutoGenerated private Button button_4; @AutoGenerated private Button button_3; @AutoGenerated private Button button_2; @AutoGenerated private Button button_1; @AutoGenerated private Button button1; @AutoGenerated private Embedded embedded_3; @AutoGenerated private Label label_1; /*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */ /*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */ /*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */ /*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */ /** * The constructor should first build the main layout, set the * composition root and then do any custom initialization. * * The constructor will not be automatically regenerated by the * visual editor. */ public Gui() { buildMainLayout(); setCompositionRoot(mainLayout); // TODO add user code here } @AutoGenerated private AbsoluteLayout buildMainLayout() { // common part: create layout mainLayout = new AbsoluteLayout(); mainLayout.setImmediate(false); mainLayout.setWidth("100%"); mainLayout.setHeight("100%"); mainLayout.setMargin(false); // top-level component properties setWidth("100.0%"); setHeight("100.0%"); // label_1 label_1 = new Label(); label_1.setCaption("ProPub"); label_1.setImmediate(false); label_1.setWidth("180px"); label_1.setHeight("38px"); label_1.setValue("<center><h2>ProPub</h2></center>"); label_1.setContentMode(3); mainLayout.addComponent(label_1, "top:2.0px;left:20.0px;"); // embedded_3 embedded_3 = new Embedded(); embedded_3.setImmediate(false); embedded_3.setWidth("50px"); embedded_3.setHeight("50px"); embedded_3.setSource(new ExternalResource( "http://www.californiasailplanes.com/duckedit.jpg")); embedded_3.setType(1); embedded_3.setMimeType("image/png"); mainLayout.addComponent(embedded_3, "top:2.0px;left:200.0px;"); // button1 button1 = new Button(); button1.setCaption("Login"); button1.setImmediate(false); button1.setWidth("-1px"); button1.setHeight("-1px"); mainLayout.addComponent(button1, "top:16.0px;left:555.0px;"); // button_1 button_1 = new Button(); button_1.setCaption("Open"); button_1.setImmediate(false); button_1.setWidth("-1px"); button_1.setHeight("-1px"); mainLayout.addComponent(button_1, "top:54.0px;left:16.0px;"); // button_2 button_2 = new Button(); button_2.setCaption("Save"); button_2.setImmediate(false); button_2.setWidth("-1px"); button_2.setHeight("-1px"); mainLayout.addComponent(button_2, "top:54.0px;left:99.0px;"); // button_3 button_3 = new Button(); button_3.setCaption("SL"); button_3.setImmediate(false); button_3.setWidth("-1px"); button_3.setHeight("-1px"); mainLayout.addComponent(button_3, "top:54.0px;left:200.0px;"); // button_4 button_4 = new Button(); button_4.setCaption("NI"); button_4.setImmediate(false); button_4.setWidth("-1px"); button_4.setHeight("-1px"); mainLayout.addComponent(button_4, "top:54.0px;left:250.0px;"); // button_5 button_5 = new Button(); button_5.setCaption("<<"); button_5.setImmediate(false); button_5.setWidth("-1px"); button_5.setHeight("-1px"); mainLayout.addComponent(button_5, "top:54.0px;left:320.0px;"); // button_6 button_6 = new Button(); button_6.setCaption("<"); button_6.setImmediate(false); button_6.setWidth("-1px"); button_6.setHeight("-1px"); mainLayout.addComponent(button_6, "top:54.0px;left:368.0px;"); // button_7 button_7 = new Button(); button_7.setCaption(">"); button_7.setImmediate(false); button_7.setWidth("-1px"); button_7.setHeight("-1px"); mainLayout.addComponent(button_7, "top:54.0px;left:407.0px;"); // button_8 button_8 = new Button(); button_8.setCaption(">>"); button_8.setImmediate(false); button_8.setWidth("-1px"); button_8.setHeight("-1px"); mainLayout.addComponent(button_8, "top:54.0px;left:446.0px;"); // optionGroup_1 optionGroup_1 = new OptionGroup(); optionGroup_1.setImmediate(false); // optionGroup_1.addStyleName("horizontal"); optionGroup_1.setWidth("102px"); optionGroup_1.setHeight("100.0%"); mainLayout.addComponent(optionGroup_1, "top:52.0px;bottom:457.0px;left:520.0px;"); // tabsheet tabsheet = new TabSheet(); tabsheet.setImmediate(false); tabsheet.setWidth("264px"); tabsheet.setHeight("380px"); mainLayout.addComponent(tabsheet, "top:140.0px;left:16.0px;"); // panel_2 panel_2 = buildPanel_2(); mainLayout.addComponent(panel_2, "top:147.0px;left:280.0px;"); return mainLayout; } @AutoGenerated private Panel buildPanel_2() { // common part: create layout panel_2 = new Panel(); panel_2.setImmediate(false); panel_2.setWidth("340px"); panel_2.setHeight("373px"); // verticalLayout_3 verticalLayout_3 = new VerticalLayout(); verticalLayout_3.setImmediate(false); verticalLayout_3.setWidth("136.69%"); verticalLayout_3.setHeight("100.0%"); verticalLayout_3.setMargin(false); panel_2.setContent(verticalLayout_3); return panel_2; } }
[ "swriddle@gmail.com" ]
swriddle@gmail.com
f3b3cc4e980620df13f4f637e7521fde7f69c829
b111b77f2729c030ce78096ea2273691b9b63749
/db-example-large-multi-project/project4/src/main/java/org/gradle/test/performance/mediumjavamultiproject/project4/p23/Production464.java
75038b6dce6921ca608387fd8bf28f87233323b7
[]
no_license
WeilerWebServices/Gradle
a1a55bdb0dd39240787adf9241289e52f593ccc1
6ab6192439f891256a10d9b60f3073cab110b2be
refs/heads/master
2023-01-19T16:48:09.415529
2020-11-28T13:28:40
2020-11-28T13:28:40
256,249,773
1
0
null
null
null
null
UTF-8
Java
false
false
1,956
java
package org.gradle.test.performance.mediumjavamultiproject.project4.p23; public class Production464 { private Production461 property0; public Production461 getProperty0() { return property0; } public void setProperty0(Production461 value) { property0 = value; } private Production462 property1; public Production462 getProperty1() { return property1; } public void setProperty1(Production462 value) { property1 = value; } private Production463 property2; public Production463 getProperty2() { return property2; } public void setProperty2(Production463 value) { property2 = value; } private String property3; public String getProperty3() { return property3; } public void setProperty3(String value) { property3 = value; } private String property4; public String getProperty4() { return property4; } public void setProperty4(String value) { property4 = value; } private String property5; public String getProperty5() { return property5; } public void setProperty5(String value) { property5 = value; } private String property6; public String getProperty6() { return property6; } public void setProperty6(String value) { property6 = value; } private String property7; public String getProperty7() { return property7; } public void setProperty7(String value) { property7 = value; } private String property8; public String getProperty8() { return property8; } public void setProperty8(String value) { property8 = value; } private String property9; public String getProperty9() { return property9; } public void setProperty9(String value) { property9 = value; } }
[ "nateweiler84@gmail.com" ]
nateweiler84@gmail.com
274f694304fe6ccb95dd23799a67efa1cc70e9f1
57728206bbcfc486e7a5606b894fa9009a8b9a88
/server/src/com/cloud/upgrade/dao/Upgrade2210to2211.java
3ba74974b55f71f8ae67f07f5d56830f57ee9dec
[]
no_license
chiragjog/CloudStack
ae790a261045ebbf68a33d8dd1a86e6b479a5770
6279ca28d6e274fba980527f39b89e9af2bf588a
refs/heads/master
2021-01-18T03:36:30.256959
2012-02-24T01:18:50
2012-02-24T01:18:50
2,956,218
2
1
null
null
null
null
UTF-8
Java
false
false
1,897
java
/** * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. * * This software is licensed under the GNU General Public License v3 or later. * * It is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ package com.cloud.upgrade.dao; import java.io.File; import java.sql.Connection; import org.apache.log4j.Logger; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.script.Script; public class Upgrade2210to2211 implements DbUpgrade { final static Logger s_logger = Logger.getLogger(Upgrade2210to2211.class); @Override public String[] getUpgradableVersionRange() { return new String[] { "2.2.10", "2.2.10"}; } @Override public String getUpgradedVersion() { return "2.2.11"; } @Override public boolean supportsRollingUpgrade() { return true; } @Override public File[] getPrepareScripts() { String script = Script.findScript("", "db/schema-2210to2211.sql"); if (script == null) { throw new CloudRuntimeException("Unable to find db/schema-2210to2211.sql"); } return new File[] { new File(script) }; } @Override public void performDataMigration(Connection conn) { } @Override public File[] getCleanupScripts() { return null; } }
[ "prachi@cloud.com" ]
prachi@cloud.com
13cac48f4701c7059a4d866c9a5de8cdcf24f2aa
041b673c9b18f24705fcebcbdc21f4f3c236487a
/app/src/main/java/com/homecaravan/android/consumer/widget/crystalrangeseekbar/widgets/BubbleThumbSeekbar.java
5141ccae3fc63177424e1f9795dd667e23c57e47
[]
no_license
Rainy1193/HCDemo
63ed54d42e65cf17ba4873c424a7e5f27bc6519e
66498a0892e000f04aa30932b67106344a96ac8c
refs/heads/master
2021-09-04T20:08:27.932681
2018-01-22T01:55:26
2018-01-22T01:55:26
107,510,248
0
0
null
null
null
null
UTF-8
Java
false
false
10,752
java
package com.homecaravan.android.consumer.widget.crystalrangeseekbar.widgets; import android.animation.PropertyValuesHolder; import android.animation.ValueAnimator; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.RectF; import android.os.Handler; import android.util.AttributeSet; import android.view.animation.OvershootInterpolator; import com.homecaravan.android.R; /** * Created by owais.ali on 7/12/2016. */ public class BubbleThumbSeekbar extends CrystalSeekbar { ////////////////////////////////////////// // PRIVATE CONSTANTS ////////////////////////////////////////// //private static final float BUBBLE_WITH = 200f; //private static final float BUBBLE_HEIGHT = 200f; ////////////////////////////////////////// // PRIVATE VAR ////////////////////////////////////////// private boolean animate; private boolean isPressedLeftThumb; private BubbleRect thumbPressedRect; ////////////////////////////////////////// // CONSTRUCTOR ////////////////////////////////////////// public BubbleThumbSeekbar(Context context) { super(context); } public BubbleThumbSeekbar(Context context, AttributeSet attrs) { super(context, attrs); } public BubbleThumbSeekbar(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } ////////////////////////////////////////// // INITIALIZATION ////////////////////////////////////////// @Override protected void init(){ thumbPressedRect = new BubbleRect(); super.init(); } ////////////////////////////////////////// // OVERRIDE METHODS ////////////////////////////////////////// @Override protected void touchDown(float x, float y) { super.touchDown(x, y); animate = true; if(Thumb.MIN.equals(getPressedThumb())){ isPressedLeftThumb = true; startAnimationUp(); } } @Override protected void touchUp(float x, float y) { super.touchUp(x, y); animate = true; if(Thumb.MIN.equals(getPressedThumb())){ startAnimationDown(); } } @Override protected void drawLeftThumbWithColor(Canvas canvas, Paint paint, RectF rect) { if(isPressedLeftThumb){ if(! animate){ rect.left = rect.left - ((getBubbleWith() / 2) - (getThumbWidth() / 2)); rect.right = rect.left + getBubbleWith(); rect.top = getLeftThumbRect().top - ((getBubbleHeight() / 2) - (getThumbHeight() / 2)); rect.bottom = getLeftThumbRect().bottom + ((getBubbleHeight() / 2) - (getThumbHeight() / 2)); } else{ rect.left = thumbPressedRect.left; rect.right = thumbPressedRect.right; rect.top = thumbPressedRect.top; rect.bottom = thumbPressedRect.bottom; } canvas.drawOval(rect, paint); } else { canvas.drawOval(rect, paint); } } @Override protected void drawLeftThumbWithImage(Canvas canvas, Paint paint, RectF rect, Bitmap image) { if(isPressedLeftThumb){ if(! animate){ image = resizeImage((int) getBubbleWith(), (int) getBubbleHeight(), image); rect.top = getLeftThumbRect().top - ((getBubbleHeight() / 2) - (getThumbHeight() / 2)); rect.left = rect.left - ((getBubbleWith() / 2) - (getThumbWidth() / 2)); } else{ image = resizeImage((int) thumbPressedRect.imageWith, (int) thumbPressedRect.imageHeight, image); rect.top = thumbPressedRect.top; rect.left = thumbPressedRect.left; } canvas.drawBitmap(image, rect.left, rect.top, paint); } else{ canvas.drawBitmap(image, rect.left, rect.top, paint); } } ////////////////////////////////////////// // PROTECTED METHODS ////////////////////////////////////////// protected float getBubbleWith(){ return getResources().getDimension(R.dimen.bubble_thumb_width); } protected float getBubbleHeight(){ return getResources().getDimension(R.dimen.bubble_thumb_height); } protected void startAnimationUp(){ BubbleRect toRect = new BubbleRect(); RectF fromRect = getLeftThumbRect(); toRect.left = fromRect.left - ((getBubbleWith() / 2) - (getThumbWidth() / 2)); toRect.right = toRect.left + getBubbleWith(); toRect.top = fromRect.top - ((getBubbleHeight() / 2) - (getThumbHeight() / 2)); toRect.bottom = fromRect.bottom + ((getBubbleHeight() / 2) - (getThumbHeight() / 2)); PropertyValuesHolder leftValueHolder = PropertyValuesHolder.ofFloat("left", fromRect.left, toRect.left); PropertyValuesHolder rightValueHolder = PropertyValuesHolder.ofFloat("right", fromRect.right, toRect.right); PropertyValuesHolder topValueHolder = PropertyValuesHolder.ofFloat("top", fromRect.top, toRect.top); PropertyValuesHolder bottomValueHolder = PropertyValuesHolder.ofFloat("bottom", fromRect.bottom, toRect.bottom); PropertyValuesHolder imageWithValueHolder = PropertyValuesHolder.ofFloat("width", getThumbWidth(), getBubbleWith()); PropertyValuesHolder imageHeightValueHolder = PropertyValuesHolder.ofFloat("height", getThumbHeight(), getBubbleHeight()); ValueAnimator animation = ValueAnimator.ofPropertyValuesHolder(leftValueHolder, rightValueHolder, topValueHolder, bottomValueHolder, imageWithValueHolder, imageHeightValueHolder); animation.setDuration(200); animation.setInterpolator(new OvershootInterpolator(5f)); animation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { thumbPressedRect.left = (float)animation.getAnimatedValue("left"); thumbPressedRect.right = (float)animation.getAnimatedValue("right"); thumbPressedRect.top = (float)animation.getAnimatedValue("top"); thumbPressedRect.bottom = (float)animation.getAnimatedValue("bottom"); thumbPressedRect.imageWith = (float)animation.getAnimatedValue("width"); thumbPressedRect.imageHeight = (float)animation.getAnimatedValue("height"); invalidate(); } }); animation.start(); new Handler().postDelayed(new Runnable() { @Override public void run() { animate = false; } }, 200); } protected void startAnimationDown(){ RectF toRect = new RectF(); RectF fromRect = getLeftThumbRect(); toRect.left = fromRect.left + ((getBubbleWith() / 2) - (getThumbWidth() / 2)); toRect.right = toRect.left + getThumbWidth(); toRect.top = 0f; toRect.bottom = getThumbHeight(); PropertyValuesHolder leftValueHolder = PropertyValuesHolder.ofFloat("left", fromRect.left, toRect.left); PropertyValuesHolder rightValueHolder = PropertyValuesHolder.ofFloat("right", fromRect.right, toRect.right); PropertyValuesHolder topValueHolder = PropertyValuesHolder.ofFloat("top", fromRect.top, toRect.top); PropertyValuesHolder bottomValueHolder = PropertyValuesHolder.ofFloat("bottom", fromRect.bottom, toRect.bottom); PropertyValuesHolder imageWithValueHolder = PropertyValuesHolder.ofFloat("width", getBubbleWith(), getThumbWidth()); PropertyValuesHolder imageHeightValueHolder = PropertyValuesHolder.ofFloat("height", getBubbleHeight(), getThumbHeight()); ValueAnimator animation = ValueAnimator.ofPropertyValuesHolder(leftValueHolder, rightValueHolder, topValueHolder, bottomValueHolder, imageWithValueHolder, imageHeightValueHolder); animation.setDuration(300); animation.setInterpolator(new OvershootInterpolator(3f)); animation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { thumbPressedRect.left = (float)animation.getAnimatedValue("left"); thumbPressedRect.right = (float)animation.getAnimatedValue("right"); thumbPressedRect.top = (float)animation.getAnimatedValue("top"); thumbPressedRect.bottom = (float)animation.getAnimatedValue("bottom"); thumbPressedRect.imageWith = (float)animation.getAnimatedValue("width"); thumbPressedRect.imageHeight = (float)animation.getAnimatedValue("height"); invalidate(); } }); animation.start(); new Handler().postDelayed(new Runnable() { @Override public void run() { animate = false; isPressedLeftThumb = false; } }, 300); } ////////////////////////////////////////// // PUBLIC METHODS ////////////////////////////////////////// ////////////////////////////////////////// // PRIVATE METHODS ////////////////////////////////////////// private Bitmap resizeImage( int iconWidth, int iconHeight, Bitmap bmp) { int width = bmp.getWidth(); int height = bmp.getHeight(); // calculate the scale float scaleWidth = ((float) iconWidth) / width; float scaleHeight = ((float) iconHeight) / height; // create a matrix for the manipulation Matrix matrix = new Matrix(); // resize the Bitmap matrix.postScale(scaleWidth, scaleHeight); // if you want to rotate the Bitmap // matrix.postRotate(45); // recreate the new Bitmap // make a Drawable from Bitmap to allow to set the Bitmap // to the ImageView, ImageButton or what ever return Bitmap.createBitmap(bmp, 0, 0, width, height, matrix, true); } ////////////////////////////////////////// // PRIVATE CLASS ////////////////////////////////////////// private class BubbleRect{ public float left; public float right; public float top; public float bottom; public float imageWith; public float imageHeight; } }
[ "daupraoc@gmail.com" ]
daupraoc@gmail.com
0ec18bcee85efda476f3b68d9f56a2e76473fadc
f24f0eeffb444e71370ee52c074351bc5f21735a
/src/main/java/br/cefetmg/vitor/udp_broker/core/ISecurity.java
7a7ce8a448fe36a4f494cf68a984bd88edf3e0fe
[]
no_license
vitorsm/udp-boker
2b55d11b3cf545cf9deff62ad0e0eab9fbc6b4a4
7d2edd78d79fb5c2ce9d5b5f07ede8fb4e88c0d7
refs/heads/master
2020-03-22T21:09:41.028697
2018-11-28T11:05:00
2018-11-28T11:05:00
140,662,024
0
0
null
null
null
null
UTF-8
Java
false
false
496
java
package br.cefetmg.vitor.udp_broker.core; import br.cefetmg.vitor.udp_broker.models.Client; import br.cefetmg.vitor.udp_broker.models.Topic; public interface ISecurity { public String getAccessToken(); // public Client getClientByToken(String token); public boolean hasPublishPermission(String token, Topic topic); public boolean hasSubscribePermission(String token, Topic topic); public boolean hasKeepAlivePermission(String token); public String generateReducedToken(String token); }
[ "vitor.sousa.moreira@hotmail.com" ]
vitor.sousa.moreira@hotmail.com
d2b102295b740b337a893c91bb6be9f44f248f5a
31bf59dab28fe245165be007b49e872ec4b6ce48
/app/build/tmp/kapt3/stubs/debug/com/rasalexman/hiltclean/model/remote/ResponseData.java
590cc17d4c6925f964d1e8652acd2287a8937dec
[]
no_license
Rasalexman/HiltExample
14e6eda3840c2a5cb9b97cfeb81dc639b9f71f06
6d9c03ca20a36d2522145d271a7b3154cf267542
refs/heads/master
2023-01-16T07:26:53.753460
2020-11-22T16:51:46
2020-11-22T16:51:46
275,111,528
1
0
null
2020-11-22T16:50:30
2020-06-26T08:44:04
Java
UTF-8
Java
false
false
4,195
java
package com.rasalexman.hiltclean.model.remote; import java.lang.System; @kotlin.Metadata(mv = {1, 1, 16}, bv = {1, 0, 3}, k = 1, d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u0007\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\f\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0002\b\u0086\b\u0018\u00002\u00020\u0001B%\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u000e\u0010\u0006\u001a\n\u0012\u0004\u0012\u00020\b\u0018\u00010\u0007\u00a2\u0006\u0002\u0010\tJ\t\u0010\u0010\u001a\u00020\u0003H\u00c6\u0003J\t\u0010\u0011\u001a\u00020\u0005H\u00c6\u0003J\u0011\u0010\u0012\u001a\n\u0012\u0004\u0012\u00020\b\u0018\u00010\u0007H\u00c6\u0003J/\u0010\u0013\u001a\u00020\u00002\b\b\u0002\u0010\u0002\u001a\u00020\u00032\b\b\u0002\u0010\u0004\u001a\u00020\u00052\u0010\b\u0002\u0010\u0006\u001a\n\u0012\u0004\u0012\u00020\b\u0018\u00010\u0007H\u00c6\u0001J\u0013\u0010\u0014\u001a\u00020\u00152\b\u0010\u0016\u001a\u0004\u0018\u00010\u0001H\u00d6\u0003J\t\u0010\u0017\u001a\u00020\u0018H\u00d6\u0001J\t\u0010\u0019\u001a\u00020\u0003H\u00d6\u0001R\u0016\u0010\u0004\u001a\u00020\u00058\u0006X\u0087\u0004\u00a2\u0006\b\n\u0000\u001a\u0004\b\n\u0010\u000bR\u001e\u0010\u0006\u001a\n\u0012\u0004\u0012\u00020\b\u0018\u00010\u00078\u0006X\u0087\u0004\u00a2\u0006\b\n\u0000\u001a\u0004\b\f\u0010\rR\u0016\u0010\u0002\u001a\u00020\u00038\u0006X\u0087\u0004\u00a2\u0006\b\n\u0000\u001a\u0004\b\u000e\u0010\u000f\u00a8\u0006\u001a"}, d2 = {"Lcom/rasalexman/hiltclean/model/remote/ResponseData;", "", "translatedText", "", "match", "", "matches", "", "Lcom/rasalexman/hiltclean/model/remote/Matches;", "(Ljava/lang/String;FLjava/util/List;)V", "getMatch", "()F", "getMatches", "()Ljava/util/List;", "getTranslatedText", "()Ljava/lang/String;", "component1", "component2", "component3", "copy", "equals", "", "other", "hashCode", "", "toString", "app_debug"}) public final class ResponseData { @org.jetbrains.annotations.NotNull() @com.google.gson.annotations.SerializedName(value = "translatedText") private final java.lang.String translatedText = null; @com.google.gson.annotations.SerializedName(value = "match") private final float match = 0.0F; @org.jetbrains.annotations.Nullable() @com.google.gson.annotations.SerializedName(value = "matches") private final java.util.List<com.rasalexman.hiltclean.model.remote.Matches> matches = null; @org.jetbrains.annotations.NotNull() public final java.lang.String getTranslatedText() { return null; } public final float getMatch() { return 0.0F; } @org.jetbrains.annotations.Nullable() public final java.util.List<com.rasalexman.hiltclean.model.remote.Matches> getMatches() { return null; } public ResponseData(@org.jetbrains.annotations.NotNull() java.lang.String translatedText, float match, @org.jetbrains.annotations.Nullable() java.util.List<com.rasalexman.hiltclean.model.remote.Matches> matches) { super(); } @org.jetbrains.annotations.NotNull() public final java.lang.String component1() { return null; } public final float component2() { return 0.0F; } @org.jetbrains.annotations.Nullable() public final java.util.List<com.rasalexman.hiltclean.model.remote.Matches> component3() { return null; } @org.jetbrains.annotations.NotNull() public final com.rasalexman.hiltclean.model.remote.ResponseData copy(@org.jetbrains.annotations.NotNull() java.lang.String translatedText, float match, @org.jetbrains.annotations.Nullable() java.util.List<com.rasalexman.hiltclean.model.remote.Matches> matches) { return null; } @org.jetbrains.annotations.NotNull() @java.lang.Override() public java.lang.String toString() { return null; } @java.lang.Override() public int hashCode() { return 0; } @java.lang.Override() public boolean equals(@org.jetbrains.annotations.Nullable() java.lang.Object p0) { return false; } }
[ "sphc@yandex.ru" ]
sphc@yandex.ru
e56d9fdf8b0677a9a2c1808acfc461e1db47b418
9c7dc5bae21ce915c00f9ca755b116e140513c15
/Romantism/Project/lib/com/scrufflet/planned/PColor.java
b1e086c77f7f6b616e597704648f1f0efa5218c4
[]
no_license
Scrufflet/Romantism
2b8a2e83d30bab4ebc9f4e8886574680a972c2d2
27390d9d145d268346eb5a4cc3937ac15caaf851
refs/heads/master
2021-01-19T08:37:12.797809
2013-10-26T11:06:50
2013-10-26T11:06:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,324
java
package com.scrufflet.planned; public class PColor { // Static public static int rgbToHex(int red, int green, int blue) { return ((red & 0x0ff) << 16) | ((green & 0x0ff) << 8) | (blue & 0x0ff); } public static int[] hexToRGB(int color) { return new int[] {(color & 0x00ff0000) >> 16, (color & 0x0000ff00) >> 8, color & 0x000000ff}; } public static int changeHex(int color, int value) { int[] rgb = hexToRGB(color); for(int i = 0; i < rgb.length; i ++) { rgb[i] += value; if(rgb[i] < 0) rgb[i] = 0; if(rgb[i] > 255) rgb[i] = 255; } return rgbToHex(rgb[0], rgb[1], rgb[2]); } // Non-static private int color; public PColor(int red, int green, int blue) { color = rgbToHex(red, green, blue); int[] rgb = getRGB(); for(int i = 0; i < rgb.length; i ++) { if(rgb[i] < 0) rgb[i] = 0; if(rgb[i] > 255) rgb[i] = 255; } color = rgbToHex(rgb[0], rgb[1], rgb[2]); } public PColor(int hex) { this.color = hex; } public void setColor(int hex) { color = hex; } public void setColor(int red, int green, int blue) { color = rgbToHex(red, green, blue); } public int getColor() { return color; } public int[] getRGB() { return hexToRGB(getColor()); } }
[ "alex@scrufflet.com" ]
alex@scrufflet.com
11806457c60ad98125d33c03d85fa207c620d4cf
607386530d05a3176b442aa51e313f30ff08e9de
/seamcat/presentation/batch/BatchParameterListModel.java
02fda59b967d092f1d62129a839417d15bc0fc74
[]
no_license
rayvo/seamcat
6b532137b2a6d9149f8a5102a48327188dcbec3c
4f9cfbab3532bb94cb35911d535af2099d779a04
refs/heads/master
2021-01-10T21:33:57.171281
2009-03-27T12:35:45
2009-03-27T12:35:45
33,710,648
0
0
null
null
null
null
UTF-8
Java
false
false
4,226
java
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) // Source File Name: BatchParameterListModel.java package org.seamcat.presentation.batch; import java.util.*; import javax.swing.ListModel; import javax.swing.event.ListDataEvent; import javax.swing.event.ListDataListener; import org.apache.log4j.Logger; import org.seamcat.batch.BatchJob; import org.seamcat.batch.BatchParameter; import org.seamcat.model.SeamcatComponent; import org.seamcat.model.Workspace; import org.seamcat.presentation.Node; public class BatchParameterListModel implements ListModel { public BatchParameterListModel() { } public BatchParameter getBatchParameterAt(int index) { checkParameterIndex(index); return (BatchParameter)parameters.get(index); } public void addExclude(BatchParameter b) { excludeSet.add(b); fireContentsChanged(); } public void removeExclude(BatchParameter b) { excludeSet.remove(b); fireContentsChanged(); } public boolean isExcluded(BatchParameter b) { return excludeSet.contains(b); } public boolean isExcluded(int index) { checkParameterIndex(index); return isExcluded((BatchParameter)parameters.get(index)); } private void checkParameterIndex(int index) { if(index >= getSize()) throw new ArrayIndexOutOfBoundsException((new StringBuilder()).append("BatchParameterIndex does not exist (size=").append(parameters.size()).append(")").toString()); else return; } public void setBatchJob(BatchJob bj) { parameters.clear(); excludeSet.clear(); if(bj != null) { Workspace wks = bj.getWorkspace(); if(wks != null) { Node scenario = wks.getScenario(); parameters.addAll(initParameters(0, scenario, new StringBuffer())); excludeSet.addAll(bj.getParameters()); } } fireContentsChanged(); } private void fireContentsChanged() { ListDataEvent event = new ListDataEvent(this, 0, 0, Math.max(parameters.size() - 1, 0)); ListDataListener l; for(Iterator i$ = listDataListeners.iterator(); i$.hasNext(); l.contentsChanged(event)) l = (ListDataListener)i$.next(); } private static List initParameters(int parameterIndex, Node node, StringBuffer path) { List parameters = new ArrayList(); path.append(" / ").append(node.toString()); if(node instanceof SeamcatComponent) { org.seamcat.model.NodeAttribute att[] = node.getNodeAttributes(); for(int cnt = 0; cnt < att.length; cnt++) parameters.add(new BatchParameter((SeamcatComponent)node, cnt, parameterIndex++, path.toString())); } for(int x = 0; x < node.getChildCount(); x++) { List l = initParameters(parameterIndex, node.getChildAt(x), new StringBuffer(path)); parameters.addAll(l); parameterIndex += l.size(); } return parameters; } public int getSize() { return parameters.size(); } public Object getElementAt(int index) { return getBatchParameterAt(index); } public void addListDataListener(ListDataListener l) { if(!listDataListeners.contains(l)) listDataListeners.add(l); } public void clear() { parameters.clear(); } public void removeListDataListener(ListDataListener l) { listDataListeners.remove(l); } private static final Logger LOG = Logger.getLogger(org/seamcat/presentation/batch/BatchParameterListModel); private static final String PATH_DELIMITER = " / "; private final List parameters = new ArrayList(); private final List listDataListeners = new ArrayList(); private final Set excludeSet = new HashSet(); }
[ "voquocduy1983@0fa86794-1aca-11de-9c9a-2d325a3e6494" ]
voquocduy1983@0fa86794-1aca-11de-9c9a-2d325a3e6494
a8642e8637ca954ca8342b4fe1b0fca59f41fd24
73d2606e6af84fb685fbd1d2ae24ffbd6d6d80c6
/core_java/src/day7/fileHandling/Example6.java
f6c13d24c8fa357ac73034a7ee20ae2d1581bf44
[]
no_license
arrpita14/CoreAndAdvancedJava
41b10ebc59ccc064dce56c882756227d7e63aa14
b15e80274cdbdc58fb6ccd6bde2dc6cc5815e713
refs/heads/master
2023-02-12T20:26:33.292327
2021-01-09T06:59:57
2021-01-09T06:59:57
328,089,066
0
0
null
null
null
null
UTF-8
Java
false
false
653
java
package day7.fileHandling; import java.io.*; public class Example6 { //deleting a file from directory public static void main(String[] args) { try { File f1 = new File("D\\test1"); f1.mkdir(); boolean fileExixts = f1.exists(); if(fileExixts) { System.out.println("Folder exists"); System.out.println("We are now deleting the folder"); boolean deleteFolder = f1.delete(); if(deleteFolder) { System.out.println("Folder deleted successfully!"); } else { System.out.println("Unable to delete a folder"); } } else { System.out.println("Folder does not exist"); } } catch (Exception e) { System.out.println("Exception occured "+e); } }}
[ "arpitadas141098@gmail.com" ]
arpitadas141098@gmail.com
4d82935e7f403bf082a6d87230c6a2b92149fbaa
d502c1e6b24da059f92732b87203ef74aca7d0a2
/MyProject/Test/PlayerTest.java
f1e540c28aaf2e7d4344638b0dc5b67ef47f1cf6
[]
no_license
triest/Java-different
a4a326febd1fe1cd7cc43271c7043749db3cb96b
f316c3ab4d190d370cf3b1299e57f9c9817a8221
refs/heads/master
2020-09-07T10:53:42.732416
2019-11-10T07:32:15
2019-11-10T07:32:15
220,755,784
0
0
null
null
null
null
UTF-8
Java
false
false
645
java
import static org.junit.Assert.*; import org.junit.Assert; import org.junit.Test; import java.lang.reflect.*; import static org.junit.Assert.*; /** * Created by triest on 13.02.2017. */ public class PlayerTest { @Test public void getName() throws Exception { String value="Jon"; Player player=new Player(value,null); assertEquals(value,player.getName()); } @Test public void getFigure() throws Exception{ final Figure input=Figure.X; final Figure extendValue=input; Player player=new Player("Jon",input); assertEquals(extendValue,player.getFigure()); } }
[ "you@example.com" ]
you@example.com
3400b0ea2b27c25653a2b333f2644f54982989fb
81146007fe9a7bf25e048033127918c024b0b8ba
/course-jvm/src/main/java/org/deanlee/course/Application.java
7febcb252e0cc22818fcacdcb754e81e184b62c0
[]
no_license
DEAN-Lee/basic-course
1059a30e900490298b475fa3174c3f2a26671b16
049ea7e9077118514c6ad1bf25c55c4d71e79372
refs/heads/master
2022-06-23T08:47:18.505907
2021-07-15T12:51:05
2021-07-15T12:51:05
220,006,859
1
0
null
2022-06-17T02:53:03
2019-11-06T13:47:03
Java
UTF-8
Java
false
false
965
java
package org.deanlee.course; import org.deanlee.course.jvm.OutMemoryErrorDemo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.Banner; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; /** * @author LiMeng * @version 1.0 * @date 2019-11-14 11:51 */ @SpringBootApplication public class Application implements CommandLineRunner { @Autowired OutMemoryErrorDemo outMemoryErrorDemo; public static void main(String[] args) throws Exception { //disabled banner, don't want to see the spring logo SpringApplication app = new SpringApplication(Application.class); app.setBannerMode(Banner.Mode.OFF); app.run(args); } @Override public void run(String... args) throws Exception { // inputOrOutStreamDemo.readInputFileDemo(); } }
[ "limeng@lechebang.com" ]
limeng@lechebang.com
89578dc1fb9eb8d13402900a9289218ded9f860f
7731416ca9afff3e69141d5d0087c193ca3e7180
/src/CAL_Libraries/src/org/openquark/cal/module/Cal/Utilities/CAL_RelativeTime.java
aa2e6cde1355d407a4b25269df2ea992c1f6fca1
[]
no_license
rdwebster/Open-Quark
288d38f823e21ec2e338adb2d05f3e05b027f603
86397b53eea2518851b4995edae2aa687f8d8812
refs/heads/master
2021-01-20T15:50:03.540743
2014-07-23T18:11:37
2014-07-23T18:11:37
481,429
0
0
null
null
null
null
UTF-8
Java
false
false
61,157
java
/* * <!-- * * ************************************************************** * This Java source has been automatically generated. * MODIFICATIONS TO THIS SOURCE MAY BE OVERWRITTEN - DO NOT MODIFY THIS FILE * ************************************************************** * * * This file (CAL_RelativeTime.java) * was generated from CAL module: Cal.Utilities.RelativeTime. * The constants and methods provided are intended to facilitate accessing the * Cal.Utilities.RelativeTime module from Java code. * * Creation date: Tue Aug 28 15:58:40 PDT 2007 * --!> * */ package org.openquark.cal.module.Cal.Utilities; import org.openquark.cal.compiler.ModuleName; import org.openquark.cal.compiler.QualifiedName; import org.openquark.cal.compiler.SourceModel; /** * This module contains the <code>Cal.Utilities.RelativeTime.RelativeDate</code>, <code>Cal.Utilities.RelativeTime.RelativeTime</code> and * <code>Cal.Utilities.RelativeTime.RelativeDateTime</code> types, together with the functions that operate on them. * <p> * These types represent dates, times and date-time values, without the notion of a specific time-zone. * In other words, they are not a precise moment in time, such as defined by the <code>Cal.Utilities.Time.Time</code> type, * but rather a relative concept. For example, it is valid to speak of Sept 1, 2006 as being the first day of the * month of September, but depending on where in the world one is at a specific moment in time, the actual date * could be August 31, 2005 or September 2, 2005. * <p> * In addition, <code>Cal.Utilities.RelativeTime.RelativeDate</code> and <code>Cal.Utilities.RelativeTime.RelativeDateTime</code> are implicitly with respect * to the Gregorian calendar. * * @author Bo Ilic */ public final class CAL_RelativeTime { public static final ModuleName MODULE_NAME = ModuleName.make("Cal.Utilities.RelativeTime"); /** * This inner class (TypeConstructors) contains constants * and methods related to binding to CAL TypeConstructors in the Cal.Utilities.RelativeTime module. */ public static final class TypeConstructors { /** * Used to specify the units of a time interval to be added * * <dl><dt><b>See Also:</b> * <dd><b>Functions and Class Methods:</b> Cal.Utilities.RelativeTime.dateAdd * </dl> */ public static final QualifiedName DateAddType = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "DateAddType"); /** * Type to specify the units for the result of performing a difference between 2 date-time values. * <p> * For example, it allows you to specify that you want the difference expressed in quarters, or weeks. */ public static final QualifiedName DateDiffType = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "DateDiffType"); /** Name binding for TypeConsApp: DatePartType. */ public static final QualifiedName DatePartType = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "DatePartType"); /** Name binding for TypeConsApp: DayOfWeek. */ public static final QualifiedName DayOfWeek = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "DayOfWeek"); /** * Used to specify the definition of what the first week of the year should be considered to be. * * <dl><dt><b>See Also:</b> * <dd><b>Functions and Class Methods:</b> Cal.Utilities.RelativeTime.datePart * </dl> */ public static final QualifiedName FirstWeekOfYear = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "FirstWeekOfYear"); /** Name binding for TypeConsApp: JDate. */ public static final QualifiedName JDate = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "JDate"); /** * Type to represent a date value without the notion of a time-zone. The date values are implicitly * with respect to the Gregorian calendar. */ public static final QualifiedName RelativeDate = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "RelativeDate"); /** * Type to represent a date-time value without the notion of a time-zone. The date-time values are implicitly * with respect to the Gregorian calendar. */ public static final QualifiedName RelativeDateTime = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "RelativeDateTime"); /** * Type to represent a time value in a single 24 hour day. The actual day is unspecified so it is a relative * notion of time. */ public static final QualifiedName RelativeTime = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "RelativeTime"); } /** * This inner class (DataConstructors) contains constants * and methods related to binding to CAL DataConstructors in the Cal.Utilities.RelativeTime module. */ public static final class DataConstructors { /* * DataConstructors for the Cal.Utilities.RelativeTime.DateAddType data type. */ /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.YearAdd. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.YearAdd */ public static final SourceModel.Expr YearAdd() { return SourceModel.Expr.DataCons.make(DataConstructors.YearAdd); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.YearAdd. * @see #YearAdd() */ public static final QualifiedName YearAdd = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "YearAdd"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.YearAdd. * @see #YearAdd() */ public static final int YearAdd_ordinal = 0; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.QuarterAdd. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.QuarterAdd */ public static final SourceModel.Expr QuarterAdd() { return SourceModel.Expr.DataCons.make(DataConstructors.QuarterAdd); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.QuarterAdd. * @see #QuarterAdd() */ public static final QualifiedName QuarterAdd = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "QuarterAdd"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.QuarterAdd. * @see #QuarterAdd() */ public static final int QuarterAdd_ordinal = 1; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.MonthAdd. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.MonthAdd */ public static final SourceModel.Expr MonthAdd() { return SourceModel.Expr.DataCons.make(DataConstructors.MonthAdd); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.MonthAdd. * @see #MonthAdd() */ public static final QualifiedName MonthAdd = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "MonthAdd"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.MonthAdd. * @see #MonthAdd() */ public static final int MonthAdd_ordinal = 2; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.DayAdd. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.DayAdd */ public static final SourceModel.Expr DayAdd() { return SourceModel.Expr.DataCons.make(DataConstructors.DayAdd); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.DayAdd. * @see #DayAdd() */ public static final QualifiedName DayAdd = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "DayAdd"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.DayAdd. * @see #DayAdd() */ public static final int DayAdd_ordinal = 3; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.WeekAdd. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.WeekAdd */ public static final SourceModel.Expr WeekAdd() { return SourceModel.Expr.DataCons.make(DataConstructors.WeekAdd); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.WeekAdd. * @see #WeekAdd() */ public static final QualifiedName WeekAdd = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "WeekAdd"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.WeekAdd. * @see #WeekAdd() */ public static final int WeekAdd_ordinal = 4; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.HourAdd. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.HourAdd */ public static final SourceModel.Expr HourAdd() { return SourceModel.Expr.DataCons.make(DataConstructors.HourAdd); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.HourAdd. * @see #HourAdd() */ public static final QualifiedName HourAdd = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "HourAdd"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.HourAdd. * @see #HourAdd() */ public static final int HourAdd_ordinal = 5; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.MinuteAdd. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.MinuteAdd */ public static final SourceModel.Expr MinuteAdd() { return SourceModel.Expr.DataCons.make(DataConstructors.MinuteAdd); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.MinuteAdd. * @see #MinuteAdd() */ public static final QualifiedName MinuteAdd = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "MinuteAdd"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.MinuteAdd. * @see #MinuteAdd() */ public static final int MinuteAdd_ordinal = 6; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.SecondAdd. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.SecondAdd */ public static final SourceModel.Expr SecondAdd() { return SourceModel.Expr.DataCons.make(DataConstructors.SecondAdd); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.SecondAdd. * @see #SecondAdd() */ public static final QualifiedName SecondAdd = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "SecondAdd"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.SecondAdd. * @see #SecondAdd() */ public static final int SecondAdd_ordinal = 7; /* * DataConstructors for the Cal.Utilities.RelativeTime.DateDiffType data type. */ /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.YearDiff. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.YearDiff */ public static final SourceModel.Expr YearDiff() { return SourceModel.Expr.DataCons.make(DataConstructors.YearDiff); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.YearDiff. * @see #YearDiff() */ public static final QualifiedName YearDiff = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "YearDiff"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.YearDiff. * @see #YearDiff() */ public static final int YearDiff_ordinal = 0; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.QuarterDiff. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.QuarterDiff */ public static final SourceModel.Expr QuarterDiff() { return SourceModel.Expr.DataCons.make(DataConstructors.QuarterDiff); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.QuarterDiff. * @see #QuarterDiff() */ public static final QualifiedName QuarterDiff = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "QuarterDiff"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.QuarterDiff. * @see #QuarterDiff() */ public static final int QuarterDiff_ordinal = 1; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.MonthDiff. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.MonthDiff */ public static final SourceModel.Expr MonthDiff() { return SourceModel.Expr.DataCons.make(DataConstructors.MonthDiff); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.MonthDiff. * @see #MonthDiff() */ public static final QualifiedName MonthDiff = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "MonthDiff"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.MonthDiff. * @see #MonthDiff() */ public static final int MonthDiff_ordinal = 2; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.DayDiff. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.DayDiff */ public static final SourceModel.Expr DayDiff() { return SourceModel.Expr.DataCons.make(DataConstructors.DayDiff); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.DayDiff. * @see #DayDiff() */ public static final QualifiedName DayDiff = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "DayDiff"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.DayDiff. * @see #DayDiff() */ public static final int DayDiff_ordinal = 3; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.WeekDiff. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.WeekDiff */ public static final SourceModel.Expr WeekDiff() { return SourceModel.Expr.DataCons.make(DataConstructors.WeekDiff); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.WeekDiff. * @see #WeekDiff() */ public static final QualifiedName WeekDiff = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "WeekDiff"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.WeekDiff. * @see #WeekDiff() */ public static final int WeekDiff_ordinal = 4; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.FirstDayOfWeekDiff. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.FirstDayOfWeekDiff */ public static final SourceModel.Expr FirstDayOfWeekDiff() { return SourceModel.Expr.DataCons.make( DataConstructors.FirstDayOfWeekDiff); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.FirstDayOfWeekDiff. * @see #FirstDayOfWeekDiff() */ public static final QualifiedName FirstDayOfWeekDiff = QualifiedName.make( CAL_RelativeTime.MODULE_NAME, "FirstDayOfWeekDiff"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.FirstDayOfWeekDiff. * @see #FirstDayOfWeekDiff() */ public static final int FirstDayOfWeekDiff_ordinal = 5; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.HourDiff. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.HourDiff */ public static final SourceModel.Expr HourDiff() { return SourceModel.Expr.DataCons.make(DataConstructors.HourDiff); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.HourDiff. * @see #HourDiff() */ public static final QualifiedName HourDiff = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "HourDiff"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.HourDiff. * @see #HourDiff() */ public static final int HourDiff_ordinal = 6; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.MinuteDiff. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.MinuteDiff */ public static final SourceModel.Expr MinuteDiff() { return SourceModel.Expr.DataCons.make(DataConstructors.MinuteDiff); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.MinuteDiff. * @see #MinuteDiff() */ public static final QualifiedName MinuteDiff = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "MinuteDiff"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.MinuteDiff. * @see #MinuteDiff() */ public static final int MinuteDiff_ordinal = 7; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.SecondDiff. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.SecondDiff */ public static final SourceModel.Expr SecondDiff() { return SourceModel.Expr.DataCons.make(DataConstructors.SecondDiff); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.SecondDiff. * @see #SecondDiff() */ public static final QualifiedName SecondDiff = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "SecondDiff"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.SecondDiff. * @see #SecondDiff() */ public static final int SecondDiff_ordinal = 8; /* * DataConstructors for the Cal.Utilities.RelativeTime.DatePartType data type. */ /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.YearPart. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.YearPart */ public static final SourceModel.Expr YearPart() { return SourceModel.Expr.DataCons.make(DataConstructors.YearPart); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.YearPart. * @see #YearPart() */ public static final QualifiedName YearPart = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "YearPart"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.YearPart. * @see #YearPart() */ public static final int YearPart_ordinal = 0; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.QuarterPart. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.QuarterPart */ public static final SourceModel.Expr QuarterPart() { return SourceModel.Expr.DataCons.make(DataConstructors.QuarterPart); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.QuarterPart. * @see #QuarterPart() */ public static final QualifiedName QuarterPart = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "QuarterPart"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.QuarterPart. * @see #QuarterPart() */ public static final int QuarterPart_ordinal = 1; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.MonthPart. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.MonthPart */ public static final SourceModel.Expr MonthPart() { return SourceModel.Expr.DataCons.make(DataConstructors.MonthPart); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.MonthPart. * @see #MonthPart() */ public static final QualifiedName MonthPart = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "MonthPart"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.MonthPart. * @see #MonthPart() */ public static final int MonthPart_ordinal = 2; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.DayOfYearPart. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.DayOfYearPart */ public static final SourceModel.Expr DayOfYearPart() { return SourceModel.Expr.DataCons.make(DataConstructors.DayOfYearPart); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.DayOfYearPart. * @see #DayOfYearPart() */ public static final QualifiedName DayOfYearPart = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "DayOfYearPart"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.DayOfYearPart. * @see #DayOfYearPart() */ public static final int DayOfYearPart_ordinal = 3; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.DayPart. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.DayPart */ public static final SourceModel.Expr DayPart() { return SourceModel.Expr.DataCons.make(DataConstructors.DayPart); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.DayPart. * @see #DayPart() */ public static final QualifiedName DayPart = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "DayPart"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.DayPart. * @see #DayPart() */ public static final int DayPart_ordinal = 4; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.DayOfWeekPart. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.DayOfWeekPart */ public static final SourceModel.Expr DayOfWeekPart() { return SourceModel.Expr.DataCons.make(DataConstructors.DayOfWeekPart); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.DayOfWeekPart. * @see #DayOfWeekPart() */ public static final QualifiedName DayOfWeekPart = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "DayOfWeekPart"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.DayOfWeekPart. * @see #DayOfWeekPart() */ public static final int DayOfWeekPart_ordinal = 5; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.WeekOfYearPart. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.WeekOfYearPart */ public static final SourceModel.Expr WeekOfYearPart() { return SourceModel.Expr.DataCons.make(DataConstructors.WeekOfYearPart); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.WeekOfYearPart. * @see #WeekOfYearPart() */ public static final QualifiedName WeekOfYearPart = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "WeekOfYearPart"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.WeekOfYearPart. * @see #WeekOfYearPart() */ public static final int WeekOfYearPart_ordinal = 6; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.HourPart. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.HourPart */ public static final SourceModel.Expr HourPart() { return SourceModel.Expr.DataCons.make(DataConstructors.HourPart); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.HourPart. * @see #HourPart() */ public static final QualifiedName HourPart = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "HourPart"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.HourPart. * @see #HourPart() */ public static final int HourPart_ordinal = 7; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.MinutePart. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.MinutePart */ public static final SourceModel.Expr MinutePart() { return SourceModel.Expr.DataCons.make(DataConstructors.MinutePart); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.MinutePart. * @see #MinutePart() */ public static final QualifiedName MinutePart = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "MinutePart"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.MinutePart. * @see #MinutePart() */ public static final int MinutePart_ordinal = 8; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.SecondPart. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.SecondPart */ public static final SourceModel.Expr SecondPart() { return SourceModel.Expr.DataCons.make(DataConstructors.SecondPart); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.SecondPart. * @see #SecondPart() */ public static final QualifiedName SecondPart = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "SecondPart"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.SecondPart. * @see #SecondPart() */ public static final int SecondPart_ordinal = 9; /* * DataConstructors for the Cal.Utilities.RelativeTime.DayOfWeek data type. */ /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.Sunday. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.Sunday */ public static final SourceModel.Expr Sunday() { return SourceModel.Expr.DataCons.make(DataConstructors.Sunday); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.Sunday. * @see #Sunday() */ public static final QualifiedName Sunday = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "Sunday"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.Sunday. * @see #Sunday() */ public static final int Sunday_ordinal = 0; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.Monday. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.Monday */ public static final SourceModel.Expr Monday() { return SourceModel.Expr.DataCons.make(DataConstructors.Monday); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.Monday. * @see #Monday() */ public static final QualifiedName Monday = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "Monday"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.Monday. * @see #Monday() */ public static final int Monday_ordinal = 1; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.Tuesday. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.Tuesday */ public static final SourceModel.Expr Tuesday() { return SourceModel.Expr.DataCons.make(DataConstructors.Tuesday); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.Tuesday. * @see #Tuesday() */ public static final QualifiedName Tuesday = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "Tuesday"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.Tuesday. * @see #Tuesday() */ public static final int Tuesday_ordinal = 2; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.Wednesday. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.Wednesday */ public static final SourceModel.Expr Wednesday() { return SourceModel.Expr.DataCons.make(DataConstructors.Wednesday); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.Wednesday. * @see #Wednesday() */ public static final QualifiedName Wednesday = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "Wednesday"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.Wednesday. * @see #Wednesday() */ public static final int Wednesday_ordinal = 3; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.Thursday. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.Thursday */ public static final SourceModel.Expr Thursday() { return SourceModel.Expr.DataCons.make(DataConstructors.Thursday); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.Thursday. * @see #Thursday() */ public static final QualifiedName Thursday = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "Thursday"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.Thursday. * @see #Thursday() */ public static final int Thursday_ordinal = 4; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.Friday. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.Friday */ public static final SourceModel.Expr Friday() { return SourceModel.Expr.DataCons.make(DataConstructors.Friday); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.Friday. * @see #Friday() */ public static final QualifiedName Friday = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "Friday"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.Friday. * @see #Friday() */ public static final int Friday_ordinal = 5; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.Saturday. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.Saturday */ public static final SourceModel.Expr Saturday() { return SourceModel.Expr.DataCons.make(DataConstructors.Saturday); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.Saturday. * @see #Saturday() */ public static final QualifiedName Saturday = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "Saturday"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.Saturday. * @see #Saturday() */ public static final int Saturday_ordinal = 6; /* * DataConstructors for the Cal.Utilities.RelativeTime.FirstWeekOfYear data type. */ /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.WeekInWhichJan1Occurs. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.WeekInWhichJan1Occurs */ public static final SourceModel.Expr WeekInWhichJan1Occurs() { return SourceModel.Expr.DataCons.make( DataConstructors.WeekInWhichJan1Occurs); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.WeekInWhichJan1Occurs. * @see #WeekInWhichJan1Occurs() */ public static final QualifiedName WeekInWhichJan1Occurs = QualifiedName.make( CAL_RelativeTime.MODULE_NAME, "WeekInWhichJan1Occurs"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.WeekInWhichJan1Occurs. * @see #WeekInWhichJan1Occurs() */ public static final int WeekInWhichJan1Occurs_ordinal = 0; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.FirstWeekWithAtLeast4DaysInNewYear. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.FirstWeekWithAtLeast4DaysInNewYear */ public static final SourceModel.Expr FirstWeekWithAtLeast4DaysInNewYear() { return SourceModel.Expr.DataCons.make( DataConstructors.FirstWeekWithAtLeast4DaysInNewYear); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.FirstWeekWithAtLeast4DaysInNewYear. * @see #FirstWeekWithAtLeast4DaysInNewYear() */ public static final QualifiedName FirstWeekWithAtLeast4DaysInNewYear = QualifiedName.make( CAL_RelativeTime.MODULE_NAME, "FirstWeekWithAtLeast4DaysInNewYear"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.FirstWeekWithAtLeast4DaysInNewYear. * @see #FirstWeekWithAtLeast4DaysInNewYear() */ public static final int FirstWeekWithAtLeast4DaysInNewYear_ordinal = 1; /** * Binding for DataConstructor: Cal.Utilities.RelativeTime.FirstWeekFullyInNewYear. * @return the SourceModule.Expr representing an application of Cal.Utilities.RelativeTime.FirstWeekFullyInNewYear */ public static final SourceModel.Expr FirstWeekFullyInNewYear() { return SourceModel.Expr.DataCons.make( DataConstructors.FirstWeekFullyInNewYear); } /** * Name binding for DataConstructor: Cal.Utilities.RelativeTime.FirstWeekFullyInNewYear. * @see #FirstWeekFullyInNewYear() */ public static final QualifiedName FirstWeekFullyInNewYear = QualifiedName.make( CAL_RelativeTime.MODULE_NAME, "FirstWeekFullyInNewYear"); /** * Ordinal of DataConstructor Cal.Utilities.RelativeTime.FirstWeekFullyInNewYear. * @see #FirstWeekFullyInNewYear() */ public static final int FirstWeekFullyInNewYear_ordinal = 2; } /** * This inner class (Functions) contains constants * and methods related to binding to CAL functions in the Cal.Utilities.RelativeTime module. */ public static final class Functions { /** * <code>Cal.Utilities.RelativeTime.dateAdd</code> is used to add intervals of time to a <code>Cal.Utilities.RelativeTime.RelativeDateTime</code> value. Its main feature * is that the date-time returned will always be valid. For example, <code>Cal.Utilities.RelativeTime.dateAdd</code> takes into account such factors as * the number of days in a month and leap years. * @param intervalType (CAL type: <code>Cal.Utilities.RelativeTime.DateAddType</code>) * @param nIntervals (CAL type: <code>Cal.Core.Prelude.Int</code>) * the number of intervals to be added. It can be positive (to get date-times in the future) or negative * (to get date-times in the past). * @param dateTime (CAL type: <code>Cal.Utilities.RelativeTime.RelativeDateTime</code>) * the date-time value to which the intervals are to be added * @return (CAL type: <code>Cal.Utilities.RelativeTime.RelativeDateTime</code>) * a date-time value to which a specified number of time intervals have been added. */ public static final SourceModel.Expr dateAdd(SourceModel.Expr intervalType, SourceModel.Expr nIntervals, SourceModel.Expr dateTime) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.dateAdd), intervalType, nIntervals, dateTime}); } /** * @see #dateAdd(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr) * @param intervalType * @param nIntervals * @param dateTime * @return the SourceModel.Expr representing an application of dateAdd */ public static final SourceModel.Expr dateAdd(SourceModel.Expr intervalType, int nIntervals, SourceModel.Expr dateTime) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.dateAdd), intervalType, SourceModel.Expr.makeIntValue(nIntervals), dateTime}); } /** * Name binding for function: dateAdd. * @see #dateAdd(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr) */ public static final QualifiedName dateAdd = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "dateAdd"); /** * * @param dateDiffType (CAL type: <code>Cal.Utilities.RelativeTime.DateDiffType</code>) * @param dateTime1 (CAL type: <code>Cal.Utilities.RelativeTime.RelativeDateTime</code>) * @param dateTime2 (CAL type: <code>Cal.Utilities.RelativeTime.RelativeDateTime</code>) * @param maybeFirstDayOfWeek (CAL type: <code>Cal.Core.Prelude.Maybe Cal.Utilities.RelativeTime.DayOfWeek</code>) * if Nothing, then <code>Cal.Utilities.RelativeTime.Sunday</code> is assumed. * @return (CAL type: <code>Cal.Core.Prelude.Int</code>) */ public static final SourceModel.Expr dateDiff(SourceModel.Expr dateDiffType, SourceModel.Expr dateTime1, SourceModel.Expr dateTime2, SourceModel.Expr maybeFirstDayOfWeek) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.dateDiff), dateDiffType, dateTime1, dateTime2, maybeFirstDayOfWeek}); } /** * Name binding for function: dateDiff. * @see #dateDiff(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr) */ public static final QualifiedName dateDiff = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "dateDiff"); /** * Extracts a specified component of a date. For example, this function can be used to * determine what week of the year a given date is. * @param datePartType (CAL type: <code>Cal.Utilities.RelativeTime.DatePartType</code>) * @param dateTime (CAL type: <code>Cal.Utilities.RelativeTime.RelativeDateTime</code>) * @param maybeFirstDayOfWeek (CAL type: <code>Cal.Core.Prelude.Maybe Cal.Utilities.RelativeTime.DayOfWeek</code>) * if <code>Cal.Core.Prelude.Nothing</code> then <code>Cal.Utilities.RelativeTime.Sunday</code> is used as a default. * @param maybeFirstWeekOfYear (CAL type: <code>Cal.Core.Prelude.Maybe Cal.Utilities.RelativeTime.FirstWeekOfYear</code>) * if <code>Cal.Core.Prelude.Nothing</code> then <code>Cal.Utilities.RelativeTime.WeekInWhichJan1Occurs</code> is used as a default. * @return (CAL type: <code>Cal.Core.Prelude.Int</code>) */ public static final SourceModel.Expr datePart(SourceModel.Expr datePartType, SourceModel.Expr dateTime, SourceModel.Expr maybeFirstDayOfWeek, SourceModel.Expr maybeFirstWeekOfYear) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.datePart), datePartType, dateTime, maybeFirstDayOfWeek, maybeFirstWeekOfYear}); } /** * Name binding for function: datePart. * @see #datePart(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr) */ public static final QualifiedName datePart = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "datePart"); /** * Helper binding method for function: dateToYearMonthDay. * @param date * @return the SourceModule.expr representing an application of dateToYearMonthDay */ public static final SourceModel.Expr dateToYearMonthDay(SourceModel.Expr date) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.dateToYearMonthDay), date}); } /** * @see #dateToYearMonthDay(org.openquark.cal.compiler.SourceModel.Expr) * @param date * @return the SourceModel.Expr representing an application of dateToYearMonthDay */ public static final SourceModel.Expr dateToYearMonthDay(int date) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.dateToYearMonthDay), SourceModel.Expr.makeIntValue(date)}); } /** * Name binding for function: dateToYearMonthDay. * @see #dateToYearMonthDay(org.openquark.cal.compiler.SourceModel.Expr) */ public static final QualifiedName dateToYearMonthDay = QualifiedName.make( CAL_RelativeTime.MODULE_NAME, "dateToYearMonthDay"); /** * Helper binding method for function: day. * @param date * @return the SourceModule.expr representing an application of day */ public static final SourceModel.Expr day(SourceModel.Expr date) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.day), date}); } /** * @see #day(org.openquark.cal.compiler.SourceModel.Expr) * @param date * @return the SourceModel.Expr representing an application of day */ public static final SourceModel.Expr day(int date) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.day), SourceModel.Expr.makeIntValue(date)}); } /** * Name binding for function: day. * @see #day(org.openquark.cal.compiler.SourceModel.Expr) */ public static final QualifiedName day = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "day"); /** * * @param date (CAL type: <code>Cal.Utilities.RelativeTime.RelativeDate</code>) * @return (CAL type: <code>Cal.Core.Prelude.Int</code>) * the day of week that a date occurs on with Sunday = 1, Monday = 2, ..., Saturday = 7. */ public static final SourceModel.Expr dayOfWeek(SourceModel.Expr date) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.dayOfWeek), date}); } /** * @see #dayOfWeek(org.openquark.cal.compiler.SourceModel.Expr) * @param date * @return the SourceModel.Expr representing an application of dayOfWeek */ public static final SourceModel.Expr dayOfWeek(int date) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.dayOfWeek), SourceModel.Expr.makeIntValue(date)}); } /** * Name binding for function: dayOfWeek. * @see #dayOfWeek(org.openquark.cal.compiler.SourceModel.Expr) */ public static final QualifiedName dayOfWeek = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "dayOfWeek"); /** * Helper binding method for function: getDatePart. * @param dateTime * @return the SourceModule.expr representing an application of getDatePart */ public static final SourceModel.Expr getDatePart(SourceModel.Expr dateTime) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.getDatePart), dateTime}); } /** * Name binding for function: getDatePart. * @see #getDatePart(org.openquark.cal.compiler.SourceModel.Expr) */ public static final QualifiedName getDatePart = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "getDatePart"); /** * Helper binding method for function: getTimePart. * @param dateTime * @return the SourceModule.expr representing an application of getTimePart */ public static final SourceModel.Expr getTimePart(SourceModel.Expr dateTime) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.getTimePart), dateTime}); } /** * Name binding for function: getTimePart. * @see #getTimePart(org.openquark.cal.compiler.SourceModel.Expr) */ public static final QualifiedName getTimePart = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "getTimePart"); /** * Helper binding method for function: hour. * @param time * @return the SourceModule.expr representing an application of hour */ public static final SourceModel.Expr hour(SourceModel.Expr time) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.hour), time}); } /** * @see #hour(org.openquark.cal.compiler.SourceModel.Expr) * @param time * @return the SourceModel.Expr representing an application of hour */ public static final SourceModel.Expr hour(int time) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.hour), SourceModel.Expr.makeIntValue(time)}); } /** * Name binding for function: hour. * @see #hour(org.openquark.cal.compiler.SourceModel.Expr) */ public static final QualifiedName hour = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "hour"); /** * Helper binding method for function: jDateToRelativeDate. * @param date * @return the SourceModule.expr representing an application of jDateToRelativeDate */ public static final SourceModel.Expr jDateToRelativeDate(SourceModel.Expr date) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.jDateToRelativeDate), date}); } /** * Name binding for function: jDateToRelativeDate. * @see #jDateToRelativeDate(org.openquark.cal.compiler.SourceModel.Expr) */ public static final QualifiedName jDateToRelativeDate = QualifiedName.make( CAL_RelativeTime.MODULE_NAME, "jDateToRelativeDate"); /** * Helper binding method for function: jDateToRelativeDateTime. * @param jdate * @return the SourceModule.expr representing an application of jDateToRelativeDateTime */ public static final SourceModel.Expr jDateToRelativeDateTime(SourceModel.Expr jdate) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.jDateToRelativeDateTime), jdate}); } /** * Name binding for function: jDateToRelativeDateTime. * @see #jDateToRelativeDateTime(org.openquark.cal.compiler.SourceModel.Expr) */ public static final QualifiedName jDateToRelativeDateTime = QualifiedName.make( CAL_RelativeTime.MODULE_NAME, "jDateToRelativeDateTime"); /** * Helper binding method for function: makeRelativeDateTimeValue. * @param year * @param month * @param day * @param hour * @param min * @param sec * @return the SourceModule.expr representing an application of makeRelativeDateTimeValue */ public static final SourceModel.Expr makeRelativeDateTimeValue(SourceModel.Expr year, SourceModel.Expr month, SourceModel.Expr day, SourceModel.Expr hour, SourceModel.Expr min, SourceModel.Expr sec) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.makeRelativeDateTimeValue), year, month, day, hour, min, sec}); } /** * @see #makeRelativeDateTimeValue(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr) * @param year * @param month * @param day * @param hour * @param min * @param sec * @return the SourceModel.Expr representing an application of makeRelativeDateTimeValue */ public static final SourceModel.Expr makeRelativeDateTimeValue(int year, int month, int day, int hour, int min, int sec) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.makeRelativeDateTimeValue), SourceModel.Expr.makeIntValue(year), SourceModel.Expr.makeIntValue(month), SourceModel.Expr.makeIntValue(day), SourceModel.Expr.makeIntValue(hour), SourceModel.Expr.makeIntValue(min), SourceModel.Expr.makeIntValue(sec)}); } /** * Name binding for function: makeRelativeDateTimeValue. * @see #makeRelativeDateTimeValue(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr) */ public static final QualifiedName makeRelativeDateTimeValue = QualifiedName.make( CAL_RelativeTime.MODULE_NAME, "makeRelativeDateTimeValue"); /** * Helper binding method for function: makeRelativeDateTimeValue2. * @param year * @param month * @param day * @return the SourceModule.expr representing an application of makeRelativeDateTimeValue2 */ public static final SourceModel.Expr makeRelativeDateTimeValue2(SourceModel.Expr year, SourceModel.Expr month, SourceModel.Expr day) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.makeRelativeDateTimeValue2), year, month, day}); } /** * @see #makeRelativeDateTimeValue2(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr) * @param year * @param month * @param day * @return the SourceModel.Expr representing an application of makeRelativeDateTimeValue2 */ public static final SourceModel.Expr makeRelativeDateTimeValue2(int year, int month, int day) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.makeRelativeDateTimeValue2), SourceModel.Expr.makeIntValue(year), SourceModel.Expr.makeIntValue(month), SourceModel.Expr.makeIntValue(day)}); } /** * Name binding for function: makeRelativeDateTimeValue2. * @see #makeRelativeDateTimeValue2(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr) */ public static final QualifiedName makeRelativeDateTimeValue2 = QualifiedName.make( CAL_RelativeTime.MODULE_NAME, "makeRelativeDateTimeValue2"); /** * Helper binding method for function: makeRelativeDateValue. * @param year * @param month * @param day * @return the SourceModule.expr representing an application of makeRelativeDateValue */ public static final SourceModel.Expr makeRelativeDateValue(SourceModel.Expr year, SourceModel.Expr month, SourceModel.Expr day) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.makeRelativeDateValue), year, month, day}); } /** * @see #makeRelativeDateValue(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr) * @param year * @param month * @param day * @return the SourceModel.Expr representing an application of makeRelativeDateValue */ public static final SourceModel.Expr makeRelativeDateValue(int year, int month, int day) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.makeRelativeDateValue), SourceModel.Expr.makeIntValue(year), SourceModel.Expr.makeIntValue(month), SourceModel.Expr.makeIntValue(day)}); } /** * Name binding for function: makeRelativeDateValue. * @see #makeRelativeDateValue(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr) */ public static final QualifiedName makeRelativeDateValue = QualifiedName.make( CAL_RelativeTime.MODULE_NAME, "makeRelativeDateValue"); /** * Helper binding method for function: makeRelativeTimeValue. * @param hour * @param min * @param sec * @return the SourceModule.expr representing an application of makeRelativeTimeValue */ public static final SourceModel.Expr makeRelativeTimeValue(SourceModel.Expr hour, SourceModel.Expr min, SourceModel.Expr sec) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.makeRelativeTimeValue), hour, min, sec}); } /** * @see #makeRelativeTimeValue(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr) * @param hour * @param min * @param sec * @return the SourceModel.Expr representing an application of makeRelativeTimeValue */ public static final SourceModel.Expr makeRelativeTimeValue(int hour, int min, int sec) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.makeRelativeTimeValue), SourceModel.Expr.makeIntValue(hour), SourceModel.Expr.makeIntValue(min), SourceModel.Expr.makeIntValue(sec)}); } /** * Name binding for function: makeRelativeTimeValue. * @see #makeRelativeTimeValue(org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr, org.openquark.cal.compiler.SourceModel.Expr) */ public static final QualifiedName makeRelativeTimeValue = QualifiedName.make( CAL_RelativeTime.MODULE_NAME, "makeRelativeTimeValue"); /** * Helper binding method for function: minute. * @param time * @return the SourceModule.expr representing an application of minute */ public static final SourceModel.Expr minute(SourceModel.Expr time) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.minute), time}); } /** * @see #minute(org.openquark.cal.compiler.SourceModel.Expr) * @param time * @return the SourceModel.Expr representing an application of minute */ public static final SourceModel.Expr minute(int time) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.minute), SourceModel.Expr.makeIntValue(time)}); } /** * Name binding for function: minute. * @see #minute(org.openquark.cal.compiler.SourceModel.Expr) */ public static final QualifiedName minute = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "minute"); /** * Helper binding method for function: month. * @param date * @return the SourceModule.expr representing an application of month */ public static final SourceModel.Expr month(SourceModel.Expr date) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.month), date}); } /** * @see #month(org.openquark.cal.compiler.SourceModel.Expr) * @param date * @return the SourceModel.Expr representing an application of month */ public static final SourceModel.Expr month(int date) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.month), SourceModel.Expr.makeIntValue(date)}); } /** * Name binding for function: month. * @see #month(org.openquark.cal.compiler.SourceModel.Expr) */ public static final QualifiedName month = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "month"); /** * Helper binding method for function: relativeDateTimeToJDate. * @param dateTime * @return the SourceModule.expr representing an application of relativeDateTimeToJDate */ public static final SourceModel.Expr relativeDateTimeToJDate(SourceModel.Expr dateTime) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.relativeDateTimeToJDate), dateTime}); } /** * Name binding for function: relativeDateTimeToJDate. * @see #relativeDateTimeToJDate(org.openquark.cal.compiler.SourceModel.Expr) */ public static final QualifiedName relativeDateTimeToJDate = QualifiedName.make( CAL_RelativeTime.MODULE_NAME, "relativeDateTimeToJDate"); /** * Helper binding method for function: relativeDateToJDate. * @param date * @return the SourceModule.expr representing an application of relativeDateToJDate */ public static final SourceModel.Expr relativeDateToJDate(SourceModel.Expr date) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.relativeDateToJDate), date}); } /** * @see #relativeDateToJDate(org.openquark.cal.compiler.SourceModel.Expr) * @param date * @return the SourceModel.Expr representing an application of relativeDateToJDate */ public static final SourceModel.Expr relativeDateToJDate(int date) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.relativeDateToJDate), SourceModel.Expr.makeIntValue(date)}); } /** * Name binding for function: relativeDateToJDate. * @see #relativeDateToJDate(org.openquark.cal.compiler.SourceModel.Expr) */ public static final QualifiedName relativeDateToJDate = QualifiedName.make( CAL_RelativeTime.MODULE_NAME, "relativeDateToJDate"); /** * Helper binding method for function: second. * @param time * @return the SourceModule.expr representing an application of second */ public static final SourceModel.Expr second(SourceModel.Expr time) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.second), time}); } /** * @see #second(org.openquark.cal.compiler.SourceModel.Expr) * @param time * @return the SourceModel.Expr representing an application of second */ public static final SourceModel.Expr second(int time) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.second), SourceModel.Expr.makeIntValue(time)}); } /** * Name binding for function: second. * @see #second(org.openquark.cal.compiler.SourceModel.Expr) */ public static final QualifiedName second = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "second"); /** * Predicate function for verifying basic functionality of the RelativeTime module. * @return (CAL type: <code>Cal.Core.Prelude.Boolean</code>) */ public static final SourceModel.Expr testModule() { return SourceModel.Expr.Var.make(Functions.testModule); } /** * Name binding for function: testModule. * @see #testModule() */ public static final QualifiedName testModule = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "testModule"); /** * Helper binding method for function: timeToHourMinuteSecond. * @param time * @return the SourceModule.expr representing an application of timeToHourMinuteSecond */ public static final SourceModel.Expr timeToHourMinuteSecond(SourceModel.Expr time) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.timeToHourMinuteSecond), time}); } /** * @see #timeToHourMinuteSecond(org.openquark.cal.compiler.SourceModel.Expr) * @param time * @return the SourceModel.Expr representing an application of timeToHourMinuteSecond */ public static final SourceModel.Expr timeToHourMinuteSecond(int time) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.timeToHourMinuteSecond), SourceModel.Expr.makeIntValue(time)}); } /** * Name binding for function: timeToHourMinuteSecond. * @see #timeToHourMinuteSecond(org.openquark.cal.compiler.SourceModel.Expr) */ public static final QualifiedName timeToHourMinuteSecond = QualifiedName.make( CAL_RelativeTime.MODULE_NAME, "timeToHourMinuteSecond"); /** * Helper binding method for function: toDateTime. * @param date * @return the SourceModule.expr representing an application of toDateTime */ public static final SourceModel.Expr toDateTime(SourceModel.Expr date) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.toDateTime), date}); } /** * @see #toDateTime(org.openquark.cal.compiler.SourceModel.Expr) * @param date * @return the SourceModel.Expr representing an application of toDateTime */ public static final SourceModel.Expr toDateTime(int date) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.toDateTime), SourceModel.Expr.makeIntValue(date)}); } /** * Name binding for function: toDateTime. * @see #toDateTime(org.openquark.cal.compiler.SourceModel.Expr) */ public static final QualifiedName toDateTime = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "toDateTime"); /** * Helper binding method for function: year. * @param date * @return the SourceModule.expr representing an application of year */ public static final SourceModel.Expr year(SourceModel.Expr date) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.year), date}); } /** * @see #year(org.openquark.cal.compiler.SourceModel.Expr) * @param date * @return the SourceModel.Expr representing an application of year */ public static final SourceModel.Expr year(int date) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.year), SourceModel.Expr.makeIntValue(date)}); } /** * Name binding for function: year. * @see #year(org.openquark.cal.compiler.SourceModel.Expr) */ public static final QualifiedName year = QualifiedName.make(CAL_RelativeTime.MODULE_NAME, "year"); } /** * A hash of the concatenated JavaDoc for this class (including inner classes). * This value is used when checking for changes to generated binding classes. */ public static final int javaDocHash = 738712575; }
[ "luke@eversosoft.com" ]
luke@eversosoft.com
fa8547787de1426448e34e0ccc61c3039e062f30
5cc5cc9e7fa629ca59017a2c7db58c515e6b1de5
/app/src/main/java/com/yzd/androidutil/util/SelectImageUtil.java
ac9edb9723fc52659cf40558dcde4d95b3307999
[]
no_license
Bacchuc/AndroidUtil-master
4981ff0512754fd1216671db4ade60f3d3bcf851
d835179037a45d19191af95e8cfa061e7433270b
refs/heads/master
2021-01-18T11:24:40.136531
2019-04-29T01:57:57
2019-04-29T01:57:57
100,360,129
0
0
null
null
null
null
UTF-8
Java
false
false
4,309
java
package com.yzd.androidutil.util; import android.app.Activity; import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.provider.MediaStore; import android.util.Log; import android.widget.ImageView; import java.io.File; /** * Created by Laiyin on 2017/4/4. * * 上传单张图片工具类 */ public class SelectImageUtil { private ImageView mImage; private Bitmap mBitmap; protected static final int CHOOSE_PICTURE = 0; protected static final int TAKE_PICTURE = 1; protected static Uri tempUri; private static final int CROP_SMALL_PICTURE = 2; private Activity activity; /** * @param activity 需要使用上传照片功能的页面 * @param mImage 需要显示照片的ImageView,需要的是ImageView,若是ImageButton,照片无法铺满控件 */ public SelectImageUtil(Activity activity, ImageView mImage){ this.activity=activity; this.mImage=mImage; } /** * 重写onActivityResult * @param requestCode * @param resultCode * @param data */ public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == activity.RESULT_OK) { switch (requestCode) { case TAKE_PICTURE: cutImage(tempUri); // 对图片进行裁剪处理 break; case CHOOSE_PICTURE: cutImage(data.getData()); // 对图片进行裁剪处理 break; case CROP_SMALL_PICTURE: if (data != null) { setImageToView(data); // 让刚才选择裁剪得到的图片显示在界面上 } break; } } } /** * 裁剪图片方法实现 */ protected void cutImage(Uri uri) { if (uri == null) { Log.i("alanjet", "The uri is not exist."); } tempUri = uri; Intent intent = new Intent("com.android.camera.action.CROP"); //com.android.camera.action.CROP这个action是用来裁剪图片用的 intent.setDataAndType(uri, "image/*"); // 设置裁剪 intent.putExtra("crop", "true"); // aspectX aspectY 是宽高的比例 intent.putExtra("aspectX", 1); intent.putExtra("aspectY", 1); // outputX outputY 是裁剪图片宽高 intent.putExtra("outputX", 150); intent.putExtra("outputY", 150); intent.putExtra("return-data", true); activity.startActivityForResult(intent, CROP_SMALL_PICTURE); } /** * 保存裁剪之后的图片数据 */ protected void setImageToView(Intent data) { Bundle extras = data.getExtras(); if (extras != null) { mBitmap = extras.getParcelable("data"); //这里图片是方形的,可以用一个工具类处理成圆形(很多头像都是圆形,这种工具类网上很多不再详述) mImage.setImageBitmap(mBitmap);//显示图片 //在这个地方可以写上上传该图片到服务器的代码,后期将单独写一篇这方面的博客,敬请期待... } } /** * 选择本地照片 */ public void choosePicture(){ Intent openAlbumIntent = new Intent( Intent.ACTION_GET_CONTENT); openAlbumIntent.setType("image/*"); //用startActivityForResult方法,待会儿重写onActivityResult()方法,拿到图片做裁剪操作 activity.startActivityForResult(openAlbumIntent, CHOOSE_PICTURE); } /** * 拍照 */ public void takePicture(){ Intent openCameraIntent = new Intent( MediaStore.ACTION_IMAGE_CAPTURE); tempUri = Uri.fromFile(new File(Environment .getExternalStorageDirectory(), "temp_image.jpg")); // 将拍照所得的相片保存到SD卡根目录 openCameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, tempUri); activity.startActivityForResult(openCameraIntent, TAKE_PICTURE); } }
[ "673482245@qq.com" ]
673482245@qq.com
1663eb82f447185bd4f6bd77f01b696db8b42e8a
53d677a55e4ece8883526738f1c9d00fa6560ff7
/com/tencent/mm/plugin/webview/luggage/jsapi/LuggageUploadMediaFileManager$2.java
2a080a82aff4a3eb4a0ef1355b32243c172549a6
[]
no_license
0jinxing/wechat-apk-source
544c2d79bfc10261eb36389c1edfdf553d8f312a
f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d
refs/heads/master
2020-06-07T20:06:03.580028
2019-06-21T09:17:26
2019-06-21T09:17:26
193,069,132
9
4
null
null
null
null
UTF-8
Java
false
false
849
java
package com.tencent.mm.plugin.webview.luggage.jsapi; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import com.tencent.matrix.trace.core.AppMethodBeat; final class LuggageUploadMediaFileManager$2 implements DialogInterface.OnClickListener { LuggageUploadMediaFileManager$2(LuggageUploadMediaFileManager paramLuggageUploadMediaFileManager) { } public final void onClick(DialogInterface paramDialogInterface, int paramInt) { AppMethodBeat.i(6393); this.ukE.ukD.a(false, null); AppMethodBeat.o(6393); } } /* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes3-dex2jar.jar * Qualified Name: com.tencent.mm.plugin.webview.luggage.jsapi.LuggageUploadMediaFileManager.2 * JD-Core Version: 0.6.2 */
[ "172601673@qq.com" ]
172601673@qq.com
5a133d645f9e81d4ce58179c070d9bbc7b26dcd9
9096468937161c1c71f0d9493b204f2527e9074b
/src/main/java/br/com/kesley/jobextra/repository/JobRepository.java
339747bb826afae4a798447050640eca406f1c95
[]
no_license
kesleyksl/jobextra
52b377dda976ae7c72cd6e5c326cd5cf50bd4b28
f25b541ae675fded9631e9a04b5802d0721502ae
refs/heads/master
2022-08-19T10:12:16.518641
2020-05-23T19:43:25
2020-05-23T19:43:25
266,407,837
0
0
null
null
null
null
UTF-8
Java
false
false
225
java
package br.com.kesley.jobextra.repository; import org.springframework.data.jpa.repository.JpaRepository; import br.com.kesley.jobextra.models.Job; public interface JobRepository extends JpaRepository<Job, Integer> { }
[ "kesley_ksl@hotmail.com" ]
kesley_ksl@hotmail.com
b90cd0f72343d3e6ad50f8d7dce24cfe5f5de2c9
58d068695ad13c93b177e2ea8e3e907250c8f2d3
/shoppingbackend/src/test/java/net/meedo/shoppingbackend/AppTest.java
aa44ba30ff04dc9159f3560d9d8727d036049204
[]
no_license
M1M2-coder/FullStack
bd3d283f79f09cfaca747080a1d1eea66689bfb9
8666c09e5895b3333cda03b30cd4dee079974957
refs/heads/master
2022-12-23T06:10:07.189252
2020-02-05T04:56:22
2020-02-05T04:56:22
238,321,180
0
0
null
2022-12-16T11:08:42
2020-02-04T22:35:45
JavaScript
UTF-8
Java
false
false
653
java
package net.meedo.shoppingbackend; 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 ); } /** * @return the suite of tests being tested */ public static Test suite() { return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ public void testApp() { assertTrue( true ); } }
[ "m1m2.coder@gmail.com" ]
m1m2.coder@gmail.com
e24a477447814958361a20444fa636044b5a1d2b
0af8b92686a58eb0b64e319b22411432aca7a8f3
/single-large-project/src/test/java/org/gradle/test/performancenull_382/Testnull_38142.java
5a34df8288a1b601c0f1f4627edc36514ae6080d
[]
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
308
java
package org.gradle.test.performancenull_382; import static org.junit.Assert.*; public class Testnull_38142 { private final Productionnull_38142 production = new Productionnull_38142("value"); @org.junit.Test public void test() { assertEquals(production.getProperty(), "value"); } }
[ "cedric.champeau@gmail.com" ]
cedric.champeau@gmail.com
64a9c5dbc7aba9890e4eb41d9e7d0eec8ed5a79c
398c84c4d5ba08ea4d14598fa9b427f3d3919ef1
/app/src/main/java/com/example/leiyu/myshortvideo/cover/VideoCoverActivity.java
5792ef7f99dc226afb76969cf28c492a2994d019
[]
no_license
leiyu2008pengyou/MyShortVideo
2bd3b7ae1792e4e8aa3a5d0cb2b4448f38114170
0bc44d10036cabe51d7f65bbae98c9cfb710dc0c
refs/heads/master
2021-05-03T07:05:03.574566
2018-03-02T09:57:43
2018-03-02T09:57:43
120,602,273
2
0
null
null
null
null
UTF-8
Java
false
false
1,603
java
package com.example.leiyu.myshortvideo.cover; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import com.example.leiyu.myshortvideo.R; /** * Created by leiyu on 2018/3/1. * 截图视频关键帧展示封面图片 */ public class VideoCoverActivity extends Activity{ private VideoCoverPicker mCoverPicker; private String mVideoPath; private VideoCoverShowView mCoverView; private long mTime; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_video_cover); Intent intent = getIntent(); mVideoPath = intent.getStringExtra("path"); initViews(); } private void initViews() { mCoverPicker = (VideoCoverPicker) findViewById(R.id.coverPicker); mCoverPicker.setVideoPath(mVideoPath); mCoverPicker.setPickTimeListener(new VideoCoverPicker.PickTimeListener() { @Override public void onPickTime(long time) { mCoverView.seekTo(time); mTime = time; } }); mCoverView = (VideoCoverShowView) findViewById(R.id.videoCoverView); mCoverView.setDataSource(mVideoPath); } private void handleCompleteClick() { Intent intent = new Intent(); intent.putExtra("coverTime", mTime); setResult(RESULT_OK, intent); finish(); } @Override protected void onDestroy() { super.onDestroy(); mCoverPicker.release(); mCoverView.release(); } }
[ "leiyu01@alibaba-inc.com" ]
leiyu01@alibaba-inc.com
0c9ed90c1eaf288f263a63d7243df49e6032eba6
abe302f27c92691d9c835606521244ddc63fbba9
/CMS_Codebase/StudentMgmtX/src/com/InnovativeThread/cms/Connection/DBConnection.java
ea3a632d416dfae5ccdff8e605b0bdfd4b84352c
[]
no_license
InnovativeThread/CMS
293bae5fc2e161f3488a11e49bb7e4ae085835db
2bd1355270d54acb74359766ba4821ed1ea25fda
refs/heads/master
2020-12-14T07:42:15.899167
2017-07-23T18:14:32
2017-07-23T18:14:32
95,472,856
0
0
null
null
null
null
UTF-8
Java
false
false
1,508
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.InnovativeThread.cms.Connection; import java.io.FileInputStream; import java.sql.Connection; import java.sql.DriverManager; import java.util.Properties; /** * * @author MOHIT */ public class DBConnection { private Connection con; private String db_url; private String user; private String password; static{ try{ Class.forName("oracle.jdbc.driver.OracleDriver"); } catch(Exception e){ System.out.println("Error while loading drivers.....\n"+e.getMessage()); } } public DBConnection() { Properties prop = new Properties(); try{ prop.load(new FileInputStream("dbconfig.properties")); db_url=prop.getProperty("db_url"); user=prop.getProperty("user"); password=prop.getProperty("password"); con=DriverManager.getConnection(db_url,user,password); } catch(Exception e){ System.out.println("Error while connectin to database.....\n"+e.getMessage()); } } public Connection getConnection(){ System.out.println(""+db_url+","+user+","+password); return con; } // public static void main(String[] args) { // DBConnection dbc =new DBConnection(); // dbc.getConnection(); // } }
[ "mas.dev.thread@gmail.com" ]
mas.dev.thread@gmail.com
fd46229cec361e3ed2fd3543451416447970ba89
a33fd5dcb682fadaa78214256b9cd2057f92294b
/gateway/src/main/java/com/timothy/gateway/config/ResourceServerConfig.java
9ab2a68330dcd662c5a3867d9ee55eb3e17fe0a3
[]
no_license
timothyadam/crm
067a8140e3741b1cf636de69f80e46a40ef2660b
8903398492c3d33db231d02204c69a47fcb4f11e
refs/heads/master
2022-12-11T01:05:55.682656
2020-09-08T13:47:46
2020-09-08T13:47:46
293,713,711
0
0
null
null
null
null
UTF-8
Java
false
false
3,693
java
package com.timothy.gateway.config; import cn.hutool.core.util.ArrayUtil; import com.timothy.common.constant.AuthConstant; import com.timothy.gateway.authorization.AuthorizationManager; import com.timothy.gateway.component.RestAuthenticationEntryPoint; import com.timothy.gateway.component.RestfulAccessDeniedHandler; import com.timothy.gateway.filter.IgnoreUrlsRemoveJwtFilter; import lombok.AllArgsConstructor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.convert.converter.Converter; import org.springframework.security.authentication.AbstractAuthenticationToken; import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity; import org.springframework.security.config.web.server.SecurityWebFiltersOrder; import org.springframework.security.config.web.server.ServerHttpSecurity; import org.springframework.security.oauth2.jwt.Jwt; import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationConverter; import org.springframework.security.oauth2.server.resource.authentication.JwtGrantedAuthoritiesConverter; import org.springframework.security.oauth2.server.resource.authentication.ReactiveJwtAuthenticationConverterAdapter; import org.springframework.security.web.server.SecurityWebFilterChain; import reactor.core.publisher.Mono; /** * @author :wangxin * @date :Created in 2020/9/8 11:13 * 资源服务器配置 */ @AllArgsConstructor @Configuration @EnableWebFluxSecurity public class ResourceServerConfig { private final AuthorizationManager authorizationManager; private final IgnoreUrlsConfig ignoreUrlsConfig; private final RestfulAccessDeniedHandler restfulAccessDeniedHandler; private final RestAuthenticationEntryPoint restAuthenticationEntryPoint; private final IgnoreUrlsRemoveJwtFilter ignoreUrlsRemoveJwtFilter; @Bean public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) { http.oauth2ResourceServer().jwt() .jwtAuthenticationConverter(jwtAuthenticationConverter()); //自定义处理JWT请求头过期或签名错误的结果 http.oauth2ResourceServer().authenticationEntryPoint(restAuthenticationEntryPoint); //对白名单路径,直接移除JWT请求头 http.addFilterBefore(ignoreUrlsRemoveJwtFilter,SecurityWebFiltersOrder.AUTHENTICATION); http.authorizeExchange() .pathMatchers(ArrayUtil.toArray(ignoreUrlsConfig.getUrls(),String.class)).permitAll()//白名单配置 .anyExchange().access(authorizationManager)//鉴权管理器配置 .and().exceptionHandling() .accessDeniedHandler(restfulAccessDeniedHandler)//处理未授权 .authenticationEntryPoint(restAuthenticationEntryPoint)//处理未认证 .and().csrf().disable(); return http.build(); } @Bean public Converter<Jwt, ? extends Mono<? extends AbstractAuthenticationToken>> jwtAuthenticationConverter() { JwtGrantedAuthoritiesConverter jwtGrantedAuthoritiesConverter = new JwtGrantedAuthoritiesConverter(); jwtGrantedAuthoritiesConverter.setAuthorityPrefix(AuthConstant.AUTHORITY_PREFIX); jwtGrantedAuthoritiesConverter.setAuthoritiesClaimName(AuthConstant.AUTHORITY_CLAIM_NAME); JwtAuthenticationConverter jwtAuthenticationConverter = new JwtAuthenticationConverter(); jwtAuthenticationConverter.setJwtGrantedAuthoritiesConverter(jwtGrantedAuthoritiesConverter); return new ReactiveJwtAuthenticationConverterAdapter(jwtAuthenticationConverter); } }
[ "wangxindyouxiang@163.com" ]
wangxindyouxiang@163.com
7ff1924a54c40bdce4d90e6ec1d9cd783d15c16b
f2d55f3601928f5e2a5d35014c6b9ad43dec0ef8
/oib-request/uts-metathesaurus/src/main/java/UtsMetathesaurusContent/GetSourceDescriptorSourceDescriptorRelationsResponse.java
242c6814eb876d83448538ae32fb111d5e0bcc17
[]
no_license
alexfranken/Innovation-182
5cc7d279030ed1e99d11c8edd5acf8b373d32900
88f32dd774f73efae92ae5d8727ca10547fb89d4
refs/heads/master
2020-12-07T00:38:15.411566
2014-04-08T22:38:05
2014-04-08T22:38:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,143
java
package UtsMetathesaurusContent; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for getSourceDescriptorSourceDescriptorRelationsResponse complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="getSourceDescriptorSourceDescriptorRelationsResponse"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="return" type="{http://webservice.uts.umls.nlm.nih.gov/}atomClusterRelationDTO" maxOccurs="unbounded" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "getSourceDescriptorSourceDescriptorRelationsResponse", propOrder = { "_return" }) public class GetSourceDescriptorSourceDescriptorRelationsResponse { @XmlElement(name = "return") protected List<AtomClusterRelationDTO> _return; /** * Gets the value of the return 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 return property. * * <p> * For example, to add a new item, do as follows: * <pre> * getReturn().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link AtomClusterRelationDTO } * * */ public List<AtomClusterRelationDTO> getReturn() { if (_return == null) { _return = new ArrayList<AtomClusterRelationDTO>(); } return this._return; } }
[ "Andrew@Andrew-PC.(none)" ]
Andrew@Andrew-PC.(none)
e0724ec25506b24d333ce7eb4bcc10a9121ccb9e
b9675a27c8dddab2c6b9b2a333083f42e58216b0
/src/test/java/com/github/ferstl/depgraph/dependency/dot/DotDependencyEdgeRendererTest.java
21a03a3ec88a14c70a64ffaf5787af3e2e7dbc01
[ "Apache-2.0" ]
permissive
OsvaldoMartini/depgraph-maven-plugin
0607a35391e3ed087684065d1a66aab270820737
5b4997cfe8232b49b5db421a6f2ee06382f96de5
refs/heads/master
2020-04-11T18:08:13.719109
2018-12-11T06:28:30
2018-12-11T17:58:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,868
java
/* * Copyright (c) 2014 - 2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.github.ferstl.depgraph.dependency.dot; import org.junit.Before; import com.github.ferstl.depgraph.dependency.AbstractDependencyEdgeRendererTest; import com.github.ferstl.depgraph.dependency.DependencyNode; import com.github.ferstl.depgraph.dependency.dot.style.StyleConfiguration; import com.github.ferstl.depgraph.graph.EdgeRenderer; public class DotDependencyEdgeRendererTest extends AbstractDependencyEdgeRendererTest { private StyleConfiguration styleConfiguration; @Before public void before() { this.styleConfiguration = new StyleConfiguration(); } @Override protected EdgeRenderer<DependencyNode> createEdgeRenderer(boolean renderVersion) { return new DotDependencyEdgeRenderer(renderVersion, this.styleConfiguration); } @Override protected String renderWithoutVersionResult() { return ""; } @Override protected String renderWithNonConflictingVersionResult() { return ""; } @Override protected String renderWithConflictShowingVersionResult() { return "[label=\"version2-alpha\"]"; } @Override protected String renderWithConflictNotShowingVersionResult() { return ""; } @Override protected String renderWithDuplicateResult() { return ""; } }
[ "st.ferstl@gmail.com" ]
st.ferstl@gmail.com
692c06c3a572c4122bd0d259fe16fd740000dd3e
efd54286d87371d6305fc0a754a9a9ef2147955b
/src/net/ememed/user2/util/Rsa.java
0ea1b73e4e5db751f394c1b3486684e8a1e6e00b
[]
no_license
eltld/user
3127b1f58ab294684eba3ff27446da14f2b51da0
f5087033d4da190856627a98fe532e158465aa60
refs/heads/master
2020-12-03T10:26:45.629899
2015-04-30T10:22:14
2015-04-30T10:22:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,489
java
/* * Copyright (C) 2010 The MobileSecurePay Project * All right reserved. * author: shiqun.shi@alipay.com */ package net.ememed.user2.util; import java.security.KeyFactory; import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java.security.PublicKey; import java.security.spec.PKCS8EncodedKeySpec; import java.security.spec.X509EncodedKeySpec; import javax.crypto.Cipher; public class Rsa { private static final String ALGORITHM = "RSA"; /** * @param algorithm * @param ins * @return * @throws NoSuchAlgorithmException * @throws AlipayException */ private static PublicKey getPublicKeyFromX509(String algorithm, String bysKey) throws NoSuchAlgorithmException, Exception { byte[] decodedKey = Base64.decode(bysKey); X509EncodedKeySpec x509 = new X509EncodedKeySpec(decodedKey); KeyFactory keyFactory = KeyFactory.getInstance(algorithm); return keyFactory.generatePublic(x509); } public static String encrypt(String content, String key) { try { PublicKey pubkey = getPublicKeyFromX509(ALGORITHM, key); Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding"); cipher.init(Cipher.ENCRYPT_MODE, pubkey); byte plaintext[] = content.getBytes("UTF-8"); byte[] output = cipher.doFinal(plaintext); String s = new String(Base64.encode(output)); return s; } catch (Exception e) { e.printStackTrace(); return null; } } public static final String SIGN_ALGORITHMS = "SHA1WithRSA"; public static String sign(String content, String privateKey) { String charset = "UTF-8"; try { PKCS8EncodedKeySpec priPKCS8 = new PKCS8EncodedKeySpec( Base64.decode(privateKey)); KeyFactory keyf = KeyFactory.getInstance("RSA"); PrivateKey priKey = keyf.generatePrivate(priPKCS8); java.security.Signature signature = java.security.Signature .getInstance(SIGN_ALGORITHMS); signature.initSign(priKey); signature.update(content.getBytes(charset)); byte[] signed = signature.sign(); return Base64.encode(signed); } catch (Exception e) { e.printStackTrace(); } return null; } public static String getMD5(String content) { String s = null; char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; try { java.security.MessageDigest md = java.security.MessageDigest .getInstance("MD5"); md.update(content.getBytes()); byte tmp[] = md.digest(); char str[] = new char[16 * 2]; int k = 0; for (int i = 0; i < 16; i++) { byte byte0 = tmp[i]; str[k++] = hexDigits[byte0 >>> 4 & 0xf]; str[k++] = hexDigits[byte0 & 0xf]; } s = new String(str); } catch (Exception e) { e.printStackTrace(); } return s; } public static boolean doCheck(String content, String sign, String publicKey) { try { KeyFactory keyFactory = KeyFactory.getInstance("RSA"); byte[] encodedKey = Base64.decode(publicKey); PublicKey pubKey = keyFactory .generatePublic(new X509EncodedKeySpec(encodedKey)); java.security.Signature signature = java.security.Signature .getInstance(SIGN_ALGORITHMS); signature.initVerify(pubKey); signature.update(content.getBytes("utf-8")); // Log.i("Result", "content : "+content); // Log.i("Result", "sign: "+sign); boolean bverify = signature.verify(Base64.decode(sign)); // Log.i("Result","bverify = " + bverify); return bverify; } catch (Exception e) { e.printStackTrace(); } return false; } }
[ "happyjie.1988@163.com" ]
happyjie.1988@163.com
0282e6915ba522ff90520bff83fcb991b25370a7
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/6/6_b57ea7370f4a2d537c17b2f6d66ff1ce3ed7fddd/DOHRobot/6_b57ea7370f4a2d537c17b2f6d66ff1ce3ed7fddd_DOHRobot_t.java
cfe3bed3313d313d23379c0e65d5c0c2be3ce3de
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
43,482
java
import java.security.*; import java.applet.Applet; import java.awt.*; import java.util.*; import java.awt.event.*; import netscape.javascript.*; import java.io.*; import java.lang.reflect.*; import java.net.URL; import java.awt.datatransfer.*; public final class DOHRobot extends Applet{ // order of execution: // wait for user to trust applet // load security manager to prevent Safari hang // discover document root in screen coordinates // discover keyboard capabilities // tell doh to continue with the test // link to doh // To invoke doh, call eval with window.eval("jsexp") // Note that the "window" is an iframe! // You might need to break out of the iframe with an intermediate function // in the parent window. private JSObject window = null; // java.awt.Robot // drives the test // you need to sign the applet JAR for this to work private Robot robot = null; // In order to preserve the execution order of Robot commands, // we have to serialize commands by having them join() the previous one. // Otherwise, if you run doh.robot.typeKeys("dijit"), you frequently get something // like "diijt" private static Thread previousThread = null; // Keyboard discovery. // At init, the Robot types keys into a textbox and JavaScript tells the // Robot what it got back. // charMap maps characters to the KeyEvent that generates the character on // the user's machine. // charMap uses the Java 1.4.2 (lack of) template syntax for wider // compatibility. private static HashMap charMap = null; // Java key constants to iterate over // not all are available on all machines! private Vector vkKeys = null; // some state variables private boolean shift = false; private boolean altgraph = false; private boolean ctrl = false; private boolean alt = false; // shake hands with JavaScript the first keypess to wake up FF2/Mac private boolean jsready = false; private String keystring = ""; // Firebug gets a little too curious about our applet for its own good // setting firebugIgnore to true ensures Firebug doesn't break the applet public boolean firebugIgnore = true; private SecurityManager securitymanager; private double key = -1; // The screen x,y of the document upper left corner. // We only set it once so people are less likely to take it over. private boolean inited = false; private int docScreenX = -100; private int docScreenY = -100; private int docScreenXMax; private int docScreenYMax; private boolean mouseSecurity = false; // The last reported mouse x,y. // If this is different from the real one, something's up. private int lastMouseX; private int lastMouseY; // save a pointer to doh.robot for fast access JSObject dohrobot = null; // java.awt.Applet methods public void stop(){ window = null; dohrobot = null; // only secure code run once if(key != -2){ // prevent further execution of secure functions key = -2; // Java calls this when you close the window. // It plays nice and restores the old security manager. AccessController.doPrivileged(new PrivilegedAction(){ public Object run(){ log("Stop"); securitymanager.checkTopLevelWindow(null); log("Security manager reset"); return null; } }); } } final private class onvisible extends ComponentAdapter{ public void componentShown(ComponentEvent evt){ // sets the security manager to fix a bug in liveconnect in Safari on Mac if(key != -1){ return; } window = (JSObject) JSObject.getWindow(applet()); AccessController.doPrivileged(new PrivilegedAction(){ public Object run(){ log("> init Robot"); try{ SecurityManager oldsecurity = System.getSecurityManager(); boolean isOpera = false; try{ isOpera = (System.getProperty("browser").equals("Opera.plugin")); }catch(Exception e){} try{ securitymanager = oldsecurity; securitymanager.checkTopLevelWindow(null); // xdomain if(charMap == null){ if(!confirm("DOH has detected that the current Web page is attempting to access DOH, but belongs to a different domain than the one you agreed to let DOH automate. If you did not intend to start a new DOH test by visiting this Web page, press Cancel now and leave the Web page. Otherwise, press OK to trust this domain to automate DOH tests.")){ stop(); return null; } } log("Found old security manager"); }catch(Exception e){ e.printStackTrace(); log("Making new security manager"); securitymanager = new RobotSecurityManager(isOpera, oldsecurity); securitymanager.checkTopLevelWindow(null); System.setSecurityManager(securitymanager); } // instantiate the Robot robot = new Robot(); }catch(Exception e){ log("Error calling _init_: "+e.getMessage()); key = -2; e.printStackTrace(); } log("< init Robot"); return null; } }); if(key == -2){ // applet not trusted // start the test without it window.eval("doh.robot._appletDead=true;doh.run();"); }else{ // now that the applet has really started, let doh know it's ok to use it log("_initRobot"); dohrobot = (JSObject) window.eval("doh.robot"); dohrobot.call("_initRobot", new Object[]{ applet() }); } } } public void init(){ // ensure isShowing = true addComponentListener(new onvisible()); } // loading functions public void _setKey(double key){ if(key == -1){ return; }else if(this.key == -1){ this.key = key; } } private boolean mouseSecure() throws Exception{ // Use MouseInfo to ensure that mouse is inside browser. // Only works in Java 1.5, but the DOHRobot must compile for 1.4. if(!mouseSecurity){ return true; } Class mouseInfoClass; Class pointerInfoClass; try{ mouseInfoClass = Class.forName("java.awt.MouseInfo"); pointerInfoClass = Class.forName("java.awt.PointerInfo"); }catch(ClassNotFoundException e){ // Java 1.4 e.printStackTrace(); return true; } Method getPointerInfo = mouseInfoClass.getMethod("getPointerInfo", new Class[0]); Method getLocation = pointerInfoClass.getMethod("getLocation", new Class[0]); Object pointer=null; try{ pointer = getPointerInfo.invoke(pointerInfoClass,new Object[0]); }catch(java.lang.reflect.InvocationTargetException e){ e.getTargetException().printStackTrace(); } Point mousePosition = (Point)(getLocation.invoke(pointer,new Object[0])); return mousePosition.x >= docScreenX && mousePosition.x <= docScreenXMax && mousePosition.y >= docScreenY && mousePosition.y <= docScreenYMax; } private boolean isSecure(double key){ boolean result = this.key != -1 && this.key != -2 && this.key == key; try{ result=result&&mouseSecure(); }catch(Exception e){ e.printStackTrace(); result=false; } if(!result&&this.key!=-2){ this.key=-2; window.eval("doh.robot._appletDead=true;"); log("User aborted test; mouse moved off of browser"); alert("User aborted test; mouse moved off of browser."); } log("Key secure: " + result); return result; } public void _callLoaded(double sec){ log("> _callLoaded Robot"); if(!isSecure(sec)){ return; } Thread thread = new Thread(){ public void run(){ AccessController.doPrivileged(new PrivilegedAction(){ public Object run(){ Point p = getLocationOnScreen(); log("Document root: ~"+p.toString()); int x = p.x + 16; int y = p.y + 8; // click the mouse over the text box try{ Thread.sleep(100); }catch(Exception e){}; robot.mouseMove(x, y); try{ Thread.sleep(100); }catch(Exception e){}; robot.mousePress(InputEvent.BUTTON1_MASK); try{ Thread.sleep(100); }catch(Exception e){} robot.mouseRelease(InputEvent.BUTTON1_MASK); try{ Thread.sleep(100); }catch(Exception e){} log("< _callLoaded Robot"); return null; } }); } }; thread.start(); } // convenience functions private DOHRobot applet(){ return this; } public void log(final String s){ AccessController.doPrivileged(new PrivilegedAction(){ public Object run(){ System.out.println((new Date()).toString() + ": " + s); return null; } }); } private void alert(final String s){ AccessController.doPrivileged(new PrivilegedAction(){ public Object run(){ window.eval("top.alert(\"" + s + "\");"); return null; } }); } private boolean confirm(final String s){ return ((Boolean) AccessController.doPrivileged(new PrivilegedAction(){ public Object run(){ return ((Boolean) window.eval("top.confirm(\"" + s + "\");")); } })).booleanValue(); } // mouse discovery code public void setDocumentBounds(double sec, int x, int y, int w, int h){ log("> setDocumentBounds"); if(!isSecure(sec)) return; // call from JavaScript // tells the Robot where the screen x,y of the upper left corner of the // document are // not screenX/Y of the window; really screenLeft/Top in IE, but not all // browsers have this if(!inited){ inited = true; this.lastMouseX = this.docScreenX = x; this.lastMouseY = this.docScreenY = y; this.docScreenXMax = x + w; this.docScreenYMax = y + h; mouseSecurity=true; } log("< setDocumentBounds"); } // keyboard discovery code private void _mapKey(char charCode, int keyindex, boolean shift, boolean altgraph){ log("_mapKey: " + charCode); // if character is not in map, add it if(!charMap.containsKey(new Integer(charCode))){ log("Notified: " + (char) charCode); KeyEvent event = new KeyEvent(applet(), 0, 0, (shift ? KeyEvent.SHIFT_MASK : 0) + (altgraph ? KeyEvent.ALT_GRAPH_MASK : 0), ((Integer) vkKeys.get(keyindex)).intValue(), (char) charCode); charMap.put(new Integer(charCode), event); log("Mapped char " + (char) charCode + " to KeyEvent " + event); if(((char) charCode) >= 'a' && ((char) charCode) <= 'z'){ // put shifted version of a-z in automatically int uppercharCode = (int) Character .toUpperCase((char) charCode); event = new KeyEvent(applet(), 0, 0, KeyEvent.SHIFT_MASK + (altgraph ? KeyEvent.ALT_GRAPH_MASK : 0), ((Integer) vkKeys.get(keyindex)).intValue(), (char) uppercharCode); charMap.put(new Integer(uppercharCode), event); log("Mapped char " + (char) uppercharCode + " to KeyEvent " + event); } } } public void _notified(double sec, final String chars){ if(!isSecure(sec)) return; // decouple from JavaScript; thread join could hang it Thread thread = new Thread("_notified"){ public void run(){ AccessController.doPrivileged(new PrivilegedAction(){ public Object run(){ try{ // wait for release shift/altgraph to resolve if(previousThread != null){ previousThread.join(); } }catch(Exception e){ } keystring += chars; if(altgraph && !shift){ shift = false; // Set robot auto delay now that FF/Mac inited all of the keys. // Good for DND. robot.setAutoDelay(1); try{ log(keystring); int index = 0; for (int i = 0; (i < vkKeys.size()) && (index < keystring.length()); i++){ char c = keystring.charAt(index++); _mapKey(c, i, false, false); } for (int i = 0; (i < vkKeys.size()) && (index < keystring.length()); i++){ char c = keystring.charAt(index++); _mapKey(c, i, true, false); } for (int i = 0; (i < vkKeys.size()) && (index < keystring.length()); i++){ char c = keystring.charAt(index++); _mapKey(c, i, false, true); } // notify DOH that the applet finished init dohrobot.call("_onKeyboard", new Object[]{}); }catch(Exception e){ e.printStackTrace(); } return null; }else if(!shift){ shift = true; }else{ shift = false; altgraph = true; } pressNext(); // } return null; } }); } }; thread.start(); } private void pressNext(){ final Thread myPreviousThread = previousThread; Thread thread = new Thread("pressNext"){ public void run(){ try{ // wait for release shift/altgraph to resolve if(myPreviousThread != null){ myPreviousThread.join(); } }catch(Exception e){ } // first time, press shift (have to do it here instead of // _notified to avoid IllegalThreadStateException on Mac) log("starting up, " + shift + " " + altgraph); if(shift){ robot.keyPress(KeyEvent.VK_SHIFT); log("Pressing shift"); } try{ if(altgraph){ robot.keyPress(KeyEvent.VK_ALT_GRAPH); log("Pressing alt graph"); } }catch(Exception e){ log("Error pressing alt graph"); e.printStackTrace(); _notified(key, ""); return; } dohrobot.call("_nextKeyGroup", new Object[]{ new Integer(vkKeys.size()) }); for (int keyindex = 0; keyindex < vkKeys.size(); keyindex++){ try{ log("Press " + ((Integer) vkKeys.get(keyindex)).intValue()); robot.keyPress(((Integer) vkKeys.get(keyindex)) .intValue()); log("Release " + ((Integer) vkKeys.get(keyindex)).intValue()); robot.keyRelease(((Integer) vkKeys.get(keyindex)) .intValue()); if(altgraph && (keyindex == (vkKeys.size() - 1))){ robot.keyRelease(KeyEvent.VK_ALT_GRAPH); log("Releasing alt graph"); } if(shift && (keyindex == (vkKeys.size() - 1))){ robot.keyRelease(KeyEvent.VK_SHIFT); log("Releasing shift"); } }catch(Exception e){ } try{ log("Press space"); robot.keyPress(KeyEvent.VK_SPACE); log("Release space"); robot.keyRelease(KeyEvent.VK_SPACE); }catch(Exception e){ e.printStackTrace(); } } } }; previousThread = thread; thread.start(); } public void _initWheel(double sec){ log("> initWheel"); if(!isSecure(sec)) return; Thread thread=new Thread(){ public void run(){ // calibrate the mouse wheel now that textbox is focused int dir=1; if(System.getProperty("os.name").toUpperCase().indexOf("MAC") != -1){ dir=-1; } robot.mouseWheel(dir); try{ Thread.sleep(100); }catch(Exception e){} log("< initWheel"); } }; thread.start(); } public void _initKeyboard(double sec){ log("> initKeyboard"); // javascript entry point to discover the keyboard if(!isSecure(sec)) return; if(charMap != null){ dohrobot.call("_onKeyboard", new Object[]{}); return; } AccessController.doPrivileged(new PrivilegedAction(){ public Object run(){ charMap = new HashMap(); KeyEvent event = new KeyEvent(applet(), 0, 0, 0, KeyEvent.VK_SPACE, ' '); charMap.put(new Integer(32), event); try{ // a-zA-Z0-9 + 29 others vkKeys = new Vector(); for (char i = 'a'; i <= 'z'; i++){ vkKeys.add(new Integer(KeyEvent.class.getField( "VK_" + Character.toUpperCase((char) i)) .getInt(null))); } for (char i = '0'; i <= '9'; i++){ vkKeys.add(new Integer(KeyEvent.class.getField( "VK_" + Character.toUpperCase((char) i)) .getInt(null))); } int[] mykeys = new int[]{ KeyEvent.VK_COMMA, KeyEvent.VK_MINUS, KeyEvent.VK_PERIOD, KeyEvent.VK_SLASH, KeyEvent.VK_SEMICOLON, KeyEvent.VK_LEFT_PARENTHESIS, KeyEvent.VK_NUMBER_SIGN, KeyEvent.VK_PLUS, KeyEvent.VK_RIGHT_PARENTHESIS, KeyEvent.VK_UNDERSCORE, KeyEvent.VK_EXCLAMATION_MARK, KeyEvent.VK_DOLLAR, KeyEvent.VK_CIRCUMFLEX, KeyEvent.VK_AMPERSAND, KeyEvent.VK_ASTERISK, KeyEvent.VK_QUOTEDBL, KeyEvent.VK_LESS, KeyEvent.VK_GREATER, KeyEvent.VK_BRACELEFT, KeyEvent.VK_BRACERIGHT, KeyEvent.VK_COLON, KeyEvent.VK_BACK_QUOTE, KeyEvent.VK_QUOTE, KeyEvent.VK_OPEN_BRACKET, KeyEvent.VK_BACK_SLASH, KeyEvent.VK_CLOSE_BRACKET, KeyEvent.VK_EQUALS }; for (int i = 0; i < mykeys.length; i++){ vkKeys.add(new Integer(mykeys[i])); } }catch(Exception e){ e.printStackTrace(); } Thread thread = new Thread(){ public void run(){ robot.setAutoDelay(0); log("< initKeyboard"); pressNext(); } }; thread.start(); return null; } }); } public void typeKey(double sec, final int charCode, final int keyCode, final boolean alt, final boolean ctrl, final boolean shift, final int delay, final boolean async){ if(!isSecure(sec)) return; // called by doh.robot._keyPress // see it for details AccessController.doPrivileged(new PrivilegedAction(){ public Object run(){ try{ log("> typeKey Robot " + charCode + ", " + keyCode + ", " + async); KeyPressThread thread = new KeyPressThread(charCode, keyCode, alt, ctrl, shift, delay, async?null:previousThread); previousThread = async?previousThread:thread; thread.start(); log("< typeKey Robot"); }catch(Exception e){ log("Error calling typeKey"); e.printStackTrace(); } return null; } }); } public void upKey(double sec, final int charCode, final int keyCode, final int delay){ // called by doh.robot.keyDown // see it for details // a nice name like "keyUp" is reserved in Java if(!isSecure(sec)) return; AccessController.doPrivileged(new PrivilegedAction(){ public Object run(){ log("> upKey Robot " + charCode + ", " + keyCode); KeyUpThread thread = new KeyUpThread(charCode, keyCode, delay, previousThread); previousThread = thread; thread.start(); log("< upKey Robot"); return null; } }); } public void downKey(double sec, final int charCode, final int keyCode, final int delay){ // called by doh.robot.keyUp // see it for details // a nice name like "keyDown" is reserved in Java if(!isSecure(sec)) return; AccessController.doPrivileged(new PrivilegedAction(){ public Object run(){ log("> downKey Robot " + charCode + ", " + keyCode); KeyDownThread thread = new KeyDownThread(charCode, keyCode, delay, previousThread); previousThread = thread; thread.start(); log("< downKey Robot"); return null; } }); } public void pressMouse(double sec, final boolean left, final boolean middle, final boolean right, final int delay){ if(!isSecure(sec)) return; // called by doh.robot.mousePress // see it for details // a nice name like "mousePress" is reserved in Java AccessController.doPrivileged(new PrivilegedAction(){ public Object run(){ log("> mousePress Robot " + left + ", " + middle + ", " + right); MousePressThread thread = new MousePressThread( (left ? InputEvent.BUTTON1_MASK : 0) + (middle ? InputEvent.BUTTON2_MASK : 0) + (right ? InputEvent.BUTTON3_MASK : 0), delay, previousThread); previousThread = thread; thread.start(); log("< mousePress Robot"); return null; } }); } public void releaseMouse(double sec, final boolean left, final boolean middle, final boolean right, final int delay){ if(!isSecure(sec)) return; // called by doh.robot.mouseRelease // see it for details // a nice name like "mouseRelease" is reserved in Java AccessController.doPrivileged(new PrivilegedAction(){ public Object run(){ log("> mouseRelease Robot " + left + ", " + middle + ", " + right); MouseReleaseThread thread = new MouseReleaseThread( (left ? InputEvent.BUTTON1_MASK : 0) + (middle ? InputEvent.BUTTON2_MASK : 0) + (right ? InputEvent.BUTTON3_MASK : 0), delay, previousThread); previousThread = thread; thread.start(); log("< mouseRelease Robot"); return null; } }); } public void moveMouse(double sec, final int x1, final int y1, final int d, final int duration){ // called by doh.robot.mouseMove // see it for details // a nice name like "mouseMove" is reserved in Java if(!isSecure(sec)) return; AccessController.doPrivileged(new PrivilegedAction(){ public Object run(){ int x = x1 + docScreenX; int y = y1 + docScreenY; if(x > docScreenXMax || y > docScreenYMax){ // TODO: try to scroll view log("Request to mouseMove denied"); return null; } int delay = d; log("> mouseMove Robot " + x + ", " + y); MouseMoveThread thread = new MouseMoveThread(x, y, delay, duration, previousThread); previousThread = thread; thread.start(); log("< mouseMove Robot"); return null; } }); } public void wheelMouse(double sec, final int amount, final int delay, final int duration){ // called by doh.robot.mouseWheel // see it for details if(!isSecure(sec)) return; AccessController.doPrivileged(new PrivilegedAction(){ public Object run(){ MouseWheelThread thread = new MouseWheelThread(amount, delay, duration, previousThread); previousThread = thread; thread.start(); return null; } }); } private int getVKCode(int charCode, int keyCode){ int keyboardCode = 0; if(charCode >= 32){ // if it is printable, then it lives in our hashmap KeyEvent event = (KeyEvent) charMap.get(new Integer(charCode)); keyboardCode = event.getKeyCode(); } else{ switch (keyCode){ case 13: keyboardCode = KeyEvent.VK_ENTER; break; case 8: keyboardCode = KeyEvent.VK_BACK_SPACE; break; case 25:// shift tab for Safari case 9: keyboardCode = KeyEvent.VK_TAB; break; case 12: keyboardCode = KeyEvent.VK_CLEAR; break; case 16: keyboardCode = KeyEvent.VK_SHIFT; break; case 17: keyboardCode = KeyEvent.VK_CONTROL; break; case 18: keyboardCode = KeyEvent.VK_ALT; break; case 63250: case 19: keyboardCode = KeyEvent.VK_PAUSE; break; case 20: keyboardCode = KeyEvent.VK_CAPS_LOCK; break; case 27: keyboardCode = KeyEvent.VK_ESCAPE; break; case 32: log("it's a space"); keyboardCode = KeyEvent.VK_SPACE; break; case 63276: case 33: keyboardCode = KeyEvent.VK_PAGE_UP; break; case 63277: case 34: keyboardCode = KeyEvent.VK_PAGE_DOWN; break; case 63275: case 35: keyboardCode = KeyEvent.VK_END; break; case 63273: case 36: keyboardCode = KeyEvent.VK_HOME; break; /** * Constant for the <b>left</b> arrow key. */ case 63234: case 37: keyboardCode = KeyEvent.VK_LEFT; break; /** * Constant for the <b>up</b> arrow key. */ case 63232: case 38: keyboardCode = KeyEvent.VK_UP; break; /** * Constant for the <b>right</b> arrow key. */ case 63235: case 39: keyboardCode = KeyEvent.VK_RIGHT; break; /** * Constant for the <b>down</b> arrow key. */ case 63233: case 40: keyboardCode = KeyEvent.VK_DOWN; break; case 63272: case 46: keyboardCode = KeyEvent.VK_DELETE; break; case 63289: case 144: keyboardCode = KeyEvent.VK_NUM_LOCK; break; case 63249: case 145: keyboardCode = KeyEvent.VK_SCROLL_LOCK; break; /** Constant for the F1 function key. */ case 63236: case 112: keyboardCode = KeyEvent.VK_F1; break; /** Constant for the F2 function key. */ case 63237: case 113: keyboardCode = KeyEvent.VK_F2; break; /** Constant for the F3 function key. */ case 63238: case 114: keyboardCode = KeyEvent.VK_F3; break; /** Constant for the F4 function key. */ case 63239: case 115: keyboardCode = KeyEvent.VK_F4; break; /** Constant for the F5 function key. */ case 63240: case 116: keyboardCode = KeyEvent.VK_F5; break; /** Constant for the F6 function key. */ case 63241: case 117: keyboardCode = KeyEvent.VK_F6; break; /** Constant for the F7 function key. */ case 63242: case 118: keyboardCode = KeyEvent.VK_F7; break; /** Constant for the F8 function key. */ case 63243: case 119: keyboardCode = KeyEvent.VK_F8; break; /** Constant for the F9 function key. */ case 63244: case 120: keyboardCode = KeyEvent.VK_F9; break; /** Constant for the F10 function key. */ case 63245: case 121: keyboardCode = KeyEvent.VK_F10; break; /** Constant for the F11 function key. */ case 63246: case 122: keyboardCode = KeyEvent.VK_F11; break; /** Constant for the F12 function key. */ case 63247: case 123: keyboardCode = KeyEvent.VK_F12; break; /** * Constant for the F13 function key. * * @since 1.2 */ /* * F13 - F24 are used on IBM 3270 keyboard; break; use * random range for constants. */ case 124: keyboardCode = KeyEvent.VK_F13; break; /** * Constant for the F14 function key. * * @since 1.2 */ case 125: keyboardCode = KeyEvent.VK_F14; break; /** * Constant for the F15 function key. * * @since 1.2 */ case 126: keyboardCode = KeyEvent.VK_F15; break; case 63302: case 45: keyboardCode = KeyEvent.VK_INSERT; break; case 47: keyboardCode = KeyEvent.VK_HELP; break; } } log("Attempting to type " + (char) charCode + ":" + charCode + " " + keyCode); log("Converted to " + keyboardCode); return keyboardCode; } private boolean isUnsafe(int keyboardCode){ // run through exemption list log("ctrl: "+ctrl+", alt: "+alt+", shift: "+shift); if(((ctrl || alt) && keyboardCode == KeyEvent.VK_ESCAPE) || (alt && keyboardCode == KeyEvent.VK_TAB) || (ctrl && alt && keyboardCode == KeyEvent.VK_DELETE)){ log("You are not allowed to press this key combination!"); return true; }else{ log("Safe to press."); return false; } } private void _typeKey(final int cCode, final int kCode, final boolean a, final boolean c, final boolean s){ AccessController.doPrivileged(new PrivilegedAction(){ public Object run(){ int charCode = cCode; int keyCode = kCode; boolean alt = a; boolean ctrl = c; boolean shift = s; boolean altgraph = false; log("> _typeKey Robot " + charCode + ", " + keyCode); try{ int keyboardCode=getVKCode(charCode, keyCode); if(charCode >= 32){ // if it is printable, then it lives in our hashmap KeyEvent event = (KeyEvent) charMap.get(new Integer(charCode)); // see if we need to press shift to generate this // character if(!shift){ shift = event.isShiftDown(); } altgraph = event.isAltGraphDown(); keyboardCode = event.getKeyCode(); } // run through exemption list if(!isUnsafe(keyboardCode)){ if(shift){ log("Pressing shift"); robot.keyPress(KeyEvent.VK_SHIFT); } if(alt){ log("Pressing alt"); robot.keyPress(KeyEvent.VK_ALT); } if(altgraph){ log("Pressing altgraph"); robot.keyPress(KeyEvent.VK_ALT_GRAPH); } if(ctrl){ log("Pressing ctrl"); robot.keyPress(KeyEvent.VK_CONTROL); } if(keyboardCode != KeyEvent.VK_SHIFT && keyboardCode != KeyEvent.VK_ALT && keyboardCode != KeyEvent.VK_CONTROL){ try{ robot.keyPress(keyboardCode); robot.keyRelease(keyboardCode); }catch(Exception e){ log("Error while actually typing a key"); e.printStackTrace(); } } if(ctrl){ robot.keyRelease(KeyEvent.VK_CONTROL); ctrl = false; } if(alt){ robot.keyRelease(KeyEvent.VK_ALT); alt = false; } if(altgraph){ robot.keyRelease(KeyEvent.VK_ALT_GRAPH); altgraph = false; } if(shift){ log("Releasing shift"); robot.keyRelease(KeyEvent.VK_SHIFT); shift = false; } } }catch(Exception e){ log("Error in _typeKey"); e.printStackTrace(); } log("< _typeKey Robot"); return null; } }); } public boolean hasFocus(){ try{ return ((Boolean) window .eval("var result=false;if(window.parent.document.hasFocus){result=window.parent.document.hasFocus();}else{result=true;}result;")) .booleanValue(); }catch(Exception e){ // runs even after you close the window! return false; } } // Threads for common Robot tasks // (so as not to tie up the browser rendering thread!) // declared inside so they have private access to the robot // we do *not* want to expose that guy! final private class KeyPressThread extends Thread{ private int charCode; private int keyCode; private boolean alt; private boolean ctrl; private boolean shift; private int delay; private Thread myPreviousThread = null; public KeyPressThread(int charCode, int keyCode, boolean alt, boolean ctrl, boolean shift, int delay, Thread myPreviousThread){ log("KeyPressThread constructor " + charCode + ", " + keyCode); this.charCode = charCode; this.keyCode = keyCode; this.alt = alt; this.ctrl = ctrl; this.shift = shift; this.delay = delay; this.myPreviousThread = myPreviousThread; } public void run(){ try{ if(myPreviousThread != null) myPreviousThread.join(); // in different order so async works while(!hasFocus()){ Thread.sleep(1000); } Thread.sleep(delay); log("> run KeyPressThread"); _typeKey(charCode, keyCode, alt, ctrl, shift); }catch(Exception e){ log("Bad parameters passed to _typeKey"); e.printStackTrace(); } log("< run KeyPressThread"); } } final private class KeyDownThread extends Thread{ private int charCode; private int keyCode; private int delay; private Thread myPreviousThread = null; public KeyDownThread(int charCode, int keyCode, int delay, Thread myPreviousThread){ log("KeyDownThread constructor " + charCode + ", " + keyCode); this.charCode = charCode; this.keyCode = keyCode; this.delay = delay; this.myPreviousThread = myPreviousThread; } public void run(){ try{ if(myPreviousThread != null) myPreviousThread.join(); Thread.sleep(delay); log("> run KeyDownThread"); while(!hasFocus()){ Thread.sleep(1000); } int vkCode=getVKCode(charCode, keyCode); if(charCode >= 32){ // if it is printable, then it lives in our hashmap KeyEvent event = (KeyEvent) charMap.get(new Integer(charCode)); // see if we need to press shift to generate this // character if(event.isShiftDown()){ robot.keyPress(KeyEvent.VK_SHIFT); shift=true; } if(event.isAltGraphDown()){ robot.keyPress(KeyEvent.VK_ALT_GRAPH); altgraph=true; } }else{ if(vkCode==KeyEvent.VK_ALT){ alt=true; }else if(vkCode==KeyEvent.VK_CONTROL){ ctrl=true; }else if(vkCode==KeyEvent.VK_SHIFT){ shift=true; }else if(vkCode==KeyEvent.VK_ALT_GRAPH){ altgraph=true; } } if(!isUnsafe(vkCode)){ robot.keyPress(vkCode); } }catch(Exception e){ log("Bad parameters passed to downKey"); e.printStackTrace(); } log("< run KeyDownThread"); } } final private class KeyUpThread extends Thread{ private int charCode; private int keyCode; private int delay; private Thread myPreviousThread = null; public KeyUpThread(int charCode, int keyCode, int delay, Thread myPreviousThread){ log("KeyUpThread constructor " + charCode + ", " + keyCode); this.charCode = charCode; this.keyCode = keyCode; this.delay = delay; this.myPreviousThread = myPreviousThread; } public void run(){ try{ if(myPreviousThread != null) myPreviousThread.join(); Thread.sleep(delay); log("> run KeyUpThread"); while(!hasFocus()){ Thread.sleep(1000); } int vkCode=getVKCode(charCode, keyCode); if(charCode >= 32){ // if it is printable, then it lives in our hashmap KeyEvent event = (KeyEvent) charMap.get(new Integer(charCode)); // see if we need to press shift to generate this // character if(event.isShiftDown()){ robot.keyRelease(KeyEvent.VK_SHIFT); shift=false; } if(event.isAltGraphDown()){ robot.keyRelease(KeyEvent.VK_ALT_GRAPH); altgraph=false; } }else{ if(vkCode==KeyEvent.VK_ALT){ alt=false; }else if(vkCode==KeyEvent.VK_CONTROL){ ctrl=false; }else if(vkCode==KeyEvent.VK_SHIFT){ shift=false; }else if(vkCode==KeyEvent.VK_ALT_GRAPH){ altgraph=false; } } robot.keyRelease(vkCode); }catch(Exception e){ log("Bad parameters passed to upKey"); e.printStackTrace(); } log("< run KeyUpThread"); } } final private class MousePressThread extends Thread{ private int mask; private int delay; private Thread myPreviousThread = null; public MousePressThread(int mask, int delay, Thread myPreviousThread){ this.mask = mask; this.delay = delay; this.myPreviousThread = myPreviousThread; } public void run(){ try{ if(myPreviousThread != null) myPreviousThread.join(); Thread.sleep(delay); log("> run MousePressThread"); while(!hasFocus()){ Thread.sleep(1000); } robot.mousePress(mask); robot.waitForIdle(); }catch(Exception e){ log("Bad parameters passed to mousePress"); e.printStackTrace(); } log("< run MousePressThread"); } } final private class MouseReleaseThread extends Thread{ private int mask; private int delay; private Thread myPreviousThread = null; public MouseReleaseThread(int mask, int delay, Thread myPreviousThread){ this.mask = mask; this.delay = delay; this.myPreviousThread = myPreviousThread; } public void run(){ try{ if(myPreviousThread != null) myPreviousThread.join(); Thread.sleep(delay); log("> run MouseReleaseThread "); while(!hasFocus()){ Thread.sleep(1000); } robot.mouseRelease(mask); robot.waitForIdle(); }catch(Exception e){ log("Bad parameters passed to mouseRelease"); e.printStackTrace(); } log("< run MouseReleaseThread "); } } final private class MouseMoveThread extends Thread{ private int x; private int y; private int delay; private int duration; private Thread myPreviousThread = null; public MouseMoveThread(int x, int y, int delay, int duration, Thread myPreviousThread){ this.x = x; this.y = y; this.delay = delay; this.duration = duration; this.myPreviousThread = myPreviousThread; } public double easeInOutQuad(double t, double b, double c, double d){ t /= d / 2; if(t < 1) return c / 2 * t * t + b; t--; return -c / 2 * (t * (t - 2) - 1) + b; }; public void run(){ try{ if(myPreviousThread != null) myPreviousThread.join(); Thread.sleep(delay); log("> run MouseMoveThread " + x + ", " + y); while(!hasFocus()){ Thread.sleep(1000); } int x1 = lastMouseX; int x2 = x; int y1 = lastMouseY; int y2 = y; // shrink range by 1 px on both ends // manually move this 1px to trip DND code if(x1 != x2){ int dx = x - lastMouseX; if(dx > 0){ x1 += 1; x2 -= 1; }else{ x1 -= 1; x2 += 1; } } if(y1 != y2){ int dy = y - lastMouseY; if(dy > 0){ y1 += 1; y2 -= 1; }else{ y1 -= 1; y2 += 1; } } robot.setAutoDelay(Math.max(duration/100,1)); robot.mouseMove(x1, y1); int d = 100; for (int t = 0; t <= d; t++){ x1 = (int) easeInOutQuad((double) t, (double) lastMouseX, (double) x2 - lastMouseX, (double) d); y1 = (int) easeInOutQuad((double) t, (double) lastMouseY, (double) y2 - lastMouseY, (double) d); robot.mouseMove(x1, y1); } robot.mouseMove(x, y); lastMouseX = x; lastMouseY = y; robot.waitForIdle(); robot.setAutoDelay(1); }catch(Exception e){ log("Bad parameters passed to mouseMove"); e.printStackTrace(); } log("< run MouseMoveThread"); } } final private class MouseWheelThread extends Thread{ private int amount; private int delay; private int duration; private Thread myPreviousThread = null; public MouseWheelThread(int amount, int delay, int duration, Thread myPreviousThread){ this.amount = amount; this.delay = delay; this.duration = duration; this.myPreviousThread = myPreviousThread; } public void run(){ try{ if(myPreviousThread != null) myPreviousThread.join(); Thread.sleep(delay); log("> run MouseWheelThread " + amount); while(!hasFocus()){ Thread.sleep(1000); } int dir = 1; if(System.getProperty("os.name").toUpperCase().indexOf("MAC") != -1){ // yay for Apple dir = -1; } robot.setAutoDelay(Math.max(duration/Math.abs(amount),1)); for(int i=0; i<Math.abs(amount); i++){ robot.mouseWheel(amount>0?dir:-dir); } robot.setAutoDelay(1); }catch(Exception e){ log("Bad parameters passed to mouseWheel"); e.printStackTrace(); } log("< run MouseWheelThread "); } } final private class RobotSecurityManager extends SecurityManager{ // The applet's original security manager. // There is a bug in some people's Safaris that causes Safari to // basically hang on liveconnect calls. // Our security manager fixes it. private boolean isActive = false; private boolean isOpera = false; private boolean isLinux = false; private SecurityManager oldsecurity = null; public RobotSecurityManager(boolean isOpera, SecurityManager oldsecurity){ this.isOpera = isOpera; this.isLinux = System.getProperty("os.name").toLowerCase().indexOf("linux") != -1; this.oldsecurity = oldsecurity; } public boolean checkTopLevelWindow(Object window){ // If our users temporarily accept our cert for a session, // then use the same session to browse to a malicious website also using our applet, // that website can automatically execute the applet. // To resolve this issue, RobotSecurityManager overrides checkTopLevelWindow // to check the JVM to see if there are other instances of the applet running on different domains. // If there are, it prompts the user to confirm that they want to run the applet before continuing. // null is not supposed to be allowed // so we allow it to distinguish our security manager. if(window == null){ isActive = !isActive; log("Active is now " + isActive); } return window == null ? true : oldsecurity .checkTopLevelWindow(window); } public void checkPermission(Permission p){ // liveconnect SocketPermission resolve takes // FOREVER (like 6 seconds) in Safari // Java does like 50 of these on the first JS call // 6*50=300 seconds! // Opera freaks out though if we deny resolve if(isActive && !isOpera && !isLinux && java.net.SocketPermission.class.isInstance(p) && p.getActions().matches(".*resolve.*")){ throw new SecurityException( "DOH: liveconnect resolve locks up Safari. Denying resolve request."); }else if(p.equals(new java.awt.AWTPermission("watchMousePointer"))){ // enable robot to watch mouse }else{ oldsecurity.checkPermission(p); } } public void checkPermission(Permission perm, Object context){ checkPermission(perm); } } public void setClipboardText(double sec, final String data) { if(!isSecure(sec)) return; // called by doh.robot.setClipboard // see it for details AccessController.doPrivileged(new PrivilegedAction(){ public Object run(){ StringSelection ss = new StringSelection(data); getSystemClipboard().setContents(ss, ss); return null; } }); } public void setClipboardHtml(double sec, final String data) { if(!isSecure(sec)) return; // called by doh.robot.setClipboard when format=='text/html' // see it for details AccessController.doPrivileged(new PrivilegedAction(){ public Object run(){ String mimeType = "text/html;class=java.lang.String";//type + "; charset=" + charset;// + "; class=" + transferType; TextTransferable transferable = new TextTransferable(mimeType, data); getSystemClipboard().setContents(transferable, transferable); return null; } }); } private static java.awt.datatransfer.Clipboard getSystemClipboard() { return Toolkit.getDefaultToolkit().getSystemClipboard(); } private static class TextTransferable implements Transferable, ClipboardOwner { private String data; private static ArrayList htmlFlavors = new ArrayList(); static{ try{ htmlFlavors.add(new DataFlavor("text/plain;charset=UTF-8;class=java.lang.String")); htmlFlavors.add(new DataFlavor("text/html;charset=UTF-8;class=java.lang.String")); }catch(ClassNotFoundException ex){ ex.printStackTrace(); } } public TextTransferable(String mimeType, String data){ this.data = data; } public DataFlavor[] getTransferDataFlavors(){ return (DataFlavor[]) htmlFlavors.toArray(new DataFlavor[htmlFlavors.size()]); } public boolean isDataFlavorSupported(DataFlavor flavor){ return htmlFlavors.contains(flavor); } public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException{ if (String.class.equals(flavor.getRepresentationClass())){ return data; } throw new UnsupportedFlavorException(flavor); } public void lostOwnership(java.awt.datatransfer.Clipboard clipboard, Transferable contents){ data = null; } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
cd476b8dcfa80c3a70e8fe3a3e0c0c3d03c2fe4c
e6c88a855d048bae12a82fe8664b2b58bf4de3f0
/dlese-tools-project/src/org/dlese/dpc/schemedit/test/SchemaHelperTester.java
4d298318a0f395b8883b4e4124c619a6e3139732
[]
no_license
UCLALibrary/sheetmusic-oai
ec604b19ef6ad3c409f61a5a51cd5e1584a2ec3d
ab3e8401484bb0197fb135ce86a87f0bc1aac0ba
refs/heads/master
2020-08-02T15:12:07.028427
2019-09-27T22:09:12
2019-09-27T22:09:12
211,402,883
0
0
null
null
null
null
UTF-8
Java
false
false
16,169
java
/* * License and Copyright: * * The contents of this file are subject to the Educational Community License v1.0 (the "License"); you may * not use this file except in compliance with the License. You should have received a copy of the License * along with this software; if not, you may obtain a copy of the License at * http://www.opensource.org/licenses/ecl1.php. * * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, * either express or implied. See the License for the specific language governing rights and limitations * under the License. * * Copyright 2002-2009 by Digital Learning Sciences, University Corporation for Atmospheric Research (UCAR). * All rights reserved. */ package org.dlese.dpc.schemedit.test; import org.dlese.dpc.serviceclients.webclient.WebServiceClient; import org.dlese.dpc.xml.*; import org.dlese.dpc.xml.schema.*; import org.dlese.dpc.xml.schema.compositor.*; import org.dlese.dpc.schemedit.*; import org.dlese.dpc.util.strings.*; import java.io.*; import java.util.*; import java.text.*; import java.util.regex.*; import java.net.*; import org.dom4j.Node; import org.dom4j.Element; import org.dom4j.Document; import org.dom4j.DocumentFactory; import org.dom4j.DocumentException; import org.dom4j.io.SAXReader; import org.dom4j.io.OutputFormat; import org.dom4j.io.XMLWriter; import com.sun.msv.datatype.xsd.*; import org.relaxng.datatype.*; /** * Description of the Class * * @author ostwald */ public class SchemaHelperTester { public WebServiceClient webServiceClient = null; public GlobalDefMap globalDefMap = null; public Document instanceDocument = null; public XSDatatypeManager xsdDatatypeManager = null; public SchemaNodeMap schemaNodeMap = null; public DefinitionMiner definitionMiner; public XMLWriter writer; public SchemaHelper sh; String xmlFormat; /** * The main program for the SchemaHelperTester class * * @param args The command line arguments */ public static void main(String[] args) throws Exception { SchemaHelper.setVerbose(false); SchemaHelperTester t = null; DefinitionMiner.setDebug(false); SchemaReader.setDebug(false); String xmlFormat = "dlese_anno"; if (args.length > 0) xmlFormat = args[0]; try { t = new SchemaHelperTester(xmlFormat); if (t.sh == null) throw new Exception ("schemaHelper not instantiated"); } catch (Exception e) { prtln ("ERROR: " + e.getMessage()); return; } // t.msp2_tests (); t.dlese_anno_tests (); // String path = "/itemRecord/geospatialCoverages/geospatialCoverage/body"; // t.showRepeatingComplexSingletons(); // t.showNodesHavingRepeatingComplexSingletons(); // if (t.sh.hasRepeatingComplexSingleton(path)) // prtln ("YUP: " + path); // t.pathTester (path); // t.enumTester(path); // -- NOTE: most/all the following are now implemented in SchemaUtils! // t.showEnumerationTypes(); // t.showXSDStringExtensionFields(); // t.showComboUnionFields(); // t.showRequiredBranches(); // t.showRequiredContentElements(); // t.showGlobalElements(); // SchemaUtils.showDerivedDataTypes (t.sh); // SchemaUtils.showSimpleAndComplexContentElements (t.sh); // SchemaUtils.showDerivedContentModelElements (t.sh); // t.showIdRefTypes(); } void msp2_tests () throws Exception { prtln ("msp2tests"); String path = "/record/coverage/location_1_"; path = XPathUtils.decodeXPath(path); prtln ("decoded path: " + path); path = XPathUtils.normalizeXPath(path); prtln ("normalized path: " + path); if (sh.getSchemaNode (path) == null) throw new Exception ("schemaNode not found for " + path); if (sh.isChoiceElement(path)) prtln ("choice"); if (sh.isMultiChoiceElement(path)) prtln ("multichoice"); if (sh.isRepeatingElement(path)) prtln ("repeating"); } /* * encoded path, e.g., "/annotationRecord/annotation/contributors/contributor_1_" */ public void dlese_anno_tests() { } void showIdRefTypes () { for (Iterator i=schemaNodeMap.getValues().iterator();i.hasNext();) { SchemaNode schemaNode = (SchemaNode)i.next(); if (schemaNode.getValidatingType().getName().equals("IdRefType")) prtln (schemaNode.getXpath()); // prtln (schemaNode.getValidatingType().getName()); } } void pathTester (String path) { prtln ("testing " + path); prtln ("\t repeating Element?"); prtln ((sh.isRepeatingElement (path)) ? "\t\t YES" : "\t\t no"); prtln ("\t is repeatingComplexSingleton??"); prtln ((sh.isRepeatingComplexSingleton (path)) ? "\t\t YES" : "\t\t no"); } /* three cases 1 - simple Enumeration (GenericType.isEnumerationType()) -> genericType.getEnumerationValues 2 - comboUnion Type (SimpleType.isComboUnionType() -> genericType.getEnumerationValues (?will this work with comboUnions?) 3 - derivedTextOnlyModel (that extends either an enumeration or comboUnion) ComplexType.isDerivedTextOnlyModel -> work with ComplexType.getExtensionType */ void enumTester (String path) { prtln ("Enum Tester with path: " + path); try { SchemaNode schemaNode = sh.getSchemaNode(path); if (schemaNode == null) throw new Exception ("schemaNode not found for " + path); GlobalDef globalDef = schemaNode.getTypeDef(); if (globalDef == null) throw new Exception ("globalDef not found for " + path); // Case 3 - ComplexType && isDerivedTextOnlyModel if (globalDef.isComplexType()) { ComplexType complexType = (ComplexType) globalDef; if (!complexType.isDerivedTextOnlyModel()) throw new Exception ("globalDef is complexType but not derivedTextOnlyModel - cannot define enumeration"); globalDef = complexType.getExtensionType(); prtln ("working with extension base: " + globalDef.getQualifiedInstanceName()); } if (!globalDef.isTypeDef()) throw new Exception ("globalDef is NOT typeDef (" + globalDef.getQualifiedInstanceName()); GenericType typeDef = (GenericType) globalDef; if (!globalDef.isSimpleType()) // now we need to test for a model that EXTENDS a simpleType ... throw new Exception ("globalDef is NOT simpleType (" + globalDef.getQualifiedInstanceName()); SimpleType simpleType = (SimpleType) globalDef; prtln (typeDef.toString()); if (! (simpleType.isEnumeration() || simpleType.isComboUnionType())) throw new Exception ("NOT an enumeration or comboUnion"); else { if (simpleType.isEnumeration()) prtln (" ... Enumeration"); if (simpleType.isComboUnionType()) prtln (" ... ComboUnionType"); } prtln ("calling getEnumerationValues"); List terms = ((GenericType)typeDef).getEnumerationValues(); prtln ("Enumeration values"); for (Iterator i=terms.iterator();i.hasNext();) { prtln ("\t" + (String)i.next()); } } catch (Exception e) { prtln ("enumTester: " + e.getMessage()); } } /** * Constructor for the SchemaHelperTester object */ public SchemaHelperTester(String xmlFormat) throws Exception { this.xmlFormat = xmlFormat; SchemaRegistry sr = new SchemaRegistry(); SchemaRegistry.Schema schema = (SchemaRegistry.Schema)sr.getSchema(xmlFormat); if (schema == null) { throw new Exception ("Schema not found for \"" + xmlFormat + "\""); } String path = schema.path; String rootElementName = schema.rootElementName; SimpleSchemaHelperTester t = null; try { if (path.indexOf ("http:") == 0) { URL schemaUrl = new URL (path); sh = new SchemaHelper(schemaUrl, rootElementName); // sh = new SchemaHelper(schemaUrl); } else { prtln ("path: " + path); sh = new SchemaHelper (new File (path), rootElementName); } if (sh == null) { throw new Exception ("\n\n ** schemaHelper not instantiated **"); } else { prtln("SchemaHelper instantiated"); } schemaNodeMap = sh.getSchemaNodeMap(); globalDefMap = sh.getGlobalDefMap(); instanceDocument = sh.getInstanceDocument(); writer = Dom4jUtils.getXMLWriter(); xsdDatatypeManager = sh.getXSDatatypeManager(); } catch (Exception e) { prtln ("failed to instantiate SimpleSchemaHelperTester: " + e.getMessage()); e.printStackTrace(); System.exit(1); } } public void stuffValue (DocMap docMap, String xpath, String value, SchemaHelper schemaHelper) throws Exception { if (schemaHelper.getSchemaNode(xpath) == null) throw new Exception ("stuffValue got an illegal xpath: " + xpath); Node node = docMap.selectSingleNode (xpath); if (node == null) node = docMap.createNewNode(xpath); if (node == null) throw new Exception ("node not found for " + xpath); else node.setText(value); } /** * Description of the Method * * @param test Description of the Parameter */ public static void charTest(String test) { // String test = "ABCD"; for (int i = 0; i < test.length(); ++i) { char c = test.charAt(i); int j = (int) c; System.out.println(j); } } /** * Description of the Method */ public static void charTest() { for (int i = 0; i < 128; i++) { char c = (char) i; prtln(c + ": " + (int) c); } } /** * Description of the Method * * @param uriStr Description of the Parameter */ public static void uriTest(String uriStr) { URI uri = null; try { uri = new URI(uriStr); } catch (Exception e) { prtln(e.getMessage()); return; } // t = new SchemaHelperTester(uri); prtln("URI: " + uri.toString()); String scheme = uri.getScheme(); prtln("Scheme: " + scheme); prtln("isAbsolute: " + uri.isAbsolute()); String path = uri.getPath(); if (path != null) { prtln("path: " + path); } else { prtln("path is null"); } if (scheme == null) { prtln("scheme is null"); } else if (scheme.equals("file")) { prtln("scheme is file"); try { File file = new File(path); if (file.exists()) { prtln("file exists at " + path); } else { prtln("file doesn't exist at " + path); } } catch (Exception e) { prtln(e.getMessage()); } } else if (scheme.equals("http")) { prtln("scheme is http"); URL url = null; try { url = uri.toURL(); prtln("made a url!"); } catch (Exception e) { prtln("failed to form URL: " + e.getMessage()); return; } prtln("url: " + url.toString()); } else { prtln("unrecognized scheme: " + scheme); } } /** * Print a listing of the globalDefs that are used more than once in the * InstanceDoc */ public void displayTypeUsers() { TreeMap map = new TreeMap(); List paths = schemaNodeMap.getKeys(); for (Iterator i = paths.iterator(); i.hasNext(); ) { String xpath = (String) i.next(); SchemaNode schemaNode = (SchemaNode) schemaNodeMap.getValue(xpath); // String typeName = schemaNode.getDataTypeName(); String typeName = schemaNode.getTypeDef().getName(); GlobalDef globalDef = (GlobalDef) globalDefMap.getValue(typeName); if (globalDef == null) { String schemaNSPrefix = this.sh.getSchemaNamespace().getPrefix(); if (!typeName.startsWith(schemaNSPrefix + ":")) { prtln(typeName + " - not found in globalDefMap"); } continue; } if (globalDef.getDataType() == GlobalDef.COMPLEX_TYPE) { // prtln (globalDef.getName()); if (map.containsKey(typeName)) { ArrayList l = (ArrayList) map.get(typeName); l.add(xpath); map.put(typeName, l); } else { ArrayList a = new ArrayList(); a.add(xpath); map.put(typeName, a); } } } Set keys = map.keySet(); for (Iterator i = keys.iterator(); i.hasNext(); ) { String key = (String) i.next(); List list = (List) map.get(key); if (list.size() > 1) { prtln("\n" + key + "(" + list.size() + " items)"); for (Iterator x = list.iterator(); x.hasNext(); ) { String path = (String) x.next(); prtln("\t" + path); } } } } /** * Description of the Method */ public void displayComplexTypes() { // List keys = globalDefMap.getKeys(GlobalDef.COMPLEX_TYPE); List complexTypes = globalDefMap.getComplexTypes(); prtln("\n** Complex types (" + complexTypes.size() + ") **"); for (Iterator i = complexTypes.iterator(); i.hasNext(); ) { GlobalDef def = (GlobalDef) i.next(); prtln(def.toString()); try { write(def.getElement()); } catch (Exception e) { prtln(e.getMessage()); } } } /** * Find the dataTypes of elements in the SchemaNodeMap that are not present in * the XSDatatypeManager. We are only interested in the SimpleTypes, since * complexTypes are not handled by the XSDatatypeManager. */ public void reportMissingXSDatatypes() { List keys = schemaNodeMap.getKeys(); List mia = new ArrayList(); for (Iterator i = keys.iterator(); i.hasNext(); ) { String key = (String) i.next(); SchemaNode schemaNode = (SchemaNode) schemaNodeMap.getValue(key); // String typeName = schemaNode.getDataTypeName(); String typeName = schemaNode.getTypeDef().getName(); if (globalDefMap.containsKey(typeName)) { GlobalDef def = (GlobalDef) globalDefMap.getValue(typeName); if (def.getDataType() == GlobalDef.COMPLEX_TYPE) { continue; } XSDatatype dt = xsdDatatypeManager.getTypeByName(typeName); // add to the missing in action (mia) map if (dt == null) { if (!mia.contains(typeName)) { mia.add(typeName); } } } else { prtln("WARNING: " + typeName + " not found in globalDefMap"); } } prtln("missing (Simple and built-in) XSDatatypes"); for (Iterator i = mia.iterator(); i.hasNext(); ) { String typeName = (String) i.next(); if (globalDefMap.containsKey(typeName)) { GlobalDef def = (GlobalDef) globalDefMap.getValue(typeName); String dataType = String.valueOf(def.getDataType()); prtln(typeName + " IS in globalDefMap"); } else { prtln(typeName + " is NOT in globalDefMap"); } } } /** * Displays specific info about all the SchemaNodeMap schemaNodes that wrap * attribute elements from the schema */ public void displayAttributes() { prtln("Attributes from the SchemaNodeMap"); List attrXPaths = schemaNodeMap.getKeys(Node.ATTRIBUTE_NODE); for (Iterator i = attrXPaths.iterator(); i.hasNext(); ) { String xpath = (String) i.next(); SchemaNode schemaNode = (SchemaNode) schemaNodeMap.getValue(xpath); String use = schemaNode.getAttr("use"); // prtln("\n" + xpath + "\n\tdataType: " + schemaNode.getDataTypeName() + "\n\tuse: " + use); prtln("\n" + xpath + "\n\tdataType: " + schemaNode.getTypeDef().getName() + "\n\tuse: " + use); } } /** * Gets the compositors attribute of the SchemaHelperTester object * * @param filter Description of the Parameter */ public void displayCompositors(String filter) { // List complexTypeNames = globalDefMap.getKeys(GlobalDef.COMPLEX_TYPE); List complexTypes = globalDefMap.getComplexTypes(); prtln("Compositors for ComplexTypes"); for (Iterator i = complexTypes.iterator(); i.hasNext(); ) { ComplexType def = (ComplexType) i.next(); String typeName = def.getName(); Compositor compositor = def.getCompositor(); if (compositor == null) continue; String compositorName = compositor.getName(); if (compositorName.equals(filter) || filter.equals("*")) { prtln("----------\n" + typeName + ": " + compositorName); // prtln("\t" + def.getLocation()); // write(def.getElement()); List choices = def.getChoices(); for (Iterator c = choices.iterator(); c.hasNext(); ) { prtln((String) c.next()); } prtln(""); } } } /** * Description of the Method * * @param o Description of the Parameter */ public void write(Object o) { try { writer.write(o); prtln(""); } catch (Exception e) { prtln("couldn write"); } } /** * Description of the Method * * @param node Description of the Parameter */ public static void pp(Node node) { prtln(Dom4jUtils.prettyPrint(node)); } /** * Description of the Method * * @param s Description of the Parameter */ public static void prtln(String s) { // System.out.prtlnln("SchemaHelperTester: " + s); System.out.println(s); } }
[ "PGhorpade@ad.library.ucla.edu" ]
PGhorpade@ad.library.ucla.edu
6336985d4417043d0179171ddb1c72138053c31c
842abddb62a76d49a86af643f719b03c1da320a0
/SDR_analysis-tools/src/main/java/com/sdr/ext/material/util/ErrorHandler.java
693fb1930cec75bd4d0f5026a82fbc692c845002
[]
no_license
siahn-kisti/sdr_portlet
09ff0912b4ff8f88ba4113468e8550bee702b432
fce45256b5056a9ac26893ea046295eee67687e3
refs/heads/master
2020-04-09T06:35:53.987766
2018-12-03T04:13:55
2018-12-03T04:13:55
160,119,581
1
0
null
null
null
null
UTF-8
Java
false
false
2,120
java
package com.sdr.ext.material.util; import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.servlet.SessionErrors; import com.liferay.portal.kernel.servlet.SessionMessages; import com.liferay.portal.security.auth.PrincipalException; import com.liferay.portal.util.PortalUtil; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; import javax.portlet.ActionRequest; import javax.portlet.RenderRequest; import javax.portlet.ResourceRequest; public class ErrorHandler { private static Log _log = LogFactoryUtil.getLog(ErrorHandler.class); public static void error(RenderRequest renderRequest, Exception e){ if(e.getClass() == PrincipalException.class){ SessionErrors.add(renderRequest, e.getClass(), PermissionConstant.SDR_ACCESS_DENIED_MESSAGE); SessionMessages.add(renderRequest, PortalUtil.getPortletId(renderRequest) + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE); } } public static void error(ActionRequest actionRequest, Exception e){ if(e.getClass() == PrincipalException.class){ SessionErrors.add(actionRequest, e.getClass(), PermissionConstant.SDR_ACCESS_DENIED_MESSAGE); SessionMessages.add(actionRequest, PortalUtil.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE); } } public static void error(ResourceRequest resourceRequest, Exception e){ if(e.getClass() == PrincipalException.class){ SessionErrors.add(resourceRequest, e.getClass(), PermissionConstant.SDR_ACCESS_DENIED_MESSAGE); SessionMessages.add(resourceRequest, PortalUtil.getPortletId(resourceRequest) + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE); } } public static String ajaxError(Exception e){ if(e.getClass() == PrincipalException.class) { return PermissionConstant.SDR_ACCESS_DENIED_MESSAGE; } return null; } } //ajax error - log level error @ResponseStatus(value = HttpStatus.BAD_REQUEST) class AjaxErrorException extends RuntimeException { public AjaxErrorException(String s) { super(s); } }
[ "siahn@kisti.re.kr" ]
siahn@kisti.re.kr
6ef42791122b4c4d7457ddf58540b9c835036381
03fdf2db9a12fa78a6748b63d799e82d267f7331
/src/cs3500/hw02/Card.java
160a135845c64eb03f1cca0042104f5b4b2bc826
[]
no_license
16jabrams/Freecell
6cfa2735eb6629264b9ec19689f8607ce6360837
05978b78a1f934876b5eb52ac9faeb3f0272fb7d
refs/heads/master
2021-01-24T04:07:55.922589
2018-02-28T16:30:16
2018-02-28T16:30:16
122,922,115
0
0
null
null
null
null
UTF-8
Java
false
false
1,143
java
package cs3500.hw02; /** * This class represents a model of a playing card. */ public class Card { private final SuitType suit; private final ValueType value; /** * Create instance of Card. * * @param suit suit of card. * @param value value of card. */ public Card(SuitType suit, ValueType value) { this.suit = suit; this.value = value; } /** * Gets the SuitType. * * @return returns suit of card. */ public SuitType getSuit() { return suit; } /** * Gets the ValueType. * * @return returns value of card. */ public ValueType getValue() { return value; } /** * Checks if the cards are equal. * * @param c given card to be compared to this card. * @return returns true if card has same suit and value as this card. */ public boolean isSame(Card c) { return c.suit == this.suit && c.value == this.value; } /** * Returns Card as string. * * @return returns of string of the card value and suit symbol for showing game status. */ @Override public String toString() { return value.getVal() + suit.getSymbol(); } }
[ "abrams.j@husky.neu.edu" ]
abrams.j@husky.neu.edu
0589db7f65bcee9a03ab0e72e20af6054b365565
385afe527e9054d5fa09aa038b11edae65f1cb45
/src/java/main/db/UserDAO.java
2e02edaef6953101cca85298b4df4c3070a6ae8d
[]
no_license
pashna/tp_2014_02_java_Kochetkov
a74c24f417f4c40fc05b1d199b2e2dc407ec7ec3
7f63ee371a832706a1b518e442b6e1b928a0defa
refs/heads/master
2021-01-16T20:34:12.472012
2014-05-09T01:20:11
2014-05-09T01:20:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
879
java
package db; // Добавить exec в анонимный класс import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; /* Created by p.Kochetkov on 08.03.14. */ public class UserDAO { //ExecHandler handler; Connection connection; UserDAO (Connection connect) { connection = connect; //handler = new ExecHandler(); } UserDataSet findUser(String username) throws SQLException { return Executor.execQuery(connection, SqlStringConstructor.generateSelect(username)); } boolean addUser(UserDataSet user) throws SQLException { return Executor.execUpdate(connection, SqlStringConstructor.generateUpdate(user)); } boolean deleteUser(String username) throws SQLException { return Executor.execUpdate(connection, SqlStringConstructor.generateDelete(username)); } }
[ "p02p@yandex.ru" ]
p02p@yandex.ru
1f61b82fec11ebc79f50096134b80d9cd7a0a47f
4df17daecb32fd5ec6ae6a76ba6c9f5e58702203
/09-29/Cadena de Responsabilidad/CoR_java/LiderTeamEjecutivo.java
24689acac0dfe1548e0026e27d61c9f868792752
[]
no_license
celinalopez/DisenoDeSistemas
3ea29db526105a4bd2db44c70c4db8680ce68f1e
273fa9f800479285cd0d3e2a3ebe0561bd7469de
refs/heads/main
2023-08-24T18:23:21.669060
2021-11-04T04:46:52
2021-11-04T04:46:52
409,076,707
0
0
null
null
null
null
UTF-8
Java
false
false
519
java
package CoR_java; public class LiderTeamEjecutivo implements IAprobador{ private IAprobador next; @Override public IAprobador getNext() { return next; } @Override public void solicitudPrestamo(int monto) { if (monto > 10000 && monto <= 50000){ System.out.println("Lo manejo yo, le lider"); } else { next.solicitudPrestamo(monto); } } @Override public void setNext(IAprobador aprobador) { next = aprobador; } }
[ "cea.lopez@alumno.um.edu.ar" ]
cea.lopez@alumno.um.edu.ar
593f130eaecc6c3c80774e065b4d365a88a58bfb
e865cec89cad56adf33db810b5fd7bafde6ba48f
/src/org/jetbrains/test/tracer/PrettyPrinter.java
f8712307753c1884d61fe7ed178bba952f28fab1
[]
no_license
LDVSOFT/selective-profiling-test
56176d115efc245912f11901bdda6972aaf55271
52fe2fd4937ca15aeecd75ad825dcde54a41b847
refs/heads/master
2020-12-30T13:47:24.482226
2017-05-14T21:15:08
2017-05-14T21:15:08
91,261,008
0
0
null
2017-05-14T17:45:39
2017-05-14T17:45:39
null
UTF-8
Java
false
false
1,232
java
package org.jetbrains.test.tracer; /** * Pretty printer of a tracer */ public class PrettyPrinter { private static final String OFFSET = ". . "; private int level = 1; private final Trace trace; /** * Create pretty printer * @param trace trace to print */ public PrettyPrinter(Trace trace) { this.trace = trace; } @Override public String toString() { StringBuffer buffer = new StringBuffer(); trace.getThreadTraces().forEach((threadName, threadTrace) -> { buffer.append(String.format("Thread %s:\n", threadName)); for (MethodTrace trace: threadTrace.getRoots()) { printTrace(buffer, trace); } }); return buffer.toString(); } private void printTrace(StringBuffer buffer, MethodTrace trace) { for (int i = 0; i < level; ++i) buffer.append(OFFSET); buffer.append(String.format( "%s(%s)\n", trace.getName(), String.join(", ", trace.getArguments()) )); ++level; for (MethodTrace child: trace.getChildren()) { printTrace(buffer, child); } --level; } }
[ "lapshin.dv@mail.ru" ]
lapshin.dv@mail.ru
79dfb50a2a223566aa1902b57e99b3ab38c1ee39
73c5f5a5545036967df0d5ddf2cbfaa97fbe49ed
/src/src/com/rapidminer/tools/math/optimization/ec/pso/PSOOptimization.java
0d654618cb202068055f13a878f0833e2ba16a39
[]
no_license
hejiming/rapiddataminer
74b103cb4523ccba47150045c165dc384cf7d38f
177e15fa67dee28b311f6d9176bbfeedae6672e2
refs/heads/master
2021-01-10T11:35:48.036839
2015-12-31T12:29:43
2015-12-31T12:29:43
48,233,639
0
0
null
null
null
null
UTF-8
Java
false
false
6,907
java
/* * RapidMiner * * Copyright (C) 2001-2008 by Rapid-I and the contributors * * Complete list of developers available at our web site: * * http://rapid-i.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see http://www.gnu.org/licenses/. */ package com.rapidminer.tools.math.optimization.ec.pso; import com.rapidminer.operator.OperatorException; import com.rapidminer.operator.performance.PerformanceVector; import com.rapidminer.tools.RandomGenerator; import com.rapidminer.tools.math.optimization.Optimization; /** * This class performs the optimization of a value vector with a particle swarm * approach. * * @author Ingo Mierswa * @version $Id: PSOOptimization.java,v 1.3 2008/05/09 19:23:19 ingomierswa Exp $ */ public abstract class PSOOptimization implements Optimization { private int maxGen; private int maxWithoutImprovement; private double inertiaWeight; private double localWeight; private double globalWeight; private double minValue; private double maxValue; private double inertiaWeightDelta; private RandomGenerator random; private Population population; /** Creates a new PSO optimization with the given parameters. */ public PSOOptimization(int popSize, int individualSize, int maxGen, int maxWithoutImprovement, double inertiaWeight, double localWeight, double globalWeight, double minValue, double maxValue, boolean dynamicInertiaWeight, RandomGenerator random) { this.maxGen = maxGen; this.maxWithoutImprovement = maxWithoutImprovement; if (this.maxWithoutImprovement < 1) this.maxWithoutImprovement = this.maxGen; this.inertiaWeight = inertiaWeight; this.localWeight = localWeight; this.globalWeight = globalWeight; this.minValue = minValue; this.maxValue = maxValue; this.inertiaWeightDelta = 0.0d; if (dynamicInertiaWeight) { inertiaWeightDelta = inertiaWeight / maxGen; } this.random = random; this.population = createInitialPopulation(popSize, individualSize); } /** * Subclasses must implement this method to calculate the fitness of the * given individual. Please note that null might be returned for non-valid * individuals. */ public abstract PerformanceVector evaluateIndividual(double[] individual) throws OperatorException; /** * This method is invoked after each evaluation. The default implementation * does nothing but subclasses might implement this method to support online * plotting or logging. */ public void nextIteration() throws OperatorException {} public void setMinValue(double minValue) { this.minValue = minValue; } public void setMaxValue(double maxValue) { this.maxValue = maxValue; } /** Creates the initial population. */ protected Population createInitialPopulation(int popSize, int individualSize) { Population initPop = new Population(popSize, individualSize); for (int i = 0; i < popSize; i++) { double[] values = new double[individualSize]; for (int j = 0; j < values.length; j++) { values[j] = random.nextDoubleInRange(minValue, maxValue); } initPop.setValues(i, values); } return initPop; } /** Invoke this method for optimization. */ public void optimize() throws OperatorException { // velocities double[][] velocities = new double[population.getNumberOfIndividuals()][population.getIndividualSize()]; for (int p = 0; p < velocities.length; p++) { for (int a = 0; a < velocities[p].length; a++) { velocities[p][a] = 0.0d; } } evaluate(population); population.nextGeneration(); nextIteration(); while (!((population.getGeneration() >= maxGen) || (population.getGenerationsWithoutImprovement() >= maxWithoutImprovement) || (population.getBestFitnessEver() >= population.getBestPerformanceEver().getMainCriterion().getMaxFitness()))) { // update velocities double[] globalBest = population.getGlobalBestValues(); for (int i = 0; i < velocities.length; i++) { double[] localBest = population.getLocalBestValues(i); double[] current = population.getValues(i); for (int d = 0; d < velocities[i].length; d++) { velocities[i][d] = inertiaWeight * velocities[i][d] + localWeight * (random.nextGaussian() + 1.0d) * (localBest[d] - current[d]) + globalWeight * (random.nextGaussian() + 1.0d) * (globalBest[d] - current[d]); } } // update positions for (int i = 0; i < velocities.length; i++) { double[] current = population.getValues(i); double[] newValues = new double[current.length]; for (int d = 0; d < velocities[i].length; d++) { newValues[d] = current[d] + velocities[i][d]; if (newValues[d] < minValue) newValues[d] = minValue; if (newValues[d] > maxValue) newValues[d] = maxValue; } population.setValues(i, newValues); } inertiaWeight -= inertiaWeightDelta; evaluate(population); population.nextGeneration(); nextIteration(); } } /** * Calculates the fitness for all individuals and gives the fitness values * to the population. */ private void evaluate(Population population) throws OperatorException { PerformanceVector[] fitnessValues = new PerformanceVector[population.getNumberOfIndividuals()]; for (int i = 0; i < fitnessValues.length; i++) { double[] individual = population.getValues(i); fitnessValues[i] = evaluateIndividual(individual); } population.setFitnessVector(fitnessValues); } /** Returns the current generation. */ public int getGeneration() { return population.getGeneration(); } /** Returns the best fitness in the current generation. */ public double getBestFitnessInGeneration() { return population.getBestFitnessInGeneration(); } /** Returns the best fitness ever. */ public double getBestFitnessEver() { return population.getBestFitnessEver(); } /** Returns the best performance vector ever. */ public PerformanceVector getBestPerformanceEver() { return population.getBestPerformanceEver(); } /** * Returns the best values ever. Use this method after optimization to get * the best result. */ public double[] getBestValuesEver() { return population.getGlobalBestValues(); } }
[ "dao.xiang.cun@163.com" ]
dao.xiang.cun@163.com
3716007d1814ba7ba7e2c9af8725130f64aec5ad
18b87702445bf74a9de1ea1dd4ad0ed3096ddb67
/app/src/main/java/com/denimprive/fabricrelaxation/MainActivity.java
b9fc41491031582af50b776b8f2cf3fad0919cd8
[]
no_license
abdulrehmanrfqt/Fabric-Relaxation
f4e8e50b310174c10d347852f248d6f1b0d4fe8b
e1d0f2b395aa0ef50ba479ef9b680645593f1cb2
refs/heads/master
2022-12-29T03:14:18.221791
2020-10-12T05:47:14
2020-10-12T05:47:14
303,289,821
0
0
null
null
null
null
UTF-8
Java
false
false
9,988
java
package com.denimprive.fabricrelaxation; import androidx.appcompat.app.AppCompatActivity; import android.IntentIntegrator; import android.IntentResult; import android.app.DatePickerDialog; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; import android.view.Gravity; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.EditText; import android.widget.ListView; import android.widget.ProgressBar; import android.widget.SimpleAdapter; import android.widget.TextView; 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.StringRequest; import com.android.volley.toolbox.Volley; import com.sdsmdg.tastytoast.TastyToast; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.HashMap; import java.util.List; import java.util.Map; public class MainActivity extends AppCompatActivity implements View.OnClickListener { ConnectionClass connectionClass; EditText edtcode; ProgressBar pbbar; ListView barcodeListView; DatePickerDialog datePickerDialog; public String barcodeId; public String Date; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_main); connectionClass = new ConnectionClass(); edtcode = findViewById(R.id.edtcode); pbbar = findViewById(R.id.pbbar); pbbar.setVisibility(View.GONE); barcodeListView = findViewById(R.id.barcodeListView); String st = getIntent().getStringExtra("Value"); // GETTING CURRENT DATE // Calendar c = Calendar.getInstance(); System.out.println("Current time => " + c.getTime()); SimpleDateFormat df = new SimpleDateFormat("dd-MMMM-yyyy"); // String formattedDate = df.format(c.getTime()); Date = df.format(c.getTime()); // formattedDate have current date/time TastyToast.makeText(getApplicationContext(), Date, TastyToast.LENGTH_LONG, TastyToast.DEFAULT); // Date = formattedDate; // Date.setTextSize(20); // Now we display formattedDate value in TextView // TextView txtView = new TextView(this); // txtView.setText(formattedDate); // txtView.setGravity(Gravity.CENTER); // txtView.setTextSize(20); // setContentView(txtView); edtcode.setOnClickListener(this); getAddedBarcodes(); } //OPEN SCANNER// public void onClick(View v) { if (v.getId() == R.id.edtcode) { IntentIntegrator scanIntegrator = new IntentIntegrator(this); scanIntegrator.initiateScan(); } } public void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); IntentResult scanningResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent); if (scanningResult != null) { barcodeId = scanningResult.getContents(); TastyToast.makeText(getApplicationContext(), "Barcode Scanned!", TastyToast.LENGTH_LONG, TastyToast.SUCCESS); if (barcodeId != null) { MasterPostRequest(); try { Thread.sleep(200); } catch (InterruptedException e) { e.printStackTrace(); } getAddedBarcodes(); } else { TastyToast.makeText(getApplicationContext(), "No scan data received!", TastyToast.LENGTH_LONG, TastyToast.CONFUSING); } try { Thread.sleep(200); } catch (InterruptedException e) { e.printStackTrace(); } barcodeId = ""; } else { TastyToast.makeText(getApplicationContext(), "No scan data received!", TastyToast.LENGTH_LONG, TastyToast.CONFUSING); } } // MASTER POST METHOD// public void MasterPostRequest() { // final String date = DenimPrive.getText().toString().trim(); final String userId = getIntent().getStringExtra("Value"); //validations if (TextUtils.isEmpty(barcodeId)) { TastyToast.makeText(getApplicationContext(), "Please Scan Barcode", TastyToast.LENGTH_LONG, TastyToast.ERROR); // edtcode.setError("Please Scan Barcode"); // edtcode.requestFocus(); return; } RequestQueue requestQueue = Volley.newRequestQueue(MainActivity.this); String url = "http://58.27.255.29:90/api/FabricRelaxation/FabricRelaxationAdd"; final StringRequest stringRequest = new StringRequest(Request.Method.POST, url, new Response.Listener<String>() { @Override public void onResponse(String response) { // //parse json data // try { // JSONObject jsonObject = new JSONObject(response); // edtcode.append(jsonObject.getString("MasterID")+"\n"); // } // catch (Exception e){ // e.printStackTrace(); //// post_response_text.setText("POST DATA : unable to Parse Json"); // Toast toast = Toast.makeText(getApplicationContext(), // "Unable to Parse Json", Toast.LENGTH_SHORT); // toast.show(); // } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { // post_response_text.setText("Post Data : Response Failed"); TastyToast.makeText(getApplicationContext(), "Response failed!", TastyToast.LENGTH_LONG, TastyToast.ERROR); } }) { @Override protected Map<String, String> getParams() { Map<String, String> params = new HashMap<String, String>(); params.put("FabricRelaxationBarcode_ReceivingRoll_Id_Fk", barcodeId); params.put("FabricRelaxationBarcode_Date", Date); params.put("FabricRelaxationBarcode_CreatedBy", userId); return params; } @Override public Map<String, String> getHeaders() throws AuthFailureError { Map<String, String> params = new HashMap<String, String>(); params.put("Content-Type", "application/x-www-form-urlencoded"); return params; } }; requestQueue.add(stringRequest); } public void getAddedBarcodes() { String z = ""; List<Map<String, String>> addeddefectslist = new ArrayList<Map<String, String>>(); try { Connection con = connectionClass.CONN(); if (con == null) { z = "Error in connection with SQL server"; } else { String query = "EXEC USP_FabricRelaxationBarcode_Get"; PreparedStatement ps = con.prepareStatement(query); ResultSet rs = ps.executeQuery(); ArrayList data1 = new ArrayList(); while (rs.next()) { Map<String, String> datanum = new HashMap<String, String>(); datanum.put("A", rs.getString("Fabric_FabricCode")); datanum.put("B", rs.getString("FabricReceivingDetail_QtyInMeters")); datanum.put("C", rs.getString("FabricReceivingDetail_RollNo")); datanum.put("D", rs.getString("FabricRelaxationBarcode_CreatedDate")); addeddefectslist.add(datanum); } z = "Success"; } } catch (Exception ex) { z = "Error retrieving data from table"; } final String[] from = {"A", "B", "C", "D"}; int[] views = {R.id.lblFabricCode, R.id.lblQtyInMeters, R.id.lblRollNo, R.id.lblDate}; final SimpleAdapter ADA = new SimpleAdapter(MainActivity.this, addeddefectslist, R.layout.barcode_detail_list_template, from, views); barcodeListView.setAdapter(ADA); } public void showSuccessToast(View view) { TastyToast.makeText(getApplicationContext(), "Download Successful !", TastyToast.LENGTH_LONG, TastyToast.SUCCESS); } public void showWarningToast(View view) { TastyToast.makeText(getApplicationContext(), "Are you sure ?", TastyToast.LENGTH_LONG, TastyToast.WARNING); } public void showErrorToast(View view) { TastyToast.makeText(getApplicationContext(), "Downloading failed ! Try again later ", TastyToast.LENGTH_LONG, TastyToast.ERROR); } public void showInfoToast(View view) { TastyToast.makeText(getApplicationContext(), "Searching for username : 'Rahul' ", TastyToast.LENGTH_LONG, TastyToast.INFO); } public void showDefaultToast(View view) { TastyToast.makeText(getApplicationContext(), "This is Default Toast", TastyToast.LENGTH_LONG, TastyToast.DEFAULT); } public void showConfusingToast(View view) { TastyToast.makeText(getApplicationContext(), "I don't Know !", TastyToast.LENGTH_LONG, TastyToast.CONFUSING); } }
[ "abdul.rehman8194@gmail.com" ]
abdul.rehman8194@gmail.com
bf64ec72dcc554f89d74412348fbe1d1e074b8bb
cca87c4ade972a682c9bf0663ffdf21232c9b857
/com/tencent/mm/plugin/fps_lighter/b/a.java
f21824995253d8ec39ed0633a32c5c9f217c4954
[]
no_license
ZoranLi/wechat_reversing
b246d43f7c2d7beb00a339e2f825fcb127e0d1a1
36b10ef49d2c75d69e3c8fdd5b1ea3baa2bba49a
refs/heads/master
2021-07-05T01:17:20.533427
2017-09-25T09:07:33
2017-09-25T09:07:33
104,726,592
12
1
null
null
null
null
UTF-8
Java
false
false
4,722
java
package com.tencent.mm.plugin.fps_lighter.b; import android.app.Activity; import android.app.Application; import android.app.Application.ActivityLifecycleCallbacks; import android.os.Bundle; import android.os.Handler; import android.os.Looper; import com.tencent.mm.sdk.platformtools.w; import java.util.ArrayList; import java.util.Iterator; class a implements ActivityLifecycleCallbacks { public boolean kNU; private Handler lPA = new Handler(Looper.getMainLooper()); public boolean lPx; private Activity lPy; private Runnable lPz; public ArrayList<a> mListeners = new ArrayList(); protected interface a { void A(Activity activity); void x(Activity activity); void y(Activity activity); void z(Activity activity); } a() { } public void c(Application application) { application.registerActivityLifecycleCallbacks(this); } public void d(Application application) { application.unregisterActivityLifecycleCallbacks(this); this.mListeners.clear(); } public void onActivityResumed(final Activity activity) { this.lPx = false; w.i("MicroMsg.BaseFrameBeatCore", "[onActivityResumed] foreground:%s", new Object[]{Boolean.valueOf(this.kNU)}); final boolean z = !this.kNU; this.kNU = true; if (activity != this.lPy) { Iterator it = this.mListeners.iterator(); while (it.hasNext()) { try { ((a) it.next()).A(activity); } catch (Exception e) { w.e("MicroMsg.BaseFrameBeatCore", "Listener threw exception!", new Object[]{e}); } } this.lPy = activity; } Handler handler = this.lPA; Runnable anonymousClass1 = new Runnable(this) { final /* synthetic */ a lPC; public final void run() { if (z) { w.i("MicroMsg.BaseFrameBeatCore", "went foreground"); Iterator it = this.lPC.mListeners.iterator(); while (it.hasNext()) { try { ((a) it.next()).x(activity); } catch (Exception e) { w.e("MicroMsg.BaseFrameBeatCore", "Listener threw exception!", new Object[]{e}); } } return; } w.i("MicroMsg.BaseFrameBeatCore", "still foreground"); } }; this.lPz = anonymousClass1; handler.postDelayed(anonymousClass1, 600); } public void onActivityPaused(final Activity activity) { w.i("MicroMsg.BaseFrameBeatCore", "[onActivityPaused] foreground:%s", new Object[]{Boolean.valueOf(this.kNU)}); this.lPx = true; if (this.lPz != null) { this.lPA.removeCallbacks(this.lPz); } Handler handler = this.lPA; Runnable anonymousClass2 = new Runnable(this) { final /* synthetic */ a lPC; public final void run() { if (this.lPC.kNU && this.lPC.lPx) { this.lPC.kNU = false; w.i("MicroMsg.BaseFrameBeatCore", "went background"); Iterator it = this.lPC.mListeners.iterator(); while (it.hasNext()) { try { ((a) it.next()).y(activity); } catch (Exception e) { w.e("MicroMsg.BaseFrameBeatCore", "Listener threw exception!", new Object[]{e}); } } return; } w.i("MicroMsg.BaseFrameBeatCore", "still foreground"); } }; this.lPz = anonymousClass2; handler.postDelayed(anonymousClass2, 600); } public void onActivityCreated(Activity activity, Bundle bundle) { w.i("MicroMsg.BaseFrameBeatCore", "Activity:%s", new Object[]{activity.getClass().getSimpleName()}); this.lPy = activity; Iterator it = this.mListeners.iterator(); while (it.hasNext()) { try { ((a) it.next()).z(activity); } catch (Exception e) { w.e("MicroMsg.BaseFrameBeatCore", "Listener threw exception!", new Object[]{e}); } } } public void onActivityStarted(Activity activity) { } public void onActivityStopped(Activity activity) { } public void onActivitySaveInstanceState(Activity activity, Bundle bundle) { } public void onActivityDestroyed(Activity activity) { } }
[ "lizhangliao@xiaohongchun.com" ]
lizhangliao@xiaohongchun.com
18d59b45e7f6a2b816681d1bb73304748284d1a2
f039113a31256ec26cc6a347debd59c753f936c2
/servlet/java-configuration/data/src/main/java/example/Message.java
62f83f28b55eddff31d8fc215b3c87b36c011436
[]
no_license
lzqjsk/spring-security-samples
3a41002f01dbbf97a1c44463bf290a335f60fd72
ca32d8e45dc48edcedf1cecf6e70e43022acd4dd
refs/heads/main
2023-09-04T16:34:23.742215
2021-11-10T17:20:09
2021-11-10T17:20:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,782
java
/* * Copyright 2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://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 example; import java.util.Calendar; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToOne; import javax.validation.constraints.NotEmpty; @Entity public class Message { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @NotEmpty(message = "Message is required.") private String text; @NotEmpty(message = "Summary is required.") private String summary; private Calendar created = Calendar.getInstance(); @OneToOne private User to; public User getTo() { return this.to; } public void setTo(User to) { this.to = to; } public Long getId() { return this.id; } public void setId(Long id) { this.id = id; } public Calendar getCreated() { return this.created; } public void setCreated(Calendar created) { this.created = created; } public String getText() { return this.text; } public void setText(String text) { this.text = text; } public String getSummary() { return this.summary; } public void setSummary(String summary) { this.summary = summary; } }
[ "rwinch@users.noreply.github.com" ]
rwinch@users.noreply.github.com
fd2f9cb1b5235f191bdb5e38e32c0cc7b7f3feaf
f6d691c6308372e7507a85851a1ea701ac6ca20d
/g_text/src/com/lujianfei/active/VideoprojActivity.java
026391c320ee99732cf3085f448254eba269443c
[]
no_license
starlessnight/test
c2a5ef6b15cca5a997d58cf4ed8f8d4a05769725
ead6f37656a5ab3b3efde5aca12eaa929f52c571
refs/heads/master
2021-01-10T03:42:58.802961
2015-11-23T15:28:09
2015-11-23T15:28:09
46,724,284
0
0
null
null
null
null
UTF-8
Java
false
false
2,159
java
package com.lujianfei.active; import java.util.ArrayList; import java.util.HashMap; import android.app.Activity; import android.graphics.Bitmap; import android.os.Bundle; import android.view.View; import android.widget.GridView; import android.widget.ImageView; import android.widget.SimpleAdapter; import android.widget.SimpleAdapter.ViewBinder; public class VideoprojActivity extends Activity { String [] a={"1123","2123","2","3"}; String [] b={"sadasd","2123","dewrwe","3"}; String [] c={"1sssssss","2123","2","jhkhjkh"}; String [] d={"1ssdasdasd","asdasd","333333","3"}; GridView gridview = null; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.videoproj_gridview_layout); gridview = (GridView) findViewById(R.id.gridview); ArrayList<HashMap<String,Object>> list=new ArrayList<HashMap<String,Object>>(); HashMap<String,Object> map=null; for(int i=0;i<4;i++) { map=new HashMap<String,Object>(); map.put("store",a[i]); map.put("pn",b[i]); map.put("pc",a[i]); map.put("pp",a[i]); list.add(map); } SimpleAdapter adapter = new SimpleAdapter(this,list,R.layout.videoproj_gridview_item_layout,new String[]{"store","pn","pc","pp"},new int[]{R.id.store_name,R.id.product_name,R.id.product_quantity,R.id.quantity}); adapter.setViewBinder(new ViewBinder(){ public boolean setViewValue(View view, Object data, String textRepresentation) { //判断是否为我们要处理的对象 if(view instanceof ImageView && data instanceof Bitmap){ ImageView iv = (ImageView) view; iv.setImageBitmap((Bitmap) data); return true; }else return false; } }); gridview.setAdapter(adapter); } }
[ "j1122334k@gmail.com" ]
j1122334k@gmail.com
f46b2174459cef9d9634c21c898f222a5fd9c104
465df43c3c0d90f7c166e842321cd14ce5516c29
/src/Ventana.java
e1166049a2772725ac7bd859ef3d24227c5d6b79
[]
no_license
Sayra/Memorama
9b0f315dc5a2363ff9afe3adacf6ee0c904694a8
cfb319add2106e74cee0678fa308c9e1a01174f7
refs/heads/master
2016-09-05T13:08:01.605755
2013-03-23T05:38:42
2013-03-23T05:38:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
389
java
import java.awt.event.MouseListener; import javax.swing.JFrame; public class Ventana extends JFrame { public Ventana(){ this.setSize(800,700); this.setTitle("JUEGO MEMORAMA"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //this.setVisible(true); this.setLocationRelativeTo(null); //this.setResizable(false); } }
[ "Valery@Valery-PC" ]
Valery@Valery-PC
6df45f78ea6c7b50091f6e34cd4bebd182b0a0de
ca389477926d084033d35255cc1bf4fb5ce1b48f
/ConsultantHourTracker/src/main/java/com/peeterst/android/ConsultantHourTrackerMain.java
800a8319ac42d5c7d2a03b00505bdeb1bbc1e339
[]
no_license
fhomasp/HomeTools
7327de3f2850a0e975e2490feb9f47dd2cec965c
61e26c3953912987a38c87199865b214cee1913a
refs/heads/master
2021-01-11T19:20:30.465043
2017-01-20T08:57:31
2017-01-20T08:57:31
79,358,852
0
0
null
null
null
null
UTF-8
Java
false
false
5,080
java
package com.peeterst.android; import android.app.ListActivity; import android.os.Bundle; import android.text.Spannable; import android.text.style.ForegroundColorSpan; import android.text.style.StyleSpan; import android.util.Log; import com.peeterst.android.adapter.ClientListAdapter; import com.peeterst.android.data.adapter.SQLiteAdapter; import com.peeterst.android.hourtracker.R; import com.peeterst.android.model.Client; import net.sf.javaocr.demos.android.utils.image.ImageProcessor; import net.sf.javaocr.demos.android.utils.image.IntegralImageSlicer; import net.sf.javaocr.demos.android.utils.image.SauvolaImageProcessor; import net.sourceforge.javaocr.Image; import net.sourceforge.javaocr.cluster.FeatureExtractor; import net.sourceforge.javaocr.matcher.FreeSpacesMatcher; import net.sourceforge.javaocr.matcher.Match; import net.sourceforge.javaocr.matcher.MatcherUtil; import net.sourceforge.javaocr.matcher.MetricMatcher; import net.sourceforge.javaocr.ocr.PixelImage; import net.sourceforge.javaocr.plugin.cluster.extractor.FreeSpacesExtractor; import net.sourceforge.javaocr.plugin.moment.HuMoments; import java.io.*; import java.util.List; /** * Created with IntelliJ IDEA. * User: Thomas * Date: 10/06/12 * Time: 23:36 * Main activity */ public class ConsultantHourTrackerMain extends ListActivity { private SQLiteAdapter<Client> clientSQLiteAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); clientSQLiteAdapter = new SQLiteAdapter<Client>(this,Client.class); addTestClients(); List<Client> activeClients = clientSQLiteAdapter.findBySelection("Active = 1"); ClientListAdapter listAdapter = new ClientListAdapter(this,R.layout.clientrow,activeClients); setListAdapter(listAdapter); //TODO: testing possible functionality that's supposed to be elsewhere InputStream in = getClass().getResourceAsStream("/2012-05-31 14.23.25r.jpg"); byte[] buf = new byte[1024]; ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { for (int readNum; (readNum = in.read(buf)) != -1;) { baos.write(buf, 0, readNum); //no doubt here is 0 /*Writes len bytes from the specified byte array starting at offset off to this byte array output stream.*/ // System.out.println("read " + readNum + " bytes,"); } } catch (IOException ex) { throw new RuntimeException(ex); } byte[] imageFrame = baos.toByteArray(); ImageProcessor imageProcessor = new SauvolaImageProcessor(1024,768,30,20,15,15); //?? IntegralImageSlicer slicer = new IntegralImageSlicer(new PixelImage(1024,768)); //2560,1920 PixelImage pixelImage = imageProcessor.prepareImage(imageFrame,1024,768); // TODO: ?? List<List<Image>> glyphs = slicer.sliceUp(pixelImage); FeatureExtractor extractor = new HuMoments(); FreeSpacesExtractor freeSpaceExtractor = new FreeSpacesExtractor(); MetricMatcher metricMatcher = new MetricMatcher(); FreeSpacesMatcher freeSpacesMatcher = new FreeSpacesMatcher(); for(List<Image> row:glyphs){ if(row != null && row.size() > 0){ StringBuilder sb = new StringBuilder(); for(Image glyph:row){ if(glyph != null){ final double[] features = extractor.extract(glyph); final double[] freeSpaces = freeSpaceExtractor.extract(glyph); // cluster mathcer List<Match> matches = metricMatcher.classify(features); // perform matching of free spaces List<Match> freeSpaceMatches = freeSpacesMatcher.classify(freeSpaces); // ... and bayes it List<Match> mergedMatches = MatcherUtil.merge(matches, freeSpaceMatches); if (!mergedMatches.isEmpty()) { for(Match match:mergedMatches){ Character character = match.getChr(); sb.append(character); sb.append(" "); } } else { System.err.println(".. Empty match .."); } } } System.err.println(sb.toString()); } } } private void addTestClients(){ for(int i = 0; i < 3; i++ ){ Client client = new Client(); client.setName("client "+i); client.setActive(true); clientSQLiteAdapter.insert(client); } Client nonActive = new Client(); nonActive.setName("inactive"); nonActive.setActive(false); clientSQLiteAdapter.insert(nonActive); } }
[ "thomas.peeters1@telenet.be" ]
thomas.peeters1@telenet.be
ca2b76294ff2bdf50323d6eef45978a497d5252b
9163e2c649dea98cf2572b2b977bc1c3a4603ff9
/app/src/main/java/com/map/mymap/route/BusSegmentListAdapter.java
2b57763e3fca1b6666a069fc2b41e006dc76e61d
[]
no_license
Wenfeng12138/MyMap
e10917bd8db8a5d194277eea62440423b09c2eaa
7d723d2b34e862a414f1f590944508dcccac77be
refs/heads/master
2022-09-15T17:33:28.812177
2020-05-23T04:59:05
2020-05-23T04:59:05
262,320,998
0
0
null
null
null
null
UTF-8
Java
false
false
8,873
java
package com.map.mymap.route; import java.util.ArrayList; import java.util.List; import android.content.Context; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import com.amap.api.services.busline.BusStationItem; import com.amap.api.services.route.BusStep; import com.amap.api.services.route.RailwayStationItem; import com.map.mymap.R; public class BusSegmentListAdapter extends BaseAdapter { private Context mContext; private List<SchemeBusStep> mBusStepList = new ArrayList<SchemeBusStep>(); public BusSegmentListAdapter(Context context, List<BusStep> list) { this.mContext = context; SchemeBusStep start = new SchemeBusStep(null); start.setStart(true); mBusStepList.add(start); for (BusStep busStep : list) { if (busStep.getWalk() != null && busStep.getWalk().getDistance() > 0) { SchemeBusStep walk = new SchemeBusStep(busStep); walk.setWalk(true); mBusStepList.add(walk); } if (busStep.getBusLine() != null) { SchemeBusStep bus = new SchemeBusStep(busStep); bus.setBus(true); mBusStepList.add(bus); } if (busStep.getRailway() != null) { SchemeBusStep railway = new SchemeBusStep(busStep); railway.setRailway(true); mBusStepList.add(railway); } if (busStep.getTaxi() != null) { SchemeBusStep taxi = new SchemeBusStep(busStep); taxi.setTaxi(true); mBusStepList.add(taxi); } } SchemeBusStep end = new SchemeBusStep(null); end.setEnd(true); mBusStepList.add(end); } @Override public int getCount() { return mBusStepList.size(); } @Override public Object getItem(int position) { return mBusStepList.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; if (convertView == null) { holder = new ViewHolder(); convertView = View.inflate(mContext, R.layout.item_bus_segment, null); holder.parent = (RelativeLayout) convertView .findViewById(R.id.bus_item); holder.busLineName = (TextView) convertView .findViewById(R.id.bus_line_name); holder.busDirIcon = (ImageView) convertView .findViewById(R.id.bus_dir_icon); holder.busStationNum = (TextView) convertView .findViewById(R.id.bus_station_num); holder.busExpandImage = (ImageView) convertView .findViewById(R.id.bus_expand_image); holder.busDirUp = (ImageView) convertView .findViewById(R.id.bus_dir_icon_up); holder.busDirDown = (ImageView) convertView .findViewById(R.id.bus_dir_icon_down); holder.splitLine = (ImageView) convertView .findViewById(R.id.bus_seg_split_line); holder.expandContent = (LinearLayout) convertView .findViewById(R.id.expand_content); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } final SchemeBusStep item = mBusStepList.get(position); if (position == 0) { holder.busDirIcon.setImageResource(R.drawable.dir_start); holder.busLineName.setText("出发"); holder.busDirUp.setVisibility(View.INVISIBLE); holder.busDirDown.setVisibility(View.VISIBLE); holder.splitLine.setVisibility(View.GONE); holder.busStationNum.setVisibility(View.GONE); holder.busExpandImage.setVisibility(View.GONE); return convertView; } else if (position == mBusStepList.size() - 1) { holder.busDirIcon.setImageResource(R.drawable.dir_end); holder.busLineName.setText("到达终点"); holder.busDirUp.setVisibility(View.VISIBLE); holder.busDirDown.setVisibility(View.INVISIBLE); holder.busStationNum.setVisibility(View.INVISIBLE); holder.busExpandImage.setVisibility(View.INVISIBLE); return convertView; } else { if (item.isWalk() && item.getWalk() != null && item.getWalk().getDistance() > 0) { holder.busDirIcon.setImageResource(R.drawable.dir13); holder.busDirUp.setVisibility(View.VISIBLE); holder.busDirDown.setVisibility(View.VISIBLE); holder.busLineName.setText("步行" + (int) item.getWalk().getDistance() + "米"); holder.busStationNum.setVisibility(View.GONE); holder.busExpandImage.setVisibility(View.GONE); return convertView; }else if (item.isBus() && item.getBusLines().size() > 0) { holder.busDirIcon.setImageResource(R.drawable.dir14); holder.busDirUp.setVisibility(View.VISIBLE); holder.busDirDown.setVisibility(View.VISIBLE); holder.busLineName.setText(item.getBusLines().get(0).getBusLineName()); holder.busStationNum.setVisibility(View.VISIBLE); holder.busStationNum .setText((item.getBusLines().get(0).getPassStationNum() + 1) + "站"); holder.busExpandImage.setVisibility(View.VISIBLE); ArrowClick arrowClick = new ArrowClick(holder, item); holder.parent.setTag(position); holder.parent.setOnClickListener(arrowClick); return convertView; } else if (item.isRailway() && item.getRailway() != null) { holder.busDirIcon.setImageResource(R.drawable.dir16); holder.busDirUp.setVisibility(View.VISIBLE); holder.busDirDown.setVisibility(View.VISIBLE); holder.busLineName.setText(item.getRailway().getName()); holder.busStationNum.setVisibility(View.VISIBLE); holder.busStationNum .setText((item.getRailway().getViastops().size() + 1) + "站"); holder.busExpandImage.setVisibility(View.VISIBLE); ArrowClick arrowClick = new ArrowClick(holder, item); holder.parent.setTag(position); holder.parent.setOnClickListener(arrowClick); return convertView; } else if (item.isTaxi() && item.getTaxi() != null) { holder.busDirIcon.setImageResource(R.drawable.dir14); holder.busDirUp.setVisibility(View.VISIBLE); holder.busDirDown.setVisibility(View.VISIBLE); holder.busLineName.setText("打车到终点"); holder.busStationNum.setVisibility(View.GONE); holder.busExpandImage.setVisibility(View.GONE); return convertView; } } return convertView; } private class ViewHolder { public RelativeLayout parent; TextView busLineName; ImageView busDirIcon; TextView busStationNum; ImageView busExpandImage; ImageView busDirUp; ImageView busDirDown; ImageView splitLine; LinearLayout expandContent; boolean arrowExpend = false; } private class ArrowClick implements OnClickListener { private ViewHolder mHolder; private SchemeBusStep mItem; public ArrowClick(final ViewHolder holder, final SchemeBusStep item) { mHolder = holder; mItem = item; } @Override public void onClick(View v) { // TODO Auto-generated method stub int position = Integer.parseInt(String.valueOf(v.getTag())); mItem = mBusStepList.get(position); if (mItem.isBus()) { if (mHolder.arrowExpend == false) { mHolder.arrowExpend = true; mHolder.busExpandImage .setImageResource(R.drawable.up); addBusStation(mItem.getBusLine().getDepartureBusStation()); for (BusStationItem station : mItem.getBusLine() .getPassStations()) { addBusStation(station); } addBusStation(mItem.getBusLine().getArrivalBusStation()); } else { mHolder.arrowExpend = false; mHolder.busExpandImage .setImageResource(R.drawable.down); mHolder.expandContent.removeAllViews(); } } else if (mItem.isRailway()) { if (mHolder.arrowExpend == false) { mHolder.arrowExpend = true; mHolder.busExpandImage .setImageResource(R.drawable.up); addRailwayStation(mItem.getRailway().getDeparturestop()); for (RailwayStationItem station : mItem.getRailway().getViastops()) { addRailwayStation(station); } addRailwayStation(mItem.getRailway().getArrivalstop()); } else { mHolder.arrowExpend = false; mHolder.busExpandImage .setImageResource(R.drawable.down); mHolder.expandContent.removeAllViews(); } } } private void addBusStation(BusStationItem station) { LinearLayout ll = (LinearLayout) View.inflate(mContext, R.layout.item_bus_segment_ex, null); TextView tv = (TextView) ll .findViewById(R.id.bus_line_station_name); tv.setText(station.getBusStationName()); mHolder.expandContent.addView(ll); } private void addRailwayStation(RailwayStationItem station) { LinearLayout ll = (LinearLayout) View.inflate(mContext, R.layout.item_bus_segment_ex, null); TextView tv = (TextView) ll .findViewById(R.id.bus_line_station_name); tv.setText(station.getName()+ " "+getRailwayTime(station.getTime())); mHolder.expandContent.addView(ll); } } public static String getRailwayTime(String time) { return time.substring(0, 2) + ":" + time.substring(2, time.length()); } }
[ "1229308644@qq.com" ]
1229308644@qq.com
44159cccd573c7ff8fdfc490920b22039d7844dc
58a8ed34f613c281a5faaaefe5da1788f5739d17
/Application_code_source/eMybaby/sources/a/c/d/s/c/d.java
14c762c0b16c66c8c3bb42aadbbdafa4d0b611fd
[]
no_license
wagnerwave/Dossier_Hacking_de_peluche
01c78629e52a94ed6a208e11ff7fcd268e10956e
514f81b1e72d88e2b8835126b2151e368dcad7fb
refs/heads/main
2023-03-31T13:28:06.247243
2021-03-25T23:03:38
2021-03-25T23:03:38
351,597,654
5
1
null
null
null
null
UTF-8
Java
false
false
43
java
package a.c.d.s.c; public interface d { }
[ "alexandre1.wagner@epitech.eu" ]
alexandre1.wagner@epitech.eu
e32468aaa94cba8c223210d067f6ad67602be913
7a771ef22db8d9f3910c31610ef791b173d396e5
/src/servlet/irdersUnfiServlet.java
59c96a9c31ebdecb31612e2830ab940f5e85842b
[]
no_license
zhengduqiang/SeaDogBuyTicketSystem
fcb531ef6d87b02bed49069a124493d2e5bebdb0
aafd45189d3309230e0075d137ff28fffbca71b3
refs/heads/master
2022-04-09T17:14:09.773558
2020-03-26T13:44:57
2020-03-26T13:44:57
250,261,056
0
0
null
null
null
null
UTF-8
Java
false
false
3,626
java
package servlet; import entity.ordersinfo; import service.ordersInfoService; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; import java.util.List; /** * Created by asus on 2019/1/18. */ @WebServlet(name = "irdersUnfiServlet", value = "/irdersUnfiServlet") public class irdersUnfiServlet extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //设置字符编码 request.setCharacterEncoding("UTF-8"); response.setContentType("text/html;charset=UTF-8"); String info = request.getParameter("info"); if (info.equals("chaXunChePiaoXinXi")) { chaXunChePiaoXinXi(request, response); } else if (info.equals("tuiPiao")) { tuiPiao(request, response); } else if (info.equals("tuiPiaoJianPiao")) { tuiPiaoJianPiao(request, response); } } protected void chaXunChePiaoXinXi(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String name = request.getParameter("name"); String cch = request.getParameter("cch"); String fcrq = request.getParameter("fcrq"); ordersinfo info = new ordersinfo(); info.setName(name); info.setTrainNo(cch); info.setDepartDate(fcrq); ordersInfoService service = new ordersInfoService(); List<ordersinfo> list = service.chaXunChePiaoXinXi(info); request.setAttribute("info", list); request.getRequestDispatcher("dinDanLieBiao.jsp").forward(request, response); } protected void tuiPiao(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String name = request.getParameter("name"); String id = request.getParameter("id"); ordersInfoService service = new ordersInfoService(); int i = service.tuiPiao(name, id); if (i == 1) { String zw = request.getParameter("zw"); String cc = request.getParameter(("cc")); String zw2 = request.getParameter("zw"); ordersInfoService service2 = new ordersInfoService(); int i2 = service2.tuiPiaoJianPiao(zw,cc); PrintWriter write = response.getWriter(); if (i2 == 1) { write.print("<script type='text/javascript'>"); write.print("alert('退票成功,即将跳转到查询车票页面');"); write.print("window.location='chaXunLieBiao.jsp';"); write.print("</script>"); write.flush(); write.close(); } else { write.print("<script type='text/javascript'>"); write.print("alert('退票失败');"); write.print("window.location='dinDanLieBiao.jsp';"); write.print("</script>"); write.flush(); write.close(); } } else { request.getRequestDispatcher("login.jsp").forward(request, response); } } protected void tuiPiaoJianPiao(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } }
[ "2473674@qq.com" ]
2473674@qq.com
a7f268bfad5e727c7ea71b1406675244db44e6e1
e9affefd4e89b3c7e2064fee8833d7838c0e0abc
/aws-java-sdk-lakeformation/src/main/java/com/amazonaws/services/lakeformation/model/AddLFTagsToResourceRequest.java
55ca3a53d88cc3b41b2a3890c349df594ab98338
[ "Apache-2.0" ]
permissive
aws/aws-sdk-java
2c6199b12b47345b5d3c50e425dabba56e279190
bab987ab604575f41a76864f755f49386e3264b4
refs/heads/master
2023-08-29T10:49:07.379135
2023-08-28T21:05:55
2023-08-28T21:05:55
574,877
3,695
3,092
Apache-2.0
2023-09-13T23:35:28
2010-03-22T23:34:58
null
UTF-8
Java
false
false
9,199
java
/* * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.lakeformation.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.AmazonWebServiceRequest; /** * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/lakeformation-2017-03-31/AddLFTagsToResource" target="_top">AWS * API Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AddLFTagsToResourceRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable { /** * <p> * The identifier for the Data Catalog. By default, the account ID. The Data Catalog is the persistent metadata * store. It contains database definitions, table definitions, and other control information to manage your Lake * Formation environment. * </p> */ private String catalogId; /** * <p> * The database, table, or column resource to which to attach an LF-tag. * </p> */ private Resource resource; /** * <p> * The LF-tags to attach to the resource. * </p> */ private java.util.List<LFTagPair> lFTags; /** * <p> * The identifier for the Data Catalog. By default, the account ID. The Data Catalog is the persistent metadata * store. It contains database definitions, table definitions, and other control information to manage your Lake * Formation environment. * </p> * * @param catalogId * The identifier for the Data Catalog. By default, the account ID. The Data Catalog is the persistent * metadata store. It contains database definitions, table definitions, and other control information to * manage your Lake Formation environment. */ public void setCatalogId(String catalogId) { this.catalogId = catalogId; } /** * <p> * The identifier for the Data Catalog. By default, the account ID. The Data Catalog is the persistent metadata * store. It contains database definitions, table definitions, and other control information to manage your Lake * Formation environment. * </p> * * @return The identifier for the Data Catalog. By default, the account ID. The Data Catalog is the persistent * metadata store. It contains database definitions, table definitions, and other control information to * manage your Lake Formation environment. */ public String getCatalogId() { return this.catalogId; } /** * <p> * The identifier for the Data Catalog. By default, the account ID. The Data Catalog is the persistent metadata * store. It contains database definitions, table definitions, and other control information to manage your Lake * Formation environment. * </p> * * @param catalogId * The identifier for the Data Catalog. By default, the account ID. The Data Catalog is the persistent * metadata store. It contains database definitions, table definitions, and other control information to * manage your Lake Formation environment. * @return Returns a reference to this object so that method calls can be chained together. */ public AddLFTagsToResourceRequest withCatalogId(String catalogId) { setCatalogId(catalogId); return this; } /** * <p> * The database, table, or column resource to which to attach an LF-tag. * </p> * * @param resource * The database, table, or column resource to which to attach an LF-tag. */ public void setResource(Resource resource) { this.resource = resource; } /** * <p> * The database, table, or column resource to which to attach an LF-tag. * </p> * * @return The database, table, or column resource to which to attach an LF-tag. */ public Resource getResource() { return this.resource; } /** * <p> * The database, table, or column resource to which to attach an LF-tag. * </p> * * @param resource * The database, table, or column resource to which to attach an LF-tag. * @return Returns a reference to this object so that method calls can be chained together. */ public AddLFTagsToResourceRequest withResource(Resource resource) { setResource(resource); return this; } /** * <p> * The LF-tags to attach to the resource. * </p> * * @return The LF-tags to attach to the resource. */ public java.util.List<LFTagPair> getLFTags() { return lFTags; } /** * <p> * The LF-tags to attach to the resource. * </p> * * @param lFTags * The LF-tags to attach to the resource. */ public void setLFTags(java.util.Collection<LFTagPair> lFTags) { if (lFTags == null) { this.lFTags = null; return; } this.lFTags = new java.util.ArrayList<LFTagPair>(lFTags); } /** * <p> * The LF-tags to attach to the resource. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setLFTags(java.util.Collection)} or {@link #withLFTags(java.util.Collection)} if you want to override the * existing values. * </p> * * @param lFTags * The LF-tags to attach to the resource. * @return Returns a reference to this object so that method calls can be chained together. */ public AddLFTagsToResourceRequest withLFTags(LFTagPair... lFTags) { if (this.lFTags == null) { setLFTags(new java.util.ArrayList<LFTagPair>(lFTags.length)); } for (LFTagPair ele : lFTags) { this.lFTags.add(ele); } return this; } /** * <p> * The LF-tags to attach to the resource. * </p> * * @param lFTags * The LF-tags to attach to the resource. * @return Returns a reference to this object so that method calls can be chained together. */ public AddLFTagsToResourceRequest withLFTags(java.util.Collection<LFTagPair> lFTags) { setLFTags(lFTags); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getCatalogId() != null) sb.append("CatalogId: ").append(getCatalogId()).append(","); if (getResource() != null) sb.append("Resource: ").append(getResource()).append(","); if (getLFTags() != null) sb.append("LFTags: ").append(getLFTags()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof AddLFTagsToResourceRequest == false) return false; AddLFTagsToResourceRequest other = (AddLFTagsToResourceRequest) obj; if (other.getCatalogId() == null ^ this.getCatalogId() == null) return false; if (other.getCatalogId() != null && other.getCatalogId().equals(this.getCatalogId()) == false) return false; if (other.getResource() == null ^ this.getResource() == null) return false; if (other.getResource() != null && other.getResource().equals(this.getResource()) == false) return false; if (other.getLFTags() == null ^ this.getLFTags() == null) return false; if (other.getLFTags() != null && other.getLFTags().equals(this.getLFTags()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getCatalogId() == null) ? 0 : getCatalogId().hashCode()); hashCode = prime * hashCode + ((getResource() == null) ? 0 : getResource().hashCode()); hashCode = prime * hashCode + ((getLFTags() == null) ? 0 : getLFTags().hashCode()); return hashCode; } @Override public AddLFTagsToResourceRequest clone() { return (AddLFTagsToResourceRequest) super.clone(); } }
[ "" ]
f0bc105326a263af039b3668b6c653d3f3879544
7d80acf33c223991d44fdc5f75def97853901775
/src/main/java/PageObjects/Log.java
6aef4fa4c7c28d715c4fed174cb7bee8e3293234
[]
no_license
ankaiah123/maven
b023fa815aa5e1bf66dcdd04ea1db1fea8511fd6
021bf2810c44e7d30a9bc38c8d2dded0cc47dea5
refs/heads/master
2021-12-15T02:37:08.663240
2019-11-07T11:07:09
2019-11-07T11:07:09
219,955,373
0
0
null
2021-12-14T21:35:36
2019-11-06T09:08:22
HTML
UTF-8
Java
false
false
1,742
java
package PageObjects; import org.apache.log4j.Logger; public class Log { // Initialize Log4j logs private static Logger Log = Logger.getLogger(Log.class.getName());// // This is to print log for the beginning of the test case, as we usually run so many test cases as a test suite public static void startTestCase(String sTestCaseName){ Log.info("****************************************************************************************"); Log.info("****************************************************************************************"); Log.info("$$$$$$$$$$$$$$$$$$$$$ "+sTestCaseName+ " $$$$$$$$$$$$$$$$$$$$$$$$$"); Log.info("****************************************************************************************"); Log.info("****************************************************************************************"); } //This is to print log for the ending of the test case public static void endTestCase(String sTestCaseName){ Log.info("XXXXXXXXXXXXXXXXXXXXXXX "+"-E---N---D-"+" XXXXXXXXXXXXXXXXXXXXXX"); Log.info("X"); Log.info("X"); Log.info("X"); Log.info("X"); } // Need to create these methods, so that they can be called public static void info(String message) { Log.info(message); } public static void warn(String message) { Log.warn(message); } public static void error(String message) { Log.error(message); } public static void fatal(String message) { Log.fatal(message); } public static void debug(String message) { Log.debug(message); } }
[ "ASUS@DESKTOP-D6VBTLG" ]
ASUS@DESKTOP-D6VBTLG
598793b688ce583fc2a4d64df4b44bc5f9f8841d
e51909d8beef46f523ed572f9bcbce15862c9a9d
/springboot-appid-appsecret/src/main/java/com/abing/appidsecret/entity/AppEntity.java
f66449120df58cd7873a49a28cfccc6560883892
[]
no_license
liubing67/SpringBootDemo
a026decc8293e55cf8432e26b714f9e61c85375a
9454e706220e8d4db9838c7d0cbca93cc5929ddc
refs/heads/master
2023-07-23T10:42:15.895980
2020-01-02T09:36:41
2020-01-02T09:36:41
137,011,206
0
0
null
2023-07-17T00:14:26
2018-06-12T03:18:38
Java
UTF-8
Java
false
false
2,034
java
/** * 功能说明: * 功能作者: * 创建日期: * 版权归属:每特教育|蚂蚁课堂所有 www.itmayiedu.com */ package com.abing.appidsecret.entity; /** * 功能说明: <br> * 创建作者:每特教育-余胜军<br> * 创建时间:2018年7月18日 下午3:18:26<br> * 教育机构:每特教育|蚂蚁课堂<br> * 版权说明:上海每特教育科技有限公司版权所有<br> * 官方网站:www.itmayiedu.com|www.meitedu.com<br> * 联系方式:qq644064779<br> * 注意:本内容有每特教育学员共同研发,请尊重原创版权 */ public class AppEntity { private long id; private String appId; private String appName; private String appSecret; private String accessToken; private int isFlag; /** * @return the id */ public long getId() { return id; } /** * @param id * the id to set */ public void setId(long id) { this.id = id; } /** * @return the appId */ public String getAppId() { return appId; } /** * @param appId * the appId to set */ public void setAppId(String appId) { this.appId = appId; } /** * @return the appName */ public String getAppName() { return appName; } /** * @param appName * the appName to set */ public void setAppName(String appName) { this.appName = appName; } /** * @return the appSecret */ public String getAppSecret() { return appSecret; } /** * @param appSecret * the appSecret to set */ public void setAppSecret(String appSecret) { this.appSecret = appSecret; } /** * @return the isFlag */ public int getIsFlag() { return isFlag; } /** * @param isFlag * the isFlag to set */ public void setIsFlag(int isFlag) { this.isFlag = isFlag; } /** * @return the accessToken */ public String getAccessToken() { return accessToken; } /** * @param accessToken * the accessToken to set */ public void setAccessToken(String accessToken) { this.accessToken = accessToken; } }
[ "L10106235b" ]
L10106235b
c20603ce7f27de67e652f624d18107c0ef0c3b0b
c76691d9653eb7895b38889126184508df810dba
/APLesson_04/Lesson_04.java
a90a28e55878e8286e0cf5f38785f1cc62267162
[]
no_license
ohnomachadom1205/OHNO-MACHADO_MARCELO
5e934999b4d9f94208620fa10aa6e7e83156b080
664bb6aebdee044f31680891e1e3654547b4f2bf
refs/heads/master
2020-12-28T19:57:34.173059
2017-06-08T16:11:46
2017-06-08T16:11:51
67,522,957
0
0
null
null
null
null
UTF-8
Java
false
false
465
java
public class Lesson_04 { public static void main(String[]args) { Lesson_04 form = new Lesson_04(); System.out.printf("%6s %10.2f", "test", 4564.3453); String word1 = "blaaah"; double number1 = 444564.3456; form.format(word1, number1); String word2 = "yesssss"; double number2 = 567456.5678767; form.format(word2, number2); } public void format(String word, double number) { System.out.printf("\n%10s %10.2f", word, number); } }
[ "mohnomachado@gmail.com" ]
mohnomachado@gmail.com
f308aaa0764b26672811db454faaf990e3812e68
e5e9e3d065c8be0a3deb165fddb10ac63c069185
/src/com/controller/sys/AreaController.java
26ab49951576b7cb7c4142066ea865dd1c9a3a0a
[]
no_license
andyChenHuaYing/klmy-meeting-manager
899d91d0ecfb2fe13381c056cd6c73396343f4fe
4e307c1730e632854c6c88d99a84e4fd9a5cccd2
refs/heads/master
2021-01-23T02:54:06.759724
2015-03-25T14:49:22
2015-03-25T14:49:22
32,732,005
0
0
null
null
null
null
UTF-8
Java
false
false
40,427
java
package com.controller.sys; import java.sql.SQLException; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletResponse; import net.sf.json.JSONArray; import net.sf.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import com.service.AreaService; import com.util.ResponseUtil; import com.util.UserHolder; import com.vo.TConfigArea; import com.vo.TbBaseDepartment; /** * * @className: AreaController * @author: gu.xiaogang * @description: 地区相关功能控制器 * @date: 2014年9月10日 */ @Controller(value="areaController") @RequestMapping("/area.spr") public class AreaController { @Autowired @Qualifier("areaService") private AreaService areaServcie; /** * @Title: toAreaManage * @Description: 跳转到地区管理页面 * @param * @return String * @throws */ @RequestMapping(params="method=toAreaManage") public String toAreaManage(){ return "sys/areaManage"; } /** * @Title: queryAreaTree * @Description: 查询地区树 * @param * @return String * @throws */ @SuppressWarnings({ "unchecked", "rawtypes" }) @RequestMapping(params="method=queryAreaTree") public String queryAreaTree(HttpServletResponse response) throws SQLException{ ResponseUtil.formatResp(response,ResponseUtil.CONTENTTYPE_JSON, ResponseUtil.CHARENCODING_UTF8); Map map = new HashMap<String, String>(); map.put("recursion", true); List<TConfigArea> list = this.areaServcie.queryAreaByMap(map); JSONArray rtnArr = new JSONArray(); for(int i=0;i<list.size();i++){ TConfigArea tmpArea = list.get(i); if(tmpArea.getAreaLevel().intValue()==1){//areaLevel == 1 JSONObject obj = new JSONObject(); obj.put("id", tmpArea.getAreaId()); obj.put("name", tmpArea.getAreaName()); obj.put("children", new JSONArray()); rtnArr.add(obj); }else if(tmpArea.getAreaLevel().intValue()==2){ JSONObject obj = new JSONObject(); obj.put("id", tmpArea.getAreaId()); obj.put("name", tmpArea.getAreaName()); obj.put("children", new JSONArray()); ((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).add(obj); }else if(tmpArea.getAreaLevel().intValue()==3){ JSONObject obj = new JSONObject(); obj.put("id", tmpArea.getAreaId()); obj.put("name", tmpArea.getAreaName()); obj.put("children", new JSONArray()); JSONArray tmpJsonArr = ((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")); ((JSONArray)((JSONObject)(tmpJsonArr.get(tmpJsonArr.size()-1))).get("children")).add(obj); }else if(tmpArea.getAreaLevel().intValue()==4){ JSONObject obj = new JSONObject(); obj.put("id", tmpArea.getAreaId()); obj.put("name", tmpArea.getAreaName()); obj.put("children", new JSONArray()); JSONArray tmpJsonArr = ((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children"); ((JSONArray)((JSONObject)(tmpJsonArr.get(tmpJsonArr.size()-1))).get("children")).add(obj); }else if(tmpArea.getAreaLevel().intValue()==5){ JSONObject obj = new JSONObject(); obj.put("id", tmpArea.getAreaId()); obj.put("name", tmpArea.getAreaName()); obj.put("children", new JSONArray()); JSONArray tmpJsonArr = ((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children"); ((JSONArray)((JSONObject)(tmpJsonArr.get(tmpJsonArr.size()-1))).get("children")).add(obj); }else if(tmpArea.getAreaLevel().intValue()==6){ JSONObject obj = new JSONObject(); obj.put("id", tmpArea.getAreaId()); obj.put("name", tmpArea.getAreaName()); obj.put("children", new JSONArray()); JSONArray tmpJsonArr = ((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children"); ((JSONArray)((JSONObject)(tmpJsonArr.get(tmpJsonArr.size()-1))).get("children")).add(obj); }else if(tmpArea.getAreaLevel().intValue()==7){ JSONObject obj = new JSONObject(); obj.put("id", tmpArea.getAreaId()); obj.put("name", tmpArea.getAreaName()); obj.put("children", new JSONArray()); JSONArray tmpJsonArr = ((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").size()-1).getJSONArray("children"); ((JSONArray)((JSONObject)(tmpJsonArr.get(tmpJsonArr.size()-1))).get("children")).add(obj); }else if(tmpArea.getAreaLevel().intValue()==8){ JSONObject obj = new JSONObject(); obj.put("id", tmpArea.getAreaId()); obj.put("name", tmpArea.getAreaName()); obj.put("children", new JSONArray()); JSONArray tmpJsonArr = ((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").size()-1).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").size()-1).getJSONArray("children").size()-1).getJSONArray("children"); ((JSONArray)((JSONObject)(tmpJsonArr.get(tmpJsonArr.size()-1))).get("children")).add(obj); }else if(tmpArea.getAreaLevel().intValue()==9){ JSONObject obj = new JSONObject(); obj.put("id", tmpArea.getAreaId()); obj.put("name", tmpArea.getAreaName()); obj.put("children", new JSONArray()); JSONArray tmpJsonArr = ((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").size()-1).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").size()-1).getJSONArray("children").size()-1).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").size()-1).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").size()-1).getJSONArray("children").size()-1).getJSONArray("children").size()-1).getJSONArray("children"); ((JSONArray)((JSONObject)(tmpJsonArr.get(tmpJsonArr.size()-1))).get("children")).add(obj); }else if(tmpArea.getAreaLevel().intValue()==10){ JSONObject obj = new JSONObject(); obj.put("id", tmpArea.getAreaId()); obj.put("name", tmpArea.getAreaName()); obj.put("children", new JSONArray()); JSONArray tmpJsonArr = ((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").size()-1).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").size()-1).getJSONArray("children").size()-1).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").size()-1).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").size()-1).getJSONArray("children").size()-1).getJSONArray("children").size()-1).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").size()-1).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").size()-1).getJSONArray("children").size()-1).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").size()-1).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").getJSONObject(((JSONObject)((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").get(((JSONObject)((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).get(((JSONArray)((JSONObject)rtnArr.get(rtnArr.size()-1)).get("children")).size()-1)).getJSONArray("children").size()-1)).getJSONArray("children").size()-1).getJSONArray("children").size()-1).getJSONArray("children").size()-1).getJSONArray("children").size()-1).getJSONArray("children").size()-1).getJSONArray("children"); ((JSONArray)((JSONObject)(tmpJsonArr.get(tmpJsonArr.size()-1))).get("children")).add(obj); } } ResponseUtil.printWrite(response, rtnArr, ResponseUtil.TRANSFER_JSONARRAY); return null; } /** * @Title: queryAreaTreeForVo * @Description: 返回地区树,地区管理界面用到 * @param * @return String * @throws */ @RequestMapping(params="method=queryAreaTreeForVo") public String queryAreaTreeForVo(HttpServletResponse response) throws SQLException{ ResponseUtil.formatResp(response,ResponseUtil.CONTENTTYPE_JSON, ResponseUtil.CHARENCODING_UTF8); ResponseUtil.printWrite(response, this.areaServcie.queryAreaTreeVo(), ResponseUtil.TRANSFER_JSONARRAY); return null; } /** * @Title: queryAreaTree2 * @Description: 查询地区树,满足jquery easy ui * @param * @return String * @throws */ @RequestMapping(params="method=queryAreaTree2") public String queryAreaTree2(HttpServletResponse response) throws SQLException{ ResponseUtil.formatResp(response,ResponseUtil.CONTENTTYPE_JSON, ResponseUtil.CHARENCODING_UTF8); List<TConfigArea> list = this.areaServcie.queryAreaTreeVo(); ResponseUtil.printWrite(response, this.areaServcie.queryAreaTree2(list, null), ResponseUtil.TRANSFER_JSONARRAY); return null; } /** * @Title: areaId * @Description: 删除地区信息 * @param * @return String * @throws */ @SuppressWarnings({ "unchecked", "rawtypes" }) @RequestMapping(params="method=deleteArea") public String deleteArea(String areaId,HttpServletResponse response){ if(areaId==null && !"".equals(areaId)){ ResponseUtil.printWrite(response, 0, ResponseUtil.TRANSFER_NONE); }else{ ResponseUtil.formatResp(response,ResponseUtil.CONTENTTYPE_JSON, ResponseUtil.CHARENCODING_UTF8); Map map = new HashMap<String,Object>(); map.put("areaId", areaId); map.put("recursion", true); int cnt = this.areaServcie.deleteArea(map); ResponseUtil.printWrite(response, cnt, ResponseUtil.TRANSFER_NONE); } return null; } /** * @Title: addArea * @Description: 新增地区 * @param * @return String * @throws */ @SuppressWarnings({ "unchecked", "rawtypes" }) @RequestMapping(params="method=addArea") public String addDept(String areaInfo,HttpServletResponse response){ if(areaInfo==null && !"".equals(areaInfo)){ ResponseUtil.printWrite(response, 0, ResponseUtil.TRANSFER_NONE); }else{ ResponseUtil.formatResp(response,ResponseUtil.CONTENTTYPE_JSON, ResponseUtil.CHARENCODING_UTF8); JSONObject obj = JSONObject.fromObject(areaInfo); Map map = (Map<String,Object>)JSONObject.toBean(obj, HashMap.class); map.put("userId", UserHolder.getUserContext().getUserId()); int cnt = this.areaServcie.addArea(map); ResponseUtil.printWrite(response, cnt, ResponseUtil.TRANSFER_NONE); } return null; } /** * @Title: updateArea * @Description: 修改地区信息 * @param * @return String * @throws */ @SuppressWarnings({ "unchecked", "rawtypes" }) @RequestMapping(params="method=updateArea") public String updateArea(String areaInfo,HttpServletResponse response){ if(areaInfo==null && !"".equals(areaInfo)){ ResponseUtil.printWrite(response, 0, ResponseUtil.TRANSFER_NONE); }else{ ResponseUtil.formatResp(response,ResponseUtil.CONTENTTYPE_JSON, ResponseUtil.CHARENCODING_UTF8); JSONObject obj = JSONObject.fromObject(areaInfo); Map map = (Map<String,Object>)JSONObject.toBean(obj, HashMap.class); map.put("modifyUserId", UserHolder.getUserContext().getUserId()); int cnt = this.areaServcie.updateArea(map); ResponseUtil.printWrite(response, cnt, ResponseUtil.TRANSFER_NONE); } return null; } /** * @Title: toAddArea * @Description: 跳转到新增地区页面 * @param * @return String * @throws */ @RequestMapping(params="method=toAddArea") public String toAddDept(){ return "sys/addArea"; } @SuppressWarnings({ "unchecked", "rawtypes" }) @RequestMapping(params="method=queryCondition") public String queryCondition(HttpServletResponse response) throws SQLException{ ResponseUtil.formatResp(response,ResponseUtil.CONTENTTYPE_JSON, ResponseUtil.CHARENCODING_UTF8); Map map = new HashMap<String, String>(); map.put("recursion", true); List<TConfigArea> areaList = this.areaServcie.queryAreaByMap(map); JSONObject obj = new JSONObject(); obj.put("areaList", areaList); ResponseUtil.printWrite(response, obj, ResponseUtil.TRANSFER_NONE); return null; } }
[ "461857202@qq.com" ]
461857202@qq.com
f0a77da256896e2d03359dd1e3f35258bdfc8f3e
97e5ba788051c167b04f2d5c7aa1ed1f1caa8ef5
/src/test/java/br/com/devmedia/helloworldservice/HelloWorldServiceTest.java
cfdc2b8e941732ef2229db375cecb91501c015eb
[]
no_license
Thyeres01/ApacheCxfSpringHelloWorld
10ec9ad4797784eccc6d33c2074d216953c154e2
ad71efe6b6e68fea2f34cc2cd33541f6276eadd2
refs/heads/master
2021-05-28T11:01:20.267535
2012-11-18T20:28:10
2012-11-18T20:28:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,952
java
package br.com.devmedia.helloworldservice; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import br.com.devmedia.helloworldservice.schema.Nome; import br.com.devmedia.helloworldservice.schema.Saudacao; import br.com.devmedia.helloworldservice.wsdl.DigaOlaException; import br.com.devmedia.helloworldservice.wsdl.DigaOlaPortType; @ContextConfiguration @RunWith(SpringJUnit4ClassRunner.class) public class HelloWorldServiceTest { @Autowired DigaOlaPortType port; @Test public void requestResponseTest() throws Exception { Nome _digaOla_parametro = new Nome(); try { _digaOla_parametro.setConteudo("ze"); Saudacao ret = port.digaOla(_digaOla_parametro); Assert.assertEquals("Bom dia", ret.getConteudo()); } catch (DigaOlaException e) { System.out.println("Expected exception: DigaOlaException has occurred."); System.out.println(e.toString()); } try { _digaOla_parametro.setConteudo("maria"); Saudacao ret = port.digaOla(_digaOla_parametro); Assert.assertEquals("Ola", ret.getConteudo()); } catch (DigaOlaException e) { System.out.println("Expected exception: DigaOlaException has occurred."); System.out.println(e.toString()); } try { _digaOla_parametro.setConteudo("anonimo"); Saudacao ret = port.digaOla(_digaOla_parametro); Assert.assertTrue(false); } catch (DigaOlaException e) { Assert.assertEquals("ERR_01",e.getFaultInfo().getConteudo()); System.out.println("Expected exception: DigaOlaException has occurred."); System.out.println(e.toString()); } } }
[ "leogsilva@gmail.com" ]
leogsilva@gmail.com
ed588d5cde3eeed085f0e4a5b1b119e555902c09
aebec2da40e5221124ead7598e06a3c1bdad6fc1
/src/test/java/modelControllerEditTests/SeverityValueTest.java
04027947d728c3404af3ca9b2574d0323e13696c
[]
no_license
VenaJanoch/BakalarkaSPADEUI
fe29b30cb202b9c88711b156b4313a69aef0c512
a6966b6f4756027f3dd1bec4d6c1a082f0d9b485
refs/heads/master
2022-07-09T06:18:44.677208
2019-06-26T23:14:20
2019-06-26T23:14:20
81,818,879
0
0
null
2022-06-21T01:22:21
2017-02-13T11:40:16
Java
UTF-8
Java
false
false
2,170
java
package modelControllerEditTests; import SPADEPAC.Severity; import controllers.formControllers.FormDataController; import org.junit.Before; import org.junit.Test; import services.SegmentLists; import services.SegmentType; import tables.ClassTable; import java.util.ArrayList; import static junit.framework.TestCase.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertSame; public class SeverityValueTest { Severity severity; SegmentLists lists; @Before public void setUp() throws Exception { WarmUp warmUp = new WarmUp(); lists = warmUp.getLists(); FormDataController formDataController = warmUp.getFormDataController(); formDataController.saveDataFromSeverity(null, true); ArrayList<String> name = new ArrayList<>(); name.add(""); name.add("Test2"); ArrayList<Integer> indicators = new ArrayList<>(); indicators.add(1); indicators.add(0); warmUp.getEditFormController().editDataFromClass(SegmentType.Severity, "Test", name, indicators, indicators, indicators, name, name, new ClassTable("Test", "nevim", "nevim", false, 0), false, 0); severity = warmUp.getDataModel().getSeverity(0); } @Test public void testAlias() { assertEquals("Test", severity.getAlias()); } @Test public void testName() { assertEquals("", severity.getName().get(0)); assertEquals("Test2", severity.getName().get(1)); assertSame(2, severity.getName().size()); } @Test public void testIndicatorName() { assertSame(1, severity.getNameIndicator().get(0)); assertSame(0, severity.getNameIndicator().get(1)); assertSame(2, severity.getNameIndicator().size()); } @Test public void testIndicatorRole() { assertSame(1, severity.getSeverityClassIndex().get(0)); assertSame(1, severity.getSeveritySuperClassIndex().get(0)); } @Test public void testId() { assertSame(0, severity.getId()); } @Test public void testExist() { assertFalse(severity.isExist()); } }
[ "vena.janoch@windowslive.com" ]
vena.janoch@windowslive.com
22a229ce24164b9ea8c75d3868ba385c806ebce7
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/XWIKI-12798-141-14-SPEA2-WeightedSum:TestLen:CallDiversity/org/xwiki/resource/servlet/RoutingFilter_ESTest_scaffolding.java
3620a061744337bca701aa55e1ebe60c2e5550bb
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
444
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Tue Apr 07 04:13:23 UTC 2020 */ package org.xwiki.resource.servlet; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; @EvoSuiteClassExclude public class RoutingFilter_ESTest_scaffolding { // Empty scaffolding for empty test suite }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
44ad71f9557e0df8138efc1a4e213cc1382833fd
642d8bf6d921bc62aaf34544ee4d96d02f410df2
/nfdw-sys/src/main/java/com/nfdw/service/JobService.java
3e4c8aac73708dffac48c7fe7f7fb9ff6ff29e7a
[ "Apache-2.0" ]
permissive
66SiYang/nfdw-basic
2935d4957a601ce52957028067ae099fdeeff22c
55b9abf1e3abc687e1e9bbc1e02beaf680fd66c2
refs/heads/master
2020-04-12T13:01:46.998771
2018-12-18T07:45:04
2018-12-18T07:45:47
162,509,562
0
0
null
null
null
null
UTF-8
Java
false
false
270
java
package com.nfdw.service; import com.nfdw.base.BaseService; import com.nfdw.entity.SysJob; import com.nfdw.entity.SysMenu; /** * @author zhuxiaomeng * @date 2018/1/6. * @email 154040976@qq.com */ public interface JobService extends BaseService<SysJob,String> { }
[ "zsy15@qq.com" ]
zsy15@qq.com
8dedda296204f4ee639aa01b0eabcd0d8411f6c0
269ef750d4a00f557130157252ccfa13afcdf1fb
/src/main/scala/test/test2.java
9b6eec9961ae2a07abe7169d041b0e5e91dd7876
[]
no_license
un-knower/CdnStreamingAndRecommandMl
ae2d1f0db5443c80229d42990c5f8ec7d5159956
4b8f9d67164a12b2227047083996a6b7b49bc5bd
refs/heads/master
2020-03-24T18:15:00.169630
2018-01-01T09:30:56
2018-01-01T09:30:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
327
java
package test; /** * Created by zengxiaosen on 2017/5/24. */ public class test2 { public static void main(String[] args){ StringBuffer sb = new StringBuffer(); sb.append(12); sb.append(34); sb.append(56); sb.append(78); System.out.println(sb.reverse().toString()); } }
[ "xiaosenceng@sohu-inc.com" ]
xiaosenceng@sohu-inc.com
89a3968d1e25029d4cf144dc28767685e5d06d30
853a18f7192b049f16c70f3707d37a0de1a0fdc9
/app/src/main/java/com/Blinger/YiDeNews/ui/fragment/NewFragment.java
4a763b1755a87ceb89ea56d2cff7813f87e19a7f
[]
no_license
ShaoCongw/YiDeNews_1
cca4e8e68fc274c0b642435f82b19616590530fe
8d2a52e3b083e54566e1a013d8b5c637bc49590f
refs/heads/master
2020-09-10T08:41:36.253318
2019-12-17T07:32:38
2019-12-17T07:32:38
221,705,458
0
1
null
null
null
null
UTF-8
Java
false
false
17,356
java
package com.Blinger.YiDeNews.ui.fragment; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.v7.widget.CardView; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.view.View; import android.view.animation.AnimationUtils; import android.view.animation.LayoutAnimationController; import android.widget.RelativeLayout; import android.widget.TextView; import com.Blinger.YiDeNews.App; import com.Blinger.YiDeNews.R; import com.Blinger.YiDeNews.config.Config; import com.Blinger.YiDeNews.config.Constant; import com.Blinger.YiDeNews.dao.RecentNewsBeanDao; import com.Blinger.YiDeNews.model.NewBean; import com.Blinger.YiDeNews.model.NewTypeBean; import com.Blinger.YiDeNews.model.RecentNewsBean; import com.Blinger.YiDeNews.model.UserInfoBean; import com.Blinger.YiDeNews.presenter.NewPresenter; import com.Blinger.YiDeNews.ui.activity.MainActivity; import com.Blinger.YiDeNews.ui.activity.WebViewActivity; import com.Blinger.YiDeNews.utils.FitPopupUtil; import com.Blinger.YiDeNews.utils.ToastUtil; import com.Blinger.base.BaseApplication; import com.Blinger.base.base.BaseAdapter; import com.Blinger.base.base.BaseFragment; import com.Blinger.base.base.BaseView; import com.Blinger.base.base.BaseViewHolder; import com.Blinger.base.utils.LogUtils; import com.github.florent37.viewanimator.ViewAnimator; import com.scwang.smartrefresh.layout.SmartRefreshLayout; import com.scwang.smartrefresh.layout.api.RefreshLayout; import com.scwang.smartrefresh.layout.listener.OnLoadmoreListener; import java.util.ArrayList; import java.util.List; import butterknife.Bind; import butterknife.ButterKnife; import butterknife.OnClick; import static android.content.Context.MODE_PRIVATE; /** * 作者:310Lab * 时间:2019/4/1 12:57 * 邮箱:1760567382@qq.com * 功能: */ public class NewFragment extends BaseFragment<NewPresenter> implements BaseView { @Bind(R.id.recyclerView) RecyclerView mRecyclerView; @Bind(R.id.refresh) SmartRefreshLayout mRefresh; @Bind(R.id.up_float_bt) // CircleImageView upArrowIv; FloatingActionButton upFloatButton; @Bind(R.id.tv_toast) TextView tvToast; @Bind(R.id.rl_top_toast) RelativeLayout rlTopToast; private BaseAdapter mAdapter; private String uuid; private NewTypeBean mData = null; //是否展示快速回到顶部按钮 private boolean isShow = true; private int disy = 0; private boolean isFirstRequest = false; //新闻所属类别 private String category; private int newSignPosition; private int isRequest = 0; // private int isVisible = 10000000; private boolean isClick = false; private boolean firstClick = false; //记录已经阅读过的文章的position; private List<Integer> myPosition = new ArrayList<>(); public static NewFragment getFragment(NewTypeBean data, String str) { NewFragment fragment = new NewFragment(); Bundle bundle = new Bundle(); bundle.putParcelable(NewFragment.class.getSimpleName(), data); fragment.setArguments(bundle); //category = str; return fragment; } @Override protected NewPresenter createPresenter() { return new NewPresenter(this); } @Override protected int getResourceId() { return R.layout.fragment_new; } @Override public void initView(View rootView) { super.initView(rootView); SharedPreferences sharedPreferences = getContext().getSharedPreferences("init", MODE_PRIVATE); uuid = sharedPreferences.getString("uuid", ""); isFirstRequest = true; newSignPosition = 10000000; myPosition.add(-1); mRecyclerView.setLayoutManager(new LinearLayoutManager(mActivity)); mAdapter = new BaseAdapter<NewBean>(mActivity, R.layout.item_new) { @Override public void convert(final BaseViewHolder holder, int position, final NewBean data) { //LogUtils.d(Constant.debugName+"NewFragment ","position is " + position+" "+ data.getTitle()); holder.setText(data.getTitle(), R.id.item_title)//设置文章标题 //已经阅读过的文章标题显示灰色 .setTextColor(R.id.item_title, (myPosition.contains(position)) ? getResources().getColor(R.color.colorTime) : getResources().getColor(R.color.colorTitle)) //设置作者 .setText(data.getAuthorName(), R.id.item_author) //设置日期 .setText(data.getDate(), R.id.item_time) //设置第一张图片 .setImageResource(data.getThumbnailPicS(), R.id.item_img) .setVisible(R.id.item_img, !TextUtils.isEmpty(data.getThumbnailPicS())) //不喜欢这条新闻 .setOnClickListener(R.id.none_interest_iv, view -> { FitPopupUtil fitPopupUtil = new FitPopupUtil(getActivity()); fitPopupUtil.setOnClickListener(new FitPopupUtil.OnCommitClickListener() { @Override public void onClick(String reason) { //提交反馈 mPresenter.postEnjoy(data.getUniquekey(), uuid, reason); mAdapter.removeData(position); } }); fitPopupUtil.showPopup(view); }) .setOnClickListener(R.id.tv_tail_toast, view -> { mRecyclerView.smoothScrollToPosition(0); mRefresh.autoRefresh(); }) //最后一条新闻底部显示没有更多了 // .setVisible(R.id.item_rl_bottom, (position == getItemCount() - 1)) //刷新后在最近一次点击的新闻底部显示 “上次观看到这里” .setVisible(R.id.item_rl_tail_toast, (position == isVisible)) .itemView.setOnClickListener(view -> { //前一位作者这里的逻辑有问题吧,这样更新newSignPosition //从顶部的新闻向下点击没有问题,反之“上次观看的提示”会出现在位置靠上新闻下 // if (newSignPosition > position){ // newSignPosition = position; // } newSignPosition = position; myPosition.add(position); notifyItemChanged(position); Intent it = new Intent(mActivity, WebViewActivity.class); it.putExtra(WebViewActivity.class.getSimpleName(), data); startActivity(it); }); } }; //LogUtils.d(Constant.debugName + "NewsFragment ", "category is " + category); mRecyclerView.setAdapter(mAdapter); // mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { // @Override // public void onScrolled(RecyclerView recyclerView, int dx, int dy) { // super.onScrolled(recyclerView, dx, dy); // // int firstVisibleItem = ((LinearLayoutManager) recyclerView.getLayoutManager()).findFirstCompletelyVisibleItemPosition(); // if (firstVisibleItem == 0) { // if (!isShow) { // isShow = true; // upFloatButton.setVisibility(View.VISIBLE); // } // } else { // if (disy > 25 && isShow) { // isShow = false; // upFloatButton.setVisibility(View.GONE); // disy = 0; // } // if (disy < -25 && !isShow) { // isShow = true; // upFloatButton.setVisibility(View.VISIBLE); // disy = 0; // } // } // // if ((isShow && dy > 0) || (!isShow && dy < 0)) { // disy += dy; // } // } // }); setRefreshListener(); setLoadMoreListener(); mData = getArguments().getParcelable(NewFragment.class.getSimpleName()); // LogUtils.d(Constant.debugName+"NewFragment","进入initView"+mData.getTitle()); category = mData.getTitle(); isUIVisible = true; } @Override protected void netWork() { super.netWork(); if (mData == null) { return; } mPresenter.getNewsList(mData.getDescript(), uuid, MainActivity.index, NewPresenter.REFRESH); } //下拉加载更多 protected void loadMore() { if (mData == null) { return; } mPresenter.getNewsList(mData.getDescript(), uuid, MainActivity.index, NewPresenter.LOAD_MORE); } /** * 刷新监听 */ private void setRefreshListener() { mRefresh.setOnRefreshListener(refresh -> { //isRequest = true; if (BaseApplication.isIsNetConnect()) { netWork(); } else { alert(getString(com.Blinger.base.R.string.alert_no_net_repeat)); } mRefresh.finishRefresh(Config.SMARTREFRESH_MAX_REFRESH_TIME); }); //不允许下拉加载更多 // mRefresh.setEnableLoadmore(false); } /** * 下拉加载多监听 */ private void setLoadMoreListener() { mRefresh.setOnLoadmoreListener(new OnLoadmoreListener() { @Override public void onLoadmore(RefreshLayout refreshlayout) { if (BaseApplication.isIsNetConnect()) { loadMore(); } else { alert(getString(com.Blinger.base.R.string.alert_no_net_repeat)); } mRefresh.finishLoadmore(Config.SMARTREFRESH_MAX_REFRESH_TIME); } }); } private void showToast(int num) { tvToast.setText("已为你成功推荐" + num + "条新闻"); //LogUtils.d(Constant.debugName + "showToast ", "已为你成功推荐"+num+"条新闻"); rlTopToast.setVisibility(View.VISIBLE); //加载成功弹出及消失动画 ViewAnimator.animate(rlTopToast) .newsPaper() .duration(500) .start() .onStop(() -> ViewAnimator.animate(rlTopToast) .bounceOut() .duration(1000) .start()); } private List<NewBean> getRecentNewsList() { RecentNewsBeanDao dao = App.mSession.getRecentNewsBeanDao(); List<RecentNewsBean> recentNewsBeans = dao.queryBuilder().where(RecentNewsBeanDao.Properties.Category.eq(category)).list(); if (recentNewsBeans == null) { recentNewsBeans = new ArrayList<>(); } // LogUtils.d(Constant.debugName+"NewFragment","into getRecentNewsList"+recentNewsBeans.size()+mData.getTitle() ); //LogUtils.d(Constant.debugName + "getRecentNewsList ", recentNewsBeans.size() + ""); List<NewBean> newBeans = new ArrayList<>(); for (int i = 0; i < recentNewsBeans.size(); i++) { NewBean newBean = new NewBean(); newBean.setUniquekey(recentNewsBeans.get(i).getUniquekey()); newBean.setTitle(recentNewsBeans.get(i).getTitle()); newBean.setDate(recentNewsBeans.get(i).getDate()); newBean.setCategory(recentNewsBeans.get(i).getCategory()); newBean.setAuthorName(recentNewsBeans.get(i).getAuthorName()); newBean.setUrl(recentNewsBeans.get(i).getUrl()); newBean.setThumbnailPicS(recentNewsBeans.get(i).getThumbnailPicS()); newBeans.add(newBean); } isFirstRequest = false; return newBeans; } private void setRecentNewsList(List<NewBean> list) { RecentNewsBeanDao dao = App.mSession.getRecentNewsBeanDao(); List<RecentNewsBean> tempList = dao.queryBuilder().where(RecentNewsBeanDao.Properties.Category.eq(category)).list(); // // for (int i=0; i<tempList.size();i++){ // LogUtils.d(Constant.debugName+"newFragment","tempList" + tempList.get(i).getTitle()+" type "+mData.getTitle()+i); // } if (tempList != null) { dao.deleteInTx(tempList); } //LogUtils.d(Constant.debugName + "setRecentNewsList ", (list.size()) + "条"); for (int i = 0; i < list.size(); i++) { RecentNewsBean recentNewsBean = new RecentNewsBean(); recentNewsBean.setUniquekey(list.get(i).getUniquekey()); recentNewsBean.setTitle(list.get(i).getTitle()); recentNewsBean.setDate(list.get(i).getDate()); recentNewsBean.setCategory(list.get(i).getCategory()); recentNewsBean.setAuthorName(list.get(i).getAuthorName()); recentNewsBean.setUrl(list.get(i).getUrl()); recentNewsBean.setThumbnailPicS(list.get(i).getThumbnailPicS()); recentNewsBean.setThumbnailPicS02("123"); recentNewsBean.setThumbnailPicS03("456"); //LogUtils.d(Constant.debugName+"setRecentNewsList ",list.get(i).getCategory()); dao.insert(recentNewsBean); } // LogUtils.d(Constant.debugName + "NewFragment ", "保存成功"+list.size()+mData.getTitle()); } @Override public void showData(Object obj) { if (obj instanceof List) { if (((List) obj).size() == 0) { if (isFirstRequest) { //isFirstRequest = false; // LogUtils.d(Constant.debugName + "NewFragment ", "into isFirstRequest"); mAdapter.setData(getRecentNewsList()); } else { if (mRefresh.isRefreshing()) { mRefresh.finishRefresh(); } alert("~休息一下吧~"); } } else { if (((List) obj).get(0) instanceof NewBean) { List<NewBean> list = (List<NewBean>) obj; if (mPresenter.requestFlag == NewPresenter.REFRESH) { //刷新,新新闻添加到顶部 // LogUtils.d(Constant.debugName + "NewFragment ", list.size() + ""); mAdapter.setData(list); mRecyclerView.scheduleLayoutAnimation(); if (mRefresh.isRefreshing()) { mRefresh.finishRefresh(); //ToastUtil.getInstance().showSuccess(App.getContext(), "数据刷新成功"); //isRequest = false; // LogUtils.d(Constant.debugName + "NewFragment ", mData.getTitle()+" "+isFirstRequest); isRequest = 1; newSignPosition += list.size(); isVisible = newSignPosition; firstClick = true; addSize(list.size()); } isFirstRequest = false; showToast(list.size()); }else{ //加载更多,新新闻添加在底部 mAdapter.setData(list,-1); if(mRefresh.isLoading()){ mRefresh.finishLoadmore(); } } } else if (((List) obj).get(0) instanceof UserInfoBean) { List<UserInfoBean> list = (List<UserInfoBean>) obj; LogUtils.d(Constant.debugName + "postEnjoy", list.get(0).toString()); ToastUtil.getInstance().showSuccess(App.getContext(), "反馈成功"); } } } } //刷新后更新点击过的item项position private void addSize(int size) { for (int i = 1; i < myPosition.size(); i++) { myPosition.set(i, myPosition.get(i) + size); } } @Override public void showError(String msg) { if (mRefresh.isRefreshing()) { mRefresh.finishRefresh(); } alert(msg); } @Override public void onDestroyView() { setRecentNewsList(mAdapter.getRecentNews()); // LogUtils.d(Constant.debugName+"NewFragment","into destroyView"+mData.getTitle()); //mAdapter.getRecentNews(); super.onDestroyView(); ButterKnife.unbind(this); } @OnClick(R.id.up_float_bt) public void onViewClicked() { mRecyclerView.smoothScrollToPosition(0); mRefresh.autoRefresh(); } }
[ "taokeyuan@gmail.com" ]
taokeyuan@gmail.com
70696dec6f8e47ec3f3bc1d391b0d11eb7c06068
9ba05b671b1f614c3ebc42d6f34eb6837b957673
/src/main/java/com/feng/boot/admin/domain/controller/SuperSimpleBaseController.java
c22e1b80c6600403a4408aaf93a0e148449d6001
[ "MIT" ]
permissive
Jack165/SaasAdmin
b07b4454dd3b809b56ec330c5f27b7608464f060
2bf5945b0d5299f9f1fe7a3729326220c375a55b
refs/heads/main
2023-04-21T22:24:47.240299
2021-05-08T08:20:58
2021-05-08T08:20:58
302,864,936
0
1
null
null
null
null
UTF-8
Java
false
false
2,048
java
package com.feng.boot.admin.domain.controller; import com.feng.boot.admin.domain.controller.base.IBaseDeleteController; import com.feng.boot.admin.domain.controller.base.IBaseQueryController; import com.feng.boot.admin.domain.controller.base.IBaseSaveController; import com.feng.boot.admin.domain.controller.base.IBaseUpdateController; import com.feng.boot.admin.domain.service.ISuperBaseService; import com.feng.boot.admin.domain.model.dto.BaseDTO; import com.feng.boot.admin.domain.model.entity.BaseDomain; import com.feng.boot.admin.domain.model.query.BaseParams; import java.io.Serializable; import java.lang.reflect.ParameterizedType; /** * 简单的实现了BaseController,<br> * 为了获取注入 Service 和 实体类型,实现基本的curd与数据校验已经对应的权限 * * @param <ID> id 类型 * @param <DTO> vo类型 * @param <PARAMS> 请求类型 * @param <ENTITY> 实体类型 * @author bing_huang * @since 3.0.0 */ public abstract class SuperSimpleBaseController<ID extends Serializable, DTO extends BaseDTO, PARAMS extends BaseParams, ENTITY extends BaseDomain> implements IBaseSaveController<DTO, ENTITY>, IBaseQueryController<ID, DTO, PARAMS, ENTITY>, IBaseUpdateController<ID, DTO, ENTITY>, IBaseDeleteController<ID, ENTITY> { private ISuperBaseService<ID, PARAMS, DTO, ENTITY> service; protected Class<ENTITY> entityClass = null; public SuperSimpleBaseController(ISuperBaseService<ID, PARAMS, DTO, ENTITY> service) { this.service = service; } public SuperSimpleBaseController() { } @Override public ISuperBaseService<ID, PARAMS, DTO, ENTITY> getBaseService() { return service; } @Override @SuppressWarnings({"unchecked", "rawtypes"}) public Class<ENTITY> getEntityClass() { if (entityClass == null) { this.entityClass = (Class) ((ParameterizedType) this.getClass().getGenericSuperclass()).getActualTypeArguments()[3]; } return this.entityClass; } }
[ "fengshuo@yunquna.com" ]
fengshuo@yunquna.com
7918a0e70d7f3598dd9890513b46044f21a013b3
c706784d8d6ef707388524dd5e538454ddfdd0e8
/vmm/vmmstorefront/web/src/com/vmm/storefront/web/theme/UiExperienceSiteThemeResolver.java
3c8429e4a07ee7740c45734995aa4f738652467b
[]
no_license
chhabraromit/VishalMM
38b7b3dc2a061e112bdd42e31f3224fc1a14cba7
4212e7210b99792121a9a370b963a2138ac2b47e
refs/heads/master
2020-04-06T07:06:11.013600
2016-08-29T13:49:08
2016-08-29T13:49:08
65,346,330
0
0
null
null
null
null
UTF-8
Java
false
false
3,730
java
/* * [y] hybris Platform * * Copyright (c) 2000-2016 SAP SE or an SAP affiliate company. * All rights reserved. * * This software is the confidential and proprietary information of SAP * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with SAP. */ package com.vmm.storefront.web.theme; import de.hybris.platform.commerceservices.enums.UiExperienceLevel; import de.hybris.platform.acceleratorservices.uiexperience.UiExperienceService; import de.hybris.platform.cms2.model.site.CMSSiteModel; import de.hybris.platform.cms2.servicelayer.services.CMSSiteService; import de.hybris.platform.commerceservices.enums.SiteTheme; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Required; import org.springframework.web.servlet.theme.AbstractThemeResolver; /** * Resolve the spring theme name from the CMSSite. * The spring theme name is built from the CMSSite UID and the CMSSite Theme. */ public class UiExperienceSiteThemeResolver extends AbstractThemeResolver { public static final String THEME_REQUEST_ATTRIBUTE_NAME = UiExperienceSiteThemeResolver.class.getName() + ".THEME"; private CMSSiteService cmsSiteService; private UiExperienceService uiExperienceService; @Override public String resolveThemeName(final HttpServletRequest request) { // Lookup the cached theme name in the request String themeName = (String) request.getAttribute(THEME_REQUEST_ATTRIBUTE_NAME); if (themeName == null) { // Resolve Theme from CMSSiteService themeName = determineDefaultThemeName(); // Cache the theme in the request attributes if (themeName != null) { request.setAttribute(THEME_REQUEST_ATTRIBUTE_NAME, themeName); } } return themeName; } protected String determineDefaultThemeName() { final UiExperienceLevel uiExperienceLevel = getUiExperienceService().getUiExperienceLevel(); // Resolve Theme from CMSSiteService final CMSSiteModel currentSite = getCmsSiteService().getCurrentSite(); if (currentSite != null) { return combineSiteAndTheme(uiExperienceLevel.getCode(), currentSite.getUid(), getThemeNameForSite(currentSite)); } return null; } protected String getThemeNameForSite(final CMSSiteModel site) { final SiteTheme theme = site.getTheme(); if (theme != null) { final String themeCode = theme.getCode(); if (themeCode != null && !themeCode.isEmpty()) { return themeCode; } } return getDefaultThemeName(); } protected String combineSiteAndTheme(final String uiExperienceLevel, final String siteUid, final String themeName) { return uiExperienceLevel + "," + siteUid + "," + themeName; } @Override public void setThemeName(final HttpServletRequest arg0, final HttpServletResponse arg1, final String arg2) { throw new UnsupportedOperationException("Cannot change theme - use a different theme resolution strategy"); } /** * @return the cmsSiteService */ protected CMSSiteService getCmsSiteService() { return cmsSiteService; } /** * @param cmsSiteService the CMSSiteService to set */ @Required public void setCmsSiteService(final CMSSiteService cmsSiteService) { this.cmsSiteService = cmsSiteService; } protected UiExperienceService getUiExperienceService() { return uiExperienceService; } @Required public void setUiExperienceService(final UiExperienceService uiExperienceService) { this.uiExperienceService = uiExperienceService; } }
[ "chhabra.romit@gmail.com" ]
chhabra.romit@gmail.com
51f283a1b25c294de6e4231b300f959eb772e98b
4a86b93b8da726b67361e63d371afb5d2890ccec
/src/com/j3a/assurance/model/EngagementsActifrepId.java
9b34002c6ab1d911a5a1f073ee251ab338a03358
[]
no_license
J3asoftwaregroup/sherpaWebUserV1
50bed0e3457534aec8ad96673988bcff5aca490a
cb559c95d9e64dd637178606940b37e4721a78d6
refs/heads/master
2021-01-25T08:32:20.327704
2015-05-06T16:47:20
2015-05-06T16:47:20
35,161,858
0
0
null
null
null
null
UTF-8
Java
false
false
2,110
java
package com.j3a.assurance.model; // Generated 5 mai 2015 11:21:10 by Hibernate Tools 4.3.1 import javax.persistence.Column; import javax.persistence.Embeddable; /** * EngagementsActifrepId generated by hbm2java */ @Embeddable public class EngagementsActifrepId implements java.io.Serializable { private String codeengagements; private String codeactifrep; public EngagementsActifrepId() { } public EngagementsActifrepId(String codeengagements, String codeactifrep) { this.codeengagements = codeengagements; this.codeactifrep = codeactifrep; } @Column(name = "CODEENGAGEMENTS", nullable = false, length = 20) public String getCodeengagements() { return this.codeengagements; } public void setCodeengagements(String codeengagements) { this.codeengagements = codeengagements; } @Column(name = "CODEACTIFREP", nullable = false, length = 20) public String getCodeactifrep() { return this.codeactifrep; } public void setCodeactifrep(String codeactifrep) { this.codeactifrep = codeactifrep; } public boolean equals(Object other) { if ((this == other)) return true; if ((other == null)) return false; if (!(other instanceof EngagementsActifrepId)) return false; EngagementsActifrepId castOther = (EngagementsActifrepId) other; return ((this.getCodeengagements() == castOther.getCodeengagements()) || (this .getCodeengagements() != null && castOther.getCodeengagements() != null && this .getCodeengagements().equals(castOther.getCodeengagements()))) && ((this.getCodeactifrep() == castOther.getCodeactifrep()) || (this .getCodeactifrep() != null && castOther.getCodeactifrep() != null && this .getCodeactifrep().equals(castOther.getCodeactifrep()))); } public int hashCode() { int result = 17; result = 37 * result + (getCodeengagements() == null ? 0 : this.getCodeengagements() .hashCode()); result = 37 * result + (getCodeactifrep() == null ? 0 : this.getCodeactifrep() .hashCode()); return result; } }
[ "kerandelniangoran@gmail.com" ]
kerandelniangoran@gmail.com
cb2cab4bf1dca40d72289624b463b2cd3330ae36
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/4/4_a8ea98d3535df31af15994190f16e1c7dbf64be6/JsonToClassConverter/4_a8ea98d3535df31af15994190f16e1c7dbf64be6_JsonToClassConverter_t.java
5cd9002f2459068ef395640c0c3e34ebc708f87b
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
4,665
java
/** *Copyright (C) 2012-2013 Wikimedia Foundation * *This program is free software; you can redistribute it and/or *modify it under the terms of the GNU General Public License *as published by the Free Software Foundation; either version 2 *of the License, or (at your option) any later version. * *This program is distributed in the hope that it will be useful, *but WITHOUT ANY WARRANTY; without even the implied warranty of *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *GNU General Public License for more details. * *You should have received a copy of the GNU General Public License *along with this program; if not, write to the Free Software *Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.wikimedia.analytics.kraken.schemas; import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.HashMap; import java.util.List; /** * The JsonToClassConverter is a generic class that can load any file that contains a list * of JSON objects into a {@link HashMap} with the key specified by the caller and the value * an instance of the JSON object */ public class JsonToClassConverter { /** * @param className refers to the name of the class that maps to the JSON file. Make sure that * all properties in the JSON file are defined in the Java class, else it will throw an error * @param file contains the name of the JSON file to be loaded. The default place to put this * file is in the src/main/resource folder * @param key name of the field from the JSON object that should be used as key to store the * JSON object in the HashMap. Suppose the field containing the key is called 'foo' then the * java Class should have a getter called getFoo. * @return * @throws JsonMappingException * @throws JsonParseException */ public final HashMap<String, Schema> construct(final String className, final String file, final String key) throws JsonMappingException, JsonParseException { JsonFactory jfactory = new JsonFactory(); HashMap<String, Schema> map = new HashMap<String, Schema>(); List<Schema> schemas = null; InputStream input; JavaType type; ObjectMapper mapper = new ObjectMapper(); try { Schema schema = (Schema) Schema.class .getClassLoader() .loadClass(className) .newInstance(); input = schema.getClass().getClassLoader().getResourceAsStream(file); type = mapper.getTypeFactory(). constructCollectionType(List.class, schema.getClass()); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } catch (InstantiationException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } try { JsonParser jParser = jfactory.createJsonParser(input); schemas = mapper.readValue(jParser, type); } catch (IOException e) { System.err.println("Specified file could not be found."); } finally { try { if (input != null) { input.close(); } } catch (IOException e){ System.err.println("Could not close filestream"); } } if (schemas != null){ for (Schema schemaInstance: schemas) { try { Method getKey = schemaInstance.getClass().getMethod(key); map.put(getKey.invoke(schemaInstance).toString(), schemaInstance); } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (InvocationTargetException e) { throw new RuntimeException(e); } catch (NoSuchMethodException e) { System.err.println("Specified key is not a valid Getter for " + className); } } } return map; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
ce00dc2e6ee802c81a4a14f5ec9a7377cd815ddf
9f67c4ad49dc880708e6b35c3d31f03c86b9dd6f
/src/main/java/db/dao/ILoyaltyDAO.java
9d6ecf26a036557e23068d132fdd90dff7b769b4
[ "MIT" ]
permissive
amanajas/ultra-vision
13d534d3475af96fce82f86be870c85a7a883654
1052a337250ace6ed4c4f7e09c0ae8d4a1756fc1
refs/heads/master
2022-07-03T03:06:44.285826
2020-05-14T19:25:10
2020-05-14T19:25:10
260,130,198
1
0
null
null
null
null
UTF-8
Java
false
false
302
java
package db.dao; import java.sql.SQLException; import entities.LoyaltyPoints; import entities.User; public interface ILoyaltyDAO { int insertLoyalty(User user) throws SQLException; boolean updateLoyalty(User user) throws SQLException; LoyaltyPoints get(int userId) throws SQLException; }
[ "user7l44@gmail.com" ]
user7l44@gmail.com
4fd36536baa640d20bcd658079f0543c30f3fce1
4fc4650f193be9086d8962976d4aac4f8ed8b015
/app/src/main/java/com/will/weiyue/ui/news/contract/ArticleContract.java
33f47fb6d39dea95b74a09519bc0d55c60b2e0a7
[]
no_license
inearlyautumn/ExerciseProjectP02
43d16491f2824b56a6a356af7d0bda475fe75398
370289efe812d96e8eeee4f91139d31840ecd585
refs/heads/master
2021-09-10T05:41:48.263833
2018-03-21T06:52:43
2018-03-21T06:52:43
120,583,588
0
0
null
null
null
null
UTF-8
Java
false
false
437
java
package com.will.weiyue.ui.news.contract; import com.will.weiyue.bean.NewsArticleBean; import com.will.weiyue.ui.base.BaseContract; /** * author: liweixing * date: 2018/2/12 */ public interface ArticleContract { interface View extends BaseContract.BaseView { void loadData(NewsArticleBean articleBean); } interface Presenter extends BaseContract.BasePresenter<View> { void getData(String aid); } }
[ "349621080@qq.com" ]
349621080@qq.com
69830e91ee8d881011f1859d9d02ef7410bfeec1
d15b2b37c66100aef41c582211f7726366597222
/app/src/main/java/com/example/samples/fragment/FullWidthDialogFragment.java
1bfcf1b98d1b0821f62d5c8061336739667827a5
[]
no_license
LakeShire/Samples
eaa09d7554c410646dc065b18abd1568d999b4cf
4ca803dee1aac5c4f08fe7d65f2d05fed5b34605
refs/heads/master
2020-12-03T21:15:41.745307
2020-04-20T13:27:01
2020-04-20T13:27:01
231,489,854
0
0
null
null
null
null
UTF-8
Java
false
false
1,667
java
package com.example.samples.fragment; import android.app.Dialog; import android.os.Bundle; import android.view.Gravity; import android.view.View; import android.view.Window; import android.view.WindowManager; import androidx.fragment.app.DialogFragment; import com.example.samples.R; public class FullWidthDialogFragment extends DialogFragment { @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Dialog dialog = null; if (getActivity() != null) { dialog = new Dialog(getActivity()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(getLayoutId()); Window window = dialog.getWindow(); if (window != null) { window.setBackgroundDrawableResource(android.R.color.transparent); WindowManager.LayoutParams attributes = window.getAttributes(); attributes.gravity = getGravity(); attributes.width = WindowManager.LayoutParams.MATCH_PARENT; window.setAttributes(attributes); } } if (dialog == null) { dialog = super.onCreateDialog(savedInstanceState); } if (dialog.getWindow() != null && dialog.getWindow().getDecorView() != null) { View view = dialog.getWindow().getDecorView(); if (view != null) { initUi(view); } } return dialog; } protected void initUi(View view) { } protected int getLayoutId() { return R.layout.dialog_base; } protected int getGravity() { return Gravity.CENTER; } }
[ "louis.liu@ximalaya.com" ]
louis.liu@ximalaya.com
44a504a84bc7112a0d5d9519a1de1924d6104507
dd7872f6b3b0077239f4a1cd2fc0db7de6920686
/app/src/main/java/com/rayyan/proyek2/app/AppController.java
455a884a7bcf633fec8db61788e591f75c11cd88
[]
no_license
haykalrayyan99/Proyek2
1ac9f38c5b2f0edcf7b7feac09180982128be875
f6e866fe3707a4ff0e6648aaf6681b8539d8f91f
refs/heads/master
2020-08-27T11:09:50.296741
2019-12-30T16:38:32
2019-12-30T16:38:32
217,345,669
0
1
null
null
null
null
UTF-8
Java
false
false
1,267
java
package com.rayyan.proyek2.app; import android.app.Application; import android.text.TextUtils; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.toolbox.Volley; public class AppController extends Application { public static final String TAG = AppController.class.getSimpleName(); private RequestQueue mRequestQueue; private static AppController mInstance; @Override public void onCreate() { super.onCreate(); mInstance = this; } public static synchronized AppController getInstance() { return mInstance; } public RequestQueue getRequestQueue() { if (mRequestQueue == null) { mRequestQueue = Volley.newRequestQueue(getApplicationContext()); } return mRequestQueue; } public <T> void addToRequestQueue(Request<T> req, String tag) { req.setTag(TextUtils.isEmpty(tag) ? TAG : tag); getRequestQueue().add(req); } public <T> void addToRequestQueue(Request<T> req) { req.setTag(TAG); getRequestQueue().add(req); } public void cancelPendingRequests(Object tag) { if (mRequestQueue != null) { mRequestQueue.cancelAll(tag); } } }
[ "haykalrayyan43@gmail.com" ]
haykalrayyan43@gmail.com