blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
1bfe3052942a6ee1d6bbe30ece62b6d78a1c9fe5
55092c6ad9d98e95b9a7dc171e634b5fd3b25976
/activiti/例子/整合/TimerBoundaryEvent&CallActivity&多实例&加减签/src/main/java/demo/Demo.java
41337f252f6a3a753599fd7d290ebdeb4f8606cf
[]
no_license
KLines/workflow
eeb70dcaef8aaa901687b499e5d792a9103f5006
e6e51bd4393d5187c511a04175d6fd287f41246d
refs/heads/master
2022-01-20T05:01:33.097331
2019-04-13T12:00:24
2019-04-13T12:00:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,648
java
package demo; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.activiti.engine.ProcessEngine; import org.activiti.engine.ProcessEngines; import org.activiti.engine.RepositoryService; import org.activiti.engine.RuntimeService; import org.activiti.engine.TaskService; import org.activiti.engine.history.HistoricProcessInstance; import org.activiti.engine.repository.Deployment; import org.activiti.engine.runtime.Execution; import org.activiti.engine.runtime.ExecutionQuery; import org.activiti.engine.runtime.ProcessInstance; import org.activiti.engine.task.Task; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication(exclude = org.activiti.spring.boot.SecurityAutoConfiguration.class) public class Demo { public static void main(String[] args) throws InterruptedException { SpringApplication.run(Demo.class, args); ProcessEngine engine = ProcessEngines.getDefaultProcessEngine(); RepositoryService repositoryService = engine.getRepositoryService(); Deployment deploy = repositoryService.createDeployment().name("callActivityDemo").addClasspathResource("diagrams/MyProcess.bpmn").addClasspathResource("diagrams/MyProcess2.bpmn").deploy(); Map<String, Object> var = new HashMap<>(); var.put("outterVar1", 1); List<String> assigneeList=new ArrayList<>(); //分配任务的人员 assigneeList.add("tom"); assigneeList.add("tom"); assigneeList.add("tom"); var.put("assigneeList", assigneeList); RuntimeService runtimeService = engine.getRuntimeService(); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myDemo", var); TaskService taskService = engine.getTaskService(); Task usertask1 = taskService.createTaskQuery().processInstanceId(processInstance.getId()).taskName("usertask1").singleResult(); taskService.complete(usertask1.getId()); Thread.sleep(10000); /* START 第一次执行子流程 */ ProcessInstance piSub = runtimeService.createProcessInstanceQuery().superProcessInstanceId(processInstance.getId()).processDefinitionKey("calledProcess2").singleResult(); Task calledProcess2_usertask1 = taskService.createTaskQuery().processInstanceId(piSub.getId()).taskName("calledProcess2_usertask1").singleResult(); taskService.complete(calledProcess2_usertask1.getId()); /* END 第一次执行子流程 */ Thread.sleep(15000); /* START 第二次执行子流程 */ ProcessInstance piSub2 = runtimeService.createProcessInstanceQuery().superProcessInstanceId(processInstance.getId()).processDefinitionKey("calledProcess2").singleResult(); Task calledProcess2_usertask1_2 = taskService.createTaskQuery().processInstanceId(piSub2.getId()).taskName("calledProcess2_usertask1").singleResult(); taskService.complete(calledProcess2_usertask1_2.getId()); /* END 第二次执行子流程 */ Thread.sleep(40000); /* START 第三次执行子流程 */ ProcessInstance piSub3 = runtimeService.createProcessInstanceQuery().superProcessInstanceId(processInstance.getId()).processDefinitionKey("calledProcess2").singleResult(); // Task calledProcess2_usertask1_3 = taskService.createTaskQuery().processInstanceId(piSub3.getId()).taskName("calledProcess2_usertask1").singleResult(); // taskService.complete(calledProcess2_usertask1_3.getId()); if ( piSub3 == null ) { System.out.println("我感觉 piSub3 == null 是正确的"); } /* END 第三次执行子流程 */ HistoricProcessInstance historicProcessInstance = engine.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(processInstance.getId()).singleResult(); Date endTime = historicProcessInstance.getEndTime(); processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId()).singleResult(); if ( processInstance == null ) { System.out.println("流程结束, 结束时间: " + endTime); } else { System.out.println(processInstance.isEnded()); System.out.println(processInstance.isSuspended()); System.out.println(processInstance.getActivityId()); } } }
b470a366c3b17a4464af55c06d0f140b96cb6b3d
cbe8abe7b7673b7504ed43e98f4f9a43d6beccce
/app/src/main/java/com/yoga/atm/app/service/impl/AccountServiceImpl.java
0436f4a43e96d2d0c30ca385f6bea2ba93c71153
[]
no_license
rizkyyoga/atm4
401c17b5095f34844ce3d8104dd990cf65a8ec73
d43646de30ff60e834f17de4829d3342e4f654f8
refs/heads/master
2020-08-27T00:41:47.372097
2019-11-12T06:56:26
2019-11-12T06:56:26
217,196,567
0
1
null
null
null
null
UTF-8
Java
false
false
793
java
package com.yoga.atm.app.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.yoga.atm.app.dao.AccountRepository; import com.yoga.atm.app.model.Account; import com.yoga.atm.app.service.AccountService; @Service public class AccountServiceImpl implements AccountService { @Autowired AccountRepository repository; @Override public Account findByAccountNumber(String accountNumber) { try { return repository.findById(accountNumber).get(); } catch (Exception e) { return null; } } @Override public Account save(Account account) { return repository.save(account); } @Override public List<Account> findAll() { return (List<Account>) repository.findAll(); } }
dbc3e97d4962a67f3291722461ac95a0a7b771ac
43dacb312c88ac3ad2026721541948645ac56ffd
/AsignacionAula/src/main/java/edu/pucmm/eict/Main.java
7aafab5b85045dc548237b1c0acb639fd8196191
[]
no_license
Ezeluna/Practicas-Program.-web
2f27b9fccc4d11b30bc1a0f088e38711e753fdf1
1ebb0196a90e3dbd9f21a2e02573f3b4eea4dbb1
refs/heads/main
2023-03-11T19:53:40.360304
2021-02-24T21:26:01
2021-02-24T21:26:01
340,053,949
0
0
null
null
null
null
UTF-8
Java
false
false
719
java
package edu.pucmm.eict; import io.javalin.Javalin; import io.javalin.core.util.RouteOverviewPlugin; import javax.naming.ldap.Control; public class Main { public static void main(String[] args){ Javalin app = Javalin.create(config->{ config.addStaticFiles("/resources"); config.registerPlugin(new RouteOverviewPlugin("/")); }); app.start(getHerokuAssignedPort()); } static int getHerokuAssignedPort() { ProcessBuilder processBuilder = new ProcessBuilder(); if (processBuilder.environment().get("PORT") != null) { return Integer.parseInt(processBuilder.environment().get("PORT")); } return 7000; } }
bc09bcd5e6ee7c0fbe851ea65ea07962520aef20
b6be7455a72726661cb745bd528e2224587cbd10
/services/src/FaultFactory.java
ba1eb0733a1e744b08cd8d3b762795f7218b8c88
[]
no_license
IndikaKuma/SDSN_SPE_2018
a476cc7ec4380cc9739daaf845e6be6d58066a56
71966d770edd12cf946da8a62c674e71649dedb8
refs/heads/master
2021-04-03T08:49:31.024763
2018-07-27T21:04:37
2018-07-27T21:04:37
124,797,099
0
0
null
null
null
null
UTF-8
Java
false
false
1,886
java
import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.soap.*; import org.apache.axis2.context.MessageContext; import javax.xml.namespace.QName; /** * TODO documentation */ public class FaultFactory { public static void createFault(MessageContext inMessageContext) { SOAPFactory soapFactory; if (inMessageContext.isSOAP11()) { soapFactory = OMAbstractFactory.getSOAP11Factory(); } else { soapFactory = OMAbstractFactory.getSOAP12Factory(); } SOAPFaultCode soapFaultCode = soapFactory.createSOAPFaultCode(); SOAPFaultValue soapFaultValue = soapFactory.createSOAPFaultValue(soapFaultCode); soapFaultValue.setText(new QName("http://ws.apache.org/axis2", "TestFault", "test")); SOAPFaultReason soapFaultReason = soapFactory.createSOAPFaultReason(); SOAPFaultText soapFaultText = soapFactory.createSOAPFaultText(soapFaultReason); soapFaultText.setText("This is some FaultReason"); SOAPFaultDetail soapFaultDetail = soapFactory.createSOAPFaultDetail(); QName qName = new QName("http://ws.apache.org/axis2", "FaultException"); OMElement detail = soapFactory.createOMElement(qName, soapFaultDetail); qName = new QName("http://ws.apache.org/axis2", "ExceptionMessage"); Throwable e = new Exception("This is a test Exception"); OMElement exception = soapFactory.createOMElement(qName, null); exception.setText(e.getMessage()); detail.addChild(exception); inMessageContext.setProperty(SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME, soapFaultCode); inMessageContext.setProperty(SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME, soapFaultReason); inMessageContext.setProperty(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME, soapFaultDetail); } }
a27e5ffe0aeb32708a9f4a1be788bb0a6045df4d
5ec8377fe0168af7387c060b5e7fc11abd0b7af6
/src/main/java/com/myleetcode/design/design_snake_game/DesignSnakeGame.java
f947fc690fd32999877c1eb02b10d0cc0ff717cd
[]
no_license
arnabs542/leetcode-35
18c84e18434e41dd7881efe0b942472879a6ccd4
492bdfe1b6532dfbcfbc3e7b073e3729184241a4
refs/heads/master
2022-12-15T08:13:02.469494
2020-09-11T23:07:52
2020-09-11T23:07:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,991
java
package com.myleetcode.design.design_snake_game; public class DesignSnakeGame { /** * 353. Design Snake Game * Medium * * 202 * * 79 * * Favorite * * Share * Design a Snake game that is played on a device with screen size = width x height. Play the game online if you are not familiar with the game. * * The snake is initially positioned at the top left corner (0,0) with length = 1 unit. * * You are given a list of food's positions in row-column order. When a snake eats the food, its length and the game's score both increase by 1. * * Each food appears one by one on the screen. For example, the second food will not appear until the first food was eaten by the snake. * * When a food does appear on the screen, it is guaranteed that it will not appear on a block occupied by the snake. * * Example: * * Given width = 3, height = 2, and food = [[1,2],[0,1]]. * * Snake snake = new Snake(width, height, food); * * Initially the snake appears at position (0,0) and the food at (1,2). * * |S| | | * | | |F| * * snake.move("R"); -> Returns 0 * * | |S| | * | | |F| * * snake.move("D"); -> Returns 0 * * | | | | * | |S|F| * * snake.move("R"); -> Returns 1 (Snake eats the first food and right after that, the second food appears at (0,1) ) * * | |F| | * | |S|S| * * snake.move("U"); -> Returns 1 * * | |F|S| * | | |S| * * snake.move("L"); -> Returns 2 (Snake eats the second food) * * | |S|S| * | | |S| * * snake.move("U"); -> Returns -1 (Game over because snake collides with border) */ /** * Design * Queue */ /** * Google * | * 3 * * Uber * | * 2 * * Amazon * | * 2 * * Zillow * | * 2 */ }
a4c5a14d85c771bcbdc4ac85e1968362dd2c3067
c31848f4a2e84ea9c021251c9629bff05521f614
/app/src/main/java/com/aj/need/tools/components/services/FormFieldKindTranslator.java
dfd7a32d02304284d90de37914199359624850b1
[]
no_license
tutanck/Need
8ec8cea3b39119d20c853ba1f5d16d0b1660590f
b1f3b170084d8c737386c25cdd27f7b74ca1d9b8
refs/heads/master
2021-03-19T17:23:39.128949
2017-11-21T20:01:46
2017-11-21T20:01:46
106,838,640
0
0
null
null
null
null
UTF-8
Java
false
false
480
java
package com.aj.need.tools.components.services; import com.aj.need.R; /** * Created by joan on 23/09/2017. */ public class FormFieldKindTranslator { public static int tr(int kind){ switch (kind) { case 0: return R.layout.fragment_form_field_multiline; case 1: return R.layout.fragment_form_field_oneliner; default: return R.layout.fragment_form_field_multiline; } } }
61566890132679c63274fe343ac8b09e84c49d42
8e872bc43b7cfac6b57d7a1e3d270929b6de24ce
/src/main/java/org/elasticsearch/index/query/AndFilterParser.java
829d079a679fa053a752329d6ab8cf78e4d7dc3d
[]
no_license
mazhen2010/rts-es-rest4j
b788e1a05f2a6c78bb344a297a284bf7c8434520
0ddbe43c5dec7734bee7ac6c14c762ad4aa687ec
refs/heads/master
2020-05-19T18:54:12.551537
2015-04-28T08:39:23
2015-04-28T08:39:23
34,521,586
4
2
null
null
null
null
UTF-8
Java
false
false
909
java
/* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch licenses this file to you under * the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.elasticsearch.index.query; public class AndFilterParser { public static final String NAME = "and"; }
ac68e3fc0041f76654751cadf8481d1cb9b2776a
01567a26bdcecb4e8af22d419c340773794206ac
/java/ArduRCT_Simulator/src/com/google/code/ardurct/libraries/graphics/ArduRCT_GraphicsUITab.java
acf49521657419c80a28e8f48cbeaa1f93a3a228
[]
no_license
ikawaljeet/ardurct
b7e69cdd31ed07fc7e899c2c23ad4c33206c1767
78ceaa7e463bfc592938fd8793fbbc745d1acfb6
refs/heads/master
2016-09-06T12:09:40.699697
2014-06-24T10:30:09
2014-06-24T10:30:09
33,772,260
0
1
null
null
null
null
UTF-8
Java
false
false
2,469
java
package com.google.code.ardurct.libraries.graphics; public class ArduRCT_GraphicsUITab extends ArduRCT_GraphicsUIOption implements IGraphicsDefines { public ArduRCT_GraphicsUITab(int id, int[] label, IUIActionCallback actionHandler, int group) { _init(id, group, label, null, actionHandler); } public ArduRCT_GraphicsUITab(int id, IUIDrawCallback drawHandler, IUIActionCallback actionHandler, int group) { _init(id, group, null, drawHandler, actionHandler); } public void autoSize(ArduRCT_Graphics graphics) { if (_text == null) return; int fontSize = getFontSize(_text); height = graphics.getFontHeight(fontSize) + GRAPHICS_UI_TAB_TOP_MARGIN * 2; width = graphics.getStringWidth(_text, fontSize) + GRAPHICS_UI_TAB_LEFT_MARGIN * 2; if ((getPrevious() == null) || (getPrevious().getGroup() != _group)) width += GRAPHICS_UI_TAB_LEFT_MARGIN; } public void draw(ArduRCT_Graphics graphics, int uiX, int uiY, int uiWidth) { int bgColor = graphics.getBackgroundColor(); int color = GRAPHICS_UI_COLOR_RELEASED; if (_value == GRAPHICS_UI_PRESSED) color = GRAPHICS_UI_COLOR_BACKGROUND; if (_state == GRAPHICS_UI_PRESSED) color = GRAPHICS_UI_COLOR_PRESSED; graphics.setBackgroundColor(color); int xStart = 0; if ((getPrevious() == null) || (getPrevious().getGroup() != _group)) xStart = GRAPHICS_UI_TAB_LEFT_MARGIN; graphics.fillRectangle(xStart+uiX+x, uiY+y+1, width-xStart, height-1, color); int bColor = BLACK; if (_state == GRAPHICS_UI_SELECTED || _state == GRAPHICS_UI_RELEASED) bColor = GRAPHICS_UI_COLOR_HIGHLIGHTED; graphics.drawRectangle(xStart+uiX+x, uiY+y+1, width-xStart, height-1, bColor, 1); int lineY = uiY+y+height-1; if (xStart != 0) graphics.drawLine(uiX+x, lineY, uiX+x+xStart, lineY, BLACK, 1); // for the last tab, go to the end of the ui if ((getNext() == null) || (getNext().getGroup() != _group)) graphics.drawLine(uiX+x+width, lineY, uiX+x+width+uiWidth, lineY, BLACK, 1); if (_value == GRAPHICS_UI_PRESSED) graphics.drawLine(uiX+x+xStart+1, lineY, uiX+x+width-2, lineY, WHITE, 1); if (_text != null) { int fontSize = getFontSize(_text); graphics.drawString(_text, uiX+x+_textX+xStart/2, uiY+y+_textY+1, BLACK, fontSize, GRAPHICS_UI_ELEMENT_FONT_IS_BOLD, false); } else if (_drawHandler != null) { _drawHandler.draw(_id, _state, _value, x+uiX, y+uiY, width, height); } graphics.setBackgroundColor(bgColor); } }
[ "[email protected]@e6c8d7e2-4189-41cd-c95d-77f86c5df063" ]
[email protected]@e6c8d7e2-4189-41cd-c95d-77f86c5df063
034c4df6c4a18e7cbb682c7f7a054ff7677b09e8
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/26/26_26decf3bce6836f5b63aecdd9fba228c54699396/AddProjectDialog/26_26decf3bce6836f5b63aecdd9fba228c54699396_AddProjectDialog_s.java
ce43d3fe661d6754b6f2085aa90ff0c41ca54594
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
8,343
java
package husacct.control.presentation.util; import husacct.ServiceProvider; import husacct.common.dto.ProjectDTO; import husacct.common.locale.ILocaleService; import husacct.common.services.IServiceListener; import husacct.control.task.configuration.ConfigurationManager; import java.awt.Component; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.util.ArrayList; import java.util.Arrays; import javax.swing.DefaultListModel; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JFileChooser; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; public class AddProjectDialog extends JDialog{ private static final long serialVersionUID = 1L; private JLabel pathLabel, projectNameLabel, versionLabel; private JTextArea descriptionText; private JList<String> pathList; private JPanel panel; private JTextField projectNameText, versionText; private JButton addButton, cancelButton, removeButton, confirmButton; private DefaultListModel<String> pathListModel = new DefaultListModel<String>(); private GridBagConstraints constraint = new GridBagConstraints(); private boolean CancelFlag = true; private ILocaleService localeService = ServiceProvider.getInstance().getLocaleService(); public AddProjectDialog(JDialog dialogOwner){ super(dialogOwner, true); setup(); addComponents(); setListeners(); setVisible(true); } public AddProjectDialog(JDialog dialogOwner, ProjectDTO defaultValues) { super(dialogOwner, true); setup(); addComponents(); setListeners(); setDefaultValues(defaultValues); setVisible(true); } private void setup(){ setTitle(localeService.getTranslatedString("ManageProjectTitle")); this.setDefaultCloseOperation(DISPOSE_ON_CLOSE); this.setLayout(new GridBagLayout()); this.setSize(new Dimension(350, 420)); this.setResizable(false); DialogUtils.alignCenter(this); } public void addComponents(){ this.setLayout(new GridBagLayout()); versionLabel = new JLabel(localeService.getTranslatedString("VersionLabel")); pathLabel = new JLabel(localeService.getTranslatedString("PathLabel")); projectNameLabel = new JLabel(localeService.getTranslatedString("ProjectNameLabel")); addButton = new JButton(localeService.getTranslatedString("AddButton")); removeButton = new JButton(localeService.getTranslatedString("RemoveButton")); confirmButton = new JButton(localeService.getTranslatedString("SaveButton")); cancelButton = new JButton(localeService.getTranslatedString("CancelButton")); projectNameText = new JTextField("myProject", 20); versionText = new JTextField(10); descriptionText = new JTextArea(localeService.getTranslatedString("ProjectTextSpace"), 5, 5); pathList = new JList<String>(pathListModel); pathList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); pathList.setLayoutOrientation(JList.VERTICAL); pathList.setVisibleRowCount(-1); JScrollPane listScroller = new JScrollPane(pathList); listScroller.setAlignmentX(Component.LEFT_ALIGNMENT); removeButton.setEnabled(false); add(projectNameLabel, getConstraint(0, 0, 1, 1)); add(projectNameText, getConstraint(1, 0, 2, 1)); add(versionLabel, getConstraint(0, 1, 1, 1)); add(versionText, getConstraint(1, 1, 2, 1)); add(descriptionText, getConstraint(0, 2, 3, 1, 100, 50)); add(pathLabel, getConstraint(0, 3, 1, 1)); add(listScroller, getConstraint(0, 4, 2, 3, 200, 150)); add(addButton, getConstraint(2, 4, 1, 1)); add(removeButton, getConstraint(2, 5, 1, 1)); add(confirmButton, getConstraint(0, 10, 1, 1)); add(cancelButton, getConstraint(1, 10, 1, 1)); } private void setListeners(){ pathList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if(pathList.getSelectedIndex() >= 0){ removeButton.setEnabled(true); } else { removeButton.setEnabled(false); } } }); addButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { showAddFileDialog(); } }); removeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { pathListModel.remove(pathList.getSelectedIndex()); } }); localeService.addServiceListener(new IServiceListener() { public void update() { versionLabel = new JLabel(localeService.getTranslatedString("VersionLabel")); pathLabel = new JLabel(localeService.getTranslatedString("PathLabel")); projectNameLabel = new JLabel(localeService.getTranslatedString("ProjectNameLabel")); addButton = new JButton(localeService.getTranslatedString("AddButton")); removeButton = new JButton(localeService.getTranslatedString("RemoveButton")); confirmButton = new JButton(localeService.getTranslatedString("OkButton")); } }); confirmButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { CancelFlag = false; dispose(); } }); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { CancelFlag = true; dispose(); } }); } private void showAddFileDialog() { FileDialog fileChooser = new FileDialog(JFileChooser.DIRECTORIES_ONLY, localeService.getTranslatedString("AddButton")); fileChooser.setCurrentDirectory(new File(ConfigurationManager.getProperty("LastUsedAddProjectPath"))); int returnVal = fileChooser.showDialog(panel); if(returnVal == JFileChooser.APPROVE_OPTION) { String addedProjectPath = fileChooser.getSelectedFile().getAbsolutePath(); ConfigurationManager.setPropertie("LastUsedAddProjectPath", addedProjectPath); pathListModel.add(pathListModel.size(), addedProjectPath); } } private void setDefaultValues(ProjectDTO defaultValues){ projectNameText.setText(defaultValues.name); versionText.setText(defaultValues.version); descriptionText.setText(defaultValues.description); for(String path : defaultValues.paths) { pathListModel.add(pathListModel.size(), path); } } public ProjectDTO getProjectData(){ if(CancelFlag) { return null; } String name = projectNameText.getText(); String version = versionText.getText(); String description = descriptionText.getText(); ArrayList<String> paths = new ArrayList<String>(Arrays.asList(Arrays.copyOf(pathListModel.toArray(), pathListModel.toArray().length, String[].class))); return new ProjectDTO(name, paths, "", version, description, null); } private GridBagConstraints getConstraint(int gridx, int gridy, int gridwidth, int gridheight, int ipadx, int ipady){ constraint.fill = GridBagConstraints.BOTH; constraint.insets = new Insets(3, 3, 3, 3); constraint.ipadx = ipadx; constraint.ipady = ipady; constraint.gridx = gridx; constraint.gridy = gridy; constraint.gridwidth = gridwidth; constraint.gridheight = gridheight; return constraint; } private GridBagConstraints getConstraint(int gridx, int gridy, int gridwidth, int gridheight){ return getConstraint(gridx, gridy, gridwidth, gridheight, 0, 0); } public boolean dataValidated() { /* String applicationName = applicationNameText.getText(); boolean showError = false; String errorMessage = ""; if(applicationName == null || applicationName.length() < 1){ errorMessage = localeService.getTranslatedString("FieldEmptyError"); showError = true; } if (!Regex.matchRegex(Regex.nameWithSpacesRegex, applicationNameText.getText())) { errorMessage = localeService.getTranslatedString("MustBeAlphaNumericError"); showError = true; } if(showError){ controlService.showErrorMessage(errorMessage); return false; }*/ return true; } }
d61ea2f117d62fa41e2bc8934fd394d42d6d0655
776f7a8bbd6aac23678aa99b72c14e8dd332e146
/src/rx/Observable$14$1.java
f44796e665a2761206351a956fe6b0fa3c1da95b
[]
no_license
arvinthrak/com.nianticlabs.pokemongo
aea656acdc6aa419904f02b7331f431e9a8bba39
bcf8617bafd27e64f165e107fdc820d85bedbc3a
refs/heads/master
2020-05-17T15:14:22.431395
2016-07-21T03:36:14
2016-07-21T03:36:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
355
java
package rx; import rx.functions.Func1; class Observable$14$1 implements Func1<Notification<?>, Void> { Observable$14$1(Observable.14 param14) {} public Void call(Notification<?> paramNotification) { return null; } } /* Location: * Qualified Name: rx.Observable.14.1 * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
67f1f53c2b24900bb2feb5a88a24e9d88d5a2a8a
80e42c8fd902bd9277aeae1b1d6548101504f2cb
/Programming1/src/euler/problem52.java
e317b261c22dc47ad7e461b40c5831b1f636ad54
[]
no_license
salvo4u/programming
a9c5da603f481426dde3c57f568f674d1639c163
8c3a10bfbccfda346e8a59d482698b43162d2c2c
refs/heads/master
2022-03-02T12:18:52.870574
2022-02-06T15:45:30
2022-02-06T15:45:30
136,000,966
0
0
null
null
null
null
UTF-8
Java
false
false
1,131
java
package euler; import java.util.HashSet; public class problem52 { public static HashSet<Integer> getSet(String number) { HashSet<Integer> s = new HashSet<Integer>(); for (int i = 0; i < (number).length(); i++) { char ch = (number).charAt(i); s.add(ch - 48); } return s; } public static void main(String args[]) { int x = 0; for (;;) { x++; int x6 = 6 * x; int x5 = 5 * x; HashSet<Integer> s6 = getSet(x6 + ""); HashSet<Integer> s5 = getSet(x5 + ""); s6.removeAll(s5); if (s6.size() == 0) { int x4 = 4 * x; HashSet<Integer> s4 = getSet(x4 + ""); s5.removeAll(s4); if ( s5.size() == 0) { int x3 = 3 * x; HashSet<Integer> s3 = getSet(x3 + ""); s4.removeAll(s3); if (s4.size() == 0) { int x2 = 2 * x; HashSet<Integer> s2 = getSet(x2 + ""); s3.removeAll(s2); if (s3.size() == 0) { int x1 = x; HashSet<Integer> s1 = getSet(x1 + ""); s2.removeAll(s1); if(s2.size()==0) { System.out.println(x); break; } } } } } } } }
f495d1c89d5cf8e4f18b44c7e701b06013805a90
2d27deb430fe96c7d5c538c486882b6a5502f918
/dwr-demo/src/main/java/com/example/dwr/reactor/Sir.java
22015819931e3b741120510276a8a4544c1743ef
[]
no_license
heheshang/spring-cloud-dwr-demo
77a2af722b1aa3f7d602e405aac01d9772b65f79
b6f4c4912b3d8b729028279de6a9c25800c86ead
refs/heads/master
2020-04-25T02:36:25.901906
2019-02-25T06:22:34
2019-02-25T06:22:34
172,446,338
0
0
null
null
null
null
UTF-8
Java
false
false
351
java
package com.example.dwr.reactor; /** * @author ssk www.8win.com Inc.All rights reserved * @version v1.0 * @date 2019-02-25-上午 11:03 */ public class Sir { private String lastName; public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } }
3d6cd5b59f420e54e3f5dbd4ac8b8be1bfaaf914
b5f57690fb2dd5860afbe1defd1ae25fae688a1f
/rpclearn/src/com/rpclearn/rpc/RpcProvider.java
fae17bc9d5c9e25a2e21725749152fb6c9f513e2
[]
no_license
zhangxinzhou/demos
a117f94e737308029dea9e4947d36b99af37c10f
a9de4fbf5b79c2d356009d8da00a1d4199b7eeb8
refs/heads/master
2022-01-31T12:48:55.485187
2019-05-17T13:04:01
2019-05-17T13:04:01
87,510,766
0
0
null
null
null
null
UTF-8
Java
false
false
504
java
package com.rpclearn.rpc; import com.rpclearn.core.RpcFramework; import com.rpclearn.service.HelloService; /** * 引用服务 * @author Administrator * */ public class RpcProvider { public static void main(String[] args) throws Exception { HelloService service=RpcFramework.refer(HelloService.class, "127.0.0.1", 1234); for (int i = 0; i < Integer.MAX_VALUE; i++) { String hello=service.hello("world "+i); System.out.println(hello); Thread.sleep(1000); } } }
5032c7550583fda1a9d72ff57b5e65a567652939
500fab1143e8e04090e66e2abc8137910eaf14e7
/src/main/java/com/example/usertask/repositories/ColumnRepository.java
8a86470bc8d7e81f1c4dd4563f7cda792990a9bb
[]
no_license
baturalp-yoruk/UserTask
13e67009fc735b720c830985a01b83e1229922e0
e936cbf2a32c31238aaf9df05fafb70ff162506c
refs/heads/master
2022-02-24T09:14:44.474581
2020-05-11T15:20:57
2020-05-11T15:20:57
251,330,827
0
0
null
2022-02-10T05:58:22
2020-03-30T14:30:32
Java
UTF-8
Java
false
false
307
java
package com.example.usertask.repositories; import com.example.usertask.model.entity.ColumnEntity; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface ColumnRepository extends JpaRepository<ColumnEntity, Integer> { }
341e0036f2f7d9c0fcf3cf8c8de9573fb89bf3d8
d48f254cff557ce34dfad8d35923d151fb3723ac
/app/src/main/java/com/atguigu/bibiq/utils/TimeUtils.java
b69df1b34cc8f7c6a9a78576037b448a99e6d8ac
[]
no_license
642609666/BibiQ
cc6597c9ea3b69acb924c0112ccb07e1c39635b5
6ea3a456cf3f31c36591a6c22eb4cd69b90952c3
refs/heads/master
2021-01-22T22:44:47.968249
2017-04-07T02:52:47
2017-04-07T02:52:47
85,575,064
0
0
null
null
null
null
UTF-8
Java
false
false
5,859
java
package com.atguigu.bibiq.utils; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Formatter; import java.util.Locale; /** * Created by ${ * 李岩 * QQ/微信: 642609666} on 3/23 0023. * 功能:时间转换 */ public class TimeUtils { private StringBuilder mFormatBuilder; private Formatter mFormatter; public TimeUtils() { // 转换成字符串的时间 mFormatBuilder = new StringBuilder(); mFormatter = new Formatter(mFormatBuilder, Locale.getDefault()); } /** * 把毫秒转换成:1:20:30这里形式 * * @param timeMs * @return */ public String stringForTime(int timeMs) { int totalSeconds = timeMs / 1000; int seconds = totalSeconds % 60; int minutes = (totalSeconds / 60) % 60; int hours = totalSeconds / 3600; mFormatBuilder.setLength(0); if (hours > 0) { return mFormatter.format("%d:%02d:%02d", hours, minutes, seconds) .toString(); } else { return mFormatter.format("%02d:%02d", minutes, seconds).toString(); } } /** * 从时间(毫秒)中提取出日期 * * @param millisecond * @return */ public static String getDateFromMillisecond(Long millisecond) { Date date = null; try { date = new Date(millisecond); } catch (Exception e) { e.printStackTrace(); } Calendar current = Calendar.getInstance(); ////今天 Calendar today = Calendar.getInstance(); today.set(Calendar.YEAR, current.get(Calendar.YEAR)); today.set(Calendar.MONTH, current.get(Calendar.MONTH)); today.set(Calendar.DAY_OF_MONTH, current.get(Calendar.DAY_OF_MONTH)); // Calendar.HOUR——12小时制的小时数 Calendar.HOUR_OF_DAY——24小时制的小时数 today.set(Calendar.HOUR_OF_DAY, 0); today.set(Calendar.MINUTE, 0); today.set(Calendar.SECOND, 0); //昨天 Calendar yesterday = Calendar.getInstance(); yesterday.set(Calendar.YEAR, current.get(Calendar.YEAR)); yesterday.set(Calendar.MONTH, current.get(Calendar.MONTH)); yesterday.set(Calendar.DAY_OF_MONTH, current.get(Calendar.DAY_OF_MONTH) - 1); yesterday.set(Calendar.HOUR_OF_DAY, 0); yesterday.set(Calendar.MINUTE, 0); yesterday.set(Calendar.SECOND, 0); // 今年 Calendar thisYear = Calendar.getInstance(); thisYear.set(Calendar.YEAR, current.get(Calendar.YEAR)); thisYear.set(Calendar.MONTH, 0); thisYear.set(Calendar.DAY_OF_MONTH, 0); thisYear.set(Calendar.HOUR_OF_DAY, 0); thisYear.set(Calendar.MINUTE, 0); thisYear.set(Calendar.SECOND, 0); current.setTime(date); //今年以前 if (current.before(thisYear)) { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); String dateStr = format.format(date); return dateStr; } else if (current.after(today)) { return "今天"; } else if (current.before(today) && current.after(yesterday)) { return "昨天"; } else { SimpleDateFormat format = new SimpleDateFormat("MM-dd"); String dateStr = format.format(date); return dateStr; } } /** * 从时间(毫秒)中提取出时间(时:分) * 时间格式: 时:分 * * @param millisecond * @return */ public static String getTimeFromMillisecond(int millisecond) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm"); Date date = new Date(millisecond); String timeStr = simpleDateFormat.format(date); return timeStr; } /** * 将毫秒转化成固定格式的时间 * 时间格式: yyyy-MM-dd HH:mm:ss * * @param millisecond * @return */ public static String getDateTimeFromMillisecond(Long millisecond) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = new Date(millisecond); String dateStr = simpleDateFormat.format(date); return dateStr; } /** * 将时间转化成毫秒 * 时间格式: yyyy-MM-dd HH:mm:ss * * @param time * @return */ public static Long timeStrToSecond(String time) { try { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Long second = format.parse(time).getTime(); return second; } catch (Exception e) { e.printStackTrace(); } return -1l; } /** * 获取时间间隔 * * @param millisecond * @return */ public static String getSpaceTime(Long millisecond) { Calendar calendar = Calendar.getInstance(); Long currentMillisecond = calendar.getTimeInMillis(); //间隔秒 Long spaceSecond = (currentMillisecond - millisecond) / 1000; //一分钟之内 if (spaceSecond >= 0 && spaceSecond < 60) { return "片刻之前"; } //一小时之内 else if (spaceSecond / 60 > 0 && spaceSecond / 60 < 60) { return spaceSecond / 60 + "分钟之前"; } //一天之内 else if (spaceSecond / (60 * 60) > 0 && spaceSecond / (60 * 60) < 24) { return spaceSecond / (60 * 60) + "小时之前"; } //3天之内 else if (spaceSecond / (60 * 60 * 24) > 0 && spaceSecond / (60 * 60 * 24) < 3) { return spaceSecond / (60 * 60 * 24) + "天之前"; } else { return getDateTimeFromMillisecond(millisecond); } } }
e9a44dad180c3b4cfabf214c53c3542276fa1262
d0949d17755f681e015fc499422781b0cbaac8dd
/app/src/main/java/com/semantic/ecare_android_v2/object/Patient.java
9b8caff162b8e7e202a9653fe913c475daa72cbe
[]
no_license
Aimen-el/eCare
c216ff285d9c5b3c4088f17e4b4f6903796d7791
8641b3dbf101e942512a8f93c1abe4bb26e8418b
refs/heads/master
2021-05-07T23:46:38.882816
2017-10-26T10:01:45
2017-10-26T10:01:45
107,531,174
0
0
null
null
null
null
UTF-8
Java
false
false
2,213
java
package com.semantic.ecare_android_v2.object; import android.util.SparseArray; import java.util.ArrayList; public class Patient{ private int id; private String uid; private int gender=1; private String name=""; private String address=""; private String surname=""; private SparseArray<ArrayList<UserConstant>> userConstants; private String symptome=""; private String note=""; private String noteDate=""; //TODO : Avoir aussi al liste des constantes médicales public Patient(int id,String uid, int gender, String name, String address, String surname, String symptome, String note, String noteDate){ this.id=id; this.uid=uid; this.gender=gender; this.name=name; this.address=address; this.surname=surname; this.symptome=symptome; this.note=note; this.noteDate=noteDate; this.userConstants = new SparseArray<ArrayList<UserConstant>>(); } public int getGender() { return gender; } public void setGender(int gender) { this.gender = gender; } public String getUid() { return uid; } public void setUid(String uid) { this.uid = uid; } public String getName() { return name; } public String getAddress() { return address; } public void setName(String name) { this.name = name; } public void setAddress(String address) { this.address = address; } public String getSurname() { return surname; } public void setSurname(String surname) { this.surname = surname; } public SparseArray<ArrayList<UserConstant>> getUserConstants() { return userConstants; } public void setRanges(SparseArray<ArrayList<UserConstant>> userConstants) { this.userConstants = userConstants; } public String getSymptome(){ return symptome; } public void setSymptome(String symptome){ this.symptome=symptome; } public String getNote(){ return note; } public String getNoteDate(){ return noteDate; } public void setNote(String note){ this.note=note; } public void setNoteDate(String noteDate){ this.noteDate=noteDate; } public int getId() { return id; } public void setId(int id) { this.id = id; } public void updateNote(NoteModel note){ this.note = note.getNote(); this.noteDate = note.getNoteDate(); } }
f00d821964886c0a82e0eae7d231ed8cc678ba4f
5b26a7924f4653b0400eb38695d91f40cb104aeb
/src/zelenov/patterns/creational/abstractFactory/banking/BankingTeamFactory.java
f56462f2b20fb4a256387d02e1659ad9a002873e
[]
no_license
ZelenovVA/Base-patterns-with-description-and-implementation
33806fbd7572e1c20cfdad4ba118e188b1e0948d
df2dc24856def37ac4794e13f90253fcde0be552
refs/heads/master
2022-12-20T14:29:00.512986
2020-09-24T18:03:57
2020-09-24T18:03:57
296,717,353
0
0
null
null
null
null
UTF-8
Java
false
false
660
java
package zelenov.patterns.creational.abstractFactory.banking; import zelenov.patterns.creational.abstractFactory.Developer; import zelenov.patterns.creational.abstractFactory.ProjectManager; import zelenov.patterns.creational.abstractFactory.ProjectTeamFactory; import zelenov.patterns.creational.abstractFactory.Tester; public class BankingTeamFactory implements ProjectTeamFactory { @Override public Developer getDeveloper() { return new JavaDeveloper(); } @Override public Tester getTester() { return new QATester(); } @Override public ProjectManager getManager() { return new BankingPM(); } }
0642728cabddd29b4a011d81d853df14f2fdd36d
d57fd3eb73ff21d7267b7c5866f1a81a2fc322d9
/11a-hello-world/src/HelloWorld.java
d247426856b232696d86310da6c30a7fa89b8e74
[]
no_license
sirishrenukumar/core-java-basic
1398aea83925a9fcd8bf18533e80ce0bd9a55f89
3c1ea5264020072c874a0f35f42f2ba51f365051
refs/heads/master
2021-01-18T18:16:31.562527
2015-08-10T13:14:53
2015-08-10T13:14:53
40,402,186
2
0
null
null
null
null
UTF-8
Java
false
false
884
java
/** * Sample class the demonstrates the simplest Java application * @author sirishr * * public - access specifier, controls the access of this code from other parts of the application * * class - keyword, that indicates that this is a class definition. Everything resides in a class! * * HelloWorld - name of the class * * static - similar to static members in C++ * * void - no result is returned * * main - method (similar to member function in C++) * * String - datatype */ public class HelloWorld { /** * This is a documentation comment that can be used to generate documentation (javadoc tool) * @param args */ public static void main(String[] args) { /* * This is a multiline comment */ //This is a single line comment System.out.println("Hello world. Welcome to the world of Java"); } }
c4a3f9a2defb3a0fda9627850c52b6429557289a
ebfa21baa9715c532d0ec3af35965208597c61b5
/passagem-aerea/src/com/algaworks/service/CalculadoraPrecoPassagem.java
d43582d29b0e5a15c3f2415f6de23799c35d22d0
[]
no_license
ApoenaFSGebur/GFT-
07b2a50ebae2664c4de3d56941a8869be3679638
34caa070bf094442f8a0b30d02b78e529566ecdd
refs/heads/master
2022-12-29T02:09:38.863122
2020-04-01T15:51:05
2020-04-01T15:51:05
236,537,922
0
0
null
2020-10-13T20:50:02
2020-01-27T16:36:39
Java
UTF-8
Java
false
false
148
java
package com.algaworks.service; import com.algaworks.model.Voo; public interface CalculadoraPrecoPassagem { public double calcular( Voo voo); }
a00467a9367f1260db814714c0025f6e4a5f8875
06d539739b7d7fb6b99a67c16f4f93ce0de8561a
/src/firstgrage/loop/DoWhileExam02.java
9f000a661456a72a5b1228119b6cad7bdc9c6114
[]
no_license
coding-guide/DoIt
407852236a975d522938fb30bc79f204cd4dd5c7
b87db0ce88761c5f72172f4a7e12343a5aba7c68
refs/heads/master
2022-12-25T22:31:12.750994
2020-10-02T11:13:49
2020-10-02T11:13:49
290,527,863
0
0
null
null
null
null
UTF-8
Java
false
false
493
java
package firstgrage.loop; import java.util.Scanner; public class DoWhileExam02 { public static void main(String[] args) { // 키보드로 정수 N을 입력받아 0부터 N까지 출력하시오. Scanner in = new Scanner(System.in); System.out.println("숫자 N을 입력하세요>>>"); int inputNumber = in.nextInt(); System.out.println("---0부터 숫자 N까지의 수 나열하기---"); int i = 0; do { System.out.print(i + " "); i++; }while(i <= inputNumber); } }
fbb10691f52f36b2c2799fae7ef2936aa53d096a
af06dc36b55703f50da9ff91c3fd038b1a6c0d9f
/observer/PatternTest.java
6e037f3dbe22ea658225b554ae40b00dbec70070
[]
no_license
pawelztef/java-design-patterns
fb77b509df3f319c4dc635367cc9d9d65949db39
3327834989eb66ecb0435b6e7af9d30c94d12bd5
refs/heads/master
2020-09-04T04:09:53.588468
2020-01-02T06:12:57
2020-01-03T13:41:21
219,654,263
0
0
null
null
null
null
UTF-8
Java
false
false
381
java
public class PatternTest { public static void main(String... args) { StockGrabber stockGrabber = new StockGrabber(); StockObserver stockObserver1 = new StockObserver(stockGrabber); StockObserver stockObserver2 = new StockObserver(stockGrabber); stockGrabber.setImbPrice(197.600); stockGrabber.setAppPrice(302.600); stockGrabber.setGooPrice(223.700); } }
cb5e5713ae4d590c9dbb07bee31b4d0d56e2ad9f
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/MATH-60b-5-24-PESA_II-WeightedSum:TestLen:CallDiversity/org/apache/commons/math/distribution/NormalDistributionImpl_ESTest.java
5a5316857103e043bdb761a9cf2652e7bc797477
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
587
java
/* * This file was automatically generated by EvoSuite * Sun Jan 19 18:15:26 UTC 2020 */ package org.apache.commons.math.distribution; import org.junit.Test; import static org.junit.Assert.*; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true) public class NormalDistributionImpl_ESTest extends NormalDistributionImpl_ESTest_scaffolding { @Test public void notGeneratedAnyTest() { // EvoSuite did not generate any tests } }
3098c376cf956291741963d251da9191a5415fdd
be8f88d297706b3fb2c2cde2023041d0a27858b0
/app/src/androidTest/java/com/example/epomeroy/accounts/SavingsAccount.java
ed207fee1bf0fbfcf4f516b64a5857a1bb140832
[]
no_license
EarlPomeroy/MyBank
2ac501994ab78fb6471623bfec3b07fa1ff0d3d5
7bba301e977cb41d38aea3c3f6da0215d3928415
refs/heads/master
2021-05-29T14:33:20.311221
2015-09-12T21:31:17
2015-09-12T21:31:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
308
java
package com.example.epomeroy.accounts; /** * Created by epomeroy on 9/12/15. */ public class SavingsAccount extends BankAccount { @Override public void withdraw(double amount) { if ( this.getNumberOfWithdraw() >= 3) { return; } super.withdraw(amount); } }
12f93816f965309fa0a1d56423c748d20a7f89ae
385809f67f807e462e2abfe139f74b32813aaaa7
/src/han/util/JPattern.java
cee0ad6b0b067979fbb677c2a4a981f1bd26f8dc
[]
no_license
shiftcat/juser-board
812a26e4c8a2c367d9700d644e38ede87a1da701
47193f063ccde0f1fefb106391dbe9bdc0d73100
refs/heads/master
2020-03-30T08:37:33.906715
2018-10-01T03:09:56
2018-10-01T03:09:56
151,029,127
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
1,862
java
package han.util; import java.util.regex.Pattern; public class JPattern { private static final String userIdPattern; private static final String hanglPattern; private static final String emailPattern; private static final String passwdPattern; private static final String juminPattern; private static final String phoneNumberPattern; private static final String mobileNumberPattern; static { userIdPattern = "^[a-zA-Z][a-zA-Z0-9]{3,7}"; emailPattern = "^[a-zA-Z0-9-]+@[a-zA-Z0-9-]+(\\.[a-zA-Z-]+)+$"; hanglPattern = "[\uAC00-\uD7A3¤¡-¤¾¤¿-¤Ó]{2,10}"; passwdPattern = "\\p{Graph}{4,8}"; juminPattern = "[0-9]{6}-[0-9]{7}"; phoneNumberPattern = "^[0][1-9]{1,2}-[0-9]{3,4}-[0-9]{4}"; mobileNumberPattern = "^01[0-9]{1}-[0-9]{3,4}-[0-9]{4}"; } public JPattern() { } public static boolean userId(String userid) { if( Pattern.matches(userIdPattern, userid) ) { return true; } return false; } public static boolean hanglName(String name) { if( Pattern.matches(hanglPattern, name) ) { return true; } return false; } public static boolean email(String email) { if( Pattern.matches( emailPattern, email ) ) { return true; } return false; } public static boolean passwd(String passwd) { if( Pattern.matches( passwdPattern, passwd ) ) { return true; } return false; } public static boolean jumin(String jumin) { if( Pattern.matches( juminPattern, jumin ) ) { return true; } return false; } public static boolean phone(String phone) { if( Pattern.matches(phoneNumberPattern, phone ) ) { return true; } return false; } public static boolean mobile(String mobile) { if( Pattern.matches( mobileNumberPattern, mobile ) ) { return true; } return false; } }
9fe9036414f572a160db44b8623f5092963bdf56
7156ec6c2cc73f82e617c516fc52c05b7704f154
/Java/_100_same_tree.java
9011efcc6ec582b7557f27b455090074c3dde8b7
[]
no_license
dreamgazer/LeetGryphon
b4f2562f574bb520a8a06de410c94bac172a99e2
10b7777bf97b4df0ca1dfbaa238e43ff5e8d5031
refs/heads/master
2020-03-22T21:46:46.397441
2019-04-15T21:59:56
2019-04-15T21:59:56
140,713,257
1
0
null
null
null
null
UTF-8
Java
false
false
520
java
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ class Solution { public boolean isSameTree(TreeNode p, TreeNode q) { if(p == null && q == null) return true; if(p == null || q == null) return false; if(p.val == q.val){ return isSameTree(p.left, q.left)&&isSameTree(p.right, q.right); } else{ return false; } } }
e2b84f50923489a037ad9a46d1b5612859aeaec3
b71a7ead976ff0147bcc9430cab97ae8819c96e9
/app/src/main/java/com/vipulfb/hn/models/MasterItem.java
1430318d82012ed7dde398ec727fc89fa7446403
[]
no_license
vipulfb/hn_cool
a204d24d2e8512907b4320a791baa9122badc2b4
7a4f667b5780bc06a26dd60af731fa891be6f024
refs/heads/master
2020-12-31T07:32:15.978887
2016-05-07T09:05:28
2016-05-07T09:05:28
58,258,328
0
0
null
null
null
null
UTF-8
Java
false
false
1,087
java
package com.vipulfb.hn.models; import com.google.gson.annotations.SerializedName; import java.util.ArrayList; /** * Created by Vipul Sharma on 5/7/2016. */ public class MasterItem { private String by; private String id; @SerializedName("kids") private ArrayList<String> commentsIdList = new ArrayList<>(); private String time; private String type; public String getBy() { return by; } public void setBy(String by) { this.by = by; } public String getId() { return id; } public void setId(String id) { this.id = id; } public ArrayList<String> getCommentsIdList() { return commentsIdList; } public void setCommentsIdList(ArrayList<String> commentsIdList) { this.commentsIdList = commentsIdList; } public String getTime() { return time; } public void setTime(String time) { this.time = time; } public String getType() { return type; } public void setType(String type) { this.type = type; } }
04b27806f76a493bbe44866e9f98c44c3971342b
8b5186f23dc859275cab7d768b14f61a3483ea24
/src/main/java/net/coderlin/java/demo/pattern/singleton/HungrySingleton.java
7f48ba2190b8d4833a11aab3e6a5295aa95663cc
[]
no_license
linhui0705/java-demo
396430fe5faf32318a2d7d18ed46ddf701fc07b2
f3a6772b4ca4d790c312780a783bc9e03c31b475
refs/heads/master
2022-12-28T22:30:40.732297
2020-12-06T06:53:14
2020-12-06T06:53:14
239,146,444
0
0
null
2022-12-16T05:11:59
2020-02-08T14:34:17
Java
UTF-8
Java
false
false
564
java
package net.coderlin.java.demo.pattern.singleton; /** * Title: HungrySingleton * Description: * 饿汉式 * 是否Lazy初始化:否 * 是否多线程安全:是 * 实现难度:易 * * @author Lin Hui * Created on 2020/2/17 10:29 下午 */ public class HungrySingleton { private static HungrySingleton INSTANCE = new HungrySingleton(); private HungrySingleton() { } public static HungrySingleton getInstance() { return INSTANCE; } public void print() { System.out.println("Hello HungrySingleton"); } }
cce457cd48524a629728a82f9ca839ee1af4a48d
e315c2bb2ea17cd8388a39aa0587e47cb417af0a
/configGenerale/tn/com/smartsoft/configGenerale/devises/devise/presentation/model/DeviseModel.java
f7b2ff3be932afa42740eb2d19e776efc89aa1ff
[]
no_license
wissem007/badges
000536a40e34e20592fe6e4cb2684d93604c44c9
2064bd07b52141cf3cff0892e628cc62b4f94fdc
refs/heads/master
2020-12-26T14:06:11.693609
2020-01-31T23:40:07
2020-01-31T23:40:07
237,530,008
0
0
null
null
null
null
UTF-8
Java
false
false
452
java
package tn.com.smartsoft.configGenerale.devises.devise.presentation.model; import java.util.List; import tn.com.smartsoft.framework.presentation.model.GenericEntiteModel; public class DeviseModel extends GenericEntiteModel { /** * */ private static final long serialVersionUID = 1L; /*private List listPays; public List getListPays() { return listPays; } public void setListPays(List listPays) { this.listPays = listPays; }*/ }
e738adbfcb11fb97e16ff7083da6c3b9500189e9
44afdb736f7ba8c29484b538a8599cd128694d80
/src/test/java/com/sample/test/demo/tests/DemoTest.java
a1c4371d95181745b49cd0c4e686d22da277c169
[]
no_license
SHanmapur/SQEDemonstrationChallengeUIProject
14a3546457931bf7656015302334bd5306e6331c
585b4321e5f4003e9aef622279049aa9ceca2f38
refs/heads/master
2023-02-05T15:07:40.539320
2020-12-24T16:37:11
2020-12-24T16:37:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,595
java
package com.sample.test.demo.tests; import org.testng.annotations.Test; import com.sample.test.demo.TestBase; import com.sample.test.demo.constants.PizzaToppings; import com.sample.test.demo.constants.PizzaTypes; import pages.OrderPage; public class DemoTest extends TestBase { @Test(description = "This Test case is POSITVE scenario - which takes all inputs and places an order then verifys success message") public void placeAnOrderTest() { OrderPage op = new OrderPage(driver); op.selectPizaType(PizzaTypes.MEDIUM_TWOTOPPINGS.getDisplayName()); op.selectPizaToppingsOption1(PizzaToppings.OLIVES.getDisplayName()); op.selectPizaToppingsOption2(PizzaToppings.MUSHROOMS.getDisplayName()); op.chosePizzaQuantity("2"); op.enterAddress("Swetha", "9987664455", "[email protected]"); op.choosePaymentMethod("cc"); op.placeOrder(); op.verifyThatOderPlaced(PizzaTypes.MEDIUM_TWOTOPPINGS.getDisplayName()); } @Test(description = "This Test case is Negative scenario - which takes all inputs except payment and places an order then verifys that oder should not be placed ") public void placeAnOrderWithOutPaymentTest() { OrderPage op = new OrderPage(driver); op.selectPizaType(PizzaTypes.MEDIUM_TWOTOPPINGS.getDisplayName()); op.selectPizaToppingsOption1(PizzaToppings.OLIVES.getDisplayName()); op.selectPizaToppingsOption2(PizzaToppings.MUSHROOMS.getDisplayName()); op.chosePizzaQuantity("2"); op.enterAddress("Swetha", "9987664455", "[email protected]"); op.placeOrder(); op.verifyThatOderPlaced(PizzaTypes.MEDIUM_TWOTOPPINGS.getDisplayName()); } }
abefcc4f7c6cf49f6e43f7ed3e37046574f02066
32104e21fb50d8adc455eb7a47d39bcd0c2b9502
/CANTalonRot (WIP)/src/org/usfirst/frc/team2180/robot/commands/GearPickup2.java
e14edf40bd1d9ee8e0b83e0a18c0dc20c562b2dc
[]
no_license
wa3kij/FRC-Team-2180-2017-
f0b953e48de9313e4fc12ba298d75a072e8daf14
dc81255cb8f62c3367c54cdab73ea150d4d13224
refs/heads/master
2021-01-19T10:34:26.825135
2017-02-15T23:02:56
2017-02-15T23:02:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
784
java
package org.usfirst.frc.team2180.robot.commands; import org.usfirst.frc.team2180.robot.Robot; import com.ctre.CANTalon; import edu.wpi.first.wpilibj.command.Command; public class GearPickup2 extends Command { int ang=0; public GearPickup2(){} protected void initialize(){ ang=2; } protected void execute(){ while (true) { Robot.gear.set(Robot.seekDir(Robot.gear.getAnalogInRaw(),ang,0.3)); } } protected boolean isFinished(){ boolean fin; if(Robot.iformat(Robot.gear.getAnalogInRaw()+Robot.MoE)>ang){ fin=false; }else if(Robot.iformat(Robot.gear.getAnalogInRaw()+Robot.MoE)>ang){ fin=false; }else{ fin=true; } return false; } protected void end(){} protected void interrupted(){} }
a09bf5480f9c6dabcf44f06176cb9f21c111b62c
8ba06c2dcf2b2342b140b28f8f6055ee420faa20
/src/main/java/com/wangxile/springioc/beandefinition/BeanDefinition.java
8e405b34c3362fc75ac2154dd6ea6fe3d00c0543
[]
no_license
wangxile/spring-ioc
0289ece8ddef02f209eff380dc52c9dabaab818e
f5cfaf372616a808c68c0cd5f1e1856e54e11914
refs/heads/master
2020-08-23T05:53:26.673840
2019-10-22T09:42:16
2019-10-22T09:42:16
216,557,335
0
0
null
null
null
null
UTF-8
Java
false
false
285
java
package com.wangxile.springioc.beandefinition; import lombok.Data; /** * @Author:wangqi * @Description: * @Date:Created in 2019/10/21 * @Modified by: */ @Data public class BeanDefinition { private String className; private String alias; private String superNames; }
002dbb1dfac4468aa91666d2dffaef0609907737
56fa5184e7fc46c60f340b38fa8988b4461e2533
/blur-indexer/src/main/java/org/apache/blur/indexer/MergeSortRowIdMatcher.java
66cd2ac77e6e6578b28da547ab6c7e0a40947b22
[ "Apache-2.0", "MIT", "BSD-3-Clause" ]
permissive
ThePrathamOS/incubator-blur
1bf5e62bb7c449eec8081a9d46dbcec373834d28
078f789bcbe0e3ac9e6945df5d01821c4b946462
refs/heads/master
2020-03-19T11:00:59.554787
2017-06-22T12:06:31
2017-06-22T12:06:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
12,999
java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.blur.indexer; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Comparator; import java.util.List; import java.util.Set; import java.util.TreeSet; import java.util.UUID; import java.util.concurrent.TimeUnit; import org.apache.blur.index.AtomicReaderUtil; import org.apache.blur.log.Log; import org.apache.blur.log.LogFactory; import org.apache.blur.store.hdfs.DirectoryDecorator; import org.apache.blur.store.hdfs.HdfsDirectory; import org.apache.blur.utils.BlurConstants; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.BlockLocation; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.HdfsBlockLocation; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.protocol.ExtendedBlock; import org.apache.hadoop.hdfs.protocol.LocatedBlock; import org.apache.hadoop.io.NullWritable; import org.apache.hadoop.io.SequenceFile; import org.apache.hadoop.io.SequenceFile.CompressionType; import org.apache.hadoop.io.SequenceFile.Reader; import org.apache.hadoop.io.SequenceFile.Writer; import org.apache.hadoop.io.Text; import org.apache.hadoop.io.compress.CompressionCodec; import org.apache.hadoop.io.compress.DeflateCodec; import org.apache.hadoop.io.compress.GzipCodec; import org.apache.hadoop.io.compress.zlib.ZlibFactory; import org.apache.hadoop.util.Progressable; import org.apache.lucene.index.AtomicReaderContext; import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.IndexCommit; import org.apache.lucene.index.SegmentInfo; import org.apache.lucene.index.SegmentInfoPerCommit; import org.apache.lucene.index.SegmentInfos; import org.apache.lucene.index.SegmentReader; import org.apache.lucene.index.Terms; import org.apache.lucene.index.TermsEnum; import org.apache.lucene.store.Directory; import org.apache.lucene.util.BytesRef; public class MergeSortRowIdMatcher { private static final String DEL = ".del"; private static final Log LOG = LogFactory.getLog(MergeSortRowIdMatcher.class); private static final Progressable NO_OP = new Progressable() { @Override public void progress() { } }; private static final long _10_SECONDS = TimeUnit.SECONDS.toNanos(10); public interface Action { void found(Text rowId) throws IOException; } private final MyReader[] _readers; private final Configuration _configuration; private final Path _cachePath; private final IndexCommit _indexCommit; private final Directory _directory; private final Progressable _progressable; private DirectoryReader _reader; public MergeSortRowIdMatcher(Directory directory, long generation, Configuration configuration, Path cachePath) throws IOException { this(directory, generation, configuration, cachePath, null); } public MergeSortRowIdMatcher(Directory directory, long generation, Configuration configuration, Path cachePath, Progressable progressable) throws IOException { List<IndexCommit> listCommits = DirectoryReader.listCommits(directory); _indexCommit = findIndexCommit(listCommits, generation); _configuration = configuration; _cachePath = cachePath; _directory = directory; _progressable = progressable == null ? NO_OP : progressable; _readers = openReaders(); } public void lookup(Text rowId, Action action) throws IOException { if (lookup(rowId)) { action.found(rowId); } } private boolean lookup(Text rowId) throws IOException { advanceReadersIfNeeded(rowId); sortReaders(); return checkReaders(rowId); } private boolean checkReaders(Text rowId) { for (MyReader reader : _readers) { int compareTo = reader.getCurrentRowId().compareTo(rowId); if (compareTo == 0) { return true; } else if (compareTo > 0) { return false; } } return false; } private void advanceReadersIfNeeded(Text rowId) throws IOException { _progressable.progress(); for (MyReader reader : _readers) { if (rowId.compareTo(reader.getCurrentRowId()) > 0) { advanceReader(reader, rowId); } } } private void advanceReader(MyReader reader, Text rowId) throws IOException { while (reader.next()) { if (rowId.compareTo(reader.getCurrentRowId()) <= 0) { return; } } } private static final Comparator<MyReader> COMP = new Comparator<MyReader>() { @Override public int compare(MyReader o1, MyReader o2) { return o1.getCurrentRowId().compareTo(o2.getCurrentRowId()); } }; private void sortReaders() { Arrays.sort(_readers, COMP); } private MyReader[] openReaders() throws IOException { Collection<SegmentKey> segmentKeys = getSegmentKeys(); MyReader[] readers = new MyReader[segmentKeys.size()]; int i = 0; for (SegmentKey segmentKey : segmentKeys) { readers[i++] = openReader(segmentKey); } return readers; } private MyReader openReader(SegmentKey segmentKey) throws IOException { Path file = getCacheFilePath(segmentKey); FileSystem fileSystem = _cachePath.getFileSystem(_configuration); if (!fileSystem.exists(file)) { createCacheFile(file, segmentKey); } Reader reader = new SequenceFile.Reader(_configuration, SequenceFile.Reader.file(file)); return new MyReader(reader); } private void createCacheFile(Path file, SegmentKey segmentKey) throws IOException { LOG.info("Building cache for segment [{0}] to [{1}]", segmentKey, file); Path tmpPath = getTmpWriterPath(file.getParent()); try (Writer writer = createWriter(_configuration, tmpPath)) { DirectoryReader reader = getReader(); for (AtomicReaderContext context : reader.leaves()) { SegmentReader segmentReader = AtomicReaderUtil.getSegmentReader(context.reader()); if (segmentReader.getSegmentName().equals(segmentKey.getSegmentName())) { writeRowIds(writer, segmentReader); break; } } } commitWriter(_configuration, file, tmpPath); } public static void commitWriter(Configuration configuration, Path file, Path tmpPath) throws IOException { FileSystem fileSystem = tmpPath.getFileSystem(configuration); LOG.info("Commit tmp [{0}] to file [{1}]", tmpPath, file); if (!fileSystem.rename(tmpPath, file)) { LOG.warn("Could not commit tmp file [{0}] to file [{1}]", tmpPath, file); } } public static Path getTmpWriterPath(Path dir) { return new Path(dir, UUID.randomUUID().toString() + ".tmp"); } public static Writer createWriter(Configuration configuration, Path tmpPath) throws IOException { return SequenceFile.createWriter(configuration, SequenceFile.Writer.file(tmpPath), SequenceFile.Writer.keyClass(Text.class), SequenceFile.Writer.valueClass(NullWritable.class), SequenceFile.Writer.compression(CompressionType.BLOCK, getCodec(configuration))); } private static CompressionCodec getCodec(Configuration configuration) { if (ZlibFactory.isNativeZlibLoaded(configuration)) { return new GzipCodec(); } return new DeflateCodec(); } private void writeRowIds(Writer writer, SegmentReader segmentReader) throws IOException { Terms terms = segmentReader.terms(BlurConstants.ROW_ID); if (terms == null) { return; } TermsEnum termsEnum = terms.iterator(null); BytesRef rowId; long s = System.nanoTime(); while ((rowId = termsEnum.next()) != null) { long n = System.nanoTime(); if (n + _10_SECONDS > s) { _progressable.progress(); s = System.nanoTime(); } writer.append(new Text(rowId.utf8ToString()), NullWritable.get()); } } private IndexCommit findIndexCommit(List<IndexCommit> listCommits, long generation) throws IOException { for (IndexCommit commit : listCommits) { if (commit.getGeneration() == generation) { return commit; } } throw new IOException("Generation [" + generation + "] not found."); } static class SegmentKey { final String _segmentName; final String _id; SegmentKey(String segmentName, String id) throws IOException { _segmentName = segmentName; _id = id; } String getSegmentName() { return _segmentName; } @Override public String toString() { return _id; } } private DirectoryReader getReader() throws IOException { if (_reader == null) { _reader = DirectoryReader.open(_indexCommit); } return _reader; } private Collection<SegmentKey> getSegmentKeys() throws IOException { List<SegmentKey> keys = new ArrayList<SegmentKey>(); SegmentInfos segmentInfos = new SegmentInfos(); segmentInfos.read(_directory, _indexCommit.getSegmentsFileName()); for (SegmentInfoPerCommit segmentInfoPerCommit : segmentInfos) { String name = segmentInfoPerCommit.info.name; String id = getId(segmentInfoPerCommit.info); keys.add(new SegmentKey(name, id)); } return keys; } private String getId(SegmentInfo si) throws IOException { HdfsDirectory dir = getHdfsDirectory(si.dir); Set<String> files = new TreeSet<String>(si.files()); return getId(_configuration, dir, files); } private static String getId(Configuration configuration, HdfsDirectory dir, Set<String> files) throws IOException { long ts = 0; String file = null; for (String f : files) { if (f.endsWith(DEL)) { continue; } long fileModified = dir.getFileModified(f); if (fileModified > ts) { ts = fileModified; file = f; } } Path path = dir.getPath(); FileSystem fileSystem = path.getFileSystem(configuration); Path realFile = new Path(path, file); if (!fileSystem.exists(realFile)) { realFile = dir.getRealFilePathFromSymlink(file); if (!fileSystem.exists(realFile)) { throw new IOException("Lucene file [" + file + "] for dir [" + path + "] can not be found."); } } return getFirstBlockId(fileSystem, realFile); } public static String getIdForSingleSegmentIndex(Configuration configuration, Path indexPath) throws IOException { HdfsDirectory dir = new HdfsDirectory(configuration, indexPath); Set<String> files = new TreeSet<String>(Arrays.asList(dir.listAll())); return getId(configuration, dir, files); } private static String getFirstBlockId(FileSystem fileSystem, Path realFile) throws IOException { FileStatus fileStatus = fileSystem.getFileStatus(realFile); BlockLocation[] locations = fileSystem.getFileBlockLocations(fileStatus, 0, 1); HdfsBlockLocation location = (HdfsBlockLocation) locations[0]; LocatedBlock locatedBlock = location.getLocatedBlock(); ExtendedBlock block = locatedBlock.getBlock(); return toNiceString(block.getBlockId()); } private static String toNiceString(long blockId) { return "b" + blockId; } private static HdfsDirectory getHdfsDirectory(Directory dir) { if (dir instanceof HdfsDirectory) { return (HdfsDirectory) dir; } else if (dir instanceof DirectoryDecorator) { DirectoryDecorator dd = (DirectoryDecorator) dir; return getHdfsDirectory(dd.getOriginalDirectory()); } else { throw new RuntimeException("Unknown directory type."); } } private Path getCacheFilePath(SegmentKey segmentKey) { return new Path(_cachePath, segmentKey + ".seq"); } static class MyReader { final Reader _reader; final Text _rowId = new Text(); boolean _finished = false; public MyReader(Reader reader) { _reader = reader; } public Text getCurrentRowId() { return _rowId; } public boolean next() throws IOException { if (_finished) { return false; } if (_reader.next(_rowId)) { return true; } _finished = true; return false; } public boolean isFinished() { return _finished; } } public static Path getCachePath(Path cachePath, String table, String shardName) { return new Path(new Path(cachePath, table), shardName); } }
66254eb0537aed107ab17a3158e99dbb76c04369
49c06b467242fb31559e841752e1df4f4245a9e2
/src/structural/adapter/src/Client.java
a21f7a6ce3543ecc4d5f435bfbcc1addea2cb56b
[]
no_license
luafabio/design-patterns
e361a6d4f40ab821a3c7a9e3e3003751cfd2004a
a1eb16b0ad98a401295b549d306db63f29b96d23
refs/heads/master
2021-04-21T17:40:22.011364
2020-03-24T21:35:13
2020-03-24T21:35:13
249,800,795
0
0
null
null
null
null
UTF-8
Java
false
false
495
java
package structural.adapter.src; public class Client { public static void main(String[] args) { Client client = new Client(); LegacyRectangle legacyRectangle = new LegacyRectangle(); LegacyRectangleAdapter adapter = new LegacyRectangleAdapter(legacyRectangle); client.calculateRectangleSize(adapter); } public void calculateRectangleSize(Rectangle rectangle) { System.out.println("Rectangle size: " + rectangle.determineSize()); } }
7d1ef3ae1c208bdb92a2f61d9948a1c0f5c7eeb4
45d645a0f684f6ccb69e5fc69a56db97c79076b3
/lemon-framework/lemon-framework-common/src/main/java/com/hisun/lemon/framework/annotation/LemonBody.java
125d49c03f2bcff578e92f811c839f217bdd88fc
[]
no_license
learndockering/framework
fe1826f86d15a6ec01c1b532f09b214d80fd571d
0e28e71ef9285e9335be32cec86eb2c290cbca5c
refs/heads/master
2020-03-18T03:51:50.856813
2018-04-24T03:08:32
2018-04-24T03:08:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
491
java
package com.hisun.lemon.framework.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * GET请求参数为GenericDTO或其子类对象 * @author yuzhou * @date 2017年8月22日 * @time 下午1:07:51 * */ @Documented @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.PARAMETER}) public @interface LemonBody { }
92c85230b33903985b869b66ddbdb9641366e3ca
656da06c9709e4631750accd294b8070a6f8a8dc
/src/test/java/com/example/html1/Html1ApplicationTests.java
229745e46ed43ff96779278246eeb8252d848ffa
[]
no_license
indonswe/html3
1e2af40b9608459d63420593a523b3139c05aaaa
110d3c140586931ce1cd1fcfa76216c0cbaae9b0
refs/heads/master
2023-03-25T19:46:58.929233
2021-03-25T13:01:33
2021-03-25T13:01:33
350,337,558
0
0
null
null
null
null
UTF-8
Java
false
false
217
java
package com.example.html1; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class Html1ApplicationTests { @Test void contextLoads() { } }
9697c15fbd0912f8f38c08b604588f67bc6d19be
478f8dd3b62a73f4e966f9d4c2c34a6dbeed2ee7
/src/main/java/com/ideabook/util/TestGenerator.java
d05a643fb5358a72229ef8b70e48d2800e80b928
[]
no_license
lizhihao1993/spring-boot-mybatis-log-exception-swagger2
091425b85b5ad2adc7ce0d68a918dac46d77540e
48c1b2d0b729c608001fee3e0a932ef9f2de01b8
refs/heads/master
2021-06-23T04:29:21.589576
2017-08-14T08:48:41
2017-08-14T08:48:41
100,246,846
0
0
null
null
null
null
UTF-8
Java
false
false
1,789
java
package com.ideabook.util; import org.mybatis.generator.api.MyBatisGenerator; import org.mybatis.generator.config.Configuration; import org.mybatis.generator.config.xml.ConfigurationParser; import org.mybatis.generator.exception.InvalidConfigurationException; import org.mybatis.generator.exception.XMLParserException; import org.mybatis.generator.internal.DefaultShellCallback; import java.io.File; import java.io.IOException; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; /** * 根据数据库的表 生成相关的代码,不要重复生成文件!!!! * 如果重复生成,会造成 Mapper.xml文件内容重复,从而报错。 */ public class TestGenerator { public static void main(String[] args) { List<String> warnings = new ArrayList<String>(); boolean overwrite = true; String genCfg = "/GeneratorConfiguration.xml"; File configFile = new File(TestGenerator.class.getResource(genCfg).getFile()); ConfigurationParser cp = new ConfigurationParser(warnings); Configuration config = null; try { config = cp.parseConfiguration(configFile); } catch (IOException e) { e.printStackTrace(); } catch (XMLParserException e) { e.printStackTrace(); } DefaultShellCallback callback = new DefaultShellCallback(overwrite); MyBatisGenerator myBatisGenerator = null; try { myBatisGenerator = new MyBatisGenerator(config, callback, warnings); System.out.println("yes.."); } catch (InvalidConfigurationException e) { e.printStackTrace(); System.out.println("o ....no..."); } try { myBatisGenerator.generate(null); } catch (SQLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } } }
f99ef1da280aa40f71a38776623fc0558fdc390e
6049c91117b4da7b2ca5ef4ad59e2e5d309ccb89
/app/src/main/java/com/example/submission5/components/movie/MovieDetailActivity.java
64d346eee0cc3c49b24a9c1c80802b824db9f5e3
[]
no_license
Syahal/CatalogueMovieFinal
4e9840b163a8f3df1c33e7777d05feef16d7d0f1
433071df921310e7f3de1fb85dd235599cb2427f
refs/heads/master
2020-09-04T04:27:10.317247
2019-11-07T09:12:36
2019-11-07T09:12:36
219,657,213
0
0
null
null
null
null
UTF-8
Java
false
false
6,270
java
package com.example.submission5.components.movie; import androidx.appcompat.app.AppCompatActivity; import androidx.core.content.ContextCompat; import android.content.ContentValues; import android.net.Uri; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.bumptech.glide.Glide; import com.bumptech.glide.request.RequestOptions; import com.example.submission5.R; import com.example.submission5.components.widget.FavoriteWidgetProvider; import com.example.submission5.models.movies.MovieItems; import jp.wasabeef.glide.transformations.BlurTransformation; import static com.example.submission5.connection.DBContract.FavoriteMoviesColumn.CONTENT_URL; import static com.example.submission5.connection.DBContract.FavoriteMoviesColumn.LANGUAGE; import static com.example.submission5.connection.DBContract.FavoriteMoviesColumn.OVERVIEW; import static com.example.submission5.connection.DBContract.FavoriteMoviesColumn.POPULARITY; import static com.example.submission5.connection.DBContract.FavoriteMoviesColumn.POSTER_PATH; import static com.example.submission5.connection.DBContract.FavoriteMoviesColumn.RELEASE_DATE; import static com.example.submission5.connection.DBContract.FavoriteMoviesColumn.TITLE; import static com.example.submission5.connection.DBContract.FavoriteMoviesColumn.VOTE_AVERAGE; import static com.example.submission5.connection.DBContract.FavoriteMoviesColumn._ID; import static com.example.submission5.MainActivity.dbFavorite; public class MovieDetailActivity extends AppCompatActivity { public static final String MOVIE_EXTRA = "movie_extra"; private int id; private String title, overview, release, vote, popularity, language, poster; private TextView tvMovieTitle, tvMovieOverview, tvMovieRelease, tvMovieVote, tvMoviePopularity, tvMovieLanguage; private ImageView imgMoviePoster, imgMovieBlur; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle(R.string.movie_detail_header); setContentView(R.layout.activity_movie_detail); bindView(); getData(); setData(); } public void bindView() { tvMovieTitle = findViewById(R.id.tv_detail_name); tvMovieOverview = findViewById(R.id.tv_detail_overview); tvMovieRelease = findViewById(R.id.tv_detail_release); tvMovieVote = findViewById(R.id.tv_detail_vote_average); tvMoviePopularity = findViewById(R.id.tv_detail_popularity); tvMovieLanguage = findViewById(R.id.tv_detail_original_language); imgMoviePoster = findViewById(R.id.img_poster_detail); imgMovieBlur = findViewById(R.id.img_blur_detail); } private void getData() { MovieItems movieItems = getIntent().getParcelableExtra(MOVIE_EXTRA); assert movieItems != null; id = movieItems.getId(); title = movieItems.getMovieTitle(); overview = movieItems.getMovieOverview(); release = movieItems.getMovieReleasedate(); vote = movieItems.getMovieVoteAvg(); popularity = movieItems.getMoviePopularity(); language = movieItems.getMovieLanguage(); poster = movieItems.getMoviePosterpath(); } private void setData() { tvMovieTitle.setText(title); tvMovieOverview.setText(overview); tvMovieRelease.setText(release); tvMovieVote.setText(vote); tvMoviePopularity.setText(popularity); tvMovieLanguage.setText(language); Glide.with(this) .load("https://image.tmdb.org/t/p/w342" + poster) .apply(RequestOptions.bitmapTransform(new BlurTransformation(10, 1))) .into(imgMovieBlur); Glide.with(this) .load("https://image.tmdb.org/t/p/w185" + poster) .into(imgMoviePoster); } public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.fav_menu, menu); if (dbFavorite.dao().isFavMov(id) == 1) { menu.getItem(0).setIcon(ContextCompat.getDrawable(this, R.drawable.ic_favorite_24dp)); menu.getItem(0).setChecked(true); } else { menu.getItem(0).setIcon(ContextCompat.getDrawable(this, R.drawable.ic_add_to_favorite_24dp)); menu.getItem(0).setChecked(false); } return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem menuItem) { MovieItems movieItems = new MovieItems(); movieItems.setId(id); movieItems.setMovieTitle(title); movieItems.setMovieOverview(overview); movieItems.setMovieReleasedate(release); movieItems.setMovieVoteAvg(vote); movieItems.setMoviePopularity(popularity); movieItems.setMovieLanguage(language); movieItems.setMoviePosterpath(poster); ContentValues values = new ContentValues(); values.put(_ID, id); values.put(TITLE, title); values.put(OVERVIEW, overview); values.put(RELEASE_DATE, release); values.put(VOTE_AVERAGE, vote); values.put(POPULARITY, popularity); values.put(LANGUAGE, language); values.put(POSTER_PATH, poster); if (menuItem.getItemId() == R.id.is_favorite) { if (menuItem.isChecked()) { menuItem.setChecked(false); dbFavorite.dao().delete(movieItems); Uri uri = Uri.parse(CONTENT_URL + "/" + id); getContentResolver().delete(uri, null, null); menuItem.setIcon(R.drawable.ic_add_to_favorite_24dp); Toast.makeText(this, R.string.remove_from_favorite, Toast.LENGTH_SHORT).show(); } else { menuItem.setChecked(true); dbFavorite.dao().addMovieItem(movieItems); getContentResolver().insert(CONTENT_URL, values); menuItem.setIcon(R.drawable.ic_favorite_24dp); Toast.makeText(this, R.string.added_to_favorite, Toast.LENGTH_SHORT).show(); } } return super.onOptionsItemSelected(menuItem); } }
8483b9b5ac59dc01d8e4cd01148e3a61aa9918af
9053984c3cf0794bd736c6cd4edb6c126943ff14
/src/com/cjlu/newspublish/actions/impl/NewsAction.java
410a70d5d4c2b7589de7eebb78ccdadeb50d2e0a
[ "Apache-2.0" ]
permissive
loyalyonggang/NewsPublish
699d75c911cdbf363f230c9b7b2e4156c79f434e
b2bdcb3c327606163b3ec286a372e99690c4a574
refs/heads/master
2021-05-14T06:16:12.270953
2015-10-26T13:19:49
2015-10-26T13:19:49
null
0
0
null
null
null
null
GB18030
Java
false
false
13,969
java
package com.cjlu.newspublish.actions.impl; import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.Date; import java.util.List; import javassist.bytecode.stackmap.TypeData.ClassName; import javax.servlet.http.Cookie; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; import com.cjlu.newspublish.actions.BaseAction; import com.cjlu.newspublish.constant.WebConstant; import com.cjlu.newspublish.models.Comment; import com.cjlu.newspublish.models.News; import com.cjlu.newspublish.models.NewsType; import com.cjlu.newspublish.models.Page; import com.cjlu.newspublish.models.State; import com.cjlu.newspublish.models.User; import com.cjlu.newspublish.models.VisitorCounter; import com.cjlu.newspublish.services.CommentService; import com.cjlu.newspublish.services.NewsService; import com.cjlu.newspublish.services.NewsTypeService; import com.cjlu.newspublish.services.StateService; import com.cjlu.newspublish.services.VisitorCounterService; import com.cjlu.newspublish.utils.CookieUtils; import com.cjlu.newspublish.utils.DataUtils; import com.cjlu.newspublish.utils.SearchIndexUtils; import com.cjlu.newspublish.utils.ValidateUtils; @Controller @Scope("prototype") public class NewsAction extends BaseAction<News> { private static final long serialVersionUID = 2627607447756718173L; @Autowired private NewsService newsService; @Autowired private NewsTypeService newsTypeService; @Autowired private CommentService commentService; @Autowired private VisitorCounterService visitorCounterService; @Autowired private StateService stateService; private int maxResult = WebConstant.MAX_RESULT; private int result = WebConstant.RESULT; private int pageSize = WebConstant.PAGE_SIZE; private Integer adminId = null; private List<List<News>> allNews = null; private List<NewsType> allNewsTypes = null; private List<State> allStates = null; private List<Comment> allComments = null; private Integer newsId = null;; private String comment = null; private User user = null; private VisitorCounter visitorCounter = null; private Integer count = null; private boolean flag = false; private Integer commentId = null; private String ipAddress = null; private Integer stateId = null; private static Logger logger = Logger.getLogger(ClassName.class); private String keywords; // 搜索时选择标题还是正文 private int sw; private Integer page; private Page<News> p; // 今日头条 private List<News> headlines = null; // 健康问答 private List<News> healthFAQs = null; // 医药时讯 private List<News> drugslines = null; // 健康资讯 private List<News> healthlines = null; // 生活专栏 private List<News> lifelines = null; // 孕妇专区 private List<News> pregnantlines = null; // 不孕不育 private List<News> infertilitylines = null; // 两性专区 private List<News> genderlines = null; // 热点曝光 private List<News> hotlines = null; private File upload; private String uploadFileName; private String uploadContentType; // 搜索某条新闻 public String getSearchedNews() { if (keywords != null && keywords.trim() != "") { sessionMap.put("keywords", keywords); } SearchIndexUtils utils = SearchIndexUtils.Instance(); if (sw == 0) { if (page == null) { utils.pageNo = 1; p = utils.searchIndex("title", (String) sessionMap.get("keywords"), false); } else { utils.pageNo = page; p = utils.searchIndex("title", (String) sessionMap.get("keywords"), false); } } else { if (page == null) { utils.pageNo = 1; p = utils.searchIndex("content", (String) sessionMap.get("keywords"), false); } else { utils.pageNo = page; p = utils.searchIndex("content", (String) sessionMap.get("keywords"), false); } } requestMap.put("page", p); requestMap.put("sw", sw); return "to_searchResultPage"; } // 后台搜索某条新闻 public String searchNews() { if (keywords != null && keywords.trim() != "") { sessionMap.put("keywords", keywords); } SearchIndexUtils utils = SearchIndexUtils.Instance(); if (sw == 0) { if (page == null) { utils.pageNo = 1; p = utils.searchIndex("title", (String) sessionMap.get("keywords"), false); } else { utils.pageNo = page; p = utils.searchIndex("title", (String) sessionMap.get("keywords"), false); } } else { if (page == null) { utils.pageNo = 1; p = utils.searchIndex("content", (String) sessionMap.get("keywords"), false); } else { utils.pageNo = page; p = utils.searchIndex("content", (String) sessionMap.get("keywords"), false); } } requestMap.put("page", p); requestMap.put("sw", sw); return "to_searchPage"; } // 用户发表某条评论 public String publishComment() { user = (User) sessionMap.get("user"); ipAddress = httpRequest.getRemoteAddr(); commentService.publishComment(comment, ipAddress, newsId, user); logger.info(user.getUsername() + "发表评论:" + comment + " ,IP地址:" + ipAddress + " ,新闻ID:" + newsId); allComments = commentService.getViewNewsAllComment(newsId); try { writeJSON(allComments); } catch (IOException e) { e.printStackTrace(); } return null; } // 管理员删除某条评论 public String deleteComment() { commentService.deleteComment(commentId); logger.info("管理员删除评论:" + commentId); allComments = commentService.getViewNewsAllComment(newsId); try { writeJSON(allComments); } catch (IOException e) { e.printStackTrace(); } return null; } // 得到所有已通过的新闻 public String getAllPassedNews() { headlines = newsService.getRecentNews(1, maxResult); healthFAQs = newsService.getRecentNews(3, maxResult); drugslines = newsService.getRecentNews(4, result); healthlines = newsService.getRecentNews(2, result); lifelines = newsService.getRecentNews(5, result); pregnantlines = newsService.getRecentNews(6, result); infertilitylines = newsService.getRecentNews(7, result); genderlines = newsService.getRecentNews(8, result); hotlines = newsService.getRecentNews(9, result); allNews = new ArrayList<List<News>>(); allNews.add(headlines); allNews.add(healthFAQs); allNews.add(drugslines); allNews.add(healthlines); allNews.add(lifelines); allNews.add(pregnantlines); allNews.add(infertilitylines); allNews.add(genderlines); allNews.add(hotlines); requestMap.put("allNews", allNews); return "to_homePage"; } // 得到所有未通过的新闻 public String getAllNotPassedNews() { p = new Page<News>(); if (page == null) { p = newsService.listAllNotPassedNewsPage(1, pageSize); } else { p = newsService.listAllNotPassedNewsPage(page, pageSize); } requestMap.put("page", p); return "to_examineNewsListPage"; } // 得到所有的新闻 public String getAllNews() { p = new Page<News>(); if (page == null) { p = newsService.listAllNewsPage(1, pageSize); } else { p = newsService.listAllNewsPage(page, pageSize); } requestMap.put("page", p); if (sessionMap.get("allNewsTypes") == null) { allNewsTypes = newsTypeService.findAllEntities(); sessionMap.put("allNewsTypes", allNewsTypes); } if (sessionMap.get("allStates") == null) { allStates = stateService.findAllEntities(); sessionMap.put("allStates", allStates); } return "to_newsListPage"; } // 判断用户是否存在指定的cookie,以此来更新新闻点击量 public void countVisitorNum(Integer newsId) { String key = DataUtils.md5(newsId.toString()); String value = DataUtils.md5("true" + newsId); Cookie c = null; try { c = CookieUtils.getCookie(httpRequest, "COUNT_" + key); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } if (c != null) { if (value.equals(c.getValue())) { flag = false; } else { flag = true; count++; } } else { flag = true; count++; CookieUtils.addCookie(httpResponse, "COUNT_" + key, value, 60 * 60 * 2); } } // 前台得到某条新闻的页面 public String getViewNews() { model = newsService.getViewNews(model.getId()); allComments = commentService.getViewNewsAllComment(model.getId()); requestMap.put("allComments", allComments); visitorCounter = new VisitorCounter(httpRequest.getRemoteAddr(), new Date(), (User) sessionMap.get("user"), model); visitorCounterService.saveEntity(visitorCounter); count = model.getCount(); countVisitorNum(model.getId()); application.setAttribute("count", count); if (flag) { model.setCount(count); newsService.updateEntity(model); } return "to_viewNewsPage"; } // 后台得到某条新闻的页面 public String getNews() { model = newsService.getViewNews(model.getId()); allComments = commentService.getViewNewsAllComment(model.getId()); requestMap.put("allComments", allComments); return "to_newsPage"; } // 后台改变新闻的状态 @SuppressWarnings("unchecked") public String changeNewsState() { model = newsService.getEntity(model.getId()); allStates = (List<State>) sessionMap.get("allStates"); State s = allStates.get(sw - 1); model.setState(s); if (s.getId() == 1) { newsService.createNewsIndex(model); } newsService.updateEntity(model); return "to_NewsAction_getAllNotPassedNews"; } // 后台得到某条未通过新闻的页面 public String getExamineNews() { model = newsService.getViewNews(model.getId()); if (sessionMap.get("allNewsTypes") == null) { allNewsTypes = newsTypeService.findAllEntities(); sessionMap.put("allNewsTypes", allNewsTypes); } if (sessionMap.get("allStates") == null) { allStates = stateService.findAllEntities(); sessionMap.put("allStates", allStates); } return "to_examineNewsPage"; } // 后台更新某条新闻 public String updateNews() { if (model.getId() != null && model.getId() > 0) { model = newsService.getEntity(model.getId()); } if (sessionMap.get("allNewsTypes") == null) { allNewsTypes = newsTypeService.findAllEntities(); sessionMap.put("allNewsTypes", allNewsTypes); } return "to_updateNewsPage"; } // 上传缩略图 private void uploadThumbnail(String uploadFileName) throws IOException { String ext = uploadFileName.substring(uploadFileName.lastIndexOf(".")); long filename = System.nanoTime(); String dir = application.getRealPath("/files/" + filename + ext); System.out.println(dir); FileOutputStream out = new FileOutputStream(dir); FileInputStream in = new FileInputStream(upload); byte[] buffer = new byte[1024]; int len = 0; while ((len = in.read(buffer)) != -1) { out.write(buffer, 0, len); } out.close(); in.close(); model.setThumbnail("/files/" + filename + ext); } // 后台保存某条新闻 public String saveNews() throws IOException { System.out.println("uploadFileName" + uploadFileName); if (ValidateUtils.isValid(uploadFileName)) { try { uploadThumbnail(uploadFileName); } catch (Exception e) { addFieldError("logoPhoto", "图片上传失败"); System.out.println("图片上传失败"); e.printStackTrace(); return "upload_error"; } } if (stateId != null && model.getId() != null) { State s = stateService.getEntity(stateId); model.setState(s); System.out.println(model.toString()); } newsService.saveNews(model, adminId); logger.info("管理员更新新闻:" + model.getTitle()); return "to_NewsAction_getAllNews"; } // 后台删除某条新闻 public String deleteNews() { try { if (model.getId() != null && model.getId() > 0) { newsService.deleteNews(model.getId()); inputStream = new ByteArrayInputStream("1".getBytes("UTF-8")); logger.info("管理员删除新闻:" + model.getTitle()); } } catch (Exception e) { try { inputStream = new ByteArrayInputStream("0".getBytes("UTF-8")); e.printStackTrace(); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); } } return "ajax_success"; } // 后台增加某条新闻 public String addNews() { if (sessionMap.get("allNewsTypes") == null) { allNewsTypes = newsTypeService.findAllEntities(); sessionMap.put("allNewsTypes", allNewsTypes); } return "to_addNewsPage"; } public Integer getAdminId() { return adminId; } public void setAdminId(Integer adminId) { this.adminId = adminId; } public String getComment() { return comment; } public void setComment(String comment) { this.comment = comment; } public Integer getNewsId() { return newsId; } public void setNewsId(Integer newsId) { this.newsId = newsId; } public Integer getCommentId() { return commentId; } public void setCommentId(Integer commentId) { this.commentId = commentId; } public Integer getStateId() { return stateId; } public void setStateId(Integer stateId) { this.stateId = stateId; } public String getKeywords() { return keywords; } public void setKeywords(String keywords) { this.keywords = keywords; } public Integer getPage() { return page; } public void setPage(Integer page) { this.page = page; } public int getSw() { return sw; } public void setSw(int sw) { this.sw = sw; } public File getUpload() { return upload; } public void setUpload(File upload) { this.upload = upload; } public String getUploadFileName() { return uploadFileName; } public void setUploadFileName(String uploadFileName) { this.uploadFileName = uploadFileName; } public String getUploadContentType() { return uploadContentType; } public void setUploadContentType(String uploadContentType) { this.uploadContentType = uploadContentType; } }
b94514a93deb822ea5a4c808542d91fe9aaf29ea
33d329f17ad4912a23dd9ee6fd3b07863c2ccce6
/src/main/java/com/esgi/stats19/api/common/entities/Country.java
3047ef3546e8e415495eb4073a554f580a6fa59d
[ "Apache-2.0" ]
permissive
stats19/stats19-api
8eb38cce4cc832ab73bf811d298f98925eb731a2
30d6f1d55973a205fbfb45dfdf245b1ad14dbe41
refs/heads/master
2022-11-18T06:18:26.940612
2020-07-15T19:49:29
2020-07-15T19:49:29
256,801,806
0
0
null
2020-06-30T10:43:13
2020-04-18T16:34:13
Java
UTF-8
Java
false
false
818
java
package com.esgi.stats19.api.common.entities; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import javax.persistence.*; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import java.util.List; @Data @Entity @Builder @NoArgsConstructor @AllArgsConstructor public class Country { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer countryId; @NotNull @Column(length = 45) @Size(min = 2, max = 45) private String name; @OneToMany(mappedBy = "country", cascade = CascadeType.ALL, fetch = FetchType.LAZY) private List<League> leagues; @OneToMany(mappedBy = "country", cascade = CascadeType.ALL, fetch = FetchType.LAZY) private List<Match> matches; }
e9407bfbbfa1c0df8a9804bac206c3b11bafbe48
385c56d0505a0f865a37de50c9259b782e98cb14
/ten.java
46bf73288d5d90cae4904f3b510376f3fdfc658a
[]
no_license
Ankita-Harkude/199DSJava
9933d7209737f499da9f633beeb9bd05bb0ca7a9
3c2022cc56a43392887804219ebd82f5c724526d
refs/heads/main
2023-09-01T00:53:17.056839
2021-10-23T11:54:47
2021-10-23T11:54:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
41
java
pswm { System.out.println("Hello All"); }
7afc53906333378a80e367ba80d2f95accf1b769
7746f1d294b3999245f9dbfe11b2af7ddc28a4ba
/src/main/java/com/setu/biller/service/BillPaymentService.java
ccfb5b2d0f9e774a660bdd4023110ebd38128c19
[]
no_license
krisrajaryan27/biller
b5de6c6255e3f3220b697db3fd8a5ce6a337d981
40acf8087df9190b0a6512695aad93f1873d5af4
refs/heads/master
2022-11-25T00:34:19.584371
2020-07-23T17:02:15
2020-07-23T17:02:15
281,979,796
1
0
null
null
null
null
UTF-8
Java
false
false
509
java
package com.setu.biller.service; import com.setu.biller.dto.BillPaymentRequest; import com.setu.biller.dto.BillPaymentUpdateResponse; import com.setu.biller.dto.DueResponse; import com.setu.biller.exception.BillerException; /** * @author Krishna Verma * @date 21/07/2020 */ public interface BillPaymentService { DueResponse getBillOfPaymentDue(String mobileNumber) throws BillerException; BillPaymentUpdateResponse updatePayment(BillPaymentRequest billPaymentRequest) throws BillerException; }
a5d3087fb37bd10c7de5f4ec3f072c707f4aa81b
b95edc31858d0e1547e71f766211f370b2ef4895
/src/main/java/com/pojogen/internal/Property.java
dbafb70179880c1b88d703aaec9758e2665ceee5
[ "Apache-2.0" ]
permissive
pojogen/pojogen
ea7dd604a07cdfbdfa7916ec2555559872e8c0fd
c4ea9c324d8dda3bc4f29294cf9195c2664086fa
refs/heads/master
2021-01-18T09:30:18.090956
2014-08-20T19:43:18
2014-08-20T19:43:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
361
java
package com.pojogen.internal; import static com.google.common.base.Preconditions.checkNotNull; final class Property { private final String name; private final Type type; Property(String name, Type type) { this.name = checkNotNull(name); this.type = checkNotNull(type); } String getName() { return name; } Type getType() { return type; } }
baa3ed2859a969a424dbb8c85971e3ca18aefb30
edfb6d6416fae12b0978018145e57eb0866a8031
/src/main/java/streams/OptionalsFromEmptyStreams.java
29eef3813f554778820bf488483b4354058443dd
[]
no_license
xiaoyuzaijinbu/TIJ5-code
1ac7a2dcfc24413faf0824390cfe53d8295234a0
2698645e6505f2590a41b0760742240690e9b3a0
refs/heads/master
2021-03-12T00:41:40.618292
2021-01-26T03:39:50
2021-01-26T03:39:50
246,574,335
0
0
null
null
null
null
UTF-8
Java
false
false
1,005
java
package streams;// streams/OptionalsFromEmptyStreams.java // (c)2017 MindView LLC: see Copyright.txt // We make no guarantees that this code is fit for any purpose. // Visit http://OnJava8.com for more book information. import java.util.*; import java.util.stream.*; class OptionalsFromEmptyStreams { public static void main(String[] args) { System.out.println(Stream.<String>empty() .findFirst()); System.out.println(Stream.<String>empty() .findAny()); System.out.println(Stream.<String>empty() .max(String.CASE_INSENSITIVE_ORDER)); System.out.println(Stream.<String>empty() .min(String.CASE_INSENSITIVE_ORDER)); System.out.println(Stream.<String>empty() .reduce((s1, s2) -> s1 + s2)); System.out.println(IntStream.empty() .average()); } } /* Output: Optional.empty Optional.empty Optional.empty Optional.empty Optional.empty OptionalDouble.empty */
f6ff6b3a6b2595aa0a89dcae4c978ac3dee08709
bb1c36eba1dd7684af02f532f97dec0facd145dc
/Javame/BuddyProfile.java
bdf223cc4d9d152849cc0c264f8d62bf1ee3342e
[]
no_license
shesheshe/linethrift
220d34ca865f4adbd918117aa20daeb67210cac5
114b1ff1acde89b9018e05e645dd7098b4e0e900
refs/heads/master
2020-09-06T07:32:27.212969
2019-09-28T08:33:11
2019-09-28T08:33:11
null
0
0
null
null
null
null
UTF-8
Java
false
true
14,732
java
/** * Autogenerated by Thrift Compiler (0.13.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ import java.util.Hashtable; import java.util.Vector; import java.util.Enumeration; import org.apache.thrift.*; import org.apache.thrift.meta_data.*; import org.apache.thrift.transport.*; import org.apache.thrift.protocol.*; public class BuddyProfile implements TBase { private static final TStruct STRUCT_DESC = new TStruct("BuddyProfile"); private static final TField BUDDY_ID_FIELD_DESC = new TField("buddyId", TType.STRING, (short)1); private static final TField MID_FIELD_DESC = new TField("mid", TType.STRING, (short)2); private static final TField SEARCH_ID_FIELD_DESC = new TField("searchId", TType.STRING, (short)3); private static final TField DISPLAY_NAME_FIELD_DESC = new TField("displayName", TType.STRING, (short)4); private static final TField STATUS_MESSAGE_FIELD_DESC = new TField("statusMessage", TType.STRING, (short)5); private static final TField CONTACT_COUNT_FIELD_DESC = new TField("contactCount", TType.I64, (short)11); private String buddyId; private String mid; private String searchId; private String displayName; private String statusMessage; private long contactCount; // isset id assignments private static final int __CONTACTCOUNT_ISSET_ID = 0; private boolean[] __isset_vector = new boolean[1]; public BuddyProfile() { } public BuddyProfile( String buddyId, String mid, String searchId, String displayName, String statusMessage, long contactCount) { this(); this.buddyId = buddyId; this.mid = mid; this.searchId = searchId; this.displayName = displayName; this.statusMessage = statusMessage; this.contactCount = contactCount; setContactCountIsSet(true); } /** * Performs a deep copy on <i>other</i>. */ public BuddyProfile(BuddyProfile other) { System.arraycopy(other.__isset_vector, 0, __isset_vector, 0, other.__isset_vector.length); if (other.isSetBuddyId()) { this.buddyId = other.buddyId; } if (other.isSetMid()) { this.mid = other.mid; } if (other.isSetSearchId()) { this.searchId = other.searchId; } if (other.isSetDisplayName()) { this.displayName = other.displayName; } if (other.isSetStatusMessage()) { this.statusMessage = other.statusMessage; } this.contactCount = other.contactCount; } public BuddyProfile deepCopy() { return new BuddyProfile(this); } public void clear() { this.buddyId = null; this.mid = null; this.searchId = null; this.displayName = null; this.statusMessage = null; setContactCountIsSet(false); this.contactCount = 0; } public String getBuddyId() { return this.buddyId; } public void setBuddyId(String buddyId) { this.buddyId = buddyId; } public void unsetBuddyId() { this.buddyId = null; } /** Returns true if field buddyId is set (has been assigned a value) and false otherwise */ public boolean isSetBuddyId() { return this.buddyId != null; } public void setBuddyIdIsSet(boolean value) { if (!value) { this.buddyId = null; } } public String getMid() { return this.mid; } public void setMid(String mid) { this.mid = mid; } public void unsetMid() { this.mid = null; } /** Returns true if field mid is set (has been assigned a value) and false otherwise */ public boolean isSetMid() { return this.mid != null; } public void setMidIsSet(boolean value) { if (!value) { this.mid = null; } } public String getSearchId() { return this.searchId; } public void setSearchId(String searchId) { this.searchId = searchId; } public void unsetSearchId() { this.searchId = null; } /** Returns true if field searchId is set (has been assigned a value) and false otherwise */ public boolean isSetSearchId() { return this.searchId != null; } public void setSearchIdIsSet(boolean value) { if (!value) { this.searchId = null; } } public String getDisplayName() { return this.displayName; } public void setDisplayName(String displayName) { this.displayName = displayName; } public void unsetDisplayName() { this.displayName = null; } /** Returns true if field displayName is set (has been assigned a value) and false otherwise */ public boolean isSetDisplayName() { return this.displayName != null; } public void setDisplayNameIsSet(boolean value) { if (!value) { this.displayName = null; } } public String getStatusMessage() { return this.statusMessage; } public void setStatusMessage(String statusMessage) { this.statusMessage = statusMessage; } public void unsetStatusMessage() { this.statusMessage = null; } /** Returns true if field statusMessage is set (has been assigned a value) and false otherwise */ public boolean isSetStatusMessage() { return this.statusMessage != null; } public void setStatusMessageIsSet(boolean value) { if (!value) { this.statusMessage = null; } } public long getContactCount() { return this.contactCount; } public void setContactCount(long contactCount) { this.contactCount = contactCount; setContactCountIsSet(true); } public void unsetContactCount() { __isset_vector[__CONTACTCOUNT_ISSET_ID] = false; } /** Returns true if field contactCount is set (has been assigned a value) and false otherwise */ public boolean isSetContactCount() { return __isset_vector[__CONTACTCOUNT_ISSET_ID]; } public void setContactCountIsSet(boolean value) { __isset_vector[__CONTACTCOUNT_ISSET_ID] = value; } public boolean equals(Object that) { if (that == null) return false; if (that instanceof BuddyProfile) return this.equals((BuddyProfile)that); return false; } public boolean equals(BuddyProfile that) { if (that == null) return false; if (this == that) return true; boolean this_present_buddyId = true && this.isSetBuddyId(); boolean that_present_buddyId = true && that.isSetBuddyId(); if (this_present_buddyId || that_present_buddyId) { if (!(this_present_buddyId && that_present_buddyId)) return false; if (!this.buddyId.equals(that.buddyId)) return false; } boolean this_present_mid = true && this.isSetMid(); boolean that_present_mid = true && that.isSetMid(); if (this_present_mid || that_present_mid) { if (!(this_present_mid && that_present_mid)) return false; if (!this.mid.equals(that.mid)) return false; } boolean this_present_searchId = true && this.isSetSearchId(); boolean that_present_searchId = true && that.isSetSearchId(); if (this_present_searchId || that_present_searchId) { if (!(this_present_searchId && that_present_searchId)) return false; if (!this.searchId.equals(that.searchId)) return false; } boolean this_present_displayName = true && this.isSetDisplayName(); boolean that_present_displayName = true && that.isSetDisplayName(); if (this_present_displayName || that_present_displayName) { if (!(this_present_displayName && that_present_displayName)) return false; if (!this.displayName.equals(that.displayName)) return false; } boolean this_present_statusMessage = true && this.isSetStatusMessage(); boolean that_present_statusMessage = true && that.isSetStatusMessage(); if (this_present_statusMessage || that_present_statusMessage) { if (!(this_present_statusMessage && that_present_statusMessage)) return false; if (!this.statusMessage.equals(that.statusMessage)) return false; } boolean this_present_contactCount = true; boolean that_present_contactCount = true; if (this_present_contactCount || that_present_contactCount) { if (!(this_present_contactCount && that_present_contactCount)) return false; if (this.contactCount != that.contactCount) return false; } return true; } public int hashCode() { return 0; } public int compareTo(Object otherObject) { if (!getClass().equals(otherObject.getClass())) { return getClass().getName().compareTo(otherObject.getClass().getName()); } BuddyProfile other = (BuddyProfile)otherObject; int lastComparison = 0; lastComparison = TBaseHelper.compareTo(isSetBuddyId(), other.isSetBuddyId()); if (lastComparison != 0) { return lastComparison; } if (isSetBuddyId()) { lastComparison = TBaseHelper.compareTo(this.buddyId, other.buddyId); if (lastComparison != 0) { return lastComparison; } } lastComparison = TBaseHelper.compareTo(isSetMid(), other.isSetMid()); if (lastComparison != 0) { return lastComparison; } if (isSetMid()) { lastComparison = TBaseHelper.compareTo(this.mid, other.mid); if (lastComparison != 0) { return lastComparison; } } lastComparison = TBaseHelper.compareTo(isSetSearchId(), other.isSetSearchId()); if (lastComparison != 0) { return lastComparison; } if (isSetSearchId()) { lastComparison = TBaseHelper.compareTo(this.searchId, other.searchId); if (lastComparison != 0) { return lastComparison; } } lastComparison = TBaseHelper.compareTo(isSetDisplayName(), other.isSetDisplayName()); if (lastComparison != 0) { return lastComparison; } if (isSetDisplayName()) { lastComparison = TBaseHelper.compareTo(this.displayName, other.displayName); if (lastComparison != 0) { return lastComparison; } } lastComparison = TBaseHelper.compareTo(isSetStatusMessage(), other.isSetStatusMessage()); if (lastComparison != 0) { return lastComparison; } if (isSetStatusMessage()) { lastComparison = TBaseHelper.compareTo(this.statusMessage, other.statusMessage); if (lastComparison != 0) { return lastComparison; } } lastComparison = TBaseHelper.compareTo(isSetContactCount(), other.isSetContactCount()); if (lastComparison != 0) { return lastComparison; } if (isSetContactCount()) { lastComparison = TBaseHelper.compareTo(this.contactCount, other.contactCount); if (lastComparison != 0) { return lastComparison; } } return 0; } public void read(TProtocol iprot) throws TException { TField field; iprot.readStructBegin(); while (true) { field = iprot.readFieldBegin(); if (field.type == TType.STOP) { break; } switch (field.id) { case 1: // BUDDY_ID if (field.type == TType.STRING) { this.buddyId = iprot.readString(); } else { TProtocolUtil.skip(iprot, field.type); } break; case 2: // MID if (field.type == TType.STRING) { this.mid = iprot.readString(); } else { TProtocolUtil.skip(iprot, field.type); } break; case 3: // SEARCH_ID if (field.type == TType.STRING) { this.searchId = iprot.readString(); } else { TProtocolUtil.skip(iprot, field.type); } break; case 4: // DISPLAY_NAME if (field.type == TType.STRING) { this.displayName = iprot.readString(); } else { TProtocolUtil.skip(iprot, field.type); } break; case 5: // STATUS_MESSAGE if (field.type == TType.STRING) { this.statusMessage = iprot.readString(); } else { TProtocolUtil.skip(iprot, field.type); } break; case 11: // CONTACT_COUNT if (field.type == TType.I64) { this.contactCount = iprot.readI64(); setContactCountIsSet(true); } else { TProtocolUtil.skip(iprot, field.type); } break; default: TProtocolUtil.skip(iprot, field.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); validate(); } public void write(TProtocol oprot) throws TException { validate(); oprot.writeStructBegin(STRUCT_DESC); if (this.buddyId != null) { oprot.writeFieldBegin(BUDDY_ID_FIELD_DESC); oprot.writeString(this.buddyId); oprot.writeFieldEnd(); } if (this.mid != null) { oprot.writeFieldBegin(MID_FIELD_DESC); oprot.writeString(this.mid); oprot.writeFieldEnd(); } if (this.searchId != null) { oprot.writeFieldBegin(SEARCH_ID_FIELD_DESC); oprot.writeString(this.searchId); oprot.writeFieldEnd(); } if (this.displayName != null) { oprot.writeFieldBegin(DISPLAY_NAME_FIELD_DESC); oprot.writeString(this.displayName); oprot.writeFieldEnd(); } if (this.statusMessage != null) { oprot.writeFieldBegin(STATUS_MESSAGE_FIELD_DESC); oprot.writeString(this.statusMessage); oprot.writeFieldEnd(); } oprot.writeFieldBegin(CONTACT_COUNT_FIELD_DESC); oprot.writeI64(this.contactCount); oprot.writeFieldEnd(); oprot.writeFieldStop(); oprot.writeStructEnd(); } public String toString() { StringBuffer sb = new StringBuffer("BuddyProfile("); boolean first = true; sb.append("buddyId:"); if (this.buddyId == null) { sb.append("null"); } else { sb.append(this.buddyId); } first = false; if (!first) sb.append(", "); sb.append("mid:"); if (this.mid == null) { sb.append("null"); } else { sb.append(this.mid); } first = false; if (!first) sb.append(", "); sb.append("searchId:"); if (this.searchId == null) { sb.append("null"); } else { sb.append(this.searchId); } first = false; if (!first) sb.append(", "); sb.append("displayName:"); if (this.displayName == null) { sb.append("null"); } else { sb.append(this.displayName); } first = false; if (!first) sb.append(", "); sb.append("statusMessage:"); if (this.statusMessage == null) { sb.append("null"); } else { sb.append(this.statusMessage); } first = false; if (!first) sb.append(", "); sb.append("contactCount:"); sb.append(this.contactCount); first = false; sb.append(")"); return sb.toString(); } public void validate() throws TException { // check for required fields } }
9240bd8a6f039044f3b64a5900eb21b3404c9526
26bc276f868e7042fb91b7b20fd02810abfbb056
/src/main/java/edu/nefu/myblog/config/ErrorPageConfig.java
12486c2667e610e06bf032f11b444425f222e0a3
[]
no_license
wenbinai/my-blog
8790cb3c106166540f06d0bf174091b9b6bb40dc
bd17ef8e1c8e9394f6e8967c0c7714b69c111e49
refs/heads/master
2023-01-31T13:49:20.790621
2020-12-13T14:02:25
2020-12-13T14:02:25
315,952,316
1
0
null
null
null
null
UTF-8
Java
false
false
558
java
package edu.nefu.myblog.config; import org.springframework.boot.web.server.ErrorPage; import org.springframework.boot.web.server.ErrorPageRegistrar; import org.springframework.boot.web.server.ErrorPageRegistry; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpStatus; @Configuration public class ErrorPageConfig implements ErrorPageRegistrar { @Override public void registerErrorPages(ErrorPageRegistry registry) { registry.addErrorPages(new ErrorPage(HttpStatus.FORBIDDEN, "/403")); } }
f8c407a2a187c079cd4b1fd8d2404c45aa2520c1
3d007e3a6226277b2ab235c303fb30b78a75f708
/src/main/java/com/how2java/tmall/service/ProductService.java
56b4e56a8ae37e6eb45f163e9c0d305d05b23e79
[]
no_license
Lazyb0x/TmallSpringBoot
b3b14fcd1f9b83df6474ad272f83b05d04ccefa5
d8a2e504901f9e456869c78d656873ec21c63267
refs/heads/master
2022-07-16T16:02:00.058796
2020-03-24T09:06:26
2020-03-24T09:06:26
210,607,729
0
0
null
2022-06-21T01:56:10
2019-09-24T13:18:08
JavaScript
UTF-8
Java
false
false
3,711
java
package com.how2java.tmall.service; import com.how2java.tmall.dao.ProductDAO; import com.how2java.tmall.pojo.Category; import com.how2java.tmall.pojo.Product; import com.how2java.tmall.util.Page4Navigator; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; @Service public class ProductService { @Autowired ProductDAO productDAO; @Autowired CategoryService categoryService; @Autowired ProductImageService productImageService; @Autowired OrderItemService orderItemService; @Autowired ReviewService reviewService; public void add(Product bean){ productDAO.save(bean); } public void delete(int id){ productDAO.delete(id); } public void update(Product bean){ productDAO.save(bean); } public Product get(int id) { return productDAO.findOne(id); } public Page4Navigator<Product> list(int cid, int start, int size, int navigatePages){ Category category = categoryService.get(cid); Sort sort = new Sort(Sort.Direction.DESC, "id"); Pageable pageable = new PageRequest(start, size, sort); Page<Product> pageFromJPA = productDAO.findByCategory(category, pageable); return new Page4Navigator<>(pageFromJPA, navigatePages); } public List<Product> listByCategory(Category category){ return productDAO.findByCategoryOrderById(category); } public void fill(List<Category> categories){ for (Category category : categories){ fill(category); } } /** * 给分类填充产品 * @param category 分类 */ public void fill(Category category){ //获得所有产品这样好吗 List<Product> products = listByCategory(category); productImageService.setFirstProductImages(products); category.setProducts(products); } public void fillByRow(List<Category> categories){ int productNumberEachRow = 8; for (Category category : categories) { List<Product> products = category.getProducts(); List<List<Product>> productsByRow = new ArrayList<>(); for (int i = 0; i < products.size(); i+=productNumberEachRow) { int size = i+productNumberEachRow; size= size>products.size()?products.size():size; List<Product> productsOfEachRow =products.subList(i, size); productsByRow.add(productsOfEachRow); } category.setProductsByRow(productsByRow); } } public void setSaleAndReviewNumber(Product product){ int saleCount = orderItemService.getSaleCount(product); product.setSaleCount(saleCount); int reviewCount = reviewService.getCount(product); product.setReviewCount(reviewCount); } public void setSaleAndReviewNumber(List<Product> products){ for (Product product : products){ setSaleAndReviewNumber(product); } } public List<Product> search(String keyword, int start, int size) { Sort sort = new Sort(Sort.Direction.DESC, "id"); Pageable pageable = new PageRequest(start, size, sort); List<Product> products = productDAO.findByNameLike("%" + keyword + "%", pageable); return products; } }
a3f8e5eebe717e890b8509b0620e38def860e1bc
b7910e40356c56c733b1a63484cc94dcc7426320
/day3 (161109)/Quizz5.java
e60c41a86c1948991a8145aa509e92a21ed22e02
[]
no_license
jinhn/java_study
ffb748caf9d3704c16ba1d2f4d957d09ae7ce84a
767c2ddb084ac911cbff7c8fbfd1cf28da94d5f0
refs/heads/master
2020-06-14T20:13:08.421228
2016-12-16T06:42:04
2016-12-16T06:42:04
75,351,691
0
0
null
null
null
null
UHC
Java
false
false
845
java
import java.util.Scanner; public class Quizz5 { public static void main(String[] args) { // 국어, 영어, 수학점수를 입력받아서 // 총점, 평균, 학점을 출력하기 // 학점은 90이상:A, 80이상:B, 70이상:C, 60이상:D, 그 외는 F Scanner sc = new Scanner(System.in); System.out.print("국어: "); int kor = sc.nextInt(); System.out.print("영어: "); int eng = sc.nextInt(); System.out.print("수학: "); int math = sc.nextInt(); int total = kor + eng + math; int avg = total / 3; String grade = ""; if (total >= 90) { grade = "A"; } else if (total >= 80) { grade = "B"; } else if (total >= 70) { grade = "C"; } else if (total >= 60) { grade = "D"; } else { grade = "F"; } System.out.println("총점 " + total + " 평균 " + avg + " 학점 " + grade); } }
16908d404336433048f974542459056553561e47
2f01c487dcc1aaff60f300042974ac33aa9ccb47
/app/src/main/java/com/mahta/rastin/broadcastapplication/helper/HttpManager.java
ea670e035ec62fe6fe35b17969df79d848a19072
[]
no_license
rastinbw/broadcast_application_client
1967f16b1ca5647edaff92fb9919ebf06b4e250e
381e2da933eea1aa9cf906994f1a7d834fcdf54c
refs/heads/master
2020-03-26T11:33:12.030419
2018-09-04T10:01:48
2018-09-04T10:01:48
144,847,130
0
0
null
null
null
null
UTF-8
Java
false
false
3,365
java
package com.mahta.rastin.broadcastapplication.helper; import android.content.ContentValues; import com.mahta.rastin.broadcastapplication.global.G; import com.mahta.rastin.broadcastapplication.interfaces.OnResultListener; import java.io.IOException; import java.util.concurrent.TimeUnit; import okhttp3.FormBody; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; public class HttpManager{ private OnResultListener onResultListener; private OkHttpClient client; private String httpResult; private static final int CONNECT_TIMEOUT = 10; private static final int WRITE_TIMEOUT = 10; private static final int READ_TIMEOUT = 30; HttpManager(){ client = new OkHttpClient.Builder() .connectTimeout(CONNECT_TIMEOUT,TimeUnit.SECONDS) .writeTimeout(WRITE_TIMEOUT, TimeUnit.SECONDS) .readTimeout(READ_TIMEOUT, TimeUnit.SECONDS) .build(); } public void post(String url, ContentValues params){ FormBody.Builder builder = new FormBody.Builder(); if (params!=null && params.size() > 0) for (String key:params.keySet()) { builder.add(key,params.getAsString(key)); } RequestBody body = builder.build(); Request request = new Request.Builder() .url(url) .post(body) .build(); doRequest(request); } public void get(String url,String[] args){ StringBuilder builder = new StringBuilder(); builder.append(url); if (args != null && args.length>0) for (String arg:args) { builder.append("/"); builder.append(arg); } // try { // URLEncoder.encode(builder.toString(), "UTF-8"); // } catch (UnsupportedEncodingException e) { // e.printStackTrace(); // } G.i(builder.toString()); // TODO: 6/3/18 remove this line Request request = new Request.Builder() .url(builder.toString()) .get() .build(); doRequest(request); } private void doRequest(final Request request){ Thread thread = new Thread(new Runnable() { @Override public void run() { Response response; try { response = client.newCall(request).execute(); if (!response.isSuccessful()) { G.e(response.body().string()); }else { httpResult = response.body().string(); if(onResultListener!=null){ G.HANDLER.post(new Runnable() { @Override public void run() { onResultListener.onResult(httpResult); } }); } } } catch (IOException e) { G.e(e.getMessage()); } } }); thread.start(); } public void setOnResultListener(OnResultListener onResultListener){ this.onResultListener = onResultListener; } }
5f30c6bb6e947dfa49d663717a390590cdd9abee
5a4e85cda26bdeb4a9a0334b34d8f8f9d6d0b76a
/src/org/dav/service/settings/ViewSettings.java
decd3d0b8069f2c0f35669906cbd41c50da0f173
[]
no_license
ADolodarenko/DAVService
cb7fe2485719f98e5dd648aa638e68c45dde0926
dabe59bea588be0bc76983d3c2d47e74769fcdda
refs/heads/master
2020-04-01T01:49:55.915494
2019-08-12T14:43:42
2019-08-12T14:43:42
152,754,309
0
0
null
null
null
null
UTF-8
Java
false
false
3,817
java
package org.dav.service.settings; import org.dav.service.settings.parameter.ParameterHeader; import org.dav.service.util.Constants; import org.dav.service.util.ResourceManager; import java.awt.*; import java.util.Locale; public class ViewSettings extends TransmissiveSettings { private static final int PARAM_COUNT = 1; private boolean mainWindowMaximized; private Point mainWindowPosition; private Dimension mainWindowSize; private Dimension mainWindowPreferredSize; public ViewSettings(ResourceManager resourceManager, Dimension mainWindowPreferredSize) throws Exception { super(resourceManager); headers = new ParameterHeader[PARAM_COUNT]; headers[0] = new ParameterHeader(Constants.KEY_PARAM_APP_LOCALE, Locale.class, resourceManager.getCurrentLocale()); this.mainWindowPreferredSize = mainWindowPreferredSize; mainWindowMaximized = false; mainWindowPosition = new Point(0, 0); mainWindowSize = new Dimension(this.mainWindowPreferredSize); init(); } @Override public void load() throws Exception { super.load(); loadMainWindowMaximized(); loadMainWindowPosition(); loadMainWindowSize(); } @Override public void save() throws Exception { SettingsManager.setStringValue(headers[0].getKeyString(), getAppLocale().toString()); SettingsManager.setStringValue(Constants.KEY_PARAM_MAIN_WIN_MAXIMIZED, String.valueOf(mainWindowMaximized)); SettingsManager.setIntValue(Constants.KEY_PARAM_MAIN_WIN_X, mainWindowPosition.x); SettingsManager.setIntValue(Constants.KEY_PARAM_MAIN_WIN_Y, mainWindowPosition.y); SettingsManager.setIntValue(Constants.KEY_PARAM_MAIN_WIN_WIDTH, mainWindowSize.width); SettingsManager.setIntValue(Constants.KEY_PARAM_MAIN_WIN_HEIGHT, mainWindowSize.height); SettingsManager.saveSettings(resourceManager.getConfig()); } private void loadMainWindowMaximized() { String maximizedString = SettingsManager.getStringValue(Constants.KEY_PARAM_MAIN_WIN_MAXIMIZED); if (Constants.MESS_TRUE.equalsIgnoreCase(maximizedString)) mainWindowMaximized = true; else mainWindowMaximized = false; } private void loadMainWindowPosition() { int x = 0; if (SettingsManager.hasValue(Constants.KEY_PARAM_MAIN_WIN_X)) x = SettingsManager.getIntValue(Constants.KEY_PARAM_MAIN_WIN_X, x); int y = 0; if (SettingsManager.hasValue(Constants.KEY_PARAM_MAIN_WIN_Y)) y = SettingsManager.getIntValue(Constants.KEY_PARAM_MAIN_WIN_Y, y); mainWindowPosition = new Point(x, y); } private void loadMainWindowSize() { int width = 0; if (SettingsManager.hasValue(Constants.KEY_PARAM_MAIN_WIN_WIDTH)) width = SettingsManager.getIntValue(Constants.KEY_PARAM_MAIN_WIN_WIDTH, width); int height = 0; if (SettingsManager.hasValue(Constants.KEY_PARAM_MAIN_WIN_HEIGHT)) height = SettingsManager.getIntValue(Constants.KEY_PARAM_MAIN_WIN_HEIGHT, height); if (width > 0 && height > 0) mainWindowSize = new Dimension(width, height); else mainWindowSize = mainWindowPreferredSize; } public Locale getAppLocale() { return ((Locale) paramMap.get(headers[0].getKeyString()).getValue()); } public boolean isMainWindowMaximized() { return mainWindowMaximized; } public Point getMainWindowPosition() { return mainWindowPosition; } public Dimension getMainWindowSize() { return mainWindowSize; } public void setMainWindowMaximized(boolean mainWindowMaximized) { this.mainWindowMaximized = mainWindowMaximized; } public void setMainWindowPosition(Point mainWindowPosition) { this.mainWindowPosition = mainWindowPosition; } public void setMainWindowSize(Dimension mainWindowSize) { this.mainWindowSize = mainWindowSize; } }
694dac4251e67f76b0a0af140542b1a27195d088
6eeecf939eb23853ae332408290a2db9a23e0fa5
/src/databases/MySQL.java
b3baec5a018dc3e9666b2f698c59428da735e88e
[]
no_license
superdyoll/Auction
1bc6daa70228b1498906c7649798c760cd70ec65
6d2215626e22908817f79c67f82eae2d03cd28f5
refs/heads/master
2021-03-27T20:09:15.858124
2015-05-15T14:58:49
2015-05-15T14:58:49
33,179,462
0
0
null
null
null
null
UTF-8
Java
false
false
1,217
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 databases; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author Lloyd */ public class MySQL implements Database { String url = "jdbc:mysql://lloydremotemeuk.domaincommysql.com:3306/auction"; String uname = "my_auction"; String pswrd = "yuvNKJN2"; Connection con = null; @Override public Connection getConnection() { if (con == null){ try { con = DriverManager.getConnection(url, uname, pswrd); } catch (SQLException ex) { Logger.getLogger(MySQL.class.getName()).log(Level.SEVERE, null, ex); } } return con; } @Override public void close() { if(con != null){ try { con.close(); } catch (SQLException ex) { Logger.getLogger(MySQL.class.getName()).log(Level.SEVERE, null, ex); } } } }
b384644270be1b1404346bb44d7ea705ca021c9c
40b218f8e7d61f4737c89fa05ad6a14f3cab0afd
/Petagram3/app/src/main/java/com/rubach/petagram/contactoActivity.java
4cd994de0a24a58e94d634f0b6525d7d1493f487
[]
no_license
rucode/Petagram_Fragment_BaseDatos
a95131d04c5b8a11fdfad85efe5b7d3d7b24c343
aeea3046ebe51bed9ab82a8cad9cc18274977cb9
refs/heads/master
2020-04-02T05:29:08.002058
2016-08-08T03:41:52
2016-08-08T03:42:05
65,160,631
0
1
null
null
null
null
UTF-8
Java
false
false
2,660
java
package com.rubach.petagram; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.view.KeyEvent; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.rubach.petagram.email.SendMail; public class contactoActivity extends AppCompatActivity { private EditText txtNombre; private EditText txtCorreo; private EditText txtBodyEmail; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_contacto); //muestro flecha de retroceder Toolbar miActionBar=(Toolbar) findViewById(R.id.miActionBar); setSupportActionBar(miActionBar); //agrega la flecha hacia atras. getSupportActionBar().setDisplayHomeAsUpEnabled(true); //muestro el logo getSupportActionBar().setLogo(R.drawable.cat_footprint_48); getSupportActionBar().setDisplayUseLogoEnabled(true); //cargo los textview txtNombre = (EditText) findViewById(R.id.txtNombre); txtCorreo= (EditText) findViewById(R.id.txtCorreo); txtBodyEmail= (EditText) findViewById(R.id.txtBodyEmail); //cargo accion del boton Button btnSiguiente = (Button)findViewById(R.id.btnSiguiente); assert btnSiguiente != null; btnSiguiente.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { CargoDatos(); } }); } public void CargoDatos(){ //envio el email Toast.makeText(getBaseContext(),"favor configurar casilla y passord para el envio", Toast.LENGTH_SHORT).show(); //Para testear esta funcionalidad, se debe probar con usuario y clave (gmail) de cada uno, en la clase Config.java. //luego descomentar la funcion sendEmail(); //sendEmail(); } //metodo para cuando pulsa el boton de ir atras. public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode==KeyEvent.KEYCODE_BACK){ finish(); } return super.onKeyDown(keyCode, event); } private void sendEmail() { //seteo las variables. String email = txtCorreo.getText().toString().trim(); String subject = txtNombre.getText().toString().trim(); String message = txtBodyEmail.getText().toString().trim(); //Creo el objeto SendMail sm = new SendMail(this, email, subject, message); //Envio el email sm.execute(); } }
75fc3011fa6820654cf2f7758c7017b9d13046a4
4a94247f4e4e862289a621596a0ad172ae018e2f
/src/main/java/com/tpo/bankjob/conf/GlobalProperties.java
54fba3a5e68aa515ede1b9f17ed4128c03b03048
[]
no_license
gaxelac0/bankjob
3e0f4cc34bc534d1c7e68cad08af2ea11b831e82
9d4b6c8553b5831ac7fcaf9d27950bba28693607
refs/heads/master
2023-09-02T06:40:18.337919
2021-11-18T13:17:29
2021-11-18T13:17:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
277
java
package com.tpo.bankjob.conf; //@Configuration //@PropertySource("classpath:global.properties") public class GlobalProperties { // @Value("${dias}") private int dias; public int getDias() { return dias; } public void setDias(int dias) { this.dias = dias; } }
c752bd971788a811723f7f7649805f3aa88f0ced
76a66820dde694588ce4697b736e6c22da79a366
/solutions/ChallengeThree.java
ac5988fd0645d9ef1ee132bc0d0e7570347f226f
[ "MIT" ]
permissive
SA-JackMax/java-beginner-problems-from-lrakai
39ea3b18e4db8357de466cada02dc21e17cebdca
f2c372b170ab59cfa2e9de64a8c9e08561e9bc93
refs/heads/master
2023-07-11T19:51:51.733384
2019-11-15T23:06:05
2019-11-15T23:06:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,194
java
import java.time.LocalDate; public class ChallengeThree { public static String dayOfWeek(String date) { /** * Returns a String storing the day of the week in all capital letters of the * given date String * Complete the implementation of the DateUtil class and use it in this function * Arguments * date - a String storing a local date, such as "2000-01-01" * Examples * dayOfWeek("2000-01-01") returns "SATURDAY" */ // ==================================== // Do not change the code before this // CODE1: Write code to return the day of the week of the String date // using the DateUtil class at the bottom of this file return new DateUtil(date).dayOfWeek(); // ==================================== // Do not change the code after this } public static void main(String[] args) { String theDayOfWeek = dayOfWeek("2000-01-01"); String expected = "SATURDAY"; // Expected output is // true System.out.println(theDayOfWeek == expected); } } class DateUtil { LocalDate theDate; public DateUtil(String date) { /** * Initialize the theDate field using the String date argument * Arguments * date - a String storing a local date, such as "2000-01-01" */ // ==================================== // Do not change the code before this // CODE2: Write code to initialize the date field of the class theDate = LocalDate.parse(date); // ==================================== // Do not change the code after this } public String dayOfWeek() { /** * Return a String the day of the week represented by theDate */ // ==================================== // Do not change the code before this // CODE3: Write code to return the String day of the week of theDate return theDate.getDayOfWeek().toString(); // ==================================== // Do not change the code after this } }
5d9765ddc6ed8990bfe201ffaa29b19d11fa3516
a41cf0c0c1c9d3b338b791fdd6dcc389cb1f58a8
/week-04/projects/src/FuckingTrump.java
0f3e2bd923000c0e2777312e8a29080cca0e00b9
[]
no_license
greenfox-zerda-raptors/regnisalram
019db74ec2adf7122773cb3c17c666c941cf3081
49379da526438b9aa12fdb4b3d3cbd6142087f6b
refs/heads/master
2021-01-11T05:46:05.800423
2017-01-13T09:21:34
2017-01-13T09:21:34
71,349,302
0
0
null
null
null
null
UTF-8
Java
false
false
1,656
java
import java.util.*; import java.io.*; /** * Created by regnisalram on 11/11/16. */ public class FuckingTrump { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Did you vote for Trump? y/n"); System.out.println(vote(input.nextLine())); System.out.println(); System.out.println("Also, here is a random thing that he promised to do:\n" + scared()); System.out.println(); System.out.println("facts are from mashable.com (http://mashable.com/2016/11/10/donald-trump-campaign-promises/#h_sjIOHVimqP)"); } public static String vote(String answer) { String message; if (answer.equals("y")) { message = "What the fuck did you just do?"; } else if (answer.equals("n")) { message = "What the fuck are we gonna do?"; } else { message = "Well, if you can't decide, that's already scary."; } return message; } public static String scared() { List<String> lines = new ArrayList<String>(); File promiseList = new File("/Users/regnisalram/greenfox/regnisalram/week-04/projects/promises.txt"); try { BufferedReader reader = new BufferedReader(new FileReader(promiseList)); String line = reader.readLine(); while (line != null) { lines.add(line); line = reader.readLine(); } } catch (Exception e) { } Random r = new Random(); String randomLine = lines.get(r.nextInt(lines.size())); return randomLine; } }
a3341a315ed7e09fdfd94ec9421f67c897841809
53271e7ba89e73c15e78b91935c16a7814b9a74b
/mall-mbg/src/main/java/com/tsien/mall/mbg/domain/model/oms/OmsCompanyAddress.java
1f3ee225002e48ca2f3bd9ebc509afa82ecd15a7
[]
no_license
Tsien16/mall-swarm
98b885117c39e63cf42fe2664301970b69fed291
04576067447b41db4f2d0fc6e3e365b19f33d512
refs/heads/master
2023-01-03T21:35:18.496722
2020-10-23T10:07:56
2020-10-23T10:07:56
306,597,333
0
0
null
null
null
null
UTF-8
Java
false
false
1,344
java
package com.tsien.mall.mbg.domain.model.oms; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import java.time.LocalDateTime; /** * Created with IntelliJ IDEA. * 订单管理模块-公司收发货地址表 * * @author tsien * @version 1.0.0 * @date 2020/10/11 0011 0:14 */ @Data @Builder @AllArgsConstructor @NoArgsConstructor public class OmsCompanyAddress { /** * 主键 */ private Long id; /** * 地址名称 */ private String addressName; /** * 收发货人姓名 */ private String name; /** * 收货人电话 */ private String phone; /** * 邮政编码 */ private String postCode; /** * 省/直辖市 */ private String province; /** * 市 */ private String city; /** * 区 */ private String region; /** * 详细地址 */ private String detailAddress; /** * 默认发货地址:0->否;1->是 */ private Integer sendStatus; /** * 是否默认收货地址:0->否;1->是 */ private Integer receiveStatus; /** * 创建时间 */ private LocalDateTime createTime; /** * 更新时间 */ private LocalDateTime updateTime; }
a79dbb371abc282f68059f99a9a1ad426cf8cc70
ab71e6f0b5f9bf20ab7f9e1a1356a7fc0c4e3b24
/Java_tut/Hooman.java
fcb86d3b268a028dd5a95d441f0ac2f8a103c233
[]
no_license
Securiteru/RoadToJava-Done
bfa97cf8cd3b253d54964b65d4d28dba8aabd7ee
c529492de66f281827a20a32ef668d0cd4fcd0bf
refs/heads/master
2020-03-22T12:09:05.758336
2018-08-21T18:09:05
2018-08-21T18:09:05
140,020,378
0
0
null
null
null
null
UTF-8
Java
false
false
299
java
package Java_tut; public class Hooman implements info { private String name; public Hooman(String name) { super(); this.name = name; } public void greet() { System.out.println("Hellloooo"); } @Override public void showInfo() { System.out.println("Person name is " + name); } }
e3ee8aa395a6ca18605b041900096dc4be97eed2
295850531e3e3cda905df084ba7cd0b04d7b3331
/demos/flamingo-demo/src/main/java/org/pushingpixels/demo/flamingo/svg/filetypes/transcoded/ext_pub.java
a43e6e1ce2ac6a21fccd240e0a0576e577d63744
[ "BSD-3-Clause" ]
permissive
fangyuzhong2016/radiance
4a2103866b30cba779213e5ec8a12dafd7e6d475
9460f6577499da97625f23b286073b5ad968ad6a
refs/heads/sunshine
2023-05-11T18:01:14.871021
2021-06-05T02:54:29
2021-06-05T02:54:29
194,482,878
0
0
BSD-3-Clause
2021-04-11T03:35:53
2019-06-30T06:25:05
Java
UTF-8
Java
false
false
20,985
java
package org.pushingpixels.demo.flamingo.svg.filetypes.transcoded; import java.awt.*; import java.awt.geom.*; import java.awt.image.BufferedImage; import java.io.*; import java.lang.ref.WeakReference; import java.util.Base64; import java.util.Stack; import javax.imageio.ImageIO; import javax.swing.SwingUtilities; import javax.swing.plaf.UIResource; import org.pushingpixels.neon.api.icon.ResizableIcon; import org.pushingpixels.neon.api.icon.ResizableIconUIResource; /** * This class has been automatically generated using <a * href="https://github.com/kirill-grouchnikov/radiance">Photon SVG transcoder</a>. */ public class ext_pub implements ResizableIcon { private Shape shape = null; private GeneralPath generalPath = null; private Paint paint = null; private Stroke stroke = null; private Shape clip = null; private Stack<AffineTransform> transformsStack = new Stack<>(); private void _paint0(Graphics2D g,float origAlpha) { transformsStack.push(g.getTransform()); // g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); transformsStack.push(g.getTransform()); g.transform(new AffineTransform(0.009999999776482582f, 0.0f, 0.0f, 0.009999999776482582f, 0.13999999687075615f, -0.0f)); // _0 g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); transformsStack.push(g.getTransform()); g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); // _0_0 if (generalPath == null) { generalPath = new GeneralPath(); } else { generalPath.reset(); } generalPath.moveTo(45.2f, 1.0f); generalPath.lineTo(72.1f, 27.7f); generalPath.lineTo(72.1f, 99.0f); generalPath.lineTo(0.3f, 99.0f); generalPath.lineTo(0.3f, 1.0f); generalPath.lineTo(45.2f, 1.0f); generalPath.closePath(); shape = generalPath; paint = new LinearGradientPaint(new Point2D.Double(36.20000076293945, 3.005000114440918), new Point2D.Double(36.20000076293945, 101.0), new float[] {0.0f,0.124f,0.262f,0.41f,0.571f,0.752f,1.0f}, new Color[] {new Color(0, 107, 105, 255),new Color(0, 128, 127, 255),new Color(0, 147, 147, 255),new Color(0, 163, 163, 255),new Color(0, 176, 175, 255),new Color(8, 184, 183, 255),new Color(20, 187, 187, 255)}, MultipleGradientPaint.CycleMethod.NO_CYCLE, MultipleGradientPaint.ColorSpaceType.SRGB, new AffineTransform(1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 102.0f)); g.setPaint(paint); g.fill(shape); g.setTransform(transformsStack.pop()); g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); transformsStack.push(g.getTransform()); g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); // _0_1 if (generalPath == null) { generalPath = new GeneralPath(); } else { generalPath.reset(); } generalPath.moveTo(45.2f, 1.0f); generalPath.lineTo(72.1f, 27.7f); generalPath.lineTo(72.1f, 99.0f); generalPath.lineTo(0.3f, 99.0f); generalPath.lineTo(0.3f, 1.0f); generalPath.lineTo(45.2f, 1.0f); generalPath.closePath(); shape = generalPath; paint = new LinearGradientPaint(new Point2D.Double(0.32499998807907104, 49.99700164794922), new Point2D.Double(72.07499694824219, 49.99700164794922), new float[] {0.005f,0.343f,1.0f}, new Color[] {new Color(7, 114, 101, 0),new Color(0, 106, 105, 0),new Color(0, 56, 54, 0)}, MultipleGradientPaint.CycleMethod.NO_CYCLE, MultipleGradientPaint.ColorSpaceType.SRGB, new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); g.setPaint(paint); g.fill(shape); paint = new Color(0, 110, 108, 255); stroke = new BasicStroke(2.0f,0,0,4.0f,null,0.0f); if (generalPath == null) { generalPath = new GeneralPath(); } else { generalPath.reset(); } generalPath.moveTo(45.2f, 1.0f); generalPath.lineTo(72.1f, 27.7f); generalPath.lineTo(72.1f, 99.0f); generalPath.lineTo(0.3f, 99.0f); generalPath.lineTo(0.3f, 1.0f); generalPath.lineTo(45.2f, 1.0f); generalPath.closePath(); shape = generalPath; g.setPaint(paint); g.setStroke(stroke); g.draw(shape); g.setTransform(transformsStack.pop()); g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); transformsStack.push(g.getTransform()); g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); // _0_2 if (generalPath == null) { generalPath = new GeneralPath(); } else { generalPath.reset(); } generalPath.moveTo(8.8f, 91.1f); generalPath.lineTo(8.8f, 71.2f); generalPath.lineTo(15.3f, 71.2f); generalPath.curveTo(17.8f, 71.2f, 19.4f, 71.299995f, 20.1f, 71.5f); generalPath.curveTo(21.2f, 71.8f, 22.2f, 72.4f, 23.0f, 73.4f); generalPath.curveTo(23.8f, 74.4f, 24.2f, 75.700005f, 24.2f, 77.3f); generalPath.curveTo(24.2f, 78.5f, 24.0f, 79.5f, 23.5f, 80.4f); generalPath.curveTo(23.1f, 81.200005f, 22.5f, 81.9f, 21.8f, 82.4f); generalPath.curveTo(21.099998f, 82.9f, 20.4f, 83.200005f, 19.699999f, 83.3f); generalPath.curveTo(18.699999f, 83.5f, 17.3f, 83.600006f, 15.499999f, 83.600006f); generalPath.lineTo(12.9f, 83.600006f); generalPath.lineTo(12.9f, 91.100006f); generalPath.lineTo(8.8f, 91.100006f); generalPath.closePath(); generalPath.moveTo(12.8f, 74.6f); generalPath.lineTo(12.8f, 80.2f); generalPath.lineTo(15.0f, 80.2f); generalPath.curveTo(16.6f, 80.2f, 17.7f, 80.1f, 18.2f, 79.899994f); generalPath.curveTo(18.7f, 79.7f, 19.2f, 79.399994f, 19.5f, 78.899994f); generalPath.curveTo(19.8f, 78.49999f, 20.0f, 77.899994f, 20.0f, 77.399994f); generalPath.curveTo(20.0f, 76.7f, 19.8f, 76.09999f, 19.4f, 75.59999f); generalPath.curveTo(19.0f, 75.09999f, 18.4f, 74.79999f, 17.8f, 74.69999f); generalPath.curveTo(17.3f, 74.59999f, 16.4f, 74.59999f, 14.9f, 74.59999f); generalPath.lineTo(12.799999f, 74.59999f); generalPath.closePath(); generalPath.moveTo(27.400002f, 71.2f); generalPath.lineTo(31.400002f, 71.2f); generalPath.lineTo(31.400002f, 82.0f); generalPath.curveTo(31.400002f, 83.7f, 31.400002f, 84.8f, 31.500002f, 85.3f); generalPath.curveTo(31.700003f, 86.100006f, 32.100002f, 86.8f, 32.7f, 87.3f); generalPath.curveTo(33.3f, 87.8f, 34.2f, 88.0f, 35.4f, 88.0f); generalPath.curveTo(36.5f, 88.0f, 37.4f, 87.8f, 38.0f, 87.3f); generalPath.curveTo(38.6f, 86.8f, 38.9f, 86.3f, 39.0f, 85.600006f); generalPath.curveTo(39.1f, 84.90001f, 39.2f, 83.8f, 39.2f, 82.200005f); generalPath.lineTo(39.2f, 71.200005f); generalPath.lineTo(43.2f, 71.200005f); generalPath.lineTo(43.2f, 81.600006f); generalPath.curveTo(43.2f, 84.00001f, 43.100002f, 85.700005f, 42.9f, 86.600006f); generalPath.curveTo(42.7f, 87.600006f, 42.300003f, 88.40001f, 41.7f, 89.100006f); generalPath.curveTo(41.1f, 89.8f, 40.3f, 90.3f, 39.3f, 90.700005f); generalPath.curveTo(38.3f, 91.100006f, 37.0f, 91.3f, 35.5f, 91.3f); generalPath.curveTo(33.6f, 91.3f, 32.1f, 91.100006f, 31.2f, 90.600006f); generalPath.curveTo(30.300003f, 90.100006f, 29.400002f, 89.600006f, 28.900002f, 88.90001f); generalPath.curveTo(28.400002f, 88.20001f, 28.000002f, 87.50001f, 27.800001f, 86.70001f); generalPath.curveTo(27.500002f, 85.60001f, 27.400002f, 83.90001f, 27.400002f, 81.70001f); generalPath.lineTo(27.400002f, 71.2f); generalPath.closePath(); generalPath.moveTo(47.5f, 71.2f); generalPath.lineTo(55.5f, 71.2f); generalPath.curveTo(57.1f, 71.2f, 58.3f, 71.299995f, 59.0f, 71.399994f); generalPath.curveTo(59.8f, 71.49999f, 60.5f, 71.799995f, 61.1f, 72.2f); generalPath.curveTo(61.699997f, 72.6f, 62.199997f, 73.2f, 62.6f, 73.899994f); generalPath.curveTo(63.0f, 74.59999f, 63.199997f, 75.399994f, 63.199997f, 76.2f); generalPath.curveTo(63.199997f, 77.1f, 62.899998f, 78.0f, 62.399998f, 78.799995f); generalPath.curveTo(61.899998f, 79.59999f, 61.199997f, 80.2f, 60.399998f, 80.49999f); generalPath.curveTo(61.6f, 80.899994f, 62.6f, 81.49999f, 63.199997f, 82.299995f); generalPath.curveTo(63.899998f, 83.1f, 64.2f, 84.1f, 64.2f, 85.299995f); generalPath.curveTo(64.2f, 86.2f, 63.999996f, 87.1f, 63.6f, 87.899994f); generalPath.curveTo(63.199997f, 88.799995f, 62.6f, 89.399994f, 61.899998f, 89.899994f); generalPath.curveTo(61.199997f, 90.399994f, 60.3f, 90.7f, 59.199997f, 90.799995f); generalPath.curveTo(58.499996f, 90.899994f, 56.899998f, 90.899994f, 54.299995f, 90.899994f); generalPath.lineTo(47.499996f, 90.899994f); generalPath.lineTo(47.499996f, 71.2f); generalPath.closePath(); generalPath.moveTo(51.6f, 74.5f); generalPath.lineTo(51.6f, 79.1f); generalPath.lineTo(54.199997f, 79.1f); generalPath.curveTo(55.799995f, 79.1f, 56.699997f, 79.1f, 57.1f, 79.0f); generalPath.curveTo(57.8f, 78.9f, 58.3f, 78.7f, 58.699997f, 78.3f); generalPath.curveTo(59.1f, 77.9f, 59.299995f, 77.4f, 59.299995f, 76.8f); generalPath.curveTo(59.299995f, 76.200005f, 59.099995f, 75.700005f, 58.799995f, 75.3f); generalPath.curveTo(58.499996f, 74.9f, 57.999996f, 74.700005f, 57.299995f, 74.600006f); generalPath.curveTo(56.899994f, 74.600006f, 55.799995f, 74.50001f, 53.899994f, 74.50001f); generalPath.lineTo(51.599995f, 74.50001f); generalPath.closePath(); generalPath.moveTo(51.6f, 82.4f); generalPath.lineTo(51.6f, 87.700005f); generalPath.lineTo(55.3f, 87.700005f); generalPath.curveTo(56.8f, 87.700005f, 57.7f, 87.700005f, 58.1f, 87.600006f); generalPath.curveTo(58.699997f, 87.50001f, 59.199997f, 87.200005f, 59.6f, 86.8f); generalPath.curveTo(60.0f, 86.4f, 60.199997f, 85.8f, 60.199997f, 85.100006f); generalPath.curveTo(60.199997f, 84.50001f, 60.1f, 84.00001f, 59.799995f, 83.600006f); generalPath.curveTo(59.499996f, 83.200005f, 59.099995f, 82.90001f, 58.499996f, 82.700005f); generalPath.curveTo(57.999996f, 82.50001f, 56.799995f, 82.4f, 54.899998f, 82.4f); generalPath.lineTo(51.6f, 82.4f); generalPath.closePath(); shape = generalPath; paint = new Color(255, 255, 255, 255); g.setPaint(paint); g.fill(shape); g.setTransform(transformsStack.pop()); g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); transformsStack.push(g.getTransform()); g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); // _0_3 if (generalPath == null) { generalPath = new GeneralPath(); } else { generalPath.reset(); } generalPath.moveTo(31.1f, 36.2f); generalPath.curveTo(31.1f, 33.0f, 29.5f, 31.400002f, 27.1f, 31.400002f); generalPath.curveTo(26.1f, 31.400002f, 25.4f, 31.500002f, 25.0f, 31.7f); generalPath.lineTo(25.0f, 41.2f); generalPath.curveTo(25.5f, 41.4f, 26.1f, 41.5f, 26.8f, 41.5f); generalPath.curveTo(29.5f, 41.4f, 31.099998f, 39.6f, 31.099998f, 36.2f); generalPath.closePath(); shape = generalPath; paint = new LinearGradientPaint(new Point2D.Double(28.031999588012695, 41.41299819946289), new Point2D.Double(28.031999588012695, 31.378000259399414), new float[] {0.005f,0.343f,1.0f}, new Color[] {new Color(0, 130, 129, 255),new Color(0, 106, 105, 255),new Color(0, 56, 54, 255)}, MultipleGradientPaint.CycleMethod.NO_CYCLE, MultipleGradientPaint.ColorSpaceType.SRGB, new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); g.setPaint(paint); g.fill(shape); g.setTransform(transformsStack.pop()); g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); transformsStack.push(g.getTransform()); g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); // _0_4 if (generalPath == null) { generalPath = new GeneralPath(); } else { generalPath.reset(); } generalPath.moveTo(15.0f, 55.3f); generalPath.lineTo(41.1f, 62.0f); generalPath.lineTo(41.1f, 19.3f); generalPath.lineTo(15.0f, 26.0f); generalPath.lineTo(15.0f, 55.3f); generalPath.closePath(); generalPath.moveTo(22.8f, 29.3f); generalPath.curveTo(23.9f, 29.0f, 25.3f, 28.8f, 27.0f, 28.8f); generalPath.curveTo(29.2f, 28.8f, 30.8f, 29.5f, 31.8f, 30.8f); generalPath.curveTo(32.7f, 32.0f, 33.3f, 33.7f, 33.3f, 35.899998f); generalPath.curveTo(33.3f, 38.1f, 32.8f, 39.899998f, 32.0f, 41.1f); generalPath.curveTo(30.8f, 42.899998f, 28.9f, 43.8f, 26.8f, 43.8f); generalPath.curveTo(26.099998f, 43.8f, 25.5f, 43.8f, 25.0f, 43.6f); generalPath.lineTo(25.0f, 53.399998f); generalPath.lineTo(22.8f, 53.399998f); generalPath.lineTo(22.8f, 29.3f); generalPath.closePath(); shape = generalPath; paint = new LinearGradientPaint(new Point2D.Double(28.030000686645508, 62.0), new Point2D.Double(28.030000686645508, 19.29199981689453), new float[] {0.005f,0.343f,1.0f}, new Color[] {new Color(0, 130, 129, 255),new Color(0, 106, 105, 255),new Color(0, 56, 54, 255)}, MultipleGradientPaint.CycleMethod.NO_CYCLE, MultipleGradientPaint.ColorSpaceType.SRGB, new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); g.setPaint(paint); g.fill(shape); g.setTransform(transformsStack.pop()); g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); transformsStack.push(g.getTransform()); g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); // _0_5 if (generalPath == null) { generalPath = new GeneralPath(); } else { generalPath.reset(); } generalPath.moveTo(43.3f, 24.7f); generalPath.lineTo(43.3f, 27.300001f); generalPath.lineTo(52.1f, 27.300001f); generalPath.lineTo(52.1f, 34.600002f); generalPath.lineTo(43.3f, 34.600002f); generalPath.lineTo(43.3f, 37.4f); generalPath.lineTo(52.1f, 37.4f); generalPath.lineTo(52.1f, 40.600002f); generalPath.lineTo(43.3f, 40.600002f); generalPath.lineTo(43.3f, 43.2f); generalPath.lineTo(52.1f, 43.2f); generalPath.lineTo(52.1f, 46.5f); generalPath.lineTo(43.3f, 46.5f); generalPath.lineTo(43.3f, 49.4f); generalPath.lineTo(52.1f, 49.4f); generalPath.lineTo(52.1f, 52.7f); generalPath.lineTo(43.3f, 52.7f); generalPath.lineTo(43.3f, 58.2f); generalPath.lineTo(58.199997f, 58.2f); generalPath.lineTo(58.199997f, 24.7f); generalPath.closePath(); shape = generalPath; paint = new LinearGradientPaint(new Point2D.Double(50.73899841308594, 58.152000427246094), new Point2D.Double(50.73899841308594, 24.680999755859375), new float[] {0.005f,0.343f,1.0f}, new Color[] {new Color(0, 130, 129, 255),new Color(0, 106, 105, 255),new Color(0, 56, 54, 255)}, MultipleGradientPaint.CycleMethod.NO_CYCLE, MultipleGradientPaint.ColorSpaceType.SRGB, new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); g.setPaint(paint); g.fill(shape); g.setTransform(transformsStack.pop()); g.setComposite(AlphaComposite.getInstance(3, 0.99f * origAlpha)); transformsStack.push(g.getTransform()); g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); // _0_6 g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); transformsStack.push(g.getTransform()); g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); // _0_6_0 if (generalPath == null) { generalPath = new GeneralPath(); } else { generalPath.reset(); } generalPath.moveTo(45.2f, 1.0f); generalPath.lineTo(72.1f, 27.7f); generalPath.lineTo(45.2f, 27.7f); generalPath.lineTo(45.2f, 1.0f); generalPath.closePath(); shape = generalPath; paint = new LinearGradientPaint(new Point2D.Double(45.2140007019043, 74.22899627685547), new Point2D.Double(58.66699981689453, 87.68199920654297), new float[] {0.0f,0.297f,0.44f,0.551f,0.645f,0.729f,0.804f,0.874f,0.938f,0.998f,1.0f}, new Color[] {new Color(214, 237, 232, 255),new Color(211, 235, 230, 255),new Color(199, 227, 223, 255),new Color(183, 216, 213, 255),new Color(160, 203, 201, 255),new Color(132, 186, 185, 255),new Color(98, 167, 167, 255),new Color(52, 147, 148, 255),new Color(0, 127, 127, 255),new Color(0, 107, 106, 255),new Color(0, 107, 105, 255)}, MultipleGradientPaint.CycleMethod.NO_CYCLE, MultipleGradientPaint.ColorSpaceType.SRGB, new AffineTransform(1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 102.0f)); g.setPaint(paint); g.fill(shape); g.setTransform(transformsStack.pop()); g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha)); transformsStack.push(g.getTransform()); g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)); // _0_6_1 if (generalPath == null) { generalPath = new GeneralPath(); } else { generalPath.reset(); } generalPath.moveTo(45.2f, 1.0f); generalPath.lineTo(72.1f, 27.7f); generalPath.lineTo(45.2f, 27.7f); generalPath.lineTo(45.2f, 1.0f); generalPath.closePath(); shape = generalPath; paint = new Color(0, 0, 0, 0); g.setPaint(paint); g.fill(shape); paint = new Color(0, 110, 108, 255); stroke = new BasicStroke(2.0f,0,2,4.0f,null,0.0f); if (generalPath == null) { generalPath = new GeneralPath(); } else { generalPath.reset(); } generalPath.moveTo(45.2f, 1.0f); generalPath.lineTo(72.1f, 27.7f); generalPath.lineTo(45.2f, 27.7f); generalPath.lineTo(45.2f, 1.0f); generalPath.closePath(); shape = generalPath; g.setPaint(paint); g.setStroke(stroke); g.draw(shape); g.setTransform(transformsStack.pop()); g.setTransform(transformsStack.pop()); g.setTransform(transformsStack.pop()); g.setTransform(transformsStack.pop()); } @SuppressWarnings("unused") private void innerPaint(Graphics2D g) { float origAlpha = 1.0f; Composite origComposite = g.getComposite(); if (origComposite instanceof AlphaComposite) { AlphaComposite origAlphaComposite = (AlphaComposite)origComposite; if (origAlphaComposite.getRule() == AlphaComposite.SRC_OVER) { origAlpha = origAlphaComposite.getAlpha(); } } _paint0(g, origAlpha); shape = null; generalPath = null; paint = null; stroke = null; clip = null; transformsStack.clear(); } /** * Returns the X of the bounding box of the original SVG image. * * @return The X of the bounding box of the original SVG image. */ public static double getOrigX() { return 0.13300000131130219; } /** * Returns the Y of the bounding box of the original SVG image. * * @return The Y of the bounding box of the original SVG image. */ public static double getOrigY() { return 0.0; } /** * Returns the width of the bounding box of the original SVG image. * * @return The width of the bounding box of the original SVG image. */ public static double getOrigWidth() { return 0.7379999160766602; } /** * Returns the height of the bounding box of the original SVG image. * * @return The height of the bounding box of the original SVG image. */ public static double getOrigHeight() { return 1.0; } /** The current width of this resizable icon. */ private int width; /** The current height of this resizable icon. */ private int height; /** * Creates a new transcoded SVG image. This is marked as private to indicate that app * code should be using the {@link #of(int, int)} method to obtain a pre-configured instance. */ private ext_pub() { this.width = (int) getOrigWidth(); this.height = (int) getOrigHeight(); } @Override public int getIconHeight() { return height; } @Override public int getIconWidth() { return width; } @Override public synchronized void setDimension(Dimension newDimension) { this.width = newDimension.width; this.height = newDimension.height; } @Override public synchronized void paintIcon(Component c, Graphics g, int x, int y) { Graphics2D g2d = (Graphics2D) g.create(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); g2d.translate(x, y); double coef1 = (double) this.width / getOrigWidth(); double coef2 = (double) this.height / getOrigHeight(); double coef = Math.min(coef1, coef2); g2d.clipRect(0, 0, this.width, this.height); g2d.scale(coef, coef); g2d.translate(-getOrigX(), -getOrigY()); if (coef1 != coef2) { if (coef1 < coef2) { int extraDy = (int) ((getOrigWidth() - getOrigHeight()) / 2.0); g2d.translate(0, extraDy); } else { int extraDx = (int) ((getOrigHeight() - getOrigWidth()) / 2.0); g2d.translate(extraDx, 0); } } Graphics2D g2ForInner = (Graphics2D) g2d.create(); innerPaint(g2ForInner); g2ForInner.dispose(); g2d.dispose(); } /** * Returns a new instance of this icon with specified dimensions. * * @param width Required width of the icon * @param height Required height of the icon * @return A new instance of this icon with specified dimensions. */ public static ResizableIcon of(int width, int height) { ext_pub base = new ext_pub(); base.width = width; base.height = height; return base; } /** * Returns a new {@link UIResource} instance of this icon with specified dimensions. * * @param width Required width of the icon * @param height Required height of the icon * @return A new {@link UIResource} instance of this icon with specified dimensions. */ public static ResizableIconUIResource uiResourceOf(int width, int height) { ext_pub base = new ext_pub(); base.width = width; base.height = height; return new ResizableIconUIResource(base); } /** * Returns a factory that returns instances of this icon on demand. * * @return Factory that returns instances of this icon on demand. */ public static Factory factory() { return ext_pub::new; } }
97469758bf953a35a4bea33cfcd184002e4c21ab
9f861371fb3c8f99905c54bc844dff2953b1615a
/controlStatements/FactorialRecursion.java
30563977124134bd323e83edc46ff7ffd505ac7e
[]
no_license
chkrishnadheeraj/java
ed665020a60dab7e0ab475c4b4baf96c63f71056
8e9a118dcd27ce9dff8d77030f1f08283d3864f8
refs/heads/master
2021-04-27T13:18:53.970034
2018-12-14T06:54:29
2018-12-14T06:54:29
122,437,479
0
0
null
2018-02-22T06:02:48
2018-02-22T06:02:47
null
UTF-8
Java
false
false
543
java
package controlStatements; import java.util.Scanner; class FactorialRecursion{ static int fact(int n){ int output; if(n==1){ return 1; } output = fact(n-1)* n; return output; } public static void main(String args[]){ Scanner scanner = new Scanner(System.in); int num = scanner.nextInt(); System.out.println("Factorial of entered number is: "+fact(num)); } /* Works only for integer range, try to make it work for bigger numbers also. */ }
9d347491d72b4e8e35c22a5bf4ac494efda3efeb
9c6755241eafce525184949f8c5dd11d2e6cefd1
/src/leetcode/algorithms/MaxScoreIndices.java
695b2541fd07f1754f1fa6e98eac361274ae066b
[]
no_license
Baltan/leetcode
782491c3281ad04efbe01dd0dcba2d9a71637a31
0951d7371ab93800e04429fa48ce99c51284d4c4
refs/heads/master
2023-08-17T00:47:41.880502
2023-08-16T16:04:32
2023-08-16T16:04:32
172,838,932
13
3
null
null
null
null
UTF-8
Java
false
false
2,161
java
package leetcode.algorithms; import java.util.ArrayList; import java.util.List; /** * Description: 2155. All Divisions With the Highest Score of a Binary Array * * @author Baltan * @date 2022/1/31 12:58 */ public class MaxScoreIndices { public static void main(String[] args) { System.out.println(maxScoreIndices(new int[]{0, 0, 1, 0})); System.out.println(maxScoreIndices(new int[]{0, 0, 0})); System.out.println(maxScoreIndices(new int[]{1, 1})); } public static List<Integer> maxScoreIndices(int[] nums) { List<Integer> result = new ArrayList<>(); /** * 假设当i为0的时候,即左子数组为空数组,右子数组为nums自身时,所求和为0(等于任意值x都可) */ int sum = 0; /** * 假设当i为0时就是所求和的最大值状态 */ int max = 0; /** * 从左向右逐一将nums中的每个元素从右子数组移出放进左子数组中,如果元素是0,会使得左子数组中0的个数加1,右子数组中1的个 * 数不变,从而所求和sum加1;反之如果元素是1,会使得左子数组中0的个数不变,右子数组中1的个数减1,从而所求和sum减1。通过 * 以上操作可以获得所求和为最大值时的状态 */ for (int i = 0; i < nums.length; i++) { sum += nums[i] == 0 ? 1 : -1; max = Math.max(max, sum); } /** * 重新将i初始化为0,即左子数组为空数组,右子数组为nums自身时 */ sum = 0; /** * 先判断当前初始化状态能否使所求和达到最大值 */ if (max == sum) { result.add(0); } /** * 从左向右逐一将nums中的每个元素从右子数组移出放进左子数组中,判断能否使所求和达到最大值 */ for (int i = 0; i < nums.length; i++) { sum += nums[i] == 0 ? 1 : -1; if (max == sum) { result.add(i + 1); } } return result; } }
8fe48367161e9646fac5f1132f31cfb7208db87a
71939f28b20bbc2f741e6245057494e9b9ef2e42
/dj-service/src/main/java/cn/dlbdata/dj/dto/vangard/VanguardParamVo.java
2451c4feba7d57a3f64c6ffb4da9dfd5d1d83d49
[]
no_license
jamesxiao2016/jlyz-parent
801d213e013723459881067025e5c5b3a8ccd81f
60d2b0a9faa04d45ab2d342f2fac82ad1c1ad849
refs/heads/master
2020-03-17T17:11:52.811523
2018-07-05T02:18:40
2018-07-05T02:19:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
922
java
package cn.dlbdata.dj.dto.vangard; import java.io.Serializable; /** * 先锋作用VO * * @author xiaowei * */ public class VanguardParamVo implements Serializable { /** * */ private static final long serialVersionUID = -6241975440130813359L; // 用户ID private Long userId; private VanguardVo honor;//获得荣誉 private VanguardVo recognition;//先锋表彰 private VanguardVo vgd;//先锋模范 public Long getUserId() { return userId; } public void setUserId(Long userId) { this.userId = userId; } public VanguardVo getHonor() { return honor; } public void setHonor(VanguardVo honor) { this.honor = honor; } public VanguardVo getRecognition() { return recognition; } public void setRecognition(VanguardVo recognition) { this.recognition = recognition; } public VanguardVo getVgd() { return vgd; } public void setVgd(VanguardVo vgd) { this.vgd = vgd; } }
82ca76893b50ef7fee7e6494113cfe17e7097ce8
877172b6b88ee9ccb8f284dad3919b24ce81926f
/basicSample/src/main/java/com/urban/basicsample/core/OpEnroll.java
5ed82c012dd8941487552f07778926c9cfc147ba
[]
no_license
AndrewBlinets/poseschalka_BSUIR
0d82fb8dae095349732e3d3be79c784ccebeee33
9db504f420bb8608ec82b964fdf9b36db2ed2af7
refs/heads/master
2021-01-12T08:10:19.449462
2017-02-10T07:42:14
2017-02-10T07:42:21
76,492,422
2
0
null
null
null
null
UTF-8
Java
false
false
9,915
java
package com.urban.basicsample.core; import com.digitalpersona.android.ptapi.PtConnectionI; import com.digitalpersona.android.ptapi.PtConstants; import com.digitalpersona.android.ptapi.PtException; import com.digitalpersona.android.ptapi.callback.PtGuiStateCallback; import com.digitalpersona.android.ptapi.resultarg.PtBirArg; import com.digitalpersona.android.ptapi.struct.PtBir; import com.digitalpersona.android.ptapi.struct.PtFingerListItem; import com.digitalpersona.android.ptapi.struct.PtGuiSampleImage; import com.digitalpersona.android.ptapi.struct.PtInputBir; import com.digitalpersona.android.ptapi.struct.PtSessionCfgV5; public abstract class OpEnroll extends Thread { private static short SESSION_CFG_VERSION = 5; private PtConnectionI mConn; private int mFingerId; public OpEnroll(PtConnectionI conn, int fingerId) { super("EnrollmentThread" + fingerId); mConn = conn; mFingerId = fingerId; } /** * Enrollment execution code. */ @SuppressWarnings("unused") @Override public void run() { try { // Optional: Set session configuration to enroll 3-5 swipes instead of 5-10 modifyEnrollmentType(); // Obtain finger template PtInputBir template = enroll(); // Test, if finger already isn't enrolled in device. // If yes and template corresponds to finger ID, remove it. Otherwise report an error. /*if(testAndClean()) { // Store enrolled template and finger ID to device addFinger(template); }*/ //This code show how to convert templates, it makes 2 conversions (to ISO template and back) //and verifies that the result match with the original template //Note: PtConvertTemplateEx is supported only by TCD50 V3 (TCD50 with area sensor) and TCD51 if(false) { //Convert just enrolled template to ISO template byte [] mIsoRawTemplate = mConn.convertTemplateEx(PtConstants.PT_TEMPLATE_TYPE_AUTO,PtConstants.PT_TEMPLATE_ENVELOPE_NONE, template.bir.data,PtConstants.PT_TEMPLATE_TYPE_ISO_FMR,PtConstants.PT_TEMPLATE_ENVELOPE_NONE,null,0); //Convert ISO template back to alpha template, get raw template (without header) byte [] aAlphaRawTemplate = mConn.convertTemplateEx(PtConstants.PT_TEMPLATE_TYPE_ISO_FMR,PtConstants.PT_TEMPLATE_ENVELOPE_NONE, mIsoRawTemplate,PtConstants.PT_TEMPLATE_TYPE_ALPHA,PtConstants.PT_TEMPLATE_ENVELOPE_NONE,null,0); //Create template with header PtBir aAlphaBir = new PtBir(); aAlphaBir.factorsMask = template.bir.factorsMask; aAlphaBir.formatID= template.bir.formatID; aAlphaBir.formatOwner= template.bir.formatOwner; aAlphaBir.headerVersion= template.bir.headerVersion; aAlphaBir.purpose= template.bir.purpose; aAlphaBir.quality= template.bir.quality; aAlphaBir.type= template.bir.type; //add raw alpha template data to this header, round up size to 4 and add empty payload (another 4 zero bytes) aAlphaBir.data = new byte[4+((aAlphaRawTemplate.length + 3) & ~3)]; //copy raw template for(int i=0;i<aAlphaRawTemplate.length;i++) { aAlphaBir.data[i] = aAlphaRawTemplate[i]; } //fill additional zero bytes for(int i=aAlphaRawTemplate.length;i<aAlphaBir.data.length;i++) { aAlphaBir.data[i] = 0; } //Convert PtBir to PtInputBir PtInputBir aAlphaInputBir = MakeInputBirFromBir(aAlphaBir); //Match the resulting template against the old template from PtEnroll, should match if(mConn.verify(0,0,false,aAlphaInputBir,null,null,null,null,PtConstants.PT_BIO_INFINITE_TIMEOUT,false,null,null,null)) { onDisplayMessage("Match"); } else { onDisplayMessage("No match!"); } } } catch (PtException e) { // Errors reported in nested methods if(e.getCode() == PtException.PT_STATUS_OPERATION_CANCELED) { } } onFinished(); } /** * Modify enrollment to 3-5 swipes. */ private void modifyEnrollmentType() throws PtException { try { PtSessionCfgV5 sessionCfg = (PtSessionCfgV5) mConn.getSessionCfgEx(SESSION_CFG_VERSION); sessionCfg.enrollMinTemplates = (byte) 3; sessionCfg.enrollMaxTemplates = (byte) 5; mConn.setSessionCfgEx(SESSION_CFG_VERSION, sessionCfg); } catch (PtException e) { onDisplayMessage("Unable to set session cfg - " + e.getMessage()); throw e; } } /** * Simple conversion PtBir to PtInputBir */ private static PtInputBir MakeInputBirFromBir(PtBir aBir) { PtInputBir aInputBir = new PtInputBir(); aInputBir.form = PtConstants.PT_FULLBIR_INPUT; aInputBir.bir = aBir; return aInputBir; } /** * Obtain finger template. */ private PtInputBir enroll() throws PtException { PtGuiStateCallback guiCallback = new PtGuiStateCallback() { public byte guiStateCallbackInvoke(int guiState, int message, byte progress, PtGuiSampleImage sampleBuffer, byte[] data) throws PtException { String s = PtHelper.GetGuiStateCallbackMessage(guiState,message,progress); if(s != null) { onDisplayMessage(s); } return isInterrupted() ? PtConstants.PT_CANCEL : PtConstants.PT_CONTINUE; } }; PtBirArg newTemplate = new PtBirArg(); try { // Register notification callback of operation state // Valid for entire PTAPI session lifetime mConn.setGUICallbacks(null, guiCallback); // Enroll finger, don't store template directly to device but return it to host // to allow verification, if finger isn't already enrolled mConn.enroll(PtConstants.PT_PURPOSE_ENROLL, null, newTemplate, null, null, PtConstants.PT_BIO_INFINITE_TIMEOUT, null, null, null); } catch (PtException e) { onDisplayMessage("Enrollment failed - " + e.getMessage()); throw e; } // Convert obtained BIR to INPUT BIR class return MakeInputBirFromBir(newTemplate.value); } /** Test, if finger already isn't enrolled in device. * If yes and template corresponds to finger ID, remove it. Otherwise report an error. * @return True, if finger can be stored. */ private boolean testAndClean() { try { // List fingers stored in device PtFingerListItem[] fingerList = mConn.listAllFingers(); if(fingerList != null) { for(int i=0; i<fingerList.length; i++) { PtFingerListItem item = fingerList[i]; byte[] fingerData = item.fingerData; if((fingerData != null) && (fingerData.length >= 1)) { int fingerId = item.fingerData[0]; if(fingerId == mFingerId) { // Delete finger from device mConn.deleteFinger(item.slotNr); } else { PtInputBir comparedBir = new PtInputBir(); comparedBir.form = PtConstants.PT_SLOT_INPUT; comparedBir.slotNr = item.slotNr; // Verify, if template doesn't match the enrolled one (last good template) if(mConn.verifyMatch(null, null, null, null, comparedBir, null, null, null, null) == true) { onDisplayMessage("Finger already enrolled as " + FingerId.NAMES[fingerId]); return false; } } } } } } catch (PtException e) { onDisplayMessage("testAndClean failed - " + e.getMessage()); return false; } return true; } /** * Store enrolled template and finger ID to device * @param template InputBir. */ private void addFinger(PtInputBir template) { try { //store template int slot = mConn.storeFinger(template); //store fingerId byte[] fingerData = new byte[1]; fingerData[0] = (byte) mFingerId; mConn.setFingerData(slot, fingerData); } catch (PtException e) { onDisplayMessage("addFinger failed - " + e.getMessage()); } } /** * Display message. To be overridden by sample activity. * @param message Message text. */ abstract protected void onDisplayMessage(String message); /** * Called, if operation is finished. * @param message Message text. */ abstract protected void onFinished(); }
9ee8d65265ad904ad01952873f07bdbce80668ad
de397a2b1641e96d701a919e57a9857629cd9784
/NewbeeDao/src/test/java/mybatis/plus/generator/GeneratorCodeUtil.java
1c5fb03b6fa3a3e4168250c806bf4590fe69a4a1
[]
no_license
zth390872451/NewbeeProject
4d9cb55fa0bf69c8f8feb7ebf5122ec7153b803b
00c743acb62b9f02b7f659a0711adabff1f142b1
refs/heads/master
2020-04-07T16:19:07.126576
2018-11-27T07:51:01
2018-11-27T07:51:01
158,524,262
0
0
null
null
null
null
UTF-8
Java
false
false
5,310
java
package mybatis.plus.generator; import com.baomidou.mybatisplus.generator.AutoGenerator; import com.baomidou.mybatisplus.generator.InjectionConfig; import com.baomidou.mybatisplus.generator.config.*; import com.baomidou.mybatisplus.generator.config.po.TableInfo; import com.baomidou.mybatisplus.generator.config.rules.DbType; import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; import java.util.ArrayList; import java.util.List; /** * 生成代码工具类 * * @author xie.m * @date 2018/8/7 */ public class GeneratorCodeUtil { private GeneratorCodeUtil() { super(); } /** * 接口是否加I前缀 */ private static final boolean SERVICE_NAME_START_WITH_I = true; /** * 是否将mapper.xml文件生成到resources目录下 * 当设置为true,生成到resources目录下,设置为false,默认生成到mapper/xml目录下 */ private static final boolean IS_CHANGE_MAPPER_DIR = true; /** * 基础生成目录 */ private static String baseOutputDir = null; /** * 默认生成目录 */ private static String outputDir = null; /** * mapper文件生成目录 */ private static String mapperOutputDir = null; /** * 数据库连接 */ private static final String DB_URL = "jdbc:mysql://10.234.7.109:3306/hrms"; /** * 数据库名 */ private static final String DB_NAME = "hrms"; /** * 数据库密码 */ private static final String DB_PD = "123456"; /** * 数据库驱动 */ private static final String DRIVER_NAME = "com.mysql.jdbc.Driver"; /** * 生成代码 * * @param packageName * 包路径 * @param tableNames * 表集合,可变参数,可以添加多个表名 */ public static void generateByTables(String packageName, String... tableNames) { generateByTables(null, packageName, tableNames); } /** * 生成代码 * * @param author * 生成代码的作者 * @param packageName * 包路径 * @param tableNames * 表集合,可变参数,可以添加多个表名 */ public static void generateByTables(String author, String packageName, String... tableNames) { generateByTables(author, packageName, DB_URL, DB_NAME, DB_PD, tableNames); } /** * 生成代码 * * @param author * 生成代码的作者 * @param packageName * 包路径 * @param dbUrl * 数据库路径 * @param dbName * 数据库名 * @param dbPassword * 数据库密码 * @param tableNames * 表集合,可变参数,可以添加多个表名 */ public static void generateByTables(String author, String packageName, String dbUrl, String dbName, String dbPassword, String... tableNames) { GlobalConfig config = new GlobalConfig(); DataSourceConfig dataSourceConfig = new DataSourceConfig(); dataSourceConfig.setDbType(DbType.MYSQL).setUrl(dbUrl).setUsername(dbName).setPassword(dbPassword) .setDriverName(DRIVER_NAME); StrategyConfig strategyConfig = new StrategyConfig(); strategyConfig.setCapitalMode(true).setEntityLombokModel(false).setDbColumnUnderline(true) .setNaming(NamingStrategy.underline_to_camel).setEntityBooleanColumnRemoveIsPrefix(true) .setRestControllerStyle(true).setControllerMappingHyphenStyle(true).setSkipView(true) .setInclude(tableNames);// 修改替换成你需要的表名,多个表名传数组 config.setActiveRecord(false).setAuthor(author).setOutputDir(outputDir).setFileOverride(true).setOpen(false) .setEnableCache(false); if (!SERVICE_NAME_START_WITH_I) { config.setServiceName("%sService"); } PackageConfig packageConfig = new PackageConfig().setParent(packageName).setController("controller") .setEntity("entity"); AutoGenerator autoGenerator = new AutoGenerator().setGlobalConfig(config).setDataSource(dataSourceConfig) .setStrategy(strategyConfig).setPackageInfo(packageConfig); if (IS_CHANGE_MAPPER_DIR) { InjectionConfig injectionConfig = getMapperDir(); TemplateConfig templateConfig = getTemplateConfig(); autoGenerator.setCfg(injectionConfig); autoGenerator.setTemplate(templateConfig); } autoGenerator.execute(); } static { String rootDir = System.getProperty("user.dir"); if (null != rootDir && !rootDir.equals("")) { baseOutputDir = rootDir.replace("\\", "/") + "/src/main/"; outputDir = baseOutputDir + "/java"; mapperOutputDir = baseOutputDir + "/resources/mapper/"; } } private static TemplateConfig getTemplateConfig() { TemplateConfig templateConfig = new TemplateConfig(); templateConfig.setXml(null); return templateConfig; } /** * 获取mapper.xml文件的生成目录 * * @return */ private static InjectionConfig getMapperDir() { InjectionConfig injectionConfig = new InjectionConfig() { @Override public void initMap() { return; } }; List<FileOutConfig> fileOutConfigList = new ArrayList<>(); FileOutConfig fileOutConfig = new FileOutConfig("/templates/mapper.xml.vm") { @Override public String outputFile(TableInfo tableInfo) { return mapperOutputDir + tableInfo.getEntityName() + "Mapper.xml"; } }; fileOutConfigList.add(fileOutConfig); injectionConfig.setFileOutConfigList(fileOutConfigList); return injectionConfig; } }
9fcc054d1378333236b5bc534a9a0f88cfedb884
cf1693c8339dd2c78877adb2234713f7bb114016
/src/main/java/logic/ViewUpdates/ChangeBallUpdate.java
89c004b19f2882bb89e71f1ab4ef06021c22d146
[]
no_license
Vasepulv/cc3002-breakout
7c3ed5bc1c2621103cb85f5bd8a6944b4ade9da4
57be1e401e23c137cddb7f3bc16d5ddf010ec327
refs/heads/master
2020-04-07T02:45:56.561575
2018-12-27T17:41:25
2018-12-27T17:41:25
157,988,923
0
0
null
null
null
null
UTF-8
Java
false
false
736
java
package logic.ViewUpdates; import logic.ViewUpdates.LevelChangesUpdate; import logic.ViewUpdates.LevelChangesUpdateReceiver; /** * This represents the update of when a ball is dropped, changing the view; * * @author Valentina Sepulveda * @version 1.0 */ public class ChangeBallUpdate implements LevelChangesUpdate { private int sign; public ChangeBallUpdate(int sign){ this.sign=sign; } /** * This method returns the sign of the action to take with the balls, by either increase it or reduce it. * @return sign */ public int getSign(){ return sign; } @Override public void accept(LevelChangesUpdateReceiver update) { update.changeBallUpdate(this); } }
8c0f98dcabb3a6cebba2fbce3e09ae0a54d62a97
379f24bd7b1b2fd641a854ea62b119f20b970d13
/src/main/java/com/feinik/excel/write/ExcelBuilderImpl.java
f08dd3627e36bb3400d4c91d070d6d06a61a671a
[ "Apache-2.0" ]
permissive
dnsfm/easyexcel-util
793e5f89784e5ad9f74093d298b26cd9cf1e88ba
abfffd27e1a3e81a1a65eee345cda83a4843619e
refs/heads/master
2022-12-26T16:34:30.648170
2019-09-13T08:47:12
2019-09-13T08:47:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,255
java
package com.feinik.excel.write; import com.alibaba.excel.event.WriteHandler; import com.alibaba.excel.exception.ExcelGenerateException; import com.alibaba.excel.metadata.BaseRowModel; import com.alibaba.excel.metadata.ExcelColumnProperty; import com.alibaba.excel.metadata.Sheet; import com.alibaba.excel.metadata.Table; import com.alibaba.excel.support.ExcelTypeEnum; import com.alibaba.excel.util.CollectionUtils; import com.alibaba.excel.util.POITempFile; import com.alibaba.excel.util.TypeUtil; import com.alibaba.excel.util.WorkBookUtil; import com.feinik.excel.context.WriteContext; import net.sf.cglib.beans.BeanMap; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.util.CellRangeAddress; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.List; /** * @author jipengfei */ public class ExcelBuilderImpl implements ExcelBuilder { private WriteContext context; public ExcelBuilderImpl(InputStream templateInputStream, OutputStream out, ExcelTypeEnum excelType, boolean needHead, WriteHandler writeHandler) { try { //初始化时候创建临时缓存目录,用于规避POI在并发写bug POITempFile.createPOIFilesDirectory(); context = new WriteContext(templateInputStream, out, excelType, needHead, writeHandler); } catch (Exception e) { throw new RuntimeException(e); } } @Override public void addContent(List data, int startRow) { if (CollectionUtils.isEmpty(data)) { return; } int rowNum = context.getCurrentSheet().getLastRowNum(); if (rowNum == 0) { Row row = context.getCurrentSheet().getRow(0); if (row == null) { if (context.getExcelHeadProperty() == null || !context.needHead()) { rowNum = -1; } } } if (rowNum < startRow) { rowNum = startRow; } for (int i = 0; i < data.size(); i++) { int n = i + rowNum + 1; addOneRowOfDataToExcel(data.get(i), n); } } @Override public void addContent(List data, Sheet sheetParam) { context.currentSheet(sheetParam); addContent(data, sheetParam.getStartRow()); } @Override public void addContent(List data, Sheet sheetParam, Table table) { context.currentSheet(sheetParam); context.currentTable(table); addContent(data, sheetParam.getStartRow()); } @Override public void merge(int firstRow, int lastRow, int firstCol, int lastCol) { CellRangeAddress cra = new CellRangeAddress(firstRow, lastRow, firstCol, lastCol); context.getCurrentSheet().addMergedRegion(cra); } @Override public void finish() { try { context.getWorkbook().write(context.getOutputStream()); context.getWorkbook().close(); } catch (IOException e) { throw new ExcelGenerateException("IO error", e); } } @Override public WriteContext getContext() { return context; } private void addBasicTypeToExcel(List<Object> oneRowData, Row row) { if (CollectionUtils.isEmpty(oneRowData)) { return; } for (int i = 0; i < oneRowData.size(); i++) { Object cellValue = oneRowData.get(i); Cell cell = WorkBookUtil.createCell(row, i, context.getCurrentContentStyle(), cellValue, TypeUtil.isNum(cellValue)); if (null != context.getAfterWriteHandler()) { context.getAfterWriteHandler().cell(i, cell); } } } private void addJavaObjectToExcel(Object oneRowData, Row row) { int i = 0; BeanMap beanMap = BeanMap.create(oneRowData); for (ExcelColumnProperty excelHeadProperty : context.getExcelHeadProperty().getColumnPropertyList()) { BaseRowModel baseRowModel = (BaseRowModel)oneRowData; String cellValue = TypeUtil.getFieldStringValue(beanMap, excelHeadProperty.getField().getName(), excelHeadProperty.getFormat()); CellStyle cellStyle = baseRowModel.getStyle(i) != null ? baseRowModel.getStyle(i) : context.getCurrentContentStyle(); Cell cell = WorkBookUtil.createCell(row, i, cellStyle, cellValue, TypeUtil.isNum(excelHeadProperty.getField())); if (null != context.getAfterWriteHandler()) { context.getAfterWriteHandler().cell(i, cell); } i++; } } private void addOneRowOfDataToExcel(Object oneRowData, int n) { Row row = WorkBookUtil.createRow(context.getCurrentSheet(), n); if (null != context.getAfterWriteHandler()) { context.getAfterWriteHandler().row(n, row); } if (oneRowData instanceof List) { addBasicTypeToExcel((List)oneRowData, row); } else { addJavaObjectToExcel(oneRowData, row); } } }
bb51708f36c444f7225aa4b0ff2cff0062cb71af
176ed3006bf1bcbae74043f67d987ea3203dae4e
/android/app/src/main/java/com/rajarsheechatterjee/NavigationBarColor/NavigationBarColorModule.java
6fcd4e122294db6641009cc2927872274b645ace
[ "MIT" ]
permissive
BLWine/lnreader
40d1d95dd178341d2828e9cc308fbe59efe52562
e79563f2d0c71efc309267a933a6bbf096a8a764
refs/heads/main
2023-09-04T18:37:06.585595
2021-11-17T09:16:18
2021-11-17T09:16:18
429,681,759
0
0
MIT
2021-11-19T05:36:41
2021-11-19T05:36:40
null
UTF-8
Java
false
false
7,941
java
package com.rajarsheechatterjee.LNReader; import android.animation.ArgbEvaluator; import android.animation.ValueAnimator; import android.annotation.TargetApi; import android.graphics.Color; import android.os.Build; import android.app.Activity; import android.view.View; import android.view.Window; import android.view.WindowManager; import androidx.annotation.UiThread; import com.facebook.react.bridge.Arguments; import com.facebook.react.bridge.Promise; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactContextBaseJavaModule; import com.facebook.react.bridge.ReactMethod; import com.facebook.react.bridge.UiThreadUtil; import com.facebook.react.bridge.WritableMap; import java.util.HashMap; import java.util.Map; import com.facebook.react.uimanager.IllegalViewOperationException; import static com.facebook.react.bridge.UiThreadUtil.runOnUiThread; public class NavigationBarColorModule extends ReactContextBaseJavaModule { public static final String REACT_CLASS = "NavigationBarColor"; private static final String ERROR_NO_ACTIVITY = "E_NO_ACTIVITY"; private static final String ERROR_NO_ACTIVITY_MESSAGE = "Tried to change the navigation bar while not attached to an Activity"; private static final String ERROR_API_LEVEL = "API_LEVEl"; private static final String ERROR_API_LEVEL_MESSAGE = "Only Android Oreo and above is supported"; private static ReactApplicationContext reactContext = null; private static final int UI_FLAG_HIDE_NAV_BAR = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; public NavigationBarColorModule(ReactApplicationContext context) { super(context); reactContext = context; } public void setNavigationBarTheme(Activity activity, Boolean light) { if (activity != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { Window window = activity.getWindow(); int flags = window.getDecorView().getSystemUiVisibility(); if (light) { flags |= View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; } else { flags &= ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; } window.getDecorView().setSystemUiVisibility(flags); } } @Override public String getName() { return REACT_CLASS; } @Override public Map<String, Object> getConstants() { final Map<String, Object> constants = new HashMap<>(); constants.put("EXAMPLE_CONSTANT", "example"); return constants; } @ReactMethod public void changeNavigationBarColor(final String color, final Boolean light, final Boolean animated, final Promise promise) { final WritableMap map = Arguments.createMap(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (getCurrentActivity() != null) { try { final Window window = getCurrentActivity().getWindow(); runOnUiThread(new Runnable() { @Override public void run() { if (color.equals("transparent") || color.equals("translucent")) { window.clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); if (color.equals("transparent")) { window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); } else { window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); } setNavigationBarTheme(getCurrentActivity(), light); map.putBoolean("success", true); promise.resolve(map); return; } else { window.clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); } if (animated) { Integer colorFrom = window.getNavigationBarColor(); Integer colorTo = Color.parseColor(String.valueOf(color)); //window.setNavigationBarColor(colorTo); ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo); colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animator) { window.setNavigationBarColor((Integer) animator.getAnimatedValue()); } }); colorAnimation.start(); } else { window.setNavigationBarColor(Color.parseColor(String.valueOf(color))); } setNavigationBarTheme(getCurrentActivity(), light); WritableMap map = Arguments.createMap(); map.putBoolean("success", true); promise.resolve(map); } }); } catch (IllegalViewOperationException e) { map.putBoolean("success", false); promise.reject("error", e); } } else { promise.reject(ERROR_NO_ACTIVITY, new Throwable(ERROR_NO_ACTIVITY_MESSAGE)); } } else { promise.reject(ERROR_API_LEVEL, new Throwable(ERROR_API_LEVEL_MESSAGE)); } } @ReactMethod public void hideNavigationBar(Promise promise) { try { runOnUiThread(new Runnable() { @Override public void run() { if (getCurrentActivity() != null) { View decorView = getCurrentActivity().getWindow().getDecorView(); decorView.setSystemUiVisibility(UI_FLAG_HIDE_NAV_BAR); } } }); } catch (IllegalViewOperationException e) { WritableMap map = Arguments.createMap(); map.putBoolean("success", false); promise.reject("error", e); } } @ReactMethod public void showNavigationBar(Promise promise) { try { runOnUiThread(new Runnable() { @Override public void run() { if (getCurrentActivity() != null) { Window w = getCurrentActivity().getWindow(); w.setStatusBarColor(Color.TRANSPARENT); w.setNavigationBarColor(Color.TRANSPARENT); View decorView = w.getDecorView(); decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); } } }); } catch (IllegalViewOperationException e) { WritableMap map = Arguments.createMap(); map.putBoolean("success", false); promise.reject("error", e); } } }
2152ed5b52b65a096b32673fd42e1056d6fdc62b
ee13febec4497ed708647a137834758c00992612
/src/Map/MapPractice1.java
5ac5772c16f94f4a872d9de4fa3a105491aa6999
[]
no_license
sdetOST/JavaOST19
e2488b4656087f8d577ec9af42d8004abf3db423
f8759ab86eacb2ace8dcfb187e91acb4c9c094e1
refs/heads/master
2020-09-06T16:41:46.945132
2020-01-02T12:00:56
2020-01-02T12:00:56
220,483,738
0
0
null
null
null
null
UTF-8
Java
false
false
4,164
java
package Map; import java.util.*; public class MapPractice1 { public static void main(String[] args) { // Map-general implementation HashMAp // SortedMap extends Map interface // NavigableMap extends SortedMap // TreeMap extends NavigableMap Map<String, Integer> scoreMap= new HashMap <> (); //put(); scoreMap.put("Ahmet", 10); scoreMap.put("Mehmet", 20); scoreMap.put("Murat", 40); scoreMap.put("Mustafa", 40); scoreMap.put("Ali", 50); scoreMap.put("Murat", 60); scoreMap.put("Veli", 50); scoreMap.put("Kemal", 40); System.out.println(scoreMap); //{Ahmet=10, Mustafa=40, Mehmet=20, Murat=60, Ali=50} // // size(); // // System.out.println(scoreMap.size()); //5 // // //isEmpty(); // // System.out.println(scoreMap.isEmpty()); //false //// scoreMap.clear(); // System.out.println(scoreMap.isEmpty()); //true // // //get (objects); // // System.out.println(scoreMap.get("Mehmet")); //20 // System.out.println(scoreMap.get(20)); //null --we need to write our key, not value - // // // //containsKey(objects Key); // // System.out.println(scoreMap.containsKey("Mustafa")); //true // System.out.println(scoreMap.containsKey(40)); //false -- we need to pass key as parameter, // //if we add value, it gives us false // // //containsValue(Object value); // // System.out.println(scoreMap.containsValue(40)); //true // System.out.println(scoreMap.containsValue("Mustafa")); //false --we need to pass value as parameter // //if we add key, it gives us false // // // //remove(Object key); // // System.out.println(scoreMap.remove("Ahmet")); //10 // System.out.println(scoreMap.remove("Semih")); //null // System.out.println(scoreMap); //{Mustafa=40, Mehmet=20, Murat=60, Ali=50} --remove Ahmet and Ahmet's value // // // void putAll---lookslike AddAll(list, set,queue) // // Map<String, Integer> scoreMap2= new HashMap <> (); // // scoreMap2.put("Ayse", 70); // scoreMap2.put("Fatma", 80); // scoreMap2.put("Gul", 90); // // scoreMap2.putAll(scoreMap); //add all scoreMAp elements inside scoreMap2 // // System.out.println(scoreMap2); //{Mustafa=40, Ayse=70, Fatma=80, Mehmet=20, Murat=60, Gul=90, Ali=50} // // // //putIfAbsent(K key, V value)--the key have to match exactly. it return us correct value // //and if key doesn't match, it return null and add the key and value in our map // // System.out.println(scoreMap.putIfAbsent("Ali",80)); //50 // // System.out.println(scoreMap); // // System.out.println(scoreMap.putIfAbsent("Halil",90)); //null // // System.out.println(scoreMap); //{Mustafa=40, Halil=90, Mehmet=20, Murat=60, Ali=50} // // // //getOrDefault(ObjectKey, V defaultvalue); // // System.out.println(scoreMap2.get("Lale")); //return null -not exist in our list // // System.out.println(scoreMap2.getOrDefault( "Lale", 100)); //it gives 100 -default value // // System.out.println(scoreMap2.getOrDefault( "Mehmet", 100)); //it gives 20-Mehmet's value // // System.out.println(scoreMap2); //{Mustafa=40, Ayse=70, Fatma=80, Mehmet=20, Murat=60, Gul=90, Ali=50} // // //boolean--> remove(Object key, Object Value)-- key and value need to "match" // // System.out.println(scoreMap2.remove("Fatma",70)); //false // System.out.println(scoreMap2); //{Mustafa=40, Ayse=70, Fatma=80, Mehmet=20, Murat=60, Gul=90, Ali=50} // // System.out.println(scoreMap2.remove("Gul",90)); //true --it is match // System.out.println(scoreMap2); //{Mustafa=40, Ayse=70, Fatma=80, Mehmet=20, Murat=60, Ali=50} // // // // // boolean--> replace(Key k,V Old Value, V new Value) // //it need to match key and old value // // System.out.println(scoreMap2.replace("Fatma",80,15)); //true // System.out.println(scoreMap2); //{Mustafa=40, Ayse=70, Fatma=15, Mehmet=20, Murat=60, Ali=50} // // System.out.println(scoreMap2.replace("Fatma",80,30)); //false // System.out.println(scoreMap2); //{Mustafa=40, Ayse=70, Fatma=15, Mehmet=20, Murat=60, Ali=50} } }
[ "“[email protected]”" ]
9b8118ffb97e3fb2bbea6e57d4540efe0ac84739
61065bac369a35282d09c116116ce8f79a1796c9
/app/src/main/java/com/ravi/ezio/personeltodolist/Activities/MainActivity.java
cf8f4e98a0783d600add498c5527787395d01875
[]
no_license
ravidelcj/PersonelToDoList-
edaf0a2b1c88c3914c43cdefc31473a247f3aecf
1d0833c25111056dba95af861e554c09e031f6db
refs/heads/master
2021-01-01T03:53:11.920942
2016-05-06T18:08:52
2016-05-06T18:08:52
57,975,982
0
0
null
null
null
null
UTF-8
Java
false
false
4,019
java
package com.ravi.ezio.personeltodolist.Activities; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.AsyncTask; import android.preference.PreferenceManager; import android.support.design.widget.FloatingActionButton; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.TextView; import com.ravi.ezio.personeltodolist.Backend.CustomToDoType; import com.ravi.ezio.personeltodolist.Backend.DatabaseHelper; import com.ravi.ezio.personeltodolist.Backend.MyRecyclerView; import com.ravi.ezio.personeltodolist.R; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity { public static MainActivity mainActivity; TextView emptyDatabaseNotice; RecyclerView recyclerView; MyRecyclerView recyclerAdapter; List<CustomToDoType> list; DatabaseHelper databaseHelper; private FloatingActionButton addToDo; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mainActivity=this; SharedPreferences prefs= PreferenceManager.getDefaultSharedPreferences(this); if(!prefs.getBoolean("first",false)) { SharedPreferences.Editor editor=prefs.edit(); editor.putBoolean("first",true); editor.commit(); Intent intent=new Intent(this,Splash.class); startActivity(intent); finish(); } setContentView(R.layout.activity_main); init(); //searching for data in database MyAsync async=new MyAsync(this,databaseHelper); async.execute(); addToDo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(MainActivity.this,EnterInfo.class)); finish(); } }); } //Initialising various parameters private void init() { addToDo= (FloatingActionButton) findViewById(R.id.add); databaseHelper=new DatabaseHelper(this); list=new ArrayList<CustomToDoType>(); recyclerView= (RecyclerView) findViewById(R.id.recycler); recyclerView.setLayoutManager(new LinearLayoutManager(this)); emptyDatabaseNotice= (TextView) findViewById(R.id.emptyDatabase); } private class MyAsync extends AsyncTask<Void,Void,Void> { DatabaseHelper databaseHelper; Context context; ProgressDialog progressDialog; public MyAsync(Context context, DatabaseHelper databaseHelper) { this.context=context; progressDialog=new ProgressDialog(context); this.databaseHelper=databaseHelper; } @Override protected void onPreExecute() { super.onPreExecute(); progressDialog.setMessage("Loading..."); progressDialog.setCancelable(false); progressDialog.show(); } @Override protected Void doInBackground(Void... params) { list= databaseHelper.getAllToDo(); return null; } @Override protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); progressDialog.dismiss(); if(list.isEmpty()) { recyclerView.setVisibility(View.GONE); emptyDatabaseNotice.setVisibility(View.VISIBLE); } else { recyclerView.setVisibility(View.VISIBLE); emptyDatabaseNotice.setVisibility(View.GONE); recyclerAdapter=new MyRecyclerView(context,list); recyclerView.setAdapter(recyclerAdapter); } } } }
677bb9e8270676de6b0d785ea555e4cfbd190c1a
21db6f35adef3f7ed5d679a5974151e2226835c6
/src/main/java/com/example/web3/model/AreaChecker.java
d08f3cdbfce46156b123b3b156d36a2a47c9a21b
[]
no_license
robqqq/Web3
f3f2f6f41a2a8913acf82652d22978141c344216
bba158615e67c656a5e137d63a8a49f9db06b5de
refs/heads/master
2023-08-30T16:25:07.559831
2021-11-11T11:04:17
2021-11-11T11:04:17
426,964,117
0
2
null
null
null
null
UTF-8
Java
false
false
94
java
package com.example.web3.model; public interface AreaChecker<T> { boolean check(T p); }
09bd2a53dbff90322166785b34ca5fa345e5a842
4fb46d16f80374a71056bd5dc292a4dc054b7787
/app/src/main/java/com/shuan/Project/asyncTasks/AddCollege.java
2e6a8f4d8b5161e8c7c663cd610a19bc36dace83
[]
no_license
ShuanTech/Project-master
b6aa98ff8c9c65a266fab902bb1b074794e14cfd
cc9d1391c1e171181172a788f9a322e28b483e4d
refs/heads/master
2020-12-02T06:39:22.322232
2017-09-13T17:23:39
2017-09-13T17:23:39
96,867,268
0
0
null
null
null
null
UTF-8
Java
false
false
1,822
java
package com.shuan.Project.asyncTasks; import android.content.Context; import android.os.AsyncTask; import android.widget.Toast; import com.shuan.Project.Utils.Common; import com.shuan.Project.parser.Connection; import com.shuan.Project.parser.php; import org.json.JSONException; import org.json.JSONObject; import java.util.HashMap; /** * Created by Android on 8/6/2016. */ public class AddCollege extends AsyncTask<String,String,String> { private Common mApp; private Context mContext; private String u_id,clgName,univ,loc,conCent,agrt,s=""; private HashMap<String, String> aData; public AddCollege(Context mContext, String u_id, String clgName, String univ, String loc, String conCent, String agrt) { this.mContext = mContext; this.u_id = u_id; this.clgName = clgName; this.univ = univ; this.loc = loc; this.conCent = conCent; this.agrt = agrt; } @Override protected String doInBackground(String... params) { aData = new HashMap<String, String>(); aData.put("u_id", u_id); aData.put("clgName", clgName); aData.put("univ", univ); aData.put("loc", loc); aData.put("coCent", conCent); aData.put("agrt", agrt); try { JSONObject json = Connection.UrlConnection(php.qualify, aData); int succ = json.getInt("success"); if(succ==0){ s="false"; }else{ s="true"; } } catch (JSONException e) { } return null; } @Override protected void onPostExecute(String s) { super.onPostExecute(s); if(s.equalsIgnoreCase("false")){ Toast.makeText(mContext,"Error! Try Again.",Toast.LENGTH_SHORT).show(); } } }
4231776e83ddccb8f60f6b16cef261999087dabe
ee44b8cfc9d9e0bcf1509ef5f7b607074c3f6972
/EvaluacionExp12015/src/entregados/exp155562455/Supermercado.java
d83a9a834a33b79e5d8aa73e75bc4e94e1658501
[]
no_license
fborquez/thdsw
96e7ee7f76620a47e4269a25adb7150159b0985b
7e618a91f543d5145e1299f45933316245eaf972
refs/heads/master
2021-01-10T12:12:51.587432
2015-11-11T01:09:25
2015-11-11T01:09:25
45,679,530
0
1
null
null
null
null
UTF-8
Java
false
false
642
java
/** * Auto Generated Java Class. */ import java.io.*; import java.util.*; import java.text.NumberFormat; public class Supermercado { //Variables public String nombre; public int numCarritos = 5; //Instancio Clase Carrito private Carrito[] carritos = new Carrito[numCarritos]; public Supermercado(String nombre) { /* YOUR CONSTRUCTOR CODE HERE*/ for (int i = 0; i < this.carritos.length; i++) { this.carritos[i] = new Carrito(); } this.nombre = nombre; } public String getNombre() { return this.nombre; } /* ADD YOUR CODE HERE */ }
6573b4d9dc6ebfc8b5ffa02bb0aa1d0fb8ec2cf3
c222bb3808d941b0d8d0d7e337e62b2cda3eaae4
/app/src/main/java/com/locationback/locatontrack/MainActivity.java
21b27553ff38c774f7b8447d0fd62872c292cddb
[]
no_license
azamyadullahi/locatonTrack
1e5b41fb269eb1514bd19480fa32f46ef101f976
dea271d90ececfe2dca51bd6e494d667353730ba
refs/heads/master
2020-09-22T20:27:17.659316
2019-12-02T07:45:34
2019-12-02T07:45:34
225,315,042
0
0
null
null
null
null
UTF-8
Java
false
false
4,511
java
package com.locationback.locatontrack; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ProgressBar; import android.widget.Toast; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; public class MainActivity extends AppCompatActivity { private EditText inputEmail, inputPassword; private FirebaseAuth auth; private ProgressBar progressBar; private Button btnSignup, btnLogin, btnReset; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Get Firebase auth instance auth = FirebaseAuth.getInstance(); if (auth.getCurrentUser() != null) { startActivity(new Intent(MainActivity.this, secondActivity.class)); finish(); } // set the view now setContentView(R.layout.activity_main); inputEmail = (EditText) findViewById(R.id.email); inputPassword = (EditText) findViewById(R.id.password); progressBar = (ProgressBar) findViewById(R.id.progressBar); btnSignup = (Button) findViewById(R.id.btn_signup); btnLogin = (Button) findViewById(R.id.btn_login); btnReset = (Button) findViewById(R.id.btn_reset_password); //Get Firebase auth instance auth = FirebaseAuth.getInstance(); btnSignup.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(MainActivity.this, SignupActivity.class)); } }); btnReset.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(MainActivity.this, ResetPasswordActivity.class)); } }); btnLogin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String email = inputEmail.getText().toString(); final String password = inputPassword.getText().toString(); if (TextUtils.isEmpty(email)) { Toast.makeText(getApplicationContext(), "Enter email address!", Toast.LENGTH_SHORT).show(); return; } if (TextUtils.isEmpty(password)) { Toast.makeText(getApplicationContext(), "Enter password!", Toast.LENGTH_SHORT).show(); return; } progressBar.setVisibility(View.VISIBLE); //authenticate user auth.signInWithEmailAndPassword(email, password) .addOnCompleteListener(MainActivity.this, new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { // If sign in fails, display a message to the user. If sign in succeeds // the auth state listener will be notified and logic to handle the // signed in user can be handled in the listener. progressBar.setVisibility(View.GONE); if (!task.isSuccessful()) { // there was an error if (password.length() < 6) { inputPassword.setError(getString(R.string.minimum_password)); } else { Toast.makeText(MainActivity.this, getString(R.string.auth_failed), Toast.LENGTH_LONG).show(); } } else { Intent intent = new Intent(MainActivity.this, secondActivity.class); startActivity(intent); finish(); } } }); } }); } }
f42d9318f23ab02dfd3a0db0f1d997012c5c08aa
cfe3fe6122bf28eb0dcbb370d854ed90e4a8eb67
/jpa03-model07/src/main/java/me/kickscar/practices/jpa03/model07/repository/JpaBlogQryDslRepositoryImpl.java
e4bc34f563ca5f0598f6fd22c2854bcef72e8b19
[]
no_license
MaximSungmo/jpa-practices
34cff2fe490ce54e2a9486339d1c5ec613e1db65
07fffd72eeaadb41b13b209725b9eed57c24fda9
refs/heads/master
2020-12-06T10:55:16.365594
2020-01-07T08:16:49
2020-01-07T08:16:49
232,445,710
1
0
null
2020-01-08T00:46:38
2020-01-08T00:46:37
null
UTF-8
Java
false
false
1,262
java
package me.kickscar.practices.jpa03.model07.repository; import com.querydsl.jpa.impl.JPAQueryFactory; import me.kickscar.practices.jpa03.model07.domain.Blog; import me.kickscar.practices.jpa03.model07.dto.BlogDto; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport; import java.util.List; import static me.kickscar.practices.jpa03.model07.domain.QBlog.blog; import me.kickscar.practices.jpa03.model07.dto.QBlogDto; public class JpaBlogQryDslRepositoryImpl extends QuerydslRepositorySupport implements JpaBlogQryDslRepository { @Autowired private JPAQueryFactory queryFactory; public JpaBlogQryDslRepositoryImpl() { super(Blog.class); } @Override public List<Blog> findAll2() { return queryFactory .select(blog) .from(blog) .innerJoin(blog.user) .fetchJoin() .fetch(); } @Override public List<BlogDto> findAll3() { return queryFactory .select(new QBlogDto(blog.no, blog.name, blog.user.id.as("userId"))) .from(blog) .innerJoin(blog.user) .fetch(); } }
6815b574e35163881f781d1db9c31a9c9c592b8c
7c4ab477d971333116bc510dade23383fef81f7f
/ch.digitalmeat.generation/src/ch/digitalmeat/generation/level/room/Randomizer.java
4c6ed4320d2cc8e337214b786beedc8ddc818688
[]
no_license
tomvangreen/generation
757d77efb62735e39407032c37b70b3102731c33
87eb2de84b90b9998f1dbec57ccc0878b75ec352
refs/heads/master
2020-12-30T10:37:05.662844
2014-03-26T13:54:44
2014-03-26T13:54:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,875
java
package ch.digitalmeat.generation.level.room; import static ch.digitalmeat.generation.level.data.Direction8.East; import static ch.digitalmeat.generation.level.data.Direction8.North; import static ch.digitalmeat.generation.level.data.Direction8.South; import static ch.digitalmeat.generation.level.data.Direction8.West; import static ch.digitalmeat.generation.level.room.RoomCellFactory.DOOR; import static ch.digitalmeat.generation.level.room.RoomCellFactory.EMPTY; import static ch.digitalmeat.generation.level.room.RoomCellFactory.WALL; import ch.digitalmeat.generation.data.List2D; import ch.digitalmeat.generation.level.Processor; import ch.digitalmeat.generation.level.data.Cell; import ch.digitalmeat.generation.level.data.Grid; public class Randomizer extends Processor { @Override protected boolean processImplementation(Grid level) { List2D<Cell> cells = level.cells(); int length = cells.length(); for (int index = 0; index < length; index++) { Cell cell = cells.get(index); randomize(cell); } return true; } private void randomize(Cell cell) { if (r.nextInt(4) == 0) { cell.put(RoomCellFactory.USED, false); } else { cell.put(RoomCellFactory.USED, true); cell.put(RoomCellFactory.CONNECTED, r.nextBoolean()); cell.put(North.name, randomWall()); cell.put(East.name, randomWall()); cell.put(South.name, randomWall()); cell.put(West.name, randomWall()); // cell.put(North.name, DOOR); // cell.put(East.name, DOOR); // cell.put(South.name, DOOR); // cell.put(West.name, DOOR); } } private int randomWall() { switch (r.nextInt(3)) { default: case 0: return EMPTY; case 1: return WALL; case 2: return DOOR; } } }
26f7e7a40cb6cdb1cece7fcfc600e1029229cf82
b2bf0f9e5f019421c624e01684eb62f07784d0ce
/src/main/java/org/entando/kubernetes/model/bundle/EntandoComponentBundleFluent.java
fa3139a9a63920b97a3c359a58f4e5b779bb4c5e
[]
no_license
Kerruba/entando-component-bundle-k8s-model
f6e0e76f2c527502179dbb2c0cc06be6d8741071
1145538f811364b7b9bee29de00bdda87218d285
refs/heads/master
2022-11-18T00:57:14.194095
2020-07-13T12:38:50
2020-07-13T12:38:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,758
java
/* * * Copyright 2015-Present Entando Inc. (http://www.entando.com) All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * */ package org.entando.kubernetes.model.bundle; import io.fabric8.kubernetes.api.builder.Nested; import io.fabric8.kubernetes.api.model.ObjectMeta; import io.fabric8.kubernetes.api.model.ObjectMetaBuilder; import org.entando.kubernetes.model.EntandoBaseFluent; public class EntandoComponentBundleFluent<A extends EntandoComponentBundleFluent<A>> extends EntandoBaseFluent<A> { protected EntandoComponentBundleSpecBuilder spec; protected EntandoComponentBundleFluent() { this(new ObjectMetaBuilder(), new EntandoComponentBundleSpecBuilder()); } protected EntandoComponentBundleFluent(EntandoComponentBundleSpec spec, ObjectMeta objectMeta) { this(new ObjectMetaBuilder(objectMeta), new EntandoComponentBundleSpecBuilder(spec)); } private EntandoComponentBundleFluent(ObjectMetaBuilder metadata, EntandoComponentBundleSpecBuilder spec) { super(metadata); this.spec = spec; } public SpecNestedImpl<A> editSpec() { return new SpecNestedImpl<>(thisAsA(), this.spec.build()); } public SpecNestedImpl<A> withNewSpec() { return new SpecNestedImpl<>(thisAsA()); } public A withSpec(EntandoComponentBundleSpec spec) { this.spec = new EntandoComponentBundleSpecBuilder(spec); return thisAsA(); } @SuppressWarnings("unchecked") protected A thisAsA() { return (A) this; } public static class SpecNestedImpl<N extends EntandoComponentBundleFluent> extends EntandoComponentBundleSpecFluent<SpecNestedImpl<N>> implements Nested<N> { private final N parentBuilder; SpecNestedImpl(N parentBuilder, EntandoComponentBundleSpec spec) { super(spec); this.parentBuilder = parentBuilder; } public SpecNestedImpl(N parentBuilder) { super(); this.parentBuilder = parentBuilder; } @Override @SuppressWarnings("unchecked") public N and() { return (N) parentBuilder.withSpec(this.build()); } public N endSpec() { return this.and(); } } }
68a7e1dec760df2f623c4a8509a9fe35e5fbb65b
139960e2d7d55e71c15e6a63acb6609e142a2ace
/mobile_app1/module1105/src/main/java/module1105packageJava0/Foo159.java
5df6319bbf5ed05649642ac5a13e985b8866b9a6
[ "Apache-2.0" ]
permissive
uber-common/android-build-eval
448bfe141b6911ad8a99268378c75217d431766f
7723bfd0b9b1056892cef1fef02314b435b086f2
refs/heads/master
2023-02-18T22:25:15.121902
2023-02-06T19:35:34
2023-02-06T19:35:34
294,831,672
83
7
Apache-2.0
2021-09-24T08:55:30
2020-09-11T23:27:37
Java
UTF-8
Java
false
false
416
java
package module1105packageJava0; import java.lang.Integer; public class Foo159 { Integer int0; public void foo0() { new module1105packageJava0.Foo158().foo6(); } public void foo1() { foo0(); } public void foo2() { foo1(); } public void foo3() { foo2(); } public void foo4() { foo3(); } public void foo5() { foo4(); } public void foo6() { foo5(); } }
2adc139f5ba901fda8ef8ce676f53f868f98c202
c2652d43c269abfb0034d58781ddbb690a87b2ea
/RemedialB/src/controllers/ControllerOperaciones.java
43abe6bcc6cb247597f80f18125c42341e8524a1
[]
no_license
bris98/remedialbriceyda
1bc0b9d715e1c416085d16ab4ac43cc91cd9dd8e
9a27115cb2e0b726363c1ee8aaaf7f4399393b78
refs/heads/master
2021-05-16T00:17:38.120696
2017-10-15T15:02:08
2017-10-15T15:02:08
106,987,595
0
0
null
null
null
null
UTF-8
Java
false
false
2,684
java
package controllers; import models.ModelOperaciones; import views.ViewOperaciones; /** * * @author Briceyda Angeles */ public class ControllerOperaciones { private final ModelOperaciones model_operaciones; private final ViewOperaciones view_operaciones; public ControllerOperaciones(ModelOperaciones model_operaciones, Object views[]){ this.model_operaciones = model_operaciones; this.view_operaciones = (ViewOperaciones) views[3]; initView(); } public void initView(){ view_operaciones.jbtn_suma.addActionListener(e -> jbtn_sumarMouseClicked()); view_operaciones.jbtn_resta.addActionListener(e -> jbtn_restaMouseClicked()); view_operaciones.jbtn_multiplicacion.addActionListener(e -> jbtn_multiplicacionMouseClicked()); view_operaciones.jbtn_division.addActionListener(e -> jbtn_divisionMouseClicked()); view_operaciones.jtf_numero_1.setText("" + model_operaciones.getNumero_1()); view_operaciones.jtf_numero_2.setText("" + model_operaciones.getNumero_2()); view_operaciones.jlb_resultado.setText("" + model_operaciones.getResultado()); } public void jbtn_sumarMouseClicked(){ model_operaciones.setNumero_1(Double.parseDouble(view_operaciones.jtf_numero_1.getText())); model_operaciones.setNumero_2(Double.parseDouble(view_operaciones.jtf_numero_2.getText())); model_operaciones.Sumar(); view_operaciones.jlb_resultado.setText("" + model_operaciones.getResultado()); } public void jbtn_restaMouseClicked(){ model_operaciones.setNumero_1(Double.parseDouble(view_operaciones.jtf_numero_1.getText())); model_operaciones.setNumero_2(Double.parseDouble(view_operaciones.jtf_numero_2.getText())); model_operaciones.Restar(); view_operaciones.jlb_resultado.setText("" + model_operaciones.getResultado()); } public void jbtn_multiplicacionMouseClicked(){ model_operaciones.setNumero_1(Double.parseDouble(view_operaciones.jtf_numero_1.getText())); model_operaciones.setNumero_2(Double.parseDouble(view_operaciones.jtf_numero_2.getText())); model_operaciones.Multiplicar(); view_operaciones.jlb_resultado.setText("" + model_operaciones.getResultado()); } public void jbtn_divisionMouseClicked(){ model_operaciones.setNumero_1(Double.parseDouble(view_operaciones.jtf_numero_1.getText())); model_operaciones.setNumero_2(Double.parseDouble(view_operaciones.jtf_numero_2.getText())); model_operaciones.Dividir(); view_operaciones.jlb_resultado.setText("" + model_operaciones.getResultado()); } }
ca4b341dcf13562020b1ff62c3776922cfc03748
fabd10e104ce8cc5979760cf704c2468fb5809dc
/app/src/main/java/music/hs/com/materialmusicv2/objects/events/controllerevents/VisualizerData.java
5df02376b7fe7cdeb7958955b7389ceb0ce4980c
[ "Apache-2.0" ]
permissive
Harisrini99/HSMusicPlayer
9a740d76d658f5ca60f403407c20d3c2c6fa7db5
a0beb1415ed695e7cc45f38e73585135c4f94d76
refs/heads/master
2021-09-07T14:14:16.637841
2021-08-21T17:04:10
2021-08-21T17:04:10
241,160,990
0
0
null
null
null
null
UTF-8
Java
false
false
202
java
package music.hs.com.materialmusicv2.objects.events.controllerevents; public class VisualizerData { public byte[] data; public VisualizerData(byte[] data) { this.data = data; } }
6abaff0a880bc9322c4281d3e10b3cdb6885d57f
f2d85e3f5d6dcac0a7b18cbfef6d6b7c62ab570a
/rdma-based-storm/examples/storm-redis-examples/src/main/java/org/apache/storm/redis/trident/WordCountStoreMapper.java
58df150c4b146c7e2ca96fc5ab910e16d0e5e72b
[ "Apache-2.0", "MIT", "BSD-3-Clause", "BSD-2-Clause", "GPL-1.0-or-later" ]
permissive
dke-knu/i2am
82bb3cf07845819960f1537a18155541a1eb79eb
0548696b08ef0104b0c4e6dec79c25300639df04
refs/heads/master
2023-07-20T01:30:07.029252
2023-07-07T02:00:59
2023-07-07T02:00:59
71,136,202
8
14
Apache-2.0
2023-07-07T02:00:31
2016-10-17T12:29:48
Java
UTF-8
Java
false
false
1,498
java
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.storm.redis.trident; import org.apache.storm.tuple.ITuple; import org.apache.storm.redis.common.mapper.RedisDataTypeDescription; import org.apache.storm.redis.common.mapper.RedisStoreMapper; public class WordCountStoreMapper implements RedisStoreMapper { @Override public RedisDataTypeDescription getDataTypeDescription() { return new RedisDataTypeDescription(RedisDataTypeDescription.RedisDataType.HASH, "test"); } @Override public String getKeyFromTuple(ITuple tuple) { return "test_" + tuple.getString(0); } @Override public String getValueFromTuple(ITuple tuple) { return tuple.getInteger(1).toString(); } }
2ddc904dd70e046ab5c8c82f9221bc020e71b1bd
138e198af877de7ae0adccc5207d70c282952ee1
/SearchHandlerThread/app/src/main/java/com/example/asus1/searchhandlerthread/DownLoadThread.java
006cd9e1172158bb4bab39433d1adb8b6ead5af2
[]
no_license
brice-liu/PracticeEveryDay
f8967f5881f2ae1a589910911544d84e78b2e255
9cab30c08da76585c4fc2c54feb035bd90f4dd91
refs/heads/master
2021-10-14T09:44:00.483488
2019-02-04T08:07:04
2019-02-04T08:07:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,412
java
package com.example.asus1.searchhandlerthread; import android.os.Bundle; import android.os.Handler; import android.os.HandlerThread; import android.os.Message; import android.os.SystemClock; import android.text.format.DateUtils; import java.util.Arrays; import java.util.List; public class DownLoadThread extends HandlerThread implements Handler.Callback { private final String TAG = this.getClass().getSimpleName(); private final String KEY_URL = "url"; public static final int TYPE_START = 1; public static final int TYPE_FINISHED = 2; private Handler mWorkHandler; private Handler mUIHandler; private List<String> mDownLoadUrlList; public DownLoadThread(String name) { super(name); } @Override protected void onLooperPrepared() { super.onLooperPrepared(); mWorkHandler = new Handler(getLooper(),this); if (mUIHandler == null) { throw new IllegalArgumentException("Not set UIHandler!"); } for(String url:mDownLoadUrlList){ Message message = mWorkHandler.obtainMessage(); Bundle bundle = new Bundle(); bundle.putString(KEY_URL,url); message.setData(bundle); mWorkHandler.sendMessage(message); } } public void setDownloadUrls(String... urls) { mDownLoadUrlList = Arrays.asList(urls); } public Handler getUIHandler() { return mUIHandler; } //注入主线程 Handler public DownLoadThread setUIHandler(final Handler UIHandler) { mUIHandler = UIHandler; return this; } @Override public boolean handleMessage(Message msg) { if(msg == null || msg.getData() == null){ return false; } String url = (String)msg.getData().get(KEY_URL); //开始下载 Message startMessage = mUIHandler.obtainMessage(TYPE_START, "\n 开始下载 @"+System.currentTimeMillis()+"\n"+url); mUIHandler.sendMessage(startMessage); SystemClock.sleep(2000); Message finishMessage = mUIHandler.obtainMessage(TYPE_FINISHED, "\n 下载完成 @"+System.currentTimeMillis()+"\n"+url); mUIHandler.sendMessage(finishMessage); return true; } @Override public boolean quitSafely() { mUIHandler = null; return super.quitSafely(); } }
c2d9d3690620556224eb1811fc30f83bd41f9ff1
ce42321cfdce9451b8249605c317ca412fcdbb56
/src/me/maxwin/view/XListViewFooter.java
fd51fd04c07239453296c1e36ee47ea530e9b181
[]
no_license
droison/Qdaily
8656d10562d2e91f520cd2ed8ea8580b7778bbab
ae26718ddbe5fcb80b5d7582f9747e86e066c4d6
refs/heads/master
2016-09-06T17:23:25.261972
2014-09-11T15:38:50
2014-09-11T15:38:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,914
java
/** * @file XFooterView.java * @create Mar 31, 2012 9:33:43 PM * @author Maxwin * @description XListView's footer */ package me.maxwin.view; import com.qdaily.ui.R; import android.content.Context; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; public class XListViewFooter extends LinearLayout { public final static int STATE_NORMAL = 0; public final static int STATE_READY = 1; public final static int STATE_LOADING = 2; private Context mContext; private View mContentView; private View mProgressBar; private TextView mHintView; public XListViewFooter(Context context) { super(context); initView(context); } public XListViewFooter(Context context, AttributeSet attrs) { super(context, attrs); initView(context); } public void setState(int state) { mHintView.setVisibility(View.INVISIBLE); mProgressBar.setVisibility(View.INVISIBLE); mHintView.setVisibility(View.INVISIBLE); if (state == STATE_READY) { mHintView.setVisibility(View.VISIBLE); mHintView.setText(R.string.xlistview_footer_hint_ready); } else if (state == STATE_LOADING) { mProgressBar.setVisibility(View.VISIBLE); } else { mHintView.setVisibility(View.VISIBLE); mHintView.setText(R.string.xlistview_footer_hint_normal); } } public void setBottomMargin(int height) { if (height < 0) return; LayoutParams lp = (LayoutParams) mContentView.getLayoutParams(); lp.bottomMargin = height; mContentView.setLayoutParams(lp); } public int getBottomMargin() { LayoutParams lp = (LayoutParams) mContentView.getLayoutParams(); return lp.bottomMargin; } /** * normal status */ public void normal() { mHintView.setVisibility(View.VISIBLE); mProgressBar.setVisibility(View.GONE); } /** * loading status */ public void loading() { mHintView.setVisibility(View.GONE); mProgressBar.setVisibility(View.VISIBLE); } /** * hide footer when disable pull load more */ public void hide() { LayoutParams lp = (LayoutParams) mContentView.getLayoutParams(); lp.height = 0; mContentView.setLayoutParams(lp); } /** * show footer */ public void show() { LayoutParams lp = (LayoutParams) mContentView.getLayoutParams(); lp.height = LayoutParams.WRAP_CONTENT; mContentView.setLayoutParams(lp); } private void initView(Context context) { mContext = context; LinearLayout moreView = (LinearLayout) LayoutInflater.from(mContext).inflate(R.layout.xlistview_footer, null); addView(moreView); moreView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); mContentView = moreView.findViewById(R.id.xlistview_footer_content); mProgressBar = moreView.findViewById(R.id.xlistview_footer_progressbar); mHintView = (TextView) moreView.findViewById(R.id.xlistview_footer_hint_textview); } }
6936d7a48396d92306a6941d4214e1f419a446d5
381926f2ba76c36900be8d4c94170b5cf7d5999b
/src/main/java/pe/com/intercorp/service/CustomerService.java
ca5ee158d89be8a0fda8f6aa38527a044d5dc140
[]
no_license
miguelgrasso/customer-service
3b2adfb89b351814139964d89160a4ab93fedb13
07c5848d0cb118eec5f9f7b5b9cb299f23e3ff5c
refs/heads/master
2022-06-10T10:42:10.966385
2020-03-24T02:58:02
2020-03-24T02:58:02
249,508,551
0
0
null
2022-05-20T21:30:50
2020-03-23T18:12:25
Java
UTF-8
Java
false
false
3,075
java
package pe.com.intercorp.service; import java.math.BigDecimal; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j; import pe.com.intercorp.bean.Customer; import pe.com.intercorp.bean.KpiCustomer; import pe.com.intercorp.bean.ResponseCustMsg; import pe.com.intercorp.bean.ResponseDataMsg; import pe.com.intercorp.repository.CustomerRepository; import pe.com.intercorp.util.Constantes; import pe.com.intercorp.util.UtilCalculos; /** * EmpleadoService * @author mgrasso **/ @Slf4j //Autogenerar LOG4J. @Service public class CustomerService{ @Autowired private CustomerRepository customerRepository; @Autowired private UtilCalculos utilCalculos; /** * creacliente * @param customer * @return ResponseEntity<ResponseEntity> **/ public ResponseEntity<String> creacliente( Customer customer ){ log.info( "-----> Customer 'creacliente': {}", customer ); String vMensajeReturn = Constantes.MENSAJE_OK; //Agregando el NUEVO customer: this.customerRepository.agregarCustomer( customer ); //Objeto Return: ResponseEntity<String> objRetorno = new ResponseEntity<String>( vMensajeReturn, HttpStatus.OK ); return objRetorno; } /** * kpiclientes * @return ResponseEntity<ResponseDataMsg> **/ public ResponseEntity<ResponseDataMsg> kpiclientes(){ log.info( "-----> Customer 'kpiclientes'" ); List<Customer> listaClientes = this.listclientes().getBody().getListCustomers(); BigDecimal vPromedio = this.utilCalculos.calcularPromedio( listaClientes ); Double vDesviacionEstandar = this.utilCalculos.calcularDesviacionEstandar(); KpiCustomer objKpiCustomer = new KpiCustomer(); objKpiCustomer.setPromedio( vPromedio + "" ); objKpiCustomer.setDesviacionEstandar( vDesviacionEstandar + "" ); ResponseDataMsg objResponseMsg = new ResponseDataMsg(); objResponseMsg.setKpiCustomer( objKpiCustomer ); //Objeto Return: ResponseEntity<ResponseDataMsg> objRetorno = new ResponseEntity<ResponseDataMsg>( objResponseMsg, HttpStatus.OK ); return objRetorno; } /** * listclientes * @return ResponseEntity<ResponseCustMsg> **/ public ResponseEntity<ResponseCustMsg> listclientes(){ log.info( "-----> Customer 'listclientes'" ); //Obteniendo la lista del REPOSITORY: List<Customer> listaCustomers = this.customerRepository.listaCustomer(); ResponseCustMsg objResponseMsg = new ResponseCustMsg(); objResponseMsg.listCustomers( listaCustomers ); //Objeto Return: ResponseEntity<ResponseCustMsg> objRetorno = new ResponseEntity<ResponseCustMsg>( objResponseMsg, HttpStatus.OK ); return objRetorno; } }
d0dbd18b640ea9bef42f60f0e496f952530cc79c
c360af2999d2950e89c8466560e5d901e534bc2d
/AndroidMovieApp/app/src/main/java/movies/com/androidmovieapp/view/MovieDetailView.java
b083a88163ee8316b94dea741dc9b91f351e9c5d
[]
no_license
BenishBaby/MovieDBApp
46c5db77c2631ef7ffaf05d6473e896325a191a0
7b5fbd5bcf29980bcdba1829fce9fea22f25391f
refs/heads/master
2020-03-18T14:40:45.471329
2018-05-28T19:55:26
2018-05-28T19:55:26
134,860,745
0
0
null
null
null
null
UTF-8
Java
false
false
522
java
package movies.com.androidmovieapp.view; import movies.com.androidmovieapp.Model.CollectionDetails; import movies.com.androidmovieapp.Model.MovieDetails; import movies.com.androidmovieapp.Model.NowPlayingMoviesResults; public interface MovieDetailView { void showProgress(); void hideProgress(); void setMovieFetchError(); void setMoviewDetails(MovieDetails moviewDetails); void setMoviewCollectionList(CollectionDetails collectionDetails); void naviageToMovieDetailPage(String movieId); }
04a1dd88567cf6199ffa69dfa6036087b7b82e2c
9c166d94fa45ac08bd6c3f8f8f38e9c31d9cfc08
/version_2/PizzaStore.java
2d872c5706c9a1d697f077baed686e8c572dfacd
[]
no_license
JavierDuranFlores/Proyectos-Tapachula-Pizza
72fb4a4f63397ebc5b88faf7881338d484e79cdd
a062ca7ac607c879b97205b37fc5b676f239e125
refs/heads/main
2023-04-04T09:44:16.107188
2021-04-17T23:32:02
2021-04-17T23:32:02
359,003,659
0
0
null
null
null
null
UTF-8
Java
false
false
535
java
/* La siguiente secuencia de código fuente: [PizzaStore.java] -> [NYPizzaStore.java] -> [Pizza.java] -> [CheesePizza.java] -> [main] */ ///PizzaStore.java public abstract class PizzaStore { abstract Pizza createPizza(String item); public Pizza orderPizza(String type) { Pizza pizza = createPizza(type); System.out.println("--- Making a " + pizza.getName() + " ---"); pizza.prepare(); pizza.bake(); pizza.cut(); pizza.box(); return pizza; } }
3519f63d651edeb6a7f056234d17f0bb1de0873f
fc47ee8153d0096b32f56d564018f3f73b3696c8
/app/src/main/java/com/johnriggs/digitalturbine/vertical/ads/view/AdsView.java
c31fd48d195e7a0214715906a0eb330d4f71b024
[]
no_license
johnriggs/DigitalTurbine
bb5b53fea08a49b9bd33de5e8fd548dfea0545c1
7985896cbdec6d524db3cbe223c93d0777fb9ee9
refs/heads/master
2021-01-01T19:26:33.547508
2017-07-31T15:03:24
2017-07-31T15:03:24
98,586,043
0
0
null
null
null
null
UTF-8
Java
false
false
292
java
package com.johnriggs.digitalturbine.vertical.ads.view; import com.johnriggs.digitalturbine.horizontal.base.view.BaseView; /** * Created by johnriggs on 7/25/17. */ public interface AdsView extends BaseView{ void setupAdsRecyclerView(); void launchToDetailsView(String appId); }
b91da0cc6348db2f7c008e5627d711d080f7517a
edc22cffa19b01aef5b6e31b218083d7ce6a3fa2
/app/src/main/java/code/common/ProgressBarAnimation.java
1335d2f5430fb31ec50ccf8d2b40adeff33b175d
[]
no_license
Rjestures/Zozima
4884b532e7b065efac685da8f7786da6bdf2b6dc
9cba962e98dd990434e15355615faadb7b6d4486
refs/heads/master
2022-07-19T18:42:55.961899
2020-05-18T07:43:43
2020-05-18T07:43:43
261,849,744
0
0
null
null
null
null
UTF-8
Java
false
false
794
java
package code.common; import android.view.animation.Animation; import android.view.animation.Transformation; import android.widget.ProgressBar; /** * Created by mohammadfaiz on 09/09/17. */ public class ProgressBarAnimation extends Animation { private ProgressBar progressBar; private float from; private float to; public ProgressBarAnimation(ProgressBar progressBar, float from, float to) { super(); this.progressBar = progressBar; this.from = from; this.to = to; } @Override protected void applyTransformation(float interpolatedTime, Transformation t) { super.applyTransformation(interpolatedTime, t); float value = from + (to - from) * interpolatedTime; progressBar.setProgress((int) value); } }
8382da8f03743fcc1783cbe676ea25369d8810e5
4b954dbad1d42681157eee475d6cd1fa57628e1d
/module4/bai_7_spring_data_jpa/bai_tap/blog_manager/src/main/java/com/blog/controller/BlogController.java
6a358f2d8b8cc95c7f1ae6a95e30ea73077c3021
[]
no_license
hongson2410/C1020G1-PhamHongSon
c5466a068154f7cfcfb6a2c0c2f47bd90ff9f7ab
ae10660a5de6d9c3018a64f238dd34897f6ad2c2
refs/heads/main
2023-04-11T10:55:26.730907
2021-04-18T10:20:00
2021-04-18T10:20:00
307,275,086
0
0
null
null
null
null
UTF-8
Java
false
false
3,201
java
package com.blog.controller; import com.blog.model.Blog; import com.blog.model.Category; import com.blog.service.impl.BlogServiceImpl; import com.blog.service.impl.CategoryServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableDefault; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import java.util.Date; @Controller public class BlogController { @Autowired BlogServiceImpl blogService; @Autowired CategoryServiceImpl categoryService; @ModelAttribute("categories") public Iterable<Category> categories(Pageable pageable) { return categoryService.findAllCategory(pageable); } @GetMapping("/") public String showHome(@PageableDefault(size = 5) Pageable pageable, Model model) { model.addAttribute("blogList", blogService.findAll(pageable)); return "home"; } @GetMapping("search_name") public String searchByName(@PageableDefault(size = 5) Pageable pageable, Model model, @RequestParam(name = "nameBlog") String blogName) { model.addAttribute("blogList", blogService.findByBlogNameContaining(pageable, blogName)); return "search"; } @GetMapping("search_category") public String searchByCategory(@PageableDefault(size = 5) Pageable pageable, Model model, @RequestParam(name = "id") Integer id) { model.addAttribute("blogList", blogService.findByCategory(pageable, id)); return "search"; } @GetMapping("create") public String showFormCreate(Model model) { model.addAttribute("blog", new Blog()); return "create"; } @PostMapping("create") public String createBlog(@ModelAttribute Blog blog, RedirectAttributes redirectAttributes) { blog.setDateUpdate(new Date()); blogService.save(blog); redirectAttributes.addFlashAttribute("message", "New blog created successfully"); return "redirect:/"; } @GetMapping("edit/{id}") public String showFormEdit(@PathVariable Integer id, Model model) { model.addAttribute("blog", blogService.findById(id)); return "edit"; } @PostMapping("edit") public String editBlog(@ModelAttribute Blog blog, RedirectAttributes redirectAttributes) { blog.setDateUpdate(new Date()); blogService.save(blog); redirectAttributes.addFlashAttribute("message", "This blog edit successfully"); return "redirect:/"; } @PostMapping("delete") public String deleteBlog(@ModelAttribute(name = "id") Integer id, RedirectAttributes redirectAttributes) { blogService.deleteById(id); redirectAttributes.addFlashAttribute("message", "This blog delete successfully"); return "redirect:/"; } @GetMapping("view/{id}") public String showBlog(@PathVariable Integer id, Model model) { model.addAttribute("blog", blogService.findById(id)); return "view"; } }
f76d77cce5812e57169c011691a68c88dd9a73f4
17e2c30d7f781108ca2cba28f34c0e4f184bce18
/BaseAPI/src/main/java/br/com/julian/projetolocadora/BaseAPI/App.java
38eb27d4cd2cb83bb5b2a5e6ccb3e8b286d448a0
[]
no_license
SoulsTrackers/ProjetoWeb
ed47cfe998634b89919b75d801ba70fe16b814bc
79efabe2dd65509b168ebf61f2ced1e9eecc99bc
refs/heads/master
2020-06-10T05:47:43.642723
2016-12-09T20:14:28
2016-12-09T20:14:28
76,066,301
0
0
null
null
null
null
UTF-8
Java
false
false
2,712
java
package br.com.julian.projetolocadora.BaseAPI; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; import br.com.julian.projetolocadora.dao.CategoriaDAO; import br.com.julian.projetolocadora.dao.FilmeDAO; import br.com.julian.projetolocadora.modelo.Categoria; import br.com.julian.projetolocadora.modelo.Cliente; import br.com.julian.projetolocadora.modelo.Filme; import br.com.julian.projetolocadora.modelo.Usuario; import br.com.julian.projetolocadora.util.PesquisaBean; /** * Hello world! * */ public class App { public static void main( String[] args ) { App aplicacao = new App(); Categoria categoria = new Categoria(); CategoriaDAO dao = new CategoriaDAO(); PesquisaBean pesquisaBean = new PesquisaBean(categoria); List<Categoria> categorias = new ArrayList<Categoria>(); categoria.setDescricao("Romance"); try { dao.criar(categoria); System.out.println("Categoria Criada Com Sucesso!"); } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } // try{ // categorias = dao.pesq(pesquisaBean, null); // // aplicacao.criarFilme(categorias.get(0)); // System.out.println("Filme criado com sucesso"); // // }catch(Exception e){ // System.out.println(e.getMessage()); // } // try{ // categorias = dao.pesq(pesquisaBean, null); // for(Categoria retorno : categorias) // { // System.out.println(retorno.getDescricao()); // } // // }catch(Exception e){ // System.out.println(e.getMessage()); // } // try // { // dao.criar(categoria); // System.out.println("Categoria criada com sucesso!"); // }catch(Exception e){ // System.out.println(e.getMessage()); // } // // } public void criarFilme(Categoria categoria) throws Exception { Filme filme = new Filme(); FilmeDAO dao = new FilmeDAO(); filme.setDescricao("A Volta dos que nao foram"); filme.setAno(Calendar.getInstance()); filme.setResumo("No final todos morrem, mas também sobrevivem"); Calendar duracao = Calendar.getInstance(); duracao.set(Calendar.HOUR_OF_DAY, 3); duracao.set(Calendar.MINUTE, 0); filme.setDuracao(duracao); dao.criar(filme); } public void criarCliente(Usuario usuario)throws Exception { Cliente cliente = new Cliente(); } }
831cb70b0614250f83fcb6e96cc6bc93f22a379b
cf0f34937b476ecde5ebcca7e2119bcbb27cfbf2
/src/com/huateng/struts/query/action/T50905Action.java
6cb24bc8550bc69e29a67b4ac480e4516ef043da
[]
no_license
Deron84/xxxTest
b5f38cc2dfe3fe28b01634b58b1236b7ec5b4854
302b807f394e31ac7350c5c006cb8dc334fc967f
refs/heads/master
2022-02-01T03:32:54.689996
2019-07-23T11:04:09
2019-07-23T11:04:09
198,212,201
0
0
null
null
null
null
UTF-8
Java
false
false
3,995
java
package com.huateng.struts.query.action; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.List; import com.huateng.common.StringUtil; import com.huateng.struts.query.BaseExcelQueryAction; import com.huateng.struts.query.ExcelName; import com.huateng.struts.query.QueryExcelUtil; import com.huateng.system.util.InformationUtil; /** * project JSBConsole date 2013-4-22 * * @author 高浩 */ public class T50905Action extends BaseExcelQueryAction { @Override protected void deal() { year = mon.substring(0, 4); String yearStart = year +"0101"; String monStart = mon + "01"; int m = Integer.valueOf(mon.substring(4, 6)); int y = Integer.valueOf(year); String monEnd = getMonEnd(m,y,mon); c = sheet.getRow(1).getCell(1); if(c == null){ sheet.getRow(1).createCell(1); } if(sheet.getRow(1).getCell(4) == null){ sheet.getRow(1).createCell(4); } String wheresql = " where CONN_TYPE = 'J' and DATE_SETTLMT_8 >= '"+ monStart +"' and DATE_SETTLMT_8 <= '"+ monEnd +"' "; if(!StringUtil.isNull(mon)){ c.setCellValue(mon); } String sql = "select (case MCHT_FLAG1 when '0' then '收款商户' " + "when '1' then '老板通商户' " + "when '2' then '分期商户' " + "when '3' then '财务转账商户' " + "when '4' then '项目形式商户' " + "when '5' then '积分业务' " + "when '6' then '其他业务' " + "when '7' then '固话POS商户' end) mchtTp," + "thNum,allNum,round(thNum*100/allNum,2) per " + "from (select MCHT_FLAG1," + "sum(case when STLM_FLAG in('0','7','A','D','9','8') then 0 else 1 end) thNum," + "count(1) allNum " + "from (select * from BTH_GC_TXN_SUCC " + "union all " + "select * from BTH_GC_TXN_SUCC_HIS) a " + "left outer join TBL_MCHT_BASE_INF b on(a.CARD_ACCP_ID=b.MCHT_NO) "; sql += wheresql; sql += " group by MCHT_FLAG1 order by MCHT_FLAG1)"; int rowNum =3, cellNum = 0,columnNum = 4; fillData(sql, rowNum, cellNum, columnNum); } // /*对账平结果标志*/ // #define STLM_FLG_OK "0" /*-- 对账结果平*/ // #define STLM_FLG_SUSPICIOUS_OK "A" /*-- CUPS可疑交易对平;*/ // // /*对账不平结果标志 */ // #define STLM_CUP_FLG_POSP "1" /*-- POSP有,CUPS没有*/ // #define STLM_CUP_FLG_CUPS "2" /*-- POSP无,CUPS有*/ // #define STLM_CUP_FLG_DISTRUST "3" /*-- POSP与CUPS金额不一致;*/ // #define STLM_HOST_FLG_POSP "4" /*-- POSP有,HOST没有;*/ // #define STLM_HOST_FLG_HOST "5" /*-- POSP无, HOST有;*/ // #define STLM_HOST_FLG_DISTRUST "6" /*-- POSP与HOST金额不一致;*/ // #define STLM_UPD_FLG_POSP "R" /*-- POSP有,UPD没有;*/ // #define STLM_UPD_FLG_UPD "S" /*-- POSP无,UPD有;*/ // #define STLM_UPD_FLG_DISTRUST "T" /*-- POSP与UPD金额不一致;*/ // #define STLM_CUP_FLG_SUSPICIOUS "7" /*-- CUPS可疑交易;*/ // #define STLM_OFF_FLG_AMT 'Z' /*脱机交易中标志两者金额不同*/ // #define STLM_OFF_FLG_HEART 'W' /*脱机交易中标志是本地端有的*/ // #define STLM_OFF_FLG_CUPS 'X' /*脱机交易中标志是银联端有的*/ // #define STLM_FLG_NOCHK "8" /*-- 导入未核对交易;*/ // #define STLM_FLG_RVSL "9" /* 银联冲正及原交易交易标志;*/ // #define STLM_FLG_DEL "D" /* 清理数据标志 */ private String year; private String mon; private String brhId; public String getMon() { return mon; } public void setMon(String mon) { this.mon = mon; } public String getBrhId() { return brhId; } public void setBrhId(String brhId) { this.brhId = brhId; } @Override protected String getFileKey() { return ExcelName.EN_55; } @Override public String getMsg() { return msg; } @Override public boolean isSuccess() { return success; } }
aa9315f43c704d8ff70b47639f1cb376467a31d8
df134b422960de6fb179f36ca97ab574b0f1d69f
/net/minecraft/server/v1_16_R2/LootEntryAlternatives.java
2114862c03e1e3fef27aab6f32bcc0f722241cd3
[]
no_license
TheShermanTanker/NMS-1.16.3
bbbdb9417009be4987872717e761fb064468bbb2
d3e64b4493d3e45970ec5ec66e1b9714a71856cc
refs/heads/master
2022-12-29T15:32:24.411347
2020-10-08T11:56:16
2020-10-08T11:56:16
302,324,687
0
1
null
null
null
null
UTF-8
Java
false
false
2,732
java
/* */ package net.minecraft.server.v1_16_R2; /* */ /* */ import com.google.common.collect.Lists; /* */ import java.util.List; /* */ import java.util.function.Consumer; /* */ import org.bukkit.craftbukkit.libs.org.apache.commons.lang3.ArrayUtils; /* */ /* */ public class LootEntryAlternatives /* */ extends LootEntryChildrenAbstract /* */ { /* */ LootEntryAlternatives(LootEntryAbstract[] var0, LootItemCondition[] var1) { /* 12 */ super(var0, var1); /* */ } /* */ /* */ /* */ public LootEntryType a() { /* 17 */ return LootEntries.f; /* */ } /* */ /* */ /* */ protected LootEntryChildren a(LootEntryChildren[] var0) { /* 22 */ switch (var0.length) { /* */ case 0: /* 24 */ return a; /* */ case 1: /* 26 */ return var0[0]; /* */ case 2: /* 28 */ return var0[0].b(var0[1]); /* */ } /* 30 */ return (var1, var2) -> { /* */ for (LootEntryChildren var6 : var0) { /* */ if (var6.expand(var1, var2)) { /* */ return true; /* */ } /* */ } /* */ return false; /* */ }; /* */ } /* */ /* */ /* */ /* */ public void a(LootCollector var0) { /* 43 */ super.a(var0); /* */ /* 45 */ for (int var1 = 0; var1 < this.c.length - 1; var1++) { /* 46 */ if (ArrayUtils.isEmpty((Object[])(this.c[var1]).d)) /* 47 */ var0.a("Unreachable entry!"); /* */ } /* */ } /* */ /* */ public static class a /* */ extends LootEntryAbstract.a<a> { /* 53 */ private final List<LootEntryAbstract> a = Lists.newArrayList(); /* */ /* */ public a(LootEntryAbstract.a<?>... var0) { /* 56 */ for (LootEntryAbstract.a<?> var4 : var0) { /* 57 */ this.a.add(var4.b()); /* */ } /* */ } /* */ /* */ /* */ protected a d() { /* 63 */ return this; /* */ } /* */ /* */ /* */ public a a(LootEntryAbstract.a<?> var0) { /* 68 */ this.a.add(var0.b()); /* 69 */ return this; /* */ } /* */ /* */ /* */ public LootEntryAbstract b() { /* 74 */ return new LootEntryAlternatives(this.a.<LootEntryAbstract>toArray(new LootEntryAbstract[0]), f()); /* */ } /* */ } /* */ /* */ public static a a(LootEntryAbstract.a<?>... var0) { /* 79 */ return new a(var0); /* */ } /* */ } /* Location: C:\Users\Josep\Downloads\Decompile Minecraft\tuinity-1.16.3.jar!\net\minecraft\server\v1_16_R2\LootEntryAlternatives.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.1.3 */
33ff7f5288274829d16361c2476a6376dfe1e6e6
a4910b28ec8c0ad2127d4e278ca1a76ab9e30724
/Demo/src/shape/Circle.java
e5ed314b24ce0135581a09aaaa4d0bb529e98aad
[]
no_license
JohnnyLChang/JavaDemo
f2008a35d210270363310e54fd6b86b3910634f4
fc7adbc1fc9fa4d2ef6e23a8ae17391d431a6beb
refs/heads/master
2021-01-23T09:25:42.934509
2017-11-14T16:13:20
2017-11-14T16:13:20
102,579,774
2
0
null
null
null
null
UTF-8
Java
false
false
899
java
package shape; public class Circle extends ShapeBuilder implements IShape { private double radius; public static class Builder extends ShapeBuilderBase<Builder, Circle> { private double radius; public Builder setRadius(double radius) { this.radius = radius; return this; } @Override public Circle build() { return new Circle(this.radius); } } public Circle(double radius) { this.radius = radius; } @SuppressWarnings("finally") @Override public double getArea() { double volume = 0; try { volume = (Math.pow(this.radius, 2) * Math.PI); } catch (Exception ex) { } finally { return volume; } } @Override public double getVolume() { return 0; } @Override public void printSummary() { System.out.printf("Summary: %s Area %f, Volume %f\n", this.getClass().getSimpleName(), this.getArea(), this.getVolume()); } }
549eb4d9aa557cf1216836d76607e1df7a4a7d3b
602f6f274fe6d1d0827a324ada0438bc0210bc39
/spring-framework/src/main/java/org/springframework/web/portlet/handler/PortletModeParameterHandlerMapping.java
476e04b1fea6a2ff3fde0e0271d3df749f5e57f0
[ "Apache-2.0" ]
permissive
1091643978/spring
c5db27b126261adf256415a0c56c4e7fbea3546e
c832371e96dffe8af4e3dafe9455a409bfefbb1b
refs/heads/master
2020-08-27T04:26:22.672721
2019-10-31T05:31:59
2019-10-31T05:31:59
217,243,879
0
0
Apache-2.0
2019-10-24T07:58:34
2019-10-24T07:58:31
null
UTF-8
Java
false
false
8,182
java
/* * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.web.portlet.handler; import java.util.HashSet; import java.util.Map; import java.util.Set; import javax.portlet.PortletMode; import javax.portlet.PortletRequest; import org.springframework.beans.BeansException; import org.springframework.util.Assert; /** * Implementation of the {@link org.springframework.web.portlet.HandlerMapping} * interface to map from the current PortletMode and a request parameter to * request handler beans. The mapping consists of two levels: first the * PortletMode and then the parameter value. In order to be mapped, * both elements must match the mapping definition. * * <p>This is a combination of the methods used in {@link PortletModeHandlerMapping PortletModeHandlerMapping} * and {@link ParameterHandlerMapping ParameterHandlerMapping}. Unlike * those two classes, this mapping cannot be initialized with properties since it * requires a two-level map. * * <p>The default name of the parameter is "action", but can be changed using * {@link #setParameterName setParameterName()}. * * <p>By default, the same parameter value may not be used in two different portlet * modes. This is so that if the portal itself changes the portlet mode, the request * will no longer be valid in the mapping. This behavior can be changed with * {@link #setAllowDuplicateParameters setAllowDupParameters()}. * * <p>The bean configuration for this mapping will look somthing like this: * * <pre class="code"> * &lt;bean id="portletModeParameterHandlerMapping" class="org.springframework.web.portlet.handler.PortletModeParameterHandlerMapping"&gt; * &lt;property name="portletModeParameterMap"&gt; * &lt;map&gt; * &lt;entry key="view"&gt; &lt;!-- portlet mode: view --&gt; * &lt;map&gt; * &lt;entry key="add"&gt;&lt;ref bean="addItemHandler"/&gt;&lt;/entry&gt; * &lt;entry key="edit"&gt;&lt;ref bean="editItemHandler"/&gt;&lt;/entry&gt; * &lt;entry key="delete"&gt;&lt;ref bean="deleteItemHandler"/&gt;&lt;/entry&gt; * &lt;/map&gt; * &lt;/entry&gt; * &lt;entry key="edit"&gt; &lt;!-- portlet mode: edit --&gt; * &lt;map&gt; * &lt;entry key="prefs"&gt;&lt;ref bean="preferencesHandler"/&gt;&lt;/entry&gt; * &lt;entry key="resetPrefs"&gt;&lt;ref bean="resetPreferencesHandler"/&gt;&lt;/entry&gt; * &lt;/map&gt; * &lt;/entry&gt; * &lt;/map&gt; * &lt;/property&gt; * &lt;/bean&gt;</pre> * * <p>This mapping can be chained ahead of a {@link PortletModeHandlerMapping PortletModeHandlerMapping}, * which can then provide defaults for each mode and an overall default as well. * * <p>Thanks to Rainer Schmitz and Yujin Kim for suggesting this mapping strategy! * * @author John A. Lewis * @author Juergen Hoeller * @since 2.0 * @see ParameterMappingInterceptor */ public class PortletModeParameterHandlerMapping extends AbstractMapBasedHandlerMapping<PortletModeParameterLookupKey> { /** * Default request parameter name to use for mapping to handlers: "action". */ public final static String DEFAULT_PARAMETER_NAME = "action"; private String parameterName = DEFAULT_PARAMETER_NAME; private Map<String, Map<String, ?>> portletModeParameterMap; private boolean allowDuplicateParameters = false; private final Set<String> parametersUsed = new HashSet<String>(); /** * Set the name of the parameter used for mapping to handlers. * <p>Default is "action". */ public void setParameterName(String parameterName) { Assert.hasText(parameterName, "'parameterName' must not be empty"); this.parameterName = parameterName; } /** * Set a Map with portlet mode names as keys and another Map as values. * The sub-map has parameter names as keys and handler bean or bean names as values. * <p>Convenient for population with bean references. * @param portletModeParameterMap two-level map of portlet modes and parameters to handler beans */ public void setPortletModeParameterMap(Map<String, Map<String, ?>> portletModeParameterMap) { this.portletModeParameterMap = portletModeParameterMap; } /** * Set whether to allow duplicate parameter values across different portlet modes. * Default is "false". * <p>Doing this is dangerous because the portlet mode can be changed by the * portal itself and the only way to see that is a rerender of the portlet. * If the same parameter value is legal in multiple modes, then a change in * mode could result in a matched mapping that is not intended and the user * could end up in a strange place in the application. */ public void setAllowDuplicateParameters(boolean allowDuplicateParameters) { this.allowDuplicateParameters = allowDuplicateParameters; } /** * Calls the {@code registerHandlers} method in addition * to the superclass's initialization. * @see #registerHandlers */ @Override public void initApplicationContext() throws BeansException { super.initApplicationContext(); registerHandlersByModeAndParameter(this.portletModeParameterMap); } /** * Register all handlers specified in the Portlet mode map for the corresponding modes. * @param portletModeParameterMap Map with mode names as keys and parameter Maps as values */ protected void registerHandlersByModeAndParameter(Map<String, Map<String, ?>> portletModeParameterMap) { Assert.notNull(portletModeParameterMap, "'portletModeParameterMap' must not be null"); for (Map.Entry<String, Map<String, ?>> entry : portletModeParameterMap.entrySet()) { PortletMode mode = new PortletMode(entry.getKey()); registerHandler(mode, entry.getValue()); } } /** * Register all handlers specified in the given parameter map. * @param parameterMap Map with parameter names as keys and handler beans or bean names as values */ protected void registerHandler(PortletMode mode, Map<String, ?> parameterMap) { for (Map.Entry<String, ?> entry : parameterMap.entrySet()) { registerHandler(mode, entry.getKey(), entry.getValue()); } } /** * Register the given handler instance for the given PortletMode and parameter value, * under an appropriate lookup key. * @param mode the PortletMode for which this mapping is valid * @param parameter the parameter value to which this handler is mapped * @param handler the handler instance bean * @throws BeansException if the handler couldn't be registered * @throws IllegalStateException if there is a conflicting handler registered * @see #registerHandler(Object, Object) */ protected void registerHandler(PortletMode mode, String parameter, Object handler) throws BeansException, IllegalStateException { // Check for duplicate parameter values across all portlet modes. if (!this.allowDuplicateParameters && this.parametersUsed.contains(parameter)) { throw new IllegalStateException( "Duplicate entries for parameter [" + parameter + "] in different Portlet modes"); } this.parametersUsed.add(parameter); registerHandler(new PortletModeParameterLookupKey(mode, parameter), handler); } /** * Returns a lookup key that combines the current PortletMode and the current * value of the specified parameter. * @see PortletRequest#getPortletMode() * @see #setParameterName */ @Override protected PortletModeParameterLookupKey getLookupKey(PortletRequest request) throws Exception { PortletMode mode = request.getPortletMode(); String parameter = request.getParameter(this.parameterName); return new PortletModeParameterLookupKey(mode, parameter); } }
b8d9d8f90c674aae980ca8e06363ffcacf553954
c1ac1f9a1760d23b88305e6a8d8e6e7f009e0baf
/src/br/com/netfood_2/entity/Pedido.java
4254529a026fba742094e2606c2a73bed81dcd15
[]
no_license
Elisiandro/netfoodBD
5eba8f9ed7d46fe68d6b08aa95dfad55bf4897ac
bff8e4ac3886af5d1f4406677b727c31c93c824a
refs/heads/master
2016-08-12T23:58:39.860666
2015-11-13T15:16:37
2015-11-13T15:16:37
46,076,560
0
0
null
null
null
null
UTF-8
Java
false
false
3,287
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 br.com.netfood_2.entity; import java.io.Serializable; import java.util.ArrayList; import java.util.Date; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OneToMany; import javax.persistence.OneToOne; import javax.persistence.Temporal; import javax.persistence.TemporalType; /** * * @author Elisiandro */ @Entity public class Pedido implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @OneToOne(cascade = CascadeType.MERGE) private Garcom garcom; @OneToOne(cascade = CascadeType.MERGE) private Mesa mesa; @Temporal(TemporalType.DATE) private Date dataPedido; private boolean aberto; private double valorCosumo; private int comissao; private double valorPago; @OneToMany(cascade = CascadeType.ALL) @JoinColumn(name="PEDIDO_ID") private List<ItemPedido> listaItens = new ArrayList<>(); // //Construtor // public Pedido() { } public Pedido(Garcom garcom, Mesa mesa, boolean aberto, double valorCosumo, int comissao, double valorPago) { this.garcom = garcom; this.mesa = mesa; this.aberto = aberto; this.valorCosumo = valorCosumo; this.comissao = comissao; this.valorPago = valorPago; } // //Get e Set // public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Garcom getGarcom() { return garcom; } public void setGarcom(Garcom garcom) { this.garcom = garcom; } public Mesa getMesa() { return mesa; } public void setMesa(Mesa mesa) { this.mesa = mesa; } public boolean isAberto() { return aberto; } public void setAberto(boolean aberto) { this.aberto = aberto; } public double getValorCosumo() { return valorCosumo; } public void setValorCosumo(double valorCosumo) { this.valorCosumo = valorCosumo; } public int getComissao() { return comissao; } public void setComissao(int comissao) { this.comissao = comissao; } public double getValorPago() { return valorPago; } public void setValorPago(double valorPago) { this.valorPago = valorPago; } public List<ItemPedido> getListaItens() { return listaItens; } public void setListaItens(List<ItemPedido> listaItens) { this.listaItens = listaItens; } public Date getDataPedido() { return dataPedido; } public void setDataPedido(Date dataPedido) { this.dataPedido = dataPedido; } }
[ "New@Matrix" ]
New@Matrix
8116d8a0a0f1f05d3a5724c72e7b008228c35547
7f2587ef405359f475da20cdc2336adcc3f8d72b
/taiyiyun/src/main/java/com/taiyiyun/passport/service/IArticleViewService.java
3054d3334ed5c797f86a04ca06ae391215ae7382
[]
no_license
zhan199516/taiyiyun
dba90433b4fce055e9b597ef8f1178a7c0b68494
2ca9d672d9d43436b72f24ff655100dae6e626b3
refs/heads/master
2022-12-20T00:15:48.821278
2020-10-01T06:46:11
2020-10-01T06:46:11
300,165,216
0
0
null
null
null
null
UTF-8
Java
false
false
286
java
package com.taiyiyun.passport.service; import java.util.HashMap; /** * Created by okdos on 2017/7/1. */ public interface IArticleViewService { HashMap<String, Object> readArticle(String articleId, String viewId); String findFirstImageUrl(String content); }
a091a4ac1f4e883b188177b63ef2f33d6852dec0
e1bc85ac82be3c828d98238cc6a61bffc3f83aa6
/src/main/java/com/example/spring5recipeapp/domain/Ingredient.java
6be2d26fe13613963ecfcba3c6c7e57170f13eb1
[]
no_license
AntonyBaasan/recipe-app
9e5fcc3f2a7e98ac646c15aa1957c5a399e80dd4
7ff425e2fa1146fbbda014f9dd0d94219ec4a20d
refs/heads/master
2021-01-24T03:57:29.235303
2018-02-28T22:39:41
2018-02-28T22:39:41
122,911,365
0
0
null
null
null
null
UTF-8
Java
false
false
990
java
package com.example.spring5recipeapp.domain; import javax.persistence.*; import java.math.BigDecimal; @Entity public class Ingredient { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private long id; private String description; private BigDecimal amount; @ManyToOne private Recipe recipe; @OneToOne(fetch = FetchType.EAGER) private UnitOfMeasure unitOfMeasure; public long getId() { return id; } public void setId(long id) { this.id = id; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public BigDecimal getAmount() { return amount; } public void setAmount(BigDecimal amount) { this.amount = amount; } public Recipe getRecipe() { return recipe; } public void setRecipe(Recipe recipe) { this.recipe = recipe; } }
98cbe7bd05afab7d6e887a1da14e559b1e9eb41b
7bf02fd615ff7b0efc5438372c8d225a4fb79174
/src/com/advance/dayone/IfConditionExample.java
689cdf3fde67c3a4bc6a0e337f221f4913c106d7
[]
no_license
sharathkp-mvrc/AdvanceJavaTraining
6135f2e595fcc4acca590af803c7dbf9d27532de
d4f4221b5ab3f1ccc51e146866ee0213ca716f3c
refs/heads/master
2023-07-19T18:25:30.887724
2021-08-30T05:10:29
2021-08-30T05:10:29
399,326,800
0
0
null
null
null
null
UTF-8
Java
false
false
416
java
package com.advance.dayone; import java.util.Scanner; public class IfConditionExample { public static void main(String[] args) { Scanner scanner=new Scanner(System.in); System.out.println("Enter value for temp"); int temp=scanner.nextInt(); if(temp==100) System.out.println("TEmp is 100"); else System.out.println("Temp is not 100"); } }
f17728ee087e2b021297e3eeb2e9842e07581996
ff930400f85103b54432d5440de27127c093f47e
/competition/cig/spencerschumann/Scene.java
dd89f7ea814c260fb88cb16ddeddf24d8779fbb5
[]
no_license
dkelmer/neuromario
a37aadb7b304057f54e01613a45d6f2ca20632fb
b81ac9d6e38f7f383ab2e7c4f13e64d45e55071c
refs/heads/master
2020-12-31T04:56:15.085256
2016-05-15T05:09:55
2016-05-15T05:09:55
56,628,853
3
1
null
null
null
null
UTF-8
Java
false
false
7,644
java
package competition.cig.spencerschumann; import ch.idsia.mario.environments.Environment; import java.util.ArrayList; /** * * @author Spencer Schumann */ public class Scene { public ArrayList<Edge> floors = new ArrayList<Edge>(); public ArrayList<Edge> walls = new ArrayList<Edge>(); public ArrayList<Edge> ceilings = new ArrayList<Edge>(); public ArrayList<BumpableEdge> bumpables = new ArrayList<BumpableEdge>(); public ArrayList<Edge> enemyEmitters = new ArrayList<Edge>(); public long constructTime; // The extreme top left corner of the scene, in world coordinates public float originX; public float originY; @Override public Scene clone() { // TODO: I should really be calling s.clone() here; see Object.clone(). Scene s = new Scene(); s.update(this); //s.pos = pos.clone(); return s; } public void update(Scene scene) { // TODO: no deep copy of edges; will this cause problems? clearEdges(); add(scene); originX = scene.originX; originY = scene.originY; //marioHeight = scene.marioHeight; // TODO: copy the other mario attributes } public void clearEdges() { floors.clear(); walls.clear(); ceilings.clear(); bumpables.clear(); enemyEmitters.clear(); } private Scene() { } //private SanitizedScene(Environment observation, PosTracker pos) { // this.pos = pos; // setMarioState(observation); //} public Scene(float originX, float originY) { this.originX = originX; this.originY = originY; } public Scene(Environment observation, byte[][] scene) { long startTime = System.nanoTime(); float [] marioPos = observation.getMarioFloatPos(); originX = (float) Math.floor(marioPos[0] / 16.0f) * 16.0f - observation.HalfObsWidth * 16.0f; originY = (float) Math.floor(marioPos[1] / 16.0f) * 16.0f - observation.HalfObsHeight * 16.0f; boolean[][] visited = new boolean[scene.length][scene[0].length]; int x, y; for (y = 0; y < scene.length; y++) { for (x = 0; x < scene[y].length; x++) { byte tile = scene[y][x]; if (tile == Tiles.COIN) { // TODO } else if (!visited[y][x]) { if (Tiles.isWall(tile)) { Scene block = new Scene(originX, originY); block.expandWall(scene, visited, x, y); add(block); } else if (tile == Tiles.LEDGE) { Scene ledge = new Scene(originX, originY); ledge.expandLedge(scene, visited, x, y); add(ledge); } } } } // TODO: update bumpables and EnemyEmitters, if not already done constructTime = System.nanoTime() - startTime; } // Expand vectorized block from an initial starting point, and mark // all tiles that are part of this block as visited private void expandWall(byte[][] scene, boolean[][] visited, int x, int y) { if (visited[y][x]) { return; } visited[y][x] = true; // left side if (x > 0) { if (Tiles.isWall(scene[y][x - 1])) { expandWall(scene, visited, x - 1, y); } else { walls.add(new Edge(originX + x * 16.0f, originY + y * 16.0f, originX + x * 16.0f, originY + (y + 1) * 16.0f)); } } // right side if (x < scene[y].length - 1) { if (Tiles.isWall(scene[y][x + 1])) { expandWall(scene, visited, x + 1, y); } else { walls.add(new Edge(originX + (x + 1) * 16.0f, originY + y * 16.0f, originX + (x + 1) * 16.0f, originY + (y + 1) * 16.0f)); } } // top side if (y > 0) { if (Tiles.isWall(scene[y - 1][x])) { expandWall(scene, visited, x, y - 1); } else { floors.add(new Edge(originX + x * 16.0f, originY + y * 16.0f, originX + (x + 1) * 16.0f, originY + y * 16.0f)); } } // bottom side if (y < scene.length - 1) { if (Tiles.isWall(scene[y + 1][x])) { expandWall(scene, visited, x, y + 1); } else { ceilings.add(new Edge(originX + x * 16.0f, originY + (y + 1) * 16.0f, originX + (x + 1) * 16.0f, originY + (y + 1) * 16.0f)); } } coalesce(); } // Expand ledge private void expandLedge(byte[][] scene, boolean[][] visited, int x, int y) { if (visited[y][x]) { return; } visited[y][x] = true; int startx = x; int endx = x; // Find left side of ledge while (startx > 0 && scene[y][startx - 1] == Tiles.LEDGE) { startx--; visited[y][startx] = true; } // Find right side of ledge while (endx < scene[y].length - 1 && scene[y][endx + 1] == Tiles.LEDGE) { endx++; visited[y][endx] = true; } floors.add(new Edge(originX + startx * 16.0f, originY + y * 16.0f, originX + (endx + 1) * 16.0f, originY + y * 16.0f)); } // Coalesce adjacent edges of the same type into one private void coalesce() { // TODO // Note: should I have a contiguous ceiling, or break it up for // each special? coalesce(walls); coalesce(ceilings); coalesce(floors); coalesce(enemyEmitters); // NOTE: bumpables shouldn't be coalesced. } private void coalesce(ArrayList<Edge> edges) { // Super stupid way for now. // TODO: optimize. Without coalesce, everything runs in about // 60 microseconds max. With coalesce, times get up to around 6 // milliseconds. That's a large chunk of the allotted 40 ms to // be wasting on this. boolean foundOne = true; while (foundOne) { foundOne = false; for (Edge a : edges) { for (Edge b : edges) { if (a == b) { continue; } foundOne = true; if (a.x1 == b.x1 && a.y1 == b.y1) { // Overlapping? Something is wrong... throw new RuntimeException("Overlapping edges!"); } else if (a.x1 == b.x2 && a.y1 == b.y2) { a.x1 = b.x1; a.y1 = b.y1; } else if (a.x2 == b.x1 && a.y2 == b.y1) { a.x2 = b.x2; a.y2 = b.y2; } else { foundOne = false; } if (foundOne) { edges.remove(b); break; } } if (foundOne) { break; } } } } // Add the edges in the subscene to this scene private void add(Scene subscene) { floors.addAll(subscene.floors); walls.addAll(subscene.walls); ceilings.addAll(subscene.ceilings); bumpables.addAll(subscene.bumpables); enemyEmitters.addAll(subscene.enemyEmitters); } }
1ac149a037f08eabeae2e7771da1cc2e6eadc988
73aafbd640003cf67e85567cc7d9fa43f04b755b
/.svn/pristine/1a/1ac149a037f08eabeae2e7771da1cc2e6eadc988.svn-base
04a9093a84ebe5a9ea4db45691e3578156ed0427
[]
no_license
wm0562/web
fa8d3fcf05b74448e01eacb0af88bf3e6fb41732
efcc94795d9204c9b8e67d7582184dca92f749e0
refs/heads/master
2022-07-28T03:13:13.841594
2019-10-25T02:38:18
2019-10-25T02:38:18
217,434,780
0
0
null
2022-07-01T21:28:10
2019-10-25T02:29:42
Java
UTF-8
Java
false
false
531
package com.vortex.cloud.ums.dataaccess.dao; import java.util.List; import com.vortex.cloud.ums.dto.rest.PramSettingRestDto; import com.vortex.cloud.ums.model.PramSetting; import com.vortex.cloud.vfs.data.hibernate.repository.HibernateRepository; public interface IParamSettingDao extends HibernateRepository<PramSetting, String> { /** * 获取对应类型下的值 * @param paramTypeCode * @return */ public List<PramSettingRestDto> findListByParamTypeCode(String paramTypeCode, String tenantId); }
ffca56de2eaf560ae730cebc82531fde44b90124
331a6f080680bde52916848a0b6f657728e39939
/assignment1/src/arthemetic/ArithmeticOperation.java
39346d6f7b29e03895cd172242b4e62b97ac096e
[]
no_license
sangeetamahati/java
8b4c3f186567fa27fb14276844d8fa9c3701a207
4f2f712ba13039f17a0228c119aab461f8f638c5
refs/heads/master
2022-04-18T05:33:59.043785
2020-04-12T14:55:48
2020-04-12T14:55:48
255,102,698
0
0
null
null
null
null
UTF-8
Java
false
false
796
java
package arthemetic; public class ArithmeticOperation { int x=40,y=10; void increment() { y=((y++) +(y++) + (++y) +(--y) -( y--)); System.out.println("after performing ((y++) +(y++) + (++y) +(--y) -( y--))"); System.out.println(y); } void shiftopearation() { int a=y>>1; int b=x<<3; System.out.println("bit wise right shift="+a); System.out.println("bit wise leftt shift="+b); } public void operations() { // TODO Auto-generated method stub int add=x+y; int sub=x-y; int div=x/y; int mult=x*y; int rem=x%y; System.out.println("addition="+add); System.out.println("substraction="+sub); System.out.println("division="+div); System.out.println("Multiplication="+mult); System.out.println("Remainder="+rem); } }
5535f5f32413c28f79cdbf99009dd97fe63e7e1a
86a6b195d09e00bdc3de14e92098e31be793ea8a
/HelloWorld/src/com/board/impl/BoardServiceImpl.java
8bf47dcf35a759aec68a4bfe6411cf4e423fbff7
[]
no_license
jongwookim2019/Hello
076dc80ab32f60678d8db35211f27a3556380b5e
32e0218bf135fef0184d22e8944d960d3b8a63cb
refs/heads/master
2020-07-23T09:14:07.199919
2019-10-23T02:53:35
2019-10-23T02:53:35
207,510,100
0
0
null
null
null
null
UTF-8
Java
false
false
1,416
java
package com.board.impl; import com.board.model.Board; import com.board.model.BoardService; public class BoardServiceImpl implements BoardService { @Override public void writeBoard(Board board, Board[] boards) { for (int i = 0; i < boards.length; i++) { if (boards[i] == null) { boards[i] = board; break; } } } @Override public Board getBoard(int boardNo, Board[] boards) { Board board = null; for (int i = 0; i < boards.length; i++) { if (boards[i] != null && boards[i].getBoardNo() == boardNo) { board = boards[i]; } } return board; } @Override public Board[] getBoardList(Board[] boards) { Board[] boardAry = new Board[boards.length]; for (int i = 0; i < boards.length; i++) { boardAry[i] = boards[i]; } return boardAry; } @Override public void delBoard(int boardNo, Board[] boards) { Board board = null; for (int i = 0; i < boards.length; i++) { if (boards[i] != null && boards[i].getBoardNo() == boardNo) { boards[i] = null; } } } @Override public void updateBoard(Board board, Board[] boards) { for (int i = 0; i < boards.length; i++) { if (boards[i] != null && boards[i].getBoardNo() == board.getBoardNo()) { boards[i].setTitle(board.getTitle()); boards[i].setContents(board.getContents()); boards[i].setWriter(board.getWriter()); } } } }
[ "user@YD03-02" ]
user@YD03-02
2bfc4e2e2a1d50fd85c020367f1c9d7c1a6a2cc3
d25714d5fa26cae8ce94a5eab2605ce430b564ea
/src/main/java/fr/dawan/agentask/bean/Reponse.java
2fd4132078b95d368d2b0186e845257b2e1dbce2
[]
no_license
aliamzil/agentask
28b41630080a6a2e8cf62a2bc2966619065c438f
17e0723c23e9a540a49ed442e9366f542d36abfe
refs/heads/master
2022-12-21T01:39:48.079509
2019-10-31T15:24:46
2019-10-31T15:24:46
215,818,448
1
0
null
2022-12-16T00:59:37
2019-10-17T14:52:38
Java
UTF-8
Java
false
false
448
java
package fr.dawan.agentask.bean; import java.util.ArrayList; import java.util.HashMap; import java.util.List; public class Reponse { private int idReponse; private Sondage sondage; private List<Integer> listrep=new ArrayList<Integer>(); public Reponse(int idReponse, Sondage sondage, List<Integer> listrep) { super(); this.idReponse = idReponse; this.sondage = sondage; this.listrep = listrep; } public Reponse() { super(); } }