blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
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
listlengths
1
1
author_id
stringlengths
0
313
d54f24dc5927ba63e567b3dfc02fea0f202fdab3
0612977b10e37bb376b68c74f5d7b33a3975ff51
/src/test/java/com/comicbook/web/rest/AuditResourceIntTest.java
4da353f621512cdd21ada547a33e3c9297e5ff88
[]
no_license
michaelboyd/comic-book
e3ea0025da59639e74fada2267de063f54834b80
981c9641494f5ad449ae2934e48ba6fff3e212aa
refs/heads/master
2021-01-17T15:48:57.135415
2016-11-01T15:30:51
2016-11-01T15:30:51
69,827,061
0
1
null
2020-09-18T10:27:05
2016-10-02T23:01:33
Java
UTF-8
Java
false
false
5,676
java
package com.comicbook.web.rest; import com.comicbook.ComicBookApp; import com.comicbook.config.audit.AuditEventConverter; import com.comicbook.domain.PersistentAuditEvent; import com.comicbook.repository.PersistenceAuditEventRepository; import com.comicbook.service.AuditEventService; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.MockitoAnnotations; import org.springframework.transaction.annotation.Transactional; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; import org.springframework.http.MediaType; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import javax.inject.Inject; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import static org.hamcrest.Matchers.hasItem; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; /** * Test class for the AuditResource REST controller. * */ @RunWith(SpringRunner.class) @SpringBootTest(classes = ComicBookApp.class) @Transactional public class AuditResourceIntTest { private static final String SAMPLE_PRINCIPAL = "SAMPLE_PRINCIPAL"; private static final String SAMPLE_TYPE = "SAMPLE_TYPE"; private static final LocalDateTime SAMPLE_TIMESTAMP = LocalDateTime.parse("2015-08-04T10:11:30"); private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd"); @Inject private PersistenceAuditEventRepository auditEventRepository; @Inject private AuditEventConverter auditEventConverter; @Inject private MappingJackson2HttpMessageConverter jacksonMessageConverter; @Inject private PageableHandlerMethodArgumentResolver pageableArgumentResolver; private PersistentAuditEvent auditEvent; private MockMvc restAuditMockMvc; @Before public void setup() { MockitoAnnotations.initMocks(this); AuditEventService auditEventService = new AuditEventService(auditEventRepository, auditEventConverter); AuditResource auditResource = new AuditResource(auditEventService); this.restAuditMockMvc = MockMvcBuilders.standaloneSetup(auditResource) .setCustomArgumentResolvers(pageableArgumentResolver) .setMessageConverters(jacksonMessageConverter).build(); } @Before public void initTest() { auditEventRepository.deleteAll(); auditEvent = new PersistentAuditEvent(); auditEvent.setAuditEventType(SAMPLE_TYPE); auditEvent.setPrincipal(SAMPLE_PRINCIPAL); auditEvent.setAuditEventDate(SAMPLE_TIMESTAMP); } @Test public void getAllAudits() throws Exception { // Initialize the database auditEventRepository.save(auditEvent); // Get all the audits restAuditMockMvc.perform(get("/management/jhipster/audits")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.[*].principal").value(hasItem(SAMPLE_PRINCIPAL))); } @Test public void getAudit() throws Exception { // Initialize the database auditEventRepository.save(auditEvent); // Get the audit restAuditMockMvc.perform(get("/management/jhipster/audits/{id}", auditEvent.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.principal").value(SAMPLE_PRINCIPAL)); } @Test public void getAuditsByDate() throws Exception { // Initialize the database auditEventRepository.save(auditEvent); // Generate dates for selecting audits by date, making sure the period will contain the audit String fromDate = SAMPLE_TIMESTAMP.minusDays(1).format(FORMATTER); String toDate = SAMPLE_TIMESTAMP.plusDays(1).format(FORMATTER); // Get the audit restAuditMockMvc.perform(get("/management/jhipster/audits?fromDate="+fromDate+"&toDate="+toDate)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.[*].principal").value(hasItem(SAMPLE_PRINCIPAL))); } @Test public void getNonExistingAuditsByDate() throws Exception { // Initialize the database auditEventRepository.save(auditEvent); // Generate dates for selecting audits by date, making sure the period will not contain the sample audit String fromDate = SAMPLE_TIMESTAMP.minusDays(2).format(FORMATTER); String toDate = SAMPLE_TIMESTAMP.minusDays(1).format(FORMATTER); // Query audits but expect no results restAuditMockMvc.perform(get("/management/jhipster/audits?fromDate=" + fromDate + "&toDate=" + toDate)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(header().string("X-Total-Count", "0")); } @Test public void getNonExistingAudit() throws Exception { // Get the audit restAuditMockMvc.perform(get("/management/jhipster/audits/{id}", Long.MAX_VALUE)) .andExpect(status().isNotFound()); } }
[ "9999.michael@gmail.com" ]
9999.michael@gmail.com
afa87ae22db029c62957d11b0c32e485b4344a0a
7591e3bd086871f48c00da7d12fe1e64d97907f6
/src/com/onlineexam/service/FeeStructureServiceImpl.java
014ae9ecd1c3e7360ac79ea295445377b6f5bd77
[]
no_license
KSNServices/onlineExam
79a1e023906b1d76053218e593dc487df59393fb
bf11550c618cdcebe9a668aaae88757fb6339936
refs/heads/master
2021-01-01T20:09:40.671354
2017-09-20T15:37:41
2017-09-20T15:37:41
98,781,709
0
0
null
null
null
null
UTF-8
Java
false
false
1,346
java
package com.onlineexam.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.onlineexam.dao.FeeStructureDAO; import com.onlineexam.model.AdmissionFormModel; import com.onlineexam.model.FeeStructure; @Service public class FeeStructureServiceImpl implements FeeStructureService { @Autowired private FeeStructureDAO feeStructureDAO; @Override @Transactional public void saveFeeStructure(FeeStructure feeStructure) { feeStructureDAO.saveFeeStructure(feeStructure); } @Override @Transactional public List<FeeStructure> listFeeStructure(int adminId, int schoolId,String classValue, String section) { return feeStructureDAO.listFeeStructure(adminId,schoolId,classValue , section); } @Override @Transactional public void removeFeeStructure(FeeStructure feeDetailsID) { feeStructureDAO.removeFeeStructure(feeDetailsID); } @Override @Transactional public FeeStructure getFeeById(Integer feeId){ return feeStructureDAO.getFeeById(feeId);} @Override @Transactional public Double getFeeClass(int adminId, int schoolId,String classvalue, String section) { return feeStructureDAO.getFeeClass(adminId, schoolId, classvalue, section); } }
[ "krishnas24may@gmail.com" ]
krishnas24may@gmail.com
8962f695acb0db05c08c50265cb573096ec13d94
1d928c3f90d4a0a9a3919a804597aa0a4aab19a3
/java/neo4j/2016/12/TxStreamCompleteListener.java
f70f04554e7e71cf7fd26f796ecb6d9c1f8f5ab3
[]
no_license
rosoareslv/SED99
d8b2ff5811e7f0ffc59be066a5a0349a92cbb845
a062c118f12b93172e31e8ca115ce3f871b64461
refs/heads/main
2023-02-22T21:59:02.703005
2021-01-28T19:40:51
2021-01-28T19:40:51
306,497,459
1
1
null
2020-11-24T20:56:18
2020-10-23T01:18:07
null
UTF-8
Java
false
false
985
java
/* * Copyright (c) 2002-2016 "Neo Technology," * Network Engine for Objects in Lund AB [http://neotechnology.com] * * This file is part of Neo4j. * * Neo4j is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.neo4j.causalclustering.catchup.tx; public interface TxStreamCompleteListener { void onTxStreamingComplete( long lastTransactionId, boolean success ); }
[ "rodrigosoaresilva@gmail.com" ]
rodrigosoaresilva@gmail.com
4fc838d585af5e8753e3d64d4fe55b19694c1290
7332a820e4c01af12b76afd9233c1c93ae0a8ef2
/src/com/ms/silverking/cloud/dht/client/gen/TypeMapping.java
053a7dd0451bac42cc796b3428b67c073746d709
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
bepahol/SilverKing
d58255caf3201504b1941004f99112bc92cba1ab
4651d62ae12e35f33998e02b7d6ed5ecd9bae37b
refs/heads/master
2021-01-11T18:05:57.193915
2019-05-20T22:56:19
2019-05-20T22:56:19
79,489,059
0
0
null
2018-03-16T21:51:45
2017-01-19T19:49:55
Java
UTF-8
Java
false
false
4,535
java
package com.ms.silverking.cloud.dht.client.gen; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import com.ms.silverking.collection.Triple; import com.ms.silverking.io.FileUtil; import com.ms.silverking.text.StringUtil; public class TypeMapping { private final String javaType; private final String externalType; private final TypeMapCodeGenerator skToJavaGenerator; private final TypeMapCodeGenerator javaToSKGenerator; private static final String mapString = "MAP"; private static final String javaTypeString = "JAVA_TYPE"; static final String tab = " "; //private static Pattern p = Pattern.compile("\\s*"+mapString+"\\(([\\w[.]]+),([\\w[.]]+)\\)\\s*\\{\\s*([^\\}]*)\\}\\s*([^\\}]*)\\}"); private static Pattern p = Pattern.compile("\\s*"+mapString+"\\(([\\w[.]]+),([\\w[.]]+)\\)\\s*\\{\\s*(.*;)\\s*(.*;)\\s*\\}"); public TypeMapping(String javaType, String externalType, TypeMapCodeGenerator skToJavaGenerator, TypeMapCodeGenerator javaToSKGenerator) { this.javaType = javaType; this.externalType = externalType; this.skToJavaGenerator = skToJavaGenerator; this.javaToSKGenerator = javaToSKGenerator; } public String getJavaType() { return javaType; } public String getExternalType() { return externalType; } public TypeMapCodeGenerator getSKToJavaGenerator() { return skToJavaGenerator; } public TypeMapCodeGenerator getJavaToSKGenerator() { return javaToSKGenerator; } public String toString(String tabString, int tabDepth) { StringBuffer sb; sb = new StringBuffer(); sb.append(String.format("%s%s(%s,%s) {\n", StringUtil.replicate(tabString, tabDepth), mapString, javaType, externalType)); sb.append(skToJavaGenerator.toString(tab, tabDepth + 1)); sb.append(javaToSKGenerator.toString(tab, tabDepth + 1)); sb.append(String.format("%s}\n", StringUtil.replicate(tabString, tabDepth))); return sb.toString(); } @Override public String toString() { return toString(tab, 0); } public static TypeMapping parse(String s) { try { Matcher m; String javaType; String externalType; TypeMapCodeGenerator skToJavaGenerator; TypeMapCodeGenerator javaToSKGenerator; Triple<String,Integer,Integer> jt; jt = javaType(s); s = s.substring(0, jt.getV2()) + javaTypeString + s.substring(jt.getV3()); m = p.matcher(s); m.find(); //javaType = m.group(1); javaType = jt.getV1(); externalType = m.group(2); skToJavaGenerator = TypeMapCodeGenerator.parse(m.group(3) +"}"); javaToSKGenerator = TypeMapCodeGenerator.parse(m.group(4) +"}"); return new TypeMapping(javaType, externalType, skToJavaGenerator, javaToSKGenerator); } catch (RuntimeException re) { System.out.println(s); throw re; } } private static Triple<String,Integer,Integer> javaType(String s) { int i0; int i1; int i2; i0 = s.indexOf(mapString); if (i0 < 0) { throw new RuntimeException("Invalid mapping: "+ s); } i1 = s.indexOf("(", i0); if (i1 < 0) { throw new RuntimeException("Invalid mapping: "+ s); } i2 = findCommaOutsideOfBrackets(s, i1); if (i2 < 0) { throw new RuntimeException("Invalid mapping: "+ s); } return new Triple<>(s.substring(i1 + 1, i2).trim(), i1 + 1, i2); } private static int findCommaOutsideOfBrackets(String s, int i0) { int depth; depth = 0; for (int i = i0; i < s.length(); i++) { char c; c = s.charAt(i); if (c == '<') { depth++; } else if (c == '>') { depth--; if (depth < 0) { throw new RuntimeException("Invalid mapping: "+ s); } } else if (c == ',') { if (depth == 0) { return i; } } } return -1; } public static List<TypeMapping> readTypeMappings(String typeMappingFile) throws IOException { List<TypeMapping> tmList; tmList = new ArrayList<>(); for (String def : FileUtil.readFileAsString(typeMappingFile).split(mapString)) { def = def.trim(); if (def.length() > 0) { tmList.add(TypeMapping.parse(mapString + def)); } } return tmList; } public static void main(String[] args) { TypeMapping tm; tm = new TypeMapping("java.util.Map", "SKMap", new TypeMapCodeGenerator(TypeMapCodeGenerator.Direction.skToJava, "skm", "jm = skm.toJavaMap()"), new TypeMapCodeGenerator(TypeMapCodeGenerator.Direction.javaToSK, "jm", "skm = SKMap::fromJavaMap(jm)")); System.out.println(tm.toString()); System.out.println(parse(tm.toString())); } }
[ "bepahol2@gmail.com" ]
bepahol2@gmail.com
5eb7354c885c91dceeaef17e8f581f86ae553d44
b09f518c08e930460e08309dc5f6dd5b1e6ff6de
/1180-decorator-mode/src/main/java/com/tuyrk/decorator/Soya.java
5d0a0f934545ee3b969b61aa93043e13da480d92
[]
no_license
tuyrk/learn-imooc
087c185d9fa50b39f73b29b44bc281f03f5e5ccf
99040f6fca437ecf36eaaaf21447a92c5f2eb0ec
refs/heads/master
2022-11-04T12:36:15.671227
2020-11-22T12:07:03
2020-11-22T12:07:03
219,886,876
1
1
null
2022-10-05T19:37:44
2019-11-06T01:38:53
Java
UTF-8
Java
false
false
263
java
package com.tuyrk.decorator; /** * 被装饰者-豆浆 * * @author tuyrk */ public class Soya implements Drink { @Override public double money() { return 5D; } @Override public String desc() { return "纯豆浆"; } }
[ "tuyrk@qq.com" ]
tuyrk@qq.com
246b3cbfb8647e33dc4c9d4c3ad5b5d77590a679
67170aec42749ac999ba7a12a991cb5fc724e28e
/src/main/java/com/mycompany/cs313playspokemon/Stream.java
a9e34e212b2f34e39f006bad3e298f77447ba062
[]
no_license
ravidfish/cs313JavaFinal
7b275ed525f59ed5f385477acf76d0c6382dd81b
56f672543ce9ed3d90adbce7a083590f3e91b494
refs/heads/master
2021-01-10T19:33:34.323364
2015-03-19T16:25:58
2015-03-19T16:25:58
32,531,454
0
0
null
null
null
null
UTF-8
Java
false
false
3,963
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.mycompany.cs313playspokemon; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author Mark */ @WebServlet(name = "Stream", urlPatterns = {"/Stream"}) public class Stream extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try (PrintWriter out = response.getWriter()) { /* TODO output your page here. You may use following sample code. */ out.println("<!DOCTYPE html>"); out.println("<html>"); out.println("<head>"); out.println("<title>CS 313 Plays Pokemon</title>"); out.println("</head>"); out.println("<body>"); out.println("<h1>CS 313 Plays Pokemon</h1>"); out.println("<object type='application/x-shockwave-flash' height='378' width='620' data='//www-cdn.jtvnw.net/swflibs/TwitchPlayer.swf' bgcolor='#000000'>"); out.println("<param name='allowFullScreen' value='true' />"); out.println("<param name='allowScriptAccess' value='always' />"); out.println("<param name='allowNetworking' value='all' />"); out.println("<param name='movie' value='//www-cdn.jtvnw.net/swflibs/TwitchPlayer.swf' />"); out.println("<param name='flashvars' value='channel=weatherworn&auto_play=true&start_volume=25' />"); out.println("</object>"); out.println("<iframe frameborder='0' scrolling='no' id='chat_embed' src='http://www.twitch.tv/weatherworn/chat' height='500' width='350'>"); out.println("</iframe>"); out.println("</body>"); out.println("</html>"); } } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
[ "ma.fisher7@gmail.com" ]
ma.fisher7@gmail.com
3444925d72bfbcad3d458fb59fc89adcb4d05e01
b9551767f097af09f5e2109b4d706fb233be6dc6
/src/features/steps/SignupStep.java
9c251079b842a75d06709cddcedddb571b69552b
[]
no_license
CaioPenhalver/No-Waste-test
ccbef36eebab8709bab6d6f33d32c7025464a460
074d5089cbe6717175a3758651bff72c4683da02
refs/heads/master
2021-01-20T18:28:20.756593
2016-07-08T01:29:01
2016-07-08T01:29:01
62,832,921
0
0
null
null
null
null
UTF-8
Java
false
false
1,818
java
package features.steps; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; import support.page_objects.HomePage; import support.page_objects.SignupFrame; public class SignupStep { private HomePage homePage = new HomePage(); private SignupFrame signupFrame; private String response; @Given("^I am on register form$") public void i_am_on_register_form() throws Throwable { signupFrame = homePage.clickOnSignup(); } @When("^I fill in \"([^\"]*)\" in username field$") public void i_fill_in_in_username_field(String username) throws Throwable { signupFrame.setUsernameField(username); } @When("^I fill in \"([^\"]*)\" in firstname field$") public void i_fill_in_in_firstname_field(String firstname) throws Throwable { signupFrame.setFirstNameField(firstname); } @When("^I fill in \"([^\"]*)\" in lastname field$") public void i_fill_in_in_lastname_field(String lastname) throws Throwable { signupFrame.setlastNameField(lastname); } @When("^I fill in \"([^\"]*)\" in password field$") public void i_fill_in_in_password_field(String password) throws Throwable { signupFrame.setPasswordField(password); } @When("^I fill in \"([^\"]*)\" in password confirmation field$") public void i_fill_in_in_password_confirmation_field(String password) throws Throwable { signupFrame.setPasswordConfirmationField(password); } @When("^I click on sing-up button$") public void i_click_on_sing_up_button() throws Throwable { response = signupFrame.register(); } @Then("^I should see \"([^\"]*)\" message$") public void i_should_see_message(String message) throws Throwable { assertThat(message, equalTo(response)); } }
[ "cpenhalver@gmail.com" ]
cpenhalver@gmail.com
03613fc884940cc8e2cab31639707635668aead1
1a1f5240a10f24de23228c72b0b6d8f7711c64da
/src/controllers/StepModeController.java
8d3c83a808ea16955c50e2a4d6cf8bbffa3e7dbb
[]
no_license
rvrhiv/SMO-19
4dfb9500073d45d381d26fdfd1101affb7ee4678
9a59b0f494e0855b621fa2027d54e5b581684015
refs/heads/master
2023-04-06T09:49:59.078947
2020-11-17T14:57:18
2020-11-17T14:57:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,700
java
package controllers; import app.*; import app.analytics.StepModel; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.*; import javafx.scene.control.cell.PropertyValueFactory; import javafx.util.Pair; import java.util.ArrayList; public class StepModeController { private Main mainApp; private Settings settings; private Simulator simulator; private ObservableList<DataTableModel> bufferTableList; private ObservableList<DataTableModel> deviceTableList; private Integer currentStep; private Integer allStepCount; private Double currentTime; private Integer currentRequestNumber; private ArrayList<StepModel> steps; @FXML private TableView<DataTableModel> bufferTable; @FXML private TableColumn<DataTableModel, String> bufferColumnName; @FXML private TableColumn<DataTableModel, String> bufferColumnState; @FXML private TableColumn<DataTableModel, String> bufferColumnRequest; @FXML private TableView<DataTableModel> deviceTable; @FXML private TableColumn<DataTableModel, String> deviceColumnName; @FXML private TableColumn<DataTableModel, String> deviceColumnState; @FXML private TableColumn<DataTableModel, String> deviceColumnRequest; @FXML private TextArea descriptionTextArea; @FXML private Button exitButton; @FXML private Button updateButton; @FXML private Label timeLabel; @FXML private Label stepLabel; @FXML private Label allStepsLabel; @FXML private TextField goToStepField; @FXML private Button goToStepButton; @FXML private Button prevButton; @FXML private Button nextButton; @FXML public void initialize() { bufferColumnName.setCellValueFactory(new PropertyValueFactory<>("Name")); bufferColumnState.setCellValueFactory(new PropertyValueFactory<>("State")); bufferColumnRequest.setCellValueFactory(new PropertyValueFactory<>("Request")); deviceColumnName.setCellValueFactory(new PropertyValueFactory<>("Name")); deviceColumnState.setCellValueFactory(new PropertyValueFactory<>("State")); deviceColumnRequest.setCellValueFactory(new PropertyValueFactory<>("Request")); currentStep = 0; allStepCount = 0; currentTime = 0.0; currentRequestNumber = 0; } @FXML void onClickNextButton(ActionEvent event) { if (currentStep >= allStepCount) { return; } currentStep++; stepLabel.setText(currentStep.toString()); commitStep(currentStep); } @FXML void onClickPrevButton(ActionEvent event) { currentStep--; if (currentStep < 0) { currentStep++; return; } int tmpStep = currentStep; stepLabel.setText(currentStep.toString()); refresh(); for (int i = 0; i < tmpStep; i++) { onClickNextButton(event); } } @FXML void onClickExitButton(ActionEvent event) { mainApp.openMainMenu(); } @FXML void onClickUpdateButton(ActionEvent event) { simulator = new Simulator(settings); simulator.simulate(); steps = new ArrayList<>(); steps.add(null); steps.addAll(simulator.getAnalytics().getSteps()); goToStepButton.setDisable(false); nextButton.setDisable(false); prevButton.setDisable(false); allStepCount = steps.size()-1; allStepsLabel.setText(allStepCount.toString()); refresh(); } @FXML void onClickGoToStepButton(ActionEvent event) { String tmpStepStr = goToStepField.getText(); int tmpStep; try { tmpStep = Integer.parseInt(tmpStepStr); } catch (Exception e) { goToStepField.requestFocus(); return; } if (tmpStep < 0 || tmpStep > allStepCount) { goToStepField.requestFocus(); return; } refresh(); for (int i = 0; i < tmpStep; i++) { onClickNextButton(event); } } public void setMainApp(Main mainApp) { this.mainApp = mainApp; } public void setSettings(Settings settings) { this.settings = settings; simulator = new Simulator(settings); } private void commitStep(Integer currentStep) { StepModel model = steps.get(currentStep); Pair<Integer, Request> data = model.getData(); currentTime = model.getCurrentTime(); timeLabel.setText(currentTime.toString()); String message = switch (model.getAction()) { case NEW_REQUEST -> { currentRequestNumber++; yield "Создана заявка " + (data.getKey()+1) + "." + currentRequestNumber + " Источником " + (data.getValue().getSourceNumber()+1); } case ADD_TO_BUFFER -> { bufferTableList.set(data.getKey(), new DataTableModel("Buffer" + (data.getKey()+1), "Busy", (data.getValue().getSourceNumber()+1) + "." + currentRequestNumber)); yield "Заявка " + (data.getValue().getSourceNumber()+1) + "." + currentRequestNumber + " была добавлена в Buffer" + (data.getKey()+1); } case REMOVE_FROM_BUFFER -> { bufferTableList.set(data.getKey(), new DataTableModel("Buffer" + (data.getKey()+1), "Free", "-")); yield "Заявка " + (data.getValue().getSourceNumber()+1) + "." + currentRequestNumber + " была отклонена Buffer" + (data.getKey()+1); } case GET_FROM_BUFFER -> { bufferTableList.set(data.getKey(), new DataTableModel("Buffer" + (data.getKey()+1), "Free", "-")); yield "Заявка " + (data.getValue().getSourceNumber()+1) + "." + currentRequestNumber + " была выбрана из Buffer" + (data.getKey()+1); } case ADD_TO_DEVICE -> { deviceTableList.set(data.getKey(), new DataTableModel("Device" + (data.getKey()+1), "Busy", (data.getValue().getSourceNumber()+1) + "." + currentRequestNumber)); yield "Заявка " + (data.getValue().getSourceNumber()+1) + "." + currentRequestNumber + " была добавлена в Device" + (data.getKey()+1); } case REMOVE_FROM_DEVICE -> { deviceTableList.set(data.getKey(), new DataTableModel("Device" + (data.getKey()+1), "Free", "-")); yield "Заявка " + (data.getValue().getSourceNumber()+1) + "." + currentRequestNumber + " была обработана Device" + (data.getKey()+1); } }; descriptionTextArea.setText(message); } private void refresh() { currentTime = 0.0; timeLabel.setText(currentTime.toString()); descriptionTextArea.clear(); currentRequestNumber = 0; currentStep = 0; stepLabel.setText(currentStep.toString()); bufferTableList = FXCollections.observableArrayList(); for (int i = 1; i <= settings.getBufferSize(); i++) { bufferTableList.add(new DataTableModel("Buffer" + i, "Free", "-")); } bufferTable.setItems(bufferTableList); deviceTableList = FXCollections.observableArrayList(); for (int i = 1; i <= settings.getDeviceAmount(); i++) { deviceTableList.add(new DataTableModel("Device" + i, "Free", "-")); } deviceTable.setItems(deviceTableList); } }
[ "rar130600@mail.ru" ]
rar130600@mail.ru
29d0b5992b04434a222d188b33b5ca38ecf5f9d1
bf6ac7040124aea31298934fbd4946901eff73a6
/lab6_HashTables/package-info.java
22d2d6a8c870cc08fe12a9a657dbe4f7cf373895
[]
no_license
MaxChillin/Computer-Science-II
6b36a31685ddd3eb4c66d174b7caa5ee677e5fd1
0e4e825ac31bb44a33962cf9718e3be111aade48
refs/heads/master
2021-01-20T07:20:50.965137
2017-05-02T05:26:30
2017-05-02T05:26:30
89,994,558
0
0
null
null
null
null
UTF-8
Java
false
false
72
java
/** * */ /** * @author Jeremy * */ package lab6_HashTables;
[ "noreply@github.com" ]
MaxChillin.noreply@github.com
d7275fd961a5b5788500888fcc37db0722edda05
6c72bdef90809ff3bacf26d3b46e42d50ed9b902
/src/main/java/org/juane/platedetect/controller/interfaces/IMainFrame.java
8b8af067fed8c3dda8ac89b662e5988ac8a7a51a
[]
no_license
juane619/MyPlateDetect
1a1b8094cb314825169530a44d839f7b97130e6f
ea926060b36db11938c04198cf0425f8d65edd97
refs/heads/master
2022-11-21T07:28:59.340954
2020-07-04T10:59:23
2020-07-04T10:59:23
277,091,440
0
0
null
null
null
null
UTF-8
Java
false
false
386
java
package org.juane.platedetect.controller.interfaces; import javafx.event.ActionEvent; public interface IMainFrame { public void openAction(ActionEvent actionEvent); public void closeAction(ActionEvent actionEvent); public void videoModeAction(ActionEvent actionEvent); public void imageModeAction(ActionEvent actionEvent); public void aboutAction(ActionEvent actionEvent); }
[ "juane_619@hotmail.com" ]
juane_619@hotmail.com
0ca2c0aacdfa804c63cf10a3ee1043e50a8150e1
5c7936d5216dc240e549a15e1a408dfbb11e24e5
/src/main/java/io/ppatierno/kafka/connect/amqp/source/AmqpSourceConnectorConfig.java
ae65a36ab8ec2bfa964a3eb1a582d03fd2159b8e
[ "Apache-2.0" ]
permissive
cirobarradov/kafka-connect-amqp
32ed7ed546fc5deaa93e2c92107d3295006953be
588f7a6be895caa5e66ad5597b1bf3bc763b3991
refs/heads/master
2020-03-20T10:27:57.807831
2018-06-14T14:56:02
2018-06-14T14:56:02
137,372,431
0
0
null
2018-06-14T14:54:50
2018-06-14T14:54:49
null
UTF-8
Java
false
false
2,214
java
/* * Copyright 2016 Red Hat Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.ppatierno.kafka.connect.amqp.source; import org.apache.kafka.common.config.AbstractConfig; import org.apache.kafka.common.config.ConfigDef; import org.apache.kafka.common.config.ConfigDef.Importance; import org.apache.kafka.common.config.ConfigDef.Type; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List; import java.util.Map; /** * Configuration class for the AMQP source connector */ public class AmqpSourceConnectorConfig extends AbstractConfig { private static final Logger LOG = LoggerFactory.getLogger(AmqpSourceConnectorConfig.class); // list of configuration parameters for each server List<Map<String, String>> configs; public static ConfigDef baseConfigDef() { return new ConfigDef() .define(AmqpSourceConnectorConstant.AMQP_SERVER_HOSTNAME, Type.STRING, AmqpSourceConnectorConstant.AMQP_SERVER_HOSTNAME_DEFAULT, Importance.HIGH, "AMQP server hostname") .define(AmqpSourceConnectorConstant.AMQP_SERVER_PORT, Type.INT, AmqpSourceConnectorConstant.AMQP_SERVER_PORT_DEFAULT, Importance.HIGH, "AMQP server port") .define(AmqpSourceConnectorConstant.AMQP_SERVER_CREDITS, Type.INT, AmqpSourceConnectorConstant.AMQP_SERVER_CREDITS_DEFAULT, Importance.HIGH, "AMQP credits for prefetch in flow control"); } public static final ConfigDef CONFIG_DEF = baseConfigDef(); /** * Constructor * * @param props properties map for configuration */ public AmqpSourceConnectorConfig(Map<String, String> props) { super(CONFIG_DEF, props); LOG.info("Initialize AMQP source Connector configuration"); } }
[ "ppatierno@live.com" ]
ppatierno@live.com
43d91c73b8f561bc9aa42ed41fb64c10306d59e1
81bb1cc89c393d284e82c1b706581e7b42c7824b
/Standalone Prototype/Source Code/src/neo4jTraversal/TraversalState.java
e4da6c8a5ad9af7fcc052d21963a16a84f442801
[ "Apache-2.0" ]
permissive
FairPlayer4/BachelorThesis
e017cf5952c77d359fcb7a3667ab650d530b5c9a
5ab902e50d868b308353ec00e31dc94e920a39c6
refs/heads/master
2022-11-28T03:14:52.086295
2020-08-10T11:49:51
2020-08-10T11:49:51
286,456,680
0
0
null
null
null
null
UTF-8
Java
false
false
6,622
java
package neo4jTraversal; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import org.neo4j.graphdb.Node; import neo4jGateSets.GateSet; /** * This class stores traversal information which is used to continue the traversal.<br> * TraversalStates copied in each traversal branch so they can be modified independently.<br> * It stores the last GateSet so further traversals can connect their GateSet or Nodes to it.<br> * It stores a List of Inport to Inport Instance Maps which is used to continue traversal at Inports (they can have multiple Inport Instances).<br> * The an Inport Map is added to the List at each Outport Instance and the last Inport Map is removed at an Inport after it was mapped to a specific Inport * Instance.<br> * It contains two HashSets for Nodes which are used to find simple and deep cycles.<br> * A simple cycle is a cycle inside a CFT that does not traverse inside other CFT.<br> * A deep cycle is a cycle between two CFT Instances in which a specific Inport Instance or Outport Instance is traversed twice.<br> * * @author Kevin Bartik * */ public class TraversalState { /** * The last GateSet that was added to the TraversalState.<br> * Is used to connect GateSets and Nodes during a traversal.<br> */ private GateSet lastGateSet; /** * List of Inport to Inport Instance Maps.<br> * Is used to continue traversal at Inports as they can have multiple Inport Instances. <br> */ private LinkedList<HashMap<Node, Node>> inportMapList; /** * All Outport Instances and Inport Instances that are traversed are added to this set. <br> * Is used to find deep cycles.<br> */ private HashSet<Node> traversedInstances; /** * All traversed Nodes except Outport Instances and Inport Instances are added to this set.<br> * Is cleared when the traversal enters another CFT.<br> * Is used to find simple cycles.<br> */ private HashSet<Node> simpleTraversedNodes; /** * Constructor for a new TraversalState.<br> * Adds the last GateSet and initializes the List and both Sets.<br> * * @param nextGateSet * The last GateSet. */ TraversalState() { lastGateSet = null; inportMapList = new LinkedList<HashMap<Node, Node>>(); traversedInstances = new HashSet<Node>(); simpleTraversedNodes = new HashSet<Node>(); } /** * Constructor for a new TraversalState.<br> * Adds the last GateSet and initializes the List and both Sets.<br> * * @param nextGateSet * The last GateSet. */ TraversalState(GateSet nextGateSet) { lastGateSet = nextGateSet; inportMapList = new LinkedList<HashMap<Node, Node>>(); traversedInstances = new HashSet<Node>(); simpleTraversedNodes = new HashSet<Node>(); } /** * Copy Constructor.<br> * Copies the previous TraversalState to allow independent modification.<br> * Is used when different traversal branches appear for example if a Node has multiple incoming Failure Propagations.<br> * * @param ts * The old TraversalState. */ TraversalState(TraversalState ts) { lastGateSet = ts.lastGateSet; inportMapList = new LinkedList<HashMap<Node, Node>>(ts.inportMapList); traversedInstances = new HashSet<Node>(ts.traversedInstances); simpleTraversedNodes = new HashSet<Node>(ts.simpleTraversedNodes); } /** * Returns the last GateSet.<br> * * @return the last GateSet. */ GateSet getLastGateSet() { return lastGateSet; } /** * Sets the last GateSet.<br> * * @param lastGateSet * The next last GateSet. */ void setLastGateSet(GateSet lastGateSet) { this.lastGateSet = lastGateSet; } /** * Adds a Node to the set for finding simple cycles.<br> * Returns false if the Node was added (the set did not contain the Node).<br> * Returns true if the Node was already contained in the set (Then a simple cycle was found).<br> * * @param node * The Node that is added. * @return false if the Node was added (the set did not contain the Node). true if the Node was already contained in the set (Then a simple cycle was * found). */ boolean addNodeToSimple(Node node) { return !simpleTraversedNodes.add(node); } /** * Adds a Node to the set for finding deep cycles.<br> * Returns false if the Node was added (the set did not contain the Node).<br> * Returns true if the Node was already contained in the set (Then a deep cycle was found).<br> * * @param node * The Node that is added. * @return false if the Node was added (the set did not contain the Node). true if the Node was already contained in the set (Then a deep cycle was found). */ boolean addNodeToInstances(Node node) { return !traversedInstances.add(node); } /** * Adds a Node to the last GateSet.<br> * * @param node * The Node that is added. */ void addNodeToLastGateSet(Node node) { lastGateSet.addNode(node); } /** * Adds a GateSet to the last GateSet.<br> * * @param gateSet * The GateSet that is added. */ void addGateSetToLastGateSet(GateSet gateSet) { lastGateSet.addLowerGateSet(gateSet); } /** * Adds an Inport Map to the List of Inport Maps.<br> * * @param inportMap * The Inport Map that is added. */ void addInportMap(HashMap<Node, Node> inportMap) { inportMapList.add(inportMap); } /** * Clears the set for finding simple cycles.<br> * Is used when the traversal enters a different CFT. */ void clearSimple() { simpleTraversedNodes.clear(); } /** * Removes and returns the last Inport Map from the List of Inport Maps.<br> * * @return The last Inport Map of the List of Inport Maps. */ HashMap<Node, Node> removeLastInportMap() { return inportMapList.removeLast(); } /** * Returns true if the last Inport Map in the List of Inport Maps contains the Inport as a key.<br> * Otherwise false. <br> * * @param inport * The Inport. * @return true if the last Inport Map in the List of Inport Maps contains the Inport as a key. Otherwise false. */ boolean containsInport(Node inport) { return inportMapList.getLast().containsKey(inport); } }
[ "bartike@gmx.de" ]
bartike@gmx.de
9be562d9124287ebb465e93d3216505f92e3d744
1e359fa8b9db767b87be921bb9263e2b4a39a138
/src/main/java/com/sample/apns/common/Configuration.java
235c3ce97a565735d45542451c65a65bcd6f8812
[ "Apache-2.0" ]
permissive
volkodava/simple-apns-app
1d8d9aa865e7a60b4a3e3b32b02258d187db433c
8e2251632cd2ca9178908cd7d26a7ec82fb5ee4c
refs/heads/master
2020-12-31T04:28:17.952699
2016-05-16T20:01:18
2016-05-16T20:01:18
58,711,052
0
0
null
null
null
null
UTF-8
Java
false
false
2,051
java
package com.sample.apns.common; import org.apache.commons.lang3.StringUtils; import java.io.IOException; import java.net.InetAddress; import java.net.Socket; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Configuration { private static final int MIN_PORT_NUMBER = 0; private static final int MAX_PORT_NUMBER = 65535; private int serverPort; private String topicAddress; private String dateTimeFormat; public int getServerPort() { return serverPort; } public void setServerPort(int serverPort) { this.serverPort = serverPort; } public String getTopicAddress() { return topicAddress; } public void setTopicAddress(String topicAddress) { this.topicAddress = topicAddress; } public String getDateTimeFormat() { return dateTimeFormat; } public SimpleDateFormat getDateTimeFormatter() { return new SimpleDateFormat(dateTimeFormat); } public void setDateTimeFormat(String dateTimeFormat) { this.dateTimeFormat = dateTimeFormat; } public String convertDateToString(Date date) { if (date == null) { return null; } return getDateTimeFormatter().format(date); } public Date convertStringToDate(String dateStr) { if (StringUtils.isBlank(dateStr)) { return null; } try { return getDateTimeFormatter().parse(dateStr); } catch (ParseException e) { throw new IllegalArgumentException("Date has invalid format: " + dateStr); } } public boolean serverPortInUse() { if (serverPort < MIN_PORT_NUMBER || serverPort > MAX_PORT_NUMBER) { throw new IllegalArgumentException("Invalid port number: " + serverPort); } try { new Socket(InetAddress.getLoopbackAddress(), serverPort).close(); return true; } catch (IOException ex) { } return false; } }
[ "volkodavav@gmail.com" ]
volkodavav@gmail.com
c45941045231c541505552a148ef3190cb9be8ef
a5772b2a435fe994fc22dd56a21203df64d0b762
/tvsurvey-frontend/src/main/java/de/daikol/tvsurvey/frontend/component/TableTooltip.java
f4b7dde496b7b6b59bd01e3be0912f22d93b025e
[]
no_license
daikol68/tvsurvey
1543066cda5cdba2658bfb9b753a0330fc1bf090
027936b1873f17c3496fe92cd98a9deb9f7ca0a0
refs/heads/master
2021-07-04T02:19:17.338838
2020-03-15T13:00:56
2020-03-15T13:00:56
229,818,112
0
0
null
2021-04-19T14:53:04
2019-12-23T20:25:01
Java
UTF-8
Java
false
false
1,161
java
package de.daikol.tvsurvey.frontend.component; import com.vaadin.ui.AbstractSelect.ItemDescriptionGenerator; import com.vaadin.ui.Component; /** * Einfache Klasse zum Anzeigen eines Tooltip. */ public class TableTooltip implements ItemDescriptionGenerator { /** * serialVersionUID. */ private static final long serialVersionUID = -2719732581763190622L; /** * Der Text, der im Tooltip angezeigt werden soll. */ String tooltipText; /** * Constructor for a new Tooltip. * * @param tooltipText * Der Text, der im Tooltip angezeigt werden soll. */ public TableTooltip(String tooltipText) { this.tooltipText = tooltipText; } /** * {@inheritDoc} */ @Override public String generateDescription(Component source, Object itemId, Object propertyId) { return this.tooltipText; } /** * Setter for <code>tooltipText</code>. * * @param tooltipText * New value used for <code>tooltipText</code>. */ public void setTooltipText(String tooltipText) { this.tooltipText = tooltipText; } }
[ "david.kowol@googlemail.com" ]
david.kowol@googlemail.com
4cae8d0a9b8d9d4e3cfedb6c2e114f6a204587fc
b1db50efcf5095f75dce781607cb8c1b4bcfad55
/tbc-console/src/main/java/console/zcomp/ZConfirmDialog.java
5321e3b223f5dfae7feec34f775a007e10bb140b
[]
no_license
berolomsa/tbcapp
86295b433be04d83455a27cc64042eb256bdd74d
54e5f50798a1684515969bb377fbfc42a11cbd00
refs/heads/master
2021-03-24T13:14:22.851887
2017-07-26T20:12:46
2017-07-26T20:12:46
80,762,251
1
0
null
null
null
null
UTF-8
Java
false
false
674
java
package console.zcomp; import com.sencha.gxt.core.client.util.Padding; import com.sencha.gxt.widget.core.client.box.ConfirmMessageBox; import com.sencha.gxt.widget.core.client.event.DialogHideEvent; public abstract class ZConfirmDialog extends ConfirmMessageBox { public ZConfirmDialog(String header, String text) { super(header, text); getBody().setPadding(new Padding(10)); setIcon(ICONS.info()); addDialogHideHandler(new DialogHideEvent.DialogHideHandler() { @Override public void onDialogHide(DialogHideEvent event) { if (event.getHideButton() == PredefinedButton.YES) { onConfirm(); } } }); } public abstract void onConfirm(); }
[ "blomsadze@gstreams.com" ]
blomsadze@gstreams.com
15ab61afdd0c27b1a99f81166ae16d6bfee4beaf
6189bc8f09d38d476ee103618e58097330b1d851
/src/thread/_1_basic/_9_setPriority/_2_regularity/MyThread1.java
c4c806d3622b9586d1b9590cb3a6d2578552dffe
[]
no_license
lyqlbst/thread_study
08e3f0bd7527731294480536a1bf194cc9f4ef67
f693e9e2e96ebe56ba90bedac9023c26fe2917e4
refs/heads/master
2020-03-15T09:11:37.080418
2018-05-25T08:41:15
2018-05-25T08:41:15
132,069,199
1
0
null
null
null
null
UTF-8
Java
false
false
635
java
package thread._1_basic._9_setPriority._2_regularity; import java.util.Random; class MyThread1 extends Thread { @Override public void run() { long beginTime = System.currentTimeMillis(); long addResult = 0; for (int j = 0; j < 10; j++) { for (int i = 0; i < 50000; i++) { Random random = new Random(); random.nextInt(); addResult += i; } } long endTime = System.currentTimeMillis(); System.out.println("★ ★ ★ ★ ★ thread 1 use time=" + (endTime - beginTime) + " addResult=" + addResult); } }
[ "linyuqiang@bonc.com.cn" ]
linyuqiang@bonc.com.cn
ac72451edeb116e4fc0af63128f5829b1d9e94b9
a7d6a36595208333099a64ff02af1ba2ec7ce941
/src/main/java/ru/twitter/domain/Role.java
6fb3d605cb4645786633e4ac221be4a1f3f39c66
[]
no_license
enfr1z/SimpleCloneTwitter
9998ce15adf321b3e1683910d937c2018d416a31
79844f86aacf04fbf5b6f35d14a7642662c5838d
refs/heads/master
2020-12-26T05:18:51.150706
2020-01-31T09:23:49
2020-01-31T09:23:49
237,397,375
0
0
null
null
null
null
UTF-8
Java
false
false
234
java
package ru.twitter.domain; import org.springframework.security.core.GrantedAuthority; public enum Role implements GrantedAuthority { USER, ADMIN; @Override public String getAuthority() { return name(); } }
[ "out-berlyaev-as@cab-wsm-0002721.sigma.sbrf.ru" ]
out-berlyaev-as@cab-wsm-0002721.sigma.sbrf.ru
348bf026171c15c2f3283d5473cae394e1b94952
1fcdacf82ed08348fe57c951ceda1fbf89797c30
/modules/core/src/test/java/org/springside/modules/utils/ThreadsTest.java
bd6b4f170c2f437af7d63662622ffd45e14f67b0
[ "Apache-2.0" ]
permissive
seightday/springside4-4.2.3.GA-fork
cd2e248867157d26441f419c3278f1b5b40c3232
bcf8bc1dfeddbb264c0e76b982f12a667b1b7e78
refs/heads/master
2021-04-30T07:06:09.011511
2019-11-12T08:36:10
2019-11-12T08:36:10
79,976,904
0
2
Apache-2.0
2020-07-01T18:08:43
2017-01-25T02:42:03
Java
UTF-8
Java
false
false
3,583
java
/******************************************************************************* * Copyright (c) 2005, 2014 springside.github.io * * Licensed under the Apache License, Version 2.0 (the "License"); *******************************************************************************/ package org.springside.modules.utils; import static org.assertj.core.api.Assertions.*; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import org.junit.Test; import org.junit.experimental.categories.Category; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springside.modules.test.category.UnStable; import org.springside.modules.test.log.LogbackListAppender; @Category(UnStable.class) public class ThreadsTest { @Test public void gracefulShutdown() throws InterruptedException { Logger logger = LoggerFactory.getLogger("test"); LogbackListAppender appender = new LogbackListAppender(); appender.addToLogger("test"); // time enough to shutdown ExecutorService pool = Executors.newSingleThreadExecutor(); Runnable task = new Task(logger, 500, 0); pool.execute(task); Threads.gracefulShutdown(pool, 1000, 1000, TimeUnit.MILLISECONDS); assertThat(pool.isTerminated()).isTrue(); assertThat(appender.getFirstLog()).isNull(); // time not enough to shutdown,call shutdownNow appender.clearLogs(); pool = Executors.newSingleThreadExecutor(); task = new Task(logger, 1000, 0); pool.execute(task); Threads.gracefulShutdown(pool, 500, 1000, TimeUnit.MILLISECONDS); assertThat(pool.isTerminated()).isTrue(); assertThat(appender.getFirstLog().getMessage()).isEqualTo("InterruptedException"); // self thread interrupt while calling gracefulShutdown appender.clearLogs(); final ExecutorService self = Executors.newSingleThreadExecutor(); task = new Task(logger, 100000, 0); self.execute(task); final CountDownLatch lock = new CountDownLatch(1); Thread thread = new Thread(new Runnable() { @Override public void run() { lock.countDown(); Threads.gracefulShutdown(self, 200000, 200000, TimeUnit.MILLISECONDS); } }); thread.start(); lock.await(); thread.interrupt(); Threads.sleep(500); assertThat(appender.getFirstLog().getMessage()).isEqualTo("InterruptedException"); } @Test public void normalShutdown() throws InterruptedException { Logger logger = LoggerFactory.getLogger("test"); LogbackListAppender appender = new LogbackListAppender(); appender.addToLogger("test"); // time not enough to shutdown,write error log. appender.clearLogs(); ExecutorService pool = Executors.newSingleThreadExecutor(); Runnable task = new Task(logger, 1000, 0); pool.execute(task); Threads.normalShutdown(pool, 500, TimeUnit.MILLISECONDS); assertThat(pool.isTerminated()).isTrue(); assertThat(appender.getFirstMessage()).isEqualTo("InterruptedException"); } static class Task implements Runnable { private final Logger logger; private int runTime = 0; private final int sleepTime; Task(Logger logger, int sleepTime, int runTime) { this.logger = logger; this.sleepTime = sleepTime; this.runTime = runTime; } @Override public void run() { System.out.println("start task"); if (runTime > 0) { long start = System.currentTimeMillis(); while ((System.currentTimeMillis() - start) < runTime) { } } try { Thread.sleep(sleepTime); } catch (InterruptedException e) { logger.warn("InterruptedException"); } } } }
[ "seightday@gmail.com" ]
seightday@gmail.com
626070266c9dfa6cff7501b6d88a7fd5b724a8d1
ba0472d756744246284c7c298b83009b144cdddd
/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/internal/jaxb/cases/domain/statement/ddl/CreateSchemaStatementTestCase.java
8463bfb3b5ab2b502ed8b4ba3f8da5875d9d6a61
[ "Apache-2.0" ]
permissive
dalek42/sharding-jdbc
31c8479abbae8d8779a8dc6c36e9fc1948f52479
b088c3610a7f61370609aabd9b5ff13e038170aa
refs/heads/master
2022-11-16T11:04:40.413209
2022-11-15T01:56:37
2022-11-15T01:56:37
64,831,988
0
0
null
null
null
null
UTF-8
Java
false
false
1,127
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.shardingsphere.test.sql.parser.internal.jaxb.cases.domain.statement.ddl; import org.apache.shardingsphere.test.sql.parser.internal.jaxb.cases.domain.statement.SQLParserTestCase; /** * Create schema statement test case. */ public final class CreateSchemaStatementTestCase extends SQLParserTestCase { }
[ "noreply@github.com" ]
dalek42.noreply@github.com
adffbda710cf7631f5ef22320405433f672bcfbf
08480828ce6980a56b59ecd19adfeb52eb41ba2f
/Ready/src/CallBack/CallBackTest.java
462c52c89a59e46a0adbcc29bc3725fb15e1bace
[]
no_license
YinXinLION/JAVA
227220ce8dda89b9a247829e567514de4969f9ad
88d476e9d229b6b6217757a30a79dbe3708f2025
refs/heads/master
2021-01-12T00:18:05.380362
2017-09-22T07:19:37
2017-09-22T07:19:37
78,703,138
0
0
null
null
null
null
UTF-8
Java
false
false
264
java
package CallBack; /** * Created by yinxin on 17-8-8. */ public class CallBackTest { public static void main(String[] args) { Server server = new Server(); Client client = new Client(server); client.sendMsg("Server,Hello~"); } }
[ "yinxin19950816@gmail.com" ]
yinxin19950816@gmail.com
9d5641b22132f8aa613491adb3a06a2b20ee22d8
08f2a0bd8e0d86b67e209df89e92d89ecf92cfb7
/app/src/main/java/org/master/utils/bldeapplication/ItemViewHolder.java
c0b4cb2bbee765a3da6ed1fce1edc2448e8fa075
[]
no_license
rajashreekhatavi/BLDEApplication
c5b5769ff60a1b359a00a67f4a693f5a99fe7d99
774cd107226fced4d736dd6dde082f9ea082cc38
refs/heads/master
2020-03-25T05:16:49.817516
2018-08-03T14:37:42
2018-08-03T14:37:42
143,438,480
0
0
null
null
null
null
UTF-8
Java
false
false
571
java
package org.master.utils.bldeapplication; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.ImageView; import android.widget.TextView; /** * Created by Gururaj on 7/28/2018. */ public class ItemViewHolder extends RecyclerView.ViewHolder { ImageView image; TextView name ; TextView dob; public ItemViewHolder(View itemView) { super(itemView); image = itemView.findViewById(R.id.image); name = itemView.findViewById(R.id.name); dob = itemView.findViewById(R.id.dob); } }
[ "rajashreekhatavi23@gmail.com" ]
rajashreekhatavi23@gmail.com
9522c36752cbea553c7fdb8ca633400598ae46c8
9d2f466f741a9f511da91b0276f8caf0d19da5c5
/jms-playground/02_wildfly_standalone/src/main/java/org/jboss/qe/kremilek/jms/eap/EapStandaloneAutoQueueCustomContextExample.java
220dd1cc10ff40e694e661688b062935c486b3af
[]
no_license
pkremens/drunken-octo-shame
e695cd37d1788a3694d8ae8fc75183213627860a
db0c18e51b9b666f696d17ee60a96def61422787
refs/heads/master
2022-09-13T15:33:17.475859
2020-11-20T11:15:00
2020-11-20T11:15:00
20,056,570
0
0
null
2022-08-30T20:50:21
2014-05-22T10:08:02
Java
UTF-8
Java
false
false
4,760
java
package org.jboss.qe.kremilek.jms.eap; import org.apache.activemq.artemis.jms.client.ActiveMQDestination; import org.apache.activemq.artemis.jms.client.ActiveMQQueue; import javax.jms.ConnectionFactory; import javax.jms.Destination; import javax.jms.JMSConsumer; import javax.jms.JMSContext; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import java.util.Properties; import java.util.logging.Logger; /** * @author Petr Kremensky pkremens@redhat.com */ public class EapStandaloneAutoQueueCustomContextExample { private static final Logger log = Logger.getLogger(EapStandaloneAutoQueueCustomContextExample.class.getName()); // Set up all the default values private static final String DEFAULT_MESSAGE = "Hello, World!"; private static final String DEFAULT_CONNECTION_FACTORY = "jms/RemoteConnectionFactory"; private static final String DEFAULT_DESTINATION = "jms/queue/pkremens"; private static final String DEFAULT_MESSAGE_COUNT = "1"; private static final String INITIAL_CONTEXT_FACTORY = "org.wildfly.naming.client.WildFlyInitialContextFactory"; private static final String PROVIDER_URL = "http-remoting://127.0.0.1:8080"; public static void main(String[] args) { Context namingContext = null; try { // Set up the namingContext for the JNDI lookup final Properties env = new Properties(); env.put(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY); env.put(Context.PROVIDER_URL, System.getProperty(Context.PROVIDER_URL, PROVIDER_URL)); namingContext = new InitialContext(env); // Perform the JNDI lookups String connectionFactoryString = System.getProperty("connection.factory", DEFAULT_CONNECTION_FACTORY); log.info("Attempting to acquire connection factory \"" + connectionFactoryString + "\""); ConnectionFactory connectionFactory = (ConnectionFactory) namingContext.lookup(connectionFactoryString); log.info("Found connection factory \"" + connectionFactoryString + "\" in JNDI"); /* * We want to artemis create a queue by itself in here so JNDI is not possible (the target * destination does not exist yet). */ // String destinationString = System.getProperty("destination", DEFAULT_DESTINATION); // log.info("Attempting to acquire destination \"" + destinationString + "\""); // Destination destination = (Destination) namingContext.lookup(destinationString); // log.info("Found destination \"" + destinationString + "\" in JNDI"); /** * Run in CLI: * /subsystem=messaging-activemq/server=default/address-setting=#:write-attribute(name=auto-create-queues, value=true) * to allow artemis creating a queues on demand */ log.info("Create a queue programmatically"); Destination destination = ActiveMQDestination.createQueue(DEFAULT_DESTINATION); int count = Integer.parseInt(System.getProperty("message.count", DEFAULT_MESSAGE_COUNT)); String content = System.getProperty("message.content", DEFAULT_MESSAGE); /** * Run in CLI: * /subsystem=messaging-activemq/server=default:write-attribute(name=security-enabled,value=false) * to disable authentication of remote JMS clients */ try (JMSContext context = connectionFactory.createContext()) { log.info("Sending " + count + " messages with content: " + content); // Send the specified number of messages for (int i = 0; i < count; i++) { context.createProducer().send(destination, content + " " + ((ActiveMQQueue) destination).getQueueName()); } // Create the JMS consumer JMSConsumer consumer = context.createConsumer(destination); // Then receive the same number of messages that were sent for (int i = 0; i < count; i++) { String text = consumer.receiveBody(String.class, 5000); log.info("Received message with content " + text); } } } catch (NamingException e) { e.printStackTrace(); log.warning(e.getMessage()); } finally { if (namingContext != null) { try { namingContext.close(); } catch (NamingException e) { e.printStackTrace(); log.warning(e.getMessage()); } } } } }
[ "pkremens@redhat.com" ]
pkremens@redhat.com
b8a191813724c63fcc118088f4b28d0fec5bc149
a710907746c9f1232ba19f7d1f7f01f1642562fa
/java-benchmark/src/main/java/com/unionpay/serializer/java/dto/UserOrder.java
8b318a8b09cce217be73900bd87354301cdfff7f
[ "Apache-2.0" ]
permissive
shiyueqi/serializer-benchmark
8f1521963b9fc50bc6964e59de50793bc5c917bc
4aff038fade6775117d50793aeaa28f40fd81aeb
refs/heads/master
2021-05-02T11:44:16.525228
2016-11-14T02:52:51
2016-11-14T02:52:51
72,712,280
0
0
null
null
null
null
UTF-8
Java
false
false
1,341
java
package com.unionpay.serializer.java.dto; import java.io.Serializable; /** * date: 2016/10/31 15:20. * author: Yueqi Shi */ public class UserOrder implements Serializable { private long id; private long gmtCreate; private int money; private String location; public UserOrder() { } public UserOrder(long id, long gmtCreate, int money, String location) { this.id = id; this.gmtCreate = gmtCreate; this.money = money; this.location = location; } public long getId() { return id; } public void setId(long id) { this.id = id; } public long getGmtCreate() { return gmtCreate; } public void setGmtCreate(long gmtCreate) { this.gmtCreate = gmtCreate; } public int getMoney() { return money; } public void setMoney(int money) { this.money = money; } public String getLocation() { return location; } public void setLocation(String location) { this.location = location; } @Override public String toString() { return "UserOrder{" + "id=" + id + ", gmtCreate=" + gmtCreate + ", money=" + money + ", location='" + location + '\'' + '}'; } }
[ "yqshi@sysnew.com" ]
yqshi@sysnew.com
a34147217fb00f1cb90f3d76a58d4b57fcac9bf7
7b81d8081061e44845b1f6c14a53075625155212
/src/main/java/com/accenture/school/service/ClassesService.java
ccf8076278c19f9244ef160aabed0041105c38f1
[]
no_license
AliceDaSilva/academia-spring-boot-school
500037cfd81478e43fcbf0c65e8161ae000e496d
62c3ea0ab3de01ba27cef632144b09ea593488c7
refs/heads/master
2023-08-21T22:23:47.133877
2021-10-01T00:11:22
2021-10-01T00:11:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
804
java
package com.accenture.school.service; import java.util.List; import org.springframework.stereotype.Service; import com.accenture.school.model.Classes; import com.accenture.school.service.interfaces.IClassesService; @Service public class ClassesService implements IClassesService{ @Override public Classes getById(long id) { // TODO Auto-generated method stub return null; } @Override public List<Classes> getAll() { // TODO Auto-generated method stub return null; } @Override public long create(Classes classes) { // TODO Auto-generated method stub return 0; } @Override public boolean update(Classes classes) { // TODO Auto-generated method stub return false; } @Override public boolean delete(long id) { // TODO Auto-generated method stub return false; } }
[ "pj_jonesmartins@bocombbm.com.br" ]
pj_jonesmartins@bocombbm.com.br
7b9fabf0f1f2eda52b2e052401b944629fd58da4
9634fd96577aa3683c5a54c2cc44145bba97e9f4
/src/main/java/com/yukkyapp/Request.java
39d43330712d430fe9d7dc1bbbf909505f1b2746
[]
no_license
smallprodapp/yukky-log-java-sdk
5f698ace453a9208662f3a8b529f4b5a7d755a60
1b0c4775d60746e3aeef29fea91b91226fd085bd
refs/heads/master
2022-07-03T06:38:02.316284
2019-09-10T11:45:55
2019-09-10T11:45:55
207,538,560
0
0
null
2020-10-13T15:56:41
2019-09-10T11:15:54
Java
UTF-8
Java
false
false
293
java
package com.yukkyapp; public class Request { private FullLog log; private String appkey; private String appsecret; public Request(FullLog log, String appkey, String appsecret) { this.log = log; this.appkey = appkey; this.appsecret = appsecret; } }
[ "pablo_mo@orange.fr" ]
pablo_mo@orange.fr
43ced7e5a12bd867a147e8c8200bf913076a7406
b8006901f62156821674557dd4861d44fcfef16d
/rocketmq-common/src/main/java/com/alibaba/rocketmq/common/protocol/body/ConsumerRunningInfo.java
379d449f393db82170c50f43b679067a77a2ef7b
[ "Apache-2.0" ]
permissive
dingjun84/mq-backup
a9b3ae1210e138684ffe6614e3ec29d5b77bd278
c242c5a7778aa6fae2cf64d86330f9e677bb53dc
refs/heads/master
2021-01-19T22:13:41.005722
2014-12-13T08:37:20
2014-12-13T08:37:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
11,261
java
package com.alibaba.rocketmq.common.protocol.body; import java.util.Iterator; import java.util.Map.Entry; import java.util.Properties; import java.util.TreeMap; import java.util.TreeSet; import com.alibaba.rocketmq.common.message.MessageQueue; import com.alibaba.rocketmq.common.protocol.heartbeat.ConsumeType; import com.alibaba.rocketmq.common.protocol.heartbeat.SubscriptionData; import com.alibaba.rocketmq.remoting.protocol.RemotingSerializable; /** * Consumer内部数据结构 */ public class ConsumerRunningInfo extends RemotingSerializable { public static final String PROP_NAMESERVER_ADDR = "PROP_NAMESERVER_ADDR"; public static final String PROP_THREADPOOL_CORE_SIZE = "PROP_THREADPOOL_CORE_SIZE"; public static final String PROP_CONSUME_ORDERLY = "PROP_CONSUMEORDERLY"; public static final String PROP_CONSUME_TYPE = "PROP_CONSUME_TYPE"; public static final String PROP_CLIENT_VERSION = "PROP_CLIENT_VERSION"; public static final String PROP_CONSUMER_START_TIMESTAMP = "PROP_CONSUMER_START_TIMESTAMP"; // 各种配置及运行数据 private Properties properties = new Properties(); // 订阅关系 private TreeSet<SubscriptionData> subscriptionSet = new TreeSet<SubscriptionData>(); // 消费进度、Rebalance、内部消费队列的信息 private TreeMap<MessageQueue, ProcessQueueInfo> mqTable = new TreeMap<MessageQueue, ProcessQueueInfo>(); // RT、TPS统计 private TreeMap<String/* Topic */, ConsumeStatus> statusTable = new TreeMap<String, ConsumeStatus>(); public Properties getProperties() { return properties; } public void setProperties(Properties properties) { this.properties = properties; } public TreeMap<MessageQueue, ProcessQueueInfo> getMqTable() { return mqTable; } public void setMqTable(TreeMap<MessageQueue, ProcessQueueInfo> mqTable) { this.mqTable = mqTable; } public TreeMap<String, ConsumeStatus> getStatusTable() { return statusTable; } public void setStatusTable(TreeMap<String, ConsumeStatus> statusTable) { this.statusTable = statusTable; } public TreeSet<SubscriptionData> getSubscriptionSet() { return subscriptionSet; } public void setSubscriptionSet(TreeSet<SubscriptionData> subscriptionSet) { this.subscriptionSet = subscriptionSet; } public String formatString() { StringBuilder sb = new StringBuilder(); // 1 { sb.append("#Consumer Properties#\n"); Iterator<Entry<Object, Object>> it = this.properties.entrySet().iterator(); while (it.hasNext()) { Entry<Object, Object> next = it.next(); String item = String.format("%-40s: %s\n", next.getKey().toString(), next.getValue().toString()); sb.append(item); } } // 2 { sb.append("\n\n#Consumer Subscription#\n"); Iterator<SubscriptionData> it = this.subscriptionSet.iterator(); int i = 0; while (it.hasNext()) { SubscriptionData next = it.next(); String item = String.format("%03d Topic: %-40s ClassFilter: %-8s SubExpression: %s\n", // ++i,// next.getTopic(),// next.isClassFilterMode(),// next.getSubString()); sb.append(item); } } // 3 { sb.append("\n\n#Consumer Offset#\n"); sb.append(String.format("%-32s %-32s %-4s %-20s\n",// "#Topic",// "#Broker Name",// "#QID",// "#Consumer Offset"// )); Iterator<Entry<MessageQueue, ProcessQueueInfo>> it = this.mqTable.entrySet().iterator(); while (it.hasNext()) { Entry<MessageQueue, ProcessQueueInfo> next = it.next(); String item = String.format("%-32s %-32s %-4d %-20d\n",// next.getKey().getTopic(),// next.getKey().getBrokerName(),// next.getKey().getQueueId(),// next.getValue().getCommitOffset()); sb.append(item); } } // 4 { sb.append("\n\n#Consumer MQ Detail#\n"); sb.append(String.format("%-32s %-32s %-4s %-20s\n",// "#Topic",// "#Broker Name",// "#QID",// "#ProcessQueueInfo"// )); Iterator<Entry<MessageQueue, ProcessQueueInfo>> it = this.mqTable.entrySet().iterator(); while (it.hasNext()) { Entry<MessageQueue, ProcessQueueInfo> next = it.next(); String item = String.format("%-32s %-32s %-4d %s\n",// next.getKey().getTopic(),// next.getKey().getBrokerName(),// next.getKey().getQueueId(),// next.getValue().toString()); sb.append(item); } } // 5 { sb.append("\n\n#Consumer RT&TPS#\n"); sb.append(String.format("%-32s %14s %14s %14s %14s %18s %25s\n",// "#Topic",// "#Pull RT",// "#Pull TPS",// "#Consume RT",// "#ConsumeOK TPS",// "#ConsumeFailed TPS",// "#ConsumeFailedMsgsInHour"// )); Iterator<Entry<String, ConsumeStatus>> it = this.statusTable.entrySet().iterator(); while (it.hasNext()) { Entry<String, ConsumeStatus> next = it.next(); String item = String.format("%-32s %14.2f %14.2f %14.2f %14.2f %18.2f %25d\n",// next.getKey(),// next.getValue().getPullRT(),// next.getValue().getPullTPS(),// next.getValue().getConsumeRT(),// next.getValue().getConsumeOKTPS(),// next.getValue().getConsumeFailedTPS(),// next.getValue().getConsumeFailedMsgs()// ); sb.append(item); } } return sb.toString(); } /** * 分析订阅关系是否相同 */ public static boolean analyzeSubscription( final TreeMap<String/* clientId */, ConsumerRunningInfo> criTable) { ConsumerRunningInfo prev = criTable.firstEntry().getValue(); boolean push = false; { String property = prev.getProperties().getProperty(ConsumerRunningInfo.PROP_CONSUME_TYPE); push = ConsumeType.valueOf(property) == ConsumeType.CONSUME_PASSIVELY; } boolean startForAWhile = false; { String property = prev.getProperties().getProperty(ConsumerRunningInfo.PROP_CONSUMER_START_TIMESTAMP); startForAWhile = (System.currentTimeMillis() - Long.parseLong(property)) > (1000 * 60 * 2); } // 只检测PUSH if (push && startForAWhile) { // 分析订阅关系是否相同 { Iterator<Entry<String, ConsumerRunningInfo>> it = criTable.entrySet().iterator(); while (it.hasNext()) { Entry<String, ConsumerRunningInfo> next = it.next(); ConsumerRunningInfo current = next.getValue(); boolean equals = current.getSubscriptionSet().equals(prev.getSubscriptionSet()); // 发现订阅关系有误 if (!equals) { // Different subscription in the same group of consumer return false; } prev = next.getValue(); } if (prev != null) { // 无订阅关系 if (prev.getSubscriptionSet().isEmpty()) { // Subscription empty! return false; } } } } return true; } public static boolean analyzeRebalance(final TreeMap<String/* clientId */, ConsumerRunningInfo> criTable) { return true; } public static String analyzeProcessQueue(final String clientId, ConsumerRunningInfo info) { StringBuilder sb = new StringBuilder(); boolean push = false; { String property = info.getProperties().getProperty(ConsumerRunningInfo.PROP_CONSUME_TYPE); push = ConsumeType.valueOf(property) == ConsumeType.CONSUME_PASSIVELY; } boolean orderMsg = false; { String property = info.getProperties().getProperty(ConsumerRunningInfo.PROP_CONSUME_ORDERLY); orderMsg = Boolean.parseBoolean(property); } if (push) { Iterator<Entry<MessageQueue, ProcessQueueInfo>> it = info.getMqTable().entrySet().iterator(); while (it.hasNext()) { Entry<MessageQueue, ProcessQueueInfo> next = it.next(); MessageQueue mq = next.getKey(); ProcessQueueInfo pq = next.getValue(); // 顺序消息 if (orderMsg) { // 没锁住 if (!pq.isLocked()) { sb.append(String.format("%s %s can't lock for a while, %dms\n", // clientId,// mq,// System.currentTimeMillis() - pq.getLastLockTimestamp())); } // 锁住 else { // Rebalance已经丢弃此队列,但是没有正常释放Lock if (pq.isDroped() && (pq.getTryUnlockTimes() > 0)) { sb.append(String.format("%s %s unlock %d times, still failed\n",// clientId,// mq,// pq.getTryUnlockTimes())); } } // 事务消息未提交 } // 乱序消息 else { long diff = System.currentTimeMillis() - pq.getLastConsumeTimestamp(); // 在有消息的情况下,超过1分钟没再消费消息了 if (diff > (1000 * 60) && pq.getCachedMsgCount() > 0) { sb.append(String.format("%s %s can't consume for a while, maybe blocked, %dms\n",// clientId,// mq, // diff)); } } } } return sb.toString(); } }
[ "dingjun84@gmail.com" ]
dingjun84@gmail.com
3a2dec165d0d0ebb5fce3d04d1085529332cb1e6
74d5bd2e7d391eb192c20f622ff60b05f0fec04d
/controlesselecciongridlistspinnerrad/src/androidTest/java/com/examples/eri/controlesselecciongridlistspinnerrad/ApplicationTest.java
229a7f7c10c6c1bd0b373ab7cbc1172cd9a9f32b
[]
no_license
eriDam/Android_TextControls_Layouts_SQLite
0cbaf1784ad8f4eb86eb02fc02ea1a3fed2bc234
4027067a8e8f3017ff1002b5e4b76dd29f2782d5
refs/heads/master
2021-01-19T16:33:19.016818
2015-04-03T16:01:58
2015-04-03T16:01:58
33,370,663
1
0
null
null
null
null
UTF-8
Java
false
false
384
java
package com.examples.eri.controlesselecciongridlistspinnerrad; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
[ "erika.c.caballero@gmail.com" ]
erika.c.caballero@gmail.com
e8926cdb78b4ba99773709bd911ec61a2fb014c9
f914821872fbcb1d3b74d962620fbaf624461b65
/src/main/java/com/jj/managesys/service/sys/PermissionService.java
eac6b8a4f3ef57d74be3f3b4599dc6f48510a17c
[]
no_license
jie295085424/managesys
d37eb6113dab3873dccb8fbbd45b28d46a617a9c
de82f0870f2958326c555ec0c3146625d563bfb0
refs/heads/master
2021-09-03T16:10:02.935671
2018-01-10T09:54:30
2018-01-10T09:54:30
115,409,357
0
0
null
null
null
null
UTF-8
Java
false
false
303
java
package com.jj.managesys.service.sys; import com.jj.managesys.domain.sys.Permission; import com.jj.managesys.service.CrudService; /** * @author huangjunjie * @ClassName PermissionService * @Description * @Date 2017/12/26. */ public interface PermissionService extends CrudService<Permission> { }
[ "295085424@qq.com" ]
295085424@qq.com
737e03b1c24e296a2572e5de156696b4f9e8edb8
24151aab2412fedf3832731ce5d52ece4144b83d
/src/test/java/com/codingcow/knapsack/KnapsackApplicationTests.java
103767298c084c61dbfc177cacdb960bc73e40af
[]
no_license
orchoe/knapsack
e5550009f40b005bbbcbb729ce3dd4fcd1f1998d
13325c927b741c17548e1dd1a7f11296204b97f3
refs/heads/master
2020-03-30T07:10:59.088664
2018-11-26T05:56:35
2018-11-26T05:56:35
150,920,724
2
0
null
null
null
null
UTF-8
Java
false
false
350
java
package com.codingcow.knapsack; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class KnapsackApplicationTests { @Test public void contextLoads() { } }
[ "antipe@outlook.com" ]
antipe@outlook.com
b1cb7bf671c087e16ed293142b391eb39417a9c4
cf53e7ac00ef902fe46df8f6458dcc3310c5bc16
/src/main/java/com/discov/service/SimulationController.java
b73f393bbe0ad4af863748e483f9633641d5b925
[]
no_license
dmatangany/interstellARR
9f266f8e7c42dca66c0e1159e6ec581d1ad97b39
e90270aa2778dbbe235a8cf68637507df9b9f2b6
refs/heads/main
2023-02-24T00:35:37.477979
2021-01-29T12:55:22
2021-01-29T12:55:22
331,668,701
0
0
null
null
null
null
UTF-8
Java
false
false
925
java
package com.discov.service; import com.discov.dataload.DirectLoader; import com.discov.dataorm.Distance; import com.discov.exception.ControllerException; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.web.bind.annotation.*; import com.discov.logical.CustomAlgorithm; import org.springframework.ui.Model; import javax.servlet.http.HttpServletRequest; @RestController public class SimulationController { @Autowired @Lazy private CustomAlgorithm customAlgorithm; @RequestMapping(method = RequestMethod.GET, value="/custom/{source}/{destination}") @ResponseBody public String getCustomShortestPath(@PathVariable("source") String source, @PathVariable("destination") String destination) throws ControllerException { return customAlgorithm.processNodes(source, destination).toString(); } }
[ "noreply@github.com" ]
dmatangany.noreply@github.com
10988cbf5d0734f257a2061b82cdd4c4ecd4710e
f2aa4806626a16c53442094ecae0f770f5b029ce
/arc-core/src/arc/mock/MockFiles.java
2ec69c844cdff86dfa51465150a950a8e8350904
[ "Apache-2.0" ]
permissive
Anuken/Arc
bc369e313c9e9c886acd7bcf16ce2613bb459637
152e49944a1de4653c6aa8c822b03915fcdf25ba
refs/heads/master
2023-09-05T22:09:26.682248
2023-09-03T17:29:00
2023-09-03T17:29:00
162,523,607
282
147
Apache-2.0
2023-08-22T10:22:53
2018-12-20T03:49:27
Java
UTF-8
Java
false
false
661
java
package arc.mock; import arc.*; import arc.files.*; import arc.util.*; import java.io.*; public class MockFiles implements Files{ @Override public Fi get(String fileName, FileType type){ return new Fi(fileName, type); } @Override public String getExternalStoragePath(){ return OS.userHome + File.separator; } @Override public boolean isExternalStorageAvailable(){ return true; } @Override public String getLocalStoragePath(){ return new File("").getAbsolutePath() + File.separator; } @Override public boolean isLocalStorageAvailable(){ return true; } }
[ "arnukren@gmail.com" ]
arnukren@gmail.com
0ba1cdfd4cc022c60df6f5af58b4b8643fae1960
9b929f72bd721477a758d5ba7016353cdf38866d
/springboot/src/main/java/com/xe/demo/common/utils/CookieUtil.java
a9bdc983f0000c0fa8bed0e8e563b2f3ee61e667
[]
no_license
ToooBad/account
2927ebd3ab89e7f9fe9106e4118e99954dcca0a8
f7f3e303763d48fac3059939a4f2fb4e7b4fb4a8
refs/heads/master
2020-04-15T15:16:49.205235
2019-01-10T01:44:23
2019-01-10T01:44:23
164,788,284
2
0
null
null
null
null
UTF-8
Java
false
false
1,366
java
package com.xe.demo.common.utils; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * kookie工具类 * * @author CZH */ public class CookieUtil { public static void set(String key, String value, HttpServletResponse response) { Cookie cookie = new Cookie(key, value); cookie.setMaxAge(-1); cookie.setPath("/"); response.addCookie(cookie); } public static void longset(String key, String value, HttpServletResponse response) { Cookie cookie = new Cookie(key, value); cookie.setMaxAge(30 * 24 * 60 * 60); cookie.setPath("/"); response.addCookie(cookie); } public static String get(String key, HttpServletRequest request) { Cookie[] cookies = request.getCookies(); if (cookies != null) { for (int i = 0; i < cookies.length; i++) { if (cookies[i].getName().equals(key)) { return cookies[i].getValue(); } } } return null; } public static void delete(String key, HttpServletRequest request, HttpServletResponse response) { Cookie[] arr_cookie = request.getCookies(); if (arr_cookie != null && arr_cookie.length > 0) { for (Cookie cookie : arr_cookie) { if (cookie.getName().equals(key)) { cookie.setValue(""); cookie.setMaxAge(0); cookie.setPath("/"); response.addCookie(cookie); } } } } }
[ "15935700104@163.com" ]
15935700104@163.com
656176e23f217559448ccb778dd2567094cd68c1
738f1614134b13bd51edd39f8265ff5818962054
/src/main/java/org/bian/dto/BQContentDevelopmentExchangeOutputModel.java
36f1088caec2af4fc354a2dd4a578758a1251ea7
[ "Apache-2.0" ]
permissive
bianapis/sd-product-training-v3
fb84bd3f6aea4750cdc70d1e2a1d8a12f6275aeb
5fb1e356bad4ba4ad1397cbaaea69b13fae9688d
refs/heads/master
2022-12-19T11:03:37.387782
2020-09-26T16:43:35
2020-09-26T16:43:35
298,789,092
0
0
null
null
null
null
UTF-8
Java
false
false
9,247
java
package org.bian.dto; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.Valid; /** * BQContentDevelopmentExchangeOutputModel */ public class BQContentDevelopmentExchangeOutputModel { private String contentDevelopmentPreconditions = null; private String contentDevelopmentBusinessUnitEmployeeReference = null; private String contentDevelopmentWorkSchedule = null; private String contentDevelopmentPostconditions = null; private String contentDevelopmentContentDevelopmentServiceType = null; private String contentDevelopmentContentDevelopmentServiceDescription = null; private String contentDevelopmentContentDevelopmentServiceInputsandOuputs = null; private String contentDevelopmentContentDevelopmentServiceWorkProduct = null; private String contentDevelopmentContentDevelopmentServiceName = null; private String contentDevelopmentExchangeActionTaskReference = null; private Object contentDevelopmentExchangeActionTaskRecord = null; private String contentDevelopmentExchangeActionResponse = null; private String contentDevelopmentInstanceStatus = null; /** * `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Text general-info: The required status/situation and or tasks that need to be completed prior to the initiation of the workstep * @return contentDevelopmentPreconditions **/ public String getContentDevelopmentPreconditions() { return contentDevelopmentPreconditions; } public void setContentDevelopmentPreconditions(String contentDevelopmentPreconditions) { this.contentDevelopmentPreconditions = contentDevelopmentPreconditions; } /** * `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::ISO20022andUNCEFACT::Identifier general-info: The operating unit/employee responsible for the workstep * @return contentDevelopmentBusinessUnitEmployeeReference **/ public String getContentDevelopmentBusinessUnitEmployeeReference() { return contentDevelopmentBusinessUnitEmployeeReference; } public void setContentDevelopmentBusinessUnitEmployeeReference(String contentDevelopmentBusinessUnitEmployeeReference) { this.contentDevelopmentBusinessUnitEmployeeReference = contentDevelopmentBusinessUnitEmployeeReference; } /** * `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Text general-info: The timing and key actions/milestones making up the workstep * @return contentDevelopmentWorkSchedule **/ public String getContentDevelopmentWorkSchedule() { return contentDevelopmentWorkSchedule; } public void setContentDevelopmentWorkSchedule(String contentDevelopmentWorkSchedule) { this.contentDevelopmentWorkSchedule = contentDevelopmentWorkSchedule; } /** * `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Text general-info: The completion status and reference to subsequent actions that may be triggered on completion of the workstep * @return contentDevelopmentPostconditions **/ public String getContentDevelopmentPostconditions() { return contentDevelopmentPostconditions; } public void setContentDevelopmentPostconditions(String contentDevelopmentPostconditions) { this.contentDevelopmentPostconditions = contentDevelopmentPostconditions; } /** * `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Text general-info: Reference to the specific business service type * @return contentDevelopmentContentDevelopmentServiceType **/ public String getContentDevelopmentContentDevelopmentServiceType() { return contentDevelopmentContentDevelopmentServiceType; } public void setContentDevelopmentContentDevelopmentServiceType(String contentDevelopmentContentDevelopmentServiceType) { this.contentDevelopmentContentDevelopmentServiceType = contentDevelopmentContentDevelopmentServiceType; } /** * `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Text general-info: Description of the performed business service * @return contentDevelopmentContentDevelopmentServiceDescription **/ public String getContentDevelopmentContentDevelopmentServiceDescription() { return contentDevelopmentContentDevelopmentServiceDescription; } public void setContentDevelopmentContentDevelopmentServiceDescription(String contentDevelopmentContentDevelopmentServiceDescription) { this.contentDevelopmentContentDevelopmentServiceDescription = contentDevelopmentContentDevelopmentServiceDescription; } /** * `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Text general-info: Mandatory and optional inputs and output information for the business service * @return contentDevelopmentContentDevelopmentServiceInputsandOuputs **/ public String getContentDevelopmentContentDevelopmentServiceInputsandOuputs() { return contentDevelopmentContentDevelopmentServiceInputsandOuputs; } public void setContentDevelopmentContentDevelopmentServiceInputsandOuputs(String contentDevelopmentContentDevelopmentServiceInputsandOuputs) { this.contentDevelopmentContentDevelopmentServiceInputsandOuputs = contentDevelopmentContentDevelopmentServiceInputsandOuputs; } /** * `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Text general-info: Documentation, meeting schedules, notes, reasearch. calculations and any other work products produced by the business service * @return contentDevelopmentContentDevelopmentServiceWorkProduct **/ public String getContentDevelopmentContentDevelopmentServiceWorkProduct() { return contentDevelopmentContentDevelopmentServiceWorkProduct; } public void setContentDevelopmentContentDevelopmentServiceWorkProduct(String contentDevelopmentContentDevelopmentServiceWorkProduct) { this.contentDevelopmentContentDevelopmentServiceWorkProduct = contentDevelopmentContentDevelopmentServiceWorkProduct; } /** * `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Text general-info: * @return contentDevelopmentContentDevelopmentServiceName **/ public String getContentDevelopmentContentDevelopmentServiceName() { return contentDevelopmentContentDevelopmentServiceName; } public void setContentDevelopmentContentDevelopmentServiceName(String contentDevelopmentContentDevelopmentServiceName) { this.contentDevelopmentContentDevelopmentServiceName = contentDevelopmentContentDevelopmentServiceName; } /** * `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::ISO20022andUNCEFACT::Identifier general-info: Reference to a Content Development instance exchange service call * @return contentDevelopmentExchangeActionTaskReference **/ public String getContentDevelopmentExchangeActionTaskReference() { return contentDevelopmentExchangeActionTaskReference; } public void setContentDevelopmentExchangeActionTaskReference(String contentDevelopmentExchangeActionTaskReference) { this.contentDevelopmentExchangeActionTaskReference = contentDevelopmentExchangeActionTaskReference; } /** * `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Binary general-info: The exchange service call consolidated processing record * @return contentDevelopmentExchangeActionTaskRecord **/ public Object getContentDevelopmentExchangeActionTaskRecord() { return contentDevelopmentExchangeActionTaskRecord; } public void setContentDevelopmentExchangeActionTaskRecord(Object contentDevelopmentExchangeActionTaskRecord) { this.contentDevelopmentExchangeActionTaskRecord = contentDevelopmentExchangeActionTaskRecord; } /** * `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Text general-info: Details of the exchange action service response * @return contentDevelopmentExchangeActionResponse **/ public String getContentDevelopmentExchangeActionResponse() { return contentDevelopmentExchangeActionResponse; } public void setContentDevelopmentExchangeActionResponse(String contentDevelopmentExchangeActionResponse) { this.contentDevelopmentExchangeActionResponse = contentDevelopmentExchangeActionResponse; } /** * `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Text general-info: The status of the Content Development instance (e.g. accepted, rejected, verified) * @return contentDevelopmentInstanceStatus **/ public String getContentDevelopmentInstanceStatus() { return contentDevelopmentInstanceStatus; } public void setContentDevelopmentInstanceStatus(String contentDevelopmentInstanceStatus) { this.contentDevelopmentInstanceStatus = contentDevelopmentInstanceStatus; } }
[ "spabandara@Virtusa.com" ]
spabandara@Virtusa.com
207147b5d1a78725c912f3b0ec7384e24edbe688
d3ef627915e73f420cbbba61691fe6b9d5115ed8
/TPO_Local_Servidor/src/entities/Remito.java
b1143a9bc77143700d90744169a44cc003e144ea
[]
no_license
fmart318/TPO_Servidor
1629b9e334eeba5dff329a3dffe0c67a2eca8082
16a61e94062b8e274dec7168d0c5c61c78cca647
refs/heads/master
2020-07-14T10:31:28.688469
2016-12-03T23:52:26
2016-12-03T23:52:26
73,876,393
0
0
null
2016-12-05T00:18:42
2016-11-16T02:38:24
Java
UTF-8
Java
false
false
1,047
java
package entities; import hbt.PersistentObject; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OneToOne; import javax.persistence.Table; import dto.RemitoDTO; @Entity @Table(name = "Remitos") public class Remito extends PersistentObject { private static final long serialVersionUID = 1L; @Id @GeneratedValue @Column(nullable = false) private int idRemito; @OneToOne @JoinColumn(name = "idPedido") private Pedido pedido; public Remito() { } public Remito(int idRemito, Pedido pedido) { super(); this.idRemito = idRemito; this.pedido = pedido; } public int getIdRemito() { return idRemito; } public void setIdRemito(int idRemito) { this.idRemito = idRemito; } public Pedido getPedido() { return pedido; } public void setPedido(Pedido pedido) { this.pedido = pedido; } public RemitoDTO toDTO() { return new RemitoDTO(idRemito, pedido.toDTO()); } }
[ "Felipe@192.168.0.104" ]
Felipe@192.168.0.104
6894a97d87c9f7645a83ba5eea7161a0ed2edd81
063630fb9fd905883775c2c3e67b95b8c61bb282
/core/src/main/java/com/justyoyo/contrast/common/CharacterSetECI.java
9d45d283bbb3effefaa47206e4ef58b178e7c97d
[ "Apache-2.0" ]
permissive
justyoyo/Contrast
807c4f5dff8ac5982c4ed87e55866c7b0c5f203f
59bf6da5ddce73edb09349dfe034b8167fda831c
refs/heads/master
2021-10-26T01:30:27.048725
2016-11-09T16:12:56
2016-11-09T16:12:56
16,801,813
14
1
null
2016-11-09T16:12:57
2014-02-13T12:13:59
Java
UTF-8
Java
false
false
3,503
java
/* * Copyright 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.justyoyo.contrast.common; import com.justyoyo.contrast.FormatException; import java.util.HashMap; import java.util.Map; /** * Encapsulates a Character Set ECI, according to "Extended Channel Interpretations" 5.3.1.1 * of ISO 18004. * * @author Sean Owen */ public enum CharacterSetECI { // Enum name is a Java encoding valid for java.lang and java.io Cp437(new int[]{0,2}), ISO8859_1(new int[]{1,3}, "ISO-8859-1"), ISO8859_2(4, "ISO-8859-2"), ISO8859_3(5, "ISO-8859-3"), ISO8859_4(6, "ISO-8859-4"), ISO8859_5(7, "ISO-8859-5"), ISO8859_6(8, "ISO-8859-6"), ISO8859_7(9, "ISO-8859-7"), ISO8859_8(10, "ISO-8859-8"), ISO8859_9(11, "ISO-8859-9"), ISO8859_10(12, "ISO-8859-10"), ISO8859_11(13, "ISO-8859-11"), ISO8859_13(15, "ISO-8859-13"), ISO8859_14(16, "ISO-8859-14"), ISO8859_15(17, "ISO-8859-15"), ISO8859_16(18, "ISO-8859-16"), SJIS(20, "Shift_JIS"), Cp1250(21, "windows-1250"), Cp1251(22, "windows-1251"), Cp1252(23, "windows-1252"), Cp1256(24, "windows-1256"), UnicodeBigUnmarked(25, "UTF-16BE", "UnicodeBig"), UTF8(26, "UTF-8"), ASCII(new int[] {27, 170}, "US-ASCII"), Big5(28), GB18030(29, "GB2312", "EUC_CN", "GBK"), EUC_KR(30, "EUC-KR"); private static final Map<Integer,CharacterSetECI> VALUE_TO_ECI = new HashMap<>(); private static final Map<String,CharacterSetECI> NAME_TO_ECI = new HashMap<>(); static { for (CharacterSetECI eci : values()) { for (int value : eci.values) { VALUE_TO_ECI.put(value, eci); } NAME_TO_ECI.put(eci.name(), eci); for (String name : eci.otherEncodingNames) { NAME_TO_ECI.put(name, eci); } } } private final int[] values; private final String[] otherEncodingNames; CharacterSetECI(int value) { this(new int[] {value}); } CharacterSetECI(int value, String... otherEncodingNames) { this.values = new int[] {value}; this.otherEncodingNames = otherEncodingNames; } CharacterSetECI(int[] values, String... otherEncodingNames) { this.values = values; this.otherEncodingNames = otherEncodingNames; } public int getValue() { return values[0]; } /** * @param value character set ECI value * @return CharacterSetECI representing ECI of given value, or null if it is legal but * unsupported * @throws IllegalArgumentException if ECI value is invalid */ public static CharacterSetECI getCharacterSetECIByValue(int value) throws FormatException { if (value < 0 || value >= 900) { throw FormatException.getFormatInstance(); } return VALUE_TO_ECI.get(value); } /** * @param name character set ECI encoding name * @return CharacterSetECI representing ECI for character encoding, or null if it is legal * but unsupported */ public static CharacterSetECI getCharacterSetECIByName(String name) { return NAME_TO_ECI.get(name); } }
[ "chris.mark.jenkins@gmail.com" ]
chris.mark.jenkins@gmail.com
aa6bd894eee1b4732be5aa09f53de8d48a09e15c
24b9497cf60713d73d02bc8c9b2ffcbc08fd46e7
/src/main/java/com/anbang/qipai/dianpaomajiang/cqrs/c/domain/listener/DianpaoMajiangPengGangActionStatisticsListener.java
d84286241997a407882ce590346c989120b3cc8f
[]
no_license
hangzhouanbang/qipai_dianpaomajiang
3c92d6d093b0f8f01ae4b7a6de49e29ff127f3b3
ff940a2f7d6c9a2c483e2452d2213f537d0403e7
refs/heads/master
2020-04-04T22:52:49.343190
2019-05-06T08:32:53
2019-05-06T08:32:53
156,339,149
0
0
null
null
null
null
UTF-8
Java
false
false
5,919
java
package com.anbang.qipai.dianpaomajiang.cqrs.c.domain.listener; import java.util.HashMap; import java.util.Map; import com.dml.majiang.ju.Ju; import com.dml.majiang.pai.fenzu.GangType; import com.dml.majiang.pan.Pan; import com.dml.majiang.player.MajiangPlayer; import com.dml.majiang.player.action.MajiangPlayerAction; import com.dml.majiang.player.action.MajiangPlayerActionType; import com.dml.majiang.player.action.gang.MajiangGangAction; import com.dml.majiang.player.action.listener.gang.MajiangPlayerGangActionStatisticsListener; import com.dml.majiang.player.action.listener.peng.MajiangPlayerPengActionStatisticsListener; import com.dml.majiang.player.action.peng.MajiangPengAction; import com.dml.majiang.position.MajiangPosition; /** * 放炮麻将统计器,包括玩家放杠统计,总杠数 * * @author lsc * */ public class DianpaoMajiangPengGangActionStatisticsListener implements MajiangPlayerPengActionStatisticsListener, MajiangPlayerGangActionStatisticsListener { private Map<String, MajiangPlayerAction> playerActionMap = new HashMap<>(); private Map<String, Integer> playerIdFangGangShuMap = new HashMap<>(); private int tongpeiCount = 0; @Override public void updateForNextPan() { playerActionMap = new HashMap<>(); playerIdFangGangShuMap = new HashMap<>(); tongpeiCount = 0; } // 清空当前轮动作 public void updateForNextLun() { playerActionMap.clear(); } @Override public void update(MajiangGangAction gangAction, Ju ju) { Pan currentPan = ju.getCurrentPan(); MajiangPlayer player = currentPan.findPlayerById(gangAction.getActionPlayerId()); if (gangAction.isDisabledByHigherPriorityAction()) {// 如果被阻塞 playerActionMap.put(player.getId(), gangAction);// 记录下被阻塞的动作 } else { if (gangAction.getGangType().equals(GangType.gangdachu)) { String dachupaiPlayerId = gangAction.getDachupaiPlayerId(); if (playerIdFangGangShuMap.containsKey(dachupaiPlayerId)) { Integer count = playerIdFangGangShuMap.get(dachupaiPlayerId) + 1; playerIdFangGangShuMap.put(dachupaiPlayerId, count); } else { playerIdFangGangShuMap.put(dachupaiPlayerId, 1); } MajiangPlayer dachupaiPlayer = currentPan.findPlayerById(gangAction.getDachupaiPlayerId()); MajiangPlayer zhuangPlayer = currentPan.findPlayerByMenFeng(MajiangPosition.dong); MajiangPlayer shangjia = currentPan.findShangjia(zhuangPlayer); MajiangPlayer xiajia = currentPan.findXiajia(zhuangPlayer); // 如果上家杠庄家或者下家,通赔计数加2 if (shangjia.getId().equals(player.getId()) && (zhuangPlayer.getId().equals(dachupaiPlayer.getId()) || xiajia.getId().equals(dachupaiPlayer.getId()))) { tongpeiCount += 2; } } else if (gangAction.getGangType().equals(GangType.kezigangshoupai)) { String dachupaiPlayerId = gangAction.getDachupaiPlayerId(); if (dachupaiPlayerId != null) { if (playerIdFangGangShuMap.containsKey(dachupaiPlayerId)) { Integer count = playerIdFangGangShuMap.get(dachupaiPlayerId) + 1; playerIdFangGangShuMap.put(dachupaiPlayerId, count); } else { playerIdFangGangShuMap.put(dachupaiPlayerId, 1); } MajiangPlayer dachupaiPlayer = currentPan.findPlayerById(gangAction.getDachupaiPlayerId()); MajiangPlayer zhuangPlayer = currentPan.findPlayerByMenFeng(MajiangPosition.dong); MajiangPlayer shangjia = currentPan.findShangjia(zhuangPlayer); MajiangPlayer xiajia = currentPan.findXiajia(zhuangPlayer); // 如果上家杠庄家或者下家,通赔计数加2 if (shangjia.getId().equals(player.getId()) && (zhuangPlayer.getId().equals(dachupaiPlayer.getId()) || xiajia.getId().equals(dachupaiPlayer.getId()))) { tongpeiCount += 2; } } } } } @Override public void update(MajiangPengAction pengAction, Ju ju) { Pan currentPan = ju.getCurrentPan(); MajiangPlayer player = currentPan.findPlayerById(pengAction.getActionPlayerId()); if (pengAction.isDisabledByHigherPriorityAction()) {// 如果被阻塞 playerActionMap.put(player.getId(), pengAction);// 记录下被阻塞的动作 } else { MajiangPlayer dachupaiPlayer = currentPan.findPlayerById(pengAction.getDachupaiPlayerId()); MajiangPlayer zhuangPlayer = currentPan.findPlayerByMenFeng(MajiangPosition.dong); MajiangPlayer shangjia = currentPan.findShangjia(zhuangPlayer); MajiangPlayer xiajia = currentPan.findXiajia(zhuangPlayer); // 如果上家碰庄家或者下家,通赔计数加1 if (shangjia.getId().equals(player.getId()) && (zhuangPlayer.getId().equals(dachupaiPlayer.getId()) || xiajia.getId().equals(dachupaiPlayer.getId()))) { tongpeiCount += 1; } } } public MajiangPlayerAction findPlayerFinallyDoneAction() { if (playerActionMap.isEmpty()) { return null; } for (MajiangPlayerAction action : playerActionMap.values()) { if (action.getType().equals(MajiangPlayerActionType.gang)) { return action; } } for (MajiangPlayerAction action : playerActionMap.values()) { if (action.getType().equals(MajiangPlayerActionType.peng)) { return action; } } return null; } public Map<String, MajiangPlayerAction> getPlayerActionMap() { return playerActionMap; } public void setPlayerActionMap(Map<String, MajiangPlayerAction> playerActionMap) { this.playerActionMap = playerActionMap; } public Map<String, Integer> getPlayerIdFangGangShuMap() { return playerIdFangGangShuMap; } public void setPlayerIdFangGangShuMap(Map<String, Integer> playerIdFangGangShuMap) { this.playerIdFangGangShuMap = playerIdFangGangShuMap; } public int getTongpeiCount() { return tongpeiCount; } public void setTongpeiCount(int tongpeiCount) { this.tongpeiCount = tongpeiCount; } }
[ "林少聪 @PC-20180515PRDG" ]
林少聪 @PC-20180515PRDG
defa04a4a59d4f41858e8e0b3e7daa1a419f740a
827030803119007ac05f08ca385bfcdf9d204821
/src/main/java/com/oliveira/pedidovenda/util/jpa/EntityManagerProducer.java
89d2ffc5539aa18cdb9038e3296d83b9488e556c
[ "Apache-2.0" ]
permissive
AdrianodeOS/pedido-venda
e64945996d7080a4272545e24d41aeac7108e4e3
7df89e3a4e63e2e60e4c062aa08ec3660667307e
refs/heads/master
2021-01-22T06:12:07.762440
2017-03-09T14:13:18
2017-03-09T14:13:18
81,745,039
0
0
null
null
null
null
UTF-8
Java
false
false
912
java
package com.oliveira.pedidovenda.util.jpa; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.context.RequestScoped; import javax.enterprise.inject.Disposes; import javax.enterprise.inject.Produces; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; /** * * @author Adriano de Oliveira */ @ApplicationScoped public class EntityManagerProducer { private final EntityManagerFactory factory; public EntityManagerProducer() { factory = Persistence.createEntityManagerFactory("PedidoPU"/*, PersistenceProperties.get()*/); } @Produces @RequestScoped public EntityManager createEntityManager() { return factory.createEntityManager(); } public void closeEntityManager(@Disposes EntityManager manager) { manager.close(); } }
[ "adrianoosyeshua@gmail.com" ]
adrianoosyeshua@gmail.com
7013c8ce51f5fb272ad488eb979f76f5dce26cdd
d8b3a25c0baeb84fa7c767d961321c0007b0dcf0
/app/src/main/java/com/example/user/lifesaver/MainActivity.java
92a7b7074eb293ac9f7f645ddcdcfa39997be6dd
[]
no_license
ManuelNemirovsky/LifeSaver
d3f05f2df9c130c3a55b6efc339ab049df615c3c
71a28fd4638848670f5d6c1f2cdc6d30d9f002b0
refs/heads/master
2020-07-28T14:41:47.968212
2016-08-26T12:06:26
2016-08-26T12:06:26
66,077,045
0
0
null
null
null
null
UTF-8
Java
false
false
1,088
java
package com.example.user.lifesaver; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.Button; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button btnSignUp = (Button)findViewById(R.id.btnSignUp); Button btnPatient = (Button)findViewById(R.id.btnSignIn); btnSignUp.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(MainActivity.this, signUp.class)); } }); btnPatient.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(MainActivity.this , Gender.class)); } }); } }
[ "manuel.nemirovsky@gmail.com" ]
manuel.nemirovsky@gmail.com
acc4eda9afe8a18b69f12800f6b5e4fcb8a92bda
ca0ee12fba28d013d4f5de68e2561736b12c1e9d
/src/main/java/com/whc/chapter4/Internationaliztion/TestResourceBoundle01.java
dfbff157df70f1d6d44050d7654114722e86a25d
[]
no_license
northcastle/SpringProject01
4cdf254331a2bed94d0eb3932c95cf2657aa9348
e063de481b3ec0220ff159a63c89e0783ecd820f
refs/heads/master
2022-12-23T15:34:57.122436
2019-09-28T09:58:25
2019-09-28T09:58:25
200,262,278
0
0
null
2022-12-16T04:50:32
2019-08-02T15:58:52
Java
UTF-8
Java
false
false
1,932
java
package com.whc.chapter4.Internationaliztion; import org.junit.Test; import java.util.Enumeration; import java.util.Locale; import java.util.ResourceBundle; /** * author : whc * createTime:2019/8/25 20:00 */ public class TestResourceBoundle01 { /** * 01 测试 中文的配置文件 */ @Test public void testZH(){ /** * 注意事项 : * 读取的文件的路径 ,不能带有 .properties 后缀名 * 写相对路径就可以 */ ResourceBundle bundle_zh = ResourceBundle.getBundle("springChapter4/i18n/db_zh", Locale.CHINA); //1. 可以获取所有的 键 Enumeration<String> keys = bundle_zh.getKeys(); while (keys.hasMoreElements()){ String s = keys.nextElement(); System.out.println("-->"+s+"<--"); } System.out.println("=========================="); //2. 我想读取值 System.out.println(bundle_zh.getString("username")); System.out.println(bundle_zh.getString("password")); System.out.println(bundle_zh.getString("classname")); } /** * 02 测试英文的 配置文件 */ @Test public void TestEN(){ ResourceBundle bundle_en = ResourceBundle.getBundle("springChapter4/i18n/db_en"); System.out.println(bundle_en.getString("username")); System.out.println(bundle_en.getString("password")); System.out.println(bundle_en.getString("classname")); } /** * 03 测试默认的配置文件 */ @Test public void TestDefault(){ ResourceBundle bundle_en = ResourceBundle.getBundle("springChapter4/i18n/default"); System.out.println(bundle_en.getString("username")); System.out.println(bundle_en.getString("password")); System.out.println(bundle_en.getString("classname")); } }
[ "975887168@qq.com" ]
975887168@qq.com
8f0bf500d7c9c41993d9f1ac16b843cdf304b99e
77749224b27fa344ecf6fb29174c99791fb6af36
/src/com/implementation/TheImplementation.java
9c81c95c0ea2e904750691ba4cdc2598ec9f6dab
[]
no_license
Saranikanth/CIS-RMI-Project
167bb2245cb39503c72c7e7cca84ec27fb96f08e
b311c31d245d96731f5c790cf36e06ea38280684
refs/heads/master
2023-06-19T20:00:43.348010
2021-07-07T18:19:07
2021-07-07T18:19:07
345,159,312
0
0
null
null
null
null
UTF-8
Java
false
false
41,646
java
package com.implementation; import com.Interface.Database; import com.Interface.TheInterface; import com.rmi.server.*; import java.awt.Color; import java.awt.image.BufferedImage; import java.io.IOException; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; /** * This class contains the server side methods that will be used by the server * * @author T.Saranikanth - 2023016 */ public class TheImplementation extends UnicastRemoteObject implements TheInterface { public TheImplementation() throws RemoteException { super(); database.Connect(); } boolean Sign_up, Sign_in, questionAdd, questionUpdate, questionDelete; /*** * This is the instance for database class */ Database database=new Database(); /*** * This method used to perform the SignUp * @param username * @param password * @return Sign_up * @throws RemoteException * @exception SQLException */ public boolean Sign_up(String username, String password) throws RemoteException { try { String sql = "INSERT INTO admin(username,password) VALUES (?,?)"; database.pst = database.con.prepareStatement(sql); database.pst.setString(1, username); database.pst.setString(2, password); database.pst.executeUpdate(); Sign_up = true; } catch (SQLException ex) { Sign_up = false; } return Sign_up; } /*** * This method used to perform the SignIn * @param username * @param password * @return Sign_in * @throws RemoteException * @exception SQLException */ public boolean Sign_in(String username, String password) throws RemoteException { try { String sql1 = "select * from admin where username = ? and password = ?"; database.pst = database.con.prepareStatement(sql1); database.pst.setString(1, username); database.pst.setString(2, password); database.rst = database.pst.executeQuery(); if (database.rst.next()) { Sign_in = true; } else { Sign_in = false; } } catch (SQLException ex) { ex.printStackTrace(); } return Sign_in; } /*** * This method used to perform the questionAdd * @param qid * @param question * @param option1 * @param option2 * @param option3 * @return questionAdd * @throws RemoteException * @exception SQLException */ public boolean questionAdd(String qid, String question, String option1, String option2, String option3) throws RemoteException { try { String sql1 = "INSERT INTO questionnaire(qid,question,option1,option2,option3) VALUES (?,?,?,?,?)"; database.pst = database.con.prepareStatement(sql1); database.pst.setString(1, qid); database.pst.setString(2, question); database.pst.setString(3, option1); database.pst.setString(4, option2); database.pst.setString(5, option3); database.pst.executeUpdate(); questionAdd = true; } catch (SQLException ex) { questionAdd = false; ex.printStackTrace(); } return questionAdd; } /*** * This method used to perform the questionUpdate * @param qno * @param question * @param opt1 * @param opt2 * @param opt3 * @returnquestionUpdate * @throws RemoteException * @exception SQLException */ public boolean questionUpdate(String qno, String question, String opt1, String opt2, String opt3) throws RemoteException { try { String sql = "UPDATE questionnaire SET question=?,option1=?,option2=?,option3=? WHERE qid=?"; database.pst = database.con.prepareStatement(sql); database.pst.setString(1, question); database.pst.setString(2, opt1); database.pst.setString(3, opt2); database.pst.setString(4, opt3); database.pst.setString(5, qno); database.pst.executeUpdate(); questionUpdate = true; } catch (SQLException ex) { questionUpdate = false; } return questionUpdate; } /*** * This method used to perform the questionDelete * @param qno * @return questionDelete * @throws RemoteException * @exception SQLException */ public boolean questionDelete(String qno) throws RemoteException { try { String sql = "DELETE FROM questionnaire WHERE qid=?"; database.pst = database.con.prepareStatement(sql); database.pst.setString(1, qno); database.pst.executeUpdate(); questionDelete = true; } catch (SQLException ex) { questionDelete = false; } return questionDelete; } /*** * These methods used to perform chart analysis by using a web API called QUICKCHART.IO * These functions needs Internet connection * * NOTE - This method will apply for all the 10 Questions * @throws RemoteException */ public void Question1_Analyse() throws RemoteException{ try { String Advertisements = "", Word_by_mouth = "", Social_media = "", link = ""; BufferedImage image = null; String sql1 = "SELECT COUNT(user_id) FROM answers WHERE question_id=1 and answer=\"Advertisements\" "; try { database.pst = database.con.prepareStatement(sql1); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { Advertisements = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } String sql2 = "SELECT COUNT(user_id) FROM answers WHERE question_id=1 and answer=\"Word by mouth\" "; try { database.pst = database.con.prepareStatement(sql2); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { Word_by_mouth = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } String sql3 = "SELECT COUNT(user_id) FROM answers WHERE question_id=1 and answer=\"Social media\" "; try { database.pst = database.con.prepareStatement(sql3); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { Social_media = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } try { link = "https://quickchart.io/chart?bkg=white&c={ type: 'pie',data: { datasets: [ { data: [\'" + Advertisements + "\',\'" + Word_by_mouth + "\',\'" + Social_media + "\',], backgroundColor: [ 'rgb(204, 0, 0)', 'rgb(204, 204, 0)', 'rgb(0,204,204)' ], label: 'How-did-you-heard-about-our-KPT-restaurant-before?', }, ], labels: ['Advertisement', 'Word-By-Mouth','Social-Media'],},}"; link = link.replace(" ", ""); URL url1 = new URL(link); HttpURLConnection urlcon = (HttpURLConnection) url1.openConnection(); urlcon.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11"); image = ImageIO.read(urlcon.getInputStream()); JFrame frame = new JFrame(); frame.setForeground(new Color(153, 255, 255)); frame.setTitle("How did you heard about our KPT restaurant before?"); frame.setResizable(false); frame.setBackground(new Color(153, 255, 255)); frame.setSize(1000, 800); JLabel label = new JLabel(new ImageIcon(image)); frame.getContentPane().add(label); frame.setVisible(true); frame.setLocationRelativeTo(null); } catch (MalformedURLException e1) { e1.printStackTrace(); } catch (IOException e1) { JOptionPane.showMessageDialog(null, "Not Internet Connection", "ALERT", JOptionPane.WARNING_MESSAGE); e1.printStackTrace(); } } catch (Exception e) { JOptionPane.showMessageDialog(null, "Error..."); e.printStackTrace(); } } public void Question2_Analyse() throws RemoteException{ try { String Yes = "", No = "", Not_prefered_to_say = "", link = ""; BufferedImage image = null; String sql1 = "SELECT COUNT(user_id) FROM answers WHERE question_id=2 and answer=\"Yes\" "; try { database.pst = database.con.prepareStatement(sql1); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { Yes = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } String sql2 = "SELECT COUNT(user_id) FROM answers WHERE question_id=2 and answer=\"No\" "; try { database.pst = database.con.prepareStatement(sql2); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { No = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } String sql3 = "SELECT COUNT(user_id) FROM answers WHERE question_id=2 and answer=\"Not prefered to say\" "; try { database.pst = database.con.prepareStatement(sql3); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { Not_prefered_to_say = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } try { link = "https://quickchart.io/chart?bkg=white&c={ type: 'bar',data: { datasets: [ { data: [\'" + Yes + "\',\'" + No + "\',\'" + Not_prefered_to_say + "\',], backgroundColor: [ 'rgb(204, 0, 0)', 'rgb(204, 204, 0)', 'rgb(0,204,204)' ], label: 'Is-this-your-first-order?', }, ], labels: ['Yes', 'No','Not-Prefered-To-Say'],},}"; link = link.replace(" ", ""); URL url1 = new URL(link); HttpURLConnection urlcon = (HttpURLConnection) url1.openConnection(); urlcon.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11"); image = ImageIO.read(urlcon.getInputStream()); JFrame frame = new JFrame(); frame.setForeground(new Color(153, 255, 255)); frame.setTitle("Is this your first order?"); frame.setResizable(false); frame.setBackground(new Color(153, 255, 255)); frame.setSize(1000, 800); JLabel label = new JLabel(new ImageIcon(image)); frame.getContentPane().add(label); frame.setVisible(true); frame.setLocationRelativeTo(null); } catch (MalformedURLException e1) { e1.printStackTrace(); } catch (IOException e1) { JOptionPane.showMessageDialog(null, "Not Internet Connection", "ALERT", JOptionPane.WARNING_MESSAGE); e1.printStackTrace(); } } catch (Exception e) { JOptionPane.showMessageDialog(null, "Error..."); e.printStackTrace(); } } public void Question3_Analyse() throws RemoteException{ try { String Vegetarian = "", Non_vegetarian = "", Vegan = "", link = ""; BufferedImage image = null; String sql1 = "SELECT COUNT(user_id) FROM answers WHERE question_id=3 and answer=\"Vegetarian\" "; try { database.pst = database.con.prepareStatement(sql1); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { Vegetarian = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } String sql2 = "SELECT COUNT(user_id) FROM answers WHERE question_id=3 and answer=\"Non-vegetarian\" "; try { database.pst = database.con.prepareStatement(sql2); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { Non_vegetarian = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } String sql3 = "SELECT COUNT(user_id) FROM answers WHERE question_id=3 and answer=\"Vegan\" "; try { database.pst = database.con.prepareStatement(sql3); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { Vegan = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } try { link = "https://quickchart.io/chart?bkg=white&c={ type: 'pie',data: { datasets: [ { data: [\'" + Vegetarian + "\',\'" + Non_vegetarian + "\',\'" + Vegan + "\',], backgroundColor: [ 'rgb(204, 0, 0)', 'rgb(204, 204, 0)', 'rgb(0,204,204)' ], label: 'What-is-your-preference-on-food?', }, ], labels: ['Vegetarian', 'Non-Vegetarian','Vegan'],},}"; link = link.replace(" ", ""); URL url1 = new URL(link); HttpURLConnection urlcon = (HttpURLConnection) url1.openConnection(); urlcon.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11"); image = ImageIO.read(urlcon.getInputStream()); JFrame frame = new JFrame(); frame.setForeground(new Color(153, 255, 255)); frame.setTitle("What is your preference on food?"); frame.setResizable(false); frame.setBackground(new Color(153, 255, 255)); frame.setSize(900, 900); JLabel label = new JLabel(new ImageIcon(image)); frame.getContentPane().add(label); frame.setVisible(true); frame.setLocationRelativeTo(null); } catch (MalformedURLException e1) { e1.printStackTrace(); } catch (IOException e1) { JOptionPane.showMessageDialog(null, "Not Internet Connection", "ALERT", JOptionPane.WARNING_MESSAGE); e1.printStackTrace(); } } catch (Exception e) { JOptionPane.showMessageDialog(null, "Error..."); e.printStackTrace(); } } public void Question4_Analyse() throws RemoteException{ try { String Indian = "", European = "", Chinese = "", link = ""; BufferedImage image = null; String sql1 = "SELECT COUNT(user_id) FROM answers WHERE question_id=4 and answer=\"Indian\" "; try { database.pst = database.con.prepareStatement(sql1); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { Indian = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } String sql2 = "SELECT COUNT(user_id) FROM answers WHERE question_id=4 and answer=\"European\" "; try { database.pst = database.con.prepareStatement(sql2); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { European = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } String sql3 = "SELECT COUNT(user_id) FROM answers WHERE question_id=4 and answer=\"Chinese\" "; try { database.pst = database.con.prepareStatement(sql3); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { Chinese = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } try { link = "https://quickchart.io/chart?bkg=white&c={ type: 'bar',data: { datasets: [ { data: [\'" + Indian + "\',\'" + European + "\',\'" + Chinese + "\',], backgroundColor: [ 'rgb(204, 0, 0)', 'rgb(204, 204, 0)', 'rgb(0,204,204)' ], label: 'What-type-of-cuisine-you-prefer?', }, ], labels: ['Indian', 'European','Chinese'],},}"; link = link.replace(" ", ""); URL url1 = new URL(link); HttpURLConnection urlcon = (HttpURLConnection) url1.openConnection(); urlcon.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11"); image = ImageIO.read(urlcon.getInputStream()); JFrame frame = new JFrame(); frame.setForeground(new Color(153, 255, 255)); frame.setTitle("What type of cuisine you prefer?"); frame.setResizable(false); frame.setBackground(new Color(153, 255, 255)); frame.setSize(1000, 800); JLabel label = new JLabel(new ImageIcon(image)); frame.getContentPane().add(label); frame.setVisible(true); frame.setLocationRelativeTo(null); } catch (MalformedURLException e1) { e1.printStackTrace(); } catch (IOException e1) { JOptionPane.showMessageDialog(null, "Not Internet Connection", "ALERT", JOptionPane.WARNING_MESSAGE); e1.printStackTrace(); } } catch (Exception e) { JOptionPane.showMessageDialog(null, "Error..."); e.printStackTrace(); } } public void Question5_Analyse() throws RemoteException{ try { String Kids_meal = "", Normal_meal = "", Jumbo_meal = "", link = ""; BufferedImage image = null; String sql1 = "SELECT COUNT(user_id) FROM answers WHERE question_id=5 and answer=\"Kids meal\" "; try { database.pst = database.con.prepareStatement(sql1); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { Kids_meal = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } String sql2 = "SELECT COUNT(user_id) FROM answers WHERE question_id=5 and answer=\"Normal meal\" "; try { database.pst = database.con.prepareStatement(sql2); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { Normal_meal = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } String sql3 = "SELECT COUNT(user_id) FROM answers WHERE question_id=5 and answer=\"Jumbo meal\" "; try { database.pst = database.con.prepareStatement(sql3); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { Jumbo_meal = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } try { link = "https://quickchart.io/chart?bkg=white&c={ type: 'pie',data: { datasets: [ { data: [\'" + Kids_meal + "\',\'" + Normal_meal + "\',\'" + Jumbo_meal + "\',], backgroundColor: [ 'rgb(204, 0, 0)', 'rgb(204, 204, 0)', 'rgb(0,204,204)' ], label: 'What-type-of-meal-you-prefer-according-to-capacity?', }, ], labels: ['Kids-Meal', 'Normal-Meal','Jumbo-Meal'],},}"; link = link.replace(" ", ""); URL url1 = new URL(link); HttpURLConnection urlcon = (HttpURLConnection) url1.openConnection(); urlcon.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11"); image = ImageIO.read(urlcon.getInputStream()); JFrame frame = new JFrame(); frame.setForeground(new Color(153, 255, 255)); frame.setTitle("What type of meal you prefer according to capacity?"); frame.setResizable(false); frame.setBackground(new Color(153, 255, 255)); frame.setSize(900, 900); JLabel label = new JLabel(new ImageIcon(image)); frame.getContentPane().add(label); frame.setVisible(true); frame.setLocationRelativeTo(null); } catch (MalformedURLException e1) { e1.printStackTrace(); } catch (IOException e1) { JOptionPane.showMessageDialog(null, "Not Internet Connection", "ALERT", JOptionPane.WARNING_MESSAGE); e1.printStackTrace(); } } catch (Exception e) { JOptionPane.showMessageDialog(null, "Error..."); e.printStackTrace(); } } public void Question6_Analyse() throws RemoteException{ try { String Normal = "", Moderate = "", Salt_free = "", link = ""; BufferedImage image = null; String sql1 = "SELECT COUNT(user_id) FROM answers WHERE question_id=6 and answer=\"Normal\" "; try { database.pst = database.con.prepareStatement(sql1); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { Normal = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } String sql2 = "SELECT COUNT(user_id) FROM answers WHERE question_id=6 and answer=\"Moderate\" "; try { database.pst = database.con.prepareStatement(sql2); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { Moderate = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } String sql3 = "SELECT COUNT(user_id) FROM answers WHERE question_id=6 and answer=\"Salt free\" "; try { database.pst = database.con.prepareStatement(sql3); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { Salt_free = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } try { link = "https://quickchart.io/chart?bkg=white&c={ type: 'bar',data: { datasets: [ { data: [\'" + Normal + "\',\'" + Moderate + "\',\'" + Salt_free + "\',], backgroundColor: [ 'rgb(204, 0, 0)', 'rgb(204, 204, 0)', 'rgb(0,204,204)' ], label: 'What-is-your-preference-in-salt?', }, ], labels: ['Normal', 'Moderate','Salt-Free'],},}"; link = link.replace(" ", ""); URL url1 = new URL(link); HttpURLConnection urlcon = (HttpURLConnection) url1.openConnection(); urlcon.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11"); image = ImageIO.read(urlcon.getInputStream()); JFrame frame = new JFrame(); frame.setForeground(new Color(153, 255, 255)); frame.setTitle("What is your preference in salt?"); frame.setResizable(false); frame.setBackground(new Color(153, 255, 255)); frame.setSize(1000, 800); JLabel label = new JLabel(new ImageIcon(image)); frame.getContentPane().add(label); frame.setVisible(true); frame.setLocationRelativeTo(null); } catch (MalformedURLException e1) { e1.printStackTrace(); } catch (IOException e1) { JOptionPane.showMessageDialog(null, "Not Internet Connection", "ALERT", JOptionPane.WARNING_MESSAGE); e1.printStackTrace(); } } catch (Exception e) { JOptionPane.showMessageDialog(null, "Error..."); e.printStackTrace(); } } public void Question7_Analyse() throws RemoteException{ try { String Spicy = "", Moderate = "", Low = "", link = ""; BufferedImage image = null; String sql1 = "SELECT COUNT(user_id) FROM answers WHERE question_id=7 and answer=\"Spicy\" "; try { database.pst = database.con.prepareStatement(sql1); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { Spicy = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } String sql2 = "SELECT COUNT(user_id) FROM answers WHERE question_id=7 and answer=\"Moderate\" "; try { database.pst = database.con.prepareStatement(sql2); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { Moderate = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } String sql3 = "SELECT COUNT(user_id) FROM answers WHERE question_id=7 and answer=\"Low\" "; try { database.pst = database.con.prepareStatement(sql3); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { Low = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } try { link = "https://quickchart.io/chart?bkg=white&c={ type: 'pie',data: { datasets: [ { data: [\'" + Spicy + "\',\'" + Moderate + "\',\'" + Low + "\',], backgroundColor: [ 'rgb(204, 0, 0)', 'rgb(204, 204, 0)', 'rgb(0,204,204)' ], label: 'What-is-your-spicy-tolerance-level?', }, ], labels: ['Spicy', 'Moderate','Low'],},}"; link = link.replace(" ", ""); URL url1 = new URL(link); HttpURLConnection urlcon = (HttpURLConnection) url1.openConnection(); urlcon.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11"); image = ImageIO.read(urlcon.getInputStream()); JFrame frame = new JFrame(); frame.setForeground(new Color(153, 255, 255)); frame.setTitle("What is your spicy tolerance level?"); frame.setResizable(false); frame.setBackground(new Color(153, 255, 255)); frame.setSize(900, 900); JLabel label = new JLabel(new ImageIcon(image)); frame.getContentPane().add(label); frame.setVisible(true); frame.setLocationRelativeTo(null); } catch (MalformedURLException e1) { e1.printStackTrace(); } catch (IOException e1) { JOptionPane.showMessageDialog(null, "Not Internet Connection", "ALERT", JOptionPane.WARNING_MESSAGE); e1.printStackTrace(); } } catch (Exception e) { JOptionPane.showMessageDialog(null, "Error..."); e.printStackTrace(); } } public void Question8_Analyse() throws RemoteException{ try { String Natural_juices = "", Carbonated_drinks = "", Hot_drinks = "", link = ""; BufferedImage image = null; String sql1 = "SELECT COUNT(user_id) FROM answers WHERE question_id=8 and answer=\"Natural juices\" "; try { database.pst = database.con.prepareStatement(sql1); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { Natural_juices = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } String sql2 = "SELECT COUNT(user_id) FROM answers WHERE question_id=8 and answer=\"Carbonated drinks\" "; try { database.pst = database.con.prepareStatement(sql2); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { Carbonated_drinks = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } String sql3 = "SELECT COUNT(user_id) FROM answers WHERE question_id=8 and answer=\"Hot drinks\" "; try { database.pst = database.con.prepareStatement(sql3); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { Hot_drinks = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } try { link = "https://quickchart.io/chart?bkg=white&c={ type: 'bar',data: { datasets: [ { data: [\'" + Natural_juices + "\',\'" + Carbonated_drinks + "\',\'" + Hot_drinks + "\',], backgroundColor: [ 'rgb(204, 0, 0)', 'rgb(204, 204, 0)', 'rgb(0,204,204)' ], label: 'What-do-you prefer-to-drinks?', }, ], labels: ['Natural-juices', 'Carbonated-drinks','Hot-drinks'],},}"; link = link.replace(" ", ""); URL url1 = new URL(link); HttpURLConnection urlcon = (HttpURLConnection) url1.openConnection(); urlcon.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11"); image = ImageIO.read(urlcon.getInputStream()); JFrame frame = new JFrame(); frame.setForeground(new Color(153, 255, 255)); frame.setTitle("What do you prefer to drinks?"); frame.setResizable(false); frame.setBackground(new Color(153, 255, 255)); frame.setSize(1000, 800); JLabel label = new JLabel(new ImageIcon(image)); frame.getContentPane().add(label); frame.setVisible(true); frame.setLocationRelativeTo(null); } catch (MalformedURLException e1) { e1.printStackTrace(); } catch (IOException e1) { JOptionPane.showMessageDialog(null, "Not Internet Connection", "ALERT", JOptionPane.WARNING_MESSAGE); e1.printStackTrace(); } } catch (Exception e) { JOptionPane.showMessageDialog(null, "Error..."); e.printStackTrace(); } } public void Question9_Analyse() throws RemoteException{ try { String Dine_inn = "", Take_away = "", both = "", link = ""; BufferedImage image = null; String sql1 = "SELECT COUNT(user_id) FROM answers WHERE question_id=9 and answer=\"Dine inn\" "; try { database.pst = database.con.prepareStatement(sql1); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { Dine_inn = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } String sql2 = "SELECT COUNT(user_id) FROM answers WHERE question_id=9 and answer=\"Take away\" "; try { database.pst = database.con.prepareStatement(sql2); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { Take_away = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } String sql3 = "SELECT COUNT(user_id) FROM answers WHERE question_id=9 and answer=\"both\" "; try { database.pst = database.con.prepareStatement(sql3); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { both = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } try { link = "https://quickchart.io/chart?bkg=white&c={ type: 'pie',data: { datasets: [ { data: [\'" + Dine_inn + "\',\'" + Take_away + "\',\'" + both + "\',], backgroundColor: [ 'rgb(204, 0, 0)', 'rgb(204, 204, 0)', 'rgb(0,204,204)' ], label: 'Which-type-of-delivery-method-you-prefer?', }, ], labels: ['Dine-Inn', 'Take-Away','Both'],},}"; link = link.replace(" ", ""); URL url1 = new URL(link); HttpURLConnection urlcon = (HttpURLConnection) url1.openConnection(); urlcon.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11"); image = ImageIO.read(urlcon.getInputStream()); JFrame frame = new JFrame(); frame.setForeground(new Color(153, 255, 255)); frame.setTitle("Which type of delivery method you prefer?"); frame.setResizable(false); frame.setBackground(new Color(153, 255, 255)); frame.setSize(900, 900); JLabel label = new JLabel(new ImageIcon(image)); frame.getContentPane().add(label); frame.setVisible(true); frame.setLocationRelativeTo(null); } catch (MalformedURLException e1) { e1.printStackTrace(); } catch (IOException e1) { JOptionPane.showMessageDialog(null, "Not Internet Connection", "ALERT", JOptionPane.WARNING_MESSAGE); e1.printStackTrace(); } } catch (Exception e) { JOptionPane.showMessageDialog(null, "Error..."); e.printStackTrace(); } } public void Question10_Analyse() throws RemoteException{ try { String Card = "", Cash = "", E_Wallets = "", link1 = ""; BufferedImage image = null; String sql1 = "SELECT COUNT(user_id) FROM answers WHERE question_id=10 and answer=\"Card\" "; try { database.pst = database.con.prepareStatement(sql1); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { Card = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } String sql2 = "SELECT COUNT(user_id) FROM answers WHERE question_id=10 and answer=\"Cash\" "; try { database.pst = database.con.prepareStatement(sql2); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { Cash = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } String sql3 = "SELECT COUNT(user_id) FROM answers WHERE question_id=10 and answer=\"E-Wallets\" "; try { database.pst = database.con.prepareStatement(sql3); ResultSet rs = database.pst.executeQuery(); while (rs.next()) { E_Wallets = rs.getString(1); } } catch (Exception e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "ERROR:"); } try { link1 = "https://quickchart.io/chart?bkg=white&c={ type: 'bar',data: { datasets: [ { data: [\'" + Card + "\',\'" + Cash + "\',\'" + E_Wallets + "\',], backgroundColor: [ 'rgb(204, 0, 0)', 'rgb(204, 204, 0)', 'rgb(0,204,204)' ], label: 'What-is-your-payment-method?', }, ], labels: ['Card', 'Cash','E-Wallets'],},}"; link1 = link1.replace(" ", ""); URL url1 = new URL(link1); HttpURLConnection urlcon = (HttpURLConnection) url1.openConnection(); urlcon.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11"); image = ImageIO.read(urlcon.getInputStream()); JFrame frame = new JFrame(); frame.setForeground(new Color(153, 255, 255)); frame.setTitle("What is your payment method?"); frame.setResizable(false); frame.setBackground(new Color(153, 255, 255)); frame.setSize(1000, 800); JLabel label = new JLabel(new ImageIcon(image)); frame.getContentPane().add(label); frame.setVisible(true); frame.setLocationRelativeTo(null); } catch (MalformedURLException e1) { e1.printStackTrace(); } catch (IOException e1) { JOptionPane.showMessageDialog(null, "Not Internet Connection", "ALERT", JOptionPane.WARNING_MESSAGE); e1.printStackTrace(); } } catch (Exception e) { JOptionPane.showMessageDialog(null, "Error..."); e.printStackTrace(); } } }
[ "HP@Sarani" ]
HP@Sarani
dafa652590f9a0e430c7c905dca55275aa8e90d6
bca3c2637f1eb18b4c10efcc07f052367e7671ce
/src/edu/wcsu/wcsufs/Exceptions/DirectoryEntryNotFoundException.java
5052182d773fe6e59775bca91c95d32b49a567de
[]
no_license
dancoff0/WCSUFS
df7f1374b1a8ed48f566ccd48da1a5ee79fe4cb5
69d0a0ff5b7e27c189ab97d6738d59dc5c36d302
refs/heads/master
2020-03-27T09:43:29.452871
2018-09-03T19:06:04
2018-09-03T19:06:04
146,366,884
1
0
null
null
null
null
UTF-8
Java
false
false
193
java
package edu.wcsu.wcsufs.Exceptions; public class DirectoryEntryNotFoundException extends Exception { public DirectoryEntryNotFoundException( String message ) { super( message ); } }
[ "coffmand@wcsu.edu" ]
coffmand@wcsu.edu
4c4eb40dcb05bddf0d571bf682ea0915575ff1e9
be9a32c57f323a5c42b4d2db5082873364686681
/src/LinkCode/P101_200/S175_InvertBinaryTree.java
5c54b5156dea5e0cc45a60ab5e19d7a0ec7b66f7
[]
no_license
mecury/MyAlgorithm
79c1022869b7305724d07f96529072962697ce9e
b7f4e33ceb5ad7c8d3541670b17f0aa2c77286bd
refs/heads/master
2021-01-13T16:18:11.511465
2017-03-07T06:03:46
2017-03-07T06:03:46
81,395,774
0
0
null
null
null
null
UTF-8
Java
false
false
1,635
java
package LinkCode.P101_200; import LinkCode.Node.TreeNode; import java.util.Stack; /** * Created by 18394 on 2017/1/16. */ public class S175_InvertBinaryTree { /** * @param root: a TreeNode, the root of the binary tree * @return: nothing */ public static void invertBinaryTree(TreeNode root) { recursionInvert(root); } //递归的解法 public static void recursionInvert(TreeNode root) { if (root == null) { return; } recursionInvert(root.left); recursionInvert(root.right); TreeNode temp = root.right; root.right = root.left; root.left = temp; } //非递归的解法 static Stack<TreeNode> stack = new Stack<>(); public static void normalInvert(TreeNode root) { stack.push(root); while (!stack.isEmpty()) { TreeNode node = stack.pop(); TreeNode temp = node.left; node.left = node.right; node.right = temp; if (node.left != null) { stack.push(node.left); } if (node.right != null) { stack.push(node.right); } } } public static void main(String[] args) { TreeNode first = new TreeNode(1); TreeNode second = new TreeNode(2); TreeNode three = new TreeNode(3); TreeNode four = new TreeNode(4); first.left = second; first.right = three; three.left = four; System.out.println("pre: " + first); invertBinaryTree(first); System.out.println("cur " + first); } }
[ "haifei.li@ninebot.com" ]
haifei.li@ninebot.com
eb8e32fcd0ab6dd40a2cbde55df8372baad94c56
51934a954934c21cae6a8482a6f5e6c3b3bd5c5a
/output/af0cf89676b34edfb211b1fe3949dd3e.java
b9f8157b27c9e7c04edc49f66dabf2dc29ae2115
[ "MIT", "Apache-2.0" ]
permissive
comprakt/comprakt-fuzz-tests
e8c954d94b4f4615c856fd3108010011610a5f73
c0082d105d7c54ad31ab4ea461c3b8319358eaaa
refs/heads/master
2021-09-25T15:29:58.589346
2018-10-23T17:33:46
2018-10-23T17:33:46
154,370,249
0
0
null
null
null
null
UTF-8
Java
false
false
12,636
java
class T_z1KfBIY { public int[][][] OP4_0Wm (S59FGMzDIOP_[][][][] ERuz, int kCa_p, void[] O, int TMg52clv2cI, void[] lKbfCpXx) throws Kwa { -qeeo_b1C().kYSb_7MZbYebzA(); int H5ikvWqomSf = ( -null.sAzICe3jETdUR).AYRFS; boolean[] z7gZy3gLSi; int en35OmxE4l = false.OmNuOizEk_6Rso; return; -!!null.V6o(); while ( !!-!!-null[ false.jP9zYm_rHPrYK]) ; void[][] Gg = !!-----s0C().g2GHy_0eCn = Z0r_w06Stztfbu().ME0AoKFuP; int Ncs = -!-N8pJwUIuTMNb3z().n4KT5DY5() = O.t8; !!( !-vUpzQGZDOE().yxFJDmeecKxY).rO0csPmxhg(); { NG oh5; int[] PJC; { lKI6DHXX2qG acLj6UIBy4n; } --new HFpz6[ !!new int[ -Amg16ACxB[ ( ( false.c()).RDz()).QMXTcLm9Bqu()]].x0()]._dI5LvYYUOPw; int Avl4; if ( !!SjLoN.nq1()) ; TDlA5CotwVQNB bBk3myf; void[][][] mHAQ; { void[] n; } kPytt03F5rH[] a4IvR9; if ( !w[ -null[ zt8T().igdME77d92Z()]]) if ( !null.I()) ; int t; if ( new boolean[ null[ --true.m]].LQ7Paj) if ( !-false[ !null[ -!!84268.Mi()]]) ; void[] O5uGN; void sz; boolean JfA; } Aklx3w o3joT; return; return; boolean i8y8SqaTAqco0 = new eg_uCdi[ !!!!false.fyCraDkCcK()].Ass7yEyEmm; void[][][][] b; while ( !!new xQpRa4Fgos769t().h3()) if ( !----false.ObEaD) return; int CpUlhPl6; p_wiKMR[] BB8RRi9 = !-this.amD0j() = !!false[ -!this.Eo3BChLPH()]; while ( S0RztASYWbg3zx().OkSiW) return; } public void[] PJwLE_Bf6r4fTT (HOQwWrh5zB1L[][][][] nuZhqU_oC, boolean[][][] N, boolean[][][][][][] UjerG1fHU) { ; return false[ Plt0y5ChtQ().Nz88QkvZaqG]; if ( !-this.ubYlGL()) return; !!null[ false.pMTK]; void[][][][] FP4TFq; boolean ri_MI; ; boolean[] VDAy5SJUp = -!!-new Wh86t()[ 936251[ false.RYlnv]]; boolean bNzkPDLrftO775 = false[ -( false[ -null[ ( new wxh5qz2RSf().TvTRv()).u9vp3Un7E()]]).x2UJG()] = new hjdcuZ()[ !false.g4MYwrEyRh0sa1]; ; { void Cg; int c9h93GCGyo; oiFl_ZtOOe9N[] O9; if ( !--( !--Fq().R79KZZjxF_0X())[ !!AjSkwvDAcwgTvc.hse()]) while ( ( !-!8153525[ this.KcK8K6D]).JNSqs6IyL()) if ( -new PMQ7pp1hpFkvV().B()) while ( true.VKl0xcQW0Xy()) !true.UkPd; qak80A3ChtRf[] na9jrR8ud8b; void eNARAIiL4IYQ; void[] yhBc; void[] cEI0Tz4VnMpf; w[] pK; if ( false.XGoD0VwJtEabN) ; int[] iF336PShIOM; int[][] ok3gb; while ( pxGDEG9gY.EIv_7wc()) if ( new jTA().xwYQfZHX) false.QlUT9OEHAIb; { if ( --this.AH7I) { -false[ -!hbb[ SOAkw4ZWDiU()[ true.RCXTpqxyn]]]; } } int mmDR_0; boolean[][][] daEed; int ljV; ; if ( !!dDO64TCjTDf0().qeunLHJvD_) if ( -this.JgRbvqZ3Ny()) { -!true.PAMOITxl; } } !!ns8M[ -null[ false[ this.MYOpAe]]]; int K_UaIlWBZ; true[ new MfmV()[ ( !new xdV().BsUz0MOF).p5wg7wfET()]]; tU2TgDcN.nSA4wcqC; while ( !!( null.e7WVEaHaHxt7BE())[ A2[ !!new boolean[ this.sSIrVgPJY8t3sZ][ null.iNGOUGPNF6z]]]) { void[] yedTRxpjhnFuEX; } void fE7f; ; void[] YBionDvF = -!false.S; GPRHMr1T3 RHHAGF; } public pSu[] _03ilc; public cdrxq[] gr78zT83o2hNh; public int[] sBH3NbpjidZ8 (int[] bSTKh8hcSI, boolean[] o, boolean j, boolean I_t, boolean[][] QFkD, boolean[] zce_BK84YeG5) { void Pz; if ( null._bihHIefD8b2()) 9[ !new STj2SxXn().jYB59]; { if ( !null.qnmf08FqL()) while ( ur37CH6vM()[ --true.sfNm3Ss0RcHpx1()]) if ( y_j.pltC4) return; ; int oFFog3M; void i1eXOX8r__AtRA; int SM; boolean[][] uhz8; Pk1dG[][][][] DVufz1bBYCdTgF; boolean[][] Z; } return B.UPc0QJPLunF; } public int[][][] IB2dQuJGHZ; public boolean[] nPSxZyLuW74HJ; public static void PYYa4tMiL9YlP (String[] LliJRqv) { void[] C5; ; DrEcZiryip p4tqRS3t; int x5v = true.wvRVv56(); int[][] QzNB3zJ; HrqFOhl2t9e_2B[][] pjS4Xdpm8; S4Igb04D3W[][] pbiH = !!new void[ -true.oz3Xt4yV].yDllgOpQ_1HQ4l(); new TIYX2dzY6jA().Z1RYKw(); ; } public void M1kiq0_04; public int[][][] xjvN; public boolean[][][] KPGtG () { void dQcYk8AUPts6Z = s1GWBH72ehXLCC.vSj9LIe2k4Drp; Ayrn[][][] AlAi25amOCFfXo; int jljV; ; -aL3_hS6cJM.wsjDvYj6_(); void GLb; boolean s = -Wk1ig().l() = null.QWnf; a2jHgDFfKqxU3e V; while ( !--9958[ !new boolean[ 2477637.NUtMoYy()].s6e9T]) ; void Ql; if ( !!!_().cwyKx) ;else return; void qnktcO9Pf2FflI = false.GfxnhbprWNGI = false[ -true.Jpwa]; while ( --!true.HC5H) return; } public boolean E4dmw_KGrrtfe (int[][] WpNv1XVUe7ICQD, int R2S, int RY4J, void mTRIkE_L7q, boolean[] PaPH85HQO3I65b) { ; if ( false[ -this[ true.K0RJFyE()]]) while ( !-new int[ !!4034985.MAINIc1EpY].W()) if ( new BybChvzFh_m[ !!!ARxAyN.aG8f()].KhsIbtC5vkn72W()) return; } } class iXRJ { public static void IVtv3wH (String[] heJCEtP8_5fS6) throws qT { boolean[] TAek5FsvynUc; _ZL5FW6KjIryR6[][] JmtvhIdq_Ogh9p; sma[][] y = !-new Scxb25daSYFM().TRAtt3() = n().c; if ( -null.BTt5Di4Mm()) while ( noGsH792Y().Z()) { ; }else { void JSwHmsNbwm; } ; while ( --!--!!-115836.ADHHwwxgSIT6E3()) !new hAFc0U_a()._M(); return; while ( new lgSP1kMtglTKl().EgJsQhXZz()) { void NIEhmy9WjEWf; } ; boolean kClOxGVbMzNKe = !-null.N2OGkt9BEa(); } public static void gavBZo (String[] R) throws NWtPDEH4GbyE { while ( D6Cg6oOCd().AKhY) ; void[] pF = !2775263.n5usSBH6(); void sDaxU1L = 47848863[ true.kBBh89EdVmP()]; --!941895.XLcB2edkg(); boolean[][][] ZhH7a6e; boolean hADXtwLjcpcXr = -( new boolean[ 564.RG8Qy0()].OtHFdqhRvMF)[ -tlnHLbGb9FiY.l0oJBZKRB]; int[] cQu8Wfyr2 = ( !-3373250.sib7raYAcvQ()).MYfyBSmdJwwT = !!fvpgH().F; if ( -false[ -true[ true.Cpqxtitsz4U4P]]) { if ( true.bb3AKl6p) -!!!null[ IJkdAIv()[ -!---!( null.yoQ2U4aBK).E1C1]]; }else if ( -!St4qB5zGfmxbTF().L6()) { int[] jLdrb1g6m5G8; } if ( false.sgR6WwO4()) !new Z[ false[ new LbkTpx7Jkuo().bsNkh_nHcvKs]].OCNr;else ; fsknmoww AhVuPxiIZKwd; return !hlnWmq8ZA5W6Xa()[ czBJGUXn()[ !this.MvAeH()]]; return ( !-regWL_g9t6D5k.JABUpf)[ 094120.oXA4Q()]; int DSwYCxqvszt8 = -new vid().cl6Re_Y() = new boolean[ !220.Q5Z7B8J2v()].crNDyEd(); boolean[][] I_FXl5dQtWZl6E; !-new Oorr0Rug().gDuD0GO_K(); boolean[] qo = -null[ 949087[ -this[ -false[ null.Y095()]]]]; void _741M = ( null.FYXWA())[ -new LfSpIKpRBZjM()[ true.Bgj1xBIfOUqS()]] = _bCMBSkfJH.piAGLP(); if ( !new W()[ !-LgUp9cyGs5j().zMCMVStnZ]) true.OpoOFqm88; if ( this.XasCdJUx1b) while ( ( tDk().jzk4y).eRfs()) { int[][] rZrGZ_EXa; }else CUPrIm()[ -( !-true.OKvlMo_5a_F2Lv).RdYzBsn0c]; while ( ( -!( !( --null[ !!-!false.lW()]).ePGsr8t5XRETG).y6Zb8tNxrr()).DZ7cWn2C) !true.Iknm0UqBbGjV; } public boolean[][] mI_duV5EeWG; public int[][][] NtU8xA_; } class SGhwQNzg { } class jcKtWc4oVT { } class Aku9 { public N0XY[][] y9R1shAJ; public static void OciGmInLgou3 (String[] lfFDdTP1) throws SB { return -false.EQjIjXGcdsh; ; ; -new E().SRYx7mfEFGJDz; return -( !l_K5jda().Uc9FjduDw).UujOJu9eF; void[] ECqKqq_j; E7O3EKU3b33jQe[] RRlPyf4x; } public static void J8uh3Azu (String[] IxL30) { while ( -!CCgWrsj7YORK().G7k()) if ( ( !!!false[ -( !--new zFI9HoDThmn().Vl7QsaNdHCS8())._nlaKw5V8()]).PTjAa) { int[][][][][] DcWZ; } void Xs3Erf5aH = !new void[ !-LA3AIO()[ null[ !!-!!new void[ new boolean[ new TcBcU().bL0_kk2IG].GtWN1hH6lp].wJDvMKTcj()]]].QjbQ26LabMskY(); { boolean[][] iQwyWPKP2N; void[] YWNpsB56m; { { { !62322463.qaOJmBRMVz; } } } { return; } int IAbX; boolean HBTcJ; int KQ; boolean[][][] YUd71j4AjKi6; jyNxs[][] ZsL; { boolean I0RVil; } return; } return !( false.d()).hLRvn(); while ( -true.xOL6jE29()) -false[ new nHUmXcQef().h9j37sYxSY7()]; void[][] Hn3g = 772[ new T().lUS()] = PXCZSqL0TA6a()[ !this.ogO]; -!!!new boolean[ ( 5127.ONZYCOguN).AA()].z8x_Meb(); int G85cFxrQt; if ( new aZQ__Nu1e[ teMfTaiPrJe.rifS8V91Puj_][ new skrKEAURO()[ 507772208[ -true.Kpa]]]) if ( !( new FdMPRrrVlh9[ 38489[ WuMI3E_jICYOJm()[ !this[ new int[ -Sh.Vfbn_C8()].iemC()]]]].sYFYT)[ -!false.LV()]) !-false.MRfC4w();else while ( -C4hrqABBI11()._KmVZ17IoPG()) if ( !!-!true.Zxhpwzw08z0XGT) if ( new int[ -null.TxfA_vd8sgi6()].u2UpWHNNyjhQ_()) ; while ( null.HFupN9oE2()) while ( new void[ -IriqB791EwLei().xguj1mh7ul()].tJipBJqkUV) ; void vy2; int[][][] _orsiwMKa3W = -!TxmAblrtz0().JKPxSnuyu64zcA(); } public boolean[] Gnh () throws nJXH59qOh2cz { ; void[] un5Ga; int[][][] d4sZxIWSTHi = this[ null.eSrClZIOvjlXd] = false.CK229dRTWT; return; void NQ2jvknudgaf; Txy1LHjOlxBy HJsqIU5O4Rca = -null.lxeG4() = false.ugVYW7Og99Hqz(); void[] cCYQzPZ; void wHESY8j_CN = --false.sfgike7n(); boolean n4nv45LA4; boolean[][][] R_xXK0Pbdcrno = -new int[ 4.VRgdNVgyE][ null.n2F7guY] = false.qxOL(); while ( 45988.aZupMdQ) return; { while ( !-new cN5Y7gI8()[ !ceAgNET().b]) return; if ( tlg5r_W.q8A1rG99l5S5()) 05.IbKpbnv; int Nrvf4tz; return; void[][][][][][][][][] Kdf1q8qhfzT8m; while ( !!null._XRt) { void[][][][] BsE0aXqkPYD; } return; while ( !!!-WtweXGY8nue.wEh5GV) ; { { int FhNb9PtbK; } } GmzGn2fN[ this.kZzA1x]; if ( -!!this.QAUYo6wUqS7QOv()) ; { return; } { return; } while ( !!-true[ new LkFZfhEUAff().J1P_KpGU001()]) false.Hby53chi; tkkQ4DcR3tbOz6[][] SYAghDoIl; boolean I; void[] pmUTeh; boolean PNs; } return 044[ -( -this[ !-v_XXuReT4SNce().wnnAHHgTmgus()]).c_JpIoTwwcd]; while ( -fIgYYY8[ !!( new void[ false.Q()].FakJWnQ).AV()]) if ( uhulN.a3Z) return; new int[ !true.FAr1OMmRoaNFG()][ !new l()[ -!new fgu36sb().zZC8iPZPN_L]]; } public int sgv; public void[][][][] dRU7UkhrIaf8i (boolean YC1pfsN6HmlQwW, KRvbRhE Yfk8GSvmR) throws woMi { ; int mczR = !( -!---null.QXlMuVWj6Wx8V()).k(); void[][] _HzWOopR5G = !new HLc9()[ !lSpM49uhKZ()[ -!new veS0lx3bHFdamf()[ !new y().HP1Yjn]]]; while ( null.cJiusiiFegVrN3) while ( 18[ !( nH6hK8gTf().j).vGVblEz]) ; boolean K = true[ !!!Xm0ne0HS1G1t().bRu5Sm] = null.Rqa(); if ( false.YhFELYg1clANGq) if ( this[ --294.lHvBWzNcs9s]) { ; } void[] KcxsgLzO; return; boolean[][] Sj23wzonmLx1r; boolean[][] vXDEP0S61lMVo = !!!qXKsg41hEdIQCF.FUf8uHHzyFAYHv; boolean[][][][][] JVLYi_ = -null.bkNFWNg; if ( !--false.rJY4NJPA4Udgtx()) return;else ; boolean _CMbuSYl = 2.C0eR6() = ( false.cx9HZ1NRX())[ !!-!new AtKbwgVik_TrZ()[ -!-new I0().BG_Jev3RZ()]]; } public static void S32QnNL (String[] X0v) { true.BCG2f; _ w5qHqFWees; EiNNqK[] V889bD9ELMlI = null[ this.n2rE_CsB7f7]; } public boolean _KMxHxfYFOzs0L; public void[][] _DRI; }
[ "hello@philkrones.com" ]
hello@philkrones.com
b6a8ad3feb050ce7085f049d45c87ee661a3b69d
29928df3447b474ff9dd8f38c2316454418d0fc3
/src/main/java/com/zryq/cms/admin/controller/StatisticsController.java
dd2f3d2c444391d1a5adc0c0560ee1b14ff8d9fc
[]
no_license
Zzhangrui/zryq
10b8a7ebe2e68afbb4dc506ff2ff3630fc7fc172
e184ccce3bf99ce764d75b3dbbbf1d3d8f7ef222
refs/heads/master
2020-03-13T05:44:21.675782
2018-09-10T08:43:44
2018-09-10T08:43:44
130,989,626
0
0
null
null
null
null
UTF-8
Java
false
false
378
java
package com.zryq.cms.admin.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; /** * Created by 锐 on 2017/11/24. */ @Controller @RequestMapping public class StatisticsController { public ModelAndView index() { return null; } }
[ "rui.zhang@mi-me.com" ]
rui.zhang@mi-me.com
c6090871708565d5a61b08a2162dbed8a5f966c9
b6de3076a2d1cf038fe766ec5c0a1a135444cdd6
/Hall/src/main/java/zhoulk/hall/client/Client.java
7a68bdcb60a2ed535832d9b9dd5dfce6479e575a
[]
no_license
zhoulk/gameServer
0eed61099bcd77b2c37309eef1c2415f560cc76f
7e29a38ad4d73a3bf122be0f678be30e5ff75bd8
refs/heads/master
2020-03-17T22:51:53.100573
2018-05-19T02:06:09
2018-05-19T02:06:09
134,021,116
0
0
null
null
null
null
UTF-8
Java
false
false
1,495
java
package zhoulk.hall.client; import io.netty.bootstrap.Bootstrap; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelInitializer; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioSocketChannel; import zhoulk.hall.client.handler.EchoClientHandler; import java.net.InetSocketAddress; /** * Created by zlk on 2018/4/15. */ public class Client { private final String host = "127.0.0.1"; private final int port = 8888; public static void main(String[] args) throws Exception { new Client().start(); } public void start() throws Exception { EventLoopGroup group = new NioEventLoopGroup(); try{ Bootstrap b = new Bootstrap(); b.group(group) .channel(NioSocketChannel.class) .remoteAddress(new InetSocketAddress(host, port)) .handler(new ChannelInitializer<SocketChannel>() { @Override protected void initChannel(SocketChannel socketChannel) throws Exception { socketChannel.pipeline().addLast(new EchoClientHandler()); } }); ChannelFuture f = b.connect().sync(); f.channel().closeFuture().sync(); }finally { group.shutdownGracefully().sync(); } } }
[ "zlk@zlktekiMacBook-Pro.local" ]
zlk@zlktekiMacBook-Pro.local
32e78e597acfa3448812752315602a14bba5a6d4
1d262bc4012f75d9cc11da2469ac1e1ca03cfa13
/Task 8/Casting/C.java
30bcc3cec43cd77dffac065a4031d367ccfe96de
[]
no_license
Phamminh202/Java
a79467ae598471e85be5e056479d0f49fa0f1c52
aa7abf166f1085d8e7e9f7ee6200472f175bc23e
refs/heads/main
2023-08-06T13:29:44.061354
2021-09-06T10:58:05
2021-09-06T10:58:05
353,701,412
0
0
null
null
null
null
UTF-8
Java
false
false
218
java
package Casting; import Casting.B; public class C extends B { public C(){ super(); System.out.println("C"); } @Override public String toString() { return "This is C"; } }
[ "73330638+Phamminh202@users.noreply.github.com" ]
73330638+Phamminh202@users.noreply.github.com
539f1d873a5852a0ef4c9838bd00e674659cff77
f695ffad9aacddd7628ec41bb8250890a36734c8
/ecp-coreservice/ecp-coreservice-common/src/main/java/com/everwing/coreservice/common/wy/entity/personbuilding/PersonBuildingNew.java
c5c4e7f1649eab6e2e029b6a82678bdd4e16c066
[]
no_license
zouyuanfa/Everwing-Cloud-Platform
9dea7e324f9447250b1b033509f17f7c8a0921be
f195dfe95f0addde56221d5c1b066290ad7ba62f
refs/heads/master
2020-04-13T18:22:36.731469
2018-12-28T06:18:37
2018-12-28T06:18:37
163,372,146
0
4
null
null
null
null
UTF-8
Java
false
false
5,145
java
package com.everwing.coreservice.common.wy.entity.personbuilding; import com.everwing.coreservice.common.BaseEntity; import com.everwing.coreservice.common.Page; import com.everwing.coreservice.common.wy.entity.cust.enterprise.EnterpriseCustNewSearch; import com.everwing.coreservice.common.wy.entity.cust.person.PersonCustNew; import javax.xml.bind.annotation.XmlRootElement; import java.util.Date; @XmlRootElement(name = "PersonBuildingNew") public class PersonBuildingNew extends BaseEntity implements Cloneable{ private static final long serialVersionUID = -7020055037493517716L; private String personBuildingId; //客户房屋关系id private String custId; //个人客户id private String enterpriseId;//企业id private String buildingId;//建筑id private String buildingCode; //建筑code private Byte state;//关联状态(0开启,1禁用) private String custType;//客户类型 private Byte enterpriseCallType;//企业呼叫人状态 private String accessory ; // 上传附件信息 private PersonCustNew personCustNew; //个人客户对象 private EnterpriseCustNewSearch enterpriseCustNew; //企业客户对象 private Page page; private Date relationDate;//关联时间 //查出其他需要字段 private String buildingFullName; //建筑全名 private String name; //客户名字 private String enterpriseName; //企业客户名字 private String projectId; private String projectName; public Object clone(){ PersonBuildingNew sc = null; try { sc = (PersonBuildingNew) super.clone(); } catch (CloneNotSupportedException e){ e.printStackTrace(); } return sc; } public String getBuildingFullName() { return buildingFullName; } public void setBuildingFullName(String buildingFullName) { this.buildingFullName = buildingFullName; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEnterpriseName() { return enterpriseName; } public void setEnterpriseName(String enterpriseName) { this.enterpriseName = enterpriseName; } public String getPersonBuildingId() { return personBuildingId; } public void setPersonBuildingId(String personBuildingId) { this.personBuildingId = personBuildingId; } public String getCustId() { return custId; } public void setCustId(String custId) { this.custId = custId; } public String getEnterpriseId() { return enterpriseId; } public void setEnterpriseId(String enterpriseId) { this.enterpriseId = enterpriseId; } public String getBuildingId() { return buildingId; } public void setBuildingId(String buildingId) { this.buildingId = buildingId; } public Byte getState() { return state; } public void setState(Byte state) { this.state = state; } public String getCustType() { return custType; } public void setCustType(String custType) { this.custType = custType; } public Byte getEnterpriseCallType() { return enterpriseCallType; } public void setEnterpriseCallType(Byte enterpriseCallType) { this.enterpriseCallType = enterpriseCallType; } public String getAccessory() { return accessory; } public void setAccessory(String accessory) { this.accessory = accessory; } public PersonCustNew getPersonCustNew() { return personCustNew; } public void setPersonCustNew(PersonCustNew personCustNew) { this.personCustNew = personCustNew; } public EnterpriseCustNewSearch getEnterpriseCustNew() { return enterpriseCustNew; } public void setEnterpriseCustNew(EnterpriseCustNewSearch enterpriseCustNew) { this.enterpriseCustNew = enterpriseCustNew; } public Page getPage() { return page; } public void setPage(Page page) { this.page = page; } public Date getRelationDate() { return relationDate; } public void setRelationDate(Date relationDate) { this.relationDate = relationDate; } public String getBuildingCode() { return buildingCode; } public void setBuildingCode(String buildingCode) { this.buildingCode = buildingCode; } public String getProjectId() { return projectId; } public void setProjectId(String projectId) { this.projectId = projectId; } public String getProjectName() { return projectName; } public void setProjectName(String projectName) { this.projectName = projectName; } @Override public String toString() { return "PersonBuildingNew [personBuildingId=" + personBuildingId + ", custId=" + custId + ", enterpriseId=" + enterpriseId + ", buildingId=" + buildingId + ", buildingCode=" + buildingCode + ", state=" + state + ", custType=" + custType + ", enterpriseCallType=" + enterpriseCallType + ", accessory=" + accessory + ", personCustNew=" + personCustNew + ", enterpriseCustNew=" + enterpriseCustNew + ", page=" + page + ", relationDate=" + relationDate + ", buildingFullName=" + buildingFullName + ", name=" + name + ", enterpriseName=" + enterpriseName + "]"; } }
[ "17711642361@163.com" ]
17711642361@163.com
deedef8b648315b05e15e7bcd1026d1642bc93f0
20a068fa60ac48c5a6b4f28df97ca6b8ab35df78
/src/br/edu/up/util/Cardapio.java
00ad6bdebf23626f38b8272f53db25a0caa09c51
[]
no_license
joaovitoraramo/projeto_crud
c82eea500e07cbd6fa184286b98c4559a119ec1e
e8e5ec02d1209c8765ff577c2851945984fc793b
refs/heads/master
2022-12-18T18:39:45.686115
2020-09-26T21:05:36
2020-09-26T21:05:36
298,898,521
0
0
null
null
null
null
ISO-8859-1
Java
false
false
4,206
java
package br.edu.up.util; import java.io.IOException; import java.util.List; import java.util.Scanner; import br.edu.up.dominio.ItemBebida; import br.edu.up.dominio.ItemPrato; import br.edu.up.dominio.ItemVinho; public class Cardapio { public static void processar(Scanner leitor, List<ItemPrato> listaDePratos, List<ItemBebida> listaDeBebidas, List<ItemVinho> listaDeVinhos) { int [] op1 = new int [99]; int [] op2 = new int [99]; int [] op3 = new int [99]; char Escolha = 0; String Obs = "", PedidoFinal = "", BebidaFinal = "", VinhoFinal = ""; int i = 0, cont1 = 0, cont2 = 0, contP = 0, contB = 0, contV = 0; double ValorFinal = 0; do { contP = RealizarPedido.Prato(leitor, contP, op1, listaDePratos); cls.limpar(); System.out.println("Gostaria de beber alguma coisa? (S)Sim (N)Não: "); Escolha = leitor.next().charAt(0); do { cont1 = 0; if (Escolha == 'S' || Escolha == 's'|| Escolha == 'N' || Escolha == 'n') { cont1 = 1; }else{ System.out.println("Opção inválida, escolha novamente."); System.out.println("Gostaria de beber alguma coisa? (S)Sim (N)Não: "); Escolha = leitor.next().charAt(0); } }while(cont1 == 0); leitor.nextLine(); cls.limpar(); if(Escolha == 'S' || Escolha == 's') { contB = RealizarPedido.Bebida(leitor, contB, op2, listaDeBebidas); } cls.limpar(); System.out.println("Gostaria de conhecer nossa carta de Vinhos? (S)Sim (N)Não: "); Escolha = leitor.next().charAt(0); do { cont1 = 0; if (Escolha == 'S' || Escolha == 's'|| Escolha == 'N' || Escolha == 'n') { cont1 = 1; }else{ System.out.println("Opção inválida, escolha novamente."); System.out.println("Gostaria de conhecer nossa carta de Vinhos? (S)Sim (N)Não: "); Escolha = leitor.next().charAt(0); } }while(cont1 == 0); leitor.nextLine(); cls.limpar(); if(Escolha == 'S' || Escolha == 's') { contV = RealizarPedido.Vinho(leitor, contV, op3, listaDeVinhos); } if((op1[0] != 0) || (op2[0] != 0) || (op3[0] != 0)) { i = 0; for(ItemPrato prato : listaDePratos) { i++; for(int j = 0; j < contP; j++) { if(op1[j] > 0 && op1[j] == i) { PedidoFinal += prato.getNomePrato() + "\t" + prato.getValorPrato() + System.lineSeparator(); ValorFinal += prato.getValorPrato(); } } } i = 0; for(ItemBebida bebida : listaDeBebidas) { i++; for(int j = 0; j < contB; j++) { if(op2[j] > 0 && op2[j] == i) { PedidoFinal += bebida.getNomeBebida() + "\t" + bebida.getValorBebida() + System.lineSeparator(); ValorFinal += bebida.getValorBebida(); } } } i = 0; for(ItemVinho vinho : listaDeVinhos) { i++; for(int j = 0; j < contV; j++) { if(op3[j] > 0 && op3[j] == i) { PedidoFinal += vinho.getNomeVinho() + "\t" + vinho.getValorVinho() + System.lineSeparator(); ValorFinal += vinho.getValorVinho(); } } } } cls.limpar(); System.out.println("Gostaria de adicionar algum comentário?"); Obs = leitor.nextLine(); cls.limpar(); try { Impressora.imprimir(PedidoFinal, BebidaFinal, VinhoFinal, Obs, ValorFinal, cont2); } catch (IOException e) { System.out.println("Erro na impressão do pedido"); //e.printStackTrace(); } System.out.println("Gostaria de refazer seu pedido?"); Escolha = leitor.next().charAt(0); do { cont1 = 0; if (Escolha == 'S' || Escolha == 's'|| Escolha == 'N' || Escolha == 'n') { cont1 = 1; }else{ System.out.println("Opção inválida, escolha novamente."); System.out.println("Gostaria de refazer seu pedido? (S)Sim (N)Não: "); Escolha = leitor.next().charAt(0); } }while(cont1 == 0); leitor.nextLine(); if(Escolha == 'N' || Escolha == 'n') { cont2 = 1; cls.limpar(); try { Impressora.imprimir(PedidoFinal, BebidaFinal, VinhoFinal, Obs, ValorFinal, cont2); } catch (IOException e) { System.out.println("Erro na impressão do pedido"); //e.printStackTrace(); } }else { cls.limpar(); } }while(cont2 == 0); } }
[ "61094070+joaovitoraramo@users.noreply.github.com" ]
61094070+joaovitoraramo@users.noreply.github.com
be51e164ba96debc141ef31f582d1f4765d65568
f8740e23e087ab71eef44321a0c92d7ddb39a58d
/src/main/java/com/eeu/smaartu/security/AuthoritiesConstants.java
2c6e970fb9b284f8a5db19020de6f0a887945f70
[]
no_license
ibrahimuslu/smaartu
b1fd259271e256c5e787a5e1560fae0fc49ca424
151ef0067e23cdaa2ffb2ca85ac12e732c475700
refs/heads/master
2022-12-11T11:55:56.857072
2021-09-30T06:32:07
2021-09-30T06:32:07
98,129,859
0
0
null
2022-12-07T21:17:53
2017-07-23T22:44:27
Java
UTF-8
Java
false
false
345
java
package com.eeu.smaartu.security; /** * Constants for Spring Security authorities. */ public final class AuthoritiesConstants { public static final String ADMIN = "ROLE_ADMIN"; public static final String USER = "ROLE_USER"; public static final String ANONYMOUS = "ROLE_ANONYMOUS"; private AuthoritiesConstants() { } }
[ "ibrahimuslu@gmail.com" ]
ibrahimuslu@gmail.com
2ae603774f892622114b24d2354a0ccf7ce71411
6af593ab090cea9c6ececb70cb6c8ff154995dae
/src/main/java/cn/xjwlfw/yeshenghuo/system/helper/SmsHelper.java
3cad637c1fc307113e4df52b3fbf4a40c2fc5ffe
[]
no_license
nrhappy/yeshenghuo
f983c54e27a1053c6574a08a9de6130a85b5163f
1ec9f89f632799175d454bf93c8d2015ca816651
refs/heads/master
2022-12-21T02:09:42.436800
2019-07-02T05:28:19
2019-07-02T05:28:19
194,793,965
0
0
null
2022-12-16T06:23:11
2019-07-02T05:28:40
JavaScript
UTF-8
Java
false
false
6,755
java
package cn.xjwlfw.yeshenghuo.system.helper; /** * Created by bingone on 15/12/16. */ import org.apache.http.HttpEntity; import org.apache.http.NameValuePair; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import java.io.IOException; import java.net.URISyntaxException; import java.net.URLEncoder; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 短信http接口的java代码调用示例 * 基于Apache HttpClient 4.3 * * @author songchao * @since 2015-04-03 */ public class SmsHelper { //查账户信息的http地址 private static String URI_GET_USER_INFO = "https://sms.yunpian.com/v2/user/get.json"; //智能匹配模版发送接口的http地址 private static String URI_SEND_SMS = "https://sms.yunpian.com/v2/sms/single_send.json"; //模板发送接口的http地址 private static String URI_TPL_SEND_SMS = "https://sms.yunpian.com/v2/sms/tpl_single_send.json"; //发送语音验证码接口的http地址 private static String URI_SEND_VOICE = "https://voice.yunpian.com/v2/voice/send.json"; //编码格式。发送编码格式统一用UTF-8 private static String ENCODING = "UTF-8"; public static void main(String[] args) throws IOException, URISyntaxException { //修改为您的apikey String apikey = "XXX"; //修改为您要发送的手机号 String mobile = URLEncoder.encode("15935020988",ENCODING); /**************** 查账户信息调用示例 *****************/ //System.out.println(SmsHelper.getUserInfo(apikey)); /**************** 使用智能匹配模版接口发短信(推荐) *****************/ //设置您要发送的内容(内容必须和某个模板匹配。以下例子匹配的是系统提供的1号模板) //String text = "【云片网】您的验证码是1234"; //发短信调用示例 //System.out.println(SmsHelper.sendSms(apikey, text, mobile)); /**************** 使用指定模板接口发短信(不推荐,建议使用智能匹配模版接口) *****************/ //设置模板ID,如使用1号模板:【#company#】您的验证码是#code# long tpl_id = 1; //设置对应的模板变量值 String tpl_value = URLEncoder.encode("#code#",ENCODING) +"=" + URLEncoder.encode("1234", ENCODING) + "&" + URLEncoder.encode("#company#",ENCODING) + "=" + URLEncoder.encode("云片网",ENCODING); //模板发送的调用示例 System.out.println(tpl_value); System.out.println(SmsHelper.tplSendSms(apikey, tpl_id, tpl_value, mobile)); /**************** 使用接口发语音验证码 *****************/ //String code = "1234"; //System.out.println(SmsHelper.sendVoice(apikey, mobile ,code)); } /** * 取账户信息 * * @return json格式字符串 * @throws java.io.IOException */ public static String getUserInfo(String apikey) throws IOException, URISyntaxException { Map<String, String> params = new HashMap<String, String>(); params.put("apikey", apikey); return post(URI_GET_USER_INFO, params); } /** * 智能匹配模版接口发短信 * * @param apikey apikey * @param text  短信内容 * @param mobile  接受的手机号 * @return json格式字符串 * @throws IOException */ public static String sendSms(String apikey, String text, String mobile) throws IOException { Map<String, String> params = new HashMap<String, String>(); params.put("apikey", apikey); params.put("text", text); params.put("mobile", mobile); return post(URI_SEND_SMS, params); } /** * 通过模板发送短信(不推荐) * * @param apikey apikey * @param tpl_id  模板id * @param tpl_value  模板变量值 * @param mobile  接受的手机号 * @return json格式字符串 * @throws IOException */ public static String tplSendSms(String apikey, long tpl_id, String tpl_value, String mobile) throws IOException { Map<String, String> params = new HashMap<String, String>(); params.put("apikey", apikey); params.put("tpl_id", String.valueOf(tpl_id)); params.put("tpl_value", tpl_value); params.put("mobile", mobile); return post(URI_TPL_SEND_SMS, params); } /** * 通过接口发送语音验证码 * @param apikey apikey * @param mobile 接收的手机号 * @param code 验证码 * @return */ public static String sendVoice(String apikey, String mobile, String code) { Map<String, String> params = new HashMap<String, String>(); params.put("apikey", apikey); params.put("mobile", mobile); params.put("code", code); return post(URI_SEND_VOICE, params); } /** * 基于HttpClient 4.3的通用POST方法 * * @param url 提交的URL * @param paramsMap 提交<参数,值>Map * @return 提交响应 */ public static String post(String url, Map<String, String> paramsMap) { CloseableHttpClient client = HttpClients.createDefault(); String responseText = ""; CloseableHttpResponse response = null; try { HttpPost method = new HttpPost(url); if (paramsMap != null) { List<NameValuePair> paramList = new ArrayList<NameValuePair>(); for (Map.Entry<String, String> param : paramsMap.entrySet()) { NameValuePair pair = new BasicNameValuePair(param.getKey(), param.getValue()); paramList.add(pair); } method.setEntity(new UrlEncodedFormEntity(paramList, ENCODING)); } response = client.execute(method); HttpEntity entity = response.getEntity(); if (entity != null) { responseText = EntityUtils.toString(entity); } } catch (Exception e) { e.printStackTrace(); } finally { try { response.close(); } catch (Exception e) { e.printStackTrace(); } } return responseText; } }
[ "106334940@qq.com" ]
106334940@qq.com
998017b1b5ccec4a4ee387582d868191f096b618
f3671cc91d01d1cca3257db847626971b7354bf3
/src/test/java/de/ruegnerlukas/simpleapplication/testapp/TestApplicationV2.java
950c3e634247712eb3dcd6790c3228cec0b2ec8c
[]
no_license
SMILEY4/SimpleApplication
8eda3966b48034abe27731ff2bb82481817dcc7d
152b127bf8a960da3b4164a5c1685289cd72da9d
refs/heads/develop
2022-11-24T10:28:30.484788
2020-11-30T21:14:57
2020-11-30T21:14:57
232,420,313
0
1
null
2022-11-15T23:54:24
2020-01-07T21:25:46
Java
UTF-8
Java
false
false
10,394
java
package de.ruegnerlukas.simpleapplication.testapp; import de.ruegnerlukas.simpleapplication.common.eventbus.EventBus; import de.ruegnerlukas.simpleapplication.common.eventbus.SubscriptionData; import de.ruegnerlukas.simpleapplication.common.instanceproviders.factories.StringFactory; import de.ruegnerlukas.simpleapplication.common.instanceproviders.providers.Provider; import de.ruegnerlukas.simpleapplication.common.tags.Tags; import de.ruegnerlukas.simpleapplication.common.utils.Pair; import de.ruegnerlukas.simpleapplication.core.application.Application; import de.ruegnerlukas.simpleapplication.core.application.ApplicationConfiguration; import de.ruegnerlukas.simpleapplication.core.application.ApplicationConstants; import de.ruegnerlukas.simpleapplication.core.plugins.Plugin; import de.ruegnerlukas.simpleapplication.core.plugins.PluginInformation; import de.ruegnerlukas.simpleapplication.core.simpleui.assets.SuiElements; import de.ruegnerlukas.simpleapplication.core.simpleui.assets.properties.misc.InjectionIndexMarker; import de.ruegnerlukas.simpleapplication.core.simpleui.core.SuiSceneController; import de.ruegnerlukas.simpleapplication.core.simpleui.core.node.NodeFactory; import de.ruegnerlukas.simpleapplication.core.simpleui.core.registry.SuiRegistry; import de.ruegnerlukas.simpleapplication.core.simpleui.core.state.SuiState; import javafx.geometry.Pos; import javafx.scene.control.Button; import javafx.scene.layout.Priority; import javafx.scene.paint.Color; import javafx.stage.Stage; import lombok.Getter; import lombok.Setter; import lombok.ToString; import lombok.extern.slf4j.Slf4j; import java.awt.Toolkit; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.UnsupportedFlavorException; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; import static de.ruegnerlukas.simpleapplication.core.simpleui.assets.SuiElements.button; import static de.ruegnerlukas.simpleapplication.core.simpleui.assets.SuiElements.colorPicker; import static de.ruegnerlukas.simpleapplication.core.simpleui.assets.SuiElements.component; import static de.ruegnerlukas.simpleapplication.core.simpleui.assets.SuiElements.hBox; import static de.ruegnerlukas.simpleapplication.core.simpleui.assets.SuiElements.label; import static de.ruegnerlukas.simpleapplication.core.simpleui.assets.SuiElements.scrollPane; import static de.ruegnerlukas.simpleapplication.core.simpleui.assets.SuiElements.slider; import static de.ruegnerlukas.simpleapplication.core.simpleui.assets.SuiElements.vBox; import static de.ruegnerlukas.simpleapplication.core.simpleui.core.node.WindowRootElement.windowRoot; public class TestApplicationV2 { public static void main(String[] args) { final ApplicationConfiguration configuration = new ApplicationConfiguration(); configuration.getPlugins().add(new EventLoggingPlugin()); configuration.getPlugins().add(new UIPlugin()); configuration.getProviderFactories().add(new StringFactory("application_name", "Test App V2")); new Application(configuration).run(); } @Getter @Setter @ToString private static class TestUIState extends SuiState { private boolean showPopupEnableAutosave = false; private boolean showPopupAlwaysOnTop = false; private List<Pair<String, Long>> content = new ArrayList<>(); } @Slf4j static class UIPlugin extends Plugin { public UIPlugin() { super(new PluginInformation("plugin.ui", "UI Plugin", "0.1", false)); } @Override public void onLoad() { final EventBus eventBus = new Provider<>(EventBus.class).get(); eventBus.subscribe( SubscriptionData.anyType(Tags.contains(ApplicationConstants.EVENT_APPLICATION_STARTED_TYPE)), e -> createViews(new Provider<Stage>(ApplicationConstants.PROVIDED_PRIMARY_STAGE).get())); } @Override public void onUnload() { } private void createViews(final Stage stage) { final TestUIState testUIState = new TestUIState(); final SuiSceneController controller = new SuiSceneController( testUIState, windowRoot(stage) .title("JFX Clipboard Testing") .size(400, 500) .content(TestUIState.class, UIPlugin::createUI) .modal(windowRoot() .title("NotImplemented: Enable Autosave") .size(400, 100) .condition(TestUIState.class, state -> state.showPopupEnableAutosave) .onClose(TestUIState.class, state -> state.setShowPopupEnableAutosave(false)) .content(TestUIState.class, state -> createPopupUI(state, "Enable Autosave"))) .modal(windowRoot() .title("NotImplemented: Always on top") .size(400, 100) .condition(TestUIState.class, state -> state.showPopupAlwaysOnTop) .onClose(TestUIState.class, state -> state.setShowPopupAlwaysOnTop(false)) .content(TestUIState.class, state -> createPopupUI(state, "Always on top"))) ); new Provider<>(SuiRegistry.class).get().inject("ij-point.toolbar", component(TestUIState.class, state -> button() .id("btn.enable-auto") .directFxNodeAccess( Button.class, fxNode -> System.out.println("on build " + fxNode.getText()), fxNode -> System.out.println("on mutate" + fxNode.getText())) .sizeMax(150, 30) .hGrow(Priority.ALWAYS) .textContent("Enable Autosave") .eventAction(".", e -> state.update(TestUIState.class, s -> s.setShowPopupEnableAutosave(true))))); new Provider<>(SuiRegistry.class).get().inject("ij-point.toolbar", component(TestUIState.class, state -> colorPicker() .id("cp.test") .eventSelectedColor(".", e -> System.out.println("color: " + e.getColor())) ) ); controller.show(); } private static NodeFactory createPopupUI(final TestUIState state, final String str) { return vBox() .items( label() .anchorsFitParent() .textContent("Not Implemented: " + str), slider() ); } private static NodeFactory createUI(final TestUIState state) { return vBox() .id("root") .fitToWidth() .items( hBox() .id("toolbar") .spacing(5) .backgroundSolid(Color.LIGHTGRAY) .sizeMin(0, 40) .sizeMax(100000, 40) .alignment(Pos.CENTER) .itemsInjectable( "ij-point.toolbar", InjectionIndexMarker.injectLast(), button() .id("btn.save") .sizeMax(150, 30) .hGrow(Priority.ALWAYS) .textContent("Save Clipboard") .eventAction(".", e -> saveClipboard(state)) ), scrollPane() .id("content.scroll") .sizePreferred(1000000, 1000000) .fitToWidth() .fitToHeight() .item( vBox() .id("content.box") .items(() -> { final List<NodeFactory> items = new ArrayList<>(); items.add( SuiElements.toggleGroup("toggle-group", s -> System.out.println("group: " + s)) ); items.add( SuiElements.toggleButton() .id("radio-1") .textContent("Radio 1") .checked(true) .toggleGroup("toggle-group") ); items.add( SuiElements.toggleButton() .id("radio-2") .textContent("Radio 2") .toggleGroup("toggle-group") ); items.add( SuiElements.toggleButton() .id("radio-3") .textContent("Radio 3") .toggleGroup("toggle-group") ); items.addAll(state.getContent().stream().map(e -> buildContentItem(state, e)).collect(Collectors.toList())); return items; }) ) ); } private static NodeFactory buildContentItem(final TestUIState state, final Pair<String, Long> content) { return hBox() .id("item-" + content.getLeft().hashCode() + "-" + content.getRight()) .sizeMax(1000000, 50) .sizeMin(0, 50) .alignment(Pos.CENTER_LEFT) .spacing(5) .items( label() .id("content.label") .sizePreferred(1000000, 45) .textContent(content.getLeft()), button() .id("content.copy") .textContent("C") .sizeMin(35, 35) .sizeMax(35, 35) .eventAction(".", e -> log.debug("NotImplemented: Copy content to clipboard")), button() .id("content.remove") .textContent("X") .sizeMin(35, 35) .sizeMax(35, 35) .eventAction(".", e -> removeClipboardItem(state, content)) ); } private static void saveClipboard(final TestUIState state) { state.update(TestUIState.class, s -> { try { final String data = (String) Toolkit.getDefaultToolkit().getSystemClipboard().getData(DataFlavor.stringFlavor); s.getContent().add(0, Pair.of(data, System.currentTimeMillis())); log.info("Clipboard saved: " + data.substring(0, Math.min(data.length(), 20))); } catch (UnsupportedFlavorException | IOException e) { log.warn("Error saving clipboard: {}", e.getMessage()); } }); } private static void removeClipboardItem(final TestUIState state, final Pair<String, Long> content) { state.update(TestUIState.class, s -> { s.getContent().removeIf( e -> e.getLeft().equals(content.getLeft()) && e.getRight().longValue() == content.getRight().longValue()); log.info("Content removed: " + content.getLeft().substring(0, Math.min(content.getLeft().length(), 20))); }); } } @Slf4j static class EventLoggingPlugin extends Plugin { public EventLoggingPlugin() { super(new PluginInformation("plugin.event-logging", "Event Logging Plugin", "0.1", false)); } @Override public void onLoad() { // log.info("LOGGING: onLoad {}.", getId()); final EventBus eventBus = new Provider<>(EventBus.class).get(); eventBus.subscribe(SubscriptionData.anyType(), this::onEvent); } private void onEvent(final Object event) { // log.info("LOGGING: event in channel='{}'", event); } @Override public void onUnload() { // log.info("LOGGING: onUnload {}.", getId()); } } }
[ "ruegnerlukas@gmail.com" ]
ruegnerlukas@gmail.com
82d8acb94e00b34515e4c7debbae87513b4a2cc4
aef6c4773dda4aa766df1f94b10ce9d0e06346e4
/src/main/java/com/lifeofcoder/asynctask/core/Typer.java
f1d09e762bc2f7aaa609c4d77cba13001f81c64a
[ "Apache-2.0" ]
permissive
zihai367/async-task
a10cef7e34bb259064a60a6fa6d1c10cf647ad77
ad938df18d87726c26c034c4a17c9e393a30c1d0
refs/heads/master
2023-03-17T17:28:39.885111
2020-09-04T02:22:03
2020-09-04T02:22:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
148
java
package com.lifeofcoder.asynctask.core; /** * 类型器 * * @author xbc * @date 2020/1/13 */ public interface Typer { String getType(); }
[ "hilaryfrank@126.com" ]
hilaryfrank@126.com
b348b134409a6a66f2a9524b9a6d6592e8a9eee8
4e2bbea7ffef04e9948057a6b6f73afc71685704
/src/main/java/collections/DuplicateItems.java
63cdf03ac8e406baecd5e0175372a8b18fc5216a
[]
no_license
SuneetaGangwar/java
0c67868584fa8802675f76e5c0d714e799882043
313c33711ddb68b8453a25a2861b395f256cd9c0
refs/heads/master
2020-04-03T07:17:15.566662
2019-08-13T17:27:56
2019-08-13T17:27:56
155,098,320
0
0
null
null
null
null
UTF-8
Java
false
false
2,367
java
package collections; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.Set; public class DuplicateItems { public static void main(String[] args) { retrieveValuesUsingHasTableMethod3(); } public static void retrieveValuesFromArrayMethod1() { // program1 : loop over an array and comparing each element to every other // element. // For doing this, we are using two loops, inner loop, and outer loop. Integer data[] = { 1, 2, 3, 6, 7, 1, 3, 9, 4 }; for (int a = 0; a < data.length; a++) { for (int b = a + 1; b < data.length; b++) { if (data[a].equals(data[b])) { System.out.print(data[a] + " "); } } } } public static void retrieveValuesUsingArrayListMethod2() { // program2 : loop over an arrayList and comparing each element to every other // element. // For doing this, we are using two loops, inner loop, and outer loop. ArrayList<Integer> data1 = new ArrayList<Integer>(); data1.add(1); data1.add(2); data1.add(1); data1.add(4); data1.add(2); /* * Iterator<Integer> iter = data1.iterator(); while (iter.hasNext()) { * System.out.print(iter.next()); * * } */ for (int a = 0; a < data1.size(); a++) { for (int b = a + 1; b < data1.size(); b++) { if (data1.get(a).equals(data1.get(b))) { System.out.println("duplicate values are: " + data1.get(a) + " "); } } } } public static void retrieveValuesUsingHasTableMethod3() { Integer data[] = { 1, 2, 3, 6, 7, 1, 3, 9, 4 }; // Third solution : using Hash map data structure to find duplicates System.out.println("Duplicate elements from array using hash map"); Map<Integer, Integer> valuesAndCount = new HashMap(); for (Integer key : data) { Integer count = valuesAndCount.get(key); if (count == null) { valuesAndCount.put(key, 1); } else { valuesAndCount.put(key, ++count); } } System.out.println(valuesAndCount.entrySet()); valuesAndCount.forEach((x, y) -> { if (y > 1) { System.out.println("Duplicate element: " + x); } }); // Set<Entry<Integer, Integer>> entryset = valuesAndCount.entrySet(); // for (Entry<Integer, Integer> entry : entryset) { // if (entry.getValue() > 1) { // System.out.println("Duplicate element: " + entry.getKey()); // } // } } }
[ "suneeta.gangwar@gmail.com" ]
suneeta.gangwar@gmail.com
f7e22793824afde4f479c2643430f5ebab5cc2a5
bb26c681e0485e27625bcfd030cfcdf36708a478
/app/src/main/java/com/toda/onefineday/views/OneDayActivity.java
bfe0a2804ed1b909f1d4450d41f37809598b04e2
[]
no_license
fpgeek/OneFineDay
d91939d1a4fc6bdd9b5ec704247772d2e184ad54
59c0551054bcec186edcb6adfb26b30b8fd34690
refs/heads/master
2021-01-25T08:54:11.467495
2014-05-25T08:08:04
2014-05-25T08:08:04
17,537,974
1
0
null
null
null
null
UTF-8
Java
false
false
15,208
java
package com.toda.onefineday.views; import android.app.ActionBar; import android.app.ListFragment; import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.database.sqlite.SQLiteDatabase; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.os.Parcelable; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentStatePagerAdapter; import android.support.v4.view.ViewPager; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.GridView; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; import com.toda.onefineday.R; import com.toda.onefineday.models.Picture; import com.toda.onefineday.models.db.DailyInfo; import com.toda.onefineday.models.db.DailyInfoDbHelper; import com.toda.onefineday.models.PictureGroup; import com.toda.onefineday.utils.TextViewUtil; import java.io.File; public class OneDayActivity extends FragmentActivity { private final static int REQUEST_CODE_TO_WRITE_ACTIVITY = 10; public final static int RESULT_CODE_FROM_ONE_DAY_ACTIVITY = 11; public final static String INTENT_EXTRA_NAME = "updatePictureGroup"; private static PlaceholderFragment placeholderFragment = null; private static Integer[] STICKER_IMAGE_IDS = { R.drawable.sticker_1, R.drawable.sticker_2, R.drawable.sticker_3, R.drawable.sticker_4, R.drawable.sticker_11, R.drawable.sticker_13, R.drawable.sticker_6, R.drawable.sticker_7, R.drawable.sticker_8, R.drawable.sticker_10 }; private static final int STICKER_COUNT_PER_SCREEN = 10; private DailyInfoDbHelper dbHelper = null; private static ImageListLoader mImageListLoader; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_daily); dbHelper = new DailyInfoDbHelper(this); mImageListLoader = new ImageListLoader(this); if (savedInstanceState == null) { placeholderFragment = new PlaceholderFragment(); getFragmentManager().beginTransaction() .add(R.id.container, placeholderFragment) .commit(); } } private void initActionBar() { ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.setDisplayShowCustomEnabled(true); actionBar.setDisplayShowTitleEnabled(false); RelativeLayout relativeLayout = (RelativeLayout)getLayoutInflater().inflate(R.layout.important_in_actionbar, null, false); actionBar.setCustomView(relativeLayout); } } @Override public void onBackPressed() { Intent intent = new Intent(); intent.putExtra(INTENT_EXTRA_NAME, (Parcelable)placeholderFragment.getPictureGroup()); setResult(RESULT_CODE_FROM_ONE_DAY_ACTIVITY, intent); super.onBackPressed(); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.daily, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. switch (item.getItemId()) { case R.id.action_share: moveToShareActivity(); return true; case R.id.action_sticker: toggelStickerView(); return true; case R.id.action_edit: openEditView(); return true; default: return super.onOptionsItemSelected(item); } } private void moveToShareActivity() { Intent intent = new Intent(this, MiniPicturesActivity.class); intent.putExtra(getString(R.string.extra_daily_data_array), (Parcelable)this.placeholderFragment.getPictureGroup()); startActivity(intent); } private void toggelStickerView() { if (this.placeholderFragment.getStickerViewPager().getVisibility() == View.VISIBLE) { closeStickerView(); } else { openStickerView(); } } private void openStickerView() { this.placeholderFragment.getStickerViewPager().setVisibility(View.VISIBLE); } private void closeStickerView() { this.placeholderFragment.getStickerViewPager().setVisibility(View.GONE); } private void openEditView() { Intent intent = new Intent(this, WriteActivity.class); intent.putExtra(getString(R.string.EXTRA_DAILY_GROUP_ID), this.placeholderFragment.getPictureGroup().getId()); intent.putExtra(getString(R.string.EXTRA_DAIRY_TEXT), this.placeholderFragment.getPictureGroup().getDairyText()); startActivityForResult(intent, REQUEST_CODE_TO_WRITE_ACTIVITY); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_CODE_TO_WRITE_ACTIVITY && resultCode == WriteActivity.RESULT_CODE_FROM_WRITE_ACTIVITY) { String dairyText = data.getStringExtra(WriteActivity.INTENT_EXTRA_UPDATE_DAIRY_TEXT_NAME); placeholderFragment.getPictureGroup().setDairyText(dairyText); TextViewUtil.setText(placeholderFragment.getDiaryTextView(), dairyText); } } /** * A placeholder fragment containing a simple view. */ public class PlaceholderFragment extends ListFragment { private PictureGroup mPictureGroup; private View mHeaderView; private ViewPager mStickerViewPager = null; private StickerCollectionPagerAdapter mStickerCollectionPagerAdapter = null; private TextView mDairyTextView = null; public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_daily, container, false); Parcelable parcelable = getActivity().getIntent().getParcelableExtra( getString(R.string.extra_daily_data_array) ); mPictureGroup = (PictureGroup)parcelable; ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.setTitle(mPictureGroup.getMainPicture().getDateText()); if (mPictureGroup.hasSticker()) { actionBar.setIcon(mPictureGroup.getSticker()); } } mHeaderView = inflater.inflate(R.layout.daily_header, null, false); mDairyTextView = (TextView) mHeaderView.findViewById(R.id.dairy_text); TextViewUtil.setText(mDairyTextView, mPictureGroup.getDairyText()); mStickerViewPager = (ViewPager)rootView.findViewById(R.id.sticker_view_pager); mStickerCollectionPagerAdapter = new StickerCollectionPagerAdapter( ((FragmentActivity)getActivity()).getSupportFragmentManager() ); mStickerViewPager.setAdapter(mStickerCollectionPagerAdapter); return rootView; } AdapterView.OnItemClickListener itemClickListener = new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { int index = (i - 1); if (0 <= index && index < mPictureGroup.size()) { Picture picture = mPictureGroup.get(i-1); if (picture != null) { Intent intent = new Intent(Intent.ACTION_VIEW); if (picture.getType() == Picture.TYPE_IMAGE) { Uri uri = Uri.fromFile(new File(picture.getFilePath())); intent.setDataAndType(uri, "image/*"); } else { Uri uri = Uri.parse(picture.getFilePath()); intent.setDataAndType(uri, "video/*"); } startActivity(intent); } } } }; @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (mHeaderView != null) { getListView().addHeaderView(mHeaderView); } getListView().setOnItemClickListener(itemClickListener); OneDayAdapter listAdapter = new OneDayAdapter(getActivity(), mPictureGroup, mImageListLoader); setListAdapter(listAdapter); } @Override public void onStart() { super.onStart(); } @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.daily, menu); } public PictureGroup getPictureGroup() { return mPictureGroup; } public ViewPager getStickerViewPager() { return mStickerViewPager; } public TextView getDiaryTextView() { return mDairyTextView; } } public class StickerCollectionPagerAdapter extends FragmentStatePagerAdapter { public StickerCollectionPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int i) { Fragment fragment = new StickerImageFragment(); Bundle args = new Bundle(); args.putInt(StickerImageFragment.ARG_OBJECT, i); fragment.setArguments(args); return fragment; } @Override public int getCount() { return (STICKER_IMAGE_IDS.length / (STICKER_COUNT_PER_SCREEN + 1)) + 1; } // @Override // public CharSequence getPageTitle(int position) { // return super.getPageTitle(position); // } } public class StickerImageFragment extends Fragment implements AdapterView.OnItemClickListener { public static final String ARG_OBJECT = "StickerImageObject"; private int imageIndex = 0; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { GridView gridView = (GridView)inflater.inflate(R.layout.fragment_sticker, container, false); Bundle args = getArguments(); imageIndex = args.getInt(ARG_OBJECT); gridView.setAdapter(new ImageAdapter(this.getActivity(), imageIndex)); gridView.setOnItemClickListener(this); return gridView; } @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { final int sticker = STICKER_IMAGE_IDS[i + (imageIndex * STICKER_COUNT_PER_SCREEN)]; if (sticker == R.drawable.sticker_10) { new SaveStickerTask(placeholderFragment.getPictureGroup().getId()).execute(0); } else { new SaveStickerTask(placeholderFragment.getPictureGroup().getId()).execute(sticker); } } } private class SaveStickerTask extends AsyncTask<Integer, Void, Boolean> { private long rowId; private int stickerImageId; public SaveStickerTask(long rowId) { this.rowId = rowId; } @Override protected Boolean doInBackground(Integer... integers) { stickerImageId = integers[0]; SQLiteDatabase db = dbHelper.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(DailyInfo.DailyEntry.COLUMN_NAME_STICKER, stickerImageId); String selection = DailyInfo.DailyEntry._ID + " = ?"; String[] selectionArgs = { String.valueOf(rowId) }; assert db != null; int count = db.update( DailyInfo.DailyEntry.TABLE_NAME, values, selection, selectionArgs ); db.close(); return count == 1; } @Override protected void onPostExecute(Boolean updateSuccess) { super.onPostExecute(updateSuccess); if (updateSuccess) { placeholderFragment.getPictureGroup().setSticker(stickerImageId); ActionBar actionBar = getActionBar(); if (actionBar != null) { if (stickerImageId == 0) { actionBar.setDisplayShowHomeEnabled(false); } else { actionBar.setDisplayShowHomeEnabled(true); actionBar.setIcon(stickerImageId); } } closeStickerView(); } } } public static class ImageAdapter extends BaseAdapter { private Context context; private int index; public ImageAdapter(Context c, int index) { context = c; this.index = index; } @Override public int getCount() { if (STICKER_COUNT_PER_SCREEN * (index + 1) <= STICKER_IMAGE_IDS.length) { return STICKER_COUNT_PER_SCREEN; } else { return (STICKER_IMAGE_IDS.length % STICKER_COUNT_PER_SCREEN); } } @Override public Object getItem(int i) { return null; } @Override public long getItemId(int i) { return 0; } @Override public View getView(int position, View convertView, ViewGroup viewGroup) { final int imageIndex = position + (index * STICKER_COUNT_PER_SCREEN); if (STICKER_IMAGE_IDS.length <= imageIndex) { return null; } ImageView imageView; if (convertView == null) { imageView = new ImageView(context); imageView.setLayoutParams(new GridView.LayoutParams(85, 85)); imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE); imageView.setPadding(8, 8, 8, 8); } else { imageView = (ImageView) convertView; } imageView.setImageResource( STICKER_IMAGE_IDS[position + (index * STICKER_COUNT_PER_SCREEN)] ); imageView.setVisibility(View.VISIBLE); return imageView; } } }
[ "fpgeek82@daumcorp.com" ]
fpgeek82@daumcorp.com
e20a3a5780900200fb1494d9c9e33452a651cd5e
04f0495d1d523fc51399962ddfcbe2762131ac7f
/src/main/java/edu/neumont/diyauto/Framework/RequestServletInjectingServletListener.java
cb9f34a06f8e4d9a7103afd0e75dd6687f3896c7
[]
no_license
DIYAutomotive/DIYAutomotive
2b7590cf6f6cbc2a625194c8f61822f998c3f78c
10e1b9276b711c9549d9c749fe28ef62f578648d
refs/heads/master
2021-01-01T06:33:55.619654
2014-06-13T18:32:56
2014-06-13T18:32:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,056
java
package edu.neumont.diyauto.Framework; import javax.enterprise.context.RequestScoped; import javax.enterprise.inject.Produces; import javax.inject.Named; import javax.servlet.ServletRequestEvent; import javax.servlet.ServletRequestListener; import javax.servlet.annotation.WebListener; import javax.servlet.http.HttpServletRequest; /** * Created by jjensen on 6/6/14. */ //@WebListener public class RequestServletInjectingServletListener implements ServletRequestListener { private static final ThreadLocal<HttpServletRequest> requestHolder = new ThreadLocal<>(); @Override public void requestDestroyed(ServletRequestEvent arg0) { requestHolder.remove(); } @Override public void requestInitialized(ServletRequestEvent arg0) { requestHolder.set((HttpServletRequest)arg0.getServletRequest()); } // @Produces @Named("innerRequest") // @RequestScoped // public HttpServletRequest getInstance() { // return requestHolder.get(); // } }
[ "haiyun211@gmail.com" ]
haiyun211@gmail.com
ca0b33c07588e33b5ee88bc7b9bbd8b00ac5ec5c
33534dc18455dcbf54ef0e34f72b900e1e8354ec
/lt_woyl/src/main/java/com/woyl/lt_woyl/view/cardview/RoundRectDrawable.java
19753125fbc465c085bd22f47a289776767a8923
[]
no_license
woyl/public_tools
be4aadd8326b113f840e2d4910c47056fc422e61
fb4f2b8a8263e220b38f2b1a7e195af013edafe0
refs/heads/master
2021-11-28T20:13:43.329749
2021-11-17T06:15:18
2021-11-17T06:15:18
225,810,839
0
0
null
null
null
null
UTF-8
Java
false
false
7,409
java
/* * Copyright (C) 2014 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.woyl.lt_woyl.view.cardview; import android.content.res.ColorStateList; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.ColorFilter; import android.graphics.Outline; import android.graphics.Paint; import android.graphics.PixelFormat; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.Rect; import android.graphics.RectF; import android.graphics.drawable.Drawable; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.RequiresApi; /** * Very simple drawable that draws a rounded rectangle background with arbitrary corners and also reports proper outline * for Lollipop. * <p> * Simpler and uses less resources compared to GradientDrawable or ShapeDrawable. */ @RequiresApi(21) class RoundRectDrawable extends Drawable { private static final double COS_45 = Math.cos(Math.toRadians(45)); private static final float SHADOW_MULTIPLIER = 1.5f; private final Paint mPaint; private final RectF mBoundsF; private final Rect mBoundsI; private float mRadius; private float mPadding; private boolean mInsetForPadding = false; private boolean mInsetForRadius = true; private ColorStateList mBackground; private PorterDuffColorFilter mTintFilter; private ColorStateList mTint; private PorterDuff.Mode mTintMode = PorterDuff.Mode.SRC_IN; RoundRectDrawable(ColorStateList backgroundColor, float radius) { mRadius = radius; mPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG); setBackground(backgroundColor); mBoundsF = new RectF(); mBoundsI = new Rect(); } private float calculateVerticalPadding(float maxShadowSize, float cornerRadius, boolean addPaddingForCorners) { if (addPaddingForCorners) { return (float) (maxShadowSize * SHADOW_MULTIPLIER + (1 - COS_45) * cornerRadius); } else { return maxShadowSize * SHADOW_MULTIPLIER; } } private float calculateHorizontalPadding(float maxShadowSize, float cornerRadius, boolean addPaddingForCorners) { if (addPaddingForCorners) { return (float) (maxShadowSize + (1 - COS_45) * cornerRadius); } else { return maxShadowSize; } } private void setBackground(ColorStateList color) { mBackground = (color == null) ? ColorStateList.valueOf(Color.TRANSPARENT) : color; mPaint.setColor(mBackground.getColorForState(getState(), mBackground.getDefaultColor())); } void setPadding(float padding, boolean insetForPadding, boolean insetForRadius) { if (padding == mPadding && mInsetForPadding == insetForPadding && mInsetForRadius == insetForRadius) { return; } mPadding = padding; mInsetForPadding = insetForPadding; mInsetForRadius = insetForRadius; updateBounds(null); invalidateSelf(); } float getPadding() { return mPadding; } @Override public void draw(@NonNull Canvas canvas) { final Paint paint = mPaint; final boolean clearColorFilter; if (mTintFilter != null && paint.getColorFilter() == null) { paint.setColorFilter(mTintFilter); clearColorFilter = true; } else { clearColorFilter = false; } canvas.drawRoundRect(mBoundsF, mRadius, mRadius, paint); if (clearColorFilter) { paint.setColorFilter(null); } } private void updateBounds(Rect bounds) { if (bounds == null) { bounds = getBounds(); } mBoundsF.set(bounds.left, bounds.top, bounds.right, bounds.bottom); mBoundsI.set(bounds); if (mInsetForPadding) { float vInset = calculateVerticalPadding(mPadding, mRadius, mInsetForRadius); float hInset = calculateHorizontalPadding(mPadding, mRadius, mInsetForRadius); mBoundsI.inset((int) Math.ceil(hInset), (int) Math.ceil(vInset)); // to make sure they have same bounds. mBoundsF.set(mBoundsI); } } @Override protected void onBoundsChange(Rect bounds) { super.onBoundsChange(bounds); updateBounds(bounds); } @Override public void getOutline(@NonNull Outline outline) { outline.setRoundRect(mBoundsI, mRadius); } @Override public void setAlpha(int alpha) { mPaint.setAlpha(alpha); } @Override public void setColorFilter(ColorFilter cf) { mPaint.setColorFilter(cf); } @Override public int getOpacity() { return PixelFormat.TRANSLUCENT; } public float getRadius() { return mRadius; } void setRadius(float radius) { if (radius == mRadius) { return; } mRadius = radius; updateBounds(null); invalidateSelf(); } public ColorStateList getColor() { return mBackground; } public void setColor(@Nullable ColorStateList color) { setBackground(color); invalidateSelf(); } @Override public void setTintList(ColorStateList tint) { mTint = tint; mTintFilter = createTintFilter(mTint, mTintMode); invalidateSelf(); } @Override public void setTintMode(@NonNull PorterDuff.Mode tintMode) { mTintMode = tintMode; mTintFilter = createTintFilter(mTint, mTintMode); invalidateSelf(); } @Override protected boolean onStateChange(int[] stateSet) { final int newColor = mBackground.getColorForState(stateSet, mBackground.getDefaultColor()); final boolean colorChanged = newColor != mPaint.getColor(); if (colorChanged) { mPaint.setColor(newColor); } if (mTint != null && mTintMode != null) { mTintFilter = createTintFilter(mTint, mTintMode); return true; } return colorChanged; } @Override public boolean isStateful() { return (mTint != null && mTint.isStateful()) || (mBackground != null && mBackground.isStateful()) || super.isStateful(); } /** * Ensures the tint filter is consistent with the current tint color and mode. */ private PorterDuffColorFilter createTintFilter(ColorStateList tint, PorterDuff.Mode tintMode) { if (tint == null || tintMode == null) { return null; } final int color = tint.getColorForState(getState(), Color.TRANSPARENT); return new PorterDuffColorFilter(color, tintMode); } }
[ "676051397@qq.com" ]
676051397@qq.com
b59f7354faa602c18f2a28bddb4213dbb9f6a45e
9d32980f5989cd4c55cea498af5d6a413e08b7a2
/A92s_10_0_0/src/main/java/com/android/server/textclassifier/TextClassificationManagerService.java
98a7c587375ae6dfde742e1046378a6edf41f88f
[]
no_license
liuhaosource/OppoFramework
e7cc3bcd16958f809eec624b9921043cde30c831
ebe39acabf5eae49f5f991c5ce677d62b683f1b6
refs/heads/master
2023-06-03T23:06:17.572407
2020-11-30T08:40:07
2020-11-30T08:40:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
33,574
java
package com.android.server.textclassifier; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.os.Binder; import android.os.IBinder; import android.os.RemoteException; import android.os.UserHandle; import android.service.textclassifier.ITextClassifierCallback; import android.service.textclassifier.ITextClassifierService; import android.service.textclassifier.TextClassifierService; import android.util.ArrayMap; import android.util.Slog; import android.util.SparseArray; import android.view.textclassifier.ConversationActions; import android.view.textclassifier.SelectionEvent; import android.view.textclassifier.TextClassification; import android.view.textclassifier.TextClassificationContext; import android.view.textclassifier.TextClassificationManager; import android.view.textclassifier.TextClassificationSessionId; import android.view.textclassifier.TextClassifierEvent; import android.view.textclassifier.TextLanguage; import android.view.textclassifier.TextLinks; import android.view.textclassifier.TextSelection; import com.android.internal.annotations.GuardedBy; import com.android.internal.util.DumpUtils; import com.android.internal.util.FunctionalUtils; import com.android.internal.util.IndentingPrintWriter; import com.android.internal.util.Preconditions; import com.android.server.SystemService; import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.Map; import java.util.Objects; import java.util.Queue; import java.util.function.Consumer; public final class TextClassificationManagerService extends ITextClassifierService.Stub { private static final String LOG_TAG = "TextClassificationManagerService"; private final Context mContext; /* access modifiers changed from: private */ public final Object mLock; @GuardedBy({"mLock"}) private final Map<TextClassificationSessionId, Integer> mSessionUserIds; @GuardedBy({"mLock"}) final SparseArray<UserState> mUserStates; public static final class Lifecycle extends SystemService { private final TextClassificationManagerService mManagerService; public Lifecycle(Context context) { super(context); this.mManagerService = new TextClassificationManagerService(context); } /* JADX WARN: Type inference failed for: r1v1, types: [com.android.server.textclassifier.TextClassificationManagerService, android.os.IBinder] */ @Override // com.android.server.SystemService public void onStart() { try { publishBinderService("textclassification", this.mManagerService); } catch (Throwable t) { Slog.e(TextClassificationManagerService.LOG_TAG, "Could not start the TextClassificationManagerService.", t); } } @Override // com.android.server.SystemService public void onStartUser(int userId) { processAnyPendingWork(userId); } @Override // com.android.server.SystemService public void onUnlockUser(int userId) { processAnyPendingWork(userId); } private void processAnyPendingWork(int userId) { synchronized (this.mManagerService.mLock) { boolean unused = this.mManagerService.getUserStateLocked(userId).bindIfHasPendingRequestsLocked(); } } @Override // com.android.server.SystemService public void onStopUser(int userId) { synchronized (this.mManagerService.mLock) { UserState userState = this.mManagerService.peekUserStateLocked(userId); if (userState != null) { userState.mConnection.cleanupService(); this.mManagerService.mUserStates.remove(userId); } } } } private TextClassificationManagerService(Context context) { this.mUserStates = new SparseArray<>(); this.mSessionUserIds = new ArrayMap(); this.mContext = (Context) Preconditions.checkNotNull(context); this.mLock = new Object(); } /* renamed from: onSuggestSelection */ public void lambda$onSuggestSelection$0$TextClassificationManagerService(TextClassificationSessionId sessionId, TextSelection.Request request, ITextClassifierCallback callback) throws RemoteException { Preconditions.checkNotNull(request); Preconditions.checkNotNull(callback); int userId = request.getUserId(); validateInput(this.mContext, request.getCallingPackageName(), userId); synchronized (this.mLock) { UserState userState = getUserStateLocked(userId); if (!userState.bindLocked()) { callback.onFailure(); } else if (userState.isBoundLocked()) { userState.mService.onSuggestSelection(sessionId, request, callback); } else { Queue<PendingRequest> queue = userState.mPendingRequests; $$Lambda$TextClassificationManagerService$Fy5j26FLkbnEPhoh1kWzQnYhcm8 r4 = new FunctionalUtils.ThrowingRunnable(sessionId, request, callback) { /* class com.android.server.textclassifier.$$Lambda$TextClassificationManagerService$Fy5j26FLkbnEPhoh1kWzQnYhcm8 */ private final /* synthetic */ TextClassificationSessionId f$1; private final /* synthetic */ TextSelection.Request f$2; private final /* synthetic */ ITextClassifierCallback f$3; { this.f$1 = r2; this.f$2 = r3; this.f$3 = r4; } public final void runOrThrow() { TextClassificationManagerService.this.lambda$onSuggestSelection$0$TextClassificationManagerService(this.f$1, this.f$2, this.f$3); } }; Objects.requireNonNull(callback); queue.add(new PendingRequest(r4, new FunctionalUtils.ThrowingRunnable(callback) { /* class com.android.server.textclassifier.$$Lambda$k7KcqZH2A0AukChaKa6Xru13_Q */ private final /* synthetic */ ITextClassifierCallback f$0; { this.f$0 = r1; } public final void runOrThrow() { this.f$0.onFailure(); } }, callback.asBinder(), this, userState)); } } } /* renamed from: onClassifyText */ public void lambda$onClassifyText$1$TextClassificationManagerService(TextClassificationSessionId sessionId, TextClassification.Request request, ITextClassifierCallback callback) throws RemoteException { Preconditions.checkNotNull(request); Preconditions.checkNotNull(callback); int userId = request.getUserId(); validateInput(this.mContext, request.getCallingPackageName(), userId); synchronized (this.mLock) { UserState userState = getUserStateLocked(userId); if (!userState.bindLocked()) { callback.onFailure(); } else if (userState.isBoundLocked()) { userState.mService.onClassifyText(sessionId, request, callback); } else { Queue<PendingRequest> queue = userState.mPendingRequests; $$Lambda$TextClassificationManagerService$aNIcwykiT4wOQ8InWE4Im6x6kE r4 = new FunctionalUtils.ThrowingRunnable(sessionId, request, callback) { /* class com.android.server.textclassifier.$$Lambda$TextClassificationManagerService$aNIcwykiT4wOQ8InWE4Im6x6kE */ private final /* synthetic */ TextClassificationSessionId f$1; private final /* synthetic */ TextClassification.Request f$2; private final /* synthetic */ ITextClassifierCallback f$3; { this.f$1 = r2; this.f$2 = r3; this.f$3 = r4; } public final void runOrThrow() { TextClassificationManagerService.this.lambda$onClassifyText$1$TextClassificationManagerService(this.f$1, this.f$2, this.f$3); } }; Objects.requireNonNull(callback); queue.add(new PendingRequest(r4, new FunctionalUtils.ThrowingRunnable(callback) { /* class com.android.server.textclassifier.$$Lambda$k7KcqZH2A0AukChaKa6Xru13_Q */ private final /* synthetic */ ITextClassifierCallback f$0; { this.f$0 = r1; } public final void runOrThrow() { this.f$0.onFailure(); } }, callback.asBinder(), this, userState)); } } } /* renamed from: onGenerateLinks */ public void lambda$onGenerateLinks$2$TextClassificationManagerService(TextClassificationSessionId sessionId, TextLinks.Request request, ITextClassifierCallback callback) throws RemoteException { Preconditions.checkNotNull(request); Preconditions.checkNotNull(callback); int userId = request.getUserId(); validateInput(this.mContext, request.getCallingPackageName(), userId); synchronized (this.mLock) { UserState userState = getUserStateLocked(userId); if (!userState.bindLocked()) { callback.onFailure(); } else if (userState.isBoundLocked()) { userState.mService.onGenerateLinks(sessionId, request, callback); } else { Queue<PendingRequest> queue = userState.mPendingRequests; $$Lambda$TextClassificationManagerService$1N5hVEvgYS5VzkBAP5HLq01CQI r4 = new FunctionalUtils.ThrowingRunnable(sessionId, request, callback) { /* class com.android.server.textclassifier.$$Lambda$TextClassificationManagerService$1N5hVEvgYS5VzkBAP5HLq01CQI */ private final /* synthetic */ TextClassificationSessionId f$1; private final /* synthetic */ TextLinks.Request f$2; private final /* synthetic */ ITextClassifierCallback f$3; { this.f$1 = r2; this.f$2 = r3; this.f$3 = r4; } public final void runOrThrow() { TextClassificationManagerService.this.lambda$onGenerateLinks$2$TextClassificationManagerService(this.f$1, this.f$2, this.f$3); } }; Objects.requireNonNull(callback); queue.add(new PendingRequest(r4, new FunctionalUtils.ThrowingRunnable(callback) { /* class com.android.server.textclassifier.$$Lambda$k7KcqZH2A0AukChaKa6Xru13_Q */ private final /* synthetic */ ITextClassifierCallback f$0; { this.f$0 = r1; } public final void runOrThrow() { this.f$0.onFailure(); } }, callback.asBinder(), this, userState)); } } } /* renamed from: onSelectionEvent */ public void lambda$onSelectionEvent$3$TextClassificationManagerService(TextClassificationSessionId sessionId, SelectionEvent event) throws RemoteException { Preconditions.checkNotNull(event); int userId = event.getUserId(); validateInput(this.mContext, event.getPackageName(), userId); synchronized (this.mLock) { UserState userState = getUserStateLocked(userId); if (userState.isBoundLocked()) { userState.mService.onSelectionEvent(sessionId, event); } else { userState.mPendingRequests.add(new PendingRequest(new FunctionalUtils.ThrowingRunnable(sessionId, event) { /* class com.android.server.textclassifier.$$Lambda$TextClassificationManagerService$Xo8FJ3LmQoamgJ2foxZOcSn70c */ private final /* synthetic */ TextClassificationSessionId f$1; private final /* synthetic */ SelectionEvent f$2; { this.f$1 = r2; this.f$2 = r3; } public final void runOrThrow() { TextClassificationManagerService.this.lambda$onSelectionEvent$3$TextClassificationManagerService(this.f$1, this.f$2); } }, null, null, this, userState)); } } } /* renamed from: onTextClassifierEvent */ public void lambda$onTextClassifierEvent$4$TextClassificationManagerService(TextClassificationSessionId sessionId, TextClassifierEvent event) throws RemoteException { String packageName; int userId; Preconditions.checkNotNull(event); if (event.getEventContext() == null) { packageName = null; } else { packageName = event.getEventContext().getPackageName(); } if (event.getEventContext() == null) { userId = UserHandle.getCallingUserId(); } else { userId = event.getEventContext().getUserId(); } validateInput(this.mContext, packageName, userId); synchronized (this.mLock) { UserState userState = getUserStateLocked(userId); if (userState.isBoundLocked()) { userState.mService.onTextClassifierEvent(sessionId, event); } else { userState.mPendingRequests.add(new PendingRequest(new FunctionalUtils.ThrowingRunnable(sessionId, event) { /* class com.android.server.textclassifier.$$Lambda$TextClassificationManagerService$sMLFGuslbXgLyLQJD4NeR5KkZn0 */ private final /* synthetic */ TextClassificationSessionId f$1; private final /* synthetic */ TextClassifierEvent f$2; { this.f$1 = r2; this.f$2 = r3; } public final void runOrThrow() { TextClassificationManagerService.this.lambda$onTextClassifierEvent$4$TextClassificationManagerService(this.f$1, this.f$2); } }, null, null, this, userState)); } } } /* renamed from: onDetectLanguage */ public void lambda$onDetectLanguage$5$TextClassificationManagerService(TextClassificationSessionId sessionId, TextLanguage.Request request, ITextClassifierCallback callback) throws RemoteException { Preconditions.checkNotNull(request); Preconditions.checkNotNull(callback); int userId = request.getUserId(); validateInput(this.mContext, request.getCallingPackageName(), userId); synchronized (this.mLock) { UserState userState = getUserStateLocked(userId); if (!userState.bindLocked()) { callback.onFailure(); } else if (userState.isBoundLocked()) { userState.mService.onDetectLanguage(sessionId, request, callback); } else { Queue<PendingRequest> queue = userState.mPendingRequests; $$Lambda$TextClassificationManagerService$yB5oS3bxsmWcPiI9f0QxOl0chLs r4 = new FunctionalUtils.ThrowingRunnable(sessionId, request, callback) { /* class com.android.server.textclassifier.$$Lambda$TextClassificationManagerService$yB5oS3bxsmWcPiI9f0QxOl0chLs */ private final /* synthetic */ TextClassificationSessionId f$1; private final /* synthetic */ TextLanguage.Request f$2; private final /* synthetic */ ITextClassifierCallback f$3; { this.f$1 = r2; this.f$2 = r3; this.f$3 = r4; } public final void runOrThrow() { TextClassificationManagerService.this.lambda$onDetectLanguage$5$TextClassificationManagerService(this.f$1, this.f$2, this.f$3); } }; Objects.requireNonNull(callback); queue.add(new PendingRequest(r4, new FunctionalUtils.ThrowingRunnable(callback) { /* class com.android.server.textclassifier.$$Lambda$k7KcqZH2A0AukChaKa6Xru13_Q */ private final /* synthetic */ ITextClassifierCallback f$0; { this.f$0 = r1; } public final void runOrThrow() { this.f$0.onFailure(); } }, callback.asBinder(), this, userState)); } } } /* renamed from: onSuggestConversationActions */ public void lambda$onSuggestConversationActions$6$TextClassificationManagerService(TextClassificationSessionId sessionId, ConversationActions.Request request, ITextClassifierCallback callback) throws RemoteException { Preconditions.checkNotNull(request); Preconditions.checkNotNull(callback); int userId = request.getUserId(); validateInput(this.mContext, request.getCallingPackageName(), userId); synchronized (this.mLock) { UserState userState = getUserStateLocked(userId); if (!userState.bindLocked()) { callback.onFailure(); } else if (userState.isBoundLocked()) { userState.mService.onSuggestConversationActions(sessionId, request, callback); } else { Queue<PendingRequest> queue = userState.mPendingRequests; $$Lambda$TextClassificationManagerService$8JdB0qZEYuRmsTmNRpxWLWnRgs r4 = new FunctionalUtils.ThrowingRunnable(sessionId, request, callback) { /* class com.android.server.textclassifier.$$Lambda$TextClassificationManagerService$8JdB0qZEYuRmsTmNRpxWLWnRgs */ private final /* synthetic */ TextClassificationSessionId f$1; private final /* synthetic */ ConversationActions.Request f$2; private final /* synthetic */ ITextClassifierCallback f$3; { this.f$1 = r2; this.f$2 = r3; this.f$3 = r4; } public final void runOrThrow() { TextClassificationManagerService.this.lambda$onSuggestConversationActions$6$TextClassificationManagerService(this.f$1, this.f$2, this.f$3); } }; Objects.requireNonNull(callback); queue.add(new PendingRequest(r4, new FunctionalUtils.ThrowingRunnable(callback) { /* class com.android.server.textclassifier.$$Lambda$k7KcqZH2A0AukChaKa6Xru13_Q */ private final /* synthetic */ ITextClassifierCallback f$0; { this.f$0 = r1; } public final void runOrThrow() { this.f$0.onFailure(); } }, callback.asBinder(), this, userState)); } } } /* renamed from: onCreateTextClassificationSession */ public void lambda$onCreateTextClassificationSession$7$TextClassificationManagerService(TextClassificationContext classificationContext, TextClassificationSessionId sessionId) throws RemoteException { Preconditions.checkNotNull(sessionId); Preconditions.checkNotNull(classificationContext); int userId = classificationContext.getUserId(); validateInput(this.mContext, classificationContext.getPackageName(), userId); synchronized (this.mLock) { UserState userState = getUserStateLocked(userId); if (userState.isBoundLocked()) { userState.mService.onCreateTextClassificationSession(classificationContext, sessionId); this.mSessionUserIds.put(sessionId, Integer.valueOf(userId)); } else { userState.mPendingRequests.add(new PendingRequest(new FunctionalUtils.ThrowingRunnable(classificationContext, sessionId) { /* class com.android.server.textclassifier.$$Lambda$TextClassificationManagerService$YjZl5O2nzrq_4fvkOEzBc8WS3aY */ private final /* synthetic */ TextClassificationContext f$1; private final /* synthetic */ TextClassificationSessionId f$2; { this.f$1 = r2; this.f$2 = r3; } public final void runOrThrow() { TextClassificationManagerService.this.lambda$onCreateTextClassificationSession$7$TextClassificationManagerService(this.f$1, this.f$2); } }, null, null, this, userState)); } } } /* renamed from: onDestroyTextClassificationSession */ public void lambda$onDestroyTextClassificationSession$8$TextClassificationManagerService(TextClassificationSessionId sessionId) throws RemoteException { int userId; Preconditions.checkNotNull(sessionId); synchronized (this.mLock) { if (this.mSessionUserIds.containsKey(sessionId)) { userId = this.mSessionUserIds.get(sessionId).intValue(); } else { userId = UserHandle.getCallingUserId(); } validateInput(this.mContext, null, userId); UserState userState = getUserStateLocked(userId); if (userState.isBoundLocked()) { userState.mService.onDestroyTextClassificationSession(sessionId); this.mSessionUserIds.remove(sessionId); } else { userState.mPendingRequests.add(new PendingRequest(new FunctionalUtils.ThrowingRunnable(sessionId) { /* class com.android.server.textclassifier.$$Lambda$TextClassificationManagerService$IiiA6SYq7BOEU1FJlf97_wOk4 */ private final /* synthetic */ TextClassificationSessionId f$1; { this.f$1 = r2; } public final void runOrThrow() { TextClassificationManagerService.this.lambda$onDestroyTextClassificationSession$8$TextClassificationManagerService(this.f$1); } }, null, null, this, userState)); } } } /* access modifiers changed from: private */ @GuardedBy({"mLock"}) public UserState getUserStateLocked(int userId) { UserState result = this.mUserStates.get(userId); if (result != null) { return result; } UserState result2 = new UserState(userId, this.mContext, this.mLock); this.mUserStates.put(userId, result2); return result2; } /* access modifiers changed from: package-private */ @GuardedBy({"mLock"}) public UserState peekUserStateLocked(int userId) { return this.mUserStates.get(userId); } /* access modifiers changed from: protected */ public void dump(FileDescriptor fd, PrintWriter fout, String[] args) { if (DumpUtils.checkDumpPermission(this.mContext, LOG_TAG, fout)) { IndentingPrintWriter pw = new IndentingPrintWriter(fout, " "); ((TextClassificationManager) this.mContext.getSystemService(TextClassificationManager.class)).dump(pw); pw.printPair("context", this.mContext); pw.println(); synchronized (this.mLock) { int size = this.mUserStates.size(); pw.print("Number user states: "); pw.println(size); if (size > 0) { for (int i = 0; i < size; i++) { pw.increaseIndent(); pw.print(i); pw.print(":"); this.mUserStates.valueAt(i).dump(pw); pw.println(); pw.decreaseIndent(); } } pw.println("Number of active sessions: " + this.mSessionUserIds.size()); } } } private static final class PendingRequest implements IBinder.DeathRecipient { /* access modifiers changed from: private */ public final IBinder mBinder; /* access modifiers changed from: private */ public final Runnable mOnServiceFailure; @GuardedBy({"mLock"}) private final UserState mOwningUser; /* access modifiers changed from: private */ public final Runnable mRequest; private final TextClassificationManagerService mService; PendingRequest(FunctionalUtils.ThrowingRunnable request, FunctionalUtils.ThrowingRunnable onServiceFailure, IBinder binder, TextClassificationManagerService service, UserState owningUser) { this.mRequest = TextClassificationManagerService.logOnFailure((FunctionalUtils.ThrowingRunnable) Preconditions.checkNotNull(request), "handling pending request"); this.mOnServiceFailure = TextClassificationManagerService.logOnFailure(onServiceFailure, "notifying callback of service failure"); this.mBinder = binder; this.mService = service; this.mOwningUser = owningUser; IBinder iBinder = this.mBinder; if (iBinder != null) { try { iBinder.linkToDeath(this, 0); } catch (RemoteException e) { e.printStackTrace(); } } } public void binderDied() { synchronized (this.mService.mLock) { removeLocked(); } } @GuardedBy({"mLock"}) private void removeLocked() { this.mOwningUser.mPendingRequests.remove(this); IBinder iBinder = this.mBinder; if (iBinder != null) { iBinder.unlinkToDeath(this, 0); } } } /* access modifiers changed from: private */ public static Runnable logOnFailure(FunctionalUtils.ThrowingRunnable r, String opDesc) { if (r == null) { return null; } return FunctionalUtils.handleExceptions(r, new Consumer(opDesc) { /* class com.android.server.textclassifier.$$Lambda$TextClassificationManagerService$R4aPVSf5_OfouCzD96pPpSsbUOs */ private final /* synthetic */ String f$0; { this.f$0 = r1; } @Override // java.util.function.Consumer public final void accept(Object obj) { Slog.d(TextClassificationManagerService.LOG_TAG, "Error " + this.f$0 + ": " + ((Throwable) obj).getMessage()); } }); } private static void validateInput(Context context, String packageName, int userId) throws RemoteException { boolean z; boolean z2 = false; if (packageName != null) { try { int packageUid = context.getPackageManager().getPackageUidAsUser(packageName, UserHandle.getCallingUserId()); int callingUid = Binder.getCallingUid(); if (callingUid != packageUid) { if (callingUid != 1000) { z = false; Preconditions.checkArgument(z, "Invalid package name. Package=" + packageName + ", CallingUid=" + callingUid); } } z = true; Preconditions.checkArgument(z, "Invalid package name. Package=" + packageName + ", CallingUid=" + callingUid); } catch (Exception e) { throw new RemoteException("Invalid request: " + e.getMessage(), e, true, true); } } if (userId != -10000) { z2 = true; } Preconditions.checkArgument(z2, "Null userId"); int callingUserId = UserHandle.getCallingUserId(); if (callingUserId != userId) { context.enforceCallingOrSelfPermission("android.permission.INTERACT_ACROSS_USERS_FULL", "Invalid userId. UserId=" + userId + ", CallingUserId=" + callingUserId); } } /* access modifiers changed from: private */ public static final class UserState { @GuardedBy({"mLock"}) boolean mBinding; final TextClassifierServiceConnection mConnection; private final Context mContext; /* access modifiers changed from: private */ public final Object mLock; @GuardedBy({"mLock"}) final Queue<PendingRequest> mPendingRequests; @GuardedBy({"mLock"}) ITextClassifierService mService; final int mUserId; private UserState(int userId, Context context, Object lock) { this.mConnection = new TextClassifierServiceConnection(); this.mPendingRequests = new ArrayDeque(); this.mUserId = userId; this.mContext = (Context) Preconditions.checkNotNull(context); this.mLock = Preconditions.checkNotNull(lock); } /* access modifiers changed from: package-private */ @GuardedBy({"mLock"}) public boolean isBoundLocked() { return this.mService != null; } /* access modifiers changed from: private */ @GuardedBy({"mLock"}) public void handlePendingRequestsLocked() { while (true) { PendingRequest request = this.mPendingRequests.poll(); if (request != null) { if (isBoundLocked()) { request.mRequest.run(); } else if (request.mOnServiceFailure != null) { request.mOnServiceFailure.run(); } if (request.mBinder != null) { request.mBinder.unlinkToDeath(request, 0); } } else { return; } } } /* access modifiers changed from: private */ @GuardedBy({"mLock"}) public boolean bindIfHasPendingRequestsLocked() { return !this.mPendingRequests.isEmpty() && bindLocked(); } /* access modifiers changed from: private */ @GuardedBy({"mLock"}) public boolean bindLocked() { if (isBoundLocked() || this.mBinding) { return true; } long identity = Binder.clearCallingIdentity(); try { ComponentName componentName = TextClassifierService.getServiceComponentName(this.mContext); if (componentName == null) { return false; } Intent serviceIntent = new Intent("android.service.textclassifier.TextClassifierService").setComponent(componentName); Slog.d(TextClassificationManagerService.LOG_TAG, "Binding to " + serviceIntent.getComponent()); boolean willBind = this.mContext.bindServiceAsUser(serviceIntent, this.mConnection, 69206017, UserHandle.of(this.mUserId)); this.mBinding = willBind; Binder.restoreCallingIdentity(identity); return willBind; } finally { Binder.restoreCallingIdentity(identity); } } /* access modifiers changed from: private */ public void dump(IndentingPrintWriter pw) { pw.printPair("context", this.mContext); pw.printPair("userId", Integer.valueOf(this.mUserId)); synchronized (this.mLock) { pw.printPair("binding", Boolean.valueOf(this.mBinding)); pw.printPair("numberRequests", Integer.valueOf(this.mPendingRequests.size())); } } private final class TextClassifierServiceConnection implements ServiceConnection { private TextClassifierServiceConnection() { } public void onServiceConnected(ComponentName name, IBinder service) { init(ITextClassifierService.Stub.asInterface(service)); } public void onServiceDisconnected(ComponentName name) { cleanupService(); } public void onBindingDied(ComponentName name) { cleanupService(); } public void onNullBinding(ComponentName name) { cleanupService(); } /* access modifiers changed from: package-private */ public void cleanupService() { init(null); } private void init(ITextClassifierService service) { synchronized (UserState.this.mLock) { UserState.this.mService = service; UserState.this.mBinding = false; UserState.this.handlePendingRequestsLocked(); } } } } }
[ "dstmath@163.com" ]
dstmath@163.com
be72dd58332dc87c9fe7db0f00fd2d26f38155bd
74f8506b962c627e473d93e46de72e11cc70689d
/javase/src/main/java/com/heima/base02/day03/code/demo01/list/Demo02LinkedList.java
0f3e9fdffbee30cbd9119405bf78e265aeac2863
[]
no_license
pengtoxen/learnbigdata
d19bd5ef78133ae2187739b467a2fd614dffc59e
3740150a8681a7fab6f009c5e01b5da3a9555d0a
refs/heads/master
2022-06-24T19:51:10.700439
2020-03-19T06:55:06
2020-03-19T06:55:06
218,454,007
0
0
null
2022-06-21T04:04:42
2019-10-30T06:00:17
PLpgSQL
UTF-8
Java
false
false
3,870
java
package com.heima.base02.day03.code.demo01.list; import java.util.LinkedList; /* java.util.LinkedList集合 implements List接口 LinkedList集合的特点: 1.底层是一个链表结构:查询慢,增删快 2.里边包含了大量操作首尾元素的方法 注意:使用LinkedList集合特有的方法,不能使用多态 - public void addFirst(E e):将指定元素插入此列表的开头。 - public void addLast(E e):将指定元素添加到此列表的结尾。 - public void push(E e):将元素推入此列表所表示的堆栈。 - public E getFirst():返回此列表的第一个元素。 - public E getLast():返回此列表的最后一个元素。 - public E removeFirst():移除并返回此列表的第一个元素。 - public E removeLast():移除并返回此列表的最后一个元素。 - public E pop():从此列表所表示的堆栈处弹出一个元素。 - public boolean isEmpty():如果列表不包含元素,则返回true。 */ public class Demo02LinkedList { public static void main(String[] args) { show03(); } /* - public E removeFirst():移除并返回此列表的第一个元素。 - public E removeLast():移除并返回此列表的最后一个元素。 - public E pop():从此列表所表示的堆栈处弹出一个元素。此方法相当于 removeFirst */ private static void show03() { //创建LinkedList集合对象 LinkedList<String> linked = new LinkedList<>(); //使用add方法往集合中添加元素 linked.add("a"); linked.add("b"); linked.add("c"); System.out.println(linked);//[a, b, c] //String first = linked.removeFirst(); String first = linked.pop(); System.out.println("被移除的第一个元素:"+first); String last = linked.removeLast(); System.out.println("被移除的最后一个元素:"+last); System.out.println(linked);//[b] } /* - public E getFirst():返回此列表的第一个元素。 - public E getLast():返回此列表的最后一个元素。 */ private static void show02() { //创建LinkedList集合对象 LinkedList<String> linked = new LinkedList<>(); //使用add方法往集合中添加元素 linked.add("a"); linked.add("b"); linked.add("c"); //linked.clear();//清空集合中的元素 在获取集合中的元素会抛出NoSuchElementException //public boolean isEmpty():如果列表不包含元素,则返回true。 if(!linked.isEmpty()){ String first = linked.getFirst(); System.out.println(first);//a String last = linked.getLast(); System.out.println(last);//c } } /* - public void addFirst(E e):将指定元素插入此列表的开头。 - public void addLast(E e):将指定元素添加到此列表的结尾。 - public void push(E e):将元素推入此列表所表示的堆栈。此方法等效于 addFirst(E)。 */ private static void show01() { //创建LinkedList集合对象 LinkedList<String> linked = new LinkedList<>(); //使用add方法往集合中添加元素 linked.add("a"); linked.add("b"); linked.add("c"); System.out.println(linked);//[a, b, c] //public void addFirst(E e):将指定元素插入此列表的开头。 //linked.addFirst("www"); linked.push("www"); System.out.println(linked);//[www, a, b, c] //public void addLast(E e):将指定元素添加到此列表的结尾。此方法等效于 add() linked.addLast("com"); System.out.println(linked);//[www, a, b, c, com] } }
[ "82912094@qq.com" ]
82912094@qq.com
9383a6361ced931a4168780d097a5fb4a453c7a6
de7763192f48555d12478d77d92e2b576f808abd
/src/main/java/com/dp/creational_patterns/builder/Builder2.java
5aa25a22cb93d1043834c22f63b557ac16e60ae3
[]
no_license
avinashmadireddy/designpatterns
6af3b4662da87687e9117a8512dae02142590db0
c477d95305598f8b29d8b54f1d0a6e49499d25d1
refs/heads/master
2020-04-26T14:22:48.361332
2019-04-14T16:52:23
2019-04-14T16:52:23
173,611,890
0
0
null
null
null
null
UTF-8
Java
false
false
529
java
package com.dp.creational_patterns.builder; import com.dp.creational_patterns.builder.LunchOrderBean2.Builder; public class Builder2 { public static void main(String[] args) { Builder builder = new Builder(); builder.bread("Sdf").meat("dsf").dressing("Sdf").condiments("Sdf"); LunchOrderBean2 lunchOrder = builder.build(); // System.out.println(lunchOrder.getBread()); System.out.println(lunchOrder.getMeat()); System.out.println(lunchOrder.getCondiments()); System.out.println(lunchOrder.getDressing()); } }
[ "avinash@seqnc.com" ]
avinash@seqnc.com
bb3d8c7f46425d32e2431452394cff590a6fd5d5
1f83e4e063dbf40a758c8e01882b2c332fefd284
/SB_FRAMEWORK/SBPersistencia/src/main/java/com/super_bits/modulosSB/Persistencia/registro/exemploImplementacao/ExemploItemNormal.java
bf47c542086f5a546d5f67d36cf9858d71e8ff94
[]
no_license
criistopher/SuperBits_FrameWork
8e5c55caa2b64ec170eac0d73b89351a128a208b
9748ec41c5df0e26e3436dc7ef54935f9ed64b9d
refs/heads/master
2021-01-12T00:39:58.602203
2017-01-11T02:49:05
2017-01-11T02:49:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,484
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.super_bits.modulosSB.Persistencia.registro.exemploImplementacao; import com.super_bits.modulosSB.SBCore.modulos.objetos.InfoCampos.anotacoes.InfoCampo; import com.super_bits.modulosSB.SBCore.modulos.objetos.InfoCampos.campo.FabCampos; import com.super_bits.modulosSB.SBCore.modulos.objetos.registro.Interfaces.basico.ItfUsuario; import java.util.Date; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.ManyToOne; import javax.persistence.Temporal; import javax.persistence.TemporalType; /** * * @author desenvolvedor */ public class ExemploItemNormal { @Id @InfoCampo(tipo = FabCampos.ID) @GeneratedValue() private int id; @InfoCampo(tipo = FabCampos.AAA_NOME) private String nome; @InfoCampo(tipo = FabCampos.AAA_DESCRITIVO) private String descritivo; @InfoCampo(tipo = FabCampos.REG_ATIVO_INATIVO) private boolean ativo; @InfoCampo(tipo = FabCampos.REG_DATAALTERACAO) @Temporal(TemporalType.TIMESTAMP) private Date dataAlteracao; @InfoCampo(tipo = FabCampos.REG_DATAINSERCAO) @Temporal(TemporalType.TIMESTAMP) private Date dataInsercao; //renomear @ManyToOne() private ItfUsuario usuarioAlteracao; @ManyToOne() private ItfUsuario usuarioInsercao; }
[ "salviof@gmail.com" ]
salviof@gmail.com
4681246f36a764c3aaaa1f861dc56281e381fa43
81acc4c943c530181aec309a0468a8781e57645f
/src/abc/StudentDAO.java
ca73c935b65975c1b7f084fdfa91163b1a25a096
[]
no_license
connectaman/Advance_Java
afc8bb9d5d967cde29d3d64b4833d7d93be875cc
adf8107f9200812dc0ad5194da18228cac3bcde8
refs/heads/master
2020-12-11T12:16:01.327504
2020-01-14T13:26:57
2020-01-14T13:26:57
233,847,001
1
0
null
null
null
null
UTF-8
Java
false
false
4,471
java
package abc; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; import java.util.ArrayList; import java.util.List; public class StudentDAO { public static int addStudent(StudentModel s) { int result = 0; try{ Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/niit","root","root"); PreparedStatement pst = con.prepareStatement("insert into niit.student values(?,?,?,?)"); pst.setString(1,s.getUsn()); pst.setString(2,s.getName()); pst.setString(3,s.getDept()); pst.setString(4,s.getColg()); result = pst.executeUpdate(); }catch(Exception e) { e.printStackTrace(); } return result; } public static List<StudentModel> getAllData(){ List<StudentModel> data = new ArrayList<StudentModel>(); try{ Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/niit","root","root"); Statement smt = con.createStatement(); ResultSet rs = smt.executeQuery("Select * from niit.student"); while(rs.next()) { StudentModel s = new StudentModel(); s.setUsn(rs.getString("id")); s.setName(rs.getString("name")); s.setDept(rs.getString("dept")); s.setColg(rs.getString("colg")); data.add(s); } }catch(Exception e) { e.printStackTrace(); } return data; } public static StudentModel getAllData(String usn){ StudentModel s = new StudentModel(); try{ Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/niit","root","root"); Statement smt = con.createStatement(); ResultSet rs = smt.executeQuery("Select * from niit.student where id='"+usn+"'"); while(rs.next()) { s.setUsn(rs.getString("id")); s.setName(rs.getString("name")); s.setDept(rs.getString("dept")); s.setColg(rs.getString("colg")); } }catch(Exception e) { e.printStackTrace(); } return s; } public static boolean update(StudentModel data) { try { Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/niit","root","root"); PreparedStatement pst = con.prepareStatement("update niit.student set name=?,dept=?,colg=? where id=?"); pst.setString(1,data.getName()); pst.setString(2,data.getDept()); pst.setString(3,data.getColg()); pst.setString(4,data.getUsn()); int result = pst.executeUpdate(); if(result!=0) { return true; } }catch(Exception e) { e.printStackTrace(); } return false; } public static boolean delete(String usn) { try { Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/niit","root","root"); PreparedStatement pst = con.prepareStatement("delete from niit.student where id=?"); pst.setString(1,usn); int result = pst.executeUpdate(); if(result!=0) { return true; } }catch(Exception e) { e.printStackTrace(); } return false; } public static List<StudentModel> search(String search){ List<StudentModel> data = new ArrayList<StudentModel>(); try{ Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/niit","root","root"); Statement smt = con.createStatement(); ResultSet rs = smt.executeQuery("Select * from niit.student where name LIKE '%"+search+"%'"); while(rs.next()) { StudentModel s = new StudentModel(); s.setUsn(rs.getString("id")); s.setName(rs.getString("name")); s.setDept(rs.getString("dept")); s.setColg(rs.getString("colg")); data.add(s); } }catch(Exception e) { e.printStackTrace(); } return data; } }
[ "connectamanulla@gmail.com" ]
connectamanulla@gmail.com
604b77f68aaa08cfcf84f0a2e4364e28c66e0f19
8bd196d98b2af464630a5b70501166a2a7eebeea
/src/leetcode/_0645_Find_Error_Nums.java
d0221d270eabc3cf58f506d1935a827333d093e9
[]
no_license
787178256/ForOffer
d1fe8324392be34180fda6d29c9f11a5e4c7de6f
2a6631e8142194ae8259e7ef60c52abe36521814
refs/heads/master
2021-07-06T00:05:01.327970
2020-06-07T15:07:20
2020-06-07T15:07:20
184,084,768
1
0
null
2020-10-13T14:03:47
2019-04-29T14:18:09
Java
UTF-8
Java
false
false
654
java
package leetcode; /** * Created by kimvra on 2019-03-14 */ public class _0645_Find_Error_Nums { public int[] findErrorNums(int[] nums) { for (int i = 0; i < nums.length; i++) { while (nums[i] != i + 1 && nums[nums[i] - 1] != nums[i]) { swap(nums, i, nums[i] - 1); } } for (int i = 0; i < nums.length; i++) { if (nums[i] != i + 1) { return new int[]{nums[i], i + 1}; } } return null; } private void swap(int[] nums, int i, int j) { int temp = nums[i]; nums[i] = nums[j]; nums[j] = temp; } }
[ "787178256@qq.com" ]
787178256@qq.com
b9d918aef21981a45372173ef73d56de68b57225
84e83af67e139ac334cbbdca6428310d27db42ff
/src/main/java/enterprises/mccollum/wmapp/ssauthclient/EmployeeTypesOnly.java
0e6c692a8aa9c73ade5da51ea50c3b872efe0b20
[]
no_license
kg6zvp/wmapp-ssauthclient
cf20de5aee12225894547e3f99453b5d8e528272
f666669972c04e682969a7b657f16dac8f88744b
refs/heads/master
2020-03-07T08:51:41.839228
2018-03-30T06:29:53
2018-03-30T06:29:53
90,931,749
0
0
null
null
null
null
UTF-8
Java
false
false
451
java
package enterprises.mccollum.wmapp.ssauthclient; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.TYPE; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Inherited @Target({ TYPE, METHOD }) @Retention(RetentionPolicy.RUNTIME) public @interface EmployeeTypesOnly { String[] value(); }
[ "smccollum@mccollum.enterprises" ]
smccollum@mccollum.enterprises
4883d56c9cae32410a06d56a624eb24d7d04f822
2b72d7a089a4063e32b54895e4a8fc3301d83d05
/src/main/java/com/microfocus/mqm/atrf/octane/entities/TestVersionDescriptor.java
fc5edca7d0b0880c5e43e0e257f6ffcb9dc9134f
[ "Apache-2.0" ]
permissive
MicroFocus/alm-test-result-collection-tool
43b19ffc57a006411fd4204035f988ce4edffe2f
304b17058531501b13f7ec30cec6feddffd38196
refs/heads/master
2022-12-07T06:50:43.252723
2021-12-23T09:01:40
2021-12-23T09:01:40
153,984,485
0
9
NOASSERTION
2022-11-16T01:18:31
2018-10-21T07:39:41
Java
UTF-8
Java
false
false
1,275
java
/* * Copyright 2017 EntIT Software LLC, a Micro Focus company, L.P. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.microfocus.mqm.atrf.octane.entities; import com.microfocus.mqm.atrf.octane.core.OctaneEntity; import com.microfocus.mqm.atrf.octane.core.OctaneEntityDescriptor; /** * Created by berkovir on 05/12/2016. */ public class TestVersionDescriptor extends OctaneEntityDescriptor { @Override public Class<? extends OctaneEntity> getEntityClass() { return TestVersion.class; } @Override public String getEntityTypeName() { return TestVersion.TYPE; } @Override public String getCollectionName() { return TestVersion.COLLECTION_NAME; } }
[ "michael.seldin@hpe.com" ]
michael.seldin@hpe.com
42096ab9478db0ec52fa123171709ab5746f81bd
eed5b25503b327794674315a5501770808e0c4f8
/sentry-spring/src/main/java/io/sentry/spring/SentryExceptionResolver.java
e519fd72c360d617c6990f9f7eefd5adc1b3409e
[ "MIT" ]
permissive
yhware/sentry-java
dd36bbfa5eca6e83404f9f39bd155757237e13f5
1f704cb3e630cb753ce0ac3390b6da5377c9e6ea
refs/heads/main
2023-06-25T19:57:41.832734
2021-07-20T12:22:09
2021-07-20T12:22:09
388,995,704
0
0
MIT
2021-07-25T16:34:56
2021-07-24T04:07:32
null
UTF-8
Java
false
false
2,327
java
package io.sentry.spring; import com.jakewharton.nopen.annotation.Open; import io.sentry.IHub; import io.sentry.SentryEvent; import io.sentry.SentryLevel; import io.sentry.exception.ExceptionMechanismException; import io.sentry.protocol.Mechanism; import io.sentry.spring.tracing.TransactionNameProvider; import io.sentry.util.Objects; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.springframework.core.Ordered; import org.springframework.web.servlet.HandlerExceptionResolver; import org.springframework.web.servlet.ModelAndView; /** * {@link HandlerExceptionResolver} implementation that will record any exception that a Spring * {@link org.springframework.web.servlet.mvc.Controller} throws to Sentry. It then returns null, * which will let the other (default or custom) exception resolvers handle the actual error. */ @Open public class SentryExceptionResolver implements HandlerExceptionResolver, Ordered { public static final String MECHANISM_TYPE = "HandlerExceptionResolver"; private final @NotNull IHub hub; private final @NotNull TransactionNameProvider transactionNameProvider = new TransactionNameProvider(); private final int order; public SentryExceptionResolver(final @NotNull IHub hub, final int order) { this.hub = Objects.requireNonNull(hub, "hub is required"); this.order = order; } @Override public @Nullable ModelAndView resolveException( final @NotNull HttpServletRequest request, final @NotNull HttpServletResponse response, final @Nullable Object handler, final @NotNull Exception ex) { final Mechanism mechanism = new Mechanism(); mechanism.setHandled(false); mechanism.setType(MECHANISM_TYPE); final Throwable throwable = new ExceptionMechanismException(mechanism, ex, Thread.currentThread()); final SentryEvent event = new SentryEvent(throwable); event.setLevel(SentryLevel.FATAL); event.setTransaction(transactionNameProvider.provideTransactionName(request)); hub.captureEvent(event); // null = run other HandlerExceptionResolvers to actually handle the exception return null; } @Override public int getOrder() { return order; } }
[ "noreply@github.com" ]
yhware.noreply@github.com
32e51cf48d028b46b14f8e09071d5285d10f00dd
afada281a45a9c9fa240fc96ee02d67e699e096d
/app/src/test/java/com/example/toolboxtewari/ExampleUnitTest.java
2bdb1980bbcd64088f1d1de7861899962d27d62c
[]
no_license
suyashtewari/ToolboxTewari
e66cb4e4bfe52864f1987874be643d6e0168e3e9
073e6985d8f040a13f53def0caca1219ca1ec741
refs/heads/master
2022-09-21T04:29:20.887614
2019-09-19T03:16:10
2019-09-19T03:16:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
386
java
package com.example.toolboxtewari; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "tewarisuyash@gmail.com" ]
tewarisuyash@gmail.com
52f053fbb16d0cd927e570b014f85e07bbe73ede
57e447d1bfec5952a58c04da8416a69b5992c377
/app/src/main/java/com/learning/userregistration/Customer.java
7d3a5d00fd0f19540b9c6410efeddf66deb2e35b
[]
no_license
Ferdows-dev/UserRegistrationFireBase
c990b190704715862ee7dbc4c0485ffd20201222
87220cfd1359b6de19ad2a87cfc687e27f2a2b7d
refs/heads/master
2022-12-25T12:30:13.438381
2020-10-09T18:41:12
2020-10-09T18:41:12
302,726,998
1
0
null
null
null
null
UTF-8
Java
false
false
980
java
package com.learning.userregistration; import android.widget.EditText; class Customer { private String customerID; private String customerName; private String customerAddress; public Customer(){ } public Customer(String customerID, String customerName, String customerAddress) { this.customerID = customerID; this.customerName = customerName; this.customerAddress = customerAddress; } public String getCustomerID() { return customerID; } public void setCustomerID(String customerID) { this.customerID = customerID; } public String getCustomerName() { return customerName; } public void setCustomerName(String customerName) { this.customerName = customerName; } public String getCustomerAddress() { return customerAddress; } public void setCustomerAddress(String customerAddress) { this.customerAddress = customerAddress; } }
[ "ferdousshawon36@gmail.com" ]
ferdousshawon36@gmail.com
08adbb25c8c2111bf42335dc0069d738f51b9d13
6dc5682bcd9572ceee8e4d56ad648cb7d8bd51ba
/src/p2021_02_05/DoWhile01.java
35642c7c4e9b294a4e21f0a4bd6c177f04ed20db
[]
no_license
go88hoontops/Java-and-sql
692e3b387f86987fd72ac99be36fe1d36d880d5f
80b4f467d5dfd5b8372704a41c553fb56fbda6a5
refs/heads/master
2023-04-04T03:02:26.106709
2021-04-06T07:06:40
2021-04-06T07:06:40
355,087,149
0
0
null
null
null
null
UTF-8
Java
false
false
416
java
package p2021_02_05; public class DoWhile01 { public static void main(String[] args) { // TODO Auto-generated method stub // do{ // 반복 실행할 문장; // }while(조건식); // do ~ while문으로 '사랑해요' 메시지를 10번 출력 하세요? int i=1; // 초기값 do { System.out.println(i+"사랑해요"); i++; // 증감식 }while(i<=10); // 조건식 } }
[ "go88.hoon@gmail.com" ]
go88.hoon@gmail.com
09e6803c8beabf8beebaad72989618c5a5321f63
123e0187b98fa9de2344d7580b404cfca7ddcaa6
/springboard22/src/main/java/com/example/spring2/controller/board/ReplyController.java
8a693fdc637bb73a9126b162d1a84def0dcc1f40
[]
no_license
Soobinnn/Spring_Board
2c54343edd8b6ec7d223033693c5e2a741057ce5
a1b182167fa14a77f28ed2f8f7642ebfbf316286
refs/heads/master
2020-04-14T16:31:36.565662
2019-01-16T11:48:47
2019-01-16T11:48:47
163,954,229
1
0
null
null
null
null
UHC
Java
false
false
2,249
java
package com.example.spring2.controller.board; import java.util.List; import javax.inject.Inject; import javax.servlet.http.HttpSession; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView; import com.example.spring2.model.board.dto.ReplyVO; import com.example.spring2.service.board.ReplyService; // REST : Representational State Transfer // 하나의 URI가 하나의 고유한 리소스를 대표하도록 설계된 개념 // http://localhost/spring02/list?bno=1 ==> url+파라미터 // http://localhost/spring02/list/1 ==> url // RestController은 스프링 4.0부터 지원 // @Controller, @RestController 차이점은 메서드가 종료되면 화면전환의 유무 //@Controller @RestController @RequestMapping("/reply/*") public class ReplyController { @Inject ReplyService replyService; // 댓글 입력 @RequestMapping("insert.do") public void insert(@ModelAttribute ReplyVO vo, HttpSession session) { String userId = (String) session.getAttribute("userId"); vo.setReplyer(userId); replyService.create(vo); } // 댓글 목록(@Controller방식 : veiw(화면)를 리턴) @RequestMapping("list.do") public ModelAndView list(@RequestParam int bno, ModelAndView mav) { List<ReplyVO> list = replyService.list(bno); // 뷰이름 지정 mav.setViewName("board/replyList"); // 뷰에 전달할 데이터 지정 mav.addObject("list", list); // replyList.jsp로 포워딩 return mav; } // 댓글 목록(@RestController Json방식으로 처리 : 데이터를 리턴) @RequestMapping("listJson.do") @ResponseBody // 리턴데이터를 json으로 변환(생략가능) public List<ReplyVO> listJson(@RequestParam int bno) { List<ReplyVO> list = replyService.list(bno); return list; } }
[ "Soobinnn@DESKTOP-3PV75D0" ]
Soobinnn@DESKTOP-3PV75D0
74d1d91a6426ec89e5a8e3699e86a8088737516c
e980453b5fc18b3730cda88dd43b58987f54bb63
/src/day58_polymorphism/superMan/Casting.java
9267c050c762d31953df8e82c32c3a49a2f24107
[]
no_license
mmiakhel/java-programming
993cbdc6675f28e38cad7d2e4df7393481b9f144
4cc99c7761e383642a29e5251d00b3ca3a9fc26f
refs/heads/master
2023-06-15T02:43:24.260212
2021-07-15T03:10:57
2021-07-15T03:10:57
365,539,389
0
0
null
2021-06-05T21:05:55
2021-05-08T14:47:54
Java
UTF-8
Java
false
false
505
java
package day58_polymorphism.superMan; public class Casting { public static void main(String[] args) { //variable of worker and object of superMan Worker worker = new SuperMan(); worker.work("QA Manager"); worker.getPaid(); ((Father)worker).raiseKid(); ((SuperMan)worker).playWithKid(); //DOWNCASTING from worker to superman SuperMan superMan = (SuperMan) worker; superMan.feedKid(); superMan.work("java dev"); } }
[ "mmiakhel@gmail.com" ]
mmiakhel@gmail.com
c409288e3349b3043bbc6814ceb6dfc7140887bd
433637e1ff83fda8e13d81b67f7d91dcafc9dfa1
/src/main/java/com/example/simplilearn/flyaway/modules/user/adapter/in/controller/UserController.java
8c022d36e185e27294f96ab7193e59f897630fea
[]
no_license
clebercmb/simplilearn_FlyAway
6ac469b304ad8a07323b91e927be79c272237187
3edfeaba4ac3494a68792286555f53410e81d6db
refs/heads/main
2023-06-10T06:55:55.608633
2021-06-26T06:07:19
2021-06-26T06:07:19
379,453,566
0
0
null
null
null
null
UTF-8
Java
false
false
6,597
java
package com.example.simplilearn.flyaway.modules.user.adapter.in.controller; import com.example.simplilearn.flyaway.modules.user.adapter.in.command.ChangePasswordCommand; import com.example.simplilearn.flyaway.modules.user.adapter.in.command.UserCommand; import com.example.simplilearn.flyaway.util.MessageStatus; import com.example.simplilearn.flyaway.modules.user.dto.UserDto; import com.example.simplilearn.flyaway.modules.user.services.*; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import java.util.List; @Controller public class UserController { CreateUserService createUserService; ReadAllUsersService readAllUsersService; DeleteUserService deleteUserService; ReadUserService readUserService; UpdateUserService updateUserService; ValidateUserService validateUserService; FindUserByEmailService findUserByEmailService; ChangePasswordService changePasswordService; public UserController(CreateUserService createUserService, ReadAllUsersService readAllUsersService, DeleteUserService deleteUserService, ReadUserService readUserService, UpdateUserService updateUserService, ValidateUserService validateUserService, FindUserByEmailService findUserByEmailService, ChangePasswordService changePasswordService) { this.createUserService = createUserService; this.readAllUsersService = readAllUsersService; this.deleteUserService = deleteUserService; this.readUserService = readUserService; this.updateUserService = updateUserService; this.validateUserService = validateUserService; this.findUserByEmailService = findUserByEmailService; this.changePasswordService = changePasswordService; } @RequestMapping("user") public String show(@ModelAttribute("userCommand") UserCommand user) { return "user"; } @RequestMapping("updateUser") public String showUpdateUser(@ModelAttribute("userCommand") UserCommand user, @RequestParam String id, Model map) { user = readUserService.execute(Integer.parseInt(id)); map.addAttribute("user", user); return "userUpdate"; } @RequestMapping(value = "createUser", method = RequestMethod.POST) public String post(@ModelAttribute("userCommand") UserCommand user, Model map) { UserDto userDto = createUserService.execute(user); map.addAttribute("user", userDto); return "redirect:/user-dashboard"; } @RequestMapping(value = "saveUser", method = RequestMethod.POST) public String put(@ModelAttribute("userCommand") UserCommand user, Model map) { UserDto userDto = updateUserService.execute(user); map.addAttribute("user", userDto); return "redirect:/user-dashboard"; } @RequestMapping("user-dashboard") public String showDashBoard(Model model) { List<UserCommand> userList = readAllUsersService.execute(); model.addAttribute("users", userList); return "userDashboard"; } @RequestMapping("deleteUser") // default GET public String delete(@RequestParam String id) { deleteUserService.execute(Integer.parseInt(id)); return "redirect:/user-dashboard"; } @RequestMapping("login") public String showLogin(@ModelAttribute("userCommand") UserCommand userCommand, HttpServletRequest request) { System.out.println("Show Login requested"); return "login"; } @RequestMapping("validate-login") public String validateLogin(@ModelAttribute("userCommand") UserCommand userCommand, Model map, HttpServletRequest request) { System.out.println("Show validateLogin"); userCommand = validateUserService.execute(userCommand); if(userCommand != null) { HttpSession session = request.getSession(); userCommand.setPassword(""); session.setAttribute("user", userCommand); return "redirect:/home"; } map.addAttribute("login_error", "Login Failed.. Try Again..!!"); return "login"; } @RequestMapping("create-user") public String createUser(@ModelAttribute("userCommand") UserCommand userCommand, Model map) { System.out.println("Show Login requested"); UserDto userDto = createUserService.execute(userCommand); if(userDto == null) { map.addAttribute("login_error", "Email already used.. Try Again..!!"); return "login"; } return "redirect:/login"; } @RequestMapping("logout") public String logout(HttpServletRequest request) { HttpSession session = request.getSession(false); if(session != null) { session.removeAttribute("user"); session.invalidate(); } return "redirect:/home"; } @RequestMapping("profile") public String showProfile(@ModelAttribute("changePasswordCommand") ChangePasswordCommand changePasswordCommand, HttpServletRequest request, Model map) { HttpSession session = request.getSession(false); UserCommand user= (UserCommand) session.getAttribute("user"); map.addAttribute("user", user); System.out.println("showProfile"); return "profile"; } @RequestMapping("change-password") public String changePassword(@ModelAttribute("changePasswordCommand") ChangePasswordCommand changePasswordCommand, HttpServletRequest request, Model map) { HttpSession session = request.getSession(false); UserCommand user= (UserCommand) session.getAttribute("user"); changePasswordCommand.setUserId(user.getUserId()); MessageStatus message = changePasswordService.execute(changePasswordCommand); if(message.series().equals( MessageStatus.Series.CLIENT_ERROR) ) { map.addAttribute("login_error", message.getReasonPhrase()); return "profile"; } user = readUserService.execute(user.getUserId()); session.setAttribute("user", user); return "redirect:/home"; } }
[ "cleber@gmail.com" ]
cleber@gmail.com
eac93b6b6a760241007e75a3241c5a11951fb2f2
e81b081081c0f49ec320576bb03b15319dd76148
/src/main/java/com/xhwl/recruitment/dao/DwJobIntentionRepository.java
02518a2739048daa0e85e357ff630cdba30ba07f
[]
no_license
GuiyuChi/xhwlRecruitment
45671dc8f83682a3196f988c6f853d9421a8f505
f2c714c132c1879297f2a8103a4590e41985cef5
refs/heads/master
2020-03-12T12:51:07.246114
2018-08-30T06:43:10
2018-08-30T06:43:10
130,628,161
1
3
null
null
null
null
UTF-8
Java
false
false
478
java
package com.xhwl.recruitment.dao; import com.xhwl.recruitment.domain.DwJobIntentionEntity; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import java.util.List; /** * @Author: guiyu * @Description: * @Date: Create in 下午2:48 2018/4/23 **/ @Repository public interface DwJobIntentionRepository extends JpaRepository<DwJobIntentionEntity, Long> { DwJobIntentionEntity findByResumeId(Long resumeId); }
[ "chikatsurasakai@chiguiyudeMacBook-Pro.local" ]
chikatsurasakai@chiguiyudeMacBook-Pro.local
6bff7960782cef831d0d88179dd4a4fce3f9fb41
e83e7a3282c655253061dcf66ce2325d5fbe0bc0
/src/main/java/com/debashis/repo/VehicleInventoryRepository.java
20ab6772165f194c92008a3b1372c213ef2a7e04
[]
no_license
Dk20/VehicleRental
823897f0c927170bf838b05b4b01a19895d6e275
c2200551480b2a0bc6c9864aa344bba8c574bfab
refs/heads/main
2023-06-30T13:08:58.910540
2021-08-08T04:42:17
2021-08-08T04:42:17
393,780,477
1
0
null
null
null
null
UTF-8
Java
false
false
1,372
java
package com.debashis.repo; import com.debashis.model.VehicleInventory; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface VehicleInventoryRepository extends JpaRepository<VehicleInventory,Long> { // Returns all Blocked inventory @Query(value = "SELECT i FROM VehicleInventory AS i WHERE i.vehicle.vehicleId=:vehicleId and " + "i.slotId=:slotId and " + "((i.startDateEpoch<=:endDateEpoch and i.startDateEpoch>=:startDateEpoch) or " + "(i.endDateEpoch<=:endDateEpoch and i.endDateEpoch>=:startDateEpoch))") List<VehicleInventory> findBlockedInventory( Long vehicleId,String slotId,long startDateEpoch,long endDateEpoch ); @Query(value = "SELECT i FROM VehicleInventory AS i WHERE i.vehicle.vehicleId IN :vehicleIds and " + "i.slotId=:slotId and " + "((i.startDateEpoch<=:endDateEpoch and i.startDateEpoch>=:startDateEpoch) or " + "(i.endDateEpoch<=:endDateEpoch and i.endDateEpoch>=:startDateEpoch))") List<VehicleInventory> findBlockedInventoryBulk( List<Long> vehicleIds,String slotId,long startDateEpoch,long endDateEpoch ); Integer removeByBookingId(Long bookingId); }
[ "debashiskarmakar@Debashiss-MacBook-Pro.local" ]
debashiskarmakar@Debashiss-MacBook-Pro.local
27bc7159320b9e4d3600c5384bbb64f54d6e59ab
12d245d4d5ec877e65a7b6e546bd2fdbd9d415a4
/training279/training279storefront/web/src/de/hybris/trainingbala/storefront/controllers/command/ManufacturerDetailsForm.java
f8388334de547b908b17946da173f800b795f7ef
[]
no_license
cheneyhu82/hybris
f38d4d2e0dc26d86bf36af178a6adab9624ed023
9ca93077216afe6e1c2c69b2dc25cbf01e95b6ac
refs/heads/master
2023-06-26T02:22:56.358325
2021-07-30T12:33:37
2021-07-30T12:33:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
569
java
package de.hybris.trainingbala.storefront.controllers.command; public class ManufacturerDetailsForm { private int id; private String name; private String country; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } }
[ "balakrishnanshss@gmail.com" ]
balakrishnanshss@gmail.com
6494659378279cfbf91dad93e320b1b481e30f46
58a961999c259d7fc9e0b8c17a0990f4247f29bf
/CDM/pract3/P1/sources/com/google/android/gms/plus/internal/model/people/zze.java
5d51686c275a4bba8405ab451acaf193e6b05cff
[]
no_license
Lulocu/4B-ETSINF
c50b4ca70ad14b9ec9af6a199c82fad333f7bc8c
65d492d0fbeb630c7bbe25d92dfbfd9e5f41bcd8
refs/heads/master
2023-06-05T23:41:02.297413
2021-06-20T10:53:30
2021-06-20T10:53:30
339,157,412
0
1
null
null
null
null
UTF-8
Java
false
false
2,541
java
package com.google.android.gms.plus.internal.model.people; import android.os.Parcel; import android.os.Parcelable; import com.google.android.gms.common.internal.safeparcel.zza; import com.google.android.gms.common.internal.safeparcel.zzb; import com.google.android.gms.plus.internal.model.people.PersonEntity; import java.util.HashSet; import java.util.Set; public class zze implements Parcelable.Creator<PersonEntity.CoverEntity.CoverPhotoEntity> { static void zza(PersonEntity.CoverEntity.CoverPhotoEntity coverPhotoEntity, Parcel parcel, int i) { int zzac = zzb.zzac(parcel); Set<Integer> set = coverPhotoEntity.zzaHQ; if (set.contains(1)) { zzb.zzc(parcel, 1, coverPhotoEntity.zzCY); } if (set.contains(2)) { zzb.zzc(parcel, 2, coverPhotoEntity.zznN); } if (set.contains(3)) { zzb.zza(parcel, 3, coverPhotoEntity.zzF, true); } if (set.contains(4)) { zzb.zzc(parcel, 4, coverPhotoEntity.zznM); } zzb.zzH(parcel, zzac); } /* renamed from: zzfQ */ public PersonEntity.CoverEntity.CoverPhotoEntity createFromParcel(Parcel parcel) { int i = 0; int zzab = zza.zzab(parcel); HashSet hashSet = new HashSet(); String str = null; int i2 = 0; int i3 = 0; while (parcel.dataPosition() < zzab) { int zzaa = zza.zzaa(parcel); switch (zza.zzbA(zzaa)) { case 1: i3 = zza.zzg(parcel, zzaa); hashSet.add(1); break; case 2: i2 = zza.zzg(parcel, zzaa); hashSet.add(2); break; case 3: str = zza.zzo(parcel, zzaa); hashSet.add(3); break; case 4: i = zza.zzg(parcel, zzaa); hashSet.add(4); break; default: zza.zzb(parcel, zzaa); break; } } if (parcel.dataPosition() == zzab) { return new PersonEntity.CoverEntity.CoverPhotoEntity(hashSet, i3, i2, str, i); } throw new zza.C0031zza("Overread allowed size end=" + zzab, parcel); } /* renamed from: zziG */ public PersonEntity.CoverEntity.CoverPhotoEntity[] newArray(int i) { return new PersonEntity.CoverEntity.CoverPhotoEntity[i]; } }
[ "lulocu99@gmail.com" ]
lulocu99@gmail.com
a629cd2bb4f3b8959d4fbbfe76c8a076fe6d5732
6ad1b82a1da2b94ed2529f95a878d3169f827446
/src/test/java/com/hero/qa/testcases/LoginPageTest.java
3331ec6216fd6bb64dd14d58171f94e5baa5c1f9
[]
no_license
Savita-Kadekodi/TestUiQaCodeChallange
187c800a1d9aa35561b3a3de9cdc48118feb880a
1a3d4b587a6cd4cf70a22a47ee4bb441421a5fc8
refs/heads/main
2023-01-05T02:45:58.180613
2020-11-02T16:08:24
2020-11-02T16:08:24
309,228,740
0
0
null
null
null
null
UTF-8
Java
false
false
729
java
package com.hero.qa.testcases; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import com.hero.qa.pages.LoginPage; import com.hero.qa.Base.TestBase; import com.hero.qa.pages.Secure; public class LoginPageTest extends TestBase { LoginPage LoginPage; Secure Secure; public LoginPageTest(){ super(); } @BeforeMethod public void setUp(){ initialization(); LoginPage = new LoginPage(); } @Test public void validateLogin() { for (int i = 1; i <= 21; i++) { LoginPage.loginTest(prop.getProperty("username" + i),prop.getProperty("password" + i)); } } @AfterMethod public void tearDown() { driver.quit(); } }
[ "spkadekodi@yahoo.com" ]
spkadekodi@yahoo.com
182d31a9e8ed1e06fc05502ae63eba6ce536d189
bcfe3d000511ad089e8a4c621ae02711a9667124
/src/main/java/com/sti/bootcamp/exerciselibrary/exception/StockBukuHabisException.java
dfc8be2c28d3f1edacec09078998308f36339020
[]
no_license
fadhilahr/Library-
b31fd5f50873a4457ce6a8328e8e7fdad7ca9abd
5cc0c273389740e07493ec4cd0d690aebb88b4b1
refs/heads/master
2021-03-29T00:43:15.735893
2020-03-17T07:57:59
2020-03-17T07:57:59
247,909,301
0
0
null
null
null
null
UTF-8
Java
false
false
298
java
package com.sti.bootcamp.exerciselibrary.exception; public class StockBukuHabisException extends Exception { public StockBukuHabisException() { super("Stock Buku yang Ingin Dipinjam Habis"); } public StockBukuHabisException(String message) { super(message); } }
[ "noreply@github.com" ]
fadhilahr.noreply@github.com
4188ff979f842a2d502b18385ccf5a5964ffd22d
cfc60fc1148916c0a1c9b421543e02f8cdf31549
/src/testcases/CWE83_XSS_Attribute/CWE83_XSS_Attribute__Servlet_PropertiesFile_14.java
aea91d89df93c1b028ff480b42b5f219cbcaac22
[ "LicenseRef-scancode-public-domain" ]
permissive
zhujinhua/GitFun
c77c8c08e89e61006f7bdbc5dd175e5d8bce8bd2
987f72fdccf871ece67f2240eea90e8c1971d183
refs/heads/master
2021-01-18T05:46:03.351267
2012-09-11T16:43:44
2012-09-11T16:43:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,888
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE83_XSS_Attribute__Servlet_PropertiesFile_14.java Label Definition File: CWE83_XSS_Attribute__Servlet.label.xml Template File: sources-sink-14.tmpl.java */ /* * @description * CWE: 83 Cross Site Scripting (XSS) in attributes; Examples(replace QUOTE with an actual double quote): ?img_loc=http://www.google.comQUOTE%20onerror=QUOTEalert(1) and ?img_loc=http://www.google.comQUOTE%20onerror=QUOTEjavascript:alert(1) * BadSource: PropertiesFile Read a value from a .properties file (in property named data) * GoodSource: A hardcoded string * BadSink: printlnServlet XSS in img src attribute * Flow Variant: 14 Control flow: if(IO.static_five==5) and if(IO.static_five!=5) * * */ package testcases.CWE83_XSS_Attribute; import testcasesupport.*; import javax.servlet.http.*; import java.util.Properties; import java.io.FileInputStream; import java.io.IOException; import java.util.logging.Logger; public class CWE83_XSS_Attribute__Servlet_PropertiesFile_14 extends AbstractTestCaseServlet { /* uses badsource and badsink */ public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable { String data; if(IO.static_five==5) { Logger log_bad = Logger.getLogger("local-logger"); data = ""; /* init data */ /* retrieve the property */ Properties props = new Properties(); FileInputStream finstr = null; try { finstr = new FileInputStream("../common/config.properties"); props.load(finstr); data = props.getProperty("data"); } catch( IOException ioe ) { log_bad.warning("Error with stream reading"); } finally { /* clean up stream reading objects */ try { if( finstr != null ) { finstr.close(); } } catch( IOException ioe ) { log_bad.warning("Error closing buffread"); } } } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ java.util.logging.Logger log_good = java.util.logging.Logger.getLogger("local-logger"); /* FIX: Use a hardcoded string */ data = "foo"; } if (data != null) { /* POTENTIAL FLAW: Input is not verified/sanitized before use in an image tag */ response.getWriter().println("<br>bad() - <img src=\"" + data + "\">"); } } /* goodG2B1() - use goodsource and badsink by changing IO.static_five==5 to IO.static_five!=5 */ private void goodG2B1(HttpServletRequest request, HttpServletResponse response) throws Throwable { String data; if(IO.static_five!=5) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ Logger log_bad = Logger.getLogger("local-logger"); data = ""; /* init data */ /* retrieve the property */ Properties props = new Properties(); FileInputStream finstr = null; try { finstr = new FileInputStream("../common/config.properties"); props.load(finstr); data = props.getProperty("data"); } catch( IOException ioe ) { log_bad.warning("Error with stream reading"); } finally { /* clean up stream reading objects */ try { if( finstr != null ) { finstr.close(); } } catch( IOException ioe ) { log_bad.warning("Error closing buffread"); } } } else { java.util.logging.Logger log_good = java.util.logging.Logger.getLogger("local-logger"); /* FIX: Use a hardcoded string */ data = "foo"; } if (data != null) { /* POTENTIAL FLAW: Input is not verified/sanitized before use in an image tag */ response.getWriter().println("<br>bad() - <img src=\"" + data + "\">"); } } /* goodG2B2() - use goodsource and badsink by reversing statements in if */ private void goodG2B2(HttpServletRequest request, HttpServletResponse response) throws Throwable { String data; if(IO.static_five==5) { java.util.logging.Logger log_good = java.util.logging.Logger.getLogger("local-logger"); /* FIX: Use a hardcoded string */ data = "foo"; } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ Logger log_bad = Logger.getLogger("local-logger"); data = ""; /* init data */ /* retrieve the property */ Properties props = new Properties(); FileInputStream finstr = null; try { finstr = new FileInputStream("../common/config.properties"); props.load(finstr); data = props.getProperty("data"); } catch( IOException ioe ) { log_bad.warning("Error with stream reading"); } finally { /* clean up stream reading objects */ try { if( finstr != null ) { finstr.close(); } } catch( IOException ioe ) { log_bad.warning("Error closing buffread"); } } } if (data != null) { /* POTENTIAL FLAW: Input is not verified/sanitized before use in an image tag */ response.getWriter().println("<br>bad() - <img src=\"" + data + "\">"); } } public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable { goodG2B1(request, response); goodG2B2(request, response); } /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException { mainFromParent(args); } }
[ "amitf@chackmarx.com" ]
amitf@chackmarx.com
a0e655e552a217daaad14512a9ca6bac8fe6e14e
2d639e97a4418f6b3e97cb5db59ec57718bfd489
/com/hmdzl/spspd/change/items/armor/glyphs/AntiEntropy.java
ffcb3b8bf84d64ca857ad48b7126460897371346
[]
no_license
Mikhael-Danilov/SPS-PD
a1d605635265c14add1a6d0293476844b8e2434a
566f97a0dba760f7770718e394d30cb40ca556f0
refs/heads/master
2020-03-27T21:14:07.915525
2018-09-02T13:43:48
2018-09-02T13:43:48
147,126,791
0
0
null
2018-09-02T22:36:04
2018-09-02T22:36:04
null
UTF-8
Java
false
false
2,081
java
/* * Pixel Dungeon * Copyright (C) 2012-2014 Oleg Dolya * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/> */ package com.hmdzl.spspd.change.items.armor.glyphs; import com.hmdzl.spspd.change.actors.Char; import com.hmdzl.spspd.change.actors.buffs.Buff; import com.hmdzl.spspd.change.actors.buffs.Frost; import com.hmdzl.spspd.change.effects.CellEmitter; import com.hmdzl.spspd.change.effects.particles.SnowParticle; import com.hmdzl.spspd.change.items.armor.Armor; import com.hmdzl.spspd.change.items.armor.Armor.Glyph; import com.hmdzl.spspd.change.levels.Level; import com.hmdzl.spspd.change.sprites.ItemSprite; import com.hmdzl.spspd.change.sprites.ItemSprite.Glowing; import com.watabou.utils.Random; public class AntiEntropy extends Glyph { private static ItemSprite.Glowing BLUE = new ItemSprite.Glowing(0x0000FF); @Override public int proc(Armor armor, Char attacker, Char defender, int damage) { int level = Math.max(0, armor.level); if (Level.adjacent(attacker.pos, defender.pos) && Random.Int(level + 6) >= 5) { Buff.prolong(attacker, Frost.class, Frost.duration(attacker) * Random.Float(1f, 1.5f)); CellEmitter.get(attacker.pos).start(SnowParticle.FACTORY, 0.2f, 6); //Buff.affect(defender, Burning.class).reignite(defender); //defender.sprite.emitter().burst(FlameParticle.FACTORY, 5); } return damage; } @Override public Glowing glowing() { return BLUE; } }
[ "noreply@github.com" ]
Mikhael-Danilov.noreply@github.com
1c66b36f59eab9b561fc0c016bc0fcc56e343ae6
4047fd63645c6e681bb567518f1ace1b54a9fb7e
/src/main/java/com/vinimoreira/cursomc/resources/PedidoResource.java
aaec0616328ebdba8eb88995f93159299f2f3dcf
[]
no_license
ViniMoreiraP/springboot2-ionic-backend
5c267565f6824ff5c1220e7e9578e61cb3d23d2b
8f8d4fdceca6abb960ae59275a6cbe21bbabc0ca
refs/heads/master
2020-03-23T20:25:31.206766
2018-08-06T15:46:05
2018-08-06T15:46:05
142,040,447
0
0
null
null
null
null
UTF-8
Java
false
false
847
java
package com.vinimoreira.cursomc.resources; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import com.vinimoreira.cursomc.domain.Pedido; import com.vinimoreira.cursomc.services.PedidoService; @RestController @RequestMapping(value="/pedidos") public class PedidoResource { @Autowired private PedidoService service; @RequestMapping(value="/{id}" ,method=RequestMethod.GET) public ResponseEntity<Pedido> find(@PathVariable Integer id) { Pedido obj= service.find(id); return ResponseEntity.ok().body(obj); } }
[ "viniciusmoreirap@hotmail.com" ]
viniciusmoreirap@hotmail.com
2606367c669f5a9f597803066f38fd4e6d06eca9
7b265573317dadf410ee8320bf183b567bcb41d6
/app/src/main/java/com/qg/kinectdoctor/model/DUser.java
352e82d0fb7647ceca43b4cdf5b517fe71070d3a
[]
no_license
QGMobile/KinectDoctor
099a5449188296809c7e65cbd433c84c9fbdbb64
e8bcece73f5d6d26b5a844ae64404edf7e47fae4
refs/heads/master
2021-01-10T23:20:40.707540
2016-12-09T12:42:17
2016-12-09T12:42:17
70,596,857
0
0
null
null
null
null
UTF-8
Java
false
false
2,486
java
package com.qg.kinectdoctor.model; /** * Created by ZH_L on 2016/10/22. */ public class DUser { private int id; private String name; private int sex; private int age; private String phone; private String password; private String hospital; private String department;//科室 private String jobTitle;//职称 public DUser(){}; public DUser(String name, int sex, int age, String phone, String password, String hospital, String department, String jobTitle) { this.name = name; this.sex = sex; this.age = age; this.phone = phone; this.password = password; this.hospital = hospital; this.department = department; this.jobTitle = jobTitle; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getSex() { return sex; } public void setSex(int sex) { this.sex = sex; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getHospital() { return hospital; } public void setHospital(String hospital) { this.hospital = hospital; } public String getDepartment() { return department; } public void setDepartment(String department) { this.department = department; } public String getJobTitle() { return jobTitle; } public void setJobTitle(String jobTitle) { this.jobTitle = jobTitle; } @Override public String toString() { return "DUser{" + "id=" + id + ", name='" + name + '\'' + ", sex=" + sex + ", age=" + age + ", phone='" + phone + '\'' + ", password='" + password + '\'' + ", hospital='" + hospital + '\'' + ", department='" + department + '\'' + ", jobTitle='" + jobTitle + '\'' + '}'; } }
[ "liangzhihao1995@126.com" ]
liangzhihao1995@126.com
f03eb20594a987c5d41c460a9e4c742486c827c9
281fc20ae4900efb21e46e8de4e7c1e476f0d132
/test-applications/facelets/src/main/java/queue/QueueComponent.java
350add576785d58b6d0b6a082031989202fb2a8b
[]
no_license
nuxeo/richfaces-3.3
c23b31e69668810219cf3376281f669fa4bf256f
485749c5f49ac6169d9187cc448110d477acab3b
refs/heads/master
2023-08-25T13:27:08.790730
2015-01-05T10:42:11
2015-01-05T10:42:11
10,627,040
3
5
null
null
null
null
UTF-8
Java
false
false
4,393
java
package queue; import java.util.ArrayList; import java.util.Date; import javax.faces.event.ActionEvent; import javax.faces.model.SelectItem; public class QueueComponent { private String inputValue; private String inputQueue; private ArrayList<SelectItem> queues; private Date calendarValue; private String calendarQueue; private boolean checkboxValue; private String checkboxQueue; private String dfsQueue; private Object dataScrollerValue; private String dataScrollerQueue; private String radioValue; private String radioQueue; private String selectMenuValue; private String selectMenuQueue; private String suggestionValue; private String suggestionQueue; public void sleepThread(ActionEvent e){ try { Thread.sleep(5000); } catch (InterruptedException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } public String getSuggestionValue() { return suggestionValue; } public void setSuggestionValue(String suggestionValue) { this.suggestionValue = suggestionValue; } public String getSuggestionQueue() { return suggestionQueue; } public void setSuggestionQueue(String suggestionQueue) { this.suggestionQueue = suggestionQueue; } public String getSelectMenuValue() { return selectMenuValue; } public void setSelectMenuValue(String selectMenuValue) { this.selectMenuValue = selectMenuValue; } public String getSelectMenuQueue() { return selectMenuQueue; } public void setSelectMenuQueue(String selectMenuQueue) { this.selectMenuQueue = selectMenuQueue; } public String getRadioValue() { return radioValue; } public void setRadioValue(String radioValue) { this.radioValue = radioValue; } public String getRadioQueue() { return radioQueue; } public void setRadioQueue(String radioQueue) { this.radioQueue = radioQueue; } public Object getDataScrollerValue() { return dataScrollerValue; } public void setDataScrollerValue(Object dataScrollerValue) { this.dataScrollerValue = dataScrollerValue; } public String getDataScrollerQueue() { return dataScrollerQueue; } public void setDataScrollerQueue(String dataScrollerQueue) { this.dataScrollerQueue = dataScrollerQueue; } public String getDfsQueue() { return dfsQueue; } public void setDfsQueue(String dfsQueue) { this.dfsQueue = dfsQueue; } public boolean isCheckboxValue() { return checkboxValue; } public void setCheckboxValue(boolean checkboxValue) { this.checkboxValue = checkboxValue; } public String getCheckboxQueue() { return checkboxQueue; } public void setCheckboxQueue(String checkboxQueue) { this.checkboxQueue = checkboxQueue; } public Date getCalendarValue() { return calendarValue; } public void setCalendarValue(Date calendarValue) { this.calendarValue = calendarValue; } public String getCalendarQueue() { return calendarQueue; } public void setCalendarQueue(String calendarQueue) { this.calendarQueue = calendarQueue; } public QueueComponent(){ this.inputValue = ""; this.inputQueue = "org.richfaces.global_queue"; this.calendarValue = new Date(); this.calendarQueue = "namedQueue"; this.checkboxValue = false; this.checkboxQueue = "formQueue"; this.dataScrollerValue = null; this.dataScrollerQueue = "default"; this.radioValue = "org.richfaces.global_queue"; this.radioQueue = "org.richfaces.global_queue"; this.dfsQueue = "namedQueue"; this.selectMenuValue = "apple"; this.selectMenuQueue = "formQueue"; this.suggestionValue = ""; this.suggestionQueue = "default"; String[] qu = {"org.richfaces.global_queue", "namedQueue", "formQueue", "default"}; queues = new ArrayList<SelectItem>(); for(int i=0; i<qu.length; i++){ queues.add(new SelectItem(qu[i], qu[i])); } } public String getInputQueue() { return inputQueue; } public void setInputQueue(String inputQueue) { this.inputQueue = inputQueue; } public String getInputValue() { return inputValue; } public void setInputValue(String inputValue) { this.inputValue = inputValue; } public ArrayList<SelectItem> getQueues() { return queues; } public void setQueues(ArrayList<SelectItem> queues) { this.queues = queues; } }
[ "grenard@nuxeo.com" ]
grenard@nuxeo.com
77fa236671876ca7d1fe4cea539b562c5e6f4c12
fb6c136da68c5273371258429e383e6c00b51a95
/app/src/main/java/com/convalida/android/foodypos/MyFirebaseMessagingService.java
7b3c1204b62afef499c24d33be39c70fe7a6fa3c
[]
no_license
convalida/FoodyPOSGit
c7e36e264b122e79b1073bd9e0a2e7f1ed1d7d2e
a5c5793bff05f9f1eedaaf5cecc5c2e541bcd78a
refs/heads/master
2020-04-13T18:47:14.943319
2020-02-01T05:00:14
2020-02-01T05:00:14
163,384,513
0
0
null
2019-10-09T07:46:32
2018-12-28T08:09:26
Java
UTF-8
Java
false
false
13,846
java
package com.convalida.android.foodypos; import android.annotation.SuppressLint; import android.app.Activity; import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothSocket; import android.content.Context; import android.content.Intent; import android.media.RingtoneManager; import android.net.Uri; import android.os.Build; import android.print.PrintManager; import android.support.annotation.NonNull; import android.support.annotation.RequiresApi; import android.support.v4.app.NotificationCompat; import android.support.v4.app.NotificationManagerCompat; import android.util.Log; import android.widget.Toast; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.iid.FirebaseInstanceId; import com.google.firebase.iid.InstanceIdResult; import com.google.firebase.messaging.FirebaseMessagingService; import com.google.firebase.messaging.RemoteMessage; import org.json.JSONObject; import java.io.InputStream; import java.io.OutputStream; import java.util.Objects; //import static android.support.v4.app.ActivityCompat.startActivityForResult; public class MyFirebaseMessagingService extends FirebaseMessagingService { private static final String TAG="MyFirebaseMessaginging"; Uri defaultSoundUri=RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); Context context; BluetoothAdapter bluetoothAdapter; BluetoothSocket bluetoothSocket; BluetoothDevice bluetoothDevice; OutputStream outputStream; InputStream inputStream; Thread thread; byte[] readBuffer; int readBufferPosition; volatile boolean stopWorker; public void onNewToken(String s){ super.onNewToken(s); Log.e("NEW_TOKEN",s); //SharedPrefManagerToken.getmInstance(getApplicationContext()).saveDeviceToken(s); } public void onTokenRefresh(){ } /**@RequiresApi(api = Build.VERSION_CODES.KITKAT) public void onMessageReceived(RemoteMessage remoteMessage){ super.onMessageReceived(remoteMessage); // if(remoteMessage.getData().size()>0){ //Log.e(TAG,"Data Payload: "+remoteMessage.getData().toString()); // Toast.makeText(getApplicationContext(),"Data Payload: "+remoteMessage.getData().toString(),Toast.LENGTH_LONG).show(); //try { //JSONObject jsonObject=new JSONObject(remoteMessage.getData().toString()); //sendPushNotification(jsonObject); //} catch (JSONException e) { //e.printStackTrace(); // } //} //else{**/ /** String msg=Objects.requireNonNull(remoteMessage.getNotification()).getBody(); assert msg != null; String[] individualStrings=msg.split(" "); String order=individualStrings[1]; String orderNum=order.substring(1); int id= (int) (Math.random()*10); // Map<String,String> data=remoteMessage.getData(); // data.get("vibrate"); Intent intent=new Intent(getApplicationContext(),OnClickOrder.class); // intent.putExtra("Msg",msg); intent.putExtra("Order num",orderNum); //intent.setAction(Intent.ACTION_MAIN); // intent.addCategory(Intent.CATEGORY_LAUNCHER); PendingIntent pendingIntent=PendingIntent.getActivity(getApplicationContext(),1,intent,PendingIntent.FLAG_UPDATE_CURRENT); @SuppressLint("ResourceType") Notification notification=new NotificationCompat.Builder(this,"my_channel_01") // Notification notification=new Notification.Builder(getApplicationContext()) .setContentTitle(Objects.requireNonNull(remoteMessage.getNotification()).getTitle()) .setContentText(remoteMessage.getNotification().getBody()) .setSmallIcon(R.drawable.notification_icon) .setSound(defaultSoundUri) .setDefaults(Notification.DEFAULT_SOUND|Notification.DEFAULT_VIBRATE) .setPriority(Notification.PRIORITY_HIGH) .setVisibility(Notification.VISIBILITY_PUBLIC) .setVibrate(new long[]{1000,100,1000,100,1000}) // .setLights() .setContentIntent(pendingIntent) .setAutoCancel(true) .setColor(getResources().getColor(R.color.colorAccent)) .build(); // intent.removeExtra("Order num");x NotificationManagerCompat managerCompat=NotificationManagerCompat.from(getApplicationContext()); // NotificationManager managerCompat= (NotificationManager) getSystemService(NOTIFICATION_SERVICE); managerCompat.notify(id,notification); //Vibrator vibrator = (Vibrator) this.getSystemService(Context.VIBRATOR_SERVICE); // assert vibrator != null; // vibrator.vibrate(new long[] {1000, 100, 1000, 100, 1000},1);**/ /**Log.e(TAG, Integer.toString(id)); if(android.os.Build.VERSION.SDK_INT>=android.os.Build.VERSION_CODES.O){ NotificationChannel notificationChannel=new NotificationChannel(Constants.CHANNEL_ID,Constants.CHANNEL_NAME,NotificationManager.IMPORTANCE_DEFAULT); notificationChannel.enableVibration(true); notificationChannel.setVibrationPattern(new long[]{100,200,300, 400,500, 400, 300, 200, 400}); NotificationManager notificationManager= (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE); assert notificationManager != null; notificationManager.createNotificationChannel(notificationChannel); // Toast.makeText(getApplicationContext(),id.hashCode(),Toast.LENGTH_LONG).show(); } }**/ @RequiresApi(api = Build.VERSION_CODES.KITKAT) public void onMessageReceived(RemoteMessage remoteMessage){ super.onMessageReceived(remoteMessage); String msg=Objects.requireNonNull(remoteMessage.getData()).get("body"); assert msg != null; String[] individualStrings=msg.split(" "); String order=individualStrings[1]; String orderNum=order.substring(1); int id= (int) (Math.random()*10); Intent intent=new Intent(getApplicationContext(),OnClickOrder.class); // intent.putExtra("Msg",msg); intent.putExtra("Order num",orderNum); //intent.setAction(Intent.ACTION_MAIN); // intent.addCategory(Intent.CATEGORY_LAUNCHER); PendingIntent pendingIntent=PendingIntent.getActivity(getApplicationContext(),1,intent,PendingIntent.FLAG_UPDATE_CURRENT); String title = remoteMessage.getData().get("title"); String body = remoteMessage.getData().get("body"); Notification notification = new NotificationCompat.Builder(this,"my_channel_01") .setContentTitle(title) .setContentText(body) .setSmallIcon(R.drawable.notification_icon) .setSound(defaultSoundUri) .setDefaults(Notification.DEFAULT_SOUND|Notification.DEFAULT_VIBRATE) .setPriority(Notification.PRIORITY_HIGH) .setVisibility(Notification.VISIBILITY_PUBLIC) .setVibrate(new long[]{1000,100,1000,100,1000}) // .setLights() .setContentIntent(pendingIntent) .setAutoCancel(true) .setColor(getResources().getColor(R.color.colorAccent)) .build(); NotificationManagerCompat managerCompat=NotificationManagerCompat.from(getApplicationContext()); managerCompat.notify(id,notification); Log.e(TAG, Integer.toString(id)); if(android.os.Build.VERSION.SDK_INT>=android.os.Build.VERSION_CODES.O){ NotificationChannel notificationChannel=new NotificationChannel(Constants.CHANNEL_ID,Constants.CHANNEL_NAME,NotificationManager.IMPORTANCE_DEFAULT); notificationChannel.enableVibration(true); notificationChannel.setVibrationPattern(new long[]{100,200,300, 400,500, 400, 300, 200, 400}); NotificationManager notificationManager= (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE); assert notificationManager != null; notificationManager.createNotificationChannel(notificationChannel); // Toast.makeText(getApplicationContext(),id.hashCode(),Toast.LENGTH_LONG).show(); } /** Intent intent1=new Intent(this,PrintNotification.class); // intent1.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent1);**/ // finish(); //doPrint(); // findBluetoothDevice(); // openBluetoothPrinter(); } /** protected void attachBaseContext(Context newBase){ context= newBase; super.attachBaseContext(); }**/ private void doPrint() { if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){ // Activity currentActivity=getApplicationContext().getCurrentA PrintManager printManager = (PrintManager) getApplicationContext().getSystemService(Context.PRINT_SERVICE); String jobName = getApplicationContext().getString(R.string.app_name)+ " Document"; printManager.print(jobName, new MyPrintDocumentAdapter(getApplicationContext()),null); } } /** * void findBluetoothDevice(){ try{ bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if(bluetoothAdapter==null){ Toast.makeText(getApplicationContext(),"No bluetooth adapter found",Toast.LENGTH_LONG).show(); } if(bluetoothAdapter.isEnabled()){ Intent enableBT = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(enableBT,0); } }catch (Exception ex){ } } **/ // String title=Objects.requireNonNull(remoteMessage.getNotification()).getTitle(); // String body=remoteMessage.getNotification().getBody(); //} /** @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) private void sendPushNotification(JSONObject jsonObject) { Log.e(TAG,"Notification JSON "+jsonObject.toString()); // Toast.makeText(getApplicationContext(),"NotificationJson "+jsonObject.toString(),Toast.LENGTH_LONG).show(); try { JSONObject data=jsonObject.getJSONObject("data"); String title=data.getString("title"); String message=data.getString("body"); MyNotificationManager myNotificationManager=new MyNotificationManager(getApplicationContext()); // Intent intent=new Intent(getApplicationContext(),OrderList.class); if(android.os.Build.VERSION.SDK_INT>=android.os.Build.VERSION_CODES.O){ NotificationManager notificationManager= (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); int importance=NotificationManager.IMPORTANCE_HIGH; NotificationChannel notificationChannel=new NotificationChannel(Constants.CHANNEL_ID,Constants.CHANNEL_NAME,importance); notificationChannel.setDescription(Constants.CHANNEL_DESCRIPTION); notificationChannel.enableLights(true); // notificationChannel.enableLights(true); notificationChannel.enableVibration(true); notificationChannel.setVibrationPattern(new long[]{100,200,300, 400,500, 400, 300, 200, 400}); assert notificationManager != null; notificationManager.createNotificationChannel(notificationChannel); } // myNotificationManager.displayNotification(title,message,intent); // myNotificationManager.displayNotification(title,message); /** Intent intent=new Intent(getApplicationContext(),com.convalida.ctpl_dt10.foodypos.OrderList.class); // TaskStackBuilder stackBuilder=TaskStackBuilder.create(context); // stackBuilder.addNextIntentWithParentStack(intent); // intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // intent.setAction(Intent.ACTION_MAIN); // intent.addCategory(Intent.CATEGORY_LAUNCHER); // intent.putExtra("Extra key",1); /** intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TASK);**/ /** intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent=PendingIntent.getService(getApplicationContext(),1,intent,PendingIntent.FLAG_ONE_SHOT); Notification notification=new Notification.Builder(getApplicationContext()) .setContentTitle(title) .setContentText(message) .setContentIntent(pendingIntent) .setSmallIcon(R.drawable.icon) .build(); NotificationManager notificationManager= (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); assert notificationManager != null; notificationManager.notify(1,notification); } catch (JSONException e) { e.printStackTrace(); } }**/ public static String getToken(Context context){ return SharedPrefManagerToken.getmInstance(context).getDeviceToken(); } }
[ "minakshi.sadana@convalidatech.com" ]
minakshi.sadana@convalidatech.com
aaff7ba585f2aca7bbd1a7bc1f072b866bd0565d
7a5d9222a00b5a3d4094476ebd7097b6c59bd234
/java-util/src/main/java/com/mrl/emulate/synchronizer/AbstractOwnableSynchronizer.java
f698474731d89514d8dfbb6cf7711a5a13d9a998
[]
no_license
TinyDataLiu/emulate
1f50a53b5321701878b2628582a81105266a91e6
827d6ad4d92ec84e5c03967a934faa83b5c3fb11
refs/heads/master
2022-07-23T06:53:54.975983
2020-03-28T08:01:27
2020-03-28T08:01:27
137,826,282
0
0
null
2022-07-13T15:30:36
2018-06-19T01:44:59
Java
UTF-8
Java
false
false
847
java
package com.mrl.emulate.synchronizer; import java.io.Serializable; /** * @author liucun * @Description: 偷窥大师经典,同步器顶级 * @date 2018/6/1911:23 */ public abstract class AbstractOwnableSynchronizer implements Serializable { private static final long serialVersionUID = -6560065003681285519L; /*为子类提供的空构造方法*/ protected AbstractOwnableSynchronizer() { } /*当前同步器的持有者*/ private transient Thread exclusiveOwnerThread; /*只允许子类使用, 且不可变更 , 获取当前同步器的使用者*/ protected final Thread getExclusiveOwnerThread() { return exclusiveOwnerThread; } /*设置当前同步器的持有者*/ protected final void setExclusiveOwnerThread(Thread thread) { exclusiveOwnerThread = thread; } }
[ "1360737271@qq.com" ]
1360737271@qq.com
56bc16ad1ebb02b8e589e033251be681661bf14b
4e9707b3fe659b323d3d84f58a6af5c814bc52b6
/src/main/java/bomberman/entities/BoundedRect.java
c9173079412a660ae58c7be2eb5ae59dfb0d4a08
[]
no_license
LananhTran302001/Bomberman
36cd6ada582c9b8da281947fd5aa9b926ff6817f
588f4a5b9e19a92579f5e07f6941370b9e2a69a3
refs/heads/main
2023-02-07T19:12:13.808019
2020-12-18T01:41:40
2020-12-18T01:41:40
309,119,179
0
0
null
null
null
null
UTF-8
Java
false
false
2,145
java
package bomberman.entities; import bomberman.constants.GameConstants; import javafx.geometry.Rectangle2D; public class BoundedRect { protected Vector2 position; protected Vector2 size; protected Rectangle2D bound; public BoundedRect() { position = new Vector2(); size = new Vector2(GameConstants.TILE_SIZE, GameConstants.TILE_SIZE); bound = new Rectangle2D(position.x, position.y, size.x, size.y); } public BoundedRect(int x, int y, int width, int height) { position = new Vector2(x, y); size = new Vector2(width, height); bound = new Rectangle2D(x, y, width, height); } public BoundedRect(Vector2 pos, Vector2 size) { this.position = new Vector2(pos); this.size = new Vector2(size); bound = new Rectangle2D(pos.x, pos.y, size.x, size.y); } public Vector2 getPosition() { return position; } public void setPosition(Vector2 position) { this.position = position; } public void setPosition(int newX, int newY) { this.position = new Vector2(newX, newY); } public int getWidth() { return size.x; } public int getHeight() { return size.y; } public Vector2 getSize() { return size; } public void setSize(int width, int height) { size = new Vector2(width, height); bound = new Rectangle2D(position.x, position.y, size.x, size.y); } public Rectangle2D getBound() { bound = new Rectangle2D(position.x, position.y, size.x, size.y); return bound; } public void setBound(Rectangle2D bound) { this.bound = bound; } public boolean collideWith(BoundedRect other) { if (other == null) { return false; } return bound.intersects(other.getBound()); } public boolean overlap(BoundedRect other) { if (other == null) { return false; } return bound.intersects(other.bound); } public boolean collideWith(int x, int y, int w, int h) { return bound.intersects(x, y, w, h); } }
[ "57004492+LananhTran302001@users.noreply.github.com" ]
57004492+LananhTran302001@users.noreply.github.com
17d3a119517a721edd56ebde40fdf8581d302488
c0e1779f5f0db14b22bac8706af044427c73e465
/modules/owl-parser/src/main/java/net/sourceforge/ondex/core/utils/DataSourcePrototype.java
962d44decf1b9e7723aa84748a8bb169a8d98bb6
[]
no_license
ruixiangliu/ondex-knet-builder
b2e48e78887458e6d269f371204a081046b6289f
ab89a2a15373fa1302a17f54080ea5c12cc23f12
refs/heads/master
2021-01-15T11:04:23.217742
2017-08-03T14:44:41
2017-08-03T14:44:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,441
java
package net.sourceforge.ondex.core.utils; import net.sourceforge.ondex.core.ONDEXGraph; import net.sourceforge.ondex.core.base.DataSourceImpl; import net.sourceforge.ondex.exception.type.NullValueException; /** * These prototypes are a quick way to prepare ONDEX entities to be created later (when a {@link ONDEXGraph} is available, * with the necessary parameters. They're also designed to be used with IoC frameworks like Spring. * * TODO: move to core, as most of the classes in this package. * * @author brandizi * <dl><dt>Date:</dt><dd>8 May 2017</dd></dl> * */ @SuppressWarnings ( "serial" ) public class DataSourcePrototype extends DataSourceImpl { public static final DataSourcePrototype OWL_PARSER = new DataSourcePrototype ( "owlParser", "The OWL Parser", "" ); private String id; public DataSourcePrototype ( String id, String fullname, String description ) { super ( -1, id, fullname, description ); this.setId ( id ); } public DataSourcePrototype () { this ( "", "", "" ); } public String getId () { return this.id; } public void setId ( String id ) { this.id = id; } @Override public void setFullname ( String fullname ) throws NullValueException, UnsupportedOperationException { this.fullname = fullname; } @Override public void setDescription ( String description ) throws NullValueException, UnsupportedOperationException { this.description = description; } }
[ "marco.brandizi@gmail.com" ]
marco.brandizi@gmail.com
aa05658b2c024574a8fde1f3335f222354808d8d
2a4f6947b0d900a763f222107f4866891a0f8eb5
/src/Ground.java
0ec745417e98611cc65b387c173c71f0c84cf2e8
[]
no_license
Tahoora78/ChessProject
3d22b91e7775be6b32ddf9f43c0762beacec3e05
9718c476f1c97635a3e431c4ba82f8663f5ab15d
refs/heads/master
2020-05-16T04:56:09.574783
2019-07-05T19:10:59
2019-07-05T19:10:59
182,796,014
0
0
null
2019-05-28T16:33:07
2019-04-22T13:43:38
Java
UTF-8
Java
false
false
28,478
java
import java.util.ArrayList; import java.util.HashMap; import java.util.Scanner; /** * used for defining the features and methods of the chess board * Tahoora Majlesi * */ public class Ground { private String x; private int y; private String turnPiece = "white"; private boolean start = false; ArrayList<String> deletedBlackChess= new ArrayList<>(); ArrayList<String> getDeletedWhiteChess = new ArrayList<>(); ArrayList<Pices> chessPicess = new ArrayList<>(); private Square currentSquare; public void setStart(boolean start){ this.start = start; } public boolean getStart(){ return start; } public void setCurrentSquare(Square square){ currentSquare = square; } public Square getCurrentSquare(){ return currentSquare; } public void setTurnPiece(String h){ turnPiece = h; } public String getTurnPiece(){ return turnPiece; } public void makingChessPicess(){ chessPicess.add(new Rook(1,1,"black",1)); chessPicess.add(new Knight(2,1,"black",1)); chessPicess.add(new Bishop(3,1,"black")); chessPicess.add(new Queen(4,1,"black")); chessPicess.add(new King(5,1,"black")); chessPicess.add(new Bishop(6,1,"black")); chessPicess.add(new Knight(7,1,"black",2)); chessPicess.add(new Rook(8,1,"black",2)); chessPicess.add(new Rook(1,8,"white",1)); chessPicess.add(new Knight(2,8,"white",1)); chessPicess.add(new Bishop(3,8,"white")); chessPicess.add(new Queen(4,8,"white")); chessPicess.add(new King(5,8,"white")); chessPicess.add(new Bishop(6,8,"white")); chessPicess.add(new Knight(7,8,"white",2)); chessPicess.add(new Rook(8,8,"white",2)); int t=1; for(int i=16;i<=23;i++){ chessPicess.add(new Pawn(t,2,"black")); t++; } t=1; for(int i=24;i<=31;i++){ chessPicess.add(new Pawn(t,7,"white")); t++; } } /** * used for displaying the pieces of chess */ public void display(){ int y=0; for(int i=0;i<chessPicess.size();i++){ System.out.print(chessPicess.get(i).getName()+chessPicess.get(i).getColor()+"x:"+chessPicess.get(i).getX()+"y:"+chessPicess.get(i).getY()+"I:"+i+" "); } System.out.println(); for(int j=8;j>=1;j--){ for(int i=1;i<=8;i++){ for(int g=(chessPicess.size()-1);g>=0;g--){ y=0; if(chessPicess.get(g).getX()==i && chessPicess.get(g).getY()==j){ System.out.print("|"+chessPicess.get(g).getName()+chessPicess.get(g).getColor()+"x:"+chessPicess.get(g).getX()+"y:"+chessPicess.get(g).getY()); y=1; break; } } if(y!=1){ System.out.print("| "); } } System.out.print("|"); System.out.println(); System.out.print("__________________________________________________"); System.out.println(); } } /** * identify that we can move this rook piece or not * @param x1 x of the starting point * @param x2 x of the destination point * @param y1 y of the starting point * @param y2 y of the destination point * @return yes or no to continue or not */ public String checkRook(int x1,int x2,int y1,int y2){ int cont; cont = 0; String continues = "no"; int dx = Math.abs(x2-x1); int dy = Math.abs(y2-y1); if (dx != dy && (dx == 0 || dy == 0)) { continues = "no"; dy = y2 - y1; if ((dx == 0)) { for (int e = 0; e < chessPicess.size(); e++) { for (int i = (Math.min(y1, y2)) + 1; i < Math.max(y1, y2); i++) { if (chessPicess.get(e).getX() == x1 && chessPicess.get(e).getY() == i) { cont++; } } } if (cont == 0) { continues = "yes"; } } cont = 0; if ((dy == 0)) { for (int r = (Math.min(x1, x2) + 1); r < Math.max(x1, x2); r++) { if (chessPicess.get(r).getX() == r && chessPicess.get(r).getY() == y1) { cont++; } } if (cont == 0) { continues = "yes"; } } } return continues; } /** * identify that we can move this bishop piece or not * @param x1 x of the starting point * @param x2 x of the destination point * @param y1 y of the starting point * @param y2 y of the destination point * @return yes or no to continue or not */ public String checkBishop(int x1,int x2,int y1,int y2,String colorss){ int t = 0; int dx = Math.abs(x2-x1); int dy = Math.abs(y2-y1); int conts = 0; String continues = "no"; if (dx == dy) { continues = "no"; conts = 0; for (int r = 0; r < chessPicess.size(); r++) { t = Math.min(y1, y2) + 1; for (int i = (Math.min(x1, x2) + 1); i < Math.max(x1, x2); i++) { if (chessPicess.get(r).getX() == i && chessPicess.get(r).getY() == t) { if (chessPicess.get(r).getY() == y2 && chessPicess.get(r).getX() == x2) { if (chessPicess.get(r).getColor().equals(colorss)) { } else { conts++; } } } t++; } if (chessPicess.get(r).getY() == y2 && chessPicess.get(r).getX() == x2) { if (chessPicess.get(r).getColor().equals(colorss)) { } else { conts++; } } } if (conts == 0) { continues = "yes"; } conts = 0; } return continues; } /** * identify that we can move this queen piece or not * @param x1 x of the starting point * @param x2 x of the destination point * @param y1 y of the starting point * @param y2 y of the destination point * @return colorss :yes or no to continue or not * @return colorss yes or no to continue */ public String checkQueen(int x1,int x2,int y1,int y2,String colorss){ int dx = Math.abs(x2-x1); int dy = Math.abs(y2-y1); int conts = 0; String continues = "no"; if ((dy == dx) || (dy == 0) || (dx == 0)) { continues = "no"; if (dy == 0) { conts = 0; for (int w = Math.min(x1, x2) + 1; w < Math.max(x1, x2); w++) { for (int r = 0; r < chessPicess.size(); r++) { if (chessPicess.get(r).getX() == w && chessPicess.get(w).getY() == y1) { conts++; } } } for (int i = 0; i < chessPicess.size(); i++) { if (chessPicess.get(i).getX() == x2 && chessPicess.get(i).getY() == y2) { if (chessPicess.get(i).getColor().equals(colorss)) { } else { conts++; } } } if (conts == 0) { continues = "yes"; } } if (dx == 0) { conts = 0; for (int w = Math.min(y1, y2) + 1; w < Math.max(y1, y2); w++) { for (int r = 0; r < chessPicess.size(); r++) { if (chessPicess.get(r).getX() == x1 && chessPicess.get(w).getY() == w) { conts++; } } } for (int i = 0; i < chessPicess.size(); i++) { if (chessPicess.get(i).getX() == x2 && chessPicess.get(i).getY() == y2) { if (chessPicess.get(i).getColor().equals(colorss)) { } else { conts++; } } } if (conts == 0) { continues = "yes"; } } if (dx == dy) { conts = 0; int t =0; t = Math.min(x1, x2) + 1; for (int g = Math.min(y1, y2) + 1; g < Math.max(y1, y2); g++) { for (int r = 0; r < chessPicess.size(); r++) { if (chessPicess.get(r).getX() == t && chessPicess.get(r).getY() == g) { conts++; } } } for (int i = 0; i < chessPicess.size(); i++) { if (chessPicess.get(i).getX() == x2 && chessPicess.get(i).getY() == y2) { if (chessPicess.get(i).getColor().equals(colorss)) { } else { conts++; } } } if (conts == 0) { continues = "yes"; } } } return continues; } /** * identify that we can move this king piece or not * @param x1 x of the starting point * @param x2 x of the destination point * @param y1 y of the starting point * @param y2 y of the destination point * @return yes or no to continue or not */ public String checkKing(int x1,int x2,int y1,int y2,String colorChoice){ int dx = Math.abs(x2-x1); int dy = Math.abs(y2-y1); String continues = "no"; if ((dx == 1 && dy == 0) || (dx == 0 && dy == 1) || (dy == dx && dy == 1)) { for(int o=0;o<chessPicess.size();o++){ if(chessPicess.get(o).getX()==x2 && chessPicess.get(o).getY()==y2){ if(chessPicess.get(o).getColor().equals(colorChoice)){ } else{ continues = "yes"; } } } } return continues; } /** * identify that we can move this knight piece or not * @param x1 x of the starting point * @param x2 x of the destination point * @param y1 y of the starting point * @param y2 y of the destination point * @return yes or no to continue or not */ public String checkKnight(int x1,int x2,int y1,int y2,String colorss){ int dx = Math.abs(x2-x1); int dy = Math.abs(y2-y1); String continues = "no"; int t=0; for(int r=0;r<chessPicess.size();r++){ if(chessPicess.get(r).getX()==x1 && chessPicess.get(r).getY()==y1){ t=r; } } int conts = 0; if (dx != dy && ((dx == 1 && dy == 2) || (dx == 2 && dy == 1))) { if (chessPicess.get(t).getX() == x2 && chessPicess.get(t).getY() == y2) { if (chessPicess.get(t).getColor().equals(colorss)) { // System.out.println("color" + colorss); conts++; } } } if (conts == 0) { continues = "yes"; } return continues; } /** * identify that we can move this pawn piece or not * @param x1 x of the starting point * @param x2 x of the destination point * @param y1 y of the starting point * @param y2 y of the destination point * @return yes or no to continue or not */ public String checkPawn(int x1,int x2,int y1,int y2){ int dy = Math.abs(y2-y1); int dx = Math.abs(x2-x1); String continues = "no"; dy = y2-y1; int t=0; System.out.println("x1:"+x1+" y1:"+y1+" x2:"+x2+" y2:"+y2+" dx:"+dx+" dy:"+dy); for(int r=0;r<chessPicess.size();r++){ if(chessPicess.get(r).getX()==x1 && chessPicess.get(r).getY()==y1){ t=r; } } System.out.println("color:"+chessPicess.get(t).getColor()+"dx checkpawn:"+dx+"x1:"+x1+" x2:"+x2+"dy checkpawn:"+dy+"y1:"+y1+"y2:"+y2); if(chessPicess.get(t).getFirst().equals("no") && dx==0 && (Math.abs(dy)==1 || Math.abs(dy)==2)){ if(chessPicess.get(t).getColor().equals("black") && (dy>0)){ continues = "yes"; //chessPicess.get(t).setFirst("yes"); } if(chessPicess.get(t).getColor().equals("white") && (dy<0)){ continues = "yes"; //chessPicess.get(t).setFirst("yes"); } } if(chessPicess.get(t).getFirst().equals("yes") && dx==0 && ( Math.abs(dy)==1)){ if(chessPicess.get(t).getColor().equals("black") && (dy>0)){ continues = "yes"; } if(chessPicess.get(t).getColor().equals("white") && (dy<0)) { continues = "yes"; } } return continues; } /** * this function gives the x and y of the destination point and move it * @param address gives the x and y of the destination point * @param colorChoice gives the color of piece * @return yes or no that we can move or not */ public String move(String address , String colorChoice) { Scanner input = new Scanner(System.in); String finish = "no"; int go = 0; int x1 = Character.getNumericValue(address.charAt(0)); int y1 = Character.getNumericValue(address.charAt(1)); int x2 =Character.getNumericValue(address.charAt(3)); int y2 = Character.getNumericValue(address.charAt(4)); System.out.println("x1:"+x1+"y1:"+y1+"x2:"+x2+"y2:"+y2); for (int o = 0; o < chessPicess.size(); o++) { if (chessPicess.get(o).getX() == x1 && chessPicess.get(o).getY() == y1) { if (chessPicess.get(o).getColor().equals(colorChoice)) { go = 0; } else { go++; System.out.println("It's not your chess picess try from yours! "); String vorood = input.next(); move(vorood, colorChoice); } } } String name; String s = "no"; String continues = "no"; for (int j = 0; j < chessPicess.size(); j++) { if (chessPicess.get(j).getX() == x1 && chessPicess.get(j).getY() == y1) { int dx; int dy; dx = Math.abs(x2 - x1); dy = Math.abs(y2 - y1); continues = "no"; System.out.println("dx:"+dx+"dy"+dy); name = chessPicess.get(j).getName(); String colorss = chessPicess.get(j).getColor(); switch (name) { case "Rook": continues = checkRook(x1,x2,y1,y2); break; case "Pawn": System.out.println("x:"+x1+"x2:"+x2+"y1:"+y1+"y2:"+y2); continues = checkPawn(x1,x2,y1,y2); if(continues.equals("yes")){ for(int i=0;i<chessPicess.size();i++){ if(chessPicess.get(i).getX()==x2 && chessPicess.get(i).getY()==y2){ chessPicess.get(i).setFirst("yes"); } } } System.out.println("continues"+continues); break; case "Bishop": continues = checkBishop(x1,x2,y1,y2,colorss); break; case "Queen": continues = checkQueen(x1,x2,y1,y2,colorss); break; case "Knight": continues = checkKnight(x1,x2,y1,y2,colorss); break; case "King": s = checkKing(x1,x2,y1,y2,colorss); if(checkKingChoiceKish(x1,x2,y1,y2)){ System.out.println("kish , pay more attention on choosing your next move"); } if(s.equals("no")){ System.out.println("wrong move try one more time"); String r = input.next(); move(r,colorChoice); } else { continues = checkKing(x1, x2, y1, y2, colorChoice); } if(chessPicess.get(j).getSizeOfChoices()==0){ System.out.println("you loose"); finish = "yes"; } break; } break; } } for (int j = 0; j < chessPicess.size(); j++) { if (chessPicess.get(j).getX() == x2 && chessPicess.get(j).getY() == y2) { if (continues.equals("yes")) { System.out.println("yesyes"); if(chessPicess.get(j).getColor().equals("black")){ deletedBlackChess.add(chessPicess.get(j).getName()); }if(chessPicess.get(j).getColor().equals("white")){ getDeletedWhiteChess.add(chessPicess.get(j).getName()); } chessPicess.remove(j); } } if (continues.equals("no")) { System.out.println("wrong move"); System.out.println("try one more time"); String newVoroodi = input.next(); move(newVoroodi,colorChoice); break; } break; } for (int i = 0; i < chessPicess.size(); i++) { if (chessPicess.get(i).getX() == x1 && chessPicess.get(i).getY() == y1 && continues.equals("yes")) { chessPicess.get(i).setX(Character.getNumericValue(address.charAt(3))); chessPicess.get(i).setY(Character.getNumericValue(address.charAt(4))); System.out.println("x:"+chessPicess.get(i).getName()+chessPicess.get(i).getColor()+"x"+chessPicess.get(i).getX()+"y"+chessPicess.get(i).getY()); break; } } makingPicessChoices(); return finish; } /** * define the places that the piece can move */ public void makingPicessChoices(){ int t; int x1=0; int y1=0; String result; String type = null; String colors = null; //for(Pices ui:chessPicess){ for (int zx = 0; zx <chessPicess.size() ; zx++) { // x1 = ui.getX(); x1 = chessPicess.get(zx).getX(); //y1 = ui.getY(); y1 = chessPicess.get(zx).getY(); //type = ui.getName(); type = chessPicess.get(zx).getName(); //colors = ui.getColor(); colors = chessPicess.get(zx).getColor(); System.out.println(chessPicess.get(zx).getName()+"%%%%the sample%%%%%%%%%%%%%%%%%%%%%%%%%%"+"x1::"+x1+" y1::"+y1+type+colors); t=1; /* for(int y=0;y<chessPicess.size();y++){ for (int u=0;u<chessPicess.get(y).getNumber();u++){ chessPicess.get(y).xChoice[u]=0; chessPicess.get(y).yChoice[u]=0; } } for(int y=0;y<chessPicess.size();y++){ if(chessPicess.get(y).getX()==x1 && chessPicess.get(y).getY()==y1){ type = chessPicess.get(y).getName(); colors = chessPicess.get(y).getColor(); System.out.println("type"+type); break; } }*/ switch (type){ case "Pawn": System.out.println(type+"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"); for (t = 1; t <= 8; t++) { for(int u=1;u<=8;u++){ System.out.println("111xx::"+chessPicess.get(zx).getX()+"yy::"+chessPicess.get(zx).getY()); result = checkPawn(chessPicess.get(zx).getX(),u,chessPicess.get(zx).getY(),t); System.out.println("result::::::::"+result+"x2:"+t+" y2:"+u+chessPicess.get(zx).getName()+"x111::"+chessPicess.get(zx).getX()+"y1:"+chessPicess.get(zx).getY()); if(result.equals("yes")){ for(int y=0;y<chessPicess.size();y++){ if(chessPicess.get(y).getX()==chessPicess.get(zx).getX() && chessPicess.get(y).getY()==chessPicess.get(zx).getY()){ int num = chessPicess.get(y).getSizeOfChoices(); chessPicess.get(y).setChoices(t-1,u-1,num); System.out.println("t"+t+"u"+u+"name"+"****************************************************"); break; } } } } } System.out.println("kkkkkkkkkkkkkkkkkkkkkkkkkkkkkk"); break; case "Rook": t=1; for(int u=1;u<=8;u++){ result = checkRook(x1,y1,t,u); if(result.equals("yes")){ for(int y=0;y<chessPicess.size();y++){ if(chessPicess.get(y).getX()==x1 && chessPicess.get(y).getY()==y1){ int num = chessPicess.get(y).getChoice().size(); chessPicess.get(y).setChoices(t,u,num); break; } } } t++; } break; case "Knight": t=1; for(int u=1;u<=8;u++){ result = checkKnight(x1,y1,t,u,colors); if(result.equals("yes")){ for(int y=0;y<chessPicess.size();y++){ if(chessPicess.get(y).getX()==x1 && chessPicess.get(y).getY()==y1){ int num = chessPicess.get(y).getChoice().size(); chessPicess.get(y).setChoices(t,u,num); break; } } } t++; } break; case "Bishop": t=1; for(int u=1;u<=8;u++){ result = checkBishop(x1,y1,t,u,colors); if(result.equals("yes")){ for(int y=0;y<chessPicess.size();y++){ if(chessPicess.get(y).getX()==x1 && chessPicess.get(y).getY()==y1){ int num = chessPicess.get(y).getChoice().size(); chessPicess.get(y).setChoices(t,u,num); break; } } } t++; } break; case "Queen": t=1; for(int u=1;u<=8;u++){ result = checkQueen(x1,y1,t,u,colors); if(result.equals("yes")){ for(int y=0;y<chessPicess.size();y++){ if(chessPicess.get(y).getX()==x1 && chessPicess.get(y).getY()==y1){ // chessPicess.get(y).setX(t); // chessPicess.get(y).setY(u); int num = chessPicess.get(y).getChoice().size(); chessPicess.get(y).setChoices(t,u,num); break; } } } t++; } break; case"King": t=1; for(int u=1;u<=8;u++){ result = checkKing(x1,y1,t,u,colors); if(result.equals("yes")){ for(int y=0;y<chessPicess.size();y++){ if(chessPicess.get(y).getX()==x1 && chessPicess.get(y).getY()==y1){ int num = chessPicess.get(y).getChoice().size(); chessPicess.get(y).setChoices(t,u,num); break; } } } t++; } break; } } } /** * check that we can move the piece or not * @param x1 get the x of starting point * @param x2 get the x of destination point * @param y1 get the y of starting point * @param y2 get the y of destination point * @return */ public Boolean checkKingChoiceKish(int x1,int x2,int y1,int y2){ Boolean kish = Boolean.valueOf("false"); int t=1; for(int y=0;y<chessPicess.size();y++){ if(chessPicess.get(y).getX()==x1 && chessPicess.get(y).getY()==y1){ t=y; break; } } for(int g=0;g<chessPicess.get(t).getChoice().size();g++) { for (int u = 0; u < chessPicess.size(); u++) { for(int i=0;i<chessPicess.get(u).getChoice().size();i++){ if(chessPicess.get(u).xChoice[i]==chessPicess.get(t).xChoice[g] && chessPicess.get(u).yChoice[i]==chessPicess.get(t).yChoice[g]){ kish = Boolean.valueOf("true"); break; } } } } return kish; } /** * used to move the pieces */ public void moving(){ Scanner input = new Scanner(System.in); String finish = "no"; String voroodi; String voroodii; String color; while(finish!="yes"){ System.out.println("white turn"); // makingPicessChoices(); voroodi = input.next(); color = "white"; finish = move(voroodi,color); System.out.println("black turn"); voroodii = input.next(); color = "black"; finish = move(voroodii,color); display(); for(int u=0;u<chessPicess.size();u++){ if(chessPicess.get(u).getName().equals("king") && chessPicess.get(u).getNumber()==0){ finish="yes"; } } //finish = "yes"; } } }
[ "9731059@ceit.local" ]
9731059@ceit.local
cfebd8070fdc8f10581912e3a59260284ea91164
2da83cafeec03e818b6e9ba4466a08758c0d73c1
/SisVenLog/SisVenLog/SisVenLog-ejb/src/java/dao/RecibosProvFacade.java
0ae9086620d7fceda5ae8badccf763dbb0c33e93
[]
no_license
lokolte/SisVenLog-WEB
a224f8a1b2b1a600ab64e59a01f37a8c66323328
657ce638f44aaecc90594901fe88fe17e75c3c12
refs/heads/master
2020-12-06T19:44:42.047301
2020-01-07T00:33:46
2020-01-07T00:33:46
232,536,488
0
0
null
2020-02-03T05:47:38
2020-01-08T10:19:30
null
UTF-8
Java
false
false
736
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 dao; import entidad.RecibosProv; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; /** * * @author admin */ @Stateless public class RecibosProvFacade extends AbstractFacade<RecibosProv> { @PersistenceContext(unitName = "SisVenLog-ejbPU") private EntityManager em; @Override protected EntityManager getEntityManager() { return em; } public RecibosProvFacade() { super(RecibosProv.class); } }
[ "varios@SISTEMAS6.salemma.local" ]
varios@SISTEMAS6.salemma.local
665efc7bfc245f88e27be1b023db3982e81991b3
10b81777614fbd354c2e65aeb77752cd4c67a1fb
/src/Modules/AIRoleChoice.java
04d38d800002983058ada04d480f122484389d4b
[]
no_license
srlarkin/PuertoRico
dbc5c7657b74e81ba1ab83df62315ae9e98bf05f
08a05177981e433bf630b9199551fe496d46a71e
refs/heads/master
2016-09-10T12:06:06.935411
2014-06-27T13:36:23
2014-06-27T13:36:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
224
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package Modules; /** * * @author steve */ public class AIRoleChoice { public int [] WtArray; public int CumRoleWt; }
[ "" ]
005c1073d0da64b4de4d4614438425594e0ee791
7bb07f40c5a62e300ae4e83bf789e5aa1f1b70f7
/core/tags/1.5.1/1.4.2/src/com/vividsolutions/jump/workbench/ui/plugin/analysis/ConvexHullPlugIn.java
079ddad3b2b647a581d5c0811b1156d429d3fefa
[]
no_license
abcijkxyz/jump-pilot
a193ebf9cfb3f082a467c0cfbe0858d4e249d420
3b6989a88e5c8e00cd55c3148f00a7bf747574c7
refs/heads/master
2022-12-18T15:22:44.594948
2020-09-23T10:46:11
2020-09-23T10:46:11
297,995,218
0
0
null
2020-09-23T15:27:25
2020-09-23T14:23:54
null
UTF-8
Java
false
false
6,046
java
/* * The Unified Mapping Platform (JUMP) is an extensible, interactive GUI * for visualizing and manipulating spatial features with geometry and attributes. * * Copyright (C) 2003 Vivid Solutions * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * For more information, contact: * * Vivid Solutions * Suite #1A * 2328 Government Street * Victoria BC V8T 5G5 * Canada * * (250)385-6040 * www.vividsolutions.com */ package com.vividsolutions.jump.workbench.ui.plugin.analysis; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.swing.JComboBox; import com.vividsolutions.jts.geom.*; import com.vividsolutions.jump.I18N; import com.vividsolutions.jump.feature.Feature; import com.vividsolutions.jump.feature.FeatureCollection; import com.vividsolutions.jump.feature.FeatureDatasetFactory; import com.vividsolutions.jump.task.TaskMonitor; import com.vividsolutions.jump.workbench.WorkbenchContext; import com.vividsolutions.jump.workbench.model.StandardCategoryNames; import com.vividsolutions.jump.workbench.plugin.*; import com.vividsolutions.jump.workbench.ui.GUIUtil; import com.vividsolutions.jump.workbench.ui.MenuNames; import com.vividsolutions.jump.workbench.ui.MultiInputDialog; import com.vividsolutions.jump.workbench.ui.plugin.FeatureInstaller; public class ConvexHullPlugIn extends AbstractPlugIn implements ThreadedPlugIn { private String LAYER = I18N.get("ui.plugin.analysis.ConvexHullPlugIn.Source-Layer"); private MultiInputDialog dialog; public ConvexHullPlugIn() { } private String categoryName = StandardCategoryNames.RESULT; public void setCategoryName(String value) { categoryName = value; } public void initialize(PlugInContext context) throws Exception { FeatureInstaller featureInstaller = new FeatureInstaller(context.getWorkbenchContext()); featureInstaller.addMainMenuItem( this, new String[] {MenuNames.TOOLS, MenuNames.TOOLS_ANALYSIS}, this.getName() + "...", false, //checkbox null, //icon createEnableCheck(context.getWorkbenchContext())); } public static MultiEnableCheck createEnableCheck(WorkbenchContext workbenchContext) { EnableCheckFactory checkFactory = new EnableCheckFactory(workbenchContext); return new MultiEnableCheck() .add(checkFactory.createWindowWithLayerNamePanelMustBeActiveCheck()) .add(checkFactory.createAtLeastNLayersMustExistCheck(1)); } public boolean execute(PlugInContext context) throws Exception { //[sstein, 16.07.2006] put here again for language settings LAYER = I18N.get("ui.plugin.analysis.ConvexHullPlugIn.Source-Layer"); //Unlike ValidatePlugIn, here we always call #initDialog because we want //to update the layer comboboxes. [Jon Aquino] initDialog(context); dialog.setVisible(true); if (!dialog.wasOKPressed()) { return false; } return true; } public String getName(){ return I18N.get("ui.plugin.analysis.ConvexHullPlugIn.Convex-Hull-on-Layer"); } private void initDialog(PlugInContext context) { dialog = new MultiInputDialog(context.getWorkbenchFrame(), I18N.get("ui.plugin.analysis.ConvexHullPlugIn.Convex-Hull-on-Layer"), true); //dialog.setSideBarImage(IconLoader.icon("Overlay.gif")); dialog.setSideBarDescription( I18N.get("ui.plugin.analysis.ConvexHullPlugIn.Creates-a-new-layer-containing-the-convex-hull-of-all-the-features-in-the-source-layer")); String fieldName = LAYER; JComboBox addLayerComboBox = dialog.addLayerComboBox(fieldName, context.getCandidateLayer(0), null, context.getLayerManager()); GUIUtil.centreOnWindow(dialog); } public void run(TaskMonitor monitor, PlugInContext context) throws Exception { FeatureCollection a = dialog.getLayer(LAYER).getFeatureCollectionWrapper(); FeatureCollection hullFC = convexHhull(monitor, a); if (hullFC == null) return; context.getLayerManager().addCategory(categoryName); context.addLayer(categoryName, I18N.get("ui.plugin.analysis.ConvexHullPlugIn.Convex-Hull"), hullFC); } private FeatureCollection convexHhull(TaskMonitor monitor, FeatureCollection fc) { monitor.allowCancellationRequests(); monitor.report(I18N.get("ui.plugin.analysis.ConvexHullPlugIn.Computing-Convex-Hull") + "..."); int size = fc.size(); GeometryFactory geomFact = null; if (size == 0) return null; int count = 0; Geometry[] geoms = new Geometry[size]; for (Iterator i = fc.iterator(); i.hasNext();) { Feature f = (Feature) i.next(); Geometry geom = f.getGeometry(); if (geom == null) continue; if (geomFact == null) geomFact = geom.getFactory(); geoms[count++] = geom; } GeometryCollection gc = geomFact.createGeometryCollection(geoms); Geometry hull = gc.convexHull(); List hullList = new ArrayList(); hullList.add(hull); return FeatureDatasetFactory.createFromGeometry(hullList); } }
[ "edso@d6f7b87f-2e33-0410-8384-f77abc8d64da" ]
edso@d6f7b87f-2e33-0410-8384-f77abc8d64da
6960dd16594f354e8d7a8f844fbac38e38f532d6
a73f25b69f8ea88b12bad09cfee49f3471630604
/app/src/main/java/com/ennoblesoft/arif/architectureexample/view/adapters/NoteAdapter.java
35dbb271d4cfc10f0f6b9f1a687bb2134519f2bf
[]
no_license
xeoncrypto/ArchitectureComponentExample
5169a0eb55a3c864b952126f3d7971ec1c242a4d
200afc6707a20f5ea8694d519a4a542521a2c4fe
refs/heads/master
2020-05-03T09:16:46.369702
2018-12-16T11:13:31
2018-12-16T11:13:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,137
java
package com.ennoblesoft.arif.architectureexample.view.adapters; import android.support.annotation.NonNull; import android.support.v7.recyclerview.extensions.ListAdapter; import android.support.v7.util.DiffUtil; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.ennoblesoft.arif.architectureexample.R; import com.ennoblesoft.arif.architectureexample.model.room.Note; public class NoteAdapter extends ListAdapter<Note, NoteAdapter.NoteViewHolder> { private OnItemClickListener mListener; public NoteAdapter() { super(DIFF_CALLBACK); } private static final DiffUtil.ItemCallback<Note> DIFF_CALLBACK = new DiffUtil.ItemCallback<Note>() { @Override public boolean areItemsTheSame(@NonNull Note oldNote, @NonNull Note newNote) { return oldNote.getId() == newNote.getId(); } @Override public boolean areContentsTheSame(@NonNull Note oldNote, @NonNull Note newNote) { return oldNote.getTitle().equals(newNote.getTitle()) && oldNote.getDescription().equals(newNote.getDescription()) && oldNote.getPriority() == newNote.getPriority(); } }; @NonNull @Override public NoteViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { View view = LayoutInflater.from(viewGroup.getContext()) .inflate(R.layout.item_note, viewGroup, false); return new NoteViewHolder(view); } @Override public void onBindViewHolder(@NonNull NoteViewHolder noteViewHolder, int i) { Note note = getItem(i); noteViewHolder.setNote(note.getTitle(), note.getDescription(), note.getPriority()); } public Note NotePositionAt(int position) { return getItem(position); } class NoteViewHolder extends RecyclerView.ViewHolder { private TextView tvTitle, tvDescription, tvPriority; private NoteViewHolder(@NonNull View itemView) { super(itemView); tvTitle = itemView.findViewById(R.id.tv_title); tvDescription = itemView.findViewById(R.id.tv_description); tvPriority = itemView.findViewById(R.id.tv_priority); itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int position = getAdapterPosition(); if (mListener != null && position != RecyclerView.NO_POSITION) { mListener.OnItemClicked(getItem(position)); } } }); } private void setNote(String title, String description, int priority) { tvTitle.setText(title); tvDescription.setText(description); tvPriority.setText(String.valueOf(priority)); } } public interface OnItemClickListener { void OnItemClicked(Note note); } public void SetOnItemClickListener(OnItemClickListener listener) { this.mListener = listener; } }
[ "arif991846@gmail.com" ]
arif991846@gmail.com
964bb5e2b8a2fb11799c9fff92cf267e5a4a1f76
6a65ca8d5052f4ff1491950e39652930ff09130a
/Projet-ENI-Java-EE/src/fr/eni/trocencheres/dal/DAOFactory.java
16de75c2c786f0fd93eca8fd4e2c169b73d0903a
[]
no_license
MacoRudy/Projet-ENI-Java-EE
e0f5dc88c54569b6544a1d26985989c4b5eb476e
5e3c78031b8a36631ddf8b2cf6c84ba13b064cab
refs/heads/master
2022-11-28T17:52:08.144980
2020-07-30T09:29:05
2020-07-30T09:29:05
283,715,151
0
0
null
null
null
null
UTF-8
Java
false
false
696
java
package fr.eni.trocencheres.dal; import fr.eni.trocencheres.dal.jdbcImpl.CategorieDAOJdbcImpl; import fr.eni.trocencheres.dal.jdbcImpl.EnchereDAOJdbcImpl; import fr.eni.trocencheres.dal.jdbcImpl.UtilisateurDAOJdbcImpl; import fr.eni.trocencheres.dal.jdbcImpl.VenteDAOJdbcImpl; /** * * @author jeanr * */ public abstract class DAOFactory { public static CategorieDAO getCategorieDAO() { return new CategorieDAOJdbcImpl(); } public static EnchereDAO getEnchereDAO() { return new EnchereDAOJdbcImpl(); } public static UtilisateurDAO getUtilisateurDAO() { return new UtilisateurDAOJdbcImpl(); } public static VenteDAO getVenteDAO() { return new VenteDAOJdbcImpl(); } }
[ "ralpina@hotmail.com" ]
ralpina@hotmail.com
ec5b10b3917ff4522af33a7817724fa5880b0d1a
ef2b2cb1ebb1e55038de3563d5a1be8677f9068d
/app/src/androidTest/java/projects/devdreamers/nearbymeapp/ApplicationTest.java
cda998b42bc718a0cc60b8963b501e291645823f
[]
no_license
simplekjl/NearByMeApp
3d8ee655ad3b88255f42767852b494f7953c7bd7
3e070687dcfe941e70c64dc73727bb0c76a47226
refs/heads/master
2021-01-10T03:18:45.633568
2016-02-19T14:37:09
2016-02-19T14:37:09
52,093,589
0
0
null
null
null
null
UTF-8
Java
false
false
363
java
package projects.devdreamers.nearbymeapp; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
[ "jl.cs606@gmail.com" ]
jl.cs606@gmail.com
a8ff6ba338e80471cce17babcc3450850e69e2c5
ff2241411b77594e3d4fb4ac0143b3b11128023f
/Android_learning/HelllWorld/app/build/generated/source/buildConfig/androidTest/debug/com/example/helllworld/test/BuildConfig.java
8cbe381e693699383b62469049a46af823117438
[]
no_license
pengjia-git/code
7eaa3caf603b47f61b4b71d16fc3d650fecaee91
df3e460c9df84f73a64b66dc70d73e5b4524f560
refs/heads/master
2021-01-18T03:39:16.475318
2020-09-08T14:29:46
2020-09-08T14:29:46
85,801,907
1
0
null
null
null
null
UTF-8
Java
false
false
461
java
/** * Automatically generated file. DO NOT MODIFY */ package com.example.helllworld.test; public final class BuildConfig { public static final boolean DEBUG = Boolean.parseBoolean("true"); public static final String APPLICATION_ID = "com.example.helllworld.test"; public static final String BUILD_TYPE = "debug"; public static final String FLAVOR = ""; public static final int VERSION_CODE = 1; public static final String VERSION_NAME = "1.0"; }
[ "1730548875@qq.com" ]
1730548875@qq.com
86e386240569006b107640e58438d800eea4d0c0
e245541e3f2cb5f3fbfbe8d374db2ae777b29bed
/src/main/java/com/upc/controller/MeController.java
4b2bfe0c2c59c50ca1cd2f398a76cce48873fece
[]
no_license
bin9450/GuideBuy
139bd9becaede60de12c3599198de0734d6235cd
c33b90bdaf9bea6db96dfda1466c2dd899b3af70
refs/heads/master
2022-12-01T16:02:20.178110
2019-11-06T10:04:10
2019-11-06T10:04:10
181,823,837
5
0
null
2022-11-16T11:47:47
2019-04-17T05:36:05
CSS
UTF-8
Java
false
false
935
java
package com.upc.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; /** * @Author: Pan * @Date: 2019/4/15 15:06 * @Description: **/ @Controller @RequestMapping("/meInfo") public class MeController { @RequestMapping("/footprint") public String showFoot(){ return "footprint"; } @RequestMapping("/footprintdetail") public String showFootDetail(){ return "footprintdetail"; } @RequestMapping("/mycollecthistory") public String showCollecthistory(){ return "mycollecthistory"; } @RequestMapping("/mycollection") public String showMycollection(){ return "mycollection"; } @RequestMapping("/order") public String showOrder(){ return "order"; } @RequestMapping("/orderdetail") public String showOrderDetail(){ return "orderdetail"; } }
[ "945023912@qq.com" ]
945023912@qq.com
6155d0c96e89bd0bfb9ddb938fb6801557612234
3f5d02ff09f54d0f8a8b26e9a6d75c62638d25b2
/spring-boot-quick/src/main/java/com/zhoushugang/springbootquick/model/Floor.java
d8fce10a844bb159799d13fceb789a8a40a3bd80
[]
no_license
hugezhou/spring
4082a4368404cce2bbbd57be9e94a7ac8116792e
33fa79085dd2250752521d85503b73ab0da51594
refs/heads/master
2023-01-03T10:08:44.015065
2020-10-30T08:45:16
2020-10-30T08:45:16
308,572,302
0
0
null
null
null
null
UTF-8
Java
false
false
1,339
java
package com.zhoushugang.springbootquick.model; import com.loyal.safe.framework.mybatis.BaseEntity; import javax.persistence.Column; import javax.persistence.Id; import javax.persistence.Transient; import java.io.Serializable; import java.util.List; @Getter @Setter @ToString public class Floor extends BaseEntity implements Serializable { @Id @Column(name = "ID") private String id; /** * 楼层名称/平面图名称 */ @Column(name = "NAME") private String name; @Transient private String fullName; /** * 联网单位 */ @Column(name = "BUILDING_ID") private String buildingId; @Transient private Integer num; /** * 切片路径 */ @Column(name = "cut_dir") private String cutDir; @Transient private boolean picModify; @Transient private String num1; @Transient private String num2; @Transient private String unitId; @Transient private Building building; @Transient private SysFile sysFile; @Transient private List<String> buildingIdList; @Transient private int totalDevice; @Transient private int totalPatrolPoint; @Transient private String warnId; @Transient private String faultId; @Transient private List<String> floorIds; }
[ "804331017@qq.com" ]
804331017@qq.com
2e8be924067f54f153a81d754a91a8d989c37376
e35953c216964ba014823dddc3275be4de6bd117
/spring-data-reactive-mongodb-simple/src/test/java/com/barath/reactive/mongodb/app/UserServiceTest.java
16df70b08080cc4d25d60f0be28ba95c55cffe02
[]
no_license
BarathArivazhagan/spring-mongodb-workshop
bc836b46b5fe400668f57317dbf087abf54f5b38
fdcf3c65ea105309616e58354fac04da850dafe0
refs/heads/master
2022-07-31T07:25:49.735473
2022-07-01T02:59:51
2022-07-01T02:59:51
71,271,334
0
1
null
2019-01-28T15:58:32
2016-10-18T17:01:23
Java
UTF-8
Java
false
false
965
java
package com.barath.reactive.mongodb.app; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.web.servlet.MockMvc; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; /** * Created by barath on 31/03/18. */ public class UserServiceTest extends AbstractSpringRunner { @Autowired private UserService userService; @Autowired private UserRepository userRepository; @Test public void testMonoUser(){ User user = new User("barath"); Mono<User> barathMono = Mono.just(user); StepVerifier.create(barathMono).expectNext(user).verifyComplete(); } @Test public void testAddUser(){ User user = new User("test"); Mono<User> testMono = Mono.just(user); System.out.println(userService); StepVerifier.create(this.userService.addUser(testMono)).expectNext(user).verifyComplete(); } }
[ "barathmacdec91@gmail.com" ]
barathmacdec91@gmail.com
77a60b9413436ca5d8fa50e93bd0ca740cbe9bd8
a41b76082aceb1b777c6139dc01ad91e7b165473
/src/fitnesse/wikitext/test/NewlineTest.java
a5cf6c7b577c6c4a4eac44caedef11e5738bf04b
[]
no_license
solsila/Fitnesse
6b424870c931f31f4e4c09a7fa65d210f07f2e62
cc1e4f0b04fc9da85e900719b924485e373aa92e
refs/heads/master
2020-06-04T02:11:54.386363
2013-10-25T13:25:20
2013-10-25T13:25:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
256
java
package fitnesse.wikitext.test; import org.junit.Test; public class NewlineTest { @Test public void translatesNewlines() { ParserTestHelper.assertTranslatesTo("hi\nmom", "hi" + ParserTestHelper.newLineRendered + "mom"); } }
[ "solsila@gmail.com" ]
solsila@gmail.com
75cbe41d53cea402e297e3953442c5d1f03f5c27
d795d80bd8c74acdaca2e443d2cd72074561ea21
/wonghetto/wonghetto-desktop/src/main/java/be/pcab/wonghetto/wonghettodesktop/tasks/package-info.java
c25a5c4edcbe3485c2ff15e9068eef1cc9a37bac
[]
no_license
pcabras/WonghettoRepo
37cb095d3741b4a0b4a86227eb9861a57c512534
5856b12d354dd84454b171db777344ff000458de
refs/heads/master
2021-01-01T18:12:15.788363
2015-07-28T09:16:46
2015-07-28T09:16:46
38,036,311
0
0
null
null
null
null
UTF-8
Java
false
false
184
java
/** * Package for asynchronous tasks.<p> * It contains objects dealing with time-consuming tasks. * * @author Paolo Cabras * */ package be.pcab.wonghetto.wonghettodesktop.tasks;
[ "cabras.pao@gmail.com" ]
cabras.pao@gmail.com
90cf70fdd3c95ba5c678a4679514af63549887bd
c7945662d1ae51e15aed13bcc883816fa7940185
/frontendMY/iPet/app/src/main/java/sg/edu/ntu/e/fang0074/ipet/controlclasses/UserDAO.java
d04949b4e272071b9d70e3ab9d64958267983996
[]
no_license
OrigenesZhang/cz2006project
615ea7737ab1c4cc71446dc8028dbd9d77a50550
0527a099063bf344f6a6637d84f00764ba271995
refs/heads/master
2021-05-09T20:47:42.559018
2018-04-11T03:36:42
2018-04-11T03:36:42
118,705,045
3
1
null
2018-03-21T04:37:56
2018-01-24T03:15:05
Python
UTF-8
Java
false
false
3,007
java
package sg.edu.ntu.e.fang0074.ipet.controlclasses; import java.util.ArrayList; public class UserDAO extends UserDAOabs { public static User currentUser = new User("AUser", "test", "11111111", "") ; public static ArrayList<User> allusers = new ArrayList<User>(); public UserDAO() { super(); //TODO: load the user database into the allusers list } User getCurrentUser() { return currentUser; } public void updateUserName(String newUserName) { //TODO: Notify database for(User user: allusers){ if(user.getUserName().equals(currentUser.getUserName())){ user.setPrevName(user.getUserName()); user.setUserName(newUserName); } } currentUser.setPrevName(currentUser.getUserName()); currentUser.setUserName(newUserName); notifyAllObservers(); } // Do not notify observers since this information is not shared. public void updateUserPassword(String newPassword) { //TODO: Notify database for(User user:allusers){ if(user.getUserName().equals(currentUser.getUserName())){ user.setPassword(newPassword); } } currentUser.setPassword(newPassword); } public void updatePhone(String newPhone) { //TODO: Notify database for(User user:allusers){ if(user.getUserName().equals(currentUser.getUserName())){ user.setPhone(newPhone); } } currentUser.setPhone(newPhone); notifyAllObservers(); } //select another user as the current user, used for logout and new log in @Override void getNewUser(String newUsername) { for(User newuser : allusers){ System.out.println(newuser.getUserName()); if(newuser.getUserName().equals(newUsername)){ currentUser.setUserName(newuser.getUserName()); currentUser.setPassword(newuser.getPassword()); currentUser.setPhone(newuser.getPhone()); } } } @Override ArrayList<User> getAllUsers() { return allusers; } @Override public void addUser(String username, String pwd, String phone) { //TODO: Notify database User newuser = new User(username, pwd, phone, ""); allusers.add(newuser); //cont("--add_user", username, pwd, phone); } @Override void deleteUser(String username) { //TODO: Notify database for(User user : allusers) { if(user.getUserName().equals(username)) { allusers.remove(user); return; } } //TODO: Handle User Not Found } /*Verify username and password*/ public boolean verify(String name, String pwd) { this.getNewUser(name); if(!currentUser.getUserName().equals(null)){ if(pwd.equals(currentUser.getPassword())) { return true; } } return false; } /* Check if the username entered is valid */ public boolean checkexist(String name) { for(User user : allusers) { if(user.getUserName().equals(name)) { return true; } } return false; } }
[ "fang0074@e.ntu.edu.sg" ]
fang0074@e.ntu.edu.sg