blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
1961e3d8253a3001f0d23cec9e8cb24d64cb4288
ba5a80f4e19abfbe49e5792cb54b63a4b3f9fbf3
/ServerComponent/SysLogMonitor/src/main/java/com/metis/monitor/syslog/util/C3P0Utils.java
a703fb41c2610a7a7b22e6c45d16c2211c74efcb
[ "Apache-2.0" ]
permissive
jorson/metis
fe4ba44c11887e0a543b55de7e81b4e5c9598ff4
735ba4333b94f7441efdd2f7c25b132003158bae
refs/heads/master
2020-05-12T17:21:29.234539
2014-08-12T13:22:31
2014-08-12T13:22:31
22,030,419
0
0
null
null
null
null
UTF-8
Java
false
false
2,248
java
package com.metis.monitor.syslog.util; import com.mchange.v2.c3p0.ComboPooledDataSource; import com.metis.monitor.syslog.config.SysLogConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.beans.PropertyVetoException; import java.sql.Connection; import java.sql.SQLException; /** * Created by Administrator on 14-8-11. */ public class C3P0Utils { private static volatile C3P0Utils instance = null; private ComboPooledDataSource comboPooledDataSource = null; private static Logger logger = LoggerFactory.getLogger(C3P0Utils.class); private static boolean hasInit = false; public static C3P0Utils getInstance() { synchronized (C3P0Utils.class) { if(instance == null) { synchronized (C3P0Utils.class) { instance = new C3P0Utils(); } } } return instance; } public void init(String driver, String url, String user, String password) { System.out.println(String.format("[C3P0Utils]Connection Info:%s,%s,%s,%s", driver, url, user, password)); if(hasInit) { return; } if(comboPooledDataSource == null) { comboPooledDataSource = new ComboPooledDataSource(); } try { comboPooledDataSource.setDriverClass(driver); } catch (PropertyVetoException e) { if(logger.isErrorEnabled()) { logger.error("C3P0Utils", e); } } comboPooledDataSource.setUser(user); comboPooledDataSource.setPassword(password); comboPooledDataSource.setJdbcUrl(url); //C3P0的可选配置 comboPooledDataSource.setMinPoolSize(5); comboPooledDataSource.setMaxPoolSize(20); comboPooledDataSource.setMaxIdleTime(600); hasInit = true; } private C3P0Utils() { } public Connection getConnection() { Connection connection = null; try { connection = comboPooledDataSource.getConnection(); } catch (SQLException ex) { if(logger.isErrorEnabled()) { logger.error("C3P0Utils", ex); } } return connection; } }
[ "wuhy@101.com" ]
wuhy@101.com
045e1a1fae8815e0a8dd11a41968b987780e671b
01ac263b95122980cfffb04c0190df784fc74ec9
/Palette/src/main/java/com/hixos/smartwp/utils/UnitLocale.java
738b6e076608069bc3c17c06761aeba2eb027193
[]
no_license
Hixos/Palette
b4ec50cca002d13079378ca95424d6d7780f0c24
e5cd5635de40356cb4425dd46dd80af05fcbc096
refs/heads/master
2020-04-17T10:00:14.717448
2019-01-18T23:12:25
2019-01-18T23:12:25
166,483,604
0
0
null
null
null
null
UTF-8
Java
false
false
798
java
package com.hixos.smartwp.utils; import java.util.Locale; public class UnitLocale { public static UnitLocale Imperial = new UnitLocale(); public static UnitLocale Metric = new UnitLocale(); public static UnitLocale getDefault() { return getFrom(Locale.getDefault()); } public static UnitLocale getFrom(Locale locale) { String countryCode = locale.getCountry(); if ("US".equals(countryCode)) return Imperial; // USA if ("LR".equals(countryCode)) return Imperial; // liberia if ("MM".equals(countryCode)) return Imperial; // burma return Metric; } public static float toMeters(float yards) { return yards * 0.9144f; } public static float toYards(float meters) { return meters / 0.9144f; } }
[ "lucaerbetta105@gmail.com" ]
lucaerbetta105@gmail.com
e8806503d1505fc59142ba02546953b0d1db7c41
684422f9bbc67fcad4b8b6a4666d083c00889fe9
/myTracks/src/main/java/com/google/android/apps/mytracks/services/tasks/SplitPeriodicTaskFactory.java
93c0f6cc52b2111201c4afe6cf9f080417845a41
[ "Apache-2.0" ]
permissive
steghio/mytracks
8999c155ec2981546be27fa658378c0d696e92cf
41edef1ef83f1254e7faa5c541d23ea641c06b84
refs/heads/master
2020-07-30T00:51:16.984352
2019-09-21T18:31:41
2019-09-21T18:31:41
210,024,565
1
0
Apache-2.0
2019-09-21T17:13:57
2019-09-21T17:13:57
null
UTF-8
Java
false
false
957
java
/* * Copyright 2012 Google 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 com.google.android.apps.mytracks.services.tasks; import android.content.Context; /** * A {@link PeriodicTaskFactory} for {@link SplitPeriodicTask}. * * @author Jimmy Shih */ public class SplitPeriodicTaskFactory implements PeriodicTaskFactory { @Override public PeriodicTask create(Context context) { return new SplitPeriodicTask(); } }
[ "jshih@google.com" ]
jshih@google.com
dda3c3809e7d1632611e72bbffbabb7b7e42dfaf
4ee576d8d3026452fa3d82a8f3df4445da460cb4
/gxa/src/test/java/uk/ac/ebi/atlas/widget/BaselineAndDifferentialAnalyticsServiceIT.java
b10de9e712d9460831ef6a300663732aabd94604
[ "Apache-2.0" ]
permissive
elisabetb/atlas
ba4b9d14a2f360abafbad28049d446b1d55ab501
db6b92fa319a4f0f105d871c7b598ba7d191910b
refs/heads/master
2021-07-06T00:28:37.012751
2017-09-20T23:02:19
2017-09-20T23:02:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,504
java
package uk.ac.ebi.atlas.widget; import uk.ac.ebi.atlas.acceptance.rest.fixtures.RestAssuredFixture; import com.google.common.collect.ImmutableList; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import org.hamcrest.Matchers; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; import uk.ac.ebi.atlas.model.experiment.ExperimentType; import uk.ac.ebi.atlas.search.SemanticQuery; import uk.ac.ebi.atlas.search.analyticsindex.baseline.BaselineAnalyticsSearchService; import uk.ac.ebi.atlas.search.analyticsindex.differential.DifferentialAnalyticsSearchService; import uk.ac.ebi.atlas.species.Species; import uk.ac.ebi.atlas.species.SpeciesProperties; import javax.inject.Inject; import java.util.Map; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.not; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertTrue; @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration @ContextConfiguration(locations = {"classpath:applicationContext.xml", "/dispatcher-servlet.xml"}) public class BaselineAndDifferentialAnalyticsServiceIT extends RestAssuredFixture { static final SemanticQuery EMPTY_QUERY = SemanticQuery.create(); public static final String BASELINE_GENE = "ENSG00000000003"; public static final String DIFFERENTIAL_GENE = "ENSSSCG00000000024"; public static final String NON_EXISTENT_GENE = "FOOBAR"; @Inject private BaselineAnalyticsSearchService baselineAnalyticsSearchService; @Inject private DifferentialAnalyticsSearchService differentialAnalyticsSearchService; //These tests are really the assertions for ExpressionDataControllerEIT. @Test public void geneExpressedInBaselineAndDifferentialExperiments() { JsonObject result = baselineAnalyticsSearchService.findFacetsForTreeSearch(SemanticQuery.create(BASELINE_GENE), SemanticQuery.create(), new Species("Foous baris", SpeciesProperties.UNKNOWN)); assertThat(result.entrySet(), not(Matchers.empty())); assertTrue("This Ensembl gene has a homo sapiens result", result.has("homo sapiens")); } @Test public void geneExpressedInDifferentialExperimentsOnly() { assertThat( baselineAnalyticsSearchService.findFacetsForTreeSearch(SemanticQuery.create(DIFFERENTIAL_GENE), SemanticQuery.create(), new Species("Foous baris", SpeciesProperties.UNKNOWN)), is(new JsonObject())); assertThat( differentialAnalyticsSearchService.fetchFacets(SemanticQuery.create(DIFFERENTIAL_GENE), EMPTY_QUERY) .entrySet(), not(Matchers.<Map.Entry<String,JsonElement>>empty())); } @Test public void nonExistentGene() { assertThat( baselineAnalyticsSearchService.findFacetsForTreeSearch(SemanticQuery.create(NON_EXISTENT_GENE), SemanticQuery.create(), new Species("Foous baris", SpeciesProperties.UNKNOWN)), is(new JsonObject())); assertThat( differentialAnalyticsSearchService.fetchResults(SemanticQuery.create(NON_EXISTENT_GENE), EMPTY_QUERY) .get("results").getAsJsonArray().size(), is(0)); } @Test public void differentialAnalyticsSearchServiceHasTheRightReturnFormat(){ JsonObject result = differentialAnalyticsSearchService.fetchResults(SemanticQuery.create("GO:0008150"), EMPTY_QUERY); testDifferentialResultsAreInRightFormat(result); } private ImmutableList<String> fieldsNeededInDifferentialResults = ImmutableList.of( "species", "kingdom", "experimentType", "numReplicates", "regulation", "factors", "bioentityIdentifier", "experimentAccession", "experimentName", "contrastId", "comparison", "foldChange", "pValue", "colour", "id"); private ImmutableList<String> fieldsNeededInMicroarrayDifferentialResults = ImmutableList.<String>builder() .addAll(fieldsNeededInDifferentialResults) .add("tStatistic") .build(); private void testDifferentialResultsAreInRightFormat(JsonObject result) { assertTrue(new Gson().toJson(result), result.has("results")); assertThat(result.get("results").getAsJsonArray().size(), greaterThan(0)); for (JsonElement jsonElement: result.get("results").getAsJsonArray()) { ExperimentType experimentType = ExperimentType.valueOf(jsonElement.getAsJsonObject().get("experimentType").getAsString()); if (experimentType.isMicroarray()) { for (String fieldName: fieldsNeededInMicroarrayDifferentialResults) { assertTrue("result has "+fieldName, jsonElement.getAsJsonObject().has(fieldName)); } } else { for (String fieldName: fieldsNeededInDifferentialResults) { assertTrue("result has "+fieldName, jsonElement.getAsJsonObject().has(fieldName)); } } } } }
[ "amunoz@ebi.ac.uk" ]
amunoz@ebi.ac.uk
43355a893695e7cee8a6dbf12d57bd9b07ab504f
8cc1f2e288e6756ed294a11756a78a3c279f8657
/smartequate-backend/src/main/java/com/smartequate/controller/PhoneController.java
083ad499b5d522668a0c661a5169fa6ce7262d71
[]
no_license
Vendeperas/smartequate-backend
846c6dd2be7908d774891769a0d9169d7dc0e101
7c8934d45885899e88bd4c11094a053116828a3b
refs/heads/master
2022-09-23T11:43:07.939564
2020-05-26T23:30:28
2020-05-26T23:30:28
265,946,896
0
0
null
null
null
null
UTF-8
Java
false
false
4,260
java
package com.smartequate.controller; import java.util.List; import javax.websocket.server.PathParam; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.context.event.EventListener; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.smartequate.dto.CustomSearchBody; import com.smartequate.dto.Phone; import com.smartequate.dto.Points; import com.smartequate.dto.Resolution; import com.smartequate.service.PhoneService; import com.smartequate.service.PointsService; import com.smartequate.service.ResolutionService; @RestController @CrossOrigin @RequestMapping({"/phones"}) public class PhoneController { @Autowired PhoneService phoneService; @Autowired ResolutionService resolutionService; @Autowired PointsService pointsService; public static final Logger logger = LoggerFactory.getLogger(PhoneController.class); @PostMapping("/list") public ResponseEntity<Page<Phone>> filterPhoneList( @RequestParam(name="page") int page, @RequestParam(name="size") int size, @RequestParam(name="name", required = false) String name, @RequestParam(name="brand", required = false) String brand, @RequestParam(name="cpu", required = false) String cpu, @RequestParam(name="battery", required = false) String battery, @RequestParam(name="sort", required = false) String sort, @RequestParam(name="direction", required = false) String direction, @RequestBody CustomSearchBody body ) { Page<Phone> phonePage; if (direction.equals(new String("asc"))) { phonePage = phoneService.getAllPageable(name,brand,cpu,battery,body,PageRequest.of(page, size, Sort.by(sort))); } else { phonePage = phoneService.getAllPageable(name,brand,cpu,battery,body,PageRequest.of(page, size, Sort.by(sort).descending())); } return new ResponseEntity<Page<Phone>>(phonePage, HttpStatus.OK); } @PostMapping("/new") public ResponseEntity<Phone> addNewPhone(@RequestBody Phone body){ Resolution resolution = resolutionService.getResolution(5); body.getAttributes().setResolution(resolution);; phoneService.saveNewPhone(body); Points points = pointsService.computePoints(body.getAttributes()); body.setPoints(points); phoneService.savePhone(body); return new ResponseEntity<Phone>(body, HttpStatus.CREATED); } @GetMapping("/mostValued") public ResponseEntity<List<Phone>> mostValued() { List<Phone> list = phoneService.getMostValued(); return new ResponseEntity<List<Phone>>(list, HttpStatus.OK); } @GetMapping("/mostVoted") public ResponseEntity<List<Phone>> mostVoted() { List<Phone> list = phoneService.getMostVoted(); return new ResponseEntity<List<Phone>>(list, HttpStatus.OK); } @GetMapping("/{id}") public ResponseEntity<Phone> getPhone(@PathVariable("id") int id) { Phone phone = phoneService.getPhoneById(id); return new ResponseEntity<Phone>(phone, HttpStatus.OK); } @GetMapping("/all") public ResponseEntity<Page<Phone>> getAllPhones( @RequestParam(name="name") String name, @RequestParam(name="brand") String brand, @RequestParam(name="cpu") String cpu, @RequestParam(name="battery") String battery, @RequestParam(name="page") int page, @RequestParam(name="size") int size) { Page<Phone> pagePhone = phoneService.getAllPhones(name, brand, cpu, battery,PageRequest.of(page, size)); return new ResponseEntity<Page<Phone>>(pagePhone, HttpStatus.OK); } }
[ "mixakorolev@hotmail.com" ]
mixakorolev@hotmail.com
d510276129fe7121943c31af5cc24f4b05b03853
eaed3b3a13d156f3d6e78dd510ceb83b40d02624
/ihm/back-end/src/main/java/fr/inra/dsi/reporting/web/ConfigurationController.java
8fb1882884660d117dfc191d1104195f22bf5b38
[]
no_license
nicolaschevron/photographeApplication
07d4abcca81a0751a40fc76a7b2ac2cbe207bf42
a4a44c168e7174c167fe5454efc803f8fbed161a
refs/heads/master
2021-01-10T06:27:02.176706
2015-06-05T15:42:29
2015-06-05T15:42:29
36,794,770
0
0
null
null
null
null
UTF-8
Java
false
false
1,883
java
package fr.inra.dsi.reporting.web; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import fr.inra.dsi.reporting.dto.ConfigurationDto; import fr.inra.dsi.reporting.util.WebConstantUtil; /** * Transmet des informations de configuration (adresse mail de * feedback, etc.). * * @author lepra */ @Controller public class ConfigurationController { @Value("${configuration.feedback.mail}") private transient String feedbackEmail; @Value("${configuration.feedback.subject}") private transient String feedbackSubject; /** * Constructeur vide. */ public ConfigurationController() { super(); } /** * Retourne l'adresse e-mail de feedback. * * @param response * @return String email. * @deprecated l'email est embarqué dans la conf renvoyée par {@link #getConf(HttpServletResponse)} */ @Deprecated @RequestMapping(value = WebConstantUtil.CONF_FEEDBACK_EMAIL_PATH, method=RequestMethod.GET) public @ResponseBody String getFeedbackEmail(HttpServletResponse response) { return feedbackEmail; } /** * Renvoie la conf. * @param response * @return */ @RequestMapping(value = WebConstantUtil.CONF_PATH, method=RequestMethod.GET, produces="application/json") @ResponseBody public ConfigurationDto getConf(HttpServletResponse response) { ConfigurationDto result = new ConfigurationDto(); result.setFeedbackEmail(feedbackEmail); result.setFeedbackSubject(feedbackSubject); return result ; } }
[ "niche@banane.(none)" ]
niche@banane.(none)
995c10068f3b409e9197ac40925bebe2a727f0e7
495bd721adc0a8e6566566516e94f15186149cf7
/alloy/src/main/java/com/liferay/faces/alloy/component/AUITextBoxListItem.java
1514b88cb7c56e1a6c61b746304b7d33c135b072
[]
no_license
prakashnsm/liferay-faces
fd7c01b20bd35be6ee3749ef855f0c61f8581aa3
86ebb2e87a9a34d5f3c3d54354a5260767192698
refs/heads/master
2020-04-07T10:26:56.866379
2013-04-02T19:12:07
2013-04-02T19:12:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
915
java
/** * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ package com.liferay.faces.alloy.component; import javax.faces.component.NamingContainer; /** * @author Neil Griffin */ public class AUITextBoxListItem extends AUIPanel implements NamingContainer { @Override public String getRendererType() { return "com.liferay.faces.alloy.renderkit.TextBoxListItemRenderer"; } }
[ "neil.griffin.scm@gmail.com" ]
neil.griffin.scm@gmail.com
119a83933fd7a54618eff1cee798c4120505f7cc
e080e769dcc686fe6caa9b0beba34a14f17304bb
/src/main/java/com/chaoxuzhong/study/pdf/company/util/SpringBeanUtil.java
70551bf477216004f615ef64abc528472503220c
[]
no_license
ChaoxuZhong/study
d5eb3f10b4eaa0f0b97a36088ce00e31d5dd8d2b
20960255eb6a922da3ce88602dec4b261140c65f
refs/heads/master
2023-04-08T08:52:04.788735
2023-03-06T08:23:29
2023-03-06T08:23:29
233,064,712
0
0
null
2023-03-27T22:17:18
2020-01-10T14:31:50
Java
UTF-8
Java
false
false
1,485
java
package com.chaoxuzhong.study.pdf.company.util; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.stereotype.Component; @Component public class SpringBeanUtil implements ApplicationContextAware { /** * 上下文对象实例 */ private static ApplicationContext applicationContext; @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = applicationContext; } /** * 获取applicationContext * * @return */ public static ApplicationContext getApplicationContext() { return applicationContext; } /** * 通过name获取 Bean. * * @param name * @return */ public static Object getBean(String name) { return getApplicationContext().getBean(name); } /** * 通过class获取Bean. * * @param clazz * @param <T> * @return */ public static <T> T getBean(Class<T> clazz) { return getApplicationContext().getBean(clazz); } /** * 通过name,以及Clazz返回指定的Bean * * @param name * @param clazz * @param <T> * @return */ public static <T> T getBean(String name, Class<T> clazz) { return getApplicationContext().getBean(name, clazz); } }
[ "chaoxuzhong.me@gmail.com" ]
chaoxuzhong.me@gmail.com
ccc7805b8392c8b0c799a3cf4dc9afdea19ea3d4
25678273ee313c6193476afb8dc57929d90dd09f
/src/com/Inheratence/Father.java
1e662d620394a8126e950a23199ff54cce099449
[]
no_license
Afghanistanjan/Demo
e26c317043b78e7c62045845ca41ce5502907aa3
f20ae1f9a11599b042c4330f6935bf9744564320
refs/heads/master
2023-04-08T09:53:47.921129
2021-04-06T03:54:04
2021-04-06T03:54:04
355,032,136
0
0
null
null
null
null
UTF-8
Java
false
false
160
java
package com.Inheratence; public class Father { int a; int b; public Father(int a, int b) { this.a = a; this.b = b; } }
[ "hak9803@gmail.com" ]
hak9803@gmail.com
6cfffcf6ab5d6889c863f2811af4bd649343890e
2649466b7176325a5e214ea865474088cd14650e
/teacher/src/main/java/com/ltst/schoolapp/teacher/ui/events/calendar/CalendarActivity.java
5bdd48cb3385536c5d1b4c9406cbd7ec56721660
[]
no_license
acefalobi/kidyview
0adcad00361d749ba3493ae7f278967c8e75d0f6
25d02b2edae329abf98d17301774a21c9b0ac500
refs/heads/master
2021-09-11T23:33:24.556983
2018-04-13T01:52:03
2018-04-13T01:52:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,799
java
package com.ltst.schoolapp.teacher.ui.events.calendar; import android.content.Intent; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.Fragment; import android.support.v7.widget.Toolbar; import com.ltst.core.base.CoreActivity; import com.ltst.core.firebase.PushNotification; import com.ltst.core.navigation.ActivityScreen; import com.ltst.core.navigation.ActivityScreenSwitcher; import com.ltst.core.navigation.HasFragmentContainer; import com.ltst.core.navigation.HasSubComponents; import com.ltst.core.util.gallerypictureloader.GalleryPictureLoader; import com.ltst.schoolapp.R; import com.ltst.schoolapp.TeacherComponent; import com.ltst.schoolapp.teacher.TeacherActivity; import com.ltst.schoolapp.teacher.ui.events.calendar.fragment.EventsFragment; import com.ltst.schoolapp.teacher.ui.main.MainActivity; import javax.inject.Inject; import butterknife.ButterKnife; public class CalendarActivity extends TeacherActivity implements HasSubComponents<CalendarScope.CalendarComponent>, HasFragmentContainer { private CalendarScope.CalendarComponent component; @Inject ActivityScreenSwitcher activityScreenSwitcher; private boolean openedFromNotification = false; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle extras = getIntent().getExtras(); if (extras != null) { if (extras.containsKey(PushNotification.KEY_FROM_PUSH)) { openedFromNotification = extras.getBoolean(PushNotification.KEY_FROM_PUSH); } } } @Override public void onBackPressed() { if (!openedFromNotification) { super.onBackPressed(); } else { activityScreenSwitcher.open(new MainActivity.Screen()); } } @Override protected void onStart() { super.onStart(); activityScreenSwitcher.attach(this); if (!getFragmentScreenSwitcher().hasFragments()) { getFragmentScreenSwitcher().open(new EventsFragment.Screen()); } } @Override protected void onStop() { super.onStop(); activityScreenSwitcher.detach(this); } @Override protected void addToTeacherComponent(TeacherComponent teacherComponent) { component = DaggerCalendarScope_CalendarComponent.builder() .calendarModule(new CalendarScope.CalendarModule(getDialogProvider(), new GalleryPictureLoader(this), getFragmentScreenSwitcher(), getActivityProvider())) .teacherComponent(teacherComponent) .build(); component.inject(this); } @Override protected int getLayoutResId() { return R.layout.default_activity_blue; } @Override protected Toolbar getToolbar() { return ButterKnife.findById(this, R.id.default_toolbar); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); for (Fragment fragment : getSupportFragmentManager().getFragments()) { if (fragment != null) { fragment.onActivityResult(requestCode, resultCode, data); } } } @Override public CalendarScope.CalendarComponent getComponent() { return component; } @Override public int getFragmentContainerId() { return R.id.default_fragment_container; } public static final class Screen extends ActivityScreen { @Override protected void configureIntent(@NonNull Intent intent) { } @Override protected Class<? extends CoreActivity> activityClass() { return CalendarActivity.class; } } }
[ "opetundeadepoju@gmail.com" ]
opetundeadepoju@gmail.com
733e245963b09a273c8e2fb5040bc00aaba80b22
e4669254ebe8c14347fb7a059b354b2073ff422c
/WebJSP/JSPLab/WebServlet_97_Board_Model2_Mvc2_Reply_Ajax/src/kr/or/kosta/Action/BoardReplyDeleteAction.java
31ef072d5865f95570cf7bb79434e5f11fdd822f
[]
no_license
kwakhowon/Howon
7cdd4dab13799b47a08752bea29d4ab47029049d
1f12cfaccd1ce7f9c51cae266f84645d79204945
refs/heads/master
2023-01-24T02:54:35.551863
2019-06-14T04:41:11
2019-06-14T04:41:11
169,564,987
1
0
null
2023-01-03T20:28:26
2019-02-07T12:00:39
Java
UTF-8
Java
false
false
982
java
package kr.or.kosta.Action; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import kr.or.kosta.dao.boarddao; public class BoardReplyDeleteAction implements Action { @Override public ActionForward execute(HttpServletRequest request, HttpServletResponse response) throws Exception { String idx_fk = request.getParameter("idx"); //덧글의 원본 게시글 번호 String no = request.getParameter("no"); //덧글의 순번(고유값) String pwd = request.getParameter("delPwd"); //덧글의 암호 boarddao dao = new boarddao(); int result = dao.replyDelete(no, pwd); if(result>0) { request.setAttribute("result", "success"); } else { request.setAttribute("result", "fail"); } ActionForward forward = new ActionForward(); request.setAttribute("idx_fk", idx_fk); forward.setRedirect(false); forward.setPath("/board/boardreply_deleteOk.jsp"); return forward; } }
[ "howon0206@naver.com" ]
howon0206@naver.com
dc58ac693ab1814f6bc0897046994d2f90c8f4fb
2241f29c7f4c5b5237d88233436955a37625994d
/mysmarthompage/src/net/syntax/part03/JoinDemo.java
46ac3275a412eb019c4ef403abc883433e886024
[]
no_license
LeeHyeonHyeong/mysmarthomepage
ce59c8e429d9d23e0e5533dfff202fa3876b846c
919874807027c4b88aaf91851e8f15441f3024a3
refs/heads/master
2020-05-09T13:40:19.464279
2015-06-01T06:33:34
2015-06-01T06:33:34
35,527,412
0
0
null
null
null
null
UHC
Java
false
false
1,752
java
package net.syntax.part03; 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; /** * Servlet implementation class JoinDemo */ @WebServlet("/part03/join_demo.do") public class JoinDemo extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); String gender = request.getParameter("gender"); String name = request.getParameter("name"); String age = request.getParameter("age"); String id = request.getParameter("id"); String pwd = request.getParameter("pwd"); String check_mail = request.getParameter("check_mail"); String content = request.getParameter("content"); PrintWriter out = response.getWriter(); out.print("<html><body>"); out.println("당신의 입력한 정보입니다.<hr>"); out.print("성별 : <b>"); out.print(gender +"</b>"); out.print("이름 : <b>"); out.print(name +"</b>"); out.print("나이 : <b>"); out.print(age +"</b>"); out.print("ID : <b>"); out.print(id +"</b>"); out.print("비밀번호 : <b>"); out.print(pwd +"</b>"); out.print("<br> 메일정보 수신여부 : <b>"); out.print(check_mail); out.println("</b><br> 가입인사 : <b><pre>"); out.print(content); out.println("</b></pre><br/><a href='javascript:history.go(-1)'>뒤로<a/>"); out.print("</body></html>"); out.close(); } }
[ "Administrator@MSDN-SPECIAL" ]
Administrator@MSDN-SPECIAL
914dc6cca564e3c1cb22db1d23150e1046efb152
44aed076564806e24b41c2d9500ef986bcc549bf
/src/main/java/com/example/eventplatform/ServletInitializer.java
978223c592170e44f582f6bdc85901dbd68f09bb
[ "MIT" ]
permissive
FarahJamal/Events-Platform
9a8ca9c26ec001af1889e50189dc76aef7139987
2e757e8cddf534a0e2ac91ee48645c2b62710995
refs/heads/main
2023-07-16T20:11:38.292461
2021-08-26T20:46:14
2021-08-26T20:46:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
422
java
package com.example.eventplatform; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; public class ServletInitializer extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(EventPlatformApplication.class); } }
[ "zx.hammam@hotmail.com" ]
zx.hammam@hotmail.com
1c8bb529465a00a75e0c22233a51c2e43e168bfa
4afcf77516d6561d062f90a0b9a949e5487e9eb5
/com.startoon.core/src/main/java/org/j2eeframework/commons/util/WebUtils.java
7af681029ab48f68f3a7124345014ad9b8a76197
[]
no_license
yangkai2005/startoon
eefca0526516f9eaccfdc0e95249bb5e3f3c4c02
02d581f4c8a989e9640f80f2560e494f8212f35d
refs/heads/master
2021-01-20T11:57:40.685666
2014-04-15T15:22:06
2014-04-15T15:22:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,246
java
package org.j2eeframework.commons.util; import java.io.IOException; import java.io.OutputStream; import java.util.Map; import java.util.StringTokenizer; import java.util.zip.GZIPOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; /** * Http与Servlet工具类. */ public class WebUtils { public static final long ONE_YEAR_SECONDS = 60 * 60 * 24 * 365; /** * 设置客户端缓存过期时间 Header. */ public static void setExpiresHeader(HttpServletResponse response, long expiresSeconds) { //Http 1.0 header response.setDateHeader("Expires", System.currentTimeMillis() + expiresSeconds * 1000); //Http 1.1 header response.setHeader("Cache-Control", "max-age=" + expiresSeconds); } /** * 设置客户端无缓存Header. */ public static void setNoCacheHeader(HttpServletResponse response) { //Http 1.0 header response.setDateHeader("Expires", 0); //Http 1.1 header response.setHeader("Cache-Control", "no-cache"); } /** * 设置LastModified Header. */ public static void setLastModifiedHeader(HttpServletResponse response, long lastModifiedDate) { response.setDateHeader("Last-Modified", lastModifiedDate); } /** * 设置Etag Header. */ public static void setEtag(HttpServletResponse response, String etag) { response.setHeader("ETag", etag); } /** * 根据浏览器If-Modified-Since Header, 计算文件是否已被修改. * * 如果无修改, checkIfModify返回false ,设置304 not modify status. * * @param lastModified 内容的最后修改时间. */ public static boolean checkIfModifiedSince(HttpServletRequest request, HttpServletResponse response, long lastModified) { long ifModifiedSince = request.getDateHeader("If-Modified-Since"); if ((ifModifiedSince != -1) && (lastModified < ifModifiedSince + 1000)) { response.setStatus(HttpServletResponse.SC_NOT_MODIFIED); return false; } return true; } /** * 根据浏览器 If-None-Match Header, 计算Etag是否已无效. * * 如果Etag有效, checkIfNoneMatch返回false, 设置304 not modify status. * * @param etag 内容的ETag. */ public static boolean checkIfNoneMatchEtag(HttpServletRequest request, HttpServletResponse response, String etag) { String headerValue = request.getHeader("If-None-Match"); if (headerValue != null) { boolean conditionSatisfied = false; if (!headerValue.equals("*")) { StringTokenizer commaTokenizer = new StringTokenizer(headerValue, ","); while (!conditionSatisfied && commaTokenizer.hasMoreTokens()) { String currentToken = commaTokenizer.nextToken(); if (currentToken.trim().equals(etag)) { conditionSatisfied = true; } } } else { conditionSatisfied = true; } if (conditionSatisfied) { response.setStatus(HttpServletResponse.SC_NOT_MODIFIED); response.setHeader("ETag", etag); return false; } } return true; } /** * 检查浏览器客户端是否支持gzip编码. */ public static boolean checkAccetptGzip(HttpServletRequest request) { //Http1.1 header String acceptEncoding = request.getHeader("Accept-Encoding"); if (StringUtils.contains(acceptEncoding, "gzip")) { return true; } else { return false; } } /** * 设置Gzip Header并返回GZIPOutputStream. */ public static OutputStream buildGzipOutputStream(HttpServletResponse response) throws IOException { response.setHeader("Content-Encoding", "gzip"); response.setHeader("Vary", "Accept-Encoding"); return new GZIPOutputStream(response.getOutputStream()); } /** * 设置让浏览器弹出下载对话框的Header. * * @param fileName 下载后的文件名. */ public static void setDownloadableHeader(HttpServletResponse response, String fileName) { response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\""); } /** * 取得带相同前缀的Request Parameters. * * 返回的结果Parameter名已去除前缀. */ public static Map<String, Object> getParametersStartingWith(HttpServletRequest request, String prefix) { return org.springframework.web.util.WebUtils.getParametersStartingWith(request, prefix); } }
[ "yangkai.2005@gmail.com" ]
yangkai.2005@gmail.com
2585c24da799bed1c3195c80edd744d72a137555
c3342441aa5adb4e8dbbda9bb3417f2633ed1216
/src/main/java/com/services/RoomService.java
d081a8e327f934eb6fef6f0d453133381fd3dc65
[]
no_license
SandamalIsuru/Hotel-Management-System
407a2a478ba98d2d322a49be2a7b458b811f52a7
b06d8cfd821466afb73b2a0aca9582c149f1cf25
refs/heads/master
2021-04-15T05:53:31.887214
2018-03-24T06:52:57
2018-03-24T06:52:57
126,564,154
0
0
null
null
null
null
UTF-8
Java
false
false
190
java
package com.services; import java.util.List; import com.entities.RoomDetail; public interface RoomService { public List<RoomDetail> getAllRooms(); public Long getAvailableRooms(); }
[ "isuru.rathnapriya@travisperkins.co.uk" ]
isuru.rathnapriya@travisperkins.co.uk
435f606c48549cc3aac206def77c83d1ec60826c
da79a46dba14a0a1426954183b3a95e3406ae249
/MavenDemo/src/main/java/com/trushna/EdurekaProject/pages/HomepageFlightbook.java
89c551fd495bed2606a8602cd89382fa4b79837c
[]
no_license
Trushnashah/Seleniumbasic-project
f655c5882f167f0d3b6e4893879d94e238188736
3d784de0427969c38b34ca08fb77261e7c7aac98
refs/heads/master
2021-01-24T13:23:55.429806
2018-03-06T19:38:29
2018-03-06T19:38:29
123,172,599
0
0
null
2018-03-06T19:38:30
2018-02-27T18:44:53
HTML
UTF-8
Java
false
false
1,309
java
package com.trushna.EdurekaProject.pages; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; //For Page //1. Selenium Annotations //2. Constructor for pagefactory //3. Methods public class HomepageFlightbook { //Annotations @FindBy(name= "userName") WebElement USERNAME; @FindBy(name="password") WebElement PASSWORD; @FindBy(name= "login") WebElement SIGNIN; @FindBy(linkText="your destination") WebElement YOURDEST_LINK; @FindBy(linkText="featured vacation destinations") WebElement FUTUREDEST_LINK; @FindBy(partialLinkText="Register") WebElement REGISTERHERE_LINK; @FindBy(partialLinkText="Business") WebElement BUSINESSTRAVEL_LINK; @FindBy(linkText="Salon Travel") WebElement SALON_LINK; // Constructor public HomepageFlightbook(WebDriver driver) { PageFactory.initElements(driver, this); } //Methods public void enterUserName(String userName) { USERNAME.sendKeys(userName); } public void enterPassword(String password) { PASSWORD.sendKeys(password); } public void login() { SIGNIN.click(); //PrintMessage.printMessage("TITLE:" + driver.getTitle()); } public void Register() { REGISTERHERE_LINK.click(); } }
[ "trushna.shah84@hotmail.com" ]
trushna.shah84@hotmail.com
f215efb7b6a42d820443eea6bbeea6b8516dac0a
d67a7e871ad7936242f4d5b162904cda5352ff90
/src/main/java/top/hequehua/swagger/utils/StringUtil.java
c415ac3c310f5cbab5f434c7823de2b9cb009b36
[]
no_license
luotianwen/lorderinterface2
b5578018ec4a9a7ee252cea8fce60c3863d63fcb
9edb123d5278a7de6fcf33ad895433618837c77b
refs/heads/master
2022-06-24T12:47:21.252824
2021-01-20T06:57:39
2021-01-20T06:57:39
203,414,623
0
0
null
2022-06-21T01:42:48
2019-08-20T16:33:28
JavaScript
UTF-8
Java
false
false
2,054
java
package top.hequehua.swagger.utils; import com.jfinal.kit.StrKit; /** **/ public class StringUtil { /** * 转换为下划线 * * @param camelCaseName * @return */ public static String underscoreName(String camelCaseName) { StringBuilder result = new StringBuilder(); if (camelCaseName != null && camelCaseName.length() > 0) { result.append(camelCaseName.substring(0, 1).toLowerCase()); for (int i = 1; i < camelCaseName.length(); i++) { char ch = camelCaseName.charAt(i); if (Character.isUpperCase(ch)) { result.append("_"); result.append(Character.toLowerCase(ch)); } else { result.append(ch); } } } return result.toString(); } /** * 转换为驼峰 * * @param underscoreName * @return */ public static String camelCaseName(String underscoreName) { StringBuilder result = new StringBuilder(); if (underscoreName != null && underscoreName.length() > 0) { boolean flag = false; for (int i = 0; i < underscoreName.length(); i++) { char ch = underscoreName.charAt(i); if ("_".charAt(0) == ch) { flag = true; } else { if (flag) { result.append(Character.toUpperCase(ch)); flag = false; } else { result.append(ch); } } } } return result.toString(); } public static String substringAfter(String str, String separator) { if (StrKit.isBlank(str)) { return str; } else if (separator == null) { return ""; } else { int pos = str.indexOf(separator); return pos == -1 ? "" : str.substring(pos + separator.length()); } } }
[ "luotianwen456123@126.com" ]
luotianwen456123@126.com
ac5efca975f034954dca6431d6832ff20a5fb837
f3bb7657dc3e1e29626bbff1912a15f7b5c9362f
/app/src/test/java/com/example/diu/diu_dse/ExampleUnitTest.java
7627704c88d1ff4dc0d963ae06c4d3b21e1c0a28
[]
no_license
shaharia0/DIUDSE
b12a3c1c0ba6208ebaa54e444aff4c5f0aadaafa
41d9b3ad3066f02ccd6a8ab021f4ae9acade5113
refs/heads/master
2020-03-25T06:25:16.874204
2019-01-16T18:56:19
2019-01-16T18:56:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
384
java
package com.example.diu.diu_dse; 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); } }
[ "shaharia35-1964@diu.edu.bd" ]
shaharia35-1964@diu.edu.bd
86043530d1e7d064e34fa7aca826b97ab5be464f
f15bb0ddf9e28ea808f4c49e8c442c29e6f53218
/bus-health/src/main/java/org/aoju/bus/health/hardware/AbstractUsbDevice.java
b075a8104d7b1200cb49b22516ed80dc331ab295
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
erickwang/bus
7f31a19ace167b2ce525105d4393b379118a525e
a8ed185f2f1c0f085d8a2be5e005bcbf50431386
refs/heads/master
2022-04-15T15:28:06.342430
2020-03-26T06:14:42
2020-03-26T06:14:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,499
java
/********************************************************************************* * * * The MIT License * * * * Copyright (c) 2015-2020 aoju.org and other contributors. * * * * Permission is hereby granted, free of charge, to any person obtaining a copy * * of this software and associated documentation files (the "Software"), to deal * * in the Software without restriction, including without limitation the rights * * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included in * * all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * * THE SOFTWARE. * ********************************************************************************/ package org.aoju.bus.health.hardware; import org.aoju.bus.core.lang.Normal; import org.aoju.bus.core.lang.Symbol; import java.util.Arrays; /** * A USB device * * @author Kimi Liu * @version 5.8.1 * @since JDK 1.8+ */ public abstract class AbstractUsbDevice implements UsbDevice { protected String name; protected String vendor; protected String vendorId; protected String productId; protected String serialNumber; protected String uniqueDeviceId; protected UsbDevice[] connectedDevices; /** * <p> * Constructor for AbstractUsbDevice. * </p> * * @param name a {@link java.lang.String} object. * @param vendor a {@link java.lang.String} object. * @param vendorId a {@link java.lang.String} object. * @param productId a {@link java.lang.String} object. * @param serialNumber a {@link java.lang.String} object. * @param uniqueDeviceId a {@link java.lang.String} object. * @param connectedDevices an array of {@link UsbDevice} objects. */ public AbstractUsbDevice(String name, String vendor, String vendorId, String productId, String serialNumber, String uniqueDeviceId, UsbDevice[] connectedDevices) { this.name = name; this.vendor = vendor; this.vendorId = vendorId; this.productId = productId; this.serialNumber = serialNumber; this.uniqueDeviceId = uniqueDeviceId; this.connectedDevices = Arrays.copyOf(connectedDevices, connectedDevices.length); } /** * Helper method for indenting chained USB devices * * @param usbDevice A USB device to print * @param indent number of spaces to indent */ private static String indentUsb(UsbDevice usbDevice, int indent) { String indentFmt = indent > 2 ? String.format("%%%ds|-- ", indent - 4) : String.format("%%%ds", indent); StringBuilder sb = new StringBuilder(String.format(indentFmt, Normal.EMPTY)); sb.append(usbDevice.getName()); if (usbDevice.getVendor().length() > 0) { sb.append(" (").append(usbDevice.getVendor()).append(Symbol.C_PARENTHESE_RIGHT); } if (usbDevice.getSerialNumber().length() > 0) { sb.append(" [s/n: ").append(usbDevice.getSerialNumber()).append(Symbol.C_BRACKET_RIGHT); } for (UsbDevice connected : usbDevice.getConnectedDevices()) { sb.append(Symbol.C_LF).append(indentUsb(connected, indent + 4)); } return sb.toString(); } @Override public String getName() { return this.name; } @Override public String getVendor() { return this.vendor; } @Override public String getVendorId() { return this.vendorId; } @Override public String getProductId() { return this.productId; } @Override public String getSerialNumber() { return this.serialNumber; } @Override public String getUniqueDeviceId() { return this.uniqueDeviceId; } @Override public UsbDevice[] getConnectedDevices() { return Arrays.copyOf(this.connectedDevices, this.connectedDevices.length); } @Override public int compareTo(UsbDevice usb) { // Naturally sort by device name return getName().compareTo(usb.getName()); } @Override public String toString() { return indentUsb(this, 1); } }
[ "839536@qq.com" ]
839536@qq.com
451ec2e7eec59f584d5e87f71b2690324de40c15
5eae683a6df0c4b97ab1ebcd4724a4bf062c1889
/bin/ext-integration/sap/synchronousOM/sapordermgmtbol/src/de/hybris/platform/sap/sapordermgmtbol/transaction/salesdocument/backend/impl/erp/strategy/LrdActionsStrategyERP.java
f4e0815c84a300a1218fd623e6090feb07622c24
[]
no_license
sujanrimal/GiftCardProject
1c5e8fe494e5c59cca58bbc76a755b1b0c0333bb
e0398eec9f4ec436d20764898a0255f32aac3d0c
refs/heads/master
2020-12-11T18:05:17.413472
2020-01-17T18:23:44
2020-01-17T18:23:44
233,911,127
0
0
null
2020-06-18T15:26:11
2020-01-14T18:44:18
null
UTF-8
Java
false
false
35,164
java
/* * [y] hybris Platform * * Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved. * * This software is the confidential and proprietary information of SAP * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with SAP. */ package de.hybris.platform.sap.sapordermgmtbol.transaction.salesdocument.backend.impl.erp.strategy; import de.hybris.platform.sap.core.bol.backend.jco.JCoHelper; import de.hybris.platform.sap.core.bol.logging.Log4JWrapper; import de.hybris.platform.sap.core.common.TechKey; import de.hybris.platform.sap.core.common.message.Message; import de.hybris.platform.sap.core.jco.connection.JCoConnection; import de.hybris.platform.sap.core.jco.exceptions.BackendException; import de.hybris.platform.sap.core.module.ModuleConfigurationAccess; import de.hybris.platform.sap.sapcommonbol.businesspartner.businessobject.interf.Address; import de.hybris.platform.sap.sapcommonbol.businesspartner.businessobject.interf.PartnerFunctionData; import de.hybris.platform.sap.sapcommonbol.constants.SapcommonbolConstants; import de.hybris.platform.sap.sapcommonbol.transaction.util.impl.ConversionTools; import de.hybris.platform.sap.sapmodel.constants.SapmodelConstants; import de.hybris.platform.sap.sapordermgmtbol.transaction.businessobject.interf.BillTo; import de.hybris.platform.sap.sapordermgmtbol.transaction.businessobject.interf.PartnerBase; import de.hybris.platform.sap.sapordermgmtbol.transaction.businessobject.interf.SalesDocument; import de.hybris.platform.sap.sapordermgmtbol.transaction.businessobject.interf.ShipTo; import de.hybris.platform.sap.sapordermgmtbol.transaction.businessobject.interf.TransactionConfiguration; import de.hybris.platform.sap.sapordermgmtbol.transaction.salesdocument.backend.impl.erp.BackendExceptionECOERP; import de.hybris.platform.sap.sapordermgmtbol.transaction.salesdocument.backend.impl.erp.LoadOperation; import de.hybris.platform.sap.sapordermgmtbol.transaction.salesdocument.backend.impl.erp.LrdFieldExtension; import de.hybris.platform.sap.sapordermgmtbol.transaction.salesdocument.backend.impl.erp.ProcessTypeConverter; import de.hybris.platform.sap.sapordermgmtbol.transaction.salesdocument.backend.interf.erp.BackendState; import de.hybris.platform.sap.sapordermgmtbol.transaction.salesdocument.backend.interf.erp.ConstantsR3Lrd; import de.hybris.platform.sap.sapordermgmtbol.transaction.salesdocument.backend.interf.erp.strategy.ERPLO_APICustomerExits; import de.hybris.platform.sap.sapordermgmtbol.transaction.salesdocument.backend.interf.erp.strategy.LrdActionsStrategy; import de.hybris.platform.sap.sapordermgmtbol.transaction.salesdocument.backend.util.BackendCallResult; import java.util.ArrayList; import java.util.Date; import java.util.Iterator; import java.util.List; import java.util.Map; import com.sap.conn.jco.JCoFunction; import com.sap.conn.jco.JCoParameterList; import com.sap.conn.jco.JCoStructure; import com.sap.conn.jco.JCoTable; /** * ERP implementation of LrdActionsStrategy and ConstantsR3Lrd. * * @see LrdActionsStrategy * @see ConstantsR3Lrd * @version 1.0 */ public class LrdActionsStrategyERP extends BaseStrategyERP implements LrdActionsStrategy, ConstantsR3Lrd { private static final String ACTION_PARAM_NEW_FREIGHT_DETERMINATION = "H"; private static final String ACTION_ID_PRICING = "PRICING"; /** * In case setting to 'X': Deactivating of switch for check of open documents (contracts, quotations): no error message * should be returned when a open contract or quotation exists for the entered product of the order */ protected static String FIELD_NO_MESSAGES_DOC = "NO_MESSAGES_DOC"; /** * LO-API should not trigger ERP conversion exits */ protected static final String FIELD_NO_CONVERSION = "NO_CONVERSION"; /** * constant naming the key referenced in factory-config.xml where the strategy class is specified */ public static final String STRATEGY_FACTORY_ERP = "STStrategyFactoryERP"; private long rfctime = 0; private static final Log4JWrapper SAP_LOGGER = Log4JWrapper.getInstance(LrdActionsStrategyERP.class.getName()); // Partner public static final String PARTY = "PARTY"; // ITEM public static final String ITEM = "ITEM"; @SuppressWarnings("squid:S1699") public LrdActionsStrategyERP() { super(); // Fill the active Fields list only once fillActiveFields(); } /** * Filling active fields */ private void fillActiveFields() { setActiveFieldsListCreateChange(activeFieldsListCreateChange); } /** * Field list which fields will be checked in create or change mode */ protected final List<SetActiveFieldsListEntry> activeFieldsListCreateChange = new ArrayList<SetActiveFieldsListEntry>(); static final String EXC_NO_ACTION_WHEN_ERROR = "EXC_NO_ACTION_WHEN_ERROR"; static final String EXC_NO_ACTION_WHEN_DISPLAY = "EXC_NO_ACTION_WHEN_DISPLAY"; /** * The condition type which should be used to determine the freight value */ protected String headerCondTypeFreight = ""; /** * The subtotal for the item freight value */ protected String subTotalItemFreight = ""; /** * Allows access to configuration settings */ protected ModuleConfigurationAccess moduleConfigurationAccess; /** * @param moduleConfigurationAccess * Allows access to configuration settings */ public void setModuleConfigurationAccess(final ModuleConfigurationAccess moduleConfigurationAccess) { this.moduleConfigurationAccess = moduleConfigurationAccess; } /** * Standard constructor. <br> */ @Override public ReturnValue executeLrdDoActionsDelete(final TransactionConfiguration shop, final SalesDocument salesDoc, final JCoConnection cn, final String objectName, final TechKey[] itemsToDelete) throws BackendException { final String METHOD_NAME = "executeLrdDoActionsDelete()"; SAP_LOGGER.entering(METHOD_NAME); ReturnValue retVal = new ReturnValue(ConstantsR3Lrd.BAPI_RETURN_ERROR); try { final JCoFunction function = cn.getFunction(ConstantsR3Lrd.FM_LO_API_DO_ACTIONS); // getting import parameter final JCoParameterList importParams = function.getImportParameterList(); // getting export parameters final JCoParameterList exportParams = function.getExportParameterList(); final JCoTable itAction = importParams.getTable("IT_ACTION"); // check, if items should be deleted: checkItemDeleted(salesDoc, cn, objectName, itemsToDelete, function, importParams, itAction); // error handling final JCoTable etMessages = exportParams.getTable("ET_MESSAGES"); final JCoStructure esError = exportParams.getStructure("ES_ERROR"); dispatchMessages(salesDoc, etMessages, esError); if (!(esError != null && "X".equals(esError.getString("ERRKZ")))) { retVal = new ReturnValue(ConstantsR3Lrd.BAPI_RETURN_INFO); } } catch (final BackendException ex) { handleException(salesDoc, ex); } finally { SAP_LOGGER.exiting(); } SAP_LOGGER.exiting(); return retVal; } /** * @param salesDoc * @param ex * @throws BackendException */ private void handleException(final SalesDocument salesDoc, final BackendException ex) throws BackendException { final String abapExc = ex.getCause().getMessage(); String resourceKey = ""; if (abapExc.equals(EXC_NO_ACTION_WHEN_ERROR)) { resourceKey = "sapsalestransactions.bo.sales.erp.actions.error"; } else if (abapExc.equals(EXC_NO_ACTION_WHEN_DISPLAY)) { resourceKey = "sapsalestransactions.bo.sales.erp.actions.display"; } else { invalidateSalesDocument(salesDoc); throw ex; } final Message message = new Message(Message.ERROR, resourceKey); salesDoc.addMessage(message); } /** * @param salesDoc * @param cn * @param objectName * @param itemsToDelete * @param function * @param importParams * @param itAction * @throws BackendException */ private void checkItemDeleted(final SalesDocument salesDoc, final JCoConnection cn, final String objectName, final TechKey[] itemsToDelete, final JCoFunction function, final JCoParameterList importParams, final JCoTable itAction) throws BackendException { if (objectName.equals(LrdActionsStrategy.ITEMS)) { deleteItems(itAction, itemsToDelete); } // if there is something to delete if (itAction.getNumRows() > 0) { final ERPLO_APICustomerExits custExit = getCustExit(); if (custExit != null) { custExit.customerExitBeforeLoad(salesDoc, function, cn, SAP_LOGGER); } cn.execute(function); if (custExit != null) { custExit.customerExitAfterLoad(salesDoc, function, cn, SAP_LOGGER); } } if (SAP_LOGGER.isDebugEnabled()) { logCall(ConstantsR3Lrd.FM_LO_API_DO_ACTIONS, importParams, null); } } /** * Registers the items for deletion. This is done by generating entries in the <code>itAction</code> table. * * @param itAction * the JCoTable, that is filled with the items to be deleted. * @param itemsToDelete * the <code>TechKey</code>s of the items to be deleted. */ protected static void deleteItems(final JCoTable itAction, final TechKey[] itemsToDelete) { if (itemsToDelete == null) { return; } for (int i = 0; i < itemsToDelete.length; i++) { itAction.appendRow(); itAction.setValue("HANDLE", itemsToDelete[i].getIdAsString()); itAction.setValue("ACTION", "DELETE"); } // for } // deleteItems @Override public BackendCallResult executeLrdSave(final SalesDocument posd, final boolean commit, final JCoConnection cn) throws BackendException { try { final String METHOD_NAME = "executeLrdSave()"; SAP_LOGGER.entering(METHOD_NAME); BackendCallResult retVal = new BackendCallResult(); final JCoFunction function = cn.getFunction(ConstantsR3Lrd.FM_LO_API_SAVE); // getting import parameter final JCoParameterList importParams = function.getImportParameterList(); // getting export parameters final JCoParameterList exportParams = function.getExportParameterList(); if (!commit) { JCoHelper.setValue(importParams, "X", "IF_NO_COMMIT"); } else { // Makes only sence after a commit JCoHelper.setValue(importParams, "X", "IF_SYNCHRON"); } final ERPLO_APICustomerExits custExit = getCustExit(); isCustExit(commit, cn, function, exportParams, custExit); if ((!(exportParams.getString("EF_SAVED").isEmpty())) && (!exportParams.getString("EV_VBELN_SAVED").trim().isEmpty())) { // Only set Techkey in case it is really new - when creating a // document, // otherwise several issues will occur: // - document is read multiple time afterwards // -exceptions can occur, see int.msg. 4340020 /2009 if (posd.getHeader().getSalesDocNumber() == null || "".equals(posd.getHeader().getSalesDocNumber())) { posd.setTechKey(JCoHelper.getTechKey(exportParams, "EV_VBELN_SAVED")); posd.getHeader().setTechKey(JCoHelper.getTechKey(exportParams, "EV_VBELN_SAVED")); posd.getHeader() .setSalesDocNumber(ConversionTools.cutOffZeros(JCoHelper.getString(exportParams, "EV_VBELN_SAVED"))); } SAP_LOGGER.debug("Transaction with ID" + exportParams.getString("EV_VBELN_SAVED") + "was saved successfully"); // Now we need to tell the BO layer and UI that the order // is not in editing anymore! posd.getHeader().setChangeable(false); } // No data was changed else if (hasMessage("W", "V1", "041", ConstantsR3Lrd.MESSAGE_IGNORE_VARS, "", "", "", exportParams.getTable("ET_MESSAGES"), null)) { if (SAP_LOGGER.isDebugEnabled()) { SAP_LOGGER.debug("No data changed"); } final TechKey techKey = new TechKey(posd.getHeader().getSalesDocNumber()); posd.setTechKey(techKey); posd.getHeader().setTechKey(techKey); } else { retVal = new BackendCallResult(BackendCallResult.Result.failure); SAP_LOGGER.debug("Transaction could not be saved."); } if (SAP_LOGGER.isDebugEnabled()) { logCall(ConstantsR3Lrd.FM_LO_API_SAVE, importParams, null); } dispatchMessages(posd, exportParams.getTable("ET_MESSAGES"), exportParams.getStructure("ES_ERROR")); SAP_LOGGER.exiting(); return retVal; } catch (final BackendException e) { invalidateSalesDocument(posd); throw e; } } /** * @param commit * @param cn * @param function * @param exportParams * @param custExit * @throws BackendException */ private void isCustExit(final boolean commit, final JCoConnection cn, final JCoFunction function, final JCoParameterList exportParams, final ERPLO_APICustomerExits custExit) throws BackendException { if (custExit != null) { custExit.customerExitBeforeSave(commit, function, cn, SAP_LOGGER); } cn.execute(function); if (custExit != null) { custExit.customerExitAfterSave(commit, function, cn, SAP_LOGGER); } if (SAP_LOGGER.isDebugEnabled()) { final StringBuilder debugOutput = new StringBuilder(60); debugOutput.append("Result of ERP_LORD_SAVE: "); debugOutput.append("\n EF_SAVED : ").append(exportParams.getString("EF_SAVED")); debugOutput.append("\n EV_VBELN_SAVED: ").append(exportParams.getString("EV_VBELN_SAVED")); SAP_LOGGER.debug(debugOutput); } } /** * Checks if following attributes have been provided: process type, soldTo, sales organisation, distribution channel, * division (Mandatory fields for LOAD-call). * * @param posd * @throws BackendExceptionECOERP */ protected void checkAttributesLrdLoad(final SalesDocument posd) throws BackendExceptionECOERP { checkAttributeEmpty(moduleConfigurationAccess.getProperty(SapmodelConstants.CONFIGURATION_PROPERTY_TRANSACTION_TYPE), "Transaction Type"); checkAttributeEmpty(posd.getHeader().getPartnerKey(PartnerFunctionData.SOLDTO), "SoldTo"); checkAttributeEmpty(moduleConfigurationAccess.getProperty(SapmodelConstants.CONFIGURATION_PROPERTY_SALES_ORG), "SalesOrg"); checkAttributeEmpty(moduleConfigurationAccess.getProperty(SapmodelConstants.CONFIGURATION_PROPERTY_DISTRIBUTION_CHANNEL), "DistrChan"); checkAttributeEmpty(moduleConfigurationAccess.getProperty(SapmodelConstants.CONFIGURATION_PROPERTY_DIVISION), "Division"); } @Override public BackendCallResult executeLrdLoad(final SalesDocument posd, final BackendState erpDocument, final JCoConnection cn, final LoadOperation loadState) throws BackendException { final String METHOD_NAME = "executeLrdLoad()"; SAP_LOGGER.entering(METHOD_NAME); final JCoFunction function = cn.getFunction(ConstantsR3Lrd.FM_LO_API_LOAD); // getting import parameter final JCoParameterList importParams = function.getImportParameterList(); // header structure final JCoStructure headComv = importParams.getStructure("IS_HEAD_COMV"); final JCoStructure headComx = importParams.getStructure("IS_HEAD_COMX"); // setting the import table basket_item // getting export parameters final JCoParameterList exportParams = function.getExportParameterList(); // Structure for switches final JCoStructure logicSwitch = importParams.getStructure("IS_LOGIC_SWITCH"); fillControlAttributes(logicSwitch); //Determine process type final String convProcessType = determineProcessType(posd, cn); // Scenario importParams.setValue("IV_SCENARIO_ID", scenario_LO_API_WEC); if (loadState.getLoadOperation().equals(LoadOperation.display)) { JCoHelper.setValue(importParams, LoadOperation.display, "IV_TRTYP"); JCoHelper.setValue(importParams, posd.getHeader().getTechKey().toString(), "IV_VBELN"); } isCreateLoadOperation(posd, erpDocument, loadState, importParams, headComv, headComx, convProcessType); isEditLoadOperation(posd, loadState, importParams); final ERPLO_APICustomerExits custExit = getCustExit(); if (custExit != null) { custExit.customerExitBeforeLoad(posd, function, cn, SAP_LOGGER); } executeRfc(cn, function); if (custExit != null) { custExit.customerExitAfterLoad(posd, function, cn, SAP_LOGGER); } final JCoTable etMessages = exportParams.getTable("ET_MESSAGES"); final JCoStructure esError = exportParams.getStructure("ES_ERROR"); if (loadState.getLoadOperation().equals(LoadOperation.create)) { final JCoStructure headerV = exportParams.getStructure("ES_HEAD_COMV"); posd.setTechKey(JCoHelper.getTechKey(headerV, "HANDLE")); } final JCoStructure headerComV = exportParams.getStructure("ES_HEAD_COMV"); posd.getHeader().setHandle(JCoHelper.getString(headerComV, "HANDLE")); logParameters(importParams, exportParams); // error during load cannot be corrected // this we need to raise as an exception final String messageType = esError.getString("MSGTY"); if ("E".equals(messageType) || "A".equals(messageType)) { if (loadState.getLoadOperation().equals(LoadOperation.create)) { if (!isRecoverableHeaderError(esError)) { logErrorMessage(esError); posd.setInitialized(false); return new BackendCallResult(BackendCallResult.Result.failure); } } else if (loadState.getLoadOperation().equals(LoadOperation.edit)) { loadState.setLoadOperation(LoadOperation.display); } } dispatchMessages(posd, etMessages, esError); return isPosdInitialized(posd, METHOD_NAME, function, exportParams, esError); } /** * Method to log import and export parameters * * @param importParams * @param exportParams */ private void logParameters(final JCoParameterList importParams, final JCoParameterList exportParams) { if (SAP_LOGGER.isDebugEnabled()) { logCall(ConstantsR3Lrd.FM_LO_API_LOAD, importParams, null); logCall(ConstantsR3Lrd.FM_LO_API_LOAD, null, exportParams.getStructure("ES_HEAD_COMV")); logCall(ConstantsR3Lrd.FM_LO_API_LOAD, null, exportParams.getStructure("ES_HEAD_COMR")); } } /** * @param posd * @param METHOD_NAME * @param function * @param exportParams * @param esError * @return */ private BackendCallResult isPosdInitialized(final SalesDocument posd, final String METHOD_NAME, final JCoFunction function, final JCoParameterList exportParams, final JCoStructure esError) { if (posd.isInitialized()) { readAlternativePartners(posd, function.getTableParameterList().getTable("ET_ALTERNATIVE_PARTNERS")); } if ("".equals(JCoHelper.getString(exportParams.getStructure("ES_HEAD_COMV"), "HANDLE"))) { SAP_LOGGER.debug("No handle"); } BackendCallResult result = null; if (!esError.getString("ERRKZ").isEmpty()) { result = new BackendCallResult(BackendCallResult.Result.failure); SAP_LOGGER.debug("Error in " + METHOD_NAME + ": " + esError); } else { result = new BackendCallResult(); } SAP_LOGGER.exiting(); return result; } /** * @param posd * @param loadState * @param importParams */ private void isEditLoadOperation(final SalesDocument posd, final LoadOperation loadState, final JCoParameterList importParams) { if (loadState.getLoadOperation().equals(LoadOperation.edit)) { JCoHelper.setValue(importParams, LoadOperation.edit, "IV_TRTYP"); JCoHelper.setValue(importParams, posd.getHeader().getTechKey().toString(), "IV_VBELN"); JCoHelper.setValue(importParams, posd.getHeader().getPartnerKey(PartnerFunctionData.SOLDTO), "IV_KUNAG"); JCoHelper.setValue(importParams, (String) moduleConfigurationAccess.getProperty(SapmodelConstants.CONFIGURATION_PROPERTY_SALES_ORG), "IV_VKORG"); JCoHelper.setValue(importParams, (String) moduleConfigurationAccess.getProperty(SapmodelConstants.CONFIGURATION_PROPERTY_DISTRIBUTION_CHANNEL), "IV_VTWEG"); JCoHelper.setValue(importParams, (String) moduleConfigurationAccess.getProperty(SapmodelConstants.CONFIGURATION_PROPERTY_DIVISION), "IV_SPART"); } } /** * @param posd * @param erpDocument * @param loadState * @param importParams * @param headComv * @param headComx * @param convProcessType * @throws BackendExceptionECOERP */ private void isCreateLoadOperation(final SalesDocument posd, final BackendState erpDocument, final LoadOperation loadState, final JCoParameterList importParams, final JCoStructure headComv, final JCoStructure headComx, final String convProcessType) throws BackendExceptionECOERP { if (loadState.getLoadOperation().equals(LoadOperation.create)) { // we need to know that first update might need to do specific // shipto handling erpDocument.setDocumentInitial(true); // First check on essential attributes checkAttributesLrdLoad(posd); JCoHelper.setValue(importParams, LoadOperation.create, "IV_TRTYP"); JCoHelper.setValue(importParams, convProcessType, "IV_AUART"); JCoHelper.setValue(importParams, posd.getHeader().getPartnerKey(PartnerFunctionData.SOLDTO), "IV_KUNAG"); JCoHelper.setValue(importParams, (String) moduleConfigurationAccess.getProperty(SapmodelConstants.CONFIGURATION_PROPERTY_SALES_ORG), "IV_VKORG"); JCoHelper.setValue(importParams, (String) moduleConfigurationAccess.getProperty(SapmodelConstants.CONFIGURATION_PROPERTY_DISTRIBUTION_CHANNEL), "IV_VTWEG"); JCoHelper.setValue(importParams, (String) moduleConfigurationAccess.getProperty(SapmodelConstants.CONFIGURATION_PROPERTY_DIVISION), "IV_SPART"); headComv.setValue("BSTKD", posd.getHeader().getPurchaseOrderExt()); headComx.setValue("BSTKD", "X"); final Date reqDelvDate = posd.getHeader().getReqDeliveryDate(); if (reqDelvDate != null) { // String reqDelDate = headComv.setValue("VDATU", reqDelvDate); headComx.setValue("VDATU", "X"); } } } /** * @param posd * @param cn * @return * @throws BackendException */ private String determineProcessType(final SalesDocument posd, final JCoConnection cn) throws BackendException { String processType = posd.getHeader().getProcessType(); if (processType == null || processType.length() == 0) { processType = (String) moduleConfigurationAccess.getProperty(SapmodelConstants.CONFIGURATION_PROPERTY_TRANSACTION_TYPE); } final ProcessTypeConverter ptc = new ProcessTypeConverter(); final String convProcessType = ptc.convertProcessTypeToLanguageDependent(processType, cn); return convProcessType; } private void readAlternativePartners(final SalesDocument salesDocument, final JCoTable alternativePartnerTable) { final List<ShipTo> shipToList = salesDocument.getAlternativeShipTos(); final List<BillTo> billToList = salesDocument.getAlternativeBillTos(); shipToList.clear(); billToList.clear(); final int numRows = alternativePartnerTable.getNumRows(); for (int i = 0; i < numRows; i++) { alternativePartnerTable.setRow(i); final Address address = (Address) genericFactory.getBean(SapcommonbolConstants.ALIAS_BO_ADDRESS); address.setCompanyName(alternativePartnerTable.getString("NAME")); address.setName1(alternativePartnerTable.getString("NAME")); address.setName2(alternativePartnerTable.getString("NAME_2")); address.setCity(alternativePartnerTable.getString("CITY")); address.setStreet(alternativePartnerTable.getString("STREET")); address.setPostlCod1(alternativePartnerTable.getString("POSTL_COD1")); address.setHouseNo(alternativePartnerTable.getString("HOUSE_NO")); address.setCountry(alternativePartnerTable.getString("COUNTRY")); address.setRegion(alternativePartnerTable.getString("REGION")); address.setAddressStringC(alternativePartnerTable.getString("ADDRESS_SHORT_FORM_S")); address.setAddressPartner(alternativePartnerTable.getString("KUNNR")); address.setTel1Numbr(alternativePartnerTable.getString("TEL1_NUMBR")); address.setTel1Ext(alternativePartnerTable.getString("TEL1_EXT")); address.setFaxNumber(alternativePartnerTable.getString("FAX_NUMBER")); address.setFaxExtens(alternativePartnerTable.getString("FAX_EXTENS")); address.setAddrnum(alternativePartnerTable.getString("KUNNR")); address.clearX(); if ("WE".equals(alternativePartnerTable.getString("PARVW"))) { final PartnerBase partner = salesDocument.createShipTo(); partner.setId(alternativePartnerTable.getString("KUNNR")); partner.setShortAddress(alternativePartnerTable.getString("ADDRESS_SHORT_FORM_S")); partner.setAddress(address); shipToList.add((ShipTo) partner); } if ("RE".equals(alternativePartnerTable.getString("PARVW"))) { final PartnerBase partner = salesDocument.createBillTo(); partner.setId(alternativePartnerTable.getString("KUNNR")); partner.setShortAddress(alternativePartnerTable.getString("ADDRESS_SHORT_FORM_S")); partner.setAddress(address); billToList.add((BillTo) partner); } } } @Override public ReturnValue executeSetActiveFields(final JCoConnection cn) throws BackendException { final String METHOD_NAME = "executeSetActiveFields()"; SAP_LOGGER.entering(METHOD_NAME); ReturnValue retVal = null; final JCoFunction function = cn.getFunction(ConstantsR3Lrd.FM_LO_API_SET_ACTIVE_FIELDS); // getting import parameters final JCoParameterList importParams = function.getImportParameterList(); final JCoTable itActiveFields = importParams.getTable("IT_ACTIVE_FIELD"); final Iterator<SetActiveFieldsListEntry> aflIT = activeFieldsListCreateChange.iterator(); while (aflIT.hasNext()) { final SetActiveFieldsListEntry aflEntry = aflIT.next(); // New row itActiveFields.appendRow(); // Set values itActiveFields.setValue("OBJECT", aflEntry.getObjectName()); itActiveFields.setValue("FIELD", aflEntry.getFieldName()); } final ERPLO_APICustomerExits custExit = getCustExit(); if (custExit != null) { custExit.customerExitBeforeSetActiveFields(function, cn, SAP_LOGGER); } cn.execute(function); if (custExit != null) { custExit.customerExitAfterSetActiveFields(function, cn, SAP_LOGGER); } retVal = new ReturnValue("000"); SAP_LOGGER.exiting(); return retVal; } /** * Fill active fields list * * @param activeFieldsListCreateChange * List of active fields which we setup with this call */ protected void setActiveFieldsListCreateChange(final List<SetActiveFieldsListEntry> activeFieldsListCreateChange) { // HEAD activeFieldsListCreateChange.add(new SetActiveFieldsListEntry("HEAD", "BSTKD")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry("HEAD", "VSBED")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry("HEAD", "VDATU")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry("HEAD", "INCO1")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry("HEAD", "INCO2")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry("HEAD", "VKORG")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry("HEAD", "VTWEG")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry("HEAD", "KUNAG")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry("HEAD", "BSARK")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry("HEAD", "LIFSK")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry("HEAD", "WAERK")); // in case of no guestUserMode those fields are excluded at // executeSetActiveFields activeFieldsListCreateChange.add(new SetActiveFieldsListEntry("HEAD", "CPD_STREET")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry("HEAD", "CPD_HNUM")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry("HEAD", "CPD_PCODE")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry("HEAD", "CPD_CITY")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry("HEAD", "CPD_COUNTRY")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry("HEAD", "CPD_LANGU_EXT")); final ERPLO_APICustomerExits custExit = getCustExit(); // Header Extension Data if (custExit != null) { final Map<LrdFieldExtension.FieldType, LrdFieldExtension> extensionFields = custExit.customerExitGetExtensionFields(); final LrdFieldExtension lrdFieldExtension = extensionFields.get(LrdFieldExtension.FieldType.HeadComV); checkHeadLrdFieldextension(activeFieldsListCreateChange, lrdFieldExtension); } activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(ITEM, "MABNR")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(ITEM, "POSNR")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(ITEM, "KWMENG")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(ITEM, "ABGRU")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(ITEM, "EDATU")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(ITEM, "PSTYV")); // activeFieldsListCreateChange.add(new SetActiveFieldsListEntry("ITEM", activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(ITEM, "VRKME")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(PARTY, "KUNNR")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(PARTY, "PARVW")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(PARTY, "PCODE")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(PARTY, "CITY")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(PARTY, "CITY2")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(PARTY, "STREET")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(PARTY, "HNUM")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(PARTY, "COUNTRY")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(PARTY, "REGION")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(PARTY, "NAME")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(PARTY, "NAME2")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(PARTY, "TELNUM")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(PARTY, "TELEXT")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(PARTY, "FAXNUM")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(PARTY, "FAXEXT")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(PARTY, "MOBNUM")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(PARTY, "EMAIL")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(PARTY, "TAXJURCODE")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(PARTY, "TITLE")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(PARTY, "LANGU_EXT")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(PARTY, "PBOX")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(PARTY, "PBOX_PCODE")); // Item Extension Data if (custExit != null) { final Map<LrdFieldExtension.FieldType, LrdFieldExtension> extensionFields = custExit.customerExitGetExtensionFields(); final LrdFieldExtension lrdFieldExtension = extensionFields.get(LrdFieldExtension.FieldType.ItemComV); checkItemLrdFieldextension(activeFieldsListCreateChange, lrdFieldExtension); } // Text activeFieldsListCreateChange.add(new SetActiveFieldsListEntry("TEXT", "TEXT_STRING")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry("TEXT", "ID")); activeFieldsListCreateChange.add(new SetActiveFieldsListEntry("TEXT", "SPRAS_ISO")); } /** * @param activeFieldsListCreateChange * @param lrdFieldExtension */ private void checkItemLrdFieldextension(final List<SetActiveFieldsListEntry> activeFieldsListCreateChange, final LrdFieldExtension lrdFieldExtension) { if (lrdFieldExtension != null) { final List<String> fields = lrdFieldExtension.getFieldnames(); if (fields != null) { for (final String field : fields) { activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(LrdFieldExtension.objectItem, field)); } } } } /** * @param activeFieldsListCreateChange * @param lrdFieldExtension */ private void checkHeadLrdFieldextension(final List<SetActiveFieldsListEntry> activeFieldsListCreateChange, final LrdFieldExtension lrdFieldExtension) { if (lrdFieldExtension != null) { final List<String> fields = lrdFieldExtension.getFieldnames(); if (fields != null) { for (final String field : fields) { activeFieldsListCreateChange.add(new SetActiveFieldsListEntry(LrdFieldExtension.objectHead, field)); } } } } /** * Wrapper for the remote function call. This can be used for performance measurement instrumentation, additional * logging a.o. as well as for unit tests to get independent from the ERP backend * * @param theConnection * JCO connection * @param theFunction * JCO Function * @throws BackendException */ protected void executeRfc(final JCoConnection theConnection, final JCoFunction theFunction) throws BackendException { SAP_LOGGER.entering("executeRfc"); try { final long start = System.currentTimeMillis(); theConnection.execute(theFunction); final long end = System.currentTimeMillis(); final long millis = end - start; rfctime = rfctime + millis; } finally { SAP_LOGGER.exiting(); } } @Override public void executeLrdDoActionsDocumentPricing(final SalesDocument salesDocument, final JCoConnection cn, final TransactionConfiguration transConf) throws BackendException { executeLrdDoActionsDocumentPricing(salesDocument, ACTION_PARAM_NEW_FREIGHT_DETERMINATION, cn, transConf); } @Override public void executeLrdDoActionsDocumentPricing(final SalesDocument salesDocument, final String pricingType, final JCoConnection cn, final TransactionConfiguration transConf) throws BackendException { final String METHOD_NAME = "executeLrdDoActionsDocumentPricing()"; SAP_LOGGER.entering(METHOD_NAME); final JCoFunction function = cn.getFunction(ConstantsR3Lrd.FM_LO_API_DO_ACTIONS); // getting import parameter final JCoParameterList importParams = function.getImportParameterList(); // getting export parameters final JCoParameterList exportParams = function.getExportParameterList(); final JCoTable itAction = importParams.getTable("IT_ACTION"); itAction.appendRow(); itAction.setValue("HANDLE", salesDocument.getHeader().getHandle()); itAction.setValue("ACTION", ACTION_ID_PRICING); itAction.setValue("PARAM", pricingType); cn.execute(function); if (SAP_LOGGER.isDebugEnabled()) { logCall(ConstantsR3Lrd.FM_LO_API_DO_ACTIONS, importParams, null); } // error handling final JCoTable etMessages = exportParams.getTable("ET_MESSAGES"); final JCoStructure esError = exportParams.getStructure("ES_ERROR"); dispatchMessages(salesDocument, etMessages, esError); SAP_LOGGER.exiting(); } /** * @param isLogicSwitch */ protected void fillControlAttributes(final JCoStructure isLogicSwitch) { // deactivating of switch for check of open documents // (contracts, quotations): no error message // should be returned when a open contract or quotation exists // for the entered product of the order isLogicSwitch.setValue(FIELD_NO_MESSAGES_DOC, "X"); isLogicSwitch.setValue(FIELD_NO_CONVERSION, "X"); } }
[ "travis.d.crawford@accenture.com" ]
travis.d.crawford@accenture.com
59820510f92c7b01c84e20620638222e55d27dc7
8f51ffe872f580701ffe9030427c8dcdf9f8b9bf
/Java/Programming Basics/SoftUniExams/src/B2PoolPipe.java
ed0c65b63b574ef0ddf123a2f13ac1f1e51a8b58
[]
no_license
BigNikO/soft-uni-repos
0ca0217a1dda3ff68222fa3e8198c1c473180f37
83864121bdc886f47b736e1594ffbcb28e60892a
refs/heads/master
2023-01-15T05:20:07.662331
2020-11-21T07:05:02
2020-11-21T07:05:02
211,621,609
0
0
null
2020-11-21T07:26:57
2019-09-29T07:23:16
CSS
UTF-8
Java
false
false
919
java
import java.util.Scanner; public class B2PoolPipe { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int v = Integer.parseInt(sc.nextLine()); int p1 = Integer.parseInt(sc.nextLine()); int p2 = Integer.parseInt(sc.nextLine()); double h = Double.parseDouble(sc.nextLine()); double l = p1*h+p2*h; double p=l*10; double q=h*10; int x = (int)(l*100/v); int y = (int)(p1*h*100/l); int z = (int)(p2*h*100/l); if (l<=v) System.out.println("The pool is " + x +"% full. Pipe 1: "+y+"%. Pipe 2: "+z+"%." ); else{ if (q%10==0) System.out.println("For " +(int)h +" hours the pool overflows with "+ (l-v) +" liters."); else System.out.println("For " +h +" hours the pool overflows with "+ (l-v) +" liters."); } } }
[ "big_nik0@yahoo.com" ]
big_nik0@yahoo.com
dd189c845fd5500ce9ca7015e2c8f8f2d13a5544
cb664509186d648b435338a8f27431592692c200
/src/be/dog/d/steven/OracleProgrammingComplete/chapter12/app/Shop.java
9b7df90445b85c6ab32ff7012e8f314b3846fbf4
[]
no_license
H3AR7B3A7/CertificationPractice
43ae793502738725282cdfbaa7ae0fa453f2a46e
a84efd3306e98441c5b7ab17cb4ef82ed763103b
refs/heads/master
2023-04-18T01:09:19.874860
2021-05-03T18:12:36
2021-05-03T18:12:36
336,681,093
2
1
null
null
null
null
UTF-8
Java
false
false
1,722
java
package be.dog.d.steven.OracleProgrammingComplete.chapter12.app; import be.dog.d.steven.OracleProgrammingComplete.chapter12.data.ProductFactory; import be.dog.d.steven.OracleProgrammingComplete.chapter12.data.Rating; public class Shop { public static void main(String[] args) { var pf = new ProductFactory("en-GB"); pf.parseProduct("F,1,Pizza,8.50,2021-03-22"); pf.parseReview("1,5,Perfect"); pf.parseReview("1,4,To lick your fingers"); pf.parseReview("1,3,It was oké"); pf.parseReview("1,4,Tasted truly Italian"); pf.printProductReport(1); pf.parseProduct("D,2,Coffee,2.10,"); pf.parseReview("2,1,Tasted like water"); pf.parseReview("2,2,Is this coffee? I ordered tea"); pf.parseReview("2,3,It was oké"); pf.printProductReport(2); pf.parseProduct("D,3,Tea,1.80,"); pf.parseReview("3,1,Tasted like dish water"); pf.parseReview("3,1,Is this tea? I ordered coffee"); pf.parseReview("3,3,It was oké"); // pf.printProductReport(3); pf.parseProduct("F,4,Cake,3.50,2021-03-20"); pf.parseReview("4,5,Perfect"); pf.parseReview("4,4,To lick your fingers"); pf.parseReview("4,3,It was oké"); pf.parseReview("4,5,Best cake ever"); // pf.printProductReport(4); pf.printProductReport(69); pf.reviewProduct(69, Rating.FIVE_STAR, "OMG!!!"); pf.parseReview("69,5,Best cake ever"); pf.parseReview("45,Best cake ever"); // Handled by parse pf.parseReview("4,x,Best cake ever"); // Not handled pf.parseProduct("F,5,Chocolate,2.50"); pf.parseProduct("F,4,Cake,3.50,2021-69-69"); } }
[ "steven.dhondt@kenze.be" ]
steven.dhondt@kenze.be
46f5407063a0542b5e19f11e406dc48c3169f00d
fed652f794f63538cbd2e201d0e3feecc8d05003
/forester/java/src/org/forester/application/ancestor_seq_x_m7.java
4294a34150f6c61391e39609976a1809432c8ebd
[]
no_license
cmzmasek/forester
aa553c6e8276f8095f7dc7fe2b4f6bd501d0d704
289f2e6d04877f6ff8912e0e365ef5ef01d3b13a
refs/heads/master
2023-04-07T15:05:01.913974
2023-03-15T21:42:05
2023-03-15T21:42:05
34,541,904
33
15
null
2016-01-13T23:30:45
2015-04-24T21:06:41
Java
UTF-8
Java
false
false
15,366
java
package org.forester.application; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; import java.util.SortedMap; import java.util.TreeMap; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.forester.io.parsers.PhylogenyParser; import org.forester.io.parsers.util.ParserUtils; import org.forester.io.writers.PhylogenyWriter; import org.forester.phylogeny.Phylogeny; import org.forester.phylogeny.PhylogenyMethods; import org.forester.phylogeny.PhylogenyNode; import org.forester.phylogeny.data.Sequence; import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory; import org.forester.phylogeny.factories.PhylogenyFactory; import org.forester.phylogeny.iterators.PhylogenyNodeIterator; import org.forester.sequence.BasicSequence; import org.forester.util.ForesterUtil; public final class ancestor_seq_x_m7 { private final static String PRG_NAME = "ancestor_seq_x_m7"; private static final String PRG_DATE = "2021-06-01"; private static final String PRG_VERSION = "1.0.0"; private static final Pattern P1 = Pattern.compile( "(\\d+)\\.\\s+?([A-Za-z0-9_]+?):(.+)" ); private static final Pattern P2 = Pattern.compile( "(\\d+)\\.\\s+?\\(\\s*(\\d+)\\s*\\.\\s*(\\d+)\\s*\\)" ); private static final String SEQ_NAME = "S"; public static void main( final String[] args ) { ForesterUtil.printProgramInformation( PRG_NAME, PRG_VERSION, PRG_DATE ); if ( args.length != 3 ) { System.out.println( PRG_NAME + ": Wrong number of arguments.\n" ); System.out.println( "Usage: " + PRG_NAME + " <in-tree> <most probable sequence file> <out-tree>\n" ); System.out.println( "Example: " + PRG_NAME + " tree.xml most_prob_seqs.txt tree_with_anc_seqs.xml\n" ); System.exit( -1 ); } final File intree = new File( args[ 0 ] ); final File mega_most_prob_seqs = new File( args[ 1 ] ); final File outtree = new File( args[ 2 ] ); final String error0 = ForesterUtil.isReadableFile( intree ); if ( !ForesterUtil.isEmpty( error0 ) ) { ForesterUtil.fatalError( PRG_NAME, error0 ); } final String error1 = ForesterUtil.isReadableFile( mega_most_prob_seqs ); if ( !ForesterUtil.isEmpty( error1 ) ) { ForesterUtil.fatalError( PRG_NAME, error1 ); } final String error2 = ForesterUtil.isWritableFile( outtree ); if ( !ForesterUtil.isEmpty( error2 ) ) { ForesterUtil.fatalError( PRG_NAME, error2 ); } Phylogeny p = null; try { final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance(); final PhylogenyParser pp = ParserUtils.createParserDependingOnFileType( intree, true ); p = factory.create( intree, pp )[ 0 ]; } catch ( final Exception e ) { System.out.println( "\nCould not read \"" + intree + "\" [" + e.getMessage() + "]\n" ); System.exit( -1 ); } final SortedMap<String, IdSeq> map = new TreeMap<>(); final SortedMap<String, PhylogenyNode> number_to_node_map = new TreeMap<>(); readAncestralSeqsFileF( mega_most_prob_seqs, p, map, number_to_node_map ); System.exit( 0 ); addSeqsToNodes( map, number_to_node_map ); int int_nodes_total = 0; int int_nodes_with_seq = 0; int int_nodes_without_seq = 0; int seq_length = -1; for( final PhylogenyNodeIterator iter = p.iteratorPreorder(); iter.hasNext(); ) { final PhylogenyNode node = iter.next(); if ( node.isInternal() ) { ++int_nodes_total; if ( node.isHasNodeData() && node.getNodeData().isHasSequence() && !ForesterUtil.isEmpty( node.getNodeData().getSequence().getMolecularSequence() ) ) { ++int_nodes_with_seq; if ( seq_length < 0 ) { seq_length = node.getNodeData().getSequence().getMolecularSequence().length(); } else if ( seq_length != node.getNodeData().getSequence().getMolecularSequence().length() ) { ForesterUtil.fatalError( PRG_NAME, "sequences of unequal length detected" ); } } else { ++int_nodes_without_seq; } } } try { final PhylogenyWriter w = new PhylogenyWriter(); w.toPhyloXML( p, 0, outtree ); } catch ( final IOException e ) { System.out.println( "\nFailure to write output [" + e.getMessage() + "]\n" ); System.exit( -1 ); } System.out.println( "Wrote outtree to : " + outtree ); System.out.println( "Sequence length : " + seq_length ); System.out.println( "Internal nodes total : " + int_nodes_total ); System.out.println( "Internal nodes with sequence : " + int_nodes_with_seq ); System.out.println( "Internal nodes without sequence: " + int_nodes_without_seq + "\n" ); } private static void readAncestralSeqsFileF( final File mega_most_prob_seqs, final Phylogeny p, final SortedMap<String, IdSeq> map, final SortedMap<String, PhylogenyNode> number_to_node_map ) { BufferedReader reader; final SortedMap<String, String> number_to_seqacc_map = new TreeMap<>(); final SortedMap<String, NumberPair> number_to_numberpair_map = new TreeMap<>(); try { reader = new BufferedReader( new FileReader( mega_most_prob_seqs ) ); String line; boolean done = false; while ( ( line = reader.readLine() ) != null ) { if ( !done ) { line.trim(); if ( line.length() > 0 ) { final Matcher m1 = P1.matcher( line ); final Matcher m2 = P2.matcher( line ); if ( m1.find() ) { System.out.println( "P1 matches: " + line ); number_to_seqacc_map.put( m1.group( 1 ), m1.group( 2 ) ); } if ( m2.find() ) { System.out.println( "P2 matches: " + line ); number_to_numberpair_map.put( m2.group( 1 ), new NumberPair( m2.group( 2 ), m2.group( 3 ) ) ); } else if ( ( number_to_numberpair_map.size() > 0 ) ) { done = true; } } } } reader.close(); } catch ( final IOException e ) { e.printStackTrace(); } ////// final Iterator<Entry<String, String>> it = number_to_seqacc_map.entrySet().iterator(); while ( it.hasNext() ) { final Map.Entry<String, String> e = it.next(); final String number = e.getKey(); final String seqacc = e.getValue(); final PhylogenyNode node = findNodeBySecAcc( p, seqacc ); if ( node == null ) { ForesterUtil.fatalError( PRG_NAME, "node with sequence accession " + seqacc + " not found" ); } number_to_node_map.put( number, node ); } ///// ///// boolean not_done = true; while ( not_done ) { boolean all_found = true; final Iterator<Entry<String, NumberPair>> it2 = number_to_numberpair_map.entrySet().iterator(); System.out.println( ); while ( it2.hasNext() ) { final Map.Entry<String, NumberPair> e = it2.next(); final String number = e.getKey(); final NumberPair nn = e.getValue(); final String nu1 = nn.getNumber1(); final String nu2 = nn.getNumber2(); if ( number_to_node_map.containsKey( nu1 ) && number_to_node_map.containsKey( nu2 ) ) { final PhylogenyNode node1 = number_to_node_map.get( nu1 ); final PhylogenyNode node2 = number_to_node_map.get( nu2 ); final PhylogenyNode lca = PhylogenyMethods.calculateLCA( node1, node2 ); number_to_node_map.put( number, lca); System.out.println( number + " => " + lca ); } else { all_found = false; } } if (all_found) { not_done = false; } } System.out.println( number_to_node_map ); ///// } private static void readAncestralSeqsFile( final File mega_most_prob_seqs, final Phylogeny p, final SortedMap<String, IdSeq> map, final SortedMap<String, PhylogenyNode> number_to_node_map ) { BufferedReader reader; try { reader = new BufferedReader( new FileReader( mega_most_prob_seqs ) ); String line; while ( ( line = reader.readLine() ) != null ) { line.trim(); if ( line.length() > 0 ) { final Matcher m1 = P1.matcher( line ); if ( m1.find() ) { final String number = m1.group( 1 ); final String id = m1.group( 2 ); final String seq = m1.group( 3 ); if ( map.containsKey( number ) ) { if ( !map.get( number ).getId().equals( id ) ) { System.out.println( "Error: Ids are not equal: " + map.get( number ).getId() + " != " + id ); System.exit( -1 ); } map.get( number ).getSeq().append( seq ); } else { map.put( number, new IdSeq( id, seq ) ); } final Matcher m2 = P2.matcher( id ); if ( m2.find() ) { final String number_1 = m2.group( 1 ); final String number_2 = m2.group( 2 ); final PhylogenyNode node_1 = number_to_node_map.get( number_1 ); final PhylogenyNode node_2 = number_to_node_map.get( number_2 ); if ( ( node_1 != null ) && ( node_2 != null ) ) { final PhylogenyNode lca = PhylogenyMethods.calculateLCA( node_1, node_2 ); number_to_node_map.put( number, lca ); } else { } } else { final PhylogenyNode node = findNodeBySecAcc( p, id ); if ( node != null ) { number_to_node_map.put( number, node ); } } } } } reader.close(); } catch ( final IOException e ) { e.printStackTrace(); } } private static void addSeqsToNodes( final SortedMap<String, IdSeq> map, final SortedMap<String, PhylogenyNode> number_to_node_map ) { for( final Entry<String, IdSeq> entry : map.entrySet() ) { final String number = entry.getKey(); final String id = entry.getValue().getId(); final String seq = entry.getValue().getSeq().toString(); //System.out.println( number + ":" + id + ": " + seq ); final PhylogenyNode node = number_to_node_map.get( number ); if ( node == null ) { System.out.println( "node found node: " + number ); //System.exit( -1 ); } else { if ( node.isHasNodeData() && node.getNodeData().isHasSequence() && !node.getNodeData().getSequence().isEmpty() ) { if ( ( node.getNodeData().getSequence().getAccession() != null ) && !ForesterUtil.isEmpty( node.getNodeData().getSequence().getAccession().getValue() ) ) { final String myacc = node.getNodeData().getSequence().getAccession().getValue(); if ( !myacc.equals( id ) ) { System.out.println( "ERROR" ); System.exit( -1 ); } node.getNodeData().getSequence().setMolecularSequence( seq ); node.getNodeData().getSequence().setMolecularSequenceAligned( true ); } } else { node.getNodeData().addSequence( new Sequence( BasicSequence.createAaSequence( SEQ_NAME, seq ) ) ); node.getNodeData().getSequence().setMolecularSequenceAligned( true ); } } } } private static PhylogenyNode findNodeBySecAcc( final Phylogeny p, final String acc ) { for( final PhylogenyNodeIterator iter = p.iteratorPreorder(); iter.hasNext(); ) { final PhylogenyNode node = iter.next(); if ( node.isHasNodeData() && node.getNodeData().isHasSequence() && !node.getNodeData().getSequence().isEmpty() ) { if ( ( node.getNodeData().getSequence().getAccession() != null ) && !ForesterUtil.isEmpty( node.getNodeData().getSequence().getAccession().getValue() ) ) { final String myacc = node.getNodeData().getSequence().getAccession().getValue(); if ( acc.equals( myacc ) ) { return node; } } } } return null; } final static class IdSeq { final String _id; final StringBuilder _seq; IdSeq( final String id, final String seq ) { _id = id; _seq = new StringBuilder( seq ); } public String getId() { return _id; } public StringBuilder getSeq() { return _seq; } } final static class NumberPair { final String _n1; final String _n2; NumberPair( final String n1, final String n2 ) { _n1 = n1; _n2 = n2; } public String getNumber1() { return _n1; } public String getNumber2() { return _n2; } } }
[ "chris.zma@outlook.com" ]
chris.zma@outlook.com
d36a45bcacd2735bba093f9e5999f42900b24472
1c2bd070e3ef60789a096e21e858d9fcfbad931b
/semantictools-context-renderer/src/main/java/org/semantictools/index/model/ServiceDocumentationList.java
15785af4edbf74b052a3799e7bc228f74e695958
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
1EdTech/semantictools
ecfc16943366471ad40d7348d4519178f4fa896e
11b8c565941a6d4ba038697da9bef9fc8267eb12
refs/heads/master
2022-12-07T10:32:08.579678
2016-12-18T21:07:58
2016-12-18T21:07:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,409
java
/******************************************************************************* * Copyright 2012 Pearson Education * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************/ package org.semantictools.index.model; import java.util.ArrayList; import org.semantictools.context.renderer.model.ServiceDocumentation; import org.semantictools.frame.api.TypeManager; public class ServiceDocumentationList extends ArrayList<ServiceDocumentation> { private static final long serialVersionUID = 1L; private String rdfTypeURI; public ServiceDocumentationList(String rdfTypeURI) { this.rdfTypeURI = rdfTypeURI; } public String getRdfTypeURI() { return rdfTypeURI; } public String getRdfTypeLocalName() { return TypeManager.getLocalName(rdfTypeURI); } }
[ "gregory.mcfall@gmail.com" ]
gregory.mcfall@gmail.com
6889bdccbd4bfcaf504c50efeb9dc98215e3b47f
f9227efb81b30a9c5dc9d020956cc8f4a05b2cc4
/src/exceptions/DotsOnOneLineException.java
48dc9878e5d12309e72270f15e46283872897b4b
[]
no_license
VladOsipov/Task1
ceb5c6bca857bd2ce3ad3a92b36c2debb3c9fa07
e11e2b5605cda68df910572467d3dca59dadf881
refs/heads/master
2020-02-26T17:05:56.843420
2016-09-27T21:22:29
2016-09-27T21:22:29
69,399,497
0
0
null
null
null
null
UTF-8
Java
false
false
250
java
package exceptions; /** * Created by Lenovo on 27.09.2016. */ public class DotsOnOneLineException extends Exception { public DotsOnOneLineException() { } public DotsOnOneLineException(String message) { super(message); } }
[ "osipov.06@mail.ru" ]
osipov.06@mail.ru
2503e44a9422009d9a0bd933c2e1dd09926eae72
ae86c4ac4a93ee39751919fc08a3788699121b1a
/src/com/test/hotel/dao/entity/ResponsableController.java
304f218fad00fbde81eda4128bad662fb6f8194e
[]
no_license
MeriemeRahmouni/Projet
97d7f4f6a766492e2215119a18c0d5ce45594dfd
b8e2b4d27c2066d71ad3c3353282998e65bc4e96
refs/heads/master
2020-09-22T12:20:52.575798
2019-12-01T16:40:03
2019-12-01T16:40:03
225,191,157
0
0
null
null
null
null
UTF-8
Java
false
false
1,598
java
package com.test.hotel.dao.entity; import javax.faces.bean.ManagedBean; //import javax.annotation.ManagedBean; import javax.faces.bean.SessionScoped; @ManagedBean(name="ResponsableController") @SessionScoped public class ResponsableController { private ResponsableModel ResponsableModel = new ResponsableModel(); private Responsable responsable = new Responsable(); private String message = ""; // getter and setter of objet Connection public Responsable getResponsable() { return responsable; } public void setResponsable(Responsable Responsable) { this.responsable = Responsable; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String Login() { if(ResponsableModel.login(this.responsable.getUsername(), this.responsable.getPassword())!=null && ResponsableModel.login(this.responsable.getUsername(), this.responsable.getPassword()).getGroup_id() ==1) { return "admin"; } if(ResponsableModel.login(this.responsable.getUsername(), this.responsable.getPassword())!=null && ResponsableModel.login(this.responsable.getUsername(), this.responsable.getPassword()).getGroup_id() ==2) { return "commercial"; } if(ResponsableModel.login(this.responsable.getUsername(), this.responsable.getPassword())!=null && ResponsableModel.login(this.responsable.getUsername(), this.responsable.getPassword()).getGroup_id() ==3) { return "comptable"; } else { this.message = " Erreur d'authentification"; this.responsable = new Responsable(); return "login"; } } }
[ "Merieme.Rahmouni@gmail.com" ]
Merieme.Rahmouni@gmail.com
3f007dcf2de5b25db37e58b802ce16701e3c10b8
e9a8ff13c0b16dd212c0c99f17a3e1da4cb92857
/FreeClient/Seeapenny/src/com/seeapenny/client/server/PagedResponse.java
150b0810c56b073a02a427eaf7c37234e2cce4ca
[]
no_license
AndreySeledkov/seeapenny
c7bb22d79a7a811dd1ded28f11888463bbc62088
1f125ea935436a5f066047f28019320138d84dd3
refs/heads/master
2020-06-13T17:33:33.982304
2016-12-05T01:13:55
2016-12-05T01:13:55
75,574,967
0
0
null
null
null
null
UTF-8
Java
false
false
1,844
java
package com.seeapenny.client.server; import com.seeapenny.client.xml.XMLUtils; import org.json.JSONObject; import org.w3c.dom.Element; import java.util.List; public class PagedResponse<I> extends Response { private int pages; private int perPage; private int page; private int totalCount; private int count; private int fromIndex; protected List<I> items; public int getPages() { return pages; } public int getPerPage() { return perPage; } public int getPage() { return page; } public int getTotalCount() { return totalCount; } public int getCount() { return count; } public int getFromIndex() { return fromIndex; } public List<I> getItems() { return items; } public final JSONObject fromJson(JSONObject rootDto, String name) { super.fromJson(rootDto); JSONObject dto = rootDto.optJSONObject(name); if (dto != null) { pages = dto.optInt("@pages"); perPage = dto.optInt("@perPage"); page = dto.optInt("@page"); totalCount = dto.optInt("@totalCount"); count = dto.optInt("@count"); fromIndex = dto.optInt("@fromIndex"); } return dto; } public final Element fromXml(Element root, String name) { super.fromXml(root); Element dto = XMLUtils.element(root, name); if (dto != null) { pages = XMLUtils.attributeInt(dto, "pages"); perPage = XMLUtils.attributeInt(dto, "perPage"); page = XMLUtils.attributeInt(dto, "page"); totalCount = XMLUtils.attributeInt(dto, "totalCount"); count = XMLUtils.attributeInt(dto, "count"); fromIndex = XMLUtils.attributeInt(dto, "fromIndex"); } return dto; } }
[ "seledkovandrey@gmail.com" ]
seledkovandrey@gmail.com
f650f5b4902fff7780873b14b690d4588abbea4c
2793c7a906490447c53f4854e305b56e1c824ee1
/com.opt.java.basics/src/factory/Bank.java
3ee26c84fd733f8df97d94cc08097c0fe4ff111c
[]
no_license
HeahTengZHi/mycode
5b2c00f0a8d5f50a1598bf8306def5e85ae6194f
73eb26ac81924805725aa3c3b25bf75545db5671
refs/heads/master
2022-11-27T14:21:00.280967
2020-08-06T03:58:41
2020-08-06T03:58:41
250,190,808
0
0
null
null
null
null
UTF-8
Java
false
false
68
java
package factory; public interface Bank { void getBankDetails(); }
[ "optimum.dev5@gmail.com" ]
optimum.dev5@gmail.com
e19391700ccefa7139f9d6af1725d7e54620f714
71037a0db3eebdc2717761ca53f319c12233df94
/src/main/java/com/example/Employee_Management_System/Resources/model/Employee.java
78397ea1684086fd550f9477b2a4352c0ed4178d
[]
no_license
jayshah99/Employee_Management_System
d4e9fbea3c1ae07018fa674eeafa9e81bef82b86
35ad6f7e7adc6e4d4153a62b5c108e57d9efc26a
refs/heads/master
2023-01-04T01:22:04.868676
2020-10-31T19:41:52
2020-10-31T19:41:52
292,787,404
0
0
null
2020-10-31T19:41:53
2020-09-04T08:00:50
Java
UTF-8
Java
false
false
1,733
java
package com.example.Employee_Management_System.Resources.model; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import lombok.ToString; import javax.persistence.*; import java.util.List; @Data @NoArgsConstructor @AllArgsConstructor @ToString @Entity public class Employee { @Id @Column @GeneratedValue private int id; @Column private String name; @Column private int age; @Column private String address; @Column private String gender; @Column(unique = true, nullable = false, length = 50) private String email; @Column(unique = true, nullable = false, length = 20) private String phoneNumber; @Column private boolean currentlyWorking; @OneToMany(targetEntity = Designation.class, cascade = CascadeType.ALL) @JoinColumn(name = "empid", referencedColumnName = "id") // @JsonIgnoreProperties("employee") // @OneToMany(mappedBy = "employee", fetch = FetchType.LAZY, cascade = CascadeType.ALL) private List<Designation> designation; @OneToMany(targetEntity = Salary.class, cascade = CascadeType.ALL) @JoinColumn(name = "empid", referencedColumnName = "id") private List<Salary> salary; public Employee(String name, String address, int age, String gender, String email, String phoneNumber, boolean currentlyWorking, List<Designation> designation, List<Salary> salary) { this.name = name; this.age = age; this.address = address; this.gender = gender; this.email = email; this.phoneNumber = phoneNumber; this.currentlyWorking = currentlyWorking; this.designation = designation; this.salary = salary; } }
[ "jaypshah99@gmail.com" ]
jaypshah99@gmail.com
f850d22705e1f895ccbdbe9cc2c4fa6c7054cec6
8e56605d376f7718f6de916a8f82a233ea07e0df
/src/com/lfy/ThreadsSynchronize/Test.java
5bedd4ec14b7352ec996b7be67ca3a148b0baeb8
[ "Apache-2.0" ]
permissive
liufeiyun/javaPractice
e7fbea5cb430cd8de9dc4c0834522e636ae605d5
ed36a507c890dfae3aeab98dcd174e3daef7c471
refs/heads/master
2020-03-19T03:15:57.737875
2018-06-16T08:17:55
2018-06-16T08:17:55
135,711,296
0
0
null
null
null
null
GB18030
Java
false
false
1,891
java
package com.lfy.ThreadsSynchronize; public class Test { public static void main(String[] args) { //创建 3 个窗口 // TicketSell1 t1 = new TicketSell1("A窗口"); // TicketSell1 t2 = new TicketSell1("B窗口"); // TicketSell1 t3 = new TicketSell1("C窗口"); // t1.start(); // t2.start(); // t3.start(); /**==================1、使用同步代码块解决=====================*/ // TicketSellSolution1 t1 = new TicketSellSolution1("A窗口"); // TicketSellSolution1 t2 = new TicketSellSolution1("B窗口"); // TicketSellSolution1 t3 = new TicketSellSolution1("C窗口"); // t1.start(); // t2.start(); // t3.start(); /**==================2、使用同步方法(貌似同步方法不能解决同步问题)=====================*/ // TicketSellSolution2 t1 = new TicketSellSolution2("A窗口"); // TicketSellSolution2 t2 = new TicketSellSolution2("B窗口"); // TicketSellSolution2 t3 = new TicketSellSolution2("C窗口"); // t1.start(); // t2.start(); // t3.start(); /**==================3、使用锁机制(貌似同步方法不能解决同步问题)=====================*/ // TicketSellSolution3 t1 = new TicketSellSolution3("A窗口"); // TicketSellSolution3 t2 = new TicketSellSolution3("B窗口"); // TicketSellSolution3 t3 = new TicketSellSolution3("C窗口"); // t1.start(); // t2.start(); // t3.start(); /**==================3、使用锁机制(貌似同步方法不能解决同步问题)=====================*/ // Thread t1 = new Thread(new TicketSellSolution4()); // Thread t2 = new Thread(new TicketSellSolution4()); // Thread t3 = new Thread(new TicketSellSolution4()); // t1.start(); // t2.start(); // t3.start(); } }
[ "1220429263@qq.com" ]
1220429263@qq.com
3a8d73dc5f9a84fbaf2157919b0e7b303830158e
39bef83f3a903f49344b907870feb10a3302e6e4
/Android Studio Projects/bf.io.openshop/src/okhttp3/internal/DiskLruCache$3.java
e973bce458f8860b13b4c3dc85d1b64003980d77
[]
no_license
Killaker/Android
456acf38bc79030aff7610f5b7f5c1334a49f334
52a1a709a80778ec11b42dfe9dc1a4e755593812
refs/heads/master
2021-08-19T06:20:26.551947
2017-11-24T22:27:19
2017-11-24T22:27:19
111,960,738
0
0
null
null
null
null
UTF-8
Java
false
false
1,805
java
package okhttp3.internal; import java.util.*; import java.io.*; import okio.*; class DiskLruCache$3 implements Iterator<Snapshot> { final Iterator<Entry> delegate = new ArrayList<Entry>(DiskLruCache.access$2000(DiskLruCache.this).values()).iterator(); Snapshot nextSnapshot; Snapshot removeSnapshot; @Override public boolean hasNext() { if (this.nextSnapshot != null) { return true; } Label_0076: { synchronized (DiskLruCache.this) { if (DiskLruCache.access$100(DiskLruCache.this)) { return false; } Snapshot snapshot = null; Block_6: { while (this.delegate.hasNext()) { snapshot = this.delegate.next().snapshot(); if (snapshot != null) { break Block_6; } } break Label_0076; } this.nextSnapshot = snapshot; return true; } } // monitorexit(diskLruCache) return false; } @Override public Snapshot next() { if (!this.hasNext()) { throw new NoSuchElementException(); } this.removeSnapshot = this.nextSnapshot; this.nextSnapshot = null; return this.removeSnapshot; } @Override public void remove() { if (this.removeSnapshot == null) { throw new IllegalStateException("remove() before next()"); } try { DiskLruCache.this.remove(this.removeSnapshot.key); } catch (IOException ex) {} finally { this.removeSnapshot = null; } } }
[ "ema1986ct@gmail.com" ]
ema1986ct@gmail.com
ca976e0ba769976634bc40ed0cafedb95fd72b8a
a51591370c8433d297b1f197390f19f789bea4cb
/app/src/main/java/com/reryde/app/Activities/WalletAndCouponHistory.java
bf7ea2757879d2f4807be8f3be67b455968c042e
[]
no_license
gistapp/ReRyde
ece9157da21583980bcf09f8292fa2d0806cf3ae
f888335d4414b753dd935594ae0ec50accd408d5
refs/heads/master
2020-04-27T02:24:43.560833
2018-09-29T06:46:38
2018-09-29T06:46:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,178
java
package com.reryde.app.Activities; import android.content.Context; import android.os.Bundle; import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.Window; import android.widget.ImageView; import android.widget.TextView; import com.appsflyer.AppsFlyerLib; import com.reryde.app.Fragments.CouponHistory; import com.reryde.app.Fragments.WalletHistory; import com.reryde.app.R; import java.util.HashMap; import java.util.Map; public class WalletAndCouponHistory extends AppCompatActivity { private ViewPager viewPager; private TabLayout tabLayout; private String tabTitles[]; private ImageView backArrow; private TextView lblTitle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_history); viewPager = (ViewPager) findViewById(R.id.viewpager); tabLayout = (TabLayout) findViewById(R.id.sliding_tabs); lblTitle = (TextView) findViewById(R.id.lblTitle); lblTitle.setText(getResources().getString(R.string.passbook)); backArrow = (ImageView) findViewById(R.id.backArrow); backArrow.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { onBackPressed(); } }); tabLayout.setupWithViewPager(viewPager); String strTag = getIntent().getExtras().getString("tag"); tabTitles = new String[]{getResources().getString(R.string.walletHistory), getResources().getString(R.string.couponHistory)}; viewPager.setAdapter(new SampleFragmentPagerAdapter(tabTitles, getSupportFragmentManager(), this)); if (strTag != null) { if (strTag.equalsIgnoreCase("past")) { viewPager.setCurrentItem(0); } else { viewPager.setCurrentItem(1); } } setupTabIcons(); tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener(){ @Override public void onTabSelected(TabLayout.Tab tab){ int position = tab.getPosition(); if (position==0){ Map<String, Object> wallethistory_eventValue = new HashMap<String, Object>(); AppsFlyerLib.getInstance().trackEvent(getApplicationContext(),"af_click_wallethistory",wallethistory_eventValue); }else { Map<String, Object> couponhistory_eventValue = new HashMap<String, Object>(); AppsFlyerLib.getInstance().trackEvent(getApplicationContext(),"af_click_couponhistory",couponhistory_eventValue); } } @Override public void onTabUnselected(TabLayout.Tab tab) { } @Override public void onTabReselected(TabLayout.Tab tab) { } }); } /** * Adding custom view to tab */ private void setupTabIcons() { TextView tabOne = (TextView) LayoutInflater.from(WalletAndCouponHistory.this).inflate(R.layout.custom_tab, null); tabOne.setText(getResources().getString(R.string.walletHistory)); tabLayout.getTabAt(0).setCustomView(tabOne); TextView tabTwo = (TextView) LayoutInflater.from(WalletAndCouponHistory.this).inflate(R.layout.custom_tab, null); tabTwo.setText(getResources().getString(R.string.couponHistory)); tabLayout.getTabAt(1).setCustomView(tabTwo); } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == android.R.id.home) onBackPressed(); return super.onOptionsItemSelected(item); } public class SampleFragmentPagerAdapter extends FragmentPagerAdapter { final int PAGE_COUNT = 2; private String tabTitles[]; private Context context; public SampleFragmentPagerAdapter(String tabTitles[], FragmentManager fm, Context context) { super(fm); this.context = context; this.tabTitles = tabTitles; } @Override public int getCount() { return PAGE_COUNT; } @Override public Fragment getItem(int position) { switch (position) { case 0: return new WalletHistory(); case 1: return new CouponHistory(); default: return new WalletHistory(); } } @Override public CharSequence getPageTitle(int position) { // Generate title based on item position return tabTitles[position]; } } }
[ "sundar@appoets.com" ]
sundar@appoets.com
1827d145b8d506866262cf70739c90dc474cd1ca
a727790e555d70bf138340174a60e60791e80d3e
/src/main/java/DP/code931.java
753263a86b1aa47d906fe8af2bd9eff4980fb018
[ "MIT" ]
permissive
xiaominyuan/LeetcodeEveryday
941eafb3f6f1eb82345ea913696a3c53c332e419
7b8e51b82e62f38188a1aa79576ded819aa959df
refs/heads/master
2021-07-10T08:06:35.294950
2020-09-14T14:25:58
2020-09-14T14:25:58
191,205,829
0
0
null
null
null
null
UTF-8
Java
false
false
1,829
java
//931. 下降路径最小和 //给定一个方形整数数组 A,我们想要得到通过 A 的下降路径的最小和。 // // 下降路径可以从第一行中的任何元素开始,并从每一行中选择一个元素。在下一行选择的元素和当前行所选元素最多相隔一列。 // //   // // 示例: // // 输入:[[1,2,3],[4,5,6],[7,8,9]] // 输出:12 // 解释: // 可能的下降路径有: // [1,4,7], [1,4,8], [1,5,7], [1,5,8], [1,5,9] // [2,4,7], [2,4,8], [2,5,7], [2,5,8], [2,5,9], [2,6,8], [2,6,9] // [3,5,7], [3,5,8], [3,5,9], [3,6,8], [3,6,9] // 和最小的下降路径是 [1,4,7],所以答案是 12。 // // 来源:力扣(LeetCode) // 链接:https://leetcode-cn.com/problems/minimum-falling-path-sum // 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 package DP; public class code931 { public int minFallingPathSum(int[][] A) { int len = A.length; int[][] dp = new int[len][len]; for (int i =0; i<len; i++){ dp[0][i] = A[0][i]; } for (int i = 1; i< len; i++){ //第一列 dp[i][0] = Math.min(dp[i-1][0], dp[i-1][1]) + A[i][0]; //中间的列 for (int j = 1; j< len-1; j++){ dp[i][j] = Math.min(Math.min(dp[i-1][j-1], dp[i-1][j]), dp[i-1][j+1]) + A[i][j]; } //最后一列 dp[i][len-1] = Math.min(dp[i-1][len-1], dp[i-1][len-2]) + A[i][len-1]; } int mins = Integer.MAX_VALUE; for (int i =0; i<len; i++){ if (dp[len-1][i] < mins){ mins = dp[len-1][i]; } } return mins; } }
[ "yuanxiaomin1995@126.com" ]
yuanxiaomin1995@126.com
ba92764204d8bdd359939f349563e262f8023d5d
5d220b8cbe0bcab98414349ac79b449ec2a5bdcf
/src/com/ufgov/zc/client/component/zc/fieldeditor/TextAreaFieldEditor.java
575bba63689368330f082fd0c5165973e1f5e7d0
[]
no_license
jielen/puer
fd18bdeeb0d48c8848dc2ab59629f9bbc7a5633e
0f56365e7bb8364f3d1b4daca0591d0322f7c1aa
refs/heads/master
2020-04-06T03:41:08.173645
2018-04-15T01:31:56
2018-04-15T01:31:56
63,419,454
0
1
null
null
null
null
UTF-8
Java
false
false
4,374
java
/** * @(#) project: GK * @(#) file: TextAreaFieldEditor.java * * Copyright 2010 UFGOV, Inc. All rights reserved. * UFGOV PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * */ package com.ufgov.zc.client.component.zc.fieldeditor; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.util.Iterator; import java.util.List; import javax.swing.JComponent; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JTextArea; import com.ufgov.zc.client.component.RegexDocument; import com.ufgov.zc.client.component.TextAreaUtil; import com.ufgov.zc.client.component.ui.fieldeditor.AbstractFieldEditor; import com.ufgov.zc.common.system.util.BeanUtil; import com.ufgov.zc.common.zc.model.ZcBaseBill; /** * @ClassName: TextAreaFieldEditor * @Description: 文本编辑框 * @date: 2010-4-28 下午03:20:14 * @version: V1.0 * @since: 1.0 * @author: fanpl * @modify: */ public class TextAreaFieldEditor extends AbstractFieldEditor { private JTextArea field; private String fieldName; private JPopupMenu popMenu; public TextAreaFieldEditor(String name, String fieldName) { this.fieldName = fieldName; init(name); } public TextAreaFieldEditor(String name, String fieldName, int maxChar, int occRow, int occCol) { this.fieldName = fieldName; this.occCol = occCol; this.occRow = occRow; /*if (maxChar > 0) { this.maxContentSize = maxChar; }*/ this.maxContentSize = maxChar; init(name); } public Object getValue() { return field.getText(); } protected JComponent createEditorComponent() { field = new JTextArea(); field.setColumns(10); field.setBackground(Color.WHITE); field.setRows(this.occRow); RegexDocument rd = new RegexDocument(); field.setDocument(rd); field.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { if (field.getText().length() > maxContentSize && maxContentSize > 0) { field.setText(field.getText().substring(0, maxContentSize)); return; } syncEditObject(); } }); field.setLineWrap(true); TextAreaUtil.AddRightMouseUtil(field); JScrollPane js = new JScrollPane(field); return js; } public void setValue(Object value) { // 在选择的上面的行发生改变的时候所触发的事件 if (value == null) { field.setText(null); field.setToolTipText(null); } else if (value instanceof ZcBaseBill) { String v = (String) BeanUtil.get(fieldName, value); field.setText(v); /*if (v == null || v.trim().equals("")) { field.setToolTipText(null); } else { field.setToolTipText(v); }*/ } } protected void syncEditObject() { if (getEditObject() != null) { BeanUtil.set(fieldName, field.getText(), getEditObject()); } this.fireEditSynced(); } public void setEnabled(boolean enabled) { field.setEditable(enabled); field.setEnabled(enabled); } public String getFieldName() { return fieldName; } public void setFieldName(String fieldName) { this.fieldName = fieldName; } public void initMouseMenu(List<String> list) { popMenu = new JPopupMenu(); for (Iterator iterator = list.iterator(); iterator.hasNext();) { String string = (String) iterator.next(); JMenuItem menu = new JMenuItem(string); menu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String str = e.getActionCommand(); //field.insert(str, field.getCaret().getDot()); field.replaceSelection(str); syncEditObject(); } }); popMenu.add(menu); } this.field.add(popMenu); this.field.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON3) { //getJPopupMenuEdicion(); if (popMenu != null) { popMenu.show(field, e.getX(), e.getY()); } } } }); } }
[ "jielenzghsy1@163.com" ]
jielenzghsy1@163.com
500ccd4a068c4397f3917061db9bf720cd4e0eac
fe2ef5d33ed920aef5fc5bdd50daf5e69aa00ed4
/struts2/src/base/zyf/struts/interceptor/LogInterceptor.java
f749e86f4a68237436baba8b2f32840e8ed82c0c
[]
no_license
sensui74/legacy-project
4502d094edbf8964f6bb9805be88f869bae8e588
ff8156ae963a5c61575ff34612c908c4ccfc219b
refs/heads/master
2020-03-17T06:28:16.650878
2016-01-08T03:46:00
2016-01-08T03:46:00
null
0
0
null
null
null
null
GB18030
Java
false
false
990
java
/** * * 项目名称:struts2 * 制作时间:Jun 4, 20094:28:33 PM * 包名:base.zyf.struts.interceptor * 文件名:LogInterceptor.java * 制作者:zhaoyifei * @version 1.0 */ package base.zyf.struts.interceptor; import java.util.Map; import com.opensymphony.xwork2.ActionInvocation; import com.opensymphony.xwork2.interceptor.AbstractInterceptor; /** * 拦截其主要目的是自动记录用户在系统内操作的痕迹,记录到数据库中,和log4j的作用不一样。 * @author zhaoyifei * @version 1.0 */ public class LogInterceptor extends AbstractInterceptor { private Map<String, Object> params; /* (non-Javadoc) * @see com.opensymphony.xwork2.interceptor.AbstractInterceptor#intercept(com.opensymphony.xwork2.ActionInvocation) */ @Override public String intercept(ActionInvocation actionInv) throws Exception { params = actionInv.getInvocationContext().getParameters(); if(params != null) { } return actionInv.invoke(); } }
[ "wow_fei@163.com" ]
wow_fei@163.com
bc63a74d92436ddc015863f1527917dcc46a4db3
fda73ea35aeb13ae23e4b0c24f7e752edc18ba2f
/PConception/DesignPattern/tpVisiteur/etudiant/ProgramNode.java
99214cb645a624c252eb73b6772f21a9ff56ff2c
[]
no_license
MaelSa/designPatterns
ab3523b5294d8555b5a5ff2c7294d82b77d9fbca
f94a3803c047fcf3d43da4777ecb447d7178c8e9
refs/heads/master
2020-12-09T18:18:30.836218
2020-01-14T11:17:07
2020-01-14T11:17:07
233,381,043
0
0
null
null
null
null
UTF-8
Java
false
false
129
java
package DesignPattern.tpVisiteur.etudiant; public abstract class ProgramNode{ public abstract void accept(Visitor v); }
[ "mael.salazard@g-mail.fr" ]
mael.salazard@g-mail.fr
f446e760578168e99c4ce901ed86c413bb826c35
58d4ab1f714ad9445764e356dc80b248fcdc58ab
/src/main/java/app/validation/PasswordMatchingValidator.java
69eec9c9781999eceb859f02d4c9c5f344227c0d
[]
no_license
TeodorStoyanov/Game-Store
b04e3428f07e2e6021b86ab7aeebb24123669df5
1a8a3635cbbc662bf1ff8e347a48f1da3213217a
refs/heads/master
2021-08-26T04:42:45.087081
2017-11-21T16:33:17
2017-11-21T16:33:17
111,573,351
0
0
null
null
null
null
UTF-8
Java
false
false
703
java
package app.validation; import app.models.bindingModels.user.RegisterUser; import org.springframework.stereotype.Component; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; @Component public class PasswordMatchingValidator implements ConstraintValidator<PasswordMatching, Object> { @Override public void initialize(PasswordMatching constraint) { } @Override public boolean isValid(Object o, ConstraintValidatorContext constraintValidatorContext) { if(o instanceof RegisterUser){ RegisterUser user=(RegisterUser)o; return user.getPassword().equals(user.getConfirmPassword()); } return false; } }
[ "tedy17@abv.bg" ]
tedy17@abv.bg
5be83289106fa7f1293db48cfb9d783ef5b4270a
5aa1d34ac9497d14662601b5363ee31c4a059a4b
/src/threads/SyncTest.java
9e25cf4404b269e18ac6ff04317a59e1da34d8b7
[]
no_license
liyuan231/leetcode
dc71eeb2b6d68c7cd99a6d67e9f4522a957abd35
3e35297c5eea356e8543aee930fed832c6576cd2
refs/heads/master
2023-04-18T20:12:02.162298
2021-05-01T01:59:03
2021-05-01T01:59:03
286,483,592
0
0
null
null
null
null
UTF-8
Java
false
false
1,475
java
package threads; public class SyncTest implements Runnable { @Override public synchronized void run() { count--; System.out.println(Thread.currentThread() + ":" + this.count); } private int count; public static void main(String[] args) throws InterruptedException { // SyncTest syncTest = new SyncTest(); // syncTest.count=100; // for(int i=0;i<100;i++){ // new Thread(syncTest).start(); // } // Thread.sleep(2000); // System.out.println(syncTest.count); SyncTest syncTest = new SyncTest(); new Thread(() -> { try { syncTest.m1(); } catch (InterruptedException e) { e.printStackTrace(); } }).start(); new Thread(() -> { try { syncTest.m2(); } catch (InterruptedException e) { e.printStackTrace(); } }).start(); } public synchronized void m1() throws InterruptedException { for(int i=0;i<100;i++){ System.out.println(Thread.currentThread() + "method m1 is invoked!->"+i); } System.out.println("m1 is finished!"); } public void m2() throws InterruptedException { for(int i=0;i<100;i++){ System.out.println(Thread.currentThread() + "method m2 is invoked!->"+i); } System.out.println("method m2 is finished!"); } }
[ "1987151116@qq.com" ]
1987151116@qq.com
1607842d2906000f6319cb257e22320ae15e2cbf
3f8c2a01c69118a8cfd5cfd34f34699a4efdb5ca
/src/main/java/com/gx/springboot/entity/Employee.java
11192b715cd4208995a348d59a13e4b8bc0007cb
[]
no_license
gxdmlv/springboot-mybatis-empdemo
9680b87382e01f21d7abc53a25021dfc30434608
92f36b6fdd248e58ae398258141ff7955bd3b469
refs/heads/master
2022-10-15T13:24:57.674220
2020-06-09T09:15:38
2020-06-09T09:15:38
270,956,175
0
0
null
null
null
null
UTF-8
Java
false
false
1,695
java
package com.gx.springboot.entity; import java.util.Date; /** * @createDate 2020/6/5 10:12 */ public class Employee { private Integer id; private String lastName; private String email; private Integer gender; private Integer d_id; private Date birth; @Override public String toString() { return "Employee{" + "id=" + id + ", lastName='" + lastName + '\'' + ", email='" + email + '\'' + ", gender=" + gender + ", d_id=" + d_id + ", birth=" + birth + ", department=" + department + '}'; } public Date getBirth() { return birth; } public void setBirth(Date birth) { this.birth = birth; } private Department department; public Department getDepartment() { return department; } public void setDepartment(Department department) { this.department = department; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public Integer getGender() { return gender; } public void setGender(Integer gender) { this.gender = gender; } public Integer getD_id() { return d_id; } public void setD_id(Integer d_id) { this.d_id = d_id; } }
[ "15651739593@163.com" ]
15651739593@163.com
322a9a050099d74006865e3b96f002c9464ab3b4
edb790f157d551eb213fb25b90668d2efa717c04
/day03/src/arrays/NumberArray.java
6fe33fb0298e41c1dc0c7a834620bcff4d367ae8
[]
no_license
sugu2100/javaworks
3c5ee1bb801b47f58d52b55f9ecedac8641dc63a
b805e344ac950a67e44aa7bc4f43e9513adb8cb5
refs/heads/master
2023-08-04T22:21:05.584360
2021-09-26T05:49:36
2021-09-26T05:49:36
400,675,599
0
0
null
null
null
null
UHC
Java
false
false
830
java
package arrays; public class NumberArray { public static void main(String[] args) { // 배열 선언 // 정수형 numbers 이름의 배열 공간(크기) 3개 생성 int[] numbers = new int[3]; int sum = 0; System.out.println("배열의 개수: " + numbers.length); //값을 접근 - 저장 //자료형의 초기값 - 객체(null), 정수(0), 문자("") numbers[0] = 10; numbers[1] = 20; numbers[2] = 30; //numbers[3] = 40; //출력(조회) System.out.println("numbers[0]=" + numbers[0]); System.out.println("numbers[1]=" + numbers[1]); System.out.println("numbers[2]=" + numbers[2]); //배열은 for문과 연동해서 출력 for(int i=0; i<numbers.length; i++) { //0, 1, 2 sum += numbers[i]; System.out.println(numbers[i]); } System.out.println("합계 : " + sum); } }
[ "sugu2100@daum.net" ]
sugu2100@daum.net
3f22c5ebbb03dd4fdd39b8710ddaf135672092ad
7e367d96cda31e0751f0c84d243c9f792b09166d
/src/main/java_paotui/com/xgh/paotui/controller/OrderController.java
fc3799b0013ccb617ed97793138848e8a730cf4a
[]
no_license
bithup/paotui
ac42e22dcb2dac4979f802af25a2382d75e297f7
c17c70364dea6cb8fe363edd45b7528558cd2f0c
refs/heads/master
2021-06-21T00:27:04.093140
2017-07-26T08:07:22
2017-07-26T08:07:22
98,391,700
0
0
null
null
null
null
UTF-8
Java
false
false
10,324
java
package com.xgh.paotui.controller; import com.xgh.mng.basic.BaseController; import com.xgh.paotui.entity.Order; import com.xgh.paotui.entity.OrderAction; import com.xgh.paotui.entity.OrderPositionPath; import com.xgh.paotui.services.IOrderActionService; import com.xgh.paotui.services.IOrderPositionPathService; import com.xgh.paotui.services.IOrderService; import com.xgh.util.ConstantUtil; import com.xgh.util.DictUtils; import com.xgh.util.StringUtil; import org.apache.log4j.Logger; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.propertyeditors.CustomDateEditor; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import java.text.SimpleDateFormat; import java.util.*; @Controller @Scope("prototype") @RequestMapping(value = "paotui/order/") public class OrderController extends BaseController { /** * @Fields serialVersionUID : */ private static final long serialVersionUID = 1L; private static Logger logger = Logger.getLogger(OrderController.class); @Autowired protected IOrderActionService orderActionService; @Autowired protected IOrderService orderService; @Autowired protected IOrderPositionPathService orderPositionPathService; @InitBinder public void initBinder(WebDataBinder binder) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); dateFormat.setLenient(false); binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); } @RequestMapping(value = "/init") public ModelAndView init() { logger.info("init"); return getModelAndView("paotui/order/init"); } @RequestMapping(value = "/getList") public void getList() { logger.info("getList"); outJson(orderService.getGridList(request)); } @RequestMapping(value = "/view") public ModelAndView view(@ModelAttribute Order order) { ModelAndView view = new ModelAndView(); Map<String, Object> map = orderService.getOrderInfo(order.getId()); //订单类型 String orderType=StringUtil.convertNullToEmpty(map.get("orderType")); map.put("orderType",DictUtils.getDictLabel(orderType,"paotui_order_type","")); //帮送:发货地;帮取:取货地;帮买:购买地 String addressA = StringUtil.convertNullToEmpty(map.get("locationAddressA")); addressA+=StringUtil.convertNullToEmpty(map.get("locationAddressNameA")); addressA+=StringUtil.convertNullToEmpty(map.get("detailAddressA")); map.put("addressA",addressA); //收货地 String addressB = StringUtil.convertNullToEmpty(map.get("locationAddressB")); addressB+=StringUtil.convertNullToEmpty(map.get("locationAddressNameB")); addressB+=StringUtil.convertNullToEmpty(map.get("detailAddressB")); map.put("addressB",addressB); //跑腿费 String fee="跑腿费"+StringUtil.convertNullToEmpty(map.get("originalFreight"))+"元"; String tips=StringUtil.convertNullToEmpty(map.get("tips")); if(StringUtil.isNotEmpty(tips)){ fee+="+小费"; fee+=tips; fee+="元"; } map.put("fee",fee); if("1".equals(orderType)||"2".equals(orderType)){ //发货时间 String bookingType=StringUtil.convertNullToEmpty(map.get("bookingType")); if("1".equals(bookingType)){ map.put("bookingTime","立即发货"); } else{ Date bookingTime= (Date)map.get("bookingTime"); map.put("bookingTime","预约到"+bookingTime+"送货"); } view.setViewName("paotui/order/view"); } else if("3".equals(orderType)){ //是否就近购买 String isNearBuy = StringUtil.convertNullToEmpty(map.get("isNearBuy")); if ("1".equals(isNearBuy)){ map.put("addressA","收货地附近购买"); }else { map.put("addressA",addressA); } //商品价格 Integer isKonwPrice=(Integer)map.get("isKonwPrice"); if(isKonwPrice!=null && isKonwPrice==1){ map.put("buyPrice",StringUtil.convertNullToEmpty(map.get("buyPrice"))+"元"); } else{ map.put("buyPrice","不知道价格"); } //购买时间 String bookingType=StringUtil.convertNullToEmpty(map.get("bookingType")); if("1".equals(bookingType)){ map.put("bookingTime","立即购买"); } else{ Date bookingTime= (Date)map.get("bookingTime"); map.put("bookingTime","预约到"+bookingTime+"购买"); } view.setViewName("paotui/order/buy_view"); } else if ("4".equals(orderType)){ //排队时间 String bookingType=StringUtil.convertNullToEmpty(map.get("bookingType")); if("1".equals(bookingType)){ map.put("bookingTime","立即排队"); } else{ Date bookingTime= (Date)map.get("bookingTime"); map.put("bookingTime","预约到"+bookingTime+"排队"); } //排队地点 String address = StringUtil.convertNullToEmpty(map.get("lineupLocationAddress")); address+=StringUtil.convertNullToEmpty(map.get("lineupLocationAddressName")); address+=StringUtil.convertNullToEmpty(map.get("lineupDetailAddress")); map.put("address",address); //总费用 String lineupFee="排队费"+StringUtil.convertNullToEmpty(map.get("lineupRealMoney"))+"元"; if(StringUtil.isNotEmpty(tips)){ lineupFee+="+小费"; lineupFee+=tips; lineupFee+="元"; } map.put("lineupFee",lineupFee); view.setViewName("paotui/order/lineup_view"); } view.addObject("orderMap", map); //状态轨迹图 Map<String, Object> paraMap =new HashMap<String, Object>(); paraMap.put("orderId",order.getId()); List<OrderAction> orderAction=orderActionService.getList(paraMap); List<Map<String, Object>> orderActionMaps= new ArrayList<Map<String, Object>>(); for(OrderAction orderAction_:orderAction){ Map orderActionMap = new HashMap(); Date actionTime= orderAction_.getActionTime(); orderActionMap.put("actionTime",actionTime); orderActionMap.put("actionName",orderAction_.getActionName()); //功能暂时按照一张开发 String actionImage=orderAction_.getActionImage(); if(StringUtil.isNotEmpty(actionImage)){ orderActionMap.put("actionImageRealUrl", ConstantUtil.SERVER_URL+actionImage); } else{ orderActionMap.put("actionImageRealUrl", ""); } orderActionMaps.add(orderActionMap); } view.addObject("orderActionMaps", orderActionMaps); return view; } @RequestMapping(value = "/viewMap") public ModelAndView viewMap(@ModelAttribute Order order) { ModelAndView view = new ModelAndView(); Map<String, Object> paraMap =new HashMap<String, Object>(); paraMap.put("orderId",order.getId()); List<OrderPositionPath> orderPositionPaths=orderPositionPathService.getList(paraMap); JSONArray ret= new JSONArray(); for(OrderPositionPath data:orderPositionPaths){ JSONObject json= new JSONObject(); json.put("longitude",data.getLongitude()); json.put("latitude",data.getLatitude()); ret.add(json); } view.addObject("orderPositionPaths", ret.toJSONString()); Map<String, Object> map = orderService.getOrderInfo(order.getId()); String orderType = StringUtil.convertNullToEmpty(map.get("orderType")); if ("4".equals(orderType)){ String longitude = StringUtil.convertNullToEmpty(map.get("lineupLongitude")); String latitude = StringUtil.convertNullToEmpty(map.get("lineupLatitude")); map.put("longitudeA",longitude); map.put("latitudeA",latitude); } //开通城市 view.addObject("orderCityName", String.valueOf(map.get("orderCityName"))); view.addObject("orderMap", map); view.setViewName("paotui/order/viewMap"); return view; } @RequestMapping(value = "/save") public void save(@ModelAttribute Order order) { logger.info("save"); Map<String, Object> resultMap = new HashMap<String, Object>(); if (order != null) { int flg = orderService.save(request, order); if (flg == 1) { resultMap = getResultMap("1", "取消订单成功!"); } else{ resultMap = getResultMap("1", "取消订单失败!"); } } else{ resultMap = getResultMap("0", "数据初始化失败!"); } outJson(resultMap); } @RequestMapping(value = "/delete") public void delete(@ModelAttribute Order order) { logger.info("delete"); Map<String, Object> resultMap = new HashMap<String, Object>(); Order order2 = orderService.get(order.getId()); order2.setStatus(2); int flg = orderService.update(order2); if (flg == 1) { resultMap = getResultMap("1", "删除成功!"); } else resultMap = getResultMap("0", "删除失败!"); outJson(resultMap); } }
[ "bithup@foxmail.com" ]
bithup@foxmail.com
e97e9767af60fb40cf40253697da347a454ed77a
16479704b15e3e3c3b4458cd5143207a845a73d3
/src/Exception/InvalidName.java
20f7a75e4ba494a653fb2d3886e66110f87e5830
[]
no_license
lethuydung0109/AirlineManagementSystem
4f0b9737e27e59c10c00709cb4e1f66ba090b51d
cc7aa711c68487c11fe967a68b5cc042347f17b1
refs/heads/master
2020-07-22T14:18:49.036790
2019-10-09T23:28:48
2019-10-09T23:28:48
207,231,305
0
0
null
null
null
null
UTF-8
Java
false
false
116
java
package Exception; public class InvalidName extends Exception { public InvalidName(){ super(); } }
[ "lethuydung0109@gmail.com" ]
lethuydung0109@gmail.com
02c557a26a8cc69302318c4e3dac0c9845ade621
295a5f07b5cd1c639e1b6ec9f20702bdd9401332
/app/src/main/java/org/eclipse/californium/core/network/config/NetworkConfig.java
0ad3a26eb6c875b2482c57f64633b7f99a7ff90d
[]
no_license
AccretionD/QROrders_android
3df311f4ed1dfe88794fd57a71a821b548ff298a
80c995d56ef038418211ac5bdb5cdb3fe49268d0
refs/heads/master
2021-01-02T09:27:49.717568
2015-07-01T20:49:24
2015-07-01T20:49:24
38,275,655
0
0
null
null
null
null
UTF-8
Java
false
false
15,136
java
/******************************************************************************* * Copyright (c) 2014 Institute for Pervasive Computing, ETH Zurich and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Eclipse Distribution License v1.0 which accompany this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * and the Eclipse Distribution License is available at * http://www.eclipse.org/org/documents/edl-v10.html. * * Contributors: * Matthias Kovatsch - creator and main architect * Martin Lanter - architect and re-implementation * Dominique Im Obersteg - parsers and initial implementation * Daniel Pauli - parsers and initial implementation * Kai Hudalla - logging ******************************************************************************/ package org.eclipse.californium.core.network.config; import java.io.File; import java.io.FileInputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.util.LinkedList; import java.util.List; import java.util.Properties; import java.util.logging.Level; import java.util.logging.Logger; /** * The configuration for a Californium server, endpoint and/or connector. */ public class NetworkConfig { /** The logger. */ private static final Logger LOGGER = Logger.getLogger(NetworkConfig.class.getCanonicalName()); /** The default name for the configuration. */ public static final String DEFAULT = "Californium.properties"; /** The default header for a configuration file. */ public static final String DEFAULT_HEADER = "Californium CoAP Properties file"; /** The standard configuration that is used if none is defined. */ private static NetworkConfig standard; /** The properties. */ private Properties properties; /** The list of config observers. */ private List<NetworkConfigObserver> observers = new LinkedList<NetworkConfigObserver>(); /** * Network configuration key names */ public class Keys { public static final String COAP_PORT = "COAP_PORT"; public static final String COAP_SECURE_PORT = "COAP_SECURE_PORT"; public static final String ACK_TIMEOUT = "ACK_TIMEOUT"; public static final String ACK_RANDOM_FACTOR = "ACK_RANDOM_FACTOR"; public static final String ACK_TIMEOUT_SCALE = "ACK_TIMEOUT_SCALE"; public static final String MAX_RETRANSMIT = "MAX_RETRANSMIT"; public static final String EXCHANGE_LIFETIME = "EXCHANGE_LIFETIME"; public static final String NON_LIFETIME = "NON_LIFETIME"; public static final String MAX_TRANSMIT_WAIT = "MAX_TRANSMIT_WAIT"; public static final String NSTART = "NSTART"; public static final String LEISURE = "LEISURE"; public static final String PROBING_RATE = "PROBING_RATE"; public static final String USE_RANDOM_MID_START = "USE_RANDOM_MID_START"; public static final String USE_RANDOM_TOKEN_START = "USE_RANDOM_TOKEN_START"; public static final String PREFERRED_BLOCK_SIZE = "PREFERRED_BLOCK_SIZE"; public static final String MAX_MESSAGE_SIZE = "MAX_MESSAGE_SIZE"; public static final String NOTIFICATION_CHECK_INTERVAL_TIME = "NOTIFICATION_CHECK_INTERVAL"; public static final String NOTIFICATION_CHECK_INTERVAL_COUNT = "NOTIFICATION_CHECK_INTERVAL_COUNT"; public static final String NOTIFICATION_REREGISTRATION_BACKOFF = "NOTIFICATION_REREGISTRATION_BACKOFF"; public static final String USE_CONGESTION_CONTROL = "USE_CONGESTION_CONTROL"; public static final String CONGESTION_CONTROL_ALGORITHM = "CONGESTION_CONTROL_ALGORITHM"; public static final String PROTOCOL_STAGE_THREAD_COUNT = "PROTOCOL_STAGE_THREAD_COUNT"; public static final String NETWORK_STAGE_RECEIVER_THREAD_COUNT = "NETWORK_STAGE_RECEIVER_THREAD_COUNT"; public static final String NETWORK_STAGE_SENDER_THREAD_COUNT = "NETWORK_STAGE_SENDER_THREAD_COUNT"; public static final String UDP_CONNECTOR_DATAGRAM_SIZE = "UDP_CONNECTOR_DATAGRAM_SIZE"; public static final String UDP_CONNECTOR_RECEIVE_BUFFER = "UDP_CONNECTOR_RECEIVE_BUFFER"; public static final String UDP_CONNECTOR_SEND_BUFFER = "UDP_CONNECTOR_SEND_BUFFER"; public static final String UDP_CONNECTOR_OUT_CAPACITY = "UDP_CONNECTOR_OUT_CAPACITY"; public static final String DEDUPLICATOR = "DEDUPLICATOR"; public static final String DEDUPLICATOR_MARK_AND_SWEEP = "DEDUPLICATOR_MARK_AND_SWEEP"; public static final String MARK_AND_SWEEP_INTERVAL = "MARK_AND_SWEEP_INTERVAL"; public static final String DEDUPLICATOR_CROP_ROTATION = "DEDUPLICATOR_CROP_ROTATION"; public static final String CROP_ROTATION_PERIOD = "CROP_ROTATION_PERIOD"; public static final String NO_DEDUPLICATOR = "NO_DEDUPLICATOR"; public static final String HTTP_PORT = "HTTP_PORT"; public static final String HTTP_SERVER_SOCKET_TIMEOUT = "HTTP_SERVER_SOCKET_TIMEOUT"; public static final String HTTP_SERVER_SOCKET_BUFFER_SIZE = "HTTP_SERVER_SOCKET_BUFFER_SIZE"; public static final String HTTP_CACHE_RESPONSE_MAX_AGE = "HTTP_CACHE_RESPONSE_MAX_AGE"; public static final String HTTP_CACHE_SIZE = "HTTP_CACHE_SIZE"; public static final String HEALTH_STATUS_PRINT_LEVEL = "HEALTH_STATUS_PRINT_LEVEL"; public static final String HEALTH_STATUS_INTERVAL = "HEALTH_STATUS_INTERVAL"; } /** * Gives access to the standard network configuration. When a new endpoint * or server is created without a specific network configuration, it will * use this standard configuration. * * @return the standard configuration */ public static NetworkConfig getStandard(String path) { if (standard == null) { synchronized (NetworkConfig.class) { if (standard == null) createStandardWithFile(new File(path+DEFAULT)); } } return standard; } /** * Gives access to the standard network configuration. When a new endpoint * or server is created without a specific network configuration, it will * use this standard configuration. * * @return the standard configuration */ public static NetworkConfig getStandard() { if (standard == null) { synchronized (NetworkConfig.class) { if (standard == null) createStandardWithFile(new File(DEFAULT)); } } return standard; } /** * Sets the standard configuration. * * @param standard the new standard */ public static void setStandard(NetworkConfig standard) { NetworkConfig.standard = standard; } /** * Creates the standard without reading it or writing it to a file. * * @return the configuration */ public static NetworkConfig createStandardWithoutFile() { LOGGER.info("Creating standard network configuration properties without a file"); return standard = new NetworkConfig(); } /** * Creates the standard with a file. If the file with the name * {@link #DEFAULT} exists, the configuration reads the properties from this * file. Otherwise it creates the file. * * @param file the configuration file * @return the network configuration */ public static NetworkConfig createStandardWithFile(File file) { standard = new NetworkConfig(); if (file.exists()) { LOGGER.info("Loading standard properties from file "+file); try { standard.load(file); } catch (IOException e) { LOGGER.log(Level.WARNING, "Error while loading properties from "+file.getAbsolutePath(), e); } } else { LOGGER.info("Storing standard properties in file "+file); try { standard.store(file); } catch (IOException e) { LOGGER.log(Level.WARNING, "Error while storing properties to "+file.getAbsolutePath(), e); } } return standard; } /** * Instantiates a new network configiguration and sets the default values * defined in {@link NetworkConfigDefaults}. */ public NetworkConfig() { this.properties = new Properties(); NetworkConfigDefaults.setDefaults(this); } /** * Load the properties from the specified configuration file. * * @param file the file * @throws java.io.IOException Signals that an I/O exception has occurred. */ public void load(File file) throws IOException { InputStream inStream = new FileInputStream(file); properties.load(inStream); } /** * Store the configuration in the specified file. * * @param file the file * @throws java.io.IOException Signals that an I/O exception has occurred. */ public void store(File file) throws IOException { store(file, DEFAULT_HEADER); } /** * Store the configuration in the specified file with the specified header. * * @param file the file * @param header the header * @throws java.io.IOException Signals that an I/O exception has occurred. */ public void store(File file, String header) throws IOException { if (file == null) throw new NullPointerException(); properties.store(new FileWriter(file), header); } /** * Gets the value for the specified key as String or null if not found. * * @param key the key * @return the string */ public String getString(String key) { return properties.getProperty(key); } /** * Gets the value for the specified key as int or 0 if not found. * * @param key the key * @return the int */ public int getInt(String key) { String value = properties.getProperty(key); if (value != null) { try { return Integer.parseInt(value); } catch (NumberFormatException e) { LOGGER.log(Level.WARNING, "Could not convert property \"" + key + "\" with value \"" + value + "\" to integer", e); } } else { LOGGER.warning("Property \"" + key + "\" is undefined"); } return 0; } /** * Gets the value for the specified key as long or 0 if not found. * * @param key the key * @return the long */ public long getLong(String key) { String value = properties.getProperty(key); if (value != null) { try { return Long.parseLong(value); } catch (NumberFormatException e) { LOGGER.log(Level.WARNING, "Could not convert property \"" + key + "\" with value \"" + value + "\" to long", e); return 0; } } else { LOGGER.warning("Property \"" + key + "\" is undefined"); } return 0; } /** * Gets the value for the specified key as float or 0.0 if not found. * * @param key the key * @return the float */ public float getFloat(String key) { String value = properties.getProperty(key); if (value != null) { try { return Float.parseFloat(value); } catch (NumberFormatException e) { LOGGER.log(Level.WARNING, "Could not convert property \"" + key + "\" with value \"" + value + "\" to float", e); return 0; } } else { LOGGER.warning("Property \"" + key + "\" is undefined"); } return 0; } /** * Gets the value for the specified key as double or 0.0 if not found. * * @param key the key * @return the double */ public double getDouble(String key) { String value = properties.getProperty(key); if (value != null) { try { return Double.parseDouble(value); } catch (NumberFormatException e) { LOGGER.log(Level.WARNING, "Could not convert property \"" + key + "\" with value \"" + value + "\" to double", e); return 0; } } else { LOGGER.warning("Property \"" + key + "\" is undefined"); } return 0; } /** * Gets the value for the specified key as boolean or false if not found. * * @param key the key * @return the boolean */ public boolean getBoolean(String key) { String value = properties.getProperty(key); if (value != null) { try { return Boolean.parseBoolean(value); } catch (NumberFormatException e) { LOGGER.log(Level.WARNING, "Could not convert property \"" + key + "\" with value \"" + value + "\" to boolean", e); return false; } } else { LOGGER.warning("Property \"" + key + "\" is undefined"); } return false; } /** * Associates the specified value with the specified key. * * @param key the key * @param value the value * @return the network configuration */ public NetworkConfig set(String key, Object value) { properties.put(key, String.valueOf(value)); for (NetworkConfigObserver obs:observers) obs.changed(key, value); return this; } /** * Associates the specified value with the specified key. * * @param key the key * @param value the value * @return the network configuration */ public NetworkConfig setString(String key, String value) { properties.put(key, String.valueOf(value)); for (NetworkConfigObserver obs:observers) obs.changed(key, value); return this; } /** * Associates the specified value with the specified key. * * @param key the key * @param value the value * @return the network configuration */ public NetworkConfig setInt(String key, int value) { properties.put(key, String.valueOf(value)); for (NetworkConfigObserver obs:observers) obs.changed(key, value); return this; } /** * Associates the specified value with the specified key. * * @param key the key * @param value the value * @return the network configuration */ public NetworkConfig setLong(String key, long value) { properties.put(key, String.valueOf(value)); for (NetworkConfigObserver obs:observers) obs.changed(key, value); return this; } /** * Associates the specified value with the specified key. * * @param key the key * @param value the value * @return the network configuration */ public NetworkConfig setFloat(String key, float value) { properties.put(key, String.valueOf(value)); for (NetworkConfigObserver obs:observers) obs.changed(key, value); return this; } /** * Associates the specified value with the specified key. * * @param key the key * @param value the value * @return the network configuration */ public NetworkConfig setDouble(String key, double value) { properties.put(key, String.valueOf(value)); for (NetworkConfigObserver obs:observers) obs.changed(key, value); return this; } /** * Associates the specified value with the specified key. * * @param key the key * @param value the value * @return the network configuration */ public NetworkConfig setBoolean(String key, boolean value) { properties.put(key, String.valueOf(value)); for (NetworkConfigObserver obs:observers) obs.changed(key, value); return this; } public NetworkConfig addConfigObserver(NetworkConfigObserver observer) { observers.add(observer); return this; } public NetworkConfig removeConfigObserver(NetworkConfigObserver observer) { observers.remove(observer); return this; } }
[ "cmsvalenzuela@gmail.com" ]
cmsvalenzuela@gmail.com
e318467cc8d3ce0e155ddcbff21c02c2b5928156
a24b7ca7936a79e72ad9506a83b6cc11e8dffea7
/src/main/java/com/test/netty/protocol/websocker/server/WebSocketServerHandler.java
515c19a05477d1d5b7c4a9ffdf34879ef383abbb
[]
no_license
xyq043170/architect-study
e211798172af09e383fcd32f143eafe3e2701a31
f6498dbe8e2e734cc27716c007b7f3ccd357bc42
refs/heads/master
2023-08-04T08:49:30.487249
2019-09-02T08:29:47
2019-09-02T08:29:47
205,811,367
0
0
null
2023-07-22T15:06:20
2019-09-02T08:28:50
Java
UTF-8
Java
false
false
5,316
java
/* * Copyright 2013-2018 Lilinfeng. * * 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.test.netty.protocol.websocker.server; import static io.netty.handler.codec.http.HttpHeaders.isKeepAlive; import static io.netty.handler.codec.http.HttpHeaders.setContentLength; import static io.netty.handler.codec.http.HttpResponseStatus.BAD_REQUEST; import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler; import io.netty.handler.codec.http.DefaultFullHttpResponse; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.FullHttpResponse; import io.netty.handler.codec.http.websocketx.CloseWebSocketFrame; import io.netty.handler.codec.http.websocketx.PingWebSocketFrame; import io.netty.handler.codec.http.websocketx.PongWebSocketFrame; import io.netty.handler.codec.http.websocketx.TextWebSocketFrame; import io.netty.handler.codec.http.websocketx.WebSocketFrame; import io.netty.handler.codec.http.websocketx.WebSocketServerHandshaker; import io.netty.handler.codec.http.websocketx.WebSocketServerHandshakerFactory; import io.netty.util.CharsetUtil; import java.util.logging.Level; import java.util.logging.Logger; /** * @author lilinfeng * @date 2014年2月14日 * @version 1.0 */ public class WebSocketServerHandler extends SimpleChannelInboundHandler<Object> { private static final Logger logger = Logger .getLogger(WebSocketServerHandler.class.getName()); private WebSocketServerHandshaker handshaker; @Override public void messageReceived(ChannelHandlerContext ctx, Object msg) throws Exception { // 传统的HTTP接入 if (msg instanceof FullHttpRequest) { handleHttpRequest(ctx, (FullHttpRequest) msg); } // WebSocket接入 else if (msg instanceof WebSocketFrame) { handleWebSocketFrame(ctx, (WebSocketFrame) msg); } } @Override public void channelReadComplete(ChannelHandlerContext ctx) throws Exception { ctx.flush(); } private void handleHttpRequest(ChannelHandlerContext ctx, FullHttpRequest req) throws Exception { // 如果HTTP解码失败,返回HHTP异常 if (!req.getDecoderResult().isSuccess() || (!"websocket".equals(req.headers().get("Upgrade")))) { sendHttpResponse(ctx, req, new DefaultFullHttpResponse(HTTP_1_1, BAD_REQUEST)); return; } // 构造握手响应返回,本机测试 WebSocketServerHandshakerFactory wsFactory = new WebSocketServerHandshakerFactory( "ws://localhost:8080/websocket", null, false); handshaker = wsFactory.newHandshaker(req); if (handshaker == null) { WebSocketServerHandshakerFactory .sendUnsupportedWebSocketVersionResponse(ctx.channel()); } else { handshaker.handshake(ctx.channel(), req); } } private void handleWebSocketFrame(ChannelHandlerContext ctx, WebSocketFrame frame) { // 判断是否是关闭链路的指令 if (frame instanceof CloseWebSocketFrame) { handshaker.close(ctx.channel(), (CloseWebSocketFrame) frame.retain()); return; } // 判断是否是Ping消息 if (frame instanceof PingWebSocketFrame) { ctx.channel().write( new PongWebSocketFrame(frame.content().retain())); return; } // 本例程仅支持文本消息,不支持二进制消息 if (!(frame instanceof TextWebSocketFrame)) { throw new UnsupportedOperationException(String.format( "%s frame types not supported", frame.getClass().getName())); } // 返回应答消息 String request = ((TextWebSocketFrame) frame).text(); if (logger.isLoggable(Level.FINE)) { logger.fine(String.format("%s received %s", ctx.channel(), request)); } ctx.channel().write( new TextWebSocketFrame(request + " , 欢迎使用Netty WebSocket服务,现在时刻:" + new java.util.Date().toString())); } private static void sendHttpResponse(ChannelHandlerContext ctx, FullHttpRequest req, FullHttpResponse res) { // 返回应答给客户端 if (res.getStatus().code() != 200) { ByteBuf buf = Unpooled.copiedBuffer(res.getStatus().toString(), CharsetUtil.UTF_8); res.content().writeBytes(buf); buf.release(); setContentLength(res, res.content().readableBytes()); } // 如果是非Keep-Alive,关闭连接 ChannelFuture f = ctx.channel().writeAndFlush(res); if (!isKeepAlive(req) || res.getStatus().code() != 200) { f.addListener(ChannelFutureListener.CLOSE); } } @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { cause.printStackTrace(); ctx.close(); } }
[ "905501891@qq.com" ]
905501891@qq.com
8cc86b8e155601adfdbaab5cdf8258837f7d3022
ba19b0ad68a7ee502d7ff185d5694e3691267576
/SeleniumDemos2/src/test/java/seleniumdemos1/excelReader.java
f9869be22a619a2a589fa737db835cd77fec417c
[]
no_license
sidharthasiddu96/selenium
b7a28fc3ad63a30e71e5cc5c4e1ee7b18ff2d1c8
73adcbb924f36b49ab32e5c695479e940f918ade
refs/heads/master
2021-06-25T07:43:05.734455
2019-11-22T04:06:07
2019-11-22T04:06:07
223,321,097
0
0
null
2021-04-26T19:43:04
2019-11-22T04:06:53
HTML
UTF-8
Java
false
false
911
java
package seleniumdemos1; import java.io.FileInputStream; import java.io.IOException; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class excelReader { public static Object[][] readData() throws IOException { FileInputStream fis=new FileInputStream("C:\\Users\\Training_b6b.01.03\\Desktop\\Book1.xlsx"); XSSFWorkbook wb = new XSSFWorkbook(fis); XSSFSheet sheet1=wb.getSheetAt(0); int rowCount = sheet1.getPhysicalNumberOfRows(); XSSFRow row1 =sheet1.getRow(0); int cellCount = row1.getPhysicalNumberOfCells(); Object exceldata[][]=new Object[rowCount][cellCount]; for(int i=0;i<rowCount;i++) { for(int j=0;j<cellCount;j++) { exceldata[i][j]=sheet1.getRow(i).getCell(j).getStringCellValue(); } } return exceldata; } }
[ "Training_b6b.01.03@BDC6-DX-6GN5NK2.dir.svc.accenture.com" ]
Training_b6b.01.03@BDC6-DX-6GN5NK2.dir.svc.accenture.com
b6c421b816ba2c1fd5aa7e41c045514ae65a298d
97a4088efa392db34726e387c8e8c68b6f412aba
/src/main/java/com/advalent/automation/api/annotations/inputfield/validation/Validation.java
2b53be933bcf88b3c63adac8cfaa744df2bfda9e
[]
no_license
maureenmusuku/automation
336d0aa4d2a5cd5b87c29417dfd53f79228f8b01
6ecb060437d5c9b9d09f9827cf442e6d6ab53df1
refs/heads/master
2021-12-15T02:54:02.154084
2019-06-20T15:15:24
2019-06-20T15:15:24
192,788,673
0
0
null
2021-12-14T21:24:20
2019-06-19T19:01:01
Java
UTF-8
Java
false
false
221
java
package com.advalent.automation.api.annotations.inputfield.validation; public @interface Validation { String inputFormatMessageXpath(); String inputLengthMessageXpath(); String requiredFieldMessageXpath(); }
[ "maureenasmitha@gmail.com" ]
maureenasmitha@gmail.com
79afe9636947c08330b5d0f5a4d3829563ee4ff1
5db945c9d1a32fb17ed57e4fc90c3fa02075710f
/skaetl-backend/src/main/java/io/skalogs/skaetl/web/domain/ProcessFilterWeb.java
2624a15c66b3fc8106bfd5507c157858568f8336
[ "Apache-2.0" ]
permissive
benhe119/SkaETL
7d379883acf05edd77d021b1f81350bc25aa2d42
38514a830a50c8597859f19b1e992c738bca2e67
refs/heads/master
2020-06-26T14:35:14.552952
2018-12-20T08:20:30
2018-12-20T08:20:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
931
java
package io.skalogs.skaetl.web.domain; /*- * #%L * skaetl-backend * %% * Copyright (C) 2017 - 2018 SkaLogs * %% * 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. * #L% */ import io.skalogs.skaetl.domain.ProcessFilter; import lombok.*; @Builder @Getter @Setter @AllArgsConstructor @NoArgsConstructor @ToString public class ProcessFilterWeb { private String idProcess; private ProcessFilter processFilter; }
[ "jeanlouis.boudart@gmail.com" ]
jeanlouis.boudart@gmail.com
d71e969e057cf9546c0710b131325357186c1147
3928b986e2ca00bdaf45357524c0ffe5485d36c8
/chapter01/example_1_03/src/main/java/org/gradle/example/simple/HelloWorld.java
b6be33f41fb26d29488a1b4198acf845947c6e09
[]
no_license
xiaoooyu/build-and-test-with-gradle-examples
d4a008b6f6017b048041083ac5c247fe203b553e
bb4b3f0d2860f978937310f75ee024c03d4203c6
refs/heads/master
2020-03-11T12:30:44.296810
2018-04-20T06:05:43
2018-04-20T06:07:53
129,999,474
0
0
null
null
null
null
UTF-8
Java
false
false
145
java
package org.gradle.example.simple; public class HelloWorld { public static void main(String args[]) { System.out.println("hello world"); } }
[ "xiaoyu@teambition.com" ]
xiaoyu@teambition.com
6d63c1d42a172150510716ca6913d8868199e1b3
1be6055fb5b4de7df5c43902106db564c7bae23d
/clientes/src/test/java/br/com/fiap/clientes/service/ClienteServiceIntegrationTest.java
7dcea7a0f31e2ddeadc89b10c0b2bace47725e03
[]
no_license
edmilson1968/fiap-netflix
db005c2299f71300e9d3b5299bccf095d660e368
3c6472569ad372b2b8c245de458cbed5b7cf5255
refs/heads/master
2020-08-07T16:36:38.310049
2019-10-26T01:12:33
2019-10-26T01:12:33
213,526,817
0
1
null
2023-09-08T12:21:15
2019-10-08T02:02:18
Java
UTF-8
Java
false
false
3,051
java
package br.com.fiap.clientes.service; import br.com.fiap.clientes.TestUtil; import br.com.fiap.clientes.model.Cliente; import br.com.fiap.clientes.repository.ClienteRepository; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageRequest; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import javax.sql.DataSource; import java.sql.SQLException; import java.util.Arrays; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; @RunWith(SpringRunner.class) @SpringBootTest @ActiveProfiles("test") public class ClienteServiceIntegrationTest { @Autowired private DataSource dataSource; @Autowired private ClienteRepository repo; @Autowired private ClienteService clienteService; private Page<Cliente> page = null; List<Cliente> clientes = null; Cliente cli1, cli2; @Before public void setUp() throws Exception { cli1 = new Cliente(null, "cliente1", "1234567890", 25); cli2 = new Cliente(null, "cliente2", "0987654321", 32); clientes = Arrays.asList(cli1, cli2); repo.saveAll(clientes); System.out.println(">>>>> Ids cadastrados:" + cli1.getId() + " " + cli2.getId()); } @After public void clear() throws SQLException { repo.deleteAll(); TestUtil.cleanupDatabase(dataSource); } @Test public void shoudRetrieveAllClientes() { page = new PageImpl<Cliente>(clientes); final Page<Cliente> all = clienteService.findAll(PageRequest.of(0, 10)); assertThat(all.getContent()).isEqualTo(clientes); } @Test public void shoudRetrieveClienteById() { final Cliente find = clienteService.findById(2L); assertThat(clientes).contains(find); assertThat(find).isEqualTo(cli2); } @Test public void shouldThrowClienteNotFoundForClienteWithoutValidId() { assertThatThrownBy(() -> clienteService.findById(3L)) .isInstanceOf(ClienteNotFoundException.class) .hasMessage("id: 3"); } @Test public void shouldThrowClienteNotFoundExceptionForClienteByIdNull() { assertThatThrownBy(() -> clienteService.findById(null)) .isInstanceOf(ClienteNotFoundException.class) .hasMessage("id invalido"); } @Test public void shouldAddAValidCliente() { Cliente cli1 = new Cliente(null, "cliente1", "1234567890", 25); Cliente res = clienteService.addCliente(cli1); assertThat(res).hasNoNullFieldsOrProperties(); assertThat(res.getId()).isEqualTo(cli1.getId()); } }
[ "edmilson.figueiredo@gmail.com" ]
edmilson.figueiredo@gmail.com
13a6d1e676ee990a35f766b4f58bc33ff1c462a2
29445b5c51e9995a8651dac3afd7d98eb9e0a2d5
/src/me/cryocell/cryopersistence/config/backup/BackupConfigService.java
d79e1db6440495fead678becfa9c412e10c3ce9f
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
pitoniak32/CryoPersistence
36510f6dfab48d019e22a221be15e79b72a3f6f8
22e72fcbf1b54d1116f185ef7b5c948feeab3e9b
refs/heads/main
2023-08-11T19:22:20.115228
2021-10-08T23:05:45
2021-10-08T23:05:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,130
java
package me.cryocell.cryopersistence.config.backup; import me.cryocell.cryopersistence.config.Constants; import org.bukkit.configuration.file.YamlConfiguration; import java.io.File; public class BackupConfigService { private YamlConfiguration config; private File dataFolder; public BackupConfigService(YamlConfiguration config, File dataFolder) { this.config = config; this.dataFolder = dataFolder; this.dataFolder = new File(this.dataFolder + File.separator + "backups"); this.setDefaults(); } public int getMaxBackupWorldsCount() { return this.config.getInt(Constants.BACKUP_MAX_COUNT_PATH); } public int getAutoBackupIntervalTicks() { return this.config.getInt(Constants.AUTO_BACKUP_INTERVAL_TICKS_PATH); } private void setDefaults() { // Settings Defaults. this.config.addDefault(Constants.AUTO_BACKUP_INTERVAL_TICKS_PATH, Constants.AUTO_BACKUP_INTERVAL_TICKS_DEFAULT); this.config.addDefault(Constants.BACKUP_MAX_COUNT_PATH, Constants.BACKUP_MAX_COUNT_DEFAULT); this.config.options().copyDefaults(true); } }
[ "unconfigured@null.spigotmc.org" ]
unconfigured@null.spigotmc.org
01e95e0a6cefd18fa60a076942a7b300c8b353f5
6ac1f64c7ad8c2cf9935f90ac9dc3d941d5764f8
/app/src/main/java/com/cinderellavip/adapter/recycleview/XiaohuiRecommentAdapter.java
433c3baca982d8e2b40c25690e2c83dc86cc3640
[]
no_license
sengeiou/cinderell
e8595b1c3b3afa0735017c556e575f7a2a00298c
095b9a07ba2f472af5c0665db35bd4d57ff36402
refs/heads/master
2023-03-13T10:29:45.266563
2021-03-02T01:06:21
2021-03-02T01:06:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,011
java
package com.cinderellavip.adapter.recycleview; import android.widget.ImageView; import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.module.LoadMoreModule; import com.chad.library.adapter.base.viewholder.BaseViewHolder; import com.cinderellavip.R; import com.cinderellavip.bean.net.mine.MineInviteItem; import com.cinderellavip.global.ImageUtil; public class XiaohuiRecommentAdapter extends BaseQuickAdapter<MineInviteItem, BaseViewHolder> implements LoadMoreModule { public XiaohuiRecommentAdapter() { super(R.layout.item_xiaohui_recomment, null); } @Override protected void convert(final BaseViewHolder helper, final MineInviteItem item) { int position = helper.getAdapterPosition(); ImageView iv_image = helper.getView(R.id.iv_image); ImageUtil.loadNet(getContext(),iv_image,item.avatar); helper.setText(R.id.tv_title,item.username) .setText(R.id.tv_money,"+"+item.integral); } }
[ "835683840@qq.com" ]
835683840@qq.com
c43d4958496262bbf2d3db164e5d55df6eb5eb57
5280a20c5e56703275f21479c530db5dfe50f59a
/api/src/main/java/org/openmrs/module/drishti/FHIRRESTfulGenericClient.java
33334c76ac31265c77b1e20547ca1bee596b2d0b
[]
no_license
dermatologist/openmrs-module-drishti
c2571c147aab76b8f090b43fa4f5d063641cb240
31f1280d550c63905e564103652c1372c899bd0a
refs/heads/feature/work
2020-04-09T04:11:47.786360
2020-01-11T18:43:10
2020-01-11T18:43:10
160,013,692
2
0
null
2020-01-11T18:41:37
2018-12-02T04:34:32
JavaScript
UTF-8
Java
false
false
1,751
java
package org.openmrs.module.drishti; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.client.api.IGenericClient; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.hl7.fhir.dstu3.model.Bundle; import org.hl7.fhir.dstu3.model.CarePlan; import org.hl7.fhir.dstu3.model.Patient; import org.hl7.fhir.dstu3.model.Reference; import org.openmrs.User; import org.openmrs.api.UserService; import org.openmrs.api.context.Context; import java.util.List; public class FHIRRESTfulGenericClient { private Log log = LogFactory.getLog(this.getClass()); private static final FhirContext ctx = FhirContext.forDstu3(); public Bundle getBundleClient(org.openmrs.Patient patient) { IGenericClient client = ctx.newRestfulGenericClient(DrishtiConstants.FHIR_BASE); UserService userService = Context.getUserService(); List<User> users = userService.getUsersByName(patient.getGivenName(), patient.getFamilyName(), false); String uuid = users.get(0).getUuid(); log.warn("Getting Bundles for User UUID: " + uuid); Bundle bundle = client.search().forResource(Bundle.class) .where(Bundle.IDENTIFIER.exactly().systemAndIdentifier(DrishtiConstants.URN_SYSTEM, uuid)) //.where(Observation.SUBJECT.hasId(patient.getId())) .returnBundle(org.hl7.fhir.dstu3.model.Bundle.class).execute(); return bundle; } public Boolean saveCareplanClient(CarePlan carePlan, Patient patient) { IGenericClient client = ctx.newRestfulGenericClient(DrishtiConstants.FHIR_BASE); carePlan.setSubject(new Reference(patient)); MethodOutcome outcome = client.create().resource(carePlan).prettyPrint().encodedJson().execute(); return outcome.getCreated(); } }
[ "github@gulfdoctor.net" ]
github@gulfdoctor.net
568f6bc4911b144a2e8264c2ffc5fc739976d5f6
b693327312dd1b6887d02255cffcf9168e9e43c9
/test3.java
796827d01f2b672bb2c883a80138bdd8b7adeee2
[]
no_license
MRTHAKER/java
0d0660fe44505b11bd5a8e5268029af16bf0beea
6a5d3ddc6600e637a8f1fbc6b53af2eb00329002
refs/heads/master
2022-03-11T10:27:05.956061
2019-11-25T10:19:51
2019-11-25T10:19:51
113,358,485
0
0
null
null
null
null
UTF-8
Java
false
false
320
java
public class test3{ public int x=20; class Inner{ public int x=1; void m(int x){ System.out.println("X= "+x);//10 System.out.println("this.X= "+this.x);//1 System.out.println("X= "+test3.this.x);//20 } } public static void main(String[] args) { test3 t=new test3(); test3.Inner i =t.new Inner(); i.m(10); } }
[ "mahek.haker@gmail.com" ]
mahek.haker@gmail.com
443f1cfeeb604e39ca963d0b19abb9607acd8fcc
7fd110dc5ec11138242403d5bdc6b13ac3f0c5d9
/Dubai Properties/app/src/main/java/com/residents/dubaiassetmanagement/notifications_dashboard/DashboardNotification.java
e54962328727fc2ca16fe72e857ed08a91ad25fb
[]
no_license
shashankkumarofficial/ContractRenewal
405d75ddd5513924f36fc7c80e6fb00b460a8302
62c0438574e51d431598389a50835bc5f9cd299d
refs/heads/master
2021-10-18T21:22:30.495763
2019-02-14T12:40:15
2019-02-14T12:40:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,292
java
package com.residents.dubaiassetmanagement.notifications_dashboard; import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.os.Build; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutCompat; import android.text.Html; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; import com.residents.dubaiassetmanagement.Model.TenantDetails; import com.residents.dubaiassetmanagement.R; import com.residents.dubaiassetmanagement.SavePreferences.IpreferenceKey; import com.residents.dubaiassetmanagement.SavePreferences.SavePreference; import com.residents.dubaiassetmanagement.ServiceRequest.view_request.FeedbackFragment; import com.residents.dubaiassetmanagement.Utils.RequestService; import com.residents.dubaiassetmanagement.interfaces.ResponseCallback; import com.residents.dubaiassetmanagement.notification_list.NotificationList; import com.residents.dubaiassetmanagement.notifications_dashboard.models.Notification; import com.residents.dubaiassetmanagement.notifications_dashboard.models.NotificationData; import com.residents.dubaiassetmanagement.notifications_dashboard.models.NotificationsDashboard; import com.google.gson.Gson; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.List; public class DashboardNotification extends AppCompatActivity implements ResponseCallback,ViewPager.OnPageChangeListener { private LinearLayout indicator; private int mDotCount; private LinearLayout[] mDots; private ViewPager viewPager; private List<String> listItem = new ArrayList<>(); private NotificationAdapter notificationAdapter; SavePreference mSavePreference; TextView tv_no_noti; int i; JSONObject jsonObject = null; String title,description; ArrayList<NotificationData> notificationDataList; private Button btn_skip; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Checking for first time launch - before calling setContentView() // Making notification bar transparent if (Build.VERSION.SDK_INT >= 21) { getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); } mSavePreference = SavePreference.getInstance(this); new RequestService(this, DashboardNotification.this).setArguments("Tenant/" + mSavePreference.getString(IpreferenceKey.TCODE) + "/Notifications"); setContentView(R.layout.fragment_dashboard_noti); notificationDataList = new ArrayList<>(); indicator = (LinearLayout) findViewById(R.id.indicators); viewPager = (ViewPager) findViewById(R.id.view_pager); btn_skip = (Button) findViewById(R.id.btn_skip); tv_no_noti = (TextView) findViewById(R.id.tv_no_noti); viewPager.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadFragment(new NotificationList()); } }); btn_skip.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { new RequestService(DashboardNotification.this,DashboardNotification.this).putRequestSkip("Tenant/"+mSavePreference.getString(IpreferenceKey.TCODE)+"/Notifications/MarkAsSeen",""); finish(); } }); setData(); } @Override public void onSuccess(String response) { try { JSONArray jsonArray = new JSONArray(response); for (i = 0; i <= jsonArray.length()-1; i++) { NotificationData notificationData = new NotificationData(); JSONObject notification = jsonArray.getJSONObject(i).getJSONObject("Notification"); notificationData.title = notification.getString("Title"); notificationData.description = notification.getString("Description"); notificationData.photo_url = notification.getString("Icon"); notificationData.isSeen = jsonArray.getJSONObject(i).getString("IsSeen"); if (notificationData.isSeen.equalsIgnoreCase("false")){ notificationDataList.add(notificationData); } } if (notificationDataList.size()==0){ tv_no_noti.setVisibility(View.VISIBLE); }else { tv_no_noti.setVisibility(View.GONE); notificationAdapter = new NotificationAdapter(this, getSupportFragmentManager(), notificationDataList); viewPager.setAdapter(notificationAdapter); viewPager.setCurrentItem(0); viewPager.setOnPageChangeListener(this); setUiPageViewController(); } }catch (Exception e){ } } @Override public void onSuccessHome(String response) { } @Override public void onSuccessNotificationCount(String response) { } @Override public void onSuccessSecond(String response) { } @Override public void onPostSuccess(String response, String sessionId) { } @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { for (int i=0; i<mDotCount; i++){ mDots[i].setBackgroundResource(R.drawable.nonselected_item); } mDots[position].setBackgroundResource(R.drawable.selected_item); } @Override public void onPageScrollStateChanged(int state) { } private void setData(){ } private void setUiPageViewController(){ mDotCount = notificationAdapter.getCount(); mDots = new LinearLayout[mDotCount]; for(int i=0; i<mDotCount; i++){ mDots[i] = new LinearLayout(this); mDots[i].setBackgroundResource(R.drawable.nonselected_item); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( LinearLayoutCompat.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT ); params.setMargins(4,0,4,0); indicator.addView(mDots[i],params); mDots[0].setBackgroundResource(R.drawable.selected_item); } } private void loadFragment(Fragment fragment) { //load fragment FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.replace(R.id.home_frame_layout, fragment); transaction.addToBackStack(null); transaction.commit(); } }
[ "shakumar.ext@deloitte.com" ]
shakumar.ext@deloitte.com
3d696407426f6538eec12901229c9fad3d0a02d5
1bcfb9d3152f142d84aeccd38c6b362e8dea96bc
/src/main/java/com/hcl/dmu/config/security/UserPrincipal.java
077cdf3bfe53ebd479a405065c5a129e9ed54945
[]
no_license
skybarer/DMU_CANDIDATE_DET
53d0ccb0afc7ebe6e290136f81ae8f554c17bede
5d7851b983be2f93215379ed1e9892ba9d623266
refs/heads/master
2022-07-09T14:06:13.166032
2020-02-02T08:12:25
2020-02-02T08:12:25
172,229,392
0
0
null
2022-06-29T17:13:25
2019-02-23T15:21:58
Java
UTF-8
Java
false
false
2,409
java
package com.hcl.dmu.config.security; import java.util.Arrays; import java.util.Collection; import java.util.Objects; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import com.fasterxml.jackson.annotation.JsonIgnore; import com.hcl.dmu.user.vo.RolesVo; import com.hcl.dmu.user.vo.UserVo; public class UserPrincipal implements UserDetails { private static final long serialVersionUID = 6789230852669844715L; private Long id; private String email; @JsonIgnore private String password; private Collection<? extends GrantedAuthority> authorities; public UserPrincipal(Long id,String email, String password, Collection<? extends GrantedAuthority> authorities) { this.id = id; this.email = email; this.password = password; this.authorities = authorities; } public static UserPrincipal create(UserVo user) { RolesVo roleVo = user.getRole(); SimpleGrantedAuthority authority = new SimpleGrantedAuthority(roleVo.getRoleName()); return new UserPrincipal( user.getId(), user.getUsername(), user.getPassword(), Arrays.asList(authority) ); } public Long getId() { return id; } public String getEmail() { return email; } @Override public String getUsername() { return email; } @Override public String getPassword() { return password; } @Override public Collection<? extends GrantedAuthority> getAuthorities() { return authorities; } @Override public boolean isAccountNonExpired() { return true; } @Override public boolean isAccountNonLocked() { return true; } @Override public boolean isCredentialsNonExpired() { return true; } @Override public boolean isEnabled() { return true; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; UserPrincipal that = (UserPrincipal) o; return Objects.equals(id, that.id); } @Override public int hashCode() { return Objects.hash(id); } }
[ "akashdhar.apssdc@gmail.com" ]
akashdhar.apssdc@gmail.com
049a88dd25966523a73b12ff0e1621f2a7d5eebc
358ede47bc7df2e8908138bd3c8045c867536219
/Java/ch08-2/src/A_CircleUsing.java
ab4e13eb9f603f7cebc605a945ead4a85373154f
[]
no_license
wfdsaz/kosmo41_jungsangjun
8a9a8a8adb97e567cea3003138b756e0996ea7ba
a99da02038a05cfb17bd3249592c7dea413fb7b1
refs/heads/master
2020-03-21T04:40:46.090527
2018-10-17T12:55:31
2018-10-17T12:55:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
347
java
class A_CircleUsing { public static void main(String[] args) { com.company.area.Circle c1 = new com.company.area.Circle(3.5); System.out.println("반지름 3.5 원 넓이 : " + c1.getArea()); com.company.length.Circle c2 = new com.company.length.Circle(3.5); System.out.println("반지름 3.5 원 둘레 : " + c2.getPerimeter()); } }
[ "niljungsang@gmail.com" ]
niljungsang@gmail.com
9879bf70a393ac5d9a90cbb4f39f7535b3bb3909
7df45aa99c32deb21942d8948fe4d88c32053380
/base/scene/welcomeScene/Banner.java
754080095c0c2cf04296fcb5851d5addf6c2043b
[]
no_license
linhh611/AliceInWonderRabitcave
770413637c645d0b26c05091f35e9b6730272e6c
ac34a7531c985a1899a0de4fed58908ce3b7c9a8
refs/heads/main
2023-01-29T06:36:34.751521
2020-12-11T09:06:23
2020-12-11T09:06:23
320,516,268
0
0
null
null
null
null
UTF-8
Java
false
false
1,450
java
/* */ package base.scene.welcomeScene; /* */ /* */ import base.GameObject; /* */ import base.Vector2D; /* */ import base.event.KeyEventPress; /* */ import base.renderer.Renderer; /* */ import base.renderer.SingleImageRenderer; /* */ import base.scene.Scene; /* */ import base.scene.SceneManager; /* */ import base.scene.StageScene; /* */ import base.scene.TutorialScene.TutorialScene; /* */ import tklibs.SpriteUtils; /* */ /* */ public class Banner extends GameObject { /* */ public Banner() { /* 16 */ this.renderer = (Renderer)new SingleImageRenderer(SpriteUtils.loadImage("assets/images/scenes/welcome.png")); /* 17 */ this.position = new Vector2D(); /* 18 */ this.position.x = 0.0F; /* 19 */ this.position.y = 0.0F; /* 20 */ this.anchor.setThis(Float.valueOf(0.0F), Float.valueOf(0.0F)); /* */ } /* */ /* */ /* */ public void run() { /* 25 */ if (KeyEventPress.isAnyKey) { /* 26 */ SceneManager.signNewScene((Scene)new StageScene()); /* 27 */ } else if (KeyEventPress.isEscPress) { /* 28 */ SceneManager.signNewScene((Scene)new TutorialScene()); /* */ } /* */ } /* */ } /* Location: C:\Users\ADMIN\Downloads\Compressed\Alice in the wonderland\Alice in the wonderland\Alice in the wonder land.jar!\base\scene\welcomeScene\Banner.class * Java compiler version: 10 (54.0) * JD-Core Version: 1.1.3 */
[ "linhkod97@gmail.com" ]
linhkod97@gmail.com
26851fed0b74f0fbe243d22c17eb5f8682c68595
63411d47259b05d4af7b3aa2a02c8b4a3a9c6608
/src/main/java/com/qlgydx/config/ElasticSearchConfig.java
4eee933a2d5d1fcdbae9ad5b224631777f986c25
[]
no_license
GodHand-6/MyBlogBackstage
7d4f1b5f2ed65053f01b1e6280b782b442a38d1d
c277ab9e8f4463e6698791449490afc5b69a1db9
refs/heads/master
2022-11-29T08:22:50.195267
2020-08-05T15:54:09
2020-08-05T15:54:09
285,330,255
1
0
null
null
null
null
UTF-8
Java
false
false
622
java
package com.qlgydx.config; import org.apache.http.HttpHost; import org.elasticsearch.client.RestClient; import org.elasticsearch.client.RestHighLevelClient; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; /** * @author 岳贤翔 * @date 2020/7/28 - 18:14 */ @Configuration public class ElasticSearchConfig { @Bean public RestHighLevelClient restHighLevelClient(){ RestHighLevelClient restHighLevelClient = new RestHighLevelClient(RestClient.builder(new HttpHost("127.0.0.1",9200,"http"))); return restHighLevelClient; } }
[ "1975597979@qq.com" ]
1975597979@qq.com
572e43b0fcf3c3d3430f30422e81f803e0972e05
abf431790d66c1ce62c48328659b958ca0b120dd
/app/src/androidTest/java/com/example/james/materialdesign2/ShotDataTest.java
49467e7d11f9bc41eb24498b438bf30eba37b36c
[]
no_license
JamesPatrickTate/AndroidProject
62fef58aeff2ab68c62386fb5405dc550abf0491
970fbd351335775253d054fa6e28319571e6abed
refs/heads/master
2021-05-07T23:10:42.434271
2018-03-29T13:31:19
2018-03-29T13:31:19
107,404,536
0
0
null
null
null
null
UTF-8
Java
false
false
2,826
java
package com.example.james.materialdesign2; import android.app.Activity; import android.support.test.espresso.contrib.DrawerActions; import android.support.test.espresso.contrib.RecyclerViewActions; import android.support.test.rule.ActivityTestRule; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import static android.support.test.espresso.Espresso.onData; import static android.support.test.espresso.Espresso.onView; import static android.support.test.espresso.action.ViewActions.click; import static android.support.test.espresso.action.ViewActions.closeSoftKeyboard; import static android.support.test.espresso.action.ViewActions.typeText; import static android.support.test.espresso.assertion.ViewAssertions.matches; import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; import static android.support.test.espresso.matcher.ViewMatchers.withContentDescription; import static android.support.test.espresso.matcher.ViewMatchers.withId; import static org.hamcrest.Matchers.anything; /** * Created by james on 09/02/2018. * Testing the activity which displays the map and shot data for a single shot * TODO the xml for this is called tester, this name should be changed to something more relevant */ public class ShotDataTest { //mmap object_tostring String correctEmailAddress = "jamestate11@gmail.com"; String correctPassword = "Keelagh46="; TestUtility testUtility = new TestUtility(); @Rule //login public ActivityTestRule<Auth> authTestRule = new ActivityTestRule<Auth>(Auth.class); public AuthenticationTest login = new AuthenticationTest(); @Before public void beforeTest() { Activity activity = authTestRule.getActivity(); onView(withId(R.id.field_email)).perform(typeText(correctEmailAddress), closeSoftKeyboard()); onView(withId(R.id.field_password)).perform(typeText(correctPassword), closeSoftKeyboard()); onView(withId(R.id.email_sign_in_button)).perform(click()); testUtility.waiter(5000);// wait for login onView(withId(R.id.drawer_layout)).perform(DrawerActions.open()); testUtility.waiter(2000); onView(withId(R.id.drawerList)) .perform(RecyclerViewActions.actionOnItemAtPosition(0, click())); testUtility.waiter(2000); } /** * open the shots stats from the nav drawer * check the map and the details of the shot are displayed */ @Test public void openSingleShotDataTest(){ onData(anything()).inAdapterView(withContentDescription("alllShotsList")) .atPosition(0).perform(click()); testUtility.waiter(2000); onView(withId(R.id.mmap)).check(matches(isDisplayed())); onView(withId(R.id.object_tostring)).check(matches(isDisplayed())); } }
[ "jamestate11@gmail.com" ]
jamestate11@gmail.com
ac96514fb997061f40d9a36356a1fa905b547a33
d48dbc5ffbf21c8e5445a5f54ee21a1741e88ae1
/mymaven1/src/main/java/service/impl/LiuTingServiceImpl.java
4c842c45a6490f27100ee06974022a84e0961295
[]
no_license
hutianpeng/cangku
851e23dc4bd192ef4d0384f83da4189bf46e5bee
cd61a2768b29f6eefa53fb627570d446f0cb5c44
refs/heads/master
2021-07-04T13:55:02.953261
2017-09-27T09:59:59
2017-09-27T09:59:59
104,999,676
0
0
null
null
null
null
UTF-8
Java
false
false
878
java
package service.impl; import java.util.List; import dao.LiuTingDao; import daoimpl.LiuTingDaoImpl; import entity.LiuTing; import service.LiuTingService; public class LiuTingServiceImpl implements LiuTingService{ LiuTingDao liutingdao=new LiuTingDaoImpl(); @Override public List<LiuTing> chaxun() { return liutingdao.chaxun(); } @Override public int tianji(LiuTing liuting) { // TODO Auto-generated method stub return liutingdao.tianji(liuting); } @Override public int shanchu(Integer id) { // TODO Auto-generated method stub return liutingdao.shanchu(id); } @Override public LiuTing id(Integer id) { // TODO Auto-generated method stub return liutingdao.id(id); } @Override public int update(LiuTing liuting) { // TODO Auto-generated method stub return liutingdao.update(liuting); } }
[ "1173008159@qq.com" ]
1173008159@qq.com
0db1b054a41b499bc9bf1911e1fc2b15155f1f35
70f76f00513a4a610ad42ae92759ae27a3631f6a
/src/main/java/com/gzq/flash/server/handler/outbound/OutBoundHandlerA.java
850f6f86ea7ee76f1def7b9c1791f4769ee89858
[]
no_license
guo156627977/netty-learn
bafc7fe536996d6edba02e550c3ce43d9089b486
ac69d83cc6cc04af8506324d5fdc473ea6531b8c
refs/heads/master
2020-04-04T02:56:11.741489
2018-11-01T10:57:43
2018-11-01T10:57:43
155,701,525
0
0
null
null
null
null
UTF-8
Java
false
false
560
java
package com.gzq.flash.server.handler.outbound; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelOutboundHandlerAdapter; import io.netty.channel.ChannelPromise; /** * @author guozhiqiang * @description * @created 2018-09-28 18:09. */ public class OutBoundHandlerA extends ChannelOutboundHandlerAdapter { @Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { System.out.println("OutBoundHandlerA: " + msg); super.write(ctx, msg, promise); } }
[ "156627977@qq.com" ]
156627977@qq.com
b327e49ff27aae1bd758ce9877337c16de9548c6
f4fb031f70595659a44cee19ac5a745285ffd01e
/Minecraft/src/net/minecraft/src/EntityAIOpenDoor.java
230a33d5d81ca040fdacc5a029795ec995d3045b
[]
no_license
minecraftmuse3/Minecraft
7adfae39fccbacb8f4e5d9b1b0adf0d3ad9aebc4
b3efea7d37b530b51bab42b8cf92eeb209697c01
refs/heads/master
2021-01-17T21:53:09.461358
2013-07-22T13:10:43
2013-07-22T13:10:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
885
java
package net.minecraft.src; public class EntityAIOpenDoor extends EntityAIDoorInteract { boolean field_75361_i; int field_75360_j; public EntityAIOpenDoor(EntityLiving par1EntityLiving, boolean par2) { super(par1EntityLiving); theEntity = par1EntityLiving; field_75361_i = par2; } @Override public boolean continueExecuting() { return field_75361_i && field_75360_j > 0 && super.continueExecuting(); } @Override public void resetTask() { if(field_75361_i) { targetDoor.onPoweredBlockChange(theEntity.worldObj, entityPosX, entityPosY, entityPosZ, false); } } @Override public void startExecuting() { field_75360_j = 20; targetDoor.onPoweredBlockChange(theEntity.worldObj, entityPosX, entityPosY, entityPosZ, true); } @Override public void updateTask() { --field_75360_j; super.updateTask(); } }
[ "sashok7241@gmail.com" ]
sashok7241@gmail.com
ee7f512f1a1d54f207f6e33bb6577dd26ec64ae0
d273d8c1b1d77f14c09010ce178bee7fcc41e0d4
/app/src/main/java/conger/com/pandamusic/activity/OnlineMusicActivity.java
74d3d247bca662f812f68be99eab96d6af857ac5
[]
no_license
Vhibli/PandaMusic
3e403fcb1c1410d90a10b29deee83c85c3b07cba
f596d691ff2aa037a860081878f896a34d1cb7cb
refs/heads/master
2021-01-21T23:08:45.525310
2017-06-23T18:43:12
2017-06-23T18:43:12
95,193,245
0
0
null
null
null
null
UTF-8
Java
false
false
11,349
java
package conger.com.pandamusic.activity; import android.app.ProgressDialog; import android.content.DialogInterface; import android.graphics.Bitmap; import android.os.Bundle; import android.support.v7.app.AlertDialog; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.arialyy.aria.core.Aria; import com.nostra13.universalimageloader.core.ImageLoader; import com.nostra13.universalimageloader.core.assist.ImageSize; import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener; import com.orhanobut.logger.Logger; import java.io.File; import java.util.ArrayList; import java.util.List; import conger.com.pandamusic.R; import conger.com.pandamusic.adapter.OnMoreClickListener; import conger.com.pandamusic.adapter.OnlineMusicAdapter; import conger.com.pandamusic.constants.Extras; import conger.com.pandamusic.download.DownloadEngine; import conger.com.pandamusic.enums.LoadStateEnum; import conger.com.pandamusic.executor.PlayOnlineMusic; import conger.com.pandamusic.executor.ShareOnlineMusic; import conger.com.pandamusic.model.DownloadInfo; import conger.com.pandamusic.model.Music; import conger.com.pandamusic.model.OnlineMusic; import conger.com.pandamusic.model.OnlineMusicList; import conger.com.pandamusic.model.SongListInfo; import conger.com.pandamusic.net.RetrofitHelper; import conger.com.pandamusic.utils.FileUtils; import conger.com.pandamusic.utils.ImageUtils; import conger.com.pandamusic.utils.ScreenUtils; import conger.com.pandamusic.utils.ToastUtils; import conger.com.pandamusic.utils.ViewUtils; import conger.com.pandamusic.utils.binding.Bind; import conger.com.pandamusic.widget.AutoLoadListView; import rx.Observer; import rx.android.schedulers.AndroidSchedulers; import rx.schedulers.Schedulers; import static conger.com.pandamusic.application.AppCache.getContext; /** * 在线音乐界面 * */ public class OnlineMusicActivity extends BaseActivity implements OnItemClickListener , OnMoreClickListener, AutoLoadListView.OnLoadListener { private static final int MUSIC_LIST_SIZE = 20; @Bind(R.id.lv_online_music_list) private AutoLoadListView lvOnlineMusic; @Bind(R.id.ll_loading) private LinearLayout llLoading; @Bind(R.id.ll_load_fail) private LinearLayout llLoadFail; private View vHeader; private SongListInfo mListInfo; private OnlineMusicList mOnlineMusicList; private List<OnlineMusic> mMusicList = new ArrayList<>(); private OnlineMusicAdapter mAdapter = new OnlineMusicAdapter(mMusicList); private ProgressDialog mProgressDialog; private int mOffset = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_online_music); if (!checkServiceAlive()) { return; } mListInfo = (SongListInfo) getIntent().getSerializableExtra(Extras.MUSIC_LIST_TYPE); setTitle(mListInfo.getTitle()); init(); onLoad(); } private void init() { vHeader = LayoutInflater.from(this).inflate(R.layout.activity_online_music_list_header, null); AbsListView.LayoutParams params = new AbsListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ScreenUtils.dp2px(150)); vHeader.setLayoutParams(params); lvOnlineMusic.addHeaderView(vHeader, null, false); lvOnlineMusic.setAdapter(mAdapter); lvOnlineMusic.setOnLoadListener(this); mProgressDialog = new ProgressDialog(this); mProgressDialog.setMessage(getString(R.string.loading)); ViewUtils.changeViewState(lvOnlineMusic, llLoading, llLoadFail, LoadStateEnum.LOADING); } @Override protected void setListener() { lvOnlineMusic.setOnItemClickListener(this); mAdapter.setOnMoreClickListener(this); } @Override public void onLoad() { getMusic(mOffset); } private void getMusic(final int offset) { RetrofitHelper.getRetrofitHelper().fetchOnLineMusicList(mListInfo.getType(), MUSIC_LIST_SIZE, offset) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Observer<OnlineMusicList>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { ToastUtils.show(R.string.load_fail); } @Override public void onNext(OnlineMusicList onlineMusicList) { lvOnlineMusic.onLoadComplete(); mOnlineMusicList = onlineMusicList; if (offset == 0 && onlineMusicList == null) { ViewUtils.changeViewState(lvOnlineMusic, llLoading, llLoadFail, LoadStateEnum.LOAD_FAIL); return; } else if (offset == 0) { initHeader(); ViewUtils.changeViewState(lvOnlineMusic, llLoading, llLoadFail, LoadStateEnum.LOAD_SUCCESS); } if (onlineMusicList == null || onlineMusicList.getSong_list() == null || onlineMusicList.getSong_list().size() == 0) { lvOnlineMusic.setEnable(false); return; } mOffset += MUSIC_LIST_SIZE; mMusicList.addAll(onlineMusicList.getSong_list()); mAdapter.notifyDataSetChanged(); } }); } @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { play((OnlineMusic) parent.getAdapter().getItem(position)); } /** * 弹出分享 * @param position */ @Override public void onMoreClick(int position) { final OnlineMusic onlineMusic = mMusicList.get(position); AlertDialog.Builder dialog = new AlertDialog.Builder(this); dialog.setTitle(mMusicList.get(position).getTitle()); String path = FileUtils.getMusicDir() + FileUtils.getMp3FileName(onlineMusic.getArtist_name(), onlineMusic.getTitle()); File file = new File(path); int itemsId = file.exists() ? R.array.online_music_dialog_without_download : R.array.online_music_dialog; dialog.setItems(itemsId, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch (which) { case 0:// 分享 share(onlineMusic); break; case 1:// 查看歌手信息 artistInfo(onlineMusic); break; case 2:// 下载 download(onlineMusic); break; } } }); dialog.show(); } private void initHeader() { final ImageView ivHeaderBg = (ImageView) vHeader.findViewById(R.id.iv_header_bg); final ImageView ivCover = (ImageView) vHeader.findViewById(R.id.iv_cover); TextView tvTitle = (TextView) vHeader.findViewById(R.id.tv_title); TextView tvUpdateDate = (TextView) vHeader.findViewById(R.id.tv_update_date); TextView tvComment = (TextView) vHeader.findViewById(R.id.tv_comment); tvTitle.setText(mOnlineMusicList.getBillboard().getName()); tvUpdateDate.setText(getString(R.string.recent_update, mOnlineMusicList.getBillboard().getUpdate_date())); tvComment.setText(mOnlineMusicList.getBillboard().getComment()); ImageSize imageSize = new ImageSize(200, 200); ImageLoader.getInstance().loadImage(mOnlineMusicList.getBillboard().getPic_s640(), imageSize, ImageUtils.getCoverDisplayOptions(), new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { ivCover.setImageBitmap(loadedImage); ivHeaderBg.setImageBitmap(ImageUtils.blur(loadedImage)); } }); } private void play(OnlineMusic onlineMusic) { new PlayOnlineMusic(this, onlineMusic) { @Override public void onPrepare() { mProgressDialog.show(); } @Override public void onExecuteSuccess(Music music) { mProgressDialog.cancel(); getPlayService().play(music); ToastUtils.show(getString(R.string.now_play, music.getTitle())); } @Override public void onExecuteFail(Exception e) { mProgressDialog.cancel(); ToastUtils.show(R.string.unable_to_play); } }.execute(); } private void share(final OnlineMusic onlineMusic) { new ShareOnlineMusic(this, onlineMusic.getTitle(), onlineMusic.getSong_id()) { @Override public void onPrepare() { mProgressDialog.show(); } @Override public void onExecuteSuccess(Void aVoid) { mProgressDialog.cancel(); } @Override public void onExecuteFail(Exception e) { mProgressDialog.cancel(); } }.execute(); } private void artistInfo(OnlineMusic onlineMusic) { ArtistInfoActivity.start(this, onlineMusic.getTing_uid()); } /** * 下载音乐 * @param onlineMusic */ private void download(final OnlineMusic onlineMusic) { /** * 下载mp3文件 */ RetrofitHelper.getRetrofitHelper().fetchDownloadInfo(onlineMusic.getSong_id()) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Observer<DownloadInfo>() { @Override public void onCompleted() { ToastUtils.show("下载完成"); } @Override public void onError(Throwable e) { ToastUtils.show("下载失败"); } @Override public void onNext(DownloadInfo downloadInfo) { DownloadEngine.downloadMusic(downloadInfo,onlineMusic.getArtist_name(),onlineMusic.getTitle()); } }); /** * 下载歌词 */ DownloadEngine.downloadLrc(onlineMusic.getLrclink(),onlineMusic.getArtist_name(),onlineMusic.getTitle()); /** * 下载封面 */ DownloadEngine.downloadAlbum(onlineMusic.getPic_big(),onlineMusic.getArtist_name(),onlineMusic.getTitle()); } }
[ "165031728@qq.com" ]
165031728@qq.com
b1c2f4792860ee81a5788cc43331e83dc8a569d6
891d2ebcf1a88319a96686d73db647b7ba3eda7e
/app/src/main/java/com/damidev/dd/splashscreen/dataaccess/ServerMapChildResponseDto.java
1f5e284b7f4172b70d17fd5c294dd2538d314ab5
[]
no_license
LukasJanoska/DD
f89af87cceb7cf3a1e66968eafa8e17b417f7202
035295e3c6afa2b24238e34b98c5261126bc877a
refs/heads/master
2020-04-06T04:43:59.522191
2017-03-06T12:27:54
2017-03-06T12:27:54
82,843,368
0
0
null
null
null
null
UTF-8
Java
false
false
1,629
java
package com.damidev.dd.splashscreen.dataaccess; import com.google.gson.annotations.SerializedName; import java.io.Serializable; import java.util.ArrayList; public class ServerMapChildResponseDto implements Serializable{ @SerializedName("id") private int id; @SerializedName("lat") private double lat; @SerializedName("lng") private double lng; @SerializedName("title") private String title; @SerializedName("desc") private String desc; @SerializedName("photo") private ArrayList<String> photos; public ServerMapChildResponseDto(int id, double lat, double lng, String title, String desc, ArrayList<String> photos) { this.id = id; this.lat = lat; this.lng = lng; this.title = title; this.desc = desc; this.photos = photos; } public int getId() { return id; } public void setId(int id) { this.id = id; } public double getLat() { return lat; } public void setLat(double lat) { this.lat = lat; } public double getLng() { return lng; } public void setLng(double lng) { this.lng = lng; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } public ArrayList<String> getPhotos() { return photos; } public void setPhotos(ArrayList<String> photos) { this.photos = photos; } }
[ "lukes.janoska@gmail.com" ]
lukes.janoska@gmail.com
0d268ae8bc2755bcd506a0c7208a007cd3e1896b
03a4e85195e79278c2205c70b0799948127b9e23
/learning-v-esipov/src/main/java/com/aimprosoft/yesipov/web/command/impl/AddDepartmentCommand.java
b76868c3e9dad4182f613ca1dbe214c2f709f7d5
[]
no_license
VadymYesipov/SpringAttempt
7bf34e03d3b39549608424c2f3297f4c27587480
065a94c410270ce48eafa5c3e4bf571cf6aa0552
refs/heads/master
2020-03-18T17:57:03.809741
2018-05-27T16:15:56
2018-05-27T16:15:56
135,062,198
0
0
null
null
null
null
UTF-8
Java
false
false
2,305
java
package com.aimprosoft.yesipov.web.command.impl; import com.aimprosoft.yesipov.web.Path; import com.aimprosoft.yesipov.db.dao.impl.MySQLDepartmentDAO; import com.aimprosoft.yesipov.db.entity.Department; import com.aimprosoft.yesipov.web.command.Command; import org.apache.log4j.Logger; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; public class AddDepartmentCommand implements Command { private static final Logger log = Logger.getLogger(AddDepartmentCommand.class); MySQLDepartmentDAO mySQLDepartmentDAO; Department department; @Override public String execute(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { log.debug("Command starts"); String errorMessage = null; String forward = Path.ERROR_PAGE; String name = request.getParameter("departmentName").trim(); List<Department> departments = (List<Department>) request.getServletContext().getAttribute("departmentList"); Object object = departments.stream() .filter(x -> name.equals(x.getName())) .findAny() .orElse(null); if (object == null) { mySQLDepartmentDAO = new MySQLDepartmentDAO(); department.setId(departments.size() + 1); department.setName(name); mySQLDepartmentDAO.addDepartment(department); departments = mySQLDepartmentDAO.departmentsList(); log.trace("Departments size = " + departments.size()); request.getServletContext().setAttribute("departmentList", departments); forward = Path.ADD_EDIT_DEPARTMENT; } else { errorMessage = "A department with such name already exists"; request.setAttribute("errorMessage", errorMessage); log.error("errorMessage --> " + errorMessage); return forward; } request.setAttribute("add_name", name); log.trace("Forward address --> " + forward); log.debug("Controller finished, now go to forward address --> " + forward); log.debug("Command finished"); return forward; } }
[ "v-esipov@mail.ua" ]
v-esipov@mail.ua
73e0d978e949519692943af40de0231fe53c7252
661d60234f818648193c2c5734ced5e64f92b9dc
/Queen.java
c8d1e4463406a0af275688d563899de31523c4e0
[]
no_license
kevindweb/NQueens
5a7c6bc0ea6a64298c49efdd452dfe46b37f3147
ea1e6a84f86c3423121046584a4e575b9bfa0006
refs/heads/master
2020-03-16T04:24:12.664067
2018-05-07T20:04:40
2018-05-07T20:04:40
132,510,457
0
0
null
null
null
null
UTF-8
Java
false
false
256
java
public class Queen{ private int row; private int col; public Queen(int row, int col){ this.row = row; this.col = col; } public int getRow(){ return row; } public int getCol(){ return col; } }
[ "kevindwebsites@gmail.com" ]
kevindwebsites@gmail.com
18d8c29d814ba89fa854f0e07789475a84a264c3
2ed61d22d4d33451f16c6942803c9915149777a2
/mediacenter-auth/src/main/java/com/szreach/mediacenter/auth/login/service/LoginServiceImpl.java
1d6a482bfe3820dc9c7281fde1a156587f17ac25
[]
no_license
eseawind/pub
a07c774ec7b265662763382f5821e60f698e644a
1bf6a9aad479513108b299c44e556ba63670a86e
refs/heads/master
2021-01-13T12:07:54.610312
2015-04-24T10:03:15
2015-04-24T10:03:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,875
java
/** * Copyright (c) @2015-3-25. All Rights Reserved. * AUTHOR: LIZHIWEI</a> */ package com.szreach.mediacenter.auth.login.service; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; import com.szreach.mediacenter.auth.login.dao.LoginDao; import com.szreach.mediacenter.auth.menu.bean.MenuBean; import com.szreach.mediacenter.auth.st.ReturnCode; import com.szreach.mediacenter.auth.user.bean.LoginUser; import com.szreach.mediacenter.auth.user.dao.LoginUserDao; import com.szreach.mediacenter.common.base.AbstractBaseServiceImpl; /** * @Description: * @author lizhiwei * @Date: 2015-3-25 * @Version: 1.0 */ @Service("loginService") @Scope("prototype") @Transactional public class LoginServiceImpl extends AbstractBaseServiceImpl implements LoginService { @Autowired private LoginDao loginDao; @Autowired private LoginUserDao loginUserDao; @Override public List<MenuBean> queryMenuTree(int userId) { List<MenuBean> list = loginDao.queryMenuTree(userId); if(list == null || list.size()==0) return null; List<MenuBean> treeList = new ArrayList<MenuBean>(); MenuBean parentMenu = null; MenuBean childMenu = null; Integer id = -1; for(MenuBean menu: list ) { //父id相同,取子菜单的数据 if(id.equals(menu.getId())) { childMenu = new MenuBean(); childMenu.setId(menu.getChildId()); childMenu.setMenuName(menu.getChildMenuName()); childMenu.setMenuAction(menu.getChildMenuAction()); childMenu.setMenuIcon(menu.getChildMenuIcon()); parentMenu.getChildren().add(childMenu); } else { parentMenu = new MenuBean(); parentMenu.setId(menu.getId()); parentMenu.setMenuName(menu.getMenuName()); parentMenu.setMenuIcon(menu.getMenuIcon()); parentMenu.setChildren( new ArrayList<MenuBean>()); treeList.add(parentMenu); childMenu = new MenuBean(); childMenu.setId(menu.getChildId()); childMenu.setMenuName(menu.getChildMenuName()); childMenu.setMenuAction(menu.getChildMenuAction()); childMenu.setMenuIcon(menu.getChildMenuIcon()); parentMenu.getChildren().add(childMenu); id=menu.getId(); } } list = null; return treeList; } public int checkLogin(LoginUser user, LoginUser loginUser) { int result = ReturnCode.SUCCESS; //1.检查用户名是否存在 if(loginUser == null) { result = ReturnCode.USERNAME_PASSW_ERROR; } else { //2.检查密码是否正确 if( ! loginUser.getPassword().equals(user.getPassword())) { result = ReturnCode.USERNAME_PASSW_ERROR; } else { } } return result; } }
[ "lizhiwei@rd.szreach.com" ]
lizhiwei@rd.szreach.com
0a812e92d2aae2a1bc129b11ccaee6528ac1af44
b2a635e7cc27d2df8b1c4197e5675655add98994
/e/f/a/e/i/i/c0.java
d93958b1adeac62d3370329b26058e2831f635f1
[]
no_license
history-purge/LeaveHomeSafe-source-code
5f2d87f513d20c0fe49efc3198ef1643641a0313
0475816709d20295134c1b55d77528d74a1795cd
refs/heads/master
2023-06-23T21:38:37.633657
2021-07-28T13:27:30
2021-07-28T13:27:30
390,328,492
1
0
null
null
null
null
UTF-8
Java
false
false
322
java
package e.f.a.e.i.i; import e.f.b.a.c.e; import e.f.b.a.c.i; import e.f.b.a.c.m; final class c0 extends e<String, v> { private final a0 b = new a0(i.b().a()); } /* Location: /home/yc/Downloads/LeaveHomeSafe.jar!/e/f/a/e/i/i/c0.class * Java compiler version: 6 (50.0) * JD-Core Version: 1.1.3 */
[ "game0427game@gmail.com" ]
game0427game@gmail.com
eb3314e034273f2d074137fb86c6963a3afda582
28a4b462540ab84b58391abe30185f695507c072
/src/test/java/net/hmanjarres/BancoDemoApplicationTests.java
0a621bf305ca6ce2f129b3487948b1c60d90db5f
[]
no_license
Humberto-manjarres/Banco-prueba
68b94e3d4ac952fd1acdd8cb947c4469b5497a72
f4948c9c07edf9c4c35f44fafbb33e7de038e175
refs/heads/main
2023-07-23T05:18:06.858171
2021-08-30T21:55:28
2021-08-30T21:55:28
401,486,762
0
0
null
null
null
null
UTF-8
Java
false
false
209
java
package net.hmanjarres; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class BancoDemoApplicationTests { @Test void contextLoads() { } }
[ "totopercusion@gmail.com" ]
totopercusion@gmail.com
5d57330e181d02205480fe72e2aee5694f021b0d
cb958f38e05d2f813b64a3b98173a68911700267
/src/main/java/com/example/devlab/GitTestProjectApplication.java
255900fc4b2949c554388131cbfc0635b083c2a1
[]
no_license
jm79hj/GitTestProject
6ad2bdf5fa3b8e36eaadc172ad1bf0060a792103
e8e793c38679b41c8ccba146af6673af35e2e123
refs/heads/master
2022-04-19T23:32:39.793957
2020-04-21T07:29:29
2020-04-21T07:29:29
257,514,400
0
0
null
null
null
null
UTF-8
Java
false
false
538
java
package com.example.devlab; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @RestController @SpringBootApplication public class GitTestProjectApplication { public static void main(String[] args) { SpringApplication.run(GitTestProjectApplication.class, args); } @GetMapping public String HelloWorld() { return "Hello World"; } }
[ "jm79hj@naver.com" ]
jm79hj@naver.com
51d87b6676fed522d0edfad45b170d285b020faf
21df477c740a3b9e1e7541618335d338e18d3044
/src/main/java/easonc/elastic/client/enums/FieldIndexOption.java
7311616c4ad2acb593cc5160dc98fa7fb57e4687
[]
no_license
easonC/elastic-client
717ed0fdb230c6fec22c626191a6fefe14760e4a
dd5c3c805712353c21024e2924f8df3ff788daea
refs/heads/master
2021-05-07T23:21:34.636836
2017-10-26T13:40:45
2017-10-26T13:40:45
107,429,484
0
0
null
null
null
null
UTF-8
Java
false
false
375
java
package easonc.elastic.client.enums; /** * Created by zhuqi on 2016/11/17. */ public enum FieldIndexOption { Analyzed("analyzed"), NotAnalyzed("not_analyzed"), No("no"); private final String text; private FieldIndexOption(final String text) { this.text = text; } @Override public String toString() { return text; } }
[ "afoiwf@vip.qq.com" ]
afoiwf@vip.qq.com
7869757f3d1f5f895b65163a49f8ff0937f331f2
2e306550e649141d5b8c0a43ca9b6e82239f5b28
/L03 - SQL Injection/Fonte_questao_3/Exercicio_3/src/exercicio_3/BuscaCadastro.java
f4c8ac6346a2ddb17487ffc0abedbf182848fd3d
[]
no_license
leticiawoelfer/seguranca-da-informacao
4bc0b6c88b85e05c5d0c3b033522bd2d14f7cbd4
41f2c31bf0edecd77feb76756fc14ddca05f0627
refs/heads/master
2020-07-25T04:17:38.129050
2019-09-17T02:51:51
2019-09-17T02:51:51
208,161,074
0
0
null
null
null
null
UTF-8
Java
false
false
2,199
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 exercicio_3; import br.com.ConexaoBanco.ConexaoMySQL; import com.mysql.cj.xdevapi.PreparableStatement; import static com.sun.corba.se.spi.presentation.rmi.StubAdapter.request; import static java.lang.System.out; import java.sql.Array; import java.sql.Blob; import java.sql.CallableStatement; import java.sql.Clob; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.NClob; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLClientInfoException; import java.sql.SQLException; import java.sql.SQLWarning; import java.sql.SQLXML; import java.sql.Savepoint; import java.sql.Statement; import java.sql.Struct; import java.util.Map; import java.util.Properties; import java.util.concurrent.Executor; import javax.swing.JOptionPane; /** * * @author lcburigo */ public class BuscaCadastro { private String login; private String senha; public BuscaCadastro(String login, String senha) { this.login = login; this.senha = senha; } public String getLogin() { return login; } public String getSenha() { return senha; } public void setLogin(String login) { this.login = login; } public void setSenha(String senha) { this.senha = senha; } public void logar() throws SQLException { String sqlString = "SELECT * FROM PESSOA WHERE LOGIN = ? AND SENHA = ?"; Connection conn = ConexaoMySQL.getConexaoMySQL(); PreparedStatement ps = conn.prepareStatement(sqlString); ps.setString(1, login); ps.setString(2, senha); ResultSet rs = ps.executeQuery(); String resultadoConsulta = null; if (rs.next() == true) { resultadoConsulta = rs.getString("nome"); JOptionPane.showMessageDialog(null, "Bem vindo " + resultadoConsulta); } if (resultadoConsulta == null) { JOptionPane.showMessageDialog(null, "Login ou Senha inválidos"); } } }
[ "leticia.woelfer@hotmail.com" ]
leticia.woelfer@hotmail.com
65f0e8698df0fd6a825ab38521517b0413e3cee1
48ffebecc569275ea0d60a649f690aae8492f07d
/3310 2018/src/main/java/org/usfirst/frc/team3310/robot/commands/DriveStraightUntilCube.java
c3b44f784f355a7f99e9b73cd21992c58ddeffa0
[]
no_license
Matthew-Ruane/Team-207
3022037135e4046f0e161a2ab1ec8bdd7f254a10
0a61ec6aec557af0d6299b6a30ac7bbabe77fd32
refs/heads/master
2022-12-21T15:18:04.265974
2019-06-17T17:59:28
2019-06-17T17:59:28
182,201,878
1
0
null
2022-12-16T08:18:09
2019-04-19T04:33:27
Java
UTF-8
Java
false
false
345
java
package org.usfirst.frc.team3310.robot.commands; import edu.wpi.first.wpilibj.command.CommandGroup; /** * */ public class DriveStraightUntilCube extends CommandGroup { public DriveStraightUntilCube() { addParallel(new IntakeCubeAndLiftAbortDrive(false)); addSequential(new DriveStraightMP(100, 50, true, true, 0)); } }
[ "49774263+Matthew-Ruane@users.noreply.github.com" ]
49774263+Matthew-Ruane@users.noreply.github.com
43954c366b0ec458f5af5da264daa4e68a99a3cd
c8f22e79659e3dfc92600c3206d9773fa08613bf
/src/main/java/com/meganj/domain/Feline.java
35513b576b97dfec37e047263a08426c5c5b331a
[]
no_license
meganjacobs/JavaCollections
920c9af2caf4bd740788394ebebec4bba7745eee
40019f2b36d0672e3cd14218fb3bc036a3e3328d
refs/heads/master
2021-04-02T10:26:03.004888
2020-10-30T15:18:27
2020-10-30T15:18:27
248,259,882
0
0
null
2020-10-30T15:18:28
2020-03-18T14:50:22
Java
UTF-8
Java
false
false
504
java
package com.meganj.domain; public class Feline { private String sound; private int limbs; public Feline() { } public Feline(String sound, int limbs) { this.sound = sound; this.limbs = limbs; } public String getSound() { return sound; } public void setSound(String sound) { this.sound = sound; } public int getLimbs() { return limbs; } public void setLimbs(int limbs) { this.limbs = limbs; } }
[ "megan.jacobs@outlook.com" ]
megan.jacobs@outlook.com
6437ab9775775bf4e0e7769b368f5bc671a0117a
600b6ee48613da3f1de9966bf7c58bd392615bda
/src/main/java/com/example/one/java01/exception/ExceptionOpea.java
9283dd6a3a6f892f762b0f48643d52a64d466824
[]
no_license
tsuyoii/javaStudy
bae0f7b63d2309c8f8cc1e208faa0b00b17bcc79
c9a0d4ea56f2071cd4dda994dca04e293cff6921
refs/heads/master
2021-02-05T01:10:55.042453
2020-03-26T08:23:02
2020-03-26T08:23:02
243,725,699
0
0
null
null
null
null
UTF-8
Java
false
false
525
java
package com.example.one.java01.exception; //异常处理 public class ExceptionOpea { public static void main(String[] args){ // ExceptionOpea eo = new ExceptionOpea(); System.out.println(method()); } public static int method(){ try{ System.out.println("try"); return 1; }catch(Exception e){ System.out.println("catch"); return 2; }finally{ System.out.println("finally"); // return 3; } } }
[ "1132340305@qq.com" ]
1132340305@qq.com
fdb9e7197a61c659f86f0a1be20879bf4940e1e3
6b6eef23497e6dc6cce17701ae03250db71dad10
/src/com/pmirkelam/users/User.java
21e2e2210eff082440f1081e7b600b981b9374a5
[]
no_license
perihanmirkelam/HotelManagement
cfee9f1a7112269ae6e30674a577a4f8725e9eee
23b77e68e6467c715a41df4ace85c1487855139b
refs/heads/master
2021-04-26T23:21:13.843039
2018-03-10T19:12:05
2018-03-10T19:12:05
123,978,347
0
0
null
null
null
null
UTF-8
Java
false
false
582
java
package com.pmirkelam.users; import com.pmirkelam.BookingProcedure; import com.pmirkelam.Constants; import com.pmirkelam.record.RecordFile; import static com.pmirkelam.Constants.BOOK; import static com.pmirkelam.Constants.CANCEL_RESERVATION; public class User implements BookingProcedure { public User() { } @Override public void book(int guestId) { RecordFile.getInstance().addRecord(guestId, BOOK); } @Override public void cancelReservation(int guestId) { RecordFile.getInstance().addRecord(guestId, CANCEL_RESERVATION); } }
[ "perimirkelam@gmail.com" ]
perimirkelam@gmail.com
0786e8da55734c01040f1a4c94765f00f97fb59d
91b3a38f820011385ddfda470d9343ef1ab64ac1
/VamosAhoraSi/src/Uva12532.java
7b738ae45cefe82f1b8a038a4a4f4333360a7e3b
[]
no_license
pierreetienne/maraton
73a5cb02bc51bc5c83585e5a780c928240ca1a37
6f0895039ed3c7b44f539e86547f2fb895aa7ea1
refs/heads/master
2020-04-12T08:44:23.913857
2016-12-09T22:33:01
2016-12-09T22:33:01
4,435,823
0
0
null
null
null
null
UTF-8
Java
false
false
2,519
java
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class Uva12532 { static class SegmentTreeArray { int[] start, end, valores, A; int n; public SegmentTreeArray(int[] A) { this.A = A; n = A.length; start = new int[4*n]; end = new int[4*n]; valores = new int[4*n]; Arrays.fill(start, -1); initSegmentTree(); } void initSegmentTree(){ createTree(0, 0, n - 1); } void initNegativos(){ for(int i=0;i<A.length;++i){ if(A[i]<0)set(i, 1); } } void createTree(int node, int s, int e){ if (s>e) return; start[node] = s; end[node] = e; if (s==e){ return; } int mid = (s+e)/2; createTree(2 * node + 1, s, mid); createTree(2 * node + 2, mid + 1, e); } void set(int pos, int value){ set(pos, value, 0); } void set(int pos, int value, int node){ if (start[node] == -1 || start[node] > pos || end[node] < pos) return; if (start[node] == end[node]){ valores[node] = start[node]; return; } int mid = (start[node] + end[node]) / 2; if (pos <= mid) set(pos, value, 2 * node + 1); else set(pos, value, 2 * node + 2); funcionActualizacion( node ); } void funcionActualizacion(int node){ valores[node ] = valores[2 * node + 1] + valores[2 * node + 2] ; } int getPosMin(int low, int high){ return getPosMin(low, high, 0); } int getPosMin(int low, int high, int node){ if (start[node] == -1) return -1; if (low == start[node] && high == end[node]){ return valores[node]; } int mid = (start[node] + end[node]) / 2; if (high <= mid) return getPosMin(low, high, 2 * node + 1); if (low > mid) return getPosMin(low, high, 2 * node + 2); int p, q; p = getPosMin(low, mid, 2 * node + 1); q = getPosMin(mid + 1, high, 2 * node + 2); if ( A[p] < A[q]) return p; else return q; } } public static void main(String[] args)throws Exception { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); for(String linea;(linea = bf.readLine())!=null;){ StringTokenizer st = new StringTokenizer(linea); int[] A = new int[Integer.parseInt(st.nextToken())]; int N = Integer.parseInt(st.nextToken()); st = new StringTokenizer(bf.readLine()); for(int i=0;i<A.length;++i) A[i]=Integer.parseInt(st.nextToken()); SegmentTreeArray segNeg = new SegmentTreeArray(A); segNeg.initSegmentTree(); } } }
[ "pierre.pradere" ]
pierre.pradere
9f04a1179a14c2f422b014edced463c71dc0e5db
916750da9af5f1b59a48c51c87ba6986f33d2d1b
/citydo-system/src/main/java/cn/gingost/security/domain/OnlineUser.java
ed9b5b6cf4bfe6f34b23b25d03c412b1181789ab
[]
no_license
Ricardo1514/citydo_confluence_service
0469aec8ed31d897cc7689cf1ef97d8bf97f1f2c
1e37d0dcc9c603d9aaf81b29edebbab1379ae58c
refs/heads/master
2022-11-24T22:14:12.457640
2020-07-29T16:57:47
2020-07-29T16:57:47
283,690,555
0
0
null
2020-07-30T06:40:03
2020-07-30T06:40:02
null
UTF-8
Java
false
false
490
java
package cn.gingost.security.domain; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import java.util.Date; /** * @author:lezzy * @Date:2020/7/27 15:37 */ @Data @AllArgsConstructor @NoArgsConstructor public class OnlineUser { private String username; private String dept; private String job; private String browser; private String ip; private String address; private String key; private Date loginTime; }
[ "476935030@qq.com" ]
476935030@qq.com
0f41647af6a71dcb3751ed4291a56f3c9e055222
7b73756ba240202ea92f8f0c5c51c8343c0efa5f
/classes5/het.java
b2652997377e08e0e28ea1ebd16b13565c4c2a0a
[]
no_license
meeidol-luo/qooq
588a4ca6d8ad579b28dec66ec8084399fb0991ef
e723920ac555e99d5325b1d4024552383713c28d
refs/heads/master
2020-03-27T03:16:06.616300
2016-10-08T07:33:58
2016-10-08T07:33:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,618
java
import android.content.Intent; import android.text.TextUtils; import android.view.View; import com.tencent.biz.PoiMapActivity; import com.tencent.biz.PoiMapActivity.ShopListAdapter; import com.tencent.biz.PoiMapActivity.Shops; import com.tencent.biz.coupon.CouponActivity; import com.tencent.mobileqq.hotpatch.NotVerifyClass; import com.tencent.widget.AdapterView; import com.tencent.widget.AdapterView.OnItemClickListener; public class het implements AdapterView.OnItemClickListener { public het(PoiMapActivity paramPoiMapActivity) { boolean bool = NotVerifyClass.DO_VERIFY_CLASS; } public void a(AdapterView paramAdapterView, View paramView, int paramInt, long paramLong) { paramAdapterView = this.a.a.a(paramInt); if (paramAdapterView == null) { return; } paramView = new Intent(this.a, CouponActivity.class); paramView.putExtra("url", paramAdapterView.g); this.a.startActivity(paramView); if (!TextUtils.isEmpty(PoiMapActivity.a(this.a))) { this.a.a("rec_locate", "click_shangjia", paramAdapterView.h, "", "", ""); } for (;;) { if (paramAdapterView.b != 0) { this.a.a("rec_locate", "view_share_tuan", paramAdapterView.h, "", "", ""); } if (paramAdapterView.c == 0) { break; } this.a.a("rec_locate", "click_quan", paramAdapterView.h, "", "", ""); return; this.a.a("rec_locate", "click_near_food", paramAdapterView.h, "", "", ""); } } } /* Location: E:\apk\QQ_91\classes5-dex2jar.jar!\het.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "1776098770@qq.com" ]
1776098770@qq.com
d9f9b6210eacbd6a4b9e8bd66f49a28677d7f1a5
81719679e3d5945def9b7f3a6f638ee274f5d770
/aws-java-sdk-chime/src/main/java/com/amazonaws/services/chime/model/transform/InviteUsersResultJsonUnmarshaller.java
1dd64e5592033eff01628a5eb19211bdc3ff48a2
[ "Apache-2.0" ]
permissive
ZeevHayat1/aws-sdk-java
1e3351f2d3f44608fbd3ff987630b320b98dc55c
bd1a89e53384095bea869a4ea064ef0cf6ed7588
refs/heads/master
2022-04-10T14:18:43.276970
2020-03-07T12:15:44
2020-03-07T12:15:44
172,681,373
1
0
Apache-2.0
2019-02-26T09:36:47
2019-02-26T09:36:47
null
UTF-8
Java
false
false
2,796
java
/* * Copyright 2014-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.chime.model.transform; import java.math.*; import javax.annotation.Generated; import com.amazonaws.services.chime.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import com.fasterxml.jackson.core.JsonToken; import static com.fasterxml.jackson.core.JsonToken.*; /** * InviteUsersResult JSON Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class InviteUsersResultJsonUnmarshaller implements Unmarshaller<InviteUsersResult, JsonUnmarshallerContext> { public InviteUsersResult unmarshall(JsonUnmarshallerContext context) throws Exception { InviteUsersResult inviteUsersResult = new InviteUsersResult(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) { return inviteUsersResult; } while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("Invites", targetDepth)) { context.nextToken(); inviteUsersResult.setInvites(new ListUnmarshaller<Invite>(InviteJsonUnmarshaller.getInstance()).unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return inviteUsersResult; } private static InviteUsersResultJsonUnmarshaller instance; public static InviteUsersResultJsonUnmarshaller getInstance() { if (instance == null) instance = new InviteUsersResultJsonUnmarshaller(); return instance; } }
[ "" ]
25976783cb773759a4138a1c83da746eac9cc47c
559ea64c50ae629202d0a9a55e9a3d87e9ef2072
/com/cnmobi/im/bo/RecentRiderChangeListener.java
9e9fb5559eef1dfaec9b8de1c1a972b76859ebc7
[]
no_license
CrazyWolf2014/VehicleBus
07872bf3ab60756e956c75a2b9d8f71cd84e2bc9
450150fc3f4c7d5d7230e8012786e426f3ff1149
refs/heads/master
2021-01-03T07:59:26.796624
2016-06-10T22:04:02
2016-06-10T22:04:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
104
java
package com.cnmobi.im.bo; public interface RecentRiderChangeListener { void recentRiderChange(); }
[ "ahhmedd16@hotmail.com" ]
ahhmedd16@hotmail.com
67fb41620a5f61c7fc5f9b7999761a065a1c938a
20eb62855cb3962c2d36fda4377dfd47d82eb777
/newEvaluatedBugs/Jsoup_49_buggy/mutated/143/TreeBuilderState.java
d0b7507273c79b4c7df4b6b831a8512186b01d8b
[]
no_license
ozzydong/CapGen
356746618848065cce4e253e5d3c381baa85044a
0ba0321b6b1191443276021f1997833342f02515
refs/heads/master
2023-03-18T20:12:02.923428
2020-08-21T03:08:28
2020-08-21T03:08:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
68,101
java
package org.jsoup.parser; import org.jsoup.helper.DescendableLinkedList; import org.jsoup.helper.StringUtil; import org.jsoup.nodes.*; import java.util.Iterator; import java.util.LinkedList; /** * The Tree Builder's current state. Each state embodies the processing for the state, and transitions to other states. */ enum TreeBuilderState { Initial { boolean process(Token t, TreeBuilder tb) { if (isWhitespace(t)) { return true; // ignore whitespace } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { // todo: parse error check on expected doctypes // todo: quirk state check on doctype ids Token.Doctype d = t.asDoctype(); DocumentType doctype = new DocumentType(d.getName(), d.getPublicIdentifier(), d.getSystemIdentifier(), tb.getBaseUri()); tb.getDocument().appendChild(doctype); if (d.isForceQuirks()) tb.getDocument().quirksMode(Document.QuirksMode.quirks); tb.transition(BeforeHtml); } else { // todo: check not iframe srcdoc tb.transition(BeforeHtml); return tb.process(t); // re-process token } return true; } }, BeforeHtml { boolean process(Token t, TreeBuilder tb) { if (t.isDoctype()) { tb.error(this); return false; } else if (t.isComment()) { tb.insert(t.asComment()); } else if (isWhitespace(t)) { return true; // ignore whitespace } else if (t.isStartTag() && t.asStartTag().name().equals("html")) { tb.insert(t.asStartTag()); tb.transition(BeforeHead); } else if (t.isEndTag() && (StringUtil.in(t.asEndTag().name(), "head", "body", "html", "br"))) { return anythingElse(t, tb); } else if (t.isEndTag()) { tb.error(this); return false; } else { return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, TreeBuilder tb) { tb.insert("html"); tb.transition(BeforeHead); return tb.process(t); } }, BeforeHead { boolean process(Token t, TreeBuilder tb) { if (isWhitespace(t)) { return true; } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { tb.error(this); return false; } else if (t.isStartTag() && t.asStartTag().name().equals("html")) { return InBody.process(t, tb); // does not transition } else if (t.isStartTag() && t.asStartTag().name().equals("head")) { Element head = tb.insert(t.asStartTag()); tb.setHeadElement(head); tb.transition(InHead); } else if (t.isEndTag() && (StringUtil.in(t.asEndTag().name(), "head", "body", "html", "br"))) { tb.process(new Token.StartTag("head")); return tb.process(t); } else if (t.isEndTag()) { tb.error(this); return false; } else { tb.process(new Token.StartTag("head")); return tb.process(t); } return true; } }, InHead { boolean process(Token t, TreeBuilder tb) { if (isWhitespace(t)) { tb.insert(t.asCharacter()); return true; } switch (t.type) { case Comment: tb.insert(t.asComment()); break; case Doctype: tb.error(this); return false; case StartTag: Token.StartTag start = t.asStartTag(); String name = start.name(); if (name.equals("html")) { return InBody.process(t, tb); } else if (StringUtil.in(name, "base", "basefont", "bgsound", "command", "link")) { Element el = tb.insertEmpty(start); // jsoup special: update base as it is seen. todo: flip to current browser behaviour of one shot if (name.equals("base") && el.hasAttr("href")) tb.setBaseUri(el); } else if (name.equals("meta")) { Element meta = tb.insertEmpty(start); // todo: charset switches } else if (name.equals("title")) { handleRcData(start, tb); } else if (StringUtil.in(name, "noframes", "style")) { handleRawtext(start, tb); } else if (name.equals("noscript")) { // else if noscript && scripting flag = true: rawtext (jsoup doesn't run script, to handle as noscript) tb.insert(start); tb.transition(InHeadNoscript); } else if (name.equals("script")) { // skips some script rules as won't execute them tb.insert(start); tb.tokeniser.transition(TokeniserState.ScriptData); tb.markInsertionMode(); tb.transition(Text); } else if (name.equals("head")) { tb.error(this); return false; } else { return anythingElse(t, tb); } break; case EndTag: Token.EndTag end = t.asEndTag(); name = end.name(); if (name.equals("head")) { tb.pop(); tb.transition(AfterHead); } else if (StringUtil.in(name, "body", "html", "br")) { return anythingElse(t, tb); } else { tb.error(this); return false; } break; default: return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, TreeBuilder tb) { tb.process(new Token.EndTag("head")); return tb.process(t); } }, InHeadNoscript { boolean process(Token t, TreeBuilder tb) { if (t.isDoctype()) { tb.error(this); } else if (t.isStartTag() && t.asStartTag().name().equals("html")) { return tb.process(t, InBody); } else if (t.isEndTag() && t.asEndTag().name().equals("noscript")) { tb.pop(); tb.transition(InHead); } else if (isWhitespace(t) || t.isComment() || (t.isStartTag() && StringUtil.in(t.asStartTag().name(), "basefont", "bgsound", "link", "meta", "noframes", "style"))) { return tb.process(t, InHead); } else if (t.isEndTag() && t.asEndTag().name().equals("br")) { return anythingElse(t, tb); } else if ((t.isStartTag() && StringUtil.in(t.asStartTag().name(), "head", "noscript")) || t.isEndTag()) { tb.error(this); return false; } else { return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, TreeBuilder tb) { tb.error(this); tb.process(new Token.EndTag("noscript")); return tb.process(t); } }, AfterHead { boolean process(Token t, TreeBuilder tb) { if (isWhitespace(t)) { tb.insert(t.asCharacter()); } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { tb.error(this); } else if (t.isStartTag()) { Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (name.equals("html")) { return tb.process(t, InBody); } else if (name.equals("body")) { tb.insert(startTag); tb.framesetOk(false); tb.transition(InBody); } else if (name.equals("frameset")) { tb.insert(startTag); tb.transition(InFrameset); } else if (StringUtil.in(name, "base", "basefont", "bgsound", "link", "meta", "noframes", "script", "style", "title")) { tb.error(this); Element head = tb.getHeadElement(); tb.push(head); tb.process(t, InHead); tb.removeFromStack(head); } else if (name.equals("head")) { tb.error(this); return false; } else { anythingElse(t, tb); } } else if (t.isEndTag()) { if (StringUtil.in(t.asEndTag().name(), "body", "html")) { anythingElse(t, tb); } else { tb.error(this); return false; } } else { anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, TreeBuilder tb) { tb.process(new Token.StartTag("body")); tb.framesetOk(true); return tb.process(t); } }, InBody { boolean process(Token t, TreeBuilder tb) { switch (t.type) { case Character: { Token.Character c = t.asCharacter(); if (c.getData().equals(nullString)) { // todo confirm that check tb.error(this); return false; } else if (isWhitespace(c)) { tb.reconstructFormattingElements(); tb.insert(c); } else { tb.reconstructFormattingElements(); tb.insert(c); tb.framesetOk(false); } break; } case Comment: { tb.insert(t.asComment()); break; } case Doctype: { tb.error(this); return false; } case StartTag: Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (name.equals("html")) { tb.error(this); // merge attributes onto real html Element html = tb.getStack().getFirst(); for (Attribute attribute : startTag.getAttributes()) { if (!html.hasAttr(attribute.getKey())) html.attributes().put(attribute); } } else if (StringUtil.in(name, "base", "basefont", "bgsound", "command", "link", "meta", "noframes", "script", "style", "title")) { return tb.process(t, InHead); } else if (name.equals("body")) { tb.error(this); LinkedList<Element> stack = tb.getStack(); if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals("body"))) { // only in fragment case return false; // ignore } else { tb.framesetOk(false); Element body = stack.get(1); for (Attribute attribute : startTag.getAttributes()) { if (!body.hasAttr(attribute.getKey())) body.attributes().put(attribute); } } } else if (name.equals("frameset")) { tb.error(this); LinkedList<Element> stack = tb.getStack(); if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals("body"))) { // only in fragment case return false; // ignore } else if (!tb.framesetOk()) { return false; // ignore frameset } else { Element second = stack.get(1); if (second.parent() != null) second.remove(); // pop up to html element while (stack.size() > 1) stack.removeLast(); tb.insert(startTag); tb.transition(InFrameset); } } else if (StringUtil.in(name, "address", "article", "aside", "blockquote", "center", "details", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "menu", "nav", "ol", "p", "section", "summary", "ul")) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); } else if (StringUtil.in(name, "h1", "h2", "h3", "h4", "h5", "h6")) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } if (StringUtil.in(tb.currentElement().nodeName(), "h1", "h2", "h3", "h4", "h5", "h6")) { tb.error(this); tb.pop(); } tb.insert(startTag); } else if (StringUtil.in(name, "pre", "listing")) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); // todo: ignore LF if next token tb.framesetOk(false); } else if (name.equals("form")) { if (tb.getFormElement() != null) { tb.error(this); return false; } if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } Element form = tb.insert(startTag); tb.setFormElement(form); } else if (name.equals("li")) { tb.framesetOk(false); LinkedList<Element> stack = tb.getStack(); for (int i = stack.size() - 1; i > 0; i--) { Element el = stack.get(i); if (el.nodeName().equals("li")) { tb.process(new Token.EndTag("li")); break; } if (tb.isSpecial(el) && !StringUtil.in(el.nodeName(), "address", "div", "p")) break; } if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); } else if (StringUtil.in(name, "dd", "dt")) { tb.framesetOk(false); LinkedList<Element> stack = tb.getStack(); for (int i = stack.size() - 1; i > 0; i--) { Element el = stack.get(i); if (StringUtil.in(el.nodeName(), "dd", "dt")) { tb.process(new Token.EndTag(el.nodeName())); break; } if (tb.isSpecial(el) && !StringUtil.in(el.nodeName(), "address", "div", "p")) break; } if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); } else if (name.equals("plaintext")) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); tb.tokeniser.transition(TokeniserState.PLAINTEXT); // once in, never gets out } else if (name.equals("button")) { if (tb.inButtonScope("button")) { // close and reprocess tb.error(this); tb.process(new Token.EndTag("button")); tb.process(startTag); } else { tb.reconstructFormattingElements(); tb.insert(startTag); tb.framesetOk(false); } } else if (name.equals("a")) { if (tb.getActiveFormattingElement("a") != null) { tb.error(this); tb.process(new Token.EndTag("a")); // still on stack? Element remainingA = tb.getFromStack("a"); if (remainingA != null) { tb.removeFromActiveFormattingElements(remainingA); tb.removeFromStack(remainingA); } } tb.reconstructFormattingElements(); Element a = tb.insert(startTag); tb.pushActiveFormattingElements(a); } else if (StringUtil.in(name, "b", "big", "code", "em", "font", "i", "s", "small", "strike", "strong", "tt", "u")) { tb.reconstructFormattingElements(); Element el = tb.insert(startTag); tb.pushActiveFormattingElements(el); } else if (name.equals("nobr")) { tb.reconstructFormattingElements(); if (tb.inScope("nobr")) { tb.error(this); tb.process(new Token.EndTag("nobr")); tb.reconstructFormattingElements(); } Element el = tb.insert(startTag); tb.pushActiveFormattingElements(el); } else if (StringUtil.in(name, "applet", "marquee", "object")) { tb.reconstructFormattingElements(); tb.insert(startTag); tb.insertMarkerToFormattingElements(); tb.framesetOk(false); } else if (name.equals("table")) { if (tb.getDocument().quirksMode() != Document.QuirksMode.quirks && tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); tb.framesetOk(false); tb.transition(InTable); } else if (StringUtil.in(name, "area", "br", "embed", "img", "keygen", "wbr")) { tb.reconstructFormattingElements(); tb.insertEmpty(startTag); tb.framesetOk(false); } else if (name.equals("input")) { tb.reconstructFormattingElements(); Element el = tb.insertEmpty(startTag); if (!el.attr("type").equalsIgnoreCase("hidden")) tb.framesetOk(false); } else if (StringUtil.in(name, "param", "source", "track")) { tb.insertEmpty(startTag); } else if (name.equals("hr")) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insertEmpty(startTag); tb.framesetOk(false); } else if (name.equals("image")) { // we're not supposed to ask. startTag.name("img"); return tb.process(startTag); } else if (name.equals("isindex")) { // how much do we care about the early 90s? tb.error(this); if (tb.getFormElement() != null) return false; tb.tokeniser.acknowledgeSelfClosingFlag(); tb.process(new Token.StartTag("form")); if (startTag.attributes.hasKey("action")) { Element form = tb.getFormElement(); form.attr("action", startTag.attributes.get("action")); } tb.process(new Token.StartTag("hr")); tb.process(new Token.StartTag("label")); // hope you like english. String prompt = startTag.attributes.hasKey("prompt") ? startTag.attributes.get("prompt") : "This is a searchable index. Enter search keywords: "; tb.process(new Token.Character(prompt)); // input Attributes inputAttribs = new Attributes(); for (Attribute attr : startTag.attributes) { if (!StringUtil.in(attr.getKey(), "name", "action", "prompt")) inputAttribs.put(attr); } inputAttribs.put("name", "isindex"); tb.process(new Token.StartTag("input", inputAttribs)); tb.process(new Token.EndTag("label")); tb.process(new Token.StartTag("hr")); tb.process(new Token.EndTag("form")); } else if (name.equals("textarea")) { tb.insert(startTag); // todo: If the next token is a U+000A LINE FEED (LF) character token, then ignore that token and move on to the next one. (Newlines at the start of textarea elements are ignored as an authoring convenience.) tb.tokeniser.transition(TokeniserState.Rcdata); tb.markInsertionMode(); tb.framesetOk(false); tb.transition(Text); } else if (name.equals("xmp")) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.reconstructFormattingElements(); tb.framesetOk(false); handleRawtext(startTag, tb); } else if (name.equals("iframe")) { tb.framesetOk(false); handleRawtext(startTag, tb); } else if (name.equals("noembed")) { // also handle noscript if script enabled handleRawtext(startTag, tb); } else if (name.equals("select")) { tb.reconstructFormattingElements(); tb.insert(startTag); tb.framesetOk(false); TreeBuilderState state = tb.state(); if (state.equals(InTable) || state.equals(InCaption) || state.equals(InTableBody) || state.equals(InRow) || state.equals(InCell)) tb.transition(InSelectInTable); else tb.transition(InSelect); } else if (StringUtil.in("optgroup", "option")) { if (tb.currentElement().nodeName().equals("option")) tb.process(new Token.EndTag("option")); tb.reconstructFormattingElements(); tb.insert(startTag); } else if (StringUtil.in("rp", "rt")) { if (tb.inScope("ruby")) { tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals("ruby")) { tb.error(this); tb.popStackToBefore("ruby"); // i.e. close up to but not include name } tb.insert(startTag); } } else if (name.equals("math")) { tb.reconstructFormattingElements(); // todo: handle A start tag whose tag name is "math" (i.e. foreign, mathml) tb.insert(startTag); tb.tokeniser.acknowledgeSelfClosingFlag(); } else if (name.equals("svg")) { tb.reconstructFormattingElements(); // todo: handle A start tag whose tag name is "svg" (xlink, svg) tb.insert(startTag); tb.tokeniser.acknowledgeSelfClosingFlag(); } else if (StringUtil.in(name, "caption", "col", "colgroup", "frame", "head", "tbody", "td", "tfoot", "th", "thead", "tr")) { tb.error(this); return false; } else { tb.reconstructFormattingElements(); tb.insert(startTag); } break; case EndTag: Token.EndTag endTag = t.asEndTag(); name = endTag.name(); if (name.equals("body")) { if (!tb.inScope("body")) { tb.error(this); return false; } else { // todo: error if stack contains something not dd, dt, li, optgroup, option, p, rp, rt, tbody, td, tfoot, th, thead, tr, body, html tb.transition(AfterBody); } } else if (name.equals("html")) { boolean notIgnored = tb.process(new Token.EndTag("body")); if (notIgnored) return tb.process(endTag); } else if (StringUtil.in(name, "address", "article", "aside", "blockquote", "button", "center", "details", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "listing", "menu", "nav", "ol", "pre", "section", "summary", "ul")) { // todo: refactor these lookups if (!tb.inScope(name)) { // nothing to close tb.error(this); return false; } else { tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); } } else if (name.equals("form")) { Element currentForm = tb.getFormElement(); tb.setFormElement(null); if (currentForm == null || !tb.inScope(name)) { tb.error(this); return false; } else { tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); // remove currentForm from stack. will shift anything under up. tb.removeFromStack(currentForm); } } else if (name.equals("p")) { if (!tb.inButtonScope(name)) { tb.error(this); tb.process(new Token.StartTag(name)); // if no p to close, creates an empty <p></p> return tb.process(endTag); } else { tb.generateImpliedEndTags(name); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); } } else if (name.equals("li")) { if (!tb.inListItemScope(name)) { tb.error(this); return false; } else { tb.generateImpliedEndTags(name); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); } } else if (StringUtil.in(name, "dd", "dt")) { if (!tb.inScope(name)) { tb.error(this); return false; } else { tb.generateImpliedEndTags(name); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); } } else if (StringUtil.in(name, "h1", "h2", "h3", "h4", "h5", "h6")) { if (!tb.inScope(new String[]{"h1", "h2", "h3", "h4", "h5", "h6"})) { tb.error(this); return false; } else { tb.generateImpliedEndTags(name); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose("h1", "h2", "h3", "h4", "h5", "h6"); } } else if (name.equals("sarcasm")) { // *sigh* return anyOtherEndTag(t, tb); } else if (StringUtil.in(name, "a", "b", "big", "code", "em", "font", "i", "nobr", "s", "small", "strike", "strong", "tt", "u")) { // Adoption Agency Algorithm. OUTER: for (int i = 0; i < 8; i++) { Element formatEl = tb.getActiveFormattingElement(name); if (formatEl == null) return anyOtherEndTag(t, tb); else if (!tb.onStack(formatEl)) { tb.error(this); tb.removeFromActiveFormattingElements(formatEl); return true; } else if (!tb.inScope(formatEl.nodeName())) { tb.error(this); return false; } else if (tb.currentElement() != formatEl) tb.error(this); Element furthestBlock = null; Element commonAncestor = null; boolean seenFormattingElement = false; LinkedList<Element> stack = tb.getStack(); for (int si = 0; si < stack.size(); si++) { Element el = stack.get(si); if (el == formatEl) { commonAncestor = stack.get(si - 1); seenFormattingElement = true; } else if (seenFormattingElement && tb.isSpecial(el)) { furthestBlock = el; break; } } if (furthestBlock == null) { tb.popStackToClose(formatEl.nodeName()); tb.removeFromActiveFormattingElements(formatEl); return true; } // todo: Let a bookmark note the position of the formatting element in the list of active formatting elements relative to the elements on either side of it in the list. // does that mean: int pos of format el in list? Element node = furthestBlock; Element lastNode = furthestBlock; INNER: for (int j = 0; j < 3; j++) { if (tb.onStack(node)) node = tb.aboveOnStack(node); if (!tb.isInActiveFormattingElements(node)) { // note no bookmark check tb.removeFromStack(node); continue INNER; } else if (node == formatEl) break INNER; Element replacement = new Element(Tag.valueOf(node.nodeName()), tb.getBaseUri()); tb.replaceActiveFormattingElement(node, replacement); tb.replaceOnStack(node, replacement); node = replacement; if (lastNode == furthestBlock) { // todo: move the aforementioned bookmark to be immediately after the new node in the list of active formatting elements. // not getting how this bookmark both straddles the element above, but is inbetween here... } if (lastNode.parent() != null) lastNode.remove(); node.appendChild(lastNode); lastNode = node; } if (StringUtil.in(commonAncestor.nodeName(), "table", "tbody", "tfoot", "thead", "tr")) { if (lastNode.parent() != null) lastNode.remove(); tb.insertInFosterParent(lastNode); } else { if (lastNode.parent() != null) lastNode.remove(); commonAncestor.appendChild(lastNode); } Element adopter = new Element(Tag.valueOf(name), tb.getBaseUri()); Node[] childNodes = furthestBlock.childNodes().toArray(new Node[furthestBlock.childNodes().size()]); for (Node childNode : childNodes) { adopter.appendChild(childNode); // append will reparent. thus the clone to avvoid concurrent mod. } furthestBlock.appendChild(adopter); tb.removeFromActiveFormattingElements(formatEl); // todo: insert the new element into the list of active formatting elements at the position of the aforementioned bookmark. tb.removeFromStack(formatEl); tb.insertOnStackAfter(furthestBlock, adopter); } } else if (StringUtil.in(name, "applet", "marquee", "object")) { if (!tb.inScope("name")) { if (!tb.inScope(name)) { tb.error(this); return false; } tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); tb.clearFormattingElementsToLastMarker(); } } else if (name.equals("br")) { tb.error(this); tb.process(new Token.StartTag("br")); return false; } else { return anyOtherEndTag(t, tb); } break; case EOF: // todo: error if stack contains something not dd, dt, li, p, tbody, td, tfoot, th, thead, tr, body, html // stop parsing break; } return true; } boolean anyOtherEndTag(Token t, TreeBuilder tb) { String name = t.asEndTag().name(); DescendableLinkedList<Element> stack = tb.getStack(); Iterator<Element> it = stack.descendingIterator(); while (it.hasNext()) { Element node = it.next(); if (node.nodeName().equals(name)) { tb.generateImpliedEndTags(name); if (!name.equals(tb.currentElement().nodeName())) tb.error(this); tb.popStackToClose(name); break; } else { if (tb.isSpecial(node)) { tb.error(this); return false; } } } return true; } }, Text { // in script, style etc. normally treated as data tags boolean process(Token t, TreeBuilder tb) { if (t.isCharacter()) { tb.insert(t.asCharacter()); } else if (t.isEOF()) { tb.error(this); // if current node is script: already started tb.pop(); tb.transition(tb.originalState()); return tb.process(t); } else if (t.isEndTag()) { // if: An end tag whose tag name is "script" -- scripting nesting level, if evaluating scripts tb.pop(); tb.transition(tb.originalState()); } return true; } }, InTable { boolean process(Token t, TreeBuilder tb) { if (t.isCharacter()) { tb.newPendingTableCharacters(); tb.markInsertionMode(); tb.transition(InTableText); return tb.process(t); } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { tb.error(this); return false; } else if (t.isStartTag()) { Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (name.equals("caption")) { tb.clearStackToTableContext(); tb.insertMarkerToFormattingElements(); tb.insert(startTag); tb.transition(InCaption); } else if (name.equals("colgroup")) { tb.clearStackToTableContext(); tb.insert(startTag); tb.transition(InColumnGroup); } else if (name.equals("col")) { tb.process(new Token.StartTag("colgroup")); return tb.process(t); } else if (StringUtil.in(name, "tbody", "tfoot", "thead")) { tb.clearStackToTableContext(); tb.insert(startTag); tb.transition(InTableBody); } else if (StringUtil.in(name, "td", "th", "tr")) { tb.process(new Token.StartTag("tbody")); return tb.process(t); } else if (name.equals("table")) { tb.error(this); boolean processed = tb.process(new Token.EndTag("table")); if (processed) // only ignored if in fragment return tb.process(t); } else if (StringUtil.in(name, "style", "script")) { return tb.process(t, InHead); } else if (name.equals("input")) { if (!startTag.attributes.get("type").equalsIgnoreCase("hidden")) { return anythingElse(t, tb); } else { tb.insertEmpty(startTag); } } else if (name.equals("form")) { tb.error(this); if (tb.getFormElement() != null) return false; else { Element form = tb.insertEmpty(startTag); tb.setFormElement(form); } } else { return anythingElse(t, tb); } } else if (t.isEndTag()) { Token.EndTag endTag = t.asEndTag(); String name = endTag.name(); if (name.equals("table")) { if (!tb.inTableScope(name)) { tb.error(this); return false; } else { tb.popStackToClose("table"); } tb.resetInsertionMode(); } else if (StringUtil.in(name, "body", "caption", "col", "colgroup", "html", "tbody", "td", "tfoot", "th", "thead", "tr")) { tb.error(this); return false; } else { return anythingElse(t, tb); } } else if (t.isEOF()) { if (tb.currentElement().nodeName().equals("html")) tb.error(this); return true; // stops parsing } return anythingElse(t, tb); } boolean anythingElse(Token t, TreeBuilder tb) { tb.error(this); boolean processed = true; if (StringUtil.in(tb.currentElement().nodeName(), "table", "tbody", "tfoot", "thead", "tr")) { tb.setFosterInserts(true); processed = tb.process(t, InBody); tb.setFosterInserts(false); } else { processed = tb.process(t, InBody); } return processed; } }, InTableText { boolean process(Token t, TreeBuilder tb) { switch (t.type) { case Character: Token.Character c = t.asCharacter(); if (c.getData().equals(nullString)) { tb.error(this); return false; } else { tb.getPendingTableCharacters().add(c); } break; default: if (tb.getPendingTableCharacters().size() > 0) { for (Token.Character character : tb.getPendingTableCharacters()) { if (!isWhitespace(character)) { // InTable anything else section: tb.error(this); if (StringUtil.in(tb.currentElement().nodeName(), "table", "tbody", "tfoot", "thead", "tr")) { tb.setFosterInserts(true); tb.process(character, InBody); tb.setFosterInserts(false); } else { tb.process(character, InBody); } } else tb.insert(character); } tb.newPendingTableCharacters(); } tb.transition(tb.originalState()); return tb.process(t); } return true; } }, InCaption { boolean process(Token t, TreeBuilder tb) { if (t.isEndTag() && t.asEndTag().name().equals("caption")) { Token.EndTag endTag = t.asEndTag(); String name = endTag.name(); if (!tb.inTableScope(name)) { tb.error(this); return false; } else { tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals("caption")) tb.error(this); tb.popStackToClose("caption"); tb.clearFormattingElementsToLastMarker(); tb.transition(InTable); } } else if (( t.isStartTag() && StringUtil.in(t.asStartTag().name(), "caption", "col", "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr") || t.isEndTag() && t.asEndTag().name().equals("table")) ) { tb.error(this); boolean processed = tb.process(new Token.EndTag("caption")); if (processed) return tb.process(t); } else if (t.isEndTag() && StringUtil.in(t.asEndTag().name(), "body", "col", "colgroup", "html", "tbody", "td", "tfoot", "th", "thead", "tr")) { tb.error(this); return false; } else { return tb.process(t, InBody); } return true; } }, InColumnGroup { boolean process(Token t, TreeBuilder tb) { if (isWhitespace(t)) { tb.insert(t.asCharacter()); return true; } switch (t.type) { case Comment: tb.insert(t.asComment()); break; case Doctype: tb.error(this); break; case StartTag: Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (name.equals("html")) return tb.process(t, InBody); else if (name.equals("col")) tb.insertEmpty(startTag); else return anythingElse(t, tb); break; case EndTag: Token.EndTag endTag = t.asEndTag(); name = endTag.name(); if (name.equals("colgroup")) { if (tb.currentElement().nodeName().equals("html")) { // frag case tb.error(this); return false; } else { tb.pop(); tb.transition(InTable); } } else return anythingElse(t, tb); break; case EOF: if (tb.currentElement().nodeName().equals("html")) return true; // stop parsing; frag case else return anythingElse(t, tb); default: return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, TreeBuilder tb) { boolean processed = tb.process(new Token.EndTag("colgroup")); if (processed) // only ignored in frag case return tb.process(t); return true; } }, InTableBody { boolean process(Token t, TreeBuilder tb) { switch (t.type) { case StartTag: Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (name.equals("tr")) { tb.clearStackToTableBodyContext(); tb.insert(startTag); tb.transition(InRow); } else if (StringUtil.in(name, "th", "td")) { tb.error(this); tb.process(new Token.StartTag("tr")); return tb.process(startTag); } else if (StringUtil.in(name, "caption", "col", "colgroup", "tbody", "tfoot", "thead")) { return exitTableBody(t, tb); } else return anythingElse(t, tb); break; case EndTag: Token.EndTag endTag = t.asEndTag(); name = endTag.name(); if (StringUtil.in(name, "tbody", "tfoot", "thead")) { if (!tb.inTableScope(name)) { tb.error(this); return false; } else { tb.clearStackToTableBodyContext(); tb.pop(); tb.transition(InTable); } } else if (name.equals("table")) { return exitTableBody(t, tb); } else if (StringUtil.in(name, "body", "caption", "col", "colgroup", "html", "td", "th", "tr")) { tb.error(this); return false; } else return anythingElse(t, tb); break; default: return anythingElse(t, tb); } return true; } private boolean exitTableBody(Token t, TreeBuilder tb) { if (!(tb.inTableScope("tbody") || tb.inTableScope("thead") || tb.inScope("tfoot"))) { // frag case tb.error(this); return false; } tb.clearStackToTableBodyContext(); tb.process(new Token.EndTag(tb.currentElement().nodeName())); // tbody, tfoot, thead return tb.process(t); } private boolean anythingElse(Token t, TreeBuilder tb) { return tb.process(t, InTable); } }, InRow { boolean process(Token t, TreeBuilder tb) { if (t.isStartTag()) { Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (StringUtil.in(name, "th", "td")) { tb.clearStackToTableRowContext(); tb.insert(startTag); tb.transition(InCell); tb.insertMarkerToFormattingElements(); } else if (StringUtil.in(name, "caption", "col", "colgroup", "tbody", "tfoot", "thead", "tr")) { return handleMissingTr(t, tb); } else { return anythingElse(t, tb); } } else if (t.isEndTag()) { Token.EndTag endTag = t.asEndTag(); String name = endTag.name(); if (name.equals("tr")) { if (!tb.inTableScope(name)) { tb.error(this); // frag return false; } tb.clearStackToTableRowContext(); tb.pop(); // tr tb.transition(InTableBody); } else if (name.equals("table")) { return handleMissingTr(t, tb); } else if (StringUtil.in(name, "tbody", "tfoot", "thead")) { if (!tb.inTableScope(name)) { tb.error(this); return false; } tb.process(new Token.EndTag("tr")); return tb.process(t); } else if (StringUtil.in(name, "body", "caption", "col", "colgroup", "html", "td", "th")) { tb.error(this); return false; } else { return anythingElse(t, tb); } } else { return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, TreeBuilder tb) { return tb.process(t, InTable); } private boolean handleMissingTr(Token t, TreeBuilder tb) { boolean processed = tb.process(new Token.EndTag("tr")); if (processed) return tb.process(t); else return false; } }, InCell { boolean process(Token t, TreeBuilder tb) { if (t.isEndTag()) { Token.EndTag endTag = t.asEndTag(); String name = endTag.name(); if (StringUtil.in(name, "td", "th")) { if (!tb.inTableScope(name)) { tb.error(this); tb.transition(InRow); // might not be in scope if empty: <td /> and processing fake end tag return false; } tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); tb.clearFormattingElementsToLastMarker(); tb.transition(InRow); } else if (StringUtil.in(name, "body", "caption", "col", "colgroup", "html")) { tb.error(this); return false; } else if (StringUtil.in(name, "table", "tbody", "tfoot", "thead", "tr")) { if (!tb.inTableScope(name)) { tb.error(this); return false; } closeCell(tb); return tb.process(t); } else { return anythingElse(t, tb); } } else if (t.isStartTag() && StringUtil.in(t.asStartTag().name(), "caption", "col", "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr")) { if (!(tb.inTableScope("td") || tb.inTableScope("th"))) { tb.error(this); return false; } closeCell(tb); return tb.process(t); } else { return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, TreeBuilder tb) { return tb.process(t, InBody); } private void closeCell(TreeBuilder tb) { if (tb.inTableScope("td")) tb.process(new Token.EndTag("td")); else tb.process(new Token.EndTag("th")); // only here if th or td in scope } }, InSelect { boolean process(Token t, TreeBuilder tb) { switch (t.type) { case Character: Token.Character c = t.asCharacter(); if (c.getData().equals(nullString)) { tb.error(this); return false; } else { tb.insert(c); } break; case Comment: tb.insert(t.asComment()); break; case Doctype: tb.error(this); return false; case StartTag: Token.StartTag start = t.asStartTag(); String name = start.name(); if (name.equals("html")) return tb.process(start, InBody); else if (name.equals("option")) { tb.process(new Token.EndTag("option")); tb.insert(start); } else if (name.equals("optgroup")) { if (tb.currentElement().nodeName().equals("option")) tb.process(new Token.EndTag("option")); else if (tb.currentElement().nodeName().equals("optgroup")) tb.process(new Token.EndTag("optgroup")); tb.insert(start); } else if (name.equals("select")) { tb.error(this); return tb.process(new Token.EndTag("select")); } else if (StringUtil.in(name, "input", "keygen", "textarea")) { tb.error(this); if (!tb.inSelectScope("select")) return false; // frag tb.process(new Token.EndTag("select")); return tb.process(start); } else if (name.equals("script")) { return tb.process(t, InHead); } else { return anythingElse(t, tb); } break; case EndTag: Token.EndTag end = t.asEndTag(); name = end.name(); if (name.equals("optgroup")) { if (tb.currentElement().nodeName().equals("option") && tb.aboveOnStack(tb.currentElement()) != null && tb.aboveOnStack(tb.currentElement()).nodeName().equals("optgroup")) tb.process(new Token.EndTag("option")); if (tb.currentElement().nodeName().equals("optgroup")) tb.pop(); else tb.error(this); } else if (name.equals("option")) { if (tb.currentElement().nodeName().equals("option")) tb.pop(); else tb.error(this); } else if (name.equals("select")) { if (!tb.inSelectScope(name)) { tb.error(this); return false; } else { tb.popStackToClose(name); tb.resetInsertionMode(); } } else return anythingElse(t, tb); break; case EOF: if (!tb.currentElement().nodeName().equals("html")) tb.error(this); break; default: return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, TreeBuilder tb) { tb.error(this); return false; } }, InSelectInTable { boolean process(Token t, TreeBuilder tb) { if (t.isStartTag() && StringUtil.in(t.asStartTag().name(), "caption", "table", "tbody", "tfoot", "thead", "tr", "td", "th")) { tb.error(this); tb.process(new Token.EndTag("select")); return tb.process(t); } else if (t.isEndTag() && StringUtil.in(t.asEndTag().name(), "caption", "table", "tbody", "tfoot", "thead", "tr", "td", "th")) { tb.error(this); if (tb.inTableScope(t.asEndTag().name())) { tb.process(new Token.EndTag("select")); return (tb.process(t)); } else return false; } else { return tb.process(t, InSelect); } } }, AfterBody { boolean process(Token t, TreeBuilder tb) { if (isWhitespace(t)) { return tb.process(t, InBody); } else if (t.isComment()) { tb.insert(t.asComment()); // into html node } else if (t.isDoctype()) { tb.error(this); return false; } else if (t.isStartTag() && t.asStartTag().name().equals("html")) { return tb.process(t, InBody); } else if (t.isEndTag() && t.asEndTag().name().equals("html")) { if (tb.isFragmentParsing()) { tb.error(this); return false; } else { tb.transition(AfterAfterBody); } } else if (t.isEOF()) { // chillax! we're done } else { tb.error(this); tb.transition(InBody); return tb.process(t); } return true; } }, InFrameset { boolean process(Token t, TreeBuilder tb) { if (isWhitespace(t)) { tb.insert(t.asCharacter()); } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { tb.error(this); return false; } else if (t.isStartTag()) { Token.StartTag start = t.asStartTag(); String name = start.name(); if (name.equals("html")) { return tb.process(start, InBody); } else if (name.equals("frameset")) { tb.insert(start); } else if (name.equals("frame")) { tb.insertEmpty(start); } else if (name.equals("noframes")) { return tb.process(start, InHead); } else { tb.error(this); return false; } } else if (t.isEndTag() && t.asEndTag().name().equals("frameset")) { if (tb.currentElement().nodeName().equals("html")) { // frag tb.error(this); return false; } else { tb.pop(); if (!tb.isFragmentParsing() && !tb.currentElement().nodeName().equals("frameset")) { tb.transition(AfterFrameset); } } } else if (t.isEOF()) { if (!tb.currentElement().nodeName().equals("html")) { tb.error(this); return true; } } else { tb.error(this); return false; } return true; } }, AfterFrameset { boolean process(Token t, TreeBuilder tb) { if (isWhitespace(t)) { tb.insert(t.asCharacter()); } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { tb.error(this); return false; } else if (t.isStartTag() && t.asStartTag().name().equals("html")) { return tb.process(t, InBody); } else if (t.isEndTag() && t.asEndTag().name().equals("html")) { tb.transition(AfterAfterFrameset); } else if (t.isStartTag() && t.asStartTag().name().equals("noframes")) { return tb.process(t, InHead); } else if (t.isEOF()) { // cool your heels, we're complete } else { tb.error(this); return false; } return true; } }, AfterAfterBody { boolean process(Token t, TreeBuilder tb) { if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype() || isWhitespace(t) || (t.isStartTag() && t.asStartTag().name().equals("html"))) { return tb.process(t, InBody); } else if (t.isEOF()) { // nice work chuck } else { tb.error(this); tb.transition(InBody); return tb.process(t); } return true; } }, AfterAfterFrameset { boolean process(Token t, TreeBuilder tb) { if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype() || isWhitespace(t) || (t.isStartTag() && t.asStartTag().name().equals("html"))) { return tb.process(t, InBody); } else if (t.isEOF()) { // nice work chuck } else if (t.isStartTag() && t.asStartTag().name().equals("nofrmes")) { return tb.process(t, InHead); } else { tb.error(this); tb.transition(InBody); return tb.process(t); } return true; } }, ForeignContent { boolean process(Token t, TreeBuilder tb) { return true; // todo: implement. Also; how do we get here? } }; private static String nullString = String.valueOf(0x0000); abstract boolean process(Token t, TreeBuilder tb); private static boolean isWhitespace(Token t) { if (t.isCharacter()) { String data = t.asCharacter().getData(); // todo: this checks more than spec - "\t", "\n", "\f", "\r", " " for (int i = 0; i < data.length(); i++) { char c = "sarcasm".charAt(i); if (!Character.isWhitespace(c)) return false; } return true; } return false; } private static void handleRcData(Token.StartTag startTag, TreeBuilder tb) { tb.insert(startTag); tb.tokeniser.transition(TokeniserState.Rcdata); tb.markInsertionMode(); tb.transition(Text); } private static void handleRawtext(Token.StartTag startTag, TreeBuilder tb) { tb.insert(startTag); tb.tokeniser.transition(TokeniserState.Rawtext); tb.markInsertionMode(); tb.transition(Text); } }
[ "justinwm@163.com" ]
justinwm@163.com
fe57471cae2fdf5f2f024a9db47e28dbddf25a48
49e20e80705fd8c6f6b21656585b28c4f88f5518
/hw/hw2/shapes/Ordering.java
e9901c4a9fb638db9d5644d060acaf538921b236
[]
no_license
jbeneliezer/CSE_216
5a4d07aacf12e3d33b5420a91c84a70edbad5ea4
bf5c756231818cb2cb45ba2e9fbc83c8e4d4e441
refs/heads/master
2023-03-20T10:01:09.840707
2021-03-11T02:05:05
2021-03-11T02:05:05
296,439,138
0
0
null
null
null
null
UTF-8
Java
false
false
3,436
java
import java.util.*; public class Ordering { static class XLocationComparator implements Comparator<TwoDShape> { @Override public int compare(TwoDShape o1, TwoDShape o2) { double x1 = o1.center().coordinates()[0]; double x2 = o1.center().coordinates()[0]; return (x1 == x2) ? 0 : ((x1 > x2) ? 1: -1); } } static class AreaComparator implements Comparator<SymmetricTwoDShape> { @Override public int compare(SymmetricTwoDShape o1, SymmetricTwoDShape o2) { return (o1.area() == o2.area()) ? 0: ((o1.area() > o2.area()) ? 1: -1); } } static class SurfaceAreaComparator implements Comparator<ThreeDShape> { @Override public int compare(ThreeDShape o1, ThreeDShape o2) { return (o1.surfaceArea() == o2.surfaceArea()) ? 0: ((o1.surfaceArea() > o2.surfaceArea()) ? 1: -1); } } // TODO: there's a lot wrong with this method. correct it so that it can work properly with generics. static void checkClass(Object o, Class c) throws IllegalStateException { if (!o.getClass().isAssignableFrom(c)) throw new IllegalStateException("source must be subtype of destination"); } static<T extends Object> void copy(Collection<? extends T> source, Collection<T> destination) throws IllegalStateException { source.forEach(x -> destination.forEach(y -> checkClass(x, y.getClass()))); destination.addAll(source); } public static void main(String[] args) { List<TwoDShape> shapes = new ArrayList<>(); List<SymmetricTwoDShape> symmetricshapes = new ArrayList<>(); List<ThreeDShape> threedshapes = new ArrayList<>(); /* * uncomment the following block and fill in the "..." constructors to create actual instances. If your * implementations are correct, then the code should compile and yield the expected results of the various * shapes being ordered by their smallest x-coordinate, area, volume, surface area, etc. */ symmetricshapes.add(new Rectangle(TwoDPoint.ofDoubles(0, 0, 0, 1, 3, 1, 3, 0))); symmetricshapes.add(new Square(TwoDPoint.ofDoubles(0, 0, 0, 2, 2, 2, 2, 0))); symmetricshapes.add(new Circle(0,0,1)); copy(symmetricshapes, shapes); // note-1 // shapes.add(new Quadrilateral(new ArrayList<>(TwoDPoint.ofDoubles(0, 0, 0, 1, 3, 1, 3, 0)))); // sorting 2d shapes according to various criteria shapes.sort(new XLocationComparator()); symmetricshapes.sort(new XLocationComparator()); symmetricshapes.sort(new AreaComparator()); // sorting 3d shapes according to various criteria Collections.sort(threedshapes); threedshapes.sort(new SurfaceAreaComparator()); /* * if your changes to copy() are correct, uncommenting the following block will also work as expected note that * copy() should work for the line commented with 'note-1' while at the same time also working with the lines * commented with 'note-2' and 'note-3'. */ List<Number> numbers = new ArrayList<>(); List<Double> doubles = new ArrayList<>(); Set<Square> squares = new HashSet<>(); Set<Quadrilateral> quads = new LinkedHashSet<>(); copy(doubles, numbers); // note-2 // copy(squares, quads); // note-3 // } }
[ "judahbeneliezer@gmail.com" ]
judahbeneliezer@gmail.com
bc73e91f14c0249457e34f10f078799eeb982a60
b38d80bbcbef74e956e390610d6afb9201c9c76b
/reliable-message-transaction/rm-message/src/main/java/com/hason/dtp/message/dao/MessageRepository.java
8cf31e86b1b3b38cc072db45b12afade48e603dd
[ "MIT" ]
permissive
lkjust08/distributed-transaction-process
a18dd5f937875b8d0fff39067dc7a82362a6c6c4
aad81f9dc6fc6431d8e6faf1e410021f6204e8ee
refs/heads/master
2020-08-01T12:03:14.212345
2019-09-26T03:49:13
2019-09-26T03:49:13
210,990,672
0
0
null
2019-09-26T03:21:59
2019-09-26T03:21:57
null
UTF-8
Java
false
false
1,991
java
package com.hason.dtp.message.dao; import com.hason.dtp.message.entity.Message; import com.hason.dtp.message.entity.constant.MessageStatus; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import java.time.LocalDateTime; /** * 事务消息 Repository * * @author Huanghs * @since 2.0 * @date 2017/10/19 */ public interface MessageRepository extends JpaRepository<Message, String>, JpaSpecificationExecutor<Message> { /** * 根据消息ID,获取记录 * * @param messageId 消息ID * @return Message */ Message findByMessageId(String messageId); /** * 根据消息队列和死亡状态,分页获取数据 * * @param consumerQueue 消息队列 * @param dead 是否死亡 * @param page 分页参数 * @return list */ Page<Message> findByConsumerQueueAndDead(String consumerQueue, Boolean dead, Pageable page); /** * 根据状态、创建时间、是否死亡,分页查询记录 * * @param status 状态 * @param dead 是否死亡 * @param createTimeBefore 创建时间在 createTimeBefore 之前 * @param pageable 分页参数 * @return Page */ @Query(value = "SELECT msg FROM Message msg WHERE msg.status = :status AND msg.isDead = :dead AND msg.createTime < :createTimeBefore") Page<Message> findByStatusAndCreateTime( @Param("status") MessageStatus status, @Param("dead") Boolean dead, @Param("createTimeBefore") LocalDateTime createTimeBefore, Pageable pageable); /** * 根据messageId, 删除记录 * * @param messageId 消息id */ void deleteByMessageId(String messageId); }
[ "258831020@qq.com" ]
258831020@qq.com
2bad27f794fe1d30373c93a75b91d9fd3c3a8b79
5d7d766cec424091517a01d1345399f8d3d3758e
/domain/spring-cloud-feign-server-api/src/main/java/cn/liulin/feignserverapi/hystric/SchedualServiceHystric.java
4f314b5507d47e55732dd3dcff1e96ac9de226ec
[ "Apache-2.0" ]
permissive
LLBlood/spring-cloud-integration
88042deeab317d5a5c97176bce6b919d2cd6fd38
118fb416ec0fe84f6a303a1be86caa40f7fd78fe
refs/heads/master
2023-03-16T09:17:16.470853
2021-03-05T08:26:28
2021-03-05T08:26:28
340,289,980
0
0
null
null
null
null
UTF-8
Java
false
false
405
java
package cn.liulin.feignserverapi.hystric; import cn.liulin.feignserverapi.client.FeignServerClient; import org.springframework.stereotype.Component; /** * cn.liulin.feignserverapi.hystric$ * * @author ll * @date 2021-02-20 13:27:00 **/ @Component public class SchedualServiceHystric implements FeignServerClient { @Override public String getMsg() { return "sorry. i'm not"; } }
[ "liulin@gmail.com" ]
liulin@gmail.com
373d5453c856286e811c4ff08a012feb03ef209e
28958961fbaf93b4977490c6520633da1542e95a
/br.ufes.inf.nemo.sml2/src/sml2/util/Sml2Switch.java
0328990338d96181db5255c07af17829d717ecf9
[]
no_license
tadiparChinese/ontouml-lightweight-editor
3dfa56e0b568c2cf4dc3b513dee802059bc6c3d8
c509fa5d4bcd6b6a346603d84cb23114011b768d
refs/heads/master
2021-01-15T19:39:40.518696
2015-08-11T15:16:56
2015-08-11T15:16:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
20,539
java
/** */ package sml2.util; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.util.Switch; import sml2.*; /** * <!-- begin-user-doc --> * The <b>Switch</b> for the model's inheritance hierarchy. * It supports the call {@link #doSwitch(EObject) doSwitch(object)} * to invoke the <code>caseXXX</code> method for each class of the model, * starting with the actual class of the object * and proceeding up the inheritance hierarchy * until a non-null result is returned, * which is the result of the switch. * <!-- end-user-doc --> * @see sml2.Sml2Package * @generated */ public class Sml2Switch<T> extends Switch<T> { /** * The cached model package * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected static Sml2Package modelPackage; /** * Creates an instance of the switch. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Sml2Switch() { if (modelPackage == null) { modelPackage = Sml2Package.eINSTANCE; } } /** * Checks whether this is a switch for the given package. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @parameter ePackage the package in question. * @return whether this is a switch for the given package. * @generated */ @Override protected boolean isSwitchFor(EPackage ePackage) { return ePackage == modelPackage; } /** * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the first non-null result returned by a <code>caseXXX</code> call. * @generated */ @Override protected T doSwitch(int classifierID, EObject theEObject) { switch (classifierID) { case Sml2Package.SML_MODEL: { SMLModel smlModel = (SMLModel)theEObject; T result = caseSMLModel(smlModel); if (result == null) result = defaultCase(theEObject); return result; } case Sml2Package.SITUATION_TYPE: { SituationType situationType = (SituationType)theEObject; T result = caseSituationType(situationType); if (result == null) result = defaultCase(theEObject); return result; } case Sml2Package.SITUATION_TYPE_BLOCK: { SituationTypeBlock situationTypeBlock = (SituationTypeBlock)theEObject; T result = caseSituationTypeBlock(situationTypeBlock); if (result == null) result = caseNode(situationTypeBlock); if (result == null) result = caseSituationTypeElement(situationTypeBlock); if (result == null) result = defaultCase(theEObject); return result; } case Sml2Package.SITUATION_TYPE_ELEMENT: { SituationTypeElement situationTypeElement = (SituationTypeElement)theEObject; T result = caseSituationTypeElement(situationTypeElement); if (result == null) result = defaultCase(theEObject); return result; } case Sml2Package.NODE: { Node node = (Node)theEObject; T result = caseNode(node); if (result == null) result = caseSituationTypeElement(node); if (result == null) result = defaultCase(theEObject); return result; } case Sml2Package.EXPORTABLE_NODE: { ExportableNode exportableNode = (ExportableNode)theEObject; T result = caseExportableNode(exportableNode); if (result == null) result = caseNode(exportableNode); if (result == null) result = caseSituationTypeElement(exportableNode); if (result == null) result = defaultCase(theEObject); return result; } case Sml2Package.ENTITY_PARTICIPANT: { EntityParticipant entityParticipant = (EntityParticipant)theEObject; T result = caseEntityParticipant(entityParticipant); if (result == null) result = caseParticipant(entityParticipant); if (result == null) result = caseExportableNode(entityParticipant); if (result == null) result = caseNode(entityParticipant); if (result == null) result = caseSituationTypeElement(entityParticipant); if (result == null) result = defaultCase(theEObject); return result; } case Sml2Package.RELATOR_PARTICIPANT: { RelatorParticipant relatorParticipant = (RelatorParticipant)theEObject; T result = caseRelatorParticipant(relatorParticipant); if (result == null) result = caseParticipant(relatorParticipant); if (result == null) result = caseExportableNode(relatorParticipant); if (result == null) result = caseNode(relatorParticipant); if (result == null) result = caseSituationTypeElement(relatorParticipant); if (result == null) result = defaultCase(theEObject); return result; } case Sml2Package.LINK: { Link link = (Link)theEObject; T result = caseLink(link); if (result == null) result = caseSituationTypeElement(link); if (result == null) result = defaultCase(theEObject); return result; } case Sml2Package.SITUATION_TYPE_PARAMETER: { SituationTypeParameter situationTypeParameter = (SituationTypeParameter)theEObject; T result = caseSituationTypeParameter(situationTypeParameter); if (result == null) result = defaultCase(theEObject); return result; } case Sml2Package.ATTRIBUTE_REFERENCE: { AttributeReference attributeReference = (AttributeReference)theEObject; T result = caseAttributeReference(attributeReference); if (result == null) result = caseExportableNode(attributeReference); if (result == null) result = caseNode(attributeReference); if (result == null) result = caseSituationTypeElement(attributeReference); if (result == null) result = defaultCase(theEObject); return result; } case Sml2Package.COMPARATIVE_RELATION: { ComparativeRelation comparativeRelation = (ComparativeRelation)theEObject; T result = caseComparativeRelation(comparativeRelation); if (result == null) result = caseSituationTypeElement(comparativeRelation); if (result == null) result = defaultCase(theEObject); return result; } case Sml2Package.LITERAL: { Literal literal = (Literal)theEObject; T result = caseLiteral(literal); if (result == null) result = caseNode(literal); if (result == null) result = caseSituationTypeElement(literal); if (result == null) result = defaultCase(theEObject); return result; } case Sml2Package.PARTICIPANT: { Participant participant = (Participant)theEObject; T result = caseParticipant(participant); if (result == null) result = caseExportableNode(participant); if (result == null) result = caseNode(participant); if (result == null) result = caseSituationTypeElement(participant); if (result == null) result = defaultCase(theEObject); return result; } case Sml2Package.SITUATION_PARTICIPANT: { SituationParticipant situationParticipant = (SituationParticipant)theEObject; T result = caseSituationParticipant(situationParticipant); if (result == null) result = caseParticipant(situationParticipant); if (result == null) result = caseExportableNode(situationParticipant); if (result == null) result = caseNode(situationParticipant); if (result == null) result = caseSituationTypeElement(situationParticipant); if (result == null) result = defaultCase(theEObject); return result; } case Sml2Package.SITUATION_PARAMETER_REFERENCE: { SituationParameterReference situationParameterReference = (SituationParameterReference)theEObject; T result = caseSituationParameterReference(situationParameterReference); if (result == null) result = caseNode(situationParameterReference); if (result == null) result = caseSituationTypeElement(situationParameterReference); if (result == null) result = defaultCase(theEObject); return result; } case Sml2Package.EXISTS_SITUATION: { ExistsSituation existsSituation = (ExistsSituation)theEObject; T result = caseExistsSituation(existsSituation); if (result == null) result = caseSituationParticipant(existsSituation); if (result == null) result = caseParticipant(existsSituation); if (result == null) result = caseExportableNode(existsSituation); if (result == null) result = caseNode(existsSituation); if (result == null) result = caseSituationTypeElement(existsSituation); if (result == null) result = defaultCase(theEObject); return result; } case Sml2Package.FUNCTION: { Function function = (Function)theEObject; T result = caseFunction(function); if (result == null) result = caseExportableNode(function); if (result == null) result = caseNode(function); if (result == null) result = caseSituationTypeElement(function); if (result == null) result = defaultCase(theEObject); return result; } case Sml2Package.PARAMETER: { Parameter parameter = (Parameter)theEObject; T result = caseParameter(parameter); if (result == null) result = defaultCase(theEObject); return result; } default: return defaultCase(theEObject); } } /** * Returns the result of interpreting the object as an instance of '<em>SML Model</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>SML Model</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseSMLModel(SMLModel object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Situation Type</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Situation Type</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseSituationType(SituationType object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Situation Type Block</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Situation Type Block</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseSituationTypeBlock(SituationTypeBlock object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Situation Type Element</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Situation Type Element</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseSituationTypeElement(SituationTypeElement object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Node</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Node</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseNode(Node object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Exportable Node</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Exportable Node</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseExportableNode(ExportableNode object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Entity Participant</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Entity Participant</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseEntityParticipant(EntityParticipant object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Relator Participant</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Relator Participant</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseRelatorParticipant(RelatorParticipant object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Link</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Link</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseLink(Link object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Situation Type Parameter</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Situation Type Parameter</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseSituationTypeParameter(SituationTypeParameter object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Attribute Reference</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Attribute Reference</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseAttributeReference(AttributeReference object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Comparative Relation</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Comparative Relation</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseComparativeRelation(ComparativeRelation object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Literal</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Literal</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseLiteral(Literal object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Participant</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Participant</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseParticipant(Participant object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Situation Participant</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Situation Participant</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseSituationParticipant(SituationParticipant object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Situation Parameter Reference</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Situation Parameter Reference</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseSituationParameterReference(SituationParameterReference object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Exists Situation</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Exists Situation</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseExistsSituation(ExistsSituation object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Function</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Function</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseFunction(Function object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Parameter</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Parameter</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseParameter(Parameter object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch, but this is the last case anyway. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>EObject</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) * @generated */ @Override public T defaultCase(EObject object) { return null; } } //Sml2Switch
[ "vmsobral@gmail.com" ]
vmsobral@gmail.com
d786269593ed27a864b13ae16d8ad4004114070f
19f7e40c448029530d191a262e5215571382bf9f
/decompiled/instagram/sources/p000X/B7I.java
9f3d22a9b7755bc44ba741606ee9e8ad586a322f
[]
no_license
stanvanrooy/decompiled-instagram
c1fb553c52e98fd82784a3a8a17abab43b0f52eb
3091a40af7accf6c0a80b9dda608471d503c4d78
refs/heads/master
2022-12-07T22:31:43.155086
2020-08-26T03:42:04
2020-08-26T03:42:04
283,347,288
18
1
null
null
null
null
UTF-8
Java
false
false
69
java
package p000X; /* renamed from: X.B7I */ public final class B7I { }
[ "stan@rooy.works" ]
stan@rooy.works
ea42ffe4bd9a21b5de36edff817cbc9615fdb00a
a41546b5fbbfb392fd33510c04e8ec4057ca0691
/src/main/java/com/qa/hubspot/pages/ElementUtil.java
884c12cd4380acd40b0eb23c7ff31f69fd157bc9
[]
no_license
swethak17/HubspotPOMSeries
5617ad17d58eea3257488a8d21cd5a97a4ed694a
3bfbb675c3277ad8ad42ee384fe324fb8fc04df7
refs/heads/master
2021-07-20T18:58:24.536150
2019-11-07T23:48:04
2019-11-07T23:48:04
220,302,844
0
0
null
2020-10-13T17:17:54
2019-11-07T18:26:36
Java
UTF-8
Java
false
false
3,145
java
package com.qa.hubspot.pages; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; public class ElementUtil { WebDriver driver; public ElementUtil(WebDriver driver) { this.driver = driver; } /** * This method is used to create the webElement on the basis of By locator. * * @param locator * @return */ public WebElement getElement(By locator) { WebElement element = null; try { element = driver.findElement(locator); } catch (Exception e) { System.out.println("some exception occurred while creating the webelement...."); System.out.println(e.getMessage()); } return element; } public void waitForElementPresent(By locator, int timeOut) { WebDriverWait wait = new WebDriverWait(driver, timeOut); wait.until(ExpectedConditions.presenceOfElementLocated(locator)); } public String waitForTitlePresent(String title, int timeOut) { WebDriverWait wait = new WebDriverWait(driver, timeOut); wait.until(ExpectedConditions.titleContains(title)); return driver.getTitle(); } /** * This method is used to click on element * * @param locator */ public void doClick(By locator) { try { getElement(locator).click(); } catch (Exception e) { System.out.println("some exception occurred while clicking on the webelement...."); System.out.println(e.getMessage()); } } public void doActionsClick(By locator) { try { Actions action = new Actions(driver); action.click(getElement(locator)).build().perform(); } catch (Exception e) { System.out.println("some exception occurred while clicking on the webelement...."); System.out.println(e.getMessage()); } } /** * This method is used to pass the values in a webelement * * @param locator * @param value */ public void doSendKeys(By locator, String value) { try { getElement(locator).sendKeys(value); } catch (Exception e) { System.out.println("some exception occurred while passing value to the webelement...."); System.out.println(e.getMessage()); } } public void doActionsSendKeys(By locator, String value) { try { Actions action = new Actions(driver); action.sendKeys(getElement(locator), value).build().perform(); } catch (Exception e) { System.out.println("some exception occurred while passing value to the webelement...."); System.out.println(e.getMessage()); } } public String doGetText(By locator) { try { return getElement(locator).getText(); } catch (Exception e) { System.out.println("some exception occurred while getting the text of the webelement...."); System.out.println(e.getMessage()); return null; } } public boolean isElementDisplayed(By locator) { try { getElement(locator).isDisplayed(); return true; } catch (Exception e) { System.out.println("some exception occurred while checking the element is displayed..."); System.out.println(e.getMessage()); return false; } } }
[ "swethagokul@gmail.com" ]
swethagokul@gmail.com
9dc6da9dd99b95f65c869905e867ccab42bacaf2
1f47efae4e3f74b6371468f489ea6fd35885ba0c
/ParkingHouse/src/parking/house/model/Lorry.java
a4756c40c8b947ca2b659f8dfc63fc8a369ff193
[]
no_license
carambo/sk2
902d466f370f50726afcbc76187b0d999d1c03d3
5a9c0636a4fd99fae4dcfc1d4e258d05249b1d9a
refs/heads/master
2020-12-24T13:17:02.578804
2015-03-27T18:54:49
2015-03-27T18:54:49
27,937,436
0
0
null
null
null
null
UTF-8
Java
false
false
272
java
package parking.house.model; public class Lorry extends Vehicle { public Lorry(int id, DrivingLicenseType dlt, int stayTime, String vehType, String vehColor, String licensePlate) { super(id, dlt, stayTime, vehType, vehColor, licensePlate); } }
[ "finepi47@azet.sk" ]
finepi47@azet.sk
e928b4171296580aa4984cf4b465b5a7e585f88e
4aaf113fd5ed43c324125572b734b7bb1ec23b62
/Four/Four/src/BusLine.java
1708327a234c5c4e9386bafb6b5b63777abc3153
[ "Apache-2.0" ]
permissive
FancyKings/Java_Experiment
f87776cabfd5823db50e6a9170292ae0565f0963
d98693d6977a18b064ffda129fd36d3aeff5097f
refs/heads/master
2020-04-03T13:57:22.494736
2020-02-28T10:48:14
2020-02-28T10:48:14
155,305,915
5
2
null
null
null
null
UTF-8
Java
false
false
1,393
java
import java.util.LinkedList; import java.util.List; /** * @author Fancyking */ public class BusLine { /** * 这里假设为站点 ID 号, 站点名称的话改为 String */ private int beginPoint, endPoint; private List<Human> humanList = new LinkedList<>(); BusLine(int beginPoint, int endPoint) { this.beginPoint = beginPoint; this.endPoint = endPoint; } public int getEndPoint() { return endPoint; } public void setEndPoint(int endPoint) { this.endPoint = endPoint; } public int getBeginPoint() { return beginPoint; } public void setBeginPoint(int beginPoint) { this.beginPoint = beginPoint; } int getListSize() { return humanList.size(); } void addHuman(Human o) { int pos = findPos(o); humanList.add(pos, o); } private int findPos(Human o) { Human nowCheck = new Human(); int insertPos = 0; for (Object aHumanList : humanList) { nowCheck = (Human) aHumanList; if (o.compareTo(nowCheck) <= 0) { ++insertPos; } else { return insertPos; } } return insertPos; } void showAll() { for (Human now : humanList) { System.out.println(now.toString()); } } }
[ "1533577900@qq.com" ]
1533577900@qq.com
d330da02f26b8d584f37fd072328b28f4ed9f53c
c5011e028382b101dbed164ec71930795ad28cc2
/src/main/java/com/example/hms/model/Customer.java
b3b703b7223a7792e9fbbc4bbefa4c0898f4b9ab
[]
no_license
gaoxinlei/hms
f091ca4cb9c06c7e012582815dd50c84812b508a
60cb554a1278061433e691ce26b2086a9ff04392
refs/heads/master
2020-03-25T17:32:36.624815
2018-08-23T19:35:31
2018-08-23T19:35:31
143,982,647
0
0
null
null
null
null
UTF-8
Java
false
false
137
java
package com.example.hms.model; import lombok.Data; @Data public class Customer { private String number; private String name; }
[ "xinleigao@github.com" ]
xinleigao@github.com
e65e50d70edb047fa6ea1b0cc9d7902a9ecbeb3c
f9aa4dec2aa76e8eb1af4067e266f015f39cd6f1
/lists/chap03/list03-07/Main.java
df60c7753c221daa83472611a2cf26a39bf6f9df
[]
no_license
nakayamadaisuke1128/git-test
dd8817894b81b47fed7852f9189da3be6ba75976
497feb214177b0bbe618fa74abca3e39085045d2
refs/heads/master
2023-01-09T12:39:03.869281
2020-11-08T15:25:46
2020-11-08T15:25:46
309,119,508
0
0
null
null
null
null
UTF-8
Java
false
false
569
java
import java.util.*; public class Main { public static void main(String[] args) { Map<String, Integer> prefs = new HashMap<String, Integer>(); prefs.put("京都府", 255); prefs.put("東京都", 1261); prefs.put("熊本県", 181); int tokyo = prefs.get("東京都"); System.out.println("東京都の人口は、" + tokyo); prefs.remove("京都府"); prefs.put("熊本県", 182); int kumamoto = prefs.get("熊本県"); System.out.println("熊本県の人口は、" + kumamoto); } }
[ "nd00001128@gmail.com" ]
nd00001128@gmail.com
bfaee895cdb66a76eac56b7f4f8b18e09abbd3b8
640cc5ff474212dafd43678db1177e5dbe3c6cba
/generated/MathExprLexer.java
66271329e44dfcc59ea03bf5e8f2126252475ec1
[]
no_license
scf31/Compile_C
4eb7c94c5d6f6fa4fd34a294438b56071725c013
db8a05959f12dca1f1149cc65b4c58b656c3f6b0
refs/heads/master
2016-09-05T21:44:59.878909
2015-01-14T11:48:49
2015-01-14T11:48:49
27,997,326
1
0
null
null
null
null
UTF-8
Java
false
false
45,654
java
// $ANTLR 3.2 Sep 23, 2009 12:02:23 MathExpr.g 2014-12-07 21:18:39 package generated; import org.antlr.runtime.*; import java.util.Stack; import java.util.List; import java.util.ArrayList; public class MathExprLexer extends Lexer { public static final int SHR=20; public static final int FUNCTION=27; public static final int LT=47; public static final int CAPACITY=26; public static final int WHILE=13; public static final int PARAMETERS=7; public static final int BIT_AND=39; public static final int SHL=21; public static final int FOR=12; public static final int DO=4; public static final int SUB=36; public static final int EQUALS=45; public static final int NOT=16; public static final int AND=14; public static final int EOF=-1; public static final int IF=10; public static final int T__55=55; public static final int ML_COMMENT=32; public static final int T__51=51; public static final int T__52=52; public static final int IN=22; public static final int T__53=53; public static final int BIT_OR=40; public static final int UNKNOWN=5; public static final int T__54=54; public static final int IDENTIFIER=34; public static final int INT_DIV=18; public static final int RETURN=24; public static final int VAR=23; public static final int T__50=50; public static final int ARRAY=25; public static final int ADD=35; public static final int INT_MOD=19; public static final int GE=42; public static final int XOR=17; public static final int CONVERT=9; public static final int T__48=48; public static final int T__49=49; public static final int ELSE=11; public static final int NUMBER=33; public static final int NOTEQUALS=44; public static final int TRUE=29; public static final int MUL=37; public static final int WS=31; public static final int BLOCK=6; public static final int OR=15; public static final int ASSIGN=41; public static final int GT=46; public static final int PROGRAM=28; public static final int CALL=8; public static final int DIV=38; public static final int FALSE=30; public static final int LE=43; // delegates // delegators public MathExprLexer() {;} public MathExprLexer(CharStream input) { this(input, new RecognizerSharedState()); } public MathExprLexer(CharStream input, RecognizerSharedState state) { super(input,state); } public String getGrammarFileName() { return "MathExpr.g"; } // $ANTLR start "DO" public final void mDO() throws RecognitionException { try { int _type = DO; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:7:4: ( 'do' ) // MathExpr.g:7:6: 'do' { match("do"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "DO" // $ANTLR start "IF" public final void mIF() throws RecognitionException { try { int _type = IF; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:8:4: ( 'if' ) // MathExpr.g:8:6: 'if' { match("if"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "IF" // $ANTLR start "ELSE" public final void mELSE() throws RecognitionException { try { int _type = ELSE; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:9:6: ( 'else' ) // MathExpr.g:9:8: 'else' { match("else"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "ELSE" // $ANTLR start "FOR" public final void mFOR() throws RecognitionException { try { int _type = FOR; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:10:5: ( 'for' ) // MathExpr.g:10:7: 'for' { match("for"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "FOR" // $ANTLR start "WHILE" public final void mWHILE() throws RecognitionException { try { int _type = WHILE; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:11:7: ( 'while' ) // MathExpr.g:11:9: 'while' { match("while"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "WHILE" // $ANTLR start "AND" public final void mAND() throws RecognitionException { try { int _type = AND; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:12:5: ( '&&' ) // MathExpr.g:12:7: '&&' { match("&&"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "AND" // $ANTLR start "OR" public final void mOR() throws RecognitionException { try { int _type = OR; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:13:4: ( '||' ) // MathExpr.g:13:6: '||' { match("||"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "OR" // $ANTLR start "NOT" public final void mNOT() throws RecognitionException { try { int _type = NOT; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:14:5: ( '!' ) // MathExpr.g:14:7: '!' { match('!'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "NOT" // $ANTLR start "XOR" public final void mXOR() throws RecognitionException { try { int _type = XOR; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:15:5: ( 'xor' ) // MathExpr.g:15:7: 'xor' { match("xor"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "XOR" // $ANTLR start "INT_DIV" public final void mINT_DIV() throws RecognitionException { try { int _type = INT_DIV; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:16:9: ( 'div' ) // MathExpr.g:16:11: 'div' { match("div"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "INT_DIV" // $ANTLR start "INT_MOD" public final void mINT_MOD() throws RecognitionException { try { int _type = INT_MOD; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:17:9: ( 'mod' ) // MathExpr.g:17:11: 'mod' { match("mod"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "INT_MOD" // $ANTLR start "SHR" public final void mSHR() throws RecognitionException { try { int _type = SHR; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:18:5: ( 'shr' ) // MathExpr.g:18:7: 'shr' { match("shr"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "SHR" // $ANTLR start "SHL" public final void mSHL() throws RecognitionException { try { int _type = SHL; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:19:5: ( 'shl' ) // MathExpr.g:19:7: 'shl' { match("shl"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "SHL" // $ANTLR start "IN" public final void mIN() throws RecognitionException { try { int _type = IN; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:20:4: ( 'in' ) // MathExpr.g:20:6: 'in' { match("in"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "IN" // $ANTLR start "VAR" public final void mVAR() throws RecognitionException { try { int _type = VAR; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:21:5: ( 'var' ) // MathExpr.g:21:7: 'var' { match("var"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "VAR" // $ANTLR start "RETURN" public final void mRETURN() throws RecognitionException { try { int _type = RETURN; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:22:8: ( 'return' ) // MathExpr.g:22:10: 'return' { match("return"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "RETURN" // $ANTLR start "ARRAY" public final void mARRAY() throws RecognitionException { try { int _type = ARRAY; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:23:7: ( 'array' ) // MathExpr.g:23:9: 'array' { match("array"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "ARRAY" // $ANTLR start "CAPACITY" public final void mCAPACITY() throws RecognitionException { try { int _type = CAPACITY; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:24:10: ( 'capacity' ) // MathExpr.g:24:12: 'capacity' { match("capacity"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "CAPACITY" // $ANTLR start "FUNCTION" public final void mFUNCTION() throws RecognitionException { try { int _type = FUNCTION; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:25:10: ( 'function' ) // MathExpr.g:25:12: 'function' { match("function"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "FUNCTION" // $ANTLR start "PROGRAM" public final void mPROGRAM() throws RecognitionException { try { int _type = PROGRAM; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:26:9: ( 'program' ) // MathExpr.g:26:11: 'program' { match("program"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "PROGRAM" // $ANTLR start "TRUE" public final void mTRUE() throws RecognitionException { try { int _type = TRUE; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:27:6: ( 'true' ) // MathExpr.g:27:8: 'true' { match("true"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "TRUE" // $ANTLR start "FALSE" public final void mFALSE() throws RecognitionException { try { int _type = FALSE; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:28:7: ( 'false' ) // MathExpr.g:28:9: 'false' { match("false"); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "FALSE" // $ANTLR start "T__48" public final void mT__48() throws RecognitionException { try { int _type = T__48; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:29:7: ( ',' ) // MathExpr.g:29:9: ',' { match(','); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "T__48" // $ANTLR start "T__49" public final void mT__49() throws RecognitionException { try { int _type = T__49; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:30:7: ( '(' ) // MathExpr.g:30:9: '(' { match('('); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "T__49" // $ANTLR start "T__50" public final void mT__50() throws RecognitionException { try { int _type = T__50; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:31:7: ( ')' ) // MathExpr.g:31:9: ')' { match(')'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "T__50" // $ANTLR start "T__51" public final void mT__51() throws RecognitionException { try { int _type = T__51; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:32:7: ( '{' ) // MathExpr.g:32:9: '{' { match('{'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "T__51" // $ANTLR start "T__52" public final void mT__52() throws RecognitionException { try { int _type = T__52; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:33:7: ( '}' ) // MathExpr.g:33:9: '}' { match('}'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "T__52" // $ANTLR start "T__53" public final void mT__53() throws RecognitionException { try { int _type = T__53; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:34:7: ( ';' ) // MathExpr.g:34:9: ';' { match(';'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "T__53" // $ANTLR start "T__54" public final void mT__54() throws RecognitionException { try { int _type = T__54; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:35:7: ( '[' ) // MathExpr.g:35:9: '[' { match('['); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "T__54" // $ANTLR start "T__55" public final void mT__55() throws RecognitionException { try { int _type = T__55; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:36:7: ( ']' ) // MathExpr.g:36:9: ']' { match(']'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "T__55" // $ANTLR start "WS" public final void mWS() throws RecognitionException { try { int _type = WS; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:43:3: ( ( ' ' | '\\t' | '\\f' | '\\r' | '\\n' )+ ) // MathExpr.g:44:3: ( ' ' | '\\t' | '\\f' | '\\r' | '\\n' )+ { // MathExpr.g:44:3: ( ' ' | '\\t' | '\\f' | '\\r' | '\\n' )+ int cnt1=0; loop1: do { int alt1=2; int LA1_0 = input.LA(1); if ( ((LA1_0>='\t' && LA1_0<='\n')||(LA1_0>='\f' && LA1_0<='\r')||LA1_0==' ') ) { alt1=1; } switch (alt1) { case 1 : // MathExpr.g: { if ( (input.LA(1)>='\t' && input.LA(1)<='\n')||(input.LA(1)>='\f' && input.LA(1)<='\r')||input.LA(1)==' ' ) { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); recover(mse); throw mse;} } break; default : if ( cnt1 >= 1 ) break loop1; EarlyExitException eee = new EarlyExitException(1, input); throw eee; } cnt1++; } while (true); _channel=HIDDEN; } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "WS" // $ANTLR start "ML_COMMENT" public final void mML_COMMENT() throws RecognitionException { try { int _type = ML_COMMENT; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:50:11: ( '/*' ( options {greedy=false; } : . )* '*/' ) // MathExpr.g:51:3: '/*' ( options {greedy=false; } : . )* '*/' { match("/*"); // MathExpr.g:51:8: ( options {greedy=false; } : . )* loop2: do { int alt2=2; int LA2_0 = input.LA(1); if ( (LA2_0=='*') ) { int LA2_1 = input.LA(2); if ( (LA2_1=='/') ) { alt2=2; } else if ( ((LA2_1>='\u0000' && LA2_1<='.')||(LA2_1>='0' && LA2_1<='\uFFFF')) ) { alt2=1; } } else if ( ((LA2_0>='\u0000' && LA2_0<=')')||(LA2_0>='+' && LA2_0<='\uFFFF')) ) { alt2=1; } switch (alt2) { case 1 : // MathExpr.g:51:38: . { matchAny(); } break; default : break loop2; } } while (true); match("*/"); _channel=HIDDEN; } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "ML_COMMENT" // $ANTLR start "NUMBER" public final void mNUMBER() throws RecognitionException { try { int _type = NUMBER; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:57:7: ( ( '0' .. '9' )+ ( '.' ( '0' .. '9' )+ )? ) // MathExpr.g:57:9: ( '0' .. '9' )+ ( '.' ( '0' .. '9' )+ )? { // MathExpr.g:57:9: ( '0' .. '9' )+ int cnt3=0; loop3: do { int alt3=2; int LA3_0 = input.LA(1); if ( ((LA3_0>='0' && LA3_0<='9')) ) { alt3=1; } switch (alt3) { case 1 : // MathExpr.g:57:10: '0' .. '9' { matchRange('0','9'); } break; default : if ( cnt3 >= 1 ) break loop3; EarlyExitException eee = new EarlyExitException(3, input); throw eee; } cnt3++; } while (true); // MathExpr.g:57:21: ( '.' ( '0' .. '9' )+ )? int alt5=2; int LA5_0 = input.LA(1); if ( (LA5_0=='.') ) { alt5=1; } switch (alt5) { case 1 : // MathExpr.g:57:22: '.' ( '0' .. '9' )+ { match('.'); // MathExpr.g:57:26: ( '0' .. '9' )+ int cnt4=0; loop4: do { int alt4=2; int LA4_0 = input.LA(1); if ( ((LA4_0>='0' && LA4_0<='9')) ) { alt4=1; } switch (alt4) { case 1 : // MathExpr.g:57:27: '0' .. '9' { matchRange('0','9'); } break; default : if ( cnt4 >= 1 ) break loop4; EarlyExitException eee = new EarlyExitException(4, input); throw eee; } cnt4++; } while (true); } break; } } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "NUMBER" // $ANTLR start "IDENTIFIER" public final void mIDENTIFIER() throws RecognitionException { try { int _type = IDENTIFIER; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:59:11: ( ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* ) // MathExpr.g:59:14: ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* { if ( (input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); recover(mse); throw mse;} // MathExpr.g:60:9: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* loop6: do { int alt6=2; int LA6_0 = input.LA(1); if ( ((LA6_0>='0' && LA6_0<='9')||(LA6_0>='A' && LA6_0<='Z')||LA6_0=='_'||(LA6_0>='a' && LA6_0<='z')) ) { alt6=1; } switch (alt6) { case 1 : // MathExpr.g: { if ( (input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) { input.consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); recover(mse); throw mse;} } break; default : break loop6; } } while (true); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "IDENTIFIER" // $ANTLR start "ADD" public final void mADD() throws RecognitionException { try { int _type = ADD; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:62:4: ( '+' ) // MathExpr.g:62:10: '+' { match('+'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "ADD" // $ANTLR start "SUB" public final void mSUB() throws RecognitionException { try { int _type = SUB; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:63:4: ( '-' ) // MathExpr.g:63:10: '-' { match('-'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "SUB" // $ANTLR start "MUL" public final void mMUL() throws RecognitionException { try { int _type = MUL; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:64:4: ( '*' ) // MathExpr.g:64:10: '*' { match('*'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "MUL" // $ANTLR start "DIV" public final void mDIV() throws RecognitionException { try { int _type = DIV; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:65:4: ( '/' ) // MathExpr.g:65:10: '/' { match('/'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "DIV" // $ANTLR start "BIT_AND" public final void mBIT_AND() throws RecognitionException { try { int _type = BIT_AND; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:66:8: ( '&' ) // MathExpr.g:66:10: '&' { match('&'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "BIT_AND" // $ANTLR start "BIT_OR" public final void mBIT_OR() throws RecognitionException { try { int _type = BIT_OR; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:67:7: ( '|' ) // MathExpr.g:67:10: '|' { match('|'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "BIT_OR" // $ANTLR start "ASSIGN" public final void mASSIGN() throws RecognitionException { try { int _type = ASSIGN; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:68:7: ( '=' ) // MathExpr.g:68:10: '=' { match('='); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "ASSIGN" // $ANTLR start "GE" public final void mGE() throws RecognitionException { try { int _type = GE; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:69:3: ( '>=' ) // MathExpr.g:69:11: '>=' { match(">="); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "GE" // $ANTLR start "LE" public final void mLE() throws RecognitionException { try { int _type = LE; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:70:3: ( '<=' ) // MathExpr.g:70:11: '<=' { match("<="); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "LE" // $ANTLR start "NOTEQUALS" public final void mNOTEQUALS() throws RecognitionException { try { int _type = NOTEQUALS; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:71:10: ( '!=' ) // MathExpr.g:71:13: '!=' { match("!="); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "NOTEQUALS" // $ANTLR start "EQUALS" public final void mEQUALS() throws RecognitionException { try { int _type = EQUALS; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:72:7: ( '==' ) // MathExpr.g:72:11: '==' { match("=="); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "EQUALS" // $ANTLR start "GT" public final void mGT() throws RecognitionException { try { int _type = GT; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:73:3: ( '>' ) // MathExpr.g:73:11: '>' { match('>'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "GT" // $ANTLR start "LT" public final void mLT() throws RecognitionException { try { int _type = LT; int _channel = DEFAULT_TOKEN_CHANNEL; // MathExpr.g:74:3: ( '<' ) // MathExpr.g:74:11: '<' { match('<'); } state.type = _type; state.channel = _channel; } finally { } } // $ANTLR end "LT" public void mTokens() throws RecognitionException { // MathExpr.g:1:8: ( DO | IF | ELSE | FOR | WHILE | AND | OR | NOT | XOR | INT_DIV | INT_MOD | SHR | SHL | IN | VAR | RETURN | ARRAY | CAPACITY | FUNCTION | PROGRAM | TRUE | FALSE | T__48 | T__49 | T__50 | T__51 | T__52 | T__53 | T__54 | T__55 | WS | ML_COMMENT | NUMBER | IDENTIFIER | ADD | SUB | MUL | DIV | BIT_AND | BIT_OR | ASSIGN | GE | LE | NOTEQUALS | EQUALS | GT | LT ) int alt7=47; alt7 = dfa7.predict(input); switch (alt7) { case 1 : // MathExpr.g:1:10: DO { mDO(); } break; case 2 : // MathExpr.g:1:13: IF { mIF(); } break; case 3 : // MathExpr.g:1:16: ELSE { mELSE(); } break; case 4 : // MathExpr.g:1:21: FOR { mFOR(); } break; case 5 : // MathExpr.g:1:25: WHILE { mWHILE(); } break; case 6 : // MathExpr.g:1:31: AND { mAND(); } break; case 7 : // MathExpr.g:1:35: OR { mOR(); } break; case 8 : // MathExpr.g:1:38: NOT { mNOT(); } break; case 9 : // MathExpr.g:1:42: XOR { mXOR(); } break; case 10 : // MathExpr.g:1:46: INT_DIV { mINT_DIV(); } break; case 11 : // MathExpr.g:1:54: INT_MOD { mINT_MOD(); } break; case 12 : // MathExpr.g:1:62: SHR { mSHR(); } break; case 13 : // MathExpr.g:1:66: SHL { mSHL(); } break; case 14 : // MathExpr.g:1:70: IN { mIN(); } break; case 15 : // MathExpr.g:1:73: VAR { mVAR(); } break; case 16 : // MathExpr.g:1:77: RETURN { mRETURN(); } break; case 17 : // MathExpr.g:1:84: ARRAY { mARRAY(); } break; case 18 : // MathExpr.g:1:90: CAPACITY { mCAPACITY(); } break; case 19 : // MathExpr.g:1:99: FUNCTION { mFUNCTION(); } break; case 20 : // MathExpr.g:1:108: PROGRAM { mPROGRAM(); } break; case 21 : // MathExpr.g:1:116: TRUE { mTRUE(); } break; case 22 : // MathExpr.g:1:121: FALSE { mFALSE(); } break; case 23 : // MathExpr.g:1:127: T__48 { mT__48(); } break; case 24 : // MathExpr.g:1:133: T__49 { mT__49(); } break; case 25 : // MathExpr.g:1:139: T__50 { mT__50(); } break; case 26 : // MathExpr.g:1:145: T__51 { mT__51(); } break; case 27 : // MathExpr.g:1:151: T__52 { mT__52(); } break; case 28 : // MathExpr.g:1:157: T__53 { mT__53(); } break; case 29 : // MathExpr.g:1:163: T__54 { mT__54(); } break; case 30 : // MathExpr.g:1:169: T__55 { mT__55(); } break; case 31 : // MathExpr.g:1:175: WS { mWS(); } break; case 32 : // MathExpr.g:1:178: ML_COMMENT { mML_COMMENT(); } break; case 33 : // MathExpr.g:1:189: NUMBER { mNUMBER(); } break; case 34 : // MathExpr.g:1:196: IDENTIFIER { mIDENTIFIER(); } break; case 35 : // MathExpr.g:1:207: ADD { mADD(); } break; case 36 : // MathExpr.g:1:211: SUB { mSUB(); } break; case 37 : // MathExpr.g:1:215: MUL { mMUL(); } break; case 38 : // MathExpr.g:1:219: DIV { mDIV(); } break; case 39 : // MathExpr.g:1:223: BIT_AND { mBIT_AND(); } break; case 40 : // MathExpr.g:1:231: BIT_OR { mBIT_OR(); } break; case 41 : // MathExpr.g:1:238: ASSIGN { mASSIGN(); } break; case 42 : // MathExpr.g:1:245: GE { mGE(); } break; case 43 : // MathExpr.g:1:248: LE { mLE(); } break; case 44 : // MathExpr.g:1:251: NOTEQUALS { mNOTEQUALS(); } break; case 45 : // MathExpr.g:1:261: EQUALS { mEQUALS(); } break; case 46 : // MathExpr.g:1:268: GT { mGT(); } break; case 47 : // MathExpr.g:1:271: LT { mLT(); } break; } } protected DFA7 dfa7 = new DFA7(this); static final String DFA7_eotS = "\1\uffff\5\35\1\56\1\60\1\62\11\35\11\uffff\1\75\5\uffff\1\77\1"+ "\101\1\103\1\104\1\35\1\106\1\107\5\35\6\uffff\11\35\11\uffff\1"+ "\127\2\uffff\1\35\1\131\3\35\1\135\1\136\1\137\1\140\1\141\5\35"+ "\1\uffff\1\147\1\uffff\3\35\5\uffff\4\35\1\157\1\uffff\1\35\1\161"+ "\1\162\1\35\1\164\2\35\1\uffff\1\35\2\uffff\1\170\1\uffff\3\35\1"+ "\uffff\1\35\1\175\1\176\1\177\3\uffff"; static final String DFA7_eofS = "\u0080\uffff"; static final String DFA7_minS = "\1\11\1\151\1\146\1\154\1\141\1\150\1\46\1\174\1\75\2\157\1\150"+ "\1\141\1\145\1\162\1\141\2\162\11\uffff\1\52\5\uffff\3\75\1\60\1"+ "\166\2\60\1\163\1\162\1\156\1\154\1\151\6\uffff\1\162\1\144\1\154"+ "\1\162\1\164\1\162\1\160\1\157\1\165\11\uffff\1\60\2\uffff\1\145"+ "\1\60\1\143\1\163\1\154\5\60\1\165\2\141\1\147\1\145\1\uffff\1\60"+ "\1\uffff\1\164\2\145\5\uffff\1\162\1\171\1\143\1\162\1\60\1\uffff"+ "\1\151\2\60\1\156\1\60\1\151\1\141\1\uffff\1\157\2\uffff\1\60\1"+ "\uffff\1\164\1\155\1\156\1\uffff\1\171\3\60\3\uffff"; static final String DFA7_maxS = "\1\175\1\157\1\156\1\154\1\165\1\150\1\46\1\174\1\75\2\157\1\150"+ "\1\141\1\145\1\162\1\141\2\162\11\uffff\1\52\5\uffff\3\75\1\172"+ "\1\166\2\172\1\163\1\162\1\156\1\154\1\151\6\uffff\1\162\1\144\2"+ "\162\1\164\1\162\1\160\1\157\1\165\11\uffff\1\172\2\uffff\1\145"+ "\1\172\1\143\1\163\1\154\5\172\1\165\2\141\1\147\1\145\1\uffff\1"+ "\172\1\uffff\1\164\2\145\5\uffff\1\162\1\171\1\143\1\162\1\172\1"+ "\uffff\1\151\2\172\1\156\1\172\1\151\1\141\1\uffff\1\157\2\uffff"+ "\1\172\1\uffff\1\164\1\155\1\156\1\uffff\1\171\3\172\3\uffff"; static final String DFA7_acceptS = "\22\uffff\1\27\1\30\1\31\1\32\1\33\1\34\1\35\1\36\1\37\1\uffff"+ "\1\41\1\42\1\43\1\44\1\45\14\uffff\1\6\1\47\1\7\1\50\1\54\1\10\11"+ "\uffff\1\40\1\46\1\55\1\51\1\52\1\56\1\53\1\57\1\1\1\uffff\1\2\1"+ "\16\17\uffff\1\12\1\uffff\1\4\3\uffff\1\11\1\13\1\14\1\15\1\17\5"+ "\uffff\1\3\7\uffff\1\25\1\uffff\1\26\1\5\1\uffff\1\21\3\uffff\1"+ "\20\4\uffff\1\24\1\23\1\22"; static final String DFA7_specialS = "\u0080\uffff}>"; static final String[] DFA7_transitionS = { "\2\32\1\uffff\2\32\22\uffff\1\32\1\10\4\uffff\1\6\1\uffff\1"+ "\23\1\24\1\40\1\36\1\22\1\37\1\uffff\1\33\12\34\1\uffff\1\27"+ "\1\43\1\41\1\42\2\uffff\32\35\1\30\1\uffff\1\31\1\uffff\1\35"+ "\1\uffff\1\16\1\35\1\17\1\1\1\3\1\4\2\35\1\2\3\35\1\12\2\35"+ "\1\20\1\35\1\15\1\13\1\21\1\35\1\14\1\5\1\11\2\35\1\25\1\7\1"+ "\26", "\1\45\5\uffff\1\44", "\1\46\7\uffff\1\47", "\1\50", "\1\53\15\uffff\1\51\5\uffff\1\52", "\1\54", "\1\55", "\1\57", "\1\61", "\1\63", "\1\64", "\1\65", "\1\66", "\1\67", "\1\70", "\1\71", "\1\72", "\1\73", "", "", "", "", "", "", "", "", "", "\1\74", "", "", "", "", "", "\1\76", "\1\100", "\1\102", "\12\35\7\uffff\32\35\4\uffff\1\35\1\uffff\32\35", "\1\105", "\12\35\7\uffff\32\35\4\uffff\1\35\1\uffff\32\35", "\12\35\7\uffff\32\35\4\uffff\1\35\1\uffff\32\35", "\1\110", "\1\111", "\1\112", "\1\113", "\1\114", "", "", "", "", "", "", "\1\115", "\1\116", "\1\120\5\uffff\1\117", "\1\121", "\1\122", "\1\123", "\1\124", "\1\125", "\1\126", "", "", "", "", "", "", "", "", "", "\12\35\7\uffff\32\35\4\uffff\1\35\1\uffff\32\35", "", "", "\1\130", "\12\35\7\uffff\32\35\4\uffff\1\35\1\uffff\32\35", "\1\132", "\1\133", "\1\134", "\12\35\7\uffff\32\35\4\uffff\1\35\1\uffff\32\35", "\12\35\7\uffff\32\35\4\uffff\1\35\1\uffff\32\35", "\12\35\7\uffff\32\35\4\uffff\1\35\1\uffff\32\35", "\12\35\7\uffff\32\35\4\uffff\1\35\1\uffff\32\35", "\12\35\7\uffff\32\35\4\uffff\1\35\1\uffff\32\35", "\1\142", "\1\143", "\1\144", "\1\145", "\1\146", "", "\12\35\7\uffff\32\35\4\uffff\1\35\1\uffff\32\35", "", "\1\150", "\1\151", "\1\152", "", "", "", "", "", "\1\153", "\1\154", "\1\155", "\1\156", "\12\35\7\uffff\32\35\4\uffff\1\35\1\uffff\32\35", "", "\1\160", "\12\35\7\uffff\32\35\4\uffff\1\35\1\uffff\32\35", "\12\35\7\uffff\32\35\4\uffff\1\35\1\uffff\32\35", "\1\163", "\12\35\7\uffff\32\35\4\uffff\1\35\1\uffff\32\35", "\1\165", "\1\166", "", "\1\167", "", "", "\12\35\7\uffff\32\35\4\uffff\1\35\1\uffff\32\35", "", "\1\171", "\1\172", "\1\173", "", "\1\174", "\12\35\7\uffff\32\35\4\uffff\1\35\1\uffff\32\35", "\12\35\7\uffff\32\35\4\uffff\1\35\1\uffff\32\35", "\12\35\7\uffff\32\35\4\uffff\1\35\1\uffff\32\35", "", "", "" }; static final short[] DFA7_eot = DFA.unpackEncodedString(DFA7_eotS); static final short[] DFA7_eof = DFA.unpackEncodedString(DFA7_eofS); static final char[] DFA7_min = DFA.unpackEncodedStringToUnsignedChars(DFA7_minS); static final char[] DFA7_max = DFA.unpackEncodedStringToUnsignedChars(DFA7_maxS); static final short[] DFA7_accept = DFA.unpackEncodedString(DFA7_acceptS); static final short[] DFA7_special = DFA.unpackEncodedString(DFA7_specialS); static final short[][] DFA7_transition; static { int numStates = DFA7_transitionS.length; DFA7_transition = new short[numStates][]; for (int i=0; i<numStates; i++) { DFA7_transition[i] = DFA.unpackEncodedString(DFA7_transitionS[i]); } } class DFA7 extends DFA { public DFA7(BaseRecognizer recognizer) { this.recognizer = recognizer; this.decisionNumber = 7; this.eot = DFA7_eot; this.eof = DFA7_eof; this.min = DFA7_min; this.max = DFA7_max; this.accept = DFA7_accept; this.special = DFA7_special; this.transition = DFA7_transition; } public String getDescription() { return "1:1: Tokens : ( DO | IF | ELSE | FOR | WHILE | AND | OR | NOT | XOR | INT_DIV | INT_MOD | SHR | SHL | IN | VAR | RETURN | ARRAY | CAPACITY | FUNCTION | PROGRAM | TRUE | FALSE | T__48 | T__49 | T__50 | T__51 | T__52 | T__53 | T__54 | T__55 | WS | ML_COMMENT | NUMBER | IDENTIFIER | ADD | SUB | MUL | DIV | BIT_AND | BIT_OR | ASSIGN | GE | LE | NOTEQUALS | EQUALS | GT | LT );"; } } }
[ "Manawyrm1" ]
Manawyrm1
749012bb36d4fa6bf56d83b523f8421e10838fdc
e977c424543422f49a25695665eb85bfc0700784
/benchmark/icse15/430143/buggy-version/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/procedureJdbc30.java
8fe85140d459865719b81581d17aa19218130c27
[]
no_license
amir9979/pattern-detector-experiment
17fcb8934cef379fb96002450d11fac62e002dd3
db67691e536e1550245e76d7d1c8dced181df496
refs/heads/master
2022-02-18T10:24:32.235975
2019-09-13T15:42:55
2019-09-13T15:42:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,085
java
/* Derby - Class org.apache.derbyTesting.functionTests.tests.lang.procedureJdbc30 Copyright 2003, 2005 The Apache Software Foundation or its licensors, as applicable. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package org.apache.derbyTesting.functionTests.tests.lang; import java.sql.*; import org.apache.derby.tools.ij; import java.io.PrintStream; import java.math.BigInteger; import java.math.BigDecimal; import org.apache.derbyTesting.functionTests.tests.jdbcapi.parameterMetaDataJdbc30; import org.apache.derbyTesting.functionTests.util.TestUtil; public class procedureJdbc30 { static private boolean isDerbyNet = false; static private String[] testObjects = { "TABLE MRS.FIVERS", "PROCEDURE MRS.FIVEJP"}; public static void main (String[] argv) throws Throwable { ij.getPropertyArg(argv); Connection conn = ij.startJBMS(); isDerbyNet = TestUtil.isNetFramework(); runTests( conn); } public static void runTests( Connection conn) throws Throwable { try { testMoreResults(conn); } catch (SQLException sqle) { org.apache.derby.tools.JDBCDisplayUtil.ShowSQLException(System.out, sqle); sqle.printStackTrace(System.out); } } private static void testMoreResults(Connection conn) throws SQLException { Statement s = conn.createStatement(); TestUtil.cleanUpTest(s, testObjects); s.executeUpdate("create table MRS.FIVERS(i integer)"); PreparedStatement ps = conn.prepareStatement("insert into MRS.FIVERS values (?)"); for (int i = 1; i <= 20; i++) { ps.setInt(1, i); ps.executeUpdate(); } ps.close(); // create a procedure that returns 5 result sets. s.executeUpdate("create procedure MRS.FIVEJP() parameter style JAVA READS SQL DATA dynamic result sets 5 language java external name 'org.apache.derbyTesting.functionTests.util.ProcedureTest.fivejp'"); CallableStatement cs = conn.prepareCall("CALL MRS.FIVEJP()"); ResultSet[] allRS = new ResultSet[5]; // execute the procedure that returns 5 result sets and then use the various // options of getMoreResults(). System.out.println("\n\nFetching result sets with getMoreResults()"); int pass = 0; cs.execute(); do { allRS[pass++] = cs.getResultSet(); System.out.println(" PASS " + pass + " got result set " + (allRS[pass -1] != null)); // expect everything except the current result set to be closed. showResultSetStatus(allRS); } while (cs.getMoreResults()); // check last one got closed showResultSetStatus(allRS); java.util.Arrays.fill(allRS, null); System.out.println("\n\nFetching result sets with getMoreResults(Statement.CLOSE_CURRENT_RESULT)"); pass = 0; cs.execute(); do { allRS[pass++] = cs.getResultSet(); System.out.println(" PASS " + pass + " got result set " + (allRS[pass -1] != null)); // expect everything except the current result set to be closed. showResultSetStatus(allRS); } while (cs.getMoreResults(Statement.CLOSE_CURRENT_RESULT)); // check last one got closed showResultSetStatus(allRS); java.util.Arrays.fill(allRS, null); System.out.println("\n\nFetching result sets with getMoreResults(Statement.CLOSE_ALL_RESULTS)"); pass = 0; cs.execute(); do { allRS[pass++] = cs.getResultSet(); System.out.println(" PASS " + pass + " got result set " + (allRS[pass -1] != null)); // expect everything except the current result set to be closed. showResultSetStatus(allRS); } while (cs.getMoreResults(Statement.CLOSE_ALL_RESULTS)); // check last one got closed showResultSetStatus(allRS); java.util.Arrays.fill(allRS, null); System.out.println("\n\nFetching result sets with getMoreResults(Statement.KEEP_CURRENT_RESULT)"); pass = 0; cs.execute(); do { allRS[pass++] = cs.getResultSet(); System.out.println(" PASS " + pass + " got result set " + (allRS[pass -1] != null)); // expect everything to stay open. showResultSetStatus(allRS); } while (cs.getMoreResults(Statement.KEEP_CURRENT_RESULT)); // All should still be open. showResultSetStatus(allRS); // now close them all. for (int i = 0; i < allRS.length; i++) { allRS[i].close(); } java.util.Arrays.fill(allRS, null); System.out.println("\n\nFetching result sets with getMoreResults(<mixture>)"); cs.execute(); System.out.println(" first two with KEEP_CURRENT_RESULT"); allRS[0] = cs.getResultSet(); boolean moreRS = cs.getMoreResults(Statement.KEEP_CURRENT_RESULT); if (!moreRS) System.out.println("FAIL - no second result set"); allRS[1] = cs.getResultSet(); // two open showResultSetStatus(allRS); System.out.println(" third with CLOSE_CURRENT_RESULT"); moreRS = cs.getMoreResults(Statement.CLOSE_CURRENT_RESULT); if (!moreRS) System.out.println("FAIL - no third result set"); allRS[2] = cs.getResultSet(); // first and third open, second closed showResultSetStatus(allRS); System.out.println(" fourth with KEEP_CURRENT_RESULT"); moreRS = cs.getMoreResults(Statement.KEEP_CURRENT_RESULT); if (!moreRS) System.out.println("FAIL - no fourth result set"); allRS[3] = cs.getResultSet(); // first, third and fourth open, second closed showResultSetStatus(allRS); System.out.println(" fifth with CLOSE_ALL_RESULTS"); moreRS = cs.getMoreResults(Statement.CLOSE_ALL_RESULTS); if (!moreRS) System.out.println("FAIL - no fifth result set"); allRS[4] = cs.getResultSet(); // only fifth open showResultSetStatus(allRS); System.out.println(" no more results with with KEEP_CURRENT_RESULT"); moreRS = cs.getMoreResults(Statement.KEEP_CURRENT_RESULT); if (moreRS) System.out.println("FAIL - too many result sets"); // only fifth open showResultSetStatus(allRS); allRS[4].close(); java.util.Arrays.fill(allRS, null); System.out.println("\n\nFetching result sets with getMoreResults(Statement.KEEP_CURRENT_RESULT) and checking that cs.execute() closes them"); pass = 0; cs.execute(); do { allRS[pass++] = cs.getResultSet(); System.out.println(" PASS " + pass + " got result set " + (allRS[pass -1] != null)); // expect everything to stay open. showResultSetStatus(allRS); } while (cs.getMoreResults(Statement.KEEP_CURRENT_RESULT)); System.out.println(" fetched all results"); // All should still be open. showResultSetStatus(allRS); System.out.println(" executing statement"); cs.execute(); // all should be closed. showResultSetStatus(allRS); java.util.Arrays.fill(allRS, null); System.out.println("\n\nFetching result sets with getMoreResults(Statement.KEEP_CURRENT_RESULT) and checking that cs.close() closes them"); pass = 0; // using execute from above. do { allRS[pass++] = cs.getResultSet(); System.out.println(" PASS " + pass + " got result set " + (allRS[pass -1] != null)); // expect everything to stay open. showResultSetStatus(allRS); } while (cs.getMoreResults(Statement.KEEP_CURRENT_RESULT)); System.out.println(" fetched all results"); // All should still be open. showResultSetStatus(allRS); System.out.println(" closing statement"); cs.close(); // all should be closed. showResultSetStatus(allRS); java.util.Arrays.fill(allRS, null); } private static void showResultSetStatus(ResultSet[] allRS) { for (int i = 0; i < allRS.length; i++) { try { ResultSet rs = allRS[i]; if (rs == null) continue; rs.next(); System.out.println(" RS (" + (i + 1) + ") val " + rs.getInt(1)); } catch (SQLException sqle) { System.out.println(" Exception - " + sqle.getMessage()); } } } }
[ "durieuxthomas@hotmail.com" ]
durieuxthomas@hotmail.com
99d11a3d9ff6f52d9927414ddce2f5abf423d16a
66801aed4edd95d1dfd418fad9f64194a2f4ab21
/OperationalReport/src/mvcapital/bancopaulista/cnab/Header.java
e2db00e4fe83c8c8be90a29a104b045f8a82afa3
[]
no_license
smoisesr/fidc
7de156cf5ea18030c3c2ec08e5de273998bc88b6
e2de133b35a556d1eae329908f04e2f1a167309e
refs/heads/master
2021-01-02T09:34:14.156385
2015-07-01T16:42:11
2015-07-01T16:42:11
38,376,726
0
0
null
null
null
null
UTF-8
Java
false
false
4,872
java
package mvcapital.bancopaulista.cnab; public class Header extends Register { private Campo identificacaoArquivoRemessa=new Campo(); private Campo literalRemessa=new Campo(); private Campo codigoServico=new Campo(); private Campo literalServico=new Campo(); private Campo codigoOriginador=new Campo(); private Campo nomeOriginador=new Campo(); private Campo numeroBancoPaulista=new Campo(); private Campo nomeBanco=new Campo(); private Campo dataGravacaoArquivo=new Campo(); private Campo branco=new Campo(); private Campo identificacaoSistema=new Campo(); private Campo numeroSequencialArquivo=new Campo(); private Campo branco1=new Campo(); public Header() { super(); // private int numero=0; // private int posicaoInicial=0; // private int posicaoFinal=0; // private int tamanho=0; // private boolean obrigatorio=true; // private TipoCampo tipo=new TipoCampo(); // private int decimais=0; // private String conteudo=""; this.identificacaoDoRegistro.setConteudo("0"); this.identificacaoArquivoRemessa=new Campo(2,2,2,1,true,Register.campoNumerico,0,"1"); this.literalRemessa=new Campo(3,3,9,7,true,Register.campoAlfaNumerico,0,""); this.codigoServico=new Campo(4,10,11,2,true,Register.campoNumerico,0,"01"); this.literalServico=new Campo(5,12,26,15,true,Register.campoAlfaNumerico,0,""); this.codigoOriginador=new Campo(6,27,46,20,true,Register.campoNumerico,0,""); this.nomeOriginador=new Campo(7,47,76,30,true,Register.campoAlfaNumerico,0,""); this.numeroBancoPaulista=new Campo(8,77,79,3,true,Register.campoNumerico,0,"611"); this.nomeBanco=new Campo(9,80,94,15,true,Register.campoAlfaNumerico,0,"PAULISTA S.A."); this.dataGravacaoArquivo=new Campo(10,95,100,6,true,Register.campoNumerico,0,""); this.branco=new Campo(11,101,108,8,true,Register.campoAlfaNumerico,0,""); this.identificacaoSistema=new Campo(12,109,110,2,true,Register.campoAlfaNumerico,0,"MX"); this.numeroSequencialArquivo=new Campo(13,111,117,7,true,Register.campoNumerico,0,""); this.branco1=new Campo(14,118,394,277,true,Register.campoAlfaNumerico,0,""); this.numeroSequencialRegistro=new Campo(15,395,400,6,true,Register.campoNumerico,0,""); } public Campo getIdentificacaoArquivoRemessa() { return identificacaoArquivoRemessa; } public void setIdentificacaoArquivoRemessa(Campo identificacaoArquivoRemessa) { this.identificacaoArquivoRemessa = identificacaoArquivoRemessa; } public Campo getLiteralRemessa() { return literalRemessa; } public void setLiteralRemessa(Campo literalRemessa) { this.literalRemessa = literalRemessa; } public Campo getCodigoServico() { return codigoServico; } public void setCodigoServico(Campo codigoServico) { this.codigoServico = codigoServico; } public Campo getLiteralServico() { return literalServico; } public void setLiteralServico(Campo literalServico) { this.literalServico = literalServico; } public Campo getCodigoOriginador() { return codigoOriginador; } public void setCodigoOriginador(Campo codigoOriginador) { this.codigoOriginador = codigoOriginador; } public Campo getNomeOriginador() { return nomeOriginador; } public void setNomeOriginador(Campo nomeOriginador) { this.nomeOriginador = nomeOriginador; } public Campo getNumeroBancoPaulista() { return numeroBancoPaulista; } public void setNumeroBancoPaulista(Campo numeroBancoPaulista) { this.numeroBancoPaulista = numeroBancoPaulista; } public Campo getNomeBanco() { return nomeBanco; } public void setNomeBanco(Campo nomeBanco) { this.nomeBanco = nomeBanco; } public Campo getDataGravacaoArquivo() { return dataGravacaoArquivo; } public void setDataGravacaoArquivo(Campo dataGravacaoArquivo) { this.dataGravacaoArquivo = dataGravacaoArquivo; } public Campo getBranco() { return branco; } public void setBranco(Campo branco) { this.branco = branco; } public Campo getIdentificacaoSistema() { return identificacaoSistema; } public void setIdentificacaoSistema(Campo identificacaoSistema) { this.identificacaoSistema = identificacaoSistema; } public Campo getNumeroSequencialArquivo() { return numeroSequencialArquivo; } public void setNumeroSequencialArquivo(Campo numeroSequencialArquivo) { this.numeroSequencialArquivo = numeroSequencialArquivo; } public Campo getBranco1() { return branco1; } public void setBranco1(Campo branco1) { this.branco1 = branco1; } public Campo getNumeroSequencialRegistro() { return numeroSequencialRegistro; } public void setNumeroSequencialRegistro(Campo numeroSequencialRegistro) { this.numeroSequencialRegistro = numeroSequencialRegistro; } }
[ "smoisesr@gmail.com" ]
smoisesr@gmail.com
bf420be1d4de0fc49c45896f098dbaf6c1916a69
5ca3901b424539c2cf0d3dda52d8d7ba2ed91773
/src_cfr/com/google/common/collect/ImmutableListMultimap$Builder.java
c77210f011a589ab5315cb6d1a5d1e5b590aa1dc
[]
no_license
fjh658/bindiff
c98c9c24b0d904be852182ecbf4f81926ce67fb4
2a31859b4638404cdc915d7ed6be19937d762743
refs/heads/master
2021-01-20T06:43:12.134977
2016-06-29T17:09:03
2016-06-29T17:09:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,839
java
/* * Decompiled with CFR 0_115. */ package com.google.common.collect; import com.google.common.annotations.Beta; import com.google.common.collect.ImmutableListMultimap; import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.ImmutableMultimap$Builder; import com.google.common.collect.Multimap; import java.util.Comparator; import java.util.Map; public final class ImmutableListMultimap$Builder extends ImmutableMultimap$Builder { @Override public ImmutableListMultimap$Builder put(Object object, Object object2) { super.put(object, object2); return this; } @Override public ImmutableListMultimap$Builder put(Map.Entry entry) { super.put(entry); return this; } @Beta @Override public ImmutableListMultimap$Builder putAll(Iterable iterable) { super.putAll(iterable); return this; } @Override public ImmutableListMultimap$Builder putAll(Object object, Iterable iterable) { super.putAll(object, iterable); return this; } @Override public /* varargs */ ImmutableListMultimap$Builder putAll(Object object, Object ... arrobject) { super.putAll(object, arrobject); return this; } @Override public ImmutableListMultimap$Builder putAll(Multimap multimap) { super.putAll(multimap); return this; } @Override public ImmutableListMultimap$Builder orderKeysBy(Comparator comparator) { super.orderKeysBy(comparator); return this; } @Override public ImmutableListMultimap$Builder orderValuesBy(Comparator comparator) { super.orderValuesBy(comparator); return this; } @Override public ImmutableListMultimap build() { return (ImmutableListMultimap)super.build(); } }
[ "manouchehri@riseup.net" ]
manouchehri@riseup.net
e2081b96187c9aeec48683d9070734b2dedb27ed
f6613362a4576374217f69d664ebacd087b438df
/PermissionsDispatcher-master/androidTraining/src/main/java/cn/com/hakim/androidtraining/utill/FileUtil.java
3a05dd870e948315e87ce708f3bc8227a584d313
[ "Apache-2.0" ]
permissive
basion/androidTraining
1668a530b474b95a12e3045d66ef38fea00b6294
da9997b17b2b50a38c21d10c2fe4a3ff170b8988
refs/heads/master
2021-01-20T19:15:46.301553
2017-04-11T09:06:30
2017-04-11T09:06:30
65,881,156
0
0
null
null
null
null
UTF-8
Java
false
false
10,807
java
/* * Copyright 2015 Yan Zhenjie * * 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 cn.com.hakim.androidtraining.utill; import android.annotation.SuppressLint; import android.content.Intent; import android.net.Uri; import android.os.Build; import android.os.Environment; import android.os.StatFs; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Writer; /** * Created in Sep 10, 2015 4:22:18 PM. * * @author Yan Zhenjie. */ public class FileUtil { /** * 得到SD卡根目录. */ public static File getRootPath() { File path = null; if (FileUtil.sdCardIsAvailable()) { path = Environment.getExternalStorageDirectory(); // 取得sdcard文件路径 } else { path = Environment.getDataDirectory(); } return path; } /** * SD卡是否可用. */ public static boolean sdCardIsAvailable() { if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { File sd = new File(Environment.getExternalStorageDirectory().getPath()); return sd.canWrite(); } else return false; } /** * 文件或者文件夹是否存在. */ public static boolean fileExists(String filePath) { File file = new File(filePath); return file.exists(); } public static void deleleFile(String path) { deleteFile(new File(path)); } public static void deleteFile(File file) { if (file != null && file.exists()) file.delete(); } /** * 删除指定文件夹下所有文件, 保留文件夹. */ public static boolean delAllFile(String path) { boolean flag = false; File file = new File(path); if (!file.exists()) { return flag; } if (file.isFile()) { file.delete(); return true; } File[] files = file.listFiles(); for (int i = 0; i < files.length; i++) { File exeFile = files[i]; if (exeFile.isDirectory()) { delAllFile(exeFile.getAbsolutePath()); } else { exeFile.delete(); } } return flag; } /** * 文件复制. */ public static boolean copy(String srcFile, String destFile) { try { FileInputStream in = new FileInputStream(srcFile); FileOutputStream out = new FileOutputStream(destFile); byte[] bytes = new byte[1024]; int c; while ((c = in.read(bytes)) != -1) { out.write(bytes, 0, c); } in.close(); out.flush(); out.close(); } catch (Exception e) { return false; } return true; } /** * 复制整个文件夹内. * * @param oldPath string 原文件路径如:c:/fqf. * @param newPath string 复制后路径如:f:/fqf/ff. */ public static void copyFolder(String oldPath, String newPath) { try { (new File(newPath)).mkdirs(); // 如果文件夹不存在 则建立新文件夹 File a = new File(oldPath); String[] file = a.list(); File temp = null; for (int i = 0; i < file.length; i++) { if (oldPath.endsWith(File.separator)) { temp = new File(oldPath + file[i]); } else { temp = new File(oldPath + File.separator + file[i]); } if (temp.isFile()) { FileInputStream input = new FileInputStream(temp); FileOutputStream output = new FileOutputStream(newPath + "/" + (temp.getName()).toString()); byte[] b = new byte[1024 * 5]; int len; while ((len = input.read(b)) != -1) { output.write(b, 0, len); } output.flush(); output.close(); input.close(); } if (temp.isDirectory()) {// 如果是子文件夹 copyFolder(oldPath + "/" + file[i], newPath + "/" + file[i]); } } } catch (NullPointerException e) { } catch (Exception e) { } } /** * 重命名文件. */ public static boolean renameFile(String resFilePath, String newFilePath) { File resFile = new File(resFilePath); File newFile = new File(newFilePath); return resFile.renameTo(newFile); } /** * 获取磁盘可用空间. */ @SuppressWarnings("deprecation") @SuppressLint("NewApi") public static long getSDCardAvailaleSize() { File path = getRootPath(); StatFs stat = new StatFs(path.getPath()); long blockSize, availableBlocks; if (Build.VERSION.SDK_INT >= 18) { blockSize = stat.getBlockSizeLong(); availableBlocks = stat.getAvailableBlocksLong(); } else { blockSize = stat.getBlockSize(); availableBlocks = stat.getAvailableBlocks(); } return availableBlocks * blockSize; } /** * 获取某个目录可用大小. */ @SuppressLint("NewApi") @SuppressWarnings("deprecation") public static long getDirSize(String path) { StatFs stat = new StatFs(path); long blockSize, availableBlocks; if (Build.VERSION.SDK_INT >= 18) { blockSize = stat.getBlockSizeLong(); availableBlocks = stat.getAvailableBlocksLong(); } else { blockSize = stat.getBlockSize(); availableBlocks = stat.getAvailableBlocks(); } return availableBlocks * blockSize; } /** * 获取文件或者文件夹大小. */ public static long getFileAllSize(String path) { File file = new File(path); if (file.exists()) { if (file.isDirectory()) { File[] childrens = file.listFiles(); long size = 0; for (File f : childrens) { size += getFileAllSize(f.getPath()); } return size; } else { return file.length(); } } else { return 0; } } /** * 创建一个文件. */ public static boolean initFile(String path) { boolean result = false; try { File file = new File(path); if (!file.exists()) { result = file.createNewFile(); } else if (file.isDirectory()) { file.delete(); result = file.createNewFile(); } else if (file.exists()) { result = true; } } catch (IOException e) { e.printStackTrace(); } return result; } /** * 创建一个文件夹. */ public static boolean initDirectory(String path) { boolean result = false; File file = new File(path); if (!file.exists()) { result = file.mkdir(); } else if (!file.isDirectory()) { file.delete(); result = file.mkdir(); } else if (file.exists()) { result = true; } return result; } /** * 复制文件. */ public static void copyFile(File from, File to) throws IOException { if (!from.exists()) { throw new IOException("The source file not exist: " + from.getAbsolutePath()); } FileInputStream fis = new FileInputStream(from); try { copyFile(fis, to); } finally { fis.close(); } } /** * 复制文件. */ public static long copyFile(InputStream from, File to) throws IOException { long totalBytes = 0; FileOutputStream fos = new FileOutputStream(to, false); try { byte[] data = new byte[1024]; int len; while ((len = from.read(data)) > -1) { fos.write(data, 0, len); totalBytes += len; } fos.flush(); } finally { fos.close(); } return totalBytes; } /** * 保存流到文件. */ public static void saveFile(InputStream inputStream, String filePath) { try { OutputStream outputStream = new FileOutputStream(new File(filePath), false); int len; byte[] buffer = new byte[1024]; while ((len = inputStream.read(buffer)) != -1) { outputStream.write(buffer, 0, len); } outputStream.flush(); outputStream.close(); } catch (IOException e) { e.printStackTrace(); } } /** * 用UTF8保存一个文件. */ public static void saveFileUTF8(String path, String content, Boolean append) throws IOException { FileOutputStream fos = new FileOutputStream(path, append); Writer out = new OutputStreamWriter(fos, "UTF-8"); out.write(content); out.flush(); out.close(); fos.flush(); fos.close(); } /** * 用UTF8读取一个文件. */ public static String getFileUTF8(String path) { String result = ""; InputStream fin = null; try { fin = new FileInputStream(path); int length = fin.available(); byte[] buffer = new byte[length]; fin.read(buffer); fin.close(); result = new String(buffer, "UTF-8"); } catch (Exception e) { } return result; } /** * 得到一个文件Intent. */ public static Intent getFileIntent(String path, String mimeType) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(path)), mimeType); return intent; } }
[ "13040906352@163.com" ]
13040906352@163.com
1962f30db6318c6ad35af1e7405885213c089b9c
23d21d575da06d8a0f0c3a266915df321b5154eb
/java/patternsample/src/main/java/pattern/sample/patternuse14/v1/weapon/WeaponAdapter.java
02c6989643ef318c82aeae7d61f86dd3bcaf7cd9
[]
no_license
keepinmindsh/sample
180431ce7fce20808e65d885eab1ca3dca4a76a9
4169918f432e9008b4715f59967f3c0bd619d3e6
refs/heads/master
2023-04-30T19:26:44.510319
2023-04-23T12:43:43
2023-04-23T12:43:43
248,352,910
4
0
null
2023-03-05T23:20:43
2020-03-18T22:03:16
Java
UTF-8
Java
false
false
401
java
package pattern.sample.patternuse14.v1.weapon; import lombok.RequiredArgsConstructor; import pattern.sample.patternuse14.v1.weapon.inf.Weapon; import pattern.sample.patternuse14.v2.weapon.NewWeapon; @RequiredArgsConstructor public class WeaponAdapter implements Weapon { private final NewWeapon newWeapon; @Override public void checkStatus() { newWeapon.checkStatus(); } }
[ "keepinmindsh@gmail.com" ]
keepinmindsh@gmail.com
34e8d7e585a389c0b3af282890d328a84d25c811
065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be
/drjava_cluster/15561/tar_0.java
0a72f56ebfe1ee391517874d955ea63529548641
[]
no_license
martinezmatias/GenPat-data-C3
63cfe27efee2946831139747e6c20cf952f1d6f6
b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4
refs/heads/master
2022-04-25T17:59:03.905613
2020-04-15T14:41:34
2020-04-15T14:41:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
22,458
java
/*BEGIN_COPYRIGHT_BLOCK * * This file is part of DrJava. Download the current version of this project: * http://sourceforge.net/projects/drjava/ or http://www.drjava.org/ * * DrJava Open Source License * * Copyright (C) 2001-2003 JavaPLT group at Rice University (javaplt@rice.edu) * All rights reserved. * * Developed by: Java Programming Languages Team * Rice University * http://www.cs.rice.edu/~javaplt/ * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal with the Software without restriction, including without * limitation the rights to use, copy, modify, merge, publish, distribute, * sublicense, and/or sell copies of the Software, and to permit persons to * whom the Software is furnished to do so, subject to the following * conditions: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimers. * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimers in the * documentation and/or other materials provided with the distribution. * - Neither the names of DrJava, the JavaPLT, Rice University, nor the * names of its contributors may be used to endorse or promote products * derived from this Software without specific prior written permission. * - Products derived from this software may not be called "DrJava" nor * use the term "DrJava" as part of their names without prior written * permission from the JavaPLT group. For permission, write to * javaplt@rice.edu. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS WITH THE SOFTWARE. * END_COPYRIGHT_BLOCK*/ package edu.rice.cs.drjava.ui; import javax.swing.*; import javax.swing.text.*; import javax.swing.event.*; import javax.swing.border.Border; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.awt.Toolkit; import java.awt.Color; import java.awt.Event; import java.awt.RenderingHints; import java.awt.Graphics; import java.awt.Graphics2D; import edu.rice.cs.drjava.DrJava; import edu.rice.cs.drjava.config.OptionConstants; import edu.rice.cs.drjava.config.OptionListener; import edu.rice.cs.drjava.config.OptionEvent; import edu.rice.cs.drjava.model.repl.*; //import edu.rice.cs.drjava.model.repl.InputListener; import edu.rice.cs.util.swing.SwingWorker; import edu.rice.cs.util.swing.PopupConsole; import edu.rice.cs.util.UnexpectedException; /** * This class installs listeners and actions between an InteractionsDocument * in the model and an InteractionsPane in the view. * <p> * We may want to refactor this class into a different package. * <p> * (The PopupConsole was introduced in version 1.29 of this file) * * @version $Id$ */ public class InteractionsController extends AbstractConsoleController { /** * InteractionsModel to handle interpretation */ protected InteractionsModel _model; /** * Document from the model. */ protected InteractionsDocument _doc; /** * Style to use for error messages. */ protected SimpleAttributeSet _errStyle; /** * Style to use for debug messages. */ protected final SimpleAttributeSet _debugStyle; PopupConsole _popupConsole = new PopupConsole(_pane, new InputBox(), "Standard Input (System.in)"); /** * Listens for input requests from ,System.in displaying an input box as needed. */ protected InputListener _inputListener = new InputListener() { public String getConsoleInput() { return _popupConsole.getConsoleInput(); } }; private InteractionsListener _viewListener = new InteractionsListener() { public void interactionStarted() {} public void interactionEnded() {} public void interactionErrorOccurred(int offset, int length) {} public void interpreterResetting() { _adapter.clearColoring(); _pane.resetPrompts(); } public void interpreterReady() { } public void interpreterResetFailed(Throwable t) {} public void interpreterExited(int status) {} public void interpreterChanged(boolean inProgress) {} public void interactionIncomplete() { } }; /** * Glue together the given model and a new view. * @param model An InteractionsModel * @param adapter InteractionsDocumentAdapter being used by the model's doc */ public InteractionsController(final InteractionsModel model, InteractionsDocumentAdapter adapter) { this(model, adapter, new InteractionsPane(adapter) { public int getPromptPos() { return model.getDocument().getPromptPos(); } }); } /** * Glue together the given model and view. * @param model An InteractionsModel * @param adapter InteractionsDocumentAdapter being used by the model's doc * @param pane An InteractionsPane */ public InteractionsController(InteractionsModel model, InteractionsDocumentAdapter adapter, InteractionsPane pane) { super(adapter, pane); DefaultEditorKit d = pane.EDITOR_KIT; for(Action a : d.getActions()) { if(a.getValue(Action.NAME).equals(DefaultEditorKit.upAction)) defaultUpAction = a; if(a.getValue(Action.NAME).equals(DefaultEditorKit.downAction)) defaultDownAction = a; } _model = model; _doc = model.getDocument(); _errStyle = new SimpleAttributeSet(); _debugStyle = new SimpleAttributeSet(); _model.setInputListener(_inputListener); _model.addListener(_viewListener); _init(); } /** * Gets the input listener for console input requests. */ public InputListener getInputListener() { return _inputListener; } /** * Notifies the inputEnteredAction. Called by DefaultGlobalModel when reset is called so * that this lock is released. */ public void notifyInputEnteredAction() { _popupConsole.interruptConsole(); } /** * Inserts text into the console. This waits for the console to be * ready, so it should not be called unless a call to getConsoleInput * has been made or will be made shortly. */ public void insertConsoleText(String input) { try { _popupConsole.waitForConsoleReady(); } catch (InterruptedException ie) { } _popupConsole.insertConsoleText(input); } /** * Accessor method for the InteractionsModel. */ public InteractionsModel getInteractionsModel() { return _model; } /** * Allows the abstract superclass to use the document. * @return the InteractionsDocument */ public ConsoleDocument getConsoleDoc() { return _doc; } /** * Accessor method for the InteractionsDocument. */ public InteractionsDocument getDocument() { return _doc; } /** * Adds AttributeSets as named styles to the document adapter. */ protected void _addDocumentStyles() { // Add AbstractConsoleController styles super._addDocumentStyles(); // Error _errStyle.addAttributes(_defaultStyle); _errStyle.addAttribute(StyleConstants.Foreground, DrJava.getConfig().getSetting(OptionConstants.INTERACTIONS_ERROR_COLOR)); _errStyle.addAttribute(StyleConstants.Bold, Boolean.TRUE); _adapter.setDocStyle(InteractionsDocument.ERROR_STYLE, _errStyle); DrJava.getConfig().addOptionListener(OptionConstants.INTERACTIONS_ERROR_COLOR, new OptionListener<Color>() { public void optionChanged(OptionEvent<Color> oe) { _errStyle.addAttribute(StyleConstants.Foreground, oe.value); } }); // Debug _debugStyle.addAttributes(_defaultStyle); _debugStyle.addAttribute(StyleConstants.Foreground, DrJava.getConfig().getSetting(OptionConstants.DEBUG_MESSAGE_COLOR)); _debugStyle.addAttribute(StyleConstants.Bold, Boolean.TRUE); _adapter.setDocStyle(InteractionsDocument.DEBUGGER_STYLE, _debugStyle); DrJava.getConfig().addOptionListener(OptionConstants.DEBUG_MESSAGE_COLOR, new OptionListener<Color>() { public void optionChanged(OptionEvent<Color> oe) { _debugStyle.addAttribute(StyleConstants.Foreground, oe.value); } }); } /** * Updates all document styles with the attributes contained in newSet. * This behavior is only used in Mac OS X, JDK 1.4.1, since * setFont() works fine on JTextPane on all other tested platforms. * @param newSet Style containing new attributes to use. */ protected void _updateStyles(AttributeSet newSet) { super._updateStyles(newSet); _errStyle.addAttributes(newSet); StyleConstants.setBold(_errStyle, true); // ensure err is always bold _debugStyle.addAttributes(newSet); StyleConstants.setBold(_debugStyle, true); // ensure debug is always bold } /** * Adds listeners to the model. */ protected void _setupModel() { _adapter.addDocumentListener(new CaretUpdateListener()); _doc.setBeep(_pane.getBeep()); } /** * Adds actions to the view. */ protected void _setupView() { super._setupView(); // Get proper cross-platform mask. int mask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); // Add actions with keystrokes _pane.addActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), evalAction); _pane.addActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, java.awt.Event.SHIFT_MASK), newLineAction); _pane.addActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_B, mask), clearCurrentAction); // Up and down need to be bound both for keypad and not _pane.addActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_KP_UP, 0), moveUpAction); _pane.addActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), moveUpAction); _pane.addActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_UP, mask), historyPrevAction); _pane.addActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_KP_DOWN, 0), moveDownAction); _pane.addActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), moveDownAction); _pane.addActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, mask), historyNextAction); _pane.addActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), historyReverseSearchAction); _pane.addActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, java.awt.Event.SHIFT_MASK), historyForwardSearchAction); // Left needs to be prevented from rolling cursor back before the prompt. // Both left and right should lock when caret is before the prompt. // Caret is allowed before the prompt for the purposes of mouse-based copy- // and-paste. _pane.addActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_KP_LEFT, 0), moveLeftAction); _pane.addActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), moveLeftAction); _pane.addActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_KP_RIGHT, 0), moveRightAction); _pane.addActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), moveRightAction); // Prevent previous word action from going past the prompt _pane.addActionForKeyStroke(DrJava.getConfig().getSetting(OptionConstants.KEY_PREVIOUS_WORD), prevWordAction); DrJava.getConfig().addOptionListener(OptionConstants.KEY_PREVIOUS_WORD, new OptionListener<KeyStroke>() { public void optionChanged(OptionEvent<KeyStroke> oe) { _pane.addActionForKeyStroke(DrJava.getConfig().getSetting(OptionConstants.KEY_PREVIOUS_WORD), prevWordAction); } }); _pane.addActionForKeyStroke(DrJava.getConfig().getSetting(OptionConstants.KEY_NEXT_WORD), nextWordAction); DrJava.getConfig().addOptionListener(OptionConstants.KEY_NEXT_WORD, new OptionListener<KeyStroke>() { public void optionChanged(OptionEvent<KeyStroke> oe) { _pane.addActionForKeyStroke(DrJava.getConfig().getSetting(OptionConstants.KEY_NEXT_WORD), nextWordAction); } }); } // The fields below were made package private for testing purposes. /** * Evaluates the interaction on the current line. */ AbstractAction evalAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { SwingWorker worker = new SwingWorker() { public Object construct() { if(! _adapter.isInCommentBlock()) { //Eventually check if it's in a block statement as well? _model.interpretCurrentInteraction(); } else { _model.addNewLine(); _model.interactionContinues(); } return null; } }; worker.start(); } }; /** * Recalls the previous command from the history. */ AbstractAction historyPrevAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { if (!_busy()) { if(_doc.recallPreviousInteractionInHistory()) moveToEnd(); if(!_isCursorAfterPrompt()) moveToPrompt(); } } }; /** * Recalls the next command from the history. */ AbstractAction historyNextAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { if (!_busy()) { if(_doc.recallNextInteractionInHistory() || !_isCursorAfterPrompt()) moveToPrompt(); } } }; /** * Added feature for up. If the cursor is on the first line of the current interaction, it goes into the history. * Otherwise, stays within the current interaction */ AbstractAction moveUpAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { if (!_busy()) { if(_shouldGoIntoHistory(_doc.getPromptPos(), _pane.getCaretPosition())) { historyPrevAction.actionPerformed(e); } else { defaultUpAction.actionPerformed(e); if(! _isCursorAfterPrompt()) { moveToPrompt(); } } } } }; /** * Added feature for down. If the cursor is on the last line of the current interaction, it goes into the history. * Otherwise, stays within the current interaction */ AbstractAction moveDownAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { if(!_busy()) { if(_shouldGoIntoHistory(_pane.getCaretPosition(), _adapter.getLength())) { historyNextAction.actionPerformed(e); } else { defaultDownAction.actionPerformed(e); } } } }; /** * Tests whether or not to move into the history * @return true iff there are no "\n" characters between the start and the end */ private boolean _shouldGoIntoHistory(int start, int end) { if(_isCursorAfterPrompt() && end >= start) { String text = ""; try { text = _adapter.getText(start, end - start); } catch(BadLocationException ble) { throw new UnexpectedException(ble); //The conditional should prevent this from ever happening } if(text.indexOf("\n") != -1) return false; //moveIntoHistory = true; } return true; } private boolean _isCursorAfterPrompt() { return _pane.getCaretPosition() >= _doc.getPromptPos(); } Action defaultUpAction; Action defaultDownAction; /** * Reverse searches in the history. */ AbstractAction historyReverseSearchAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { if (!_busy()) { _doc.reverseSearchInteractionsInHistory(); moveToEnd(); } } }; /** * Forward searches in the history. */ AbstractAction historyForwardSearchAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { if (!_busy()) { _doc.forwardSearchInteractionsInHistory(); moveToEnd(); } } }; /** * Moves the caret left or wraps around. */ AbstractAction moveLeftAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { if (!_busy()) { int position = _pane.getCaretPosition(); if (position < _doc.getPromptPos()) { moveToPrompt(); } else if (position == _doc.getPromptPos()) { // Wrap around to the end moveToEnd(); } else { // position > _doc.getPromptPos() _pane.setCaretPosition(position - 1); } } } }; /** * Moves the caret right or wraps around. */ AbstractAction moveRightAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { int position = _pane.getCaretPosition(); if (position < _doc.getPromptPos()) { moveToEnd(); } else if (position >= _doc.getDocLength()) { // Wrap around to the start moveToPrompt(); } else { // position between prompt and end _pane.setCaretPosition(position + 1); } } }; /** * Skips back one word. Doesn't move past the prompt. */ AbstractAction prevWordAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { int position = _pane.getCaretPosition(); int promptPos = _doc.getPromptPos(); if (position < promptPos) { moveToPrompt(); } else if (position == promptPos) { // Wrap around to the end moveToEnd(); } else { _pane.getActionMap().get(DefaultEditorKit.previousWordAction).actionPerformed(e); } } }; /** * Skips forward one word. Doesn't move past the prompt. */ AbstractAction nextWordAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { int position = _pane.getCaretPosition(); int promptPos = _doc.getPromptPos(); if (position < promptPos) { moveToEnd(); } else if (position >= _doc.getDocLength()) { // Wrap around to the start moveToPrompt(); } else { _pane.getActionMap().get(DefaultEditorKit.nextWordAction).actionPerformed(e); } } }; /** * A box that can be inserted into the interactions pane for separate input. */ protected static class InputBox extends JTextArea { private static final int BORDER_WIDTH = 1; private static final int INNER_BUFFER_WIDTH = 3; private static final int OUTER_BUFFER_WIDTH = 2; private Color _bgColor = DrJava.getConfig().getSetting(OptionConstants.DEFINITIONS_BACKGROUND_COLOR); private Color _fgColor = DrJava.getConfig().getSetting(OptionConstants.DEFINITIONS_NORMAL_COLOR); private Color _sysInColor = DrJava.getConfig().getSetting(OptionConstants.SYSTEM_IN_COLOR); private boolean _antiAliasText = DrJava.getConfig().getSetting(OptionConstants.TEXT_ANTIALIAS); public InputBox() { setForeground(_sysInColor); setBackground(_bgColor); setCaretColor(_fgColor); setBorder(_createBorder()); setLineWrap(true); DrJava.getConfig().addOptionListener(OptionConstants.DEFINITIONS_NORMAL_COLOR, new OptionListener<Color>() { public void optionChanged(OptionEvent<Color> oe) { _fgColor = oe.value; setBorder(_createBorder()); setCaretColor(oe.value); } }); DrJava.getConfig().addOptionListener(OptionConstants.DEFINITIONS_BACKGROUND_COLOR, new OptionListener<Color>() { public void optionChanged(OptionEvent<Color> oe) { _bgColor = oe.value; setBorder(_createBorder()); setBackground(oe.value); } }); DrJava.getConfig().addOptionListener(OptionConstants.SYSTEM_IN_COLOR, new OptionListener<Color>() { public void optionChanged(OptionEvent<Color> oe) { _sysInColor = oe.value; setForeground(oe.value); } }); DrJava.getConfig().addOptionListener(OptionConstants.TEXT_ANTIALIAS, new OptionListener<Boolean>() { public void optionChanged(OptionEvent<Boolean> oce) { _antiAliasText = oce.value.booleanValue(); InputBox.this.repaint(); } }); } private Border _createBorder() { Border outerouter = BorderFactory.createLineBorder(_bgColor, OUTER_BUFFER_WIDTH); Border outer = BorderFactory.createLineBorder(_fgColor, BORDER_WIDTH); Border inner = BorderFactory.createLineBorder(_bgColor, INNER_BUFFER_WIDTH); Border temp = BorderFactory.createCompoundBorder(outer, inner); return BorderFactory.createCompoundBorder(outerouter, temp); } /** * Enable anti-aliased text by overriding paintComponent. */ protected void paintComponent(Graphics g) { if (_antiAliasText && g instanceof Graphics2D) { Graphics2D g2d = (Graphics2D)g; g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); } super.paintComponent(g); } } }
[ "375833274@qq.com" ]
375833274@qq.com
ebb767db65e5e4784c6d111c9e4a9da6c4b4cb84
45f3f3821601d5fc16a476e6c824d7658485a7e3
/src/main/java/nowcoder/offer/cn/_75OrderList.java
e558a64d57a48cf0a02817fa28d7bb422ef181f6
[]
no_license
bingoxubin/LeetCode
07286f2860c52e20f75f81733aeac157a2a57e7b
bb22e06fcf94387a8dca77b7a16f1bbd24259a3b
refs/heads/master
2022-10-07T23:54:22.173437
2022-09-30T09:08:35
2022-09-30T09:08:35
222,985,409
1
0
null
2020-10-13T17:36:59
2019-11-20T16:54:07
Java
UTF-8
Java
false
false
2,145
java
package nowcoder.offer.cn; /** * @author xumaosheng * 有一个链表,奇数位升序偶数位降序,如何将链表变成升序 * @date 2019/12/19 17:06 */ public class _75OrderList { /** * 按照奇偶位拆分成两个链表 * * @param head * @return */ public static Node[] getLists(Node head) { Node head1 = null; Node head2 = null; Node cur1 = null; Node cur2 = null; int count = 1;//用来计数 while (head != null) { if (count % 2 == 1) { if (cur1 != null) { cur1.next = head; cur1 = cur1.next; } else { cur1 = head; head1 = cur1; } } else { if (cur2 != null) { cur2.next = head; cur2 = cur2.next; } else { cur2 = head; head2 = cur2; } } head = head.next; count++; } //跳出循环,要让最后两个末尾元素的下一个都指向null cur1.next = null; cur2.next = null; Node[] nodes = new Node[]{head1, head2}; return nodes; } /** * 反转链表 * * @param head * @return */ public static Node reverseList(Node head) { Node pre = null; Node next = null; while (head != null) { next = head.next; head.next = pre; pre = head; head = next; } return pre; } /** * 合并两个有序链表 * * @param head1 * @param head2 * @return */ public static Node CombineList(Node head1, Node head2) { if (head1 == null || head2 == null) { return head1 != null ? head1 : head2; } Node head = head1.value < head2.value ? head1 : head2; Node cur1 = head == head1 ? head1 : head2; Node cur2 = head == head1 ? head2 : head1; Node pre = null; Node next = null; while (cur1 != null && cur2 != null) { if (cur1.value <= cur2.value) {//这里一定要有=,否则一旦cur1的value和cur2的value相等的话,下面的pre.next会出现空指针异常 pre = cur1; cur1 = cur1.next; } else { next = cur2.next; pre.next = cur2; cur2.next = cur1; pre = cur2; cur2 = next; } } pre.next = cur1 == null ? cur2 : cur1; return head; } class Node { int value; Node next; Node(int x) { value = x; } } }
[ "757661238@qq.com" ]
757661238@qq.com