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
058147ad2c9d0be3e037fb0b49bf090674082782
e515c0e3ea5d390b2621500facac443a42db3d78
/src/com/xiudun/action/ImportAction.java
4c87abff2ad8051d08d3a397467317db5d2732c2
[]
no_license
yangleihaha/qxgl
a401a53f32893c63c60e81ea1fc4e25ae2d629a9
68d6d2524073702a1c607d27989bdcd8fe15d26d
refs/heads/master
2022-05-11T09:08:58.347640
2022-03-27T13:20:38
2022-03-27T13:20:38
189,689,088
0
0
null
null
null
null
GB18030
Java
false
false
3,475
java
/** * */ package com.xiudun.action; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.WorkbookFactory; import com.xiudun.domain.User; import com.xiudun.service.Service; /** * @author Administrator * */ public class ImportAction extends HttpServlet{ private Service service = new Service(); @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { //无论传递文件参数还是普通参数都不能直接使用request.getParameter() //都需要使用fileupload组件获取。 //创建一个DiskFileItemFactory //负责将请求传递的信息(文件,普通参数)分开,重新组装,组成一个个的FileItem对象。 DiskFileItemFactory factory = new DiskFileItemFactory(); //创建FileUpload组件对象,需要一个上面的工厂参数 ServletFileUpload upload = new ServletFileUpload(factory); //upload组件使用factory将请求参数组装成list集合,集合里存放FileItem对象,也就是请求的参数 //参数为一个request //FileItem对象还有许多常用方法,参考web宝典 List<FileItem> fis = upload.parseRequest(request); //获得一个可以读取上传文件内容的输入流。 InputStream is = fis.get(0).getInputStream(); // //将获取的文件,上传到指定位置 // OutputStream os = new FileOutputStream("d:/yang/bbb.doc"); // while(true) { // int i = is.read(); // if(i==-1) break; // os.write(i); // } // os.flush(); //根据excel文件或文件输入流创建工作簿 //参数可以是一个上传的输入流或者是一个确定的xlsx文件 Workbook book = WorkbookFactory.create(is); //获取指定的工作表 Sheet sheet = book.getSheetAt(0); //循环工作表里的每一行(下标从0开始)因为0行为表头,所以循环从1开始 //getLastRowNum()最后一行的序号(下标) for(int i = 1;i<=sheet.getLastRowNum();i++) { //在表中获取一行 Row row = sheet.getRow(i); //获取行中的一个单元 Cell c1 = row.getCell(0); Cell c2 = row.getCell(1); Cell c3 = row.getCell(2); //获取单元中的值 //只要表格中写的都是数字,就只能获取数字,只有浮点型一种数字。 String uname = (int)c1.getNumericCellValue()+""; String upass = (int)c2.getNumericCellValue()+""; String truename = c3.getStringCellValue(); //之后想要的操作 User user = new User(null,uname,upass,truename); service.insert(user); } response.setContentType("text/html;charset=utf-8"); response.getWriter().write("操作成功!"); } catch (Exception e) { e.printStackTrace(); } } }
[ "496954149@qq.com" ]
496954149@qq.com
cd31001aaf175fae8de65c6d431a703da2b074cb
0e3cca112790e6a78b4c5abc31b7850359c577cd
/android/src/org/colinw/asteroids/Matrix.java
0599f3dee847fd9a2e29597a94f177655617098f
[ "MIT" ]
permissive
colinw7/CQAsteroids
9e00dd708aa8d2ddd1e82552e1d45f3ec37ab80c
e47611970bfe9f83693292d8285cc0046fd271e1
refs/heads/master
2023-01-23T02:03:46.989348
2023-01-16T14:43:05
2023-01-16T14:43:05
126,750,647
1
0
null
null
null
null
UTF-8
Java
false
false
936
java
package org.colinw.asteroids; public class Matrix { private double m00_, m01_, m02_, m10_, m11_, m12_, m20_, m21_, m22_; Matrix() { } void setIdentity() { setInnerIdentity (); setOuterIdentity (); setBottomIdentity(); } void setRotation(double a) { setInnerRotation (a); setOuterIdentity (); setBottomIdentity(); } public Point multiplyPoint(double xi, double yi) { double xo = m00_*xi + m01_*yi + m02_; double yo = m10_*xi + m11_*yi + m12_; return new Point(xo, yo); } public void setInnerRotation(double a) { double c = Math.cos(a); double s = Math.sin(a); m00_ = c; m01_ = -s; m10_ = s; m11_ = c; } void setInnerIdentity() { m00_ = 1.0; m01_ = 0.0; m10_ = 0.0; m11_ = 1.0; } public void setOuterIdentity() { m02_ = 0.0; m12_ = 0.0; } public void setBottomIdentity() { m20_ = 0.0; m21_ = 0.0; m22_ = 1.0; } }
[ "colinw@nc.rr.com" ]
colinw@nc.rr.com
97557d4ce215940fc204b576d206549f8ac9d42e
455b07f6a8f234dc9fe0fb9cdff0b8c5f00f3cb2
/src/main/java/io/confluent/kwq/streams/TaskStatsCollector.java
818266c12de2829486444453a706819ecb5ea046
[ "Apache-2.0" ]
permissive
astubbs/kwq
b7bdac9ae8e0304a29f6eebe0e692f0e5ae02f8f
7c7ff01110c10063c3987cf7780b1d925cac943c
refs/heads/master
2023-07-09T12:42:34.427489
2020-01-15T16:40:15
2020-01-15T17:53:22
132,119,266
0
0
Apache-2.0
2020-01-15T17:53:24
2018-05-04T09:28:57
Java
UTF-8
Java
false
false
4,468
java
/** * Copyright 2018 Confluent Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. **/ package io.confluent.kwq.streams; import io.confluent.kwq.Task; import io.confluent.kwq.streams.model.TaskStats; import io.confluent.kwq.util.LockfreeConcurrentQueue; import org.apache.kafka.common.serialization.Serdes; import org.apache.kafka.streams.KafkaStreams; import org.apache.kafka.streams.StreamsBuilder; import org.apache.kafka.streams.StreamsConfig; import org.apache.kafka.streams.Topology; import org.apache.kafka.streams.kstream.KStream; import org.apache.kafka.streams.kstream.KTable; import org.apache.kafka.streams.kstream.Materialized; import org.apache.kafka.streams.kstream.TimeWindows; import org.apache.kafka.streams.kstream.Windowed; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Collections; import java.util.List; import java.util.Queue; import java.util.concurrent.CopyOnWriteArrayList; public class TaskStatsCollector { private static final Logger log = LoggerFactory.getLogger(TaskStatsCollector.class); public static final int STATS_RETENTION = 2000; private final Topology topology; private TaskStats currentWindowStats; private final StreamsConfig streamsConfig; private KafkaStreams streams; private final Queue<TaskStats> stats = new LockfreeConcurrentQueue<>(); private int windowDurationS; public TaskStatsCollector(final String taskStatusTopic, final StreamsConfig streamsConfig, final int windowDurationS){ this.streamsConfig = streamsConfig; this.topology = buildTopology(taskStatusTopic, windowDurationS); } private Topology buildTopology(final String taskStatusTopic, final int windowDurationS) { this.windowDurationS = windowDurationS; StreamsBuilder builder = new StreamsBuilder(); KStream<String, Task> tasks = builder.stream(taskStatusTopic); KTable<Windowed<String>, TaskStats> windowedTaskStatsKTable = tasks .groupBy((key, value) -> "agg-all-values") .windowedBy(TimeWindows.of(windowDurationS * 1000)) .aggregate( TaskStats::new, (key, value, aggregate) -> aggregate.add(value), Materialized.with(new Serdes.StringSerde(), new TaskStats.TaskStatsSerde()) ); /** * We only want to view the final value of each window, and not every CDC event, so use a window threshold. */ windowedTaskStatsKTable.toStream().foreach( (key, value) -> { log.debug("Processing:{} time:{}", value, key.window().end()); if (currentWindowStats != null && key.window().end() != currentWindowStats.getTime()) { log.debug("Adding:{} time:{}", currentWindowStats, key.window().end()); stats.add(currentWindowStats); if (stats.size() > STATS_RETENTION) { stats.remove(); } // TODO: Publish stats onto a Topic for visualization via Grafana (store in elastic or influx) } currentWindowStats = value; currentWindowStats.setTime(key.window().end()); } ); return builder.build(); } public void start() { streams = new KafkaStreams(topology, streamsConfig); streams.start(); } public void stop() { streams.close(); streams.cleanUp(); } public List<TaskStats> getStats() { if (currentWindowStats != null && currentWindowStats.getTime() < System.currentTimeMillis() - (windowDurationS * 1000)) { stats.add(currentWindowStats); currentWindowStats = null; } else if (currentWindowStats == null) { currentWindowStats = new TaskStats(); currentWindowStats.setTime(System.currentTimeMillis() - (windowDurationS * 1000)); } CopyOnWriteArrayList results = new CopyOnWriteArrayList<>(stats); if (currentWindowStats != null) results.add(currentWindowStats); Collections.reverse(results); return results; } public Topology getTopology() { return topology; } }
[ "neil@confluent.io" ]
neil@confluent.io
a810152a7b989cd8d68d3d3cb4f1ea65aae1f42a
f57ef2e1c61c2e09b82bfaef0edaa140fde51c8e
/spring-boot/src/main/java/ru/itis/springbootdemo/security/details/UserDetailsServiceImpl.java
4469f604d66c46c88811805b54bd76f6818f0adc
[]
no_license
verzzil/RizatNewRepo
5b22e202a9ac8cc5b04b7836994260c544a908ba
0934cc1eeab00db2f02f994c7f479454e859c2a8
refs/heads/main
2023-05-08T04:05:46.263751
2021-05-30T15:19:44
2021-05-30T15:19:44
372,261,634
0
0
null
null
null
null
UTF-8
Java
false
false
971
java
package ru.itis.springbootdemo.security.details; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service; import ru.itis.springbootdemo.models.User; import ru.itis.springbootdemo.repositories.UsersRepository; @Service("customUserDetailsService") public class UserDetailsServiceImpl implements UserDetailsService { @Autowired private UsersRepository usersRepository; @Override public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException { User user = usersRepository.findFirstByEmail(email); if (user == null){ throw new UsernameNotFoundException("User not found"); } return new UserDetailsImpl(user); } }
[ "xannanov.albert@mail.ru" ]
xannanov.albert@mail.ru
5acae4c8c07679e0369bef0fe5e715e20da9d752
c00aaf3cb82aeefce1a30ceb5727546636eac4e8
/associations/src/main/java/com/psl/springdata/associations/onetomany/repos/CustomerRepository.java
b8c5b90b1c7557d6dcb225af209fb6f64d0f6291
[]
no_license
ShwetaShukla123/Spring-ORM
adc4f062efb6d60c1aa8a4e7092f734c4ad53ed1
687e283f962f44cd47f1dc23ee46992aee60330b
refs/heads/master
2023-08-18T17:33:54.983998
2021-10-11T08:48:55
2021-10-11T08:48:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
266
java
package com.psl.springdata.associations.onetomany.repos; import org.springframework.data.repository.CrudRepository; import com.psl.springdata.associations.onetomanyentities.Customer; public interface CustomerRepository extends CrudRepository<Customer, Long> { }
[ "shweta_shukla1@persistent.com" ]
shweta_shukla1@persistent.com
cff24794689bc837a063bc3c1979acacb24350c7
5818a8adebe57cca76af3e0e25ecfde1f62edcd9
/src/my/framework/util/Updator.java
eb4e840f2f4a9e04283f552fa2aa9d556d6ddb5e
[]
no_license
chancedream/FirePig
101c29248f2154dbaafe39864ebd34ed3c9f8e22
5546f9d35b6dad3ef0a24f01488956e50483caa6
refs/heads/master
2021-01-22T18:14:21.678265
2012-01-09T01:55:08
2012-01-09T01:55:08
2,952,997
0
0
null
null
null
null
UTF-8
Java
false
false
815
java
package my.framework.util; public class Updator<S, T> { private long lastUpdatedAt = -1; private T object; private Runner<S, T> runner; private Updatable source; public Updator(Updatable source, Runner<S, T> runner) { this.source = source; this.runner = runner; runner.setSource((S)source); } public void clear() { object = null; lastUpdatedAt = -1; } public T get() { if (source.updatedSince(lastUpdatedAt)) { // synchronized source to prevent concurrent modification synchronized (source) { object = runner.run(); lastUpdatedAt = source.updatedAt(); } } return object; } public static abstract class Runner<S, T> { protected S source; public abstract T run(); public void setSource(S source) { this.source = source; } } }
[ "chance@IBM-R8V8FX4.cn.ibm.com" ]
chance@IBM-R8V8FX4.cn.ibm.com
33248d596fca8bfc36f977c11ad85e8168687877
2f3593ca7bdfce8e18cf8805711c9dfbe19b44c8
/app/src/main/java/com/coolweather/android/gson/AQI.java
0adac1a6fa27221ed3f41ccdadbfe2cc7e210be2
[ "Apache-2.0" ]
permissive
lyh19940521/coolweather
da98620136a79c5d720dc06f73b22a9bc1dbf8f1
b6f025f7fcd2b491624783d4e9a51a3f061f85f6
refs/heads/master
2021-01-02T09:30:29.977067
2017-08-06T12:49:06
2017-08-06T12:49:06
99,229,025
0
0
null
null
null
null
UTF-8
Java
false
false
210
java
package com.coolweather.android.gson; /** * Created by L on 2017/8/5. */ public class AQI { public AQICity city; public class AQICity{ public String aqi; public String pm25; } }
[ "8@qq.com" ]
8@qq.com
272e132b7194d13530c32bd8d696e892c0116cc9
32572e37c6f92b67325b48eb2459c4ae1f11828f
/suitmeupFinal-ejb/src/java/db/SmuUserQualification.java
6003ec318f10e0f532124663d962f4392eaa74a7
[]
no_license
manali27/SuitMeUp
576759282065c8aab2fa82dc0e6e4ec13ed570d3
8c8fee52d0924b144997df4868c073cca0e6b782
refs/heads/master
2016-09-06T20:11:24.180008
2015-06-17T18:30:13
2015-06-17T18:30:13
37,608,576
0
1
null
null
null
null
UTF-8
Java
false
false
6,761
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 db; import java.io.Serializable; import java.util.Date; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.EmbeddedId; import javax.persistence.Entity; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; /** * * @author jay */ @Entity @Table(name = "smu_user_qualification") @NamedQueries({ @NamedQuery(name = "SmuUserQualification.findAll", query = "SELECT s FROM SmuUserQualification s"), @NamedQuery(name = "SmuUserQualification.findByUcUserId", query = "SELECT s FROM SmuUserQualification s WHERE s.smuUserQualificationPK.ucUserId = :ucUserId ORDER BY s.uqQualificationPassingYear DESC"), @NamedQuery(name = "SmuUserQualification.findByUqQualificationId", query = "SELECT s FROM SmuUserQualification s WHERE s.smuUserQualificationPK.uqQualificationId = :uqQualificationId"), @NamedQuery(name = "SmuUserQualification.findByUqQualificationName", query = "SELECT s FROM SmuUserQualification s WHERE s.uqQualificationName = :uqQualificationName"), @NamedQuery(name = "SmuUserQualification.findByUqQualificationInstitute", query = "SELECT s FROM SmuUserQualification s WHERE s.uqQualificationInstitute = :uqQualificationInstitute"), @NamedQuery(name = "SmuUserQualification.findByUqQualificationOneLineDescription", query = "SELECT s FROM SmuUserQualification s WHERE s.uqQualificationOneLineDescription = :uqQualificationOneLineDescription"), @NamedQuery(name = "SmuUserQualification.findByUqQualificationPassingYear", query = "SELECT s FROM SmuUserQualification s WHERE s.uqQualificationPassingYear = :uqQualificationPassingYear"), @NamedQuery(name = "SmuUserQualification.findByUqQualificationPercentage", query = "SELECT s FROM SmuUserQualification s WHERE s.uqQualificationPercentage = :uqQualificationPercentage")}) public class SmuUserQualification implements Serializable { private static final long serialVersionUID = 1L; @EmbeddedId protected SmuUserQualificationPK smuUserQualificationPK; @Basic(optional = false) @NotNull @Size(min = 1, max = 100) @Column(name = "uq_qualification_name") private String uqQualificationName; @Basic(optional = false) @NotNull @Size(min = 1, max = 100) @Column(name = "uq_qualification_institute") private String uqQualificationInstitute; @Size(max = 100) @Column(name = "uq_qualification_one_line_description") private String uqQualificationOneLineDescription; @Column(name = "uq_qualification_passing_year") @Temporal(TemporalType.DATE) private Date uqQualificationPassingYear; @Column(name = "uq_qualification_percentage") private Integer uqQualificationPercentage; @JoinColumn(name = "uc_user_id", referencedColumnName = "uc_user_id", insertable = false, updatable = false) @ManyToOne(optional = false) private SmuUserCredentials smuUserCredentials; public SmuUserQualification() { } public SmuUserQualification(SmuUserQualificationPK smuUserQualificationPK) { this.smuUserQualificationPK = smuUserQualificationPK; } public SmuUserQualification(SmuUserQualificationPK smuUserQualificationPK, String uqQualificationName, String uqQualificationInstitute) { this.smuUserQualificationPK = smuUserQualificationPK; this.uqQualificationName = uqQualificationName; this.uqQualificationInstitute = uqQualificationInstitute; } public SmuUserQualification(int ucUserId, int uqQualificationId) { this.smuUserQualificationPK = new SmuUserQualificationPK(ucUserId, uqQualificationId); } public SmuUserQualificationPK getSmuUserQualificationPK() { return smuUserQualificationPK; } public void setSmuUserQualificationPK(SmuUserQualificationPK smuUserQualificationPK) { this.smuUserQualificationPK = smuUserQualificationPK; } public String getUqQualificationName() { return uqQualificationName; } public void setUqQualificationName(String uqQualificationName) { this.uqQualificationName = uqQualificationName; } public String getUqQualificationInstitute() { return uqQualificationInstitute; } public void setUqQualificationInstitute(String uqQualificationInstitute) { this.uqQualificationInstitute = uqQualificationInstitute; } public String getUqQualificationOneLineDescription() { return uqQualificationOneLineDescription; } public void setUqQualificationOneLineDescription(String uqQualificationOneLineDescription) { this.uqQualificationOneLineDescription = uqQualificationOneLineDescription; } public Date getUqQualificationPassingYear() { return uqQualificationPassingYear; } public void setUqQualificationPassingYear(Date uqQualificationPassingYear) { this.uqQualificationPassingYear = uqQualificationPassingYear; } public Integer getUqQualificationPercentage() { return uqQualificationPercentage; } public void setUqQualificationPercentage(Integer uqQualificationPercentage) { this.uqQualificationPercentage = uqQualificationPercentage; } public SmuUserCredentials getSmuUserCredentials() { return smuUserCredentials; } public void setSmuUserCredentials(SmuUserCredentials smuUserCredentials) { this.smuUserCredentials = smuUserCredentials; } @Override public int hashCode() { int hash = 0; hash += (smuUserQualificationPK != null ? smuUserQualificationPK.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof SmuUserQualification)) { return false; } SmuUserQualification other = (SmuUserQualification) object; if ((this.smuUserQualificationPK == null && other.smuUserQualificationPK != null) || (this.smuUserQualificationPK != null && !this.smuUserQualificationPK.equals(other.smuUserQualificationPK))) { return false; } return true; } @Override public String toString() { return "db.SmuUserQualification[ smuUserQualificationPK=" + smuUserQualificationPK + " ]"; } }
[ "manali.sarkar93@gmail.com" ]
manali.sarkar93@gmail.com
97785ab89e8639f05e673ffaa6a2c79693238fd2
f321db1ace514d08219cc9ba5089ebcfff13c87a
/generated-tests/adynamosa/tests/s1013/3_gson/evosuite-tests/com/google/gson/internal/LinkedHashTreeMap_ESTest_scaffolding.java
3568026b5e37112d9494f93004fb60f452ff69d3
[]
no_license
sealuzh/dynamic-performance-replication
01bd512bde9d591ea9afa326968b35123aec6d78
f89b4dd1143de282cd590311f0315f59c9c7143a
refs/heads/master
2021-07-12T06:09:46.990436
2020-06-05T09:44:56
2020-06-05T09:44:56
146,285,168
2
2
null
null
null
null
UTF-8
Java
false
false
5,676
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Mon Jul 22 19:14:16 GMT 2019 */ package com.google.gson.internal; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; import org.junit.AfterClass; import org.evosuite.runtime.sandbox.Sandbox; import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; import static org.evosuite.shaded.org.mockito.Mockito.*; @EvoSuiteClassExclude public class LinkedHashTreeMap_ESTest_scaffolding { @org.junit.Rule public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); @BeforeClass public static void initEvoSuiteFramework() { org.evosuite.runtime.RuntimeSettings.className = "com.google.gson.internal.LinkedHashTreeMap"; org.evosuite.runtime.GuiSupport.initialize(); org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); org.evosuite.runtime.classhandling.JDKClassResetter.init(); setSystemProperties(); initializeClasses(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); try { initMocksToAvoidTimeoutsInTheTests(); } catch(ClassNotFoundException e) {} } @AfterClass public static void clearEvoSuiteFramework(){ Sandbox.resetDefaultSecurityManager(); java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); } @Before public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); setSystemProperties(); org.evosuite.runtime.GuiSupport.setHeadless(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); org.evosuite.runtime.agent.InstrumentingAgent.activate(); } @After public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); org.evosuite.runtime.classhandling.JDKClassResetter.reset(); resetClasses(); org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); } public static void setSystemProperties() { java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); java.lang.System.setProperty("user.dir", "/home/apaniche/performance/Dataset/gordon_scripts/projects/3_gson"); java.lang.System.setProperty("java.io.tmpdir", "/tmp"); } private static void initializeClasses() { org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(LinkedHashTreeMap_ESTest_scaffolding.class.getClassLoader() , "com.google.gson.internal.LinkedHashTreeMap", "com.google.gson.internal.LinkedHashTreeMap$AvlIterator", "com.google.gson.internal.LinkedHashTreeMap$1", "com.google.gson.internal.LinkedHashTreeMap$Node", "com.google.gson.internal.LinkedHashTreeMap$LinkedTreeMapIterator", "com.google.gson.internal.LinkedHashTreeMap$EntrySet$1", "com.google.gson.internal.LinkedHashTreeMap$KeySet$1", "com.google.gson.internal.LinkedHashTreeMap$EntrySet", "com.google.gson.internal.LinkedHashTreeMap$KeySet", "com.google.gson.internal.LinkedHashTreeMap$AvlBuilder" ); } private static void initMocksToAvoidTimeoutsInTheTests() throws ClassNotFoundException { mock(Class.forName("java.lang.Comparable", false, LinkedHashTreeMap_ESTest_scaffolding.class.getClassLoader())); mock(Class.forName("java.util.Comparator", false, LinkedHashTreeMap_ESTest_scaffolding.class.getClassLoader())); mock(Class.forName("java.util.function.BiConsumer", false, LinkedHashTreeMap_ESTest_scaffolding.class.getClassLoader())); mock(Class.forName("java.util.function.BiFunction", false, LinkedHashTreeMap_ESTest_scaffolding.class.getClassLoader())); } private static void resetClasses() { org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(LinkedHashTreeMap_ESTest_scaffolding.class.getClassLoader()); org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( "com.google.gson.internal.LinkedHashTreeMap$1", "com.google.gson.internal.LinkedHashTreeMap", "com.google.gson.internal.LinkedHashTreeMap$Node", "com.google.gson.internal.LinkedHashTreeMap$AvlIterator", "com.google.gson.internal.LinkedHashTreeMap$AvlBuilder", "com.google.gson.internal.LinkedHashTreeMap$EntrySet", "com.google.gson.internal.LinkedHashTreeMap$KeySet", "com.google.gson.internal.LinkedHashTreeMap$LinkedTreeMapIterator", "com.google.gson.internal.LinkedHashTreeMap$EntrySet$1", "com.google.gson.internal.LinkedHashTreeMap$KeySet$1" ); } }
[ "granogiovanni90@gmail.com" ]
granogiovanni90@gmail.com
a940a172963b7ead53d1620cf9ee4a0377aead5f
b9d57afdd3d5b6bb85464c887d34a1870e5cbda0
/app/build/generated/not_namespaced_r_class_sources/debug/r/androidx/legacy/coreutils/R.java
6a8e1f8a86caa08fdbffc9c9e03566cb24922f3b
[]
no_license
HeshSs/BlinkToSpeech
70fc89f033ea47477fe938c09cd1fffb15134eba
ebb44f081d2642b8d508a004cd867c3d7e66925d
refs/heads/master
2020-12-21T06:51:46.803961
2020-01-26T16:57:37
2020-01-26T16:57:37
236,343,761
0
0
null
null
null
null
UTF-8
Java
false
false
10,456
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package androidx.legacy.coreutils; public final class R { private R() {} public static final class attr { private attr() {} public static final int alpha = 0x7f030028; public static final int font = 0x7f0300da; public static final int fontProviderAuthority = 0x7f0300dc; public static final int fontProviderCerts = 0x7f0300dd; public static final int fontProviderFetchStrategy = 0x7f0300de; public static final int fontProviderFetchTimeout = 0x7f0300df; public static final int fontProviderPackage = 0x7f0300e0; public static final int fontProviderQuery = 0x7f0300e1; public static final int fontStyle = 0x7f0300e2; public static final int fontVariationSettings = 0x7f0300e3; public static final int fontWeight = 0x7f0300e4; public static final int ttcIndex = 0x7f030215; } public static final class color { private color() {} public static final int notification_action_color_filter = 0x7f05006a; public static final int notification_icon_bg_color = 0x7f05006b; public static final int ripple_material_light = 0x7f050075; public static final int secondary_text_default_material_light = 0x7f050077; } public static final class dimen { private dimen() {} public static final int compat_button_inset_horizontal_material = 0x7f06004e; public static final int compat_button_inset_vertical_material = 0x7f06004f; public static final int compat_button_padding_horizontal_material = 0x7f060050; public static final int compat_button_padding_vertical_material = 0x7f060051; public static final int compat_control_corner_material = 0x7f060052; public static final int compat_notification_large_icon_max_height = 0x7f060053; public static final int compat_notification_large_icon_max_width = 0x7f060054; public static final int notification_action_icon_size = 0x7f0600c2; public static final int notification_action_text_size = 0x7f0600c3; public static final int notification_big_circle_margin = 0x7f0600c4; public static final int notification_content_margin_start = 0x7f0600c5; public static final int notification_large_icon_height = 0x7f0600c6; public static final int notification_large_icon_width = 0x7f0600c7; public static final int notification_main_column_padding_top = 0x7f0600c8; public static final int notification_media_narrow_margin = 0x7f0600c9; public static final int notification_right_icon_size = 0x7f0600ca; public static final int notification_right_side_padding_top = 0x7f0600cb; public static final int notification_small_icon_background_padding = 0x7f0600cc; public static final int notification_small_icon_size_as_large = 0x7f0600cd; public static final int notification_subtext_size = 0x7f0600ce; public static final int notification_top_pad = 0x7f0600cf; public static final int notification_top_pad_large_text = 0x7f0600d0; } public static final class drawable { private drawable() {} public static final int notification_action_background = 0x7f07006b; public static final int notification_bg = 0x7f07006c; public static final int notification_bg_low = 0x7f07006d; public static final int notification_bg_low_normal = 0x7f07006e; public static final int notification_bg_low_pressed = 0x7f07006f; public static final int notification_bg_normal = 0x7f070070; public static final int notification_bg_normal_pressed = 0x7f070071; public static final int notification_icon_background = 0x7f070072; public static final int notification_template_icon_bg = 0x7f070073; public static final int notification_template_icon_low_bg = 0x7f070074; public static final int notification_tile_bg = 0x7f070075; public static final int notify_panel_notification_icon_bg = 0x7f070076; } public static final class id { private id() {} public static final int action_container = 0x7f08000e; public static final int action_divider = 0x7f080010; public static final int action_image = 0x7f080011; public static final int action_text = 0x7f080017; public static final int actions = 0x7f080018; public static final int async = 0x7f080020; public static final int blocking = 0x7f080024; public static final int chronometer = 0x7f08003e; public static final int forever = 0x7f080060; public static final int icon = 0x7f080069; public static final int icon_group = 0x7f08006a; public static final int info = 0x7f08006d; public static final int italic = 0x7f080070; public static final int line1 = 0x7f080075; public static final int line3 = 0x7f080076; public static final int normal = 0x7f080083; public static final int notification_background = 0x7f080084; public static final int notification_main_column = 0x7f080085; public static final int notification_main_column_container = 0x7f080086; public static final int right_icon = 0x7f080093; public static final int right_side = 0x7f080094; public static final int tag_transition_group = 0x7f0800c0; public static final int tag_unhandled_key_event_manager = 0x7f0800c1; public static final int tag_unhandled_key_listeners = 0x7f0800c2; public static final int text = 0x7f0800c3; public static final int text2 = 0x7f0800c4; public static final int time = 0x7f0800cc; public static final int title = 0x7f0800cd; } public static final class integer { private integer() {} public static final int status_bar_notification_info_maxnum = 0x7f09000e; } public static final class layout { private layout() {} public static final int notification_action = 0x7f0b0036; public static final int notification_action_tombstone = 0x7f0b0037; public static final int notification_template_custom_big = 0x7f0b0038; public static final int notification_template_icon_group = 0x7f0b0039; public static final int notification_template_part_chronometer = 0x7f0b003a; public static final int notification_template_part_time = 0x7f0b003b; } public static final class string { private string() {} public static final int status_bar_notification_info_overflow = 0x7f0d005b; } public static final class style { private style() {} public static final int TextAppearance_Compat_Notification = 0x7f0e011b; public static final int TextAppearance_Compat_Notification_Info = 0x7f0e011c; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0e011d; public static final int TextAppearance_Compat_Notification_Time = 0x7f0e011e; public static final int TextAppearance_Compat_Notification_Title = 0x7f0e011f; public static final int Widget_Compat_NotificationActionContainer = 0x7f0e01c5; public static final int Widget_Compat_NotificationActionText = 0x7f0e01c6; } public static final class styleable { private styleable() {} public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f030028 }; public static final int ColorStateListItem_android_color = 0; public static final int ColorStateListItem_android_alpha = 1; public static final int ColorStateListItem_alpha = 2; public static final int[] FontFamily = { 0x7f0300dc, 0x7f0300dd, 0x7f0300de, 0x7f0300df, 0x7f0300e0, 0x7f0300e1 }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f0300da, 0x7f0300e2, 0x7f0300e3, 0x7f0300e4, 0x7f030215 }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_android_ttcIndex = 3; public static final int FontFamilyFont_android_fontVariationSettings = 4; public static final int FontFamilyFont_font = 5; public static final int FontFamilyFont_fontStyle = 6; public static final int FontFamilyFont_fontVariationSettings = 7; public static final int FontFamilyFont_fontWeight = 8; public static final int FontFamilyFont_ttcIndex = 9; public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 }; public static final int GradientColor_android_startColor = 0; public static final int GradientColor_android_endColor = 1; public static final int GradientColor_android_type = 2; public static final int GradientColor_android_centerX = 3; public static final int GradientColor_android_centerY = 4; public static final int GradientColor_android_gradientRadius = 5; public static final int GradientColor_android_tileMode = 6; public static final int GradientColor_android_centerColor = 7; public static final int GradientColor_android_startX = 8; public static final int GradientColor_android_startY = 9; public static final int GradientColor_android_endX = 10; public static final int GradientColor_android_endY = 11; public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 }; public static final int GradientColorItem_android_color = 0; public static final int GradientColorItem_android_offset = 1; } }
[ "hishmat.salehi2015@gmail.com" ]
hishmat.salehi2015@gmail.com
8f5f3f975b57f506751034c8331d48f691346f2c
d3620858a4db4cdd3b0997a55f20316ee546fe62
/IFI-J2EE_TP1/src/main/java/Hello.java
49b2f229a832db6d2f6ed4f3cb7cd7a9646b1f05
[]
no_license
Tiplok/M2_workspace
40acb0bd2dfc1848aaef317c21a22106f41cf0d1
d3e7d6ee917e45bcaf7557a0b5f7084ba29cd86b
refs/heads/master
2021-05-01T09:29:26.549842
2016-12-06T07:20:10
2016-12-06T07:20:10
68,121,319
0
0
null
null
null
null
UTF-8
Java
false
false
173
java
public class Hello { public static void main(String[] args){ System.out.println(new Hello().getMessage()); } public String getMessage(){ return "Hello World"; } }
[ "tiplok1@gmail.com" ]
tiplok1@gmail.com
5af35569458953e4bc0bf6a2c0c8ff6ef49ebde2
036783ca5faa768545d69bb62d1829ab0bbe20c7
/app/src/main/java/com/example/splashscreen/Splashscreen.java
178ec1007fda79a6683d7d4b96f894085c4b3621
[]
no_license
barunstha007/splashscreen
33e111a0a069dd9cca3fa4621227e265417cbf2f
62f3dce118efb8a4e57d0497a39262db4e96cbcc
refs/heads/master
2020-12-07T10:16:33.153517
2020-01-09T02:17:26
2020-01-09T02:17:26
232,701,494
0
0
null
null
null
null
UTF-8
Java
false
false
65
java
package com.example.splashscreen; public class Splashscreen { }
[ "barun.shrestha6@gmail.com" ]
barun.shrestha6@gmail.com
55fd6210a2f6838c886f01de2e519aaafe321f94
b39a725c47218b3a53e50472cc84298f01e40823
/src/main/java/com/robototes/logging/shuffleboard/reporters/CameraStreamView.java
ec018d95650148aa36fa279369fab085908eb60f
[]
no_license
jamesdooleymsft/2412RobotLibrary
cf0c3149c845906560abfac4a8a82e8c39530103
35e7b9e97672454a041040bcbdba3b99d3faa6c4
refs/heads/master
2020-11-24T12:00:22.619703
2020-07-29T19:34:17
2020-07-29T19:34:17
228,134,741
0
0
null
2020-07-29T19:34:19
2019-12-15T05:41:57
Java
UTF-8
Java
false
false
1,434
java
package com.robototes.logging.shuffleboard.reporters; import java.util.Map; import com.robototes.logging.shuffleboard.AbstractReporter; import edu.wpi.cscore.VideoSource; import edu.wpi.first.wpilibj.shuffleboard.BuiltInWidgets; import edu.wpi.first.wpilibj.shuffleboard.WidgetType; public class CameraStreamView extends AbstractReporter<VideoSource, CameraStreamView> { public CameraStreamView(VideoSource video, String name, String tabName) { super(() -> video, name, tabName); } @Override public void update() { } public CameraStreamView withRotation(Rotation rotation) { return withProperties(Map.of("rotation", rotation.getValue())); } public CameraStreamView showControls(boolean show) { return withProperties(Map.of("showControls", show)); } public CameraStreamView showCrosshair(Boolean show) { return withProperties(Map.of("showCrosshair", show)); } public CameraStreamView crosshairColor(String color) { return withProperties(Map.of("crosshairColor", color)); } @Override public WidgetType getType() { return BuiltInWidgets.kCameraStream; } public static enum Rotation { NONE("NONE"), QUARTER_CLOCK_WISE("QUARTER_CW"), QUARTER_COUNTER_CLOCK_WISE("QUARTER_CCW"), HALF("HALF"); private final String value; private Rotation(String value) { this.value = value; } public String getValue() { return value; } } }
[ "eliorona@live.com" ]
eliorona@live.com
c2782dd448313de12d515c3541d54cf24e61b0dd
bfe702f86375eeefa5f6c93088b9ccfa3b2c575a
/src/main/java/com/getfei/jobSpider/entity/AnalysisResult.java
d7848e8c1c7fdbe5ff310dcb805335937fcf8102
[ "Apache-2.0" ]
permissive
lroyyy/jobSpider
b8098cc45f1acf69496c279248cfccca326aa9eb
2583dad799de092f5213728c50c989f65861eab0
refs/heads/dev
2022-09-22T16:07:31.996642
2020-10-27T00:54:14
2020-10-27T00:54:14
232,069,474
2
1
Apache-2.0
2022-09-01T23:18:51
2020-01-06T09:42:41
JavaScript
UTF-8
Java
false
false
903
java
package com.getfei.jobSpider.entity; import java.util.Date; import java.util.List; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Transient; import com.getfei.jobSpider.util.data.EchartsData; import lombok.Getter; import lombok.Setter; /** * 分析的结果 * * @author lroy * @see FetchedResult * */ @Getter @Setter public class AnalysisResult extends BaseEntity{ private static final long serialVersionUID = -2205698762127429568L; @Id private String id; /**关键字*/ private String keyword; /**位置*/ private String position; /**分析日期*/ private Date date; /**总页数*/ private int totalPage; /**是否是全新的*/ @Transient private boolean ifNew=true; private List<EchartsData> technologyCounter; private List<EchartsData> technologyTypeCounter; }
[ "lroy@163.com" ]
lroy@163.com
67d8de984638c82c24e7c1e97b277058bd290c78
06bb1087544f7252f6a83534c5427975f1a6cfc7
/modules/cesecore-common/src/org/cesecore/keys/token/AvailableCryptoToken.java
7ff861a08472fd10daf0cb154413c6e639541170
[]
no_license
mvilche/ejbca-ce
65f2b54922eeb47aa7a132166ca5dfa862cee55b
a89c66218abed47c7b310c3999127409180969dd
refs/heads/master
2021-03-08T08:51:18.636030
2020-03-12T18:53:18
2020-03-12T18:53:18
246,335,702
1
0
null
null
null
null
UTF-8
Java
false
false
2,961
java
/************************************************************************* * * * CESeCore: CE Security Core * * * * This software 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 any later version. * * * * See terms of license at gnu.org. * * * *************************************************************************/ package org.cesecore.keys.token; /** * Value class containing information about an available crypto token registered to the CryptoTokenCache. * * @version $Id: AvailableCryptoToken.java 17625 2013-09-20 07:12:06Z netmackan $ */ public class AvailableCryptoToken { private String classpath; private String name; private boolean translateable; private boolean use; public AvailableCryptoToken(String classpath, String name, boolean translateable, boolean use){ this.classpath = classpath; this.name = name; this.translateable = translateable; this.use = use; } /** * Method returning the classpath used to create the plugin. Must implement the HardCAToken interface. * */ public String getClassPath(){ return this.classpath; } /** * Method returning the general name of the plug-in used in the adminweb-gui. If translateable flag is * set then must the resource be in the language files. * */ public String getName(){ return this.name; } /** * Indicates if the name should be translated in the adminweb-gui. * */ public boolean isTranslateable(){ return this.translateable; } /** * Indicates if the plug should be used in the system or if it's a dummy or test class. * */ public boolean isUsed(){ return this.use; } /** Classpath is considered the key for AvailableCryptoToken */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((classpath == null) ? 0 : classpath.hashCode()); return result; } /** Classpath is considered the key for AvailableCryptoToken */ @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final AvailableCryptoToken other = (AvailableCryptoToken) obj; if (classpath == null) { if (other.classpath != null) { return false; } } else if (!classpath.equals(other.classpath)) { return false; } return true; } }
[ "mfvilche@gmail.com" ]
mfvilche@gmail.com
c9ec76980c22a6b59ecb8ff4a6647f279a87824b
4ec3bf36837420a2cb84bec4adb772d2664f6e92
/FrameworkDartesESP_alunosSDIS/brokerOM2M/org.eclipse.om2m/org.eclipse.om2m.android.dashboard/src/main/java/org/eclipse/om2m/android/dashboard/CustomSecondaryActivity.java
c828c62d47527b8f4ae7ca3d0d4695069574800d
[]
no_license
BaltasarAroso/SDIS_OM2M
1f2ce310b3c1bf64c2a95ad9d236c64bf672abb0
618fdb4da1aba5621a85e49dae0442cafef5ca31
refs/heads/master
2020-04-08T19:08:22.073674
2019-01-20T15:42:48
2019-01-20T15:42:48
159,641,777
0
2
null
2020-03-06T15:49:51
2018-11-29T09:35:02
C
UTF-8
Java
false
false
1,562
java
/******************************************************************************* * Copyright (c) 2013, 2017 Orange. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * BAREAU Cyrille <cyrille.bareau@orange.com>, * BONNARDEL Gregory <gbonnardel.ext@orange.com>, * BOLLE Sebastien <sebastien.bolle@orange.com>. *******************************************************************************/ package org.eclipse.om2m.android.dashboard; import org.eclipse.om2m.android.dashboard.R; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; public class CustomSecondaryActivity extends Activity { @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu_secondary, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch(item.getItemId()) { case R.id.menu_help: // to be overridden break; case android.R.id.home: Intent mainActivity = new Intent(CustomSecondaryActivity.this, DashboardActivity.class); mainActivity.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(mainActivity); break; default: break; } return true; } }
[ "ba_aroso@icloud.com" ]
ba_aroso@icloud.com
ab4e5daab2525616cfd668484955334149ba6ed6
4bb1c4b39e354163b109195d15862cb0b6dcc784
/chapter2/transaction-propagation-demo/src/test/java/geektime/spring/data/transactionpropagationdemo/TransactionPropagationDemoApplicationTests.java
4f11099feba6230a69f7c43560a386e09c35cec9
[]
no_license
LiuYanpin/SpringBucket
be23c984a16dc43e2e3f7b65ac593776382b7313
f7c6a73c8167e26905b389d476ee43bbd932e2ab
refs/heads/master
2022-09-20T18:02:27.684185
2020-06-04T09:40:40
2020-06-04T09:40:40
269,010,786
0
0
null
null
null
null
UTF-8
Java
false
false
398
java
package geektime.spring.data.transactionpropagationdemo; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; import static org.junit.jupiter.api.Assertions.assertTrue; @SpringBootTest class TransactionPropagationDemoApplicationTests { @Test void contextLoads() { } @Test void should_be_true() { assertTrue(true); } }
[ "yanpliu@thoughtworks.com" ]
yanpliu@thoughtworks.com
f15c7555dc80ebddef300ba3defa5e63e22a5aa7
e02942e9b9aa2c418e5e4af86c94fa1ce4c49005
/app/src/main/java/com/santra/sanchita/portfolioapp/utils/rx/SchedulerProvider.java
8d1d90f4bb0625ebfbf9f12cb5537dd6a75fcf90
[]
no_license
santrasanchita13/PortfolioApp
3bd3547d8fde5cb6048257c8573953a7945451d5
1bc0e930ecff097b3800bc63790e62b1731d39d3
refs/heads/master
2021-01-24T04:43:24.651054
2019-08-04T03:39:36
2019-08-04T03:39:36
113,287,613
0
0
null
null
null
null
UTF-8
Java
false
false
239
java
package com.santra.sanchita.portfolioapp.utils.rx; import io.reactivex.Scheduler; /** * Created by sanchita on 6/12/17. */ public interface SchedulerProvider { Scheduler computation(); Scheduler io(); Scheduler ui(); }
[ "santra.sanchita13@gmail.com" ]
santra.sanchita13@gmail.com
5255fbdb5dd2938c12fd62cb06df87476730684f
e64c96fcaccd7acc01a406a1c1e4a57bd9bd526e
/Medium/Problem553.java
299cefb02110d73c7f50ba99418e8503e706bf0d
[]
no_license
Zivxary/Leetcode
e1e1dfb82fecc36bb51d55b59d25820b5e1d83da
882488ff59322d8bf8a4563fe567fb4f468000f3
refs/heads/master
2020-03-25T07:56:30.567245
2018-09-26T07:37:52
2018-09-26T07:37:52
143,589,549
0
0
null
null
null
null
UTF-8
Java
false
false
793
java
// 2018.9.7 /* https://leetcode.com/problems/optimal-division/description/ */ class Solution { public String optimalDivision(int[] nums) { StringBuilder sb = new StringBuilder(); //最佳解為 x1/(x2/x3/.../xn) switch (nums.length) { case 1: sb.append(nums[0]); break; case 2: sb.append(nums[0]).append('/').append(nums[1]); break; default: sb.append(nums[0]).append('/').append('('); for (int i = 1; i < nums.length - 1; ++i) { sb.append(nums[i]).append('/'); } sb.append(nums[nums.length - 1]).append(')'); break; } return sb.toString(); } }
[ "childbrozoo8@gmail.com" ]
childbrozoo8@gmail.com
aebd2ae023d377cc635f1c66a0377f804b01f6ae
e72267e4c674dc3857dc91db556572534ecf6d29
/spring-mybatis-master/src/main/java/org/mybatis/spring/annotation/MapperScannerRegistrar.java
17de0b5f15525d9391b056ab9474c8dd14eedb67
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
lydon-GH/mybatis-study
4be7f279529a33ead3efa9cd79d60cd44d2184a9
a8a89940bfa6bb790e78e1c28b0c7c0a5d69e491
refs/heads/main
2023-07-29T06:55:56.549751
2021-09-04T09:08:25
2021-09-04T09:08:25
403,011,812
0
0
null
null
null
null
UTF-8
Java
false
false
7,199
java
/* * Copyright ${license.git.copyrightYears} the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.mybatis.spring.annotation; import java.lang.annotation.Annotation; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; import org.mybatis.spring.mapper.ClassPathMapperScanner; import org.mybatis.spring.mapper.MapperFactoryBean; import org.mybatis.spring.mapper.MapperScannerConfigurer; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.support.BeanNameGenerator; import org.springframework.context.ResourceLoaderAware; import org.springframework.context.annotation.ImportBeanDefinitionRegistrar; import org.springframework.core.annotation.AnnotationAttributes; import org.springframework.core.io.ResourceLoader; import org.springframework.core.type.AnnotationMetadata; import org.springframework.util.ClassUtils; import org.springframework.util.StringUtils; /** * A {@link ImportBeanDefinitionRegistrar} to allow annotation configuration of MyBatis mapper scanning. Using * an @Enable annotation allows beans to be registered via @Component configuration, whereas implementing * {@code BeanDefinitionRegistryPostProcessor} will work for XML configuration. * * @author Michael Lanyon * @author Eduardo Macarron * @author Putthiphong Boonphong * * @see MapperFactoryBean * @see ClassPathMapperScanner * @since 1.2.0 */ public class MapperScannerRegistrar implements ImportBeanDefinitionRegistrar, ResourceLoaderAware { /** * {@inheritDoc} * * @deprecated Since 2.0.2, this method not used never. */ @Override @Deprecated public void setResourceLoader(ResourceLoader resourceLoader) { // NOP } /** * {@inheritDoc} */ @Override public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { AnnotationAttributes mapperScanAttrs = AnnotationAttributes .fromMap(importingClassMetadata.getAnnotationAttributes(MapperScan.class.getName())); if (mapperScanAttrs != null) { registerBeanDefinitions(importingClassMetadata, mapperScanAttrs, registry, generateBaseBeanName(importingClassMetadata, 0)); } } void registerBeanDefinitions(AnnotationMetadata annoMeta, AnnotationAttributes annoAttrs, BeanDefinitionRegistry registry, String beanName) { BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(MapperScannerConfigurer.class); builder.addPropertyValue("processPropertyPlaceHolders", true); Class<? extends Annotation> annotationClass = annoAttrs.getClass("annotationClass"); if (!Annotation.class.equals(annotationClass)) { builder.addPropertyValue("annotationClass", annotationClass); } Class<?> markerInterface = annoAttrs.getClass("markerInterface"); if (!Class.class.equals(markerInterface)) { builder.addPropertyValue("markerInterface", markerInterface); } Class<? extends BeanNameGenerator> generatorClass = annoAttrs.getClass("nameGenerator"); if (!BeanNameGenerator.class.equals(generatorClass)) { builder.addPropertyValue("nameGenerator", BeanUtils.instantiateClass(generatorClass)); } Class<? extends MapperFactoryBean> mapperFactoryBeanClass = annoAttrs.getClass("factoryBean"); if (!MapperFactoryBean.class.equals(mapperFactoryBeanClass)) { builder.addPropertyValue("mapperFactoryBeanClass", mapperFactoryBeanClass); } String sqlSessionTemplateRef = annoAttrs.getString("sqlSessionTemplateRef"); if (StringUtils.hasText(sqlSessionTemplateRef)) { builder.addPropertyValue("sqlSessionTemplateBeanName", annoAttrs.getString("sqlSessionTemplateRef")); } String sqlSessionFactoryRef = annoAttrs.getString("sqlSessionFactoryRef"); if (StringUtils.hasText(sqlSessionFactoryRef)) { builder.addPropertyValue("sqlSessionFactoryBeanName", annoAttrs.getString("sqlSessionFactoryRef")); } List<String> basePackages = new ArrayList<>(); basePackages.addAll( Arrays.stream(annoAttrs.getStringArray("value")).filter(StringUtils::hasText).collect(Collectors.toList())); basePackages.addAll(Arrays.stream(annoAttrs.getStringArray("basePackages")).filter(StringUtils::hasText) .collect(Collectors.toList())); basePackages.addAll(Arrays.stream(annoAttrs.getClassArray("basePackageClasses")).map(ClassUtils::getPackageName) .collect(Collectors.toList())); if (basePackages.isEmpty()) { basePackages.add(getDefaultBasePackage(annoMeta)); } String lazyInitialization = annoAttrs.getString("lazyInitialization"); if (StringUtils.hasText(lazyInitialization)) { builder.addPropertyValue("lazyInitialization", lazyInitialization); } String defaultScope = annoAttrs.getString("defaultScope"); if (!AbstractBeanDefinition.SCOPE_DEFAULT.equals(defaultScope)) { builder.addPropertyValue("defaultScope", defaultScope); } builder.addPropertyValue("basePackage", StringUtils.collectionToCommaDelimitedString(basePackages)); registry.registerBeanDefinition(beanName, builder.getBeanDefinition()); } private static String generateBaseBeanName(AnnotationMetadata importingClassMetadata, int index) { return importingClassMetadata.getClassName() + "#" + MapperScannerRegistrar.class.getSimpleName() + "#" + index; } private static String getDefaultBasePackage(AnnotationMetadata importingClassMetadata) { return ClassUtils.getPackageName(importingClassMetadata.getClassName()); } /** * A {@link MapperScannerRegistrar} for {@link MapperScans}. * * @since 2.0.0 */ static class RepeatingRegistrar extends MapperScannerRegistrar { /** * {@inheritDoc} */ @Override public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { AnnotationAttributes mapperScansAttrs = AnnotationAttributes .fromMap(importingClassMetadata.getAnnotationAttributes(MapperScans.class.getName())); if (mapperScansAttrs != null) { AnnotationAttributes[] annotations = mapperScansAttrs.getAnnotationArray("value"); for (int i = 0; i < annotations.length; i++) { registerBeanDefinitions(importingClassMetadata, annotations[i], registry, generateBaseBeanName(importingClassMetadata, i)); } } } } }
[ "447172979@qq.com" ]
447172979@qq.com
385aab61d9d0ca67e31aee2a77c85f4ec864aaad
52dd205230ba5ddbe46fa16e8ca6a869ede52096
/oracle/com-jy-platform-system/src/main/java/com/jy/modules/platform/bizauth/vmrulemapping/job/AutoFlushVmruleMappingTask.java
1c6ab922e69f187545d85383f2845762bb6c114e
[]
no_license
wangshuaibo123/BI
f5bfca6bcc0d3d0d1bec973ae5864e1bca697ac3
a44f8621a208cfb02e4ab5dc1e576056d62ff37c
refs/heads/master
2021-05-04T16:20:22.382751
2018-01-29T11:02:05
2018-01-29T11:02:05
120,247,955
0
1
null
null
null
null
UTF-8
Java
false
false
4,703
java
package com.jy.modules.platform.bizauth.vmrulemapping.job; import java.io.Serializable; import java.util.HashMap; import java.util.List; import java.util.Map; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.quartz.SchedulerContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Component; import com.jy.modules.platform.bizauth.vmrulemapping.dto.VmruleMappingDTO; import com.jy.modules.platform.bizauth.vmrulemapping.service.VmruleMappingService; import com.jy.modules.platform.bizauth.vmtreeinfo.dto.VmtreeInfoDTO; import com.jy.modules.platform.bizauth.vmtreeinfo.service.VmtreeInfoService; /** * @description:新增门店 定时刷新数据权限定时任务入口 * 建议定时任务每天执行1或2次。 * @author chengang * @date: 2016年7月21日 下午4:01:12 */ @Component("com.jy.modules.platform.bizauth.vmrulemapping.job.AutoFlushVmruleMappingTask") public class AutoFlushVmruleMappingTask implements Serializable, Job{ private static final long serialVersionUID = 1L; private static final Logger logger = LoggerFactory.getLogger(AutoFlushVmruleMappingTask.class); //控制 不允许 多线程 执行 public void execute(JobExecutionContext context) throws JobExecutionException 方法 private static boolean isNext = true; private VmtreeInfoService vmtreeInfoService; private VmruleMappingService vmruleMappingService; @Override public void execute(JobExecutionContext context) throws JobExecutionException { if(!isNext){ logger.info("------------AutoFlushVmruleMappingTask-------isNext:"+isNext); return ; } isNext = false; SchedulerContext cont; try { cont = context.getScheduler().getContext(); ApplicationContext appCtx = (ApplicationContext) cont.get("applicationContextKey"); vmtreeInfoService = (VmtreeInfoService)appCtx.getBean(VmtreeInfoService.class); vmruleMappingService = (VmruleMappingService)appCtx.getBean(VmruleMappingService.class); //查询虚拟树一段时间内新增的数据 Map<String,Object> searchParams = new HashMap<String,Object>(); searchParams.put("createTime_interval", 60 * 24);//查询一天以内修改的数据 VmtreeInfoDTO vmtreeInfoParam = new VmtreeInfoDTO(); searchParams.put("dto", vmtreeInfoParam); List vmtreeInfoList = vmtreeInfoService.searchVmtreeInfo(searchParams); //没有数据 if(vmtreeInfoList==null || vmtreeInfoList.size()<=0){ return; } VmtreeInfoDTO vmtreeInfoDTO = null; VmtreeInfoDTO parentVmtreeInfoDTO = null; Long parentOrgId = null; //遍历所有最近新增的机构 for(int i=0;i<vmtreeInfoList.size();i++){ vmtreeInfoDTO = (VmtreeInfoDTO)vmtreeInfoList.get(i); parentOrgId = vmtreeInfoDTO.getParentId(); while(parentOrgId!=null && parentOrgId.longValue()>0L){ //如果父机构不存在,就不继续刷新数据权限了 parentVmtreeInfoDTO = vmtreeInfoService.queryVmtreeInfoByPrimaryKey(parentOrgId.toString(), vmtreeInfoDTO.getOrgType()); if(parentVmtreeInfoDTO.getOrgName()==null || "".equals(parentVmtreeInfoDTO.getOrgName())){ break; } //查找是否有“人对parentOrgId”的映射 Map<String,Object> searchVmruleMappingParams = new HashMap<String,Object>(); VmruleMappingDTO vmruleMappingParam = new VmruleMappingDTO(); vmruleMappingParam.setMapType("2");//人对机构 vmruleMappingParam.setMapValue(parentOrgId.toString()); searchVmruleMappingParams.put("dto", vmruleMappingParam); searchVmruleMappingParams.put("vmTableName",parentVmtreeInfoDTO.getOrgType() + "_" + "VMRULE_MAPPING"); List vmruleMappingList = vmruleMappingService.searchVmruleMapping(searchVmruleMappingParams); //如果有“人对parentOrgId”的映射,刷新此映射 if(vmruleMappingList!=null && vmruleMappingList.size()>0){ VmruleMappingDTO vmruleMappingDTO = null; for(int j=0;j<vmruleMappingList.size();j++){ vmruleMappingDTO = (VmruleMappingDTO)vmruleMappingList.get(j); //刷新数据权限 vmruleMappingService.fulshVmruleMapping(vmruleMappingDTO.getId()+"", vmruleMappingDTO.getOrgType()); } } //继续刷新父机构的数据权限 parentOrgId = parentVmtreeInfoDTO.getParentId(); } } } catch(Exception ex){ logger.error("---------------AutoFlushVmruleMappingTask-------error----------"+ex.getMessage()); } finally{ logger.info("----------------AutoFlushVmruleMappingTask-------end-------------"); isNext= true; } } }
[ "gangchen1@jieyuechina.com" ]
gangchen1@jieyuechina.com
38451fd0fe41377c96205c6df6a7557080e34aa2
6980da38a4a2daa7c967bb63936a9d49ee42e1fd
/drools-wb-screens/drools-wb-guided-dtable-editor/drools-wb-guided-dtable-editor-client/src/test/java/org/drools/workbench/screens/guided/dtable/client/widget/table/columns/dom/datepicker/DatePickerSingletonDOMElementFactoryTest.java
f6d802ac0e5ed9dc799c1e0b8d77fefd547a7fd7
[ "Apache-2.0" ]
permissive
danielezonca/drools-wb
4ec7a0cffaa427bbf13d9de828050fee08a836c7
6f9c30958c2610763c50acf8b553ec53fdcb4b65
refs/heads/master
2021-06-25T15:08:00.499469
2020-10-09T11:46:30
2020-10-09T11:46:30
129,713,286
0
1
Apache-2.0
2019-01-14T17:53:29
2018-04-16T08:51:08
Java
UTF-8
Java
false
false
4,217
java
/* * Copyright 2018 Red Hat, Inc. and/or its affiliates. * * 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.drools.workbench.screens.guided.dtable.client.widget.table.columns.dom.datepicker; import java.util.Date; import java.util.HashMap; import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.junit.GWTMockUtilities; import org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.kie.workbench.common.services.shared.preferences.ApplicationPreferences; import org.kie.workbench.common.widgets.client.util.TimeZoneUtils; import org.mockito.Mock; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.uberfire.ext.widgets.common.client.common.DatePicker; import org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer; import org.uberfire.ext.wires.core.grids.client.widget.layer.impl.GridLienzoPanel; import static org.junit.Assert.assertEquals; import static org.kie.workbench.common.services.shared.preferences.ApplicationPreferences.DATE_FORMAT; import static org.kie.workbench.common.services.shared.preferences.ApplicationPreferences.KIE_TIMEZONE_OFFSET; import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; import static org.powermock.api.mockito.PowerMockito.mockStatic; @PrepareForTest({DatePickerSingletonDOMElementFactory.class, DateTimeFormat.class, TimeZoneUtils.class}) @RunWith(PowerMockRunner.class) public class DatePickerSingletonDOMElementFactoryTest { private static final String TEST_DATE_FORMAT = "MM-dd-yyyy HH:mm:ss Z"; @Mock private GridLienzoPanel gridPanel; @Mock private GridLayer gridLayer; @Mock private GuidedDecisionTableView gridWidget; @Mock private DatePicker datePicker; @BeforeClass public static void setupStatic() { preventGWTCreateError(); setStandardTimeZone(); mockStaticMethods(); initializeApplicationPreferences(); } private static void preventGWTCreateError() { GWTMockUtilities.disarm(); } private static void initializeApplicationPreferences() { ApplicationPreferences.setUp(new HashMap<String, String>() {{ put(KIE_TIMEZONE_OFFSET, "10800000"); put(DATE_FORMAT, TEST_DATE_FORMAT); }}); } private static void mockStaticMethods() { mockStatic(DateTimeFormat.class); PowerMockito.when(DateTimeFormat.getFormat(anyString())).thenReturn(mock(DateTimeFormat.class)); } private static void setStandardTimeZone() { System.setProperty("user.timezone", "Europe/Vilnius"); } @Test public void testGetValue() { final DatePickerSingletonDOMElementFactory factory = spy(makeFactory()); final Date date = mock(Date.class); final Date convertedDate = mock(Date.class); doReturn(datePicker).when(factory).getWidget(); when(datePicker.getValue()).thenReturn(date); mockStatic(TimeZoneUtils.class); PowerMockito.when(TimeZoneUtils.convertToServerTimeZone(date)).thenReturn(convertedDate); final Date actualDate = factory.getValue(); assertEquals(convertedDate, actualDate); } private DatePickerSingletonDOMElementFactory makeFactory() { return new DatePickerSingletonDOMElementFactory(gridPanel, gridLayer, gridWidget); } }
[ "manstis@users.noreply.github.com" ]
manstis@users.noreply.github.com
2ece434e8e7e14f923677ba14addf4a4626b15a7
127d445be6bfaed1e279bd9a72af3ed4874a6319
/src/main/java/com/cnt/service/CountryService.java
14a4f044c2aafb96404d2c1d395062c359eb412d
[]
no_license
tolip05/CNT
6aa599bd3338d524b2b874e778b3d94b51b8ba6c
2bef6d831984b204a3c7cf46e16f15a385f65d9c
refs/heads/main
2023-04-13T02:51:59.703212
2021-04-20T04:58:37
2021-04-20T04:58:37
358,970,521
0
0
null
null
null
null
UTF-8
Java
false
false
321
java
package com.cnt.service; import com.cnt.domein.entities.Country; import com.cnt.domein.models.service.RequestServiceModel; import com.cnt.domein.models.views.ResultViewModel; public interface CountryService { ResultViewModel calculate(RequestServiceModel requestServiceModel); boolean createCountry(Country country); }
[ "kosta1980@abv.bg" ]
kosta1980@abv.bg
b29d968eaea5c6ebc6e517d9a8a39842556502e0
d4e1685bb279ba2813627cbb00d1bca2952cebb4
/app/src/main/java/com/example/androidb/superquick/activities/LoginActivity2.java
bf8a57fd5c97e857a2e93bb0f0967c7b2aec1132
[]
no_license
ymLoecher/SuperQuick-1
4d4f6cd70c72d769eb3b9840b4d5d6fed5506eb3
a2b40d457122ab33de24ee97ce0893fd5ea79e0f
refs/heads/master
2020-09-21T05:06:46.556740
2019-11-26T10:10:37
2019-11-26T10:10:37
224,688,150
0
0
null
2019-11-28T16:04:39
2019-11-28T16:04:39
null
UTF-8
Java
false
false
14,291
java
package com.example.androidb.superquick.activities; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.annotation.TargetApi; import android.content.Intent; import android.content.pm.PackageManager; //import android.support.annotation.NonNull; //import android.support.design.widget.Snackbar; //import android.support.v7.app.AppCompatActivity; import android.app.LoaderManager.LoaderCallbacks; import android.content.CursorLoader; import android.content.Loader; import android.database.Cursor; import android.net.Uri; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; import android.provider.ContactsContract; import android.text.TextUtils; import android.view.KeyEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.inputmethod.EditorInfo; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import java.util.ArrayList; import java.util.List; import com.example.androidb.superquick.General.UserSessionData; import com.example.androidb.superquick.R; import com.example.androidb.superquick.dialogs.EditUserDialogFragment; import com.example.androidb.superquick.dialogs.ProductDialogFragment; import com.example.androidb.superquick.entities.User; import com.example.androidb.superquick.entities.Users; import com.google.android.material.snackbar.Snackbar; import com.parse.ParseException; import com.parse.ParseObject; import com.parse.ParseQuery; import static android.Manifest.permission.READ_CONTACTS; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.FragmentManager; /** * A login screen that offers login via email/password. */ public class LoginActivity2 extends AppCompatActivity implements LoaderCallbacks<Cursor> { /** * Id to identity READ_CONTACTS permission request. */ private static final int REQUEST_READ_CONTACTS = 0; /** * A dummy authentication store containing known user names and passwords. * TODO: remove after connecting to a real authentication system. */ private static final String[] DUMMY_CREDENTIALS = new String[]{ "foo@example.com:hello", "bar@example.com:world" }; /** * Keep track of the login task to ensure we can cancel it if requested. */ private UserLoginTask mAuthTask = null; // UI references. private AutoCompleteTextView mEmailView; private EditText mPasswordView; private View mProgressView; private View mLoginFormView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login2); // Set up the login form. mEmailView = (AutoCompleteTextView) findViewById(R.id.email); populateAutoComplete(); mPasswordView = (EditText) findViewById(R.id.password); mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) { if (id == EditorInfo.IME_ACTION_DONE || id == EditorInfo.IME_NULL) { attemptLogin(); return true; } return false; } }); Button mEmailSignInButton = (Button) findViewById(R.id.email_sign_in_button); mEmailSignInButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { //taking the email from the textBox and getting the user from DB AutoCompleteTextView autoCompleteTextViewEmail=findViewById(R.id.email); String email=autoCompleteTextViewEmail.getText().toString(); EditText editTextPassword=findViewById(R.id.password); String password=editTextPassword.getText().toString(); //querry get user by email Users user= Users.getUserByEmail(email); if(user==null) { Users newUser=new Users(); newUser.setUserEmail(email); newUser.setUserPassword(password); UserSessionData.setInstance(newUser); //open edit dialog for new user FragmentManager ft = getSupportFragmentManager(); EditUserDialogFragment editUserDialogFragment = new EditUserDialogFragment(); editUserDialogFragment.show(ft, "i"); } else { //saving the current user UserSessionData.setInstance(user); Intent intent = new Intent(); intent.setClass(LoginActivity2.this, StartMenuActivity.class); startActivity(intent); } } }); mLoginFormView = findViewById(R.id.login_form); mProgressView = findViewById(R.id.login_progress); } private void populateAutoComplete() { if (!mayRequestContacts()) { return; } getLoaderManager().initLoader(0, null, this); } private boolean mayRequestContacts() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { return true; } if (checkSelfPermission(READ_CONTACTS) == PackageManager.PERMISSION_GRANTED) { return true; } if (shouldShowRequestPermissionRationale(READ_CONTACTS)) { Snackbar.make(mEmailView, R.string.permission_rationale, Snackbar.LENGTH_INDEFINITE) .setAction(android.R.string.ok, new View.OnClickListener() { @Override @TargetApi(Build.VERSION_CODES.M) public void onClick(View v) { requestPermissions(new String[]{READ_CONTACTS}, REQUEST_READ_CONTACTS); } }); } else { requestPermissions(new String[]{READ_CONTACTS}, REQUEST_READ_CONTACTS); } return false; } /** * Callback received when a permissions request has been completed. */ @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { if (requestCode == REQUEST_READ_CONTACTS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { populateAutoComplete(); } } } /** * Attempts to sign in or register the account specified by the login form. * If there are form errors (invalid email, missing fields, etc.), the * errors are presented and no actual login attempt is made. */ private void attemptLogin() { if (mAuthTask != null) { return; } // Reset errors. mEmailView.setError(null); mPasswordView.setError(null); // Store values at the time of the login attempt. String email = mEmailView.getText().toString(); String password = mPasswordView.getText().toString(); boolean cancel = false; View focusView = null; // Check for a valid password, if the user entered one. if (!TextUtils.isEmpty(password) && !isPasswordValid(password)) { mPasswordView.setError(getString(R.string.error_invalid_password)); focusView = mPasswordView; cancel = true; } // Check for a valid email address. if (TextUtils.isEmpty(email)) { mEmailView.setError(getString(R.string.error_field_required)); focusView = mEmailView; cancel = true; } else if (!isEmailValid(email)) { mEmailView.setError(getString(R.string.error_invalid_email)); focusView = mEmailView; cancel = true; } if (cancel) { // There was an error; don't attempt login and focus the first // form field with an error. focusView.requestFocus(); } else { // Show a progress spinner, and kick off a background task to // perform the user login attempt. showProgress(true); mAuthTask = new UserLoginTask(email, password); mAuthTask.execute((Void) null); } } private boolean isEmailValid(String email) { //TODO: Replace this with your own logic return email.contains("@"); } private boolean isPasswordValid(String password) { //TODO: Replace this with your own logic return password.length() > 4; } /** * Shows the progress UI and hides the login form. */ @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2) private void showProgress(final boolean show) { // On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow // for very easy animations. If available, use these APIs to fade-in // the progress spinner. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime); mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE); mLoginFormView.animate().setDuration(shortAnimTime).alpha( show ? 0 : 1).setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE); } }); mProgressView.setVisibility(show ? View.VISIBLE : View.GONE); mProgressView.animate().setDuration(shortAnimTime).alpha( show ? 1 : 0).setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mProgressView.setVisibility(show ? View.VISIBLE : View.GONE); } }); } else { // The ViewPropertyAnimator APIs are not available, so simply show // and hide the relevant UI components. mProgressView.setVisibility(show ? View.VISIBLE : View.GONE); mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE); } } @Override public Loader<Cursor> onCreateLoader(int i, Bundle bundle) { return new CursorLoader(this, // Retrieve data rows for the device user's 'profile' contact. Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI, ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION, // Select only email addresses. ContactsContract.Contacts.Data.MIMETYPE + " = ?", new String[]{ContactsContract.CommonDataKinds.Email .CONTENT_ITEM_TYPE}, // Show primary email addresses first. Note that there won't be // a primary email address if the user hasn't specified one. ContactsContract.Contacts.Data.IS_PRIMARY + " DESC"); } @Override public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) { List<String> emails = new ArrayList<>(); cursor.moveToFirst(); while (!cursor.isAfterLast()) { emails.add(cursor.getString(ProfileQuery.ADDRESS)); cursor.moveToNext(); } addEmailsToAutoComplete(emails); } @Override public void onLoaderReset(Loader<Cursor> cursorLoader) { } private void addEmailsToAutoComplete(List<String> emailAddressCollection) { //Create adapter to tell the AutoCompleteTextView what to show in its dropdown list. ArrayAdapter<String> adapter = new ArrayAdapter<>(LoginActivity2.this, android.R.layout.simple_dropdown_item_1line, emailAddressCollection); mEmailView.setAdapter(adapter); } private interface ProfileQuery { String[] PROJECTION = { ContactsContract.CommonDataKinds.Email.ADDRESS, ContactsContract.CommonDataKinds.Email.IS_PRIMARY, }; int ADDRESS = 0; int IS_PRIMARY = 1; } /** * Represents an asynchronous login/registration task used to authenticate * the user. */ public class UserLoginTask extends AsyncTask<Void, Void, Boolean> { private final String mEmail; private final String mPassword; UserLoginTask(String email, String password) { mEmail = email; mPassword = password; } @Override protected Boolean doInBackground(Void... params) { // TODO: attempt authentication against a network service. try { // Simulate network access. Thread.sleep(2000); } catch (InterruptedException e) { return false; } for (String credential : DUMMY_CREDENTIALS) { String[] pieces = credential.split(":"); if (pieces[0].equals(mEmail)) { // Account exists, return true if the password matches. return pieces[1].equals(mPassword); } } // TODO: register the new account here. return true; } @Override protected void onPostExecute(final Boolean success) { mAuthTask = null; showProgress(false); if (success) { finish(); } else { mPasswordView.setError(getString(R.string.error_incorrect_password)); mPasswordView.requestFocus(); } } @Override protected void onCancelled() { mAuthTask = null; showProgress(false); } } }
[ "hodaiarg@gmail.com" ]
hodaiarg@gmail.com
a45e894eb6b52f86b95538c153392807087767f4
253754398ed2e5889f7051169212a0e831955228
/trip-mgrsite/src/main/java/cn/wolfcode/wolf2w/controller/RegionController.java
98a7ef6267a1713319644ad3e4633499379a4ec1
[]
no_license
PandoraHeartss/wolf2w
d16e1f982d96bf46e4e40564ac6e9252342d748d
909b8b20be7ee5dc84b27603c0fb9e81c2802946
refs/heads/master
2023-07-15T23:40:03.499964
2021-08-21T14:44:43
2021-08-21T14:44:43
393,286,047
2
0
null
null
null
null
UTF-8
Java
false
false
2,720
java
package cn.wolfcode.wolf2w.controller; import cn.wolfcode.wolf2w.domain.Destination; import cn.wolfcode.wolf2w.domain.Region; import cn.wolfcode.wolf2w.query.RegionQuery; import cn.wolfcode.wolf2w.service.IDestinationService; import cn.wolfcode.wolf2w.service.IRegionService; import cn.wolfcode.wolf2w.util.JsonResult; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import java.util.List; @Controller @RequestMapping("region") public class RegionController { @Autowired private IRegionService regionService; @Autowired private IDestinationService destinationService; @GetMapping("/list") public Object list(Model model, @ModelAttribute("qo") RegionQuery qo) { //page Page<Region> page = regionService.queryPage(qo); model.addAttribute("page", page); //dests List<Destination> dests = destinationService.list(); model.addAttribute("dests", dests); return "region/list"; } @RequestMapping("/get") @ResponseBody public Object get(Long id) { return JsonResult.success(regionService.getById(id)); } @RequestMapping("/saveOrUpdate") @ResponseBody public Object saveOrUpdate(Region region) { regionService.saveOrUpdate(region); return JsonResult.success(); } @RequestMapping("/delete") @ResponseBody public Object delete(Long id) { regionService.removeById(id); return JsonResult.success(); } /* * @Description: 根据区域id 和 热门参数 更改 * @param: id 区域id * @param: hot 热门参数 * @return java.lang.Object * @author PandoraHearts * @date 2021/8/13 16:44 */ @RequestMapping("/changeHotValue") @ResponseBody public Object changeHotValue(Long id, int hot) { regionService.changeHotValue(id, hot); return JsonResult.success(); } /* * @Description: 据区域id查找出 对应的目的地集合 * @param: rid * @return java.lang.Object * @author PandoraHearts * @date 2021/8/13 17:15 */ @RequestMapping("/getDestByRegionId") @ResponseBody public Object getDestByRegionId(Long rid) { List<Destination> list = destinationService.getDestByRegionId(rid); return list; } }
[ "1512836768@qq.com" ]
1512836768@qq.com
e6ededfe6da4dc0f0dd81a67b4356fe6ea488713
620a1e48b6b65024da57e8266d7901ab4b3f7473
/Eco/app/src/main/java/com/fare/eco/externalLibrary/volley/toolbox/RequestFuture.java
b8ad421d992e789db6367d4abc69b7f74ba57a0d
[]
no_license
ahu1210/Eco
262de53fde85d7ace7176765ea311fc7cb1857e3
6833d3abdaec3016e180d4bbe44a317ffd32cd32
refs/heads/master
2020-05-23T08:09:16.804296
2016-09-27T10:21:39
2016-09-27T10:21:39
69,344,266
0
0
null
null
null
null
UTF-8
Java
false
false
3,743
java
/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.fare.eco.externalLibrary.volley.toolbox; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import com.fare.eco.externalLibrary.volley.Request; import com.fare.eco.externalLibrary.volley.VolleyError; import com.fare.eco.externalLibrary.volley.Response; /** * A Future that represents a Volley request. * * Used by providing as your response and error listeners. For example: * * <pre> * RequestFuture&lt;JSONObject&gt; future = RequestFuture.newFuture(); * MyRequest request = new MyRequest(URL, future, future); * * // If you want to be able to cancel the request: * future.setRequest(requestQueue.add(request)); * * // Otherwise: * requestQueue.add(request); * * try { * JSONObject response = future.get(); * // do something with response * } catch (InterruptedException e) { * // handle the error * } catch (ExecutionException e) { * // handle the error * } * </pre> * * @param <T> * The type of parsed response this future expects. */ public class RequestFuture<T> implements Future<T>, Response.Listener<T>, Response.ErrorListener { private Request<?> mRequest; private boolean mResultReceived = false; private T mResult; private VolleyError mException; public static <E> RequestFuture<E> newFuture() { return new RequestFuture<E>(); } private RequestFuture() { } public void setRequest(Request<?> request) { mRequest = request; } @Override public synchronized boolean cancel(boolean mayInterruptIfRunning) { if (mRequest == null) { return false; } if (!isDone()) { mRequest.cancel(); return true; } else { return false; } } @Override public T get() throws InterruptedException, ExecutionException { try { return doGet(null); } catch (TimeoutException e) { throw new AssertionError(e); } } @Override public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { return doGet(TimeUnit.MILLISECONDS.convert(timeout, unit)); } private synchronized T doGet(Long timeoutMs) throws InterruptedException, ExecutionException, TimeoutException { if (mException != null) { throw new ExecutionException(mException); } if (mResultReceived) { return mResult; } if (timeoutMs == null) { wait(0); } else if (timeoutMs > 0) { wait(timeoutMs); } if (mException != null) { throw new ExecutionException(mException); } if (!mResultReceived) { throw new TimeoutException(); } return mResult; } @Override public boolean isCancelled() { if (mRequest == null) { return false; } return mRequest.isCanceled(); } @Override public synchronized boolean isDone() { return mResultReceived || mException != null || isCancelled(); } @Override public synchronized void onResponse(T response) { mResultReceived = true; mResult = response; notifyAll(); } @Override public synchronized void onErrorResponse(VolleyError error) { mException = error; notifyAll(); } }
[ "243562128@qq.com" ]
243562128@qq.com
c2e5858af2f2c6b5affc3efe690e79cd247629e1
fdbd3f8ed6ff64a8a974e18b3a081668e4e197d7
/doc/src/main/java/io/fabric8/maven/doc/ClasspathIncludeProcessor.java
e05ea8dac0f1329445041449f7a3ce389d06e674
[ "Apache-2.0" ]
permissive
theexplorist/fabric8-maven-plugin
f01adecd4f3f7e13ae263e8d8bed58cae75ecfa9
d87b44aa38a16e28edb65428fadd0d5a60816c41
refs/heads/master
2020-06-19T08:16:17.305325
2019-08-22T08:00:31
2019-08-22T08:19:34
196,633,949
3
0
Apache-2.0
2019-07-22T17:53:52
2019-07-12T19:23:40
Java
UTF-8
Java
false
false
2,746
java
/** * Copyright 2016 Red Hat, Inc. * * Red Hat licenses this file to you under the Apache License, version * 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing * permissions and limitations under the License. */ package io.fabric8.maven.doc; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.MalformedURLException; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.asciidoctor.ast.DocumentRuby; import org.asciidoctor.extension.IncludeProcessor; import org.asciidoctor.extension.PreprocessorReader; /** * @author roland * @since 11/07/16 */ public class ClasspathIncludeProcessor extends IncludeProcessor { @Override public boolean handles(String target) { return target.startsWith("classpath:"); } @Override public void process(DocumentRuby document, PreprocessorReader reader, String target, Map<String, Object> attributes) { List<String> content = readContent(target); for (int i = content.size() - 1; i >= 0; i--) { String line = content.get(i); // See also https://github.com/asciidoctor/asciidoctorj/issues/437#issuecomment-192669617 // Seems to be a hack to avoid mangling of paragraphes if (line.trim().equals("")) { line = " "; } reader.push_include(line, target, target, 1, attributes); } } private List<String> readContent(String target) { String resourcePath = target.substring("classpath:".length()); InputStream is = getClass().getResourceAsStream(resourcePath); if (is == null) { throw new IllegalArgumentException("No resource " + target + " could be found in the classpath"); } BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(is)); String line; List<String> lines = new ArrayList<>(); try { while ((line = bufferedReader.readLine()) != null) { lines.add(line); } bufferedReader.close(); } catch (IOException e) { throw new IllegalArgumentException(e); } return lines; } }
[ "roland@ro14nd.de" ]
roland@ro14nd.de
a6e20814b92f10dfc1a23869de3266ee2154afea
e0ffaa78078bba94b5ad7897ce4baf9636d5e50d
/plugins/edu.kit.ipd.sdq.modsim.hla.edit/src/edu/kit/ipd/sdq/modsim/hla/ieee1516/omt/provider/UpdateRateTypeItemProvider.java
e84da6d9cfd677278b34390e286f579a730ea9ff
[]
no_license
kit-sdq/RTI_Plugin
828fbf76771c1fb898d12833ec65b40bbb213b3f
bc57398be3d36e54d8a2c8aaac44c16506e6310c
refs/heads/master
2021-05-05T07:46:18.402561
2019-01-30T13:26:01
2019-01-30T13:26:01
118,887,589
0
0
null
null
null
null
UTF-8
Java
false
false
7,696
java
/** */ package edu.kit.ipd.sdq.modsim.hla.ieee1516.omt.provider; import edu.kit.ipd.sdq.modsim.hla.ieee1516.omt.OmtFactory; import edu.kit.ipd.sdq.modsim.hla.ieee1516.omt.OmtPackage; import edu.kit.ipd.sdq.modsim.hla.ieee1516.omt.UpdateRateType; import java.util.Collection; import java.util.List; import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.util.ResourceLocator; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; import org.eclipse.emf.edit.provider.IItemLabelProvider; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; import org.eclipse.emf.edit.provider.IItemPropertySource; import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; import org.eclipse.emf.edit.provider.ITreeItemContentProvider; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.eclipse.emf.edit.provider.ItemProviderAdapter; import org.eclipse.emf.edit.provider.ViewerNotification; /** * This is the item provider adapter for a {@link edu.kit.ipd.sdq.modsim.hla.ieee1516.omt.UpdateRateType} object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class UpdateRateTypeItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { /** * This constructs an instance from a factory and a notifier. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public UpdateRateTypeItemProvider(AdapterFactory adapterFactory) { super(adapterFactory); } /** * This returns the property descriptors for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { if (itemPropertyDescriptors == null) { super.getPropertyDescriptors(object); addIdtagPropertyDescriptor(object); addNotesPropertyDescriptor(object); } return itemPropertyDescriptors; } /** * This adds a property descriptor for the Idtag feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addIdtagPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_UpdateRateType_idtag_feature"), getString("_UI_PropertyDescriptor_description", "_UI_UpdateRateType_idtag_feature", "_UI_UpdateRateType_type"), OmtPackage.eINSTANCE.getUpdateRateType_Idtag(), true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Notes feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addNotesPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_UpdateRateType_notes_feature"), getString("_UI_PropertyDescriptor_description", "_UI_UpdateRateType_notes_feature", "_UI_UpdateRateType_type"), OmtPackage.eINSTANCE.getUpdateRateType_Notes(), true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { if (childrenFeatures == null) { super.getChildrenFeatures(object); childrenFeatures.add(OmtPackage.eINSTANCE.getUpdateRateType_Name()); childrenFeatures.add(OmtPackage.eINSTANCE.getUpdateRateType_Rate()); childrenFeatures.add(OmtPackage.eINSTANCE.getUpdateRateType_Semantics()); childrenFeatures.add(OmtPackage.eINSTANCE.getUpdateRateType_Any()); childrenFeatures.add(OmtPackage.eINSTANCE.getUpdateRateType_AnyAttribute()); } return childrenFeatures; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EStructuralFeature getChildFeature(Object object, Object child) { // Check the type of the specified child object and return the proper feature to use for // adding (see {@link AddCommand}) it as a child. return super.getChildFeature(object, child); } /** * This returns UpdateRateType.gif. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object getImage(Object object) { return overlayImage(object, getResourceLocator().getImage("full/obj16/UpdateRateType")); } /** * This returns the label text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String getText(Object object) { String label = ((UpdateRateType)object).getIdtag(); return label == null || label.length() == 0 ? getString("_UI_UpdateRateType_type") : getString("_UI_UpdateRateType_type") + " " + label; } /** * This handles model notifications by calling {@link #updateChildren} to update any cached * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void notifyChanged(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(UpdateRateType.class)) { case OmtPackage.UPDATE_RATE_TYPE__IDTAG: case OmtPackage.UPDATE_RATE_TYPE__NOTES: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; case OmtPackage.UPDATE_RATE_TYPE__NAME: case OmtPackage.UPDATE_RATE_TYPE__RATE: case OmtPackage.UPDATE_RATE_TYPE__SEMANTICS: case OmtPackage.UPDATE_RATE_TYPE__ANY: case OmtPackage.UPDATE_RATE_TYPE__ANY_ATTRIBUTE: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); return; } super.notifyChanged(notification); } /** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); newChildDescriptors.add (createChildParameter (OmtPackage.eINSTANCE.getUpdateRateType_Name(), OmtFactory.eINSTANCE.createIdentifierType())); newChildDescriptors.add (createChildParameter (OmtPackage.eINSTANCE.getUpdateRateType_Rate(), OmtFactory.eINSTANCE.createRateType())); newChildDescriptors.add (createChildParameter (OmtPackage.eINSTANCE.getUpdateRateType_Semantics(), OmtFactory.eINSTANCE.createString())); } /** * Return the resource locator for this item provider's resources. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public ResourceLocator getResourceLocator() { return Hla_metamodelEditPlugin.INSTANCE; } }
[ "gruen.jojo.develop@gmail.com" ]
gruen.jojo.develop@gmail.com
000b9294d06868114c7b89007b631ea8ffec56a0
7f5f8029a4d57a7fd10356b1327122a425673e86
/selenium_swahlabs/src/main/java/com/pratian/automation/filehandling/PropertyManager.java
75d185f525e7a246cb60b7c72d65a3ce7b1f2bcb
[]
no_license
shanmuk98/selenium-_saucedemo_project
69674ca791cc28b93a13cddc171db0fdca826d03
529b2f618dd96d2110622e8eb6009b883e570571
refs/heads/master
2023-03-07T00:50:23.862776
2021-02-22T13:26:29
2021-02-22T13:26:29
341,169,273
0
0
null
null
null
null
UTF-8
Java
false
false
458
java
package com.pratian.automation.filehandling; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.Properties; public class PropertyManager { public static String getProperty(String propName) throws IOException { FileReader fileReader=new FileReader("app.properties"); Properties properties=new Properties(); properties.load(fileReader); return properties.getProperty(propName); } }
[ "shanmuk.paduchuri@gmail.com" ]
shanmuk.paduchuri@gmail.com
f83fba641880d833d888513d1c888652fb786d62
8fbe2aac0e4cb5bbab6d607982650f7c56ec9336
/src/test/java/tscfg/example/JavaIssue33cCfg.java
77cc046e10812aacfc3aa21aa04d92bf1f3c51e3
[ "Apache-2.0" ]
permissive
carueda/tscfg
57030e9f83eb7f4502f54a6cbe415071a7617ad3
61af5256c6bf34b0f288cadf6548c3d675ff5280
refs/heads/main
2023-08-31T15:13:18.982670
2023-07-01T01:12:47
2023-07-01T01:12:47
49,305,108
113
22
Apache-2.0
2023-09-12T14:20:09
2016-01-09T00:58:42
Scala
UTF-8
Java
false
false
2,514
java
package tscfg.example; public class JavaIssue33cCfg { public final JavaIssue33cCfg.Endpoint endpoint; public static class Endpoint { public final Endpoint.OptObj optObj; public final java.lang.String req; public static class OptObj { public final java.lang.String key; public OptObj(com.typesafe.config.Config c, java.lang.String parentPath, $TsCfgValidator $tsCfgValidator) { this.key = c.hasPathOrNull("key") ? c.getString("key") : "bar"; } } public Endpoint(com.typesafe.config.Config c, java.lang.String parentPath, $TsCfgValidator $tsCfgValidator) { this.optObj = c.hasPathOrNull("optObj") ? new Endpoint.OptObj(c.getConfig("optObj"), parentPath + "optObj.", $tsCfgValidator) : new Endpoint.OptObj(com.typesafe.config.ConfigFactory.parseString("optObj{}"), parentPath + "optObj.", $tsCfgValidator); this.req = $_reqStr(parentPath, c, "req", $tsCfgValidator); } private static java.lang.String $_reqStr(java.lang.String parentPath, com.typesafe.config.Config c, java.lang.String path, $TsCfgValidator $tsCfgValidator) { if (c == null) return null; try { return c.getString(path); } catch(com.typesafe.config.ConfigException e) { $tsCfgValidator.addBadPath(parentPath + path, e); return null; } } } public JavaIssue33cCfg(com.typesafe.config.Config c) { final $TsCfgValidator $tsCfgValidator = new $TsCfgValidator(); final java.lang.String parentPath = ""; this.endpoint = c.hasPathOrNull("endpoint") ? new JavaIssue33cCfg.Endpoint(c.getConfig("endpoint"), parentPath + "endpoint.", $tsCfgValidator) : new JavaIssue33cCfg.Endpoint(com.typesafe.config.ConfigFactory.parseString("endpoint{}"), parentPath + "endpoint.", $tsCfgValidator); $tsCfgValidator.validate(); } private static final class $TsCfgValidator { private final java.util.List<java.lang.String> badPaths = new java.util.ArrayList<>(); void addBadPath(java.lang.String path, com.typesafe.config.ConfigException e) { badPaths.add("'" + path + "': " + e.getClass().getName() + "(" + e.getMessage() + ")"); } void validate() { if (!badPaths.isEmpty()) { java.lang.StringBuilder sb = new java.lang.StringBuilder("Invalid configuration:"); for (java.lang.String path : badPaths) { sb.append("\n ").append(path); } throw new com.typesafe.config.ConfigException(sb.toString()) {}; } } } }
[ "carueda@mbari.org" ]
carueda@mbari.org
3fd0c1baa9c6a594d11d2737a420b165568a24d4
53a306c527b692b75319867b0a926e0c039751f1
/rpi-server/src/main/java/ru/itlab/rpiserver/SpringConfiguration.java
f235ef3bf3d294ea093cf1caad2ea6084cc88ac0
[]
no_license
gpm80/RPI
763ce43023535994ae7f1cee013922901c91c6ad
41a1f1aa9619d71e65d35b3c773f15bf15bc2b2c
refs/heads/main
2023-01-24T09:34:18.037435
2020-11-29T00:50:40
2020-11-29T00:50:40
316,612,777
0
0
null
null
null
null
UTF-8
Java
false
false
1,592
java
package ru.itlab.rpiserver; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.ArrayList; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; /** * Конфигурация прилдожения. */ @Configuration public class SpringConfiguration { private static final Logger logger = LoggerFactory.getLogger(SpringConfiguration.class); /** * Параметры приложения. * * @return параметры */ @Bean public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { final PropertySourcesPlaceholderConfigurer propsConfigurer = new PropertySourcesPlaceholderConfigurer(); propsConfigurer.setIgnoreResourceNotFound(true); final List<Resource> resources = new ArrayList<>(); resources.add(new ClassPathResource("application.properties")); try { resources.add(new ClassPathResource(InetAddress.getLocalHost().getHostName() + ".properties")); } catch (UnknownHostException e) { logger.error(e.getMessage()); throw new RuntimeException(e); } propsConfigurer.setLocations(resources.toArray(new Resource[0])); return propsConfigurer; } }
[ "pelm@efo.ru" ]
pelm@efo.ru
492a2b14544cf35ca13a700815e6ba49546b20fa
20e737550d14f9aef93eb8d52007448208cc7ff7
/src/main/java/br/gov/pi/detran/blitz/modelo/geral/Agente.java
76df40901ad08b8d000ee5f1335da1a9cac713a6
[]
no_license
filipesoaresdev/blitz
000145b532bc2c6171ba47243453896aa0cb25c6
2013b8503df7d63cf1d7f564128c4f45683ae504
refs/heads/master
2020-03-27T22:39:11.860242
2018-09-07T03:39:19
2018-09-07T03:39:19
147,249,061
0
0
null
null
null
null
UTF-8
Java
false
false
1,461
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package br.gov.pi.detran.blitz.modelo.geral; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; /** * * @author jonny */ @Entity @Table(name = "agente") public class Agente implements Serializable { @Id private Long id; @Column(name = "matricula", columnDefinition = "char(11)") private String matricula; @Column(name = "nome", columnDefinition = "varchar(50)") private String nome; @Column(name = "cpf", columnDefinition = "char(11)") private String cpf; @Column(name = "orgao", columnDefinition = "int") private Integer orgao; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getMatricula() { return matricula; } public void setMatricula(String matricula) { this.matricula = matricula; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public String getCpf() { return cpf; } public void setCpf(String cpf) { this.cpf = cpf; } public Integer getOrgao() { return orgao; } public void setOrgao(Integer orgao) { this.orgao = orgao; } }
[ "filipefsv@yahoo.com.br" ]
filipefsv@yahoo.com.br
3d096b87715b08c6c56dea00928a155c0a9046a2
ce93aec505ac0364dca8e19d36889977dd73b72d
/src/com/dlmu/offer/Offer57.java
f16c587c1fe5142cc90bbd88fa1233042f24f1bf
[]
no_license
yezer24/test
66ac62e1521a679010f2b4c74ce2ff1c48c5d179
fe9fb5a1195f2721551a4e56bf4966457a820ffb
refs/heads/master
2023-03-26T11:09:29.854945
2021-03-26T10:21:49
2021-03-26T10:21:49
351,741,335
0
0
null
null
null
null
UTF-8
Java
false
false
770
java
package com.dlmu.offer; import com.dlmu.util.TreeNode; import java.util.HashMap; import java.util.LinkedList; import java.util.Map; import java.util.Queue; /** * @Author: yezer * @Time: 2020/11/26 * @Task: 和为S的两个数的下标 */ public class Offer57 { public int[] twoSum(int[] nums, int target) { Map<Integer, Integer> map = new HashMap<>(); LinkedList<TreeNode> queue = new LinkedList<>(); for (int i = 0; i < nums.length; i++) { if(map.containsKey(target - nums[i])){ return new int[]{i, map.get(target - nums[i])}; }else{ map.put(nums[i], i); } } return new int[]{-1, -1}; } public static void main(String[] args) { } }
[ "yezer824@163.com" ]
yezer824@163.com
6773f4edf2d3db6e298c937f4105ed926c3e01d2
d5e78590dab6aace002d9bc83a62d489a32ab1a7
/src/main/java/lsieun/classfile/attrs/annotation/type/TypePath.java
14ff5f813d7986285826de127e89388ecdef215b
[ "MIT" ]
permissive
CodePpoi/java8-classfile-tutorial-master
723f8ccfcd7e39fece7366e4e11f3f234c90df2e
6f472d6e5731da2bfefdf0a43b28a6a28744b030
refs/heads/main
2023-07-11T22:11:37.453903
2021-08-16T13:10:15
2021-08-16T13:10:15
396,799,637
0
0
null
null
null
null
UTF-8
Java
false
false
420
java
package lsieun.classfile.attrs.annotation.type; import lsieun.utils.ByteDashboard; public class TypePath { public final int path_length; public final Path[] pathes; public TypePath(ByteDashboard bd) { this.path_length = bd.readUnsignedByte(); this.pathes = new Path[path_length]; for (int i = 0; i < path_length; i++) { this.pathes[i] = new Path(bd); } } }
[ "467938742@qq.com" ]
467938742@qq.com
aab9a4cec5699b872cb0ca625c50a9f339b0dc12
0f9f1b357dfaa5c6c46ba1bb6ee91baeaceb2fd4
/stomp-websocket-autoconfigure/src/main/java/org/springframework/boot/samples/stomp/autoconfigure/StompMetricsApplication.java
0fe20ff97816fe777f3963e43fbb5309c16acdd3
[]
no_license
wilkinsona/stomp-demo
5b9877d513a08d45fa943c8146bab0058028a5f1
6cf128bdc847004eb9bdf4696791e44dbe99b456
refs/heads/master
2021-01-15T22:52:57.441485
2013-09-04T08:20:53
2013-09-04T08:20:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,183
java
/* * Copyright 2002-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.boot.samples.stomp.autoconfigure; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller @EnableAutoConfiguration public class StompMetricsApplication { @RequestMapping("/") public String home() { return "monitor.html"; } public static void main(String[] args) { SpringApplication.run(StompMetricsApplication.class, args); } }
[ "dsyer@gopivotal.com" ]
dsyer@gopivotal.com
f7eb9fa76eacb5097cdd75310027fc48003ef518
134a308d4cbc0d57752641c4374630baa9b432d2
/src/main/java/com/mycompany/chatservice/event/ParticipantRepository.java
55fdbe1697cc52041ddeef36e3040433732b1f2e
[]
no_license
kazi-imran/chatservice
3de6a49372988b16517417102d85bf7f1fffcec6
500078694e8839522179162364c7c5fa8f86a33a
refs/heads/master
2021-06-18T18:58:13.059957
2017-07-10T19:13:51
2017-07-10T19:13:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
716
java
package com.mycompany.chatservice.event; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class ParticipantRepository { private Map<String, LoginEvent> activeSessions = new ConcurrentHashMap<>(); public void add(String sessionId, LoginEvent event) { activeSessions.put(sessionId, event); } public LoginEvent getParticipant(String sessionId) { return activeSessions.get(sessionId); } public void removeParticipant(String sessionId) { activeSessions.remove(sessionId); } public Map<String, LoginEvent> getActiveSessions() { return activeSessions; } public void setActiveSessions(Map<String, LoginEvent> activeSessions) { this.activeSessions = activeSessions; } }
[ "kiaziz2002@hotmail.com" ]
kiaziz2002@hotmail.com
f81b6d4e7d9135bf719f572b94b8f765a5c3c96f
d9957138bb736670881a70ac76cbd8812a5afe84
/src/main/java/com/github/javadev/undescriptive/client/PlayGame.java
e6ed5ae50726b35b096ef314b5342838ad997956
[]
no_license
Oracleman200/dragons-of-mugloar
f842552ff2d2927dc6147414993a9b5eff047fb6
34fe750c09c5b5b12c9d36f18de1012277627eb4
refs/heads/master
2020-09-10T18:03:22.254720
2016-09-14T16:13:02
2016-09-14T16:13:02
66,883,103
0
0
null
null
null
null
UTF-8
Java
false
false
1,125
java
package com.github.javadev.undescriptive.client; import java.util.Map; import com.github.underscore.lodash.$; public class PlayGame { public static void main(String[] args) { GameClient client = HttpClient.createDefault(); Map<String, Object> game = client.getGame(); Map<String, Object> weatherResponse = client.getWeather((Long) $.get(game, "gameId")); final Map<String, Object> request = client.generateGameSolution((Map<String, Object>) $.get(game, "knight"), weatherResponse); Map<String, Object> response = client.sendSolution((Long) $.get(game, "gameId"), request); if ("Victory".equals((String) $.get(response, "status"))) { System.out.println("NEW GAME:"); System.out.println(game); System.out.println(); System.out.println("NEW WEATHER REPORT:"); System.out.println(weatherResponse); System.out.println(); System.out.println("GAME RESPONSE"); System.out.println("We win a game"+ response); System.out.println(); } else if ("SRO".equals((String) $.get(weatherResponse, "code"))) { System.out.println("Storm Weather"); } } }
[ "bukag2001@yahoo.ca" ]
bukag2001@yahoo.ca
96291d309d4d0df1b23d8b5631db82f15c9e3722
040a2e6c0131ed4d5d9f123d21a3f7e8dfd789db
/app/src/main/java/com/nlte/smartcity/domain/NewsMenuBean.java
8892aacc3357311355502903968bb53f100d425f
[]
no_license
FTVIU0/SmartCity
3b1b3fedc143d483ba93f1ba9065a6bdd1d37644
32adae1068880cdb22dc2484d38df7717794c169
refs/heads/master
2016-09-12T21:45:35.273383
2016-05-01T08:27:11
2016-05-01T08:27:11
56,494,707
1
1
null
null
null
null
UTF-8
Java
false
false
1,278
java
package com.nlte.smartcity.domain; import java.util.ArrayList; /**网络分类信息的封装 * 使用Gson解析Json注意事项: * 1. 逢 {} 创建对象,逢 [] 创建ArrayList<> * 2. 类中所有字段的命名要和网络返回的字段一致(名字和类型要一致) * 3. 不需要的字段可以不解析或者不声明 * Created by Nlte * 2016/4/23 0023. */ public class NewsMenuBean { public int retcode; public ArrayList<String> extend; public ArrayList<NewsMenuData> data; @Override public String toString() { return "NewsMenuBean [data=" + data + "]"; } /*侧边栏对象*/ public class NewsMenuData{ public String id; public String title; public int type; public ArrayList<NewsTabData> children; @Override public String toString() { return "NewsMenuData [title=" + title + ", children=" + children + "]"; } } /*Tab对象, 页签对象*/ public class NewsTabData{ public String id; public String title; public String url; public int type; @Override public String toString() { return "NewsTabData [title=" + title + "]"; } } }
[ "HGQ577068802@qq.com" ]
HGQ577068802@qq.com
e05ce3ce9f8c7451ed7c5435f30979bb835ba21c
22527752ed4f2a6f54b507c9aaa193783fc0e6fc
/app/src/main/java/com/webabcd/androiddemo/view/recyclerview/RecyclerViewDemo4.java
a32ef6f79f3f76aeb307e0bbdd3bc3cce57058f4
[]
no_license
webabcd/AndroidDemo
1a9df344999548fde70cf32dd5677b045fd57d7f
02031106c66b359162f32f6564c557f708cea593
refs/heads/master
2023-08-04T11:23:22.189782
2023-07-26T03:06:16
2023-07-26T03:06:16
153,596,772
36
8
null
null
null
null
UTF-8
Java
false
false
2,709
java
/** * 演示 RecyclerView 的上拉加载更多数据 * * adapter 参见 RecyclerViewDemo4Adapter.java * scroll 监听器参见 RecyclerViewDemo4OnScrollListener.java */ package com.webabcd.androiddemo.view.recyclerview; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.os.AsyncTask; import android.os.Bundle; import android.os.SystemClock; import com.webabcd.androiddemo.R; import java.util.List; public class RecyclerViewDemo4 extends AppCompatActivity { private RecyclerView _recyclerView; // 数据分页的页索引 private int _pageIndex = 0; // 数据分页的页大小 private int _pageSize = 20; // 是否正在加载数据 private boolean _isLoading = false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_view_recyclerview_recyclerviewdemo4); _recyclerView = findViewById(R.id.recyclerView1); sample(); } private void sample() { _recyclerView.setLayoutManager(new LinearLayoutManager(RecyclerViewDemo4.this)); // 初始数据 _recyclerView.setAdapter(new RecyclerViewDemo4Adapter(MyData.generateDataList(_pageIndex, _pageSize))); _recyclerView.addOnScrollListener(new RecyclerViewDemo4OnScrollListener() { @Override public void onBottom() { if (!_isLoading) { // 加载更多数据 _pageIndex++; _isLoading = true; new MyTask().execute(_pageIndex, _pageSize); } } }); } // 异步加载数据 private class MyTask extends AsyncTask<Integer, Void, List<MyData>> { @Override protected List<MyData> doInBackground(Integer... params) { SystemClock.sleep(1000); int pageIndex = params[0]; int pageSize = params[1]; // 请求到更多数据 return MyData.generateDataList(pageIndex * pageSize, pageSize); } @Override protected void onPostExecute(List<MyData> result) { RecyclerViewDemo4Adapter adapter = (RecyclerViewDemo4Adapter)_recyclerView.getAdapter(); if (_pageIndex > 3) { // 没有更多数据了 adapter.setHasMoreItems(false); } else { // 追加数据 adapter.appendData(result); } adapter.notifyDataSetChanged(); _isLoading = false; } } }
[ "webabcd@hotmail.com" ]
webabcd@hotmail.com
57f3c25610f04f8ee0f7df2690bb2001f7e18a25
96e3c0aa7667baeba6f75716246a611b6db1acba
/Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/PdbApplicator.java
d04c4d6b58d445b82a06ddc37216a2a2e61cf4fb
[ "GPL-1.0-or-later", "GPL-3.0-only", "Apache-2.0", "LicenseRef-scancode-public-domain", "LGPL-2.1-only", "LicenseRef-scancode-unknown-license-reference" ]
permissive
craysiii/ghidra
9b66890b2abe89612e83ba39181100840a94c45d
0cdc722921cef61b7ca1b7236bdc21079fd4c03e
refs/heads/master
2022-12-23T22:29:04.109821
2020-09-26T12:53:30
2020-09-26T12:53:30
299,513,989
1
0
Apache-2.0
2020-09-29T05:32:46
2020-09-29T05:32:45
null
UTF-8
Java
false
false
58,375
java
/* ### * IP: GHIDRA * * 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 ghidra.app.util.pdb.pdbapplicator; import java.math.BigInteger; import java.util.*; import ghidra.app.cmd.label.SetLabelPrimaryCmd; import ghidra.app.util.NamespaceUtils; import ghidra.app.util.SymbolPath; import ghidra.app.util.bin.format.pdb2.pdbreader.*; import ghidra.app.util.bin.format.pdb2.pdbreader.symbol.*; import ghidra.app.util.bin.format.pdb2.pdbreader.type.AbstractMsType; import ghidra.app.util.importer.MessageLog; import ghidra.app.util.pdb.PdbCategories; import ghidra.app.util.pdb.pdbapplicator.SymbolGroup.AbstractMsSymbolIterator; import ghidra.graph.*; import ghidra.graph.algo.GraphNavigator; import ghidra.graph.jung.JungDirectedGraph; import ghidra.program.model.address.Address; import ghidra.program.model.data.*; import ghidra.program.model.lang.Register; import ghidra.program.model.listing.*; import ghidra.program.model.symbol.*; import ghidra.util.Msg; import ghidra.util.exception.*; import ghidra.util.task.CancelOnlyWrappingTaskMonitor; import ghidra.util.task.TaskMonitor; /** * The main engine for applying an AbstractPdb to Ghidra, whether a Program or DataTypeManager. * The class is to be constructed first. * <p> * The * {@link #applyTo(Program, DataTypeManager, Address, PdbApplicatorOptions, TaskMonitor, MessageLog)} * method is then called with the appropriate {@link PdbApplicatorOptions} along with a * {@link Program} and/or {@link DataTypeManager}. Either, but not both can be null. * If the Program is not null but the DatatypeManager is null, then the DataTypeManager is gotten * from the Program. If the Program is null, then data types can be applied to a DataTypeManager. * The validation logic for the parameters is found in * {@link #validateAndSetParameters(Program, DataTypeManager, Address, PdbApplicatorOptions, TaskMonitor, MessageLog)}. * <p> * Once the parameters are validated, appropriate classes and storage containers are constructed. * Then processing commences, first with data types, followed by symbol-related processing. * <p> * {@link PdbApplicatorMetrics} are captured during the processing and status and logging is * reported to various mechanisms including {@link Msg}, {@link MessageLog}, and {@link PdbLog}. */ public class PdbApplicator { private static final String THUNK_NAME_PREFIX = "[thunk]:"; //============================================================================================== /** * Returns integer value of BigInteger or Integer.MAX_VALUE if does not fit. * @param myApplicator PdbApplicator for which we are working. * @param big BigInteger value to convert. * @return the integer value. */ static long bigIntegerToLong(PdbApplicator myApplicator, BigInteger big) { try { return big.longValueExact(); } catch (ArithmeticException e) { String msg = "BigInteger value greater than max Long: " + big; PdbLog.message(msg); myApplicator.appendLogMsg(msg); return Long.MAX_VALUE; } } /** * Returns integer value of BigInteger or Integer.MAX_VALUE if does not fit. * @param myApplicator PdbApplicator for which we are working. * @param big BigInteger value to convert. * @return the integer value. */ static int bigIntegerToInt(PdbApplicator myApplicator, BigInteger big) { try { return big.intValueExact(); } catch (ArithmeticException e) { String msg = "BigInteger value greater than max Integer: " + big; PdbLog.message(msg); myApplicator.appendLogMsg(msg); return Integer.MAX_VALUE; } } //============================================================================================== private String pdbFilename; private AbstractPdb pdb; private PdbApplicatorMetrics pdbApplicatorMetrics; //============================================================================================== private Program program; private PdbApplicatorOptions applicatorOptions; private MessageLog log; private TaskMonitor monitor; private CancelOnlyWrappingTaskMonitor cancelOnlyWrappingMonitor; //============================================================================================== private Address imageBase; private DataTypeManager dataTypeManager; private PdbAddressManager pdbAddressManager; private List<SymbolGroup> symbolGroups; //============================================================================================== // If we have symbols and memory with VBTs in them, then a better VbtManager is created. VbtManager vbtManager; PdbRegisterNameToProgramRegisterMapper registerNameToRegisterMapper; //============================================================================================== private int resolveCount; private PdbCategories categoryUtils; private PdbPrimitiveTypeApplicator pdbPrimitiveTypeApplicator; private TypeApplierFactory typeApplierParser; private ComplexTypeApplierMapper complexApplierMapper; private JungDirectedGraph<MsTypeApplier, GEdge<MsTypeApplier>> applierDependencyGraph; /** * This namespace map documents as follows: * <PRE> * false = simple namespace * true = class namespace * </PRE> */ private Map<SymbolPath, Boolean> isClassByNamespace; //============================================================================================== private SymbolApplierFactory symbolApplierParser; // Investigating... might change from String to AbstractSymbolApplier. private Map<Address, Set<String>> labelsByAddress; // Investigations into source/line info private Map<String, Set<RecordNumber>> recordNumbersByFileName; private Map<Integer, Set<RecordNumber>> recordNumbersByModuleNumber; //============================================================================================== // TODO: eventually put access methods on AbstractPdb to get filename from it (deep down). public PdbApplicator(String pdbFilename, AbstractPdb pdb) { Objects.requireNonNull(pdbFilename, "pdbFilename cannot be null"); Objects.requireNonNull(pdb, "pdb cannot be null"); this.pdbFilename = pdbFilename; this.pdb = pdb; } //============================================================================================== //============================================================================================== /** * Applies the PDB to the {@link Program} or {@link DataTypeManager}. Either, but not both, * can be null. * @param programParam The {@link Program} to which to apply the PDB. Can be null in certain * circumstances. * @param dataTypeManagerParam The {@link DataTypeManager} to which to apply data types. Can be * null in certain circumstances. * @param imageBaseParam Address bases from which symbol addresses are based. If null, uses * the image base of the program (both cannot be null). * @param applicatorOptionsParam {@link PdbApplicatorOptions} used for applying the PDB. * @param monitorParam TaskMonitor uses for watching progress and cancellation notices. * @param logParam The MessageLog to which to output messages. * @throws PdbException if there was a problem processing the data. * @throws CancelledException Upon user cancellation */ public void applyTo(Program programParam, DataTypeManager dataTypeManagerParam, Address imageBaseParam, PdbApplicatorOptions applicatorOptionsParam, TaskMonitor monitorParam, MessageLog logParam) throws PdbException, CancelledException { initializeApplyTo(programParam, dataTypeManagerParam, imageBaseParam, applicatorOptionsParam, monitorParam, logParam); switch (applicatorOptions.getRestrictions()) { case DATA_TYPES_ONLY: processTypes(); break; case PUBLIC_SYMBOLS_ONLY: processPublicSymbols(); break; case NONE: processTypes(); processSymbols(); break; default: throw new PdbException("Invalid Restriction"); } pdbAddressManager.logReport(); String applicatorMetrics = pdbApplicatorMetrics.getPostProcessingReport(); Msg.info(this, applicatorMetrics); PdbLog.message(applicatorMetrics); Msg.info(this, "PDB Terminated Normally"); } //============================================================================================== private void processTypes() throws CancelledException, PdbException { setMonitorMessage("PDB: Applying to DTM " + dataTypeManager.getName() + "..."); PdbResearch.initBreakPointRecordNumbers(); // for developmental debug resolveCount = 0; // PdbResearch.childWalk(this, monitor); // PdbResearch.studyDataTypeConflicts(this, monitor); // PdbResearch.studyCompositeFwdRefDef(pdb, monitor); // PdbResearch.study1(pdb, monitor); complexApplierMapper.mapAppliers(monitor); processSequentially(); // dumpSourceFileRecordNumbers(); // PdbResearch.developerDebugOrder(this, monitor); processDeferred(); resolveSequentially(); Msg.info(this, "resolveCount: " + resolveCount); // Currently, defining classes needs to have a program. When this is no longer true, // then this call can be performed with the data types only work. if (program != null) { defineClasses(); } // Process typedefs, which are in the symbols. processGlobalTypdefSymbols(); } //============================================================================================== private void processSymbols() throws CancelledException, PdbException { // PdbResearch.studyAggregateSymbols(this, monitor); // TODO: not sure if the following will be relevant here, elsewhere, or nowhere. // if (!pdbAddressManager.garnerSectionSegmentInformation()) { // return; // } // Doing globals before publics, as publics are those that can have mangled names. By // applying the non-mangled symbols first, we can get full type information from the // underlying type. Then we can apply the mangled symbols and demangle them without // affecting our ability to lay down PDB type information--any type information from // the mangled symbols can happen afterward. processGlobalSymbolsNoTypedefs(); processPublicSymbols(); // Seems that we shouldn't do the following, as it could be a buffer of invalid symbols // that hadn't been gone through for garbage collection of sorts. //processNonPublicOrGlobalSymbols(); // Seems that we shouldn't do the following, as the ones that are needed seem to be // referenced from a global symbol using a ReferencedSymbol. If we process the module // symbols, as below, then collisions can start to appear at addresses. This has // happened to me when I forgot to clear the results from a previous build, in which // case I could find symbols referring to a location within the old build and within // the latest build at the particular address corresponding to its location within that // build. So a module might have symbols that had not been garbage-collected. processModuleSymbols(); // These are good to process (one particular module for the linker). // processLinkerSymbols(); // Get additional thunks (that old pdb analyzer got). processThunkSymbolsFromNonLinkerModules(); //processAllSymbols(); // dumpLabels(); } //============================================================================================== //============================================================================================== private void initializeApplyTo(Program programParam, DataTypeManager dataTypeManagerParam, Address imageBaseParam, PdbApplicatorOptions applicatorOptionsParam, TaskMonitor monitorParam, MessageLog logParam) throws PdbException, CancelledException { validateAndSetParameters(programParam, dataTypeManagerParam, imageBaseParam, applicatorOptionsParam, monitorParam, logParam); cancelOnlyWrappingMonitor = new CancelOnlyWrappingTaskMonitor(monitor); pdbApplicatorMetrics = new PdbApplicatorMetrics(); pdbAddressManager = new PdbAddressManager(this, imageBase); symbolGroups = createSymbolGroups(); categoryUtils = setPdbCatogoryUtils(pdbFilename); pdbPrimitiveTypeApplicator = new PdbPrimitiveTypeApplicator(dataTypeManager); typeApplierParser = new TypeApplierFactory(this); complexApplierMapper = new ComplexTypeApplierMapper(this); applierDependencyGraph = new JungDirectedGraph<>(); isClassByNamespace = new TreeMap<>(); if (program != null) { // Currently, this must happen after symbolGroups are created. PdbVbtManager pdbVbtManager = new PdbVbtManager(this); //pdbVbtManager.CreateVirtualBaseTables(); // Depends on symbolGroups vbtManager = pdbVbtManager; registerNameToRegisterMapper = new PdbRegisterNameToProgramRegisterMapper(program); } else { vbtManager = new VbtManager(getDataTypeManager()); } symbolApplierParser = new SymbolApplierFactory(this); // Investigations labelsByAddress = new HashMap<>(); // Investigations into source/line info recordNumbersByFileName = new HashMap<>(); recordNumbersByModuleNumber = new HashMap<>(); } private void validateAndSetParameters(Program programParam, DataTypeManager dataTypeManagerParam, Address imageBaseParam, PdbApplicatorOptions applicatorOptionsParam, TaskMonitor monitorParam, MessageLog logParam) throws PdbException { applicatorOptions = (applicatorOptionsParam != null) ? applicatorOptionsParam : new PdbApplicatorOptions(); if (programParam == null) { if (dataTypeManagerParam == null) { throw new PdbException( "programParam and dataTypeManagerParam may not both be null."); } if (imageBaseParam == null) { throw new PdbException("programParam and imageBaseParam may not both be null."); } if (applicatorOptions.getRestrictions() != PdbApplicatorRestrictions.DATA_TYPES_ONLY) { throw new PdbException( "programParam may not be null for the chosen PdbApplicatorRestrictions: " + applicatorOptions.getRestrictions()); } } monitor = (monitorParam != null) ? monitorParam : TaskMonitor.DUMMY; log = (logParam != null) ? logParam : new MessageLog(); program = programParam; dataTypeManager = (dataTypeManagerParam != null) ? dataTypeManagerParam : program.getDataTypeManager(); imageBase = (imageBaseParam != null) ? imageBaseParam : program.getImageBase(); } private List<SymbolGroup> createSymbolGroups() throws CancelledException, PdbException { List<SymbolGroup> mySymbolGroups = new ArrayList<>(); int num = pdb.getDatabaseInterface().getNumModules(); // moduleNumber zero is our global/public group. for (int moduleNumber = 0; moduleNumber <= num; moduleNumber++) { monitor.checkCanceled(); Map<Long, AbstractMsSymbol> symbols = pdb.getDatabaseInterface().getModuleSymbolsByOffset(moduleNumber); SymbolGroup symbolGroup = new SymbolGroup(symbols, moduleNumber); mySymbolGroups.add(symbolGroup); } return mySymbolGroups; } //============================================================================================== // Basic utility methods. //============================================================================================== /** * Returns the {@link PdbApplicatorOptions} for this PdbApplicator. * @return the {@link PdbApplicatorOptions} for this PdbApplicator. */ PdbApplicatorOptions getPdbApplicatorOptions() { return applicatorOptions; } /** * Check to see if this monitor has been canceled * @throws CancelledException if monitor has been cancelled */ void checkCanceled() throws CancelledException { monitor.checkCanceled(); } /** * Sets the message displayed on the task monitor * @param message the message to display */ void setMonitorMessage(String message) { monitor.setMessage(message); } /** * Sets the message displayed on the task monitor * @param message the message to display */ void appendLogMsg(String message) { log.appendMsg(message); } /** * Puts message to {@link PdbLog} and to Msg.info() * @param originator a Logger instance, "this", or YourClass.class * @param message the message to display */ void pdbLogAndInfoMessage(Object originator, String message) { PdbLog.message(message); Msg.info(originator, message); } /** * Returns the {@link TaskMonitor} to available for this analyzer. * @return the monitor. */ TaskMonitor getMonitor() { return monitor; } /** * Returns the {@link CancelOnlyWrappingTaskMonitor} to available for this analyzer. This is * useful for the user to be able to control the monitor progress bar without called commands * changing its progress on smaller tasks. * @return the monitor. */ TaskMonitor getCancelOnlyWrappingMonitor() { return cancelOnlyWrappingMonitor; } /** * Returns the {@link PdbApplicatorMetrics} being used for this applicator. * @return the {@link PdbApplicatorMetrics}. */ PdbApplicatorMetrics getPdbApplicatorMetrics() { return pdbApplicatorMetrics; } /** * Returns the {@link AbstractPdb} being analyzed. * @return {@link AbstractPdb} being analyzed. */ AbstractPdb getPdb() { return pdb; } /** * Returns the {@link Program} for which this analyzer is working. * @return {@link Program} for which this analyzer is working. */ Program getProgram() { return program; } //============================================================================================== // Information for a putative PdbTypeApplicator: /** * Returns the {@link DataTypeManager} associated with this analyzer. * @return DataTypeManager which this analyzer is using. */ DataTypeManager getDataTypeManager() { return dataTypeManager; } // for PdbTypeApplicator (new) DataOrganization getDataOrganization() { return dataTypeManager.getDataOrganization(); } PdbPrimitiveTypeApplicator getPdbPrimitiveTypeApplicator() { return pdbPrimitiveTypeApplicator; } //============================================================================================== // CategoryPath-related methods. //============================================================================================== /** * Get the {@link CategoryPath} associated with the {@link SymbolPath} specified, rooting * it either at the PDB Category. * @param symbolPath Symbol path to be used to create the CategoryPath. Null represents global * namespace. * @return {@link CategoryPath} created for the input. */ CategoryPath getCategory(SymbolPath symbolPath) { return categoryUtils.getCategory(symbolPath); } /** * Returns the {@link CategoryPath} for a typedef with with the give {@link SymbolPath} and * module number; 1 <= moduleNumber <= {@link AbstractDatabaseInterface#getNumModules()}, * except that modeleNumber of 0 represents publics/globals. * @param moduleNumber module number * @param symbolPath SymbolPath of the symbol * @return the CategoryPath */ CategoryPath getTypedefsCategory(int moduleNumber, SymbolPath symbolPath) { return categoryUtils.getTypedefsCategory(moduleNumber, symbolPath); } /** * Returns the {@link CategoryPath} for Anonymous Functions Category for the PDB. * @return the {@link CategoryPath} */ CategoryPath getAnonymousFunctionsCategory() { return categoryUtils.getAnonymousFunctionsCategory(); } /** * Returns the {@link CategoryPath} for Anonymous Types Category for the PDB. * @return the {@link CategoryPath} */ CategoryPath getAnonymousTypesCategory() { return categoryUtils.getAnonymousTypesCategory(); } /** * Returns the name of what should be the next Anonymous Function (based on the count of * the number of anonymous functions) so that there is a unique name for the function. * @return the name for the next anonymous function. */ String getNextAnonymousFunctionName() { return categoryUtils.getNextAnonymousFunctionName(); } /** * Updates the count of the anonymous functions. This is a separate call from * {@link #getNextAnonymousFunctionName()} because the count should only be updated after * the previous anonymous function has been successfully created/stored. */ void incrementNextAnonymousFunctionName() { categoryUtils.incrementNextAnonymousFunctionName(); } private PdbCategories setPdbCatogoryUtils(String pdbFilename) throws CancelledException, PdbException { List<String> categoryNames = new ArrayList<>(); int num = pdb.getDatabaseInterface().getNumModules(); for (int index = 1; index <= num; index++) { monitor.checkCanceled(); String moduleName = pdb.getDatabaseInterface().getModuleInformation(index).getModuleName(); categoryNames.add(moduleName); } int index = pdbFilename.lastIndexOf("\\"); if (index == -1) { index = pdbFilename.lastIndexOf("/"); } return new PdbCategories(pdbFilename.substring(index + 1), categoryNames); } //============================================================================================== // Applier-based-DataType-dependency-related methods. //============================================================================================== void addApplierDependency(MsTypeApplier depender) { Objects.requireNonNull(depender); applierDependencyGraph.addVertex(depender.getDependencyApplier()); } void addApplierDependency(MsTypeApplier depender, MsTypeApplier dependee) { Objects.requireNonNull(depender); Objects.requireNonNull(dependee); // TODO: Possibly do checks on dependee and depender types for actual creation // of dependency--making this the one-stop-shop of this logic. Then make calls to // this method from all possibly places. (Perhaps, for example, if depender is a // pointer, then the logic would say "no.") // // Examples of where dependency should possibly be created (by not doing it, we are // getting .conflict data types) include: // structure or enum as a function return type or argument type. // applierDependencyGraph.addEdge( new DefaultGEdge<>(depender.getDependencyApplier(), dependee.getDependencyApplier())); } List<MsTypeApplier> getVerticesInPostOrder() { setMonitorMessage("PDB: Determining data type dependency order..."); return GraphAlgorithms.getVerticesInPostOrder(applierDependencyGraph, GraphNavigator.topDownNavigator()); } //============================================================================================== //============================================================================================== //============================================================================================== MsTypeApplier getApplierSpec(RecordNumber recordNumber, Class<? extends MsTypeApplier> expected) throws PdbException { return typeApplierParser.getApplierSpec(recordNumber, expected); } MsTypeApplier getApplierOrNoTypeSpec(RecordNumber recordNumber, Class<? extends MsTypeApplier> expected) throws PdbException { return typeApplierParser.getApplierOrNoTypeSpec(recordNumber, expected); } MsTypeApplier getTypeApplier(RecordNumber recordNumber) { //PdbResearch.checkBreak(recordNumber.getNumber()); return typeApplierParser.getTypeApplier(recordNumber); } MsTypeApplier getTypeApplier(AbstractMsType type) { return typeApplierParser.getTypeApplier(type); } //============================================================================================== //============================================================================================== //============================================================================================== int findModuleNumberBySectionOffsetContribution(int section, long offset) throws PdbException { for (AbstractSectionContribution sectionContribution : pdb.getDatabaseInterface().getSectionContributionList()) { int sectionContributionOffset = sectionContribution.getOffset(); int maxSectionContributionOffset = sectionContributionOffset + sectionContribution.getLength(); if (offset >= sectionContributionOffset && offset < maxSectionContributionOffset) { return sectionContribution.getModule(); } } throw new PdbException("Module not found for section/offset"); } //============================================================================================== private void processDataTypesSequentially() throws CancelledException, PdbException { AbstractTypeProgramInterface tpi = pdb.getTypeProgramInterface(); int num = tpi.getTypeIndexMaxExclusive() - tpi.getTypeIndexMin(); monitor.initialize(num); setMonitorMessage("PDB: Processing " + num + " data type components..."); for (int indexNumber = tpi.getTypeIndexMin(); indexNumber < tpi.getTypeIndexMaxExclusive(); indexNumber++) { monitor.checkCanceled(); //PdbResearch.checkBreak(indexNumber); MsTypeApplier applier = getTypeApplier(RecordNumber.typeRecordNumber(indexNumber)); //PdbResearch.checkBreak(indexNumber, applier); applier.apply(); monitor.incrementProgress(1); } } //============================================================================================== //============================================================================================== //============================================================================================== // Investigations into source/line info void putRecordNumberByFileName(RecordNumber recordNumber, String filename) { Set<RecordNumber> recordNumbers = recordNumbersByFileName.get(filename); if (recordNumbers == null) { recordNumbers = new HashSet<>(); recordNumbersByFileName.put(filename, recordNumbers); } recordNumbers.add(recordNumber); } //============================================================================================== void putRecordNumberByModuleNumber(RecordNumber recordNumber, int moduleNumber) { Set<RecordNumber> recordNumbers = recordNumbersByModuleNumber.get(moduleNumber); if (recordNumbers == null) { recordNumbers = new HashSet<>(); recordNumbersByModuleNumber.put(moduleNumber, recordNumbers); } recordNumbers.add(recordNumber); } //============================================================================================== void dumpSourceFileRecordNumbers() { PdbLog.message("RecordNumbersByFileName"); for (Map.Entry<String, Set<RecordNumber>> entry : recordNumbersByFileName.entrySet()) { String filename = entry.getKey(); PdbLog.message("FileName: " + filename); for (RecordNumber recordNumber : entry.getValue()) { AbstractMsType msType = pdb.getTypeRecord(recordNumber); PdbLog.message(recordNumber.toString() + "\n" + msType); } } PdbLog.message("RecordNumbersByModuleNumber"); for (Map.Entry<Integer, Set<RecordNumber>> entry : recordNumbersByModuleNumber.entrySet()) { int moduleNumber = entry.getKey(); PdbLog.message("ModuleNumber: " + moduleNumber); for (RecordNumber recordNumber : entry.getValue()) { AbstractMsType msType = pdb.getTypeRecord(recordNumber); PdbLog.message(recordNumber.toString() + "\n" + msType); } } } //============================================================================================== //============================================================================================== //============================================================================================== private void processItemTypesSequentially() throws CancelledException, PdbException { AbstractTypeProgramInterface ipi = pdb.getItemProgramInterface(); int num = ipi.getTypeIndexMaxExclusive() - ipi.getTypeIndexMin(); monitor.initialize(num); setMonitorMessage("PDB: Processing " + num + " item type components..."); for (int indexNumber = ipi.getTypeIndexMin(); indexNumber < num; indexNumber++) { monitor.checkCanceled(); MsTypeApplier applier = getTypeApplier(RecordNumber.itemRecordNumber(indexNumber)); applier.apply(); monitor.incrementProgress(1); } } //============================================================================================== private void processSequentially() throws CancelledException, PdbException { processDataTypesSequentially(); processItemTypesSequentially(); } //============================================================================================== private void processDeferred() throws CancelledException, PdbException { List<MsTypeApplier> verticesInPostOrder = getVerticesInPostOrder(); monitor.initialize(verticesInPostOrder.size()); setMonitorMessage("PDB: Processing " + verticesInPostOrder.size() + " deferred data type dependencies..."); for (MsTypeApplier applier : verticesInPostOrder) { monitor.checkCanceled(); //PdbResearch.checkBreak(applier.index); //checkBreak(applier.index, applier); if (applier.isDeferred()) { applier.deferredApply(); } monitor.incrementProgress(1); } } //============================================================================================== private void resolveSequentially() throws CancelledException { AbstractTypeProgramInterface tpi = pdb.getTypeProgramInterface(); int num = tpi.getTypeIndexMaxExclusive() - tpi.getTypeIndexMin(); monitor.initialize(num); setMonitorMessage("PDB: Resolving " + num + " data type components..."); Date start = new Date(); long longStart = start.getTime(); for (int indexNumber = tpi.getTypeIndexMin(); indexNumber < tpi.getTypeIndexMaxExclusive(); indexNumber++) { monitor.checkCanceled(); //PdbResearch.checkBreak(indexNumber); MsTypeApplier applier = getTypeApplier(RecordNumber.typeRecordNumber(indexNumber)); //PdbResearch.checkBreak(indexNumber, applier); applier.resolve(); monitor.incrementProgress(1); } Date stop = new Date(); long longStop = stop.getTime(); long timeDiff = longStop - longStart; Msg.info(this, "Resolve time: " + timeDiff + " mS"); } //============================================================================================== //============================================================================================== //============================================================================================== DataType resolve(DataType dataType) { DataType resolved = getDataTypeManager().resolve(dataType, DataTypeConflictHandler.REPLACE_EMPTY_STRUCTS_OR_RENAME_AND_ADD_HANDLER); resolveCount++; return resolved; } //============================================================================================== //============================================================================================== //============================================================================================== //============================================================================================== // SymbolGroup-related methods. //============================================================================================== SymbolGroup getSymbolGroup() { return getSymbolGroupForModule(0); } SymbolGroup getSymbolGroupForModule(int moduleNumber) { return symbolGroups.get(moduleNumber); } // public AbstractMsSymbol getSymbolForModuleAndOffset(int moduleNumber, long offset) // throws PdbException { // return pdb.getDatabaseInterface().getSymbolForModuleAndOffsetOfRecord(moduleNumber, offset); // } //============================================================================================== // Address-related methods. //============================================================================================== /** * Returns true if the {@link Address} is an invalid address for continuing application of * information to the program. Will report Error or message for an invalid address and will * report a "External address" message for the name when the address is external. * @param address the address to test * @param name name associated with the address used for reporting error/info situations. * @return {@code true} if the address should be processed. */ boolean isInvalidAddress(Address address, String name) { if (address == PdbAddressManager.BAD_ADDRESS) { appendLogMsg("Invalid address encountered for: " + name); return true; } if (address == PdbAddressManager.EXTERNAL_ADDRESS) { //Msg.info(this, "External address not known for: " + name); return true; } return false; } /** * Returns the image base Address being used by the applicator. * @return The Address */ Address getImageBase() { return imageBase; } /** * Returns the Address for the given section and offset. * @param symbol The {@link AddressMsSymbol} * @return The Address, which can be {@code Address.NO_ADDRESS} if invalid or * {@code Address.EXTERNAL_ADDRESS} if the address is external to the program. */ Address getAddress(AddressMsSymbol symbol) { return pdbAddressManager.getAddress(symbol); } /** * Returns the Address for the given section and offset. * @param segment The segment * @param offset The offset * @return The Address */ Address getAddress(int segment, long offset) { return pdbAddressManager.getRawAddress(segment, offset); } /** * Returns the Address for the given section and offset. * @param symbol The {@link AddressMsSymbol} * @return The Address, which can be {@code Address.NO_ADDRESS} if invalid or * {@code Address.EXTERNAL_ADDRESS} if the address is external to the program. */ Address getRawAddress(AddressMsSymbol symbol) { return pdbAddressManager.getRawAddress(symbol); } /** * Indicate to the {@link PdbAddressManager} that a new symbol with the given name has the * associated address. This allows the PdbAddressManager to create and organize the * re-mapped address and supply them. Also returns the address of the pre-existing symbol * of the same name if the name was unique, otherwise null if it didn't exist or wasn't * unique. * @param name the symbol name * @param address its associated address * @return the {@link Address} of existing symbol or null */ Address witnessSymbolNameAtAddress(String name, Address address) { return pdbAddressManager.witnessSymbolNameAtAddress(name, address); } /** * Returns the Address of an existing symbol for the query address, where the mapping is * derived by using a the address of a PDB symbol as the key and finding the address of * a symbol in the program of the same "unique" name. This is accomplished using public * mangled symbols. If the program symbol came from the PDB, then it maps to itself. * @param address the query address * @return the remapAddress */ Address getRemapAddressByAddress(Address address) { return pdbAddressManager.getRemapAddressByAddress(address); } /** * Method for callee to set the real address for the section. * @param sectionNum the section number * @param realAddress The Address */ void putRealAddressesBySection(int sectionNum, long realAddress) { pdbAddressManager.putRealAddressesBySection(sectionNum, realAddress); } /** * Method for callee to add a Memory Group symbol to the Memory Group list. * @param symbol the symbol. */ void addMemoryGroupRefinement(PeCoffGroupMsSymbol symbol) { pdbAddressManager.addMemoryGroupRefinement(symbol); } /** * Method for callee to add a Memory Section symbol to the Memory Section list. * @param symbol the symbol. */ void addMemorySectionRefinement(PeCoffSectionMsSymbol symbol) { pdbAddressManager.addMemorySectionRefinement(symbol); } //============================================================================================== // Virtual-Base-Table-related methods. //============================================================================================== VbtManager getVbtManager() { return vbtManager; } //============================================================================================== // //============================================================================================== Register getRegister(String pdbRegisterName) { return registerNameToRegisterMapper.getRegister(pdbRegisterName); } //============================================================================================== //============================================================================================== @SuppressWarnings("unused") // for method not being called. /** * Process all symbols. User should not then call other methods: * {@link #processGlobalSymbols()}, (@link #processPublicSymbols()}, and * {@link #processNonPublicOrGlobalSymbols()}. * @throws CancelledException upon user cancellation * @throws PdbException upon issue processing the request */ private void processAllSymbols() throws CancelledException, PdbException { processMainSymbols(); processModuleSymbols(); } //============================================================================================== @SuppressWarnings("unused") // for method not being called. private void processMainSymbols() throws CancelledException, PdbException { // Get a count SymbolGroup symbolGroup = getSymbolGroup(); int totalCount = symbolGroup.size(); setMonitorMessage("PDB: Applying " + totalCount + " main symbol components..."); monitor.initialize(totalCount); AbstractMsSymbolIterator iter = symbolGroup.iterator(); processSymbolGroup(0, iter); } //============================================================================================== private void processModuleSymbols() throws CancelledException { int totalCount = 0; int num = pdb.getDatabaseInterface().getNumModules(); for (int moduleNumber = 1; moduleNumber <= num; moduleNumber++) { monitor.checkCanceled(); SymbolGroup symbolGroup = getSymbolGroupForModule(moduleNumber); totalCount += symbolGroup.size(); } setMonitorMessage("PDB: Applying " + totalCount + " module symbol components..."); monitor.initialize(totalCount); // Process symbols list for each module for (int moduleNumber = 1; moduleNumber <= num; moduleNumber++) { monitor.checkCanceled(); // Process module symbols list SymbolGroup symbolGroup = getSymbolGroupForModule(moduleNumber); AbstractMsSymbolIterator iter = symbolGroup.iterator(); processSymbolGroup(moduleNumber, iter); // catelogSymbols(index, symbolGroup); // do not call monitor.incrementProgress(1) here, as it is updated inside of // processSymbolGroup. } } // private Set<Class<? extends AbstractMsSymbol>> moduleSymbols = new HashSet<>(); // // private void catelogSymbols(int moduleNumber, SymbolGroup symbolGroup) // throws CancelledException { // symbolGroup.initGet(); // while (symbolGroup.hasNext()) { // monitor.checkCanceled(); // AbstractMsSymbol symbol = symbolGroup.peek(); // moduleSymbols.add(symbol.getClass()); // symbolGroup.next(); // } // } // //============================================================================================== private void processSymbolGroup(int moduleNumber, AbstractMsSymbolIterator iter) throws CancelledException { iter.initGet(); while (iter.hasNext()) { monitor.checkCanceled(); procSym(iter); monitor.incrementProgress(1); } } //============================================================================================== /** * Process public symbols. User should not then call {@link #processAllSymbols()}; but * has these other methods available to supplement this one: {@link #processGlobalSymbolsNoTypedefs()} * and {@link #processNonPublicOrGlobalSymbols()}. * @throws CancelledException upon user cancellation * @throws PdbException upon issue processing the request */ private void processPublicSymbols() throws CancelledException, PdbException { SymbolGroup symbolGroup = getSymbolGroup(); PublicSymbolInformation publicSymbolInformation = pdb.getDatabaseInterface().getPublicSymbolInformation(); List<Long> offsets = publicSymbolInformation.getModifiedHashRecordSymbolOffsets(); setMonitorMessage("PDB: Applying " + offsets.size() + " public symbol components..."); monitor.initialize(offsets.size()); AbstractMsSymbolIterator iter = symbolGroup.iterator(); for (long offset : offsets) { monitor.checkCanceled(); iter.initGetByOffset(offset); if (!iter.hasNext()) { break; } pdbApplicatorMetrics.witnessPublicSymbolType(iter.peek()); procSym(iter); monitor.incrementProgress(1); } } /** * Process global symbols--no typedef. User should not then call {@link #processAllSymbols()}; * but has these other methods available to supplement this one: (@link #processPublicSymbols()} * and {@link #processNonPublicOrGlobalSymbols()}. * @throws CancelledException upon user cancellation * @throws PdbException upon issue processing the request */ private void processGlobalSymbolsNoTypedefs() throws CancelledException, PdbException { SymbolGroup symbolGroup = getSymbolGroup(); GlobalSymbolInformation globalSymbolInformation = pdb.getDatabaseInterface().getGlobalSymbolInformation(); List<Long> offsets = globalSymbolInformation.getModifiedHashRecordSymbolOffsets(); setMonitorMessage("PDB: Applying global symbols..."); monitor.initialize(offsets.size()); AbstractMsSymbolIterator iter = symbolGroup.iterator(); for (long offset : offsets) { monitor.checkCanceled(); iter.initGetByOffset(offset); if (!iter.hasNext()) { break; } AbstractMsSymbol symbol = iter.peek(); pdbApplicatorMetrics.witnessGlobalSymbolType(symbol); if (!(symbol instanceof AbstractUserDefinedTypeMsSymbol)) { // Not doing typedefs here procSym(iter); } monitor.incrementProgress(1); } } /** * Process global typdef symbols. * @throws CancelledException upon user cancellation * @throws PdbException upon issue processing the request */ private void processGlobalTypdefSymbols() throws CancelledException, PdbException { SymbolGroup symbolGroup = getSymbolGroup(); GlobalSymbolInformation globalSymbolInformation = pdb.getDatabaseInterface().getGlobalSymbolInformation(); List<Long> offsets = globalSymbolInformation.getModifiedHashRecordSymbolOffsets(); setMonitorMessage("PDB: Applying typedefs..."); monitor.initialize(offsets.size()); AbstractMsSymbolIterator iter = symbolGroup.iterator(); for (long offset : offsets) { monitor.checkCanceled(); iter.initGetByOffset(offset); if (!iter.hasNext()) { break; } AbstractMsSymbol symbol = iter.peek(); if (symbol instanceof AbstractUserDefinedTypeMsSymbol) { // Doing typedefs here procSym(iter); } monitor.incrementProgress(1); } } /** * Processing non-public, non-global symbols. User should not then call * {@link #processAllSymbols()}; but has these other methods available to supplement this one: * {@link #processGlobalSymbolsNoTypedefs()} and (@link #processPublicSymbols()}. * @throws CancelledException upon user cancellation * @throws PdbException upon issue processing the request */ @SuppressWarnings("unused") // for method not being called. private void processNonPublicOrGlobalSymbols() throws CancelledException, PdbException { Set<Long> offsetsRemaining = getSymbolGroup().getOffsets(); for (long off : pdb.getDatabaseInterface().getPublicSymbolInformation().getModifiedHashRecordSymbolOffsets()) { monitor.checkCanceled(); offsetsRemaining.remove(off); } for (long off : pdb.getDatabaseInterface().getGlobalSymbolInformation().getModifiedHashRecordSymbolOffsets()) { monitor.checkCanceled(); offsetsRemaining.remove(off); } setMonitorMessage( "PDB: Applying " + offsetsRemaining.size() + " other symbol components..."); monitor.initialize(offsetsRemaining.size()); //getCategoryUtils().setModuleTypedefsCategory(null); SymbolGroup symbolGroup = getSymbolGroup(); AbstractMsSymbolIterator iter = symbolGroup.iterator(); for (long offset : offsetsRemaining) { monitor.checkCanceled(); iter.initGetByOffset(offset); AbstractMsSymbol symbol = iter.peek(); procSym(iter); monitor.incrementProgress(1); } } //============================================================================================== private int findLinkerModuleNumber() { if (pdb.getDatabaseInterface() != null) { int num = 1; for (AbstractModuleInformation module : pdb.getDatabaseInterface().getModuleInformationList()) { if (isLinkerModule(module.getModuleName())) { return num; } num++; } } appendLogMsg("Not processing linker symbols because linker module not found"); return -1; } private boolean isLinkerModule(String name) { return "* Linker *".equals(name); } //============================================================================================== @SuppressWarnings("unused") // for method not being called. private boolean processLinkerSymbols() throws CancelledException { int linkerModuleNumber = findLinkerModuleNumber(); if (linkerModuleNumber == -1) { return false; } SymbolGroup symbolGroup = getSymbolGroupForModule(linkerModuleNumber); if (symbolGroup == null) { Msg.info(this, "No symbols to process from linker module."); return false; } setMonitorMessage("PDB: Applying " + symbolGroup.size() + " linker symbol components..."); monitor.initialize(symbolGroup.size()); AbstractMsSymbolIterator iter = symbolGroup.iterator(); while (iter.hasNext()) { checkCanceled(); pdbApplicatorMetrics.witnessLinkerSymbolType(iter.peek()); procSym(iter); monitor.incrementProgress(1); } return true; } //============================================================================================== private void processThunkSymbolsFromNonLinkerModules() throws CancelledException { int linkerModuleNumber = findLinkerModuleNumber(); int totalCount = 0; int num = pdb.getDatabaseInterface().getNumModules(); for (int index = 1; index <= num; index++) { monitor.checkCanceled(); if (index == linkerModuleNumber) { continue; } SymbolGroup symbolGroup = getSymbolGroupForModule(index); totalCount += symbolGroup.size(); } setMonitorMessage("PDB: Processing module thunks..."); monitor.initialize(totalCount); // Process symbols list for each module for (int index = 1; index <= num; index++) { monitor.checkCanceled(); if (index == linkerModuleNumber) { continue; } SymbolGroup symbolGroup = getSymbolGroupForModule(index); AbstractMsSymbolIterator iter = symbolGroup.iterator(); while (iter.hasNext()) { monitor.checkCanceled(); AbstractMsSymbol symbol = iter.peek(); if (symbol instanceof AbstractThunkMsSymbol) { procSym(iter); } else { iter.next(); } monitor.incrementProgress(1); } } } //============================================================================================== //============================================================================================== //============================================================================================== MsSymbolApplier getSymbolApplier(AbstractMsSymbolIterator iter) throws CancelledException { return symbolApplierParser.getSymbolApplier(iter); } //============================================================================================== void procSym(AbstractMsSymbolIterator iter) throws CancelledException { try { MsSymbolApplier applier = getSymbolApplier(iter); applier.apply(); } catch (PdbException e) { // skipping symbol Msg.info(this, "Error applying symbol to program: " + e.toString()); } } //============================================================================================== //============================================================================================== //============================================================================================== boolean isClass(SymbolPath path) { return isClassByNamespace.get(path); } //============================================================================================== void predefineClass(SymbolPath classPath) { isClassByNamespace.put(classPath, true); for (SymbolPath path = classPath.getParent(); path != null; path = path.getParent()) { if (!isClassByNamespace.containsKey(path)) { isClassByNamespace.put(path, false); // path is simple namespace } } } //============================================================================================== private void defineClasses() throws CancelledException { // create namespace and classes in an ordered fashion use tree map monitor.initialize(isClassByNamespace.size()); setMonitorMessage("PDB: Defining classes..."); for (Map.Entry<SymbolPath, Boolean> entry : isClassByNamespace.entrySet()) { monitor.checkCanceled(); SymbolPath path = entry.getKey(); boolean isClass = entry.getValue(); Namespace parentNamespace = NamespaceUtils.getNonFunctionNamespace(program, path.getParent()); if (parentNamespace == null) { String type = isClass ? "class" : "namespace"; log.appendMsg("Error: failed to define " + type + ": " + path); continue; } defineNamespace(parentNamespace, path.getName(), isClass); monitor.incrementProgress(1); } } //============================================================================================== private void defineNamespace(Namespace parentNamespace, String name, boolean isClass) { try { SymbolTable symbolTable = program.getSymbolTable(); Namespace namespace = symbolTable.getNamespace(name, parentNamespace); if (namespace != null) { if (isClass) { if (namespace instanceof GhidraClass) { return; } if (isSimpleNamespaceSymbol(namespace)) { NamespaceUtils.convertNamespaceToClass(namespace); return; } } else if (namespace.getSymbol().getSymbolType() == SymbolType.NAMESPACE) { return; } log.appendMsg("Unable to create class namespace due to conflicting symbol: " + namespace.getName(true)); } else if (isClass) { symbolTable.createClass(parentNamespace, name, SourceType.IMPORTED); } else { symbolTable.createNameSpace(parentNamespace, name, SourceType.IMPORTED); } } catch (InvalidInputException | DuplicateNameException e) { log.appendMsg("Unable to create class namespace: " + parentNamespace.getName(true) + Namespace.DELIMITER + name + " due to exception: " + e.toString()); } } //============================================================================================== private boolean isSimpleNamespaceSymbol(Namespace namespace) { Symbol s = namespace.getSymbol(); if (s.getSymbolType() != SymbolType.NAMESPACE) { return false; } Namespace n = namespace; while (n != null) { if (n instanceof Function) { return false; } n = n.getParentNamespace(); } return true; } //============================================================================================== //============================================================================================== //============================================================================================== @SuppressWarnings("unused") // for method not being called. private void storeLabelByAddress(Address address, String label) { Set<String> labels = labelsByAddress.get(address); if (labels == null) { labels = new TreeSet<>(); labelsByAddress.put(address, labels); } if (labels.contains(label)) { // TODO investigate why we would see it again. } labels.add(label); } @SuppressWarnings("unused") // for method not being called. private void dumpLabels() { for (Map.Entry<Address, Set<String>> entry : labelsByAddress.entrySet()) { Address address = entry.getKey(); Set<String> labels = entry.getValue(); System.out.println("\nAddress: " + address); for (String label : labels) { System.out.println(label); } } } //============================================================================================== boolean shouldForcePrimarySymbol(Address address, boolean forceIfMangled) { Symbol primarySymbol = program.getSymbolTable().getPrimarySymbol(address); if (primarySymbol != null) { if (primarySymbol.getName().startsWith("?") && forceIfMangled && applicatorOptions.allowDemotePrimaryMangledSymbols()) { return true; } SourceType primarySymbolSource = primarySymbol.getSource(); if (!SourceType.ANALYSIS.isHigherPriorityThan(primarySymbolSource)) { return true; } } return false; } //============================================================================================== @SuppressWarnings("unused") // For method not being called. In process of removing this version boolean createSymbolOld(Address address, String symbolPathString, boolean forcePrimary) { // storeLabelByAddress(address, symbolPathString); try { Namespace namespace = program.getGlobalNamespace(); if (symbolPathString.startsWith(THUNK_NAME_PREFIX)) { symbolPathString = symbolPathString.substring(THUNK_NAME_PREFIX.length(), symbolPathString.length()); } SymbolPath symbolPath = new SymbolPath(symbolPathString); symbolPath = symbolPath.replaceInvalidChars(); String name = symbolPath.getName(); String namespacePath = symbolPath.getParentPath(); if (namespacePath != null) { namespace = NamespaceUtils.createNamespaceHierarchy(namespacePath, namespace, program, address, SourceType.IMPORTED); } Symbol s = SymbolUtilities.createPreferredLabelOrFunctionSymbol(program, address, namespace, name, SourceType.IMPORTED); if (s != null && forcePrimary) { // PDB contains both mangled, namespace names, and global names // If mangled name does not remain primary it will not get demamgled // and we may not get signature information applied SetLabelPrimaryCmd cmd = new SetLabelPrimaryCmd(address, s.getName(), s.getParentNamespace()); cmd.applyTo(program); } return true; } catch (InvalidInputException e) { log.appendMsg("Unable to create symbol: " + e.getMessage()); } return false; } //============================================================================================== private static class PrimarySymbolInfo { private Symbol symbol; private boolean isNewSymbol; private PrimarySymbolInfo(Symbol symbol, boolean isNewSymbol) { this.symbol = symbol; this.isNewSymbol = isNewSymbol; } private boolean canBePrimaryForceOverriddenBy(String newName) { if (getSource().isLowerPriorityThan(SourceType.IMPORTED)) { return true; } if (isMangled() && !PdbApplicator.isMangled(newName)) { return true; } if (isNewSymbol()) { return false; } return false; } private SourceType getSource() { return symbol.getSource(); } private boolean isMangled() { return symbol.getName().startsWith("?"); } private boolean isNewSymbol() { return isNewSymbol; } } private Map<Address, PrimarySymbolInfo> primarySymbolInfoByAddress = new HashMap<>(); //============================================================================================== Symbol createSymbol(Address address, String symbolPathString, boolean forcePrimaryIfExistingIsMangled) { // Must get existing info before creating new symbol, as we do not want "existing" // to include the new one PrimarySymbolInfo existingPrimarySymbolInfo = getExistingPrimarySymbolInfo(address); Symbol newSymbol = createSymbol(address, symbolPathString); if (newSymbol == null) { return null; } boolean forcePrimary = false; if (existingPrimarySymbolInfo != null) { if (existingPrimarySymbolInfo.canBePrimaryForceOverriddenBy(symbolPathString) && forcePrimaryIfExistingIsMangled && applicatorOptions.allowDemotePrimaryMangledSymbols()) { forcePrimary = true; } } boolean forcePrimarySucceeded = false; if (forcePrimary) { SetLabelPrimaryCmd cmd = new SetLabelPrimaryCmd(address, newSymbol.getName(), newSymbol.getParentNamespace()); if (cmd.applyTo(program)) { forcePrimarySucceeded = true; } } if (existingPrimarySymbolInfo == null || forcePrimarySucceeded) { PrimarySymbolInfo primarySymbolInfo = new PrimarySymbolInfo(newSymbol, true); setExistingPrimarySymbolInfo(address, primarySymbolInfo); } return newSymbol; } private static boolean isMangled(String name) { return name.startsWith("?"); } private void setExistingPrimarySymbolInfo(Address address, PrimarySymbolInfo info) { primarySymbolInfoByAddress.put(address, info); } private PrimarySymbolInfo getExistingPrimarySymbolInfo(Address address) { PrimarySymbolInfo info = primarySymbolInfoByAddress.get(address); if (info != null) { return info; } Symbol primarySymbol = pdbAddressManager.getPrimarySymbol(address); if (primarySymbol == null || primarySymbol.getSource().isLowerPriorityThan(SourceType.IMPORTED)) { return null; } info = new PrimarySymbolInfo(primarySymbol, false); primarySymbolInfoByAddress.put(address, info); return info; } private Symbol createSymbol(Address address, String symbolPathString) { Symbol symbol = null; try { Namespace namespace = program.getGlobalNamespace(); if (symbolPathString.startsWith(THUNK_NAME_PREFIX)) { symbolPathString = symbolPathString.substring(THUNK_NAME_PREFIX.length(), symbolPathString.length()); } SymbolPath symbolPath = new SymbolPath(symbolPathString); symbolPath = symbolPath.replaceInvalidChars(); String name = symbolPath.getName(); String namespacePath = symbolPath.getParentPath(); if (namespacePath != null) { namespace = NamespaceUtils.createNamespaceHierarchy(namespacePath, namespace, program, address, SourceType.IMPORTED); } symbol = SymbolUtilities.createPreferredLabelOrFunctionSymbol(program, address, namespace, name, SourceType.IMPORTED); } catch (InvalidInputException e) { appendLogMsg("Unable to create symbol " + symbolPathString + " at " + address); } return symbol; } }
[ "50744617+ghizard@users.noreply.github.com" ]
50744617+ghizard@users.noreply.github.com
526a680e9085b5c9c6da36840b5041c1bac74b3c
f27905fa30c43e7441670c21a1fa83a679d652a2
/app/src/main/java/com/huateng/phone/collection/base/IBaseModel.java
b0c237913111150235ac03cebe15064cf50b8b4b
[]
no_license
JQHxx/CollecttionApp
255bf1c2e6327615fffcbba81095a3f70411e74b
ecea46860bb4f8c6ab536c3a4310e1262570fc09
refs/heads/master
2022-11-29T18:41:06.306869
2020-08-06T07:07:52
2020-08-06T07:07:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
151
java
package com.huateng.phone.collection.base; /** * author: yichuan * Created on: 2019-10-29 15:48 * description: */ public interface IBaseModel { }
[ "yichuan@chinasofti.com" ]
yichuan@chinasofti.com
16bed37574df26b4dc16dd740e478dbbfbd54943
7323787d41bd7fd6225d5dd5b4187760cd805a36
/src/main/java/org/swissbib/documentprocessing/exceptions/XML2SolrException.java
af6bcf7db9185d4d50c9224a33b2e963d23950f0
[]
no_license
swissbib/content2SearchDocs
050d913a50f003b36a391cb30c79bf8228cb85fa
9baa4a66e96c541f9d20cfad128ead45d581976a
refs/heads/master
2021-07-12T17:01:04.289378
2020-06-10T14:10:23
2020-06-10T14:10:23
11,877,250
0
1
null
null
null
null
UTF-8
Java
false
false
1,523
java
package org.swissbib.documentprocessing.exceptions; /** * [...description of the type ...] * <p/> * <p/> * <p/> * Copyright (C) project swissbib, University Library Basel, Switzerland * http://www.swissbib.org / http://www.swissbib.ch / http://www.ub.unibas.ch * <p/> * Date: 5/29/13 * Time: 7:18 AM * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, * as published by the Free Software Foundation. * <p/> * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * <p/> * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * <p/> * license: http://opensource.org/licenses/gpl-2.0.php GNU General Public License * * @author Guenter Hipler <guenter.hipler@unibas.ch> * @link http://www.swissbib.org * @link https://github.com/swissbib/xml2SearchDoc */ public class XML2SolrException extends Exception { public XML2SolrException(Exception parentExcept) { super(parentExcept); } @Override public String getMessage() { return super.getMessage(); //To change body of overridden methods use File | Settings | File Templates. } }
[ "guenter.hipler@unibas.ch" ]
guenter.hipler@unibas.ch
7ffec67bd3eab2f6c9cdbb629fabd7c449d5eeb3
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/apache--kafka/d0e436c471ba4122ddcc0f7a1624546f97c4a517/after/WorkerTaskTest.java
7ea4249b51df1da4de61d1a3f6538f954a0c7e19
[]
no_license
fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211003
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
UTF-8
Java
false
false
5,517
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.kafka.connect.runtime; import org.apache.kafka.connect.sink.SinkTask; import org.apache.kafka.connect.util.ConnectorTaskId; import org.easymock.EasyMock; import org.easymock.IAnswer; import org.junit.Test; import java.util.HashMap; import java.util.Map; import java.util.concurrent.CountDownLatch; import static org.easymock.EasyMock.expectLastCall; import static org.easymock.EasyMock.partialMockBuilder; import static org.easymock.EasyMock.replay; import static org.easymock.EasyMock.verify; public class WorkerTaskTest { private static final Map<String, String> TASK_PROPS = new HashMap<>(); static { TASK_PROPS.put(TaskConfig.TASK_CLASS_CONFIG, TestSinkTask.class.getName()); } private static final TaskConfig TASK_CONFIG = new TaskConfig(TASK_PROPS); @Test public void standardStartup() { ConnectorTaskId taskId = new ConnectorTaskId("foo", 0); TaskStatus.Listener statusListener = EasyMock.createMock(TaskStatus.Listener.class); WorkerTask workerTask = partialMockBuilder(WorkerTask.class) .withConstructor(ConnectorTaskId.class, TaskStatus.Listener.class, TargetState.class) .withArgs(taskId, statusListener, TargetState.STARTED) .addMockedMethod("initialize") .addMockedMethod("execute") .addMockedMethod("close") .createStrictMock(); workerTask.initialize(TASK_CONFIG); expectLastCall(); workerTask.execute(); expectLastCall(); statusListener.onStartup(taskId); expectLastCall(); workerTask.close(); expectLastCall(); statusListener.onShutdown(taskId); expectLastCall(); replay(workerTask); workerTask.initialize(TASK_CONFIG); workerTask.run(); workerTask.stop(); workerTask.awaitStop(1000L); verify(workerTask); } @Test public void stopBeforeStarting() { ConnectorTaskId taskId = new ConnectorTaskId("foo", 0); TaskStatus.Listener statusListener = EasyMock.createMock(TaskStatus.Listener.class); WorkerTask workerTask = partialMockBuilder(WorkerTask.class) .withConstructor(ConnectorTaskId.class, TaskStatus.Listener.class, TargetState.class) .withArgs(taskId, statusListener, TargetState.STARTED) .addMockedMethod("initialize") .addMockedMethod("execute") .addMockedMethod("close") .createStrictMock(); workerTask.initialize(TASK_CONFIG); EasyMock.expectLastCall(); workerTask.close(); EasyMock.expectLastCall(); replay(workerTask); workerTask.initialize(TASK_CONFIG); workerTask.stop(); workerTask.awaitStop(1000L); // now run should not do anything workerTask.run(); verify(workerTask); } @Test public void cancelBeforeStopping() throws Exception { ConnectorTaskId taskId = new ConnectorTaskId("foo", 0); TaskStatus.Listener statusListener = EasyMock.createMock(TaskStatus.Listener.class); WorkerTask workerTask = partialMockBuilder(WorkerTask.class) .withConstructor(ConnectorTaskId.class, TaskStatus.Listener.class, TargetState.class) .withArgs(taskId, statusListener, TargetState.STARTED) .addMockedMethod("initialize") .addMockedMethod("execute") .addMockedMethod("close") .createStrictMock(); final CountDownLatch stopped = new CountDownLatch(1); final Thread thread = new Thread() { @Override public void run() { try { stopped.await(); } catch (Exception e) { } } }; workerTask.initialize(TASK_CONFIG); EasyMock.expectLastCall(); workerTask.execute(); expectLastCall().andAnswer(new IAnswer<Void>() { @Override public Void answer() throws Throwable { thread.start(); return null; } }); statusListener.onStartup(taskId); expectLastCall(); workerTask.close(); expectLastCall(); // there should be no call to onShutdown() replay(workerTask); workerTask.initialize(TASK_CONFIG); workerTask.run(); workerTask.stop(); workerTask.cancel(); stopped.countDown(); thread.join(); verify(workerTask); } private static abstract class TestSinkTask extends SinkTask { } }
[ "fraczwojciech@gmail.com" ]
fraczwojciech@gmail.com
9b092dd3f4361f489fe29d38a1787c874a606005
cbbcead358f0c848e0c51428e18b42a2d3032829
/WEB-INF/src/com/zionex/t3sinc/util/db/SincDatabaseUtility.java
23abdeb4a105238aa859d2e685675983e9530704
[]
no_license
NSAPS/nscm
f1b8c4ebcd7000d81cd1b83978ddfc5a353c5efe
f413b3c2aa8247907cb685a5daf138792fce2b8d
refs/heads/master
2020-09-19T08:20:10.330036
2016-09-08T00:01:46
2016-09-08T00:01:46
66,534,395
0
0
null
null
null
null
UTF-8
Java
false
false
7,872
java
/* * Created on 2004. 6. 22. * * Copyright 1999-2004 ZIONEX, Inc. All Rights Reserved. * This software is the proprietary information of ZIONEX, Inc. * Use is subject to license terms. */ package com.zionex.t3sinc.util.db; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.sql.DataSource; import org.apache.commons.dbutils.DbUtils; import com.zionex.t3sinc.tsc.SincComponentExecutionException; import com.zionex.t3sinc.tsc.db.dbaccess.DatabaseSetterImpl; import com.zionex.t3sinc.tsc.db.query.QueryInformation; import com.zionex.t3sinc.tsc.db.query.QueryInterface; import com.zionex.t3sinc.tsc.db.query.organizer.QueryOrganizerImplSelect; import com.zionex.t3sinc.tsc.db.query.organizer.QueryOrganizerImplUpdate; import com.zionex.t3sinc.tsc.db.query.organizer.QueryOrganizerInterface; /** * @version 1.0 * @author blueist * @since JDK 1.4 */ public class SincDatabaseUtility implements SincDatabaseInterface { /** * */ public SincDatabaseUtility() { super(); } /* * (non-Javadoc) * * @see com.zionex.t3sinc.util.db.SincDatabaseInterface#getConnection(java.lang.String) */ public Connection getConnection(String datasource) throws SQLException { Connection connection = null; DataSource datasourceObject = (new DatabaseSetterImpl()) .setupDataSource(datasource).getDatasource(); if (datasourceObject != null) { connection = datasourceObject.getConnection(); } return connection; } /* * (non-Javadoc) * * @see com.zionex.t3sinc.util.db.SincDatabaseInterface#getQueryString(java.lang.String, * java.util.Map) */ public String getQueryString(String queryID, Map queryParameter) throws SQLException { String queryString = ""; QueryOrganizerInterface queryOrgernizer = new QueryOrganizerImplUpdate(); List queryList = getOrganizedQueryList(queryOrgernizer, queryID, queryParameter); if (queryList != null && queryList.size() > 0) { queryString = ((QueryInterface) queryList.get(0)).getQuery(); } return queryString; } // public void testQuery(Statement statement, String sqlKey, Map // queryItemMap) { // QueryOrganizerInterface queryOrgernizer = new QueryOrganizerImplUpdate(); // List queryList = getOrganizedQueryList(queryOrgernizer, sqlKey, // queryItemMap); // for (Iterator iteratorQuery = queryList.iterator(); iteratorQuery // .hasNext();) { // System.out.println(((QueryInterface) iteratorQuery.next()) // .getQuery()); // } // // } /* * (non-Javadoc) * * @see com.zionex.t3sinc.util.db.SincDatabaseInterface#executeQuery(java.lang.String, * java.lang.String) */ public ResultSet executeQuery(Statement statement, String sqlString) throws SQLException { return statement.executeQuery(sqlString); } /* * (non-Javadoc) * * @see com.zionex.t3sinc.util.db.SincDatabaseInterface#executeQuery(java.lang.String, * java.lang.String, java.util.Map) */ public ResultSet executeQuery(Statement statement, String sqlKey, Map queryItemMap) throws SQLException { ResultSet resultSet = null; QueryOrganizerInterface queryOrgernizer = new QueryOrganizerImplSelect(); List queryList = getOrganizedQueryList(queryOrgernizer, sqlKey, queryItemMap); if (queryList != null && queryList.size() > 0) { QueryInterface queryInterface = (QueryInterface) queryList.get(0); resultSet = statement.executeQuery(queryInterface.getQuery()); } return resultSet; } /* * (non-Javadoc) * * @see com.zionex.t3sinc.util.db.SincDatabaseInterface#executeUpdate(java.lang.String, * java.lang.String) */ public int executeUpdate(Statement statement, String sqlString) throws SQLException { return statement.executeUpdate(sqlString); } /* * (non-Javadoc) * * @see com.zionex.t3sinc.util.db.SincDatabaseInterface#executeUpdate(java.lang.String, * java.lang.String, java.util.Map) */ public int executeUpdate(Statement statement, String sqlKey, Map queryItemMap) throws SQLException { int result = 0; QueryOrganizerInterface queryOrgernizer = new QueryOrganizerImplUpdate(); List queryList = getOrganizedQueryList(queryOrgernizer, sqlKey, queryItemMap); if (queryList != null && queryList.size() > 0) { if (queryList.size() == 1) { QueryInterface queryInterface = (QueryInterface) queryList .get(0); result = statement.executeUpdate(queryInterface.getQuery()); } else { List queryStringList = new ArrayList(); for (int i = 0, s = queryList.size(); i < s; i++) { queryStringList.add(((QueryInterface) queryList.get(i)) .getQuery()); } result = executeBatch(statement, queryStringList)[0]; } } return result; } /* * (non-Javadoc) * * @see com.zionex.t3sinc.util.db.SincDatabaseInterface#executeBatch(java.lang.String, * java.util.List) */ public int[] executeBatch(Statement statement, List sqlStrings) throws SQLException { for (Iterator iterator = sqlStrings.iterator(); iterator.hasNext();) { statement.addBatch(iterator.next().toString()); } return statement.executeBatch(); } /* * (non-Javadoc) * * @see com.zionex.t3sinc.util.db.SincDatabaseInterface#executeBatch(java.lang.String, * java.util.List, java.util.Map) */ public int[] executeBatch(Statement statement, List sqlKeys, Map queryItemMap) throws SQLException { QueryOrganizerInterface queryOrgernizer = new QueryOrganizerImplUpdate(); List queryList = getOrganizedQueryList(queryOrgernizer, sqlKeys, queryItemMap); for (Iterator iteratorQuery = queryList.iterator(); iteratorQuery .hasNext();) { statement.addBatch(((QueryInterface) iteratorQuery.next()) .getQuery()); } return statement.executeBatch(); } private List getOrganizedQueryList(QueryOrganizerInterface queryOrgernizer, List sqlKeys, Map queryItemMap) { List queryList = new ArrayList(); for (Iterator iteratorKey = sqlKeys.iterator(); iteratorKey.hasNext();) { queryList.addAll(getOrganizedQueryList(queryOrgernizer, iteratorKey .next().toString(), queryItemMap)); } return queryList; } private List getOrganizedQueryList(QueryOrganizerInterface queryOrgernizer, String sqlKey, Map queryItemMap) { List result = new ArrayList(); QueryInformation queryInformation; queryInformation = new QueryInformation(sqlKey, ""); try { result.addAll(queryOrgernizer.getQuery(queryInformation, queryItemMap)); } catch (SincComponentExecutionException e) { e.printStackTrace(); } return result; } /* * (non-Javadoc) * * @see com.zionex.t3sinc.util.db.SincDatabaseInterface#close(java.sql.Statement) */ public void close(Statement statement) { DbUtils.closeQuietly(statement); } /* * (non-Javadoc) * * @see com.zionex.t3sinc.util.db.SincDatabaseInterface#close(java.sql.Connection) */ public void close(Connection connection) { DbUtils.closeQuietly(connection); } /* * (non-Javadoc) * * @see com.zionex.t3sinc.util.db.SincDatabaseInterface#close(java.sql.ResultSet) */ public void close(ResultSet resultSet) { DbUtils.closeQuietly(resultSet); } /* * (non-Javadoc) * * @see com.zionex.t3sinc.util.db.SincDatabaseInterface#close(java.sql.Connection, * java.sql.Statement) */ public void close(Connection connection, Statement statement) { this.close(statement); this.close(connection); } /* * (non-Javadoc) * * @see com.zionex.t3sinc.util.db.SincDatabaseInterface#close(java.sql.Connection, * java.sql.Statement, java.sql.ResultSet) */ public void close(Connection connection, Statement statement, ResultSet resultSet) { DbUtils.closeQuietly(connection, statement, resultSet); } }
[ "nuy@nongshim.co.kr" ]
nuy@nongshim.co.kr
2a8da2bfd48258b96970ec2712ed69baf5ba721c
54df7f1c707468d0f3bfb6f425f2de425e511219
/jre_emul/android/libcore/json/src/test/java/org/json/JSONTokenerTest.java
b604e1e71d9b04c8e8ce22debdc9b2aded9db713
[ "Apache-2.0" ]
permissive
svantesturre/j2objc
b0ca82b9f0639f0ca8001937b8c27b858e65179b
ff1e4abe03c3a99bb7fb497c660b5f90c8079654
refs/heads/master
2021-01-15T10:25:23.329487
2014-09-11T19:47:38
2014-09-12T16:23:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
23,109
java
/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.json; import junit.framework.AssertionFailedError; import junit.framework.TestCase; /** * This black box test was written without inspecting the non-free org.json sourcecode. */ public class JSONTokenerTest extends TestCase { public void testNulls() throws JSONException { // JSONTokener accepts null, only to fail later on almost all APIs! new JSONTokener(null).back(); try { new JSONTokener(null).more(); fail(); } catch (NullPointerException e) { } try { new JSONTokener(null).next(); fail(); } catch (NullPointerException e) { } try { new JSONTokener(null).next(3); fail(); } catch (NullPointerException e) { } try { new JSONTokener(null).next('A'); fail(); } catch (NullPointerException e) { } try { new JSONTokener(null).nextClean(); fail(); } catch (NullPointerException e) { } try { new JSONTokener(null).nextString('"'); fail(); } catch (NullPointerException e) { } try { new JSONTokener(null).nextTo('A'); fail(); } catch (NullPointerException e) { } try { new JSONTokener(null).nextTo("ABC"); fail(); } catch (NullPointerException e) { } try { new JSONTokener(null).nextValue(); fail(); } catch (NullPointerException e) { } try { new JSONTokener(null).skipPast("ABC"); fail(); } catch (NullPointerException e) { } try { new JSONTokener(null).skipTo('A'); fail(); } catch (NullPointerException e) { } assertEquals("foo! at character 0 of (null)", new JSONTokener(null).syntaxError("foo!").getMessage()); assertEquals(" at character 0 of (null)", new JSONTokener(null).toString()); } public void testEmptyString() throws JSONException { JSONTokener backTokener = new JSONTokener(""); backTokener.back(); assertEquals(" at character 0 of ", backTokener.toString()); assertFalse(new JSONTokener("").more()); assertEquals('\0', new JSONTokener("").next()); try { new JSONTokener("").next(3); fail(); } catch (JSONException expected) { } try { new JSONTokener("").next('A'); fail(); } catch (JSONException e) { } assertEquals('\0', new JSONTokener("").nextClean()); try { new JSONTokener("").nextString('"'); fail(); } catch (JSONException e) { } assertEquals("", new JSONTokener("").nextTo('A')); assertEquals("", new JSONTokener("").nextTo("ABC")); try { new JSONTokener("").nextValue(); fail(); } catch (JSONException e) { } new JSONTokener("").skipPast("ABC"); assertEquals('\0', new JSONTokener("").skipTo('A')); assertEquals("foo! at character 0 of ", new JSONTokener("").syntaxError("foo!").getMessage()); assertEquals(" at character 0 of ", new JSONTokener("").toString()); } public void testCharacterNavigation() throws JSONException { JSONTokener abcdeTokener = new JSONTokener("ABCDE"); assertEquals('A', abcdeTokener.next()); assertEquals('B', abcdeTokener.next('B')); assertEquals("CD", abcdeTokener.next(2)); try { abcdeTokener.next(2); fail(); } catch (JSONException e) { } assertEquals('E', abcdeTokener.nextClean()); assertEquals('\0', abcdeTokener.next()); assertFalse(abcdeTokener.more()); abcdeTokener.back(); assertTrue(abcdeTokener.more()); assertEquals('E', abcdeTokener.next()); } public void testBackNextAndMore() throws JSONException { JSONTokener abcTokener = new JSONTokener("ABC"); assertTrue(abcTokener.more()); abcTokener.next(); abcTokener.next(); assertTrue(abcTokener.more()); abcTokener.next(); assertFalse(abcTokener.more()); abcTokener.back(); assertTrue(abcTokener.more()); abcTokener.next(); assertFalse(abcTokener.more()); abcTokener.back(); abcTokener.back(); abcTokener.back(); abcTokener.back(); // you can back up before the beginning of a String! assertEquals('A', abcTokener.next()); } public void testNextMatching() throws JSONException { JSONTokener abcdTokener = new JSONTokener("ABCD"); assertEquals('A', abcdTokener.next('A')); try { abcdTokener.next('C'); // although it failed, this op consumes a character of input fail(); } catch (JSONException e) { } assertEquals('C', abcdTokener.next('C')); assertEquals('D', abcdTokener.next('D')); try { abcdTokener.next('E'); fail(); } catch (JSONException e) { } } public void testNextN() throws JSONException { JSONTokener abcdeTokener = new JSONTokener("ABCDEF"); assertEquals("", abcdeTokener.next(0)); try { abcdeTokener.next(7); fail(); } catch (JSONException e) { } assertEquals("ABC", abcdeTokener.next(3)); try { abcdeTokener.next(4); fail(); } catch (JSONException e) { } } public void testNextNWithAllRemaining() throws JSONException { JSONTokener tokener = new JSONTokener("ABCDEF"); tokener.next(3); try { tokener.next(3); } catch (JSONException e) { AssertionFailedError error = new AssertionFailedError("off-by-one error?"); error.initCause(e); throw error; } } public void testNext0() throws JSONException { JSONTokener tokener = new JSONTokener("ABCDEF"); tokener.next(5); tokener.next(); try { tokener.next(0); } catch (JSONException e) { Error error = new AssertionFailedError("Returning an empty string should be valid"); error.initCause(e); throw error; } } public void testNextCleanComments() throws JSONException { JSONTokener tokener = new JSONTokener( " A /*XX*/B/*XX//XX\n//XX\nXX*/C//X//X//X\nD/*X*///X\n"); assertEquals('A', tokener.nextClean()); assertEquals('B', tokener.nextClean()); assertEquals('C', tokener.nextClean()); assertEquals('D', tokener.nextClean()); assertEquals('\0', tokener.nextClean()); } public void testNextCleanNestedCStyleComments() throws JSONException { JSONTokener tokener = new JSONTokener("A /* B /* C */ D */ E"); assertEquals('A', tokener.nextClean()); assertEquals('D', tokener.nextClean()); assertEquals('*', tokener.nextClean()); assertEquals('/', tokener.nextClean()); assertEquals('E', tokener.nextClean()); } public void testNextCleanHashComments() throws JSONException { JSONTokener tokener = new JSONTokener("A # B */ /* C */ \nD #"); assertEquals('A', tokener.nextClean()); assertEquals('D', tokener.nextClean()); assertEquals('\0', tokener.nextClean()); } public void testNextCleanCommentsTrailingSingleSlash() throws JSONException { JSONTokener tokener = new JSONTokener(" / S /"); assertEquals('/', tokener.nextClean()); assertEquals('S', tokener.nextClean()); assertEquals('/', tokener.nextClean()); assertEquals("nextClean doesn't consume a trailing slash", '\0', tokener.nextClean()); } public void testNextCleanTrailingOpenComment() throws JSONException { try { new JSONTokener(" /* ").nextClean(); fail(); } catch (JSONException e) { } assertEquals('\0', new JSONTokener(" // ").nextClean()); } public void testNextCleanNewlineDelimiters() throws JSONException { assertEquals('B', new JSONTokener(" // \r\n B ").nextClean()); assertEquals('B', new JSONTokener(" // \n B ").nextClean()); assertEquals('B', new JSONTokener(" // \r B ").nextClean()); } public void testNextCleanSkippedWhitespace() throws JSONException { assertEquals("character tabulation", 'A', new JSONTokener("\tA").nextClean()); assertEquals("line feed", 'A', new JSONTokener("\nA").nextClean()); assertEquals("carriage return", 'A', new JSONTokener("\rA").nextClean()); assertEquals("space", 'A', new JSONTokener(" A").nextClean()); } /** * Tests which characters tokener treats as ignorable whitespace. See Kevin Bourrillion's * <a href="https://spreadsheets.google.com/pub?key=pd8dAQyHbdewRsnE5x5GzKQ">list * of whitespace characters</a>. */ public void testNextCleanRetainedWhitespace() throws JSONException { assertNotClean("null", '\u0000'); assertNotClean("next line", '\u0085'); assertNotClean("non-breaking space", '\u00a0'); assertNotClean("ogham space mark", '\u1680'); assertNotClean("mongolian vowel separator", '\u180e'); assertNotClean("en quad", '\u2000'); assertNotClean("em quad", '\u2001'); assertNotClean("en space", '\u2002'); assertNotClean("em space", '\u2003'); assertNotClean("three-per-em space", '\u2004'); assertNotClean("four-per-em space", '\u2005'); assertNotClean("six-per-em space", '\u2006'); assertNotClean("figure space", '\u2007'); assertNotClean("punctuation space", '\u2008'); assertNotClean("thin space", '\u2009'); assertNotClean("hair space", '\u200a'); assertNotClean("zero-width space", '\u200b'); assertNotClean("left-to-right mark", '\u200e'); assertNotClean("right-to-left mark", '\u200f'); assertNotClean("line separator", '\u2028'); assertNotClean("paragraph separator", '\u2029'); assertNotClean("narrow non-breaking space", '\u202f'); assertNotClean("medium mathematical space", '\u205f'); assertNotClean("ideographic space", '\u3000'); assertNotClean("line tabulation", '\u000b'); assertNotClean("form feed", '\u000c'); assertNotClean("information separator 4", '\u001c'); assertNotClean("information separator 3", '\u001d'); assertNotClean("information separator 2", '\u001e'); assertNotClean("information separator 1", '\u001f'); } private void assertNotClean(String name, char c) throws JSONException { assertEquals("The character " + name + " is not whitespace according to the JSON spec.", c, new JSONTokener(new String(new char[] { c, 'A' })).nextClean()); } public void testNextString() throws JSONException { assertEquals("", new JSONTokener("'").nextString('\'')); assertEquals("", new JSONTokener("\"").nextString('\"')); assertEquals("ABC", new JSONTokener("ABC'DEF").nextString('\'')); assertEquals("ABC", new JSONTokener("ABC'''DEF").nextString('\'')); // nextString permits slash-escaping of arbitrary characters! assertEquals("ABC", new JSONTokener("A\\B\\C'DEF").nextString('\'')); JSONTokener tokener = new JSONTokener(" 'abc' 'def' \"ghi\""); tokener.next(); assertEquals('\'', tokener.next()); assertEquals("abc", tokener.nextString('\'')); tokener.next(); assertEquals('\'', tokener.next()); assertEquals("def", tokener.nextString('\'')); tokener.next(); assertEquals('"', tokener.next()); assertEquals("ghi", tokener.nextString('\"')); assertFalse(tokener.more()); } public void testNextStringNoDelimiter() throws JSONException { try { new JSONTokener("").nextString('\''); fail(); } catch (JSONException e) { } JSONTokener tokener = new JSONTokener(" 'abc"); tokener.next(); tokener.next(); try { tokener.next('\''); fail(); } catch (JSONException e) { } } public void testNextStringEscapedQuote() throws JSONException { try { new JSONTokener("abc\\").nextString('"'); fail(); } catch (JSONException e) { } // we're mixing Java escaping like \" and JavaScript escaping like \\\" // which makes these tests extra tricky to read! assertEquals("abc\"def", new JSONTokener("abc\\\"def\"ghi").nextString('"')); assertEquals("abc\\def", new JSONTokener("abc\\\\def\"ghi").nextString('"')); assertEquals("abc/def", new JSONTokener("abc\\/def\"ghi").nextString('"')); assertEquals("abc\bdef", new JSONTokener("abc\\bdef\"ghi").nextString('"')); assertEquals("abc\fdef", new JSONTokener("abc\\fdef\"ghi").nextString('"')); assertEquals("abc\ndef", new JSONTokener("abc\\ndef\"ghi").nextString('"')); assertEquals("abc\rdef", new JSONTokener("abc\\rdef\"ghi").nextString('"')); assertEquals("abc\tdef", new JSONTokener("abc\\tdef\"ghi").nextString('"')); } public void testNextStringUnicodeEscaped() throws JSONException { // we're mixing Java escaping like \\ and JavaScript escaping like \\u assertEquals("abc def", new JSONTokener("abc\\u0020def\"ghi").nextString('"')); assertEquals("abcU0020def", new JSONTokener("abc\\U0020def\"ghi").nextString('"')); // JSON requires 4 hex characters after a unicode escape try { new JSONTokener("abc\\u002\"").nextString('"'); fail(); } catch (NumberFormatException e) { } catch (JSONException e) { } try { new JSONTokener("abc\\u").nextString('"'); fail(); } catch (JSONException e) { } try { new JSONTokener("abc\\u \"").nextString('"'); fail(); } catch (NumberFormatException e) { } assertEquals("abc\"def", new JSONTokener("abc\\u0022def\"ghi").nextString('"')); try { new JSONTokener("abc\\u000G\"").nextString('"'); fail(); } catch (NumberFormatException e) { } } public void testNextStringNonQuote() throws JSONException { assertEquals("AB", new JSONTokener("ABC").nextString('C')); assertEquals("ABCD", new JSONTokener("AB\\CDC").nextString('C')); assertEquals("AB\nC", new JSONTokener("AB\\nCn").nextString('n')); } public void testNextTo() throws JSONException { assertEquals("ABC", new JSONTokener("ABCDEFG").nextTo("DHI")); assertEquals("ABCDEF", new JSONTokener("ABCDEF").nextTo("")); JSONTokener tokener = new JSONTokener("ABC\rDEF\nGHI\r\nJKL"); assertEquals("ABC", tokener.nextTo("M")); assertEquals('\r', tokener.next()); assertEquals("DEF", tokener.nextTo("M")); assertEquals('\n', tokener.next()); assertEquals("GHI", tokener.nextTo("M")); assertEquals('\r', tokener.next()); assertEquals('\n', tokener.next()); assertEquals("JKL", tokener.nextTo("M")); tokener = new JSONTokener("ABCDEFGHI"); assertEquals("ABC", tokener.nextTo("DEF")); assertEquals("", tokener.nextTo("DEF")); assertEquals('D', tokener.next()); assertEquals("", tokener.nextTo("DEF")); assertEquals('E', tokener.next()); assertEquals("", tokener.nextTo("DEF")); assertEquals('F', tokener.next()); assertEquals("GHI", tokener.nextTo("DEF")); assertEquals("", tokener.nextTo("DEF")); tokener = new JSONTokener(" \t \fABC \t DEF"); assertEquals("ABC", tokener.nextTo("DEF")); assertEquals('D', tokener.next()); tokener = new JSONTokener(" \t \fABC \n DEF"); assertEquals("ABC", tokener.nextTo("\n")); assertEquals("", tokener.nextTo("\n")); tokener = new JSONTokener(""); try { tokener.nextTo(null); fail(); } catch (NullPointerException e) { } } public void testNextToTrimming() { assertEquals("ABC", new JSONTokener("\t ABC \tDEF").nextTo("DE")); assertEquals("ABC", new JSONTokener("\t ABC \tDEF").nextTo('D')); } public void testNextToTrailing() { assertEquals("ABC DEF", new JSONTokener("\t ABC DEF \t").nextTo("G")); assertEquals("ABC DEF", new JSONTokener("\t ABC DEF \t").nextTo('G')); } public void testNextToDoesntStopOnNull() { String message = "nextTo() shouldn't stop after \\0 characters"; JSONTokener tokener = new JSONTokener(" \0\t \fABC \n DEF"); assertEquals(message, "ABC", tokener.nextTo("D")); assertEquals(message, '\n', tokener.next()); assertEquals(message, "", tokener.nextTo("D")); } public void testNextToConsumesNull() { String message = "nextTo shouldn't consume \\0."; JSONTokener tokener = new JSONTokener("ABC\0DEF"); assertEquals(message, "ABC", tokener.nextTo("\0")); assertEquals(message, '\0', tokener.next()); assertEquals(message, "DEF", tokener.nextTo("\0")); } public void testSkipPast() { JSONTokener tokener = new JSONTokener("ABCDEF"); tokener.skipPast("ABC"); assertEquals('D', tokener.next()); tokener.skipPast("EF"); assertEquals('\0', tokener.next()); tokener = new JSONTokener("ABCDEF"); tokener.skipPast("ABCDEF"); assertEquals('\0', tokener.next()); tokener = new JSONTokener("ABCDEF"); tokener.skipPast("G"); assertEquals('\0', tokener.next()); tokener = new JSONTokener("ABC\0ABC"); tokener.skipPast("ABC"); assertEquals('\0', tokener.next()); assertEquals('A', tokener.next()); tokener = new JSONTokener("\0ABC"); tokener.skipPast("ABC"); assertEquals('\0', tokener.next()); tokener = new JSONTokener("ABC\nDEF"); tokener.skipPast("DEF"); assertEquals('\0', tokener.next()); tokener = new JSONTokener("ABC"); tokener.skipPast("ABCDEF"); assertEquals('\0', tokener.next()); tokener = new JSONTokener("ABCDABCDABCD"); tokener.skipPast("ABC"); assertEquals('D', tokener.next()); tokener.skipPast("ABC"); assertEquals('D', tokener.next()); tokener.skipPast("ABC"); assertEquals('D', tokener.next()); tokener = new JSONTokener(""); try { tokener.skipPast(null); fail(); } catch (NullPointerException e) { } } public void testSkipTo() { JSONTokener tokener = new JSONTokener("ABCDEF"); tokener.skipTo('A'); assertEquals('A', tokener.next()); tokener.skipTo('D'); assertEquals('D', tokener.next()); tokener.skipTo('G'); assertEquals('E', tokener.next()); tokener.skipTo('A'); assertEquals('F', tokener.next()); tokener = new JSONTokener("ABC\nDEF"); tokener.skipTo('F'); assertEquals('F', tokener.next()); tokener = new JSONTokener("ABCfDEF"); tokener.skipTo('F'); assertEquals('F', tokener.next()); tokener = new JSONTokener("ABC/* DEF */"); tokener.skipTo('D'); assertEquals('D', tokener.next()); } public void testSkipToStopsOnNull() { JSONTokener tokener = new JSONTokener("ABC\0DEF"); tokener.skipTo('F'); assertEquals("skipTo shouldn't stop when it sees '\\0'", 'F', tokener.next()); } public void testBomIgnoredAsFirstCharacterOfDocument() throws JSONException { JSONTokener tokener = new JSONTokener("\ufeff[]"); JSONArray array = (JSONArray) tokener.nextValue(); assertEquals(0, array.length()); } public void testBomTreatedAsCharacterInRestOfDocument() throws JSONException { JSONTokener tokener = new JSONTokener("[\ufeff]"); JSONArray array = (JSONArray) tokener.nextValue(); assertEquals(1, array.length()); } public void testDehexchar() { assertEquals( 0, JSONTokener.dehexchar('0')); assertEquals( 1, JSONTokener.dehexchar('1')); assertEquals( 2, JSONTokener.dehexchar('2')); assertEquals( 3, JSONTokener.dehexchar('3')); assertEquals( 4, JSONTokener.dehexchar('4')); assertEquals( 5, JSONTokener.dehexchar('5')); assertEquals( 6, JSONTokener.dehexchar('6')); assertEquals( 7, JSONTokener.dehexchar('7')); assertEquals( 8, JSONTokener.dehexchar('8')); assertEquals( 9, JSONTokener.dehexchar('9')); assertEquals(10, JSONTokener.dehexchar('A')); assertEquals(11, JSONTokener.dehexchar('B')); assertEquals(12, JSONTokener.dehexchar('C')); assertEquals(13, JSONTokener.dehexchar('D')); assertEquals(14, JSONTokener.dehexchar('E')); assertEquals(15, JSONTokener.dehexchar('F')); assertEquals(10, JSONTokener.dehexchar('a')); assertEquals(11, JSONTokener.dehexchar('b')); assertEquals(12, JSONTokener.dehexchar('c')); assertEquals(13, JSONTokener.dehexchar('d')); assertEquals(14, JSONTokener.dehexchar('e')); assertEquals(15, JSONTokener.dehexchar('f')); for (int c = 0; c <= 0xFFFF; c++) { if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f')) { continue; } assertEquals("dehexchar " + c, -1, JSONTokener.dehexchar((char) c)); } } }
[ "tball@google.com" ]
tball@google.com
b1e53f4ba1090e39394f4640b12b257f2a96e76f
e95908bde64fe7b122774b09cfd4a2fb518ccdf5
/ML/src/main/java/Core/NeuralNetwork/Layers/Dense.java
68574d2e0b61f0a7d36f1b62e40033bf87ec014f
[]
no_license
nryanov/MachineLearningFramework
0caaacdaa6c6438caeab5dabc01ce8d3fcb3875a
4530b1bbc42a09ee71062c57823364fa75eea679
refs/heads/master
2021-06-17T02:41:40.239028
2017-05-22T21:35:41
2017-05-22T21:35:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,249
java
package Core.NeuralNetwork.Layers; import Core.NeuralNetwork.Activation.Activation; import Core.NeuralNetwork.Activation.Identity; import Core.NeuralNetwork.Activation.Sigmoid; import Core.NeuralNetwork.Initialization.Initialization; import Core.NeuralNetwork.Initialization.RandomInit; import Utilities.DataSetUtilities; import org.ejml.simple.SimpleMatrix; /** * Created by GrIfOn on 09.04.2017. */ public class Dense extends Layer { public Dense(int units) { this.units = units; this.activation = new Identity(); output = new SimpleMatrix(units, 1); } public Dense(Activation activation, int units) { this.activation = activation; this.units = units; } @Override public SimpleMatrix computeError(SimpleMatrix delta) { error = activation.derivative(input.mult(thetas)).scale(delta.elementSum()); return thetas.mult(error.transpose()); } @Override public SimpleMatrix feedforward(SimpleMatrix Z) { input = Z; output = activation.activation(input.mult(thetas)); output = DataSetUtilities.addColumnOfOnes(output); return output; } @Override public String toString() { return "Dense{}"; } }
[ "grifon52@gmail.com" ]
grifon52@gmail.com
5ea23e365d730fe7492d7397d666afeda8ed02f0
affb2c0e5b07c852a463725a628641a1b65a56ca
/src/main/java/cmm/javacc/zck/SimpleNode.java
4b50f2b6eb0fa70e67bc83a7b83341377d379b68
[]
no_license
zhangchengkai826/cmm-javacc-zck
05331c324951ef60d4ee2470c160902e2f1f4fc3
713e9926ceae804cbfc8446e1141c75de3af2b74
refs/heads/master
2022-03-27T12:48:37.833407
2019-12-26T01:52:15
2019-12-26T01:52:15
230,184,605
0
0
null
null
null
null
UTF-8
Java
false
false
2,296
java
/* Generated By:JJTree: Do not edit this line. SimpleNode.java Version 4.3 */ /* JavaCCOptions:MULTI=false,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package cmm.javacc.zck; public class SimpleNode implements Node { protected Node parent; protected Node[] children; protected int id; protected Object value; protected CMMParser parser; public SimpleNode(int i) { id = i; } public SimpleNode(CMMParser p, int i) { this(i); parser = p; } public void jjtOpen() { } public void jjtClose() { } public void jjtSetParent(Node n) { parent = n; } public Node jjtGetParent() { return parent; } public void jjtAddChild(Node n, int i) { if (children == null) { children = new Node[i + 1]; } else if (i >= children.length) { Node c[] = new Node[i + 1]; System.arraycopy(children, 0, c, 0, children.length); children = c; } children[i] = n; } public Node jjtGetChild(int i) { return children[i]; } public int jjtGetNumChildren() { return (children == null) ? 0 : children.length; } public void jjtSetValue(Object value) { this.value = value; } public Object jjtGetValue() { return value; } /* You can override these two methods in subclasses of SimpleNode to customize the way the node appears when the tree is dumped. If your output uses more than one line you should override toString(String), otherwise overriding toString() is probably all you need to do. */ public String toString() { return CMMParserTreeConstants.jjtNodeName[id]; } public String toString(String prefix) { return prefix + toString(); } /* Override this method if you want to customize how the node dumps out its children. */ public void dump(String prefix) { System.out.println(toString(prefix)); if (children != null) { for (int i = 0; i < children.length; ++i) { SimpleNode n = (SimpleNode)children[i]; if (n != null) { n.dump(prefix + " "); } } } } } /* JavaCC - OriginalChecksum=19d3d0b89ac60ea851cb9d8815dda30c (do not edit this line) */
[ "zchengkai826@gmail.com" ]
zchengkai826@gmail.com
8b095db04c54c743a22df5af437411eaf652c035
bfc55981555709d33619ead60f44cda422156a89
/src/main/java/vertx/fi/Products.java
e8c1c4efb0a586c42c79ede062ed08d3c1e4b21e
[]
no_license
yangmyfly/mobileTeam3
67a17ddd886f8ab5fb37a72ff6d7684ff20d75d0
a9437ea217b5e3459f3b587b26f742d59bccc4f4
refs/heads/master
2021-04-06T18:08:40.794848
2016-08-02T17:23:55
2016-08-02T17:23:55
64,081,513
0
0
null
null
null
null
UTF-8
Java
false
false
688
java
package vertx.fi; /** * Created by joe on 16/7/26. */ public class Products { public double x; public double y; public String title; public String ASIN; public String price; public String image; public String description; public String customReview; public Products(double x, double y, String title, String ASIN, String price, String image, String description, String customReview) { this.x = x; this.y = y; this.title = title; this.ASIN = ASIN; this.price = price; this.image = image; this.description = description; this.customReview = customReview; } }
[ "1368035409@qq.com" ]
1368035409@qq.com
9cc7926a6cbd5d93b54a87679b505aa5f4e051c1
c024937fd450d3fb63467c01ea0d6f36edf1507c
/src/main/java/br/com/netflics/persistence/RoleRepository.java
58784f231b9b6e9b928225df8d2a78971e54f81c
[]
no_license
robsonmrsp/react-netflics
42071faba49eac69d60d0c4826015485262729a0
2f3c764f35409bae5a9f82484502e8f2acc5d1b9
refs/heads/master
2022-01-16T12:08:05.533074
2022-01-04T01:21:34
2022-01-04T01:21:43
165,163,784
0
0
null
null
null
null
UTF-8
Java
false
false
441
java
/* generated by JSetup v0.95 : at 23 de jun de 2021 23:11:06 */ package br.com.netflics.persistence; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import br.com.netflics.model.Role; public interface RoleRepository extends JpaRepository<Role, Integer> ,JpaSpecificationExecutor<Role>{ } //generated by JSetup v0.95 : at 23 de jun de 2021 23:11:06
[ "robsonmrsp@gmail.com" ]
robsonmrsp@gmail.com
f841de64a8c739f12df13fc42cce07951364fc13
cc91c7efe92821c9a8cd8ef0fb13929bf2646857
/feixiang-tdd/src/main/java/com/feixiang/tdd/game/service/TicTacToe.java
189d2e0d124dc54b50e43591a1228215659a9676
[]
no_license
lidaofei/feixiang
914b931eed6aa28350f7f9ee664b96c950584ca3
c49c6e02a8d757205de9ccc1b512b00239bac65b
refs/heads/master
2022-12-06T21:42:29.694471
2020-12-22T06:07:16
2020-12-22T06:07:16
183,771,444
1
0
null
2022-11-16T09:58:08
2019-04-27T12:42:16
Java
UTF-8
Java
false
false
938
java
package com.feixiang.tdd.game.service; /** * @author lidaofei * @date 2019/12/24 22:20 */ public class TicTacToe { public static final char INIT_VALUE = '0'; private char[][] board; private char player; public TicTacToe() { this.board = { {'0', '0', '0'}, {'0', '0', '0'}, {'0', '0', '0'} }; player = 'K'; } public void play(Integer x, Integer y) { test(x, "x越界"); test(y, "y越界"); if (board[x][y] != INIT_VALUE) { throw new RuntimeException("该格已经被占据"); } else { board[x][y] = '1'; } } private void test(Integer x, String message) { if (x <= 0 || x >= 5) { throw new RuntimeException(message); } } public char nextPlayer() { return 'k'; } }
[ "392586954@qq.com" ]
392586954@qq.com
ce45c98d5246b870040842acba0e88c18301236c
d482588adb04399c1b548dd65dee17016989b56b
/src/com/wode/factorymethod/TestFactoryMethod.java
098583a7d5cab70d6cb492dc6f7d44a104973cc2
[]
no_license
TJPgithub/test1
014aa5e0d39c70fcfdd7d1ad90ad56412bf95f2c
1fccee64aeef9b408b419c8c42c5f41848506f58
refs/heads/master
2021-01-14T21:26:19.624618
2020-02-26T10:39:36
2020-02-26T10:39:36
242,764,540
0
0
null
null
null
null
UTF-8
Java
false
false
521
java
package com.wode.factorymethod; import com.wode.Payment; /** * Created by admin on 2020/2/26. */ public class TestFactoryMethod { public static void main(String[] args) { CreateFactoryMethod factory = new ZfbPayFactory(); Payment payment = factory.create(); payment.payMsg(); factory = new WxPayFactory(); payment = factory.create(); payment.payMsg(); factory = new ApplePayFactory(); payment = factory.create(); payment.payMsg(); } }
[ "792282512@qq.com" ]
792282512@qq.com
e6e68933a191a371c659535c6dfe92756cced65b
d72cdc4a0158ee3ecae5e1b2d9cdb9bb7e241763
/tools/base/build-system/gradle-core/src/main/groovy/com/android/build/gradle/internal/ApplicationTaskManager.java
e293f79e914ac74388108d2135ffeb418fbd3590
[ "Apache-2.0" ]
permissive
yanex/uast-lint-common
700fc4ca41a3ed7d76cb33cab280626a0c9d717b
34f5953acd5e8c0104bcc2548b2f2e3f5ab8c675
refs/heads/master
2021-01-20T18:08:31.404596
2016-06-08T19:58:58
2016-06-08T19:58:58
60,629,527
3
0
null
null
null
null
UTF-8
Java
false
false
14,615
java
/* * Copyright (C) 2015 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.build.gradle.internal; import com.android.annotations.NonNull; import com.android.annotations.Nullable; import com.android.build.api.transform.QualifiedContent.Scope; import com.android.build.gradle.AndroidConfig; import com.android.build.gradle.internal.incremental.InstantRunWrapperTask; import com.android.build.gradle.internal.incremental.InstantRunPatchingPolicy; import com.android.build.gradle.internal.pipeline.TransformManager; import com.android.build.gradle.internal.pipeline.TransformStream; import com.android.build.gradle.internal.scope.AndroidTask; import com.android.build.gradle.internal.scope.VariantScope; import com.android.build.gradle.internal.transforms.InstantRunSplitApkBuilder; import com.android.build.gradle.internal.variant.ApplicationVariantData; import com.android.build.gradle.internal.variant.BaseVariantData; import com.android.build.gradle.internal.variant.BaseVariantOutputData; import com.android.build.gradle.tasks.PackageApplication; import com.android.builder.core.AndroidBuilder; import com.android.builder.profile.ExecutionType; import com.android.builder.profile.Recorder; import com.android.builder.profile.ThreadRecorder; import org.gradle.api.Project; import org.gradle.api.artifacts.Configuration; import org.gradle.api.tasks.compile.JavaCompile; import org.gradle.tooling.provider.model.ToolingModelBuilderRegistry; import android.databinding.tool.DataBindingBuilder; import java.io.File; import java.util.List; import java.util.Set; /** * TaskManager for creating tasks in an Android application project. */ public class ApplicationTaskManager extends TaskManager { public ApplicationTaskManager( Project project, AndroidBuilder androidBuilder, DataBindingBuilder dataBindingBuilder, AndroidConfig extension, SdkHandler sdkHandler, DependencyManager dependencyManager, ToolingModelBuilderRegistry toolingRegistry) { super(project, androidBuilder, dataBindingBuilder, extension, sdkHandler,dependencyManager, toolingRegistry); } @Override public void createTasksForVariantData( @NonNull final TaskFactory tasks, @NonNull final BaseVariantData<? extends BaseVariantOutputData> variantData) { assert variantData instanceof ApplicationVariantData; final VariantScope variantScope = variantData.getScope(); createAnchorTasks(tasks, variantScope); createCheckManifestTask(tasks, variantScope); handleMicroApp(tasks, variantScope); // Create all current streams (dependencies mostly at this point) createDependencyStreams(variantScope); // Add a task to process the manifest(s) ThreadRecorder.get().record(ExecutionType.APP_TASK_MANAGER_CREATE_MERGE_MANIFEST_TASK, new Recorder.Block<Void>() { @Override public Void call() { createMergeAppManifestsTask(tasks, variantScope); return null; } }); // Add a task to create the res values ThreadRecorder.get().record(ExecutionType.APP_TASK_MANAGER_CREATE_GENERATE_RES_VALUES_TASK, new Recorder.Block<Void>() { @Override public Void call() { createGenerateResValuesTask(tasks, variantScope); return null; } }); // Add a task to compile renderscript files. ThreadRecorder.get().record(ExecutionType.APP_TASK_MANAGER_CREATE_CREATE_RENDERSCRIPT_TASK, new Recorder.Block<Void>() { @Override public Void call() { createRenderscriptTask(tasks, variantScope); return null; } }); // Add a task to merge the resource folders ThreadRecorder.get().record(ExecutionType.APP_TASK_MANAGER_CREATE_MERGE_RESOURCES_TASK, new Recorder.Block<Void>() { @Override public Void call() { createMergeResourcesTask(tasks, variantScope); return null; } }); // Add a task to merge the asset folders ThreadRecorder.get().record(ExecutionType.APP_TASK_MANAGER_CREATE_MERGE_ASSETS_TASK, new Recorder.Block<Void>() { @Override public Void call() { createMergeAssetsTask(tasks, variantScope); return null; } }); // Add a task to create the BuildConfig class ThreadRecorder.get().record(ExecutionType.APP_TASK_MANAGER_CREATE_BUILD_CONFIG_TASK, new Recorder.Block<Void>() { @Override public Void call() { createBuildConfigTask(tasks, variantScope); return null; } }); ThreadRecorder.get().record(ExecutionType.APP_TASK_MANAGER_CREATE_PROCESS_RES_TASK, new Recorder.Block<Void>() { @Override public Void call() { // Add a task to process the Android Resources and generate source files createApkProcessResTask(tasks, variantScope); // Add a task to process the java resources createProcessJavaResTasks(tasks, variantScope); return null; } }); ThreadRecorder.get().record(ExecutionType.APP_TASK_MANAGER_CREATE_AIDL_TASK, new Recorder.Block<Void>() { @Override public Void call() { createAidlTask(tasks, variantScope); return null; } }); // Add NDK tasks if (!isComponentModelPlugin) { ThreadRecorder.get().record(ExecutionType.APP_TASK_MANAGER_CREATE_NDK_TASK, new Recorder.Block<Void>() { @Override public Void call() { createNdkTasks(variantScope); return null; } }); } else { if (variantData.compileTask != null) { variantData.compileTask.dependsOn(getNdkBuildable(variantData)); } else { variantScope.getCompileTask().dependsOn(tasks, getNdkBuildable(variantData)); } } variantScope.setNdkBuildable(getNdkBuildable(variantData)); // Add a task to merge the jni libs folders ThreadRecorder.get().record(ExecutionType.APP_TASK_MANAGER_CREATE_MERGE_JNILIBS_FOLDERS_TASK, new Recorder.Block<Void>() { @Override public Void call() { createMergeJniLibFoldersTasks(tasks, variantScope); return null; } }); // Add a compile task ThreadRecorder.get().record(ExecutionType.APP_TASK_MANAGER_CREATE_COMPILE_TASK, new Recorder.Block<Void>() { @Override public Void call() { AndroidTask<? extends JavaCompile> javacTask = createJavacTask(tasks, variantScope); if (variantData.getVariantConfiguration().getUseJack()) { createJackTask(tasks, variantScope); } else { setJavaCompilerTask(javacTask, tasks, variantScope); createJarTasks(tasks, variantScope); createPostCompilationTasks(tasks, variantScope); } return null; } }); // Add data binding tasks if enabled if (extension.getDataBinding().isEnabled()) { createDataBindingTasks(tasks, variantScope); } if (variantData.getSplitHandlingPolicy().equals( BaseVariantData.SplitHandlingPolicy.RELEASE_21_AND_AFTER_POLICY)) { if (getExtension().getBuildToolsRevision().getMajor() < 21) { throw new RuntimeException("Pure splits can only be used with buildtools 21 and later"); } ThreadRecorder.get().record(ExecutionType.APP_TASK_MANAGER_CREATE_SPLIT_TASK, new Recorder.Block<Void>() { @Override public Void call() { createSplitTasks(tasks, variantScope); return null; } }); } ThreadRecorder.get().record(ExecutionType.APP_TASK_MANAGER_CREATE_PACKAGING_TASK, new Recorder.Block<Void>() { @Override public Void call() { @Nullable AndroidTask<InstantRunWrapperTask> fullBuildInfoGeneratorTask = createInstantRunPackagingTasks(tasks, variantScope); createPackagingTask(tasks, variantScope, true /*publishApk*/, fullBuildInfoGeneratorTask); return null; } }); // create the lint tasks. ThreadRecorder.get().record(ExecutionType.APP_TASK_MANAGER_CREATE_LINT_TASK, new Recorder.Block<Void>() { @Override public Void call() { createLintTasks(tasks, variantScope); return null; } }); } /** * Create tasks related to creating pure split APKs containing sharded dex files. */ @Nullable protected AndroidTask<InstantRunWrapperTask> createInstantRunPackagingTasks( @NonNull TaskFactory tasks, @NonNull VariantScope variantScope) { if (getIncrementalMode(variantScope.getVariantConfiguration()) == IncrementalMode.NONE) { return null; } // create a buildInfoGeneratorTask that will only be invoked if a assembleVARIANT is called. AndroidTask<InstantRunWrapperTask> fullBuildInfoGeneratorTask = getAndroidTasks() .create(tasks, new InstantRunWrapperTask.ConfigAction( variantScope, InstantRunWrapperTask.TaskType.FULL, getLogger())); InstantRunPatchingPolicy patchingPolicy = variantScope.getInstantRunBuildContext().getPatchingPolicy(); if (patchingPolicy == InstantRunPatchingPolicy.MULTI_APK) { AndroidTask<InstantRunSplitApkBuilder> splitApk = getAndroidTasks().create(tasks, new InstantRunSplitApkBuilder.ConfigAction( variantScope)); TransformManager transformManager = variantScope.getTransformManager(); for (TransformStream stream : transformManager.getStreams( PackageApplication.sDexFilter)) { // TODO Optimize to avoid creating too many actions splitApk.dependsOn(tasks, stream.getDependencies()); } variantScope.getVariantData().assembleVariantTask.dependsOn( splitApk.get(tasks)); // if the assembleVariant task run, make sure it also runs the task to generate // the build-info.xml. variantScope.getVariantData().assembleVariantTask.dependsOn( fullBuildInfoGeneratorTask.get(tasks)); // make sure the split APK task is run before we generate the build-info.xml variantScope.getInstantRunAnchorTask().dependsOn(tasks, splitApk); variantScope.getInstantRunIncrementalTask().dependsOn(tasks, splitApk); } return fullBuildInfoGeneratorTask; } @NonNull @Override protected Set<Scope> getResMergingScopes(@NonNull VariantScope variantScope) { return TransformManager.SCOPE_FULL_PROJECT; } /** * Configure variantData to generate embedded wear application. */ private void handleMicroApp( @NonNull TaskFactory tasks, @NonNull VariantScope scope) { BaseVariantData<? extends BaseVariantOutputData> variantData = scope.getVariantData(); if (variantData.getVariantConfiguration().getBuildType().isEmbedMicroApp()) { // get all possible configurations for the variant. We'll take the highest priority // of them that have a file. List<String> wearConfigNames = variantData.getWearConfigNames(); for (String configName : wearConfigNames) { Configuration config = project.getConfigurations().findByName( configName); // this shouldn't happen, but better safe. if (config == null) { continue; } Set<File> file = config.getFiles(); int count = file.size(); if (count == 1) { createGenerateMicroApkDataTask(tasks, scope, config); // found one, bail out. return; } else if (count > 1) { throw new RuntimeException(String.format( "Configuration '%s' resolves to more than one apk.", configName)); } } } } }
[ "yan.zhulanow@jetbrains.com" ]
yan.zhulanow@jetbrains.com
4b38ceabc6f977404148a669ddffcba1f98187b0
f34602b407107a11ce0f3e7438779a4aa0b1833e
/professor/dvl/roadnet-client/src/main/java/org/datacontract/schemas/_2004/_07/roadnet_apex_server_services_wcfshared_datacontracts/DataWarehouseTelematicsDeviceInputOutputAccessoryDimension.java
d924d61023a1d94da3ce604871ff8610c6f92988
[]
no_license
ggmoura/treinar_11836
a447887dc65c78d4bd87a70aab2ec9b72afd5d87
0a91f3539ccac703d9f59b3d6208bf31632ddf1c
refs/heads/master
2022-06-14T13:01:27.958568
2020-04-04T01:41:57
2020-04-04T01:41:57
237,103,996
0
2
null
2022-05-20T21:24:49
2020-01-29T23:36:21
Java
UTF-8
Java
false
false
3,214
java
package org.datacontract.schemas._2004._07.roadnet_apex_server_services_wcfshared_datacontracts; import javax.xml.bind.JAXBElement; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlType; import com.roadnet.apex.datacontracts.AggregateRootEntity; /** * <p>Classe Java de DataWarehouseTelematicsDeviceInputOutputAccessoryDimension complex type. * * <p>O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. * * <pre> * &lt;complexType name="DataWarehouseTelematicsDeviceInputOutputAccessoryDimension"&gt; * &lt;complexContent&gt; * &lt;extension base="{http://roadnet.com/apex/DataContracts/}AggregateRootEntity"&gt; * &lt;sequence&gt; * &lt;element name="Description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt; * &lt;element name="Identifier" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt; * &lt;/sequence&gt; * &lt;/extension&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "DataWarehouseTelematicsDeviceInputOutputAccessoryDimension", propOrder = { "description", "identifier" }) public class DataWarehouseTelematicsDeviceInputOutputAccessoryDimension extends AggregateRootEntity { @XmlElementRef(name = "Description", namespace = "http://schemas.datacontract.org/2004/07/Roadnet.Apex.Server.Services.WCFShared.DataContracts.DataWarehouse", type = JAXBElement.class, required = false) protected JAXBElement<String> description; @XmlElementRef(name = "Identifier", namespace = "http://schemas.datacontract.org/2004/07/Roadnet.Apex.Server.Services.WCFShared.DataContracts.DataWarehouse", type = JAXBElement.class, required = false) protected JAXBElement<String> identifier; /** * Obtém o valor da propriedade description. * * @return * possible object is * {@link JAXBElement }{@code <}{@link String }{@code >} * */ public JAXBElement<String> getDescription() { return description; } /** * Define o valor da propriedade description. * * @param value * allowed object is * {@link JAXBElement }{@code <}{@link String }{@code >} * */ public void setDescription(JAXBElement<String> value) { this.description = value; } /** * Obtém o valor da propriedade identifier. * * @return * possible object is * {@link JAXBElement }{@code <}{@link String }{@code >} * */ public JAXBElement<String> getIdentifier() { return identifier; } /** * Define o valor da propriedade identifier. * * @param value * allowed object is * {@link JAXBElement }{@code <}{@link String }{@code >} * */ public void setIdentifier(JAXBElement<String> value) { this.identifier = value; } }
[ "gleidson.gmoura@gmail.com" ]
gleidson.gmoura@gmail.com
b1558eb097b5e4fb695153a4660fc4b6a7b1f7ff
a6a646810614bb1b0663c91cd0c0d3f4dcd8ed68
/SpringBootH2/src/test/java/com/example/SpringBootH2ApplicationTests.java
185722ca45deb5aa6abae37a9a3e1b9757d2d563
[]
no_license
shobhanath/spring-boot
facd33e8d5b753a556702ac7f41f785d27168635
ebb5161f7e9204c670a5c78991c286899d051fe4
refs/heads/master
2021-01-24T08:09:26.433936
2016-10-06T08:45:03
2016-10-06T08:45:03
69,145,943
0
0
null
null
null
null
UTF-8
Java
false
false
507
java
package com.example; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.SpringApplicationConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = SpringBootH2Application.class) @WebAppConfiguration public class SpringBootH2ApplicationTests { @Test public void contextLoads() { } }
[ "shobhanath.sharma@hotmail.com" ]
shobhanath.sharma@hotmail.com
e00da0d51169983e60e021e3533918856d27f4a2
53ab284155da9b761eb820371b868ab16476dc77
/org.xtext.assignment1.einKauflist.ui/src-gen/org/xtext/assignment1/ui/contentassist/AbstractEinKauflistProposalProvider.java
72adfe9d4fbcfcb15c2806f7c4d51b8abfec9b88
[]
no_license
malbac/Xtend_Xtext
0328243d272501abf2f44c991fc4dc67b0ba56e3
7b9c8e1a34f94edfc73b0a516756fd3bacd11a64
refs/heads/master
2020-05-18T16:15:23.200933
2015-04-26T22:06:11
2015-04-26T22:06:11
34,631,645
0
0
null
null
null
null
UTF-8
Java
false
false
2,354
java
/* * generated by Xtext */ package org.xtext.assignment1.ui.contentassist; import org.eclipse.emf.ecore.EObject; import org.eclipse.xtext.*; import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor; import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext; /** * Represents a generated, default implementation of superclass {@link org.eclipse.xtext.common.ui.contentassist.TerminalsProposalProvider}. * Methods are dynamically dispatched on the first parameter, i.e., you can override them * with a more concrete subtype. */ @SuppressWarnings("all") public class AbstractEinKauflistProposalProvider extends org.eclipse.xtext.common.ui.contentassist.TerminalsProposalProvider { public void completeBuyticket_Category(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completeCategory_CategoryName(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completeCategory_Items(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completeItem_ItemName(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void completeItem_Price(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); } public void complete_Buyticket(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_Category(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } public void complete_Item(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // subclasses may override } }
[ "malobicky.m@gmail.com" ]
malobicky.m@gmail.com
7289b72e8c383eb7154242492311d1d61f8e0768
eaf6bff3d45c0cbb8e4060d62be076fd8b681d12
/src/com/oop/exception/exception01/ExceptionFigure.java
2e7bf3c88c148ae245e1cee1f3558a1e91c95d6f
[]
no_license
datianxia1/JavaCode
c646221db15e67125703fc451d22312787f09e02
4d9b4dd660a27d0ac7178fbb5f1c56b5cf365107
refs/heads/master
2023-08-22T23:10:45.876852
2021-10-02T15:01:40
2021-10-02T15:01:40
410,148,455
0
0
null
null
null
null
UTF-8
Java
false
false
144
java
package com.oop.exception.exception01; public class ExceptionFigure { public static void main(String[] args) { //Throwable } }
[ "1578732214@qq.com" ]
1578732214@qq.com
552bb7e6f6fa683273b60267c40f7cfaa5e9cdb1
c6aa94983f3c8f82954463af3972ae06b30396a7
/springcloud_alibaba2/spring-cloud-alibaba-fescar/src/main/java/org/springframework/cloud/alibaba/fescar/feign/FescarFeignBuilder.java
ff123a732c473ec89e109ff3c8ebd9ff9a975ff1
[ "Apache-2.0" ]
permissive
dobulekill/jun_springcloud
f01358caacb1b04f57908dccc6432d0a5e17745e
33248f65301741ed97a24b978a5c22d5d6c052fb
refs/heads/master
2023-01-24T13:24:59.282130
2020-11-25T17:30:47
2020-11-25T17:30:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
980
java
/* * Copyright (C) 2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.cloud.alibaba.fescar.feign; import org.springframework.beans.factory.BeanFactory; import feign.Feign; /** * @author Wujun */ final class FescarFeignBuilder { private FescarFeignBuilder() { } static Feign.Builder builder(BeanFactory beanFactory) { return Feign.builder().client(new FescarFeignClient(beanFactory)); } }
[ "wujun728@hotmail.com" ]
wujun728@hotmail.com
c70395882664571d789225b2c792f56a1f017bbc
e3a37aaf17ec41ddc7051f04b36672db62a7863d
/business-service/schedule-service-project/schedule-service/src/main/java/com/iot/schedule/job/AirSwitchEventJob.java
e4928e22bae9e571b5bb016f9190eca145bd5891
[]
no_license
github4n/cloud
68477a7ecf81d1526b1b08876ca12cfe575f7788
7974042dca1ee25b433177e2fe6bda1de28d909a
refs/heads/master
2020-04-18T02:04:33.509889
2019-01-13T02:19:32
2019-01-13T02:19:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,621
java
package com.iot.schedule.job; import com.alibaba.fastjson.JSON; import com.google.common.base.Strings; import com.iot.airswitch.api.AirSwitchStatisticsApi; import com.iot.common.helper.ApplicationContextHelper; import com.iot.schedule.common.ScheduleConstants; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import java.util.List; import java.util.Map; /** * @Author: Xieby * @Date: 2018/11/15 * @Description: * */ public class AirSwitchEventJob implements Job { @Override public void execute(JobExecutionContext context) throws JobExecutionException { System.out.println("========================= air switch event job start ======================"); try { Map<String, Object> data =(Map<String, Object>) context.getMergedJobDataMap().get(ScheduleConstants.JOB_DATA_KEY); String ids = data.get("tenantIds") == null ? null : data.get("tenantIds").toString(); if (Strings.isNullOrEmpty(ids)) { return; } List<Long> idList = JSON.parseArray(ids, Long.class); System.out.println("tenant ids = " + JSON.toJSONString(idList)); AirSwitchStatisticsApi statisticsApi = ApplicationContextHelper.getBean(AirSwitchStatisticsApi.class); for (Long tenantId : idList) { statisticsApi.countAirSwitchEvent(tenantId); } } catch (Exception e) { e.printStackTrace(); } System.out.println("========================= air switch event job end ======================"); } }
[ "qizhiyong@LDS-Z-C5497.LEEDARSON.LOCAL" ]
qizhiyong@LDS-Z-C5497.LEEDARSON.LOCAL
61a15ae30c1ddf6fde65c45024dfe1a1e1616d92
8c24918f8e0b0c8bb367785c95d911a55a9f0e78
/Factorial.java
e152a4eb6765ea8603343550782193840050bcc2
[]
no_license
nicole-mathias/java
51ee679cfbbf1a8c2edb45cd2be0c4679743d39d
9f394c5e1d2a4826ab9860fdc371a883f14ac2a9
refs/heads/master
2023-03-10T21:42:19.705860
2021-02-26T05:23:36
2021-02-26T05:23:36
294,592,821
1
0
null
null
null
null
UTF-8
Java
false
false
472
java
import java.util.*; public class Factorial { public static void main(String args[]){ int no; int factorial = 1; Scanner sc = new Scanner(System.in); System.out.println("Enter a number to find factorial"); no = sc.nextInt(); for(int i = 1; i <= no; i++){ factorial = factorial * i; } System.out.println("Factorial of " + no + " is " + factorial); } }
[ "nicolemathias0@gmail.com" ]
nicolemathias0@gmail.com
ea8b34234f3c711709111f95a2c1701c0eb23577
bce98e2e824d16625aa33557afb59eb856ef0204
/common/src/main/java/com/jme/common/ui/base/BaseFragment.java
852e2e201206e687c83fd1eb6cbfb965b9aad062
[]
no_license
JewelXuJun/LSGoldTrade
5eb3a12123f2aa0da1323b08d67c307909bc3188
ddbd740cb3eaad6f181f8d6887db677ef2f07821
refs/heads/master
2020-06-29T20:30:55.672293
2020-03-20T08:23:54
2020-03-20T08:23:54
200,611,216
0
0
null
null
null
null
UTF-8
Java
false
false
11,582
java
package com.jme.common.ui.base; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.Toast; import androidx.annotation.ColorInt; import androidx.annotation.DrawableRes; import androidx.annotation.MenuRes; import androidx.annotation.StyleRes; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.databinding.DataBindingUtil; import androidx.databinding.ViewDataBinding; import androidx.fragment.app.Fragment; import com.jme.common.network.API; import com.jme.common.network.AsynCommon; import com.jme.common.network.DTRequest; import com.jme.common.network.Head; import com.jme.common.network.OnResultListener; import com.jme.common.ui.view.LoadingDialog; import java.util.HashMap; /** * Fragment基类 * Created by XuJun on 2018/11/7. */ public abstract class BaseFragment<T> extends Fragment implements View.OnTouchListener, OnResultListener { protected Toast mToast; protected LoadingDialog mLoadingDialog; protected Context mContext; protected AppCompatActivity mActivity; protected ToolbarHelper mToolbarHelper; protected ViewDataBinding mBindingUtil; protected boolean mHide = true; protected boolean mUseBinding = true; protected boolean mVisible = false; protected T mBinding; private static final int MSG_ERROR_MSG_REPEAT = 1000; private String mPrevErrorCode = ""; private Handler mErrorHandler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case MSG_ERROR_MSG_REPEAT: mErrorHandler.removeMessages(MSG_ERROR_MSG_REPEAT); mPrevErrorCode = ""; break; } } }; @Override public void onAttach(Context context) { super.onAttach(context); mActivity = (AppCompatActivity) context; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContext = getContext(); } @Override public void setUserVisibleHint(boolean isVisibleToUser) { super.setUserVisibleHint(isVisibleToUser); mVisible = isVisibleToUser; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); int id = getContentViewId(); View view; if (mUseBinding) { mBindingUtil = DataBindingUtil.inflate(inflater, id, container, false); if (mBindingUtil == null) view = inflater.inflate(id, container, false); else view = mBindingUtil.getRoot(); } else { view = inflater.inflate(id, container, false); } return view; } @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); setHasOptionsMenu(true); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); initView(); initData(savedInstanceState); initListener(); } @Override public void onHiddenChanged(boolean hidden) { super.onHiddenChanged(hidden); mHide = hidden; } public void initToolbar(View view, boolean hasBack) { mToolbarHelper = new ToolbarHelper(mActivity, getView()); mToolbarHelper.initToolbar(view); setBackNavigation(hasBack); } public void initToolbar(String title, boolean hasBack) { mToolbarHelper = new ToolbarHelper(mActivity, getView()); mToolbarHelper.initToolbar(title); setBackNavigation(hasBack); } public void initToolbar(String title, boolean hasBack, @ColorInt int resId) { mToolbarHelper = new ToolbarHelper(mActivity, getView()); mToolbarHelper.initToolbar(title, resId); setBackNavigation(hasBack); } public void initToolbar(int resId, boolean hasBack) { initToolbar(getString(resId), hasBack); } public void initToolbar(int resId, boolean hasBack, @ColorInt int colorResID) { initToolbar(getString(resId), hasBack, colorResID); } public void setTitle(int resId) { if (resId != 0) setTitle(getString(resId)); } public void setTitle(String title) { if (mToolbarHelper != null) mToolbarHelper.setTitle(title); } public void setBackNavigation(boolean hasBack) { if (mToolbarHelper != null) mToolbarHelper.setBackNavigation(hasBack, (view) -> mActivity.onBackPressed()); } public void setRightNavigation(String str, @DrawableRes int resId, ToolbarHelper.OnSingleMenuItemClickListener listener) { if (mToolbarHelper != null) mToolbarHelper.setSingleMenu(str, resId, listener); } public void setRightNavigation(String str, @DrawableRes int resId, @StyleRes int _resId, ToolbarHelper.OnSingleMenuItemClickListener listener) { if (mToolbarHelper != null) mToolbarHelper.setSingleMenu(str, resId, _resId, listener); } public void setRightMultiNavigation(@MenuRes int resId, final Toolbar.OnMenuItemClickListener listener) { if (mToolbarHelper != null) mToolbarHelper.setMenu(resId, listener); } public void setRightMultiNavigation(@MenuRes int resId, @StyleRes int _resId, final Toolbar.OnMenuItemClickListener listener) { if (mToolbarHelper != null) mToolbarHelper.setMenu(resId, _resId, listener); } public void clearRightNavigation() { if (mToolbarHelper != null) mToolbarHelper.clearMenu(); } protected void showShortToast(final int resId) { mActivity.runOnUiThread(new Runnable() { @Override public void run() { if (mToast == null) mToast = Toast.makeText(mActivity, getResources().getString(resId), Toast.LENGTH_SHORT); else mToast.setText(resId); mToast.show(); } }); } protected void showShortToast(final String text) { if (!TextUtils.isEmpty(text)) { mActivity.runOnUiThread(new Runnable() { @Override public void run() { if (mToast == null) mToast = Toast.makeText(mActivity, text, Toast.LENGTH_SHORT); else mToast.setText(text); mToast.show(); } }); } } protected void showLongToast(final int resId) { mActivity.runOnUiThread(new Runnable() { @Override public void run() { if (mToast == null) mToast = Toast.makeText(mActivity, getResources().getString(resId), Toast.LENGTH_SHORT); else mToast.setText(resId); mToast.show(); } }); } protected void showLongToast(final String text) { if (!TextUtils.isEmpty(text)) { mActivity.runOnUiThread(new Runnable() { @Override public void run() { if (mToast == null) mToast = Toast.makeText(mActivity, text, Toast.LENGTH_SHORT); else mToast.setText(text); mToast.show(); } }); } } protected void startAnimActivity(Class<?> cls) { this.startAnimActivity(cls, null); } protected void startAnimActivity(Class<?> cls, Bundle bundle) { Intent intent = new Intent(); intent.setClass(mActivity, cls); if (bundle != null) intent.putExtras(bundle); startActivity(intent); } protected void startAnimActivityForResult(Class<?> cls, int requestCode) { this.startAnimActivityForResult(cls, null, requestCode); } protected void startAnimActivityForResult(Class<?> cls, Bundle bundle, int requestCode) { Intent intent = new Intent(); intent.setClass(mActivity, cls); if (bundle != null) intent.putExtras(bundle); startActivityForResult(intent, requestCode); } protected void showLoadingDialog(String text) { if (mLoadingDialog == null) mLoadingDialog = new LoadingDialog(mActivity); mLoadingDialog.setLoadingText(text); if (!mActivity.isFinishing() && !mLoadingDialog.isShowing()) mLoadingDialog.show(); } protected void dismissLoadingDialog() { if (mLoadingDialog != null && mLoadingDialog.isShowing()) mLoadingDialog.dismiss(); } protected AsynCommon sendRequest(API api, HashMap<String, String> params, boolean showprogressDialog, boolean showErrorMsgOneTime, boolean showErrorMsg) { if (showprogressDialog) showLoadingDialog(""); AsynCommon task = AsynCommon.SendRequest(api, params, showErrorMsgOneTime, showErrorMsg, this, mContext); return task; } protected AsynCommon sendRequest(API api, HashMap<String, String> params, boolean showprogressDialog, boolean showErrorMsgOneTime) { return sendRequest(api, params, showprogressDialog, showErrorMsgOneTime, true); } protected AsynCommon sendRequest(API api, HashMap<String, String> params, boolean showprogressDialog) { return sendRequest(api, params, showprogressDialog, false, true); } @Override public void OnResult(DTRequest request, Head head, Object response) { dismissLoadingDialog(); // handleErrorInfo(request, head); DataReturn(request, head, response); } protected void DataReturn(DTRequest request, Head head, Object response) { } public void handleErrorInfo(DTRequest request, Head head) { if (head.getCode() != null && !head.getCode().equals("0")) { if (!request.isShowErrorMsg()) { return; } if (request.isSilent()) { if (!head.getCode().equals(mPrevErrorCode)) { mPrevErrorCode = head.getCode(); mErrorHandler.removeMessages(MSG_ERROR_MSG_REPEAT); mErrorHandler.sendEmptyMessageDelayed(MSG_ERROR_MSG_REPEAT, 120 * 1000); showShortToast(head.getMsg()); } } else { showShortToast(head.getMsg()); } } } protected abstract int getContentViewId(); protected void initView() { } protected void initData(Bundle savedInstanceState) { } protected void initListener() { } protected View findViewById(int resId) { return getView().findViewById(resId); } @Override public boolean onTouch(View v, MotionEvent event) { // 拦截触摸事件,防止传递到下一层的View return true; } @Override public void onDestroyView() { super.onDestroyView(); } }
[ "xujun@rfinex.com" ]
xujun@rfinex.com
daefea837e34876cecad7b9fe36146f837d2936b
bc6dee1f15332a65f564264b0c81226263ffd82d
/app/src/main/java/com/takenote/tomenota/model/enums/Prioridade.java
84afa932fa42a4d67cd093209a7d4f35dc3ab174
[]
no_license
FerreirinhaJean/tome-nota
4319c0066ec164b6b0a9f37a585f83d76b43a22f
8d8e982845e4330cdc8315312f981465505e6ed1
refs/heads/master
2022-11-11T14:18:17.186676
2020-07-03T19:45:13
2020-07-03T19:45:13
264,242,118
0
0
null
null
null
null
UTF-8
Java
false
false
103
java
package com.takenote.tomenota.model.enums; public enum Prioridade { ALTA, MEDIA, BAIXA; }
[ "jeangabrielferreira1@gmail.com" ]
jeangabrielferreira1@gmail.com
fc85993b76431a12026a2394a196f0143ba8c030
5b3ccd03986b0c2c9e2426e31326e154a4aa1711
/Doorbell/app/src/main/gen/com/solutions/nimbus/doorbell/BuildConfig.java
14e62edb0f3af6dceb249d60762fde67d5570dbc
[]
no_license
hacktm/Hardware-Nimbus-solutions
8eb6d9aaa68a08e04c6323342f3ad9b78f9d7d6e
a00d4675d1fd323be103ddbb90943895564ce0c8
refs/heads/master
2016-09-05T11:45:23.852641
2015-02-09T20:19:22
2015-02-09T20:19:22
25,373,572
0
1
null
null
null
null
UTF-8
Java
false
false
271
java
/*___Generated_by_IDEA___*/ package com.solutions.nimbus.doorbell; /* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */ public final class BuildConfig { public final static boolean DEBUG = Boolean.parseBoolean(null); }
[ "alexandra_br@ymail.com" ]
alexandra_br@ymail.com
243e90b7613fa258cacd9aa72085d8933a9a15e4
6d4245b56d4448c6dbbbb167c0782715a50104d7
/tika-server/src/main/java/org/apache/tika/server/TikaServerParseExceptionMapper.java
fe1d12ca046ffa4ae4218795ea41480646f27ef2
[ "LGPL-2.1-or-later", "CDDL-1.0", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-unknown", "ICU", "LicenseRef-scancode-iptc-2006", "LicenseRef-scancode-unrar", "LicenseRef-scancode-bsd-simplified-darwin", "NetCDF", "LicenseRef-scancode-public-domain" ]
permissive
HyperDunk/DR-TIKA
8b9e844440c7d867fc61fa4f1b9d36b06f29faf5
1a0c455e9035632709f53bff76db03fc132ac694
refs/heads/trunk
2020-03-29T23:01:58.931883
2015-04-29T04:58:18
2015-04-29T04:58:18
33,805,537
1
1
Apache-2.0
2020-02-11T05:32:06
2015-04-12T06:11:04
Java
UTF-8
Java
false
false
3,666
java
package org.apache.tika.server; /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; import javax.ws.rs.ext.ExceptionMapper; import javax.ws.rs.ext.Provider; import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; import java.io.Writer; import org.apache.poi.hwpf.OldWordFileFormatException; import org.apache.tika.exception.EncryptedDocumentException; import org.apache.tika.exception.TikaException; @Provider public class TikaServerParseExceptionMapper implements ExceptionMapper<TikaServerParseException> { private final boolean returnStack; public TikaServerParseExceptionMapper(boolean returnStack) { this.returnStack = returnStack; } public Response toResponse(TikaServerParseException e) { if (e.getMessage() != null && e.getMessage().equals(Response.Status.UNSUPPORTED_MEDIA_TYPE.toString())) { return buildResponse(e, 415); } Throwable cause = e.getCause(); if (cause == null) { return buildResponse(e, Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); } else { if (cause instanceof EncryptedDocumentException) { return buildResponse(cause, 422); } else if (cause instanceof TikaException) { //unsupported media type Throwable causeOfCause = cause.getCause(); if (causeOfCause instanceof WebApplicationException) { return ((WebApplicationException) causeOfCause).getResponse(); } return buildResponse(cause, 422); } else if (cause instanceof IllegalStateException) { return buildResponse(cause, 422); } else if (cause instanceof OldWordFileFormatException) { return buildResponse(cause, 422); } else if (cause instanceof WebApplicationException) { return ((WebApplicationException) e.getCause()).getResponse(); } else { return buildResponse(e, 500); } } } private Response buildResponse(Throwable cause, int i) { if (returnStack && cause != null) { Writer result = new StringWriter(); PrintWriter writer = new PrintWriter(result); cause.printStackTrace(writer); writer.flush(); try { result.flush(); } catch (IOException e) { //something went seriously wrong return Response.status(500).build(); } return Response.status(i).entity(result.toString()).type("text/plain").build(); } else { return Response.status(i).build(); } } }
[ "tallison@apache.org" ]
tallison@apache.org
73a42037e72c06c8974dca649bff87dfb1cea229
e336473ecdc8043480de6c5235bbab86dac588d0
/Mms/src/com/android/mms/ui/AdvancedCheckBoxPreference.java
2569bd3a84536f2fd481049a491985aa9b5556af
[ "Apache-2.0" ]
permissive
wangyx0055/AZ8188-LOW13
509c96bf75b170be4d97c262be5c15286d77018a
7f430136afbd4c91af57dde3e43fb90a4ccaf9e1
refs/heads/master
2023-08-30T21:37:31.239462
2012-11-19T09:04:21
2012-11-19T09:04:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,349
java
/* Copyright Statement: * * This software/firmware and related documentation ("MediaTek Software") are * protected under relevant copyright laws. The information contained herein * is confidential and proprietary to MediaTek Inc. and/or its licensors. * Without the prior written permission of MediaTek inc. and/or its licensors, * any reproduction, modification, use or disclosure of MediaTek Software, * and information contained herein, in whole or in part, shall be strictly prohibited. * * MediaTek Inc. (C) 2010. All rights reserved. * * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. * * The following software/firmware and/or related documentation ("MediaTek Software") * have been modified by MediaTek Inc. All revisions are subject to any receiver's * applicable license agreements with MediaTek Inc. */ package com.android.mms.ui; import com.android.mms.R; import android.R.color; import android.content.Context; import android.content.res.TypedArray; import android.preference.CheckBoxPreference; import android.util.AttributeSet; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.android.internal.telephony.PhoneFactory; import com.android.internal.telephony.gemini.GeminiPhone; import com.android.internal.telephony.Phone; import android.provider.Telephony; import android.os.SystemProperties; public class AdvancedCheckBoxPreference extends CheckBoxPreference{ public interface GetSimInfo { CharSequence getSimNumber(int i); CharSequence getSimName(int i); int getSimColor(int i); int getNumberFormat(int i); int getSimStatus(int i); boolean is3G(int i); } private static int currentId = 0; // for object reference count; private static int maxCount = 0; private static final String TAG = "AdvancedCheckBoxPreference"; private static TextView simName[]; private static TextView simNumber[]; private static TextView simNumberShort[]; private static TextView sim3G[]; private static ImageView simStatus[]; private static ImageView simColor[]; static GetSimInfo simInfo; public static void init(Context context, int count) { simInfo = (GetSimInfo) context; maxCount = count; } //private final GetSimInfo simInfo = ; public AdvancedCheckBoxPreference(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); TypedArray a = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.CheckBoxPreference, defStyle, 0); a.recycle(); } public AdvancedCheckBoxPreference(Context context, AttributeSet attrs) { this(context, attrs, com.android.internal.R.attr.checkBoxPreferenceStyle); } public AdvancedCheckBoxPreference(Context context) { this(context, null); } @Override protected View onCreateView(ViewGroup parent) { final LayoutInflater layoutInflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View layout = layoutInflater.inflate(R.layout.advanced_checkbox_preference, parent, false); simName = new TextView[maxCount]; simNumber = new TextView[maxCount]; simNumberShort = new TextView[maxCount]; simStatus = new ImageView[maxCount]; simColor = new ImageView[maxCount]; sim3G = new TextView[maxCount]; if (currentId < maxCount) { currentId++; } else { //reset to 1 currentId = 1; } return layout; } @Override //called when we're binding the view to the preference. protected void onBindView(View view) { super.onBindView(view); simName[currentId-1] = (TextView) view.findViewById(R.id.simName); simNumber[currentId-1] = (TextView) view.findViewById(R.id.simNumber); simNumberShort[currentId-1] = (TextView) view.findViewById(R.id.simNumberShort); simStatus[currentId-1] = (ImageView) view.findViewById(R.id.simStatus); simColor[currentId-1] = (ImageView) view.findViewById(R.id.simIcon); sim3G[currentId-1] = (TextView) view.findViewById(R.id.sim3g); // here need change to common usage simName[currentId-1].setText(simInfo.getSimName(currentId-1)); simNumber[currentId-1].setText(simInfo.getSimNumber(currentId-1)); String numShow = (String) simInfo.getSimNumber(currentId-1); if (simInfo.getNumberFormat(currentId-1) == android.provider.Telephony.SimInfo.DISPLAY_NUMBER_FIRST) { if (numShow != null && numShow.length()>4) { simNumberShort[currentId-1].setText(numShow.substring(0, 4)); } else { simNumberShort[currentId-1].setText(numShow); } } else if (simInfo.getNumberFormat(currentId-1) == android.provider.Telephony.SimInfo.DISPLAY_NUMBER_LAST) { if (numShow != null && numShow.length()>4) { simNumberShort[currentId-1].setText(numShow.substring(numShow.length() - 4)); } else { simNumberShort[currentId-1].setText(numShow); } } else { simNumberShort[currentId-1].setText(""); } int simStatusResourceId = MessageUtils.getSimStatusResource(simInfo.getSimStatus(currentId-1)); if (-1 != simStatusResourceId) { simStatus[currentId-1].setImageResource(simStatusResourceId); } simColor[currentId-1].setBackgroundResource(simInfo.getSimColor(currentId-1)); // show the first 3G slot if (simInfo.is3G(currentId-1)) { String optr = SystemProperties.get("ro.operator.optr"); if (optr.equals("OP02")) { sim3G[currentId-1].setVisibility(View.VISIBLE); } else { sim3G[currentId-1].setVisibility(View.GONE); } } } }
[ "powerbush@gmail.com" ]
powerbush@gmail.com
603d90722f314c9f06bdbcf73b5725c0e65b314a
a4424fdc2a740e47d72f39ec1f6ebdb7b564f274
/src/main/java/com/parallelstack/ProgressRequestBody.java
04130c9e32c1e47bdcc86a2aad631d9a0dc9d534
[]
no_license
ParallelStack/rsearch-sdk-java
62460f100ee74e81f5a0741b73055846dc3d9f74
ea2464fbca73b32ec55f8dd99cf708afb634c2c1
refs/heads/master
2021-09-09T01:57:20.224090
2018-03-13T08:19:04
2018-03-13T08:19:04
110,425,362
0
0
null
null
null
null
UTF-8
Java
false
false
2,119
java
/* * ParallelStack RSearch API * REST API Specification for ParallelStack RSearch API * * OpenAPI spec version: 1.3.0 * Contact: team@parallelstack.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ package com.parallelstack; import com.squareup.okhttp.MediaType; import com.squareup.okhttp.RequestBody; import java.io.IOException; import okio.Buffer; import okio.BufferedSink; import okio.ForwardingSink; import okio.Okio; import okio.Sink; public class ProgressRequestBody extends RequestBody { public interface ProgressRequestListener { void onRequestProgress(long bytesWritten, long contentLength, boolean done); } private final RequestBody requestBody; private final ProgressRequestListener progressListener; public ProgressRequestBody(RequestBody requestBody, ProgressRequestListener progressListener) { this.requestBody = requestBody; this.progressListener = progressListener; } @Override public MediaType contentType() { return requestBody.contentType(); } @Override public long contentLength() throws IOException { return requestBody.contentLength(); } @Override public void writeTo(BufferedSink sink) throws IOException { BufferedSink bufferedSink = Okio.buffer(sink(sink)); requestBody.writeTo(bufferedSink); bufferedSink.flush(); } private Sink sink(Sink sink) { return new ForwardingSink(sink) { long bytesWritten = 0L; long contentLength = 0L; @Override public void write(Buffer source, long byteCount) throws IOException { super.write(source, byteCount); if (contentLength == 0) { contentLength = contentLength(); } bytesWritten += byteCount; progressListener.onRequestProgress(bytesWritten, contentLength, bytesWritten == contentLength); } }; } }
[ "6973916+bansriyar@users.noreply.github.com" ]
6973916+bansriyar@users.noreply.github.com
5a5ae33fc9939aab022ff27d3d2cd58ebad8f600
e686b5880a22d643a31d99592ef2f335572ab59b
/src/main/java/dev/miku/r2dbc/mysql/codec/AbstractParameter.java
fdbad81e2c11c6fcb2c3dde0d22bc09436211ed4
[ "Apache-2.0" ]
permissive
wuwen8729/r2dbc-mysql
d366256e07389705680c90d7b51819e976c256dd
7cf499fdba3c402a4423f3a959b3088bd390d1e1
refs/heads/main
2023-02-03T08:43:15.823470
2020-12-20T19:06:10
2020-12-21T16:19:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
988
java
/* * Copyright 2018-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * 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 dev.miku.r2dbc.mysql.codec; import dev.miku.r2dbc.mysql.Parameter; /** * Base class considers non null values for {@link Parameter} implementations. */ abstract class AbstractParameter implements Parameter { @Override public final String toString() { // Hide parameter detail even its type. return "Parameter{REDACTED}"; } }
[ "mirromutth@gmail.com" ]
mirromutth@gmail.com
8cb008fae037eaf3dc86602491675440c45e61d5
c1f203622573c43623cff40f298e6015d204c4cc
/parsermaker/src/au/com/illyrian/bnf/ast/BnfTreeCodeVisitor.java
c1dd3e5768065d940d66d5cbd345452d79c87702
[]
no_license
illyrian-com-au/CompilerMaker
15daf46c96d2049f91fdbe0b6e604f13783245dd
0978c2bce2394fb5c81683e20c34a81d3b4139e6
refs/heads/master
2021-06-05T01:19:09.743623
2019-10-01T21:40:28
2019-10-01T21:40:28
26,747,447
1
0
null
2020-10-13T11:56:12
2014-11-17T08:34:20
Java
UTF-8
Java
false
false
694
java
package au.com.illyrian.bnf.ast; public class BnfTreeCodeVisitor { public BnfTreeCodeVisitor() { } public void resolveRule(BnfTreeRule rule) { } public void resolveRule(BnfTreeList list) { } public void resolveRule(BnfTreeSequence seq) { } public void resolveRule(BnfTreeAlternative alt) { } public void resolveRule(BnfTreeName name) { } public void resolveRule(BnfTreeMethodCall call) { } public void resolveRule(BnfTreeReserved reserved) { } public void resolveRule(BnfTreeEmpty astParserEmpty) { } public void resolveRule(BnfTreeAction astParserExpr) { } }
[ "donald.s.strong@gmail.com" ]
donald.s.strong@gmail.com
9516ae57692543da86a5257ba12b8b036fd64642
7fbec00f474c2d205c7d041bbc6321d32b39ae69
/Toy Language Interpretor/app/model/expresion/ArithmeticExpression.java
1fb4c9e8948dedd70192ddadb025f756c28fc0f5
[]
no_license
filip-x/Personal-projects
d156cfaf9b5faa6112b29a0f5a17a235fb528cb5
b8a351c85e85c81dbeca8cc2640715b28bb1c78e
refs/heads/master
2023-01-19T07:47:29.389312
2020-12-04T08:06:20
2020-12-04T08:06:20
314,050,477
0
0
null
null
null
null
UTF-8
Java
false
false
2,735
java
package app.model.expresion; import app.exception.MyInterpreterException; import app.model.dictionary.InterfaceMyDictionary; import app.model.dictionary.InterfaceMyHeap; import app.model.type.IntType; import app.model.value.IntValue; import app.model.value.InterfaceValue; // computes the value of an expression public class ArithmeticExpression implements InterfaceExpression { InterfaceExpression expression1; InterfaceExpression expression2; int operand;//1-plus,2-minus,3-star,4-divide public ArithmeticExpression(InterfaceExpression expression1,InterfaceExpression expression2,int operand){ this.expression1 = expression1; this.expression2 = expression2; this.operand = operand; } public InterfaceValue evaluate(InterfaceMyDictionary<String, InterfaceValue> variableDictionary, InterfaceMyHeap<Integer,InterfaceValue> variableHeap) throws MyInterpreterException {// exception InterfaceValue value1,value2; value1=expression1.evaluate(variableDictionary,variableHeap);//we make sure that we can convert into int if(value1.getType().equals(new IntType())) { value2 = expression2.evaluate(variableDictionary,variableHeap);// we make sure that we can convert into int if(value2.getType().equals(new IntType())) { IntValue i1 = (IntValue)value1; IntValue i2 = (IntValue)value2; int number1,number2; number1 = i1.getValue(); number2 = i2.getValue(); if(operand == 1) return new IntValue(number1+number2); if(operand == 2) return new IntValue(number1-number2); if(operand == 3) return new IntValue(number1*number2); if(operand == 4) if(number2 == 0) throw new MyInterpreterException("division by zero"); else return new IntValue(number1/number2); }else throw new MyInterpreterException("second operand is not a integer"); }else throw new MyInterpreterException("first operand is not an integer"); return null; } public String toString() { switch (this.operand) { case 1: return this.expression1 + " + " + this.expression2; case 2: return this.expression1 + " - " + this.expression2; case 3: return this.expression1 + " * " + this.expression2; case 4: return this.expression1 + " / " + this.expression2; } return ""; } }
[ "cfie2693@scs.ubbcluj.ro" ]
cfie2693@scs.ubbcluj.ro
83a7d1f51e27ae77db95d5703fb6cce12e2e619d
4010ecbd720547df60f74c0ab93485b5028ffec8
/src/main/java/com/virtusa/covid/controller/patient/logoutController.java
0e23097eaafe4f58fd9e85a2a874b2cda6f61a1f
[]
no_license
vardhanreddy27/covid19
a887daa9034708ac49bdd9d5d04e89d205b60317
68effceef758347c904c8472578283d43b01362c
refs/heads/master
2022-12-08T05:44:56.433263
2020-08-31T09:52:30
2020-08-31T09:52:30
290,440,549
0
0
null
null
null
null
UTF-8
Java
false
false
566
java
package com.virtusa.covid.controller.patient; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; @Controller @RequestMapping(value = { "/user" }) public class logoutController { // User DashBoard Instailization @RequestMapping(value = "/logout", method = RequestMethod.GET) public ModelAndView indexPage(ModelAndView model) { model.setViewName("logout"); return model; } }
[ "ishnuavardhan@gmail.com" ]
ishnuavardhan@gmail.com
2d729ec8e5df18a83e1bb3e3054957724ad37c4d
afd3a2aff126c345536d1b9ff1c2e19aa8aed139
/source/branches/prototype-v2/at.rc.tacos.client.ui/src/at/rc/tacos/client/ui/controller/EmptyTransportAction.java
a24aa5f15f19a562c192de0e3fe81e6c2e1af76c
[]
no_license
mheiss/rc-tacos
5705e6e8aabe0b98b2626af0a6a9598dd5a7a41d
df7e1dbef5287d46ee2fc9c3f76f0f7f0ffeb08b
refs/heads/master
2021-01-09T05:27:45.141578
2017-02-02T22:15:58
2017-02-02T22:15:58
80,772,164
0
0
null
null
null
null
ISO-8859-1
Java
false
false
3,076
java
package at.rc.tacos.client.ui.controller; import org.eclipse.jface.action.Action; import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.window.Window; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.PlatformUI; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.rc.tacos.client.net.NetWrapper; import at.rc.tacos.platform.iface.IProgramStatus; import at.rc.tacos.platform.iface.ITransportStatus; import at.rc.tacos.platform.model.Transport; import at.rc.tacos.platform.net.message.UpdateMessage; /** * Assigns the transport as an empty transport * * @author b.thek */ public class EmptyTransportAction extends Action implements ITransportStatus, IProgramStatus { private Logger log = LoggerFactory.getLogger(EmptyTransportAction.class); private TableViewer viewer; /** * Default class constructor. * * @param viewer * the table viewer */ public EmptyTransportAction(TableViewer viewer) { this.viewer = viewer; setText("Leerfahrt"); setToolTipText("Macht aus dem Transport eine Leerfahrt"); } @Override public void run() { // get the selected transport ISelection selection = viewer.getSelection(); Transport transport = (Transport) ((IStructuredSelection) selection).getFirstElement(); // check if the object is currently locked if (transport.isLocked()) { boolean forceEdit = MessageDialog.openQuestion(Display.getCurrent().getActiveShell(), "Information: Eintrag wird bearbeitet", "Der Transport,den Sie bearbeiten möchten wird bereits von " + transport.getLockedBy() + " bearbeitet.\n" + "Ein gleichzeitiges Bearbeiten kann zu unerwarteten Fehlern führen!\n\n" + "Es wird dringend empfohlen, den Transport erst nach Freigabe durch " + transport.getLockedBy() + " als Leerfahrt zu kennzeichnen!\n\n" + "Möchten Sie das Fahrzeug trotzdem bearbeiten?"); if (!forceEdit) return; // log the override of the lock String username = NetWrapper.getSession().getUsername(); log.warn("Der Eintrag " + transport + " wird trotz Sperrung durch " + transport.getLockedBy() + " von " + username + " bearbeitet"); } // confirm the cancel InputDialog dlg = new InputDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Leerfahrt", "Bitte geben Sie Informationen zur Leerfahrt ein", null, null); if (dlg.open() == Window.OK) { transport.setNotes(transport.getNotes() + " Leerfahrtinformation: " + dlg.getValue()); transport.setProgramStatus(PROGRAM_STATUS_JOURNAL); // remove the lock transport.setLocked(false); transport.setLockedBy(null); // send the update UpdateMessage<Transport> updateMessage = new UpdateMessage<Transport>(transport); updateMessage.asnchronRequest(NetWrapper.getSession()); } } }
[ "michael.heiss@outlook.at" ]
michael.heiss@outlook.at
8221b3dfd4a38b3cf6e684515e72d7c7f1887a29
7dbb1110d16bcec127fe7261f70158c6f2844761
/1.7.10/src/main/java/com/mod/tuto/items/ItemPickaxeTuto.java
eb1e7ba99b0b8ca6abba768c8e20bc2a48b33265
[]
no_license
AlexandreRosset/Money-Mod
209565e466b40fe795e84b9fbabbdc45d8f1d9e7
57878796fa5a4a045075461c7943ebb9db60f88f
refs/heads/master
2020-06-16T22:06:16.172466
2016-11-29T09:42:57
2016-11-29T09:42:57
75,063,391
0
0
null
null
null
null
UTF-8
Java
false
false
217
java
package com.mod.tuto.items; import net.minecraft.item.ItemPickaxe; public class ItemPickaxeTuto extends ItemPickaxe { public ItemPickaxeTuto(ToolMaterial p_i45347_1_) { super(p_i45347_1_); } }
[ "alex.gamegame@laposte.net" ]
alex.gamegame@laposte.net
5e5f07414c5ba2ca23dcf730924666aa6da2ecc6
849dc91b752d44ec28df204297b7c780fe817165
/Customer-Order-81/src/main/java/org/yuanqi/customerorder81/config/Myconfig.java
311445171dd6ab8ffd8d3cbeb589987dc06282c4
[]
no_license
illfg/SpringCloud
b699c9f8f444d9cc77fddc4e5f6999dbd70971ed
72f77960f18819bf2886669c9d8506b850e3eac6
refs/heads/master
2022-07-16T14:41:11.355617
2020-03-29T08:26:32
2020-03-29T08:26:32
247,421,068
1
0
null
2022-06-21T02:59:30
2020-03-15T07:30:14
Java
UTF-8
Java
false
false
421
java
package org.yuanqi.customerorder81.config; import org.springframework.cloud.client.loadbalancer.LoadBalanced; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.client.RestTemplate; @Configuration public class Myconfig { @Bean @LoadBalanced RestTemplate restTemplate(){ return new RestTemplate(); } }
[ "1667248505@qq.com" ]
1667248505@qq.com
f91380cb0bec999e58cd56f8e1904404077775ec
19e9361976368688359dfb3815b0f336439be48c
/src/domain/ElevatorState.java
edaf306191ed0e3c6c885f5b84ad6c8e017beafe
[]
no_license
dk16z/Elelator
a9dbb2eedb52f2a9e28b610668614cc571302dbf
73e664b462dbcc5fe95deaa6397fea49bd86b2f3
refs/heads/master
2021-07-03T23:19:34.859923
2017-09-26T17:14:49
2017-09-26T17:14:49
104,915,180
0
0
null
null
null
null
UTF-8
Java
false
false
64
java
package domain; public enum ElevatorState { UP,DOWN,CLOSE }
[ "13122321216@163.com" ]
13122321216@163.com
6d625dcb643ba920270a68af2152a53bfdd4204c
ef276ffe0631e5ff665e1e350aa6c2cead7f2cd4
/comake/src/main/java/com/lambdaschool/comake/services/IssueServiceImpl.java
a48bedfc965827b2804d277e1cf16c8e65a7ea89
[ "MIT" ]
permissive
comake-bw/backend-java
9d6fdd2aada01bc68c47fb51c858ec22a3703f2a
05d723a2e608a1d627c34312bdd98091adb2a9f8
refs/heads/main
2023-02-11T08:26:19.304687
2021-01-07T15:45:32
2021-01-07T15:45:32
326,301,952
0
0
MIT
2021-01-07T15:45:33
2021-01-03T01:05:41
Java
UTF-8
Java
false
false
4,382
java
package com.lambdaschool.comake.services; import com.lambdaschool.comake.exceptions.ResourceNotFoundException; import com.lambdaschool.comake.models.Issue; import com.lambdaschool.comake.models.Location; import com.lambdaschool.comake.models.Role; import com.lambdaschool.comake.models.UserRoles; import com.lambdaschool.comake.repository.IssueRepository; import com.lambdaschool.comake.repository.LocationRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.transaction.Transactional; import java.util.ArrayList; import java.util.List; @Transactional @Service(value = "issueService") public class IssueServiceImpl implements IssueService { @Autowired private IssueRepository issuerepos; @Autowired private IssueService issueService; @Override public List<Issue> findAll() { List<Issue> list = new ArrayList<>(); /* * findAll returns an iterator set. * iterate over the iterator set and add each element to an array list. */ issuerepos.findAll() .iterator() .forEachRemaining(list::add); return list; } @Override public Issue findIssueById(long id) { return issuerepos.findById(id) .orElseThrow(() -> new ResourceNotFoundException("Issue id " + id + " not found!")); } @Override public void delete(long id) { issuerepos.findById(id) .orElseThrow(() -> new ResourceNotFoundException("Product id " + id + " not found!")); issuerepos.deleteById(id); } @Transactional @Override public Issue update(Issue issue, long id) { Issue currentIssue = issuerepos.findById(id) .orElseThrow(() -> new ResourceNotFoundException("Issue id " + id + " not found!")); if (issue.getDescription() != null) { currentIssue.setDescription(issue.getDescription()); } if (issue.getImageurl() != null) { currentIssue.setImageurl(issue.getImageurl()); } return issuerepos.save(currentIssue); // if (issue.getUser().getUsername() != null) { // currentIssue.getUser().setUsername(issue.getUser().getUsername()); // } // if (issue.getUser().getLocation().getZipcode() != 0) { // currentIssue.getLocation().setZipcode(issue.getLocation() // .getZipcode()); // } @Transactional @Override public Issue save(Issue issue) { Issue newIssue = new Issue(); if (issue.getIssueid() != 0) { newIssue = issuerepos.findById(issue.getIssueid()) .orElseThrow(() -> new ResourceNotFoundException("Issue id " + issue.getIssueid() + " not found!")); } newIssue.setLocation(issue.getLocation()); newIssue.setDescription(issue.getDescription()); newIssue.setImageurl(issue.getImageurl()); newIssue.setUser(issue.getUser()); return issuerepos.save(newIssue); } @Override public List<Issue> findListByUserid(long id) { Iterable<Issue> list = issueService.findAll(); List<Issue> filteredList = new ArrayList<>(); for (Issue item: list) { if (item.getUser().getUserid() == id) { filteredList.add(item); } } return filteredList; } @Override public List<Issue> findListByLocationid(long id) { Iterable<Issue> list = issueService.findAll(); List<Issue> filteredList = new ArrayList<>(); for (Issue item: list) { if (item.getLocation().getLocationid() == id) { filteredList.add(item); } } return filteredList; } @Override public List<Issue> findListByZipcode(long zipcode) { Iterable<Issue> issueList = issueService.findAll(); List<Issue> filteredList = new ArrayList<>(); for (Issue item: issueList) { if (item.getLocation().getZipcode() == zipcode) { filteredList.add(item); } } return filteredList; } @Transactional @Override public void deleteAll() { issuerepos.deleteAll(); } }
[ "aldenho@Aldens-Mac-mini.local" ]
aldenho@Aldens-Mac-mini.local
03f70afe225c03feb43624a183f456fa6f2df491
f854fe3bc7dc52d981045d0d4750be8a168e146c
/src/main/java/com/zhongxin/controller/LoginController.java
6b4432e1bdac82139b5ebf70aa02b75e047e09e4
[]
no_license
xiaolianggithub/zhognxin
e82c4d87fa437bb7acc7a96fa502c17d5c650ad3
faad0be238156a76a5c9a86fa741406d7a2deb86
refs/heads/master
2020-03-20T00:18:42.147602
2018-06-15T05:51:20
2018-06-15T05:51:20
137,039,335
0
0
null
null
null
null
UTF-8
Java
false
false
1,156
java
package com.zhongxin.controller; import javax.servlet.http.HttpSession; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.UsernamePasswordToken; import org.apache.shiro.subject.Subject; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.zhongxin.pojo.User; @Controller @RequestMapping("/login") public class LoginController { @RequestMapping("/user") @ResponseBody public User login(@RequestBody User user, HttpSession session) { Subject subject = SecurityUtils.getSubject(); UsernamePasswordToken token = new UsernamePasswordToken(user.getLoginName(), user.getPassword()); try { subject.login(token); User principal = (User) subject.getPrincipal(); session.setAttribute("user", principal); } catch (AuthenticationException e) { // TODO Auto-generated catch block e.printStackTrace(); return user; } return user; } }
[ "1052091897@qq.com" ]
1052091897@qq.com
57fd9101359cd17091dc31fb20cc26cb8f443590
da3c5aab53ba2e9ca395aa4c1d733aa08ae7ae9c
/src/auto_tester/base_functions/Square_root_solver.java
a8f60db6b1b5d30e6fbbc87c7a56cc0aae832e36
[]
no_license
Waguy02/TP_ANANUM_4GI
b91ac5dbdfaed941ee6491ff50b50cc3e0dc73ff
ec2f31e9e3ce0c664cfc1253dc139f4459ad8ade
refs/heads/master
2021-01-14T22:12:41.318506
2020-07-15T05:40:20
2020-07-15T05:40:20
242,775,108
1
0
null
null
null
null
UTF-8
Java
false
false
559
java
package auto_tester.base_functions; import auto_tester.interfaces.IBaseFunction; import java.util.ArrayList; import java.util.List; public class Square_root_solver implements IBaseFunction { @Override public List<Double> runBase(List<Double> params) { //Calcul de la racine carrée ArrayList<Double> result = new ArrayList<>(); try { result.add(Math.sqrt(result.get(0))); } catch(Exception e){ System.out.println(e.getMessage()); } return result; } }
[ "guywaffo@gmail.com" ]
guywaffo@gmail.com
d2693a7dc4f4b79c7a709727b20f1d8e57f10c57
d9918fe2e990b3712bcecedd7557b3f6d502a29c
/ProyectoConstructora/src/main/Java/com/javi/acme/controlador/UsuarioController.java
3cab994b81d028ae3795647cd4fe6e9d2c3eb59b
[]
no_license
acmeja/Proyecto
8f940a8a2032f5db672ec72b561c6ef6eb80b165
411d86ed5d06cd7a74482785208ba5f35a580123
refs/heads/master
2016-08-04T11:57:12.238098
2014-07-02T22:00:15
2014-07-02T22:00:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,483
java
package com.javi.acme.controlador; import java.io.IOException; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.SessionAttributes; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.view.RedirectView; import com.javi.acme.formulario.BaseDatosForm; import com.javi.acme.formulario.UsuarioForm; import com.javi.acme.servicios.UsuarioService; import com.javi.acme.servicios.UsuarioServiceImpl; import com.javi.acme.util.archivo_bd; import javax.servlet.jsp.*; @SessionAttributes("basedatos") @Controller public class UsuarioController { private UsuarioService usuarioService = new UsuarioServiceImpl(); static UsuarioForm usuarioForm = new UsuarioForm(); private int sistemaausar=0; @RequestMapping(value = "/inicializarLogin.html", method = RequestMethod.POST) public ModelAndView inicializarUsuario(@ModelAttribute("BaseDatosForm") BaseDatosForm baseDatosForm) { ModelAndView modelAndView = new ModelAndView("login" , "usuarioForm", new UsuarioForm()); System.out.println(baseDatosForm.getBasededatos()); sistemaausar = baseDatosForm.getBasededatos(); modelAndView.addObject("basedatos",baseDatosForm); System.out.println("Si hemos llegado aqui quiere decir que la pagina index.jsp ha invocado a este controlador por el request /inicializarLogin.html y requiere el inicializarUsuario View"); return modelAndView; } @RequestMapping(value= "/seleccionarBD.htm",method=RequestMethod.GET) public ModelAndView inicializarBaseDatos() { return new ModelAndView("sel_bd","baseDatosForm",new BaseDatosForm()); } @RequestMapping(value = "/verificarLogin.html", method = RequestMethod.POST) public ModelAndView verificarUsuario(@ModelAttribute("usuarioForm") UsuarioForm usuarioForm,@ModelAttribute("basedatos") BaseDatosForm baseDatosForm) throws IOException { boolean existe = false; System.out.println("Si hemos llegado aqui quiere decir que la pagina login.jsp ha invocado a este controlador por el request /verificarLogin.html y requiere el verificarUsuario View"); new archivo_bd().c_archivo_bd(sistemaausar); existe = usuarioService.buscarUsuario(usuarioForm); if("".equals(usuarioForm.getUsuario())&&"".equals(usuarioForm.getPassword())){ System.out.println("Cargaremos por primera vez la pagina de login con el mensaje vacio"); return new ModelAndView("login" , "mensaje", "Debe de llenar los campos de Usuario y Clave"); } else if(existe){ System.out.println("Se coloco al usuario y clave correctamente y va a la pagina de agregarComponentes"); return new ModelAndView("redirect:menu.acme"); } else{ System.out.println("Se coloco al usuario y clave incorrectamente y regresamos a la pagina de login con el mensaje de Usuario Incorrecto"); return new ModelAndView("login" , "mensaje", "Usuario Incorrecto"); } } }
[ "javiam_am1@hotmail.com" ]
javiam_am1@hotmail.com
3596f12ffed542da1b9639d18395426982ac33a5
9b294c3bf262770e9bac252b018f4b6e9412e3ee
/camerazadas/source/apk/com.sonyericsson.android.camera/src-cfr/com/google/android/gms/common/data/f.java
1e68964bf3ce2453b8d26935969218646faa6017
[]
no_license
h265/camera
2c00f767002fd7dbb64ef4dc15ff667e493cd937
77b986a60f99c3909638a746c0ef62cca38e4235
refs/heads/master
2020-12-30T22:09:17.331958
2015-08-25T01:22:25
2015-08-25T01:22:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,566
java
/* * Decompiled with CFR 0_100. */ package com.google.android.gms.common.data; import android.database.CursorWindow; import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; import com.google.android.gms.common.data.DataHolder; import com.google.android.gms.common.internal.safeparcel.a; import com.google.android.gms.common.internal.safeparcel.b; public class f implements Parcelable.Creator<DataHolder> { static void a(DataHolder dataHolder, Parcel parcel, int n) { int n2 = b.D(parcel); b.a(parcel, 1, dataHolder.gB(), false); b.c(parcel, 1000, dataHolder.getVersionCode()); b.a((Parcel)parcel, (int)2, (Parcelable[])dataHolder.gC(), (int)n, (boolean)false); b.c(parcel, 3, dataHolder.getStatusCode()); b.a(parcel, 4, dataHolder.gy(), false); b.H(parcel, n2); } public DataHolder[] at(int n) { return new DataHolder[n]; } @Override public /* synthetic */ Object createFromParcel(Parcel parcel) { return this.z(parcel); } @Override public /* synthetic */ Object[] newArray(int n) { return this.at(n); } public DataHolder z(Parcel object) { int n = 0; Bundle bundle = null; int n2 = a.C((Parcel)object); CursorWindow[] arrcursorWindow = null; String[] arrstring = null; int n3 = 0; block7 : while (object.dataPosition() < n2) { int n4 = a.B((Parcel)object); switch (a.aD(n4)) { default: { a.b((Parcel)object, n4); continue block7; } case 1: { arrstring = a.A((Parcel)object, n4); continue block7; } case 1000: { n3 = a.g((Parcel)object, n4); continue block7; } case 2: { arrcursorWindow = a.b((Parcel)object, n4, CursorWindow.CREATOR); continue block7; } case 3: { n = a.g((Parcel)object, n4); continue block7; } case 4: } bundle = a.q((Parcel)object, n4); } if (object.dataPosition() != n2) { throw new a.a("Overread allowed size end=" + n2, (Parcel)object); } object = new DataHolder(n3, arrstring, arrcursorWindow, n, bundle); object.gA(); return object; } }
[ "jmrm@ua.pt" ]
jmrm@ua.pt
c0a1c74ff0be5f48044ad4f4fb62f3808dd60052
edc098432e73357c8f1087dab3d9d08ab8434a9a
/fgoa/src/main/java/com/fgoa/service/examquestion/ExamClassServiceI.java
3be81887337951ea6e00159e88cb04a2a18c5462
[]
no_license
lkdd7777/fgproject
9be34b60f9d7d84a55bb907c04e794e05e53ddc9
369a460049862c8d231ad0a1d4fc0ad534ce2cb6
refs/heads/master
2020-03-15T23:48:26.043738
2018-05-07T03:50:31
2018-05-07T03:50:31
132,400,974
0
0
null
null
null
null
UTF-8
Java
false
false
747
java
package com.fgoa.service.examquestion; import org.jeecgframework.core.common.service.CommonService; import com.fgoa.entity.examquestion.ExamClassEntity; import java.io.Serializable; public interface ExamClassServiceI extends CommonService{ public <T> void delete(T entity); public <T> Serializable save(T entity); public <T> void saveOrUpdate(T entity); /** * 默认按钮-sql增强-新增操作 * @param id * @return */ public boolean doAddSql(ExamClassEntity t); /** * 默认按钮-sql增强-更新操作 * @param id * @return */ public boolean doUpdateSql(ExamClassEntity t); /** * 默认按钮-sql增强-删除操作 * @param id * @return */ public boolean doDelSql(ExamClassEntity t); }
[ "lkddpc520@vip.qq.com" ]
lkddpc520@vip.qq.com
121b6bcd8af0eb6b78914d441cd5ea1e12c381aa
b2a46002c030c89e030f21adb5d5656eca75ac40
/src/main/java/com/example/hbase_messaging/controller/WebUiController.java
cf7087b1fafa1048ca9a7f8809b00d99bc114070
[]
no_license
tmyksj/hbase-messaging
e31d0f83ecb545190ba47e0ed87f39f8504157b9
963153e2807d064fa070c07e4f91ee32e89d5fb1
refs/heads/master
2021-09-15T01:52:09.974094
2017-12-16T02:16:55
2017-12-16T02:16:55
114,429,957
0
0
null
null
null
null
UTF-8
Java
false
false
397
java
package com.example.hbase_messaging.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @Controller public class WebUiController { @RequestMapping(path = "/webui", method = RequestMethod.GET) public String get() { return "webui/index"; } }
[ "33417830+tmyksj@users.noreply.github.com" ]
33417830+tmyksj@users.noreply.github.com
163f57d74c468dd51130d453617b79d9e5c7f100
b6c48128657a32f2be05edd6c89b1f1c16fa58be
/src/main/java/com/smarthealth/diningroom/service/impl/MealServiceImpl.java
c064fc3e4a6aa45f566ca3136330a2da3fb6415b
[]
no_license
songlingsl/SmartHealth
38f0c5b4fb4b1c342b81ee9d5ec3b256f96743cf
c9927290801101bff2ed32cfc9d7c29ba73c6fff
refs/heads/master
2023-02-01T11:45:20.162491
2020-11-27T12:08:49
2020-11-27T12:08:49
258,490,425
0
0
null
null
null
null
UTF-8
Java
false
false
5,641
java
package com.smarthealth.diningroom.service.impl; import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUtil; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.smarthealth.diningroom.entity.Dishes; import com.smarthealth.diningroom.entity.Meal; import com.smarthealth.diningroom.entity.Plate; import com.smarthealth.diningroom.entity.PlateFood; import com.smarthealth.diningroom.mapper.MealMapper; import com.smarthealth.diningroom.mapper.PlateFoodMapper; import com.smarthealth.diningroom.mapper.PlateMapper; import com.smarthealth.diningroom.service.MealService; import com.smarthealth.diningroom.util.DictManager; import com.smarthealth.diningroom.vo.IntakeVO; import com.smarthealth.diningroom.vo.PerMealIntakeVO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.math.BigDecimal; import java.time.LocalDate; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; /** * <p> * 每餐 服务实现类 * </p> * * @author songling * @since 2020-04-29 */ @Service public class MealServiceImpl extends ServiceImpl<MealMapper, Meal> implements MealService { @Autowired private PlateMapper plateMapper;// @Resource DictManager dictManager; @Autowired private PlateFoodMapper plateFoodMapper;// @Transactional @Override public void transactionalTest() { Meal meal=new Meal(); // meal.setType(2); this.save(meal); Plate plate=new Plate(); plate.setStatus(377777777);//上面的保存也不会入库 plateMapper.insert(plate); } @Override public Map getTodayMeal(String userId) { Map<Long, Dishes> dishesMap=dictManager.getDishesMap(); Map<Integer, PerMealIntakeVO> rmap=new HashMap(); String mealDay= LocalDate.now().toString(); List<PlateFood> list= plateFoodMapper.getTodayMeal(userId,mealDay); for (PlateFood p:list) { PerMealIntakeVO per=rmap.get(p.getMealType()); if(per==null){ per= new PerMealIntakeVO(); rmap.put(p.getMealType(),per); } Dishes d=dishesMap.get( p.getFoodId()); if(d!=null){ p.setFoodName(d.getName()); addPerFoodIntake(per,p,d); } per.getFoodList().add(p); } return rmap; } @Override public IntakeVO getTodayAllIntakeByUserId(String userId) { String mealDay= LocalDate.now().toString(); List<PlateFood> list= plateFoodMapper.getTodayMeal(userId,mealDay); IntakeVO vo=dealDailyIntake(list); return vo; } @Override public IntakeVO getSevenDayIntakeByUserId(String userId) { String mealDay= LocalDate.now().toString(); DateTime dateTime= DateUtil.offsetDay(DateUtil.date(),-6);//六天前 String preDay=DateUtil.format(dateTime, "yyyy-MM-dd"); List<PlateFood> list= plateFoodMapper.getSevenDayMeal(userId,preDay,mealDay); IntakeVO vo=dealDailyIntake(list); return vo; } private IntakeVO dealDailyIntake(List<PlateFood> list) { Map<Long, Dishes> dishesMap=dictManager.getDishesMap(); IntakeVO vo=new IntakeVO(); for (PlateFood p:list) { Dishes dishes=dishesMap.get( p.getFoodId()); if(dishes!=null){ BigDecimal weight= new BigDecimal(p.getWeight()); vo.setEnergy(vo.getEnergy()+dishes.getEnergyCal().multiply(weight).intValue()); vo.setFats(vo.getFats()+dishes.getFat().multiply(weight).intValue()); vo.setProteins(vo.getProteins()+dishes.getProtein().multiply(weight).intValue()); vo.setCarbohydrates(vo.getCarbohydrates()+dishes.getCarbohy().multiply(weight).intValue()); vo.setCalcium(vo.getCalcium()+dishes.getElementCa().multiply(weight).intValue()); } } return vo; } /** * 每种菜的摄入量相加到每餐 * @param per * @param p */ private void addPerFoodIntake(PerMealIntakeVO per, PlateFood p, Dishes dishes) { BigDecimal weight= new BigDecimal(p.getWeight()); per.setEnergy(per.getEnergy()+dishes.getEnergyCal().multiply(weight).intValue()); per.setFats(per.getFats()+dishes.getFat().multiply(weight).intValue()); per.setProteins(per.getProteins()+dishes.getProtein().multiply(weight).intValue()); per.setCarbohydrates(per.getCarbohydrates()+dishes.getCarbohy().multiply(weight).intValue()); per.setCalcium(per.getCalcium()+dishes.getElementCa().multiply(weight).intValue()); } @Override public Map<String, IntakeVO> getWeekIntakeByUserId(String userId) { Map<String, IntakeVO> rmap=new LinkedHashMap<>(); for(int i=-6;i<=0;i++){ DateTime dateTime= DateUtil.offsetDay(DateUtil.date(),i); String mealDay=DateUtil.format(dateTime, "yyyy-MM-dd"); String keyDay=DateUtil.format(dateTime, "MM-dd"); //String week=dateTime.dayOfWeek()-1+""; List<PlateFood> list= plateFoodMapper.getTodayMeal(userId,mealDay); IntakeVO vo=dealDailyIntake(list); rmap.put(keyDay,vo); } return rmap; } }
[ "songlingsl@163.com" ]
songlingsl@163.com
61674b3b21373bfce36f4c0fb7f654471d53aa41
95141e3346071e8cfbd0051082da6c81ba0458a1
/backend/src/main/java/com/example/infrastructure/persistence/RedisPasswordResettableAccountRepository.java
095b25f34a7efb0ef11f22d0b82e4e7959129105
[ "Apache-2.0" ]
permissive
fyamvbf/example-chat
d184f486f0f65c0148668c2d397f2c0e54d1d060
f1285cd5bf1af50a80d6660f0be927fc33f64d37
refs/heads/master
2023-03-27T21:59:10.214687
2021-03-30T05:55:21
2021-03-30T05:55:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,547
java
package com.example.infrastructure.persistence; import java.io.IOException; import java.util.concurrent.TimeUnit; import com.example.domain.model.account.Account; import com.example.domain.model.account.AccountId; import com.example.domain.model.account.MailAddress; import com.example.domain.model.account.PasswordResettableAccount; import com.example.domain.model.account.TemporaryUserToken; import com.example.domain.model.account.UserName; import com.example.domain.repository.PasswordResettableAccountRepository; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import nablarch.core.repository.di.config.externalize.annotation.ComponentRef; import nablarch.core.repository.di.config.externalize.annotation.ConfigValue; import nablarch.core.repository.di.config.externalize.annotation.SystemRepositoryComponent; import nablarch.integration.redisstore.lettuce.LettuceRedisClient; @SystemRepositoryComponent public class RedisPasswordResettableAccountRepository implements PasswordResettableAccountRepository { private final LettuceRedisClient redisClient; private final long expireMilliseconds; private final ObjectMapper objectMapper = new ObjectMapper(); public RedisPasswordResettableAccountRepository(@ComponentRef("lettuceRedisClientProvider") LettuceRedisClient redisClient, @ConfigValue("${passwordReset.verification.expire}") String expireSeconds) { this.redisClient = redisClient; this.expireMilliseconds = TimeUnit.SECONDS.toMillis(Long.parseLong(expireSeconds)); } @Override public void add(PasswordResettableAccount resettableAccount) { String key = resettableAccount.userToken().value(); byte[] value = serialize(resettableAccount.account()); redisClient.set(key, value); redisClient.pexpire(key, expireMilliseconds); } @Override public PasswordResettableAccount findBy(TemporaryUserToken userToken) { String key = userToken.value(); byte[] value = redisClient.get(key); if (value == null) { return null; } Account account = deserialize(value); return new PasswordResettableAccount(userToken, account); } @Override public void remove(TemporaryUserToken userToken) { redisClient.del(userToken.value()); } private byte[] serialize(Account account) { try { Value value = new Value(); value.accountId = account.accountId().value(); value.userName = account.userName().value(); value.mailAddress = account.mailAddress().value(); return objectMapper.writeValueAsBytes(value); } catch (JsonProcessingException e) { throw new RuntimeException(e); } } private Account deserialize(byte[] jsonBytes) { try { Value value = objectMapper.readValue(jsonBytes, Value.class); AccountId accountId = new AccountId(value.accountId); UserName userName = new UserName(value.userName); MailAddress mailAddress = new MailAddress(value.mailAddress); return new Account(accountId, userName, mailAddress); } catch (IOException e) { throw new RuntimeException(e); } } public static class Value { public long accountId; public String userName; public String mailAddress; public String password; } }
[ "tec-inv-west@ml.tis.co.jp" ]
tec-inv-west@ml.tis.co.jp
d832ef67dae42e6187265d51e9a2aebf295a7cc7
ba90ba9bcf91c4dbb1121b700e48002a76793e96
/com-gameportal-web/src/main/java/com/gameportal/web/user/dao/MemberXimaDetailDao.java
28bccd56185c43fdd0cc32ae44726fbc9a51ea08
[]
no_license
portalCMS/xjw
1ab2637964fd142f8574675bd1c7626417cf96d9
f1bdba0a0602b8603444ed84f6d7afafaa308b63
refs/heads/master
2020-04-16T13:33:21.792588
2019-01-18T02:29:40
2019-01-18T02:29:40
165,632,513
0
9
null
null
null
null
UTF-8
Java
false
false
854
java
package com.gameportal.web.user.dao; import java.util.List; import java.util.Map; import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.StringUtils; import org.springframework.stereotype.Component; import com.gameportal.web.user.model.MemberXimaDetail; @Component @SuppressWarnings("all") public class MemberXimaDetailDao extends BaseIbatisDAO { @Override public Class getEntityClass() { return MemberXimaDetail.class; } public boolean saveOrUpdate(MemberXimaDetail entity) { if (entity.getMxdid() == null) return StringUtils.isNotBlank(ObjectUtils.toString(save(entity))) ? true : false; else return update(entity); } public List<MemberXimaDetail> findMemberXimaDetailList(Map<String, Object> params){ return getSqlMapClientTemplate().queryForList(getSimpleName()+".pageSelectDetail",params); } }
[ "sunny@gmail.com" ]
sunny@gmail.com
8b0f3985fb269923cd05b9078554180cb98423a8
13550e8fbae589af18a0af93962c10b27ac50ff6
/src/devMatching2021/Solution03.java
4f144c3a870bce2a35b3615dc98403c3557c63d6
[]
no_license
SungWoo824/JavaAlgorithm
824fff65bee375694cbf3272789c113661d9bee2
66e7a4893abace8ffa85f7ef1d2a26b28caa51f3
refs/heads/master
2023-08-17T07:12:17.690567
2023-08-08T14:09:32
2023-08-08T14:09:32
214,786,375
0
0
null
null
null
null
UTF-8
Java
false
false
2,522
java
package devMatching2021; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class Solution03 { public static int solution(String s) { if (s.length()==1){ return 0; } long answer = 0; Map<Character,int[]> keyMap = new HashMap<>(); char[][] temp = { {'q','w','e','r','t','y','u','i','o'}, {'p','a','s','d','f','g','h','j','k'}, {'l','z','x','c','v','b','n','m'} }; for (int i = 0 ; i < temp.length ; i++){ for (int j = 0 ; j < temp[i].length ; j++) { keyMap.put(temp[i][j],new int[]{i,j}); } } Map<String, Integer> cacheMap = new HashMap<>(); for (int i = 2 ; i <= s.length() ; i++) { for (int j = 0 ; j+i-1<s.length(); j++) { String subset=s.substring(j,j+i); if (cacheMap.containsKey(subset)){ answer = answer+cacheMap.get(subset); } else { int plusNum = 0; if (cacheMap.containsKey(subset.substring(0,subset.length()-1))) { int[] lastIndex = keyMap.get(subset.charAt(subset.length()-2)); int[] checkIndex = keyMap.get(subset.charAt(subset.length()-1)); plusNum = cacheMap.get(subset.substring(0,subset.length()-1))+Math.abs(checkIndex[0]-lastIndex[0])+Math.abs(checkIndex[1]-lastIndex[1]); cacheMap.put(subset,plusNum); answer = answer + plusNum; } else { int[] charIndex = keyMap.get(subset.charAt(0)); int[] tempIndex; for (int k = 1 ; k < subset.length() ; k++) { tempIndex = keyMap.get(subset.charAt(k)); plusNum = plusNum + Math.abs(tempIndex[0]-charIndex[0])+Math.abs(tempIndex[1]-charIndex[1]); charIndex = keyMap.get(subset.charAt(k)); } cacheMap.put(subset,plusNum); answer = answer + plusNum; } } } } return (int) (answer%(Math.pow(10,9)+7)); } public static void main(String[] args) { String s = "abcc"; System.out.println(solution(s)); } } /* s result "abcc" 23 "tooth" 52 "zzz" 0 */
[ "scody1219@gmail.com" ]
scody1219@gmail.com
7985285f2040c8c0a50400947a58d631276b620d
afa872a111c67f44f701bc9892a872a494b3edfe
/OTRSProject/src/com/belcci/otrs/form/listener/ApplicationListener.java
aaba36c8580e9d75d3f975ab861b1dc6a98766a8
[]
no_license
asysoi/OTRSProject
641aabb2b20cf6380c2d78c3ae566c48e6f8e09a
ded2a1c3752043ec0fcdc3524129a2242b3df240
refs/heads/master
2020-09-22T03:14:55.237236
2014-02-18T12:17:04
2014-02-18T12:17:04
16,942,556
0
1
null
null
null
null
WINDOWS-1251
Java
false
false
411
java
package com.belcci.otrs.form.listener; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JOptionPane; public class ApplicationListener implements ActionListener { public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(null, "Основная панель приложения"); } }
[ "asysoi@cci.by" ]
asysoi@cci.by
5b93117d16cc67a9ac674a61b009e555bb7674d1
0ea271177f5c42920ac53cd7f01f053dba5c14e4
/5.3.5/sources/com/google/android/gms/wearable/internal/zzhf.java
6593c6064ba97574b3981deebfdc8673618ddc81
[]
no_license
alireza-ebrahimi/telegram-talaeii
367a81a77f9bc447e729b2ca339f9512a4c2860e
68a67e6f104ab8a0888e63c605e8bbad12c4a20e
refs/heads/master
2020-03-21T13:44:29.008002
2018-12-09T10:30:29
2018-12-09T10:30:29
138,622,926
12
1
null
null
null
null
UTF-8
Java
false
false
348
java
package com.google.android.gms.wearable.internal; import com.google.android.gms.common.api.Status; import com.google.android.gms.common.api.internal.zzn; final class zzhf extends zzgm<Status> { public zzhf(zzn<Status> zzn) { super(zzn); } public final void zza(zzbn zzbn) { zzav(new Status(zzbn.statusCode)); } }
[ "alireza.ebrahimi2006@gmail.com" ]
alireza.ebrahimi2006@gmail.com
d7979787bc9af891becd9902b2f9a443885d088b
d5a727438664b2bf43e324df165bbf8e58188368
/7_1/src/ServerAPI/Message.java
a202a00ae8c17d7093ec8b32c7907175b1d5005e
[]
no_license
ToJluK-V/Labs_2sem
117d684e904a9dcc655f77c08903c7da7e095a74
764f9e90b80d2dcd2951574088b70ba022cad174
refs/heads/master
2022-08-21T20:16:19.507869
2020-05-25T17:21:03
2020-05-25T17:21:03
263,628,146
0
0
null
null
null
null
UTF-8
Java
false
false
406
java
package ServerAPI; import java.io.Serializable; public class Message implements Serializable { private static final long serialVersionUID = 1L; public String sender; public String receiver; public String message; public Message(String sender, String receiver, String message){ this.sender = sender; this.message = message; this.receiver = receiver; } }
[ "sivakov_vanya@bk.ru" ]
sivakov_vanya@bk.ru
4c6b4439704fbbea016a6de0a864172120108f44
c4c39e81afbc599484f2f9751c24c1caac8fd853
/src/main/java/jgrapht/demo/App.java
1d42c6ea166b05fd2c9c5466a5fb7311cb1e7e99
[]
no_license
besza/GmlGraphDemo
7e4c2fa41f3c3ff2ecf8ea5402add465fbf7fc1d
fdb278f4ec9e5358c4887a6dc40babc3a5339a6b
refs/heads/master
2021-07-14T18:15:04.599573
2017-10-19T14:08:25
2017-10-19T14:08:25
107,554,647
0
0
null
null
null
null
UTF-8
Java
false
false
3,673
java
package jgrapht.demo; import org.jgrapht.graph.DefaultWeightedEdge; import org.jgrapht.graph.SimpleDirectedWeightedGraph; import org.jgrapht.graph.SimpleWeightedGraph; import org.jgrapht.io.*; import java.io.*; import java.util.Map; import java.util.Random; public class App { public static void main(String[] args) { SimpleDirectedWeightedGraph<CapacityVertex, DefaultWeightedEdge> graph = new SimpleDirectedWeightedGraph<>(DefaultWeightedEdge.class); CapacityVertex A = new CapacityVertex("A"); CapacityVertex B = new CapacityVertex("B"); CapacityVertex C = new CapacityVertex("C"); graph.addVertex(A); graph.addVertex(B); graph.addVertex(C); graph.addEdge(A, B); graph.addEdge(A, C); graph.addEdge(B, C); // adjunk random élsúlyokat Random generator = new Random(); for (DefaultWeightedEdge e : graph.edgeSet()) { graph.setEdgeWeight(e, generator.nextInt(100)); } GmlExporter<CapacityVertex, DefaultWeightedEdge> exporter = new GmlExporter<>( CapacityVertex::getName, //a vertex id-ja legyen a neve (v) -> String.valueOf(v.getCapacity()), //a vertex label-je legyen a kapacitása new IntegerComponentNameProvider<>(), //az él id-ja legyen a soron következő egész null); exporter.setParameter(GmlExporter.Parameter.EXPORT_EDGE_LABELS, true); exporter.setParameter(GmlExporter.Parameter.EXPORT_EDGE_WEIGHTS, true); exporter.setParameter(GmlExporter.Parameter.EXPORT_VERTEX_LABELS, true); try (Writer writer = new PrintWriter(new File("out.gml"))){ exporter.exportGraph(graph, writer); } catch (IOException e) { e.printStackTrace(); } //-------------------------------------------------------------------------------------------------------------- VertexProvider<CapacityVertex> vertexProvider = new VertexProvider<CapacityVertex>() { @Override public CapacityVertex buildVertex(String s, Map<String, String> map) { CapacityVertex vertex = new CapacityVertex(s); //tákoljuk össze a vertex objektumot, itt fontos tudni azt, hogy mit tettünk a csúcs label-jébe String capacity = map.get("label"); if (capacity != null) { vertex.setCapacity(Integer.valueOf(capacity)); } return vertex; } }; EdgeProvider<CapacityVertex, DefaultWeightedEdge> edgeProvider = new EdgeProvider<CapacityVertex, DefaultWeightedEdge>() { @Override public DefaultWeightedEdge buildEdge(CapacityVertex capacityVertex, CapacityVertex v1, String s, Map<String, String> map) { return new DefaultWeightedEdge(); } }; GmlImporter<CapacityVertex, DefaultWeightedEdge> importer = new GmlImporter<>(vertexProvider, edgeProvider); SimpleDirectedWeightedGraph<CapacityVertex, DefaultWeightedEdge> importedGraph = new SimpleDirectedWeightedGraph<>(DefaultWeightedEdge.class); try { SimpleWeightedGraph<CapacityVertex, DefaultWeightedEdge> graph2 = new SimpleWeightedGraph<>(DefaultWeightedEdge.class); importer.importGraph(graph2, new File("out.gml")); } catch (ImportException e) { e.printStackTrace(); } } }
[ "besenyei.szabolcs@nyfbox.hu" ]
besenyei.szabolcs@nyfbox.hu
f0724cd241fbce23aa88903c1d3f5bac176b64c1
5cb11eee55419204c7e2785ea861259d0870f3d5
/BusTicketing/src/main/java/com/ticketbooking/exceptions/GlobalExceptionHandler.java
ff099c350202c90bc4c3a3b8e1bf28d3e15600e0
[]
no_license
nivetha-r/hackathon
33a5da262a7552f67e79498dac1401e6daf2076b
557fcd5ae8b6752846900dc150af39c57300623e
refs/heads/master
2020-12-28T01:15:44.492331
2019-12-24T10:17:50
2019-12-24T10:17:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
735
java
package com.ticketbooking.exceptions; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import com.ticketbooking.constants.Constant; import com.ticketbooking.dto.ErrorDto; @ControllerAdvice public class GlobalExceptionHandler { @ExceptionHandler(TicketNotFoundException.class) public ResponseEntity<ErrorDto> ticketNotFoundException(){ ErrorDto errorDto = new ErrorDto(); errorDto.setMessage(Constant.TICKET_NOT_FOUND); errorDto.setStatusCode(Constant.TICKET_CANCEL_FAILED); return ResponseEntity.status(HttpStatus.NOT_FOUND).body(errorDto); } }
[ "raghum112233@gmail.com" ]
raghum112233@gmail.com
cf2ffdcd1b26964b96491a8eb80a8244c84d3f77
ba0be749af230e8fb2263c02bf606f2ed309e2ea
/src/test/java/com/renyuanhang/test/StringTest.java
2bcee732ab6c4e6ce81aff35da80829a64fa0815
[]
no_license
ryhflandre/weektest
dde78a614d9e4422d74c803ebce13408fdc3f757
a23f02db9321876e039f8b925da3ad6fc03cf097
refs/heads/master
2022-12-24T10:03:19.211906
2019-09-09T02:07:19
2019-09-09T02:07:19
207,192,976
0
0
null
2022-12-16T10:32:05
2019-09-09T00:38:52
CSS
UTF-8
Java
false
false
795
java
package com.renyuanhang.test; import java.util.Scanner; import com.renyuanhang.controller.StringUtils; /** * flandre * * 2019年9月9日 */ public class StringTest { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str1 = sc.next(); String result = StringUtils.toHtml(str1); System.out.println(result); String str2 = sc.next(); if(StringUtils.isPhone(str2)){ System.out.println("验证成功是一个手机号"); }else{ System.out.println("这不是一个手机号"); } String str3 = sc.next(); if (StringUtils.isEmail(str3)) { System.out.println("验证成功是一个邮箱号"); }else{ System.out.println("这不是一个邮箱"); } System.out.println(); } }
[ "flandre@gensokyo.com" ]
flandre@gensokyo.com
cb96cca792d73effb8d7cb4acfb29f68fcb360f2
9acd76e8320351030d126f375e28b1478c6735f7
/ApplicationEight/app/src/androidTest/java/fileapp/ws/applicationeight/ExampleInstrumentedTest.java
abd54a9c9131d87529afb792d2b1bffb609f8a16
[]
no_license
aswinpradeep0/android1
c2b7b0be112f31fc872f7f482d3d4e7493ad80c2
1d627355632f62e716e09052e84f56369d403fab
refs/heads/master
2020-05-21T00:49:55.734007
2019-05-09T17:00:30
2019-05-09T17:00:30
185,839,693
0
0
null
null
null
null
UTF-8
Java
false
false
738
java
package fileapp.ws.applicationeight; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("fileapp.ws.applicationeight", appContext.getPackageName()); } }
[ "aswinpradeep1@gmail.com" ]
aswinpradeep1@gmail.com
04fce5ee23bb34255228f88ff17db111d8f936e0
bda6e2f261440585a2686488056e678143f7771b
/src/main/java/com/project/mocktest/service/mapper/QueryMapper.java
a09f49a7b7c3bb761f64802b767bfc2df0f452d4
[]
no_license
rajanish007/mocktest
35479d8cc2686ef21bb12e5464b97c2e74e8cdab
fd18c1a98ed8e13d12ccc4dca4ffdfbf39cfae09
refs/heads/master
2020-04-09T06:08:00.291218
2019-01-17T15:20:16
2019-01-17T15:20:16
160,099,620
0
0
null
2019-01-17T15:20:17
2018-12-02T21:47:18
Java
UTF-8
Java
false
false
2,056
java
package com.project.mocktest.service.mapper; import com.project.mocktest.domain.Question; import com.project.mocktest.domain.QuestionVO; import com.project.mocktest.repository.QuestionEntity; import org.springframework.stereotype.Component; @Component public class QueryMapper { public Question convert(QuestionEntity qEntity) { Question q = new Question(); q.setCorrectAnswer(qEntity.getCorrectAnswer()); q.setDescription(qEntity.getDescription()); q.setFaculty_Id(qEntity.getFaculty_Id()); q.setFirstAnswer(qEntity.getFirstAnswer()); q.setSecondAnswer(qEntity.getSecondAnswer()); q.setThirdAnswer(qEntity.getThirdAnswer()); q.setFourthAnswer(qEntity.getFourthAnswer()); q.setTimeAllocated(qEntity.getTimeAllocated()); q.setQuestionId(qEntity.getQuestionId()); q.setTotalAttempts(qEntity.getTotalAttempts()); q.setCorrectAttempts(qEntity.getCorrectAttempts()); return q; } public QuestionEntity convert(Question q) { QuestionEntity questionEntity = new QuestionEntity(q.getFaculty_Id(), q.getTimeAllocated(), q.getCorrectAnswer(), q.getDescription(), q.getFirstAnswer(), q.getSecondAnswer(), q.getThirdAnswer(), q.getFourthAnswer(),0,0); return questionEntity; } public QuestionVO convertToVO(QuestionEntity qEntity) { Question q = convert(qEntity); QuestionVO qVO = new QuestionVO(); qVO.setCorrectAnswer(q.getCorrectAnswer()); qVO.setDescription(q.getDescription()); qVO.setFaculty_Id(q.getFaculty_Id()); qVO.setFirstAnswer(q.getFirstAnswer()); qVO.setSecondAnswer(q.getSecondAnswer()); qVO.setThirdAnswer(q.getThirdAnswer()); qVO.setFourthAnswer(q.getFourthAnswer()); qVO.setTimeAllocated(q.getTimeAllocated()); qVO.setQuestionId(q.getQuestionId()); qVO.setCorrectAttempts(q.getCorrectAttempts()); qVO.setTotalAttempts(q.getTotalAttempts()); return qVO; } }
[ "ranjan.rajanish0@gmail.com" ]
ranjan.rajanish0@gmail.com
a3571d61fd5e95c3a77aa5c855cb6b2e91db96c0
e7083e92e1670b6d93ffc867b0c38668ee146c67
/JSR352.Annotations/src/javax/batch/annotation/StepListener.java
c539e96d3036dcb3a8e87e320224d7e5b8350b93
[ "Apache-2.0" ]
permissive
mminella/jsr-352-ri-tck
5e3330feb717ddb96ef74bf59f433401a9fac939
6c08c0fecc93667852a9fa0e77d9c2dfc5c1c398
refs/heads/master
2021-01-20T11:30:24.031435
2013-01-02T15:13:24
2013-01-02T15:13:24
7,408,437
1
0
null
null
null
null
UTF-8
Java
false
false
1,085
java
/* * Copyright 2012 International Business Machines Corp. * * See the NOTICE file distributed with this work for additional information * regarding copyright ownership. 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 javax.batch.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface StepListener { public String value() default ""; }
[ "mminella@vmware.com" ]
mminella@vmware.com
2e5db1b7debe12ea2fa92b250950f49631b912a4
d1edc833c1256faae574d27a46f0cb2a2555c705
/SprintBootMVC/src/test/java/com/das/learnings/SprintBootBasicApplicationTests.java
aad9020040402f5aef079b6bea06cc20d306c6dd
[]
no_license
dasg16/SpringBootMVC
561bf74d8d57c0f39744076429d31b7f47816e1a
dd0ae7d3685d1035b461131788fae0bda79f2fbe
refs/heads/master
2023-08-27T13:21:53.452658
2021-11-10T16:11:32
2021-11-10T16:11:32
423,899,785
0
0
null
null
null
null
UTF-8
Java
false
false
218
java
package com.das.learnings; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class SprintBootBasicApplicationTests { @Test void contextLoads() { } }
[ "goura@10.0.0.216" ]
goura@10.0.0.216
2d5fde2df024e8877e529b5cd1a1c9bba6792d61
4d6eb28bf7e6ad77410d4480fb551f938311b9c1
/src/main/java/de/arkadi/persistence/model/Author.java
1b78e37aae95205b8e7079ae9c87d830fc0135c0
[]
no_license
iFindY/jpa
daf0cd1eaece76243ec87eb1983313b1af23bda0
893c7bb98fc985104f73b13c30f459030bfed195
refs/heads/master
2020-04-05T15:52:58.544813
2018-11-25T21:04:01
2018-11-25T21:04:01
156,988,014
0
0
null
null
null
null
UTF-8
Java
false
false
2,479
java
package de.arkadi.persistence.model; import javax.persistence.*; import javax.xml.bind.annotation.XmlRootElement; import java.io.Serializable; import java.util.Date; @Entity @XmlRootElement @NamedQueries({ @NamedQuery(name = Author.FIND_ALL, query = "select a from Author a"), }) public class Author extends Artist implements Serializable { // ====================================== // = Attributes = // ====================================== @Column(name = "preferred_Language") @Enumerated private Language preferredLanguage; // ====================================== // = Constant = // ====================================== public static final String FIND_ALL = "Author.findAll"; // ====================================== // = Constructors = // ====================================== public Author() { } public Author(String firstName, String lastName, String bio, Date dateOfBirth, Language language) { this.firstName = firstName; this.lastName = lastName; this.bio = bio; this.dateOfBirth = dateOfBirth; this.preferredLanguage = language; } // ====================================== // = Getters & Setters = // ====================================== public Language getPreferredLanguage() { return preferredLanguage; } public void setPreferredLanguage(Language preferredLanguage) { this.preferredLanguage = preferredLanguage; } // ====================================== // = hashcode, equals & toString = // ====================================== @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; Author author = (Author) o; if (preferredLanguage != author.preferredLanguage) return false; return true; } @Override public int hashCode() { int result = super.hashCode(); result = 31 * result + (preferredLanguage != null ? preferredLanguage.hashCode() : 0); return result; } @Override public String toString() { final StringBuilder sb = new StringBuilder(firstName); sb.append(' '); sb.append(lastName); return sb.toString(); } }
[ "arkadi.daschkewitsch@gmail.com" ]
arkadi.daschkewitsch@gmail.com
6d571417d463d0a2e48875587fa5a18e16098d4c
e517d18b6095ea9e6310330d0f1e0e0825515cc0
/contest/2019年3月/Mathequal/Main.java
e056e7a20890c4f35528850f75e465f7caad8ad0
[]
no_license
Azhao1993/MiOj
16458165331ebe72960c7fa72f86a3a40be9f4c2
261f4755b69f8d9ee0d25a25fb369c060c1d979a
refs/heads/master
2020-04-25T21:40:29.287604
2019-04-04T03:38:50
2019-04-04T03:38:50
173,086,922
0
0
null
null
null
null
UTF-8
Java
false
false
287
java
package Mathequal; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int d = sc.nextInt(); int e = sc.nextInt(); } }
[ "1124913956@qq.com" ]
1124913956@qq.com
1306686d9244c799ffb8af5fe2f111bbed340344
f896b5b0e4324442bb0bfaeb9216c3906bbdacae
/app/src/main/java/com/example/raptor/Partita3Activity.java
c7f0b56d966c59de499c49d67c225e2e85f310d7
[]
no_license
IvanoiuAlexandruPaul/LegoRobot
700a5007cabe57a054ace77d49dcbd04132ddc95
2c69d49843146dd076908dc2f235bc179c378ae0
refs/heads/main
2023-03-19T11:28:08.529971
2021-03-05T12:38:40
2021-03-05T12:38:40
344,806,065
0
0
null
null
null
null
UTF-8
Java
false
false
340
java
package com.example.raptor; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; public class Partita3Activity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_partita3); } }
[ "48321600+IvanoiuAlexandruPaul@users.noreply.github.com" ]
48321600+IvanoiuAlexandruPaul@users.noreply.github.com
95fcddcfabead0c7019a1fa41f5f0e070b35300f
81180f928ab2e6af7ad454900f63f55edb546645
/src/main/java/org/dynmap/residence/MetricsLite.java
489222daa9b8352762e61cfb114325108a196073
[]
no_license
Tominous/dynmap-residence
75ace5c5c018915ae98bae07a8b5b1824ddb9560
ab920fa71364363fa51122f1a62d2a0158ebb817
refs/heads/master
2020-05-27T12:14:10.314663
2019-05-25T21:33:57
2019-05-25T21:33:57
188,614,073
1
0
null
2019-05-25T21:32:01
2019-05-25T21:32:00
null
UTF-8
Java
false
false
14,308
java
/* * Copyright 2011-2013 Tyler Blair. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * The views and conclusions contained in the software and documentation are those of the * authors and contributors and should not be interpreted as representing official policies, * either expressed or implied, of anybody else. */ package org.dynmap.residence; import org.bukkit.Bukkit; import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.scheduler.BukkitTask; import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; import java.net.Proxy; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; import java.util.UUID; import java.util.logging.Level; public class MetricsLite { /** * The current revision number */ private final static int REVISION = 6; /** * The base url of the metrics domain */ private static final String BASE_URL = "http://mcstats.org"; /** * The url used to report a server's status */ private static final String REPORT_URL = "/report/%s"; /** * Interval of time to ping (in minutes) */ private final static int PING_INTERVAL = 10; /** * The plugin this metrics submits for */ private final Plugin plugin; /** * The plugin configuration file */ private final YamlConfiguration configuration; /** * The plugin configuration file */ private final File configurationFile; /** * Unique server id */ private final String guid; /** * Debug mode */ private final boolean debug; /** * Lock for synchronization */ private final Object optOutLock = new Object(); /** * Id of the scheduled task */ private volatile BukkitTask task = null; public MetricsLite(Plugin plugin) throws IOException { if (plugin == null) { throw new IllegalArgumentException("Plugin cannot be null"); } this.plugin = plugin; // load the config configurationFile = getConfigFile(); configuration = YamlConfiguration.loadConfiguration(configurationFile); // add some defaults configuration.addDefault("opt-out", false); configuration.addDefault("guid", UUID.randomUUID().toString()); configuration.addDefault("debug", false); // Do we need to create the file? if (configuration.get("guid", null) == null) { configuration.options().header("http://mcstats.org").copyDefaults(true); configuration.save(configurationFile); } // Load the guid then guid = configuration.getString("guid"); debug = configuration.getBoolean("debug", false); } /** * Start measuring statistics. This will immediately create an async repeating task as the plugin and send * the initial data to the metrics backend, and then after that it will post in increments of * PING_INTERVAL * 1200 ticks. * * @return True if statistics measuring is running, otherwise false. */ public boolean start() { synchronized (optOutLock) { // Did we opt out? if (isOptOut()) { return false; } // Is metrics already running? if (task != null) { return true; } // Begin hitting the server with glorious data task = plugin.getServer().getScheduler().runTaskTimerAsynchronously(plugin, new Runnable() { private boolean firstPost = true; public void run() { try { // This has to be synchronized or it can collide with the disable method. synchronized (optOutLock) { // Disable Task, if it is running and the server owner decided to opt-out if (isOptOut() && task != null) { task.cancel(); task = null; } } // We use the inverse of firstPost because if it is the first time we are posting, // it is not a interval ping, so it evaluates to FALSE // Each time thereafter it will evaluate to TRUE, i.e PING! postPlugin(!firstPost); // After the first post we set firstPost to false // Each post thereafter will be a ping firstPost = false; } catch (IOException e) { if (debug) { Bukkit.getLogger().log(Level.INFO, "[Metrics] " + e.getMessage()); } } } }, 0, PING_INTERVAL * 1200); return true; } } /** * Has the server owner denied plugin metrics? * * @return true if metrics should be opted out of it */ public boolean isOptOut() { synchronized(optOutLock) { try { // Reload the metrics file configuration.load(getConfigFile()); } catch (IOException ex) { if (debug) { Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); } return true; } catch (InvalidConfigurationException ex) { if (debug) { Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); } return true; } return configuration.getBoolean("opt-out", false); } } /** * Enables metrics for the server by setting "opt-out" to false in the config file and starting the metrics task. * * @throws java.io.IOException */ public void enable() throws IOException { // This has to be synchronized or it can collide with the check in the task. synchronized (optOutLock) { // Check if the server owner has already set opt-out, if not, set it. if (isOptOut()) { configuration.set("opt-out", false); configuration.save(configurationFile); } // Enable Task, if it is not running if (task == null) { start(); } } } /** * Disables metrics for the server by setting "opt-out" to true in the config file and canceling the metrics task. * * @throws java.io.IOException */ public void disable() throws IOException { // This has to be synchronized or it can collide with the check in the task. synchronized (optOutLock) { // Check if the server owner has already set opt-out, if not, set it. if (!isOptOut()) { configuration.set("opt-out", true); configuration.save(configurationFile); } // Disable Task, if it is running if (task != null) { task.cancel(); task = null; } } } /** * Gets the File object of the config file that should be used to store data such as the GUID and opt-out status * * @return the File object for the config file */ public File getConfigFile() { // I believe the easiest way to get the base folder (e.g craftbukkit set via -P) for plugins to use // is to abuse the plugin object we already have // plugin.getDataFolder() => base/plugins/PluginA/ // pluginsFolder => base/plugins/ // The base is not necessarily relative to the startup directory. File pluginsFolder = plugin.getDataFolder().getParentFile(); // return => base/plugins/PluginMetrics/config.yml return new File(new File(pluginsFolder, "PluginMetrics"), "config.yml"); } /** * Generic method that posts a plugin to the metrics website */ private void postPlugin(boolean isPing) throws IOException { // Server software specific section PluginDescriptionFile description = plugin.getDescription(); String pluginName = description.getName(); boolean onlineMode = Bukkit.getServer().getOnlineMode(); // TRUE if online mode is enabled String pluginVersion = description.getVersion(); String serverVersion = Bukkit.getVersion(); int playersOnline = Bukkit.getServer().getOnlinePlayers().length; // END server software specific section -- all code below does not use any code outside of this class / Java // Construct the post data final StringBuilder data = new StringBuilder(); // The plugin's description file containg all of the plugin data such as name, version, author, etc data.append(encode("guid")).append('=').append(encode(guid)); encodeDataPair(data, "version", pluginVersion); encodeDataPair(data, "server", serverVersion); encodeDataPair(data, "players", Integer.toString(playersOnline)); encodeDataPair(data, "revision", String.valueOf(REVISION)); // New data as of R6 String osname = System.getProperty("os.name"); String osarch = System.getProperty("os.arch"); String osversion = System.getProperty("os.version"); String java_version = System.getProperty("java.version"); int coreCount = Runtime.getRuntime().availableProcessors(); // normalize os arch .. amd64 -> x86_64 if (osarch.equals("amd64")) { osarch = "x86_64"; } encodeDataPair(data, "osname", osname); encodeDataPair(data, "osarch", osarch); encodeDataPair(data, "osversion", osversion); encodeDataPair(data, "cores", Integer.toString(coreCount)); encodeDataPair(data, "online-mode", Boolean.toString(onlineMode)); encodeDataPair(data, "java_version", java_version); // If we're pinging, append it if (isPing) { encodeDataPair(data, "ping", "true"); } // Create the url URL url = new URL(BASE_URL + String.format(REPORT_URL, encode(pluginName))); // Connect to the website URLConnection connection; // Mineshafter creates a socks proxy, so we can safely bypass it // It does not reroute POST requests so we need to go around it if (isMineshafterPresent()) { connection = url.openConnection(Proxy.NO_PROXY); } else { connection = url.openConnection(); } connection.setDoOutput(true); // Write the data final OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream()); writer.write(data.toString()); writer.flush(); // Now read the response final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); final String response = reader.readLine(); // close resources writer.close(); reader.close(); if (response == null || response.startsWith("ERR")) { throw new IOException(response); //Throw the exception } } /** * Check if mineshafter is present. If it is, we need to bypass it to send POST requests * * @return true if mineshafter is installed on the server */ private boolean isMineshafterPresent() { try { Class.forName("mineshafter.MineServer"); return true; } catch (Exception e) { return false; } } /** * <p>Encode a key/value data pair to be used in a HTTP post request. This INCLUDES a & so the first * key/value pair MUST be included manually, e.g:</p> * <code> * StringBuffer data = new StringBuffer(); * data.append(encode("guid")).append('=').append(encode(guid)); * encodeDataPair(data, "version", description.getVersion()); * </code> * * @param buffer the stringbuilder to append the data pair onto * @param key the key value * @param value the value */ private static void encodeDataPair(final StringBuilder buffer, final String key, final String value) throws UnsupportedEncodingException { buffer.append('&').append(encode(key)).append('=').append(encode(value)); } /** * Encode text as UTF-8 * * @param text the text to encode * @return the encoded text, as UTF-8 */ private static String encode(final String text) throws UnsupportedEncodingException { return URLEncoder.encode(text, "UTF-8"); } }
[ "mike@primmhome.com" ]
mike@primmhome.com
352381412223f9e48b8d74cc85adff5b218bce59
bbae19a1c2fb145a73cbea88d856e210744107bf
/src/chapter3/ReenterLock.java
f0b3f6eec1ede531ab59b3d3b181406e90505cc1
[]
no_license
leige6/java_study
648f3e805898b236fa9a39e71779899bc7abaf38
9ab4c06a167e3da62c8acff3f7743a954c72e200
refs/heads/master
2021-01-01T18:09:09.445427
2018-04-26T02:56:51
2018-04-26T02:56:51
98,259,198
0
0
null
null
null
null
UTF-8
Java
false
false
862
java
package chapter3; import java.util.concurrent.locks.ReentrantLock; /** * оп╚в╦Э * Created by 13 on 2017/5/5. */ public class ReenterLock implements Runnable { public static ReentrantLock lock = new ReentrantLock(); public static int i = 0; @Override public void run() { for (int j = 0; j < 1000000; j++) { lock.lock(); try { i++; } finally { lock.unlock(); } } } public static void main(String args[]) throws InterruptedException { ReenterLock reenterLock = new ReenterLock(); Thread thread1 = new Thread(reenterLock); Thread thread2 = new Thread(reenterLock); thread1.start(); thread2.start(); thread1.join(); thread2.join(); System.out.println(i); } }
[ "yourleige@163.com" ]
yourleige@163.com
96386cd4777f291f46e5be617947dd7bcf973877
3ac4717262bcea10c023df18c935a117c96abb0c
/limits-service/src/main/java/com/microservices/limitsservice/bean/LimitConfiguration.java
7171c81d44efc9db2552f4a244c7c3eeb6229723
[]
no_license
morkvaivan/example-of-microservices-in-spring
2f1d73fe154198c4a9f5986742c379201a64fdc3
221d7641a44a1c3eaff02ddf2400849d4f3855f9
refs/heads/master
2022-04-23T22:36:34.714246
2020-04-24T15:43:09
2020-04-24T15:43:09
256,280,841
0
0
null
null
null
null
UTF-8
Java
false
false
423
java
package com.microservices.limitsservice.bean; public class LimitConfiguration { private int maximum; private int minimum; protected LimitConfiguration() {} public LimitConfiguration(int maximum, int minimum) { this.maximum = maximum; this.minimum = minimum; } public int getMaximum() { return maximum; } public int getMinimum() { return minimum; } }
[ "morkvaivan@icloud.com" ]
morkvaivan@icloud.com