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
f6918482aaedb7844614b87b223014179748e98a
779854ea426dd273609a60ff02c45a7ef0953d94
/src/java/com/afnemo/view/PersonaController.java
e97bfa65827dc35380a5dfca89e427ce5d01a758
[]
no_license
aafnemo/web-plataform-netbeans
b65857ca175b043f808f720aaad05054d2d67b29
524b3b8d9615e404861b03d56069171a52affd50
refs/heads/master
2020-05-06T15:46:46.118197
2019-05-27T01:12:36
2019-05-27T01:12:36
180,207,951
0
0
null
null
null
null
UTF-8
Java
false
false
5,292
java
package com.afnemo.view; import com.afnemo.dto.Persona; import com.afnemo.view.util.JsfUtil; import com.afnemo.view.util.JsfUtil.PersistAction; import com.afnemo.session.PersonaFacade; import java.io.Serializable; import java.util.List; import java.util.ResourceBundle; import java.util.logging.Level; import java.util.logging.Logger; import javax.ejb.EJB; import javax.ejb.EJBException; import javax.inject.Named; import javax.enterprise.context.SessionScoped; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.convert.Converter; import javax.faces.convert.FacesConverter; @Named("personaController") @SessionScoped public class PersonaController implements Serializable { @EJB private com.afnemo.session.PersonaFacade ejbFacade; private List<Persona> items = null; private Persona selected; public PersonaController() { } public Persona getSelected() { return selected; } public void setSelected(Persona selected) { this.selected = selected; } protected void setEmbeddableKeys() { } protected void initializeEmbeddableKey() { } private PersonaFacade getFacade() { return ejbFacade; } public Persona prepareCreate() { selected = new Persona(); initializeEmbeddableKey(); return selected; } public void create() { persist(PersistAction.CREATE, ResourceBundle.getBundle("/Bundle").getString("PersonaCreated")); if (!JsfUtil.isValidationFailed()) { items = null; // Invalidate list of items to trigger re-query. } } public void update() { persist(PersistAction.UPDATE, ResourceBundle.getBundle("/Bundle").getString("PersonaUpdated")); } public void destroy() { persist(PersistAction.DELETE, ResourceBundle.getBundle("/Bundle").getString("PersonaDeleted")); if (!JsfUtil.isValidationFailed()) { selected = null; // Remove selection items = null; // Invalidate list of items to trigger re-query. } } public List<Persona> getItems() { if (items == null) { items = getFacade().findAll(); } return items; } private void persist(PersistAction persistAction, String successMessage) { if (selected != null) { setEmbeddableKeys(); try { if (persistAction != PersistAction.DELETE) { getFacade().edit(selected); } else { getFacade().remove(selected); } JsfUtil.addSuccessMessage(successMessage); } catch (EJBException ex) { String msg = ""; Throwable cause = ex.getCause(); if (cause != null) { msg = cause.getLocalizedMessage(); } if (msg.length() > 0) { JsfUtil.addErrorMessage(msg); } else { JsfUtil.addErrorMessage(ex, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured")); } } catch (Exception ex) { Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex); JsfUtil.addErrorMessage(ex, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured")); } } } public Persona getPersona(java.lang.String id) { return getFacade().find(id); } public List<Persona> getItemsAvailableSelectMany() { return getFacade().findAll(); } public List<Persona> getItemsAvailableSelectOne() { return getFacade().findAll(); } @FacesConverter(forClass = Persona.class) public static class PersonaControllerConverter implements Converter { @Override public Object getAsObject(FacesContext facesContext, UIComponent component, String value) { if (value == null || value.length() == 0) { return null; } PersonaController controller = (PersonaController) facesContext.getApplication().getELResolver(). getValue(facesContext.getELContext(), null, "personaController"); return controller.getPersona(getKey(value)); } java.lang.String getKey(String value) { java.lang.String key; key = value; return key; } String getStringKey(java.lang.String value) { StringBuilder sb = new StringBuilder(); sb.append(value); return sb.toString(); } @Override public String getAsString(FacesContext facesContext, UIComponent component, Object object) { if (object == null) { return null; } if (object instanceof Persona) { Persona o = (Persona) object; return getStringKey(o.getPRSid()); } else { Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "object {0} is of type {1}; expected type: {2}", new Object[]{object, object.getClass().getName(), Persona.class.getName()}); return null; } } } }
[ "arnoldherrera@cbit-online.com" ]
arnoldherrera@cbit-online.com
afbe625f29007a9648610d013075a3c9cb8bb0ae
40475d92097ca97fbe82b365a615278ea66248e6
/email-notification-service/src/main/java/demo/service/impl/UserCategoryServiceImpl.java
513ad77c1746deba2a20871ec138b49be476deda
[]
no_license
xujiahaha/price-monitoring-system
360cf8dea51e65dc433ab49f7bb6b5b7598a82ca
455144ef184aaa9fbd07fab9c1a905ef4137e14a
refs/heads/master
2021-01-01T20:07:17.936247
2017-08-22T00:21:59
2017-08-22T00:21:59
98,767,951
7
5
null
null
null
null
UTF-8
Java
false
false
784
java
package demo.service.impl; import demo.domain.UserCategory; import demo.domain.UserCategoryRepository; import demo.service.UserCategoryService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** * Created by jiaxu on 8/9/17. */ @Service public class UserCategoryServiceImpl implements UserCategoryService{ private UserCategoryRepository userCategoryRepository; @Autowired public UserCategoryServiceImpl(UserCategoryRepository userCategoryRepository) { this.userCategoryRepository = userCategoryRepository; } @Override public List<UserCategory> getByCategoryId(int categoryId) { return this.userCategoryRepository.getByCategoryId(categoryId); } }
[ "xujiahaha@hotmail.com" ]
xujiahaha@hotmail.com
ad99908f395112c6ecd939a4078f0328d1a0492d
979b83b93a1bc91d92de044a23fc89250d2b35fa
/html/src/com/win/de/client/HtmlLauncher.java
125919b106864b19c24945174d2e646e0db7c571
[]
no_license
WinThuLatt/DE
bbdc2004b0f199d7d9b30aea74d42436cc64f13b
e6737548a7412352b6dd67d6184f3d9475459f5e
refs/heads/master
2021-01-20T13:36:52.446975
2017-02-21T15:13:23
2017-02-21T15:13:23
82,693,871
0
0
null
null
null
null
UTF-8
Java
false
false
548
java
package com.win.de.client; import com.badlogic.gdx.ApplicationListener; import com.badlogic.gdx.backends.gwt.GwtApplication; import com.badlogic.gdx.backends.gwt.GwtApplicationConfiguration; import com.win.de.DE; public class HtmlLauncher extends GwtApplication { @Override public GwtApplicationConfiguration getConfig () { return new GwtApplicationConfiguration(480, 320); } @Override public ApplicationListener createApplicationListener () { return new DE(); } }
[ "winthulatt2016@gmail.com" ]
winthulatt2016@gmail.com
ccaae93a358e526d6ca8e1bb2709502b61e23a98
4f10eb63e8e17fd4adc7b8b950ebad5815256e31
/kulami/src/kulami/gui/GameDisplay.java
66648394151fca4a6d4d844cd4d5c47f88491d1b
[]
no_license
gordonce/kulami
f2bf8381c46bb22887754087f319ee4e27376910
a45f8808967b288b5733e6352b41ee8a5fe01874
refs/heads/master
2016-09-13T16:26:04.630699
2016-05-07T16:52:44
2016-05-07T16:52:44
58,356,632
0
0
null
null
null
null
UTF-8
Java
false
false
2,675
java
package kulami.gui; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.logging.Logger; import javax.swing.JPanel; import kulami.game.GameObservable; import kulami.game.GameObserver; import kulami.game.board.Board; import kulami.game.board.Marbles; /** * This class is notified when the game state changes and displays the game * using a <code>MapPainter</code>. * <p> * A <code>GameDisplay</code> sends user input events to a * <code>GameDisplayAdapter</code>. * * @author gordon * */ public class GameDisplay implements GameObserver { private MapPainter mapPainter; private GameDisplayAdapter gameDisplayAdapter; private static final Logger logger = Logger .getLogger("kulami.gui.GameDisplay"); /** * Constructs a new <code>GameDisplay</code>, creates a * <code>MapPainter</code>, and registers with a <code>GameObservable</code> * . * * @param game * @param board * @param gameDisplayAdapter */ public GameDisplay(GameObservable game, JPanel board, GameDisplayAdapter gameDisplayAdapter) { this.gameDisplayAdapter = gameDisplayAdapter; mapPainter = new MapPainter(board); game.registerObserver(this); } /* * (non-Javadoc) * * @see kulami.gui.GameObserver#gameChanged() */ @Override public void gameChanged(GameObservable game) { mapPainter.setLastMove(game.getLastMove()); mapPainter.setPossibleMoves(game.getLegalMoves()); mapPainter.setPanelOwners(game.getPanelOwners()); Marbles marbles = game.getMarbles(); mapPainter.drawMarbles(marbles); } /* * (non-Javadoc) * * @see kulami.gui.GameObserver#boardChanged(kulami.game.GameObservable) */ @Override public void boardChanged(GameObservable game) { Board board = game.getBoard(); logger.finer("Drawing map: " + board); mapPainter.drawBoard(board, game.getDisplayFlags()); initTileListeners(); } /* * (non-Javadoc) * * @see kulami.gui.GameObserver#flagsChanged(kulami.control.DisplayFlags) */ @Override public void flagsChanged(GameObservable game) { mapPainter.flagsChanged(); } /** * Register listeners for all 100 <code>TileComponent</code>s. */ private void initTileListeners() { mapPainter.registerTileListeners(new MouseAdapter() { /* * (non-Javadoc) * * @see * java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent * ) */ @Override public void mouseClicked(MouseEvent e) { Object source = e.getSource(); TileComponent tile; if (source instanceof TileComponent) tile = (TileComponent) e.getSource(); else return; gameDisplayAdapter.tileClicked(tile.getPos()); } }); } }
[ "gordonmartin1980@gmail.com" ]
gordonmartin1980@gmail.com
18e67e50d3978ece75511de5905ea8bca6d48024
2de674129b7cbc12b006dcaed86b3c5f19d3f172
/welcomehelloworldupdated/src/main/java/com/spring/model/CartItem.java
a6c3055ca1196e2f6d6460e32dc30dc48463560f
[]
no_license
meena26/project
3266e2926b48f7188826a05025f39046291617c5
86b870695ff445e424dc0e9c61875ee946294c93
refs/heads/master
2021-01-12T14:45:38.937300
2016-10-27T06:25:28
2016-10-27T06:25:28
72,077,722
0
0
null
null
null
null
UTF-8
Java
false
false
1,183
java
package com.spring.model; import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; @Entity @Table(name="cartitem") public class CartItem implements Serializable { @Id @GeneratedValue(strategy=GenerationType.AUTO) private int cartItemId; private int quantity; private double Totalprice; @ManyToOne @JoinColumn(name="isbn") private Book book; @ManyToOne @JoinColumn(name="cartid") private Cart cart; public int getCartItemId() { return cartItemId; } public void setCartItemId(int cartItemId) { this.cartItemId = cartItemId; } public int getQuantity() { return quantity; } public void setQuantity(int quantity) { this.quantity = quantity; } public double getTotalPrice() { return Totalprice; } public void setTotalPrice(double price) { this.Totalprice = price; } public Book getBook() { return book; } public void setBook(Book book) { this.book = book; } public Cart getCart() { return cart; } public void setCart(Cart cart) { this.cart = cart; } }
[ "chavanmeena2@gmail.com" ]
chavanmeena2@gmail.com
8e5d040a4705b8309978900825b0a8c970c876ca
c9ff4c7d1c23a05b4e5e1e243325d6d004829511
/aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/CreateJobRequest.java
d40615a89162f19fd437fd9527ae04c8d97e9804
[ "Apache-2.0" ]
permissive
Purushotam-Thakur/aws-sdk-java
3c5789fe0b0dbd25e1ebfdd48dfd71e25a945f62
ab58baac6370f160b66da96d46afa57ba5bdee06
refs/heads/master
2020-07-22T23:27:57.700466
2019-09-06T23:28:26
2019-09-06T23:28:26
207,350,924
1
0
Apache-2.0
2019-09-09T16:11:46
2019-09-09T16:11:45
null
UTF-8
Java
false
false
65,008
java
/* * Copyright 2014-2019 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.glue.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.AmazonWebServiceRequest; /** * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/glue-2017-03-31/CreateJob" target="_top">AWS API * Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class CreateJobRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable { /** * <p> * The name you assign to this job definition. It must be unique in your account. * </p> */ private String name; /** * <p> * Description of the job being defined. * </p> */ private String description; /** * <p> * This field is reserved for future use. * </p> */ private String logUri; /** * <p> * The name or Amazon Resource Name (ARN) of the IAM role associated with this job. * </p> */ private String role; /** * <p> * An <code>ExecutionProperty</code> specifying the maximum number of concurrent runs allowed for this job. * </p> */ private ExecutionProperty executionProperty; /** * <p> * The <code>JobCommand</code> that executes this job. * </p> */ private JobCommand command; /** * <p> * The default arguments for this job. * </p> * <p> * You can specify arguments here that your own job-execution script consumes, as well as arguments that AWS Glue * itself consumes. * </p> * <p> * For information about how to specify and consume your own Job arguments, see the <a * href="https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-python-calling.html">Calling AWS Glue APIs * in Python</a> topic in the developer guide. * </p> * <p> * For information about the key-value pairs that AWS Glue consumes to set up your job, see the <a * href="https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-glue-arguments.html">Special Parameters * Used by AWS Glue</a> topic in the developer guide. * </p> */ private java.util.Map<String, String> defaultArguments; /** * <p> * The connections used for this job. * </p> */ private ConnectionsList connections; /** * <p> * The maximum number of times to retry this job if it fails. * </p> */ private Integer maxRetries; /** * <p> * This parameter is deprecated. Use <code>MaxCapacity</code> instead. * </p> * <p> * The number of AWS Glue data processing units (DPUs) to allocate to this Job. You can allocate from 2 to 100 DPUs; * the default is 10. A DPU is a relative measure of processing power that consists of 4 vCPUs of compute capacity * and 16 GB of memory. For more information, see the <a href="https://aws.amazon.com/glue/pricing/">AWS Glue * pricing page</a>. * </p> */ @Deprecated private Integer allocatedCapacity; /** * <p> * The job timeout in minutes. This is the maximum time that a job run can consume resources before it is terminated * and enters <code>TIMEOUT</code> status. The default is 2,880 minutes (48 hours). * </p> */ private Integer timeout; /** * <p> * The number of AWS Glue data processing units (DPUs) that can be allocated when this job runs. A DPU is a relative * measure of processing power that consists of 4 vCPUs of compute capacity and 16 GB of memory. For more * information, see the <a href="https://aws.amazon.com/glue/pricing/">AWS Glue pricing page</a>. * </p> * <p> * Do not set <code>Max Capacity</code> if using <code>WorkerType</code> and <code>NumberOfWorkers</code>. * </p> * <p> * The value that can be allocated for <code>MaxCapacity</code> depends on whether you are running a Python shell * job or an Apache Spark ETL job: * </p> * <ul> * <li> * <p> * When you specify a Python shell job (<code>JobCommand.Name</code>="pythonshell"), you can allocate either 0.0625 * or 1 DPU. The default is 0.0625 DPU. * </p> * </li> * <li> * <p> * When you specify an Apache Spark ETL job (<code>JobCommand.Name</code>="glueetl"), you can allocate from 2 to 100 * DPUs. The default is 10 DPUs. This job type cannot have a fractional DPU allocation. * </p> * </li> * </ul> */ private Double maxCapacity; /** * <p> * The name of the <code>SecurityConfiguration</code> structure to be used with this job. * </p> */ private String securityConfiguration; /** * <p> * The tags to use with this job. You may use tags to limit access to the job. For more information about tags in * AWS Glue, see <a href="https://docs.aws.amazon.com/glue/latest/dg/monitor-tags.html">AWS Tags in AWS Glue</a> in * the developer guide. * </p> */ private java.util.Map<String, String> tags; /** * <p> * Specifies configuration properties of a job notification. * </p> */ private NotificationProperty notificationProperty; /** * <p> * Glue version determines the versions of Apache Spark and Python that AWS Glue supports. The Python version * indicates the version supported for jobs of type Spark. * </p> * <p> * For more information about the available AWS Glue versions and corresponding Spark and Python versions, see <a * href="https://docs.aws.amazon.com/glue/latest/dg/add-job.html">Glue version</a> in the developer guide. * </p> * <p> * Jobs that are created without specifying a Glue version default to Glue 0.9. * </p> */ private String glueVersion; /** * <p> * The number of workers of a defined <code>workerType</code> that are allocated when a job runs. * </p> * <p> * The maximum number of workers you can define are 299 for <code>G.1X</code>, and 149 for <code>G.2X</code>. * </p> */ private Integer numberOfWorkers; /** * <p> * The type of predefined worker that is allocated when a job runs. Accepts a value of Standard, G.1X, or G.2X. * </p> * <ul> * <li> * <p> * For the <code>Standard</code> worker type, each worker provides 4 vCPU, 16 GB of memory and a 50GB disk, and 2 * executors per worker. * </p> * </li> * <li> * <p> * For the <code>G.1X</code> worker type, each worker maps to 1 DPU (4 vCPU, 16 GB of memory, 64 GB disk), and * provides 1 executor per worker. We recommend this worker type for memory-intensive jobs. * </p> * </li> * <li> * <p> * For the <code>G.2X</code> worker type, each worker maps to 2 DPU (8 vCPU, 32 GB of memory, 128 GB disk), and * provides 1 executor per worker. We recommend this worker type for memory-intensive jobs. * </p> * </li> * </ul> */ private String workerType; /** * <p> * The name you assign to this job definition. It must be unique in your account. * </p> * * @param name * The name you assign to this job definition. It must be unique in your account. */ public void setName(String name) { this.name = name; } /** * <p> * The name you assign to this job definition. It must be unique in your account. * </p> * * @return The name you assign to this job definition. It must be unique in your account. */ public String getName() { return this.name; } /** * <p> * The name you assign to this job definition. It must be unique in your account. * </p> * * @param name * The name you assign to this job definition. It must be unique in your account. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateJobRequest withName(String name) { setName(name); return this; } /** * <p> * Description of the job being defined. * </p> * * @param description * Description of the job being defined. */ public void setDescription(String description) { this.description = description; } /** * <p> * Description of the job being defined. * </p> * * @return Description of the job being defined. */ public String getDescription() { return this.description; } /** * <p> * Description of the job being defined. * </p> * * @param description * Description of the job being defined. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateJobRequest withDescription(String description) { setDescription(description); return this; } /** * <p> * This field is reserved for future use. * </p> * * @param logUri * This field is reserved for future use. */ public void setLogUri(String logUri) { this.logUri = logUri; } /** * <p> * This field is reserved for future use. * </p> * * @return This field is reserved for future use. */ public String getLogUri() { return this.logUri; } /** * <p> * This field is reserved for future use. * </p> * * @param logUri * This field is reserved for future use. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateJobRequest withLogUri(String logUri) { setLogUri(logUri); return this; } /** * <p> * The name or Amazon Resource Name (ARN) of the IAM role associated with this job. * </p> * * @param role * The name or Amazon Resource Name (ARN) of the IAM role associated with this job. */ public void setRole(String role) { this.role = role; } /** * <p> * The name or Amazon Resource Name (ARN) of the IAM role associated with this job. * </p> * * @return The name or Amazon Resource Name (ARN) of the IAM role associated with this job. */ public String getRole() { return this.role; } /** * <p> * The name or Amazon Resource Name (ARN) of the IAM role associated with this job. * </p> * * @param role * The name or Amazon Resource Name (ARN) of the IAM role associated with this job. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateJobRequest withRole(String role) { setRole(role); return this; } /** * <p> * An <code>ExecutionProperty</code> specifying the maximum number of concurrent runs allowed for this job. * </p> * * @param executionProperty * An <code>ExecutionProperty</code> specifying the maximum number of concurrent runs allowed for this job. */ public void setExecutionProperty(ExecutionProperty executionProperty) { this.executionProperty = executionProperty; } /** * <p> * An <code>ExecutionProperty</code> specifying the maximum number of concurrent runs allowed for this job. * </p> * * @return An <code>ExecutionProperty</code> specifying the maximum number of concurrent runs allowed for this job. */ public ExecutionProperty getExecutionProperty() { return this.executionProperty; } /** * <p> * An <code>ExecutionProperty</code> specifying the maximum number of concurrent runs allowed for this job. * </p> * * @param executionProperty * An <code>ExecutionProperty</code> specifying the maximum number of concurrent runs allowed for this job. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateJobRequest withExecutionProperty(ExecutionProperty executionProperty) { setExecutionProperty(executionProperty); return this; } /** * <p> * The <code>JobCommand</code> that executes this job. * </p> * * @param command * The <code>JobCommand</code> that executes this job. */ public void setCommand(JobCommand command) { this.command = command; } /** * <p> * The <code>JobCommand</code> that executes this job. * </p> * * @return The <code>JobCommand</code> that executes this job. */ public JobCommand getCommand() { return this.command; } /** * <p> * The <code>JobCommand</code> that executes this job. * </p> * * @param command * The <code>JobCommand</code> that executes this job. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateJobRequest withCommand(JobCommand command) { setCommand(command); return this; } /** * <p> * The default arguments for this job. * </p> * <p> * You can specify arguments here that your own job-execution script consumes, as well as arguments that AWS Glue * itself consumes. * </p> * <p> * For information about how to specify and consume your own Job arguments, see the <a * href="https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-python-calling.html">Calling AWS Glue APIs * in Python</a> topic in the developer guide. * </p> * <p> * For information about the key-value pairs that AWS Glue consumes to set up your job, see the <a * href="https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-glue-arguments.html">Special Parameters * Used by AWS Glue</a> topic in the developer guide. * </p> * * @return The default arguments for this job.</p> * <p> * You can specify arguments here that your own job-execution script consumes, as well as arguments that AWS * Glue itself consumes. * </p> * <p> * For information about how to specify and consume your own Job arguments, see the <a * href="https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-python-calling.html">Calling AWS * Glue APIs in Python</a> topic in the developer guide. * </p> * <p> * For information about the key-value pairs that AWS Glue consumes to set up your job, see the <a * href="https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-glue-arguments.html">Special * Parameters Used by AWS Glue</a> topic in the developer guide. */ public java.util.Map<String, String> getDefaultArguments() { return defaultArguments; } /** * <p> * The default arguments for this job. * </p> * <p> * You can specify arguments here that your own job-execution script consumes, as well as arguments that AWS Glue * itself consumes. * </p> * <p> * For information about how to specify and consume your own Job arguments, see the <a * href="https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-python-calling.html">Calling AWS Glue APIs * in Python</a> topic in the developer guide. * </p> * <p> * For information about the key-value pairs that AWS Glue consumes to set up your job, see the <a * href="https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-glue-arguments.html">Special Parameters * Used by AWS Glue</a> topic in the developer guide. * </p> * * @param defaultArguments * The default arguments for this job.</p> * <p> * You can specify arguments here that your own job-execution script consumes, as well as arguments that AWS * Glue itself consumes. * </p> * <p> * For information about how to specify and consume your own Job arguments, see the <a * href="https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-python-calling.html">Calling AWS * Glue APIs in Python</a> topic in the developer guide. * </p> * <p> * For information about the key-value pairs that AWS Glue consumes to set up your job, see the <a * href="https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-glue-arguments.html">Special * Parameters Used by AWS Glue</a> topic in the developer guide. */ public void setDefaultArguments(java.util.Map<String, String> defaultArguments) { this.defaultArguments = defaultArguments; } /** * <p> * The default arguments for this job. * </p> * <p> * You can specify arguments here that your own job-execution script consumes, as well as arguments that AWS Glue * itself consumes. * </p> * <p> * For information about how to specify and consume your own Job arguments, see the <a * href="https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-python-calling.html">Calling AWS Glue APIs * in Python</a> topic in the developer guide. * </p> * <p> * For information about the key-value pairs that AWS Glue consumes to set up your job, see the <a * href="https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-glue-arguments.html">Special Parameters * Used by AWS Glue</a> topic in the developer guide. * </p> * * @param defaultArguments * The default arguments for this job.</p> * <p> * You can specify arguments here that your own job-execution script consumes, as well as arguments that AWS * Glue itself consumes. * </p> * <p> * For information about how to specify and consume your own Job arguments, see the <a * href="https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-python-calling.html">Calling AWS * Glue APIs in Python</a> topic in the developer guide. * </p> * <p> * For information about the key-value pairs that AWS Glue consumes to set up your job, see the <a * href="https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-glue-arguments.html">Special * Parameters Used by AWS Glue</a> topic in the developer guide. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateJobRequest withDefaultArguments(java.util.Map<String, String> defaultArguments) { setDefaultArguments(defaultArguments); return this; } public CreateJobRequest addDefaultArgumentsEntry(String key, String value) { if (null == this.defaultArguments) { this.defaultArguments = new java.util.HashMap<String, String>(); } if (this.defaultArguments.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.defaultArguments.put(key, value); return this; } /** * Removes all the entries added into DefaultArguments. * * @return Returns a reference to this object so that method calls can be chained together. */ public CreateJobRequest clearDefaultArgumentsEntries() { this.defaultArguments = null; return this; } /** * <p> * The connections used for this job. * </p> * * @param connections * The connections used for this job. */ public void setConnections(ConnectionsList connections) { this.connections = connections; } /** * <p> * The connections used for this job. * </p> * * @return The connections used for this job. */ public ConnectionsList getConnections() { return this.connections; } /** * <p> * The connections used for this job. * </p> * * @param connections * The connections used for this job. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateJobRequest withConnections(ConnectionsList connections) { setConnections(connections); return this; } /** * <p> * The maximum number of times to retry this job if it fails. * </p> * * @param maxRetries * The maximum number of times to retry this job if it fails. */ public void setMaxRetries(Integer maxRetries) { this.maxRetries = maxRetries; } /** * <p> * The maximum number of times to retry this job if it fails. * </p> * * @return The maximum number of times to retry this job if it fails. */ public Integer getMaxRetries() { return this.maxRetries; } /** * <p> * The maximum number of times to retry this job if it fails. * </p> * * @param maxRetries * The maximum number of times to retry this job if it fails. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateJobRequest withMaxRetries(Integer maxRetries) { setMaxRetries(maxRetries); return this; } /** * <p> * This parameter is deprecated. Use <code>MaxCapacity</code> instead. * </p> * <p> * The number of AWS Glue data processing units (DPUs) to allocate to this Job. You can allocate from 2 to 100 DPUs; * the default is 10. A DPU is a relative measure of processing power that consists of 4 vCPUs of compute capacity * and 16 GB of memory. For more information, see the <a href="https://aws.amazon.com/glue/pricing/">AWS Glue * pricing page</a>. * </p> * * @param allocatedCapacity * This parameter is deprecated. Use <code>MaxCapacity</code> instead.</p> * <p> * The number of AWS Glue data processing units (DPUs) to allocate to this Job. You can allocate from 2 to * 100 DPUs; the default is 10. A DPU is a relative measure of processing power that consists of 4 vCPUs of * compute capacity and 16 GB of memory. For more information, see the <a * href="https://aws.amazon.com/glue/pricing/">AWS Glue pricing page</a>. */ @Deprecated public void setAllocatedCapacity(Integer allocatedCapacity) { this.allocatedCapacity = allocatedCapacity; } /** * <p> * This parameter is deprecated. Use <code>MaxCapacity</code> instead. * </p> * <p> * The number of AWS Glue data processing units (DPUs) to allocate to this Job. You can allocate from 2 to 100 DPUs; * the default is 10. A DPU is a relative measure of processing power that consists of 4 vCPUs of compute capacity * and 16 GB of memory. For more information, see the <a href="https://aws.amazon.com/glue/pricing/">AWS Glue * pricing page</a>. * </p> * * @return This parameter is deprecated. Use <code>MaxCapacity</code> instead.</p> * <p> * The number of AWS Glue data processing units (DPUs) to allocate to this Job. You can allocate from 2 to * 100 DPUs; the default is 10. A DPU is a relative measure of processing power that consists of 4 vCPUs of * compute capacity and 16 GB of memory. For more information, see the <a * href="https://aws.amazon.com/glue/pricing/">AWS Glue pricing page</a>. */ @Deprecated public Integer getAllocatedCapacity() { return this.allocatedCapacity; } /** * <p> * This parameter is deprecated. Use <code>MaxCapacity</code> instead. * </p> * <p> * The number of AWS Glue data processing units (DPUs) to allocate to this Job. You can allocate from 2 to 100 DPUs; * the default is 10. A DPU is a relative measure of processing power that consists of 4 vCPUs of compute capacity * and 16 GB of memory. For more information, see the <a href="https://aws.amazon.com/glue/pricing/">AWS Glue * pricing page</a>. * </p> * * @param allocatedCapacity * This parameter is deprecated. Use <code>MaxCapacity</code> instead.</p> * <p> * The number of AWS Glue data processing units (DPUs) to allocate to this Job. You can allocate from 2 to * 100 DPUs; the default is 10. A DPU is a relative measure of processing power that consists of 4 vCPUs of * compute capacity and 16 GB of memory. For more information, see the <a * href="https://aws.amazon.com/glue/pricing/">AWS Glue pricing page</a>. * @return Returns a reference to this object so that method calls can be chained together. */ @Deprecated public CreateJobRequest withAllocatedCapacity(Integer allocatedCapacity) { setAllocatedCapacity(allocatedCapacity); return this; } /** * <p> * The job timeout in minutes. This is the maximum time that a job run can consume resources before it is terminated * and enters <code>TIMEOUT</code> status. The default is 2,880 minutes (48 hours). * </p> * * @param timeout * The job timeout in minutes. This is the maximum time that a job run can consume resources before it is * terminated and enters <code>TIMEOUT</code> status. The default is 2,880 minutes (48 hours). */ public void setTimeout(Integer timeout) { this.timeout = timeout; } /** * <p> * The job timeout in minutes. This is the maximum time that a job run can consume resources before it is terminated * and enters <code>TIMEOUT</code> status. The default is 2,880 minutes (48 hours). * </p> * * @return The job timeout in minutes. This is the maximum time that a job run can consume resources before it is * terminated and enters <code>TIMEOUT</code> status. The default is 2,880 minutes (48 hours). */ public Integer getTimeout() { return this.timeout; } /** * <p> * The job timeout in minutes. This is the maximum time that a job run can consume resources before it is terminated * and enters <code>TIMEOUT</code> status. The default is 2,880 minutes (48 hours). * </p> * * @param timeout * The job timeout in minutes. This is the maximum time that a job run can consume resources before it is * terminated and enters <code>TIMEOUT</code> status. The default is 2,880 minutes (48 hours). * @return Returns a reference to this object so that method calls can be chained together. */ public CreateJobRequest withTimeout(Integer timeout) { setTimeout(timeout); return this; } /** * <p> * The number of AWS Glue data processing units (DPUs) that can be allocated when this job runs. A DPU is a relative * measure of processing power that consists of 4 vCPUs of compute capacity and 16 GB of memory. For more * information, see the <a href="https://aws.amazon.com/glue/pricing/">AWS Glue pricing page</a>. * </p> * <p> * Do not set <code>Max Capacity</code> if using <code>WorkerType</code> and <code>NumberOfWorkers</code>. * </p> * <p> * The value that can be allocated for <code>MaxCapacity</code> depends on whether you are running a Python shell * job or an Apache Spark ETL job: * </p> * <ul> * <li> * <p> * When you specify a Python shell job (<code>JobCommand.Name</code>="pythonshell"), you can allocate either 0.0625 * or 1 DPU. The default is 0.0625 DPU. * </p> * </li> * <li> * <p> * When you specify an Apache Spark ETL job (<code>JobCommand.Name</code>="glueetl"), you can allocate from 2 to 100 * DPUs. The default is 10 DPUs. This job type cannot have a fractional DPU allocation. * </p> * </li> * </ul> * * @param maxCapacity * The number of AWS Glue data processing units (DPUs) that can be allocated when this job runs. A DPU is a * relative measure of processing power that consists of 4 vCPUs of compute capacity and 16 GB of memory. For * more information, see the <a href="https://aws.amazon.com/glue/pricing/">AWS Glue pricing page</a>.</p> * <p> * Do not set <code>Max Capacity</code> if using <code>WorkerType</code> and <code>NumberOfWorkers</code>. * </p> * <p> * The value that can be allocated for <code>MaxCapacity</code> depends on whether you are running a Python * shell job or an Apache Spark ETL job: * </p> * <ul> * <li> * <p> * When you specify a Python shell job (<code>JobCommand.Name</code>="pythonshell"), you can allocate either * 0.0625 or 1 DPU. The default is 0.0625 DPU. * </p> * </li> * <li> * <p> * When you specify an Apache Spark ETL job (<code>JobCommand.Name</code>="glueetl"), you can allocate from 2 * to 100 DPUs. The default is 10 DPUs. This job type cannot have a fractional DPU allocation. * </p> * </li> */ public void setMaxCapacity(Double maxCapacity) { this.maxCapacity = maxCapacity; } /** * <p> * The number of AWS Glue data processing units (DPUs) that can be allocated when this job runs. A DPU is a relative * measure of processing power that consists of 4 vCPUs of compute capacity and 16 GB of memory. For more * information, see the <a href="https://aws.amazon.com/glue/pricing/">AWS Glue pricing page</a>. * </p> * <p> * Do not set <code>Max Capacity</code> if using <code>WorkerType</code> and <code>NumberOfWorkers</code>. * </p> * <p> * The value that can be allocated for <code>MaxCapacity</code> depends on whether you are running a Python shell * job or an Apache Spark ETL job: * </p> * <ul> * <li> * <p> * When you specify a Python shell job (<code>JobCommand.Name</code>="pythonshell"), you can allocate either 0.0625 * or 1 DPU. The default is 0.0625 DPU. * </p> * </li> * <li> * <p> * When you specify an Apache Spark ETL job (<code>JobCommand.Name</code>="glueetl"), you can allocate from 2 to 100 * DPUs. The default is 10 DPUs. This job type cannot have a fractional DPU allocation. * </p> * </li> * </ul> * * @return The number of AWS Glue data processing units (DPUs) that can be allocated when this job runs. A DPU is a * relative measure of processing power that consists of 4 vCPUs of compute capacity and 16 GB of memory. * For more information, see the <a href="https://aws.amazon.com/glue/pricing/">AWS Glue pricing * page</a>.</p> * <p> * Do not set <code>Max Capacity</code> if using <code>WorkerType</code> and <code>NumberOfWorkers</code>. * </p> * <p> * The value that can be allocated for <code>MaxCapacity</code> depends on whether you are running a Python * shell job or an Apache Spark ETL job: * </p> * <ul> * <li> * <p> * When you specify a Python shell job (<code>JobCommand.Name</code>="pythonshell"), you can allocate either * 0.0625 or 1 DPU. The default is 0.0625 DPU. * </p> * </li> * <li> * <p> * When you specify an Apache Spark ETL job (<code>JobCommand.Name</code>="glueetl"), you can allocate from * 2 to 100 DPUs. The default is 10 DPUs. This job type cannot have a fractional DPU allocation. * </p> * </li> */ public Double getMaxCapacity() { return this.maxCapacity; } /** * <p> * The number of AWS Glue data processing units (DPUs) that can be allocated when this job runs. A DPU is a relative * measure of processing power that consists of 4 vCPUs of compute capacity and 16 GB of memory. For more * information, see the <a href="https://aws.amazon.com/glue/pricing/">AWS Glue pricing page</a>. * </p> * <p> * Do not set <code>Max Capacity</code> if using <code>WorkerType</code> and <code>NumberOfWorkers</code>. * </p> * <p> * The value that can be allocated for <code>MaxCapacity</code> depends on whether you are running a Python shell * job or an Apache Spark ETL job: * </p> * <ul> * <li> * <p> * When you specify a Python shell job (<code>JobCommand.Name</code>="pythonshell"), you can allocate either 0.0625 * or 1 DPU. The default is 0.0625 DPU. * </p> * </li> * <li> * <p> * When you specify an Apache Spark ETL job (<code>JobCommand.Name</code>="glueetl"), you can allocate from 2 to 100 * DPUs. The default is 10 DPUs. This job type cannot have a fractional DPU allocation. * </p> * </li> * </ul> * * @param maxCapacity * The number of AWS Glue data processing units (DPUs) that can be allocated when this job runs. A DPU is a * relative measure of processing power that consists of 4 vCPUs of compute capacity and 16 GB of memory. For * more information, see the <a href="https://aws.amazon.com/glue/pricing/">AWS Glue pricing page</a>.</p> * <p> * Do not set <code>Max Capacity</code> if using <code>WorkerType</code> and <code>NumberOfWorkers</code>. * </p> * <p> * The value that can be allocated for <code>MaxCapacity</code> depends on whether you are running a Python * shell job or an Apache Spark ETL job: * </p> * <ul> * <li> * <p> * When you specify a Python shell job (<code>JobCommand.Name</code>="pythonshell"), you can allocate either * 0.0625 or 1 DPU. The default is 0.0625 DPU. * </p> * </li> * <li> * <p> * When you specify an Apache Spark ETL job (<code>JobCommand.Name</code>="glueetl"), you can allocate from 2 * to 100 DPUs. The default is 10 DPUs. This job type cannot have a fractional DPU allocation. * </p> * </li> * @return Returns a reference to this object so that method calls can be chained together. */ public CreateJobRequest withMaxCapacity(Double maxCapacity) { setMaxCapacity(maxCapacity); return this; } /** * <p> * The name of the <code>SecurityConfiguration</code> structure to be used with this job. * </p> * * @param securityConfiguration * The name of the <code>SecurityConfiguration</code> structure to be used with this job. */ public void setSecurityConfiguration(String securityConfiguration) { this.securityConfiguration = securityConfiguration; } /** * <p> * The name of the <code>SecurityConfiguration</code> structure to be used with this job. * </p> * * @return The name of the <code>SecurityConfiguration</code> structure to be used with this job. */ public String getSecurityConfiguration() { return this.securityConfiguration; } /** * <p> * The name of the <code>SecurityConfiguration</code> structure to be used with this job. * </p> * * @param securityConfiguration * The name of the <code>SecurityConfiguration</code> structure to be used with this job. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateJobRequest withSecurityConfiguration(String securityConfiguration) { setSecurityConfiguration(securityConfiguration); return this; } /** * <p> * The tags to use with this job. You may use tags to limit access to the job. For more information about tags in * AWS Glue, see <a href="https://docs.aws.amazon.com/glue/latest/dg/monitor-tags.html">AWS Tags in AWS Glue</a> in * the developer guide. * </p> * * @return The tags to use with this job. You may use tags to limit access to the job. For more information about * tags in AWS Glue, see <a href="https://docs.aws.amazon.com/glue/latest/dg/monitor-tags.html">AWS Tags in * AWS Glue</a> in the developer guide. */ public java.util.Map<String, String> getTags() { return tags; } /** * <p> * The tags to use with this job. You may use tags to limit access to the job. For more information about tags in * AWS Glue, see <a href="https://docs.aws.amazon.com/glue/latest/dg/monitor-tags.html">AWS Tags in AWS Glue</a> in * the developer guide. * </p> * * @param tags * The tags to use with this job. You may use tags to limit access to the job. For more information about * tags in AWS Glue, see <a href="https://docs.aws.amazon.com/glue/latest/dg/monitor-tags.html">AWS Tags in * AWS Glue</a> in the developer guide. */ public void setTags(java.util.Map<String, String> tags) { this.tags = tags; } /** * <p> * The tags to use with this job. You may use tags to limit access to the job. For more information about tags in * AWS Glue, see <a href="https://docs.aws.amazon.com/glue/latest/dg/monitor-tags.html">AWS Tags in AWS Glue</a> in * the developer guide. * </p> * * @param tags * The tags to use with this job. You may use tags to limit access to the job. For more information about * tags in AWS Glue, see <a href="https://docs.aws.amazon.com/glue/latest/dg/monitor-tags.html">AWS Tags in * AWS Glue</a> in the developer guide. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateJobRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; } public CreateJobRequest addTagsEntry(String key, String value) { if (null == this.tags) { this.tags = new java.util.HashMap<String, String>(); } if (this.tags.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.tags.put(key, value); return this; } /** * Removes all the entries added into Tags. * * @return Returns a reference to this object so that method calls can be chained together. */ public CreateJobRequest clearTagsEntries() { this.tags = null; return this; } /** * <p> * Specifies configuration properties of a job notification. * </p> * * @param notificationProperty * Specifies configuration properties of a job notification. */ public void setNotificationProperty(NotificationProperty notificationProperty) { this.notificationProperty = notificationProperty; } /** * <p> * Specifies configuration properties of a job notification. * </p> * * @return Specifies configuration properties of a job notification. */ public NotificationProperty getNotificationProperty() { return this.notificationProperty; } /** * <p> * Specifies configuration properties of a job notification. * </p> * * @param notificationProperty * Specifies configuration properties of a job notification. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateJobRequest withNotificationProperty(NotificationProperty notificationProperty) { setNotificationProperty(notificationProperty); return this; } /** * <p> * Glue version determines the versions of Apache Spark and Python that AWS Glue supports. The Python version * indicates the version supported for jobs of type Spark. * </p> * <p> * For more information about the available AWS Glue versions and corresponding Spark and Python versions, see <a * href="https://docs.aws.amazon.com/glue/latest/dg/add-job.html">Glue version</a> in the developer guide. * </p> * <p> * Jobs that are created without specifying a Glue version default to Glue 0.9. * </p> * * @param glueVersion * Glue version determines the versions of Apache Spark and Python that AWS Glue supports. The Python version * indicates the version supported for jobs of type Spark. </p> * <p> * For more information about the available AWS Glue versions and corresponding Spark and Python versions, * see <a href="https://docs.aws.amazon.com/glue/latest/dg/add-job.html">Glue version</a> in the developer * guide. * </p> * <p> * Jobs that are created without specifying a Glue version default to Glue 0.9. */ public void setGlueVersion(String glueVersion) { this.glueVersion = glueVersion; } /** * <p> * Glue version determines the versions of Apache Spark and Python that AWS Glue supports. The Python version * indicates the version supported for jobs of type Spark. * </p> * <p> * For more information about the available AWS Glue versions and corresponding Spark and Python versions, see <a * href="https://docs.aws.amazon.com/glue/latest/dg/add-job.html">Glue version</a> in the developer guide. * </p> * <p> * Jobs that are created without specifying a Glue version default to Glue 0.9. * </p> * * @return Glue version determines the versions of Apache Spark and Python that AWS Glue supports. The Python * version indicates the version supported for jobs of type Spark. </p> * <p> * For more information about the available AWS Glue versions and corresponding Spark and Python versions, * see <a href="https://docs.aws.amazon.com/glue/latest/dg/add-job.html">Glue version</a> in the developer * guide. * </p> * <p> * Jobs that are created without specifying a Glue version default to Glue 0.9. */ public String getGlueVersion() { return this.glueVersion; } /** * <p> * Glue version determines the versions of Apache Spark and Python that AWS Glue supports. The Python version * indicates the version supported for jobs of type Spark. * </p> * <p> * For more information about the available AWS Glue versions and corresponding Spark and Python versions, see <a * href="https://docs.aws.amazon.com/glue/latest/dg/add-job.html">Glue version</a> in the developer guide. * </p> * <p> * Jobs that are created without specifying a Glue version default to Glue 0.9. * </p> * * @param glueVersion * Glue version determines the versions of Apache Spark and Python that AWS Glue supports. The Python version * indicates the version supported for jobs of type Spark. </p> * <p> * For more information about the available AWS Glue versions and corresponding Spark and Python versions, * see <a href="https://docs.aws.amazon.com/glue/latest/dg/add-job.html">Glue version</a> in the developer * guide. * </p> * <p> * Jobs that are created without specifying a Glue version default to Glue 0.9. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateJobRequest withGlueVersion(String glueVersion) { setGlueVersion(glueVersion); return this; } /** * <p> * The number of workers of a defined <code>workerType</code> that are allocated when a job runs. * </p> * <p> * The maximum number of workers you can define are 299 for <code>G.1X</code>, and 149 for <code>G.2X</code>. * </p> * * @param numberOfWorkers * The number of workers of a defined <code>workerType</code> that are allocated when a job runs.</p> * <p> * The maximum number of workers you can define are 299 for <code>G.1X</code>, and 149 for <code>G.2X</code>. */ public void setNumberOfWorkers(Integer numberOfWorkers) { this.numberOfWorkers = numberOfWorkers; } /** * <p> * The number of workers of a defined <code>workerType</code> that are allocated when a job runs. * </p> * <p> * The maximum number of workers you can define are 299 for <code>G.1X</code>, and 149 for <code>G.2X</code>. * </p> * * @return The number of workers of a defined <code>workerType</code> that are allocated when a job runs.</p> * <p> * The maximum number of workers you can define are 299 for <code>G.1X</code>, and 149 for <code>G.2X</code>. */ public Integer getNumberOfWorkers() { return this.numberOfWorkers; } /** * <p> * The number of workers of a defined <code>workerType</code> that are allocated when a job runs. * </p> * <p> * The maximum number of workers you can define are 299 for <code>G.1X</code>, and 149 for <code>G.2X</code>. * </p> * * @param numberOfWorkers * The number of workers of a defined <code>workerType</code> that are allocated when a job runs.</p> * <p> * The maximum number of workers you can define are 299 for <code>G.1X</code>, and 149 for <code>G.2X</code>. * @return Returns a reference to this object so that method calls can be chained together. */ public CreateJobRequest withNumberOfWorkers(Integer numberOfWorkers) { setNumberOfWorkers(numberOfWorkers); return this; } /** * <p> * The type of predefined worker that is allocated when a job runs. Accepts a value of Standard, G.1X, or G.2X. * </p> * <ul> * <li> * <p> * For the <code>Standard</code> worker type, each worker provides 4 vCPU, 16 GB of memory and a 50GB disk, and 2 * executors per worker. * </p> * </li> * <li> * <p> * For the <code>G.1X</code> worker type, each worker maps to 1 DPU (4 vCPU, 16 GB of memory, 64 GB disk), and * provides 1 executor per worker. We recommend this worker type for memory-intensive jobs. * </p> * </li> * <li> * <p> * For the <code>G.2X</code> worker type, each worker maps to 2 DPU (8 vCPU, 32 GB of memory, 128 GB disk), and * provides 1 executor per worker. We recommend this worker type for memory-intensive jobs. * </p> * </li> * </ul> * * @param workerType * The type of predefined worker that is allocated when a job runs. Accepts a value of Standard, G.1X, or * G.2X.</p> * <ul> * <li> * <p> * For the <code>Standard</code> worker type, each worker provides 4 vCPU, 16 GB of memory and a 50GB disk, * and 2 executors per worker. * </p> * </li> * <li> * <p> * For the <code>G.1X</code> worker type, each worker maps to 1 DPU (4 vCPU, 16 GB of memory, 64 GB disk), * and provides 1 executor per worker. We recommend this worker type for memory-intensive jobs. * </p> * </li> * <li> * <p> * For the <code>G.2X</code> worker type, each worker maps to 2 DPU (8 vCPU, 32 GB of memory, 128 GB disk), * and provides 1 executor per worker. We recommend this worker type for memory-intensive jobs. * </p> * </li> * @see WorkerType */ public void setWorkerType(String workerType) { this.workerType = workerType; } /** * <p> * The type of predefined worker that is allocated when a job runs. Accepts a value of Standard, G.1X, or G.2X. * </p> * <ul> * <li> * <p> * For the <code>Standard</code> worker type, each worker provides 4 vCPU, 16 GB of memory and a 50GB disk, and 2 * executors per worker. * </p> * </li> * <li> * <p> * For the <code>G.1X</code> worker type, each worker maps to 1 DPU (4 vCPU, 16 GB of memory, 64 GB disk), and * provides 1 executor per worker. We recommend this worker type for memory-intensive jobs. * </p> * </li> * <li> * <p> * For the <code>G.2X</code> worker type, each worker maps to 2 DPU (8 vCPU, 32 GB of memory, 128 GB disk), and * provides 1 executor per worker. We recommend this worker type for memory-intensive jobs. * </p> * </li> * </ul> * * @return The type of predefined worker that is allocated when a job runs. Accepts a value of Standard, G.1X, or * G.2X.</p> * <ul> * <li> * <p> * For the <code>Standard</code> worker type, each worker provides 4 vCPU, 16 GB of memory and a 50GB disk, * and 2 executors per worker. * </p> * </li> * <li> * <p> * For the <code>G.1X</code> worker type, each worker maps to 1 DPU (4 vCPU, 16 GB of memory, 64 GB disk), * and provides 1 executor per worker. We recommend this worker type for memory-intensive jobs. * </p> * </li> * <li> * <p> * For the <code>G.2X</code> worker type, each worker maps to 2 DPU (8 vCPU, 32 GB of memory, 128 GB disk), * and provides 1 executor per worker. We recommend this worker type for memory-intensive jobs. * </p> * </li> * @see WorkerType */ public String getWorkerType() { return this.workerType; } /** * <p> * The type of predefined worker that is allocated when a job runs. Accepts a value of Standard, G.1X, or G.2X. * </p> * <ul> * <li> * <p> * For the <code>Standard</code> worker type, each worker provides 4 vCPU, 16 GB of memory and a 50GB disk, and 2 * executors per worker. * </p> * </li> * <li> * <p> * For the <code>G.1X</code> worker type, each worker maps to 1 DPU (4 vCPU, 16 GB of memory, 64 GB disk), and * provides 1 executor per worker. We recommend this worker type for memory-intensive jobs. * </p> * </li> * <li> * <p> * For the <code>G.2X</code> worker type, each worker maps to 2 DPU (8 vCPU, 32 GB of memory, 128 GB disk), and * provides 1 executor per worker. We recommend this worker type for memory-intensive jobs. * </p> * </li> * </ul> * * @param workerType * The type of predefined worker that is allocated when a job runs. Accepts a value of Standard, G.1X, or * G.2X.</p> * <ul> * <li> * <p> * For the <code>Standard</code> worker type, each worker provides 4 vCPU, 16 GB of memory and a 50GB disk, * and 2 executors per worker. * </p> * </li> * <li> * <p> * For the <code>G.1X</code> worker type, each worker maps to 1 DPU (4 vCPU, 16 GB of memory, 64 GB disk), * and provides 1 executor per worker. We recommend this worker type for memory-intensive jobs. * </p> * </li> * <li> * <p> * For the <code>G.2X</code> worker type, each worker maps to 2 DPU (8 vCPU, 32 GB of memory, 128 GB disk), * and provides 1 executor per worker. We recommend this worker type for memory-intensive jobs. * </p> * </li> * @return Returns a reference to this object so that method calls can be chained together. * @see WorkerType */ public CreateJobRequest withWorkerType(String workerType) { setWorkerType(workerType); return this; } /** * <p> * The type of predefined worker that is allocated when a job runs. Accepts a value of Standard, G.1X, or G.2X. * </p> * <ul> * <li> * <p> * For the <code>Standard</code> worker type, each worker provides 4 vCPU, 16 GB of memory and a 50GB disk, and 2 * executors per worker. * </p> * </li> * <li> * <p> * For the <code>G.1X</code> worker type, each worker maps to 1 DPU (4 vCPU, 16 GB of memory, 64 GB disk), and * provides 1 executor per worker. We recommend this worker type for memory-intensive jobs. * </p> * </li> * <li> * <p> * For the <code>G.2X</code> worker type, each worker maps to 2 DPU (8 vCPU, 32 GB of memory, 128 GB disk), and * provides 1 executor per worker. We recommend this worker type for memory-intensive jobs. * </p> * </li> * </ul> * * @param workerType * The type of predefined worker that is allocated when a job runs. Accepts a value of Standard, G.1X, or * G.2X.</p> * <ul> * <li> * <p> * For the <code>Standard</code> worker type, each worker provides 4 vCPU, 16 GB of memory and a 50GB disk, * and 2 executors per worker. * </p> * </li> * <li> * <p> * For the <code>G.1X</code> worker type, each worker maps to 1 DPU (4 vCPU, 16 GB of memory, 64 GB disk), * and provides 1 executor per worker. We recommend this worker type for memory-intensive jobs. * </p> * </li> * <li> * <p> * For the <code>G.2X</code> worker type, each worker maps to 2 DPU (8 vCPU, 32 GB of memory, 128 GB disk), * and provides 1 executor per worker. We recommend this worker type for memory-intensive jobs. * </p> * </li> * @return Returns a reference to this object so that method calls can be chained together. * @see WorkerType */ public CreateJobRequest withWorkerType(WorkerType workerType) { this.workerType = workerType.toString(); 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 (getName() != null) sb.append("Name: ").append(getName()).append(","); if (getDescription() != null) sb.append("Description: ").append(getDescription()).append(","); if (getLogUri() != null) sb.append("LogUri: ").append(getLogUri()).append(","); if (getRole() != null) sb.append("Role: ").append(getRole()).append(","); if (getExecutionProperty() != null) sb.append("ExecutionProperty: ").append(getExecutionProperty()).append(","); if (getCommand() != null) sb.append("Command: ").append(getCommand()).append(","); if (getDefaultArguments() != null) sb.append("DefaultArguments: ").append(getDefaultArguments()).append(","); if (getConnections() != null) sb.append("Connections: ").append(getConnections()).append(","); if (getMaxRetries() != null) sb.append("MaxRetries: ").append(getMaxRetries()).append(","); if (getAllocatedCapacity() != null) sb.append("AllocatedCapacity: ").append(getAllocatedCapacity()).append(","); if (getTimeout() != null) sb.append("Timeout: ").append(getTimeout()).append(","); if (getMaxCapacity() != null) sb.append("MaxCapacity: ").append(getMaxCapacity()).append(","); if (getSecurityConfiguration() != null) sb.append("SecurityConfiguration: ").append(getSecurityConfiguration()).append(","); if (getTags() != null) sb.append("Tags: ").append(getTags()).append(","); if (getNotificationProperty() != null) sb.append("NotificationProperty: ").append(getNotificationProperty()).append(","); if (getGlueVersion() != null) sb.append("GlueVersion: ").append(getGlueVersion()).append(","); if (getNumberOfWorkers() != null) sb.append("NumberOfWorkers: ").append(getNumberOfWorkers()).append(","); if (getWorkerType() != null) sb.append("WorkerType: ").append(getWorkerType()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CreateJobRequest == false) return false; CreateJobRequest other = (CreateJobRequest) obj; if (other.getName() == null ^ this.getName() == null) return false; if (other.getName() != null && other.getName().equals(this.getName()) == false) return false; if (other.getDescription() == null ^ this.getDescription() == null) return false; if (other.getDescription() != null && other.getDescription().equals(this.getDescription()) == false) return false; if (other.getLogUri() == null ^ this.getLogUri() == null) return false; if (other.getLogUri() != null && other.getLogUri().equals(this.getLogUri()) == false) return false; if (other.getRole() == null ^ this.getRole() == null) return false; if (other.getRole() != null && other.getRole().equals(this.getRole()) == false) return false; if (other.getExecutionProperty() == null ^ this.getExecutionProperty() == null) return false; if (other.getExecutionProperty() != null && other.getExecutionProperty().equals(this.getExecutionProperty()) == false) return false; if (other.getCommand() == null ^ this.getCommand() == null) return false; if (other.getCommand() != null && other.getCommand().equals(this.getCommand()) == false) return false; if (other.getDefaultArguments() == null ^ this.getDefaultArguments() == null) return false; if (other.getDefaultArguments() != null && other.getDefaultArguments().equals(this.getDefaultArguments()) == false) return false; if (other.getConnections() == null ^ this.getConnections() == null) return false; if (other.getConnections() != null && other.getConnections().equals(this.getConnections()) == false) return false; if (other.getMaxRetries() == null ^ this.getMaxRetries() == null) return false; if (other.getMaxRetries() != null && other.getMaxRetries().equals(this.getMaxRetries()) == false) return false; if (other.getAllocatedCapacity() == null ^ this.getAllocatedCapacity() == null) return false; if (other.getAllocatedCapacity() != null && other.getAllocatedCapacity().equals(this.getAllocatedCapacity()) == false) return false; if (other.getTimeout() == null ^ this.getTimeout() == null) return false; if (other.getTimeout() != null && other.getTimeout().equals(this.getTimeout()) == false) return false; if (other.getMaxCapacity() == null ^ this.getMaxCapacity() == null) return false; if (other.getMaxCapacity() != null && other.getMaxCapacity().equals(this.getMaxCapacity()) == false) return false; if (other.getSecurityConfiguration() == null ^ this.getSecurityConfiguration() == null) return false; if (other.getSecurityConfiguration() != null && other.getSecurityConfiguration().equals(this.getSecurityConfiguration()) == false) return false; if (other.getTags() == null ^ this.getTags() == null) return false; if (other.getTags() != null && other.getTags().equals(this.getTags()) == false) return false; if (other.getNotificationProperty() == null ^ this.getNotificationProperty() == null) return false; if (other.getNotificationProperty() != null && other.getNotificationProperty().equals(this.getNotificationProperty()) == false) return false; if (other.getGlueVersion() == null ^ this.getGlueVersion() == null) return false; if (other.getGlueVersion() != null && other.getGlueVersion().equals(this.getGlueVersion()) == false) return false; if (other.getNumberOfWorkers() == null ^ this.getNumberOfWorkers() == null) return false; if (other.getNumberOfWorkers() != null && other.getNumberOfWorkers().equals(this.getNumberOfWorkers()) == false) return false; if (other.getWorkerType() == null ^ this.getWorkerType() == null) return false; if (other.getWorkerType() != null && other.getWorkerType().equals(this.getWorkerType()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode()); hashCode = prime * hashCode + ((getLogUri() == null) ? 0 : getLogUri().hashCode()); hashCode = prime * hashCode + ((getRole() == null) ? 0 : getRole().hashCode()); hashCode = prime * hashCode + ((getExecutionProperty() == null) ? 0 : getExecutionProperty().hashCode()); hashCode = prime * hashCode + ((getCommand() == null) ? 0 : getCommand().hashCode()); hashCode = prime * hashCode + ((getDefaultArguments() == null) ? 0 : getDefaultArguments().hashCode()); hashCode = prime * hashCode + ((getConnections() == null) ? 0 : getConnections().hashCode()); hashCode = prime * hashCode + ((getMaxRetries() == null) ? 0 : getMaxRetries().hashCode()); hashCode = prime * hashCode + ((getAllocatedCapacity() == null) ? 0 : getAllocatedCapacity().hashCode()); hashCode = prime * hashCode + ((getTimeout() == null) ? 0 : getTimeout().hashCode()); hashCode = prime * hashCode + ((getMaxCapacity() == null) ? 0 : getMaxCapacity().hashCode()); hashCode = prime * hashCode + ((getSecurityConfiguration() == null) ? 0 : getSecurityConfiguration().hashCode()); hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); hashCode = prime * hashCode + ((getNotificationProperty() == null) ? 0 : getNotificationProperty().hashCode()); hashCode = prime * hashCode + ((getGlueVersion() == null) ? 0 : getGlueVersion().hashCode()); hashCode = prime * hashCode + ((getNumberOfWorkers() == null) ? 0 : getNumberOfWorkers().hashCode()); hashCode = prime * hashCode + ((getWorkerType() == null) ? 0 : getWorkerType().hashCode()); return hashCode; } @Override public CreateJobRequest clone() { return (CreateJobRequest) super.clone(); } }
[ "" ]
b04de3a7902337d87fb7d3635060c05830d509b3
49b1b15740c788b8b2248db5d3053ae5b1673148
/src/DoublyLinkedList/DLinkNode.java
8a9c80ff6fa5b329d4998ec4d2c6f270a782d405
[]
no_license
avinash273/algorithm
24c6a14aed29bda2928734c60d42956c948052fd
e7eb742ee9ef6cd02df3bfb1aaf63a28f0125155
refs/heads/master
2020-09-06T22:00:10.259159
2020-02-13T03:47:26
2020-02-13T03:47:26
220,567,093
0
0
null
null
null
null
UTF-8
Java
false
false
763
java
package DoublyLinkedList; public class DLinkNode { private int data; private DLinkNode nextNode; private DLinkNode previousNode; public DLinkNode(int data) { this.data = data; } public int getData() { return data; } public void setData(int data) { this.data = data; } public DLinkNode getNextNode() { return nextNode; } public void setNextNode(DLinkNode nextNode) { this.nextNode = nextNode; } public DLinkNode getPreviousNode() { return previousNode; } public void setPreviousNode(DLinkNode previousNode) { this.previousNode = previousNode; } @Override public String toString() { return this.data + "->"; } }
[ "avinash.shanker@mavs.uta.edu" ]
avinash.shanker@mavs.uta.edu
09e1b2e5e65a9cc32684d68c49066a6f8c841052
dbad45915eb54607e4d74c33e0a274c713499682
/app/src/main/java/com/example/wearecoders/myfirstproject/RegisterActivity.java
86b051e0f70c74d4a1c815ab26630949adcd548b
[]
no_license
andywac17/DatingDescriptionMvp
4280716cdb498d6285fc3e66a7e8dc8322769280
4de10face25f3ba929e894dc57f6b3432e872461
refs/heads/master
2021-04-28T10:08:47.088559
2018-02-19T12:31:37
2018-02-19T12:31:37
122,059,582
0
0
null
null
null
null
UTF-8
Java
false
false
6,262
java
package com.example.wearecoders.myfirstproject; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.provider.Settings; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.Toast; import com.example.wearecoders.myfirstproject.Utils.AppController; import com.example.wearecoders.myfirstproject.Utils.Config; import com.example.wearecoders.myfirstproject.Utils.Constants; import com.facebook.CallbackManager; import com.facebook.FacebookCallback; import com.facebook.FacebookException; import com.facebook.FacebookSdk; import com.facebook.LoggingBehavior; import com.facebook.login.LoginResult; import com.facebook.login.widget.LoginButton; import com.google.firebase.FirebaseApp; import com.google.firebase.iid.FirebaseInstanceId; import com.google.gson.Gson; import java.util.Arrays; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; /** * Created by We Are Coders on 2/7/2018. */ public class RegisterActivity extends AppCompatActivity { private final String TAG = RegisterActivity.class.getSimpleName(); @BindView(R.id.firstname) EditText firstname; @BindView(R.id.lastname) EditText lastname; @BindView(R.id.dob) EditText dob; @BindView(R.id.interested) EditText interested; @BindView(R.id.country) EditText country; @BindView(R.id.zipcode) EditText postcode; @BindView(R.id.fb_login) ImageView fbLogin; @BindView(R.id.login_button) LoginButton loginButton; private CallbackManager callbackManager; ProgressDialog progressDialog; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); FacebookSdk.sdkInitialize(getApplicationContext()); setContentView(R.layout.activity_register); ButterKnife.bind(this); callbackManager = CallbackManager.Factory.create(); FacebookSdk.addLoggingBehavior(LoggingBehavior.REQUESTS); facebookLogin(); } private String getfcm() { FirebaseApp.initializeApp(this); return FirebaseInstanceId.getInstance().getToken();//Token generation } @OnClick(R.id.fb_login) public void next(View view) { String token = getfcm(); switch (view.getId()) { case R.id.fb_login: if (token != null) loginButton.performClick(); else Toast.makeText(this, R.string.appnotintial, Toast.LENGTH_SHORT).show(); break; }} private void facebookLogin() { loginButton.setReadPermissions(Arrays.asList("public_profile,email")); loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { login_facebook(loginResult.getAccessToken().getToken(), null, null, null); } @Override public void onCancel() { Log.e("RegisterActivity", "cancel"); } @Override public void onError(FacebookException error) { Log.e("RegisterActivity", error.getMessage()); } }); } public static String getdeviceid(Context context) { return Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); } private void validlogin(JSON_Result json_result) { Log.e(TAG, "validlogin" + new Gson().toJson(json_result)); if (json_result.isStatus()) { if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); } if (json_result.getData() != null) { Gson gson = new Gson(); Log.e(TAG, "login" + gson.toJson(json_result.getData())); AppController.getInstance().getPref().edit().putString(Constants.LOGGED_IN, gson.toJson(json_result.getData())).commit(); Intent intent = new Intent(RegisterActivity.this, SecondActivity.class); startActivity(intent); finish(); } } else { progressDialog.dismiss(); } } private void login_facebook(String access_token, String emial, String name, String pic) { progressDialog = new ProgressDialog(RegisterActivity.this); progressDialog.setMessage("Please wait..."); progressDialog.setCancelable(false); progressDialog.show(); Config config = AppController.getInstance().getConfig(); Call<JSON_Result> call = null; if (access_token != null) { call = config.login_facebook(access_token, getfcm(), RegisterActivity.getdeviceid(getApplicationContext()), Constants.DEVICE_TYPE, Constants.FROM_FACEBOOK); } else { ///nothing to write. } call.enqueue(new Callback<JSON_Result>() { @Override public void onResponse(Call<JSON_Result> call, Response<JSON_Result> response) { /* {"status":true,"message":"Your Password Email Has Been Sent To Your Registered Email Please Check"}*/ Log.e(TAG, "response:"); try { Log.e(TAG, response.body().toString()); validlogin(response.body()); } catch (Exception e) { Log.e(TAG, "error"); if (progressDialog != null && progressDialog.isShowing()) progressDialog.dismiss(); Toast.makeText(RegisterActivity.this, "Error in Json server " + e.getMessage(), Toast.LENGTH_SHORT).show(); } } @Override public void onFailure(Call<JSON_Result> call, Throwable t) { Log.e(TAG, "error :" + t.getMessage()); } }); } }
[ "35330445+andywac17@users.noreply.github.com" ]
35330445+andywac17@users.noreply.github.com
b476b047ecf937f2ffae3467c65e69edd45c7e28
1b596b0ecf32236a0af5d6d088c9ebd9d2095476
/src/main/java/com/trycore/planets/service/ServiceImpl.java
ee51c01a24d8823e9dd03878ac250e971fbd435b
[]
no_license
jsovalles/spring-boot-planets
de6321e5ed25792422b3ffb8923f0d166ea11e1b
76116c138f3f02204eb69f2b1948f46538525457
refs/heads/master
2022-12-08T04:53:41.131101
2020-08-06T20:40:01
2020-08-06T20:40:01
285,638,922
0
0
null
null
null
null
UTF-8
Java
false
false
1,198
java
package com.trycore.planets.service; import com.trycore.planets.dao.IPersonaDAO; import com.trycore.planets.dao.IPlanetasDAO; import com.trycore.planets.dao.entity.Persona; import com.trycore.planets.dao.entity.Planeta; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class ServiceImpl { @Autowired IPlanetasDAO daoPlanetas; @Autowired IPersonaDAO daoPersonas; public List<Planeta> listPlanetas(){ return daoPlanetas.findAll(); } public Planeta getPlaneta(int id){ Planeta planeta = daoPlanetas.findById(id).orElse(null); planeta.setContador(planeta.getContador() + 1); daoPlanetas.save(planeta); return planeta; } public List<Persona> listPersonas(){ return daoPersonas.findAll();} public Persona getPersona(int id){ Persona persona = daoPersonas.findById(id).orElse(null); persona.setNumeroVisitas(persona.getNumeroVisitas() + 1); persona.getPlaneta().setContador(persona.getPlaneta().getContador() + 1); daoPersonas.save(persona); return persona; } }
[ "jsovalles95@gmail.com" ]
jsovalles95@gmail.com
93a5c677b355e37d3b2133feb47a5dba819ca1f3
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/bazelbuild--bazel/74f24c1cee9e0522b3a0fdcfe40e47191f3c3973/after/ZipDecompressor.java
cc47ae280d75898a3bbb8aa14da20fd86fa63ccf
[]
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
6,650
java
// Copyright 2015 The Bazel Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.devtools.build.lib.bazel.repository; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Optional; import com.google.devtools.build.lib.bazel.repository.DecompressorValue.Decompressor; import com.google.devtools.build.lib.rules.repository.RepositoryFunction.RepositoryFunctionException; import com.google.devtools.build.lib.vfs.FileSystemUtils; import com.google.devtools.build.lib.vfs.Path; import com.google.devtools.build.lib.vfs.PathFragment; import com.google.devtools.build.skyframe.SkyFunctionException.Transience; import com.google.devtools.build.zip.ZipFileEntry; import com.google.devtools.build.zip.ZipReader; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; import java.nio.file.StandardCopyOption; import java.util.Collection; import javax.annotation.Nullable; /** * Creates a repository by decompressing a zip file. */ public class ZipDecompressor implements Decompressor { public static final Decompressor INSTANCE = new ZipDecompressor(); private ZipDecompressor() { } private static final int S_IFDIR = 040000; private static final int S_IFREG = 0100000; private static final int EXECUTABLE_MASK = 0755; @VisibleForTesting static final int WINDOWS_DIRECTORY = 0x10; @VisibleForTesting static final int WINDOWS_FILE = 0x20; /** * This unzips the zip file to a sibling directory of {@link DecompressorDescriptor#archivePath}. * The zip file is expected to have the WORKSPACE file at the top level, e.g.: * * <pre> * $ unzip -lf some-repo.zip * Archive: ../repo.zip * Length Date Time Name * --------- ---------- ----- ---- * 0 2014-11-20 15:50 WORKSPACE * 0 2014-11-20 16:10 foo/ * 236 2014-11-20 15:52 foo/BUILD * ... * </pre> */ @Override @Nullable public Path decompress(DecompressorDescriptor descriptor) throws RepositoryFunctionException { Path destinationDirectory = descriptor.archivePath().getParentDirectory(); Optional<String> prefix = descriptor.prefix(); boolean foundPrefix = false; try (ZipReader reader = new ZipReader(descriptor.archivePath().getPathFile())) { Collection<ZipFileEntry> entries = reader.entries(); for (ZipFileEntry entry : entries) { StripPrefixedPath entryPath = StripPrefixedPath.maybeDeprefix(entry.getName(), prefix); foundPrefix = foundPrefix || entryPath.foundPrefix(); if (entryPath.skip()) { continue; } extractZipEntry(reader, entry, destinationDirectory, entryPath.getPathFragment()); } } catch (IOException e) { throw new RepositoryFunctionException(new IOException( String.format("Error extracting %s to %s: %s", descriptor.archivePath(), destinationDirectory, e.getMessage())), Transience.TRANSIENT); } if (prefix.isPresent() && !foundPrefix) { throw new RepositoryFunctionException( new IOException("Prefix " + prefix.get() + " was given, but not found in the zip"), Transience.PERSISTENT); } return destinationDirectory; } private void extractZipEntry( ZipReader reader, ZipFileEntry entry, Path destinationDirectory, PathFragment strippedRelativePath) throws IOException { if (strippedRelativePath.isAbsolute()) { throw new IOException( String.format( "Failed to extract %s, zipped paths cannot be absolute", strippedRelativePath)); } Path outputPath = destinationDirectory.getRelative(strippedRelativePath); int permissions = getPermissions(entry.getExternalAttributes(), entry.getName()); FileSystemUtils.createDirectoryAndParents(outputPath.getParentDirectory()); boolean isDirectory = (permissions & 040000) == 040000; if (isDirectory) { FileSystemUtils.createDirectoryAndParents(outputPath); } else { // TODO(kchodorow): should be able to be removed when issue #236 is resolved, but for now // this delete+rewrite is required or the build will error out if outputPath exists here. // The zip file is not re-unzipped when the WORKSPACE file is changed (because it is assumed // to be immutable) but is on server restart (which is a bug). File outputFile = outputPath.getPathFile(); try (InputStream input = reader.getInputStream(entry)) { Files.copy(input, outputFile.toPath(), StandardCopyOption.REPLACE_EXISTING); } outputPath.chmod(permissions); } } @VisibleForTesting static int getPermissions(int permissions, String path) throws IOException { // Sometimes zip files list directories as being "regular" executable files (i.e., 0100755). // I'm looking at you, Go AppEngine SDK 1.9.37 (see #1263 for details). if (path.endsWith("/")) { return S_IFDIR | EXECUTABLE_MASK; } // Posix permissions are in the high-order 2 bytes of the external attributes. After this // operation, permissions holds 0100755 (or 040755 for directories). int shiftedPermissions = permissions >>> 16; if (shiftedPermissions != 0) { return shiftedPermissions; } // If this was zipped up on FAT, it won't have posix permissions set. Instead, this // checks if extra attributes is set to 0 for files. From // https://github.com/miloyip/rapidjson/archive/v1.0.2.zip, it looks like executables end up // with "normal" (posix) permissions (oddly), so they'll be handled above. int windowsPermission = permissions & 0xff; if ((windowsPermission & WINDOWS_DIRECTORY) == WINDOWS_DIRECTORY) { // Directory. return S_IFDIR | EXECUTABLE_MASK; } else if (permissions == 0 || (windowsPermission & WINDOWS_FILE) == WINDOWS_FILE) { // File. return S_IFREG | EXECUTABLE_MASK; } // No idea. throw new IOException("Unrecognized file mode for " + path + ": 0x" + Integer.toHexString(permissions)); } }
[ "fraczwojciech@gmail.com" ]
fraczwojciech@gmail.com
d054cb02a12975055086e300559c0d382e469085
83718884562d7df8706f76f8d23c90585ee80d6c
/src/main/java/rmi/demo/springtestdbunitdemo/api/advice/exception/NotFoundException.java
187ed7b908f3712cc7c99fbd81cfb6a2a46d7549
[]
no_license
northernbird/spring-test-dbunit-demo
1d3d026bbc40714d848db2ea864358e08800418a
4fcab6ae72c63d2ee1efa818dd06ce9130b8f430
refs/heads/master
2021-04-22T01:26:26.145849
2020-03-30T12:41:58
2020-03-30T12:41:58
249,839,148
0
0
null
null
null
null
UTF-8
Java
false
false
307
java
package rmi.demo.springtestdbunitdemo.api.advice.exception; import lombok.Getter; import lombok.Setter; @Getter @Setter public class NotFoundException extends RuntimeException { private String errorMessage; public NotFoundException(String errorMessage) { this.errorMessage = errorMessage; } }
[ "northernbird98@gmail.com" ]
northernbird98@gmail.com
e33c2dfdffdbc3ed513e00d3b3d5e0b39f7d379d
9254e7279570ac8ef687c416a79bb472146e9b35
/pai-dlc-20201203/src/main/java/com/aliyun/pai_dlc20201203/models/GetDataSourceResponseBody.java
38e4fe53a0448bc1095bec728af43b9ce44f05fa
[ "Apache-2.0" ]
permissive
lquterqtd/alibabacloud-java-sdk
3eaa17276dd28004dae6f87e763e13eb90c30032
3e5dca8c36398469e10cdaaa34c314ae0bb640b4
refs/heads/master
2023-08-12T13:56:26.379027
2021-10-19T07:22:15
2021-10-19T07:22:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,308
java
// This file is auto-generated, don't edit it. Thanks. package com.aliyun.pai_dlc20201203.models; import com.aliyun.tea.*; public class GetDataSourceResponseBody extends TeaModel { // 数据源类型 @NameInMap("DataSourceType") public String dataSourceType; // 数据源Id @NameInMap("DataSourceId") public String dataSourceId; // 数据源显示名称 @NameInMap("DisplayName") public String displayName; // 数据源描述 @NameInMap("Description") public String description; // 阿里云NAS文件系统Id @NameInMap("FileSystemId") public String fileSystemId; // 阿里云OSS文件系统路径 @NameInMap("Path") public String path; // 阿里云OSS文件系统服务端点 @NameInMap("Endpoint") public String endpoint; // 阿里云OSS文件系统配置选项 @NameInMap("Options") public String options; // 本地挂载目录 @NameInMap("MountPath") public String mountPath; // 创建人Id @NameInMap("UserId") public String userId; // 创建时间(UTC) @NameInMap("GmtCreateTime") public String gmtCreateTime; // 修改时间(UTC) @NameInMap("GmtModifyTime") public String gmtModifyTime; // 请求Id @NameInMap("RequestId") public String requestId; public static GetDataSourceResponseBody build(java.util.Map<String, ?> map) throws Exception { GetDataSourceResponseBody self = new GetDataSourceResponseBody(); return TeaModel.build(map, self); } public GetDataSourceResponseBody setDataSourceType(String dataSourceType) { this.dataSourceType = dataSourceType; return this; } public String getDataSourceType() { return this.dataSourceType; } public GetDataSourceResponseBody setDataSourceId(String dataSourceId) { this.dataSourceId = dataSourceId; return this; } public String getDataSourceId() { return this.dataSourceId; } public GetDataSourceResponseBody setDisplayName(String displayName) { this.displayName = displayName; return this; } public String getDisplayName() { return this.displayName; } public GetDataSourceResponseBody setDescription(String description) { this.description = description; return this; } public String getDescription() { return this.description; } public GetDataSourceResponseBody setFileSystemId(String fileSystemId) { this.fileSystemId = fileSystemId; return this; } public String getFileSystemId() { return this.fileSystemId; } public GetDataSourceResponseBody setPath(String path) { this.path = path; return this; } public String getPath() { return this.path; } public GetDataSourceResponseBody setEndpoint(String endpoint) { this.endpoint = endpoint; return this; } public String getEndpoint() { return this.endpoint; } public GetDataSourceResponseBody setOptions(String options) { this.options = options; return this; } public String getOptions() { return this.options; } public GetDataSourceResponseBody setMountPath(String mountPath) { this.mountPath = mountPath; return this; } public String getMountPath() { return this.mountPath; } public GetDataSourceResponseBody setUserId(String userId) { this.userId = userId; return this; } public String getUserId() { return this.userId; } public GetDataSourceResponseBody setGmtCreateTime(String gmtCreateTime) { this.gmtCreateTime = gmtCreateTime; return this; } public String getGmtCreateTime() { return this.gmtCreateTime; } public GetDataSourceResponseBody setGmtModifyTime(String gmtModifyTime) { this.gmtModifyTime = gmtModifyTime; return this; } public String getGmtModifyTime() { return this.gmtModifyTime; } public GetDataSourceResponseBody setRequestId(String requestId) { this.requestId = requestId; return this; } public String getRequestId() { return this.requestId; } }
[ "sdk-team@alibabacloud.com" ]
sdk-team@alibabacloud.com
59fdd9bc047b96d12e94f6207442ad2f8192d28f
e55ee9225461e4affdf6d664296d7f3a30f1976b
/src/main/java/sparrow/ui/Ui.java
38d35a15538926ed1f31aac0a84f0ad9a8a79c02
[]
no_license
jonfoocy/ip
b940b62a90b5ec63171b79961398ca964186a367
45a0c6eded7fad7b43cff6261fa9392a3a693653
refs/heads/master
2022-12-18T08:40:01.760440
2020-09-18T14:14:49
2020-09-18T14:14:49
288,524,439
0
0
null
2020-09-08T12:01:26
2020-08-18T17:45:53
Java
UTF-8
Java
false
false
2,216
java
package sparrow.ui; import java.util.List; import java.util.Scanner; import sparrow.data.task.Task; import sparrow.data.trivia.Vocabulary; /** * Responsible for sending messages to the user. */ public class Ui { private static final String DIVIDER = " ________________________________________"; private static final String MESSAGE_PREFIX = " "; /** * Welcomes the user to the program. */ public void greet() { String welcome = " _ _ _ ___ _ \n" + " | || (_) |_ _( )_ __ \n" + " | __ | | | ||/| ' \\ \n" + " |_||_|_| |___| |_|_|_| \n" + " / __|_ __ __ _ _ _ _ _ _____ __ __\n" + " \\__ \\ '_ \\/ _` | '_| '_/ _ \\ V V /\n" + " |___/ .__/\\__,_|_| |_| \\___/\\_/\\_/ \n" + " |_| "; System.out.println(welcome); replyToUser("How can I help ye?"); } /** * Sends a reply to the user in a standard format. * @param message Reply to be formatted. */ public void replyToUser(String message) { System.out.println(DIVIDER); Scanner sc = new Scanner(message); while (sc.hasNextLine()) { String line = sc.nextLine(); System.out.println(MESSAGE_PREFIX + line); } System.out.println(DIVIDER); sc.close(); } /** * Converts input task list to string. */ public String taskListToString(List<Task> tasks) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < tasks.size(); i++) { String temp = String.format("%d. %s\n", i + 1, tasks.get(i)); sb.append(temp); } return sb.toString(); } /** * Converts input task list to string. */ public String vocabListToString(List<Vocabulary> vocabList) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < vocabList.size(); i++) { String temp = String.format("%d. %s\n", i + 1, vocabList.get(i)); sb.append(temp); } return sb.toString(); } }
[ "jonathanfoocy@gmail.com" ]
jonathanfoocy@gmail.com
4cb075fc1653bb79c822b78454352d2de28c6217
94ac7f62afe724b64839223de3900f44444b5ccc
/clientSoftware/SOPLabel/src/com/dhl/xmlpi/labelservice/model/request/PaymentCode.java
f296832aa006e013dec9924ac8c37fd43c30cca0
[]
no_license
ly0929simon/DHL
afda83a872c1c546ea29e349e12a8e1d8215b08e
ff26fa3a7d20a0c943b5092f9e162e68f7471d9e
refs/heads/master
2020-05-26T09:57:05.904321
2019-05-23T08:44:07
2019-05-23T08:44:07
188,195,290
3
0
null
null
null
null
UTF-8
Java
false
false
1,138
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 // 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: 2012.11.01 at 04:46:27 PM IST // package com.dhl.xmlpi.labelservice.model.request; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for PaymentCode. * * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;simpleType name="PaymentCode"> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"> * &lt;length value="1"/> * &lt;enumeration value="Y"/> * &lt;enumeration value="N"/> * &lt;/restriction> * &lt;/simpleType> * </pre> * */ @XmlType(name = "PaymentCode") @XmlEnum public enum PaymentCode { Y, N; public String value() { return name(); } public static PaymentCode fromValue(String v) { return valueOf(v); } }
[ "34259858+JackLiuYang@users.noreply.github.com" ]
34259858+JackLiuYang@users.noreply.github.com
2b5ba21217695405e06948eb6a4ec5e4aef591eb
4aa90348abcb2119011728dc067afd501f275374
/app/src/main/java/com/tencent/mm/plugin/appbrand/jsapi/ac.java
e2888ae83bfc5a74366e06659b10026c9d0f3ed7
[]
no_license
jambestwick/HackWechat
0d4ceb2d79ccddb45004ca667e9a6a984a80f0f6
6a34899c8bfd50d19e5a5ec36a58218598172a6b
refs/heads/master
2022-01-27T12:48:43.446804
2021-12-29T10:36:30
2021-12-29T10:36:30
249,366,791
0
0
null
2020-03-23T07:48:32
2020-03-23T07:48:32
null
UTF-8
Java
false
false
1,469
java
package com.tencent.mm.plugin.appbrand.jsapi; import android.content.Context; import android.provider.Settings.SettingNotFoundException; import android.provider.Settings.System; import com.tencent.mm.plugin.appbrand.j; import com.tencent.mm.sdk.platformtools.x; import com.tencent.tmassistantsdk.storage.table.DownloadSettingTable$Columns; import java.util.HashMap; import java.util.Map; import org.json.JSONObject; public final class ac extends a { public static final int CTRL_INDEX = 232; public static final String NAME = "getScreenBrightness"; public final void a(j jVar, JSONObject jSONObject, int i) { x.d("MicroMsg.JsApiGetScreenBrightness", "JsApiGetScreenBrightness!"); Context a = a(jVar); if (a == null) { jVar.E(i, e("fail", null)); x.e("MicroMsg.JsApiGetScreenBrightness", "context is null, invoke fail!"); return; } float f = a.getWindow().getAttributes().screenBrightness; if (f < 0.0f) { f = bT(a); } Map hashMap = new HashMap(); hashMap.put(DownloadSettingTable$Columns.VALUE, Float.valueOf(f)); jVar.E(i, e("ok", hashMap)); } private static float bT(Context context) { float f = 0.0f; try { return ((float) System.getInt(context.getContentResolver(), "screen_brightness")) / 255.0f; } catch (SettingNotFoundException e) { return f; } } }
[ "malin.myemail@163.com" ]
malin.myemail@163.com
e6518fbbc6a1aba791c1ebcefcc4a3238a99abd1
b2f07f3e27b2162b5ee6896814f96c59c2c17405
/com/sun/corba/se/impl/oa/toa/Element.java
8f70703e66133969796f13475c818d9f50563d95
[]
no_license
weiju-xi/RT-JAR-CODE
e33d4ccd9306d9e63029ddb0c145e620921d2dbd
d5b2590518ffb83596a3aa3849249cf871ab6d4e
refs/heads/master
2021-09-08T02:36:06.675911
2018-03-06T05:27:49
2018-03-06T05:27:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,702
java
/* */ package com.sun.corba.se.impl.oa.toa; /* */ /* */ import com.sun.corba.se.impl.orbutil.ORBUtility; /* */ /* */ final class Element /* */ { /* 156 */ Object servant = null; /* 157 */ Object servantData = null; /* 158 */ int index = -1; /* 159 */ int counter = 0; /* 160 */ boolean valid = false; /* */ /* */ Element(int paramInt, Object paramObject) /* */ { /* 165 */ this.servant = paramObject; /* 166 */ this.index = paramInt; /* */ } /* */ /* */ byte[] getKey(Object paramObject1, Object paramObject2) /* */ { /* 171 */ this.servant = paramObject1; /* 172 */ this.servantData = paramObject2; /* 173 */ this.valid = true; /* */ /* 175 */ return toBytes(); /* */ } /* */ /* */ byte[] toBytes() /* */ { /* 182 */ byte[] arrayOfByte = new byte[8]; /* 183 */ ORBUtility.intToBytes(this.index, arrayOfByte, 0); /* 184 */ ORBUtility.intToBytes(this.counter, arrayOfByte, 4); /* */ /* 186 */ return arrayOfByte; /* */ } /* */ /* */ void delete(Element paramElement) /* */ { /* 191 */ if (!this.valid) /* 192 */ return; /* 193 */ this.counter += 1; /* 194 */ this.servantData = null; /* 195 */ this.valid = false; /* */ /* 198 */ this.servant = paramElement; /* */ } /* */ /* */ public String toString() /* */ { /* 203 */ return "Element[" + this.index + ", " + this.counter + "]"; /* */ } /* */ } /* Location: C:\Program Files\Java\jdk1.7.0_79\jre\lib\rt.jar * Qualified Name: com.sun.corba.se.impl.oa.toa.Element * JD-Core Version: 0.6.2 */
[ "yuexiahandao@gmail.com" ]
yuexiahandao@gmail.com
5f9ebc488fa4595097fee0189079aa78a8231631
d0fdb02976eb27753df27fdbe5f872457b68a7ec
/Verkkokauppa1/src/main/java/ohtu/verkkokauppa/KirjanpitoIF.java
1ca7a2dc9d19a253ca575e3c34ce09ba3d497c66
[]
no_license
Themis1/ohtu-viikko2
9e151890dd8b11c29391201044abce05f95bf657
452ca838e0e12c887be8bc4a26d2798ea8a619d3
refs/heads/main
2023-01-12T23:50:39.451335
2020-11-09T21:48:44
2020-11-09T21:48:44
311,424,122
0
0
null
null
null
null
UTF-8
Java
false
false
181
java
package ohtu.verkkokauppa; import java.util.ArrayList; public interface KirjanpitoIF { ArrayList<String> getTapahtumat(); void lisaaTapahtuma(String tapahtuma); }
[ "laura.north@helsinki.fi" ]
laura.north@helsinki.fi
002b2937181622b685255c743a8880faa5dca948
d5245e2343f8ac34f222751fd9e401e9721cadd7
/app/src/main/java/com/daowei/www/daoweitwo/view/home/HomeFragment.java
59585c409b63cfd0f0d62b83e9fd5f307e33e881
[]
no_license
yulu1121/newTrunk
72e86b10d99a725f13daa0b79afa4c9b333c1ba9
5930baea6a1f72dbb2a2929c6581a3b4a56be902
refs/heads/master
2021-01-19T08:05:41.832850
2017-04-08T01:42:35
2017-04-08T01:42:35
87,599,729
0
0
null
null
null
null
UTF-8
Java
false
false
21,366
java
package com.daowei.www.daoweitwo.view.home; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ExpandableListView; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RadioButton; import android.widget.TextView; import android.widget.Toast; import com.bigkoo.convenientbanner.ConvenientBanner; import com.bigkoo.convenientbanner.holder.CBViewHolderCreator; import com.bigkoo.convenientbanner.holder.Holder; import com.bigkoo.convenientbanner.listener.OnItemClickListener; import com.daowei.www.daoweitwo.R; import com.daowei.www.daoweitwo.SearchActivity; import com.daowei.www.daoweitwo.module.home.bean.HomeBannerBean; import com.daowei.www.daoweitwo.module.home.bean.HomeExpanbleBean; import com.daowei.www.daoweitwo.module.home.bean.HomeFooterBean; import com.daowei.www.daoweitwo.module.home.bean.HomeRecommendBean; import com.daowei.www.daoweitwo.module.home.bean.HomeServiceBean; import com.daowei.www.daoweitwo.presenter.IBannerPresenter; import com.daowei.www.daoweitwo.presenter.IFooterPresenter; import com.daowei.www.daoweitwo.presenter.IHomePresenter; import com.daowei.www.daoweitwo.presenter.IRecommendPresenter; import com.daowei.www.daoweitwo.presenter.IServicePresenter; import com.daowei.www.daoweitwo.presenter.home.impl.BannerPresenter; import com.daowei.www.daoweitwo.presenter.home.impl.FooterPresenter; import com.daowei.www.daoweitwo.presenter.home.impl.HomePresneter; import com.daowei.www.daoweitwo.presenter.home.impl.RecommendPresenter; import com.daowei.www.daoweitwo.presenter.home.impl.ServicePresenter; import com.daowei.www.daoweitwo.utils.DesityUtil; import com.daowei.www.daoweitwo.utils.SharedPreferenceUtils; import com.daowei.www.daoweitwo.view.adapter.HomeExpanbleAdapter; import com.daowei.www.daoweitwo.view.adapter.HomeFooterAdapter; import com.daowei.www.daoweitwo.view.adapter.HomeGridAdapter; import com.daowei.www.daoweitwo.view.category.MyGridView; import com.daowei.www.daoweitwo.view.indent.TitleMsgActivity; import com.daowei.www.daoweitwo.view.selfview.HomeGridView; import com.daowei.www.daoweitwo.view.selfview.HomeRecelerView; import com.handmark.pulltorefresh.library.PullToRefreshBase; import com.handmark.pulltorefresh.library.PullToRefreshExpandableListView; import com.squareup.picasso.Picasso; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import butterknife.BindView; import butterknife.ButterKnife; import rx.Observable; import rx.android.schedulers.AndroidSchedulers; import rx.functions.Action0; import rx.functions.Action1; import rx.functions.Func1; import rx.schedulers.Schedulers; /** * * Created by yulu on 2017/2/20 0020. */ public class HomeFragment extends Fragment implements IHomePresenter.SendHomeExpanbleData,IBannerPresenter.SendHomeBannerData,IServicePresenter.SendServiceData,IRecommendPresenter.SendRecommendData,IFooterPresenter.SendFooterBeanData{ private Context context; private IHomePresenter presenter; private IBannerPresenter bannerPresenter; private IServicePresenter servicePresenter; private IRecommendPresenter recommendPresenter; private IFooterPresenter footerPresenter; private HomeExpanbleAdapter adapter; @BindView(R.id.street_text) TextView textView; @BindView(R.id.frg_search) RadioButton search; @BindView(R.id.message) RadioButton message; private String city; private RadioButton radioButton; private HomeRecelerView recyclerView; private HomeGridView homeGridView; private MyGridView homeFooterGridView; private HomeFooterAdapter homeFooterAdapter; private MyAdapter receclerAdapter; private HomeGridAdapter gridAdapter; private ConvenientBanner convenientBanner; private Boolean isFresh = true;//让下拉刷新只刷新一次 private List<HomeRecommendBean.DataBean.RecommendBean> recommendList = new ArrayList<>(); private List<HomeServiceBean.DataBean> serviceList = new ArrayList<>(); private List<HomeBannerBean.DataBean> bannerList = new ArrayList<>();//存放广告的集合 private List<HomeFooterBean.DataBean> footerList = new ArrayList<>(); private Map<String,List<HomeExpanbleBean.DataBean>> dataBeanMap = new LinkedHashMap<>(); @Override public void onAttach(Context context) { super.onAttach(context); this.context = context; bannerPresenter = new BannerPresenter(context,this); presenter = new HomePresneter(context,this); servicePresenter = new ServicePresenter(context,this); recommendPresenter = new RecommendPresenter(context,this); footerPresenter = new FooterPresenter(context,this); } @BindView(R.id.home_expanblelistView) PullToRefreshExpandableListView expandableListView; public static HomeFragment newInstance(){ return new HomeFragment(); } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_home, container, false); ButterKnife.bind(this,view); presenter.getHomeExpanbleData(); bannerPresenter.getHomeBannerData(); servicePresenter.getServiceData(); recommendPresenter.getRecommendData(); footerPresenter.getFooterBeanData(); city=SharedPreferenceUtils.getString(context,"city"); initView(); initHeadView(); initFooterView(); initExpanbleList(); return view; } private void initView() { String street = SharedPreferenceUtils.getString(context, "street"); textView.setText(street); textView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(context,MapActivity.class); startActivity(intent); } }); search.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(context, SearchActivity.class); startActivity(intent); } }); message.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(context, TitleMsgActivity.class); startActivity(intent); } }); } /** * 初始化头部视图 */ private void initHeadView(){ final View view = LayoutInflater.from(context).inflate(R.layout.home_header,null); HeaderViewHolder holder = new HeaderViewHolder(view); expandableListView.getRefreshableView().addHeaderView(view); convenientBanner = holder.banner; homeGridView = holder.gridView; radioButton = holder.recommond; recyclerView = holder.recycler; } /** * 初始化底部视图 */ private void initFooterView(){ final View view = LayoutInflater.from(context).inflate(R.layout.home_footer_layout,null); homeFooterGridView = (MyGridView) view.findViewById(R.id.home_footer_grid); expandableListView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ExpandableListView>() { @Override public void onPullDownToRefresh(PullToRefreshBase<ExpandableListView> refreshView) { dataBeanMap.clear(); presenter.getHomeExpanbleData(); adapter.notifyDataSetChanged(); refreshView.onRefreshComplete(); } @Override public void onPullUpToRefresh(PullToRefreshBase<ExpandableListView> refreshView) { if(isFresh){ isFresh = false; homeFooterGridView.setAdapter(homeFooterAdapter); refreshView.getRefreshableView().addFooterView(view); expandableListView.onRefreshComplete(); }else { expandableListView.onRefreshComplete(); } } }); } @Override public void sendServiceData(HomeServiceBean bean) { List<HomeServiceBean.DataBean> data = bean.getData(); for (int i = 0; i <10; i++) { serviceList.add(data.get(i)); } gridAdapter = new HomeGridAdapter(context,serviceList); homeGridView.setAdapter(gridAdapter); gridAdapter.notifyDataSetChanged(); } /** * 初始化头部视图的recyclerview */ private void initRecyclerView(){ LinearLayoutManager manager = new LinearLayoutManager(context,LinearLayoutManager.HORIZONTAL,false); recyclerView.setLayoutManager(manager); receclerAdapter = new MyAdapter(); recyclerView.setAdapter(receclerAdapter); } /** * @param bean 获取底部view的实体类 * added by yulu 2017年2月23日 16:16:12 */ @Override public void sendFooterBeanData(HomeFooterBean bean) { footerList.addAll(bean.getData()); homeFooterAdapter = new HomeFooterAdapter(context,footerList); } /** * 实现receclerview */ class RececlerVH extends RecyclerView.ViewHolder implements View.OnClickListener{ View view; ImageView backgroud; TextView title; TextView des; public RececlerVH(View itemView) { super(itemView); this.view = itemView; backgroud = (ImageView) itemView.findViewById(R.id.home_center_image); title = (TextView) itemView.findViewById(R.id.home_center_title); des = (TextView) itemView.findViewById(R.id.home_center_des); itemView.setOnClickListener(this); } @Override public void onClick(View v) { } } class MyAdapter extends RecyclerView.Adapter<RececlerVH>{ @Override public RececlerVH onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(context).inflate(R.layout.recycler_item,parent,false); return new RececlerVH(view); } @Override public void onBindViewHolder(RececlerVH holder, final int position) { int width = SharedPreferenceUtils.getInt(context, "width"); int px = DesityUtil.dip2px(context, width); LinearLayout.LayoutParams ll = new LinearLayout.LayoutParams(px/4-DesityUtil.dip2px(context,2f),DesityUtil.dip2px(context,120f)); ll.setMargins(0,0,3,3); HomeRecommendBean.DataBean.RecommendBean bean = recommendList.get(position); Picasso.with(context).load(bean.getImg()).into(holder.backgroud); holder.title.setText(bean.getTitle()); holder.des.setText(bean.getSubject()); holder.view.setLayoutParams(ll); holder.view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(context, "v"+position, Toast.LENGTH_SHORT).show(); } }); switch (bean.getTitle()){ case "热销": holder.view.setBackgroundColor(getResources().getColor(R.color.hot)); break; case "新店": holder.view.setBackgroundColor(getResources().getColor(R.color.newshop)); break; case "领券": holder.view.setBackgroundColor(getResources().getColor(R.color.ticket)); break; case "充值": holder.view.setBackgroundColor(getResources().getColor(R.color.charge)); break; } } @Override public int getItemCount() { return recommendList.size(); } } @Override public void sendRecommendData(HomeRecommendBean bean) { int total_count = bean.getData().getRecommend_total_count(); radioButton.setText("本地"+total_count+"个服务商"); final List<HomeRecommendBean.DataBean.RecommendBean> recommendBeanList = bean.getData().getRecommend(); Observable.from(recommendBeanList) .map(new Func1<HomeRecommendBean.DataBean.RecommendBean,HomeRecommendBean.DataBean.RecommendBean>() { @Override public HomeRecommendBean.DataBean.RecommendBean call(HomeRecommendBean.DataBean.RecommendBean recommendBean) { return recommendBean; } }) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Action1<HomeRecommendBean.DataBean.RecommendBean>() { @Override public void call(HomeRecommendBean.DataBean.RecommendBean recommendBean) { recommendList.add(recommendBean); } }, new Action1<Throwable>() { @Override public void call(Throwable throwable) { throwable.printStackTrace(); } }, new Action0() { @Override public void call() { initRecyclerView(); receclerAdapter.notifyDataSetChanged(); } }); } class HeaderViewHolder{ @BindView(R.id.home_banner) ConvenientBanner banner; @BindView(R.id.home_grid) HomeGridView gridView; @BindView(R.id.home_recommend_rb) RadioButton recommond; @BindView(R.id.home_head_recycler) HomeRecelerView recycler; HeaderViewHolder(View view){ ButterKnife.bind(this,view); } } private void setupBanner(ConvenientBanner convenientBanner){ convenientBanner.setPages(new CBViewHolderCreator<HomeBannerCreater>() { @Override public HomeBannerCreater createHolder() { return new HomeBannerCreater(); } },bannerList) .setPageIndicator(new int[]{R.drawable.dot_unselected,R.drawable.dot_selected}) .setPageIndicatorAlign(ConvenientBanner.PageIndicatorAlign.ALIGN_PARENT_RIGHT) .setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(int position) { String target = bannerList.get(position).getTarget(); if(target.contains("http")){ Intent intent = new Intent(context,HomeBannerActivityOne.class); intent.putExtra("target",target); startActivity(intent); }else if(target.contains("app")){ if(target.contains("105097")){ Intent intent = new Intent(context,ServiceActivity.class); Bundle bundle = new Bundle(); bundle.putString("itemId","105097"); bundle.putString("serviceId","ab65512d16b745f1b420c915cbd399f2"); intent.putExtra("formation",bundle); startActivity(intent); }else { Toast.makeText(context, "详情", Toast.LENGTH_SHORT).show();} }else { Intent intent = new Intent(context,HomeBannerActivityTwo.class); intent.putExtra("targeting",target); startActivity(intent); } } }) ; } class HomeBannerCreater implements Holder<HomeBannerBean.DataBean>{ private ImageView imageView; @Override public View createView(Context context) { imageView = new ImageView(context); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); return imageView; } @Override public void UpdateUI(Context context, int position, HomeBannerBean.DataBean data) { Picasso.with(context).load(data.getImgUrl()).into(imageView); } } /** * 初始化分组视图 * added by yulu 2017年2月21日 14:05:19 */ private void initExpanbleList(){ adapter = new HomeExpanbleAdapter(context,dataBeanMap); expandableListView.getRefreshableView().setAdapter(adapter); expandableListView.setMode(PullToRefreshBase.Mode.BOTH); expandableListView.getRefreshableView().setGroupIndicator(null); expandableListView.getRefreshableView().setDividerHeight(0); } /** * @param bean * 完成map和list的数据注入 * added by yulu 2017年2月21日 14:05:04 */ @Override public void sendHomeExpanbleData(HomeExpanbleBean bean) { List<HomeExpanbleBean.DataBean> dataBeanList = bean.getData(); Observable.from(dataBeanList) .flatMap(new Func1<HomeExpanbleBean.DataBean, Observable<HomeExpanbleBean.DataBean.ItemsBean>>() { @Override public Observable<HomeExpanbleBean.DataBean.ItemsBean> call(HomeExpanbleBean.DataBean dataBean) { String categoryName = dataBean.getCategoryName(); if(!dataBeanMap.containsKey(categoryName)){ dataBeanMap.put(categoryName,new ArrayList<HomeExpanbleBean.DataBean>()); } dataBeanMap.get(categoryName).add(dataBean); return Observable.from(dataBean.getItems()); } }) .map(new Func1<HomeExpanbleBean.DataBean.ItemsBean,HomeExpanbleBean.DataBean.ItemsBean>() { @Override public HomeExpanbleBean.DataBean.ItemsBean call(HomeExpanbleBean.DataBean.ItemsBean itemsBean) { return itemsBean; } }) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Action1<HomeExpanbleBean.DataBean.ItemsBean>() { @Override public void call(HomeExpanbleBean.DataBean.ItemsBean itemsBean) { } }, new Action1<Throwable>() { @Override public void call(Throwable throwable) { throwable.printStackTrace(); } }, new Action0() { @Override public void call() { adapter.notifyDataSetChanged(); expandListView(); } }) ; } /** * 使组无法收缩 * added by yulu 2017年2月21日 14:02:06 */ private void expandListView() { Object[] objects = dataBeanMap.keySet().toArray(); int size = objects.length ; for (int i = 0; i < size; i++) { ExpandableListView refreshableView = expandableListView.getRefreshableView(); refreshableView.expandGroup(i); } } @Override public void onStart() { super.onStart(); //设置轮播时间 convenientBanner.startTurning(3000); } @Override public void onStop() { super.onStop(); //停止轮播 convenientBanner.stopTurning(); } @Override public void sendHomeBannerData(HomeBannerBean bean) { final List<HomeBannerBean.DataBean> data = bean.getData(); Observable.from(data) .map(new Func1<HomeBannerBean.DataBean, HomeBannerBean.DataBean>() { @Override public HomeBannerBean.DataBean call(HomeBannerBean.DataBean dataBean) { return dataBean; } }) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Action1<HomeBannerBean.DataBean>() { @Override public void call(HomeBannerBean.DataBean dataBean) { if( dataBean.getCity().contains(city)){ bannerList.add(dataBean); } } }, new Action1<Throwable>() { @Override public void call(Throwable throwable) { throwable.printStackTrace(); } }, new Action0() { @Override public void call() { setupBanner(convenientBanner); } }); } }
[ "626899174@qq.com" ]
626899174@qq.com
b9150c1301ab01e09adb80dc04cddf51a6203911
7a0f1c3e65dcd7917bb2e2586a938257c070ab76
/src/Office_Hours/SingleDimensionalArray11_11_20.java
c5da57f22e0cf59a9b108cc98d63c00775d71651
[]
no_license
Javiddarvish/JavaProgramming2020_B21
601ce6065b52e21ffa225ddd49c666d3d2518a21
345aef755f1e0feedfd4637f432950ba4af1f168
refs/heads/master
2023-01-11T02:06:05.500427
2020-11-11T20:54:34
2020-11-11T20:54:34
312,081,438
0
0
null
null
null
null
UTF-8
Java
false
false
958
java
package Office_Hours; import java.util.Arrays; public class SingleDimensionalArray11_11_20 { public static void main(String[] args) { int [] score = new int[5]; score[2] = 10; score[1] = 20; score[0] = 50; score[3] = 30; score[4] = 40; System.out.println(Arrays.toString(score)); // one by one System.out.println(score[2]); System.out.println(score[3]); System.out.println(score[4]); System.out.println(score[1]); System.out.println("======================================"); // i < 5 for (int i = 0; i < score.length; i++){ // for (int i = 0; i < 5; i++) we can do this way too System.out.println(score[i]); } System.out.println("======================================="); for (int each : score){ System.out.println(each); } }}
[ "javid7darvish@gmail.com" ]
javid7darvish@gmail.com
ceeefbfaa74417154507c40ed2ff83a4d466b3f5
45d59ea2c57237f4222cf95fa7474e447406d3a8
/Modul2/Lesson1/Lab1/MainMenu.java
6df5767093a1e9538ba6145e2268ff188cf3c6c7
[]
no_license
Kenidzu/bitlab_onlain
843201c0110427a09897e817a559a9925474c59c
7d81db42753433c1477db2d8a18d1deb511ddaa9
refs/heads/master
2023-01-01T14:13:23.282847
2020-10-25T07:10:46
2020-10-25T07:10:46
307,041,406
0
0
null
null
null
null
UTF-8
Java
false
false
1,917
java
package Lab1; import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.List; public class MainMenu extends JPanel { private MainFrame parent; private JButton AddStudent; private JButton ListStudents; private JButton exitButton; public MainMenu (MainFrame parent){ this.parent = parent; setSize(500,500); setLayout(null); AddStudent = new JButton("Add Student"); AddStudent.setSize(300,30); AddStudent.setLocation(100,100); add(AddStudent); AddStudent.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { parent.getMainMenupage().setVisible(false); parent.getAddStudentpage().setVisible(true); parent.getAddStudentpage().showButtonsaddStudent(); } }); ListStudents = new JButton("List Student"); ListStudents.setSize(300,30); ListStudents.setLocation(100,150); add(ListStudents); ListStudents.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { parent.getListStudentspage().generateTable(parent.getStudents()); parent.getMainMenupage().setVisible(false); parent.getListStudentspage().setVisible(true); parent.getListStudentspage().showButtonsListStudent(); } }); exitButton = new JButton("Exit"); exitButton.setSize(300,30); exitButton.setLocation(100,200); add(exitButton); exitButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { System.exit(0); } }); } }
[ "zumaevk5@gmail.com" ]
zumaevk5@gmail.com
7aee7cab590d361dfe347f9ed11c57d57d5786bc
280da3630f692c94472f2c42abd1051fb73d1344
/src/net/minecraft/client/gui/GuiErrorScreen.java
f7a6be74cd04b9e5b7a87ba7f9a18ca9d4d128df
[]
no_license
MicrowaveClient/Clarinet
7c35206c671eb28bc139ee52e503f405a14ccb5b
bd387bc30329e0febb6c1c1b06a836d9013093b5
refs/heads/master
2020-04-02T18:47:52.047731
2016-07-14T03:21:46
2016-07-14T03:21:46
63,297,767
1
0
null
null
null
null
UTF-8
Java
false
false
1,913
java
package net.minecraft.client.gui; import net.minecraft.client.resources.I18n; import java.io.IOException; public class GuiErrorScreen extends GuiScreen { private String field_146313_a; private String field_146312_f; public GuiErrorScreen(String p_i46319_1_, String p_i46319_2_) { this.field_146313_a = p_i46319_1_; this.field_146312_f = p_i46319_2_; } /** * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the * window resizes, the buttonList is cleared beforehand. */ public void initGui() { super.initGui(); this.buttonList.add(new GuiButton(0, this.width / 2 - 100, 140, I18n.format("gui.cancel", new Object[0]))); } /** * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks */ public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawGradientRect(0, 0, this.width, this.height, -12574688, -11530224); this.drawCenteredString(this.fontRendererObj, this.field_146313_a, this.width / 2, 90, 16777215); this.drawCenteredString(this.fontRendererObj, this.field_146312_f, this.width / 2, 110, 16777215); super.drawScreen(mouseX, mouseY, partialTicks); } /** * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) */ protected void keyTyped(char typedChar, int keyCode) throws IOException { } /** * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) */ protected void actionPerformed(GuiButton button) throws IOException { this.mc.displayGuiScreen((GuiScreen) null); } }
[ "justanormalpcnoghostclientoranyt@justanormalpcnoghostclientoranyt-Aspire-XC-704" ]
justanormalpcnoghostclientoranyt@justanormalpcnoghostclientoranyt-Aspire-XC-704
5b9fc24d5d380ef9ef026c662881656f971aacfd
08262fa142f2fef7e754cddf7b2eacb57a8cc331
/src/main/java/repsaj/airstreamer/server/model/Movie.java
236e52a054b551a15e15656ac7f9fedec3b3b821
[]
no_license
chxiaowu/AirStreamer
10ec2c3889ec3388e3e137a3e445071e8fe4d95e
867c9040ed70a137e0609c926a207ea7c76db2c6
refs/heads/master
2021-01-17T07:05:56.189909
2013-02-11T19:14:17
2013-02-11T19:14:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,399
java
package repsaj.airstreamer.server.model; import java.util.Map; /** * * @author jasper */ public class Movie extends Video { private int year; private int movieId; private int length; private double rating; public int getYear() { return year; } public void setYear(int year) { this.year = year; } public int getMovieId() { return movieId; } public void setMovieId(int movieId) { this.movieId = movieId; } public int getLength() { return length; } public void setLength(int length) { this.length = length; } public double getRating() { return rating; } public void setRating(double rating) { this.rating = rating; } @Override public Map<String, Object> toMap() { Map<String, Object> map = super.toMap(); map.put("year", year); map.put("movieId", movieId); map.put("length", length); map.put("rating", rating); return map; } @Override public void fromMap(Map<String, Object> map) { super.fromMap(map); year = (Integer) map.get("year"); movieId = (Integer) map.get("movieId"); length = (Integer) map.get("length"); rating = (Double) map.get("rating"); } @Override public String getType() { return "movie"; } }
[ "jwesselink@gmail.com" ]
jwesselink@gmail.com
8802ef678b314df503c794659302104de6a5992c
ff249230bd1af14fe2ef6d5e79fbbc6e1e89f044
/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/BaseGradleProjectResolverExtension.java
55ccbe8c2be61f76173c6c011630ef105436a6c6
[ "Apache-2.0" ]
permissive
raksuns/intellij-community
d6755fac65ae69dbd388d76adbc67f19ef6940d4
77234b7656e3e35fdcf11a97916a655b7fc8d63f
refs/heads/master
2021-01-21T05:40:40.403232
2014-01-22T14:17:26
2014-01-22T14:17:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
22,215
java
/* * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jetbrains.plugins.gradle.service.project; import com.intellij.execution.ExecutionException; import com.intellij.execution.configurations.SimpleJavaParameters; import com.intellij.externalSystem.JavaProjectData; import com.intellij.openapi.application.PathManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.externalSystem.model.DataNode; import com.intellij.openapi.externalSystem.model.ExternalSystemException; import com.intellij.openapi.externalSystem.model.ProjectKeys; import com.intellij.openapi.externalSystem.model.project.*; import com.intellij.openapi.externalSystem.model.task.TaskData; import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil; import com.intellij.openapi.externalSystem.util.ExternalSystemDebugEnvironment; import com.intellij.openapi.externalSystem.util.Order; import com.intellij.openapi.module.EmptyModuleType; import com.intellij.openapi.module.JavaModuleType; import com.intellij.openapi.module.ModuleType; import com.intellij.openapi.module.StdModuleTypes; import com.intellij.openapi.roots.DependencyScope; import com.intellij.openapi.util.KeyValue; import com.intellij.openapi.util.io.FileUtil; import com.intellij.pom.java.LanguageLevel; import com.intellij.util.BooleanFunction; import com.intellij.util.Function; import com.intellij.util.PathUtil; import com.intellij.util.PathsList; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.ContainerUtilRt; import com.intellij.util.net.HttpConfigurable; import com.intellij.util.text.CharArrayUtil; import groovy.lang.GroovyObject; import org.gradle.tooling.ProjectConnection; import org.gradle.tooling.model.DomainObjectSet; import org.gradle.tooling.model.GradleTask; import org.gradle.tooling.model.idea.*; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.gradle.model.*; import org.jetbrains.plugins.gradle.model.data.BuildScriptClasspathData; import org.jetbrains.plugins.gradle.model.data.ClasspathEntry; import org.jetbrains.plugins.gradle.util.GradleBundle; import org.jetbrains.plugins.gradle.util.GradleConstants; import org.jetbrains.plugins.gradle.util.GradleUtil; import java.io.File; import java.io.FilenameFilter; import java.net.URL; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Set; /** * {@link BaseGradleProjectResolverExtension} provides base implementation of Gradle project resolver. * * @author Vladislav.Soroka * @since 10/14/13 */ @Order(Integer.MAX_VALUE) public class BaseGradleProjectResolverExtension implements GradleProjectResolverExtension { private static final Logger LOG = Logger.getInstance("#" + BaseGradleProjectResolverExtension.class.getName()); @NotNull @NonNls private static final String UNRESOLVED_DEPENDENCY_PREFIX = "unresolved dependency - "; @NotNull private ProjectResolverContext resolverCtx; @NotNull private final BaseProjectImportErrorHandler myErrorHandler = new BaseProjectImportErrorHandler(); @Override public void setProjectResolverContext(@NotNull ProjectResolverContext projectResolverContext) { resolverCtx = projectResolverContext; } @Override public void setNext(@Nullable GradleProjectResolverExtension next) { // should be the last extension in the chain } @Nullable @Override public GradleProjectResolverExtension getNext() { return null; } @NotNull @Override public ProjectData createProject() { final String projectDirPath = resolverCtx.getProjectPath(); final IdeaProject ideaProject = resolverCtx.getModels().getIdeaProject(); return new ProjectData(GradleConstants.SYSTEM_ID, ideaProject.getName(), projectDirPath, projectDirPath); } @NotNull @Override public JavaProjectData createJavaProjectData() { final String projectDirPath = resolverCtx.getProjectPath(); final IdeaProject ideaProject = resolverCtx.getModels().getIdeaProject(); // Gradle API doesn't expose gradleProject compile output path yet. JavaProjectData javaProjectData = new JavaProjectData(GradleConstants.SYSTEM_ID, projectDirPath + "/build/classes"); javaProjectData.setJdkVersion(ideaProject.getJdkName()); javaProjectData.setLanguageLevel(ideaProject.getLanguageLevel().getLevel()); return javaProjectData; } @NotNull @Override public ModuleData createModule(@NotNull IdeaModule gradleModule, @NotNull ProjectData projectData) { final String moduleName = gradleModule.getName(); if (moduleName == null) { throw new IllegalStateException("Module with undefined name detected: " + gradleModule); } final String moduleConfigPath = GradleUtil.getConfigPath(gradleModule.getGradleProject(), projectData.getLinkedExternalProjectPath()); if (ExternalSystemDebugEnvironment.DEBUG_ORPHAN_MODULES_PROCESSING) { LOG.info(String.format( "Creating module data ('%s') with the external config path: '%s'", gradleModule.getGradleProject().getPath(), moduleConfigPath )); } ModuleData moduleData = new ModuleData(gradleModule.getGradleProject().getPath(), GradleConstants.SYSTEM_ID, StdModuleTypes.JAVA.getId(), moduleName, moduleConfigPath, moduleConfigPath); ModuleExtendedModel moduleExtendedModel = resolverCtx.getExtraProject(gradleModule, ModuleExtendedModel.class); if (moduleExtendedModel != null) { moduleData.setGroup(moduleExtendedModel.getGroup()); moduleData.setVersion(moduleExtendedModel.getVersion()); moduleData.setArtifacts(moduleExtendedModel.getArtifacts()); } return moduleData; } @Override public void populateModuleExtraModels(@NotNull IdeaModule gradleModule, @NotNull DataNode<ModuleData> ideModule) { BuildScriptClasspathModel buildScriptClasspathModel = resolverCtx.getExtraProject(gradleModule, BuildScriptClasspathModel.class); if (buildScriptClasspathModel != null) { List<ClasspathEntry> classpathEntries = ContainerUtil.map(buildScriptClasspathModel.getClasspath(), new Function<ClasspathEntryModel, ClasspathEntry>() { @Override public ClasspathEntry fun(ClasspathEntryModel model) { return new ClasspathEntry(model.getClassesFile(), model.getSourcesFile(), model.getJavadocFile()); } }); BuildScriptClasspathData buildScriptClasspathData = new BuildScriptClasspathData(GradleConstants.SYSTEM_ID, classpathEntries); ideModule.createChild(BuildScriptClasspathData.KEY, buildScriptClasspathData); } } @Override public void populateModuleContentRoots(@NotNull IdeaModule gradleModule, @NotNull DataNode<ModuleData> ideModule) { DomainObjectSet<? extends IdeaContentRoot> contentRoots; ModuleExtendedModel moduleExtendedModel = resolverCtx.getExtraProject(gradleModule, ModuleExtendedModel.class); if (moduleExtendedModel != null) { contentRoots = moduleExtendedModel.getContentRoots(); } else { contentRoots = gradleModule.getContentRoots(); } if (contentRoots == null) { return; } for (IdeaContentRoot gradleContentRoot : contentRoots) { if (gradleContentRoot == null) continue; File rootDirectory = gradleContentRoot.getRootDirectory(); if (rootDirectory == null) continue; ContentRootData ideContentRoot = new ContentRootData(GradleConstants.SYSTEM_ID, rootDirectory.getAbsolutePath()); ideModule.getData().setModuleFileDirectoryPath(ideContentRoot.getRootPath()); populateContentRoot(ideContentRoot, ExternalSystemSourceType.SOURCE, gradleContentRoot.getSourceDirectories()); populateContentRoot(ideContentRoot, ExternalSystemSourceType.TEST, gradleContentRoot.getTestDirectories()); if (gradleContentRoot instanceof ExtIdeaContentRoot) { ExtIdeaContentRoot extIdeaContentRoot = (ExtIdeaContentRoot)gradleContentRoot; populateContentRoot(ideContentRoot, ExternalSystemSourceType.RESOURCE, extIdeaContentRoot.getResourceDirectories()); populateContentRoot(ideContentRoot, ExternalSystemSourceType.TEST_RESOURCE, extIdeaContentRoot.getTestResourceDirectories()); } Set<File> excluded = gradleContentRoot.getExcludeDirectories(); if (excluded != null) { for (File file : excluded) { ideContentRoot.storePath(ExternalSystemSourceType.EXCLUDED, file.getAbsolutePath()); } } ideModule.createChild(ProjectKeys.CONTENT_ROOT, ideContentRoot); } } @Override public void populateModuleCompileOutputSettings(@NotNull IdeaModule gradleModule, @NotNull DataNode<ModuleData> ideModule) { IdeaCompilerOutput moduleCompilerOutput = gradleModule.getCompilerOutput(); if (moduleCompilerOutput == null) { return; } File sourceCompileOutputPath = moduleCompilerOutput.getOutputDir(); ModuleData moduleData = ideModule.getData(); if (sourceCompileOutputPath != null) { moduleData.setCompileOutputPath(ExternalSystemSourceType.SOURCE, sourceCompileOutputPath.getAbsolutePath()); } File testCompileOutputPath = moduleCompilerOutput.getTestOutputDir(); if (testCompileOutputPath != null) { moduleData.setCompileOutputPath(ExternalSystemSourceType.TEST, testCompileOutputPath.getAbsolutePath()); } moduleData.setInheritProjectCompileOutputPath( moduleCompilerOutput.getInheritOutputDirs() || sourceCompileOutputPath == null || testCompileOutputPath == null ); } @Override public void populateModuleDependencies(@NotNull IdeaModule gradleModule, @NotNull DataNode<ModuleData> ideModule, @NotNull DataNode<ProjectData> ideProject) { ProjectDependenciesModel dependenciesModel = resolverCtx.getExtraProject(gradleModule, ProjectDependenciesModel.class); final List<? extends IdeaDependency> dependencies = dependenciesModel != null ? dependenciesModel.getDependencies() : gradleModule.getDependencies().getAll(); if (dependencies == null) return; for (IdeaDependency dependency : dependencies) { if (dependency == null) { continue; } DependencyScope scope = parseScope(dependency.getScope()); if (dependency instanceof IdeaModuleDependency) { ModuleDependencyData d = buildDependency(ideModule, (IdeaModuleDependency)dependency, ideProject); d.setExported(dependency.getExported()); if (scope != null) { d.setScope(scope); } ideModule.createChild(ProjectKeys.MODULE_DEPENDENCY, d); } else if (dependency instanceof IdeaSingleEntryLibraryDependency) { LibraryDependencyData d = buildDependency(ideModule, (IdeaSingleEntryLibraryDependency)dependency, ideProject); d.setExported(dependency.getExported()); if (scope != null) { d.setScope(scope); } ideModule.createChild(ProjectKeys.LIBRARY_DEPENDENCY, d); } } } @NotNull @Override public Collection<TaskData> populateModuleTasks(@NotNull IdeaModule gradleModule, @NotNull DataNode<ModuleData> ideModule, @NotNull DataNode<ProjectData> ideProject) throws IllegalArgumentException, IllegalStateException { final Collection<TaskData> tasks = ContainerUtil.newArrayList(); final String rootProjectPath = ideProject.getData().getLinkedExternalProjectPath(); final String moduleConfigPath = GradleUtil.getConfigPath(gradleModule.getGradleProject(), rootProjectPath); for (GradleTask task : gradleModule.getGradleProject().getTasks()) { String taskName = task.getName(); if (taskName == null || taskName.trim().isEmpty() || isIdeaTask(taskName)) { continue; } TaskData taskData = new TaskData(GradleConstants.SYSTEM_ID, taskName, moduleConfigPath, task.getDescription()); ideModule.createChild(ProjectKeys.TASK, taskData); tasks.add(taskData); } return tasks; } @NotNull @Override public Collection<TaskData> filterRootProjectTasks(@NotNull List<TaskData> allTasks) { return allTasks; } @NotNull @Override public Set<Class> getExtraProjectModelClasses() { return ContainerUtil.<Class>set(ModuleExtendedModel.class, ProjectDependenciesModel.class, BuildScriptClasspathModel.class); } @NotNull @Override public List<KeyValue<String, String>> getExtraJvmArgs() { if (ExternalSystemApiUtil.isInProcessMode(GradleConstants.SYSTEM_ID)) { return HttpConfigurable.getJvmPropertiesList(false, null); } return Collections.emptyList(); } @NotNull @Override public ExternalSystemException getUserFriendlyError(@NotNull Throwable error, @NotNull String projectPath, @Nullable String buildFilePath) { return myErrorHandler.getUserFriendlyError(error, projectPath, buildFilePath); } @Override public void preImportCheck() { } @Override public void enhanceRemoteProcessing(@NotNull SimpleJavaParameters parameters) throws ExecutionException { PathsList classPath = parameters.getClassPath(); // Gradle i18n bundle. ExternalSystemApiUtil.addBundle(classPath, GradleBundle.PATH_TO_BUNDLE, GradleBundle.class); // Gradle tool jars. String toolingApiPath = PathManager.getJarPathForClass(ProjectConnection.class); if (toolingApiPath == null) { LOG.warn(GradleBundle.message("gradle.generic.text.error.jar.not.found")); throw new ExecutionException("Can't find gradle libraries"); } File gradleJarsDir = new File(toolingApiPath).getParentFile(); String[] gradleJars = gradleJarsDir.list(new FilenameFilter() { @Override public boolean accept(@NotNull File dir, @NotNull String name) { return name.endsWith(".jar"); } }); if (gradleJars == null) { LOG.warn(GradleBundle.message("gradle.generic.text.error.jar.not.found")); throw new ExecutionException("Can't find gradle libraries at " + gradleJarsDir.getAbsolutePath()); } for (String jar : gradleJars) { classPath.add(new File(gradleJarsDir, jar).getAbsolutePath()); } List<String> additionalEntries = ContainerUtilRt.newArrayList(); ContainerUtilRt.addIfNotNull(additionalEntries, PathUtil.getJarPathForClass(GroovyObject.class)); ContainerUtilRt.addIfNotNull(additionalEntries, PathUtil.getJarPathForClass(JavaProjectData.class)); ContainerUtilRt.addIfNotNull(additionalEntries, PathUtil.getJarPathForClass(LanguageLevel.class)); ContainerUtilRt.addIfNotNull(additionalEntries, PathUtil.getJarPathForClass(StdModuleTypes.class)); ContainerUtilRt.addIfNotNull(additionalEntries, PathUtil.getJarPathForClass(JavaModuleType.class)); ContainerUtilRt.addIfNotNull(additionalEntries, PathUtil.getJarPathForClass(ModuleType.class)); ContainerUtilRt.addIfNotNull(additionalEntries, PathUtil.getJarPathForClass(EmptyModuleType.class)); for (String entry : additionalEntries) { classPath.add(entry); } } @Override public void enhanceLocalProcessing(@NotNull List<URL> urls) { } /** * Stores information about given directories at the given content root * * @param contentRoot target paths info holder * @param type type of data located at the given directories * @param dirs directories which paths should be stored at the given content root * @throws IllegalArgumentException if specified by {@link ContentRootData#storePath(ExternalSystemSourceType, String)} */ private static void populateContentRoot(@NotNull ContentRootData contentRoot, @NotNull ExternalSystemSourceType type, @Nullable Iterable<? extends IdeaSourceDirectory> dirs) throws IllegalArgumentException { if (dirs == null) { return; } for (IdeaSourceDirectory dir : dirs) { contentRoot.storePath(type, dir.getDirectory().getAbsolutePath()); } } @Nullable private static DependencyScope parseScope(@Nullable IdeaDependencyScope scope) { if (scope == null) { return null; } String scopeAsString = scope.getScope(); if (scopeAsString == null) { return null; } for (DependencyScope dependencyScope : DependencyScope.values()) { if (scopeAsString.equalsIgnoreCase(dependencyScope.toString())) { return dependencyScope; } } return null; } @NotNull private static ModuleDependencyData buildDependency(@NotNull DataNode<ModuleData> ownerModule, @NotNull IdeaModuleDependency dependency, @NotNull DataNode<ProjectData> ideProject) throws IllegalStateException { IdeaModule module = dependency.getDependencyModule(); if (module == null) { throw new IllegalStateException( String.format("Can't parse gradle module dependency '%s'. Reason: referenced module is null", dependency) ); } String moduleName = module.getName(); if (moduleName == null) { throw new IllegalStateException(String.format( "Can't parse gradle module dependency '%s'. Reason: referenced module name is undefined (module: '%s') ", dependency, module )); } Set<String> registeredModuleNames = ContainerUtilRt.newHashSet(); Collection<DataNode<ModuleData>> modulesDataNode = ExternalSystemApiUtil.getChildren(ideProject, ProjectKeys.MODULE); for (DataNode<ModuleData> moduleDataNode : modulesDataNode) { String name = moduleDataNode.getData().getExternalName(); registeredModuleNames.add(name); if (name.equals(moduleName)) { return new ModuleDependencyData(ownerModule.getData(), moduleDataNode.getData()); } } throw new IllegalStateException(String.format( "Can't parse gradle module dependency '%s'. Reason: no module with such name (%s) is found. Registered modules: %s", dependency, moduleName, registeredModuleNames )); } @NotNull private static LibraryDependencyData buildDependency(@NotNull DataNode<ModuleData> ownerModule, @NotNull IdeaSingleEntryLibraryDependency dependency, @NotNull DataNode<ProjectData> ideProject) throws IllegalStateException { File binaryPath = dependency.getFile(); if (binaryPath == null) { throw new IllegalStateException(String.format( "Can't parse external library dependency '%s'. Reason: it doesn't specify path to the binaries", dependency )); } // Gradle API doesn't provide library name at the moment. String libraryName; if (binaryPath.isFile()) { libraryName = FileUtil.getNameWithoutExtension(binaryPath); } else { libraryName = FileUtil.sanitizeFileName(binaryPath.getPath()); } // Gradle API doesn't explicitly provide information about unresolved libraries (http://issues.gradle.org/browse/GRADLE-1995). // That's why we use this dirty hack here. boolean unresolved = libraryName.startsWith(UNRESOLVED_DEPENDENCY_PREFIX); if (unresolved) { // Gradle uses names like 'unresolved dependency - commons-collections commons-collections 3.2' for unresolved dependencies. libraryName = binaryPath.getName().substring(UNRESOLVED_DEPENDENCY_PREFIX.length()); int i = libraryName.indexOf(' '); if (i >= 0) { i = CharArrayUtil.shiftForward(libraryName, i + 1, " "); } if (i >= 0 && i < libraryName.length()) { int dependencyNameIndex = i; i = libraryName.indexOf(' ', dependencyNameIndex); if (i > 0) { libraryName = String.format("%s-%s", libraryName.substring(dependencyNameIndex, i), libraryName.substring(i + 1)); } } } final LibraryData library = new LibraryData(GradleConstants.SYSTEM_ID, libraryName, unresolved); if (!unresolved) { library.addPath(LibraryPathType.BINARY, binaryPath.getAbsolutePath()); } File sourcePath = dependency.getSource(); if (!unresolved && sourcePath != null) { library.addPath(LibraryPathType.SOURCE, sourcePath.getAbsolutePath()); } File javadocPath = dependency.getJavadoc(); if (!unresolved && javadocPath != null) { library.addPath(LibraryPathType.DOC, javadocPath.getAbsolutePath()); } DataNode<LibraryData> libraryData = ExternalSystemApiUtil.find(ideProject, ProjectKeys.LIBRARY, new BooleanFunction<DataNode<LibraryData>>() { @Override public boolean fun(DataNode<LibraryData> node) { return library.equals(node.getData()); } }); if (libraryData == null) { libraryData = ideProject.createChild(ProjectKeys.LIBRARY, library); } return new LibraryDependencyData(ownerModule.getData(), libraryData.getData(), LibraryLevel.PROJECT); } private static boolean isIdeaTask(final String taskName) { return taskName.toLowerCase().contains("idea"); } }
[ "Vladislav.Soroka@jetbrains.com" ]
Vladislav.Soroka@jetbrains.com
ab1e5465724d60727cd432f1aed4542f29d94d53
370aae4bdc2fae261b38e3e819696005b218f2a8
/android-crmtab/app/src/main/java/fr/pds/isintheair/crmtab/jbide/uc/registercall/database/dao/CallEndedDAO.java
6cc7678fa0cee6159833253cea2244f5947cd60f
[]
no_license
balamuthu1/CRM-Android
535fd7a80f88afe3dfdedb334d57a0a917aeec18
5dfe30a17bafbca4f9e74b1301ff23ac9e94eb56
refs/heads/master
2021-01-01T04:04:37.946795
2016-05-13T22:40:25
2016-05-13T22:40:25
58,776,231
1
0
null
null
null
null
UTF-8
Java
false
false
734
java
package fr.pds.isintheair.crmtab.jbide.uc.registercall.database.dao; import com.raizlabs.android.dbflow.sql.language.Delete; import com.raizlabs.android.dbflow.sql.language.Select; import java.util.List; import fr.pds.isintheair.crmtab.jbide.uc.registercall.database.entity.CallEndedEvent; import fr.pds.isintheair.crmtab.jbide.uc.registercall.database.entity.CallEndedEvent_Table; /** * Created by jbide on 22/01/2016. */ public class CallEndedDAO { public static List<CallEndedEvent> getAll() { return new Select().from(CallEndedEvent.class).queryList(); } public static void delete(Long idcall) { new Delete().from(CallEndedEvent.class).where(CallEndedEvent_Table.id.eq(idcall)).query(); } }
[ "muthukumarasamy.balabascarin@etu.u-pec.fr" ]
muthukumarasamy.balabascarin@etu.u-pec.fr
bf75d641d132fb2a6e70e3bcf1d52b31de951c03
e6efc5140919b700cc5a916781ff6019c3406af9
/pmd-apex/src/test/java/net/sourceforge/pmd/lang/apex/rule/design/CyclomaticComplexityTest.java
50ffb556eaa79206d7e4b68a1f549a7b5d168129
[ "BSD-3-Clause", "Apache-2.0" ]
permissive
tiobe/pmd
0a09d8a813bf5e79134664007b9dbf9213b1a1e8
f304a64f39a14488c362e118430fcdfcc1a354ee
refs/heads/tiobe_fixes
2023-04-30T08:23:37.084568
2023-04-13T14:07:16
2023-04-13T14:07:16
28,335,883
2
2
NOASSERTION
2023-09-06T15:57:38
2014-12-22T11:26:04
Java
UTF-8
Java
false
false
256
java
/** * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ package net.sourceforge.pmd.lang.apex.rule.design; import net.sourceforge.pmd.testframework.PmdRuleTst; public class CyclomaticComplexityTest extends PmdRuleTst { }
[ "andreas.dangel@adangel.org" ]
andreas.dangel@adangel.org
52981142fbfa1c377e5ea8c6b9623ef20209ac6c
8810496f1e57140c2346b2f298916f7695cb238d
/LPL_XML/src/main/java/com/shiva/generated/C60.java
27005549b2da18b651345efd7cd13024c4c66182
[]
no_license
NairitCh/SystemwareAPI
14b7c5a31179f501351b8415d31bb3b5edb6a7f2
03ad0c9826464fa0aa9fef475c1be0cd3b448206
refs/heads/master
2020-03-19T17:47:16.813258
2018-07-01T07:01:35
2018-07-01T07:01:35
136,777,831
1
0
null
null
null
null
UTF-8
Java
false
false
2,424
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 // 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: 2018.07.01 at 09:59:34 AM IST // package com.shiva.generated; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlID; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; /** * <p>Java class for C-60 complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="C-60"> * &lt;simpleContent> * &lt;extension base="&lt;>C-60_NoID"> * &lt;attribute name="id" type="{}ID" /> * &lt;/extension> * &lt;/simpleContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "C-60", propOrder = { "value" }) public class C60 { @XmlValue protected String value; @XmlAttribute(name = "id") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) @XmlID protected String id; /** * Gets the value of the value property. * * @return * possible object is * {@link String } * */ public String getValue() { return value; } /** * Sets the value of the value property. * * @param value * allowed object is * {@link String } * */ public void setValue(String value) { this.value = value; } /** * Gets the value of the id property. * * @return * possible object is * {@link String } * */ public String getId() { return id; } /** * Sets the value of the id property. * * @param value * allowed object is * {@link String } * */ public void setId(String value) { this.id = value; } }
[ "606905@LT036994.cts.com" ]
606905@LT036994.cts.com
af02024236eb76533dfeb89280da9fcd054aea7f
af3f3a1743f655d5c127d62a7d7220bc4ee82243
/src/main/java/com/lieang/reactive/repository/impl/PersonRepositoryImpl.java
32b31c9a591d9785577a01be1e8719bef115e0fa
[]
no_license
metees/spring-reactive-lab
fa1c0a7ec292affb53e25b195f79b3a630e9d78b
bc32ee1025beb6bf503ef9719bf2e4e4c7aec126
refs/heads/master
2023-07-11T00:04:19.085835
2021-08-21T10:49:51
2021-08-21T10:49:51
398,506,008
0
0
null
null
null
null
UTF-8
Java
false
false
494
java
package com.lieang.reactive.repository.impl; import com.lieang.reactive.domain.Person; import com.lieang.reactive.repository.PersonRepository; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public class PersonRepositoryImpl implements PersonRepository { @Override public Mono<Person> getById(Integer id) { // TODO Auto-generated method stub return null; } @Override public Flux<Person> getAll() { // TODO Auto-generated method stub return null; } }
[ "metee.dev@gmail.com" ]
metee.dev@gmail.com
fcd2ff798c6c5a97ed5aeaeb53c9ab610a50699d
039ec44770c6bb429a5ab2686ddb0dbae4bc9097
/shop/src/main/java/com/zds/controller/GoodsController.java
7d4c3f4ee605920cecdf57e61af5969f5f323122
[]
no_license
zhongds01/zhongds01
302f214c05c85e119d9bd32aeba7a64aa43eb2b8
084a95e094297c8130bfa40adfe49c6a9bbf872f
refs/heads/master
2022-12-23T13:57:53.232174
2020-11-12T14:23:02
2020-11-12T14:23:02
157,668,851
4
1
null
2022-12-16T09:43:00
2018-11-15T07:18:16
Java
UTF-8
Java
false
false
5,224
java
package com.zds.controller; import com.zds.bean.Goods; import com.zds.service.GoodsService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import java.io.File; import java.io.IOException; import java.util.*; /** * description: please add the description * author: ZDS * create_date : 2019/4/19 * create_time : 1:13 */ @Controller public class GoodsController { private Logger log = LoggerFactory.getLogger("GoodsController.class"); @Resource(name = "goodsServiceImpl") private GoodsService goodsService; @RequestMapping("/getAllGoods.action") @ResponseBody public List<Goods> getAllGoods(){ List<Goods> goods = goodsService.getAllGoods(); for (int i=0;i<goods.size();i++){ String url = goods.get(i).getGoodsPic(); url = url.replaceAll("\\\\","/"); System.out.println(url); goods.get(i).setGoodsPic(url); } return goods; } @RequestMapping("/commentGoods.action") @ResponseBody public Map<String,String> commentGoods(Goods goods){ Map<String,String> map = new HashMap<String, String>(); System.out.println(goods.getGoodsId()); System.out.println(goods.getGoodsComment()); int row = goodsService.commentGoods(goods); if (row>0){ map.put("msg","ok"); }else { map.put("msg","error"); } return map; } @RequestMapping("/goodsAdd.action") public String goodsAdd(String goodsName,Double goodsPrice,String goodsCata,Integer goodsStock,String goodsDesc,String goodsComment, MultipartFile goodsPic){ //System.out.println(goodsName); String originalName = goodsPic.getOriginalFilename(); String dirPath = "D:"+File.separator+"upload"+File.separator+ Calendar.getInstance().get(Calendar.YEAR)+File.separator+(Calendar.getInstance().get(Calendar.MONTH)+1)+File.separator+Calendar.getInstance().get(Calendar.DATE)+File.separator; File filePath = new File(dirPath); if (!filePath.exists()){ filePath.mkdirs(); } String newName = UUID.randomUUID()+"_"+originalName; try { goodsPic.transferTo(new File(dirPath + newName )); } catch (IOException e) { e.printStackTrace(); } String goodsPicURL = Calendar.getInstance().get(Calendar.YEAR)+File.separator+(Calendar.getInstance().get(Calendar.MONTH)+1)+File.separator+Calendar.getInstance().get(Calendar.DATE)+File.separator+newName; Goods goods = new Goods(); System.out.println(goodsPrice); goods.setGoodsStock(goodsStock); goods.setGoodsCata(goodsCata); goods.setGoodsDesc(goodsDesc); goods.setGoodsName(goodsName); goods.setGoodsPrice(goodsPrice); goods.setGoodsComment(goodsComment); goods.setState("U"); goods.setGoodsPic(goodsPicURL); int row = goodsService.insert(goods); if (row>0){ return "ok"; }else { return "error"; } } @RequestMapping("/recommend.action") @ResponseBody public List<Goods> recommend(){ return goodsService.recommend(); } @RequestMapping("/searchGoods.action") @ResponseBody public List<Goods> searchGoods(String goodsName){ return goodsService.searchGoods(goodsName); } @RequestMapping("/searchGoodsByCata.action") @ResponseBody public List<Goods> searchGoodsByCata (String goodsCata){ return goodsService.searchGoodsByCata(goodsCata); } @RequestMapping("/searchGoodsByNameOrCata.action") @ResponseBody public List<Goods> searchGoodsByNameOrCata (String goodsName,String goodsCata){ return goodsService.searchGoodsByNameOrCata(goodsName,goodsCata); } @RequestMapping("/modifyGoods.action") @ResponseBody public Map<String,String> modifyGoods(String modifyGoods){ Map<String,String> map = new HashMap<String, String>(); int row = goodsService.modifyGoods(modifyGoods); if (row>0){ map.put("msg","ok"); }else { map.put("msg","error"); } return map; } @RequestMapping("/reduceMounts.action") @ResponseBody public Map<String,String> reduceMounts(String shopCars){ Map<String,String> map = new HashMap<String, String>(); int row = goodsService.reduceMounts(shopCars); if (row>0){ map.put("msg","ok"); }else { map.put("msg","error"); } return map; } @RequestMapping("/deleteGoods.action") @ResponseBody public Map<String,String> deleteGoods(Integer goodsId){ Map<String,String> map = new HashMap<String, String>(); int row = goodsService.deleteGoods(goodsId); if (row>0){ map.put("msg","ok"); }else { map.put("msg","error"); } return map; } }
[ "1246696804@qq.com" ]
1246696804@qq.com
4dd081029831973b9ebd13d680fdae66a2fbb76f
8cb1d16152258c4cabaa73f57ce1eb9baf34d56b
/src/warmup/page8/excelsheetcolumntitle/ExcelSheetColumnTitle.java
18d10c4b3f194d2a918fe7597da3ee70cfca7a78
[]
no_license
ZhaoPeixiao/leetcode
9361638a78b064000e36becaadf5643577178caf
16266b9653433c48d43f2c09ef919b2fda497832
refs/heads/master
2023-01-04T14:59:26.856814
2020-10-19T06:03:12
2020-10-19T06:03:12
282,442,039
0
0
null
null
null
null
UTF-8
Java
false
false
634
java
package warmup.page8.excelsheetcolumntitle; /** * @author Peixiao Zhao * @date 2020/9/10 */ class Solution { public String convertToTitle(int n) { StringBuilder stringBuilder = new StringBuilder(); while (n > 26){ int i = n % 26; if (i == 0){ stringBuilder.append((char)('Z')); n /= 26; -- n; } else{ stringBuilder.append((char)(i+'A' - 1)); n/= 26; } } stringBuilder.append((char)(n+'A' - 1)); return stringBuilder.reverse().toString(); } }
[ "u6935249@anu.edu.au" ]
u6935249@anu.edu.au
7e5ff40e1add20b8dda006b69674265b251ea038
bf2966abae57885c29e70852243a22abc8ba8eb0
/aws-java-sdk-eks/src/main/java/com/amazonaws/services/eks/model/transform/ResourceNotFoundExceptionUnmarshaller.java
90e496af1523ea8ee25e859d08309cc610326fc9
[ "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
3,890
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.eks.model.transform; import java.math.*; import javax.annotation.Generated; import com.amazonaws.services.eks.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import com.fasterxml.jackson.core.JsonToken; import static com.fasterxml.jackson.core.JsonToken.*; /** * ResourceNotFoundException JSON Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ResourceNotFoundExceptionUnmarshaller extends EnhancedJsonErrorUnmarshaller { private ResourceNotFoundExceptionUnmarshaller() { super(com.amazonaws.services.eks.model.ResourceNotFoundException.class, "ResourceNotFoundException"); } @Override public com.amazonaws.services.eks.model.ResourceNotFoundException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception { com.amazonaws.services.eks.model.ResourceNotFoundException resourceNotFoundException = new com.amazonaws.services.eks.model.ResourceNotFoundException( null); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) { return null; } while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("clusterName", targetDepth)) { context.nextToken(); resourceNotFoundException.setClusterName(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("nodegroupName", targetDepth)) { context.nextToken(); resourceNotFoundException.setNodegroupName(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("fargateProfileName", targetDepth)) { context.nextToken(); resourceNotFoundException.setFargateProfileName(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("addonName", targetDepth)) { context.nextToken(); resourceNotFoundException.setAddonName(context.getUnmarshaller(String.class).unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return resourceNotFoundException; } private static ResourceNotFoundExceptionUnmarshaller instance; public static ResourceNotFoundExceptionUnmarshaller getInstance() { if (instance == null) instance = new ResourceNotFoundExceptionUnmarshaller(); return instance; } }
[ "" ]
150ca0e1947f66e9160115e01b09e7de76302e91
6b0aaf9a71a3c5c919ebc3bda684bbf384c1228d
/bankCard/src/bankCard/How_To_Use_Token.java
eac23e51f7b77765a31219ace0331d09fa931511
[]
no_license
sushilpokharel2009/java-basics
ae3c6858384e0d0f6c2fee7c5654e9fdff9a99ff
ccf854990542e2331a912472bc5df043364ab1e5
refs/heads/master
2021-03-30T21:29:45.706219
2018-03-11T17:47:35
2018-03-11T17:47:35
124,782,489
0
0
null
null
null
null
UTF-8
Java
false
false
1,619
java
package bankCard; import java.util.HashMap; public class How_To_Use_Token { public static void main(String[] args) { String ACCOUNT_ID = "Merchant's Account ID Here"; String SECRET_KEY = "Merchant's Secret Key Here"; String MODE = "TEST"; String TOKEN = "Transaction ID here"; BluePay payment = new BluePay( ACCOUNT_ID, SECRET_KEY, MODE ); // Sale Amount: $3.00 HashMap<String, String> saleParams = new HashMap<>(); saleParams.put("amount", "3.00"); saleParams.put("transactionID", TOKEN); // The transaction ID of a previous sale payment.sale(saleParams); // Makes the API Request with BluePay try { payment.process(); } catch (Exception ex) { System.out.println("Exception: " + ex.toString()); System.exit(1); } // If transaction was successful reads the responses from BluePay if (payment.isSuccessful()) { System.out.println("Transaction Status: " + payment.getStatus()); System.out.println("Transaction ID: " + payment.getTransID()); System.out.println("Transaction Message: " + payment.getMessage()); System.out.println("AVS Result: " + payment.getAVS()); System.out.println("CVV2: " + payment.getCVV2()); System.out.println("Masked Payment Account: " + payment.getMaskedPaymentAccount()); System.out.println("Card Type: " + payment.getCardType()); System.out.println("Authorization Code: " + payment.getAuthCode()); } else { System.out.println("Error: " + payment.getMessage()); } } }
[ "aruna_poudyal@yahoo.com" ]
aruna_poudyal@yahoo.com
ae79bb70f85dbd704872ee54581a5e94c873c6e6
403aca6b4e2a60e773820fafa2a79ffe2ee4805b
/src/src/net/idtoki/serteca/model/BaseVehiculo.java
24e578d40aee606f8a61643785e8f3005ea3579d
[]
no_license
esle-elkartea/lankidetza00004
e57a32c2d00416f86da45458db030558ef4e7f5a
a02a4ddf45050fbe85dbf41af146ae86f0b0cf22
refs/heads/master
2020-12-24T11:53:20.234029
2016-06-24T09:38:34
2016-06-24T09:38:34
61,873,745
0
0
null
null
null
null
UTF-8
Java
false
false
25,861
java
package net.idtoki.serteca.model; import java.math.BigDecimal; import java.sql.Connection; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; import net.zylk.tools.ajax.AjaxUtils; import org.apache.commons.lang.ObjectUtils; import org.apache.torque.TorqueException; import org.apache.torque.om.BaseObject; import org.apache.torque.om.ComboKey; import org.apache.torque.om.DateKey; import org.apache.torque.om.NumberKey; import org.apache.torque.om.ObjectKey; import org.apache.torque.om.SimpleKey; import org.apache.torque.om.StringKey; import org.apache.torque.om.Persistent; import org.apache.torque.util.Criteria; import org.apache.torque.util.Transaction; /** * This class was autogenerated by Torque on: * * [Mon Jul 03 11:03:24 CEST 2006] * * You should not use this class directly. It should not even be * extended all references should be to Vehiculo */ public abstract class BaseVehiculo extends BaseObject { /** The Peer class */ private static final VehiculoPeer peer = new VehiculoPeer(); /** The value for the id field */ private int id = -1; /** The value for the modeloId field */ private int modeloId; /** The value for the version field */ private String version = ""; /** The value for the matricula field */ private String matricula = ""; /** The value for the clienteId field */ private int clienteId; /** The value for the chasisId field */ private String chasisId; /** The value for the motorId field */ private String motorId; /** The value for the color field */ private String color; /** The value for the fechaMatriculacion field */ private String fechaMatriculacion; /** The value for the fechaRevision field */ private String fechaRevision; /** The value for the obs field */ private String obs; /** * Get the Id * * @return int */ public int getId() { return id; } /** * Set the value of Id * * @param v new value */ public void setId(int v) throws TorqueException { if (this.id != v) { this.id = v; setModified(true); } } /** * Get the ModeloId * * @return int */ public int getModeloId() { return modeloId; } /** * Set the value of ModeloId * * @param v new value */ public void setModeloId(int v) throws TorqueException { if (this.modeloId != v) { this.modeloId = v; setModified(true); } if (aModelo != null && !(aModelo.getId() == v)) { aModelo = null; } } /** * Get the Version * * @return String */ public String getVersion() { return version; } /** * Set the value of Version * * @param v new value */ public void setVersion(String v) { if (!ObjectUtils.equals(this.version, v)) { this.version = v; setModified(true); } } /** * Get the Matricula * * @return String */ public String getMatricula() { return matricula; } /** * Set the value of Matricula * * @param v new value */ public void setMatricula(String v) { if (!ObjectUtils.equals(this.matricula, v)) { this.matricula = v; setModified(true); } } /** * Get the ClienteId * * @return int */ public int getClienteId() { return clienteId; } /** * Set the value of ClienteId * * @param v new value */ public void setClienteId(int v) throws TorqueException { if (this.clienteId != v) { this.clienteId = v; setModified(true); } if (aCliente != null && !(aCliente.getId() == v)) { aCliente = null; } } /** * Get the ChasisId * * @return String */ public String getChasisId() { return chasisId; } /** * Set the value of ChasisId * * @param v new value */ public void setChasisId(String v) { if (!ObjectUtils.equals(this.chasisId, v)) { this.chasisId = v; setModified(true); } } /** * Get the MotorId * * @return String */ public String getMotorId() { return motorId; } /** * Set the value of MotorId * * @param v new value */ public void setMotorId(String v) { if (!ObjectUtils.equals(this.motorId, v)) { this.motorId = v; setModified(true); } } /** * Get the Color * * @return String */ public String getColor() { return color; } /** * Set the value of Color * * @param v new value */ public void setColor(String v) { if (!ObjectUtils.equals(this.color, v)) { this.color = v; setModified(true); } } /** * Get the FechaMatriculacion * * @return String */ public String getFechaMatriculacion() { return fechaMatriculacion; } /** * Set the value of FechaMatriculacion * * @param v new value */ public void setFechaMatriculacion(String v) { if (!ObjectUtils.equals(this.fechaMatriculacion, v)) { this.fechaMatriculacion = v; setModified(true); } } /** * Get the FechaRevision * * @return String */ public String getFechaRevision() { return fechaRevision; } /** * Set the value of FechaRevision * * @param v new value */ public void setFechaRevision(String v) { if (!ObjectUtils.equals(this.fechaRevision, v)) { this.fechaRevision = v; setModified(true); } } /** * Get the Obs * * @return String */ public String getObs() { return obs; } /** * Set the value of Obs * * @param v new value */ public void setObs(String v) { if (!ObjectUtils.equals(this.obs, v)) { this.obs = v; setModified(true); } } private Modelo aModelo; /** * Declares an association between this object and a Modelo object * * @param v Modelo * @throws TorqueException */ public void setModelo(Modelo v) throws TorqueException { if (v == null) { setModeloId( 0); } else { setModeloId(v.getId()); } aModelo = v; } /** * Get the associated Modelo object * * @return the associated Modelo object * @throws TorqueException */ public Modelo getModelo() throws TorqueException { if (aModelo == null && (this.modeloId != 0)) { aModelo = ModeloPeer.retrieveByPK(SimpleKey.keyFor(this.modeloId)); /* The following can be used instead of the line above to guarantee the related object contains a reference to this object, but this level of coupling may be undesirable in many circumstances. As it can lead to a db query with many results that may never be used. Modelo obj = ModeloPeer.retrieveByPK(this.modeloId); obj.addVehiculos(this); */ } return aModelo; } /** * Provides convenient way to set a relationship based on a * ObjectKey, for example * <code>bar.setFooKey(foo.getPrimaryKey())</code> * */ public void setModeloKey(ObjectKey key) throws TorqueException { setModeloId(((NumberKey) key).intValue()); } private Cliente aCliente; /** * Declares an association between this object and a Cliente object * * @param v Cliente * @throws TorqueException */ public void setCliente(Cliente v) throws TorqueException { if (v == null) { setClienteId( 0); } else { setClienteId(v.getId()); } aCliente = v; } /** * Get the associated Cliente object * * @return the associated Cliente object * @throws TorqueException */ public Cliente getCliente() throws TorqueException { if (aCliente == null && (this.clienteId != 0)) { aCliente = ClientePeer.retrieveByPK(SimpleKey.keyFor(this.clienteId)); /* The following can be used instead of the line above to guarantee the related object contains a reference to this object, but this level of coupling may be undesirable in many circumstances. As it can lead to a db query with many results that may never be used. Cliente obj = ClientePeer.retrieveByPK(this.clienteId); obj.addVehiculos(this); */ } return aCliente; } /** * Provides convenient way to set a relationship based on a * ObjectKey, for example * <code>bar.setFooKey(foo.getPrimaryKey())</code> * */ public void setClienteKey(ObjectKey key) throws TorqueException { setClienteId(((NumberKey) key).intValue()); } /** * If this collection has already been initialized, returns * the collection. Otherwise returns the results of * getReparacions(new Criteria()) * * @throws TorqueException */ public List getReparacions() throws TorqueException { return getReparacions(new Criteria(10)); } /** * If this collection has already been initialized with * an identical criteria, it returns the collection. * Otherwise if this Vehiculo has previously * been saved, it will retrieve related Reparacions from storage. * If this Vehiculo is new, it will return * an empty collection or the current collection, the criteria * is ignored on a new object. * * @throws TorqueException */ public List getReparacions(Criteria criteria) throws TorqueException { criteria.add(ReparacionPeer.VEHICULO_ID, getId()); return ReparacionPeer.doSelect(criteria); } /** * If this collection has already been initialized, returns * the collection. Otherwise returns the results of * getReparacions(new Criteria(),Connection) * This method takes in the Connection also as input so that * referenced objects can also be obtained using a Connection * that is taken as input */ public List getReparacions(Connection con) throws TorqueException { return getReparacions(new Criteria(10), con); } /** * If this collection has already been initialized with * an identical criteria, it returns the collection. * Otherwise if this Vehiculo has previously * been saved, it will retrieve related Reparacions from storage. * If this Vehiculo is new, it will return * an empty collection or the current collection, the criteria * is ignored on a new object. * This method takes in the Connection also as input so that * referenced objects can also be obtained using a Connection * that is taken as input */ public List getReparacions(Criteria criteria, Connection con) throws TorqueException { criteria.add(ReparacionPeer.VEHICULO_ID, getId()); return ReparacionPeer.doSelect(criteria, con); } /** * If this collection has already been initialized with * an identical criteria, it returns the collection. * Otherwise if this Vehiculo is new, it will return * an empty collection; or if this Vehiculo has previously * been saved, it will retrieve related Reparacions from storage. * * This method is protected by default in order to keep the public * api reasonable. You can provide public methods for those you * actually need in Vehiculo. */ protected List getReparacionsJoinVehiculo(Criteria criteria) throws TorqueException { criteria.add(ReparacionPeer.VEHICULO_ID, getId()); return ReparacionPeer.doSelectJoinVehiculo(criteria); } private static List fieldNames = null; /** * Generate a list of field names. * * @return a list of field names */ public static synchronized List getFieldNames() { if (fieldNames == null) { fieldNames = new ArrayList(); fieldNames.add("Id"); fieldNames.add("ModeloId"); fieldNames.add("Version"); fieldNames.add("Matricula"); fieldNames.add("ClienteId"); fieldNames.add("ChasisId"); fieldNames.add("MotorId"); fieldNames.add("Color"); fieldNames.add("FechaMatriculacion"); fieldNames.add("FechaRevision"); fieldNames.add("Obs"); fieldNames = Collections.unmodifiableList(fieldNames); } return fieldNames; } /** * Retrieves a field from the object by name passed in as a String. * * @param name field name * @return value */ public Object getByName(String name) { if (name.equals("Id")) { return new Integer(getId()); } if (name.equals("ModeloId")) { return new Integer(getModeloId()); } if (name.equals("Version")) { return getVersion(); } if (name.equals("Matricula")) { return getMatricula(); } if (name.equals("ClienteId")) { return new Integer(getClienteId()); } if (name.equals("ChasisId")) { return getChasisId(); } if (name.equals("MotorId")) { return getMotorId(); } if (name.equals("Color")) { return getColor(); } if (name.equals("FechaMatriculacion")) { return getFechaMatriculacion(); } if (name.equals("FechaRevision")) { return getFechaRevision(); } if (name.equals("Obs")) { return getObs(); } return null; } /** * Retrieves a field from the object by name passed in * as a String. The String must be one of the static * Strings defined in this Class' Peer. * * @param name peer name * @return value */ public Object getByPeerName(String name) { if (name.equals(VehiculoPeer.ID)) { return new Integer(getId()); } if (name.equals(VehiculoPeer.MODELO_ID)) { return new Integer(getModeloId()); } if (name.equals(VehiculoPeer.VERSION)) { return getVersion(); } if (name.equals(VehiculoPeer.MATRICULA)) { return getMatricula(); } if (name.equals(VehiculoPeer.CLIENTE_ID)) { return new Integer(getClienteId()); } if (name.equals(VehiculoPeer.CHASIS_ID)) { return getChasisId(); } if (name.equals(VehiculoPeer.MOTOR_ID)) { return getMotorId(); } if (name.equals(VehiculoPeer.COLOR)) { return getColor(); } if (name.equals(VehiculoPeer.FECHA_MATRICULACION)) { return getFechaMatriculacion(); } if (name.equals(VehiculoPeer.FECHA_REVISION)) { return getFechaRevision(); } if (name.equals(VehiculoPeer.OBSERVACION)) { return getObs(); } return null; } /** * Retrieves a field from the object by Position as specified * in the xml schema. Zero-based. * * @param pos position in xml schema * @return value */ public Object getByPosition(int pos) { if (pos == 0) { return new Integer(getId()); } if (pos == 1) { return new Integer(getModeloId()); } if (pos == 2) { return getVersion(); } if (pos == 3) { return getMatricula(); } if (pos == 4) { return new Integer(getClienteId()); } if (pos == 5) { return getChasisId(); } if (pos == 6) { return getMotorId(); } if (pos == 7) { return getColor(); } if (pos == 8) { return getFechaMatriculacion(); } if (pos == 9) { return getFechaRevision(); } if (pos == 10) { return getObs(); } return null; } /** * Stores the object in the database. If the object is new, * it inserts it; otherwise an update is performed. * * @throws Exception */ public void save() throws Exception { save(VehiculoPeer.getMapBuilder() .getDatabaseMap().getName()); } /** * Stores the object in the database. If the object is new, * it inserts it; otherwise an update is performed. * Note: this code is here because the method body is * auto-generated conditionally and therefore needs to be * in this file instead of in the super class, BaseObject. * * @param dbName * @throws TorqueException */ public void save(String dbName) throws TorqueException { Connection con = null; try { con = Transaction.begin(dbName); save(con); Transaction.commit(con); } catch(TorqueException e) { Transaction.safeRollback(con); throw e; } } /** flag to prevent endless save loop, if this object is referenced by another object which falls in this transaction. */ private boolean alreadyInSave = false; /** * Stores the object in the database. If the object is new, * it inserts it; otherwise an update is performed. This method * is meant to be used as part of a transaction, otherwise use * the save() method and the connection details will be handled * internally * * @param con * @throws TorqueException */ public void save(Connection con) throws TorqueException { if (!alreadyInSave) { alreadyInSave = true; // If this object has been modified, then save it to the database. if (isModified()) { if (isNew()) { VehiculoPeer.doInsert((Vehiculo) this, con); setNew(false); } else { VehiculoPeer.doUpdate((Vehiculo) this, con); } } alreadyInSave = false; } } /** * Set the PrimaryKey using ObjectKey. * * @param key id ObjectKey */ public void setPrimaryKey(ObjectKey key) throws TorqueException { setId(((NumberKey) key).intValue()); } /** * Set the PrimaryKey using a String. * * @param key */ public void setPrimaryKey(String key) throws TorqueException { setId(Integer.parseInt(key)); } /** * returns an id that differentiates this object from others * of its class. */ public ObjectKey getPrimaryKey() { return SimpleKey.keyFor(getId()); } /** * Makes a copy of this object. * It creates a new object filling in the simple attributes. * It then fills all the association collections and sets the * related objects to isNew=true. */ public Vehiculo copy() throws TorqueException { return copyInto(new Vehiculo()); } protected Vehiculo copyInto(Vehiculo copyObj) throws TorqueException { copyObj.setId(id); copyObj.setModeloId(modeloId); copyObj.setVersion(version); copyObj.setMatricula(matricula); copyObj.setClienteId(clienteId); copyObj.setChasisId(chasisId); copyObj.setMotorId(motorId); copyObj.setColor(color); copyObj.setFechaMatriculacion(fechaMatriculacion); copyObj.setFechaRevision(fechaRevision); copyObj.setObs(obs); copyObj.setId( -1); return copyObj; } /** * returns a peer instance associated with this om. Since Peer classes * are not to have any instance attributes, this method returns the * same instance for all member of this class. The method could therefore * be static, but this would prevent one from overriding the behavior. */ public VehiculoPeer getPeer() { return peer; } public String toString() { StringBuffer str = new StringBuffer(); str.append("Vehiculo:\n"); str.append("Id = ") .append(getId()) .append("\n"); str.append("ModeloId = ") .append(getModeloId()) .append("\n"); str.append("Version = ") .append(getVersion()) .append("\n"); str.append("Matricula = ") .append(getMatricula()) .append("\n"); str.append("ClienteId = ") .append(getClienteId()) .append("\n"); str.append("ChasisId = ") .append(getChasisId()) .append("\n"); str.append("MotorId = ") .append(getMotorId()) .append("\n"); str.append("Color = ") .append(getColor()) .append("\n"); str.append("FechaMatriculacion = ") .append(getFechaMatriculacion()) .append("\n"); str.append("FechaRevision = ") .append(getFechaRevision()) .append("\n"); str.append("Obs = ") .append(getObs()) .append("\n"); return(str.toString()); } public String getComplexId() { ArrayList a = new ArrayList(); a.add(Integer.toString(this.getId())); return AjaxUtils.concatenateIdFields(a); } }
[ "noreply@esle.eu" ]
noreply@esle.eu
af439eb321b040f14ff9bfabaf5ba182418df1c6
f281d0d6431c1b45c6e5ebfff5856c374af4b130
/DAY100~199/DAY122-programmers-단어변환/hyunhee_bfs.java
f56292a8cec62475012c118b8c880a360f3fee40
[]
no_license
tachyon83/code-rhino
ec802dc91dce20980fac401b26165a487494adb4
b1af000f5798cd12ecdab36aeb9c7a36f91c1101
refs/heads/master
2022-08-13T09:10:16.369287
2022-07-30T11:27:34
2022-07-30T11:27:34
292,142,812
5
6
null
null
null
null
UTF-8
Java
false
false
1,380
java
package level3.단어변환; import java.util.*; class Solution_BFS { public static void main(String[] args) { System.out.println(solution("hit", "cog", new String[] { "hot", "dot", "dog", "lot", "log", "cog" })); System.out.println(solution("hit", "cog", new String[] { "hot", "dot", "dog", "lot", "log" })); } static class Point { char[] word; int count; public Point(char[] word, int count) { this.word = word; this.count = count; } } public static int solution(String begin, String target, String[] words) { Queue<Point> queue = new LinkedList<>(); char[] temp = begin.toCharArray(); queue.offer(new Point(temp, 0)); boolean[] isVisited = new boolean[words.length]; while (!queue.isEmpty()) { Point p = queue.poll(); String answer = ""; for (int i = 0; i < p.word.length; i++) { answer += p.word[i]; } if (answer.equals(target)) { return p.count; } for (int i = 0; i < words.length; i++) { if (isVisited[i]) { continue; } temp = words[i].toCharArray(); if (check(p.word, temp)) { queue.offer(new Point(temp, p.count + 1)); isVisited[i] = true; } } } return 0; } private static boolean check(char[] word, char[] target) { int cnt = 0; for (int i = 0; i < target.length; i++) { if (word[i] != target[i]) { cnt++; } } return cnt == 1; } }
[ "wjdgusgml997@naver.com" ]
wjdgusgml997@naver.com
73a0ac0dab117dcc8db1fad112bafe17dc1ae788
6e4f2c061c5584c673206de8c2a03f1815752309
/app/src/test/java/com/example/lenovo/zh_v3/ExampleUnitTest.java
8bca2b88c0f5861fdfabc1149d7c0d3a4dfa7183
[]
no_license
DanceInDark/zhihu
55865a01bcdabaae4afb74efcd4016918768a5c3
3ab57ba5b7ca874a6130383ab41a0a83ca8da140
refs/heads/master
2020-04-11T15:22:46.313393
2018-12-15T09:26:58
2018-12-15T09:26:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
402
java
package com.example.lenovo.zh_v3; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "1247609574@qq.com" ]
1247609574@qq.com
8926175e367ded6cedf1fb3c96c79db3d1911d0a
dc15e59b5baa26178c02561308afde41c315bbb4
/swift-study/src/main/java/com/swift/sr18/mt564/SeqE1F90AOFFRType.java
c482ce1e79c66b98e6807aa996cba8332724da8d
[]
no_license
zbdy20061001/swift
0e7014e2986a8f6fc04ad22f2505b7f05d67d7b8
260e942b848175d1e8d12571a3d32efecaa3d437
refs/heads/master
2020-04-26T19:16:05.954125
2019-03-04T15:12:27
2019-03-04T15:12:27
173,768,829
0
0
null
null
null
null
GB18030
Java
false
false
4,630
java
// // 此文件是由 JavaTM Architecture for XML Binding (JAXB) 引用实现 v2.2.8-b130911.1802 生成的 // 请访问 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // 在重新编译源模式时, 对此文件的所有修改都将丢失。 // 生成时间: 2018.12.05 时间 12:24:35 AM CST // package com.swift.sr18.mt564; 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>SeqE1_F90a_OFFR_Type complex type的 Java 类。 * * <p>以下模式片段指定包含在此类中的预期内容。 * * <pre> * &lt;complexType name="SeqE1_F90a_OFFR_Type"> * &lt;complexContent> * &lt;extension base="{urn:swift:xsd:fin.564.2018}Qualifier"> * &lt;choice> * &lt;element name="F90A" type="{urn:swift:xsd:fin.564.2018}F90A_2_Type"/> * &lt;element name="F90B" type="{urn:swift:xsd:fin.564.2018}F90B_7_Type"/> * &lt;element name="F90E" type="{urn:swift:xsd:fin.564.2018}F90E_9_Type"/> * &lt;element name="F90F" type="{urn:swift:xsd:fin.564.2018}F90F_2_Type"/> * &lt;element name="F90J" type="{urn:swift:xsd:fin.564.2018}F90J_2_Type"/> * &lt;element name="F90L" type="{urn:swift:xsd:fin.564.2018}F90L_Type"/> * &lt;/choice> * &lt;/extension> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "SeqE1_F90a_OFFR_Type", propOrder = { "f90A", "f90B", "f90E", "f90F", "f90J", "f90L" }) public class SeqE1F90AOFFRType extends Qualifier { @XmlElement(name = "F90A") protected F90A2Type f90A; @XmlElement(name = "F90B") protected F90B7Type f90B; @XmlElement(name = "F90E") protected F90E9Type f90E; @XmlElement(name = "F90F") protected F90F2Type f90F; @XmlElement(name = "F90J") protected F90J2Type f90J; @XmlElement(name = "F90L") protected F90LType f90L; /** * 获取f90A属性的值。 * * @return * possible object is * {@link F90A2Type } * */ public F90A2Type getF90A() { return f90A; } /** * 设置f90A属性的值。 * * @param value * allowed object is * {@link F90A2Type } * */ public void setF90A(F90A2Type value) { this.f90A = value; } /** * 获取f90B属性的值。 * * @return * possible object is * {@link F90B7Type } * */ public F90B7Type getF90B() { return f90B; } /** * 设置f90B属性的值。 * * @param value * allowed object is * {@link F90B7Type } * */ public void setF90B(F90B7Type value) { this.f90B = value; } /** * 获取f90E属性的值。 * * @return * possible object is * {@link F90E9Type } * */ public F90E9Type getF90E() { return f90E; } /** * 设置f90E属性的值。 * * @param value * allowed object is * {@link F90E9Type } * */ public void setF90E(F90E9Type value) { this.f90E = value; } /** * 获取f90F属性的值。 * * @return * possible object is * {@link F90F2Type } * */ public F90F2Type getF90F() { return f90F; } /** * 设置f90F属性的值。 * * @param value * allowed object is * {@link F90F2Type } * */ public void setF90F(F90F2Type value) { this.f90F = value; } /** * 获取f90J属性的值。 * * @return * possible object is * {@link F90J2Type } * */ public F90J2Type getF90J() { return f90J; } /** * 设置f90J属性的值。 * * @param value * allowed object is * {@link F90J2Type } * */ public void setF90J(F90J2Type value) { this.f90J = value; } /** * 获取f90L属性的值。 * * @return * possible object is * {@link F90LType } * */ public F90LType getF90L() { return f90L; } /** * 设置f90L属性的值。 * * @param value * allowed object is * {@link F90LType } * */ public void setF90L(F90LType value) { this.f90L = value; } }
[ "zbdy20061001@163.com" ]
zbdy20061001@163.com
b168f6e4d21002f52fd69defa784b4b69f82d3ce
16ee4fa3ddd43532dc897dcf3cead46a4c54470b
/src/main/java/com/epam/hostel/command/impl/ChangeLanguageCommand.java
6cda3ddf33989b1407080beb55c8d1bb64d87de4
[]
no_license
kusmen21/Web_EPAM
9c908fab2b300ea7a4b2f86d91e64bcb90c8b5af
59d9806d3177d1bc9987807afa96e7ae473ac3ab
refs/heads/master
2021-01-19T12:30:11.744970
2017-10-19T07:44:25
2017-10-19T07:44:25
100,793,556
0
0
null
null
null
null
UTF-8
Java
false
false
1,589
java
package com.epam.hostel.command.impl; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; import com.epam.hostel.command.ExtendedСommand; import com.epam.hostel.resource.ConfigurationManager; public class ChangeLanguageCommand extends ExtendedСommand { private static final Logger log = LogManager.getLogger(ChangeLanguageCommand.class); private static final String LOCALE_EMPTY_MESSAGE = "error.locale_empty"; private static final String RUSSIAN = "ru"; private static final String ENGLISH = "en"; @Override public String execute(HttpServletRequest request, HttpServletResponse response) { String page = ConfigurationManager.getProperty(INDEX_PAGE); // redirect to previous page Object previousPageObject = request.getSession().getAttribute(PAGE_ATTRIBUTE); if (previousPageObject != null && previousPageObject instanceof String) { String previousPage = (String) previousPageObject; page = ConfigurationManager.getProperty(previousPage); } String locale = request.getParameter(LOCALE); if (locale != null && !locale.isEmpty()) { if (locale.equals(RUSSIAN)) { request.getSession().setAttribute(LOCALE_ATTRIBUTE, RUSSIAN); } else { if (locale.equals(ENGLISH)) { request.getSession().setAttribute(LOCALE_ATTRIBUTE, ENGLISH); } } } else { String errorMessage = LOCALE_EMPTY_MESSAGE; log.error(errorMessage); request.getSession().setAttribute(LOGIN_ERROR_ATTRIBUTE, errorMessage); } return page; } }
[ "kusmen21kda@gmail.com" ]
kusmen21kda@gmail.com
16339469a5a2629382bdcab30df072724003fefe
122ef137bfcdda5b5f6665f7d0db1a21b12b1cdc
/app/src/main/java/com/example/felixlarrouy/youtube/adapters/YTSearch/OnSearchVideoClickListener.java
e3adc3e885d500a62fcb844f9ffd2d25d8069770
[]
no_license
felixlarrouy/YouTube_app
c8d11105b0bb8b986708ed2f77423ff80d275bba
5facd5cef3c327d599fddbabbf4045fdc736c61e
refs/heads/master
2021-04-15T03:39:44.470066
2018-03-23T15:28:48
2018-03-23T15:28:48
126,504,073
0
0
null
null
null
null
UTF-8
Java
false
false
277
java
package com.example.felixlarrouy.youtube.adapters.YTSearch; import com.example.felixlarrouy.youtube.models.YTSearch.SearchVideo; /** * Created by felixlarrouy on 07/03/2018. */ public interface OnSearchVideoClickListener { void onSearchVideoClick(SearchVideo item); }
[ "felix.larrouy@gmail.com" ]
felix.larrouy@gmail.com
76911ee16c14cf15b8c0ff7e57dd436d2a5d36e5
d415812d71ce6d3834c5e1e6d3964d8f80d33855
/src/trab/Redis.java
a5f06d6f6498fbcde9695a9e1dbe322769375568
[ "MIT" ]
permissive
vieirinhasantana/pattern
0309b5ae96550ebd255b4f67b3e1ac7b596aa91d
2a868ff50dd33eaf7ebfbd67ebecd2f479ff83da
refs/heads/master
2021-05-16T05:11:31.981978
2017-10-14T01:47:16
2017-10-14T01:47:16
106,311,727
0
0
null
null
null
null
UTF-8
Java
false
false
263
java
package trab; public class Redis extends Buscador{ public Redis(Buscador proximo) { super(proximo); } @Override public Boolean buscar() { System.out.println("Usuário nao encontrado em Redis"); return false; } }
[ "daniel.vieira@obers-server.intra" ]
daniel.vieira@obers-server.intra
12aefc1babf35c0f5b1cf6a797f149a62e64ce12
5222ab5f4e96d0e97d965bceb37bde77d06ca11d
/weilan/src/main/java/com/cfyj/weilan/utils/MD5Util.java
f08b4a42cf6377fd80584fb2b509734bbee9ff11
[]
no_license
yqxz045000/weilan
7f57827611f387754d59f521aafa4423efe59e85
8ab55fdf1d3510bfe1b0b07a3b6284224c61aa05
refs/heads/master
2021-05-07T01:45:39.477944
2018-08-05T08:07:43
2018-08-05T08:07:43
110,419,403
0
0
null
2018-05-19T05:45:33
2017-11-12T09:16:38
Java
UTF-8
Java
false
false
1,277
java
package com.cfyj.weilan.utils; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class MD5Util { private static final char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; private static MessageDigest mdInst; static { try { mdInst = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } } public static String MD5(String key) { try { byte[] btInput = key.getBytes(); // 获得MD5摘要算法的 MessageDigest 对象 // 使用指定的字节更新摘要 mdInst.update(btInput); // 获得密文 byte[] md = mdInst.digest(); // 把密文转换成十六进制的字符串形式 int j = md.length; char str[] = new char[j * 2]; int k = 0; for (int i = 0; i < j; i++) { byte byte0 = md[i]; str[k++] = hexDigits[byte0 >>> 4 & 0xf]; str[k++] = hexDigits[byte0 & 0xf]; } return new String(str); } catch (Exception e) { return null; } } }
[ "yqxz045000@users.noreply.github.com" ]
yqxz045000@users.noreply.github.com
ea1359309ac66512987c6ac27d2722ffa99ba7cc
47ea37f56c712cd3f7f3063ce817d640cc76d1c7
/net.sf.parteg.base/src/net/sf/parteg/base/testcasegraph/valuetyperanges/UnorderedValueTypeRange.java
51a8244a7a3591619bd6162ea331020184f21d8b
[]
no_license
Xilaew/uml-activity-testcasegenerator
c194e0f93d8ff6e92e04582bee39f9dce1d7f5fb
33b1833aaa70ebd2d05d2cf9fa2dc545129ea025
refs/heads/master
2020-05-18T06:51:19.024164
2014-07-08T23:31:13
2014-07-08T23:31:13
38,853,918
0
0
null
null
null
null
ISO-8859-1
Java
false
false
17,897
java
package net.sf.parteg.base.testcasegraph.valuetyperanges; import java.util.ArrayList; import java.util.List; import java.util.Map; import net.sf.parteg.base.testcasegraph.generated.TCGOCLAtom; import net.sf.parteg.base.testcasegraph.generated.TCGOCLExpression; import net.sf.parteg.base.testcasegraph.generated.TCGOCLOperation; import net.sf.parteg.base.testcasegraph.valuetypes.UnorderedValueType; import net.sf.parteg.base.testcasegraph.valuetypes.ValueType; import net.sf.parteg.core.testcase.TestCaseValidValue; public class UnorderedValueTypeRange extends ValueTypeRange { // empty allowed values means: all values are allowed without the forbidden ones // if allowed values is not empty: resulting allowed values is allowed values without forbidden values private ArrayList<UnorderedValueType> m_colAllowedValues; private ArrayList<UnorderedValueType> m_colForbiddenValues; protected UnorderedValueType m_oReferenceValue; public UnorderedValueTypeRange(UnorderedValueType in_oReferenceValue) { m_oReferenceValue = in_oReferenceValue; m_colAllowedValues = new ArrayList<UnorderedValueType>(); m_colForbiddenValues = new ArrayList<UnorderedValueType>(); } public UnorderedValueType getReferenceValue() { return m_oReferenceValue; } public ArrayList<UnorderedValueType> getAllowedValues() { return m_colAllowedValues; } public boolean allowedValuesContainEqualObject(UnorderedValueType in_oObject) { for(UnorderedValueType oVT : getAllowedValues()) { if(oVT.equals(in_oObject)) return true; } return false; } public ArrayList<UnorderedValueType> getForbiddenValues() { return m_colForbiddenValues; } public boolean forbiddenValuesContainEqualObject(UnorderedValueType in_oObject) { for(UnorderedValueType oVT : getForbiddenValues()) { if(oVT.equals(in_oObject)) return true; } return false; } @Override public boolean adaptRange(ValueTypeRange in_oOtherRange) { UnorderedValueTypeRange oOtherRange = (UnorderedValueTypeRange)in_oOtherRange; // own: everything is allowed if(getAllowedValues().isEmpty()) { // other: everything is allowed if(oOtherRange.getAllowedValues().isEmpty()) { // both value ranges have no enforced values -> unite all forbidden values for(UnorderedValueType oValue: oOtherRange.getForbiddenValues()) { if(!forbiddenValuesContainEqualObject(oValue)) { getForbiddenValues().add(oValue); } } } else // allowed values are restricted to the given ones { for(UnorderedValueType oValue: oOtherRange.getAllowedValues()) { // add all allowed values - forbidden ones of "this" are compared to later getAllowedValues().add(oValue); } for(UnorderedValueType oValue: oOtherRange.getForbiddenValues()) { if(!forbiddenValuesContainEqualObject(oValue)) { getForbiddenValues().add(oValue); } } } } else // this: allowed values are restricted to the given ones { // other: everything except the forbidden is allowed if(oOtherRange.getAllowedValues().isEmpty()) { // the other range could have negative values that influence the enforced values of this range for(UnorderedValueType oValue: oOtherRange.getForbiddenValues()) { if(!forbiddenValuesContainEqualObject(oValue)) getForbiddenValues().add(oValue); } } else { // both value ranges contain values from which one is Mr. Right -> intersection for(UnorderedValueType oValue : getAllowedValues()) { if(!oOtherRange.allowedValuesContainEqualObject(oValue) || oOtherRange.forbiddenValuesContainEqualObject(oValue)) { getForbiddenValues().add(oValue); } } for(UnorderedValueType oValue : oOtherRange.getForbiddenValues()) { if(!forbiddenValuesContainEqualObject(oValue)) { getForbiddenValues().add(oValue); } } } } return !isEmpty(); } @Override public ValueType getValidRandomValue() { ValueType oValue = null; if(!getAllowedValues().isEmpty()) { // TODO Zufall implementieren! oValue = getAllowedValues().get(0); } return oValue; } @Override public ValueTypeRange clone() { UnorderedValueTypeRange oCopy = new UnorderedValueTypeRange(getReferenceValue()); for(UnorderedValueType oVTR : getAllowedValues()) { oCopy.getAllowedValues().add((UnorderedValueType)oVTR.clone()); } for(UnorderedValueType oVTR : getForbiddenValues()) { oCopy.getForbiddenValues().add((UnorderedValueType)oVTR.clone()); } return oCopy; } @Override public void setRangeAccordingToRightSideOfExpression( TCGOCLExpression in_oExpression) throws Exception { TCGOCLExpression oValidExpression = null; if (in_oExpression instanceof TCGOCLOperation) { TCGOCLOperation oCallExp = (TCGOCLOperation) in_oExpression; // TODO : hack, dass Instanz des ValueTypes für Polymorphie des Typparameters missbraucht wird -> ändern!?! oValidExpression = oCallExp.getRight(); if(oValidExpression == null) // again - workaround for "not" oValidExpression = oCallExp.getLeft(); } else { oValidExpression = (TCGOCLAtom)in_oExpression; } ValueType oValueOfExpression = getReferenceValue().createValueFromExpression( oValidExpression); if(in_oExpression instanceof TCGOCLOperation) // =, <, >, <=, >=, <>, not ? setRange(oValueOfExpression, ((TCGOCLOperation)in_oExpression).getOperationName()); else // simple boolean values setRange(oValueOfExpression, "="); } @Override public void setRangeAccordingToRightSideOfExpression( TCGOCLExpression in_oExpression, Map<TCGOCLAtom, TestCaseValidValue> in_colCurrentValueAssignment) throws Exception { TCGOCLExpression oValidExpression = null; if (in_oExpression instanceof TCGOCLOperation) { TCGOCLOperation oCallExp = (TCGOCLOperation) in_oExpression; // TODO : hack, dass Instanz des ValueTypes für Polymorphie des Typparameters missbraucht wird -> ändern!?! oValidExpression = oCallExp.getRight(); if(oValidExpression == null) // again - workaround for "not" oValidExpression = oCallExp.getLeft(); } else { oValidExpression = (TCGOCLAtom)in_oExpression; } ValueType oValueOfExpression = getReferenceValue().createValueFromExpression( oValidExpression, in_colCurrentValueAssignment); if(in_oExpression instanceof TCGOCLOperation) // =, <, >, <=, >=, <>, not ? setRange(oValueOfExpression, ((TCGOCLOperation)in_oExpression).getOperationName()); else // simple boolean values setRange(oValueOfExpression, "="); } @Override public void setRange(ValueType in_oValue, String in_sOperationName) { // if(in_sOperationName == null) { // int x = 42; // ++x; // } if(in_sOperationName.compareTo("=") == 0) { getAllowedValues().add((UnorderedValueType)in_oValue); } else { getForbiddenValues().add((UnorderedValueType)in_oValue); } } public ArrayList<UnorderedValueType> intersectValueTypeLists( ArrayList<UnorderedValueType> in_colFirst, ArrayList<UnorderedValueType> in_colSecond) { ArrayList<UnorderedValueType> colIntersection = new ArrayList<UnorderedValueType>(); for(UnorderedValueType oFirst : in_colFirst) { boolean bFound = false; for(UnorderedValueType oSecond : in_colSecond) { if(oFirst.equals(oSecond)) { bFound = true; } } if(bFound == true) { colIntersection.add(oFirst); } } return colIntersection; } @Override public boolean isEmpty() { if(getAllowedValues().isEmpty()) return false; else { for(UnorderedValueType oVT : getAllowedValues()) { if(!forbiddenValuesContainEqualObject(oVT)) return false; } } return true; // return getForbiddenValues().containsAll(getAllowedValues()); // ArrayList<UnorderedValueType> colOwnAllowedValues = getAllowedValues(); // if(colOwnAllowedValues.isEmpty()) // colOwnAllowedValues = m_oReferenceValue.getRemainingValues(getForbiddenValues()); // // if(colOwnAllowedValues.isEmpty()) // { // return true; // } // return false; } @Override public boolean equals(ValueTypeRange other) { if(other instanceof UnorderedValueTypeRange) { UnorderedValueTypeRange oOtherUnorderedRange = (UnorderedValueTypeRange)other; ArrayList<UnorderedValueType> colOwnAllowedValues = getAllowedValues(); if(colOwnAllowedValues.isEmpty()) colOwnAllowedValues = getReferenceValue().getRemainingValues(getForbiddenValues()); ArrayList<UnorderedValueType> colOtherAllowedValues = oOtherUnorderedRange.getAllowedValues(); if(colOtherAllowedValues.isEmpty()) colOtherAllowedValues = getReferenceValue().getRemainingValues( oOtherUnorderedRange.getForbiddenValues()); if(colOwnAllowedValues.size() != colOtherAllowedValues.size()) return false; if(!firstCollectionContainsAllEqualsElementsOfSecondCollection( colOwnAllowedValues, colOtherAllowedValues)) return false; // if(getAllowedValues().containsAll(oOtherUnorderedRange.getAllowedValues()) && // getAllowedValues().size() == oOtherUnorderedRange.getAllowedValues().size() && // getForbiddenValues().containsAll(oOtherUnorderedRange.getForbiddenValues()) && // getForbiddenValues().size() == oOtherUnorderedRange.getForbiddenValues().size()) // return true; return true; } return false; } // /* // * moves the remaining elements of the forbidden elements to the allowed elements // */ // public void moveNegatedForbiddenValuesToAllowedValues() // { // for(UnorderedValueType oNegatedValue : m_oReferenceValue.getRemainingValues(getForbiddenValues())) // { // boolean bFound = false; // for(UnorderedValueType oAllowedValue : getAllowedValues()) // { // if(oAllowedValue.equals(oNegatedValue)) // { // bFound = true; // } // } // if(bFound == true) // { // getAllowedValues().add(oNegatedValue); // } // } // } @Override public boolean contains(ValueTypeRange other) { if(other instanceof UnorderedValueTypeRange) { UnorderedValueTypeRange oOtherUnorderedRange = (UnorderedValueTypeRange)other; // contains: the set of allowed values in this is a superset of the other's set of allowed values ArrayList<UnorderedValueType> colOwnAllowedValues = getAllowedValues(); if(colOwnAllowedValues.isEmpty()) colOwnAllowedValues = getReferenceValue().getRemainingValues(getForbiddenValues()); ArrayList<UnorderedValueType> colOtherAllowedValues = oOtherUnorderedRange.getAllowedValues(); if(colOtherAllowedValues.isEmpty()) colOtherAllowedValues = getReferenceValue().getRemainingValues( oOtherUnorderedRange.getForbiddenValues()); // checks if own's allowed values are a super set of other's allowed values if(!firstCollectionContainsAllEqualsElementsOfSecondCollection( colOwnAllowedValues, colOtherAllowedValues)) return false; return true; } return false; } private static boolean firstCollectionContainsAllEqualsElementsOfSecondCollection( ArrayList<? extends ValueType> in_colFirstCollection, ArrayList<? extends ValueType> in_colSecondCollection) { for(ValueType oThisForbiddenValue : in_colSecondCollection) { boolean bFound = false; for(ValueType oOtherForbiddenValue : in_colFirstCollection) { if(oOtherForbiddenValue.equals(oThisForbiddenValue)) bFound = true; } if(bFound == false) return false; } return true; } @Override public void setRangeAccordingToRightSideOfExpression( TCGOCLExpression in_oExpression, Map<TCGOCLAtom, TestCaseValidValue> in_colCurrentValueAssignment, Map<TCGOCLAtom, ValueTypeRange> in_colCurrentValueTypeRanges) throws Exception { // createValueFromExpression nur auf Atoms aufrufen UnorderedValueTypeRange oUOVTR = getRangeForExpression( in_oExpression, in_colCurrentValueAssignment, in_colCurrentValueTypeRanges); if(oUOVTR != null) { if(in_oExpression instanceof TCGOCLAtom) { getAllowedValues().clear(); getAllowedValues().addAll(oUOVTR.getAllowedValues()); getForbiddenValues().clear(); getForbiddenValues().addAll(oUOVTR.getForbiddenValues()); } else if(in_oExpression instanceof TCGOCLOperation) { TCGOCLOperation oOperation = (TCGOCLOperation)in_oExpression; if(oOperation.getOperationName().equals("=")) { getAllowedValues().clear(); getAllowedValues().addAll(oUOVTR.getAllowedValues()); getForbiddenValues().clear(); getForbiddenValues().addAll(oUOVTR.getForbiddenValues()); } else { getAllowedValues().clear(); getAllowedValues().addAll(oUOVTR.getForbiddenValues()); getForbiddenValues().clear(); getForbiddenValues().addAll(oUOVTR.getAllowedValues()); } } } } @SuppressWarnings("null") private UnorderedValueTypeRange getRangeForExpression( TCGOCLExpression in_oExpression, Map<TCGOCLAtom, TestCaseValidValue> in_colCurrentValueAssignment, Map<TCGOCLAtom, ValueTypeRange> in_colCurrentValueTypeRanges) throws Exception { // should always fail in execution Double o = null; o.intValue(); return null; // // createValueFromExpression nur auf Atoms aufrufen // if(in_oExpression instanceof TCGOCLAtom) { // TCGOCLAtom oAtom = (TCGOCLAtom)in_oExpression; // UnorderedValueTypeRange oUOVTR = (UnorderedValueTypeRange)in_colCurrentValueTypeRanges.get(oAtom); // if(oUOVTR == null) { // ValueType oValueOfExpression = m_oReferenceValue.createValueFromExpression( // in_oExpression, in_colCurrentValueAssignment); // if(oValueOfExpression == null) // return null; // oUOVTR = (UnorderedValueTypeRange)ValueTypeRangeFactory. // createValueTypeRangeForObject(in_oExpression); // oUOVTR.setRange(oValueOfExpression, "="); // } // return oUOVTR; // } // else if (in_oExpression instanceof TCGOCLOperation) { // TCGOCLOperation oOperation = (TCGOCLOperation)in_oExpression; // Map<TCGOCLAtom, Pair<ValueType, ValueType>> colAtomToValueRanges = // new LinkedHashMap<TCGOCLAtom, Pair<ValueType, ValueType>>(); // for(TCGOCLAtom oAtom : in_colCurrentValueTypeRanges.keySet()) { // UnorderedValueTypeRange oUOVTR = // (UnorderedValueTypeRange)in_colCurrentValueTypeRanges.get(oAtom); // UnorderedValueType oVT = // OrderedValueType oMaxVT = oUOVTR.getMaxValue(); // if(!oUOVTR.isMaxIncluded()) // oMaxVT = oMaxVT.getLowerValueMinDistance(); // OrderedValueType oMinVT = oUOVTR.getMinValue(); // if(!oUOVTR.isMinIncluded()) // oMinVT = oMinVT.getUpperValueMinDistance(); // // colAtomToValueRanges.put(oAtom, new Pair<ValueType, ValueType>( // oMinVT, oMaxVT)); // } // Pair<ValueType, ValueType> oValueTypePair = // m_oMinValue.createValueFromExpression( // oOperation.getRight(), in_colCurrentValueAssignment, // colAtomToValueRanges); // if(oValueTypePair != null) { // OrderedValueType oFirstValue = (OrderedValueType)oValueTypePair.getFirst(); // OrderedValueType oSecondValue = (OrderedValueType)oValueTypePair.getSecond(); // OrderedValueTypeRange oVTR = new OrderedValueTypeRange<OVT>( // oFirstValue, true, oSecondValue, true); // // return oVTR; // } // } // return null; } @Override public boolean adaptRange(String in_sSelectedTestValue) { if(getAllowedValues().isEmpty()) { for(UnorderedValueType oUOVT : getForbiddenValues()) { if(oUOVT.equals(in_sSelectedTestValue)) { return false; } } setRange(in_sSelectedTestValue); return true; } else { boolean bDetected = false; for(UnorderedValueType oUOVT : getAllowedValues()) { // there is at least one matching value -> reduce all values to this one if(oUOVT.equals(in_sSelectedTestValue)) { bDetected = true; } } if(bDetected == true) { for(UnorderedValueType oUOVT : getForbiddenValues()) { // value is not forbidden if(oUOVT.equals(in_sSelectedTestValue)) { return false; } } setRange(in_sSelectedTestValue); return true; } return false; } } @Override public void setRange(String in_sSelectedTestValue) { if(getAllowedValues().isEmpty()) { // everything allowed? -> add one value to the allowed values UnorderedValueType oNewAllowed = (UnorderedValueType)m_oReferenceValue.clone(); oNewAllowed.setValue(in_sSelectedTestValue); getAllowedValues().add(oNewAllowed); } else { // only the existing elements allowed: restrict this set for(UnorderedValueType oUOVT : getAllowedValues()) { if(!oUOVT.equals(in_sSelectedTestValue)) { getForbiddenValues().add(oUOVT); } } if(getAllowedValues().isEmpty()) { UnorderedValueType oNewAllowed = (UnorderedValueType)m_oReferenceValue.clone(); oNewAllowed.setValue(in_sSelectedTestValue); getAllowedValues().add(oNewAllowed); } } // if the value was already forbidden -> remove the reference List<UnorderedValueType> colValuesToBeRemoved = new ArrayList<UnorderedValueType>(); for(UnorderedValueType oUOVT : getForbiddenValues()) { // value is not forbidden if(oUOVT.equals(in_sSelectedTestValue)) { colValuesToBeRemoved.add(oUOVT); } } getForbiddenValues().removeAll(colValuesToBeRemoved); } @Override public void adaptRangeToStaticConstraints() { // there are no static constraints for these types } }
[ "xilaew@gmail.com" ]
xilaew@gmail.com
c3d9ecb9ff6fb53686c6ebf93ebc2a2a2faccc01
863052231309e164f187ec5d0f5b515602a9e8e2
/microservices/authorization-services/authorization-service/src/main/java/org/mddarr/ui/request/service/models/AuthenticationRequest.java
81797921d168974bb6d61f1a54ad56840e62bdfa
[]
no_license
MathiasDarr/event-driven-kafka-microservices
a46b52c5cb6f6135aebe624bb0e6fd32bf7171e1
fbb1d8ce1ec303d33f7994092f24f83df9e0ee81
refs/heads/master
2023-02-23T15:03:47.281347
2021-01-26T03:32:31
2021-01-26T03:32:31
329,455,570
0
0
null
null
null
null
UTF-8
Java
false
false
753
java
package org.mddarr.ui.request.service.models; import java.io.Serializable; public class AuthenticationRequest implements Serializable { private String username; private String password; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } //need default constructor for JSON Parsing public AuthenticationRequest() { } public AuthenticationRequest(String username, String password) { this.setUsername(username); this.setPassword(password); } }
[ "mddarr@gmail.com" ]
mddarr@gmail.com
b1616eec4be78aacd9e640f2b5d237717eadc4c2
9aaa33f14d5abe9001031667ab002b41de0128b0
/design-patterns/01-seven-principle/src/main/java/com/exercise/isp/Bird.java
bed1a53f6e3009eb5d1e8a18983d10e38aae33ef
[]
no_license
miniministar/exercise
f03e9df1664205d6a8b5dc94ecf773fa60e1491b
b5c6582a64bd0ae58646d3070de8b35b9c331eba
refs/heads/master
2023-06-07T13:40:50.618123
2023-06-07T12:00:04
2023-06-07T12:00:04
252,025,193
0
0
null
2023-04-10T13:09:40
2020-03-31T23:50:22
Java
UTF-8
Java
false
false
264
java
package com.exercise.isp; public class Bird implements IAnimal , IFlyAnimal { @Override public void eat() { System.out.println("bird eat something"); } @Override public void fly() { System.out.println("bird can fly"); } }
[ "1005712028@qq.com" ]
1005712028@qq.com
85d35f86cf2423c863bdefa95d0afb3550cf41fd
e0c17ce9957b9e26c0758cfcadf6d568b5a8009a
/src/spoonloader/SpoonLoader.java
adb634931c8bc648e82211528e3f393e5bdc5473
[]
no_license
KavithaSundarraj/SimpleSpoonIfTransform
b78b21c305fe04c7b091629ccf01b7900bfd5d63
ea3572f35c46ae352b7059df1cf01b7eafcd7cd6
refs/heads/master
2021-04-28T17:55:39.102110
2018-02-17T14:43:05
2018-02-17T14:43:05
121,862,457
0
0
null
null
null
null
UTF-8
Java
false
false
4,173
java
package spoonloader; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import spoon.processing.Builder; import spoon.reflect.Factory; import spoon.reflect.declaration.CtSimpleType; import spoon.support.ByteCodeOutputProcessor; import spoon.support.DefaultCoreFactory; import spoon.support.JavaOutputProcessor; import spoon.support.StandardEnvironment; /** * * @author kavitha * */ public class SpoonLoader { private static final String DEFAULT_MODEL_BIN_DIR = "spoon/bin"; private static final String DEFAULT_MODEL_SRC_DIR = "spoon/src"; private Factory factory; private String modelBinDir = DEFAULT_MODEL_BIN_DIR; private String modelSrcDir = DEFAULT_MODEL_SRC_DIR; public SpoonLoader() { factory = createFactory(); } /** * @return the {@link Factory} used to create mirrors */ public Factory getFactory() { return factory; } /** * Set the temporary directory in which this class outputs source files */ public void setModelSrcDir(String modelSrcDir) { this.modelSrcDir = modelSrcDir; } /** * Get the temporary directory in which this class outputs source files */ public String getModelSrcDir() { return modelSrcDir; } /** * Set the temporary directory in which this class outputs compiled class files */ public void setModelBinDir(String modelBinDir) { this.modelBinDir = modelBinDir; } /** * Get the temporary directory in which this class outputs compiled class files */ public String getModelBinDir() { return modelBinDir; } /** * @return a new Spoon {@link Factory} */ protected Factory createFactory() { StandardEnvironment env = new StandardEnvironment(); Factory factory = new Factory(new DefaultCoreFactory(), env); // environment initialization env.setComplianceLevel(6); env.setVerbose(false); env.setDebug(false); env.setTabulationSize(5); env.useTabulations(true); env.useSourceCodeFragments(false); return factory; } /** * Add directories or JAR files in which to search for input source code */ public void addSourcePath(String sourcePath) { addSourcePath(new File(sourcePath)); } /** * Add directories or JAR files in which to search for input source code */ public void addSourcePath(File sourcePath) { buildModel(sourcePath); compile(); } /** * Build the internal model (i.e. abstract syntax tree) of the source code */ protected void buildModel(File sourcePath) { Builder builder = getFactory().getBuilder(); try { builder.addInputSource(sourcePath); builder.build(); } catch (IOException e) { throw new RuntimeException(e); } catch (Exception e) { throw new RuntimeException(e); } } /** * Create class files of the internal model in {@link #modelBinDir} */ public void compile() { JavaOutputProcessor fileOutput = new JavaOutputProcessor(new File(modelSrcDir)); ByteCodeOutputProcessor classOutput = new ByteCodeOutputProcessor(fileOutput, new File(modelBinDir)); classOutput.setFactory(getFactory()); classOutput.init(); for (CtSimpleType<?> type : getFactory().Class().getAll()) { classOutput.process(type); } classOutput.processingDone(); } /** * @return the class with the given qualified name. */ @SuppressWarnings("unchecked") public <T> Class<T> load(String qualifiedName) { try { URL url = new File(modelBinDir).toURI().toURL(); URLClassLoader cl = new URLClassLoader(new URL[] {url}); Thread.currentThread().setContextClassLoader(cl); return (Class<T>)(cl.loadClass(qualifiedName)); } catch (MalformedURLException e) { throw new RuntimeException(e); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } /** * @return the reflective instance of the class with the given qualified name */ public <T> CtSimpleType<T> mirror(String qualifiedName) { Class<T> clazz = load(qualifiedName); return mirror(clazz); } /** * @return the reflective instance of the given class */ public <T> CtSimpleType<T> mirror(Class<T> clazz) { return getFactory().Type().get(clazz); } }
[ "jeyakumar.kavitha@gmail.com" ]
jeyakumar.kavitha@gmail.com
4dfb76ea352e41fd08eb08be158054f18119ddc4
710dac8a978b4290dbaec07878a1d658c4729aa0
/src/evaluator/Evaluator.java
ea07b81d65d90b0acb0da8eba796a335424dd57e
[ "MIT" ]
permissive
AmrDeveloper/Kong
a38bdf38245880b1bdf72180b72fbec73181118a
777fa3dac1996e04dc8bd0602b7bb7cac90c179b
refs/heads/master
2023-04-23T17:03:58.512388
2021-05-08T21:49:22
2021-05-08T21:49:22
360,160,555
3
0
null
null
null
null
UTF-8
Java
false
false
16,014
java
package evaluator; import ast.*; import object.*; import java.util.*; import java.util.function.Function; public class Evaluator implements StatementVisitor<KongObject>, ExpressionVisitor<KongObject> { private static final KongNull NULL = new KongNull(); private static final KongBoolean TRUE = new KongBoolean(true); private static final KongBoolean FALSE = new KongBoolean(false); private final Map<String, BuiltinFunction> builtinFunctionsMap = new HashMap<>(); private Environment environment; public Evaluator(Environment environment) { this.environment = environment; // Set Builtin Functions this.builtinFunctionsMap.put("len", new BuiltinFunction(builtinStringLength)); this.builtinFunctionsMap.put("push", new BuiltinFunction(builtinArrayPush)); this.builtinFunctionsMap.put("puts", new BuiltinFunction(builtinPrintln)); } @Override public KongObject visit(Program program) { KongObject result = null; for(Statement statement : program.getStatements()) { result = statement.accept(this); if (result instanceof KongReturn) return ((KongReturn) result).getValue(); if (result instanceof KongError) return result; } return result; } @Override public KongObject visit(LetStatement statement) { KongObject value = statement.getValue().accept(this); if(isError(value)) return value; environment.set(statement.getName().getValue(), value); return null; } @Override public KongObject visit(ReturnStatement statement) { KongObject value = statement.getReturnValue().accept(this); if(isError(value)) return value; return new KongReturn(value); } @Override public KongObject visit(ExpressionStatement statement) { return statement.getExpression().accept(this); } @Override public KongObject visit(BlockStatement statement) { return evalStatements(statement.getStatements()); } @Override public KongObject visit(Identifier expression) { KongObject value = environment.get(expression.getValue()); if(value != null) return value; BuiltinFunction function = builtinFunctionsMap.get(expression.getValue()); if(function != null) return function; return newError("identifier not found: " + expression.getValue()); } @Override public KongObject visit(IntegerLiteral expression) { return new KongInteger(expression.getValue()); } @Override public KongObject visit(StringLiteral expression) { return new KongString(expression.getValue()); } @Override public KongObject visit(BooleanLiteral expression) { return expression.isValue() ? TRUE : FALSE; } @Override public KongObject visit(PrefixExpression expression) { KongObject right = expression.getRight().accept(this); if(isError(right)) return right; return evalPrefixExpression(expression.getOperator(), right); } @Override public KongObject visit(InfixExpression expression) { KongObject left = expression.getLeft().accept(this); if(isError(left)) return left; KongObject right = expression.getRight().accept(this); if(isError(right)) return right; return evalInfixExpression(expression.getOperator(), left, right); } @Override public KongObject visit(IfExpression expression) { KongObject condition = expression.getCondition().accept(this); if(isError(condition)) return condition; if(isTruthy(condition)) { return expression.getConsequence().accept(this); } else if(expression.getAlternative() != null) { return expression.getAlternative().accept(this); } return NULL; } @Override public KongObject visit(FunctionLiteral expression) { List<Identifier> params = expression.getParameters(); BlockStatement body = expression.getBody(); return new KongFunction(params, body, environment); } @Override public KongObject visit(CallExpression expression) { KongObject function = expression.getFunction().accept(this); if(isError(function)) return function; List<KongObject> args = evalExpressions(expression.getArguments()); if(args.size() == 1 && isError(args.get(0))) return args.get(0); return applyFunction(function, args); } @Override public KongObject visit(ArrayLiteral expression) { List<KongObject> elements = evalExpressions(expression.getElements()); if(elements.size() == 1 && isError(elements.get(0))) return elements.get(0); return new KongArray(elements); } @Override public KongObject visit(IndexExpression expression) { KongObject left = expression.getLeft().accept(this); if(isError(left)) return left; KongObject index = expression.getIndex().accept(this); if(isError(index)) return index; return evalIndexExpression(left, index); } @Override public KongObject visit(MapLiteral expression) { Map<Expression, Expression> expressionsPairs = expression.getPairs(); Map<KongMapKey, KongMapPair> kongObjectsMap = new HashMap<>(); for(Map.Entry<Expression, Expression> expressionPair : expressionsPairs.entrySet()) { KongObject key = expressionPair.getKey().accept(this); if(isError(key)) return key; if(!(key instanceof Hashable)) { return newError("unusable as hash key: %s", key.getObjectType()); } KongObject value = expressionPair.getValue().accept(this); if(isError(value)) return value; Hashable hashable = (Hashable) key; KongMapPair pair = new KongMapPair(key, value); kongObjectsMap.put(hashable.getHashKey(), pair); } return new KongMap(kongObjectsMap); } private KongObject evalStatements(List<Statement> statements) { KongObject result = null; for(Statement statement : statements) { result = statement.accept(this); if(result.getObjectType() == ObjectType.RETURN || result.getObjectType() == ObjectType.ERROR) { return result; } } return result; } private KongObject evalPrefixExpression(String operator, KongObject right) { switch (operator) { case "!": return evalBangOperatorExpression(right); case "-": return evalMinusPrefixOperatorExpression(right); default: return newError("unknown operator: %s%s", operator, right.getObjectType()); } } private KongBoolean evalBangOperatorExpression(KongObject right) { if (right == TRUE) return FALSE; if (right == FALSE) return TRUE; if (right == NULL) return TRUE; return FALSE; } private KongObject evalMinusPrefixOperatorExpression(KongObject right) { if(right.getObjectType() != ObjectType.INTEGER) return newError("unknown operator: -%s", right.getObjectType()); long value = ((KongInteger) right).getValue(); return new KongInteger(-value); } private KongObject evalInfixExpression(String operator, KongObject left, KongObject right) { if(left.getObjectType() == ObjectType.INTEGER && right.getObjectType() == ObjectType.INTEGER) { return evalIntegerInfixExpression(operator, left, right); } if(left.getObjectType() == ObjectType.STRING && right.getObjectType() == ObjectType.STRING) { return evalStringInfixExpression(operator, left, right); } if(operator.equals("==")) return nativeBoolToBooleanObject(left == right); if(operator.equals("!=")) return nativeBoolToBooleanObject(left != right); if(left.getObjectType() != right.getObjectType()) { return newError("type mismatch: %s %s %s", left.getObjectType(), operator, right.getObjectType()); } return newError("unknown operator: %s %s %s", left.getObjectType(), operator, right.getObjectType()); } private KongObject evalIntegerInfixExpression(String operator, KongObject left, KongObject right) { long leftValue = ((KongInteger) left).getValue(); long rightValue = ((KongInteger) right).getValue(); switch (operator) { case "+": return new KongInteger(leftValue + rightValue); case "-": return new KongInteger(leftValue - rightValue); case "*": return new KongInteger(leftValue * rightValue); case "/": return new KongInteger(leftValue / rightValue); case "<": return nativeBoolToBooleanObject(leftValue < rightValue); case ">": return nativeBoolToBooleanObject(leftValue > rightValue); case "==": return nativeBoolToBooleanObject(leftValue == rightValue); case "!=": return nativeBoolToBooleanObject(leftValue != rightValue); default: return newError("unknown operator: %s %s %s", left.getObjectType(), operator, right.getObjectType()); } } private KongObject evalStringInfixExpression(String operator, KongObject left, KongObject right) { String leftValue = ((KongString) left).getValue(); String rightValue = ((KongString) right).getValue(); switch (operator) { case "+": return new KongString(leftValue + rightValue); case "<": return nativeBoolToBooleanObject(leftValue.length() < rightValue.length()); case ">": return nativeBoolToBooleanObject(leftValue.length() > rightValue.length()); case "==": return nativeBoolToBooleanObject(leftValue.equals(rightValue)); case "!=": return nativeBoolToBooleanObject(!leftValue.equals(rightValue)); default: return newError("unknown operator: %s %s %s", left.getObjectType(), operator, right.getObjectType()); } } private KongObject evalIndexExpression(KongObject left, KongObject index) { if(left.getObjectType() == ObjectType.ARRAY && index.getObjectType() == ObjectType.INTEGER) { return evalArrayIndexExpression(left, index); } if(left.getObjectType() == ObjectType.MAP) { return evalMapIndexExpression(left, index); } if(left.getObjectType() == ObjectType.STRING && index.getObjectType() == ObjectType.INTEGER) { return evalStringIndexExpression(left, index); } return newError("index operator not supported: %s", left.getObjectType()); } private KongObject evalArrayIndexExpression(KongObject array, KongObject index) { KongArray kongArray = (KongArray) array; long kongIndex = ((KongInteger) index).getValue(); int maxLength = kongArray.getElements().size() - 1; if(kongIndex < 0 || kongIndex > maxLength) return NULL; return kongArray.getElements().get((int) kongIndex); } private KongObject evalMapIndexExpression(KongObject map, KongObject key) { if(!(key instanceof Hashable)) { return newError("unusable as hash key: %s", key.getObjectType()); } Hashable hashable = (Hashable) key; KongMap kongMap = (KongMap) map; KongMapPair pair = kongMap.getPairs().get(hashable.getHashKey()); if(pair == null) return NULL; return pair.getValue(); } private KongObject evalStringIndexExpression(KongObject string, KongObject index) { KongString kongString = (KongString) string; long kongIndex = ((KongInteger) index).getValue(); int maxLength = kongString.getValue().length() - 1; if(kongIndex < 0 || kongIndex > maxLength) return NULL; String charAtPosition = String.valueOf(kongString.getValue().charAt((int) kongIndex)); return new KongString(charAtPosition); } private KongObject applyFunction(KongObject function, List<KongObject> args) { if(function instanceof KongFunction) { Environment currentEnv = environment; KongFunction functionObject = (KongFunction) function; Environment extendedEnv = extendFunctionEnv(functionObject, args); environment = extendedEnv; KongObject evaluated = functionObject.getBody().accept(this); environment = currentEnv; return unwrapReturnValue(evaluated); } else if(function instanceof BuiltinFunction) { BuiltinFunction builtinFunction = (BuiltinFunction) function; return builtinFunction.getFunction().apply(args); } return newError("not a function: %s", function.getObjectType()); } private Environment extendFunctionEnv(KongFunction function, List<KongObject> args) { Environment env = new Environment(function.getEnvironment()); List<Identifier> parameters = function.getParameters(); for(int i = 0 ; i < parameters.size() ; i++) { env.set(parameters.get(i).getValue(), args.get(i)); } return env; } private KongObject unwrapReturnValue(KongObject object) { if(object instanceof KongReturn) { return ((KongReturn) object).getValue(); } return object; } private List<KongObject> evalExpressions(List<Expression> expressions) { List<KongObject> result = new ArrayList<>(); for(Expression expression : expressions) { KongObject evaluated = expression.accept(this); if (isError(evaluated)) { return Collections.singletonList(evaluated); } result.add(evaluated); } return result; } private KongBoolean nativeBoolToBooleanObject(boolean value) { return value ? TRUE : FALSE; } private boolean isTruthy(KongObject object) { if(object == NULL) return false; if(object == TRUE) return true; return object != FALSE; } private KongError newError(String format, Object... args) { return new KongError(String.format(format, args)); } private boolean isError(KongObject object) { if(object != null) { return object.getObjectType() == ObjectType.ERROR; } return false; } private final Function<List<KongObject>, KongObject> builtinStringLength = args -> { if(args.size() != 1) { return newError("wrong number of arguments. got=%d, want=1", args.size()); } switch (args.get(0).getObjectType()) { case STRING: { String value = ((KongString )args.get(0)).getValue(); return new KongInteger(value.length()); } case ARRAY: { KongArray value = ((KongArray)args.get(0)); int length = value.getElements().size(); return new KongInteger(length); } default: { return newError("argument to `len` not supported, got %s", args.get(0).getObjectType()); } } }; private final Function<List<KongObject>, KongObject> builtinArrayPush = args -> { if(args.size() != 2) { return newError("wrong number of arguments. got=%d, want=2", args.size()); } if(args.get(0).getObjectType() != ObjectType.ARRAY) { return newError("argument to `push` must be ARRAY, got %s", args.get(0).getObjectType()); } KongArray array = (KongArray) args.get(0); List<KongObject> elements = array.getElements(); elements.add(args.get(1)); return array; }; private final Function<List<KongObject>, KongObject> builtinPrintln = args -> { for(KongObject arg : args) { System.out.println(arg.inspect()); } return NULL; }; }
[ "amr96@programmer.net" ]
amr96@programmer.net
ded36a59bca2717d9e76dbdbebd4667deda9c88a
3446120c21c6da9653ca410da7f26f30f0061189
/Test2OOPTasks/src/recap/Child.java
3de371f81fb0c863028f954f88be79873df32a11
[]
no_license
BlagoyNikolov/ITTalentsWorkspace
32eed3c9fc88b241dd92c92334da153a3636100c
af7bd75d444cfc4274a641354788ca7cd2e77068
refs/heads/master
2021-01-23T05:35:30.607462
2018-01-18T20:05:29
2018-01-18T20:05:29
92,970,410
0
0
null
null
null
null
UTF-8
Java
false
false
422
java
package recap; public class Child extends Parent { public Child() { // TODO Auto-generated constructor stub } @Override public void Speak(String word) { // TODO Auto-generated method stub super.Speak(word); } public void Speak(String word, int itmes) { int x = 5; System.out.println(x); } // @Override // public void Speak(String word, int itmes) { // int y = 5; // System.out.println(y); // } }
[ "nikolovblagoy@gmail.com" ]
nikolovblagoy@gmail.com
4fccb6b85c66ff91b80db85f63a7a1cb0e8cc671
4a3ab0ac1d106330c556b80bd012d6648455993f
/jingwei-task-monitor/src/main/java/org/sxdata/jingwei/service/Impl/JobServiceImpl.java
fd27596bcdf086ea902b75f9c61d4e1f6dd74948
[]
no_license
Maxcj/KettleWeb
2e490e87103d14a069be4f1cf037d11423503d38
75be8f65584fe0880df6f6d637c72bcb1a66c4cd
refs/heads/master
2022-12-21T06:56:34.756989
2022-02-05T03:03:57
2022-02-05T03:03:57
192,645,149
13
10
null
2022-12-16T02:43:00
2019-06-19T02:36:43
JavaScript
UTF-8
Java
false
false
21,368
java
package org.sxdata.jingwei.service.Impl; import net.sf.json.JSONObject; import org.flhy.ext.App; import org.flhy.ext.JobExecutor; import org.flhy.ext.PluginFactory; import org.flhy.ext.base.GraphCodec; import org.flhy.ext.job.JobExecutionConfigurationCodec; import org.pentaho.di.core.Const; import org.pentaho.di.job.JobExecutionConfiguration; import org.pentaho.di.job.JobMeta; import org.pentaho.di.repository.ObjectId; import org.pentaho.di.repository.Repository; import org.pentaho.di.repository.RepositoryDirectoryInterface; import org.quartz.JobKey; import org.quartz.Scheduler; import org.quartz.SchedulerFactory; import org.quartz.TriggerKey; import org.quartz.impl.StdSchedulerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.sxdata.jingwei.bean.PageforBean; import org.sxdata.jingwei.dao.*; import org.sxdata.jingwei.entity.*; import org.sxdata.jingwei.service.JobService; import org.sxdata.jingwei.util.TaskUtil.CarteClient; import org.sxdata.jingwei.util.TaskUtil.CarteTaskManager; import org.sxdata.jingwei.util.TaskUtil.KettleEncr; import org.sxdata.jingwei.util.CommonUtil.StringDateUtil; import javax.servlet.http.HttpServletRequest; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Created by cRAZY on 2017/2/22. */ @Service public class JobServiceImpl implements JobService{ @Autowired protected JobDao jobDao; @Autowired protected UserDao userDao; @Autowired protected SlaveDao slaveDao; @Autowired protected DirectoryDao directoryDao; @Autowired protected JobSchedulerDao jobSchedulerDao; @Autowired protected TaskGroupDao taskGroupDao; @Autowired protected JobSchedulerDao schedulerDao; protected SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @Override public JobEntity getJobById(Integer jobId) throws Exception{ return jobDao.getJobById(jobId); } @Override public List<JobTimeSchedulerEntity> getAllTimerJob() throws Exception{ return jobSchedulerDao.getAllTimerJob(""); } @Override public List<JobEntity> getJobPath(List<JobEntity> jobs) throws Exception{ List<JobEntity> resultJobs=new ArrayList<JobEntity>(); //根据作业的id来查找该作业在资源库的绝对目录 for (JobEntity job:jobs){ String directoryName=""; Integer directoryId=job.getDirectoryId(); //判断该作业是否是在根目录下 如果对应的目录id为0代表在根目录/下面 if(directoryId==0){ directoryName="/"+job.getName(); }else{ //不是在根目录下获取作业所在当前目录的目录名 并且拼接上作业名 DirectoryEntity directory=directoryDao.getDirectoryById(directoryId); directoryName=directory.getDirectoryName()+"/"+job.getName(); Integer parentId=directory.getParentDirectoryId(); //继续判断该文件上一级的目录是否是根目录 if (parentId==0){ directoryName="/"+directoryName; }else{ //循环判断该目录的父级目录是否是根目录 直到根部为止 while(parentId!=0){ DirectoryEntity parentDirectory=directoryDao.getDirectoryById(parentId); directoryName=parentDirectory.getDirectoryName()+"/"+directoryName; parentId=parentDirectory.getParentDirectoryId(); } directoryName="/"+directoryName; } } job.setDirectoryName(directoryName); resultJobs.add(job); } return resultJobs; } @Override public JSONObject findJobs(int start, int limit, String name, String createDate,String userGroupName) throws Exception{ PageforBean pages=new PageforBean(); net.sf.json.JSONObject result=null; //该页的作业信息以及整个表(可能是条件查询)的总记录条数 List<JobEntity> jobs=null; Integer totalCount=0; if (StringDateUtil.isEmpty(name) && StringDateUtil.isEmpty(createDate)){ jobs=jobDao.getThisPageJob(start,limit,userGroupName); //对日期进行处理转换成指定的格式 for (JobEntity job:jobs){ job.setCreateDate(format.parse(format.format(job.getCreateDate()))); job.setModifiedDate(format.parse(format.format(job.getModifiedDate()))); } totalCount=jobDao.getTotalCount(userGroupName); }else{ if(!createDate.isEmpty()) createDate+=" 00:00:00"; jobs=jobDao.conditionFindJobs(start, limit, name, createDate,userGroupName); for (JobEntity job:jobs){ job.setCreateDate(format.parse(format.format(job.getCreateDate()))); job.setModifiedDate(format.parse(format.format(job.getModifiedDate()))); } totalCount=jobDao.conditionFindJobCount(name,createDate,userGroupName); } //设置作业的全目录名 jobs=this.getJobPath(jobs); //设置作业所在的任务组名 for(JobEntity job:jobs){ List<TaskGroupAttributeEntity> items=taskGroupDao.getTaskGroupByTaskName(job.getName(), "job"); if(null!=items && items.size()>0){ if(items.size()==1){ job.setBelongToTaskGroup(items.get(0).getTaskGroupName()); }else{ String belongToTaskGroup=""; for(int i=0;i<items.size();i++){ if(i==items.size()-1){ belongToTaskGroup+=items.get(i).getTaskGroupName(); continue; } belongToTaskGroup+=items.get(i).getTaskGroupName()+","; } job.setBelongToTaskGroup(belongToTaskGroup); } } } pages.setRoot(jobs); pages.setTotalProperty(totalCount); //把分页对象(包含该页的数据以及所有页的总条数)转换成json对象 result=net.sf.json.JSONObject.fromObject(pages, StringDateUtil.configJson("yyyy-MM-dd HH:mm:ss")); return result; } @Override public void deleteJobs(String jobPath,String flag) throws Exception { Repository repository = App.getInstance().getRepository(); String dir = jobPath.substring(0, jobPath.lastIndexOf("/")); String name = jobPath.substring(jobPath.lastIndexOf("/") + 1); List<JobTimeSchedulerEntity> timers=schedulerDao.getTimerJobByJobName(name); if(timers!=null && timers.size()>0){ //删除作业的定时记录 schedulerDao.deleteSchedulerByJobName(name); SchedulerFactory factory=new StdSchedulerFactory(); Scheduler scheduler=factory.getScheduler(); //从trigger中移除该定时 for(JobTimeSchedulerEntity timer:timers){ String taskId=String.valueOf(timer.getIdJobtask()); TriggerKey triggerKey=TriggerKey.triggerKey(taskId + "trigger", CarteTaskManager.JOB_TIMER_TASK_GROUP); scheduler.pauseTrigger(triggerKey); //停止触发器 scheduler.unscheduleJob(triggerKey); //移除触发器 scheduler.deleteJob(JobKey.jobKey(taskId, CarteTaskManager.JOB_TIMER_TASK_GROUP)); //删除作业 } } //删除作业在任务组明细表中的记录 taskGroupDao.deleteTaskGroupAttributesByTaskName(name,"job"); //删除作业 RepositoryDirectoryInterface directory = repository.findDirectory(dir); if(directory == null) directory = repository.getUserHomeDirectory(); ObjectId id = repository.getJobId(name, directory); repository.deleteJob(id); } @Override public void executeJob(String path,Integer slaveId) throws Exception { //获取用户信息 UserEntity loginUser = userDao.getUserbyName("admin").get(0); loginUser.setPassword(KettleEncr.decryptPasswd("Encrypted " + loginUser.getPassword())); //构造Carte对象 SlaveEntity slave=slaveDao.getSlaveById(slaveId); slave.setPassword(KettleEncr.decryptPasswd(slave.getPassword())); CarteClient carteClient=new CarteClient(slave); //拼接资源库名 String repoId=CarteClient.hostName+"_"+CarteClient.databaseName; //拼接http请求字符串 String urlString="/?rep="+repoId+"&user="+loginUser.getLogin()+"&pass="+loginUser.getPassword()+"&job="+path+"&level=Basic"; urlString = Const.replace(urlString, "/", "%2F"); urlString = carteClient.getHttpUrl() + CarteClient.EXECREMOTE_JOB +urlString; System.out.println("请求远程执行作业的url字符串为" + urlString); CarteTaskManager.addTask(carteClient, "job_exec", urlString); } //判断是否在数据库中已经存在相同类型 相同执行周期的同一个作业 public boolean judgeJobIsAlike(JobTimeSchedulerEntity willAddJobTimer){ boolean flag=false; List<JobTimeSchedulerEntity> jobs=jobSchedulerDao.getAllTimerJob(""); if(jobs!=null && jobs.size()>=1){ //遍历查找是否有作业名与用户选择的作业名相同的作业 List<JobTimeSchedulerEntity> jobNameEqual=new ArrayList<>(); //存放作业名与用户选择的相同的作业 for(JobTimeSchedulerEntity nameEqual:jobs){ if(nameEqual.getJobName().equals(willAddJobTimer.getJobName())){ jobNameEqual.add(nameEqual); } } //遍历查找相同作业名的情况下 是否有作业定时类型也相同的作业 if(jobNameEqual.size()>=1){ List<JobTimeSchedulerEntity> typeEqualJobs=new ArrayList<>(); //存放定时类型与用户传递的定时运行相同的作业 for(JobTimeSchedulerEntity jobTimer:jobs){ if(jobTimer.getSchedulertype()==willAddJobTimer.getSchedulertype()){ typeEqualJobs.add(jobTimer); } } //进一步判断定时的具体时间是否相同 if(typeEqualJobs.size()>=1){ Integer timerType=willAddJobTimer.getSchedulertype(); switch(timerType) { //类型为1也就是间隔执行 判断间隔执行的分钟间隔是否相同 case 1: for(JobTimeSchedulerEntity jobTime:typeEqualJobs){ if(willAddJobTimer.getIntervalminutes()==jobTime.getIntervalminutes()){ flag=true; } } break; //类型为2也就每天执行类型 进一步判断每天执行的小时 分钟是否一样 case 2: List<JobTimeSchedulerEntity> hourLikeByTypeTwo=new ArrayList<>(); //存放每天执行 小时与用户设置值一样的定时作业 for(JobTimeSchedulerEntity jobTime:typeEqualJobs){ if(willAddJobTimer.getHour()==jobTime.getHour()){ hourLikeByTypeTwo.add(jobTime); } } //如果有小时相同的记录 进一步判断是否分钟相同 if(hourLikeByTypeTwo.size()>=1){ for(JobTimeSchedulerEntity jobTime:hourLikeByTypeTwo){ if(willAddJobTimer.getMinutes()==jobTime.getMinutes()){ flag=true; } } } break; //类型为3 每周执行 case 3: //首先判断每周执行的星期值week是否相同 List<JobTimeSchedulerEntity> weekLikeByTypeThree=new ArrayList<>();//存放星期数值与用户传递值相同的记录 for(JobTimeSchedulerEntity jobTime:typeEqualJobs){ if(jobTime.getWeekday()==willAddJobTimer.getWeekday()){ weekLikeByTypeThree.add(jobTime); } } List<JobTimeSchedulerEntity> weekAndHourLikeByTypeThree=new ArrayList<>();//存放星期数值和小时与用户传递值相同的记录 //如果星期值相同判断小时是是否也相同 if(weekLikeByTypeThree.size()>=1){ for(JobTimeSchedulerEntity weekLikeJob:weekAndHourLikeByTypeThree){ if(weekLikeJob.getHour()==willAddJobTimer.getHour()){ weekAndHourLikeByTypeThree.add(weekLikeJob); } } } //如果星期值和小时值都相同则最终判断分钟是否相同 if(weekAndHourLikeByTypeThree.size()>=1){ for(JobTimeSchedulerEntity weekAndHourLikeJob:weekAndHourLikeByTypeThree){ if(weekAndHourLikeJob.getMinutes()==willAddJobTimer.getMinutes()){ flag=true; } } } break; //类型4 每月执行 case 4: //首先判断每月执行的日期xx号是否相同 List<JobTimeSchedulerEntity> dayLikeByTypeFour=new ArrayList<>(); for(JobTimeSchedulerEntity jobTime:typeEqualJobs){ if(jobTime.getDayofmonth()==willAddJobTimer.getDayofmonth()){ dayLikeByTypeFour.add(jobTime); } } //如果日期xx号相同则继续判断时间hour是否相同 List<JobTimeSchedulerEntity> dayAndHourLikeByTypeFour=new ArrayList<>(); if(dayLikeByTypeFour.size()>=1){ for(JobTimeSchedulerEntity dayLike:dayLikeByTypeFour){ if(dayLike.getHour()==willAddJobTimer.getHour()){ dayAndHourLikeByTypeFour.add(dayLike); } } } //如果日期和时间值都相同则最终判断minute是否相同 if(dayAndHourLikeByTypeFour.size()>=1){ for(JobTimeSchedulerEntity dayAndHourLike:dayAndHourLikeByTypeFour){ if(dayAndHourLike.getMinutes()==willAddJobTimer.getMinutes()){ flag=true; } } } break; default: break; } } } } return flag; } @Override //定时作业 public boolean beforeTimeExecuteJob(Map<String, Object> params,HttpServletRequest request) throws Exception { boolean isSuccess=false; JobTimeSchedulerEntity jobTimeScheduler=new JobTimeSchedulerEntity(); jobTimeScheduler.setIdJobtask(System.nanoTime()); //定时的ID 唯一标识 jobTimeScheduler.setIdJob(Integer.parseInt(params.get("jobId").toString())); //所需定时的作业ID jobTimeScheduler.setJobName(params.get("jobName").toString()); //作业名 jobTimeScheduler.setIsrepeat("Y"); //是否重复执行 暂时默认重复执行Y //设置定时类型 String typeInfo=params.get("typeChoose").toString(); int schedulerType=0; //如果是间隔执行则设置执行的时间间隔 if(typeInfo.trim().equals("间隔重复")){ schedulerType=1; jobTimeScheduler.setIntervalminutes(Integer.parseInt(params.get("intervalminute").toString())); }else if(typeInfo.trim().equals("每天执行")){ schedulerType=2; }else if(typeInfo.trim().equals("每周执行")){ //每周执行则设置每周的时间week schedulerType=3; jobTimeScheduler.setWeekday(StringDateUtil.getIntWeek(params.get("weekChoose").toString())); }else if(typeInfo.trim().equals("每月执行")){ //每月执行设置每月多少号执行 monthDay schedulerType=4; jobTimeScheduler.setDayofmonth(StringDateUtil.getdayInt(params.get("monthChoose").toString())); } jobTimeScheduler.setSchedulertype(schedulerType); //只要不是间隔执行 其它三种都需要设置hour minute 执行的具体时间 if(schedulerType!=1){ jobTimeScheduler.setHour(Integer.parseInt(params.get("hour").toString())); jobTimeScheduler.setMinutes(Integer.parseInt(params.get("minute").toString())); } //如果库中不存在相同的定时作业则放入内存 if(!this.judgeJobIsAlike(jobTimeScheduler)){ //获取当前登录的用户 UserEntity loginUser=(UserEntity)request.getSession().getAttribute("login"); String username=loginUser.getLogin(); isSuccess=true; if(CarteTaskManager.jobTimerMap.containsKey(username)) CarteTaskManager.jobTimerMap.remove(username); CarteTaskManager.jobTimerMap.put(username, jobTimeScheduler); } return isSuccess; } @Override //定时作业 public void addTimeExecuteJob(String graphXml,String executionConfiguration,HttpServletRequest request) throws Exception { // JobMeta jobMeta = RepositoryUtils.loadJobbyPath(taskName); GraphCodec codec = (GraphCodec) PluginFactory.getBean(GraphCodec.JOB_CODEC); JobMeta jobMeta = (JobMeta) codec.decode(graphXml); org.flhy.ext.utils.JSONObject jsonObject = org.flhy.ext.utils.JSONObject.fromObject(executionConfiguration); JobExecutionConfiguration jobExecutionConfiguration = JobExecutionConfigurationCodec.decode(jsonObject, jobMeta); JobExecutor jobExecutor = JobExecutor.initExecutor(jobExecutionConfiguration, jobMeta); //获取当前登录的用户 UserEntity loginUser=(UserEntity)request.getSession().getAttribute("login"); JobTimeSchedulerEntity jobTimeScheduler=CarteTaskManager.jobTimerMap.get(loginUser.getLogin()); jobExecutor.setUsername(loginUser.getLogin()); //设置执行时的配置参数 以及执行节点 jobTimeScheduler.setExecutionConfig(executionConfiguration); if(jobExecutor.getExecutionConfiguration().isExecutingLocally()){ jobTimeScheduler.setSlaves("本地执行"); }else{ SlaveEntity thisSlave=slaveDao.getSlaveByHostName(jobExecutor.getExecutionConfiguration().getRemoteServer().getHostname()); jobTimeScheduler.setSlaves(thisSlave.getSlaveId()+"_"+thisSlave.getHostName()); } //执行定时任务 CarteTaskManager.addTimerTask(jobExecutor, null, jobTimeScheduler, loginUser); //把该定时信息更新到数据库 jobTimeScheduler.setUsername(loginUser.getLogin()); jobSchedulerDao.addTimerJob(jobTimeScheduler); CarteTaskManager.jobTimerMap.remove(loginUser.getLogin()); } @Override public JobEntity getJobByName(String jobName) throws Exception{ JobEntity job=jobDao.getJobByName(jobName); List<JobEntity> jobs=new ArrayList<JobEntity>(); jobs.add(job); return this.getJobPath(jobs).get(0); } @Override public boolean updateJobName(String oldName, String newName) { //修改作业名前先判断新的作业名是否已存在 for(JobEntity job:taskGroupDao.getAllJob("")){ if(job.getName().equals(oldName)) continue; if (job.getName().equals(newName)) return false; } jobDao.updateJobNameforJob(oldName,newName); taskGroupDao.updateTaskNameforAttr(oldName,newName,"job","/"+newName); return true; } }
[ "903283542@qq.com" ]
903283542@qq.com
75105ce33a91b75be2bcd2f3d32a53773aeafc68
35138d508cd0307742e42f90d04620636e85f010
/spring-secutity-mvc-all/spring-security-demo-03-custom-login-form/src/main/java/com/udemy/spring/springsecurity/config/DemoSecurityConfig.java
310ec5f11b5741466edc4bb1495df536fe9bfd93
[]
no_license
vinaymalleshHM/Spring-SpringSecurity--Udemy
6194f33120f538084447521c4fb28c15c4d91d22
bcf2245c4bba9ea09d94f3009240ae59c18a3efa
refs/heads/master
2022-04-21T01:36:53.871367
2020-04-20T15:32:03
2020-04-20T15:32:03
253,061,626
0
0
null
null
null
null
UTF-8
Java
false
false
1,514
java
package com.udemy.spring.springsecurity.config; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.User.UserBuilder; @Configuration @EnableWebSecurity public class DemoSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { // super.configure(auth); //add our users for in memory Authentication UserBuilder users = User.withDefaultPasswordEncoder(); auth.inMemoryAuthentication() .withUser(users.username("prince").password("test123").roles("EMPLOYEE")) .withUser(users.username("Winay").password("Aa@123456").roles("MANAGER")) .withUser(users.username("vinay").password("Aa@123456").roles("ADMIN")); } @Override protected void configure(HttpSecurity http) throws Exception { // super.configure(http); http.authorizeRequests() .anyRequest().authenticated() .and() .formLogin() .loginPage("/showMyLoginPage") .loginProcessingUrl("/authenticateTheUser") .permitAll(); } }
[ "princevinay404@gmail.com" ]
princevinay404@gmail.com
ef5b41ca58771e7401b70972a4e1150a6fbc3366
2f57e8c430fce1bfecf5345ac9b53bab1e2deb9c
/jtransc-main/test/jtransc/rt/test/JTranscCollectionsTest.java
040501c2afcf3b4a1c500a166bfe0a25286d26b5
[ "Apache-2.0" ]
permissive
GMadorell/jtransc
35f10c90b4ba58105a0ac56e579c3e1073db4f40
8298d6a74903842e5027a44bbd98b2c74e33c927
refs/heads/master
2021-01-14T10:23:37.171690
2016-03-06T19:39:41
2016-03-06T19:39:41
53,316,788
0
0
null
2016-03-07T10:27:53
2016-03-07T10:27:53
null
UTF-8
Java
false
false
1,911
java
package jtransc.rt.test; import java.util.*; public class JTranscCollectionsTest { static public void main(String[] args) { testArrayList(); testHashSet(); } static public void testArrayList() { System.out.println("ArrayList:"); ArrayList<Integer> list = new ArrayList<>(); list.add(1); System.out.println(list.size()); list.add(2); list.add(3); list.add(99999); list.add(null); list.add(2); System.out.println(list.size()); System.out.println(Arrays.toString(list.toArray())); System.out.println(Arrays.toString(list.toArray(new Integer[0]))); System.out.println(Arrays.toString(list.toArray(new Integer[6]))); System.out.println(Arrays.toString(list.toArray(new Integer[10]))); System.out.println(list.indexOf(2)); System.out.println(list.indexOf(null)); System.out.println(list.lastIndexOf(2)); System.out.println(list.indexOf(99999)); System.out.println(list.indexOf(-7)); ListIterator<Integer> iterator = list.listIterator(); while (iterator.hasNext()) { Integer value = iterator.next(); if (value != null && value == 2) iterator.remove(); } System.out.println(Arrays.toString(list.toArray())); } static public void testHashSet() { System.out.println("HashSet:"); HashSet<String> set = new HashSet<>(); String s1 = new String("s"); String s2 = new String("s"); String a1 = new String("a"); set.add(s1); set.add(s2); set.add(a1); System.out.println(set.size()); System.out.println(set.contains(s1)); System.out.println(set.contains(s2)); System.out.println(set.contains(a1)); System.out.println(set.contains("b")); System.out.println(toSortedList(set)); set.remove(s2); System.out.println(set.size()); System.out.println(toSortedList(set)); } static public <T extends Comparable<T>> List<T> toSortedList(Collection<T> c) { ArrayList<T> l = new ArrayList<T>(c); Collections.sort(l); return l; } }
[ "soywiz@gmail.com" ]
soywiz@gmail.com
1e4f4149b342ae6832e5bfb98c353d60ee266cdb
754565ec497054b8e9320efff1413aa4fb969580
/src/main/java/burstcoin/faucet/BurstcoinFaucetProperties.java
9da2e2c25ba89dc2e001ea3c1714c0782a81eac0
[ "MIT" ]
permissive
evilgenieent/burstcoin-faucet
d4c36ee04505bcd52a0c424bbc23cbf2339351a0
c0dbb769e9f65335a2b7d3e2997e119eaa23ab5d
refs/heads/master
2021-01-21T18:05:12.498850
2017-05-13T22:16:38
2017-05-13T22:16:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,434
java
/* * The MIT License (MIT) * * Copyright (c) 2016 by luxe - https://github.com/de-luxe - BURST-LUXE-RED2-G6JW-H4HG5 * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software * is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies * or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ package burstcoin.faucet; import nxt.crypto.Crypto; import nxt.util.Convert; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.util.StringUtils; import java.io.FileInputStream; import java.io.IOException; import java.util.Properties; public class BurstcoinFaucetProperties { private static final Logger LOG = LoggerFactory.getLogger(BurstcoinFaucetProperties.class); private static final Properties PROPS = new Properties(); static { try { PROPS.load(new FileInputStream(System.getProperty("user.dir") + "/faucet.properties")); } catch(IOException e) { LOG.error(e.getMessage()); } } private static String walletServer; private static String passPhrase; private static String serverPort; private static String privateKey; private static String publicKey; private static String analyticsCode; private static String numericFaucetAccountId; private static Integer minDonationAmount; private static Integer claimInterval; private static Integer claimAmount; private static Integer fee; private static Integer connectionTimeout; private static Integer statsUpdateInterval; private static Integer maxClaimsPerAccount; public static String getServerPort() { if(serverPort == null) { serverPort = asString("burstcoin.faucet.serverPort", "8080"); } return serverPort; } public static String getWalletServer() { if(walletServer == null) { walletServer = asString("burstcoin.faucet.walletServer", "http://localhost:8125"); } return walletServer; } public static String getPrivateKey() { if(privateKey == null) { privateKey = asString("burstcoin.faucet.recaptcha.privateKey", "6LfEQRETAAAAABu9BQBb7NjRoRkYBUG8wu50cSQ5"); } return privateKey; } public static String getAnalyticsCode() { if(analyticsCode == null) { analyticsCode = asString("burstcoin.faucet.analytics", null); } return analyticsCode; } public static String getPublicKey() { if(publicKey == null) { publicKey = asString("burstcoin.faucet.recaptcha.publicKey", "6LfEQRETAAAAAMxkEr7RHrOE0XEUeeGUgcspSf2J"); } return publicKey; } public static String getPassPhrase() { if(passPhrase == null) { passPhrase = asString("burstcoin.faucet.secretPhrase", "noPassPhrase"); if(passPhrase.equals("noPassPhrase")) { LOG.error("Error: property 'passPhrase' is required!"); } } return passPhrase; // we deliver "noPassPhrase", should find no plots! } public static String getNumericFaucetAccountId() { if(numericFaucetAccountId == null) { String passPhrase = getPassPhrase(); if(passPhrase != null) { byte[] publicKey = Crypto.getPublicKey(passPhrase); byte[] publicKeyHash = Crypto.sha256().digest(publicKey); long faucetAccountId = Convert.fullHashToId(publicKeyHash); numericFaucetAccountId = Convert.toUnsignedLong(faucetAccountId); } } return numericFaucetAccountId; } public static Integer getMaxClaimsPerAccount() { if(maxClaimsPerAccount == null) { maxClaimsPerAccount = asInteger("burstcoin.faucet.maxClaimsPerAccount", null); } return maxClaimsPerAccount; } public static int getClaimInterval() { if(claimInterval == null) { claimInterval = asInteger("burstcoin.faucet.claimInterval", 2); } return claimInterval; } public static int getConnectionTimeout() { if(connectionTimeout == null) { connectionTimeout = asInteger("burstcoin.faucet.connectionTimeout", 30000); } return connectionTimeout; } public static int getStatsUpdateInterval() { if(statsUpdateInterval == null) { statsUpdateInterval = asInteger("burstcoin.faucet.statsUpdateInterval", 1000 * 60 * 10); } return statsUpdateInterval; } public static int getMinDonationAmount() { if(minDonationAmount == null) { minDonationAmount = asInteger("burstcoin.faucet.minDonationListed", 10); } return minDonationAmount; } public static int getClaimAmount() { if(claimAmount == null) { claimAmount = asInteger("burstcoin.faucet.claimAmount", 3); } return claimAmount; } public static int getFee() { if(fee == null) { fee = asInteger("burstcoin.faucet.fee", 1); } return fee; } private static Integer asInteger(String key, Integer defaultValue) { String integerProperty = PROPS.containsKey(key) ? String.valueOf(PROPS.getProperty(key)) : null; Integer value = null; if(!StringUtils.isEmpty(integerProperty)) { try { value = Integer.valueOf(integerProperty); } catch(NumberFormatException e) { LOG.error("value of property: '" + key + "' should be a numeric (int) value."); } } return value != null ? value : defaultValue; } private static String asString(String key, String defaultValue) { String value = PROPS.containsKey(key) ? String.valueOf(PROPS.getProperty(key)) : defaultValue; return StringUtils.isEmpty(value) ? defaultValue : value; } }
[ "luxe@hush.com" ]
luxe@hush.com
e02024139eb9ce6d0296f1b25a71d84312e02978
b704aeff33c7dadf1317691f6398d6995aeee2f6
/src/main/java/signatures/booleant/KeyStoreService.java
ceaad95e8d54865a5de9cf4fbd422949dfc55d9d
[]
no_license
amitchaulagain/docusign
9356f56547001b3fe99f6ebc5d387912bddbcac7
ea5ea8f8e66f0bab499995119beede048f6847d3
refs/heads/master
2021-09-13T06:06:54.659126
2019-05-30T09:46:38
2019-05-30T09:46:38
181,475,175
0
0
null
2021-08-13T15:32:34
2019-04-15T11:44:28
Java
UTF-8
Java
false
false
6,244
java
package signatures.booleant; import sun.security.x509.*; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.math.BigInteger; import java.security.*; import java.security.cert.Certificate; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import java.util.Date; import java.util.Enumeration; public class KeyStoreService implements IKeyStoreService { private final KeyStore keyStore; private final String type = "JCEKS"; KeyStoreService(String name, String password) throws CertificateException, NoSuchAlgorithmException, IOException { this.keyStore = loadKeyStore(name, password, this.type); } @Override public KeyStore createKeyStore(String name, String password, String type) throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException { KeyStore keyStore = null; if (type == null || type.isEmpty()) { type = KeyStore.getDefaultType(); } keyStore = KeyStore.getInstance(type); //load char[] pwdArray = password.toCharArray(); keyStore.load(null, pwdArray); // Save the keyStore FileOutputStream fos = new FileOutputStream(name); keyStore.store(fos, pwdArray); fos.close(); return keyStore; } @Override public KeyStore loadKeyStore(String name, String password, String type) throws IOException, CertificateException, NoSuchAlgorithmException { KeyStore keyStore = null; char[] pwdArray = password.toCharArray(); keyStore.load(new FileInputStream(name), pwdArray); return keyStore; } @Override public void deleteKeyStore(String name, String password, String type) throws CertificateException, NoSuchAlgorithmException, IOException, KeyStoreException { KeyStore keyStore = loadKeyStore(name, password, type); Enumeration<String> aliases = keyStore.aliases(); while (aliases.hasMoreElements()) { String alias = aliases.nextElement(); keyStore.deleteEntry(alias); } keyStore = null; } public X509Certificate generateCertificate(KeyPair keyPair, CertificateUser distinguishedName, CertificateUser issuer) throws CertificateException, IOException, NoSuchProviderException, NoSuchAlgorithmException, InvalidKeyException, SignatureException { final String SHA1WITHRSA = "SHA1withRSA"; X509CertInfo certInfo = new X509CertInfo(); // Serial number and version certInfo.set(X509CertInfo.SERIAL_NUMBER, new CertificateSerialNumber(new BigInteger(64, new SecureRandom()))); certInfo.set(X509CertInfo.VERSION, new CertificateVersion(CertificateVersion.V3)); // Subject & Issuer X500Name owner = new X500Name(distinguishedName.toString()); certInfo.set(X509CertInfo.SUBJECT, owner); certInfo.set(X509CertInfo.ISSUER, owner); // Key and algorithm certInfo.set(X509CertInfo.KEY, new CertificateX509Key(keyPair.getPublic())); AlgorithmId algorithm = new AlgorithmId(AlgorithmId.sha1WithRSAEncryption_oid); certInfo.set(X509CertInfo.ALGORITHM_ID, new CertificateAlgorithmId(algorithm)); // Validity Date validFrom = new Date(); Date validTo = new Date(validFrom.getTime() + 50L * 365L * 24L * 60L * 60L * 1000L); //50 years CertificateValidity validity = new CertificateValidity(validFrom, validTo); certInfo.set(X509CertInfo.VALIDITY, validity); // Create certificate and sign it X509CertImpl cert = new X509CertImpl(certInfo); cert.sign(keyPair.getPrivate(), SHA1WITHRSA); // Since the SHA1withRSA provider may have a different algorithm ID to what we think it should be, // we need to reset the algorithm ID, and resign the certificate AlgorithmId actualAlgorithm = (AlgorithmId) cert.get(X509CertImpl.SIG_ALG); certInfo.set(CertificateAlgorithmId.NAME + "." + CertificateAlgorithmId.ALGORITHM, actualAlgorithm); X509CertImpl newCert = new X509CertImpl(certInfo); newCert.sign(keyPair.getPrivate(), SHA1WITHRSA); return newCert; } @Override public void removeCertificate(String name, String password, String alias) throws CertificateException, NoSuchAlgorithmException, IOException, KeyStoreException { KeyStore keyStore = loadKeyStore(name, password, this.type); keyStore.deleteEntry(alias); } public void setKeyEntry(String name, String password, String alias, PrivateKey privateKey, String keyPassword, java.security.cert.Certificate[] certificateChain) throws KeyStoreException, IOException, CertificateException, NoSuchAlgorithmException { // KeyStore keyStore = null; // keyStore.load(new FileInputStream(name), password.toCharArray()); keyStore.setKeyEntry(alias, privateKey, keyPassword.toCharArray(), certificateChain); } public void setCertificateEntry(String name, String password, String alias, java.security.cert.Certificate certificate) throws KeyStoreException, IOException, CertificateException, NoSuchAlgorithmException { // KeyStore keyStore = null; // keyStore.load(new FileInputStream(name), password.toCharArray()); keyStore.setCertificateEntry(alias, certificate); } public Certificate getCertificate(String name, String password, String alias) throws KeyStoreException, IOException, CertificateException, NoSuchAlgorithmException { // KeyStore keyStore = null; // keyStore.load(new FileInputStream(name), password.toCharArray()); return keyStore.getCertificate(alias); } @Override public KeyStore.Entry getKeyEntry(String alias, String keyPassword) throws KeyStoreException, IOException, CertificateException, NoSuchAlgorithmException, UnrecoverableEntryException { KeyStore.Entry entry = keyStore.getEntry(alias, new KeyStore.PasswordProtection(keyPassword.toCharArray())); return entry; } public KeyStore getKeyStore() { return keyStore; } }
[ "chaulagain.amit@rew3.com" ]
chaulagain.amit@rew3.com
bf04f3a85b8fee3aeed94d5c5273c56781a10996
9dd4e6a116f5f4c38509f0655c3b1ca95b1ceb62
/begin05/src/servlet/CheckboxServlet.java
18357ba8c22a3bb82cae62729f9b89a1cc1166bb
[ "Apache-2.0" ]
permissive
webarata3/begin_Servlet
2bb01a93e9527cd6d5fd891649d0f592de7aa47a
9300f6481a7752f8e7b1449b9ffb265e7b0ece8e
refs/heads/master
2020-03-17T16:27:27.976921
2018-09-28T10:47:25
2018-09-28T10:47:25
133,749,414
0
0
null
null
null
null
UTF-8
Java
false
false
1,434
java
package servlet; import java.io.IOException; import java.io.PrintWriter; import java.nio.charset.StandardCharsets; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/checkbox") public class CheckboxServlet extends HttpServlet { private static final long serialVersionUID = 1L; @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding(StandardCharsets.UTF_8.name()); String checkbox = request.getParameter("checkbox"); String[] checkboxes = request.getParameterValues("checkboxes"); response.setContentType("text/html"); response.setCharacterEncoding(StandardCharsets.UTF_8.name()); try (PrintWriter out = response.getWriter()) { out.println("<html><head><meta charset=\"utf-8\"></head><body>"); out.println("checkbox=" + checkbox + "<br>"); if (checkboxes != null) { out.println("checkboxes=" + String.join(",", checkboxes)); } else { out.println("checkboxes=パラメータなし"); } out.println("</body></html>"); } } }
[ "webarata3@gmail.com" ]
webarata3@gmail.com
a8fa01f7730de83e9f832361945232985866e4c4
cea3fe1ae551bf2f81b431876d15563d6347119b
/case Cloud Demo/case SpringCloudHystrix/product-server/src/main/java/com/gang/cloud/template/demo/client/OrderFeignClient.java
45a801cca136fa2e318b086a9e6f5206ecd83608
[]
no_license
black-ant/case
2e33cbd74b559924d3a53092a8b070edea4d143d
589598bb41398b330bc29b2ca61757296b55b579
refs/heads/master
2023-07-31T23:22:51.168312
2022-07-24T06:15:53
2022-07-24T06:15:53
137,761,384
86
26
null
2023-07-17T01:03:21
2018-06-18T14:22:01
Java
UTF-8
Java
false
false
701
java
package com.gang.cloud.template.demo.client; import com.gang.cloud.template.to.CommonOrderTO; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import java.util.Collection; /** * @Classname SampleFeignClient * @Description TODO * @Date 2021/3/4 21:21 * @Created by zengzg */ @FeignClient("order-server") @Component public interface OrderFeignClient { @GetMapping("/order/list") Collection<CommonOrderTO> list(); @GetMapping("/order/get/{id}") CommonOrderTO getById(@PathVariable("id") String id); }
[ "1016930479@qq.com" ]
1016930479@qq.com
abcd4355188ae9a613df1e936021295bbf2e3930
581b663e4db7c82577d786770dac418d69041b40
/data/src/main/java/ua/com/info/data/Command.java
69815e722c801c3b4220257f23a85b163659fa39
[]
no_license
orestonatsko/PrizeUkr
ed92ee7f22a798f821902420debb2e8f80934b24
5a6eb18a4e146f95049706ab2a96e69e8702fe3f
refs/heads/master
2020-04-04T12:32:05.452803
2018-11-06T11:00:48
2018-11-06T11:00:58
155,929,702
0
0
null
null
null
null
UTF-8
Java
false
false
306
java
package ua.com.info.data; /** * Створено v.m 05.03.2018. */ public class Command implements IDataObject { public String command; public Parameters parameters; public Command(String cmd, Parameters parameters) { command = cmd; this.parameters = parameters; } }
[ "orestonatsko@gmail.com" ]
orestonatsko@gmail.com
61a213e7605a1e2b52ee0ef0885ad00dbeb00beb
7ce51fd525f1767fa18f5c1ead92ed8402891b0f
/chapter5/src/main/java/com/ljx/chapter5/service/impl/EmployeeServiceImpl.java
499bf9d38c3e543cdfe14908fd83edb649e7b8b9
[]
no_license
ljx407/springboot
0ffeb330e0be7a8d314337014ea2bd2a3c60e379
887db0f2a7c605a88143193e94b33c559f4814e0
refs/heads/master
2022-12-21T21:08:41.600126
2019-06-08T09:56:58
2019-06-08T09:56:58
190,871,380
0
0
null
2022-12-16T00:04:00
2019-06-08T09:50:12
Java
UTF-8
Java
false
false
1,526
java
package com.ljx.chapter5.service.impl; import com.ljx.chapter5.dao.EmployeeJpaRepositoryDao; import com.ljx.chapter5.enums.SexEnum; import com.ljx.chapter5.model.Employee; import com.ljx.chapter5.service.EmployService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class EmployeeServiceImpl implements EmployService { @Autowired private EmployeeJpaRepositoryDao employeeJpaRepositoryDao ; @Override public Employee getEmployeeById(Integer id) { return employeeJpaRepositoryDao.findById(id).get(); } @Override public List<Employee> findAll() { return employeeJpaRepositoryDao.findAll(); } @Override public List<Employee> findByCondition(String note,String empName) { return employeeJpaRepositoryDao.findByCondition(note,empName); } @Override public List<Employee> findByCondition(String note) { return employeeJpaRepositoryDao.findByCondition(note); } @Override public List<Employee> findByEmpName(String empName) { return employeeJpaRepositoryDao.findByEmpName(empName); } @Override public List<Employee> findByEmpNameLike(String empName) { return employeeJpaRepositoryDao.findByEmpNameLike(empName); } @Override public List<Employee> findByEmpNameLikeAndSex(String empName, SexEnum sex) { return employeeJpaRepositoryDao.findByEmpNameLikeAndSex(empName,sex); } }
[ "ljx407@163.com" ]
ljx407@163.com
e566e31be885db92564f567f6d826e8977da6166
081f98af6e452b85f110ed7abbba12ae1ed027ba
/src/main/java/rio/antelodel/david/ejercicios_programacion/rich_entity/filter/iface/IFilterIRExamenDescripcion.java
ccb4ff82e55d392f074a43cb1e8672bc14439adc
[]
no_license
DaveDarkLion/TFG
ca9641e1f8fc11d0cf609563cfcb32b1d52e4e8b
338e1438bb1a8456e50b7115fad9dfbb2c6cca37
refs/heads/master
2022-12-24T10:52:35.585554
2019-09-04T18:15:51
2019-09-04T18:15:51
205,182,613
0
0
null
2022-12-15T23:49:32
2019-08-29T14:29:10
Java
UTF-8
Java
false
false
452
java
package rio.antelodel.david.ejercicios_programacion.rich_entity.filter.iface; import rio.antelodel.david.ejercicios_programacion.rich_entity.filter.getter.IFilterIRExamenGetter; import rio.antelodel.david.ejercicios_programacion.rich_entity.filter.iface.container.IFilter; import rio.antelodel.david.ejercicios_programacion.rich_entity.iface.IRExamen; public interface IFilterIRExamenDescripcion extends IFilter <IRExamen, IFilterIRExamenGetter> { }
[ "47219938+DaveDarkLion@users.noreply.github.com" ]
47219938+DaveDarkLion@users.noreply.github.com
c19e3fd5daaf82f6c2342b594fa298f1ca5353e7
36476135bf1389c3dee08a4b177f3b9dd9e663ab
/src/com/fung/service/CategoryService.java
8d665aebff0885440da2fc635cec0210756535ff
[]
no_license
fungnotl/WQStore
ca09c1a7a882ad90d802d49173003bc97145c154
62d63b41f986143e175aa7e39a044969135fcd7e
refs/heads/master
2020-05-30T03:31:16.068889
2019-05-31T04:00:53
2019-05-31T04:00:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
279
java
package com.fung.service; import com.fung.domain.Category; import net.sf.json.JSONArray; public interface CategoryService { //找到所有的Category 并封装成一个JSONArray JSONArray findAllCategory(); //找到单个category Category findCategoryByCid(String cid); }
[ "1311718164@qq.com" ]
1311718164@qq.com
f7b0ab83dc0f6ff816857db2294a2e654a57ec89
23571a3a672a9104e8ec8dd905bfa74887edb963
/1.JavaSyntax/src/com/javarush/task/task07/task0718/Solution.java
3d10558dcbb300e69c4bfb19895482ec35929506
[]
no_license
PiBog/JavaRushTasks
86b6113ee854a9e019bc4157ba89331ecbbf5c5e
4e539e50cf8e444d70280b1fb4fd3ba62009c4b4
refs/heads/master
2021-09-12T15:42:47.824102
2018-04-18T07:46:55
2018-04-18T07:46:55
110,075,581
0
0
null
null
null
null
UTF-8
Java
false
false
1,349
java
package com.javarush.task.task07.task0718; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; /* Проверка на упорядоченность 1. Объяви переменную типа список строк и сразу проинициализируй ee. 2. Считай 10 строк с клавиатуры и добавь их в список. 3. Если список упорядочен по возрастанию длины строки, то ничего выводить не нужно. 4. Если список не упорядочен по возрастанию длины строки, то нужно вывести на экран номер первого элемента, нарушающего такую упорядоченность. */ public class Solution { public static void main(String[] args) throws IOException { //напишите тут ваш код ArrayList<String> list = new ArrayList<>(); BufferedReader reader = new BufferedReader( new InputStreamReader(System.in)); for (int i=0; i<10; i++) list.add(reader.readLine()); for (int k=0; k<list.size()-1; k++){ if (list.get(k).length()>list.get(k+1).length()) System.out.println(k+1); } } }
[ "boblinger@gmail.com" ]
boblinger@gmail.com
50e1bbf54d4e97f7fbdf018253593afe60db0533
b07ec5bf7fbedb0ca8a7d2cc25c6a1d2edfd40fd
/src/main/java/com/airbnb/repositories/HouseDao.java
bb1ab17c50acb27d377aa70e8b9a1e0cd1b70c64
[]
no_license
dudq/airbnb_backend
ee9f5254efcfa59076019531db1a83a1ccddd5f2
0f5e53f6a11faf7bf3df4b203bfab77d6b1a3725
refs/heads/dev
2020-12-06T17:01:08.655117
2020-02-10T07:39:18
2020-02-10T07:39:18
232,512,485
0
0
null
2020-02-10T07:39:20
2020-01-08T08:12:05
Java
UTF-8
Java
false
false
4,305
java
package com.airbnb.repositories; import com.airbnb.messages.response.HouseDetail; import com.airbnb.messages.response.HouseInformation; import com.airbnb.messages.response.HouseInformationOfHost; import com.airbnb.models.House; import org.springframework.stereotype.Repository; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.Query; import javax.transaction.Transactional; import java.util.ArrayList; import java.util.List; @Transactional @Repository public class HouseDao { @PersistenceContext private EntityManager em; public void insert(House house) { em.persist(house); } public HouseDetail getHouseDetailById(Long houseId) { String sql = "select h.id, h.houseNam, h.address, h.bedroomNumber, " + "h.bathroomNumber, h.description, h.price, h.area, h.status," + " u.name userName, u.id userId" + " from house h" + " LEFT JOIN users u" + " ON h.host_id = u.id" + " where h.id = :houseId"; Query query = em.createNativeQuery(sql); query.setParameter("houseId", houseId); Object[] result = (Object[]) query.getSingleResult(); int index = 0; HouseDetail houseDetail = new HouseDetail(); houseDetail.setId(Long.parseLong("" + result[index++])); houseDetail.setName(result[index++].toString()); houseDetail.setAddress(result[index++].toString()); houseDetail.setBedroomNumber(result[index++].toString()); houseDetail.setBathroomNumber(result[index++].toString()); houseDetail.setDescription(result[index++].toString()); houseDetail.setPrice(result[index++].toString()); houseDetail.setArea(result[index++].toString()); houseDetail.setStatus(result[index++].toString()); houseDetail.setUserName(result[index++].toString()); houseDetail.setUserId(result[index].toString()); return houseDetail; } public List<HouseInformation> getListHouse(int page, int pageSize) { String sql = "select h.id, h.houseName, h.address, h.price, h.picture " + "from house h " + "left join users u " + "on h.host_id = u.id;"; Query query = em.createNativeQuery(sql); List<Object[]> listResult = query.getResultList(); List<HouseInformation> houseList = new ArrayList<>(); HouseInformation house; int index; for (Object[] result : listResult) { index = 0; house = new HouseInformation(); house.setId(Long.parseLong(result[index++].toString())); house.setName(result[index++].toString()); house.setAddress(result[index++].toString()); house.setPrice(result[index++].toString()); house.setPicture(result[index++].toString()); houseList.add(house); } return houseList; } public List<HouseInformationOfHost> getListHouseInformationOfHost(Long userId) { String sql = "select h.id, h.houseName, c.name, h.address, h.price, h.status " + "from house h join users u join user_roles ur join Category c " + "on h.host_id = u.id and h.host_id = ur.user_id and c.id = h.category_id " + "where ur.role_id = 2 and ur.user_id = :urid"; Query query = em.createNativeQuery(sql); query.setParameter("urid", userId); List<Object[]> listResult = query.getResultList(); List<HouseInformationOfHost> houseInformationOfHostList = new ArrayList<>(); HouseInformationOfHost house; int index; for (Object[] result : listResult) { index = 0; house = new HouseInformationOfHost(); house.setId(Long.parseLong(result[index++].toString())); house.setName(result[index++].toString()); house.setCategoryName(result[index++].toString()); house.setAddress(result[index++].toString()); house.setPrice(result[index++].toString()); // house.setStatus(result[index].toString()); houseInformationOfHostList.add(house); } return houseInformationOfHostList; } }
[ "dudq.xmt@gmail.com" ]
dudq.xmt@gmail.com
b5d593cff6a767303f09b559b454baa270c04ffd
7006f2b2cfe3dcb1bcd597c6547f983cd7d7fcec
/src/main/java/com/datahome/group/IndexDataMgmtGroup.java
ce481ce2fcfd9db3acab00db88bc4cb2114252b9
[]
no_license
Youlingsong/shmec_index
48cfb12cb945d330db3114df10c26b682685b8dd
1c9aa860b332a358b122b8ffc9ba2eb74774ad4c
refs/heads/master
2020-05-16T04:34:34.583761
2019-05-05T10:07:48
2019-05-05T10:07:48
182,780,725
0
0
null
null
null
null
UTF-8
Java
false
false
311
java
package com.datahome.group; /** * @Author xl * @Description: * @Date: Create in 2018/5/21 19:40 */ public interface IndexDataMgmtGroup { interface finds {} interface update {} interface findMapData {} interface saveIndexData {} interface exportExcel {} interface delete {} }
[ "www.mackson.xyz" ]
www.mackson.xyz
c904eb12b806fde022e8e21c9573db439554c74c
79bd726e1cb46f34092095343e8bfff21fd11fdc
/src/main/java/com/chen/phone_store_springboot/service/AddressService.java
e296a0cd2fd4621f35874948d01654362c9cd62f
[]
no_license
machunchen/phone_store_springboot
6682780940237cf4a3825bf6cf3f2bb4e181474f
130c97df698b9f02fe54f7ba4e23f2fe76f9a889
refs/heads/master
2023-06-23T03:32:12.011083
2021-07-17T07:00:08
2021-07-17T07:00:08
386,863,453
0
0
null
null
null
null
UTF-8
Java
false
false
316
java
package com.chen.phone_store_springboot.service; import com.chen.phone_store_springboot.form.AddressForm; import com.chen.phone_store_springboot.vo.AddressVO; import java.util.List; public interface AddressService { public List<AddressVO> findAll(); public void saveOrUpdate(AddressForm addressForm); }
[ "wmac1204@outlook.com" ]
wmac1204@outlook.com
94b83c95f4c0ec50e3a6512b3ccd6afaaac3436e
f12da240ee793afdaf485524b86afcda2e0b02b4
/banner/src/main/java/com/king/lib/banner/BannerLog.java
83bd9cc4cd801ebf5c7c3d752e6fa7ab00fd11fc
[]
no_license
AidenKing/CoolBanner
82e9fb93d9a1fdad817f446f34e4a5c82f0ae007
53d587f8bef4962247213685a13374e4c34744c3
refs/heads/master
2020-04-26T11:36:58.995791
2019-03-04T09:42:30
2019-03-04T09:42:30
173,464,897
0
0
null
null
null
null
UTF-8
Java
false
false
1,005
java
package com.king.lib.banner; import android.util.Log; /** * Desc: * * @author:Jing Yang * @date: 2019/3/1 10:16 */ public class BannerLog { private static boolean isDebug=false; /**类名**/ private static String className; /**方法名**/ private static String methodName; public static void e(String message){ if (!isDebug) return; // Throwable instance must be created before any methods getMethodNames(new Throwable().getStackTrace()); Log.e(className, createLog(message)); } private static void getMethodNames(StackTraceElement[] sElements){ className = sElements[1].getFileName(); methodName = sElements[1].getMethodName(); } private static String createLog(String log){ StringBuffer buffer = new StringBuffer(); buffer.append("["); buffer.append(methodName); buffer.append("]"); buffer.append(log); return buffer.toString(); } }
[ "jingyangsddx@163.com" ]
jingyangsddx@163.com
56771ffdd528dfa7a3ccca513c8b476a572a6468
1ef2cae4af76342a6f808093e1f5cec637b86e51
/src/src/Connexion.java
09225d76e73761aba52af6ef11c429ddf3d3c899
[]
no_license
cverite/Tetris
d25ac97051d7716ec28f16688c761bbd28fb5b12
401483b17cbdd61b0ce2b3e121164b270623c975
refs/heads/master
2020-03-25T06:28:13.670856
2015-06-07T18:25:59
2015-06-07T18:25:59
37,026,457
0
0
null
null
null
null
UTF-8
Java
false
false
6,308
java
package src; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; import java.net.Socket; /** * Cette classe permet de gérer la connexion entre le serveur et le client. * @author Aurélie OTTAVI et Céline VERITE */ public class Connexion extends Thread{ /** * Flux que l'on reçoit du Client */ private BufferedReader d; /** * Flux dans lequel on envoi vers le Client */ private PrintStream out; /** * jeuServeur */ private JeuServeur jeuServeur; /** * Constructeur de la classe * @param client le socket avec lequel on communique avec le client * @param jeuServeur classe ou est cr��e cette classe */ public Connexion(Socket client, JeuServeur jeuServeur){ try{ this.jeuServeur=jeuServeur; d = new BufferedReader(new InputStreamReader(client.getInputStream())); out=new PrintStream(client.getOutputStream()); } catch(IOException e){ System.err.println("Erreur "+e); System.exit(1); } this.start(); } /** * Cette m�thode permet l'envoi des données au client */ public void run(){ for(;;){ //On cr�e une classe pour envoyer les données EnvoiServeur e=new EnvoiServeur(out,jeuServeur); e.start(); //On cr�e une classe pour recevoir les donn�es Ecoute ec=new Ecoute(true,d,jeuServeur.getFenetre()); ec.start(); //On lance la thread de jeu jeuServeur.getFenetre().jeu.start(); while(true){ if(jeuServeur.getRequete()==null){ //si la requete n'est pas nulle c'est que l'on a pas encore envoy� son contenu donc on ne le remplace pas if(jeuServeur.getFenetre().envoiChoixForme==true){ // envoi du tableau de pieces spéciales avec lesquelles on joue jeuServeur.setRequete(jeuServeur.getFenetre().jeu.SpetoString()); jeuServeur.getFenetre().envoiChoixForme=false; } else if(jeuServeur.getFenetre().jeu.envoicorriace==true){//envoi d'une piece corriace a l'adversaire jeuServeur.setRequete("c"); jeuServeur.getFenetre().jeu.envoicorriace=false; } else if(jeuServeur.getFenetre().jeu.lievre==true){//envoi la destruction d'une piece lievre à l'adversaire jeuServeur.setRequete("L"); jeuServeur.getFenetre().jeu.lievre=false; } else if(jeuServeur.getFenetre().jeu.superCassePied==true){//envoi la destruction d'une piece super casse-pied à l'adversaire jeuServeur.setRequete("S"); jeuServeur.getFenetre().jeu.superCassePied=false; } else if(jeuServeur.getFenetre().jeu.O==true){//envoi d'une piece 'O' à l'adversaire jeuServeur.setRequete("O"); jeuServeur.getFenetre().jeu.O=false; } else if(jeuServeur.getFenetre().jeu.pickpocket==true){//envoi un demande à l'adversaire pour qu'il tranqmette sa prochaine piece jeuServeur.setRequete("V"); jeuServeur.getFenetre().jeu.pickpocket=false; } else if (jeuServeur.getFenetre().jeu.envoiForme==true){// envoi de sa prochaine piece a l'adversaire jeuServeur.setRequete("V"+jeuServeur.getFenetre().ecranJeu.formeSuivante.toString()); jeuServeur.getFenetre().ecranJeu.newForme(); jeuServeur.getFenetre().jeu.envoiForme=false; } else if(jeuServeur.getFenetre().jeu.echangiste1==true){// envoi de l'écran et de la forme courrante en cas de piece �changiste detruite et demande d'nvoi du jeu de l'autre jeuServeur.setRequete("E"+jeuServeur.getFenetre().ecranJeu.currentForme.getNbrElement()+jeuServeur.getFenetre().ecranJeu.currentForme.toString()+jeuServeur.getFenetre().ecranJeu.toString()); jeuServeur.getFenetre().jeu.echangiste1=false; } else if(jeuServeur.getFenetre().jeu.echangiste2==true){//envoi de l'écran et de la forme courrante en cas de piece échangiste detruite jeuServeur.setRequete("e"+jeuServeur.getFenetre().jeu.ecranJeuTemp.toString()); jeuServeur.getFenetre().jeu.echangiste2=false; } else if(jeuServeur.getFenetre().pannel.perdu==true)jeuServeur.setRequete("P");//envoi de la perte de la partie else if(jeuServeur.getFenetre().pannel.gagne==true)jeuServeur.setRequete("G");//envoi é l'adversaire qu'il a gagn� else if(jeuServeur.getFenetre().pannel.envoip==true) {jeuServeur.setRequete("p");}//envoi de la mise en pause de la partie else if(jeuServeur.getFenetre().pannel.ecranJeu.envoi==true ){// envoi de l'écran à l'adversaire jeuServeur.setRequete(jeuServeur.getFenetre().pannel.ecranJeu.formeSuivante.getNbrElement()+jeuServeur.getFenetre().pannel.ecranJeu.formeSuivante.toString()+ jeuServeur.getFenetre().pannel.ecranJeu.toString()); jeuServeur.getFenetre().pannel.ecranJeu.envoi=false; } } } } } }
[ "ce.verite@gmail.com" ]
ce.verite@gmail.com
388f2c3bf60017c0019a66a45eb87c1d586ab7be
dc4d199d48c794998d58abee8a944b89e306ce26
/javadoc-parser/src/test/java/com/ashigeru/lang/java/parser/javadoc/DefaultJavadocBlockParserTest.java
1165f26d835ae76dc385180d04c42dc500cb27ac
[ "Apache-2.0" ]
permissive
ashigeru/javalang-tools
547c0361462e3b15ab78a3377b038dc0d812489f
71cd0c81960737a6511a156a3e38681021999601
refs/heads/master
2020-05-07T10:20:25.490959
2011-03-09T06:30:27
2011-03-09T06:30:27
910,273
0
0
null
null
null
null
UTF-8
Java
false
false
4,400
java
/* * Copyright 2007 the Seasar Foundation and the Others. * * 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.ashigeru.lang.java.parser.javadoc; import static com.ashigeru.lang.java.internal.parser.javadoc.ir.IrDocElementKind.*; import static org.junit.Assert.*; import java.util.Arrays; import java.util.List; import java.util.regex.Pattern; import org.junit.Test; import com.ashigeru.lang.java.internal.parser.javadoc.ir.IrDocBlock; import com.ashigeru.lang.java.internal.parser.javadoc.ir.IrDocFragment; /** * Test for {@link DefaultJavadocBlockParser}. * @author Suguru ARAKAWA (Gluegent, Inc.) */ public class DefaultJavadocBlockParserTest extends JavadocTestRoot { /** * Test method for {@link DefaultJavadocBlockParser#DefaultJavadocBlockParser()}. */ @Test public void testDefaultJavadocBlockParser() { DefaultJavadocBlockParser parser = new DefaultJavadocBlockParser(); assertEquals(0, parser.getBlockParsers().size()); } /** * Test method for {@link DefaultJavadocBlockParser#DefaultJavadocBlockParser(java.util.List)}. */ @Test public void testDefaultJavadocBlockParserInlines() { MockJavadocBlockParser m1 = new MockJavadocBlockParser(); MockJavadocBlockParser m2 = new MockJavadocBlockParser(); MockJavadocBlockParser m3 = new MockJavadocBlockParser(); DefaultJavadocBlockParser parser = new DefaultJavadocBlockParser(Arrays.asList(m1, m2, m3)); List<? extends JavadocBlockParser> parsers = parser.getBlockParsers(); assertEquals(3, parsers.size()); assertSame(m1, parsers.get(0)); assertSame(m2, parsers.get(1)); assertSame(m3, parsers.get(2)); } /** * Test method for {@link DefaultJavadocBlockParser#canAccept(java.lang.String)}. */ @Test public void testCanAccept() { DefaultJavadocBlockParser parser = new DefaultJavadocBlockParser(); assertTrue(parser.canAccept(null)); assertTrue(parser.canAccept("")); assertTrue(parser.canAccept("param")); assertTrue(parser.canAccept("code")); } /** * Test method for {@link DefaultJavadocBlockParser#parse(java.lang.String, JavadocScanner)}. * @throws Exception If occurred */ @Test public void testParse() throws Exception { MockJavadocBlockParser i1 = new MockJavadocBlockParser(); i1.setIdentifier("i1"); i1.setAcceptable(Pattern.compile("a")); DefaultJavadocBlockParser parser = new DefaultJavadocBlockParser(Arrays.asList(i1)); { IrDocBlock block = parser.parse(null, string(" Hello, world!")); assertNull(block.getTag()); List<? extends IrDocFragment> fragments = block.getFragments(); assertKinds(fragments, TEXT); } { IrDocBlock block = parser.parse(null, string("{@a sample}")); assertNull(block.getTag()); List<? extends IrDocFragment> fragments = block.getFragments(); assertKinds(fragments, BLOCK); assertMockBlockEquals(i1, "@a", fragments.get(0)); } { IrDocBlock block = parser.parse(null, string("Hello, {@a THIS} world!")); assertNull(block.getTag()); List<? extends IrDocFragment> fragments = block.getFragments(); assertKinds(fragments, TEXT, BLOCK, TEXT); assertTextEquals("Hello, ", fragments.get(0)); assertMockBlockEquals(i1, "@a", fragments.get(1)); assertTextEquals(" world!", fragments.get(2)); } { try { parser.parse(null, string("Hello, {@b THIS} world!")); fail(); } catch (MissingJavadocBlockParserException e) { assertEquals("b", e.getTagName()); } } } }
[ "public@ashigeru.com" ]
public@ashigeru.com
9fe1b84a25ed819917a34b03dd0a4364838fec84
8e0d800d6eb7d65b1ab1f264f3e28edcaf74c3df
/bus-gitlab/src/main/java/org/aoju/bus/gitlab/utils/AccessTokenUtils.java
6ae28a81b47a860bc50ea8ecce4d6b957d4a648b
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
GuoJingFu/bus
e30f4c6eb3bffee0fd6b7bf4a8f235a92a62752c
a4eed21a354f531dc9ba141ed7fd8a39a4273490
refs/heads/master
2020-11-26T17:15:46.994157
2019-12-19T16:16:18
2019-12-19T16:16:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
35,058
java
package org.aoju.bus.gitlab.utils; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; import org.aoju.bus.gitlab.GitLabApiException; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; import java.util.Arrays; import java.util.List; import java.util.StringJoiner; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * This class uses HTML scraping to create and revoke GitLab personal access tokens, * the user's Feed token, and for fetching the current Health Check access token. * * <p>NOTE: This relies on HTML scraping and has been tested on GitLab-CE 11.0.0 to 11.10.1 for * proper functionality. It may not work on earlier or later versions.</p> */ public final class AccessTokenUtils { protected static final String USER_AGENT = "GitLab4J Client"; protected static final String COOKIES_HEADER = "Set-Cookie"; protected static final String NEW_USER_AUTHENTICITY_TOKEN_REGEX = "\"new_user\".*name=\\\"authenticity_token\\\"\\svalue=\\\"([^\\\"]*)\\\".*new_new_user"; protected static final Pattern NEW_USER_AUTHENTICITY_TOKEN_PATTERN = Pattern.compile(NEW_USER_AUTHENTICITY_TOKEN_REGEX); protected static final String AUTHENTICITY_TOKEN_REGEX = "name=\\\"authenticity_token\\\"\\svalue=\\\"([^\\\"]*)\\\""; protected static final Pattern AUTHENTICITY_TOKEN_PATTERN = Pattern.compile(AUTHENTICITY_TOKEN_REGEX); protected static final String PERSONAL_ACCESS_TOKEN_REGEX = "name=\\\"created-personal-access-token\\\".*data-clipboard-text=\\\"([^\\\"]*)\\\".*\\/>"; protected static final Pattern PERSONAL_ACCESS_TOKEN_PATTERN = Pattern.compile(PERSONAL_ACCESS_TOKEN_REGEX); protected static final String REVOKE_PERSONAL_ACCESS_TOKEN_REGEX = "href=\\\"([^\\\"]*)\\\""; protected static final Pattern REVOKE_PERSONAL_ACCESS_TOKEN_PATTERN = Pattern.compile(REVOKE_PERSONAL_ACCESS_TOKEN_REGEX); protected static final String FEED_TOKEN_REGEX = "name=\\\"feed_token\\\".*value=\\\"([^\\\"]*)\\\".*\\/>"; protected static final Pattern FEED_TOKEN_PATTERN = Pattern.compile(FEED_TOKEN_REGEX); protected static final String HEALTH_CHECK_ACCESS_TOKEN_REGEX = "id=\"health-check-token\">([^<]*)<\\/code>"; protected static final Pattern HEALTH_CHECK_ACCESS_TOKEN_PATTERN = Pattern.compile(HEALTH_CHECK_ACCESS_TOKEN_REGEX); /** * Create a GitLab personal access token with the provided configuration. * * @param baseUrl the GitLab server base URL * @param username the user name to create the personal access token for * @param password the password of the user to create the personal access token for * @param tokenName the name for the new personal access token * @param scopes an array of scopes for the new personal access token * @return the created personal access token * @throws GitLabApiException if any exception occurs */ public static final String createPersonalAccessToken(final String baseUrl, final String username, final String password, final String tokenName, final Scope[] scopes) throws GitLabApiException { if (scopes == null || scopes.length == 0) { throw new RuntimeException("scopes cannot be null or empty"); } return (createPersonalAccessToken(baseUrl, username, password, tokenName, Arrays.asList(scopes))); } /** * Create a GitLab personal access token with the provided configuration. * * @param baseUrl the GitLab server base URL * @param username the user name to create the personal access token for * @param password the password of the user to create the personal access token for * @param tokenName the name for the new personal access token * @param scopes a List of scopes for the new personal access token * @return the created personal access token * @throws GitLabApiException if any exception occurs */ public static final String createPersonalAccessToken(final String baseUrl, final String username, final String password, final String tokenName, final List<Scope> scopes) throws GitLabApiException { // Save the follow redirect state so it can be restored later boolean savedFollowRedirects = HttpURLConnection.getFollowRedirects(); String cookies = null; try { // Must manually follow redirects if (savedFollowRedirects) { HttpURLConnection.setFollowRedirects(false); } /******************************************************************************* * Step 1: Login and get the session cookie. * *******************************************************************************/ cookies = login(baseUrl, username, password); /******************************************************************************* * Step 2: Go to the /profile/personal_access_tokens page to fetch a * * new authenticity token. * *******************************************************************************/ String urlString = baseUrl + "/profile/personal_access_tokens"; URL url = new URL(urlString); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestProperty("User-Agent", USER_AGENT); connection.setRequestProperty("Cookie", cookies); connection.setReadTimeout(10000); connection.setConnectTimeout(10000); // Make sure the response code is 200, otherwise there is a failure int responseCode = connection.getResponseCode(); if (responseCode != 200) { throw new GitLabApiException("Failure loading Access Tokens page, aborting!"); } String content = getContent(connection); Matcher matcher = AUTHENTICITY_TOKEN_PATTERN.matcher(content); if (!matcher.find()) { throw new GitLabApiException("authenticity_token not found, aborting!"); } String csrfToken = matcher.group(1); /******************************************************************************* * Step 3: Submit the /profile/personalccess_tokens page with the info to * * create a new personal access token. * *******************************************************************************/ connection = (HttpURLConnection) url.openConnection(); connection.setRequestProperty("User-Agent", USER_AGENT); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); connection.setRequestProperty("Charset", "utf-8"); connection.setRequestProperty("Cookie", cookies); connection.setReadTimeout(10000); connection.setConnectTimeout(10000); connection.setRequestMethod("POST"); connection.setDoInput(true); connection.setDoOutput(true); StringBuilder formData = new StringBuilder(); addFormData(formData, "authenticity_token", csrfToken); addFormData(formData, "personal_access_token[name]", tokenName); addFormData(formData, "personal_access_token[expires_at]", ""); if (scopes != null && scopes.size() > 0) { for (Scope scope : scopes) { addFormData(formData, "personal_access_token[scopes][]", scope.toString()); } } connection.setRequestProperty("Content-Length", String.valueOf(formData.length())); OutputStream output = connection.getOutputStream(); output.write(formData.toString().getBytes()); output.flush(); output.close(); // Make sure a redirect was provided, otherwise there is a failure responseCode = connection.getResponseCode(); if (responseCode != 302) { throw new GitLabApiException("Failure creating personal access token, aborting!"); } // Follow the redirect with the provided session cookie String redirectUrl = connection.getHeaderField("Location"); url = new URL(redirectUrl); connection = (HttpURLConnection) url.openConnection(); connection.setRequestProperty("User-Agent", USER_AGENT); connection.setRequestProperty("Cookie", cookies); connection.setReadTimeout(10000); connection.setConnectTimeout(10000); // Make sure the response code is 200, otherwise there is a failure responseCode = connection.getResponseCode(); if (responseCode != 200) { throw new GitLabApiException("Failure creating personal access token, aborting!"); } // Extract the personal access token from the page and return it content = getContent(connection); matcher = PERSONAL_ACCESS_TOKEN_PATTERN.matcher(content); if (!matcher.find()) { throw new GitLabApiException("created-personal-access-token not found, aborting!"); } String personalAccessToken = matcher.group(1); return (personalAccessToken); } catch (IOException ioe) { throw new GitLabApiException(ioe); } finally { if (cookies != null) { try { logout(baseUrl, cookies); } catch (Exception ignore) { } } if (savedFollowRedirects) { HttpURLConnection.setFollowRedirects(true); } } } /** * Revoke the first matching GitLab personal access token. * * @param baseUrl the GitLab server base URL * @param username the user name to revoke the personal access token for * @param password the password of the user to revoke the personal access token for * @param tokenName the name of the personal access token to revoke * @param scopes an array of scopes of the personal access token to revoke * @throws GitLabApiException if any exception occurs */ public static final void revokePersonalAccessToken(final String baseUrl, final String username, final String password, final String tokenName, final Scope[] scopes) throws GitLabApiException { if (scopes == null || scopes.length == 0) { throw new RuntimeException("scopes cannot be null or empty"); } revokePersonalAccessToken(baseUrl, username, password, tokenName, Arrays.asList(scopes)); } /** * Revoke the first matching GitLab personal access token. * * @param baseUrl the GitLab server base URL * @param username the user name to revoke the personal access token for * @param password the password of the user to revoke the personal access token for * @param tokenName the name of the personal access token to revoke * @param scopes a List of scopes of the personal access token to revoke * @throws GitLabApiException if any exception occurs */ public static final void revokePersonalAccessToken(final String baseUrl, final String username, final String password, final String tokenName, final List<Scope> scopes) throws GitLabApiException { // Save the follow redirect state so it can be restored later boolean savedFollowRedirects = HttpURLConnection.getFollowRedirects(); String cookies = null; try { // Must manually follow redirects if (savedFollowRedirects) { HttpURLConnection.setFollowRedirects(false); } /******************************************************************************* * Step 1: Login and get the session cookie. * *******************************************************************************/ cookies = login(baseUrl, username, password); /******************************************************************************* * Step 2: Go to the /profile/personal_access_tokens page and fetch the * * authenticity token. * *******************************************************************************/ String urlString = baseUrl + "/profile/personal_access_tokens"; URL url = new URL(urlString); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestProperty("User-Agent", USER_AGENT); connection.setRequestProperty("Cookie", cookies); connection.setReadTimeout(10000); connection.setConnectTimeout(10000); // Make sure the response code is 200, otherwise there is a failure int responseCode = connection.getResponseCode(); if (responseCode != 200) { throw new GitLabApiException("Failure loading Access Tokens page, aborting!"); } String content = getContent(connection); Matcher matcher = AUTHENTICITY_TOKEN_PATTERN.matcher(content); if (!matcher.find()) { throw new GitLabApiException("authenticity_token not found, aborting!"); } String csrfToken = matcher.group(1); /******************************************************************************* * Step 3: Submit the /profile/personal_access_tokens page with the info to * * revoke the first matching personal access token. * *******************************************************************************/ int indexOfTokenName = content.indexOf("<td>" + tokenName + "</td>"); if (indexOfTokenName == -1) { throw new GitLabApiException("personal access token not found, aborting!"); } content = content.substring(indexOfTokenName); int indexOfLinkEnd = content.indexOf("</a>"); if (indexOfTokenName == -1) { throw new GitLabApiException("personal access token not found, aborting!"); } content = content.substring(0, indexOfLinkEnd); String scopesText = ""; if (scopes != null && scopes.size() > 0) { final StringJoiner joiner = new StringJoiner(", "); scopes.forEach(s -> joiner.add(s.toString())); scopesText = joiner.toString(); } if (content.indexOf(scopesText) == -1) { throw new GitLabApiException("personal access token not found, aborting!"); } matcher = REVOKE_PERSONAL_ACCESS_TOKEN_PATTERN.matcher(content); if (!matcher.find()) { throw new GitLabApiException("personal access token not found, aborting!"); } String revokePath = matcher.group(1); url = new URL(baseUrl + revokePath); connection = (HttpURLConnection) url.openConnection(); connection.setRequestProperty("User-Agent", USER_AGENT); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); connection.setRequestProperty("Charset", "utf-8"); connection.setRequestProperty("Cookie", cookies); connection.setReadTimeout(10000); connection.setConnectTimeout(10000); connection.setRequestMethod("PUT"); connection.setDoInput(true); connection.setDoOutput(true); // Submit the form StringBuilder formData = new StringBuilder(); addFormData(formData, "authenticity_token", csrfToken); connection.setRequestProperty("Content-Length", String.valueOf(formData.length())); OutputStream output = connection.getOutputStream(); output.write(formData.toString().getBytes()); output.flush(); output.close(); // Make sure a redirect was provided, otherwise there is a failure responseCode = connection.getResponseCode(); if (responseCode != 302) { throw new GitLabApiException("Failure revoking personal access token, aborting!"); } // Follow the redirect with the provided session cookie String redirectUrl = connection.getHeaderField("Location"); url = new URL(redirectUrl); connection = (HttpURLConnection) url.openConnection(); connection.setRequestProperty("User-Agent", USER_AGENT); connection.setRequestProperty("Cookie", cookies); connection.setReadTimeout(10000); connection.setConnectTimeout(10000); // Make sure the response code is 200, otherwise there is a failure responseCode = connection.getResponseCode(); if (responseCode != 200) { throw new GitLabApiException("Failure revoking personal access token, aborting!"); } } catch (IOException ioe) { throw new GitLabApiException(ioe); } finally { if (cookies != null) { try { logout(baseUrl, cookies); } catch (Exception ignore) { } } if (savedFollowRedirects) { HttpURLConnection.setFollowRedirects(true); } } } /** * Fetches the user's GitLab Feed token using HTML scraping. * * @param baseUrl the GitLab server base URL * @param username the user name the user to log in with * @param password the password of the provided username * @return the fetched Feed token * @throws GitLabApiException if any exception occurs */ public static final String getFeedToken(final String baseUrl, final String username, final String password) throws GitLabApiException { // Save the follow redirect state so it can be restored later boolean savedFollowRedirects = HttpURLConnection.getFollowRedirects(); String cookies = null; try { // Must manually follow redirects if (savedFollowRedirects) { HttpURLConnection.setFollowRedirects(false); } /******************************************************************************* * Step 1: Login and get the session cookie. * *******************************************************************************/ cookies = login(baseUrl, username, password); /******************************************************************************* * Step 2: Go to the /profile/personal_access_tokens page and fetch the * * Feed token. * *******************************************************************************/ String urlString = baseUrl + "/profile/personal_access_tokens"; URL url = new URL(urlString); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestProperty("User-Agent", USER_AGENT); connection.setRequestProperty("Cookie", cookies); connection.setReadTimeout(10000); connection.setConnectTimeout(10000); // Make sure the response code is 200, otherwise there is a failure int responseCode = connection.getResponseCode(); if (responseCode != 200) { throw new GitLabApiException("Failure loading Access Tokens page, aborting!"); } // Extract the Feed token from the page and return it String content = getContent(connection); Matcher matcher = FEED_TOKEN_PATTERN.matcher(content); if (!matcher.find()) { throw new GitLabApiException("Feed token not found, aborting!"); } String feedToken = matcher.group(1); return (feedToken); } catch (IOException ioe) { throw new GitLabApiException(ioe); } finally { if (cookies != null) { try { logout(baseUrl, cookies); } catch (Exception ignore) { } } if (savedFollowRedirects) { HttpURLConnection.setFollowRedirects(true); } } } /** * Fetches the GitLab health check access token using HTML scraping. * * @param baseUrl the GitLab server base URL * @param username the user name of an admin user to log in with * @param password the password of the provided username * @return the fetched health check access token * @throws GitLabApiException if any exception occurs */ public static final String getHealthCheckAccessToken(final String baseUrl, final String username, final String password) throws GitLabApiException { // Save the follow redirect state so it can be restored later boolean savedFollowRedirects = HttpURLConnection.getFollowRedirects(); String cookies = null; try { // Must manually follow redirects if (savedFollowRedirects) { HttpURLConnection.setFollowRedirects(false); } /******************************************************************************* * Step 1: Login and get the session cookie. * *******************************************************************************/ cookies = login(baseUrl, username, password); /******************************************************************************* * Step 2: Go to the /admin/health_check page and fetch the * health check * access token. * *******************************************************************************/ String urlString = baseUrl + "/admin/health_check"; URL url = new URL(urlString); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestProperty("User-Agent", USER_AGENT); connection.setRequestProperty("Cookie", cookies); connection.setReadTimeout(10000); connection.setConnectTimeout(10000); // Make sure the response code is 200, otherwise there is a failure int responseCode = connection.getResponseCode(); if (responseCode != 200) { throw new GitLabApiException("Failure loading Health Check page, aborting!"); } // Extract the personal access token from the page and return it String content = getContent(connection); Matcher matcher = HEALTH_CHECK_ACCESS_TOKEN_PATTERN.matcher(content); if (!matcher.find()) { throw new GitLabApiException("health-check-access-token not found, aborting!"); } String healthCheckAccessToken = matcher.group(1); return (healthCheckAccessToken); } catch (IOException ioe) { throw new GitLabApiException(ioe); } finally { if (cookies != null) { try { logout(baseUrl, cookies); } catch (Exception ignore) { } } if (savedFollowRedirects) { HttpURLConnection.setFollowRedirects(true); } } } /** * Gets a GitLab session cookie by logging in the specified user. * * @param baseUrl the GitLab server base URL * @param username the user name to to login for * @param password the password of the user to login for * @return the GitLab seesion token as a cookie value * @throws GitLabApiException if any error occurs */ protected static final String login(final String baseUrl, final String username, final String password) throws GitLabApiException { // Save the follow redirect state so it can be restored later boolean savedFollowRedirects = HttpURLConnection.getFollowRedirects(); try { // Must manually follow redirects if (savedFollowRedirects) { HttpURLConnection.setFollowRedirects(false); } /******************************************************************************* * Step 1: Go to the login page to get a session cookie and an athuicity_token * *******************************************************************************/ String urlString = baseUrl + "/users/sign_in"; URL url = new URL(urlString); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.addRequestProperty("User-Agent", USER_AGENT); connection.setReadTimeout(10000); connection.setConnectTimeout(10000); // Make sure a redirect was provided, otherwise it is a login failure int responseCode = connection.getResponseCode(); if (responseCode != 200) { throw new GitLabApiException("Invalid state, aborting!"); } // Get the session cookie from the headers String[] cookieParts = connection.getHeaderField(COOKIES_HEADER).split(";"); String cookies = cookieParts[0]; // Extract the authenticity token from the content, need this to submit the // login form String content = getContent(connection); Matcher matcher = NEW_USER_AUTHENTICITY_TOKEN_PATTERN.matcher(content); if (!matcher.find()) { throw new GitLabApiException("authenticity_token not found, aborting!"); } String csrfToken = matcher.group(1); /******************************************************************************* * Step 2: Submit the login form wih the session cookie and authenticity_token * * fetching a new session cookie along the way. * *******************************************************************************/ connection = (HttpURLConnection) url.openConnection(); connection.setRequestProperty("User-Agent", USER_AGENT); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); connection.setRequestProperty("Charset", "utf-8"); connection.setRequestProperty("Cookie", cookies); connection.setReadTimeout(10000); connection.setConnectTimeout(10000); connection.setRequestMethod("POST"); connection.setDoInput(true); connection.setDoOutput(true); StringBuilder formData = new StringBuilder(); addFormData(formData, "user[login]", username); addFormData(formData, "user[password]", password); addFormData(formData, "authenticity_token", csrfToken); connection.setRequestProperty("Content-Length", String.valueOf(formData.length())); OutputStream output = connection.getOutputStream(); output.write(formData.toString().getBytes()); output.flush(); output.close(); // Make sure a redirect was provided, otherwise it is a login failure responseCode = connection.getResponseCode(); if (responseCode != 302) { throw new GitLabApiException("Login failure, aborting!", 401); } cookieParts = connection.getHeaderField(COOKIES_HEADER).split(";"); cookies = cookieParts[0]; // Follow the redirect with the provided session cookie String redirectUrl = connection.getHeaderField("Location"); url = new URL(redirectUrl); connection = (HttpURLConnection) url.openConnection(); connection.setRequestProperty("User-Agent", USER_AGENT); connection.setRequestProperty("Cookie", cookies); connection.setReadTimeout(10000); connection.setConnectTimeout(10000); // The response code should be 200, otherwise something is wrong, consider it a login failure responseCode = connection.getResponseCode(); if (responseCode != 200) { throw new GitLabApiException("Login failure, aborting!", 401); } return (cookies); } catch (IOException ioe) { throw new GitLabApiException(ioe); } finally { if (savedFollowRedirects) { HttpURLConnection.setFollowRedirects(true); } } } /** * Logs out the user associated with the GitLab session cookie. * * @param baseUrl the GitLab server base URL * @param cookies the GitLab session cookie to logout * @throws GitLabApiException if any error occurs */ protected static final void logout(final String baseUrl, final String cookies) throws GitLabApiException { // Save so it can be restored later boolean savedFollowRedirects = HttpURLConnection.getFollowRedirects(); try { // Must manually follow redirects if (savedFollowRedirects) { HttpURLConnection.setFollowRedirects(false); } String urlString = baseUrl + "/users/sign_out"; URL url = new URL(urlString); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestProperty("User-Agent", USER_AGENT); connection.setRequestProperty("Cookie", cookies); connection.setRequestMethod("GET"); connection.setReadTimeout(10000); connection.setConnectTimeout(10000); // Make sure a redirect was provided, otherwise it is a logout failure int responseCode = connection.getResponseCode(); if (responseCode != 302) { throw new GitLabApiException("Logout failure, aborting!"); } } catch (IOException ioe) { throw new GitLabApiException(ioe); } finally { if (savedFollowRedirects) { HttpURLConnection.setFollowRedirects(true); } } } /** * Adds the specified form param to the form data StringBuilder. If the provided formData is null, * will create the StringBuilder instance first. * * @param formData the StringBuilder instance holding the form data, if null will create the StringBuilder * @param name the form param name * @param value the form param value * @return the form data StringBuilder * @throws GitLabApiException if any error occurs. */ public static final StringBuilder addFormData(StringBuilder formData, String name, String value) throws GitLabApiException { if (formData == null) { formData = new StringBuilder(); } else if (formData.length() > 0) { formData.append("&"); } formData.append(name); formData.append("="); try { formData.append(URLEncoder.encode(value, "UTF-8")); return (formData); } catch (Exception e) { throw new GitLabApiException(e); } } /** * Reads and returns the content from the provided URLConnection. * * @param connection the URLConnection to read the content from * @return the read content as a String * @throws GitLabApiException if any error occurs */ protected static String getContent(URLConnection connection) throws GitLabApiException { StringBuilder buf = new StringBuilder(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) { reader.lines().forEach(b -> buf.append(b)); } catch (IOException ioe) { throw new GitLabApiException(ioe); } return (buf.toString()); } /** * This enum defines the available scopes for a personal access token. */ public enum Scope { /** * Grants complete access to the API and Container Registry (read/write) (introduced in GitLab 8.15). */ API, /** * Allows to read (pull) container registry images if a project is private and * authorization is required (introduced in GitLab 9.3). If the GitLab server you * are using does not have the Registry properly configured, using this scope will * result in an exception. */ READ_REGISTRY, /** * Allows read-only access (pull) to the repository through git clone. */ READ_REPOSITORY, /** * Allows access to the read-only endpoints under /users. Essentially, any of the GET * requests in the Users API are allowed (introduced in GitLab 8.15). */ READ_USER, /** * Allows performing API actions as any user in the system, * if the authenticated user is an admin (introduced in GitLab 10.2). */ SUDO, /** * Grants read-write access to repositories on private projects using Git-over-HTTP (not using the API). */ WRITE_REPOSITORY; private static JacksonJsonEnumHelper<Scope> enumHelper = new JacksonJsonEnumHelper<>(Scope.class); @JsonCreator public static Scope forValue(String value) { return enumHelper.forValue(value); } @JsonValue public String toValue() { return (enumHelper.toString(this)); } @Override public String toString() { return (enumHelper.toString(this)); } } }
[ "839536@qq.com" ]
839536@qq.com
6a3d27fa2bc4fbbdc986e36e4657487c4e18da0e
3588b0b904934b7fca493953da90120276d5c1e5
/src/challenge4/First.java
fd590bb2ff8b046f4c39c7e69683582de7f33a93
[]
no_license
WXRain/Algorithms
223f50d3b9f5ff247194bebeaee5792acdcecbf7
a965bdfd3d2de02bc6ec70e7b162f9587e5d9b3f
refs/heads/master
2023-08-05T11:23:48.197865
2021-09-01T02:30:44
2021-09-01T02:30:44
99,637,642
0
0
null
null
null
null
UTF-8
Java
false
false
691
java
package challenge4; public class First { public boolean canFormArray(int[] arr, int[][] pieces) { for (int i = 0; i < pieces.length; i++) { int loc = 0; for (int j = 0; j < pieces[i].length; j++, loc++) { if (loc == 0) loc = findLocation(pieces[i][j], arr); if (loc == -1 || loc >= arr.length) return false; if (pieces[i][j] != arr[loc]) return false; } } return true; } public int findLocation(int x, int[] arr) { int i; for (i = 0; i < arr.length; i++) { if (arr[i] == x) return i; } return -1; } }
[ "xiaomenxiaomen@qq.com" ]
xiaomenxiaomen@qq.com
c397f8a2b4766767bfcc2f213d0ddfaad7c91285
b3a002a8fa092d13bdf50c4df3f606dee5343ae0
/src/br/com/dh/model/PessoaJuridica.java
2594d7d7a0c92189fe590f0f7df5d5d668c04999
[]
no_license
andrerco001/incognitous-sa
60ef1a66323e75fda774e2fad6cfeb331201b2b5
a41da600dd295cfa99134512fc12a9c27554b029
refs/heads/master
2022-12-01T00:47:25.438636
2020-08-21T22:17:04
2020-08-21T22:17:04
288,885,735
0
0
null
null
null
null
UTF-8
Java
false
false
2,614
java
package br.com.dh.model; import java.time.LocalDate; import java.time.temporal.ChronoUnit; public class PessoaJuridica extends Funcionario { // atributos private String cnpj; // metodos construtores public PessoaJuridica() { } public PessoaJuridica(int id, String nome, String email, String endereco, String setor, LocalDate dataDeAdmissao, LocalDate dataDeDemissao, double salarioBase, String cnpj) { super(id, nome, email, endereco, setor, dataDeAdmissao, dataDeDemissao, salarioBase); this.cnpj = cnpj; } // metodos getters e setters public String getCnpj() { return cnpj; } public void setCnpj(String cnpj) { this.cnpj = cnpj; } // metodos @Override public String toString() { return "PessoaJuridica [id=" + id + ", nome=" + nome + ", email=" + email + ", endereco=" + endereco + ", setor=" + setor + ", dataDeAdmissao=" + dataDeAdmissao + ", dataDeDemissao=" + dataDeDemissao + ", salarioBase=" + salarioBase + ", cnpj=" + cnpj + "]"; } @Override public void consultarContrachque() { System.out.println("################ Contra-cheque ################"); System.out.println("Funcionario [id=" + id + ", nome=" + nome + ", setor=" + setor + ", dataDeAdmissao=" + dataDeAdmissao + ", dataDeDemissao=" + dataDeDemissao + ", salarioBase=" + salarioBase + "]"); System.out.println("################################################"); } @Override public void requisitarFerias() { LocalDate dataAtual = LocalDate.now(); if (ChronoUnit.MONTHS.between(dataDeAdmissao, dataAtual) >= 11) { System.out.println("Suas ferias foram aprovadas."); } } @Override public void trabalhar() { LocalDate diaDeTrabalho = LocalDate.now(); System.out.println("O funcionario " + this.nome + ", id " + this.id + " trabalhara no dia " + diaDeTrabalho); } @Override public void pedirDemissao() { LocalDate diaDeDemissao = LocalDate.now(); System.out.println( "O funcionario " + this.nome + ", id " + this.id + " solicita sua demissao em " + diaDeDemissao); this.dataDeDemissao = diaDeDemissao; } @Override public void solicitarAumento() { int resposta = (int) Math.floor(Math.random() * 10); if (resposta % 2 == 0) { System.out.println("O aumento salarial solicitado pelo funcionario " + this.nome + ", id " + this.id + " foi aprovado."); } else { System.out.println( "O aumento salarial solicitado pelo funcionario " + this.nome + ", id " + this.id + " foi negado."); } } @Override public void funcionarioEmFeriasNaoPodeTrabalhar() { System.out.println("Os funcionarios em ferias nao podem trabalhar"); } }
[ "andreoliveira.adv@hotmail.com" ]
andreoliveira.adv@hotmail.com
377b9ca79ce44a5d74a4e0bbf8fe2a9db8d158a9
795ae78163db8db48f8257c763de1d25bcb87390
/src/uk/ac/warwick/dcs/boss/frontend/sites/configpages/ConfigPage.java
e5738e48c6ba8ef6378b45ae6907f867aef0c282
[]
no_license
tranngocthachs/BOSS2
324a716eff5aeea9bd9cd2c4128b111d99ef8a28
0dc1e1d496b0e8200eb6a2306dd542a922f8dddb
refs/heads/master
2020-04-28T06:22:41.183599
2010-09-15T14:02:58
2010-09-15T14:02:58
505,859
2
0
null
null
null
null
UTF-8
Java
false
false
1,045
java
package uk.ac.warwick.dcs.boss.frontend.sites.configpages; import java.io.IOException; import javax.servlet.ServletException; import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; import uk.ac.warwick.dcs.boss.frontend.Page; import uk.ac.warwick.dcs.boss.frontend.PageContext; import uk.ac.warwick.dcs.boss.frontend.PageLoadException; import uk.ac.warwick.dcs.boss.model.FactoryRegistrar; public class ConfigPage extends Page { public ConfigPage() throws PageLoadException { super("system_config", AccessLevel.NONE); } public void handleGet(PageContext pageContext, Template template, VelocityContext templateContext) throws ServletException, IOException { templateContext.put("options", FactoryRegistrar.knownConfigurationOptions()); pageContext.renderTemplate(template, templateContext); } protected void handlePost(PageContext pageContext, Template template, VelocityContext templateContext) throws ServletException, IOException { throw new ServletException("Unexpected POST"); } }
[ "tranngocthachs@gmail.com" ]
tranngocthachs@gmail.com
8e258fe3b40552d23e486c466c7587dd0b11d408
f9941de13892be6ea6351e67c7a85b003be56b0d
/abc/ui/swing/JKeySignature.java
6b679981d08561cd6c82d0856f10b0c21605bdab
[]
no_license
embeddedprogrammer/pianohero
3600a56af9e918c7e71f14455651558d7cdca15a
b7eb1c6189bd0c78cec2cfbcae9736e35a521f8f
refs/heads/master
2021-05-11T21:42:28.935200
2020-02-28T03:47:15
2020-02-28T03:47:15
117,476,218
0
0
null
null
null
null
UTF-8
Java
false
false
7,357
java
// Copyright 2006-2008 Lionel Gueganton // This file is part of abc4j. // // abc4j is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // abc4j is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with abc4j. If not, see <http://www.gnu.org/licenses/>. package abc.ui.swing; import java.awt.Color; import java.awt.Graphics2D; import java.awt.geom.Point2D; import java.util.ArrayList; import abc.notation.Accidental; import abc.notation.Clef; import abc.notation.KeySignature; import abc.notation.Note; import abc.notation.MusicElement; import abc.ui.scoretemplates.ScoreElements; /** This class is in charge of rendering a key signature. */ class JKeySignature extends JScoreElementAbstract { /* TODO: test every keys, TJM "Gracings" branch changes not included */ private KeySignature key = null; private KeySignature previous_key = null; private double m_width = -1; private ArrayList chars = new ArrayList(); //ArrayList of char[] private ArrayList positions = new ArrayList(); //ArrayList of Point2D public JKeySignature(KeySignature keyV, Point2D base, ScoreMetrics c) { this(keyV, null, base, c); } public JKeySignature(KeySignature keyV, KeySignature keyPrevious, Point2D base, ScoreMetrics c) { super(c); key = keyV; previous_key = keyPrevious; setBase(base); } public MusicElement getMusicElement() { return key; } public double getWidth() { return m_width; //suppose it has been calculated } protected void onBaseChanged() { ScoreMetrics c = getMetrics(); Point2D m_base = getBase(); // easier to read, and may speed up a little :) double noteHeight = c.getNoteHeight(); double baseX = m_base.getX(); double baseY = m_base.getY() - noteHeight/2; Clef clef = key.getClef(); if (previous_key != null) { if (!previous_key.getClef().equals(key.getClef())) { double clefWidth = new JClef(getBase(), key.getClef(), getMetrics()).getWidth(); m_width += clefWidth; baseX += clefWidth; } } double octaveOffset = 0; if (clef.isC()) octaveOffset = 3.5; else if (clef.isF()) octaveOffset = 3.5*2; //key accidentals depending on the clef octave offset = 3.5 octaveOffset -= clef.getOctaveTransposition()*3.5; //Calculate vertical position for # and b double FsharpY = baseY - (JClef.getOffset(new Note(Note.f), clef)-octaveOffset) * noteHeight; double CsharpY = baseY - (JClef.getOffset(new Note(Note.c), clef)-octaveOffset) * noteHeight; double GsharpY = baseY - (JClef.getOffset(new Note(Note.g), clef)-octaveOffset) * noteHeight; double DsharpY = baseY - (JClef.getOffset(new Note(Note.d), clef)-octaveOffset) * noteHeight; double AsharpY = baseY - (JClef.getOffset(new Note(Note.A), clef)-octaveOffset) * noteHeight; double EsharpY = baseY - (JClef.getOffset(new Note(Note.e), clef)-octaveOffset) * noteHeight; double BsharpY = baseY - (JClef.getOffset(new Note(Note.B), clef)-octaveOffset) * noteHeight; double BflatY = BsharpY;//baseY - JNote.getOffset(new Note(Note.B)) * noteHeight; double EflatY = EsharpY;//baseY - JNote.getOffset(new Note(Note.e)) * noteHeight; double AflatY = AsharpY;//baseY - JNote.getOffset(new Note(Note.A)) * noteHeight; double DflatY = DsharpY;//baseY - JNote.getOffset(new Note(Note.d)) * noteHeight; double GflatY = baseY - (JClef.getOffset(new Note(Note.G), clef)-octaveOffset) * noteHeight; double CflatY = CsharpY;//baseY - JNote.getOffset(new Note(Note.c)) * noteHeight; double FflatY = baseY - (JClef.getOffset(new Note(Note.F), clef)-octaveOffset) * noteHeight; //0=C, 1=D..., 6=B int[] sharpOrder = new int[] {3,0,4,1,5,2,6}; int[] flatOrder = new int[] {6,2,5,1,4,0,3}; double[] sharpYs = new double[] {FsharpY,CsharpY,GsharpY,DsharpY,AsharpY,EsharpY,BsharpY}; double[] flatYs = new double[] {BflatY,EflatY,AflatY,DflatY,GflatY,CflatY,FflatY}; Accidental firstAccidental, secondAccidental; if (key.isSharpDominant()) { firstAccidental = Accidental.SHARP; secondAccidental = Accidental.FLAT; } else /*if (key.hasOnlyFlats())*/ { firstAccidental = Accidental.FLAT; secondAccidental = Accidental.SHARP; } Accidental[] accidentals = key.getAccidentals(); int cpt = 0; if ((previous_key != null) && !previous_key.equals(key)) { //Before switching to a new key, maybe we need to //print naturals Accidental accidental = previous_key.isSharpDominant() ?Accidental.SHARP:Accidental.FLAT; int[] order = (accidental == Accidental.FLAT) ?flatOrder:sharpOrder; char glyph = getMusicalFont().getAccidental(Accidental.NATURAL); double glyphWidth = getMetrics().getBounds(glyph).getWidth(); double[] Ys = (accidental==Accidental.FLAT) ?flatYs:sharpYs; Accidental[] previous_accidentals = previous_key.getAccidentals(); for (int i = 0; i < order.length; i++) { if (!previous_accidentals[order[i]].isNatural() && !accidentals[order[i]].equals(previous_accidentals[order[i]])) { chars.add(cpt, new char[]{glyph}); positions.add(cpt, new Point2D.Double(baseX, Ys[i])); baseX += glyphWidth; m_width += glyphWidth; cpt++; } } if (cpt > 0) { //there are some naturals, so a little space baseX += glyphWidth; m_width += glyphWidth; } } for (int twoPasses = 1; twoPasses <= 2; twoPasses++) { Accidental accidental = twoPasses==1?firstAccidental:secondAccidental; int[] order = (accidental.isFlat())?flatOrder:sharpOrder; double[] Ys = (accidental.isFlat())?flatYs:sharpYs; if ((twoPasses == 2) && key.hasSharpsAndFlats()) { //A little space when changing accidental double litSpace = getMetrics().getBounds(getMusicalFont().getAccidental(Accidental.NATURAL)).getWidth(); baseX += litSpace; m_width += litSpace; } for (int i = 0; i < order.length; i++) { if (accidentals[order[i]].getNearestOccidentalValue() == accidental.getNearestOccidentalValue()) { char glyph = getMusicalFont().getAccidental(accidentals[order[i]]); double glyphWidth = getMetrics().getBounds(glyph).getWidth(); chars.add(cpt, new char[]{glyph}); positions.add(cpt, new Point2D.Double(baseX, Ys[i])); baseX += glyphWidth; m_width += glyphWidth; cpt++; } } } } public double render(Graphics2D context){ super.render(context); if (previous_key != null) { if (!previous_key.getClef().equals(key.getClef())) { JClef jc = new JClef(getBase(), key.getClef(), getMetrics()); jc.setStaffLine(getStaffLine()); jc.render(context); } } Color previousColor = context.getColor(); setColor(context, ScoreElements.KEY_SIGNATURE); for (int i = 0, j = chars.size(); i < j; i++) { if (chars.get(i)!=null) { Point2D p = (Point2D) positions.get(i); context.drawChars((char[]) chars.get(i), 0, 1, (int)p.getX(), (int)p.getY()); } } context.setColor(previousColor); return getWidth(); } }
[ "snowflakeobsidian3.14@gmail.com" ]
snowflakeobsidian3.14@gmail.com
af472e91c80ae29bcbadc3144373a9b6619e50fb
508c1a8a65b05f6a8a0d4e0cfd277538d22c0fec
/dolphin-tools/src/main/java/com/zhiyun/utils/AlipayUtils.java
d5139ad30971bd9f447533a7b44795a6b1c81943
[]
no_license
zhiyunhanhuibing/dolphin
2dcfa20c3f0f6e4ee0ad202bafefcea886e5c8d6
e4888bb7654d54c3ac01a92ce16677a0e6400f1b
refs/heads/master
2022-07-06T11:56:00.928583
2019-08-22T07:10:28
2019-08-22T07:10:28
193,455,125
2
1
null
2022-06-21T01:30:04
2019-06-24T07:22:02
Java
UTF-8
Java
false
false
2,395
java
package com.zhiyun.utils; import cn.hutool.core.util.StrUtil; import com.alipay.api.AlipayApiException; import com.alipay.api.internal.util.AlipaySignature; import com.zhiyun.domain.AlipayConfig; import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletRequest; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.Map; /** * 支付宝工具类 * @author zhengjie * @date 2018/09/30 14:04:35 */ @Component public class AlipayUtils { /** * 生成订单号 * @return */ public String getOrderCode() { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); int a = (int)(Math.random() * 9000.0D) + 1000; System.out.println(a); Date date = new Date(); String str = sdf.format(date); String[] split = str.split("-"); String s = split[0] + split[1] + split[2]; String[] split1 = s.split(" "); String s1 = split1[0] + split1[1]; String[] split2 = s1.split(":"); String s2 = split2[0] + split2[1] + split2[2] + a; return s2; } /** * 校验签名 * @param request * @return */ public boolean rsaCheck(HttpServletRequest request, AlipayConfig alipay){ /** * 获取支付宝POST过来反馈信息 */ Map<String,String> params = new HashMap<>(1); Map requestParams = request.getParameterMap(); for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext();) { String name = (String) iter.next(); String[] values = (String[]) requestParams.get(name); String valueStr = ""; for (int i = 0; i < values.length; i++) { valueStr = (i == values.length - 1) ? valueStr + values[i] : valueStr + values[i] + ","; } params.put(name, valueStr); } try { boolean verifyResult = AlipaySignature.rsaCheckV1(params, alipay.getPublicKey(), alipay.getCharset(), alipay.getSignType()); return verifyResult; } catch (AlipayApiException e) { return false; } } public boolean isEmpty(String str){ return StrUtil.isEmpty(str); } }
[ "282691156@qq.com //你的GitHub注册邮箱" ]
282691156@qq.com //你的GitHub注册邮箱
bad37e6181a3e95cee2609f998d742de5bbf6c7a
5fe514255d2a18aefc00f0dc07d7c19d2021b4ca
/src/main/java/com/qihang/buss/sc/baseinfo/entity/TScFeeForRpEntity.java
3bc4ec8637fe798581a81e595a429252a4667bf7
[]
no_license
goozi/winter
2e3e7c6ce7f14ed4c34d86e0c183e22352bf0d36
59cc69e4b4c1966ccaa29bb75c2b7b76f82c80e6
refs/heads/master
2021-01-10T10:48:11.919014
2016-11-30T09:59:19
2016-11-30T09:59:19
43,868,005
0
0
null
null
null
null
UTF-8
Java
false
false
7,723
java
package com.qihang.buss.sc.baseinfo.entity; import com.qihang.winter.poi.excel.annotation.Excel; import org.hibernate.annotations.GenericGenerator; import javax.persistence.*; import java.util.Date; /** * @Title: Entity * @Description: 收支项目 * @author onlineGenerator * @date 2016-07-08 11:34:35 * @version V1.0 * */ @Entity @Table(name = "T_SC_Fee", schema = "") @SuppressWarnings("serial") public class TScFeeForRpEntity implements java.io.Serializable { /**主键*/ private String id; /**创建人名称*/ private String createName; /**创建人登录名称*/ private String createBy; /**创建日期*/ private Date createDate; /**更新人名称*/ private String updateName; /**更新人登录名称*/ private String updateBy; /**更新日期*/ private Date updateDate; /**名称*/ @Excel(name="收支项目") private String name; /**编号*/ private String number; /**分类ID*/ private String parentID; /**助记码*/ private String shortNumber; /**简称*/ private String shortName; /**禁用标记*/ private Integer disabled; /**逻辑删除*/ private Integer deleted; /**版本号*/ private Integer version; /**级次*/ private Integer level; /**引用次数*/ private Integer count; /**备注*/ private String note; /** *方法: 取得java.lang.String *@return: java.lang.String 主键 */ @Id @GeneratedValue(generator = "paymentableGenerator") @GenericGenerator(name = "paymentableGenerator", strategy = "uuid") @Column(name ="ID",nullable=false,length=36) public String getId(){ return this.id; } /** *方法: 设置java.lang.String *@param: java.lang.String 主键 */ public void setId(String id){ this.id = id; } /** *方法: 取得java.lang.String *@return: java.lang.String 创建人名称 */ @Column(name ="CREATE_NAME",nullable=true,length=50) public String getCreateName(){ return this.createName; } /** *方法: 设置java.lang.String *@param: java.lang.String 创建人名称 */ public void setCreateName(String createName){ this.createName = createName; } /** *方法: 取得java.lang.String *@return: java.lang.String 创建人登录名称 */ @Column(name ="CREATE_BY",nullable=true,length=50) public String getCreateBy(){ return this.createBy; } /** *方法: 设置java.lang.String *@param: java.lang.String 创建人登录名称 */ public void setCreateBy(String createBy){ this.createBy = createBy; } /** *方法: 取得java.util.Date *@return: java.util.Date 创建日期 */ @Column(name ="CREATE_DATE",nullable=true,length=20) public Date getCreateDate(){ return this.createDate; } /** *方法: 设置java.util.Date *@param: java.util.Date 创建日期 */ public void setCreateDate(Date createDate){ this.createDate = createDate; } /** *方法: 取得java.lang.String *@return: java.lang.String 更新人名称 */ @Column(name ="UPDATE_NAME",nullable=true,length=50) public String getUpdateName(){ return this.updateName; } /** *方法: 设置java.lang.String *@param: java.lang.String 更新人名称 */ public void setUpdateName(String updateName){ this.updateName = updateName; } /** *方法: 取得java.lang.String *@return: java.lang.String 更新人登录名称 */ @Column(name ="UPDATE_BY",nullable=true,length=50) public String getUpdateBy(){ return this.updateBy; } /** *方法: 设置java.lang.String *@param: java.lang.String 更新人登录名称 */ public void setUpdateBy(String updateBy){ this.updateBy = updateBy; } /** *方法: 取得java.util.Date *@return: java.util.Date 更新日期 */ @Column(name ="UPDATE_DATE",nullable=true,length=20) public Date getUpdateDate(){ return this.updateDate; } /** *方法: 设置java.util.Date *@param: java.util.Date 更新日期 */ public void setUpdateDate(Date updateDate){ this.updateDate = updateDate; } /** *方法: 取得java.lang.String *@return: java.lang.String 名称 */ @Column(name ="NAME",nullable=false,length=80) public String getName(){ return this.name; } /** *方法: 设置java.lang.String *@param: java.lang.String 名称 */ public void setName(String name){ this.name = name; } /** *方法: 取得java.lang.String *@return: java.lang.String 编号 */ @Column(name ="NUMBER",nullable=false,length=80) public String getNumber(){ return this.number; } /** *方法: 设置java.lang.String *@param: java.lang.String 编号 */ public void setNumber(String number){ this.number = number; } /** *方法: 取得java.lang.String *@return: java.lang.String 分类ID */ @Column(name ="PARENTID",nullable=true,length=32) public String getParentID(){ return this.parentID; } /** *方法: 设置java.lang.String *@param: java.lang.String 分类ID */ public void setParentID(String parentID){ this.parentID = parentID; } /** *方法: 取得java.lang.String *@return: java.lang.String 助记码 */ @Column(name ="SHORTNUMBER",nullable=true,length=80) public String getShortNumber(){ return this.shortNumber; } /** *方法: 设置java.lang.String *@param: java.lang.String 助记码 */ public void setShortNumber(String shortNumber){ this.shortNumber = shortNumber; } /** *方法: 取得java.lang.String *@return: java.lang.String 简称 */ @Column(name ="SHORTNAME",nullable=false,length=80) public String getShortName(){ return this.shortName; } /** *方法: 设置java.lang.String *@param: java.lang.String 简称 */ public void setShortName(String shortName){ this.shortName = shortName; } /** *方法: 取得java.lang.Integer *@return: java.lang.Integer 禁用标记 */ @Column(name ="DISABLED",nullable=true,length=32) public Integer getDisabled(){ return this.disabled; } /** *方法: 设置java.lang.Integer *@param: java.lang.Integer 禁用标记 */ public void setDisabled(Integer disabled){ this.disabled = disabled; } /** *方法: 取得java.lang.Integer *@return: java.lang.Integer 逻辑删除 */ @Column(name ="DELETED",nullable=true,length=32) public Integer getDeleted(){ return this.deleted; } /** *方法: 设置java.lang.Integer *@param: java.lang.Integer 逻辑删除 */ public void setDeleted(Integer deleted){ this.deleted = deleted; } /** *方法: 取得java.lang.Integer *@return: java.lang.Integer 版本号 */ @Version @Column(name ="VERSION",nullable=true,length=32) public Integer getVersion(){ return this.version; } /** *方法: 设置java.lang.Integer *@param: java.lang.Integer 版本号 */ public void setVersion(Integer version){ this.version = version; } /** *方法: 取得java.lang.Integer *@return: java.lang.Integer 级次 */ @Column(name ="LEVEL",nullable=true,length=32) public Integer getLevel(){ return this.level; } /** *方法: 设置java.lang.Integer *@param: java.lang.Integer 级次 */ public void setLevel(Integer level){ this.level = level; } /** *方法: 取得java.lang.Integer *@return: java.lang.Integer 引用次数 */ @Column(name ="COUNT",nullable=true,length=32) public Integer getCount(){ return this.count; } /** *方法: 设置java.lang.Integer *@param: java.lang.Integer 引用次数 */ public void setCount(Integer count){ this.count = count; } /** *方法: 取得java.lang.String *@return: java.lang.String 备注 */ @Column(name ="NOTE",nullable=true,length=255) public String getNote(){ return this.note; } /** *方法: 设置java.lang.String *@param: java.lang.String 备注 */ public void setNote(String note){ this.note = note; } }
[ "goozi@163.com" ]
goozi@163.com
5bdec3cd9c42220971f4c35447715a864f227c64
931cd24bcee1d8a1c16d69792975649ddc434915
/design-pattern/src/main/java/com/aaron/design/pattern/structural/facade/SubSystem2.java
a036d8884fcfc8f97fe81980829b66a881631031
[]
no_license
wangleimvp/maven-wanglei-severlet
581c9c1c95fa8dba4a9937a8431b2b17de1bbd12
23842569b7fb4cbd289f314ffafede4bdaa8e557
refs/heads/master
2022-12-24T23:46:35.301546
2020-05-20T04:47:17
2020-05-20T04:47:17
78,193,446
0
0
null
2022-12-16T06:57:06
2017-01-06T09:30:26
Java
UTF-8
Java
false
false
223
java
package com.aaron.design.pattern.structural.facade; /** * Author wanglei * Created on 2020-03-13 */ public class SubSystem2 { public void method2() { System.out.println("子系统2的方法执行"); } }
[ "wangleimvp110@126.com" ]
wangleimvp110@126.com
f5bfc5ad5e2ec2298d6f5a9d181eb6207966730b
c7e000e5c6549e095a8ffd032d33e0ca449c7ffd
/bin/platform/bootstrap/gensrc/de/hybris/platform/cms2/model/navigation/CMSNavigationNodeModel.java
8df262fc6c7f4c0541b90a55a6a7281e5f18cf7f
[]
no_license
J3ys/million
e80ff953e228e4bc43a1108a1c117ddf11cc4644
a97974b68b4adaf820f9024aa5181de635c60b4f
refs/heads/master
2021-03-09T22:59:35.115273
2015-05-19T02:47:29
2015-05-19T02:47:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
12,042
java
/* * ---------------------------------------------------------------- * --- WARNING: THIS FILE IS GENERATED AND WILL BE OVERWRITTEN! --- * --- Generated at 2015/05/18 13:25:55 --- * ---------------------------------------------------------------- * * [y] hybris Platform * * Copyright (c) 2000-2011 hybris AG * All rights reserved. * * This software is the confidential and proprietary information of hybris * ("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 hybris. * */ package de.hybris.platform.cms2.model.navigation; import de.hybris.platform.catalog.model.CatalogVersionModel; import de.hybris.platform.cms2.model.contents.CMSItemModel; import de.hybris.platform.cms2.model.contents.components.CMSLinkComponentModel; import de.hybris.platform.cms2.model.navigation.CMSNavigationEntryModel; import de.hybris.platform.cms2.model.navigation.CMSNavigationNodeModel; import de.hybris.platform.cms2.model.pages.ContentPageModel; import de.hybris.platform.core.model.ItemModel; import de.hybris.platform.servicelayer.model.ItemModelContext; import java.util.List; import java.util.Locale; /** * Generated model class for type CMSNavigationNode first defined at extension cms2. */ @SuppressWarnings("all") public class CMSNavigationNodeModel extends CMSItemModel { /**<i>Generated model type code constant.</i>*/ public final static String _TYPECODE = "CMSNavigationNode"; /**<i>Generated relation code constant for relation <code>CMSNavigationNodeChildren</code> defining source attribute <code>parent</code> in extension <code>cms2</code>.</i>*/ public final static String _CMSNAVIGATIONNODECHILDREN = "CMSNavigationNodeChildren"; /**<i>Generated relation code constant for relation <code>CMSLinksForNavNodes</code> defining source attribute <code>links</code> in extension <code>cms2</code>.</i>*/ public final static String _CMSLINKSFORNAVNODES = "CMSLinksForNavNodes"; /**<i>Generated relation code constant for relation <code>CMSContentPagesForNavNodes</code> defining source attribute <code>pages</code> in extension <code>cms2</code>.</i>*/ public final static String _CMSCONTENTPAGESFORNAVNODES = "CMSContentPagesForNavNodes"; /** <i>Generated constant</i> - Attribute key of <code>CMSNavigationNode.title</code> attribute defined at extension <code>cms2</code>. */ public static final String TITLE = "title"; /** <i>Generated constant</i> - Attribute key of <code>CMSNavigationNode.visible</code> attribute defined at extension <code>cms2</code>. */ public static final String VISIBLE = "visible"; /** <i>Generated constant</i> - Attribute key of <code>CMSNavigationNode.parent</code> attribute defined at extension <code>cms2</code>. */ public static final String PARENT = "parent"; /** <i>Generated constant</i> - Attribute key of <code>CMSNavigationNode.children</code> attribute defined at extension <code>cms2</code>. */ public static final String CHILDREN = "children"; /** <i>Generated constant</i> - Attribute key of <code>CMSNavigationNode.links</code> attribute defined at extension <code>cms2</code>. */ public static final String LINKS = "links"; /** <i>Generated constant</i> - Attribute key of <code>CMSNavigationNode.pages</code> attribute defined at extension <code>cms2</code>. */ public static final String PAGES = "pages"; /** <i>Generated constant</i> - Attribute key of <code>CMSNavigationNode.entries</code> attribute defined at extension <code>cms2</code>. */ public static final String ENTRIES = "entries"; /** <i>Generated variable</i> - Variable of <code>CMSNavigationNode.visible</code> attribute defined at extension <code>cms2</code>. */ private Boolean _visible; /** <i>Generated variable</i> - Variable of <code>CMSNavigationNode.parent</code> attribute defined at extension <code>cms2</code>. */ private CMSNavigationNodeModel _parent; /** <i>Generated variable</i> - Variable of <code>CMSNavigationNode.children</code> attribute defined at extension <code>cms2</code>. */ private List<CMSNavigationNodeModel> _children; /** <i>Generated variable</i> - Variable of <code>CMSNavigationNode.links</code> attribute defined at extension <code>cms2</code>. */ private List<CMSLinkComponentModel> _links; /** <i>Generated variable</i> - Variable of <code>CMSNavigationNode.pages</code> attribute defined at extension <code>cms2</code>. */ private List<ContentPageModel> _pages; /** <i>Generated variable</i> - Variable of <code>CMSNavigationNode.entries</code> attribute defined at extension <code>cms2</code>. */ private List<CMSNavigationEntryModel> _entries; /** * <i>Generated constructor</i> - Default constructor for generic creation. */ public CMSNavigationNodeModel() { super(); } /** * <i>Generated constructor</i> - Default constructor for creation with existing context * @param ctx the model context to be injected, must not be null */ public CMSNavigationNodeModel(final ItemModelContext ctx) { super(ctx); } /** * <i>Generated constructor</i> - Constructor with all mandatory attributes. * @deprecated Since 4.1.1 Please use the default constructor without parameters * @param _catalogVersion initial attribute declared by type <code>CMSItem</code> at extension <code>cms2</code> * @param _uid initial attribute declared by type <code>CMSItem</code> at extension <code>cms2</code> */ @Deprecated public CMSNavigationNodeModel(final CatalogVersionModel _catalogVersion, final String _uid) { super(); setCatalogVersion(_catalogVersion); setUid(_uid); } /** * <i>Generated constructor</i> - for all mandatory and initial attributes. * @deprecated Since 4.1.1 Please use the default constructor without parameters * @param _catalogVersion initial attribute declared by type <code>CMSItem</code> at extension <code>cms2</code> * @param _owner initial attribute declared by type <code>Item</code> at extension <code>core</code> * @param _uid initial attribute declared by type <code>CMSItem</code> at extension <code>cms2</code> */ @Deprecated public CMSNavigationNodeModel(final CatalogVersionModel _catalogVersion, final ItemModel _owner, final String _uid) { super(); setCatalogVersion(_catalogVersion); setOwner(_owner); setUid(_uid); } /** * <i>Generated method</i> - Getter of the <code>CMSNavigationNode.children</code> attribute defined at extension <code>cms2</code>. * Consider using FlexibleSearchService::searchRelation for pagination support of large result sets. * @return the children */ public List<CMSNavigationNodeModel> getChildren() { if (this._children!=null) { return _children; } return _children = getPersistenceContext().getValue(CHILDREN, _children); } /** * <i>Generated method</i> - Getter of the <code>CMSNavigationNode.entries</code> attribute defined at extension <code>cms2</code>. * Consider using FlexibleSearchService::searchRelation for pagination support of large result sets. * @return the entries */ public List<CMSNavigationEntryModel> getEntries() { if (this._entries!=null) { return _entries; } return _entries = getPersistenceContext().getValue(ENTRIES, _entries); } /** * <i>Generated method</i> - Getter of the <code>CMSNavigationNode.links</code> attribute defined at extension <code>cms2</code>. * Consider using FlexibleSearchService::searchRelation for pagination support of large result sets. * @return the links */ @Deprecated public List<CMSLinkComponentModel> getLinks() { if (this._links!=null) { return _links; } return _links = getPersistenceContext().getValue(LINKS, _links); } /** * <i>Generated method</i> - Getter of the <code>CMSNavigationNode.pages</code> attribute defined at extension <code>cms2</code>. * Consider using FlexibleSearchService::searchRelation for pagination support of large result sets. * @return the pages */ @Deprecated public List<ContentPageModel> getPages() { if (this._pages!=null) { return _pages; } return _pages = getPersistenceContext().getValue(PAGES, _pages); } /** * <i>Generated method</i> - Getter of the <code>CMSNavigationNode.parent</code> attribute defined at extension <code>cms2</code>. * @return the parent */ public CMSNavigationNodeModel getParent() { if (this._parent!=null) { return _parent; } return _parent = getPersistenceContext().getValue(PARENT, _parent); } /** * <i>Generated method</i> - Getter of the <code>CMSNavigationNode.title</code> attribute defined at extension <code>cms2</code>. * @return the title */ public String getTitle() { return getTitle(null); } /** * <i>Generated method</i> - Getter of the <code>CMSNavigationNode.title</code> attribute defined at extension <code>cms2</code>. * @param loc the value localization key * @return the title * @throws IllegalArgumentException if localization key cannot be mapped to data language */ public String getTitle(final Locale loc) { return getPersistenceContext().getLocalizedValue(TITLE, loc); } /** * <i>Generated method</i> - Getter of the <code>CMSNavigationNode.visible</code> attribute defined at extension <code>cms2</code>. * @return the visible */ public boolean isVisible() { return toPrimitive( _visible = getPersistenceContext().getValue(VISIBLE, _visible)); } /** * <i>Generated method</i> - Setter of <code>CMSNavigationNode.children</code> attribute defined at extension <code>cms2</code>. * * @param value the children */ public void setChildren(final List<CMSNavigationNodeModel> value) { _children = getPersistenceContext().setValue(CHILDREN, value); } /** * <i>Generated method</i> - Setter of <code>CMSNavigationNode.entries</code> attribute defined at extension <code>cms2</code>. * * @param value the entries */ public void setEntries(final List<CMSNavigationEntryModel> value) { _entries = getPersistenceContext().setValue(ENTRIES, value); } /** * <i>Generated method</i> - Setter of <code>CMSNavigationNode.links</code> attribute defined at extension <code>cms2</code>. * * @param value the links */ @Deprecated public void setLinks(final List<CMSLinkComponentModel> value) { _links = getPersistenceContext().setValue(LINKS, value); } /** * <i>Generated method</i> - Setter of <code>CMSNavigationNode.pages</code> attribute defined at extension <code>cms2</code>. * * @param value the pages */ @Deprecated public void setPages(final List<ContentPageModel> value) { _pages = getPersistenceContext().setValue(PAGES, value); } /** * <i>Generated method</i> - Setter of <code>CMSNavigationNode.parent</code> attribute defined at extension <code>cms2</code>. * * @param value the parent */ public void setParent(final CMSNavigationNodeModel value) { _parent = getPersistenceContext().setValue(PARENT, value); } /** * <i>Generated method</i> - Setter of <code>CMSNavigationNode.title</code> attribute defined at extension <code>cms2</code>. * * @param value the title */ public void setTitle(final String value) { setTitle(value,null); } /** * <i>Generated method</i> - Setter of <code>CMSNavigationNode.title</code> attribute defined at extension <code>cms2</code>. * * @param value the title * @param loc the value localization key * @throws IllegalArgumentException if localization key cannot be mapped to data language */ public void setTitle(final String value, final Locale loc) { getPersistenceContext().setLocalizedValue(TITLE, loc, value); } /** * <i>Generated method</i> - Setter of <code>CMSNavigationNode.visible</code> attribute defined at extension <code>cms2</code>. * * @param value the visible */ public void setVisible(final boolean value) { _visible = getPersistenceContext().setValue(VISIBLE, toObject(value)); } }
[ "yanagisawa@gotandadenshi.jp" ]
yanagisawa@gotandadenshi.jp
e8665847512b740fb701e0449c6c2f61148f39f4
27f60e6e9b98f8466256afdd9063c193cfa1c2ee
/spring-data-jpa-tutorial-model/src/main/java/com/bobocode/model/Role.java
8f052ba8044ebcd2345d4c5a5e43b78cb20f2bc6
[]
no_license
bobocode-projects/spring-data-jpa-tutorial
23ffad8f65ccab9fc4b750973bc81a5132aa2ec9
325eca1d3769f77465fe837b8d7169e03e36f9db
refs/heads/master
2020-03-30T16:07:11.939064
2018-12-13T05:42:19
2018-12-13T05:42:19
151,393,865
2
4
null
null
null
null
UTF-8
Java
false
false
1,111
java
package com.bobocode.model; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import lombok.ToString; import javax.persistence.*; import java.time.LocalDateTime; import java.util.Objects; @NoArgsConstructor @Getter @Setter @ToString(exclude = "user") @Entity @Table(name = "role") public class Role { @Id @GeneratedValue private Long id; @Enumerated(EnumType.STRING) @Column(name = "role_type") private RoleType roleType; @Column(name = "creation_date") private LocalDateTime creationDate = LocalDateTime.now(); @ManyToOne @JoinColumn(name = "user_id") private User user; public static Role valueOf(RoleType roleType) { return new Role(roleType); } private Role(RoleType roleType) { this.roleType = roleType; } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Role)) return false; Role role = (Role) o; return Objects.equals(id, role.id); } @Override public int hashCode() { return 31; } }
[ "tarass.boychuk@gmail.com" ]
tarass.boychuk@gmail.com
335492bfdba62e2866263d483b14782d38a0a283
7f4b48055c16e43e8d3c37772157509098899e2b
/course/src/com/course/dao/StuDao.java
3f31e02232b2f00eea0f7c6e58d73a0d27b85270
[]
no_license
yu123105/demos
088f8fe0509b7cbb5e93cb1433084c66d1ffee71
4f8f4abfeacc5cf802903d5c76a1b93dc18560aa
refs/heads/master
2020-06-09T01:23:45.360641
2013-11-20T11:53:47
2013-11-20T11:53:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
257
java
package com.course.dao; import java.util.List; import com.course.model.Student; public interface StuDao { boolean save(Student stu); List<Student> getAllStudents(); List<Student> getStudents(int pageNo, int pAGE_SIZE); boolean delete(int id); }
[ "zhangxf05@163.com" ]
zhangxf05@163.com
5f3217bd483f069a100881b9c118594d75fe92cd
05fc981c4cb53d04c8a3dad126169163cf7c04c0
/src/main/java/uk/co/raytheon/PicTestWebServerApplication.java
5098866a5df52764277e242a1b434efe4b243018
[]
no_license
AidanJones/httpsTestWebServer
8c43baddf04ec4d0308d16ffb087eb3ff2794139
63d58b6d44452ca6ca2d5b598a28c9b418860c74
refs/heads/master
2021-01-13T13:46:41.479335
2017-01-17T15:54:31
2017-01-17T15:54:31
79,242,304
0
0
null
null
null
null
UTF-8
Java
false
false
834
java
package uk.co.raytheon; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import uk.co.raytheon.storage.StorageProperties; import uk.co.raytheon.storage.StorageService; @SpringBootApplication @EnableConfigurationProperties(StorageProperties.class) public class PicTestWebServerApplication { public static void main(String[] args) { SpringApplication.run(PicTestWebServerApplication.class, args); } @Bean CommandLineRunner init(StorageService storageService) { return (args) -> { storageService.deleteAll(); storageService.init(); }; } }
[ "aidanjones@gmail.com" ]
aidanjones@gmail.com
d66501893c5133572108402ff95321b12281da5e
bb136cedb6c3722df9ae2f3bcb4c5a01318e56f9
/app/src/main/java/br/com/blockcells/blockcells/modelo/Mensagem.java
d404873545ce5235387bfd1bb51a3b25d436caa6
[]
no_license
anderllr/blockcells_android
cf3d58da0ae1071cce8dc74025f9e3a4ce5af107
8f60f96ad4b8b4d38f3310afe9ead4737e649276
refs/heads/master
2021-09-10T13:28:52.113529
2018-03-26T23:56:10
2018-03-26T23:56:10
120,015,175
0
0
null
null
null
null
UTF-8
Java
false
false
761
java
package br.com.blockcells.blockcells.modelo; import java.io.Serializable; /** * Created by anderson on 18/11/16. */ public class Mensagem implements Serializable { private String msg; private String msg_vip; private boolean msgcomlocalizacao; public String getMsg() { return msg; } public void setMsg(String descmensagem) { this.msg = descmensagem; } public String getMsg_vip() { return msg_vip; } public void setMsg_vip(String msg_vip) { this.msg_vip = msg_vip; } public boolean isMsgcomlocalizacao() { return msgcomlocalizacao; } public void setMsgcomlocalizacao(boolean msgcomlocalizacao) { this.msgcomlocalizacao = msgcomlocalizacao; } }
[ "anderllr@gmail.com" ]
anderllr@gmail.com
1a567722b50af0cdf72980927437bf34452a274d
32b1b6f07ff3b8a3b70c32ac8512258b7cdc95d2
/FirstJava/src/day0424/example5/MainActor.java
205094738e36a82e84e3f4891ea992a364782eb4
[]
no_license
bokyoung89/JavaFramework
90a027b7dc48de9e14048be529adface5d9d807e
078af5e05fff90cdfb5c00aa916375c9c40a2e2e
refs/heads/master
2022-08-13T19:10:43.694158
2020-05-20T00:24:10
2020-05-20T00:24:10
258,055,807
0
0
null
null
null
null
UTF-8
Java
false
false
384
java
package day0424.example5; public class MainActor { public static void main(String[] args) { //배우 정보 String actorName = "해리슨 포드"; String actorGender = "남자"; String actorBirthdate = "1942.07.13"; String actorNationality = "미국"; Actor actor = new Actor(actorName, actorGender, actorBirthdate,actorNationality); actor.printInfo(); } }
[ "sbk8689@gmail.com" ]
sbk8689@gmail.com
a34505723a6c74b4466f1d46d38792ab15a0bd6a
9af5abe79a9d2d38b2d6d34c4d821a07935e3339
/src/main/java/com/phonemetra/turbo/internal/binary/BinaryReaderHandles.java
0eb093004e1ce66836c06832008792c76f036a3a
[ "Apache-2.0" ]
permissive
Global-localhost/TurboSQL
a66b70a8fdb4cd67642dda0dad132986f2b9165c
10dd81a36a0e25b1f786e366eb3ed9af0e5e325b
refs/heads/master
2022-12-17T05:48:16.652086
2019-04-16T23:02:00
2019-04-16T23:02:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,883
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.phonemetra.turbo.internal.binary; import org.jetbrains.annotations.Nullable; import java.util.HashMap; import java.util.Map; /** * Reader handles. */ public class BinaryReaderHandles { /** Mode: empty. */ private static final int MODE_EMPTY = 0; /** Mode: single object. */ private static final int MODE_SINGLE = 1; /** Mode: multiple objects. */ private static final int MODE_MULTIPLE = 2; /** Position. */ private int singlePos; /** Data. This is either an object or a map. */ private Object data; /** Mode. */ private int mode = MODE_EMPTY; /** * Get object by position. * * @param pos Position. * @return Object. */ @Nullable public <T> T get(int pos) { switch (mode) { case MODE_EMPTY: return null; case MODE_SINGLE: return pos == singlePos ? (T)data : null; default: assert mode == MODE_MULTIPLE; return (T)((Map<Integer, Object>)data).get(pos); } } /** * Put object to registry and return previous position (if any). * * @param pos Position. * @param obj Object. */ @SuppressWarnings("unchecked") public void put(int pos, Object obj) { assert pos >= 0; assert obj != null; switch (mode) { case MODE_EMPTY: this.singlePos = pos; this.data = obj; this.mode = MODE_SINGLE; break; case MODE_SINGLE: Map<Integer, Object> newData = new HashMap(3, 1.0f); newData.put(singlePos, data); newData.put(pos, obj); this.singlePos = -1; this.data = newData; this.mode = MODE_MULTIPLE; break; default: assert mode == MODE_MULTIPLE; Map<Integer, Object> data0 = (Map<Integer, Object>)data; data0.put(pos, obj); } } }
[ "devteam@phonemetra.com" ]
devteam@phonemetra.com
92e1f922ba246d3e269e22ae9335c3d0bcb2195b
18f1710497f7f61d16125548e6e9ee0bee304eb3
/libraryapp-boot/src/main/java/org/dxctraining/author/services/AuthorServiceImpl.java
8f6cd2d70113c53e4677898d6220c2ae3d9026ec
[]
no_license
nehamolakallapalli/java
5481ffa5078e82ee7b988acc20533cba5bc8844e
1bad2d2ea9ef82a3450d24e196eacd2ea301329f
refs/heads/master
2022-12-01T16:23:32.412597
2020-08-17T18:48:37
2020-08-17T18:48:37
285,633,953
0
0
null
null
null
null
UTF-8
Java
false
false
1,377
java
package org.dxctraining.author.services; import org.dxctraining.author.dao.IAuthorDao; import org.dxctraining.author.entities.Author; import org.dxctraining.author.exceptions.InvalidArgumentException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.transaction.Transactional; @Transactional @Service public class AuthorServiceImpl implements IAuthorService { @Autowired private IAuthorDao authorDao; @Override public Author findAuthorID(String id) { validateID(id); Author author=authorDao.findAuthorID(id); return author; } public void validateID(String id) { if(id==null || id.isEmpty()) { throw new InvalidArgumentException("ID can't be null"); } } @Override public void addAuthor(Author author) { authorDao.addAuthor(author); } @Override public Author updateName(Author author, String name) { ValidateName(name); authorDao.updateName(author,name); return author; } private void ValidateName(String name) { if (name==null|| name.isEmpty()) { throw new InvalidArgumentException("NAME CANT BE NULL"); } } @Override public void removeAuthor(String id) { authorDao.removeAuthor(id); } }
[ "nehamolakallapalli@gmail.com" ]
nehamolakallapalli@gmail.com
2ab2ab76f5b29fd641f78207a9fe2dca13acc030
f76d141d6c0aed105adeaf942546dacf53e2fc2c
/app/src/main/java/com/revo/aesrsa/resrsa/AES.java
78c18be40004f0bcfd7a7d686a1698b627db9dd0
[]
no_license
BASS-HY/androidRsaAES
66994bf665fa8345c5fead4d4002171b1168308e
30014939e9130afa5cc8aa183614da566e5be367
refs/heads/master
2022-12-02T18:17:46.348669
2020-08-14T09:26:09
2020-08-14T09:26:09
419,981,374
1
0
null
null
null
null
UTF-8
Java
false
false
8,441
java
package com.revo.aesrsa.resrsa; import java.io.UnsupportedEncodingException; import java.security.Key; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import javax.crypto.Cipher; import javax.crypto.KeyGenerator; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; /** * Description: * * @author: stvelzhang * @date: 2020/7/21 15:12 */ public class AES { /** * 加密 * * @param data 需要加密的内容 * @param key 加密密码 * @return */ public static byte[] encrypt(byte[] data, byte[] key) { CheckUtils.notEmpty(data, "data"); CheckUtils.notEmpty(key, "key"); if (key.length != 16) { throw new RuntimeException("Invalid AES key length (must be 16 bytes)"); } try { SecretKeySpec secretKey = new SecretKeySpec(key, "AES"); byte[] enCodeFormat = secretKey.getEncoded(); SecretKeySpec seckey = new SecretKeySpec(enCodeFormat, "AES"); Cipher cipher = Cipher.getInstance(ConfigureEncryptAndDecrypt.AES_ALGORITHM);// 创建密码器 IvParameterSpec iv = new IvParameterSpec(key);//使用CBC模式,需要一个向量iv,可增加加密算法的强度 cipher.init(Cipher.ENCRYPT_MODE, seckey, iv);// 初始化 byte[] result = cipher.doFinal(data); return result; // 加密 } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("encrypt fail!", e); } } public static byte[] encrypt(byte[] data, byte[] key,byte[] ivparm) { CheckUtils.notEmpty(data, "data"); CheckUtils.notEmpty(ivparm, "key"); if (key.length != 16) { throw new RuntimeException("Invalid AES key length (must be 16 bytes)"); } if (ivparm.length != 16) { throw new RuntimeException("Invalid AES key length (must be 16 bytes)"); } try { SecretKeySpec secretKey = new SecretKeySpec(key, "AES"); byte[] enCodeFormat = secretKey.getEncoded(); SecretKeySpec seckey = new SecretKeySpec(enCodeFormat, "AES"); Cipher cipher = Cipher.getInstance(ConfigureEncryptAndDecrypt.AES_ALGORITHM);// 创建密码器 IvParameterSpec iv = new IvParameterSpec(ivparm);//使用CBC模式,需要一个向量iv,可增加加密算法的强度 cipher.init(Cipher.ENCRYPT_MODE, seckey, iv);// 初始化 byte[] result = cipher.doFinal(data); return result; // 加密 } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("encrypt fail!", e); } } /** * 解密 * * @param data 待解密内容 * @param key 解密密钥 * @return */ public static byte[] decrypt(byte[] data, byte[] key,byte[] ivparm) { CheckUtils.notEmpty(data, "data"); CheckUtils.notEmpty(key, "key"); if (key.length != 16) { throw new RuntimeException("Invalid AES key length (must be 16 bytes)"); } if (ivparm.length != 16) { throw new RuntimeException("Invalid AES key length (must be 16 bytes)"); } try { SecretKeySpec secretKey = new SecretKeySpec(key, "AES"); byte[] enCodeFormat = secretKey.getEncoded(); SecretKeySpec seckey = new SecretKeySpec(enCodeFormat, "AES"); Cipher cipher = Cipher.getInstance(ConfigureEncryptAndDecrypt.AES_ALGORITHM);// 创建密码器 IvParameterSpec iv = new IvParameterSpec(ivparm);//使用CBC模式,需要一个向量iv,可增加加密算法的强度 cipher.init(Cipher.DECRYPT_MODE, seckey, iv);// 初始化 byte[] result = cipher.doFinal(data); return result; // 解密 } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("decrypt fail!", e); } } public static byte[] decrypt(byte[] data, byte[] key) { CheckUtils.notEmpty(data, "data"); CheckUtils.notEmpty(key, "key"); if (key.length != 16) { throw new RuntimeException("Invalid AES key length (must be 16 bytes)"); } try { SecretKeySpec secretKey = new SecretKeySpec(key, "AES"); byte[] enCodeFormat = secretKey.getEncoded(); SecretKeySpec seckey = new SecretKeySpec(enCodeFormat, "AES"); Cipher cipher = Cipher.getInstance(ConfigureEncryptAndDecrypt.AES_ALGORITHM);// 创建密码器 IvParameterSpec iv = new IvParameterSpec(key);//使用CBC模式,需要一个向量iv,可增加加密算法的强度 cipher.init(Cipher.DECRYPT_MODE, seckey, iv);// 初始化 byte[] result = cipher.doFinal(data); return result; // 解密 } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("decrypt fail!", e); } } public static String encryptToBase64(String data, String key) { try { byte[] valueByte = encrypt(data.getBytes(ConfigureEncryptAndDecrypt.CHAR_ENCODING), key.getBytes(ConfigureEncryptAndDecrypt.CHAR_ENCODING)); return new String(Base64.encode(valueByte)); } catch (UnsupportedEncodingException e) { throw new RuntimeException("encrypt fail!", e); } } public static String encryptToBase64(String data, String key,String iv) { try { byte[] valueByte = encrypt(data.getBytes(ConfigureEncryptAndDecrypt.CHAR_ENCODING), key.getBytes(ConfigureEncryptAndDecrypt.CHAR_ENCODING), iv.getBytes(ConfigureEncryptAndDecrypt.CHAR_ENCODING)); return new String(Base64.encode(valueByte)); } catch (UnsupportedEncodingException e) { throw new RuntimeException("encrypt fail!", e); } } public static String decryptFromBase64(String data, String key) { try { byte[] originalData = Base64.decode(data.getBytes()); byte[] valueByte = decrypt(originalData, key.getBytes(ConfigureEncryptAndDecrypt.CHAR_ENCODING)); return new String(valueByte, ConfigureEncryptAndDecrypt.CHAR_ENCODING); } catch (UnsupportedEncodingException e) { throw new RuntimeException("decrypt fail!", e); } } public static String decryptFromBase64(String data, String key,String iv) { try { byte[] originalData = Base64.decode(data.getBytes()); byte[] valueByte = decrypt(originalData, key.getBytes(ConfigureEncryptAndDecrypt.CHAR_ENCODING),iv.getBytes(ConfigureEncryptAndDecrypt.CHAR_ENCODING)); return new String(valueByte, ConfigureEncryptAndDecrypt.CHAR_ENCODING); } catch (UnsupportedEncodingException e) { throw new RuntimeException("decrypt fail!", e); } } public static String encryptWithKeyBase64(String data, String key) { try { byte[] valueByte = encrypt(data.getBytes(ConfigureEncryptAndDecrypt.CHAR_ENCODING), Base64.decode(key.getBytes())); return new String(Base64.encode(valueByte)); } catch (UnsupportedEncodingException e) { throw new RuntimeException("encrypt fail!", e); } } public static String decryptWithKeyBase64(String data, String key) { try { byte[] originalData = Base64.decode(data.getBytes()); byte[] valueByte = decrypt(originalData, Base64.decode(key.getBytes())); return new String(valueByte, ConfigureEncryptAndDecrypt.CHAR_ENCODING); } catch (UnsupportedEncodingException e) { throw new RuntimeException("decrypt fail!", e); } } public static byte[] genarateRandomKey() { KeyGenerator keygen = null; try { keygen = KeyGenerator.getInstance(ConfigureEncryptAndDecrypt.AES_ALGORITHM); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(" genarateRandomKey fail!", e); } SecureRandom random = new SecureRandom(); keygen.init(random); Key key = keygen.generateKey(); return key.getEncoded(); } public static String genarateRandomKeyWithBase64() { return new String(Base64.encode(genarateRandomKey())); } }
[ "zhangsanxi@revoview.com" ]
zhangsanxi@revoview.com
fd72c0be8c2ae12db878618089255482f8e704f8
51264860a1b39d0b07526858610d6e1f6214692e
/app/src/main/java/com/emrebisgun/mydictionary/TranslateActivity.java
f41c937133b3b4133015c674f14f58fbf7c15b03
[]
no_license
emrebsgn/MyDictionary
865b936fd62da86499300d5243fc45b93167f55a
9507fae0370aa21b3af9ac2ca36b84730df8cae7
refs/heads/master
2023-06-12T09:13:14.563853
2021-06-29T20:27:49
2021-06-29T20:27:49
381,465,517
0
0
null
null
null
null
UTF-8
Java
false
false
3,548
java
package com.emrebisgun.mydictionary; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.parse.FindCallback; import com.parse.ParseException; import com.parse.ParseObject; import com.parse.ParseQuery; import java.util.List; public class TranslateActivity extends AppCompatActivity { EditText editTextTurkish; EditText editTextEnglish; Button btnTranslate; Button btnTransClear; //TextView resultText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_translate); editTextTurkish=findViewById(R.id.editTextTurk); editTextEnglish=findViewById(R.id.editTextEng); btnTranslate=findViewById(R.id.btnTranslate); btnTransClear=findViewById(R.id.btnTransClear); //resultText=findViewById(R.id.resultText); } public void clickTranslate(View view){ ParseQuery<ParseObject> query=ParseQuery.getQuery("Words"); if(editTextEnglish.getText().toString().matches("")){ query.whereEqualTo("turkish",editTextTurkish.getText().toString()); query.findInBackground(new FindCallback<ParseObject>() { @Override public void done(List<ParseObject> objects, ParseException e) { if(e!=null){ Toast.makeText(TranslateActivity.this, e.getLocalizedMessage(), Toast.LENGTH_SHORT).show(); }else{ if(objects.size()>0){ for(ParseObject object:objects){ String objectEnglish=object.getString("english"); //resultText.setText(objectEnglish); editTextEnglish.setText(objectEnglish); Toast.makeText(getApplicationContext(), "Çevrildi", Toast.LENGTH_SHORT).show(); editTextTurkish.setText(""); } } } } }); } if(editTextTurkish.getText().toString().matches("")){ query.whereEqualTo("english",editTextEnglish.getText().toString()); query.findInBackground(new FindCallback<ParseObject>() { @Override public void done(List<ParseObject> objects, ParseException e) { if(e!=null){ Toast.makeText(TranslateActivity.this, e.getLocalizedMessage(), Toast.LENGTH_SHORT).show(); }else{ if(objects.size()>0){ for(ParseObject object:objects){ String objectTurkish=object.getString("turkish"); //resultText.setText(objectTurkish); editTextTurkish.setText(objectTurkish); Toast.makeText(getApplicationContext(), "Çevrildi", Toast.LENGTH_SHORT).show(); editTextEnglish.setText(""); } } } } }); } } public void clickTransClear(View view){ editTextTurkish.setText(""); editTextEnglish.setText(""); } }
[ "emrebsgn1@hotmail.com" ]
emrebsgn1@hotmail.com
a6f4802c4e1503c243fc39f50f552a37a995e452
2a4d9d10aa00ca2637bd2fe0eecd6c9807b7726c
/src/patterns/producer/consumer/PCProblemWithoutlockingQueue.java
ef1d0917b1242ed6d483cb5f6bc47453755bcef9
[]
no_license
BudaiKinga/concurrency_patterns
fdb259bf52c9c387ef7eb7eec41e3d49d6158c5e
1e8f14eb3f9e97e3a865622a174455d01895db0e
refs/heads/master
2023-04-30T13:36:04.435425
2021-04-18T08:37:09
2021-04-18T08:37:09
359,086,324
0
0
null
null
null
null
UTF-8
Java
false
false
1,769
java
package patterns.producer.consumer; /** * Created by BudaiK on Nov, 2020. */ public class PCProblemWithoutlockingQueue { public static void main(String[] args) { exampleOnObjectsAndWait(); // exampleOnLocksAndConditions(); } private static void exampleOnLocksAndConditions() { MyBlockingQueueUsingLocksAndConditions<MyMessage> queue = new MyBlockingQueueUsingLocksAndConditions<>(10); Runnable prod = () -> { while (true) { MyMessage msg = new MyMessage(); queue.add(msg); System.out.println("Added msg " + msg.getInstance() + " by " + Thread.currentThread().getId()); } }; Runnable cons = () -> { while (true) { MyMessage msg = queue.take(); System.out.println("Took msg " + msg.getInstance() + " by " + Thread.currentThread().getId()); } }; new Thread(prod).start(); new Thread(cons).start(); } private static void exampleOnObjectsAndWait() { MyBlockingQueueUsingWaitNotify<MyMessage> queue = new MyBlockingQueueUsingWaitNotify<>(10); Runnable prod = () -> { while (true) { MyMessage msg = new MyMessage(); queue.add(msg); System.out.println("Added msg " + msg.getInstance() + " by " + Thread.currentThread().getId()); } }; Runnable cons = () -> { while (true) { MyMessage msg = queue.take(); System.out.println("Took msg " + msg.getInstance() + " by " + Thread.currentThread().getId()); } }; new Thread(prod).start(); new Thread(cons).start(); } }
[ "kinga.budai@qiagen.com" ]
kinga.budai@qiagen.com
5eb8855a65acf50c6d47b122a486771f46f1dfe6
bae2580ceac6735dc66cdaa3cfa76ed27ff11319
/src/main/java/ee/ioc/cs/vsle/util/syntax/Token.java
5c4ce098f7f60ea46a77f28905f04eae9c040716
[ "Apache-2.0" ]
permissive
shamjithkv/CoCoViLa
34e66779afcddf7bc11d32b3ed9a7b82609a4398
bd66e824b5e3c0bb1a3fd159603aa3b723fcb808
refs/heads/master
2021-06-28T17:33:19.985677
2017-09-19T18:30:47
2017-09-19T18:30:47
106,534,623
1
0
null
2017-10-11T09:36:42
2017-10-11T09:36:42
null
UTF-8
Java
false
false
4,387
java
/* * This file is part of a syntax highlighting package * Copyright (C) 1999, 2000 Stephen Ostermiller * http://ostermiller.org/contact.pl?regarding=Syntax+Highlighting * * 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. * * See COPYING.TXT for details. */ package ee.ioc.cs.vsle.util.syntax; /** * A generic token class. */ public abstract class Token{ /** * A unique ID for this type of token. * Typically, ID numbers for each type will * be static variables of the Token class. * * @return an ID for this type of token. */ public abstract int getID(); /** * A description of this token. The description should * be appropriate for syntax highlighting. For example * "comment" might be returned for a comment. This should * make it easy to do html syntax highlighting. Just use * style sheets to define classes with the same name as * the description and write the token in the html file * with that css class name. * * @return a description of this token. */ public abstract String getDescription(); /** * The actual meat of the token. * * @return a string representing the text of the token. */ public abstract String getContents(); /** * Determine if this token is a comment. Sometimes comments should be * ignored (compiling code) other times they should be used * (syntax highlighting). This provides a method to check * in case you feel you should ignore comments. * * @return true if this token represents a comment. */ public abstract boolean isComment(); /** * Determine if this token is whitespace. Sometimes whitespace should be * ignored (compiling code) other times they should be used * (code beautification). This provides a method to check * in case you feel you should ignore whitespace. * * @return true if this token represents whitespace. */ public abstract boolean isWhiteSpace(); /** * Determine if this token is an error. Lets face it, not all code * conforms to spec. The lexer might know about an error * if a string literal is not closed, for example. * * @return true if this token is an error. */ public abstract boolean isError(); /** * get the line number of the input on which this token started * * @return the line number of the input on which this token started */ public abstract int getLineNumber(); /** * get the offset into the input in characters at which this token started * * @return the offset into the input in characters at which this token started */ public abstract int getCharBegin(); /** * get the offset into the input in characters at which this token ended * * @return the offset into the input in characters at which this token ended */ public abstract int getCharEnd(); /** * get a String that explains the error, if this token is an error. * * @return a String that explains the error, if this token is an error, null otherwise. */ public abstract String errorString(); /** * The state of the tokenizer is undefined. */ public static final int UNDEFINED_STATE = -1; /** * The initial state of the tokenizer. * Anytime the tokenizer returns to this state, * the tokenizer could be restarted from that point * with side effects. */ public static final int INITIAL_STATE = 0; /** * Get an integer representing the state the tokenizer is in after * returning this token. * Those who are interested in incremental tokenizing for performance * reasons will want to use this method to figure out where the tokenizer * may be restarted. The tokenizer starts in Token.INITIAL_STATE, so * any time that it reports that it has returned to this state, the * tokenizer may be restarted from there. */ public abstract int getState(); }
[ "pavelg@cs.ioc.ee" ]
pavelg@cs.ioc.ee
0e6e97882e20b8ea80f02bd2a834c5d6b6c706d4
297cb5ca9ea81a73d77c8205978b85e7306bca80
/app/src/main/java/app/app1uppro/baseui/BaseFragment.java
d491f90c00b153510d06c69a9845125d91741858
[]
no_license
Nitin0901/1UpPro
7189a78a935d340d85d3efb60712b95e73b10bf5
73f1f3211ac837d001a23f45476f8e12896da4fe
refs/heads/master
2020-04-04T13:15:10.686166
2018-11-03T06:35:44
2018-11-03T06:35:44
155,954,554
0
0
null
null
null
null
UTF-8
Java
false
false
3,678
java
package app.app1uppro.baseui; import android.app.ProgressDialog; import android.content.Context; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.annotation.StringRes; import android.support.v4.app.Fragment; import android.support.v4.widget.SwipeRefreshLayout; import android.view.View; import app.app1uppro.common.CommonUtils; import app.app1uppro.di.component.ActivityComponent; import butterknife.Unbinder; public abstract class BaseFragment extends Fragment implements MvpView { private BaseActivity mActivity; private Unbinder mUnBinder; private ProgressDialog mProgressDialog; private SwipeRefreshLayout swipeRefreshLayout; @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(false); } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); setUp(view); } @Override public void onAttach(Context context) { super.onAttach(context); if (context instanceof BaseActivity) { BaseActivity activity = (BaseActivity) context; this.mActivity = activity; activity.onFragmentAttached(); } } @Override public void showLoading() { hideLoading(); mProgressDialog = CommonUtils.initProgressDialog(getActivity()); } @Override public void hideLoading() { if (mProgressDialog != null && mProgressDialog.isShowing()) { mProgressDialog.cancel(); } } @Override public void onError(String message) { if (mActivity != null) { mActivity.onError(message); } } @Override public void onError(@StringRes int resId) { if (mActivity != null) { mActivity.onError(resId); } } @Override public void showMessage(String message) { if (mActivity != null) { mActivity.showMessage(message); } } @Override public void showCustomMessage(String message) { if(mActivity!=null) { mActivity.showCustomMessage(message); } } @Override public void showMessage(@StringRes int resId) { if (mActivity != null) { mActivity.showMessage(resId); } } @Override public boolean isNetworkConnected() { if (mActivity != null) { return mActivity.isNetworkConnected(); } return false; } @Override public void onDetach() { mActivity = null; super.onDetach(); } @Override public void hideKeyboard() { if (mActivity != null) { mActivity.hideKeyboard(); } } @Override public void openActivityOnTokenExpire() { if (mActivity != null) { mActivity.openActivityOnTokenExpire(); } } public ActivityComponent getActivityComponent() { if (mActivity != null) { return mActivity.getActivityComponent(); } return null; } public BaseActivity getBaseActivity() { return mActivity; } public void setUnBinder(Unbinder unBinder) { mUnBinder = unBinder; } protected abstract void setUp(View view); @Override public void onDestroy() { if (mUnBinder != null) { mUnBinder.unbind(); } super.onDestroy(); } public interface BaseCallback { void onFragmentAttached(); void onFragmentDetached(String tag); } }
[ "sfs.nitin18@gmail.com" ]
sfs.nitin18@gmail.com
ce9c6fd9ca8b1a08664ce683981545a0a81af24b
95a251503d218096ada4cc720c67a55757590fee
/movie-catalogue-service/src/main/java/com/springboot1/moviecatalogueservice/model/CatalogItem.java
7e77c4fdddb024915ca6e9f8f5d4c6c46a9064fd
[]
no_license
hanmantmca/SpringBootV2_Fault
afd2d316d01c2d7bc4c6d336735f8531b6bb590a
7a6383930b9986ed8a8d3243e7f20c1999e77153
refs/heads/master
2023-08-14T22:21:50.391023
2021-09-18T07:44:17
2021-09-18T07:44:17
407,449,743
0
0
null
null
null
null
UTF-8
Java
false
false
627
java
package com.springboot1.moviecatalogueservice.model; public class CatalogItem { private String name; private String desc; private int rating; public CatalogItem(String name, String desc, int rating) { super(); this.name = name; this.desc = desc; this.rating = rating; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } public int getRating() { return rating; } public void setRating(int rating) { this.rating = rating; } }
[ "hanmantmca@gmail.com" ]
hanmantmca@gmail.com
e7c2880be3cc2d8658c09830060c419ea43c0b48
9f302a15e14ecf1f404b3cb6519b1ca3fb7d2003
/call it/src/com/ul/taxi/db/dbconnection.java
7ec06d8c18fce7cc95a0aa3a68c6896c65d18930
[]
no_license
Jiqingliu/taxi
8e5e261b5575f1e0b42b2b9e507a04a74bcfcfbc
bd9392407a92abfbbc1b78adfa300c0414b30fa3
refs/heads/master
2021-01-12T15:50:15.303617
2016-11-22T14:20:40
2016-11-22T14:20:40
71,882,270
0
0
null
null
null
null
UTF-8
Java
false
false
743
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.ul.taxi.db; import java.sql.*; /** * * @author SONY */ public class dbconnection { private static Connection connection = null; public static Connection createConnection() throws ClassNotFoundException, SQLException { Class.forName("com.mysql.jdbc.Driver"); connection =DriverManager.getConnection("jdbc:mysql://localhost:3306/taxitest","root","molly"); System.out.println("connection: "+connection); return connection; } }
[ "573175162@qq.com" ]
573175162@qq.com
582bceb7df5c7b1b05f6ab0781685a68f50d40fc
63f579466b611ead556cb7a257d846fc88d582ed
/XDRValidator/src/main/java/generated/ADXP.java
a420c981531bc30521efbb9cde27c13bd672abec
[]
no_license
svalluripalli/soap
14f47b711d63d4890de22a9f915aed1bef755e0b
37d7ea683d610ab05477a1fdb4e329b5feb05381
refs/heads/master
2021-01-18T20:42:09.095152
2014-05-07T21:16:36
2014-05-07T21:16:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,395
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-2 // 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: 2014.05.07 at 05:07:17 PM EDT // package generated; 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.XmlAttribute; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlType; /** * * A character string that may have a type-tag signifying its * role in the address. Typical parts that exist in about * every address are street, house number, or post box, * postal code, city, country but other roles may be defined * regionally, nationally, or on an enterprise level (e.g. in * military addresses). Addresses are usually broken up into * lines, which are indicated by special line-breaking * delimiter elements (e.g., DEL). * * * <p>Java class for ADXP complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="ADXP"> * &lt;complexContent> * &lt;extension base="{}ST"> * &lt;attribute name="partType" type="{}AddressPartType" /> * &lt;/extension> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ADXP") @XmlSeeAlso({ AdxpDeliveryInstallationType.class, AdxpPrecinct.class, AdxpUnitID.class, AdxpCensusTract.class, AdxpDeliveryAddressLine.class, AdxpPostBox.class, AdxpDeliveryInstallationArea.class, AdxpDeliveryMode.class, AdxpHouseNumber.class, AdxpStreetNameType.class, AdxpDirection.class, AdxpPostalCode.class, AdxpStreetNameBase.class, AdxpDeliveryInstallationQualifier.class, AdxpBuildingNumberSuffix.class, AdxpCity.class, AdxpState.class, AdxpDelimiter.class, AdxpStreetAddressLine.class, AdxpUnitType.class, AdxpCountry.class, AdxpHouseNumberNumeric.class, AdxpCareOf.class, AdxpCounty.class, AdxpDeliveryModeIdentifier.class, AdxpStreetName.class, AdxpAdditionalLocator.class }) public class ADXP extends ST { @XmlAttribute(name = "partType") protected List<String> partType; /** * Gets the value of the partType 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 partType property. * * <p> * For example, to add a new item, do as follows: * <pre> * getPartType().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link String } * * */ public List<String> getPartType() { if (partType == null) { partType = new ArrayList<String>(); } return this.partType; } }
[ "konkapv@NCI-01874632-L.nci.nih.gov" ]
konkapv@NCI-01874632-L.nci.nih.gov
17dbcc94196ea9ef16d6137419e17eb3c1abd3a4
3a10d0322214d83b0ad38fe5a914f6f62d7e8672
/src/org/sablecc/sablecc/syntax3/lexer/node/TLeftKeyword.java
a84bd0074c0a2fb1611e3c8e1728c262fa620b64
[]
no_license
johnny-bui/sccnb4
0ac4e403f9c27bedfa05094a99dbddd23d5d16e0
4135c91fadd00ef5f8ed34ce246db021cfdd1a75
refs/heads/master
2016-09-05T22:30:11.873036
2012-07-08T12:25:52
2012-07-08T12:25:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
810
java
/* This file was generated by SableCC (http://www.sablecc.org/). */ package org.sablecc.sablecc.syntax3.lexer.node; import org.sablecc.sablecc.syntax3.lexer.analysis.*; @SuppressWarnings("nls") public final class TLeftKeyword extends Token { public TLeftKeyword() { super.setText("Left"); } public TLeftKeyword(int line, int pos) { super.setText("Left"); setLine(line); setPos(pos); } @Override public Object clone() { return new TLeftKeyword(getLine(), getPos()); } public void apply(Switch sw) { ((Analysis) sw).caseTLeftKeyword(this); } @Override public void setText(@SuppressWarnings("unused") String text) { throw new RuntimeException("Cannot change TLeftKeyword text."); } }
[ "" ]
2bc678488fb4540ca8bba88cbae773823f3a7640
a920e5724d56843ebd7afa06ec3016b58ea2c763
/src/main/java/com/choosedb/controller/UserController.java
ec271697251f48a59627f405513fb59c24600b6c
[]
no_license
liyc712/dynamicChooseDb
194e1325c27faa6f4cb2c6eb8355377bd6ff86c1
a0d8111636a227d6073c6bdc85f6bd4493fb3ab2
refs/heads/master
2021-09-02T06:21:57.753755
2017-12-31T01:09:25
2017-12-31T01:09:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,166
java
package com.choosedb.controller; import com.choosedb.mybatis.model.User; import com.choosedb.service.IUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import javax.inject.Inject; /** * */ @Controller @RequestMapping(value = "/user", produces = {"application/json;charset=UTF-8"}) public class UserController { @Autowired private IUserService userService; //http://localhost:8080/user/select.do @ResponseBody @RequestMapping(value = "/select.do", method = RequestMethod.GET) public String select() { User user = userService.selectUserById(123); return user.toString(); } //http://localhost:8080/user/add.do @ResponseBody @RequestMapping(value = "/add.do", method = RequestMethod.GET) public String add() { boolean isOk = userService.addUser(new User("333", "444")); return isOk == true ? "shibai" : "chenggong"; } }
[ "1575571143@qq.com" ]
1575571143@qq.com
c2c2e1db04f265c2587afe054fa15c6195a3ef72
5741045375dcbbafcf7288d65a11c44de2e56484
/reddit-decompilada/com/reddit/frontpage/presentation/listing/PopularListingScreen$customizeDecorationStrategy$1.java
79d30bc33d0447f11c50fd0b6362e9d3a93221f3
[]
no_license
miarevalo10/ReporteReddit
18dd19bcec46c42ff933bb330ba65280615c281c
a0db5538e85e9a081bf268cb1590f0eeb113ed77
refs/heads/master
2020-03-16T17:42:34.840154
2018-05-11T10:16:04
2018-05-11T10:16:04
132,843,706
0
0
null
null
null
null
UTF-8
Java
false
false
1,025
java
package com.reddit.frontpage.presentation.listing; import kotlin.Metadata; import kotlin.jvm.functions.Function1; import kotlin.jvm.internal.Lambda; @Metadata(bv = {1, 0, 2}, d1 = {"\u0000\u000e\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\b\n\u0000\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0003H\n¢\u0006\u0002\b\u0004"}, d2 = {"<anonymous>", "", "it", "", "invoke"}, k = 3, mv = {1, 1, 9}) /* compiled from: PopularListingScreen.kt */ final class PopularListingScreen$customizeDecorationStrategy$1 extends Lambda implements Function1<Integer, Boolean> { public static final PopularListingScreen$customizeDecorationStrategy$1 f36525a = new PopularListingScreen$customizeDecorationStrategy$1(); PopularListingScreen$customizeDecorationStrategy$1() { super(1); } public final /* synthetic */ Object mo6492a(Object obj) { boolean z = true; if (((Number) obj).intValue() <= 1) { z = false; } return Boolean.valueOf(z); } }
[ "mi.arevalo10@uniandes.edu.co" ]
mi.arevalo10@uniandes.edu.co
33b28ca768b6141bd2d8cfb2c3a19195b3ad01f5
34b88a84c5b9989e117d3e6dc884875f9eba05fc
/gen/com/phonegap/fived/BuildConfig.java
2d2f87a2ede0e939a1e0a86580df1e04444b18f9
[]
no_license
nafiskhan/five-d
1a75cffe9367fc73172d5749ff1a4337aec1510b
a5bf95a94ef609b305ccc1b66c41a474328dc273
refs/heads/master
2020-05-24T13:12:58.973161
2013-05-07T08:30:05
2013-05-07T08:30:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
160
java
/** Automatically generated file. DO NOT MODIFY */ package com.phonegap.fived; public final class BuildConfig { public final static boolean DEBUG = true; }
[ "nafish_khan@nucsoft.co.in" ]
nafish_khan@nucsoft.co.in
5cef3c4ed68a52f2b1c27cf17355ee313ea2bc99
b5f812cee950324d92ff115e2014b3aee1937f58
/archive/r127/Round_127_C_Test.java
9016acf3adb266706ce057437155767a7615d936
[]
no_license
elizarov/Codeforces
4625a3dff1962fd160fba155253a44f7149ccd77
d235d95e9ada7ebe8e18d9331d9fa7b8020d748a
refs/heads/master
2023-05-25T12:32:33.023871
2023-05-16T16:14:30
2023-05-16T16:14:30
140,975,150
37
3
null
null
null
null
UTF-8
Java
false
false
945
java
package archive.r127; import junit.framework.TestCase; /** * @author Roman Elizarov */ public class Round_127_C_Test extends TestCase { public void testMax() { long time = System.currentTimeMillis(); Round_127_C t = new Round_127_C(); t.n = 100000; t.allocate(); t.solve(); System.out.println(System.currentTimeMillis() - time); } public void testSome() { assertEquals(1, solve(1)); assertEquals(2, solve(2)); assertEquals(3, solve(3)); assertEquals(4, solve(4)); assertEquals(5, solve(5)); assertEquals(6, solve(6)); assertEquals(6, solve(6)); assertEquals(2, solve(1, 1)); assertEquals(3, solve(1, 1, 1)); assertEquals(4, solve(1, 1, 1, 1)); assertEquals(5, solve(1, 1, 1, 1, 1)); assertEquals(5, solve(2, 1, 2, 1)); } private long solve(int... a) { Round_127_C t = new Round_127_C(); t.n = a.length + 1; t.allocate(); System.arraycopy(a, 0, t.a, 1, a.length); return t.solve(); } }
[ "elizarov@gmail.com" ]
elizarov@gmail.com
28edc8b7f7d78accd5504dbecbbadd9fa7e3a321
8afa982659fdfdb04bf015a7fb6be7e31d644451
/src/main/java/com/hzkdxh/service/CompanyService.java
243133949b17b7df180d27450910dd92e575e8c0
[]
no_license
capricore/hzkdxh
fee093f66dc380b3185a5134c640bfa15bc79ab0
271bef35e99c3d3315c56d6f38b0089b873ba0c9
refs/heads/master
2020-06-01T01:35:10.483521
2016-03-02T05:39:23
2016-03-02T05:39:23
36,228,093
0
2
null
null
null
null
GB18030
Java
false
false
1,054
java
package com.hzkdxh.service; import java.util.List; import com.hzkdxh.bean.Company; public interface CompanyService { /* 查询公司列表 */ public List<Company> getCompanyList(); /* 根据主公司id查询对应子公司列表 */ public List<Company> getSubcompanyListByCompId(String compid); /* 查询子公司列表 */ public List<Company> getSubcompanyList(); /* 根据compname查询指定用户 */ public Company getByCompanyName(String compname); /* 根据compid查询指定用户 */ public Company getByCompanyId(String compid); /* 添加新公司 */ public boolean addCompany(Company company); /* 更新公司信息*/ public boolean updateCompany(Company company); /* 获得主公司信息列表*/ public List<Company> getMainCompanyList(); /* 根据公司等级公司信息列表*/ public List<Company> getCompanyListByLevel(int level); /* 删除公司信息*/ public boolean deleteComp(String compid); }
[ "405020841@qq.com" ]
405020841@qq.com
a36ec973a067cb08132e54b518240281961b3ce1
38dd86472ff6abcee0db322a6a496337f355d7aa
/java/epi/list/NodeDelete.java
61e49ecd19693e6009bd5e94d0a5fd582caf6c35
[ "MIT" ]
permissive
code-lgtm/Problem-Solving
e44c3f75cb50383f35e4f4e8162e331147145436
be9e3b8a630e4126f150b9e7f03c2f3290ba3255
refs/heads/master
2023-03-07T09:20:18.279727
2021-02-17T13:21:38
2021-02-17T13:21:38
130,567,705
0
0
null
null
null
null
UTF-8
Java
false
false
969
java
package epi.list; //Delete a note in O(1) time and O(1) space, the node to be deleted isn't the last node public class NodeDelete { static class LNode{ int data; LNode next; LNode(int data){ this.data = data; } } public static void main(String[] args) { LNode l1 = new LNode(1); l1.next = new LNode(5); l1.next.next = new LNode(8); l1.next.next.next = new LNode(10); LNode delNode = l1.next.next;//8 LNode cur = deleteNode(l1, delNode); while (cur != null) { System.out.print(cur.data + " "); cur = cur.next; } //Output: 1 5 10 } static LNode deleteNode(LNode lst, LNode del){ //insted of deleting node del, copy del's next's data in del and delete del's next. effectively yielding the same config del.data = del.next.data; del.next = del.next.next; return lst; } }
[ "inbox.prashant@gmail.com" ]
inbox.prashant@gmail.com
8a8bf5f1c1dfeff6adfc1d249991bfd9e1919a1b
84f0ed3f1b47eb7cf4cdf8193a836114a50e577a
/furniture-mall-wx-api/src/main/java/com/xinzhi/furniture/mall/wx/task/TaskStartupRunner.java
c39afa8377cda9e8e8b38694ffdefe7950155eeb
[]
no_license
lizebin-dream/ToHeart_furniture
565f3649ece641c9ac61df966f3de74090c409e2
37d2770e7c7699d0bdde5b9688f1153c0f92d8ed
refs/heads/master
2022-07-11T23:02:12.039644
2020-03-08T13:06:53
2020-03-08T13:06:53
245,817,448
0
0
null
2022-06-29T18:00:14
2020-03-08T13:15:37
Java
UTF-8
Java
false
false
1,635
java
package com.xinzhi.furniture.mall.wx.task; import com.xinzhi.furniture.mall.core.system.SystemConfig; import com.xinzhi.furniture.mall.core.task.TaskService; import com.xinzhi.furniture.mall.db.domain.LitemallOrder; import com.xinzhi.furniture.mall.db.service.LitemallOrderService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; import org.springframework.stereotype.Component; import java.time.LocalDateTime; import java.time.temporal.ChronoUnit; import java.util.List; @Component public class TaskStartupRunner implements ApplicationRunner { @Autowired private LitemallOrderService orderService; @Autowired private TaskService taskService; @Override public void run(ApplicationArguments args) throws Exception { List<LitemallOrder> orderList = orderService.queryUnpaid(SystemConfig.getOrderUnpaid()); for(LitemallOrder order : orderList){ LocalDateTime add = order.getAddTime(); LocalDateTime now = LocalDateTime.now(); LocalDateTime expire = add.plusMinutes(SystemConfig.getOrderUnpaid()); if(expire.isBefore(now)) { // 已经过期,则加入延迟队列 taskService.addTask(new OrderUnpaidTask(order.getId(), 0)); } else{ // 还没过期,则加入延迟队列 long delay = ChronoUnit.MILLIS.between(now, expire); taskService.addTask(new OrderUnpaidTask(order.getId(), delay)); } } } }
[ "lizebin@qq.com" ]
lizebin@qq.com
150331ff9b12ea3970698b966163922272285c50
f172420e71354ed5d84dc768ebc2be80bc72d651
/flashsale/src/test/java/com/retail/proj/flashsale/FlashsaleApplicationTests.java
6226fe578f0ce42bc22c8d8f623e52e90a7d03a1
[]
no_license
arjun541/flashsaleproject
7141fb81d6dcac4316dda58c3187fd7b226aefbd
60617d204e28c3a75060a91ba273113d0a79bd7d
refs/heads/master
2020-12-21T12:36:31.580126
2020-01-30T08:48:56
2020-01-30T08:48:56
236,433,308
0
0
null
null
null
null
UTF-8
Java
false
false
1,915
java
package com.retail.proj.flashsale; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import javax.transaction.Transactional; import javax.validation.constraints.AssertTrue; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.domain.Example; import com.retail.proj.flashsale.model.PurchaseOrder; import com.retail.proj.flashsale.pojo.FlashSaleRegistrationResult; import com.retail.proj.flashsale.pojo.PurchaseResult; import com.retail.proj.flashsale.repository.FlashSaleRepository; import com.retail.proj.flashsale.repository.OrderRepository; import com.retail.proj.flashsale.repository.RegistrationRepository; import com.retail.proj.flashsale.service.FlashSaleSerice; @SpringBootTest @Transactional class FlashsaleApplicationTests { @Test void contextLoads() { } @Autowired FlashSaleSerice fs; @Autowired RegistrationRepository reg; @Autowired FlashSaleRepository fr; @Autowired OrderRepository or; @Test public void registerFlashSale_whenSave_thenGetOk() { fs.registerForSale(1, 1); assertTrue(reg.getOne("1-1").getFlashSale().getId()==1); } @Test public void purchaseproduct_whenRegistered_thenGetOk() { fs.registerForSale(1, 3); PurchaseResult po= fs.purchaseFromSale(1, 3); assertTrue(po.getStatus()); } @Test public void purchaseproduct_whenNotRegistered_thenGetNotOk() { PurchaseResult po= fs.purchaseFromSale(4, 3); assertFalse(po.getStatus()); } @Test public void register_whenSaleIsRegNotOpen_thenGetNotOk() { FlashSaleRegistrationResult fr=fs.registerForSale(4, 2); assertFalse(fr.getStatus()); } }
[ "bmkr.541@gmail.com" ]
bmkr.541@gmail.com
8006d8c1ebee40895b2f2b41cc3a6f04164a4ec3
7f62db61a68dc1fd9cb4078f6a1ca1c94a3d5274
/druid-sql-parser/src/main/java/com/adang/druid/proxy/util/JdbcConstants.java
abf468bc2cd50cc1eef071e664a56f97c9b28508
[]
no_license
baojie5642/druid-sqlparser
f64c05b2e060ad63260adc8b1e6a1b24dc20c063
81b0fc13fddbb2b1a82912af710d8390c240e7e8
refs/heads/master
2022-11-08T14:14:00.995209
2020-03-29T06:24:18
2020-03-29T06:24:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,865
java
/* * Copyright 1999-2017 Alibaba Group Holding Ltd. * * 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.adang.druid.proxy.util; public interface JdbcConstants { public static final String JTDS = "jtds"; public static final String MOCK = "mock"; public static final String HSQL = "hsql"; public static final String DB2 = "db2"; public static final String DB2_DRIVER = "COM.ibm.db2.jdbc.app.DB2Driver"; public static final String POSTGRESQL = "postgresql"; public static final String POSTGRESQL_DRIVER = "org.postgresql.Driver"; public static final String SYBASE = "sybase"; public static final String SQL_SERVER = "sqlserver"; public static final String SQL_SERVER_DRIVER = "com.microsoft.jdbc.sqlserver.SQLServerDriver"; public static final String SQL_SERVER_DRIVER_SQLJDBC4 = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; public static final String SQL_SERVER_DRIVER_JTDS = "net.sourceforge.jtds.jdbc.Driver"; public static final String ORACLE = "oracle"; public static final String ORACLE_DRIVER = "oracle.jdbc.OracleDriver"; public static final String ORACLE_DRIVER2 = "oracle.jdbc.driver.OracleDriver"; public static final String ALI_ORACLE = "AliOracle"; public static final String ALI_ORACLE_DRIVER = "com.alibaba.jdbc.AlibabaDriver"; public static final String MYSQL = "mysql"; public static final String MYSQL_DRIVER = "com.mysql.jdbc.Driver"; public static final String MYSQL_DRIVER_6 = "com.mysql.cj.jdbc.Driver"; public static final String MYSQL_DRIVER_REPLICATE = "com.mysql.jdbc."; public static final String MARIADB = "mariadb"; public static final String MARIADB_DRIVER = "org.mariadb.jdbc.Driver"; public static final String DERBY = "derby"; public static final String HBASE = "hbase"; public static final String HIVE = "hive"; public static final String HIVE_DRIVER = "org.apache.hive.jdbc.HiveDriver"; public static final String H2 = "h2"; public static final String H2_DRIVER = "org.h2.Driver"; public static final String DM = "dm"; public static final String DM_DRIVER = "dm.jdbc.driver.DmDriver"; public static final String KINGBASE = "kingbase"; public static final String KINGBASE_DRIVER = "com.kingbase.Driver"; public static final String GBASE = "gbase"; public static final String GBASE_DRIVER = "com.gbase.jdbc.Driver"; public static final String OCEANBASE = "oceanbase"; public static final String OCEANBASE_DRIVER = "com.mysql.jdbc.Driver"; public static final String INFORMIX = "informix"; /** * 阿里云odps */ public static final String ODPS = "odps"; public static final String ODPS_DRIVER = "com.aliyun.odps.jdbc.OdpsDriver"; public static final String TERADATA = "teradata"; public static final String TERADATA_DRIVER = "com.teradata.jdbc.TeraDriver"; /** * Log4JDBC */ public static final String LOG4JDBC = "log4jdbc"; public static final String LOG4JDBC_DRIVER = "net.sf.log4jdbc.DriverSpy"; public static final String PHOENIX = "phoenix"; public static final String PHOENIX_DRIVER = "org.apache.phoenix.jdbc.PhoenixDriver"; public static final String ENTERPRISEDB = "edb"; public static final String ENTERPRISEDB_DRIVER = "com.edb.Driver"; public static final String KYLIN = "kylin"; public static final String KYLIN_DRIVER = "org.apache.kylin.jdbc.Driver"; public static final String SQLITE = "sqlite"; public static final String SQLITE_DRIVER = "org.sqlite.JDBC"; public static final String ALIYUN_ADS = "aliyun_ads"; public static final String ALIYUN_DRDS = "aliyun_drds"; public static final String PRESTO = "presto"; public static final String ELASTIC_SEARCH = "elastic_search"; String ELASTIC_SEARCH_DRIVER = "com.alibaba.xdriver.elastic.jdbc.ElasticDriver"; }
[ "liweihua@hd123.com" ]
liweihua@hd123.com
86e0da28ba0b42ef9749a4a9be26b8e229ece595
5447706854f8b3ad397a4ae3d33d96a743601b40
/src/main/java/bgu/spl/app/TimeService.java
be3b2b39218a4339e4323683318ae6b06a9c51da
[]
no_license
saleemdibbiny/Shoe-store
4b5a6b81788a7a9f942967877a3530e85ceca55b
6c84d11ea3a54bf4b80d72aee8d4b029c1bf21ca
refs/heads/master
2021-01-01T04:42:48.068266
2017-07-14T09:53:14
2017-07-14T09:53:14
97,231,859
0
0
null
null
null
null
UTF-8
Java
false
false
3,365
java
package bgu.spl.app; import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.CountDownLatch; import java.util.concurrent.Phaser; import java.util.logging.Logger; import bgu.spl.mics.MicroService; /** * This micro-service is the global system timer (handles the clock ticks in the * system). it is responsible for counting how much clock ticks passed since the * beginning of its execution and notifying every other micro-services (thats * interested) about it using the {@link TickBroadcast}. * * @author Anan Kays, Saleem Dibbiny * */ public class TimeService extends MicroService { /** * int - describes the current tick of the whole system. * */ private int tick = 0; /** * int - number of milliseconds each clock tick takes */ private int speed; /** * int - the number of ticks before termination. */ private int duration; /** * singleton {@link Store}. */ private Store store; /** * CountDownLatch - let the current thread wait for the rest of the threads * to be ready. */ private CountDownLatch countDown; /** * Phaser - A reusable synchronization barrier, similar in functionality to * CyclicBarrier and CountDownLatch but supporting more flexible usage. */ private Phaser phaser; private final Logger log; /** * Creates a new {@link TimeService} micro-service. * * @param speed * int - number of milliseconds each clock tick takes * @param duration * int - the number of ticks before termination. * @param store * singleton {@link Store}. * @param countDown * CountDownLatch - let the current thread wait for the rest of * the threads to be ready. * @param phaser * A reusable synchronization barrier, similar in functionality * to CyclicBarrier and CountDownLatch but supporting more * flexible usage. */ public TimeService(int speed, int duration, Store store, CountDownLatch countDown, Phaser phaser) { super("TimeService"); this.countDown = countDown; this.speed = speed; this.duration = duration; this.store = store; this.phaser = phaser; this.log = Logger.getLogger("timeService"); } /** * Let the micro-service wait the other micro-services (Threads) to be * ready. */ private void waitOtherThreads() { try { countDown.await(); } catch (InterruptedException e) { e.printStackTrace(); } } @SuppressWarnings("deprecation") @Override /* * (non-Javadoc) * * @see bgu.spl.mics.MicroService#initialize() */ protected void initialize() { int delay = speed; // milliseconds TimeService thisService = this; Timer timer = new Timer(); log.info("Ready and waiting for other services"); waitOtherThreads(); log.info("All services are ready to start"); timer.schedule(new TimerTask() { @Override public void run() { tick++; if (tick > duration) { thisService.sendBroadcast(new TerminationBroadcast(phaser)); phaser.arriveAndAwaitAdvance(); log.info(" MicroService " + thisService.getName() + " Terminated!"); thisService.terminate(); timer.cancel(); store.print(); } else { log.info("Tick " + tick + ":"); thisService.sendBroadcast(new TickBroadcast(tick, duration)); } } }, 0, delay); Thread.currentThread().stop(); } }
[ "saleemdibbiny@gmail.com" ]
saleemdibbiny@gmail.com
8f29ef390da3b8274b593bd5774b404e2b4fce6c
f07946e772638403c47cc3e865fd8a5e976c0ce6
/leetcode_java/src/1986.minimum-number-of-work-sessions-to-finish-the-tasks.java
c87edc250811156970478e619b216722f166ce9a
[]
no_license
yuan-fei/Coding
2faf4f87c72694d56ac082778cfc81c6ff8ec793
2c64b53c5ec1926002d6e4236c4a41a676aa9472
refs/heads/master
2023-07-23T07:32:33.776398
2023-07-21T15:34:25
2023-07-21T15:34:25
113,255,839
0
0
null
null
null
null
UTF-8
Java
false
false
2,884
java
/* * @lc app=leetcode id=1986 lang=java * * [1986] Minimum Number of Work Sessions to Finish the Tasks * * https://leetcode.com/problems/minimum-number-of-work-sessions-to-finish-the-tasks/description/ * * algorithms * Medium (29.53%) * Likes: 254 * Dislikes: 16 * Total Accepted: 6.2K * Total Submissions: 21.1K * Testcase Example: '[1,2,3]\n3' * * There are n tasks assigned to you. The task times are represented as an * integer array tasks of length n, where the i^th task takes tasks[i] hours to * finish. A work session is when you work for at most sessionTime consecutive * hours and then take a break. * * You should finish the given tasks in a way that satisfies the following * conditions: * * * If you start a task in a work session, you must complete it in the same work * session. * You can start a new task immediately after finishing the previous one. * You may complete the tasks in any order. * * * Given tasks and sessionTime, return the minimum number of work sessions * needed to finish all the tasks following the conditions above. * * The tests are generated such that sessionTime is greater than or equal to * the maximum element in tasks[i]. * * * Example 1: * * * Input: tasks = [1,2,3], sessionTime = 3 * Output: 2 * Explanation: You can finish the tasks in two work sessions. * - First work session: finish the first and the second tasks in 1 + 2 = 3 * hours. * - Second work session: finish the third task in 3 hours. * * * Example 2: * * * Input: tasks = [3,1,3,1,1], sessionTime = 8 * Output: 2 * Explanation: You can finish the tasks in two work sessions. * - First work session: finish all the tasks except the last one in 3 + 1 + 3 * + 1 = 8 hours. * - Second work session: finish the last task in 1 hour. * * * Example 3: * * * Input: tasks = [1,2,3,4,5], sessionTime = 15 * Output: 1 * Explanation: You can finish all the tasks in one work session. * * * * Constraints: * * * n == tasks.length * 1 <= n <= 14 * 1 <= tasks[i] <= 10 * max(tasks[i]) <= sessionTime <= 15 * * */ // @lc code=start class Solution { public int minSessions(int[] tasks, int sessionTime) { int n = tasks.length; int[] dp = new int[1 << n]; for(int m = 0; m < (1 << n); m++){ dp[m] = n; int total = 0; for(int i = 0; i < n; i++){ if(((m >> i) & 1) != 0){ total += tasks[i]; } } if(total <= sessionTime){ dp[m] = 1; } int x = m; while(x != 0){ x = (x-1) & m; dp[m] = Math.min(dp[m], dp[x] + dp[m ^ x]); } } // System.out.println(Arrays.toString(dp)); return dp[(1 << n) - 1]; } } // @lc code=end
[ "yuanfei_1984@hotmail.com" ]
yuanfei_1984@hotmail.com
d167916478fbf069f1dbb3d7c3d512554235cdbe
62e109b35a8e8801d2b1fdf98f6edd45f1021340
/src/java/myPkg/ProcessData.java
bb46572c4458b33912976097ed9f555d8ae57432
[]
no_license
MineriaForetell/MineriaForetell
0eeb6c835928d3c6a51ce5f36b583986e1e3ab05
c0c394b03a3f82cd0c1bc93081ec5f0c961a44e6
refs/heads/master
2020-05-21T17:09:27.928039
2018-02-25T10:58:01
2018-02-25T10:58:01
84,637,637
1
0
null
null
null
null
UTF-8
Java
false
false
3,178
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 myPkg; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author raxton */ public class ProcessData extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try (PrintWriter out = response.getWriter()) { /* TODO output your page here. You may use following sample code. */ String processReq = request.getParameter("process"); HadoopProcessingClass obj = new HadoopProcessingClass(); if (processReq.equals("starthadoop")) { //Path must have correct value String startProcess = "nohup sh -x /home/raxton/data/scripts/start-hadoop.sh > temp.log 2>&1 &"; obj.startprocess(startProcess); } else if (processReq.equals("ProcesScript")) { //Path must have cor rect value String startProcess = "nohup sh -x /home/raxton/data/scripts/.sh > temp.log 2>&1 &"; // String start = obj.startprocess(startProcess); } } } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
[ "rakshitshah1994@gmail.com" ]
rakshitshah1994@gmail.com