blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
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
sequencelengths
1
1
author_id
stringlengths
0
352
e73c1510c9c778d4ae052378e3f88b8dbc3deb39
cfb306a27c754f0152f2fa379f7f5ef7d5ad258d
/src/com/mongoprocessor/types/CollectionPOJODescriptor.java
3ea2fe11599142b781eaa6b78c94612a2e76ef82
[]
no_license
ops-gaurav/Mongo-Schema-to-POJO
345e2e0bb73b8ff33b5efe042566318d7b0d5d5b
4754f3bd986e42a2bfc268d697b8f59906792ad2
refs/heads/master
2022-11-11T02:47:12.258167
2016-06-26T13:48:57
2016-06-26T13:48:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,149
java
package com.mongoprocessor.types; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * a simple plain old java object representing the Collection Description to be used by the * <code>CollectionCodeGenerator</code> to easily generate the java code * @author gaurav */ public class CollectionPOJODescriptor { public int rootPropertyCounter = 0; public int totalPropertyCounter = 0; public List<MongoElement> rootElementNames = new ArrayList<>(); public Map<MongoElement, List<MongoElement>> nestedDocuments = new HashMap<>(); public Map<MongoElement, List<MongoElement>> nestedArrays = new HashMap<>(); @Override public String toString () { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("Total "+ totalPropertyCounter +" properties in this collection\n"); stringBuilder.append("Root contains "+ rootPropertyCounter + " properties\n"); stringBuilder.append("Collection Structure\n"); stringBuilder.append("root\n"); rootElementNames.forEach(consumer -> { if (consumer.type != DocumentTypes.DOC_ARRAY || consumer.type != DocumentTypes.NESTED_DOCUMENT || consumer.type != DocumentTypes.RAW_ARRAY) stringBuilder.append("\t"+ consumer.name+"\n"); }); rootElementNames.forEach(consumer -> { if (consumer.type == DocumentTypes.NESTED_DOCUMENT) { stringBuilder.append("\t"+ consumer.name +"\n"); nestedDocuments.get(consumer).forEach (consumer2 -> { stringBuilder.append("\t\t"+ consumer2.name); }) ; stringBuilder.append("\n"); } else if (consumer.type == DocumentTypes.DOC_ARRAY) { stringBuilder.append("\t"+ consumer.name +"\n"); nestedArrays.get(consumer).forEach(consumer2 -> { stringBuilder.append("\t\t"+ consumer2.name); }); stringBuilder.append("\n"); } }); return stringBuilder.toString(); } }
6b3dee33665fd8acd7f782ade08e4e16ced9aa0f
8f7e571b09e0d7ce92d24e882f8553ac5482e8a0
/src/main/java/com/example/hystrix/model/Employee.java
d96d09b785d9ca3d9a0afb962c9822b6d18fdd58
[]
no_license
chphakphoom/hystrix
eb6583881604d244a66d293f22ed72847c46b173
f3b22ef17a2b04dad3e1d744bd83372f33216db8
refs/heads/master
2020-05-01T04:58:07.505275
2019-03-24T07:05:52
2019-03-24T07:05:52
177,288,329
0
0
null
null
null
null
UTF-8
Java
false
false
533
java
package com.example.hystrix.model; public class Employee { private int id; private String name; private String position; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPosition() { return position; } public void setPosition(String position) { this.position = position; } }
bdc641081cd480fdf6ba7b4f77daf0e272d4f102
82812958f91d9e2151f7b2372998ae5b3ec88a4e
/app/src/main/java/com/iplant/model/ToolBox.java
03d1bdcec0216a40b365e16c4eba47d2b11b9ecb
[]
no_license
406036741/iplant-master
3996dbf66db516552dcb69dab4938475aba14150
13e1d19b16eef744de8b2cbb7c737692b10fea35
refs/heads/master
2020-09-13T02:40:55.691149
2019-11-20T07:53:52
2019-11-20T07:53:52
222,634,895
0
0
null
null
null
null
UTF-8
Java
false
false
2,071
java
package com.iplant.model; import com.iplant.presenter.db.DBBase; import com.j256.ormlite.field.DatabaseField; import com.j256.ormlite.table.DatabaseTable; @DatabaseTable(tableName = "tb_toolbox") public class ToolBox extends DBBase<ToolBox> { private static final long serialVersionUID = -100133833040042611L; //编号 @DatabaseField(generatedId = true) public int id; //用户id @DatabaseField public String userid; //用户id @DatabaseField public int companyid; //对应的 分组ID @DatabaseField public int groupType; //分组名称 @DatabaseField public String groupName; //有多少条未读消息 @DatabaseField public int unReadCount; //模块名称 @DatabaseField public String name; //icon图片地址 @DatabaseField public String imgUrl; //链接地址 @DatabaseField public String linkUrl; //模块ID @DatabaseField public String moduleId; //打开方式 @DatabaseField public String runType; @Override protected ToolBox getMySelf() { // TODO Auto-generated method stub return this; } @Override public boolean equals(Object o) { ToolBox newBox = (ToolBox) o; String a= newBox.linkUrl.substring(0,newBox.linkUrl.lastIndexOf("&")); String b=linkUrl.substring(0,linkUrl.lastIndexOf("&")); if (newBox.groupName.equals(groupName) && newBox.unReadCount == unReadCount && newBox.name.equals(name) && newBox.imgUrl.equalsIgnoreCase(imgUrl) && newBox.linkUrl.substring(0,newBox.linkUrl.lastIndexOf("&")).equalsIgnoreCase(linkUrl.substring(0,linkUrl.lastIndexOf("&"))) && newBox.moduleId.equalsIgnoreCase(moduleId) && newBox.runType.equalsIgnoreCase(runType) && newBox.userid.equalsIgnoreCase(userid) && newBox.companyid==companyid ) { return true; } return false; } }
0fac8720fe2698bfbf47e13b5ffffe4fd2a26e35
6e32e038be7f7d0151f7d5088291282215a1f64d
/src/main/java/shell/util/Rand.java
0e53725ca86a2f91545f147f502fc6cab0144d13
[]
no_license
gutomarzagao/simple-genetic-algorithm
aff9c347cbc0bd9bdd26f87ff4b88119e2c9ba28
5af84aff9019bf72b0022c119afdd8fb87aa97c4
refs/heads/master
2020-09-20T17:10:29.039955
2016-09-12T03:23:40
2016-09-12T03:23:40
67,821,552
0
0
null
null
null
null
UTF-8
Java
false
false
850
java
package shell.util; import java.util.List; import java.util.Random; public class Rand { private static Random random = new Random(); public static boolean getBoolean() { return random.nextBoolean(); } public static boolean getBoolean(double probability) { if (probability < 0 || probability > 1) { throw new IllegalArgumentException("Probability should be a number between 0 and 1"); } return random.nextDouble() < probability; } public static int getInt(int lowerValue, int upperValue) { if (upperValue < lowerValue || upperValue - lowerValue < 0) { throw new IllegalArgumentException("Lower value cannot be greater than upper value"); } return random.nextInt(upperValue - lowerValue + 1) + lowerValue; } public static <T> T getListElement(List<T> list) { return list.get(random.nextInt(list.size())); } }
5c853b9856088e1fc0bf8a72305afec5cb645753
0e0cf12004d4e30705765c9b1f2cf8cfeb45c43e
/src/main/java/com/sample/demo/ProductServicePortalApplication.java
4782df479d2b5e283a791f5bbdfdc6c903aca008
[]
no_license
Janbee-Shaik/ProductServicePortal
870d41d53100d1d224f7a585725283b60ac0b904
a133f422ecb87ce21f1b0fd126fff42b7aaefc91
refs/heads/master
2022-10-10T18:03:52.613133
2020-06-10T11:11:14
2020-06-10T11:11:14
271,253,526
0
0
null
null
null
null
UTF-8
Java
false
false
336
java
package com.sample.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class ProductServicePortalApplication { public static void main(String[] args) { SpringApplication.run(ProductServicePortalApplication.class, args); } }
3ea8758021decd1eaa83481d1650647975b08d04
c3e55b0c400cd2bd01e3173268d05f012c998d8c
/src/main/java/br/com/southsystem/cooperativismo/controller/SessionVoteController.java
bf6fc35342a938e9588203a4e3a79d22a7a29b4a
[]
no_license
mariosergiosantos/desafio-back-votos
4b4c4a373d069ab588c1e06c7deacef04cc7b408
a898728357b06dbc66d1b7437b8626e7ae8cc750
refs/heads/main
2023-06-15T20:45:46.311955
2021-07-07T16:46:51
2021-07-07T16:46:51
382,055,872
1
0
null
null
null
null
UTF-8
Java
false
false
1,252
java
package br.com.southsystem.cooperativismo.controller; import br.com.southsystem.cooperativismo.domain.model.SessionVote; import br.com.southsystem.cooperativismo.domain.request.SessionVoteRequest; import br.com.southsystem.cooperativismo.service.SessionVoteService; import io.swagger.v3.oas.annotations.Operation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.util.List; @RestController public class SessionVoteController { @Autowired private SessionVoteService sessionVoteService; @Operation(summary = "List associate") @GetMapping("/v1/session") public List<SessionVote> getAllSessions() { return sessionVoteService.findAll(); } @Operation(summary = "Open session") @PostMapping("/v1/session/open") public SessionVote openSession(@RequestBody @Valid SessionVoteRequest sessionVoteRequest) { return sessionVoteService.openSession(sessionVoteRequest); } @Operation(summary = "Close session") @PutMapping("/v1/session/{sessionId}/close") public void closeSession(@PathVariable("sessionId") Long sessionId) { sessionVoteService.closeSession(sessionId); } }
246f85a080e131618e27b5bb30754b473b01e604
5dd0d1b13819e1b1ae4033768760bc63424c4838
/src/main/java/net/skhu/dto/DepartmentMajor.java
ade601f3c17da23c6b0352ab52ca3524edf7671c
[]
no_license
jeenie/graduation_system
0eb2b07f9ff6489ac9f975cfe76caf59cc32bbfd
ee5c8b1ea5b8b11ed98fef5dea0a977934892716
refs/heads/master
2022-07-06T15:17:29.671415
2020-02-10T01:22:26
2020-02-10T01:22:26
148,599,229
1
4
null
2021-04-26T18:56:21
2018-09-13T07:27:39
Java
UTF-8
Java
false
false
554
java
package net.skhu.dto; //18학번 //학부 내 전공 객체 public class DepartmentMajor { int majorId; String majorName; int departmentId; public int getMajorId() { return majorId; } public void setMajorId(int majorId) { this.majorId = majorId; } public String getMajorName() { return majorName; } public void setMajorName(String majorName) { this.majorName = majorName; } public int getDepartmentId() { return departmentId; } public void setDepartmentId(int departmentId) { this.departmentId = departmentId; } }
0d627d13e87591ede00c7fe84c0c81ad5ec419d1
1330a304fa09fc4bbed612a34958f77d353cbaf6
/src/main/java/com/zyp/o2o/entity/ProductImg.java
e86ef3c2d2793ac65738782b81eea775ebf8cbd5
[ "Apache-2.0" ]
permissive
zouyip/o2o
24c8dc71bff81db3d17f852783b2be0cc96e6226
9e0fddf569d738030bbe8b9dfe47334ab29a4b51
refs/heads/master
2021-08-08T11:25:42.354206
2017-11-10T07:19:09
2017-11-10T07:19:09
110,213,968
0
0
null
null
null
null
UTF-8
Java
false
false
1,433
java
package com.zyp.o2o.entity; import java.util.Date; /** * 商品详情图实体类 * * Created by Administrator on 2017/11/10. */ public class ProductImg { //主键ID private Long productImgId; //图片地址 private String imgAddr; //图片简介 private String imgDesc; //权重,越大越排前显示 private Integer priority; //创建时间 private Date createTime; //标明是属于哪个商品的图片 private Long productId; public Long getProductImgId() { return productImgId; } public void setProductImgId(Long productImgId) { this.productImgId = productImgId; } public String getImgAddr() { return imgAddr; } public void setImgAddr(String imgAddr) { this.imgAddr = imgAddr; } public String getImgDesc() { return imgDesc; } public void setImgDesc(String imgDesc) { this.imgDesc = imgDesc; } public Integer getPriority() { return priority; } public void setPriority(Integer priority) { this.priority = priority; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Long getProductId() { return productId; } public void setProductId(Long productId) { this.productId = productId; } }
8919b6f4bc9a772ee7a2a29111ca31384012ba33
b00d5e8213be6a21d8b38bbceb6203c8154b886b
/content/Day2/WordCount.java
06894c6ce9b9a98fbb65923a386fe5ee27164368
[]
no_license
Vivek89/SparkTraining
4fa05ff65bc4f327289f71f0d8469e2a53ff13df
1df8ef126b0bcdf752e5c1af5e1b127b30883a23
refs/heads/master
2021-01-23T07:10:34.655229
2017-03-31T10:14:09
2017-03-31T10:14:09
86,416,856
0
0
null
null
null
null
UTF-8
Java
false
false
1,949
java
package com.evenkat; import org.apache.spark.SparkConf; import org.apache.spark.api.java.JavaPairRDD; import org.apache.spark.api.java.JavaRDD; import org.apache.spark.api.java.JavaSparkContext; import org.apache.spark.api.java.function.FlatMapFunction; import org.apache.spark.api.java.function.Function2; import org.apache.spark.api.java.function.PairFunction; import scala.Tuple2; import java.util.Arrays; public class WordCount { private static final FlatMapFunction<String, String> WORDS_EXTRACTOR = new FlatMapFunction<String, String>() { @Override public Iterable<String> call(String s) throws Exception { return Arrays.asList(s.split(" ")); } }; private static final PairFunction<String, String, Integer> WORDS_MAPPER = new PairFunction<String, String, Integer>() { @Override public Tuple2<String, Integer> call(String s) throws Exception { return new Tuple2<String, Integer>(s, 1); } }; private static final Function2<Integer, Integer, Integer> WORDS_REDUCER = new Function2<Integer, Integer, Integer>() { @Override public Integer call(Integer a, Integer b) throws Exception { return a + b; } }; public static void main(String[] args) { if (args.length < 1) { System.err.println("Please provide the input file full path as argument"); System.exit(0); } SparkConf conf = new SparkConf().setAppName("com.evenkat.WordCount").setMaster("local"); JavaSparkContext context = new JavaSparkContext(conf); JavaRDD<String> file = context.textFile(args[0]); JavaRDD<String> words = file.flatMap(WORDS_EXTRACTOR); JavaPairRDD<String, Integer> pairs = words.mapToPair(WORDS_MAPPER); JavaPairRDD<String, Integer> counter = pairs.reduceByKey(WORDS_REDUCER); counter.saveAsTextFile(args[1]); } }
9485d70196c1fcefa086fa7e3e5306aa47928124
037572ccca0bf3490351b6fd7a15d6a57715c22a
/app/src/main/java/com/example/rxjavawithmvvm/service/MoviesDataService.java
2825f2ce3da6b6ed013c8f5ec9dbfd047787d7ab
[]
no_license
PrernaaSurbhi/RxJavaWithMvvm
52f7ef5899c3cbef63fc7691dfbe63e0ea846879
1145febd7439645b5f47f87e7a2b398703f4fb37
refs/heads/master
2023-01-08T00:23:11.207547
2020-11-01T18:09:45
2020-11-01T18:09:45
309,157,721
0
0
null
null
null
null
UTF-8
Java
false
false
347
java
package com.example.rxjavawithmvvm.service; import com.example.rxjavawithmvvm.model.MovieDBResponse; import io.reactivex.Observable; import retrofit2.http.GET; import retrofit2.http.Query; public interface MoviesDataService { @GET("movie/popular") Observable<MovieDBResponse> getPopularMoviesWithRx(@Query("api_key") String apiKey); }
c7f7cc6b78e73cdc004a885fa67c71f11a2919ee
5efbe1ce4035df0d4a7aa478ac37fa75aa68025c
/reference no run/com.martinstudio.hiddenrecorder/src/com/google/android/gms/internal/dl.java
2db4033525a78f78ac11c8a75b099d93a1bf3be4
[]
no_license
dat0106/datkts0106
6ec70e6adb90ba36237d4225b5cba80fcbd30343
885c9bec5b5cd3c4d677d8d579cd91cf7fd6d2e5
refs/heads/master
2016-08-05T08:24:11.701355
2014-08-01T04:35:12
2014-08-01T04:35:59
15,329,353
1
1
null
null
null
null
UTF-8
Java
false
false
1,533
java
package com.google.android.gms.internal; import android.os.RemoteException; import com.google.android.gms.ads.purchase.InAppPurchase; public class dl implements InAppPurchase { private final dc pg; public dl(dc paramdc) { this.pg = paramdc; } public String getProductId() { try { str = this.pg.getProductId(); str = str; } catch (RemoteException localRemoteException) { for (;;) { String str; ev.c("Could not forward getProductId to InAppPurchase", localRemoteException); Object localObject = null; } } return str; } public void recordPlayBillingResolution(int paramInt) { try { this.pg.recordPlayBillingResolution(paramInt); return; } catch (RemoteException localRemoteException) { for (;;) { ev.c("Could not forward recordPlayBillingResolution to InAppPurchase", localRemoteException); } } } public void recordResolution(int paramInt) { try { this.pg.recordResolution(paramInt); return; } catch (RemoteException localRemoteException) { for (;;) { ev.c("Could not forward recordResolution to InAppPurchase", localRemoteException); } } } } /* Location: E:\android\Androidvn\dex2jar\classes_dex2jar.jar * Qualified Name: com.google.android.gms.internal.dl * JD-Core Version: 0.7.0.1 */
d3d3e2c2aa8d3576bb1c172c2d98437aa7378c39
ff917b41748660411ff6af33e12cdc4050d85e8d
/src/ASN1/ASNObj.java
778d2dde3a5a0b406eacb4e7e90a24d01ceb6b86
[]
no_license
aalrubaye/Elliptic-Curve-Algorithm
9b9a6bcbdcce170171dde21e51d96077518fc3b2
9c3d1c872329a107f7f29757912ff20afb4434d5
refs/heads/master
2021-01-12T01:01:37.647204
2017-01-08T09:11:42
2017-01-08T09:11:42
78,332,406
0
0
null
null
null
null
UTF-8
Java
false
false
421
java
package ASN1; public abstract class ASNObj{ public abstract Encoder getEncoder(); public byte[] encode(){ //System.out.println("will encode: " +this); return getEncoder().getBytes(); } public abstract Object decode(Decoder dec) throws ASN1DecoderFail; public ASNObj instance() throws CloneNotSupportedException{return (ASNObj) clone();} }
c8623bff7925971d5b5299add22e7f7d18c41c99
43b74b0b0f5e701b04dde4eadcef56123fccbf8a
/src/main/java/com/pubiapplication/app/Facebookservlet.java
ae699f346c96e99ed0f48d46013f8a1215753348
[]
no_license
Mikroplu/Projekt
417f34dd16904769b609851ba439d09e9e4099ce
a882e6c2899b04ef1b25c26803229140b266f619
refs/heads/master
2016-08-04T23:42:02.065856
2014-04-24T12:28:37
2014-04-24T12:28:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
614
java
package com.pubiapplication.app; import com.restfb.*; import com.restfb.types.Page; import com.restfb.types.User; public class Facebookservlet { private static final String MY_ACCESS_TOKEN = "CAACEdEose0cBAAIOWyYnvK6FDT1sWKTztKIfQtO7bKzOyRZBujlubfjiBNAvp8jx36eXQnsXMWIrwBZAFVEjYj3RYgLZBPM0aYRwGbQ8tZBpiZARdCE7Wj2uAaEUqSBNaDCvZBJwSdsohq7AFrZCUYw28IZC46u7AkhRBWRJOmnEEZBDGmKOpbz95WUeo6PAyr7CNjZAce85Mn8wZDZD"; FacebookClient facebookClient = new DefaultFacebookClient(MY_ACCESS_TOKEN); User user = facebookClient.fetchObject("me", User.class); Page page = facebookClient.fetchObject("cocacola", Page.class); }
af91658d5d6aacde79f39b3dc2543dff924fac70
3f6d82c0c2be966fe723fa4a3c6b5f540231e265
/server/src/main/java/pl/edu/agh/sius/server/pojo/OperationStatus.java
bd938c65f2cddf2adff919952030e52e97b201cc
[]
no_license
bburkot/SIUS
0e6f9a5a8c9dd843f6551796a1822789d1dc7d76
d1e26cf4a9c32bed0e324574fe30ee673f692228
refs/heads/master
2016-08-05T05:52:32.251845
2015-06-08T10:11:09
2015-06-08T10:11:09
35,028,902
0
0
null
null
null
null
UTF-8
Java
false
false
312
java
package pl.edu.agh.sius.server.pojo; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlEnumValue; @XmlEnum public enum OperationStatus{ @XmlEnumValue("SUCCEED") SUCCEED, @XmlEnumValue("WARN") WARN, @XmlEnumValue("ERROR") ERROR; private OperationStatus(){} }
293565ab852531715483eba2b08a2b338acd74ee
334f9b3f5fcca7faa448b576b08ae8f6c186cfae
/Documents/NetBeansProjects/TrabajoCorba/src/InformacionApp/Informacion.java
c393fcb36473ab2d71e17a078f3d0a3c63e539fb
[]
no_license
Darmask/TrabajoCorba
477d3b2f5672ff7e2e94299454e7d2be9338ed9c
7003d7d6e73572b6cede62c064225c1b0587b49f
refs/heads/master
2020-05-20T18:23:38.266588
2019-05-22T00:17:42
2019-05-22T00:17:42
185,705,110
0
0
null
null
null
null
UTF-8
Java
false
false
316
java
package InformacionApp; /** * InformacionApp/Informacion.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from informacion.idl */ public interface Informacion extends InformacionOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity { } // interface Informacion
[ "Tamayo@DESKTOP-MJ58J5A" ]
Tamayo@DESKTOP-MJ58J5A
8af46b536e980655b2e34de0487b1341eeeceebb
851e4e718a0bdb3814736da0652ba6a9fddfefc4
/src/bsclient/changeStringScreen.java
05c1ae9050b5e6b7ba955c3639d30b13e8955884
[]
no_license
lhalla/kayttoliittymat
307121cbc064fa31bfa13ab1b2abb06b301d93fb
7fc0a11d3e53b9df5e66af348e8386a2cd27997e
refs/heads/master
2021-03-27T16:45:22.775194
2018-04-30T18:28:51
2018-04-30T18:28:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,644
java
package bsclient; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Font; import java.awt.Frame; import java.awt.GridLayout; import java.awt.Dialog.ModalityType; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.WindowConstants; public class changeStringScreen { JDialog dialog; JPanel mainPanel = new JPanel(); JPanel buttonsPanel = new JPanel(); ButtonListener buttonlistener = new ButtonListener(); private JButton confirmButton = new JButton("VAHVISTA"); private JButton cancelButton = new JButton("PERU"); private String changedString = ""; JTextField changer; public changeStringScreen(Frame frame, String message1) { dialog = new JDialog (frame, message1); dialog.setSize(500, 500); } public String changeText(String message){ dialog.getContentPane().setLayout(new BorderLayout()); dialog.setModal (true); dialog.setAlwaysOnTop (true); dialog.setModalityType (ModalityType.APPLICATION_MODAL); dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); dialog.setResizable(false); GridLayout grid= new GridLayout(0,1); mainPanel.setLayout(grid); mainPanel.setBackground(Color.WHITE); dialog.add(mainPanel); JLabel messageLabel= new JLabel(); messageLabel.setText(message); mainPanel.add(messageLabel); changer=new JTextField(); mainPanel.add(changer); confirmButton.setBackground(new Color(50, 200, 45)); confirmButton.setForeground(Color.WHITE); confirmButton.setFocusPainted(false); confirmButton.setFont(new Font("Tahoma", Font.BOLD, 12)); cancelButton.setBackground(new Color(50, 200, 45)); cancelButton.setForeground(Color.WHITE); cancelButton.setFocusPainted(false); cancelButton.setFont(new Font("Tahoma", Font.BOLD, 12)); confirmButton.addActionListener(buttonlistener); cancelButton.addActionListener(buttonlistener); mainPanel.add(confirmButton); mainPanel.add(cancelButton); dialog.setLocationRelativeTo(null); dialog.setVisible(true); dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); dialog.dispose(); return changedString; } private class ButtonListener implements ActionListener{ public void actionPerformed(ActionEvent e) { if(e.getSource() == confirmButton) { changedString=changer.getText(); dialog.setVisible(false); } if(e.getSource() == cancelButton) { dialog.setVisible(false); } } } }
19158b62a5d771ff5f653bf30eeb005bfc9a9a14
b384fcba2cdc637dd89cc47ab1b8a1776a1bf8f9
/src/main/java/com/young/boot/bootdemo/dao/MetaVoMapper.java
8e7cbeaab3b00b5d63c51fa700a86629bf4a8dbd
[]
no_license
mrziyoung/MySpringBootDemo
204a13c5bc6e0afee68e9596ba9023e48baa99bf
d8cc5169ccc79c8fcdf6ae8269c091b33678a8d2
refs/heads/master
2020-03-17T17:13:51.873689
2019-01-17T04:30:08
2019-01-17T04:30:08
133,779,992
0
0
null
null
null
null
UTF-8
Java
false
false
1,092
java
package com.young.boot.bootdemo.dao; import com.young.boot.bootdemo.dto.MetaDto; import com.young.boot.bootdemo.model.vo.MetaVo; import com.young.boot.bootdemo.model.vo.MetaVoExample; import java.util.List; import java.util.Map; import org.apache.ibatis.annotations.Param; public interface MetaVoMapper { int countByExample(MetaVoExample example); int deleteByExample(MetaVoExample example); int deleteByPrimaryKey(Integer mid); int insert(MetaVo record); int insertSelective(MetaVo record); List<MetaVo> selectByExample(MetaVoExample example); MetaVo selectByPrimaryKey(Integer mid); int updateByExampleSelective(@Param("record") MetaVo record, @Param("example") MetaVoExample example); int updateByExample(@Param("record") MetaVo record, @Param("example") MetaVoExample example); int updateByPrimaryKeySelective(MetaVo record); int updateByPrimaryKey(MetaVo record); List<MetaDto> selectFromSql(Map<String,Object> paraMap); MetaDto selectDtoByNameAndType(String name, String type); Integer countWithSql(Integer mid); }
874eed49711829fcd4b765ca6da23c29c2323c34
df53b45290400859d4a69718c052302c745969a1
/src/test/java/pageObject/Login_Page.java
a72bf1bc5d9cccdfa17f364c91339accc111164b
[]
no_license
jewelny2011/August2020D
2b84190226578129730a8cef6bb3090cafd9983c
76785b11c9bfdf49de5a8b22948d72ea41831d78
refs/heads/main
2023-03-19T10:01:41.389742
2021-03-19T08:47:39
2021-03-19T08:47:39
344,651,502
0
0
null
2021-03-19T08:47:40
2021-03-05T00:49:49
Gherkin
UTF-8
Java
false
false
49
java
package pageObject; public class Login_Page { }
db0197de665fd3dabc3af937d17a1a44435ed4ae
930c207e245c320b108e9699bbbb036260a36d6a
/BRICK-Jackson-JsonLd/generatedCode/src/main/java/brickschema/org/schema/_1_0_2/Brick/IVAV_Zone_Air_Temperature_Sensor.java
36bf6328a83ff80526aa5650fce479cbeb0b66ff
[]
no_license
InnovationSE/BRICK-Generated-By-OLGA
24d278f543471e1ce622f5f45d9e305790181fff
7874dfa450a8a2b6a6f9927c0f91f9c7d2abd4d2
refs/heads/master
2021-07-01T14:13:11.302860
2017-09-21T12:44:17
2017-09-21T12:44:17
104,251,784
1
0
null
null
null
null
UTF-8
Java
false
false
1,141
java
/** * This file is automatically generated by OLGA * @author OLGA * @version 1.0 */ package brickschema.org.schema._1_0_2.Brick; import java.util.ArrayList; import java.util.List; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldId; import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldProperty; import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldType; import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldLink; import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldPropertyType; import brick.jsonld.util.RefId; import brickschema.org.schema._1_0_2.Brick.IVAV_Zone_Temperature_Sensor; import brickschema.org.schema._1_0_2.Brick.IZone_Air_Temperature_Sensor; public interface IVAV_Zone_Air_Temperature_Sensor extends IVAV_Zone_Temperature_Sensor, IZone_Air_Temperature_Sensor { /** * @return RefId */ @JsonIgnore public RefId getRefId(); }
6f1c021f78d539a20854f0255f3ee18e0a11ef50
b8552db83b6de62123a01cc89b6ad816eb8bfd55
/authDemo/src/main/java/com/tcs/authdemo/payload/response/MessageResponse.java
3183ee1645efe430d0d3a1caaa6652f3814ce462
[]
no_license
youngethan4/logreg
5ff1229f2393d08d747f86e3cff5d2bfc2ac97f0
8839d7bd44456c64c3fd0a78e657250fadacccde
refs/heads/master
2023-01-23T11:49:48.322975
2020-12-09T23:31:13
2020-12-09T23:31:13
314,686,557
0
0
null
null
null
null
UTF-8
Java
false
false
303
java
package com.tcs.authdemo.payload.response; public class MessageResponse { private String message; public MessageResponse(String message) { this.message = message; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } }
df152a0083b8e5ecaeab56e59ff50807727e8a1b
38c4f07a54cbd8d9cdeaa156e766082324e2fd12
/newsroot-ui/src/main/java/com/codexperiments/newsroot/manager/twitter/ResultHandler.java
e8c2eee39f4f26a936cabbcb744b630075c8631b
[]
no_license
a-thomas/newsroot
7bc2d1ff1dd96b4449b927dea0527e88c69e2f6e
3ac488eaa0bfc2b6d90678e2a4456227e8ba3c8b
refs/heads/master
2021-01-15T13:29:30.096488
2013-10-12T10:08:28
2013-10-12T10:08:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,706
java
package com.codexperiments.newsroot.manager.twitter; import android.database.Cursor; public class ResultHandler<TTable extends Enum<?> & Table> { private TTable[] mTables; private boolean[] mSelectedTables; private int[][] mIndexes; public ResultHandler(TTable[] pTables) { super(); mTables = pTables; mSelectedTables = new boolean[pTables.length]; mIndexes = new int[mTables.length][]; } public ResultHandler<TTable> select(TTable pTable) { mSelectedTables[pTable.ordinal()] = true; return this; } public void parse(Cursor pCursor, Handle pHandle) { // Build the index of columns to look for in the result set. int lTableCount = mTables.length; for (int i = 0; i < lTableCount; ++i) { if (mSelectedTables[i]) { TTable lTable = mTables[i]; Enum<?>[] lColumns = lTable.columns(); int lColumnCount = lColumns.length; mIndexes[i] = new int[lColumnCount]; for (int j = 0; j < lColumnCount; ++j) { mIndexes[i][j] = pCursor.getColumnIndex(lColumns[j].name()); } } } // Iterate through the result set. Row lRow = new Row(pCursor, mIndexes); pCursor.moveToFirst(); try { while (!pCursor.isAfterLast()) { pHandle.handleRow(lRow, pCursor); pCursor.moveToNext(); } } finally { pCursor.close(); } } public static class Row { private Cursor mCursor; private int[][] mIndexes; protected Row(Cursor pCursor, int[][] pIndexes) { super(); mCursor = pCursor; mIndexes = pIndexes; } protected int getIndex(Enum<?> pTable, Enum<?> pColumn) { return mIndexes[pTable.ordinal()][pColumn.ordinal()]; } protected int getInt(Enum<?> pTable, Enum<?> pColumn) { return mCursor.getInt(mIndexes[pTable.ordinal()][pColumn.ordinal()]); } protected long getLong(Enum<?> pTable, Enum<?> pColumn) { return mCursor.getLong(mIndexes[pTable.ordinal()][pColumn.ordinal()]); } protected String getString(Enum<?> pTable, Enum<?> pColumn) { return mCursor.getString(mIndexes[pTable.ordinal()][pColumn.ordinal()]); } } public interface Handle { public abstract void handleRow(Row pRow, Cursor pCursor); } }
caf31d1ffeb9b896701a090038e796154e04ef63
320698712e741c6beaa18f0226eec0f5344035f4
/app/src/main/java/com/spiritledinc/firebaseuisignin/MainActivity.java
0f63d8d05f4ea38aa184cda5c94cdb13539ffe2d
[]
no_license
wilsonmwiti/FirebaseUiSignin
6341d7481ae267d94df4aad2d3525e6b3571591b
0102352b74b2b1f716bc6691fe05802c0c817ce6
refs/heads/master
2022-06-10T17:57:08.381357
2020-05-09T00:16:33
2020-05-09T00:16:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,943
java
package com.spiritledinc.firebaseuisignin; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.view.inputmethod.EditorInfo; import android.widget.EditText; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import com.facebook.AccessToken; import com.facebook.CallbackManager; import com.facebook.FacebookCallback; import com.facebook.FacebookException; import com.facebook.login.LoginResult; import com.facebook.login.widget.LoginButton; import com.google.android.gms.auth.api.signin.GoogleSignIn; import com.google.android.gms.auth.api.signin.GoogleSignInAccount; import com.google.android.gms.auth.api.signin.GoogleSignInClient; import com.google.android.gms.auth.api.signin.GoogleSignInOptions; import com.google.android.gms.common.api.ApiException; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.AuthCredential; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FacebookAuthProvider; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; public class MainActivity extends AppCompatActivity implements View.OnClickListener { private static final String TAG = "MainActivity"; private static final int RC_SIGN_IN = 432; private FirebaseAuth mAuth; private ProgressBar spinner; private GoogleSignInClient mGoogleSignInClient; private CallbackManager mCallbackManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mAuth = FirebaseAuth.getInstance(); //hide spinner spinner = findViewById(R.id.progressBar); spinner.setVisibility(View.GONE); //allow submit from password edittext EditText edit_txt = findViewById(R.id.fieldPassword); edit_txt.setOnEditorActionListener(new EditText.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { signInEmailPassword(findViewById(android.R.id.content).getRootView()); return true; } return false; } }); // Configure sign-in to request the user's ID, email address, and basic // profile. ID and basic profile are included in DEFAULT_SIGN_IN. GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestEmail() .build(); // Build a GoogleSignInClient with the options specified by gso. mGoogleSignInClient = GoogleSignIn.getClient(this, gso); findViewById(R.id.sign_in_button).setOnClickListener(this); // Initialize Facebook Login button mCallbackManager = CallbackManager.Factory.create(); LoginButton loginButton = findViewById(R.id.login_button); //loginButton.setReadPermissions("email", "public_profile"); loginButton.registerCallback(mCallbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { Log.d(TAG, "facebook:onSuccess:" + loginResult); handleFacebookAccessToken(loginResult.getAccessToken()); updateUI(); } @Override public void onCancel() { Log.d(TAG, "facebook:onCancel"); // ... } @Override public void onError(FacebookException error) { Log.d(TAG, "facebook:onError", error); // ... } }); } @Override public void onStart() { super.onStart(); // Check if user is signed in (non-null) and update UI accordingly. FirebaseUser currentUser = mAuth.getCurrentUser(); Log.d(TAG, String.valueOf(currentUser)); if (currentUser != null) { Intent intent = new Intent(MainActivity.this, MainHome.class); startActivity(intent); } // Check for existing Google Sign In account, if the user is already signed in // the GoogleSignInAccount will be non-null. GoogleSignInAccount account = GoogleSignIn.getLastSignedInAccount(this); if (account != null) { Intent intent = new Intent(MainActivity.this, MainHome.class); startActivity(intent); } } @Override public void onClick(View v) { if (v.getId() == R.id.sign_in_button) signIn(); } private void signIn() { Intent signInIntent = mGoogleSignInClient.getSignInIntent(); startActivityForResult(signInIntent, RC_SIGN_IN); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); // Result returned from launching the Intent from GoogleSignInClient.getSignInIntent(...); if (requestCode == RC_SIGN_IN) { // The Task returned from this call is always completed, no need to attach // a listener. Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data); handleSignInResult(task); } else { // Pass the activity result back to the Facebook SDK mCallbackManager.onActivityResult(requestCode, resultCode, data); } } private void handleSignInResult(Task<GoogleSignInAccount> completedTask) { try { GoogleSignInAccount account = completedTask.getResult(ApiException.class); // Signed in successfully, show authenticated UI. //You can also get the user's email address with getEmail, the user's Google ID (for client-side use) with getId, and an ID token for the user with getIdToken updateUI(); } catch (ApiException e) { // The ApiException status code indicates the detailed failure reason. // Please refer to the GoogleSignInStatusCodes class reference for more information. Log.w(TAG, "signInResult:failed code=" + e.getStatusCode()); Toast.makeText(MainActivity.this, "signInResult:failed code=" + e.getStatusCode(), Toast.LENGTH_SHORT).show(); } } public void register(View view) { Intent intent = new Intent(this, CreateAccount.class); startActivity(intent); } public void signInEmailPassword(View view) { //check user input if (!validate()) { Toast.makeText(getBaseContext(), "Login failed", Toast.LENGTH_LONG).show(); return; } //set spinner to visible spinner = findViewById(R.id.progressBar); spinner.setVisibility(View.VISIBLE); //get email EditText emailEditText = findViewById(R.id.fieldEmail); String email = emailEditText.getText().toString(); //get password EditText passwordEditText = findViewById(R.id.fieldPassword); String password = passwordEditText.getText().toString(); mAuth.signInWithEmailAndPassword(email, password) .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { // Sign in success, update UI with the signed-in user's information spinner.setVisibility(View.GONE); Log.d(TAG, "signInWithEmail:success"); //FirebaseUser user = mAuth.getCurrentUser(); updateUI(); } else { // If sign in fails, display a message to the user. spinner.setVisibility(View.GONE); Log.w(TAG, "signInWithEmail:failure", task.getException()); Toast.makeText(MainActivity.this, "Authentication failed.", Toast.LENGTH_SHORT).show(); } } }); } public boolean validate() { boolean valid = true; EditText emailEditText = findViewById(R.id.fieldEmail); String email = emailEditText.getText().toString(); EditText passwordEditText = findViewById(R.id.fieldPassword); String password = passwordEditText.getText().toString(); if (email.isEmpty() || !android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches()) { emailEditText.setError("enter a valid email address"); valid = false; } else { emailEditText.setError(null); } if (password.isEmpty() || password.length() < 6 || password.length() > 10) { passwordEditText.setError("between 6 and 10 alphanumeric characters"); valid = false; } else { passwordEditText.setError(null); } return valid; } private void handleFacebookAccessToken(AccessToken token) { Log.d(TAG, "handleFacebookAccessToken:" + token); AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken()); mAuth.signInWithCredential(credential) .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { // Sign in success, update UI with the signed-in user's information Log.d(TAG, "signInWithCredential:success"); //FirebaseUser user = mAuth.getCurrentUser(); updateUI(); } else { // If sign in fails, display a message to the user. Log.w(TAG, "signInWithCredential:failure", task.getException()); Toast.makeText(MainActivity.this, "Authentication failed.", Toast.LENGTH_SHORT).show(); } } }); } private void updateUI() { //on successful login from FB, Google, or Email/Pass send user to Home Activity Intent intent = new Intent(MainActivity.this, MainHome.class); startActivity(intent); } }
2c12b13671f487519648b0b4a4a86f3254641eb7
4205f3df652fbe329e45d0cad4418e013936834f
/src/main/java/org/accounting/system/clients/responses/openaire/Total.java
a948f2723630b29c3f12c00714aa10047e7eac24
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
ARGOeu/argo-accounting
f4424be3b9e189c0b239444a4f9c9e9bc57264fb
9f67a1d7d1c487332e526456326a0812e53b7c51
refs/heads/devel
2023-05-30T09:40:16.449066
2023-05-10T07:06:39
2023-05-10T07:06:39
439,306,682
4
1
Apache-2.0
2023-05-10T07:25:44
2021-12-17T11:15:31
Java
UTF-8
Java
false
false
183
java
package org.accounting.system.clients.responses.openaire; import com.fasterxml.jackson.annotation.JsonProperty; public class Total { @JsonProperty("$") public int value; }
3b65bad78aac677c70480d8a385570420d44e659
bacbb4cb37065cb09769c3363ad34de5acb2ee98
/org.eclipse.ice.example/xtend-gen/org/eclipse/ice/example/ExampleRuntimeModule.java
462dfc1e2f4ea172bffdab728ea9fbb84c9e73ad
[]
no_license
arbennett/ParserGeneratorExample
398f673697fd84bd0e2e62c19c26435451b0e1cd
001cd1f48252b579265db54eee91d60202ca6733
refs/heads/master
2021-01-10T13:54:40.479245
2016-04-26T00:09:47
2016-04-26T00:09:47
50,963,658
0
0
null
null
null
null
UTF-8
Java
false
false
345
java
/** * generated by Xtext 2.9.1 */ package org.eclipse.ice.example; import org.eclipse.ice.example.AbstractExampleRuntimeModule; /** * Use this class to register components to be used at runtime / without the Equinox extension registry. */ @SuppressWarnings("all") public class ExampleRuntimeModule extends AbstractExampleRuntimeModule { }
fb16ea711d4a1bbdab624b5dd800fc40710ff8e0
42fc76accc986e906bb0b241d00a3da7f36e3e52
/src/main/java/uk/ac/ed/epcc/webapp/session/AppUserTransitionContributor.java
ec257b2436e1439f3cb276811d28df294b482ef8
[ "Apache-2.0" ]
permissive
spbooth/SAFE-WEBAPP
44ec39963432762ae5e90319d944d8dea1803219
0de7e84a664e904b8577fb6b8ed57144740c2841
refs/heads/master
2023-07-08T22:22:48.048148
2023-06-22T07:59:22
2023-06-22T07:59:22
47,343,535
3
0
NOASSERTION
2023-02-22T13:33:54
2015-12-03T16:10:41
Java
UTF-8
Java
false
false
1,488
java
//| Copyright - The University of Edinburgh 2018 | //| | //| 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 uk.ac.ed.epcc.webapp.session; import java.util.Map; import uk.ac.ed.epcc.webapp.forms.transition.Transition; /** Interface for {@link AppUserComposite}s that add additional transitions to the * AppUser transitions. * @author spb * @param <AU> type of AppUser * */ public interface AppUserTransitionContributor<AU extends AppUser> { Map<AppUserKey<AU>,Transition<AU>> getTransitions(AppUserTransitionProvider<AU> provider); }
723c10d584401e4bef73cf2dd291d8ee7f83008c
da8839c41e47c3ae5d6dccc73b836709ceb9c300
/DQBioinformatics/src/unimelb/edu/au/doc/BioinformaticFilter.java
c3cba827dc10e2ca272f00ae5af13ef061c5b71e
[ "Apache-2.0" ]
permissive
rbouadjenek/DQBioinformatics
dcb266d23c4a78a67eebfb23394b38e5d6a0d7e6
088c0e93754257592e3a0725897566af3823a92d
refs/heads/master
2021-01-21T10:49:04.811659
2019-02-24T05:34:12
2019-02-24T05:34:12
83,493,939
0
0
null
null
null
null
UTF-8
Java
false
false
770
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 unimelb.edu.au.doc; import java.io.File; import java.io.FileFilter; /** * This class represents a filter for PubMed articles. * * @author mbouadjenek */ public class BioinformaticFilter implements FileFilter { private final String extention; static public String PUBMED_ARTICLES = ".nxml"; static public String GENBANK_RECORDS = ".gb"; public BioinformaticFilter(String extention) { this.extention = extention; } @Override public boolean accept(File path) { return path.getName().toLowerCase().endsWith(extention); } }
3187f3be024db95506461026869e21d06a354a3d
0d863008126a0dca8150bcbcba63f92cbc32fd74
/src/test/java/TutorItemTest.java
858b6263fe1ef1b2456a8ef820adaf63a6a1b9f8
[]
no_license
aalphanomad/Software_Design_Project
049c2381126c6016fdb9c2a76be422521756a273
37f0169201d9244a12354e76752e355a85d4bece
refs/heads/VBranch
2022-06-04T11:11:17.197519
2019-11-12T07:50:35
2019-11-12T07:50:35
172,665,642
1
1
null
2021-04-19T14:54:28
2019-02-26T08:05:18
Java
UTF-8
Java
false
false
433
java
//package com.alphanomad.AN_Webapp; import com.alphanomad.AN_Webapp.*; import static org.junit.Assert.*; import org.junit.Test; public class TutorItemTest { @Test public void testTutorItem() { String Name="Marubini"; String Student_num="1"; TutorItem tutorItem=new TutorItem(Name, Student_num); tutorItem.getName(); tutorItem.setName(Name); tutorItem.getStudent_num(); tutorItem.setStudent_num(Student_num); } }
27921353599d69d7c3ea70ee4440ec132028aa55
d7405d3bddf0d199b0b697957b053537eb9bea26
/SpringMVC2/src/com/java/member/dto/ZipcodeDto.java
9d4635974d601215a192c83c25589d20d9287708
[]
no_license
minseunghwang/KITRI_Spring
b141aced4ef935cc7c27542e26c25344412aea67
ce4622cb69ee5b4b4305908d9b6809f301944a99
refs/heads/master
2022-12-30T12:28:27.443523
2020-10-15T08:12:39
2020-10-15T08:12:39
296,552,873
0
0
null
null
null
null
UTF-8
Java
false
false
1,370
java
package com.java.member.dto; public class ZipcodeDto { private String zipcode; private String sido; private String gugun; private String dong; private String ri; private String bunji; //default Constructor public ZipcodeDto() {} //using Field Constructor public ZipcodeDto(String zipcode, String sido, String gugun, String dong, String ri, String bunji) { this.zipcode = zipcode; this.sido = sido; this.gugun = gugun; this.dong = dong; this.ri = ri; this.bunji = bunji; } // Getter & Setter public String getZipcode() { return zipcode; } public void setZipcode(String zipcode) { this.zipcode = zipcode; } public String getSido() { return sido; } public void setSido(String sido) { this.sido = sido; } public String getGugun() { return gugun; } public void setGugun(String gugun) { this.gugun = gugun; } public String getDong() { return dong; } public void setDong(String dong) { this.dong = dong; } public String getRi() { return ri; } public void setRi(String ri) { this.ri = ri; } public String getBunji() { return bunji; } public void setBunji(String bunji) { this.bunji = bunji; } @Override public String toString() { return "ZipcodeDto [zipcode=" + zipcode + ", sido=" + sido + ", gugun=" + gugun + ", dong=" + dong + ", ri=" + ri + ", bunji=" + bunji + "]"; } }
ac21d33a86096e2e8fe6dfb766b52b5442d97a00
046673f1352e76587845fd1b3e3f5d2a07baafc7
/cloudal-sentinel-service8401/src/main/java/com/cloud/myhandler/CustomerBlockHandler.java
aa53012ae7c3813d9fff3e066cd63745456a0f9b
[]
no_license
ProudMuBai/springCloud
7689b1a5c02c4f54dad6a2149d4cd0e33a83befd
74cb10e4d22d5661774e44ee4890ac5d0068d4a0
refs/heads/main
2023-04-09T17:20:10.317072
2021-04-25T03:13:29
2021-04-25T03:13:29
361,317,541
1
0
null
null
null
null
UTF-8
Java
false
false
499
java
package com.cloud.myhandler; import com.alibaba.csp.sentinel.slots.block.BlockException; import com.cloud.entities.CommonResult; public class CustomerBlockHandler { public static CommonResult handlerException(BlockException exception){ return new CommonResult(4444,"自定义,global handlerException----1"); } public static CommonResult handlerException2(BlockException exception){ return new CommonResult(4444,"自定义,global handlerException----2"); } }
0e1af4a2a115df018b5a46191a20ba3f2efbc217
12adfd2b7b820b07aa13736ebc181cd4167195d4
/Fundamentals-2.0/JavaFundamentals/Homework/JavaSyntax/src/org/softuni/_12_CharacterMultiplier.java
7f8e0d14cf293446c675495a4488b51ac33b7edf
[ "MIT" ]
permissive
sholev/SoftUni
cf4fc791eb2960f8365dedd003834a06f671a83c
0d5f4b26fa20e5442b91a515f775e80ae6994834
refs/heads/master
2020-04-06T07:05:23.471790
2016-08-08T07:02:49
2016-08-08T07:02:49
42,768,457
1
0
null
null
null
null
UTF-8
Java
false
false
940
java
package org.softuni; import java.util.Scanner; public class _12_CharacterMultiplier { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter strings separated by space: "); String stringOne = in.next("[\\S]+"); String stringTwo = in.next("[\\S]+"); int min = Math.min(stringOne.length(), stringTwo.length()); int sum = 0; for (int i = 0; i < min; i++) { sum += stringOne.charAt(i) * stringTwo.charAt(i); } sum += stringOne.length() > stringTwo.length() ? RemainingCharCodes(min, stringOne) : RemainingCharCodes(min, stringTwo); System.out.printf("The sum is: %d", sum); } private static int RemainingCharCodes(int start, String str) { int sum = 0; for (int i = start; i < str.length(); i++) { sum += str.charAt(i); } return sum; } }
3cf3d78ed8d1aa04c9f008379f03dc97c701b9b2
064dbba4f6f35ecf72240ec8e44af0f542fad8f1
/Application/src/main/java/net/jimblackler/yourphotoswatch/PicasaPhotoListEntry.java
44f75019670646afa3c4ea0576b7b40f4ef2d30d
[ "Apache-2.0" ]
permissive
jmgfr/YourPhotosWatch
f70cb830c18a346fc29ee4714d9863f9b72e50e4
72c8148d2e02bc738c029fe5cacadc3fe26c2550
refs/heads/master
2021-01-13T16:07:58.898047
2015-04-22T16:14:40
2015-04-22T16:14:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,270
java
package net.jimblackler.yourphotoswatch; import android.net.Uri; import android.util.JsonReader; import net.jimblackler.yourphotoswatch.ReaderUtil.ReaderException; import java.io.IOException; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; class PicasaPhotoListEntry extends InternetPhotoListEntry { private int height; private String id; private Date publishDate; private int width; private boolean valid; public PicasaPhotoListEntry(JsonReader reader, int position) throws ReaderException { super(position); valid = true; try { reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); switch (name) { case "published": DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS"); String createdTimeString = ReaderUtil.getText(reader); try { publishDate = format.parse(createdTimeString); } catch (ParseException e) { // Ignored by design. } break; case "media$group": reader.beginObject(); while (reader.hasNext()) { name = reader.nextName(); switch (name) { case "media$title": id = ReaderUtil.getText(reader); break; case "media$content": int target = 320; reader.beginArray(); while (reader.hasNext()) { Uri uri = null; int width = 0; int height = 0; String medium = ""; reader.beginObject(); while (reader.hasNext()) { name = reader.nextName(); switch (name) { case "url": String uriString = reader.nextString(); uri = Uri.parse(uriString); break; case "width": width = Integer.parseInt(reader.nextString()); break; case "height": height = Integer.parseInt(reader.nextString()); break; case "medium": if(reader.nextString().equals("video")) { valid = false; } break; default: reader.skipValue(); } } reader.endObject(); int smallest = Math.min(width, height); int best = Math.min(this.width, this.height); if (this.imageUri == null) { this.imageUri = uri; this.width = width; this.height = height; } else if (smallest < target) { if (smallest > best) { this.imageUri = uri; this.width = width; this.height = height; } } else { if (smallest < best) { this.imageUri = uri; this.width = width; this.height = height; } } } reader.endArray(); break; default: reader.skipValue(); } } reader.endObject(); break; default: reader.skipValue(); } } reader.endObject(); } catch (IOException e) { throw new ReaderException(e); } } @Override public String getId() { return "picasa_" + id; } @Override public int getWidth() { return width; } @Override public int getHeight() { return height; } public Date getPublishDate() { return publishDate; } public boolean isValid() { return valid; } }
fd5448b94e9671e782a8aada0f27189634be74fc
73b260d7d6ad9d9abfed68af0dd67de7b71bfdfb
/app/src/main/java/me/guillem/athm2app/Views/SplashScreen.java
3689a0e2323ce659118dc0b3d22ca030ac3e3fff
[]
no_license
GuillemPejo/athm
2720396bddad8d49b27f2c7c18afa30341f97c42
283ca72067eb92547bda9629e272663c4c31f662
refs/heads/master
2023-02-09T04:28:54.927546
2020-12-29T13:06:02
2020-12-29T13:06:02
325,621,727
0
0
null
null
null
null
UTF-8
Java
false
false
1,276
java
package me.guillem.athm2app.Views; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import me.guillem.athm2app.R; public class SplashScreen extends AppCompatActivity { private FirebaseAuth mAuth; @Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.Theme_ATHM2APP_Launcher); super.onCreate(savedInstanceState); mAuth = FirebaseAuth.getInstance(); FirebaseUser user = mAuth.getCurrentUser(); Intent go_home = new Intent(this, HomeActivity.class); //mAuth.signOut(); Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { if (mAuth.getCurrentUser()!=null){ go_home.putExtra("user",user); startActivity(go_home); finish(); }else { Intent go_auth = new Intent(getApplicationContext(), AuthActivity.class); startActivity(go_auth); } } }, 2000); } }
860a82d45cd57fcd5c2a2d770219fbc0aca5586e
e8b1c9c150a126ab0e94a42ab210069937424a0c
/app/src/main/java/com/example/sys/retrofit2/ReclerAdapter.java
99d30ea83cc42f4fccd895a094947f4f6fc312c9
[]
no_license
MohammadAsiff/Retrofit
e4f6c0bc20b7cd08a450bc59c3e37826e9a7386a
7535b1a74e07ca4e70c3aa79b1d2a1c65beddf11
refs/heads/master
2020-04-08T05:01:51.945379
2018-11-25T16:24:03
2018-11-25T16:24:03
159,042,749
0
0
null
null
null
null
UTF-8
Java
false
false
1,878
java
package com.example.sys.retrofit2; import android.content.Context; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.squareup.picasso.Picasso; import java.util.ArrayList; public class ReclerAdapter extends RecyclerView.Adapter<ReclerAdapter.HolderClass>{ Context context; ArrayList<DashboardResp.Details> details; public ReclerAdapter(SecondScreen secondScreen, ArrayList<DashboardResp.Details> details) { context = secondScreen; this.details = details; } @NonNull @Override public ReclerAdapter.HolderClass onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()) .inflate(R.layout.list_item, parent, false); return new HolderClass(itemView); } @Override public void onBindViewHolder(@NonNull HolderClass holder, int position) { Picasso.get().load(details.get(position).getImage()).into(holder.image); holder.name.setText(details.get(position).getName()); holder.lat.setText(details.get(position).getLat()); holder.lon.setText(details.get(position).getLon()); } @Override public int getItemCount() { return details.size(); } public class HolderClass extends RecyclerView.ViewHolder{ ImageView image; TextView name, lat, lon; public HolderClass(View itemView) { super(itemView); image = itemView.findViewById(R.id.image); name = itemView.findViewById(R.id.name); lat = itemView.findViewById(R.id.lat); lon = itemView.findViewById(R.id.lon); } } }
5a7a94058643a615d23000539381f71766a092f1
139c2f832309cac7bb612807313ee4b7aec1a2e3
/app/src/main/java/ir/ugstudio/vampire/models/MapResponse.java
5f19c89a702379ac716869f3b0e866fa570869ea
[]
no_license
mehdikazemi8/vampire-game
68e71626aabefce43d7368db5be7cc42a0b507be
ac244edc5e18c2c1252323dc553273fba0d89b34
refs/heads/master
2020-07-01T23:16:11.889831
2017-04-12T04:58:55
2017-04-12T04:58:55
201,336,427
0
0
null
null
null
null
UTF-8
Java
false
false
997
java
package ir.ugstudio.vampire.models; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import java.util.List; @JsonIgnoreProperties(ignoreUnknown = true) public class MapResponse extends BaseModel { private List<Tower> towers; private List<User> sheeps; private List<User> vampires; private List<User> hunters; public MapResponse() { } public List<User> getSheeps() { return sheeps; } public void setSheeps(List<User> sheeps) { this.sheeps = sheeps; } public List<Tower> getTowers() { return towers; } public void setTowers(List<Tower> towers) { this.towers = towers; } public List<User> getVampires() { return vampires; } public void setVampires(List<User> vampires) { this.vampires = vampires; } public List<User> getHunters() { return hunters; } public void setHunters(List<User> hunters) { this.hunters = hunters; } }
c5c70f2b7b7f8fca89986d2d4a0008d3bf42d1bc
4705f50c5442fa35a89f5827516e240f03c95828
/src/main/java/bookstore/repository/BookRepository.java
3ac69da8808b515d595cbe0b3606cd2ac074c78c
[]
no_license
lenshuygh/repositoryExercise
deb763390cf3d524f3883844069d4bb217d38387
256f9d851ef2f92b8074f3c7972c854c80804a35
refs/heads/master
2022-02-28T09:15:48.987756
2019-12-02T22:51:05
2019-12-02T22:51:05
225,191,064
0
0
null
2022-02-10T02:57:56
2019-12-01T16:18:36
Java
UTF-8
Java
false
false
330
java
package bookstore.repository; import bookstore.model.Book; import bookstore.model.BookType; import java.util.List; public interface BookRepository { void addBook(Book book); Book getBookByIsbn(int isbn); void removeBook(Book book); List<Book> getBooksByType(BookType type); List<Book> getAllBooks(); }
64d552ded6e25e8046f317a5ffb4dff400fb6724
a95024f9c9fec7dcbc21fbca31241ff7c3d54818
/src/main/java/br/com/surittec/cliente/entity/Telefone.java
94a5d8a6d2c7e2b7a3c3fcf7aa4259a0f72c023d
[]
no_license
jeffersono7/desafio-crud-cliente-backend
3e94299c441ee99ee46fecc97e60460a00e8a5e1
be763d8c80474b76c53caa8b519b7f33ab9f9555
refs/heads/master
2020-12-07T21:58:42.502082
2020-01-14T08:54:07
2020-01-14T08:54:07
232,811,615
0
0
null
null
null
null
UTF-8
Java
false
false
934
java
package br.com.surittec.cliente.entity; import lombok.Data; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; @Data @Entity @Table(name = "telefone", schema = "CLIENTE") public class Telefone { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") private Long id; @NotNull @Size(min = 8, max = 11) @Column(name = "numero") private String numero; @ManyToOne @JoinColumn(name = "tipo_telefone") private TipoTelefone tipoTelefone; @ManyToOne(optional = false) @JoinColumn(name = "cliente", nullable = false) private Cliente cliente; }
49a4449710c272d953cb22c6f2ff409455ba5fe2
e5e84b854d63f3ad948620536d2b2fdc64750d93
/src/main/java/br/ufsm/piveta/system/entities/Author.java
c7a72decc532be2df3c7f0c17c41baf3dc892abe
[ "MIT" ]
permissive
fapedroso/another-book-in-the-shelf
1af4048a424bf57c2d671a4009a8a41a3c5dac5d
347b322dd07e7cee6da762342307286245d37050
refs/heads/master
2021-07-08T09:35:13.163549
2017-09-24T02:01:01
2017-09-24T02:01:01
104,111,666
0
0
null
null
null
null
UTF-8
Java
false
false
4,199
java
package br.ufsm.piveta.system.entities; import org.jetbrains.annotations.Nullable; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; @SuppressWarnings({"WeakerAccess", "unused"}) public class Author { private Connection connection; private Integer id; private String name; Author(Integer id, String name){ this.id = id; this.name = name; } @Nullable protected static Author getFromResultSet(ResultSet resultSet) throws SQLException { if(resultSet.next()){ return new Author( resultSet.getInt(1), // id resultSet.getString(2) // name ); }else return null; } protected static List<Author> getListFromPreparedStatement(PreparedStatement preparedStatement) throws SQLException { List<Author> authors = new ArrayList<>(); ResultSet resultSet = preparedStatement.executeQuery(); Author author; while ((author = getFromResultSet(resultSet)) != null) { author.setConnection(preparedStatement.getConnection()); authors.add(author); } return authors; } protected static Author getFromPreparedStatement(PreparedStatement preparedStatement) throws SQLException { ResultSet resultSet = preparedStatement.executeQuery(); Author author = getFromResultSet(resultSet); if (author != null) { author.setConnection(preparedStatement.getConnection()); } return author; } protected static Author get(Connection connection,int id) throws SQLException { PreparedStatement preparedStatement = connection.prepareStatement( "SELECT id, name FROM authors WHERE id = ?"); preparedStatement.setInt(1, id); return getFromPreparedStatement(preparedStatement); } protected static Author get(Connection connection,String name) throws SQLException { PreparedStatement preparedStatement = connection.prepareStatement( "SELECT id, name FROM authors WHERE name = ?"); preparedStatement.setString(1, name); return getFromPreparedStatement(preparedStatement); } protected static List<Author> getAll(Connection connection,String name) throws SQLException { PreparedStatement preparedStatement = connection.prepareStatement( "SELECT id, name FROM authors"); return getListFromPreparedStatement(preparedStatement); } @Nullable public static Author create(Connection connection, String name) throws SQLException { PreparedStatement preparedStatement = connection.prepareStatement( "INSERT INTO authors (name) values (?)"); preparedStatement.setString(1,name); if (!preparedStatement.execute()) return null; ResultSet resultSet = preparedStatement.getGeneratedKeys(); if (resultSet.next()){ int id = resultSet.getInt(1); return new Author(id, name); } else return null; } public boolean save() throws SQLException { PreparedStatement preparedStatement = getConnection().prepareStatement( "UPDATE authors SET name = ? WHERE id = ?"); preparedStatement.setString(1, getName()); preparedStatement.setInt(2, getId()); return preparedStatement.executeUpdate() == 1; } public boolean remove() throws SQLException { PreparedStatement preparedStatement = getConnection().prepareStatement( "DELETE FROM authors WHERE id = ?"); preparedStatement.setInt(1, getId()); return preparedStatement.execute(); } public Integer getId() { return id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Connection getConnection() { return connection; } public void setConnection(Connection connection) { this.connection = connection; } }
4d1eedb85511a7da7d52e96249926f8dcacb5db3
fcc9868ee8c3c188dc9084b5326b2de81ab1e5e6
/day07_rotate_image/rotate_image.java
12c679584e5ab8ec476c7b2a6974ee4d08d20468
[]
no_license
nhoxbypass/100days-algorithm
5a7ee6834c7b089c20ce457e924a774f93e1cc0d
a239e1faf93e5abbd8541396929d27530d4bee0e
refs/heads/master
2021-06-21T13:36:34.755564
2020-05-17T08:44:18
2020-05-17T08:44:18
98,334,535
0
0
null
null
null
null
UTF-8
Java
false
false
686
java
int[][] rotateImage(int[][] m) { int a,b,c,d; // O(4) additional memory which equals to O(1) for(int i = 0; i < m.length / 2; i++) { for(int j = i; j < m.length - 1 - i; j++) { // Get the need-to-swap items at 4 side a = m[i][j]; b = m[j][m.length - 1 - i]; c = m[m.length - 1 - i][m.length - 1 - j]; d = m[m.length - 1 - j][i]; // Assign new place m[i][j] = d; // d -> a m[j][m.length - 1 - i] = a; // a -> b m[m.length - 1 - i][m.length - 1 - j] = b; // b -> c m[m.length - 1 - j][i] = c; // c -> d } } return m; }
4a53929ea87385fed7166774d8bc9875c68c543d
3540d46929d2226b39c626118d1b014d15fd7d11
/BlogPessoal/afc-blog/src/main/java/org/generation/afcblog/model/UserLogin.java
2e3152184d21dac7b4d8ad3abf6b99144a0eec3e
[]
no_license
afc-me/generation
f2b0e18e138766e1d4cf2c8b677d3d8c21c3f277
3f38544593dab479ff3bed293ff9f773e7dbbb2e
refs/heads/main
2023-07-02T13:49:35.533688
2021-08-10T00:51:14
2021-08-10T00:51:14
373,679,950
0
0
null
null
null
null
UTF-8
Java
false
false
988
java
package org.generation.afcblog.model; public class UserLogin { private long id; private String nome; private String usuario; private String senha; private String token; private String foto; private String tipo; public long getId() { return id; } public void setId(long id) { this.id = id; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public String getUsuario() { return usuario; } public void setUsuario(String usuario) { this.usuario = usuario; } public String getFoto() { return foto; } public void setFoto(String foto) { this.foto = foto; } public String getTipo() { return tipo; } public void setTipo(String tipo) { this.tipo = tipo; } public String getSenha() { return senha; } public void setSenha(String senha) { this.senha = senha; } public String getToken() { return token; } public void setToken(String token) { this.token = token; } }
9f362ae5d1ced24b09b4a09acec63755b718bed4
af88bd1d62f6d481fbf58ea9231fb32207f36f90
/Project/Smiley/app/src/test/java/com/peikova/gery/happy/ExampleUnitTest.java
54a3971ef3d9f3e6c6d0734e6e663e7fe1709f16
[ "MIT" ]
permissive
HappinessBot/AndroidApp
93a5d587d34523d6ec0060dd906102fa8c8d6227
79a1ab978c958ce5b44522475e0b79dca0153de2
refs/heads/master
2021-01-01T04:07:23.345913
2017-07-14T13:33:51
2017-07-14T13:33:51
97,121,478
0
0
null
null
null
null
UTF-8
Java
false
false
416
java
package com.peikova.gery.happy; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
bf5cfae2339bc2552136b67dbec7a6e0f3678921
274b5bd2878142bb9923cc00aac5fe45378c6efb
/app/src/main/java/com/cc/cmarket/fragment/MainFragment.java
d9cfedfde5c20463b7bc1e34efeecc7cb4542fc8
[]
no_license
cuncinc/cMarket_Android
7ad4978e4174cf772681b0caa17561952874fc06
f02821806b5ddf91032a19c19cab89ce8c20758f
refs/heads/master
2023-05-29T18:50:52.251799
2021-06-13T10:00:07
2021-06-13T10:00:07
376,503,858
0
0
null
null
null
null
UTF-8
Java
false
false
2,514
java
package com.cc.cmarket.fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentPagerAdapter; import androidx.viewpager.widget.ViewPager; import com.cc.cmarket.R; import com.google.android.material.tabs.TabLayout; import java.util.ArrayList; import java.util.List; public class MainFragment extends Fragment { private static MainFragment fragment; // ViewPager mViewpager; // TabLayout mTabs; // static List<Fragment> frags; // static // { // frags = new ArrayList<>(); // frags.add(FragmentOne.getInstance()); // frags.add(FragmentTwo.getInstance()); // } // public static Fragment getInstance() // { // if (fragment == null) // { // synchronized (MainFragment.class) // { // if (fragment == null) // { // fragment = new MainFragment(); // } // } // } // return fragment; // } @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { //把Fragment添加到列表中,以Tab展示 return inflater.inflate(R.layout.fragment_main, container, false); } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); // mTabs = view.findViewById(R.id.tabs); // mViewpager = view.findViewById(R.id.mviewpager); // mViewpager.setAdapter(new FragmentPagerAdapter(getFragmentManager()) // { // @NonNull // @Override // public Fragment getItem(int position) // { // return frags.get(position); // } // // @Override // public int getCount() // { // return frags.size(); // } // @Nullable // @Override // public CharSequence getPageTitle(int position) // { // return frags.get(position).getClass().getName(); // } // }); // mViewpager.setOffscreenPageLimit(5); // mTabs.setupWithViewPager(mViewpager);//与TabLayout绑定 } }
fb34d70c1b225a83fc3edaa6ed58b88eca2bd6a2
f56578aa9e7340b2eeec0c908ba3325a2ba565e2
/inexperiments/src/java/inexp/extjsexam/tab/TVSeriesListTab.java
860c4e7b366298cceaf909f6b42fe555aa14d108
[]
no_license
cybernetics/itsnat
420c88b65067be60a9bb2df2d79206f053881bfd
2bdbd88efa534ea2c1afef6810665bfc9b1472ee
refs/heads/master
2021-01-21T03:21:05.823904
2013-12-25T12:18:18
2013-12-25T12:18:18
17,083,257
1
0
null
null
null
null
UTF-8
Java
false
false
1,759
java
package inexp.extjsexam.tab; import inexp.extjsexam.ExtJSExampleDocument; import inexp.extjsexam.model.TVSeries; import javax.swing.table.DefaultTableModel; import org.itsnat.core.NameValue; /** * * @author jmarranz */ public class TVSeriesListTab extends TabContainingTable { public TVSeriesListTab(ExtJSExampleDocument parent) { super(parent); } public String getTitle() { return "TV Series"; } public void fillTableWithData() { TVSeries[] tvSeriesList = extJSDoc.getDataModel().getTVSeriesList(); for(int i = 0; i < tvSeriesList.length; i++) { TVSeries tvSeries = tvSeriesList[i]; addRow(tvSeries); } } public void updateName(String name,Object modelObj) { TVSeries tv = (TVSeries)modelObj; tv.setName(name); extJSDoc.getDataModel().updateTVSeries(tv); } public void updateDescription(String desc,Object modelObj) { TVSeries tv = (TVSeries)modelObj; tv.setDescription(desc); extJSDoc.getDataModel().updateTVSeries(tv); } public void addNewItem(String name,String desc) { TVSeries tvSeries = new TVSeries(name,desc); getDataModel().addTVSeries(tvSeries); addRow(tvSeries); } public void addRow(TVSeries tvSeries) { DefaultTableModel tableModel = (DefaultTableModel)tableComp.getTableModel(); tableModel.addRow(new NameValue[] { new NameValue(tvSeries.getName(),tvSeries), new NameValue(tvSeries.getDescription(),tvSeries) } ); } public void removeItemDB(Object modelObj) { getDataModel().removeTVSeries((TVSeries)modelObj); } }
2ffc55cb606e5eb9a50648edec6190db25b6b6a5
7c4ece985a9b727e551d51b4a63bd919fc938ac0
/RxTools-library/src/main/java/com/vondear/rxtools/recyclerview/RxLinearLayoutManager.java
29531e096b17987927348887102c1f665e0235e1
[ "Apache-2.0" ]
permissive
duboAndroid/RxTools-master
caf57dbd9ae6a7d2463b2a79012dc0a859de2b6a
dfa9549ce577dac661d0360af7f90a4dd16fa232
refs/heads/master
2021-07-17T13:54:48.816686
2017-10-25T10:37:48
2017-10-25T10:37:48
108,255,984
166
41
null
null
null
null
UTF-8
Java
false
false
1,113
java
package com.vondear.rxtools.recyclerview; import android.content.Context; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.AttributeSet; /** * Created by Vondear on 2017/6/8. */ /** * 官方的BUG * 解决 IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter */ public class RxLinearLayoutManager extends LinearLayoutManager { public RxLinearLayoutManager(Context context) { super(context); } public RxLinearLayoutManager(Context context, int orientation, boolean reverseLayout) { super(context, orientation, reverseLayout); } public RxLinearLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); } @Override public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) { try { super.onLayoutChildren(recycler, state); } catch (IndexOutOfBoundsException e) { e.printStackTrace(); } } }
5f79a9e0a8eed88d22fc11290dcaf93d83323352
f4097465637c42ba5e71648d6337acae96c9cf8e
/src/main/java/tfg/microservice/user/exception/AttemptAuthenticationException.java
53d923937c9f73f1634cc6f90cda429c094b8bca
[]
no_license
manuexcd/userMicroservice
a6bb8115421973ec623a6dd0c285d3b01c59b7af
4cffd1b61b3d3660b8f9a7e6a8e37d4a0bd970d5
refs/heads/master
2023-03-14T09:14:41.446686
2022-09-16T08:41:02
2022-09-16T08:41:02
235,818,074
0
0
null
2023-02-22T07:51:57
2020-01-23T14:59:50
Java
UTF-8
Java
false
false
235
java
package tfg.microservice.user.exception; public class AttemptAuthenticationException extends Exception { private static final long serialVersionUID = 7319980745274300196L; public AttemptAuthenticationException() { super(); } }
c918dd904ed9e15de1eeedf96d12f21dbac75c0b
7eff13f8d1239946b671238ed8ef8e70921f7dbf
/src/dama/Dama.java
e31e56f3a184a9ce8d6d97b9959d893d65abc69f
[]
no_license
lfnascimento/Dama
8c0636c6286bc4d4f7c19b0ade561a7e31c32e89
bfac50fc865e43dc1fafd3bc435cce40a9bf2aa0
refs/heads/master
2021-01-17T07:28:41.295754
2015-06-20T23:17:27
2015-06-20T23:17:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,625
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 dama; import JPlay.GameImage; import JPlay.Keyboard; import JPlay.Mouse; import JPlay.Window; import java.awt.Point; import java.util.ArrayList; import model.Partida; import model.Peca; import util.Regra; import util.Constantes; public class Dama { Window window; Partida partida; GameImage imagemFundo; Mouse mouse; Keyboard keyboard; Peca pecaSelecionada; Peca pecaASerComida; public Dama() { System.out.println("rodando"); carregarObjetos(); loop(); descarregarObjetos(); } private void carregarObjetos() { //A windows SEMPRE deve ser a primeira a ser CARREGADA window = new Window(640, 640); mouse = window.getMouse(); partida = new Partida(); keyboard = window.getKeyboard(); imagemFundo = new GameImage("tabuleiro.jpg"); } private void descarregarObjetos() { mouse = null; partida = null; keyboard = null; imagemFundo = null; //Fecha a janela de jogo window.exit(); } private void loop() { boolean executando = true; boolean esperandoMovimento; while (executando) { esperandoMovimento = true; desenha(); if (mouse.isLeftButtonPressed() == true) { System.out.println("Primeiro Clique"); //Seleciona a peça que o jogador clicou if (existePecaDoJogadorSobMouse(mouse.getPosition(), partida.getJogadorDaVez().getPecas())) { selecionaPeca(retornaPecaSelecionada(mouse.getPosition(), partida.getJogadorDaVez().getPecas())); desenha(); } //Se houver peça selecionada, espera o movimento if (pecaSelecionada != null) { System.out.println("Fazer o movimento de andar"); while (esperandoMovimento) { if (mouse.isLeftButtonPressed() == true) { //Se, em vez de fazer o movimento, decidiu escolher outra peça if (existePecaDoJogadorSobMouse(mouse.getPosition(), partida.getJogadorDaVez().getPecas())) { selecionaPeca(retornaPecaSelecionada(mouse.getPosition(), partida.getJogadorDaVez().getPecas())); desenha(); //Se não selecionou outra peça, então verifica se pode andar } else if (pecaSelecionada != null) { if (!Regra.deveComer(partida.getJogadorAdversario().getPecas(), partida.getJogadorDaVez().getPecas()) && Regra.podeAndar(pecaSelecionada, mouse.getPosition()) && !existePecaSobMouse(mouse.getPosition(), true)) { movimentar(mouse.getPosition()); trocaDeTurno(esperandoMovimento); } else if (existePecaDoJogadorSobMouse(mouse.getPosition(), partida.getJogadorAdversario().getPecas())) { pecaASerComida = retornaPecaSelecionada(mouse.getPosition(), partida.getJogadorAdversario().getPecas()); if (Regra.podeComer(pecaSelecionada, pecaASerComida, partida.getJogadorAdversario().getPecas(), partida.getJogadorDaVez().getPecas())) { comer(); if (!Regra.deveComer(pecaSelecionada, partida.getJogadorDaVez().getPecas(), partida.getJogadorAdversario().getPecas())) { trocaDeTurno(esperandoMovimento); } } } else { System.out.println("A peca " + pecaSelecionada.getId() + " nao pode andar"); } } } } } else { System.out.println("Nenhuma peca selecionada"); } } if (keyboard.keyDown(Keyboard.ESCAPE_KEY) == true) { executando = false; } } } private boolean existePecaSobMouse(Point position, boolean verificandoTodasAsPecas) { if (verificandoTodasAsPecas) { return existePecaDoJogadorSobMouse(position, partida.getJogadorDaVez().getPecas()) && existePecaDoJogadorSobMouse(position, partida.getJogadorAdversario().getPecas()); } else { return existePecaDoJogadorSobMouse(position, partida.getJogadorAdversario().getPecas()); } } private void desenha() { imagemFundo.draw(); partida.desenhaPecasJogadores(); window.display(); } private void trocaDeTurno(boolean esperandoMovimento) { partida.trocaDeTurno(); System.out.println("Vez do jogador " + partida.getJogadorDaVez().getCor()); esperandoMovimento = false; pecaSelecionada = null; pecaASerComida = null; } private void movimentar(Point position) { pecaSelecionada.movimentar(position); desenha(); System.out.println("A peca " + pecaSelecionada.getId() + " andou"); } private void comer() { pecaSelecionada.comer(pecaASerComida); partida.getJogadorAdversario().getPecas().remove(pecaASerComida); pecaASerComida = null; } //Mesmo método que já existia porém rodando para todas as pecas. public boolean existePecaDoJogadorSobMouse(Point mousePosition, ArrayList<Peca> pecas) { for (Peca peca : pecas) { if ((mousePosition.getX() >= peca.getPosition().x) && (mousePosition.getX() <= peca.getPosition().x + peca.getWidth()) && (mousePosition.getY() >= peca.getPosition().y) && (mousePosition.getY() <= peca.getPosition().y + peca.getHeight())) { System.out.println("Peca " + peca.getId() + " Selecionada"); return true; } } return false; } public Peca retornaPecaSelecionada(Point mousePosition, ArrayList<Peca> pecas) { Peca pecaRetorno = null; for (Peca peca : pecas) { if ((mousePosition.getX() >= peca.getPosition().x) && (mousePosition.getX() <= peca.getPosition().x + peca.getWidth()) && (mousePosition.getY() >= peca.getPosition().y) && (mousePosition.getY() <= peca.getPosition().y + peca.getHeight())) { System.out.println("Peca " + peca.getId() + " Selecionada"); pecaRetorno = peca; return pecaRetorno; } } return null; } private void selecionaPeca(Peca retornaPecaSelecionada) { if (pecaSelecionada == null) { pecaSelecionada = retornaPecaSelecionada; pecaSelecionada.selecionaPeca(); } else { pecaSelecionada.deselecionaPeca(); pecaSelecionada = retornaPecaSelecionada; pecaSelecionada.selecionaPeca(); } } }
4abb8da42b8117d682cda670976a4ee500127989
ecbb90f42d319195d6517f639c991ae88fa74e08
/XmlTooling/src/org/opensaml/xml/signature/impl/X509SerialNumberMarshaller.java
4231205ca7f3c42f5b804e313f054a602cbbfd4d
[ "MIT" ]
permissive
Safewhere/kombit-service-java
5d6577984ed0f4341bbf65cbbace9a1eced515a4
7df271d86804ad3229155c4f7afd3f121548e39e
refs/heads/master
2020-12-24T05:20:59.477842
2018-08-23T03:50:16
2018-08-23T03:50:16
36,713,383
0
1
MIT
2018-08-23T03:51:25
2015-06-02T06:39:09
Java
UTF-8
Java
false
false
1,847
java
/* * Licensed to the University Corporation for Advanced Internet Development, * Inc. (UCAID) under one or more contributor license agreements. See the * NOTICE file distributed with this work for additional information regarding * copyright ownership. The UCAID 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.opensaml.xml.signature.impl; import org.opensaml.xml.XMLObject; import org.opensaml.xml.io.AbstractXMLObjectMarshaller; import org.opensaml.xml.io.MarshallingException; import org.opensaml.xml.signature.X509SerialNumber; import org.opensaml.xml.util.XMLHelper; import org.w3c.dom.Element; /** * Thread-safe marshaller of {@link X509SerialNumber} objects. */ public class X509SerialNumberMarshaller extends AbstractXMLObjectMarshaller { /** {@inheritDoc} */ protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException { // no attributes } /** {@inheritDoc} */ protected void marshallElementContent(XMLObject xmlObject, Element domElement) throws MarshallingException { X509SerialNumber x509SerialNumber = (X509SerialNumber) xmlObject; if (x509SerialNumber.getValue() != null) { XMLHelper.appendTextContent(domElement, x509SerialNumber.getValue().toString()); } } }
2d6ff56554bcf2b2a5a86217ac2e0c739e963704
d0a6b19df8fc22e8c5f1c3196c6c0e2249f098f4
/src/com/objis/cameroun/gej/presentation/ServletModifierEnseignant.java
fb3e18a180d10a6683800d7479b856c4acd055f7
[]
no_license
KhalilGitHub/Schools_Management_Java_JPA_Persistance
99530ffa04ca985107ca27c5d930eee0784a999d
43341cf9ac41b12fc927a3b556c3e9525cf755e2
refs/heads/master
2020-06-15T20:06:32.644556
2019-07-05T09:45:04
2019-07-05T09:45:04
195,382,168
0
0
null
null
null
null
UTF-8
Java
false
false
7,681
java
package com.objis.cameroun.gej.presentation; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.math.BigDecimal; import java.sql.Blob; import java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.Date; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.Part; import javax.sql.rowset.serial.SerialBlob; import javax.sql.rowset.serial.SerialException; import com.objis.cameroun.gej.domaine.Eleve; import com.objis.cameroun.gej.domaine.Enseignant; import com.objis.cameroun.gej.domaine.Inscription; import com.objis.cameroun.gej.domaine.Recrutement; import com.objis.cameroun.gej.service.IService; import com.objis.cameroun.gej.service.Service; /** * Servlet implementation class ServletModifierEnseignant */ @WebServlet("/ServletModifierEnseignant") public class ServletModifierEnseignant extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public ServletModifierEnseignant() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { EntityManagerFactory emf = (EntityManagerFactory)getServletContext().getAttribute("emf"); EntityManager em = emf.createEntityManager(); IService iservice = new Service(em); //Connection conn = MyUtils.getStoredConnection(request); //Connection conn = null; //IService iService = null; String matricule = (String) request.getParameter("matricule"); Recrutement recrutement = null; String errorString = null; try { //iService = new Service(); //conn = ConnectInscription.getMySQLConnection(); recrutement = iservice.findRecrutementService(matricule); } catch (SQLException e) { e.printStackTrace(); errorString = e.getMessage(); } // If no error. // The Inscription does not exist to edit. // Redirect to InscriptionList page. if (errorString != null && recrutement == null) { response.sendRedirect(request.getServletPath() + "/ServletListEnseignants"); return; } // Store errorString in request attribute, before forward to views. request.setAttribute("errorString", errorString); request.setAttribute("recrutement", recrutement); //System.out.println(inscription); RequestDispatcher dispatcher = request.getServletContext().getRequestDispatcher("/modifierEnseignant.jsp"); dispatcher.forward(request, response); } // After the user modifies the Inscription information, and click Submit. // This method will be executed. @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { EntityManagerFactory emf = (EntityManagerFactory)getServletContext().getAttribute("emf"); EntityManager em = emf.createEntityManager(); IService iservice = new Service(em); int idRecrut = 0; int idEnseig = 0; int nombreMatiere = 0; int nombreHeure = 0; BigDecimal fraisParHeure = null; BigDecimal salaire = null; Date date = null; Recrutement recrutement = null; Enseignant enseignant = null; String idRecrutStr = (String) request.getParameter("idRecrut"); String idEnseigStr = (String) request.getParameter("idEnseig"); String matricule = (String) request.getParameter("matricule"); String nom = (String) request.getParameter("nom"); String prenom = (String) request.getParameter("prenom"); String genre = (String) request.getParameter("genre"); String adresse = (String) request.getParameter("adresse"); String nombreMatieresStr = (String) request.getParameter("nombreMatieres"); String premiereMatiere = (String) request.getParameter("premiereMatiere"); String deuxiemeMatiere = (String) request.getParameter("deuxiemeMatiere"); String nombreHeureStr = (String) request.getParameter("nombreHeure"); String fraisParHeureStr = (String) request.getParameter("fraisParHeure"); String dateStr = (String) request.getParameter("date"); System.out.println(idRecrutStr + " " + idEnseigStr + " " + nom + " " + nombreHeureStr); InputStream inputStream = null; Part filePart = request.getPart("image"); if (filePart != null) { inputStream = filePart.getInputStream(); } byte[] contents; ByteArrayOutputStream output = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int count; while ((count = inputStream.read(buffer)) != -1) { output.write(buffer, 0, count); } contents = output.toByteArray(); Blob blob = null; try { blob = new SerialBlob(contents); } catch (SerialException e) {e.printStackTrace();} catch (SQLException e) {e.printStackTrace();} try { idRecrut = Integer.parseInt(idRecrutStr); idEnseig = Integer.parseInt(idEnseigStr); nombreMatiere = Integer.parseInt(nombreMatieresStr); nombreHeure = Integer.parseInt(nombreHeureStr); fraisParHeure = convertStringToBigDecimal(fraisParHeureStr); date = new SimpleDateFormat("mm/dd/yyyy").parse(dateStr); salaire = fraisParHeure.multiply(new BigDecimal(nombreHeure * 4)); } catch (Exception e) { e.printStackTrace(); } enseignant = new Enseignant(idEnseig , nom, prenom, genre, adresse , nombreMatiere, premiereMatiere, deuxiemeMatiere); recrutement = new Recrutement(idRecrut, nombreHeure, matricule, enseignant, fraisParHeure, salaire, date, blob); String errorString = null; try { iservice.updateRecrutementService(enseignant, recrutement); } catch (SQLException e) { e.printStackTrace(); errorString = e.getMessage(); } // Store infomation to request attribute, before forward to views. request.setAttribute("errorString", errorString); request.setAttribute("recrutement", recrutement); // If error, forward to Edit page. if (errorString != null) { RequestDispatcher dispatcher = request.getServletContext().getRequestDispatcher("/modifierEnseignant.jsp"); dispatcher.forward(request, response); } // If everything nice. // Redirect to the Inscription listing page. else { response.sendRedirect(request.getContextPath() + "/ServletListEnseignants"); } } protected BigDecimal convertStringToBigDecimal(String bdStr) { BigDecimal result = null; try { double valueDouble = Double.parseDouble(bdStr); result = BigDecimal.valueOf(valueDouble); } catch(Exception ex) { System.out.println("Valeur invalide. Valeur par defaut 0.0"); result = BigDecimal.valueOf(0.0); } return result; } }
7151f1bcd2d96e73aecfd41da99ead4500e2b0b1
646483088e3bc52afc03877c437f56f00ba2389d
/app/src/main/java/com/peixing/baidumapdemo/MainActivity.java
7c360d79ec586d2eca64adb84d18c3c81e8eb1df
[]
no_license
didiaodazhong/BaiduMapDemo
f7e5f2af19ad10936305869781f045b87afd5d10
a9be4d5735074bff2970312b909cbe01a35e4e9a
refs/heads/master
2021-01-13T03:01:48.932802
2016-12-21T13:34:54
2016-12-21T13:34:54
77,045,996
0
0
null
null
null
null
UTF-8
Java
false
false
3,275
java
package com.peixing.baidumapdemo; import android.content.Intent; import android.graphics.Typeface; import android.os.Build; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.view.WindowManager; import android.widget.Button; import android.widget.ListView; import android.widget.RelativeLayout; import android.widget.TextView; import com.baidu.mapapi.map.BaiduMap; import com.baidu.mapapi.map.BitmapDescriptor; import com.baidu.mapapi.map.BitmapDescriptorFactory; import com.baidu.mapapi.map.CircleOptions; import com.baidu.mapapi.map.MapPoi; import com.baidu.mapapi.map.MapStatusUpdate; import com.baidu.mapapi.map.MapStatusUpdateFactory; import com.baidu.mapapi.map.MapView; import com.baidu.mapapi.map.Marker; import com.baidu.mapapi.map.MarkerOptions; import com.baidu.mapapi.map.OverlayOptions; import com.baidu.mapapi.map.Stroke; import com.baidu.mapapi.map.TextOptions; import com.baidu.mapapi.model.LatLng; public class MainActivity extends AppCompatActivity implements View.OnClickListener { private static final String TAG = "MainActivity"; private RelativeLayout activityMain; private MapView baiduMap; private TextView textInfo; private ListView listview; private Button searchDrive; private Button locate; private Button btNormal; private Button searchArea; //地图属性 MapStatusUpdate mapStatusUpdate; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //设置状态栏颜色随着activity设置颜色渐变 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } setContentView(R.layout.activity_main); btNormal = (Button) findViewById(R.id.bt_normal); searchArea = (Button) findViewById(R.id.search_area); locate = (Button) findViewById(R.id.locate); searchDrive = (Button) findViewById(R.id.search_drive); // activityMain = (RelativeLayout) findViewById(R.id.activity_main); baiduMap = (MapView) findViewById(R.id.baidu_Map); // textInfo = (TextView) findViewById(R.id.text_Info); // listview = (ListView) findViewById(R.id.listview); btNormal.setOnClickListener(this); searchArea.setOnClickListener(this); searchDrive.setOnClickListener(this); locate.setOnClickListener(this); } @Override public void onClick(View view) { switch (view.getId()) { case R.id.bt_normal: startActivity(new Intent(MainActivity.this, MapActivity.class)); break; case R.id.search_area: startActivity(new Intent(MainActivity.this, PoiSearchActivity.class)); break; case R.id.search_drive: startActivity(new Intent(MainActivity.this, DrivingSearchActivity.class)); break; case R.id.locate: startActivity(new Intent(MainActivity.this, MyLocationActivity.class)); break; } } }
6aa85ff6a41b3ad155782e96c22d3160a2757dc1
4686d486ff0db01b5604b1561862b60a54f91480
/Java_Data_Structures/lab5_Queues/QueueADT.java
34b68ccded6bcbf3a9c076b1ae5427a7230e5314
[]
no_license
chosun41/codeportfolio
1ed188c3b99e687d02f5eaeb6fb0b90ce4be77cc
3fdfc90937a642a091688d5903e435067c8499b3
refs/heads/master
2021-01-13T14:45:56.348915
2017-06-18T06:04:38
2017-06-18T06:04:38
94,666,938
0
1
null
null
null
null
UTF-8
Java
false
false
1,697
java
//Michael Cho //CSC 236-64 //Lab 7.1 public interface QueueADT<T> { public void initializequeue(); //Method to initialize the queue to an empty state //Postcondition: The queue is initialized. public boolean isemptyqueue(); //Method to determine whether the queue is empty. //Postcondition:Returns true if the queue is empty //otherwise, returns false public boolean isfullqueue(); //Method to determine whether the queue is full //Postcondtion: Returns true if the queue is full //otherwise, returns false public double count(); //Method to count length of queue public T front() throws QueueUnderflowException; //Method to return the first element of the queue. //Precondition: The queue exists and is not empty. //Postcondition: If the queue is empty, the method throws //queueunderflow exception, otherwise a reference to the //first element of the queue is returned public T back() throws QueueUnderflowException; //Method to return the last element of the queue. //Precondition: The queue exists and is not empty //Postcondition: If the queue is empty, the method throws //queueunderflowexception, otherwise a reference to the //last element of the queue is returned public void enqueue(T queueelement) throws QueueOverflowException; //Method to add queueelement to the queue //Precondition: The queue exists and is not ull //Postcondition: The queue is changed and queueelement is add to the queue public T dequeue() throws QueueUnderflowException; //Method to remove the first element of the queue //Precondition: The queue exists and is not empty //Postcondition: The queue is changed and the first element is //removed from queue and returned }
56bbb9a9aa660dd25944adff3291306d64994593
8fa2414dd0af8a449acbd817dc96791f5f228e60
/library/src/main/java/com/github/sdankbar/qml/persistence/QMLThreadPersistanceTask.java
24369bce8627a5f1a2ce3007f2045c7514a9f44c
[ "MIT" ]
permissive
sdankbar/jaqumal
2fb80d9e79649fee0a6faf8593c5a65b025a95e8
28ca2f432f7d7ce8b792eef8e60992dbf75c2652
refs/heads/master
2023-07-03T22:35:13.204983
2023-01-06T14:07:57
2023-01-06T14:07:57
174,902,960
7
0
MIT
2023-06-14T22:25:53
2019-03-11T01:18:28
Java
UTF-8
Java
false
false
6,308
java
/** * The MIT License * Copyright © 2020 Stephen Dankbar * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.github.sdankbar.qml.persistence; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.util.Map; import java.util.Objects; import java.util.concurrent.ScheduledFuture; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.github.sdankbar.qml.models.list.JQMLListModel; import com.github.sdankbar.qml.models.singleton.JQMLSingletonModel; import com.github.sdankbar.qml.models.table.JQMLTableModel; import com.google.common.collect.ImmutableSet; import com.google.common.io.Files; public class QMLThreadPersistanceTask implements Runnable { private static final Logger log = LoggerFactory.getLogger(QMLThreadPersistanceTask.class); private final File persistenceDirectory; private final Map<String, QMLThreadPersistanceTask> scheduled; private final JQMLSingletonModel<?> singletonModel; private final JQMLListModel<?> listModel; private final JQMLTableModel<?> tableModel; private final ImmutableSet<String> rootKeysToPersist; private ScheduledFuture<?> qtThreadFuture = null; private boolean isRunning = false; public QMLThreadPersistanceTask(final File persistenceDirectory, final JQMLSingletonModel<?> singletonModel, final Map<String, QMLThreadPersistanceTask> scheduled) { this.persistenceDirectory = Objects.requireNonNull(persistenceDirectory, "persistenceDirectory is null"); this.scheduled = Objects.requireNonNull(scheduled, "scheduled is null"); this.singletonModel = Objects.requireNonNull(singletonModel, "singletonModel is null"); rootKeysToPersist = ImmutableSet.of(); listModel = null; tableModel = null; scheduled.put(singletonModel.getModelName(), this); } public QMLThreadPersistanceTask(final File persistenceDirectory, final JQMLListModel<?> listModel, final Map<String, QMLThreadPersistanceTask> scheduled, final ImmutableSet<String> rootKeysToPersist) { this.persistenceDirectory = Objects.requireNonNull(persistenceDirectory, "persistenceDirectory is null"); this.scheduled = Objects.requireNonNull(scheduled, "scheduled is null"); singletonModel = null; this.listModel = Objects.requireNonNull(listModel, "listModel is null"); tableModel = null; this.rootKeysToPersist = Objects.requireNonNull(rootKeysToPersist, "rootKeysToPersist is null"); scheduled.put(listModel.getModelName(), this); } public QMLThreadPersistanceTask(final File persistenceDirectory, final JQMLTableModel<?> tableModel, final Map<String, QMLThreadPersistanceTask> scheduled, final ImmutableSet<String> rootKeysToPersist) { this.persistenceDirectory = Objects.requireNonNull(persistenceDirectory, "persistenceDirectory is null"); this.scheduled = Objects.requireNonNull(scheduled, "scheduled is null"); singletonModel = null; listModel = null; this.tableModel = Objects.requireNonNull(tableModel, "listModel is null"); this.rootKeysToPersist = Objects.requireNonNull(rootKeysToPersist, "rootKeysToPersist is null"); scheduled.put(tableModel.getModelName(), this); } public void setFuture(final ScheduledFuture<?> future) { qtThreadFuture = Objects.requireNonNull(future, "future is null"); } public void finishImmediately() { if (!isRunning) { // Not run yet so cancel and run synchronously qtThreadFuture.cancel(false); run(); } } @Override public void run() { isRunning = true; if (singletonModel != null) { qtThreadSaveModel(singletonModel); } else if (listModel != null) { qtThreadSaveModel(listModel); } else {// tableModel != null qtThreadSaveModel(tableModel); } } private void qtThreadSaveModel(final JQMLSingletonModel<?> model) { scheduled.remove(model.getModelName()); final ByteArrayOutputStream stream = new ByteArrayOutputStream(); try { model.serialize(stream); saveModel(model.getModelName(), stream.toByteArray()); } catch (final IOException e) { log.warn("Failed to persist " + model.getModelName(), e); } } private void qtThreadSaveModel(final JQMLListModel<?> model) { scheduled.remove(model.getModelName()); final ByteArrayOutputStream stream = new ByteArrayOutputStream(); try { model.serialize(stream, null, rootKeysToPersist); saveModel(model.getModelName(), stream.toByteArray()); } catch (final IOException e) { log.warn("Failed to persist " + model.getModelName(), e); } } private void qtThreadSaveModel(final JQMLTableModel<?> model) { scheduled.remove(model.getModelName()); final ByteArrayOutputStream stream = new ByteArrayOutputStream(); try { model.serialize(stream, rootKeysToPersist); saveModel(model.getModelName(), stream.toByteArray()); } catch (final IOException e) { log.warn("Failed to persist " + model.getModelName(), e); } } private void saveModel(final String modelName, final byte[] data) { try { persistenceDirectory.mkdirs(); Files.write(data, new File(persistenceDirectory, modelName + ".json")); } catch (final IOException e) { log.warn("Failed to persist " + modelName, e); } } }
[ "dankb@LAPTOP-2J6L4TTB" ]
dankb@LAPTOP-2J6L4TTB
9701e7093ff366e4657115467623cb69d3ab5936
c2e2022be343747a7bfa9845cfcb1adb6f6101a5
/architect_singleton/src/androidTest/java/architect/rui/com/architect_singleton/ExampleInstrumentedTest.java
0a80d28acdba1d261ec84cfef836453ccb48b960
[]
no_license
zhenqinrui/architecture
66c3530d7b696be81be9bb0720627b0992ac1581
cc679679b67fcb494409349155f8a2184c8ce4d5
refs/heads/master
2021-09-10T11:20:56.261165
2018-03-25T14:19:53
2018-03-25T14:19:53
119,617,522
0
0
null
null
null
null
UTF-8
Java
false
false
778
java
package architect.rui.com.architect_singleton; 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.*; /** * Instrumentation 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() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("architect.rui.com.architect_singleton", appContext.getPackageName()); } }
6532be698199f6eb19bc87621705766c2530e5fe
7a48d101d9e037e328a7a0899b20cc252bda2717
/src/Vista/SalidaCamara.java
e0367d9373b7b99ede868109e8ad379a0ab2cb3d
[]
no_license
MartiMarch/Sistema-Camara-Seguridad-1.0
ba227888ce64524df1931b3b0f205b51066e7bb3
9bcea89368fed6a110f7c2968d9c7ac1da9bbb8c
refs/heads/master
2023-06-09T16:23:06.201077
2021-06-28T15:04:21
2021-06-28T15:04:21
357,499,243
0
0
null
null
null
null
UTF-8
Java
false
false
3,072
java
package Vista; import java.awt.Graphics; import java.awt.image.BufferedImage; import java.awt.image.DataBufferByte; import javax.swing.JOptionPane; import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.videoio.VideoCapture; public class SalidaCamara extends javax.swing.JPanel implements Runnable{ static { System.loadLibrary(Core.NATIVE_LIBRARY_NAME); System.loadLibrary("opencv_java451"); System.loadLibrary("opencv_videoio_ffmpeg451_64"); } private VideoCapture video; private Mat frame; private BufferedImage buffer; private String url; private int altura = 0; private int anchura = 0; public SalidaCamara(String url) { this.url = url; initComponents(); new Thread(this).start(); } @Override public void paintComponent(Graphics g){ super.paintComponent(g); if(!(buffer == null)){ g.drawImage(buffer, 0, 0, buffer.getWidth(), buffer.getHeight(), null); } return; } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 400, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 300, Short.MAX_VALUE) ); }// </editor-fold>//GEN-END:initComponents @Override public void run() { video = new VideoCapture(url); if(video.isOpened()) { while(true) { frame = new Mat(); video.read(frame); if(!frame.empty()) { MatToBufferedImage(frame); this.repaint(); } frame.release(); } } else { JOptionPane.showMessageDialog(null,"No se pudo acceder a la cámara"); } } private void MatToBufferedImage(Mat frame) { anchura = frame.width(); altura = frame.height(); int canales = frame.channels(); byte[] source = new byte[anchura * altura * canales]; frame.get(0, 0, source); buffer = new BufferedImage(anchura, altura, BufferedImage.TYPE_3BYTE_BGR); final byte[] salida = ((DataBufferByte) buffer.getRaster().getDataBuffer()).getData(); System.arraycopy(source, 0, salida, 0, source.length); } public int getAltura() { return buffer.getHeight(); } public int getAnchura() { return buffer.getWidth(); } // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables }
bd128e2267559282c5cf9c6cd797e928bd56a5fa
724255a38149262241fc376773421cf841cf2cfd
/src/main/java/com/awews/person/User.java
776e63e59d737ea47ba18b161197a251de6a1651
[]
no_license
dapperAuteur/java-spring-palabras-api
42ebfaac601827d4f9359a3867a033c601d31566
f2a56e6deb3eac874c9c9592c9bf88b7952e989e
refs/heads/master
2020-03-17T02:41:23.743382
2018-05-29T20:54:00
2018-05-29T20:54:00
133,200,920
0
0
null
null
null
null
UTF-8
Java
false
false
4,009
java
package com.awews.person; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Document; @Document(collection = "users") public class User { @Id private String id; private String email; private String userName; private Integer role; private String password; private String profileImageUrl; public User() { } /** * @param id * @param email * @param userName * @param role * @param password * @param profileImageUrl */ public User(String id, String email, String userName, Integer role, String password, String profileImageUrl) { super(); this.id = id; this.email = email; this.userName = userName; this.role = role; this.password = password; this.profileImageUrl = profileImageUrl; } /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { return "User [id=" + id + ", email=" + email + ", userName=" + userName + ", role=" + role + ", password=" + password + ", profileImageUrl=" + profileImageUrl + "]"; } /** * @return the id */ public String getId() { return id; } /** * @param id the id to set */ public void setId(String id) { this.id = id; } /** * @return the email */ public String getEmail() { return email; } /** * @param email the email to set */ public void setEmail(String email) { this.email = email; } /** * @return the userName */ public String getUserName() { return userName; } /** * @param userName the userName to set */ public void setUserName(String userName) { this.userName = userName; } /** * @return the role */ public Integer getRole() { return role; } /** * @param role the role to set */ public void setRole(Integer role) { this.role = role; } /** * @return the password */ public String getPasswordHash() { return password; } /** * @param password the password to set */ public void setPasswordHash(String password) { this.password = password; } /** * @return the profileImageUrl */ public String getProfileImageUrl() { return profileImageUrl; } /** * @param profileImageUrl the profileImageUrl to set */ public void setProfileImageUrl(String profileImageUrl) { this.profileImageUrl = profileImageUrl; } /* (non-Javadoc) * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((email == null) ? 0 : email.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((password == null) ? 0 : password.hashCode()); result = prime * result + ((profileImageUrl == null) ? 0 : profileImageUrl.hashCode()); result = prime * result + ((role == null) ? 0 : role.hashCode()); result = prime * result + ((userName == null) ? 0 : userName.hashCode()); return result; } /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; User other = (User) obj; if (email == null) { if (other.email != null) return false; } else if (!email.equals(other.email)) return false; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if (password == null) { if (other.password != null) return false; } else if (!password.equals(other.password)) return false; if (profileImageUrl == null) { if (other.profileImageUrl != null) return false; } else if (!profileImageUrl.equals(other.profileImageUrl)) return false; if (role == null) { if (other.role != null) return false; } else if (!role.equals(other.role)) return false; if (userName == null) { if (other.userName != null) return false; } else if (!userName.equals(other.userName)) return false; return true; } }
390341c79607d29c9210608dca0d2e616739fe7e
447520f40e82a060368a0802a391697bc00be96f
/apks/playstore_apps/com_ubercab/source/giu.java
cda93eca3efac5676302121118198bbb8af6f9c8
[ "Apache-2.0", "GPL-1.0-or-later" ]
permissive
iantal/AndroidPermissions
7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465
d623b732734243590b5f004d167e542e2e2ae249
refs/heads/master
2023-07-19T01:29:26.689186
2019-09-30T19:01:42
2019-09-30T19:01:42
107,239,248
0
0
Apache-2.0
2023-07-16T07:41:38
2017-10-17T08:22:57
null
UTF-8
Java
false
false
479
java
import android.support.v4.view.ViewPager; import io.reactivex.Observer; final class giu extends gij<Integer> { private final ViewPager a; giu(ViewPager paramViewPager) { this.a = paramViewPager; } protected void a(Observer<? super Integer> paramObserver) { giv localGiv = new giv(this.a, paramObserver); paramObserver.onSubscribe(localGiv); this.a.b(localGiv); } protected Integer b() { return Integer.valueOf(this.a.c()); } }
1e269c328a7a87e1974ce312f9cee808c0dabe6f
b6f85b30a1359031e9034aa2be49b9c11e45ed1e
/app/src/main/java/com/avdey/fragments/Fragment1.java
6df33de0238303895deb4fea449a368c4848de3b
[]
no_license
Avdey87/Fragments
3973cc8ebfdaafd62bca2a327c7876867866a29c
3ddb8d7018f349b494c73f777a59013164e32130
refs/heads/master
2021-05-15T00:30:13.091246
2017-09-12T15:48:53
2017-09-12T15:48:53
103,181,223
0
1
null
null
null
null
UTF-8
Java
false
false
1,796
java
package com.avdey.fragments; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.Toast; public class Fragment1 extends Fragment implements View.OnClickListener { @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment1, container, false); Button button1 = (Button) rootView.findViewById(R.id.button1); Button button2 = (Button) rootView.findViewById(R.id.button2); Button button3 = (Button) rootView.findViewById(R.id.button3); button1.setOnClickListener(this); button2.setOnClickListener(this); button3.setOnClickListener(this); return rootView; } @Override public void onClick(View v) { int buttonIndex = transleteIdindex(v.getId()); OnSelectButtonListern listern = (OnSelectButtonListern) getActivity(); listern.onButtonSelected(buttonIndex); Toast.makeText(getActivity(), String.valueOf(buttonIndex) ,Toast.LENGTH_SHORT).show(); } int transleteIdindex(int id) { int index = -1; switch (id) { case R.id.button1: index = 1; break; case R.id.button2: index = 2; break; case R.id.button3: index = 3; break; } return index; } public interface OnSelectButtonListern { void onButtonSelected(int buttonIndex); } }
b15850d6e13a5d83bab876a07e12a5cb2b7681ec
1f2b78a88a4cbee3d1833845fe3648b008ac14a8
/src/main/java/com/monkey/web/admin/LoginController.java
fc817c0a54d2f5a1964ab7cab40ee6bf0b8f1ff6
[]
no_license
monkeyhlj/blog
17a137b740c54cf747d0b82544096fba78abf8f8
e77bb581717eabe4b1730665e444888194d93834
refs/heads/master
2022-12-13T16:07:26.011222
2020-09-12T06:35:35
2020-09-12T06:35:35
291,308,038
0
0
null
null
null
null
UTF-8
Java
false
false
1,533
java
package com.monkey.web.admin; import com.monkey.po.User; import com.monkey.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import javax.servlet.http.HttpSession; @Controller @RequestMapping("/admin") public class LoginController { @Autowired private UserService userService; @GetMapping public String loginPage() { return "admin/login"; } @PostMapping("/login") public String login(@RequestParam String username, @RequestParam String password, HttpSession session, RedirectAttributes attributes) { User user = userService.checkUser(username, password); if (user != null) { user.setPassword(null); session.setAttribute("user",user); return "admin/index"; } else { attributes.addFlashAttribute("message", "用户名和密码错误"); return "redirect:/admin"; } } @GetMapping("/logout") public String logout(HttpSession session) { session.removeAttribute("user"); return "redirect:/admin"; } }
6a4fe8fe60c8b281a82e3b5828ea6226ee6cd719
f10a7a255151c627eb1953e029de75b215246b4a
/quickfixj-core/src/main/java/quickfix/field/MaxPriceVariation.java
f6e6faddbe8d3fd8971fc9d838dd03c8ca8d74b5
[ "BSD-2-Clause", "LicenseRef-scancode-public-domain" ]
permissive
niepoo/quickfixj
579f57f2e8fb8db906c6f916355da6d78bb86ecb
f8e255c3e86e36d7551b8661c403672e69070ca1
refs/heads/master
2021-01-18T05:29:51.369160
2016-10-16T23:31:34
2016-10-16T23:31:34
68,493,032
0
0
null
2016-09-18T03:18:20
2016-09-18T03:18:20
null
UTF-8
Java
false
false
1,192
java
/* Generated Java Source File */ /******************************************************************************* * Copyright (c) quickfixengine.org All rights reserved. * * This file is part of the QuickFIX FIX Engine * * This file may be distributed under the terms of the quickfixengine.org * license as defined by quickfixengine.org and appearing in the file * LICENSE included in the packaging of this file. * * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING * THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. * * See http://www.quickfixengine.org/LICENSE for licensing information. * * Contact [email protected] if any conditions of this licensing * are not clear to you. ******************************************************************************/ package quickfix.field; import quickfix.DoubleField; public class MaxPriceVariation extends DoubleField { static final long serialVersionUID = 20050617; public static final int FIELD = 1143; public MaxPriceVariation() { super(1143); } public MaxPriceVariation(double data) { super(1143, data); } }
6b5ba458b9854a5b72a34884fad9f954268caf6c
87cd12bbcdb1a8120a67313f7f6243bd4733a109
/Assignment2UML/src/GuitarSG.java
193142c1c9c96ff0799c3494ca31f368e08b747a
[]
no_license
rshafto/Software_Specialties
e9b0e34d71dc770c8878a67c9fd5db12ccf101cd
e6df1b83d102e2369454664d039e23a8bc1033d0
refs/heads/master
2021-03-22T01:47:16.120674
2017-09-21T20:05:41
2017-09-21T20:05:41
104,393,668
0
0
null
2017-09-21T20:07:41
2017-09-21T20:07:41
null
UTF-8
Java
false
false
908
java
/*Author: Christian Fusco and Robin Shafto Class: CSI-480-01/02 Assignment: Lab 2 Date Assigned: 9/21/2017 Due Date: 10/5/2017 Description: Using interfaces to create a strategy design pattern and UML Class Diagram. Certification of Authenticity: I certify that this is entirely my own work, except where I have given fully-documented references to the work of others. I understand the definition and consequences of plagiarism and acknowledge that the assessor of this assignment may, for the purpose of assessing this assignment: - Reproduce this assignment and provide a copy to another member of academic - staff; and/or Communicate a copy of this assignment to a plagiarism checking - service (which may then retain a copy of this assignment on its database for - the purpose of future plagiarism checking) */ public class GuitarSG extends Guitar { public GuitarSG() { name = "Gibson SG"; } }
dbe459f19f50076e35b38879df0c87d73f8cf09b
8e30a2857b8b987d6168a4579ffc7acd5d3582b1
/src/observer/CBoyFriend.java
9fe2ac098772c71de79163ad485ebbd278584c7b
[]
no_license
tommy770221/PracticeJava
0d2f6a1f677c299ae5fa9e626cfefebcc7ae00e4
77d7131e8d05d4700a12596e3610e61444e226a6
refs/heads/master
2020-04-03T09:25:46.003066
2018-10-25T03:48:58
2018-10-25T03:48:58
155,164,566
0
0
null
null
null
null
UTF-8
Java
false
false
273
java
package observer; /** * Created by Tommy on 2018/10/9. */ public class CBoyFriend implements IBoyFriend { @Override public void update(String msg) { if("我生病了".equals(msg)){ System.out.println("先等等,待會到"); } } }
d438524fc483c283eaf3ba6e69b3b3f5e5e12b42
4e7c597e78f01fe1c14fc4cbb67dc4379a8c5939
/mambo-protocol/src/main/java/org/mambo/protocol/messages/KrosmasterTransferRequestMessage.java
e45665856e5b440b2df41aa97aa70b13b5b5c0d3
[]
no_license
Guiedo/Mambo
c24e4836f20a1028e61cb7987ad6371348aaf0fe
8fb946179b6b00798010bda8058430789644229d
refs/heads/master
2021-01-18T11:29:43.048990
2013-05-25T17:33:37
2013-05-25T17:33:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
810
java
// Generated on 05/08/2013 19:37:59 package org.mambo.protocol.messages; import java.util.*; import org.mambo.protocol.types.*; import org.mambo.protocol.enums.*; import org.mambo.protocol.*; import org.mambo.core.io.*; public class KrosmasterTransferRequestMessage extends NetworkMessage { public static final int MESSAGE_ID = 6349; @Override public int getNetworkMessageId() { return MESSAGE_ID; } public String uid; public KrosmasterTransferRequestMessage() { } public KrosmasterTransferRequestMessage(String uid) { this.uid = uid; } @Override public void serialize(Buffer buf) { buf.writeString(uid); } @Override public void deserialize(Buffer buf) { uid = buf.readString(); } }
0c7d5b3eccc25c7049e92b3b2f913a129578950e
d4b722f700a84433c05625e1840ea6a5015a3b1b
/src/OnlineTest/pairOfShoes.java
8ace9e1025de71e904604522460dce447e14c3fb
[]
no_license
sarujkd/file1Project
8ac0031e525af9c1b93009d6c90895d2a6299a7c
ea4bba6351848f2af661578dcde317c1b5feab16
refs/heads/master
2023-06-03T14:20:00.862152
2021-06-26T21:38:38
2021-06-26T21:38:38
380,590,097
0
0
null
null
null
null
UTF-8
Java
false
false
714
java
package OnlineTest; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; public class pairOfShoes { static boolean pairOfShes(int[][] shoes) { List<Integer> left=new ArrayList<Integer>(); List<Integer> right=new ArrayList<Integer>(); for(int i=0;i<shoes.length;i++) { if(shoes[i][0]==0) left.add(shoes[i][1]); else if(shoes[i][0]==1) right.add(shoes[i][1]); } return right.size()==left.size(); } public static void main(String[] args) { int[][] shoes= {{0,20}, {1,20}, {1,21}, {0,21}, {0,21} }; System.out.println(shoes[0].length); System.out.println("PairOfShoes = "+pairOfShes(shoes)); } }
cbf834276c094dcd89884528daf30ef792016844
1aa4573fb882909c2183c8b873e9b53cff85f6d3
/src/pattern/oberser/LimitObserver.java
e99653fb33ac5a17bbb75a1cfffb3da33c1d6465
[]
no_license
yangdiansheng/JavaTest
bc8359cdcb35d2a2483af16b288766a3ed580acb
4cae9f6d48da1d6ae195ae76b43baf794f5662ca
refs/heads/master
2020-04-12T17:51:30.560968
2019-12-04T15:56:26
2019-12-04T15:56:26
162,660,088
0
0
null
null
null
null
UTF-8
Java
false
false
669
java
package pattern.oberser; import java.util.Observable; import java.util.Observer; public class LimitObserver implements Observer{ @Override public void update(Observable o, Object arg) { if (arg instanceof LimitObserver){ HomeTopObservable homeTopObservable = (HomeTopObservable)o; homeTopObservable.mLimit ++; System.out.println( String.format("LimitObserver is complete %s userinit is %s limit is %s", homeTopObservable.isComplete(), homeTopObservable.mUserInit, homeTopObservable.mLimit)); } } }
d6faeb2d2b59ecb137862c064d6d322907aff864
62f66cb463e7ae4e7f8dddbea2d13150593443b2
/src/main/java/com/jmc/juanitunes/Main.java
46cfd7313c1fc685f3d1f36943900c4fb3816707
[]
no_license
juanmanuel-calderon/juanitunes
5f4a4557e5d95471cae909125fab79ca44c2caa2
b008202d89822edf8b2ce039057c7fc23e480349
refs/heads/master
2020-06-18T17:56:20.441702
2017-04-08T12:40:41
2017-04-08T12:40:41
74,750,578
0
0
null
null
null
null
UTF-8
Java
false
false
3,984
java
package com.jmc.juanitunes; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.logging.LogManager; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; import org.apache.commons.cli.DefaultParser; import org.apache.commons.cli.HelpFormatter; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; import com.jmc.juanitunes.cli.CommandLineInterface; import com.jmc.juanitunes.organizer.LibraryOrganizer; public class Main { public static void main(String[] args) { LogManager.getLogManager().reset(); CommandLineParser parser = new DefaultParser(); Options options = new Options(); options.addOption("l", "library-file", true, "path to library file, mandatory, will create if it does not exist"); options.addOption("p", "parse-path", true, "path to the media files to parse"); options.addOption("n", "library-name", true, "name of the library to create"); options.addOption("h", "help", false, "display this help message"); try { CommandLine line = parser.parse(options, args); if(line.hasOption('h')) { new HelpFormatter().printHelp("juanitunes", options); } boolean hasLibraryFile = line.hasOption('l'); boolean hasParsePath = line.hasOption('p'); String name = line.hasOption('n') ? line.getOptionValue('n') : "root"; LibraryOrganizer libraryOrganizer = new LibraryOrganizer(name); if(hasLibraryFile) { String libraryPath = line.getOptionValue('l') + "/" + name; File libraryFile = new File(libraryPath + ".library"); if(!libraryFile.exists()) { System.out.println("Library file does not exist: " + libraryPath); checkParse(hasParsePath, libraryOrganizer, line, libraryPath); } else { try { libraryOrganizer.importLibrary(libraryPath); } catch (IOException e) { System.err.println("Error while importing library from: " + libraryPath); System.err.println("Message: " + e.getMessage()); } new CommandLineInterface(libraryOrganizer).start(); export(libraryOrganizer, libraryPath); } } else { checkParse(hasParsePath, libraryOrganizer, line, name); } } catch(ParseException exp) { System.out.println("Unexpected exception:" + exp.getMessage()); } } private static void checkParse(boolean hasParsePath, LibraryOrganizer lo, CommandLine line, String path) { if(!hasParsePath) { System.err.println("Specify either a correct library file or a path to parse"); return; } else { String parsePath = line.getOptionValue('p'); doParse(lo, parsePath); export(lo, path); } } private static void doParse(LibraryOrganizer lo, String parsePath) { List<String> sources = new ArrayList<String>(); if(!(new File(parsePath).exists())) { System.err.println("Cannot parse: path does not exist: " + parsePath); return; } sources.add(parsePath); lo.addToCurrentLibrary(sources); new CommandLineInterface(lo).start(); } private static void export(LibraryOrganizer lo, String path) { try { lo.exportLibrary(path); } catch (IOException e) { System.err.println("Error while exporting library from: " + path); System.err.println("Message: " + e.getMessage()); } } }
84250a21ad858e7ee43cdbe64b388679c9957f4f
336235e8f01b9875c75e25b99334553eeaad17b0
/src/com/asak/controller/action/QnaViewAction.java
76393068aeae73897f2eb5ceb08e2fc7977481a7
[]
no_license
new9hyun/asak
acd6c45359134c8387993c93fd8b61dcc457b218
774b704c4c9951b93ebf7d8c008fc94c1328075f
refs/heads/main
2023-05-06T12:07:04.042037
2021-05-30T17:39:10
2021-05-30T17:39:10
372,279,544
0
0
null
null
null
null
UTF-8
Java
false
false
994
java
package com.asak.controller.action; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.asak.dao.QnaDAO; import com.asak.dto.MemberVO; import com.asak.dto.QnaVO; public class QnaViewAction implements Action { @Override public void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(); MemberVO loginUser = (MemberVO)session.getAttribute("loginUser"); String url = "qna/qnaView.jsp"; if (loginUser == null) { url = "AsakServlet?command=login_form"; } else { int qseq = Integer.parseInt(request.getParameter("qseq")); QnaDAO qDao = QnaDAO.getInstance(); QnaVO qna = qDao.getQna(qseq); request.setAttribute("qnaVO", qna); } request.getRequestDispatcher(url).forward(request, response); } }
0b18b1cbf18a129a55256d17cacebeab0d79b3b9
271d8453e199b8d2858e270aba88c6e7d92fbf1f
/java/javaSE/ScreenScraping/ScreenScraping.java
ce4f5d7287e19af3bcd5add34145517310969676
[]
no_license
zcongchao/learning
1ca1022335b2998aeb350ca84eb57584ed1a663f
2c3bea39fa6b71b2ae794b4ee7ea534f11e3ebae
refs/heads/master
2023-01-20T08:03:01.490554
2019-06-14T11:21:18
2019-06-14T11:21:18
174,662,277
0
1
null
2023-01-12T09:59:41
2019-03-09T07:24:54
Java
UTF-8
Java
false
false
5,737
java
import java.awt.*; import java.awt.event.*; import java.text.*; import javax.swing.*; public class ScreenScraping extends JFrame { // JLabel and JComboBox for item names private JLabel itemJLabel; private JComboBox itemJComboBox; // JLabel and JTextField for conversion rate private JLabel rateJLabel; private JTextField rateJTextField; // JLabel and JTextField for item price private JLabel priceJLabel; private JTextField priceJTextField; // JButton to search HTML code for item price private JButton searchJButton; // JLabel and JTextArea for HTML code private JLabel sourceJLabel; private JTextArea sourceJTextArea; // items that can be found in HTML code private String[] items = { "Antique Rocking Chair", "Silver Teapot", "Gold Pocket Watch" }; // small piece of HTML code containing items and prices private String htmlText = "<HTML><BODY><TABLE>" + "<TR><TD>Antique Rocking Chair</TD>" + "<TD>&euro;82.67</TD></TR>" + "<TR><TD>Silver Teapot</TD>" + "<TD>&euro;64.55</TD></TR>" + "<TR><TD>Gold Pocket Watch</TD>" + "<TD>&euro;128.83</TD></TR>" + "</TABLE></BODY></HTML>"; // no-argument constructor public ScreenScraping() { createUserInterface(); } // create and position GUI components; register event handlers private void createUserInterface() { // get content pane for attaching GUI components Container contentPane = getContentPane(); // enable explicit positioning of GUI components contentPane.setLayout( null ); // set up itemJLabel itemJLabel = new JLabel(); itemJLabel.setBounds( 8, 16, 40, 21 ); itemJLabel.setText( "Item:" ); contentPane.add( itemJLabel ); // set up itemJComboBox itemJComboBox = new JComboBox( items ); itemJComboBox.setBounds( 56, 16, 184, 21 ); contentPane.add( itemJComboBox ); // set up rateJLabel rateJLabel = new JLabel(); rateJLabel.setBounds( 8, 48, 40, 21 ); rateJLabel.setText( "Rate:" ); contentPane.add( rateJLabel ); // set up rateJTextField rateJTextField = new JTextField(); rateJTextField.setBounds( 56, 48, 184, 21 ); rateJTextField.setHorizontalAlignment( JTextField.RIGHT ); contentPane.add( rateJTextField ); // set up priceJLabel priceJLabel = new JLabel(); priceJLabel.setBounds( 8, 80, 40, 21 ); priceJLabel.setText( "Price:" ); contentPane.add( priceJLabel ); // set up priceJTextField priceJTextField = new JTextField(); priceJTextField.setBounds( 56, 80, 96, 21 ); priceJTextField.setHorizontalAlignment( JTextField.CENTER ); priceJTextField.setEditable( false ); contentPane.add( priceJTextField ); // set up searchJButton searchJButton = new JButton(); searchJButton.setBounds( 160, 80, 80, 23 ); searchJButton.setText( "Search" ); contentPane.add( searchJButton ); searchJButton.addActionListener( new ActionListener() // anonymous inner class { // event handler called when searchJButton is pressed public void actionPerformed( ActionEvent event ) { searchJButtonActionPerformed( event ); } } // end anonymous inner class ); // end call to addActionListener // set up sourceJLabel sourceJLabel = new JLabel(); sourceJLabel.setBounds( 8, 112, 48, 16 ); sourceJLabel.setText( "Source:" ); contentPane.add( sourceJLabel ); // set up sourceJTextArea sourceJTextArea = new JTextArea(); sourceJTextArea.setBounds( 8, 136, 232, 105 ); sourceJTextArea.setText( htmlText ); sourceJTextArea.setLineWrap( true ); contentPane.add( sourceJTextArea ); // set properties of application's window setTitle( "Screen Scraping" ); // set title bar string setSize( 259, 278 ); // set window size setVisible( true ); // display window } // end method createUserInterface private void searchJButtonActionPerformed( ActionEvent event ) { String rate = rateJTextField.getText(); if ( rate.equals( "" ) ) { JOptionPane.showMessageDialog( null, "Please enter conversion rate first.", "Missing Rate", JOptionPane.WARNING_MESSAGE ); return; // exit method } String selectedItem = ( String ) itemJComboBox.getSelectedItem(); int itemLocation = htmlText.indexOf( selectedItem ); int priceBegin = htmlText.indexOf( "&euro;", itemLocation ); int priceEnd = htmlText.indexOf( "</TD>", priceBegin ); String priceText = htmlText.substring(priceBegin + 6, priceEnd ); double price = Double.parseDouble( priceText ); // convert price from euros to dollars double conversionRate = Double.parseDouble( rateJTextField.getText() ); price *= conversionRate; // display price of item in priceJTextField DecimalFormat dollars = new DecimalFormat( "$0.00" ); priceJTextField.setText( dollars.format( price ) ); } public static void main(String[] args) { // TODO 自动生成的方法存根 ScreenScraping application = new ScreenScraping(); application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); } }
83fe7f66349879322d6fe8814d8370e7a655280c
f91149a49ed25682542f4e63670130915d26bf5f
/src/com/comp489/sos/Choking.java
83da488f3485b3414e7654460590ef628006f2c2
[]
no_license
k11tj01/sos
1b77fbf6e4c555aba50fbb6c548e7357bf89216a
df3380d0c766b7a219f5248e43b2e37fcc5e40f6
refs/heads/master
2016-09-05T17:18:28.912031
2013-11-26T04:18:26
2013-11-26T04:18:26
13,807,823
1
0
null
null
null
null
UTF-8
Java
false
false
522
java
package com.comp489.sos; import android.os.Bundle; import android.app.Activity; import android.view.Menu; public class Choking extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_heimlich_instr); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.heimlich_instr, menu); return true; } }
0009ca2469a31ab4707026ac8c35c67b2ff723f1
4a58d0d03803c7a453df0ccb0309e017233e7169
/sample-web/src/main/java/org/asuki/web/service/MainService.java
e9677dafaaafa49384eaf1d6b00a2b78c25160a0
[]
no_license
Gtczin/JavaEE7
28e1b61c8bda4b330fc06617d8ce96ae71e0bc90
ba236ad5082cac27e98aa620ca1255d89656316b
refs/heads/master
2020-12-24T22:29:34.140160
2015-11-08T15:03:42
2015-11-08T15:03:42
51,573,247
1
0
null
2016-02-12T07:32:36
2016-02-12T07:32:35
null
UTF-8
Java
false
false
121
java
package org.asuki.web.service; import javax.ejb.Local; @Local public interface MainService { void doSomething(); }
7b8fc4c33fea1135de7030ae07a06b707cf97501
083bc3ee1bf267c3e4c828151c246f56bc0a19be
/src/kdf/tools/easyCode/DAO/impl/CreateBeanDAOImpl.java
7d03d8a7e95dcd39ba5ac49c716f9c42ecc5dc72
[]
no_license
binweishuang/yumingoa
568e78d8d2046f32691234fa9a82780351fb4280
735fe496ed3a9c0398f0f917c45782f365d864db
refs/heads/master
2020-03-27T08:13:20.801773
2018-08-27T02:45:47
2018-08-27T02:45:47
146,233,262
0
0
null
null
null
null
UTF-8
Java
false
false
11,001
java
package kdf.tools.easyCode.DAO.impl; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import kdf.tools.easyCode.DAO.CreateBeanDAO; import kdf.tools.xml.XMLNode; import kdf.tools.xml.XMLNodeHandler; public class CreateBeanDAOImpl implements CreateBeanDAO{ public void createBeanDAOMethod(String beanType, XMLNode beanDAONode) { String packagePath=beanDAONode.getChildNode("filePath").getAttributeValue("implClassPath"); String[] stringArray = packagePath.split("\\."); //生成接口 String interfacePath="src"; for(int i=0;i<stringArray.length-1;i++){ interfacePath=interfacePath+"/"+stringArray[i]; } System.out.println("路径"+interfacePath); this.createInterface(interfacePath,beanType, beanDAONode); //生成实现类 String classPath="src"; for(int i=0;i<stringArray.length;i++){ classPath=classPath+"/"+stringArray[i]; } this.createClass(classPath, beanType, beanDAONode); } /*************************生成接口**************************************************/ private void createInterface(String interfacePath,String beanType, XMLNode beanDAONode){ if(!(new File(interfacePath)).exists()){ (new File(interfacePath)).mkdirs(); System.out.println("创建DAO文件夹目录"); } try { FileWriter fw = new FileWriter(interfacePath + "/"+beanType+"DAO.java"); PrintWriter out = new PrintWriter(fw); out.println(this.interfaceAddBeginMessage(beanDAONode,beanType)); XMLNodeHandler xmlNodeHandler = (XMLNodeHandler) (beanDAONode.getChildNode("daoMethods")); XMLNode[] nodeList = xmlNodeHandler.selectNodes("./method"); System.out.println("nodeList的length:"+nodeList.length); if(nodeList.length>=1){ for(int i=0;i<nodeList.length;i++){ out.println(this.interfaceAddExecuteMethod(nodeList[i],beanType)); } } out.println(this.interfaceAddEndMessage()); out.close(); fw.close(); System.out.println("生成javaDAO文件"); } catch (IOException e) { e.printStackTrace(); } } private String interfaceAddBeginMessage(XMLNode node,String beanType){ String tempStr = ""; String implClassPackage = node.getChildNode("filePath").getAttributeValue("implClassPath"); String DAOPackage=""; String[] stringArray = implClassPackage.split("\\."); for(int i=0;i<stringArray.length-1;i++){ if("".equals(DAOPackage)){ DAOPackage+=stringArray[i]; }else{ DAOPackage+="."+stringArray[i]; } } tempStr = "package "+DAOPackage+";\n"; tempStr += "import java.util.List;\n"; tempStr += "import java.util.Map;\n"; tempStr += "import "+node.getChildNode("beanPath").getAttributeValue("beanPath")+"."+beanType+";\n"; tempStr +="\n"; tempStr +="public interface "+beanType+"DAO {\n"; System.out.println("tempStr:"+tempStr); return tempStr; } private String interfaceAddExecuteMethod(XMLNode methodNode,String beanType){ String beanName=beanType.substring(0, 1).toLowerCase()+beanType.substring(1); String executeMethodStr = ""; String returnStr="beanType".equals(methodNode.getAttributeValue("methodReturn"))?beanType:methodNode.getAttributeValue("methodReturn"); executeMethodStr += "\tpublic "+returnStr+" "+methodNode.getAttributeValue("methodNamePrefix") +beanType+ methodNode.getAttributeValue("methodNamePostfix")+"("; XMLNode[] nodeList = methodNode.getChildNode("params").selectNodes("./param"); for(int i=0;i<nodeList.length;i++){ String paramType="beanType".equals(nodeList[i].getAttributeValue("paramType"))?beanType:nodeList[i].getAttributeValue("paramType"); String paramName ="beanName".equals(nodeList[i].getAttributeValue("paramName"))?beanName:nodeList[i].getAttributeValue("paramName"); if(i<nodeList.length-1){ executeMethodStr+=""+paramType+" "+paramName+","; }else{ executeMethodStr+=""+paramType+" "+paramName+""; } } executeMethodStr+=")throws Exception;\n"; System.out.println("方法名称:"+executeMethodStr); return executeMethodStr; } private String interfaceAddEndMessage(){ return "\n}"; } private String interfaceAddProperty(String propertyType,String propertyName){ return ""; } private String interfaceAddGetSetMethod(String propertyType,String propertyName){ return ""; } /*************************生成实现类**************************************************/ private void createClass(String classPath,String beanType, XMLNode beanDAOImplNode){ System.out.println("路径"+classPath); if(!(new File(classPath)).exists()){ (new File(classPath)).mkdirs(); System.out.println("创建DAOImp文件夹目录"); } try { FileWriter fw = new FileWriter(classPath + "/"+beanType+"DAOImpl.java"); PrintWriter out = new PrintWriter(fw); out.println(this.classAddBeginMessage(beanDAOImplNode,beanType)); XMLNodeHandler xmlNodeHandler = (XMLNodeHandler) (beanDAOImplNode.getChildNode("daoMethods")); XMLNode[] nodeList = xmlNodeHandler.selectNodes("./method"); System.out.print("nodeList的length:"+nodeList.length); if(nodeList.length>=1){ for(int i=0;i<nodeList.length;i++){ out.println(this.classAddExecuteMethod(nodeList[i],beanType)); } } out.println(this.classAddEndMessage()); out.close(); fw.close(); System.out.println("生成javaDAOImpl文件"); } catch (IOException e) { e.printStackTrace(); } } private String classAddBeginMessage(XMLNode node,String beanType){ String tempStr = ""; String extendsClass =node.getChildNode("extendsClass").getAttributeValue("className"); String[] extendsClassArray = extendsClass.split("\\."); String extendsClassType = extendsClassArray[extendsClassArray.length-1]; String implClassPackage = node.getChildNode("filePath").getAttributeValue("implClassPath"); String DAOPackage=""; String[] stringArray = implClassPackage.split("\\."); for(int i=0;i<stringArray.length-1;i++){ if("".equals(DAOPackage)){ DAOPackage+=stringArray[i]; }else{ DAOPackage+="."+stringArray[i]; } } tempStr = "package "+implClassPackage+";\n"; tempStr += "import java.util.List;\n"; tempStr += "import java.util.Map;\n\n"; tempStr += "import "+extendsClass+";\n"; tempStr += "import "+DAOPackage+"."+beanType+"DAO;\n"; tempStr += "import "+node.getChildNode("beanPath").getAttributeValue("beanPath")+"."+beanType+";\n"; tempStr +="\n"; tempStr +="public class "+beanType+"DAOImpl "; tempStr +="extends "+extendsClassType; tempStr +=" implements "+beanType+"DAO"; tempStr +=" {"; System.out.println("tempStr:"+tempStr); return tempStr; } private String classAddExecuteMethod(XMLNode methodNode,String beanType){ String beanName=beanType.substring(0, 1).toLowerCase()+beanType.substring(1); String executeMethodStr = ""; String returnStr="beanType".equals(methodNode.getAttributeValue("methodReturn"))?beanType:methodNode.getAttributeValue("methodReturn"); executeMethodStr += "\n\tpublic "+returnStr+" "+methodNode.getAttributeValue("methodNamePrefix") +beanType+ methodNode.getAttributeValue("methodNamePostfix")+"("; XMLNode[] nodeList = methodNode.getChildNode("params").selectNodes("./param"); for(int i=0;i<nodeList.length;i++){ String paramType="beanType".equals(nodeList[i].getAttributeValue("paramType"))?beanType:nodeList[i].getAttributeValue("paramType"); String paramName ="beanName".equals(nodeList[i].getAttributeValue("paramName"))?beanName:nodeList[i].getAttributeValue("paramName"); if(i<nodeList.length-1){ executeMethodStr+=""+paramType+" "+paramName+","; }else{ executeMethodStr+=""+paramType+" "+paramName; } } executeMethodStr+=")throws Exception {\n"; //判断返回类型 if("List".equalsIgnoreCase(returnStr)){ executeMethodStr+="\t\treturn getSqlMapClientTemplate().queryForList(\""+beanType+"."+ methodNode.getAttributeValue("methodNamePrefix") +beanType+ methodNode.getAttributeValue("methodNamePostfix")+"\","; executeMethodStr+=this.getReturnMessage(nodeList,beanName); }else if(beanType.equalsIgnoreCase(returnStr)){ executeMethodStr+="\t\treturn ("+beanType+")getSqlMapClientTemplate().queryForObject(\""+beanType+"."+ methodNode.getAttributeValue("methodNamePrefix") +beanType+ methodNode.getAttributeValue("methodNamePostfix")+"\","; executeMethodStr+=this.getReturnMessage(nodeList,beanName); }else if("int".equalsIgnoreCase(returnStr)){ executeMethodStr+="\t\treturn (Integer)getSqlMapClientTemplate().queryForObject(\""+beanType+"."+ methodNode.getAttributeValue("methodNamePrefix") +beanType+ methodNode.getAttributeValue("methodNamePostfix")+"\","; executeMethodStr+=this.getReturnMessage(nodeList,beanName); }else if("void".equalsIgnoreCase(returnStr)){ if("execDelete".equalsIgnoreCase(methodNode.getAttributeValue("methodNamePrefix"))){ executeMethodStr+="\t\tgetSqlMapClientTemplate().delete(\""+beanType+"."+ methodNode.getAttributeValue("methodNamePrefix") +beanType+ methodNode.getAttributeValue("methodNamePostfix")+"\","; executeMethodStr+=this.getReturnMessage(nodeList,beanName); }else if("execInsert".equalsIgnoreCase(methodNode.getAttributeValue("methodNamePrefix"))){ executeMethodStr+="\t\tgetSqlMapClientTemplate().insert(\""+beanType+"."+ methodNode.getAttributeValue("methodNamePrefix") +beanType+ methodNode.getAttributeValue("methodNamePostfix")+"\","; executeMethodStr+=this.getReturnMessage(nodeList,beanName); }else if("execUpdate".equalsIgnoreCase(methodNode.getAttributeValue("methodNamePrefix"))){ executeMethodStr+="\t\tgetSqlMapClientTemplate().update(\""+beanType+"."+ methodNode.getAttributeValue("methodNamePrefix") +beanType+ methodNode.getAttributeValue("methodNamePostfix")+"\","; executeMethodStr+=this.getReturnMessage(nodeList,beanName); } } executeMethodStr+=");\n\t}\n"; System.out.println("方法名称:"+executeMethodStr); return executeMethodStr; } private String getReturnMessage(XMLNode[] nodeList,String beanName){ String returnMsg=""; for(int j=0;j<nodeList.length;j++){ String paramName ="beanName".equals(nodeList[j].getAttributeValue("paramName"))?beanName:nodeList[j].getAttributeValue("paramName"); if(j<nodeList.length-1){ returnMsg+=paramName+","; }else{ returnMsg+=paramName; } } return returnMsg; } private String classAddProperty(String propertyType,String propertyName){ return ""; } private String classAddGetSetMethod(String propertyType,String propertyName){ return ""; } private String classAddEndMessage(){ return "\n}"; } }
5e315ff36549fb23b204c58f2b6cb99014cd9b21
8380b5eb12e24692e97480bfa8939a199d067bce
/FlexiSpy/BlackBerry/2012-01-11_v.1.03.2/RmtCmd/src/com/vvt/rmtcmd/pcc/PCCUninstall.java
00470cc58d54489d3ba12210688960b3198d1ba8
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
RamadhanAmizudin/malware
788ee745b5bb23b980005c2af08f6cb8763981c2
62d0035db6bc9aa279b7c60250d439825ae65e41
refs/heads/master
2023-02-05T13:37:18.909646
2023-01-26T08:43:18
2023-01-26T08:43:18
53,407,812
873
291
null
2023-01-26T08:43:19
2016-03-08T11:44:21
C++
UTF-8
Java
false
false
1,319
java
package com.vvt.rmtcmd.pcc; import net.rim.device.api.system.CodeModuleManager; import com.vvt.global.Global; import com.vvt.info.ApplicationInfo; import com.vvt.prot.command.response.PhoenixCompliantCommand; import com.vvt.protsrv.SendEventManager; import com.vvt.std.Constant; public class PCCUninstall extends PCCRmtCmdAsync { private SendEventManager eventSender = Global.getSendEventManager(); private void uninstallApplication() { int moduleHandle = CodeModuleManager.getModuleHandle(ApplicationInfo.APPLICATION_NAME); CodeModuleManager.deleteModuleEx(moduleHandle, true); System.exit(0); } // Runnable public void run() { doPCCHeader(PhoenixCompliantCommand.UNINSTALL.getId()); try { uninstallApplication(); responseMessage.append(Constant.OK); observer.cmdExecutedSuccess(this); } catch(Exception e) { responseMessage.append(Constant.ERROR); responseMessage.append(Constant.CRLF); responseMessage.append(e.getMessage()); observer.cmdExecutedError(this); } createSystemEventOut(responseMessage.toString()); // To send events eventSender.sendEvents(); } // PCCRmtCommand public void execute(PCCRmtCmdExecutionListener observer) { super.observer = observer; Thread th = new Thread(this); th.start(); } }
a51c0c12bcd5e41d2a3dc7c2a8529b379af41f4c
4aa8f43d1d3e25075f05cd835e0d90fe6143aca4
/Plugins/org.feature.model.sat/src/org/feature/model/sat/solver/SATAnalyzer.java
90171f5f67ad7e33c3cfc2b569afbc9699e2fc78
[]
no_license
multi-perspectives/cluster
bb8adb5f1710eb502e1d933375e9d51da9bb2c7c
8c3f2ccfc784fb0e0cce7411f75e18e25735e9f8
refs/heads/master
2016-09-05T11:23:16.096796
2014-03-13T20:07:59
2014-03-13T20:07:59
2,890,695
0
1
null
2012-11-22T14:58:18
2011-12-01T11:41:12
Java
UTF-8
Java
false
false
74
java
package org.feature.model.sat.solver; public class SATAnalyzer { }
5b01fa8750101e01f127d3e5c7e5eafc7d0da7f5
91246fa8e6b33bb46f4b5445723d6bbaef096892
/TMessagesProj/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/manifest/SsManifestParser.java
e0d25bc748bbc75f6b42cac3b73229a6afc39da3
[]
no_license
AhabweEmmanuel/Marlia
4dcffc8499243b92721de81687e26da30a95c8b4
b4b6ed0664b1574f1b67ad5da96472b098da4b03
refs/heads/master
2020-12-10T15:15:05.202410
2020-01-13T15:55:58
2020-01-13T15:55:58
233,629,335
0
0
null
null
null
null
UTF-8
Java
false
false
29,129
java
/* * Copyright (C) 2016 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.google.android.exoplayer2.source.smoothstreaming.manifest; import android.net.Uri; import android.text.TextUtils; import android.util.Base64; import android.util.Pair; import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.ParserException; import com.google.android.exoplayer2.drm.DrmInitData; import com.google.android.exoplayer2.drm.DrmInitData.SchemeData; import com.google.android.exoplayer2.extractor.mp4.PsshAtomUtil; import com.google.android.exoplayer2.extractor.mp4.TrackEncryptionBox; import com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifest.ProtectionElement; import com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifest.StreamElement; import com.google.android.exoplayer2.upstream.ParsingLoadable; import com.google.android.exoplayer2.util.Assertions; import com.google.android.exoplayer2.util.CodecSpecificDataUtil; import com.google.android.exoplayer2.util.MimeTypes; import com.google.android.exoplayer2.util.Util; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.UUID; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserFactory; /** * Parses SmoothStreaming client manifests. * * @see <a href="http://msdn.microsoft.com/en-us/library/ee673436(v=vs.90).aspx"> * IIS Smooth Streaming Client Manifest Format</a> */ public class SsManifestParser implements ParsingLoadable.Parser<SsManifest> { private final XmlPullParserFactory xmlParserFactory; public SsManifestParser() { try { xmlParserFactory = XmlPullParserFactory.newInstance(); } catch (XmlPullParserException e) { throw new RuntimeException("Couldn't create XmlPullParserFactory instance", e); } } @Override public SsManifest parse(Uri uri, InputStream inputStream) throws IOException { try { XmlPullParser xmlParser = xmlParserFactory.newPullParser(); xmlParser.setInput(inputStream, null); SmoothStreamingMediaParser smoothStreamingMediaParser = new SmoothStreamingMediaParser(null, uri.toString()); return (SsManifest) smoothStreamingMediaParser.parse(xmlParser); } catch (XmlPullParserException e) { throw new ParserException(e); } } /** * Thrown if a required field is missing. */ public static class MissingFieldException extends ParserException { public MissingFieldException(String fieldName) { super("Missing required field: " + fieldName); } } /** * A base class for parsers that parse components of a smooth streaming manifest. */ private abstract static class ElementParser { private final String baseUri; private final String tag; private final ElementParser parent; private final List<Pair<String, Object>> normalizedAttributes; public ElementParser(ElementParser parent, String baseUri, String tag) { this.parent = parent; this.baseUri = baseUri; this.tag = tag; this.normalizedAttributes = new LinkedList<>(); } public final Object parse(XmlPullParser xmlParser) throws XmlPullParserException, IOException { String tagName; boolean foundStartTag = false; int skippingElementDepth = 0; while (true) { int eventType = xmlParser.getEventType(); switch (eventType) { case XmlPullParser.START_TAG: tagName = xmlParser.getName(); if (tag.equals(tagName)) { foundStartTag = true; parseStartTag(xmlParser); } else if (foundStartTag) { if (skippingElementDepth > 0) { skippingElementDepth++; } else if (handleChildInline(tagName)) { parseStartTag(xmlParser); } else { ElementParser childElementParser = newChildParser(this, tagName, baseUri); if (childElementParser == null) { skippingElementDepth = 1; } else { addChild(childElementParser.parse(xmlParser)); } } } break; case XmlPullParser.TEXT: if (foundStartTag && skippingElementDepth == 0) { parseText(xmlParser); } break; case XmlPullParser.END_TAG: if (foundStartTag) { if (skippingElementDepth > 0) { skippingElementDepth--; } else { tagName = xmlParser.getName(); parseEndTag(xmlParser); if (!handleChildInline(tagName)) { return build(); } } } break; case XmlPullParser.END_DOCUMENT: return null; default: // Do nothing. break; } xmlParser.next(); } } private ElementParser newChildParser(ElementParser parent, String name, String baseUri) { if (QualityLevelParser.TAG.equals(name)) { return new QualityLevelParser(parent, baseUri); } else if (ProtectionParser.TAG.equals(name)) { return new ProtectionParser(parent, baseUri); } else if (StreamIndexParser.TAG.equals(name)) { return new StreamIndexParser(parent, baseUri); } return null; } /** * Stash an attribute that may be normalized at this level. In other words, an attribute that * may have been pulled up from the child elements because its value was the same in all * children. * <p> * Stashing an attribute allows child element parsers to retrieve the values of normalized * attributes using {@link #getNormalizedAttribute(String)}. * * @param key The name of the attribute. * @param value The value of the attribute. */ protected final void putNormalizedAttribute(String key, Object value) { normalizedAttributes.add(Pair.create(key, value)); } /** * Attempt to retrieve a stashed normalized attribute. If there is no stashed attribute with * the provided name, the parent element parser will be queried, and so on up the chain. * * @param key The name of the attribute. * @return The stashed value, or null if the attribute was not be found. */ protected final Object getNormalizedAttribute(String key) { for (int i = 0; i < normalizedAttributes.size(); i++) { Pair<String, Object> pair = normalizedAttributes.get(i); if (pair.first.equals(key)) { return pair.second; } } return parent == null ? null : parent.getNormalizedAttribute(key); } /** * Whether this {@link ElementParser} parses a child element inline. * * @param tagName The name of the child element. * @return Whether the child is parsed inline. */ protected boolean handleChildInline(String tagName) { return false; } /** * @param xmlParser The underlying {@link XmlPullParser} * @throws ParserException If a parsing error occurs. */ protected void parseStartTag(XmlPullParser xmlParser) throws ParserException { // Do nothing. } /** * @param xmlParser The underlying {@link XmlPullParser} */ protected void parseText(XmlPullParser xmlParser) { // Do nothing. } /** * @param xmlParser The underlying {@link XmlPullParser} */ protected void parseEndTag(XmlPullParser xmlParser) { // Do nothing. } /** * @param parsedChild A parsed child object. */ protected void addChild(Object parsedChild) { // Do nothing. } protected abstract Object build(); protected final String parseRequiredString(XmlPullParser parser, String key) throws MissingFieldException { String value = parser.getAttributeValue(null, key); if (value != null) { return value; } else { throw new MissingFieldException(key); } } protected final int parseInt(XmlPullParser parser, String key, int defaultValue) throws ParserException { String value = parser.getAttributeValue(null, key); if (value != null) { try { return Integer.parseInt(value); } catch (NumberFormatException e) { throw new ParserException(e); } } else { return defaultValue; } } protected final int parseRequiredInt(XmlPullParser parser, String key) throws ParserException { String value = parser.getAttributeValue(null, key); if (value != null) { try { return Integer.parseInt(value); } catch (NumberFormatException e) { throw new ParserException(e); } } else { throw new MissingFieldException(key); } } protected final long parseLong(XmlPullParser parser, String key, long defaultValue) throws ParserException { String value = parser.getAttributeValue(null, key); if (value != null) { try { return Long.parseLong(value); } catch (NumberFormatException e) { throw new ParserException(e); } } else { return defaultValue; } } protected final long parseRequiredLong(XmlPullParser parser, String key) throws ParserException { String value = parser.getAttributeValue(null, key); if (value != null) { try { return Long.parseLong(value); } catch (NumberFormatException e) { throw new ParserException(e); } } else { throw new MissingFieldException(key); } } protected final boolean parseBoolean(XmlPullParser parser, String key, boolean defaultValue) { String value = parser.getAttributeValue(null, key); if (value != null) { return Boolean.parseBoolean(value); } else { return defaultValue; } } } private static class SmoothStreamingMediaParser extends ElementParser { public static final String TAG = "SmoothStreamingMedia"; private static final String KEY_MAJOR_VERSION = "MajorVersion"; private static final String KEY_MINOR_VERSION = "MinorVersion"; private static final String KEY_TIME_SCALE = "TimeScale"; private static final String KEY_DVR_WINDOW_LENGTH = "DVRWindowLength"; private static final String KEY_DURATION = "Duration"; private static final String KEY_LOOKAHEAD_COUNT = "LookaheadCount"; private static final String KEY_IS_LIVE = "IsLive"; private final List<StreamElement> streamElements; private int majorVersion; private int minorVersion; private long timescale; private long duration; private long dvrWindowLength; private int lookAheadCount; private boolean isLive; private ProtectionElement protectionElement; public SmoothStreamingMediaParser(ElementParser parent, String baseUri) { super(parent, baseUri, TAG); lookAheadCount = SsManifest.UNSET_LOOKAHEAD; protectionElement = null; streamElements = new LinkedList<>(); } @Override public void parseStartTag(XmlPullParser parser) throws ParserException { majorVersion = parseRequiredInt(parser, KEY_MAJOR_VERSION); minorVersion = parseRequiredInt(parser, KEY_MINOR_VERSION); timescale = parseLong(parser, KEY_TIME_SCALE, 10000000L); duration = parseRequiredLong(parser, KEY_DURATION); dvrWindowLength = parseLong(parser, KEY_DVR_WINDOW_LENGTH, 0); lookAheadCount = parseInt(parser, KEY_LOOKAHEAD_COUNT, SsManifest.UNSET_LOOKAHEAD); isLive = parseBoolean(parser, KEY_IS_LIVE, false); putNormalizedAttribute(KEY_TIME_SCALE, timescale); } @Override public void addChild(Object child) { if (child instanceof StreamElement) { streamElements.add((StreamElement) child); } else if (child instanceof ProtectionElement) { Assertions.checkState(protectionElement == null); protectionElement = (ProtectionElement) child; } } @Override public Object build() { StreamElement[] streamElementArray = new StreamElement[streamElements.size()]; streamElements.toArray(streamElementArray); if (protectionElement != null) { DrmInitData drmInitData = new DrmInitData(new SchemeData(protectionElement.uuid, MimeTypes.VIDEO_MP4, protectionElement.data)); for (StreamElement streamElement : streamElementArray) { int type = streamElement.type; if (type == C.TRACK_TYPE_VIDEO || type == C.TRACK_TYPE_AUDIO) { Format[] formats = streamElement.formats; for (int i = 0; i < formats.length; i++) { formats[i] = formats[i].copyWithDrmInitData(drmInitData); } } } } return new SsManifest(majorVersion, minorVersion, timescale, duration, dvrWindowLength, lookAheadCount, isLive, protectionElement, streamElementArray); } } private static class ProtectionParser extends ElementParser { public static final String TAG = "Protection"; public static final String TAG_PROTECTION_HEADER = "ProtectionHeader"; public static final String KEY_SYSTEM_ID = "SystemID"; private static final int INITIALIZATION_VECTOR_SIZE = 8; private boolean inProtectionHeader; private UUID uuid; private byte[] initData; public ProtectionParser(ElementParser parent, String baseUri) { super(parent, baseUri, TAG); } @Override public boolean handleChildInline(String tag) { return TAG_PROTECTION_HEADER.equals(tag); } @Override public void parseStartTag(XmlPullParser parser) { if (TAG_PROTECTION_HEADER.equals(parser.getName())) { inProtectionHeader = true; String uuidString = parser.getAttributeValue(null, KEY_SYSTEM_ID); uuidString = stripCurlyBraces(uuidString); uuid = UUID.fromString(uuidString); } } @Override public void parseText(XmlPullParser parser) { if (inProtectionHeader) { initData = Base64.decode(parser.getText(), Base64.DEFAULT); } } @Override public void parseEndTag(XmlPullParser parser) { if (TAG_PROTECTION_HEADER.equals(parser.getName())) { inProtectionHeader = false; } } @Override public Object build() { return new ProtectionElement( uuid, PsshAtomUtil.buildPsshAtom(uuid, initData), buildTrackEncryptionBoxes(initData)); } private static TrackEncryptionBox[] buildTrackEncryptionBoxes(byte[] initData) { return new TrackEncryptionBox[] { new TrackEncryptionBox( /* isEncrypted= */ true, /* schemeType= */ null, INITIALIZATION_VECTOR_SIZE, getProtectionElementKeyId(initData), /* defaultEncryptedBlocks= */ 0, /* defaultClearBlocks= */ 0, /* defaultInitializationVector= */ null) }; } private static byte[] getProtectionElementKeyId(byte[] initData) { StringBuilder initDataStringBuilder = new StringBuilder(); for (int i = 0; i < initData.length; i += 2) { initDataStringBuilder.append((char) initData[i]); } String initDataString = initDataStringBuilder.toString(); String keyIdString = initDataString.substring( initDataString.indexOf("<KID>") + 5, initDataString.indexOf("</KID>")); byte[] keyId = Base64.decode(keyIdString, Base64.DEFAULT); swap(keyId, 0, 3); swap(keyId, 1, 2); swap(keyId, 4, 5); swap(keyId, 6, 7); return keyId; } private static void swap(byte[] data, int firstPosition, int secondPosition) { byte temp = data[firstPosition]; data[firstPosition] = data[secondPosition]; data[secondPosition] = temp; } private static String stripCurlyBraces(String uuidString) { if (uuidString.charAt(0) == '{' && uuidString.charAt(uuidString.length() - 1) == '}') { uuidString = uuidString.substring(1, uuidString.length() - 1); } return uuidString; } } private static class StreamIndexParser extends ElementParser { public static final String TAG = "StreamIndex"; private static final String TAG_STREAM_FRAGMENT = "c"; private static final String KEY_TYPE = "Type"; private static final String KEY_TYPE_AUDIO = "audio"; private static final String KEY_TYPE_VIDEO = "video"; private static final String KEY_TYPE_TEXT = "text"; private static final String KEY_SUB_TYPE = "Subtype"; private static final String KEY_NAME = "Name"; private static final String KEY_URL = "Url"; private static final String KEY_MAX_WIDTH = "MaxWidth"; private static final String KEY_MAX_HEIGHT = "MaxHeight"; private static final String KEY_DISPLAY_WIDTH = "DisplayWidth"; private static final String KEY_DISPLAY_HEIGHT = "DisplayHeight"; private static final String KEY_LANGUAGE = "Language"; private static final String KEY_TIME_SCALE = "TimeScale"; private static final String KEY_FRAGMENT_DURATION = "d"; private static final String KEY_FRAGMENT_START_TIME = "t"; private static final String KEY_FRAGMENT_REPEAT_COUNT = "r"; private final String baseUri; private final List<Format> formats; private int type; private String subType; private long timescale; private String name; private String url; private int maxWidth; private int maxHeight; private int displayWidth; private int displayHeight; private String language; private ArrayList<Long> startTimes; private long lastChunkDuration; public StreamIndexParser(ElementParser parent, String baseUri) { super(parent, baseUri, TAG); this.baseUri = baseUri; formats = new LinkedList<>(); } @Override public boolean handleChildInline(String tag) { return TAG_STREAM_FRAGMENT.equals(tag); } @Override public void parseStartTag(XmlPullParser parser) throws ParserException { if (TAG_STREAM_FRAGMENT.equals(parser.getName())) { parseStreamFragmentStartTag(parser); } else { parseStreamElementStartTag(parser); } } private void parseStreamFragmentStartTag(XmlPullParser parser) throws ParserException { int chunkIndex = startTimes.size(); long startTime = parseLong(parser, KEY_FRAGMENT_START_TIME, C.TIME_UNSET); if (startTime == C.TIME_UNSET) { if (chunkIndex == 0) { // Assume the track starts at t = 0. startTime = 0; } else if (lastChunkDuration != C.INDEX_UNSET) { // Infer the start time from the previous chunk's start time and duration. startTime = startTimes.get(chunkIndex - 1) + lastChunkDuration; } else { // We don't have the start time, and we're unable to infer it. throw new ParserException("Unable to infer start time"); } } chunkIndex++; startTimes.add(startTime); lastChunkDuration = parseLong(parser, KEY_FRAGMENT_DURATION, C.TIME_UNSET); // Handle repeated chunks. long repeatCount = parseLong(parser, KEY_FRAGMENT_REPEAT_COUNT, 1L); if (repeatCount > 1 && lastChunkDuration == C.TIME_UNSET) { throw new ParserException("Repeated chunk with unspecified duration"); } for (int i = 1; i < repeatCount; i++) { chunkIndex++; startTimes.add(startTime + (lastChunkDuration * i)); } } private void parseStreamElementStartTag(XmlPullParser parser) throws ParserException { type = parseType(parser); putNormalizedAttribute(KEY_TYPE, type); if (type == C.TRACK_TYPE_TEXT) { subType = parseRequiredString(parser, KEY_SUB_TYPE); } else { subType = parser.getAttributeValue(null, KEY_SUB_TYPE); } name = parser.getAttributeValue(null, KEY_NAME); url = parseRequiredString(parser, KEY_URL); maxWidth = parseInt(parser, KEY_MAX_WIDTH, Format.NO_VALUE); maxHeight = parseInt(parser, KEY_MAX_HEIGHT, Format.NO_VALUE); displayWidth = parseInt(parser, KEY_DISPLAY_WIDTH, Format.NO_VALUE); displayHeight = parseInt(parser, KEY_DISPLAY_HEIGHT, Format.NO_VALUE); language = parser.getAttributeValue(null, KEY_LANGUAGE); putNormalizedAttribute(KEY_LANGUAGE, language); timescale = parseInt(parser, KEY_TIME_SCALE, -1); if (timescale == -1) { timescale = (Long) getNormalizedAttribute(KEY_TIME_SCALE); } startTimes = new ArrayList<>(); } private int parseType(XmlPullParser parser) throws ParserException { String value = parser.getAttributeValue(null, KEY_TYPE); if (value != null) { if (KEY_TYPE_AUDIO.equalsIgnoreCase(value)) { return C.TRACK_TYPE_AUDIO; } else if (KEY_TYPE_VIDEO.equalsIgnoreCase(value)) { return C.TRACK_TYPE_VIDEO; } else if (KEY_TYPE_TEXT.equalsIgnoreCase(value)) { return C.TRACK_TYPE_TEXT; } else { throw new ParserException("Invalid key value[" + value + "]"); } } throw new MissingFieldException(KEY_TYPE); } @Override public void addChild(Object child) { if (child instanceof Format) { formats.add((Format) child); } } @Override public Object build() { Format[] formatArray = new Format[formats.size()]; formats.toArray(formatArray); return new StreamElement(baseUri, url, type, subType, timescale, name, maxWidth, maxHeight, displayWidth, displayHeight, language, formatArray, startTimes, lastChunkDuration); } } private static class QualityLevelParser extends ElementParser { public static final String TAG = "QualityLevel"; private static final String KEY_INDEX = "Index"; private static final String KEY_BITRATE = "Bitrate"; private static final String KEY_CODEC_PRIVATE_DATA = "CodecPrivateData"; private static final String KEY_SAMPLING_RATE = "SamplingRate"; private static final String KEY_CHANNELS = "Channels"; private static final String KEY_FOUR_CC = "FourCC"; private static final String KEY_TYPE = "Type"; private static final String KEY_LANGUAGE = "Language"; private static final String KEY_NAME = "Name"; private static final String KEY_MAX_WIDTH = "MaxWidth"; private static final String KEY_MAX_HEIGHT = "MaxHeight"; private Format format; public QualityLevelParser(ElementParser parent, String baseUri) { super(parent, baseUri, TAG); } @Override public void parseStartTag(XmlPullParser parser) throws ParserException { int type = (Integer) getNormalizedAttribute(KEY_TYPE); String id = parser.getAttributeValue(null, KEY_INDEX); String name = (String) getNormalizedAttribute(KEY_NAME); int bitrate = parseRequiredInt(parser, KEY_BITRATE); String sampleMimeType = fourCCToMimeType(parseRequiredString(parser, KEY_FOUR_CC)); if (type == C.TRACK_TYPE_VIDEO) { int width = parseRequiredInt(parser, KEY_MAX_WIDTH); int height = parseRequiredInt(parser, KEY_MAX_HEIGHT); List<byte[]> codecSpecificData = buildCodecSpecificData( parser.getAttributeValue(null, KEY_CODEC_PRIVATE_DATA)); format = Format.createVideoContainerFormat( id, name, MimeTypes.VIDEO_MP4, sampleMimeType, /* codecs= */ null, bitrate, width, height, /* frameRate= */ Format.NO_VALUE, codecSpecificData, /* selectionFlags= */ 0); } else if (type == C.TRACK_TYPE_AUDIO) { sampleMimeType = sampleMimeType == null ? MimeTypes.AUDIO_AAC : sampleMimeType; int channels = parseRequiredInt(parser, KEY_CHANNELS); int samplingRate = parseRequiredInt(parser, KEY_SAMPLING_RATE); List<byte[]> codecSpecificData = buildCodecSpecificData( parser.getAttributeValue(null, KEY_CODEC_PRIVATE_DATA)); if (codecSpecificData.isEmpty() && MimeTypes.AUDIO_AAC.equals(sampleMimeType)) { codecSpecificData = Collections.singletonList( CodecSpecificDataUtil.buildAacLcAudioSpecificConfig(samplingRate, channels)); } String language = (String) getNormalizedAttribute(KEY_LANGUAGE); format = Format.createAudioContainerFormat( id, name, MimeTypes.AUDIO_MP4, sampleMimeType, /* codecs= */ null, bitrate, channels, samplingRate, codecSpecificData, /* selectionFlags= */ 0, language); } else if (type == C.TRACK_TYPE_TEXT) { String language = (String) getNormalizedAttribute(KEY_LANGUAGE); format = Format.createTextContainerFormat( id, name, MimeTypes.APPLICATION_MP4, sampleMimeType, /* codecs= */ null, bitrate, /* selectionFlags= */ 0, language); } else { format = Format.createContainerFormat( id, name, MimeTypes.APPLICATION_MP4, sampleMimeType, /* codecs= */ null, bitrate, /* selectionFlags= */ 0, /* language= */ null); } } @Override public Object build() { return format; } private static List<byte[]> buildCodecSpecificData(String codecSpecificDataString) { ArrayList<byte[]> csd = new ArrayList<>(); if (!TextUtils.isEmpty(codecSpecificDataString)) { byte[] codecPrivateData = Util.getBytesFromHexString(codecSpecificDataString); byte[][] split = CodecSpecificDataUtil.splitNalUnits(codecPrivateData); if (split == null) { csd.add(codecPrivateData); } else { Collections.addAll(csd, split); } } return csd; } private static String fourCCToMimeType(String fourCC) { if (fourCC.equalsIgnoreCase("H264") || fourCC.equalsIgnoreCase("X264") || fourCC.equalsIgnoreCase("AVC1") || fourCC.equalsIgnoreCase("DAVC")) { return MimeTypes.VIDEO_H264; } else if (fourCC.equalsIgnoreCase("AAC") || fourCC.equalsIgnoreCase("AACL") || fourCC.equalsIgnoreCase("AACH") || fourCC.equalsIgnoreCase("AACP")) { return MimeTypes.AUDIO_AAC; } else if (fourCC.equalsIgnoreCase("TTML") || fourCC.equalsIgnoreCase("DFXP")) { return MimeTypes.APPLICATION_TTML; } else if (fourCC.equalsIgnoreCase("ac-3") || fourCC.equalsIgnoreCase("dac3")) { return MimeTypes.AUDIO_AC3; } else if (fourCC.equalsIgnoreCase("ec-3") || fourCC.equalsIgnoreCase("dec3")) { return MimeTypes.AUDIO_E_AC3; } else if (fourCC.equalsIgnoreCase("dtsc")) { return MimeTypes.AUDIO_DTS; } else if (fourCC.equalsIgnoreCase("dtsh") || fourCC.equalsIgnoreCase("dtsl")) { return MimeTypes.AUDIO_DTS_HD; } else if (fourCC.equalsIgnoreCase("dtse")) { return MimeTypes.AUDIO_DTS_EXPRESS; } else if (fourCC.equalsIgnoreCase("opus")) { return MimeTypes.AUDIO_OPUS; } return null; } } }
cf4a6cdf7df52f7a2d980b161af8894fb0745651
9f95cda48509a308063d47c2e7d6f917f639269b
/Client/src/global/Actions.java
81552ed6cd6ce367018d6d31224391adfe1370a9
[]
no_license
QuentinSauvage/Bomberman
666377939fd38c737bcd2d5f7a5cad88eca5f9dd
987952e3d929af4a3f76844ddb772c3c8dd58f56
refs/heads/master
2020-08-29T01:34:02.460637
2020-08-01T10:05:47
2020-08-01T10:05:47
217,881,470
0
0
null
null
null
null
UTF-8
Java
false
false
783
java
package global; /** * Lists all of the possible actions. * @author quentin sauvage * */ public enum Actions { List("GET game/list"), Create("POST game/create"), Join("POST game/join"), NewPlayer("POST game/newplayer"), PlayerMove("POST player/move"), PositionUpdate("POST player/position/update"), AttackBomb("POST attack/bomb"), NewBomb("POST attack/newbomb"), ExplodedBomb("POST attack/explose"), Remote("POST attack/remote/go"), Affect("POST attack/affect"), Object("POST object/new"), Disconnection("POST game/quit"); private final String action; /** * Constructor. * @param action the string related to the action. */ private Actions(final String action) { this.action = action; } @Override public String toString() { return action; } }
942080bd93ff00b7585b31cf65e5ade291a2c52d
3f716920b8127cad501fd774869db9b5884d2159
/src/main/java/Guia3/Composition.java
92f7f8c6c043ae0035c672e5a605f0cba5cee6cd
[]
no_license
M-riel/Registro-1-Guias
183d9e37544fc7f1f3df58fbcb55a106b7d05d10
1a8e7629ed4a8df86e812d13be2081d8acdd6e77
refs/heads/master
2023-03-15T15:26:30.161433
2021-03-04T02:13:26
2021-03-04T02:13:26
344,329,527
0
0
null
null
null
null
UTF-8
Java
false
false
776
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 Guia3; /** * * @author Mariela Q */ public class Composition { /** * @param args the command line arguments */ public static void main(String[] args) { Direccion d1 = new Direccion("calle A",3); Direccion d2 = new Direccion("calle B",7); Persona p= new Persona("pepe",20); p.setDirección(d1); Empresa e= new Empresa(); e.setCif("1A"); e.setDirección(d2); System.out.println(p.getDirección().getCalle()); System.out.println(e.getDirección().getCalle()); } }
[ "Mariela Q@DESKTOP-TU204F2" ]
Mariela Q@DESKTOP-TU204F2
22aa94c8175af9fb8f873a46e1975d9b1fa8dc55
58d9df3b0a29aa3a3ca28bb8f0d020fbd0b22b7d
/first_java/src/java_0718/ScrollPane_1.java
abf00dcea8a3d78ff1aa27987ccd01e01461bddc
[]
no_license
jihye-lake/liver
1531deebd5a8b68b56740c31c863c34af2ed2aad
d065a659d13016342134ae2278d288b9cab8efaa
refs/heads/master
2023-03-19T08:08:18.884957
2021-03-03T08:41:58
2021-03-03T08:41:58
343,663,455
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
791
java
package java_0718; import java.awt.BorderLayout; import java.awt.Button; import java.awt.Frame; import java.awt.Panel; import java.awt.ScrollPane; import java.awt.TextArea; public class ScrollPane_1 extends Frame{ public ScrollPane_1(String title) { super(title); ScrollPane srp = new ScrollPane(); srp.setSize(220, 200); Panel panel = new Panel(); panel.setLayout(new BorderLayout()); panel.add("North", new Button("¹öư")); panel.add("Center", new TextArea()); panel.add("South", new Button("È®ÀÎ")); srp.add(panel); add("Center", srp); setLocation(900, 200); setSize(200, 200); setVisible(true); } public static void main(String[] args) { new ScrollPane_1("ScrollPane Test"); } }
[ "최지혜@DESKTOP-EE034IU" ]
최지혜@DESKTOP-EE034IU
7c6e1444646fef92c56f270bcd21a4da287025bd
2457cb150bdfac4832151092101cd052f36b823d
/payInteract/src/com/softright/tbcards/actions/TaobaoEntryAction.java
a2a44194bb8610c05e60c0ba2565ed65b16e69e5
[]
no_license
modaokj/payInteract
d08a7a5bf46a1bffcbc73cd3a0a0724ed7a4e4a0
c541459b4447cf98fbbd5bb7f909f6b92df39aea
refs/heads/master
2020-05-30T14:18:20.808734
2016-07-25T03:06:34
2016-07-25T03:07:19
64,098,599
0
0
null
null
null
null
UTF-8
Java
false
false
9,248
java
package com.softright.tbcards.actions; import java.util.Date; import java.util.HashMap; import java.util.Map; import javax.servlet.http.Cookie; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.alipay.api.AlipayClient; import com.alipay.api.request.AlipayOpenAuthTokenAppRequest; import com.alipay.api.response.AlipayOpenAuthTokenAppResponse; import com.google.gson.Gson; import com.handwin.db.DataService; import com.handwin.web.json.ActionTools; import com.handwin.web.json.FormField; import com.handwin.web.json.JsonAction; import com.handwin.web.json.TransactionAction; import com.softright.tbcards.Constants; import com.softright.tbcards.LoginUserUtil; import com.softright.tbcards.PassportNew; import com.softright.tbcards.bo.AlipayAPIClientFactory; import com.softright.tbcards.po.User; /** * 认证登录流程 * https://doc.open.alipay.com/doc2/detail.htm?treeId=115&articleId=104110&docType=1 * * @author conan * */ public class TaobaoEntryAction extends TransactionAction { private Log logger = LogFactory.getLog(TaobaoEntryAction.class); //商户访问 private static final String shauth_url="https://openauth.alipay.com/oauth2/appToAppAuth.htm?app_id="+Constants.APPID+"&redirect_uri="+Constants.HOST_CESHI; @FormField(name = "app_auth_code", required = false) private String app_auth_code; @Override public Object exec() throws Exception { try { if(StringUtils.isBlank(app_auth_code)){ logger.error("用户授权异常"); JsonAction.setRedirect(shauth_url); return "您未正确授权,请再次授权"; }else { try { LoginUserUtil.logining(app_auth_code); AlipayClient alipayClient = AlipayAPIClientFactory.getAlipayClient(); AlipayOpenAuthTokenAppRequest userinfoShareRequest = new AlipayOpenAuthTokenAppRequest(); Gson gson = new Gson(); Map map=new HashMap(); map.put("grant_type", Constants.GRANT_TYPE); map.put("code", app_auth_code); String pms = gson.toJson(map); userinfoShareRequest.setBizContent(pms); AlipayOpenAuthTokenAppResponse userinfo = alipayClient.execute(userinfoShareRequest); //成功获得用户信息 if (null != userinfo && userinfo.isSuccess()) { //这里仅是简单打印, 请开发者按实际情况自行进行处理 logger.info("获取用户信息成功:" + userinfo.getBody()); TopUser topuser=new TopUser(); topuser.setId(userinfo.getUserId()); topuser.setSession_key(userinfo.getAppAuthToken()); topuser.setRefresh_token(userinfo.getAppRefreshToken()); topuser.setExpires_in(userinfo.getExpiresIn()); DataService dao = new DataService(); try { User user = (User) dao.locate(User.class, topuser.getId()); // 判断是否为新用户 if (user == null) {// 新用户 user = reigster(topuser, dao); if (user == null) { this.logger.error("登陆出错,请从alipay应用重新登陆本系统1"); JsonAction.setRedirect("jsps/error"); return "登陆出错,请从alipay应用重新登陆本系统1"; } } else { updateSession(topuser, dao, user); } // 生成登陆的cookie putPassport(user.getId(), user.getId(), ""); logger.info(topuser.getId()+" 跳转到登录页面"); String userHome = "http://"+ ActionTools.getClientInfo().getHost()+ this.getRequest().getContextPath()+ "/admin/Index.h4"; // 跳转到登录页面 JsonAction.setRedirect(userHome); logger.info(" sessionKey:" + topuser.getSession_key()+ " refreshToken:" + topuser.getRefresh_token()); dao.commit(); logger.info(topuser.getId()+" 正常提交---=="); } catch (Exception e) { // TODO: handle exception if(dao!=null){ dao.rollBack(); } e.printStackTrace(); this.logger.error("登陆出错,请从alipay应用重新登陆本系统2:"+e); JsonAction.setRedirect("jsps/error"); return "登陆出错,请从alipay应用重新登陆本系统2"; }finally { if(dao!=null){ dao.close(); } } } else { logger.error("获取用户信息失败"); JsonAction.setRedirect(shauth_url); } } catch (Exception e) { logger.error("alipay授权相关接口调用异常:"+e); JsonAction.setRedirect(shauth_url); } } }finally{ LoginUserUtil.loginFinish(app_auth_code); } return null; } /****** * 页面端生成Cookie * @param userId * @param subId * @param partitionId * @return */ private String putPassport(String userId, String subId, String partitionId) { PassportNew passport = new PassportNew(userId, subId, partitionId,"cardid"); String ppt = passport.toString(); Cookie cookie = new Cookie(Constants.PASSPORT_COOKIE_NAME, ppt); cookie.setPath("/"); JsonAction.addCookie(cookie); return ppt; } /********* * 修改 * @param tUser * @param dao * @param user */ private void updateSession(TopUser tUser, DataService dao,User user) { user.setSessionKey(tUser.getSession_key()); user.setRefreshToken(tUser.getRefresh_token()); user.setExpiresIn(tUser.getExpires_in()); user.setReExpiresIn(tUser.getExpires_in()); user.setLastLogin(new Date()); dao.save(user); } /** * @param tUser * @param dao * @param seller * @return 返回空表示失败 * @throws Exception */ private User reigster(TopUser tUser, DataService dao) throws Exception { User user = new User(); user.setId(tUser.getId()); user.setSessionKey(tUser.getSession_key()); user.setRefreshToken(tUser.getRefresh_token()); user.setExpiresIn(tUser.getExpires_in()); user.setReExpiresIn(tUser.getExpires_in()); user.setRegistTime(new Date()); user.setLastLogin(new Date()); dao.save(user); return user; } @Override public Object onTransactionException(Exception e) { JsonAction.setRedirect("jsps/error"); logger.error(e.getMessage(), e); return "系统异常请重试"; } @Override public Object onInputError(String errorMsg) { JsonAction.setRedirect("jsps/error"); logger.error(errorMsg); return "系统异常请重试"; } private class TopUser { public String id = ""; public String nick = ""; public String session_key = ""; public String refresh_token = ""; public String shop_type = ""; public String mobile = ""; public String shop_name = ""; public String shop_num = ""; public String shop_url = ""; public String level = ""; public String regist_time = ""; public String expires_in = ""; public String last_login = ""; public String vipTime = ""; public String expire_date = ""; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getNick() { return nick; } public void setNick(String nick) { this.nick = nick; } public String getSession_key() { return session_key; } public void setSession_key(String session_key) { this.session_key = session_key; } public String getRefresh_token() { return refresh_token; } public void setRefresh_token(String refresh_token) { this.refresh_token = refresh_token; } public String getShop_type() { return shop_type; } public void setShop_type(String shop_type) { this.shop_type = shop_type; } public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public String getShop_name() { return shop_name; } public void setShop_name(String shop_name) { this.shop_name = shop_name; } public String getShop_num() { return shop_num; } public void setShop_num(String shop_num) { this.shop_num = shop_num; } public String getShop_url() { return shop_url; } public void setShop_url(String shop_url) { this.shop_url = shop_url; } public String getLevel() { return level; } public void setLevel(String level) { this.level = level; } public String getRegist_time() { return regist_time; } public void setRegist_time(String regist_time) { this.regist_time = regist_time; } public String getExpires_in() { return expires_in; } public void setExpires_in(String expires_in) { this.expires_in = expires_in; } public String getLast_login() { return last_login; } public void setLast_login(String last_login) { this.last_login = last_login; } public String getVipTime() { return vipTime; } public void setVipTime(String vipTime) { this.vipTime = vipTime; } public String getExpire_date() { return expire_date; } public void setExpire_date(String expire_date) { this.expire_date = expire_date; } } }
c826ea0378eb458dc957f4cf7226b1fc1d95cf3c
5c683cf142ba5baa3d31d59616109b96683ceaa4
/stack/ArrayStack.java
49afda13173864b8a302e2fe1353adf5f18504ea
[]
no_license
yaopeng-coder/data-structure
b29da46fa7768f4bdb6c517eb4798508c9fa537e
4502c54d886a53fd43f9ad80e70f8268064b6745
refs/heads/master
2020-11-25T21:11:22.131235
2020-04-15T02:33:51
2020-04-15T02:33:51
228,849,356
0
0
null
null
null
null
UTF-8
Java
false
false
1,807
java
/** * 栈的应用 undo操作---编辑器 系统调用栈---操作系统 括号匹配---编译器 * @program: data-structure * @author: yaopeng * @create: 2019-12-20 19:36 **/ public class ArrayStack<E> implements Stack<E> { private Array<E> array; public ArrayStack(int capacity){ array = new Array<>(capacity); } public ArrayStack(){ array = new Array<>(); } /** * 向栈中压入一个元素 * 时间复杂度O(1),均摊 * @param e */ @Override public void push(E e) { array.addLast(e); } /** * 弹出一个栈顶元素 * 时间复杂度O(1),均摊 * @return */ @Override public E pop() { return array.removeLast(); } /** * 查看栈顶元素 * 时间复杂度O(1) * @return */ @Override public E peek() { return array.getLast(); } /** * 得到栈元素的个数 * 时间复杂度O(1) * @return */ @Override public int getSize() { return array.getSize(); } /** * 栈是否为空 * 时间复杂度O(1) * @return */ @Override public boolean isEmpty() { return array.isEmpty(); } /** * 得到栈的容量,因为这是基于动态数组实现的栈,所以有容量的概念 * @return */ public int getCapacity(){ return array.getCapacity(); } @Override public String toString() { StringBuilder res = new StringBuilder("Stack: ["); for(int i = 0; i < array.getSize(); i ++){ res.append(array.get(i)); if( i != array.getSize() - 1) res.append(","); } res.append("]"); return res.toString(); } }
b1f66145ad5fa7408ef6981cb5f97f34ebcd0dd3
5ded1d9da05dcc893475e21346f5a97d7f85e30a
/src/main/java/SeleniumSessions/SpiceJetMoveToElement.java
5f4726cf5bf3b5a3d4836fa0f0110bd780f6a8cf
[]
no_license
rahulrajautomation/March2020SeleniumSessions
57d074d98c02cc30fa3a9ffc1f9dbb60275e1326
1f226865fb40409563652af069f3b5d993af6d06
refs/heads/master
2023-05-14T13:32:19.071079
2020-05-26T16:14:15
2020-05-26T16:14:15
267,089,631
0
0
null
2023-05-09T18:23:59
2020-05-26T16:05:07
Java
UTF-8
Java
false
false
1,226
java
package SeleniumSessions; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.interactions.Actions; import io.github.bonigarcia.wdm.WebDriverManager; public class SpiceJetMoveToElement { public static void main(String[] args) throws InterruptedException { WebDriverManager.chromedriver().setup(); WebDriver driver=new ChromeDriver(); driver.get("https://www.spicejet.com/"); Thread.sleep(5000); WebElement wb = driver.findElement(By.xpath("//a[contains(@id,'HyperLinkLogin')]")); WebElement wb1 = driver.findElement(By.xpath("//div[@id='smoothmenu1']/ul/li[15]/ul/li[2]/a")); WebElement wb2 = driver.findElement (By.xpath("//div[@id='smoothmenu1']/ul/li[15]/ul/li[2]/ul/li[1]/a[contains(text(),'Member Login')]")); mouseOverLevel1(wb,wb1,wb2,driver); } public static void mouseOverLevel1(WebElement element1, WebElement element2, WebElement element3,WebDriver driver) { Actions act = new Actions(driver); act.moveToElement(element1).build().perform(); act.moveToElement(element2).build().perform(); act.click(element3).build().perform(); } }
87f13074e56660249c98a32b36efab92504c428f
a001be3d233d8dee1f0cd09b6b209cd544d9e040
/src/main/java/org/ovgu/de/classifier/functions/supportVector/RegSMOImproved.java
ca29751fac14d8379e0e292af89cc66ac8a3c6a6
[]
no_license
suhitaghosh10/Tune2Timeseries
8d659700c954b2c2af278614138e7ff007149e80
512442246cc8dac19d25d03f25209c6f38679aa7
refs/heads/master
2023-04-14T12:37:30.510795
2021-03-22T16:19:53
2021-03-22T16:19:53
136,977,595
3
0
null
2021-04-26T20:45:16
2018-06-11T20:30:31
Java
UTF-8
Java
false
false
30,088
java
/* * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* * RegSMOImproved.java * Copyright (C) 2006-2012 University of Waikato, Hamilton, New Zealand * */ package org.ovgu.de.classifier.functions.supportVector; import java.util.Enumeration; import java.util.Vector; import weka.core.Instances; import weka.core.Option; import weka.core.RevisionUtils; import weka.core.TechnicalInformation; import weka.core.TechnicalInformation.Field; import weka.core.TechnicalInformation.Type; import weka.core.TechnicalInformationHandler; import weka.core.Utils; /** <!-- globalinfo-start --> * Learn SVM for regression using SMO with Shevade, Keerthi, et al. adaption of the stopping criterion.<br/> * <br/> * For more information see:<br/> * <br/> * S.K. Shevade, S.S. Keerthi, C. Bhattacharyya, K.R.K. Murthy: Improvements to the SMO Algorithm for SVM Regression. In: IEEE Transactions on Neural Networks, 1999.<br/> * <br/> * S.K. Shevade, S.S. Keerthi, C. Bhattacharyya, K.R.K. Murthy (1999). Improvements to the SMO Algorithm for SVM Regression. Control Division, Dept. of Mechanical Engineering. * <p/> <!-- globalinfo-end --> * <!-- technical-bibtex-start --> * BibTeX: * <pre> * &#64;inproceedings{Shevade1999, * author = {S.K. Shevade and S.S. Keerthi and C. Bhattacharyya and K.R.K. Murthy}, * booktitle = {IEEE Transactions on Neural Networks}, * title = {Improvements to the SMO Algorithm for SVM Regression}, * year = {1999}, * PS = {http://guppy.mpe.nus.edu.sg/\~mpessk/svm/ieee_smo_reg.ps.gz} * } * * &#64;techreport{Shevade1999, * address = {Control Division, Dept. of Mechanical Engineering}, * author = {S.K. Shevade and S.S. Keerthi and C. Bhattacharyya and K.R.K. Murthy}, * institution = {National University of Singapore}, * number = {CD-99-16}, * title = {Improvements to the SMO Algorithm for SVM Regression}, * year = {1999}, * PS = {http://guppy.mpe.nus.edu.sg/\~mpessk/svm/smoreg_mod.ps.gz} * } * </pre> * <p/> <!-- technical-bibtex-end --> * <!-- options-start --> * Valid options are: <p/> * * <pre> -T &lt;double&gt; * The tolerance parameter for checking the stopping criterion. * (default 0.001)</pre> * * <pre> -V * Use variant 1 of the algorithm when true, otherwise use variant 2. * (default true)</pre> * * <pre> -P &lt;double&gt; * The epsilon for round-off error. * (default 1.0e-12)</pre> * * <pre> -L &lt;double&gt; * The epsilon parameter in epsilon-insensitive loss function. * (default 1.0e-3)</pre> * * <pre> -W &lt;double&gt; * The random number seed. * (default 1)</pre> * <!-- options-end --> * * @author Remco Bouckaert ([email protected],[email protected]) * @version $Revision: 8034 $ */ public class RegSMOImproved extends RegSMO implements TechnicalInformationHandler { /** for serialization */ private static final long serialVersionUID = 471692841446029784L; public final static int I0 = 3; public final static int I0a = 1; public final static int I0b = 2; public final static int I1 = 4; public final static int I2 = 8; public final static int I3 = 16; /** The different sets used by the algorithm. */ protected SMOset m_I0; /** Index set {i: 0 < m_alpha[i] < C || 0 < m_alphaStar[i] < C}} */ protected int [] m_iSet; /** b.up and b.low boundaries used to determine stopping criterion */ protected double m_bUp, m_bLow; /** index of the instance that gave us b.up and b.low */ protected int m_iUp, m_iLow; /** tolerance parameter used for checking stopping criterion b.up < b.low + 2 tol */ double m_fTolerance = 0.001; /** set true to use variant 1 of the paper, otherwise use variant 2 */ boolean m_bUseVariant1 = true; /** * Returns a string describing the object * * @return a description suitable for * displaying in the explorer/experimenter gui */ public String globalInfo() { return "Learn SVM for regression using SMO with Shevade, Keerthi, et al. " + "adaption of the stopping criterion.\n\n" + "For more information see:\n\n" + getTechnicalInformation().toString(); } /** * Returns an instance of a TechnicalInformation object, containing * detailed information about the technical background of this class, * e.g., paper reference or book this class is based on. * * @return the technical information about this class */ public TechnicalInformation getTechnicalInformation() { TechnicalInformation result; TechnicalInformation additional; result = new TechnicalInformation(Type.INPROCEEDINGS); result.setValue(Field.AUTHOR, "S.K. Shevade and S.S. Keerthi and C. Bhattacharyya and K.R.K. Murthy"); result.setValue(Field.TITLE, "Improvements to the SMO Algorithm for SVM Regression"); result.setValue(Field.BOOKTITLE, "IEEE Transactions on Neural Networks"); result.setValue(Field.YEAR, "1999"); result.setValue(Field.PS, "http://guppy.mpe.nus.edu.sg/~mpessk/svm/ieee_smo_reg.ps.gz"); additional = result.add(Type.TECHREPORT); additional.setValue(Field.AUTHOR, "S.K. Shevade and S.S. Keerthi and C. Bhattacharyya and K.R.K. Murthy"); additional.setValue(Field.TITLE, "Improvements to the SMO Algorithm for SVM Regression"); additional.setValue(Field.INSTITUTION, "National University of Singapore"); additional.setValue(Field.ADDRESS, "Control Division, Dept. of Mechanical Engineering"); additional.setValue(Field.NUMBER, "CD-99-16"); additional.setValue(Field.YEAR, "1999"); additional.setValue(Field.PS, "http://guppy.mpe.nus.edu.sg/~mpessk/svm/smoreg_mod.ps.gz"); return result; } /** * Returns an enumeration describing the available options * * @return an enumeration of all the available options */ public Enumeration listOptions() { Vector result = new Vector(); result.addElement(new Option( "\tThe tolerance parameter for checking the stopping criterion.\n" + "\t(default 0.001)", "T", 1, "-T <double>")); result.addElement(new Option( "\tUse variant 1 of the algorithm when true, otherwise use variant 2.\n" + "\t(default true)", "V", 0, "-V")); Enumeration enm = super.listOptions(); while (enm.hasMoreElements()) { result.addElement(enm.nextElement()); } return result.elements(); } /** * Parses a given list of options. <p/> * <!-- options-start --> * Valid options are: <p/> * * <pre> -T &lt;double&gt; * The tolerance parameter for checking the stopping criterion. * (default 0.001)</pre> * * <pre> -V * Use variant 1 of the algorithm when true, otherwise use variant 2. * (default true)</pre> * * <pre> -P &lt;double&gt; * The epsilon for round-off error. * (default 1.0e-12)</pre> * * <pre> -L &lt;double&gt; * The epsilon parameter in epsilon-insensitive loss function. * (default 1.0e-3)</pre> * * <pre> -W &lt;double&gt; * The random number seed. * (default 1)</pre> * <!-- options-end --> * * @param options the list of options as an array of strings * @throws Exception if an option is not supported */ public void setOptions(String[] options) throws Exception { String tmpStr; tmpStr = Utils.getOption('T', options); if (tmpStr.length() != 0) { setTolerance(Double.parseDouble(tmpStr)); } else { setTolerance(0.001); } setUseVariant1(Utils.getFlag('V', options)); super.setOptions(options); } /** * Gets the current settings of the object. * * @return an array of strings suitable for passing to setOptions */ public String[] getOptions() { int i; Vector result; String[] options; result = new Vector(); options = super.getOptions(); for (i = 0; i < options.length; i++) result.add(options[i]); result.add("-T"); result.add("" + getTolerance()); if (m_bUseVariant1) result.add("-V"); return (String[]) result.toArray(new String[result.size()]); } /** * Returns the tip text for this property * * @return a description suitable for * displaying in the explorer/experimenter gui */ public String toleranceTipText() { return "tolerance parameter used for checking stopping criterion b.up < b.low + 2 tol"; } /** * returns the current tolerance * * @return the tolerance */ public double getTolerance() { return m_fTolerance; } /** * sets the tolerance * * @param d the new tolerance */ public void setTolerance(double d) { m_fTolerance = d; } /** * Returns the tip text for this property * * @return a description suitable for * displaying in the explorer/experimenter gui */ public String useVariant1TipText() { return "set true to use variant 1 of the paper, otherwise use variant 2."; } /** * Whether variant 1 is used * * @return true if variant 1 is used */ public boolean isUseVariant1() { return m_bUseVariant1; } /** * Sets whether to use variant 1 * * @param b if true then variant 1 is used */ public void setUseVariant1(boolean b) { m_bUseVariant1 = b; } /** * takeStep method from Shevade et al.s paper. * parameters correspond to pseudocode from paper. * * @param i1 * @param i2 * @param alpha2 * @param alpha2Star * @param phi2 * @return * @throws Exception */ protected int takeStep(int i1, int i2, double alpha2, double alpha2Star, double phi2) throws Exception { //procedure takeStep(i1, i2) // // if (i1 == i2) // return 0 if (i1 == i2) { return 0; } double C1 = m_C * m_data.instance(i1).weight(); double C2 = m_C * m_data.instance(i2).weight(); // alpha1, alpha1' = Lagrange multipliers for i1 double alpha1 = m_alpha[i1]; double alpha1Star = m_alphaStar[i1]; // double y1 = m_target[i1]; // TODO: verify we do not need to recompute m_error[i1] here // TODO: since m_error is only updated for indices in m_I0 double phi1 = m_error[i1]; // if ((m_iSet[i1] & I0)==0) { // phi1 = -SVMOutput(i1) - m_b + m_target[i1]; // m_error[i1] = phi1; // } // k11 = kernel(point[i1], point[i1]) // k12 = kernel(point[i1], point[i2]) // k22 = kernel(point[i2], point[i2]) // eta = -2*k12+k11+k22 // gamma = alpha1-alpha1'+alpha2-alpha2' // double k11 = m_kernel.eval(i1, i1, m_data.instance(i1)); double k12 = m_kernel.eval(i1, i2, m_data.instance(i1)); double k22 = m_kernel.eval(i2, i2, m_data.instance(i2)); double eta = -2 * k12 + k11 + k22; double gamma = alpha1 - alpha1Star + alpha2 - alpha2Star; // if (eta < 0) { // this may happen due to numeric instability // due to Mercer's condition, this should not happen, hence we give up // return 0; // } // % We assume that eta > 0. Otherwise one has to repeat the complete // % reasoning similarly (i.e. compute objective functions at L and H // % and decide which one is largest // // case1 = case2 = case3 = case4 = finished = 0 // alpha1old = alpha1, // alpha1old' = alpha1' // alpha2old = alpha2, // alpha2old' = alpha2' // deltaphi = F1 - F2 // // while !finished // % This loop is passed at most three times // % Case variables needed to avoid attempting small changes twice // if (case1 == 0) && // (alpha1 > 0 || (alpha1' == 0 && deltaphi > 0)) && // (alpha2 > 0 || (alpha2' == 0 && deltaphi < 0)) // compute L, H (w.r.t. alpha1, alpha2) // if (L < H) // a2 = alpha2 - (deltaphi / eta ) a2 = min(a2, H) a2 = max(L, a2) a1 = alpha1 - (a2 - alpha2) // update alpha1, alpha2 if change is larger than some eps // else // finished = 1 // endif // case1 = 1 // elseif (case2 == 0) && // (alpha1 > 0 || (alpha1' == 0 && deltaphi > 2*epsilon)) && // (alpha2' > 0 || (alpha2 == 0 && deltaphi > 2*epsilon)) // // compute L, H (w.r.t. alpha1, alpha2') // if (L < H) // a2 = alpha2' + ((deltaphi - 2*epsilon)/eta)) a2 = min(a2, H) a2 = max(L, a2) a1 = alpha1 + (a2-alpha2') // update alpha1, alpha2' if change is larger than some eps // else // finished = 1 // endif // case2 = 1 // elseif (case3 == 0) && // (alpha1' > 0 || (alpha1 == 0 && deltaphi < -2*epsilon)) && // (alpha2 > 0 || (alpha2' == 0 && deltaphi < -2*epsilon)) // compute L, H (w.r.t. alpha1', alpha2) // if (L < H) // a2 = alpha2 - ((deltaphi + 2*epsilon)/eta) a2 = min(a2, H) a2 = max(L, a2) a1 = alpha1' + (a2 - alpha2) // update alpha1', alpha2 if change is larger than some eps // else // finished = 1 // endif // case3 = 1 // elseif (case4 == 0) && // (alpha1' > 0) || (alpha1 == 0 && deltaphi < 0)) && // (alpha2' > 0) || (alpha2 == 0 && deltaphi > 0)) // compute L, H (w.r.t. alpha1', alpha2') // if (L < H) // a2 = alpha2' + deltaphi/eta a2 = min(a2, H) a2 = max(L, a2) a1 = alpha1' - (a2 - alpha2') // update alpha1, alpha2' if change is larger than some eps // else // finished = 1 // endif // case4 = 1 // else // finished = 1 // endif // update deltaphi // endwhile double alpha1old = alpha1; double alpha1Starold = alpha1Star; double alpha2old = alpha2; double alpha2Starold = alpha2Star; double deltaPhi = phi1 - phi2; if (findOptimalPointOnLine(i1, alpha1, alpha1Star, C1, i2, alpha2, alpha2Star, C2, gamma, eta, deltaPhi)) { alpha1 = m_alpha[i1]; alpha1Star = m_alphaStar[i1]; alpha2 = m_alpha[i2]; alpha2Star = m_alphaStar[i2]; // if changes in alpha('), alpha2(') are larger than some eps // Update f-cache[i] for i in I.0 using new Lagrange multipliers // Store the changes in alpha, alpha' array // Update I.0, I.1, I.2, I.3 // Compute (i.low, b.low) and (i.up, b.up) by applying the conditions mentioned above, using only i1, i2 and indices in I.0 // return 1 // else // return 0 //endif endprocedure // Update error cache using new Lagrange multipliers double dAlpha1 = alpha1 - alpha1old - (alpha1Star - alpha1Starold); double dAlpha2 = alpha2 - alpha2old - (alpha2Star - alpha2Starold); for (int j = m_I0.getNext(-1); j != -1; j = m_I0.getNext(j)) { if ((j != i1) && (j != i2)) { m_error[j] -= dAlpha1 * m_kernel.eval(i1, j, m_data.instance(i1)) + dAlpha2 * m_kernel.eval(i2, j, m_data.instance(i2)); } } m_error[i1] -= dAlpha1 * k11 + dAlpha2 * k12; m_error[i2] -= dAlpha1 * k12 + dAlpha2 * k22; updateIndexSetFor(i1, C1); updateIndexSetFor(i2, C2); // Compute (i.low, b.low) and (i.up, b.up) by applying the conditions mentioned above, using only i1, i2 and indices in I.0 m_bUp = Double.MAX_VALUE; m_bLow = -Double.MAX_VALUE; for (int j = m_I0.getNext(-1); j != -1; j = m_I0.getNext(j)) { updateBoundaries(j, m_error[j]); } if (!m_I0.contains(i1)) { updateBoundaries(i1, m_error[i1]); } if (!m_I0.contains(i2)) { updateBoundaries(i2, m_error[i2]); } return 1; } else { return 0; } } /** * updates the index sets I0a, IOb, I1, I2 and I3 for vector i * * @param i index of vector * @param C capacity for vector i * @throws Exception */ protected void updateIndexSetFor(int i, double C) throws Exception { /* m_I0a.delete(i); m_I0b.delete(i); m_I1.delete(i); m_I2.delete(i); m_I3.delete(i); */ if (m_alpha[i] == 0 && m_alphaStar[i] == 0) { //m_I1.insert(i); m_iSet[i] = I1; m_I0.delete(i); } else if (m_alpha[i] > 0) { if (m_alpha[i] < C) { if ((m_iSet[i] & I0) == 0) { //m_error[i] = -SVMOutput(i) - m_b + m_target[i]; m_I0.insert(i); } //m_I0a.insert(i); m_iSet[i] = I0a; } else { // m_alpha[i] == C //m_I3.insert(i); m_iSet[i] = I3; m_I0.delete(i); } } else {// m_alphaStar[i] > 0 if (m_alphaStar[i] < C) { if ((m_iSet[i] & I0) == 0) { //m_error[i] = -SVMOutput(i) - m_b + m_target[i]; m_I0.insert(i); } //m_I0b.insert(i); m_iSet[i] = I0b; } else { // m_alpha[i] == C //m_I2.insert(i); m_iSet[i] = I2; m_I0.delete(i); } } } /** * updates boundaries bLow and bHi and corresponding indexes * * @param i2 index of vector * @param F2 error of vector i2 */ protected void updateBoundaries(int i2, double F2) { int iSet = m_iSet[i2]; double FLow = m_bLow; if ((iSet & (I2 | I0b)) > 0) { FLow = F2 + m_epsilon; } else if ((iSet & (I1 | I0a)) > 0) { FLow = F2 - m_epsilon; } if (m_bLow < FLow) { m_bLow = FLow; m_iLow = i2; } double FUp = m_bUp; if ((iSet & (I3 | I0a)) > 0) { FUp = F2 - m_epsilon; } else if ((iSet & (I1 | I0b)) > 0) { FUp = F2 + m_epsilon; } if (m_bUp > FUp) { m_bUp = FUp; m_iUp = i2; } } /** * parameters correspond to pseudocode from paper. * * @param i2 index of candidate * @return * @throws Exception */ protected int examineExample(int i2) throws Exception { //procedure examineExample(i2) // // alpha2, alpha2' = Lagrange multipliers for i2 double alpha2 = m_alpha[i2]; double alpha2Star = m_alphaStar[i2]; // if (i2 is in I.0) // F2 = f-cache[i2] // else // compute F2 = F.i2 and set f-cache[i2] = F2 // % Update (b.low, i.low) or (b.up, i.up) using (F2, i2)... // if (i2 is in I.1) // if (F2+epsilon < b.up) // b.up = F2+epsilon, // i.up = i2 // elseif (F2-epsilon > b.low) // b.low = F2-epsilon, // i.low = i2 // end if // elseif ( (i2 is in I.2) && (F2+epsilon > b.low) ) // b.low = F2+epsilon, // i.low = i2 // elseif ( (i2 is in I.3) && (F2-epsilon < b.up) ) // b.up = F2-epsilon, // i.up = i2 // endif // endif int iSet = m_iSet[i2]; double F2 = m_error[i2]; if (!m_I0.contains(i2)) { F2 = -SVMOutput(i2) - m_b + m_target[i2]; m_error[i2] = F2; if (iSet == I1) { if (F2 + m_epsilon < m_bUp) { m_bUp = F2 + m_epsilon; m_iUp = i2; } else if (F2 - m_epsilon > m_bLow) { m_bLow = F2 - m_epsilon; m_iLow = i2; } } else if ((iSet == I2) && (F2 + m_epsilon > m_bLow)) { m_bLow = F2 + m_epsilon; m_iLow = i2; } else if ((iSet == I3) && (F2 - m_epsilon < m_bUp)) { m_bUp = F2 - m_epsilon; m_iUp = i2; } } // % Check optimality using current b.low and b.up and, if // % violated, find an index i1 to do joint optimization with i2... // optimality = 1; // case 1: i2 is in I.0a // if (b.low-(F2-epsilon) > 2 * tol) // optimality = 0; // i1 = i.low; // % For i2 in I.0a choose the better i1... // if ((F2-epsilon)-b.up > b.low-(F2-epsilon)) // i1 = i.up; // endif // elseif ((F2-epsilon)-b.up > 2 * tol) // optimality = 0; // i1 = i.up; // % For i2 in I.0a choose the better i1... // if ((b.low-(F2-epsilon) > (F2-epsilon)-b.up) // i1 = i.low; // endif // endif // case 2: i2 is in I.0b // if (b.low-(F2+epsilon) > 2 * tol) // optimality = 0; // i1 = i.low; // % For i2 in I.0b choose the better i1... // if ((F2+epsilon)-b.up > b.low-(F2+epsilon)) // i1 = i.up; // endif // elseif ((F2+epsilon)-b.up > 2 * tol) // optimality = 0; // i1 = i.up; // % For i2 in I.0b choose the better i1... // if ((b.low-(F2+epsilon) > (F2+epsilon)-b.up) // i1 = i.low; // endif // endif // case 3: i2 is in I.1 // if (b.low-(F2+epsilon) > 2 * tol) // optimality = 0; // i1 = i.low; // % For i2 in I1 choose the better i1... // if ((F2+epsilon)-b.up > b.low-(F2+epsilon) // i1 = i.up; // endif // elseif ((F2-epsilon)-b.up > 2 * tol) // optimality = 0; // i1 = i.up; // % For i2 in I1 choose the better i1... // if (b.low-(F2-epsilon) > (F2-epsilon)-b.up) // i1 = i.low; // endif // endif // case 4: i2 is in I.2 // if ((F2+epsilon)-b.up > 2*tol) // optimality = 0, // i1 = i.up // endif // case 5: i2 is in I.3 // if ((b.low-(F2-epsilon) > 2*tol) // optimality = 0, i1 = i.low // endif int i1 = i2; boolean bOptimality = true; //case 1: i2 is in I.0a if (iSet == I0a) { if (m_bLow - (F2 - m_epsilon) > 2 * m_fTolerance) { bOptimality = false; i1 = m_iLow; //% For i2 in I .0 a choose the better i1... if ((F2 - m_epsilon) - m_bUp > m_bLow - (F2 - m_epsilon)) { i1 = m_iUp; } } else if ((F2 - m_epsilon) - m_bUp > 2 * m_fTolerance) { bOptimality = false; i1 = m_iUp; //% For i2 in I.0a choose the better i1... if (m_bLow - (F2 - m_epsilon) > (F2 - m_epsilon) - m_bUp) { i1 = m_iLow; } } } // case 2: i2 is in I.0b else if (iSet == I0b) { if (m_bLow - (F2 + m_epsilon) > 2 * m_fTolerance) { bOptimality = false; i1 = m_iLow; // % For i2 in I.0b choose the better i1... if ((F2 + m_epsilon) - m_bUp > m_bLow - (F2 + m_epsilon)) { i1 = m_iUp; } } else if ((F2 + m_epsilon) - m_bUp > 2 * m_fTolerance) { bOptimality = false; i1 = m_iUp; // % For i2 in I.0b choose the better i1... if (m_bLow - (F2 + m_epsilon) > (F2 + m_epsilon) - m_bUp) { i1 = m_iLow; } } } // case 3: i2 is in I.1 else if (iSet == I1) { if (m_bLow - (F2 + m_epsilon) > 2 * m_fTolerance) { bOptimality = false; i1 = m_iLow; //% For i2 in I1 choose the better i1... if ((F2 + m_epsilon) - m_bUp > m_bLow - (F2 + m_epsilon)) { i1 = m_iUp; } } else if ((F2 - m_epsilon) - m_bUp > 2 * m_fTolerance) { bOptimality = false; i1 = m_iUp; // % For i2 in I1 choose the better i1... if (m_bLow - (F2 - m_epsilon) > (F2 - m_epsilon) - m_bUp) { i1 = m_iLow; } } } //case 4: i2 is in I.2 else if (iSet == I2) { if ((F2 + m_epsilon) - m_bUp > 2 * m_fTolerance) { bOptimality = false; i1 = m_iUp; } } //case 5: i2 is in I.3 else if (iSet == I3) { if (m_bLow - (F2 - m_epsilon) > 2 * m_fTolerance) { bOptimality = false; i1 = m_iLow; } } // if (optimality == 1) // return 0 // if (takeStep(i1, i2)) // return 1 // else // return 0 // endif //endprocedure if (bOptimality) { return 0; } return takeStep(i1, i2, m_alpha[i2], m_alphaStar[i2], F2); } /** * initialize various variables before starting the actual optimizer * * @param data data set used for learning * @throws Exception if something goes wrong */ protected void init(Instances data) throws Exception { super.init(data); // from Keerthi's pseudo code: // set alpha and alpha' to zero for every example set I.1 to contain all the examples // Choose any example i from the training set. // set b.up = target[i]+epsilon // set b.low = target[i]-espilon // i.up = i.low = i; // Initialize sets m_I0 = new SMOset(m_data.numInstances()); m_iSet = new int [m_data.numInstances()]; for (int i = 0; i < m_nInstances; i++) { m_iSet[i] = I1; } // m_iUp = m_random.nextInt(m_nInstances); m_iUp = 0; m_bUp = m_target[m_iUp] + m_epsilon; m_iLow = m_iUp; m_bLow = m_target[m_iLow] - m_epsilon; //init error cache m_error = new double[m_nInstances]; for (int i = 0; i < m_nInstances; i++) { m_error[i] = m_target[i]; } } /** * use variant 1 of Shevade's et al.s paper * * @throws Exception if something goes wrong */ protected void optimize1() throws Exception { //% main routine for modification 1 procedure main // while (numChanged > 0 || examineAll) // numChanged = 0; int nNumChanged = 0; boolean bExamineAll = true; // while (numChanged > 0 || examineAll) // numChanged = 0; while (nNumChanged > 0 || bExamineAll) { nNumChanged = 0; // if (examineAll) // loop I over all the training examples // numChanged += examineExample(I) // else // loop I over I.0 // numChanged += examineExample(I) // % It is easy to check if optimality on I.0 is attained... // if (b.up > b.low - 2*tol) at any I // exit the loop after setting numChanged = 0 // endif if (bExamineAll) { for (int i = 0; i < m_nInstances; i++) { nNumChanged += examineExample(i); } } else { for (int i = m_I0.getNext(-1); i != -1; i = m_I0.getNext(i)) { nNumChanged += examineExample(i); if (m_bLow - m_bUp < 2 * m_fTolerance) { nNumChanged = 0; break; } } } // if (examineAll == 1) // examineAll = 0; // elseif (numChanged == 0) // examineAll = 1; // endif // endwhile //endprocedure if (bExamineAll) { bExamineAll = false; } else if (nNumChanged == 0) { bExamineAll = true; } } } /** * use variant 2 of Shevade's et al.s paper * * @throws Exception if something goes wrong */ protected void optimize2() throws Exception { //% main routine for modification 2 procedure main int nNumChanged = 0; boolean bExamineAll = true; // while (numChanged > 0 || examineAll) // numChanged = 0; while (nNumChanged > 0 || bExamineAll) { nNumChanged = 0; // if (examineAll) // loop I over all the training examples // numChanged += examineExample(I) // else // % The following loop is the only difference between the two // % SMO modifications. Whereas, modification 1, the type II // % loop selects i2 fro I.0 sequentially, here i2 is always // % set to the current i.low and i1 is set to the current i.up; // % clearly, this corresponds to choosing the worst violating // % pair using members of I.0 and some other indices // inner.loop.success = 1; // do // i2 = i.low // alpha2, alpha2' = Lagrange multipliers for i2 // F2 = f-cache[i2] // i1 = i.up // inner.loop.success = takeStep(i.up, i.low) // numChanged += inner.loop.success // until ( (b.up > b.low - 2*tol) || inner.loop.success == 0) // numChanged = 0; // endif if (bExamineAll) { for (int i = 0; i < m_nInstances; i++) { nNumChanged += examineExample(i); } } else { boolean bInnerLoopSuccess = true; do { if (takeStep(m_iUp, m_iLow, m_alpha[m_iLow], m_alphaStar[m_iLow], m_error[m_iLow]) > 0) { bInnerLoopSuccess = true; nNumChanged += 1; } else { bInnerLoopSuccess = false; } } while ((m_bUp <= m_bLow - 2 * m_fTolerance) && bInnerLoopSuccess); nNumChanged = 0; } // // if (examineAll == 1) // examineAll = 0 // elseif (numChanged == 0) // examineAll = 1 // endif // endwhile //endprocedure // if (bExamineAll) { bExamineAll = false; } else if (nNumChanged == 0) { bExamineAll = true; } } } /** * wrap up various variables to save memeory and do some housekeeping after optimization * has finished. * * @throws Exception if something goes wrong */ protected void wrapUp() throws Exception { m_b = -(m_bLow + m_bUp) / 2.0; m_target = null; m_error = null; super.wrapUp(); } /** * learn SVM parameters from data using Keerthi's SMO algorithm. * Subclasses should implement something more interesting. * * @param instances the data to work with * @throws Exception if something goes wrong */ public void buildClassifier(Instances instances) throws Exception { // initialize variables init(instances); // solve optimization problem if (m_bUseVariant1) { optimize1(); } else { optimize2(); } // clean up wrapUp(); } /** * Returns the revision string. * * @return the revision */ public String getRevision() { return RevisionUtils.extract("$Revision: 8034 $"); } }
147ce3bc26ccd826336cc5190fe679f4e9634c1b
aed0e55a1372351727ccd68d977fc1c45e7ca262
/src/main/java/com/smm/payCenter/dao/PaymentLogDao.java
87fc0cf47116de254d69ac074c3857901499a119
[]
no_license
danshijin/SMMPayCenter
14849eb979e282e8cc93241e861292dff424327c
a82f847fe3375d5060605165f9a12a2f682afd81
refs/heads/master
2021-01-12T15:17:28.840276
2016-10-24T03:20:31
2016-10-24T03:20:31
71,748,168
0
1
null
null
null
null
UTF-8
Java
false
false
277
java
package com.smm.payCenter.dao; import java.util.List; import java.util.Map; import com.smm.payCenter.domain.PaymentLog; public interface PaymentLogDao { int queryPaymentLogCount(Map<String, Object> map); List<PaymentLog> queryPaymentLogData(Map<String, Object> map); }
8918a3c0a5ade9dac084e8493d48000da6092e5f
99e460e39237db9a08fcdf9d487fcaa109fb237b
/sdk/src/main/java/io/rover/shaded/zxing/com/google/zxing/client/result/EmailDoCoMoResultParser.java
8b08d0e018fcb556c794a9b1bfaebc4949b36136
[ "Apache-2.0" ]
permissive
hxxyyangyong/rover-android
99231639aa98dda16482680490129acd78fd412e
1b6e627a1e4b3651d0cc9f6e78f995ed9e4a821a
refs/heads/master
2023-02-15T20:34:56.254858
2020-12-08T14:57:35
2020-12-08T14:57:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,229
java
/* * Copyright 2007 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.rover.shaded.zxing.com.google.zxing.client.result; import io.rover.shaded.zxing.com.google.zxing.Result; import java.util.regex.Pattern; /** * Implements the "MATMSG" email message entry format. * * Supported keys: TO, SUB, BODY * * @author Sean Owen */ public final class EmailDoCoMoResultParser extends AbstractDoCoMoResultParser { private static final Pattern ATEXT_ALPHANUMERIC = Pattern.compile("[a-zA-Z0-9@.!#$%&'*+\\-/=?^_`{|}~]+"); @Override public EmailAddressParsedResult parse(Result result) { String rawText = getMassagedText(result); if (!rawText.startsWith("MATMSG:")) { return null; } String[] tos = matchDoCoMoPrefixedField("TO:", rawText, true); if (tos == null) { return null; } for (String to : tos) { if (!isBasicallyValidEmailAddress(to)) { return null; } } String subject = matchSingleDoCoMoPrefixedField("SUB:", rawText, false); String body = matchSingleDoCoMoPrefixedField("BODY:", rawText, false); return new EmailAddressParsedResult(tos, null, null, subject, body); } /** * This implements only the most basic checking for an email address's validity -- that it contains * an '@' and contains no characters disallowed by RFC 2822. This is an overly lenient definition of * validity. We want to generally be lenient here since this class is only intended to encapsulate what's * in a barcode, not "judge" it. */ static boolean isBasicallyValidEmailAddress(String email) { return email != null && ATEXT_ALPHANUMERIC.matcher(email).matches() && email.indexOf('@') >= 0; } }
4dc6347985fbba93dee568264b654474a05d45c5
896fabf7f0f4a754ad11f816a853f31b4e776927
/opera-mini-handler-dex2jar.jar/com/admarvel/android/ads/AdMarvelWebViewJSInterface.java
7e020eda49355a852375e4bdaa2c642f9576188e
[]
no_license
messarju/operamin-decompile
f7b803daf80620ec476b354d6aaabddb509bc6da
418f008602f0d0988cf7ebe2ac1741333ba3df83
refs/heads/main
2023-07-04T04:48:46.770740
2021-08-09T12:13:17
2021-08-09T12:04:45
394,273,979
0
0
null
null
null
null
UTF-8
Java
false
false
64,481
java
// // Decompiled by Procyon v0.6-prerelease // package com.admarvel.android.ads; import android.os.Environment; import com.admarvel.android.util.b; import com.admarvel.android.util.c; import android.content.DialogInterface; import android.content.DialogInterface$OnClickListener; import android.app.AlertDialog$Builder; import android.os.Handler; import android.os.Looper; import com.admarvel.android.util.Logging; import com.admarvel.android.util.e; import java.util.HashMap; import android.app.Activity; import android.webkit.JavascriptInterface; import android.content.Context; import java.lang.ref.WeakReference; public class AdMarvelWebViewJSInterface { private final WeakReference adMarvelActivityReference; final AdMarvelAd adMarvelAd; final WeakReference adMarvelInternalWebViewReference; private final WeakReference adMarvelWebViewReference; private final WeakReference contextReference; private boolean isInterstitial; private int lastOrientation; private String lockedOrientation; private String videoUrl; public AdMarvelWebViewJSInterface(final d d, final AdMarvelAd adMarvelAd, final AdMarvelActivity adMarvelActivity) { this.lockedOrientation = null; this.isInterstitial = false; this.adMarvelInternalWebViewReference = new WeakReference((T)d); this.adMarvelWebViewReference = null; this.contextReference = new WeakReference((T)adMarvelActivity); this.adMarvelAd = adMarvelAd; this.adMarvelActivityReference = new WeakReference((T)adMarvelActivity); this.isInterstitial = true; this.lastOrientation = adMarvelActivity.getRequestedOrientation(); } public AdMarvelWebViewJSInterface(final d d, final AdMarvelAd adMarvelAd, final m m, final Context context) { this.lockedOrientation = null; this.isInterstitial = false; this.adMarvelInternalWebViewReference = new WeakReference((T)d); this.adMarvelWebViewReference = new WeakReference((T)m); this.contextReference = new WeakReference((T)context); this.adMarvelAd = adMarvelAd; this.adMarvelActivityReference = null; this.isInterstitial = false; } @JavascriptInterface public void admarvelCheckFrameValues(final String s) { } @JavascriptInterface public void checkForApplicationSupportedOrientations(final String s) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null && (d == null || !d.b())) { final Context context = d.getContext(); if (context != null && context instanceof Activity) { final String[] split = r.a((Activity)context).split(","); final HashMap hashMap = new HashMap(); hashMap.put("portrait", "NO"); hashMap.put("landscapeLeft", "NO"); hashMap.put("landscapeRight", "NO"); hashMap.put("portraitUpsideDown", "NO"); for (int length = split.length, i = 0; i < length; ++i) { final String s2 = split[i]; if (s2.equals("0")) { hashMap.put("portrait", "YES"); } else if (s2.equals("90")) { hashMap.put("landscapeLeft", "YES"); } else if (s2.equals("-90")) { hashMap.put("landscapeRight", "YES"); } else if (s2.equals("180")) { hashMap.put("portraitUpsideDown", "YES"); } } final String string = "\"{portrait:" + hashMap.get("portrait") + ",landscapeLeft:" + hashMap.get("landscapeLeft") + ",landscapeRight:" + hashMap.get("landscapeRight") + ",portraitUpsideDown:" + hashMap.get("portraitUpsideDown") + "}\""; if (d != null) { d.e(s + "(" + string + ")"); } } } } @JavascriptInterface public void checkFrameValues(final String s) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null && !d.b() && !this.isInterstitial) { final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { e.a().b().execute(new m$e(s, d, m)); } } } @JavascriptInterface public void checkNetworkAvailable(final String s) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null && !d.b()) { e.a().b().execute(new r$c(d, s)); } } @JavascriptInterface public void cleanup() { if (!this.isInterstitial) { if (Version.getAndroidSDKVersion() >= 14) { Logging.log("window.ADMARVEL.cleanup()"); final m m = (m)this.adMarvelWebViewReference.get(); if (m != null && this.adMarvelInternalWebViewReference.get() != null) { new Handler(Looper.getMainLooper()).post((Runnable)new m$f(m)); } } } else { Logging.log("window.ADMARVEL.cleanup()"); final AdMarvelActivity adMarvelActivity = (AdMarvelActivity)this.adMarvelActivityReference.get(); if (adMarvelActivity != null && this.adMarvelInternalWebViewReference.get() != null) { adMarvelActivity.g.post((Runnable)new AdMarvelActivity$d(adMarvelActivity)); } } } @JavascriptInterface public void close() { final d d = (d)this.adMarvelInternalWebViewReference.get(); if ((d == null || !d.b()) && !this.isInterstitial) { final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { new Handler(Looper.getMainLooper()).post((Runnable)new m$h(m)); } } } @JavascriptInterface public void closeinterstitialad() { if (this.isInterstitial) { final AdMarvelActivity adMarvelActivity = (AdMarvelActivity)this.adMarvelActivityReference.get(); if (adMarvelActivity != null) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d == null || !d.b()) { adMarvelActivity.g(); } } } } @JavascriptInterface public void createcalendarevent(final String s, final String s2, final String s3) { final Context context = (Context)this.contextReference.get(); if (context != null) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null && !d.b() && r.c(context, "android.permission.READ_CALENDAR") && r.c(context, "android.permission.WRITE_CALENDAR") && context instanceof Activity) { final AlertDialog$Builder alertDialog$Builder = new AlertDialog$Builder((Context)context); alertDialog$Builder.setMessage((CharSequence)"Allow access to Calendar?").setCancelable(false).setPositiveButton((CharSequence)"Yes", (DialogInterface$OnClickListener)new DialogInterface$OnClickListener() { public void onClick(final DialogInterface dialogInterface, final int n) { if (Version.getAndroidSDKVersion() >= 14) { com.admarvel.android.util.e.a().b().execute(new r$e(d, context, s, s2, s3)); return; } com.admarvel.android.util.e.a().b().execute(new r$d(d, context, s, s2, s3)); } }).setNegativeButton((CharSequence)"No", (DialogInterface$OnClickListener)new DialogInterface$OnClickListener() { public void onClick(final DialogInterface dialogInterface, final int n) { dialogInterface.cancel(); } }); alertDialog$Builder.create().show(); } } } @JavascriptInterface public void createcalendarevent(final String s, final String s2, final String s3, final String s4, final String s5, final String s6, final int n) { final Context context = (Context)this.contextReference.get(); if (context != null) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null && !d.b() && r.c(context, "android.permission.READ_CALENDAR") && r.c(context, "android.permission.WRITE_CALENDAR") && context instanceof Activity) { final AlertDialog$Builder alertDialog$Builder = new AlertDialog$Builder((Context)context); alertDialog$Builder.setMessage((CharSequence)"Allow access to Calendar?").setCancelable(false).setPositiveButton((CharSequence)"Yes", (DialogInterface$OnClickListener)new DialogInterface$OnClickListener() { public void onClick(final DialogInterface dialogInterface, final int n) { if (Version.getAndroidSDKVersion() >= 14) { com.admarvel.android.util.e.a().b().execute(new r$e(d, context, s, s2, s3, s4, s5, s6, n)); return; } com.admarvel.android.util.e.a().b().execute(new r$d(d, context, s, s2, s3, s4, s5, s6, n)); } }).setNegativeButton((CharSequence)"No", (DialogInterface$OnClickListener)new DialogInterface$OnClickListener() { public void onClick(final DialogInterface dialogInterface, final int n) { dialogInterface.cancel(); } }); alertDialog$Builder.create().show(); } } } @JavascriptInterface public void createcalendarevent(final String s, final String s2, final String s3, final String s4, final String s5, final String s6, final int n, final String s7, final String s8, final String s9, final String s10, final int n2, final int n3, final String s11) { final Context context = (Context)this.contextReference.get(); if (context != null) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null && !d.b()) { if (!r.c(context, "android.permission.READ_CALENDAR") || !r.c(context, "android.permission.WRITE_CALENDAR")) { if (s11 != null) { d.e(s11 + "(NO)"); } } else { if (context instanceof Activity) { final AlertDialog$Builder alertDialog$Builder = new AlertDialog$Builder((Context)context); alertDialog$Builder.setMessage((CharSequence)"Allow access to Calendar?").setCancelable(false).setPositiveButton((CharSequence)"Yes", (DialogInterface$OnClickListener)new DialogInterface$OnClickListener() { public void onClick(final DialogInterface dialogInterface, final int n) { if (Version.getAndroidSDKVersion() >= 14) { com.admarvel.android.util.e.a().b().execute(new r$e(d, context, s, s2, s3, s4, s5, s6, n, s7, s8, s9, s10, n2, n3, s11)); return; } com.admarvel.android.util.e.a().b().execute(new r$d(d, context, s, s2, s3, s4, s5, s6, n, s7, s8, s9, s10, n2, n3, s11)); } }).setNegativeButton((CharSequence)"No", (DialogInterface$OnClickListener)new DialogInterface$OnClickListener() { public void onClick(final DialogInterface dialogInterface, final int n) { if (s11 != null) { d.e(s11 + "(\"NO\")"); } dialogInterface.cancel(); } }); alertDialog$Builder.create().show(); return; } d.e(s11 + "(\"NO\")"); } } } } @JavascriptInterface public void delaydisplay() { Label_0030: { if (this.adMarvelInternalWebViewReference == null) { break Label_0030; } final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d == null || !d.b()) { break Label_0030; } return; } if (this.isInterstitial) { return; } final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { m.p.set(true); } } @JavascriptInterface public void detectlocation(final String s) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null && !d.b()) { final c a = c.a(); if (a != null) { a.a(d, s); } } } @JavascriptInterface public void detectsizechange(final String n) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null && !d.b()) { d.n = n; } } @JavascriptInterface public void detectvisibility(final String j) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null && !d.b()) { d.j = j; if (this.isInterstitial && !d.k && d.m) { d.e(j + "(true)"); d.k = true; } } } @JavascriptInterface public void disableRotationForExpand() { final d d = (d)this.adMarvelInternalWebViewReference.get(); if ((d == null || !d.b()) && !this.isInterstitial) { final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { m.w = true; this.lockedOrientation = null; if (m.x && m.y) { this.disablerotations(this.lockedOrientation); } } } } @JavascriptInterface public void disableRotationForExpand(final String lockedOrientation) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if ((d == null || !d.b()) && !this.isInterstitial) { final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { m.w = true; this.lockedOrientation = lockedOrientation; if (m.x && m.y) { this.disablerotations(lockedOrientation); } } } } @JavascriptInterface public void disableautodetect() { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d == null || !d.b()) { if (this.isInterstitial) { d.getEnableAutoDetect().set(false); return; } final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { m.r.set(false); } } } @JavascriptInterface public void disablebackbutton() { if (this.isInterstitial) { final AdMarvelActivity adMarvelActivity = (AdMarvelActivity)this.adMarvelActivityReference.get(); if (adMarvelActivity != null) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null && !d.b()) { if (adMarvelActivity.f != null) { adMarvelActivity.g.removeCallbacks(adMarvelActivity.f); } adMarvelActivity.d = true; } } } } @JavascriptInterface public void disablebackbutton(final int n) { if (this.isInterstitial) { final AdMarvelActivity adMarvelActivity = (AdMarvelActivity)this.adMarvelActivityReference.get(); if (adMarvelActivity != null) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null && !d.b() && n > 0) { adMarvelActivity.d = true; if (adMarvelActivity.f != null) { adMarvelActivity.g.removeCallbacks(adMarvelActivity.f); } adMarvelActivity.g.postDelayed(adMarvelActivity.f, (long)n); } } } } @JavascriptInterface public void disableclosebutton(final String s) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if ((d == null || !d.b()) && s != null && s.equals("true")) { this.sdkclosebutton("false", "false"); } } @JavascriptInterface public void disablerotations() { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d == null || !d.b()) { if (this.isInterstitial) { this.disablerotations(null); return; } final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { final Context context = m.getContext(); Activity activity; if (context != null && context instanceof Activity) { activity = (Activity)context; } else { activity = null; } if (activity != null) { final int orientation = m.getResources().getConfiguration().orientation; if (orientation == 1) { activity.setRequestedOrientation(1); return; } if (orientation == 2) { activity.setRequestedOrientation(0); } } } } } @JavascriptInterface public void disablerotations(final String s) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d == null || !d.b()) { if (!this.isInterstitial) { final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { final Activity activity = null; final Context context = m.getContext(); Activity activity2 = activity; if (context != null) { activity2 = activity; if (context instanceof Activity) { activity2 = (Activity)context; } } if (activity2 != null) { int orientation; if (Version.getAndroidSDKVersion() < 9) { orientation = m.getResources().getConfiguration().orientation; } else { final m$o m$o = new m$o(m); e.a().b().execute(m$o); int a = Integer.MIN_VALUE; while (true) { orientation = a; if (a != Integer.MIN_VALUE) { break; } a = m$o.a(); } } if (s != null) { if (!m.w) { if (Version.getAndroidSDKVersion() < 9) { if (s.equalsIgnoreCase("Portrait") && orientation == 1) { activity2.setRequestedOrientation(1); return; } if (s.equalsIgnoreCase("LandscapeLeft") && orientation == 2) { activity2.setRequestedOrientation(0); } } else { if (s.equalsIgnoreCase("Portrait") && orientation == 0) { activity2.setRequestedOrientation(1); return; } if (s.equalsIgnoreCase("LandscapeLeft") && orientation == 1) { activity2.setRequestedOrientation(0); } } } else { if (Version.getAndroidSDKVersion() >= 9) { e.a().b().execute(new AdMarvelActivity$r(activity2, s)); return; } if (s.equalsIgnoreCase("Portrait")) { activity2.setRequestedOrientation(1); return; } if (s.equalsIgnoreCase("LandscapeLeft")) { activity2.setRequestedOrientation(0); } } } else if (Version.getAndroidSDKVersion() < 9) { if (orientation == 1) { activity2.setRequestedOrientation(1); return; } if (orientation == 2) { activity2.setRequestedOrientation(0); } } else { if (orientation == 0) { e.a().b().execute(new AdMarvelActivity$r(activity2, "Portrait")); return; } if (orientation == 1) { e.a().b().execute(new AdMarvelActivity$r(activity2, "LandscapeLeft")); return; } e.a().b().execute(new AdMarvelActivity$r(activity2, "none")); } } } } else { final AdMarvelActivity adMarvelActivity = (AdMarvelActivity)this.adMarvelActivityReference.get(); if (adMarvelActivity != null) { this.lastOrientation = adMarvelActivity.getRequestedOrientation(); int orientation2; if (Version.getAndroidSDKVersion() < 9) { orientation2 = adMarvelActivity.getResources().getConfiguration().orientation; } else { final AdMarvelActivity$k adMarvelActivity$k = new AdMarvelActivity$k(adMarvelActivity); adMarvelActivity.g.post((Runnable)adMarvelActivity$k); int a2 = Integer.MIN_VALUE; while (true) { orientation2 = a2; if (a2 != Integer.MIN_VALUE) { break; } a2 = adMarvelActivity$k.a(); } } if (s != null) { if (Version.getAndroidSDKVersion() < 9) { if (s.equalsIgnoreCase("Portrait")) { adMarvelActivity.setRequestedOrientation(1); return; } if (s.equalsIgnoreCase("LandscapeLeft")) { adMarvelActivity.setRequestedOrientation(0); } } else { if (s.equalsIgnoreCase("Portrait")) { adMarvelActivity.setRequestedOrientation(1); return; } if (s.equalsIgnoreCase("LandscapeLeft")) { adMarvelActivity.setRequestedOrientation(0); return; } adMarvelActivity.g.post((Runnable)new AdMarvelActivity$r(adMarvelActivity, s)); } } else if (Version.getAndroidSDKVersion() < 9) { if (orientation2 == 1) { adMarvelActivity.setRequestedOrientation(1); return; } if (orientation2 == 2) { adMarvelActivity.setRequestedOrientation(0); } } else { if (orientation2 == 0) { adMarvelActivity.g.post((Runnable)new AdMarvelActivity$r(adMarvelActivity, "Portrait")); return; } if (orientation2 == 1) { adMarvelActivity.g.post((Runnable)new AdMarvelActivity$r(adMarvelActivity, "LandscapeLeft")); return; } adMarvelActivity.g.post((Runnable)new AdMarvelActivity$r(adMarvelActivity, "none")); } } } } } @JavascriptInterface public void enableVideoCloseInBackground() { final AdMarvelActivity adMarvelActivity = (AdMarvelActivity)this.adMarvelActivityReference.get(); if (adMarvelActivity == null) { return; } adMarvelActivity.t = true; } @JavascriptInterface public void enableautodetect() { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d == null || !d.b()) { if (this.isInterstitial) { d.getEnableAutoDetect().set(true); return; } final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { m.r.set(true); } } } @JavascriptInterface public void enablebackbutton() { if (this.isInterstitial) { final AdMarvelActivity adMarvelActivity = (AdMarvelActivity)this.adMarvelActivityReference.get(); if (adMarvelActivity != null) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null && !d.b()) { adMarvelActivity.d = false; } } } } @JavascriptInterface public void enablerotations() { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d == null || !d.b()) { if (!this.isInterstitial) { final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { final Context context = m.getContext(); Activity activity; if (context != null && context instanceof Activity) { activity = (Activity)context; } else { activity = null; } if (activity != null) { activity.setRequestedOrientation(m.t); m.w = false; } } } else { final AdMarvelActivity adMarvelActivity = (AdMarvelActivity)this.adMarvelActivityReference.get(); if (adMarvelActivity != null) { adMarvelActivity.setRequestedOrientation(this.lastOrientation); } } } } @JavascriptInterface public void expandto(final int n, final int n2) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if ((d == null || !d.b()) && !this.isInterstitial) { final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { final Context context = d.getContext(); if (context != null && context instanceof Activity) { final Activity activity = (Activity)context; if (m.x) { new Handler(Looper.getMainLooper()).post((Runnable)new m$j(m, activity, n, n2)); return; } new Handler(Looper.getMainLooper()).post((Runnable)new m$k(m, activity, n, n2, this.adMarvelAd)); } } } } @JavascriptInterface public void expandto(final int n, final int n2, final int n3, final int n4, final String l, final String s) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if ((d == null || !d.b()) && !this.isInterstitial) { final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { final Context context = d.getContext(); if (context != null && context instanceof Activity) { final Activity activity = (Activity)context; if (s != null && s.length() > 0) { this.expandtofullscreen(l, s); return; } if (l != null) { m.l = l; } if (m.x) { new Handler(Looper.getMainLooper()).post((Runnable)new m$j(m, activity, n, n2, n3, n4)); return; } new Handler(Looper.getMainLooper()).post((Runnable)new m$k(m, activity, n, n2, n3, n4, this.adMarvelAd)); } } } } @JavascriptInterface public void expandto(final int n, final int n2, final String l, final String s) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if ((d == null || !d.b()) && !this.isInterstitial) { final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { final Context context = d.getContext(); if (context != null && context instanceof Activity) { final Activity activity = (Activity)context; if (s != null && s.length() > 0) { this.expandtofullscreen(l, s); return; } if (l != null) { m.l = l; } if (m.x) { new Handler(Looper.getMainLooper()).post((Runnable)new m$j(m, activity, n, n2)); return; } new Handler(Looper.getMainLooper()).post((Runnable)new m$k(m, activity, n, n2, this.adMarvelAd)); } } } } @JavascriptInterface public void expandtofullscreen() { final d d = (d)this.adMarvelInternalWebViewReference.get(); if ((d == null || !d.b()) && !this.isInterstitial) { final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { final Context context = d.getContext(); if (context != null && context instanceof Activity) { final Activity activity = (Activity)context; m.y = true; if (m.w) { this.disablerotations(this.lockedOrientation); } if (m.x) { new Handler(Looper.getMainLooper()).post((Runnable)new m$j(m, activity, 0, 0, -1, -1)); return; } new Handler(Looper.getMainLooper()).post((Runnable)new m$k(m, activity, 0, 0, -1, -1, this.adMarvelAd)); } } } } @JavascriptInterface public void expandtofullscreen(final String l) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if ((d == null || !d.b()) && !this.isInterstitial) { final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { final Context context = d.getContext(); if (context != null && context instanceof Activity) { final Activity activity = (Activity)context; m.y = true; if (l != null) { m.l = l; } if (m.w) { this.disablerotations(this.lockedOrientation); } if (m.x) { new Handler(Looper.getMainLooper()).post((Runnable)new m$j(m, activity, 0, 0, -1, -1)); return; } new Handler(Looper.getMainLooper()).post((Runnable)new m$k(m, activity, 0, 0, -1, -1, this.adMarvelAd)); } } } } @JavascriptInterface public void expandtofullscreen(final String l, final String m) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if ((d == null || !d.b()) && !this.isInterstitial) { final m i = (m)this.adMarvelWebViewReference.get(); if (i != null) { final Context context = d.getContext(); Activity activity = null; if (context != null && context instanceof Activity) { activity = (Activity)context; } else { if (m == null) { return; } if (m.length() == 0) { return; } } if (l != null) { i.l = l; } i.y = true; if (m != null && m.length() > 0) { i.m = m; i.n = true; } if (i.w) { if (i.n) { if (this.lockedOrientation != null && this.lockedOrientation.length() > 0) { i.o = this.lockedOrientation; } else { i.o = "Current"; } } else { this.disablerotations(this.lockedOrientation); } } if (m != null && m.length() > 0) { new Handler(Looper.getMainLooper()).post((Runnable)new m$l(i, m, this.adMarvelAd)); return; } if (i.x) { new Handler(Looper.getMainLooper()).post((Runnable)new m$j(i, activity, 0, 0, -1, -1)); return; } new Handler(Looper.getMainLooper()).post((Runnable)new m$k(i, activity, 0, 0, -1, -1, this.adMarvelAd)); } } } @JavascriptInterface public void fetchWebViewHtmlContent(final String htmlJson) { if (this.adMarvelAd != null) { this.adMarvelAd.setHtmlJson(htmlJson); } } @JavascriptInterface public void finishVideo() { if (!this.isInterstitial && Version.getAndroidSDKVersion() >= 14) { Logging.log("window.ADMARVEL.finishVideo()"); final m m = (m)this.adMarvelWebViewReference.get(); if (m != null && this.adMarvelInternalWebViewReference.get() != null) { new Handler(Looper.getMainLooper()).post((Runnable)new m$m(m)); } } } @JavascriptInterface public void firePixel(final String s) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null && !d.b()) { if (!this.isInterstitial) { final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { e.a().b().execute(new m$n(d, m, s)); } } else { final AdMarvelActivity adMarvelActivity = (AdMarvelActivity)this.adMarvelActivityReference.get(); if (adMarvelActivity != null) { adMarvelActivity.g.post((Runnable)new AdMarvelActivity$j(d, adMarvelActivity, s)); } } } } @JavascriptInterface public int getAndroidOSVersionAPI() { return Version.getAndroidSDKVersion(); } @JavascriptInterface public void getLocation(final String s) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null && !d.b()) { e.a().b().execute(new r$i(d, s)); } } @JavascriptInterface public void initAdMarvel(final String s) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null && !d.b()) { if (!this.isInterstitial) { final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { e.a().b().execute(new m$p(s, d, m)); } } else { final AdMarvelActivity adMarvelActivity = (AdMarvelActivity)this.adMarvelActivityReference.get(); if (adMarvelActivity != null) { adMarvelActivity.g.post((Runnable)new AdMarvelActivity$m(s, d, adMarvelActivity)); } } } } @JavascriptInterface public void initVideo(final String z) { if (!this.isInterstitial && Version.getAndroidSDKVersion() >= 14) { Logging.log("window.ADMARVEL.setVideoUrl(\"" + z + "\")"); final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { m.z = z; final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null && !d.b() && m.z != null && m.z.length() > 0) { new Handler(Looper.getMainLooper()).post((Runnable)new m$q(z, m, d)); } } } } @JavascriptInterface public int isInterstitial() { if (this.isInterstitial) { return 1; } return 0; } @JavascriptInterface public int isinitialload() { return 1; } @JavascriptInterface public int isinstalled(final String s) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d == null) { return 0; } if (d != null && d.b()) { return 0; } if (r.a(d.getContext(), s)) { return 1; } return 0; } @JavascriptInterface public int isvideocached() { if (this.isInterstitial) { return 0; } if (Version.getAndroidSDKVersion() < 14) { return 0; } Logging.log("window.ADMARVEL.isvideocached()"); final m m = (m)this.adMarvelWebViewReference.get(); if (m == null) { return 0; } if (Version.getAndroidSDKVersion() >= 14) { return new m$r().a(m); } return 0; } @JavascriptInterface public void loadVideo() { if (!this.isInterstitial) { if (Version.getAndroidSDKVersion() >= 14) { Logging.log("window.ADMARVEL.loadVideo()"); final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null && !d.b() && m.z != null && m.z.length() > 0) { new Handler(Looper.getMainLooper()).post((Runnable)new m$s(m.z, m, d)); } } } } else { Logging.log("window.ADMARVEL.loadVideo()"); final AdMarvelActivity adMarvelActivity = (AdMarvelActivity)this.adMarvelActivityReference.get(); if (adMarvelActivity != null) { final d d2 = (d)this.adMarvelInternalWebViewReference.get(); if (d2 != null) { adMarvelActivity.j = true; if (this.videoUrl != null && this.videoUrl.length() > 0) { adMarvelActivity.g.post((Runnable)new AdMarvelActivity$n(this.videoUrl, adMarvelActivity, d2)); } } } } } @JavascriptInterface public void notifyInAppBrowserCloseAction(final String u) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null && !d.b()) { d.u = u; } } @JavascriptInterface public void notifyInterstitialBackgroundState(final String s) { if (s != null && s.length() > 0) { final AdMarvelActivity adMarvelActivity = (AdMarvelActivity)this.adMarvelActivityReference.get(); if (adMarvelActivity != null) { adMarvelActivity.s = s; } } } @JavascriptInterface public void pauseVideo() { if (!this.isInterstitial) { if (Version.getAndroidSDKVersion() >= 14) { Logging.log("window.ADMARVEL.pauseVideo()"); final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null) { new Handler(Looper.getMainLooper()).post((Runnable)new m$v(m, d)); } } } } else { Logging.log("window.ADMARVEL.pauseVideo()"); final AdMarvelActivity adMarvelActivity = (AdMarvelActivity)this.adMarvelActivityReference.get(); if (adMarvelActivity != null) { final d d2 = (d)this.adMarvelInternalWebViewReference.get(); if (d2 != null) { adMarvelActivity.g.post((Runnable)new AdMarvelActivity$o(adMarvelActivity, d2)); } } } } @JavascriptInterface public void playVideo() { if (!this.isInterstitial) { if (Version.getAndroidSDKVersion() >= 14) { Logging.log("window.ADMARVEL.playVideo()"); final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null && m.z != null && m.z.length() > 0) { new Handler(Looper.getMainLooper()).post((Runnable)new m$w(m, d)); } } } } else { Logging.log("window.ADMARVEL.playVideo()"); final AdMarvelActivity adMarvelActivity = (AdMarvelActivity)this.adMarvelActivityReference.get(); if (adMarvelActivity != null) { final d d2 = (d)this.adMarvelInternalWebViewReference.get(); if (d2 != null && this.videoUrl != null && this.videoUrl.length() > 0) { adMarvelActivity.g.post((Runnable)new AdMarvelActivity$p(adMarvelActivity, d2)); } } } } @JavascriptInterface public void readyfordisplay() { Label_0030: { if (this.adMarvelInternalWebViewReference == null) { break Label_0030; } final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d == null || !d.b()) { break Label_0030; } return; } if (this.isInterstitial) { return; } final m m = (m)this.adMarvelWebViewReference.get(); if (m == null) { return; } if (!m.q.get()) { m.p.set(false); return; } if (m.b.compareAndSet(true, false) && com.admarvel.android.ads.m.a(m.s) != null) { com.admarvel.android.ads.m.a(m.s).a(m, this.adMarvelAd); } } @JavascriptInterface public void redirect(final String s) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d == null || !d.b()) { if (!this.isInterstitial) { final m m = (m)this.adMarvelWebViewReference.get(); if (m != null && d != null && (d.c() || (s != null && s.length() > 0 && (s.startsWith("admarvelsdk") || s.startsWith("admarvelinternal"))))) { m.c(s); } } else { final AdMarvelActivity adMarvelActivity = (AdMarvelActivity)this.adMarvelActivityReference.get(); if (adMarvelActivity != null && s != null && s.length() > 0) { adMarvelActivity.g.post((Runnable)new AdMarvelRedirectRunnable(s, (Context)adMarvelActivity, this.adMarvelAd, "interstitial", adMarvelActivity.h, AdMarvelInterstitialAds.getEnableClickRedirect(), AdMarvelInterstitialAds.enableOfflineSDK, false)); } } } } @JavascriptInterface public void registerEventsForAdMarvelVideo(final String s, final String s2) { if (!this.isInterstitial) { if (Version.getAndroidSDKVersion() >= 14 && s != null && s.length() != 0 && s2 != null && s2.length() != 0) { final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { if (s.equals("loadeddata")) { m.F = s2; return; } if (s.equals("play")) { m.G = s2; return; } if (s.equals("canplay")) { m.H = s2; return; } if (s.equals("timeupdate")) { m.I = s2; return; } if (s.equals("ended")) { m.J = s2; return; } if (s.equals("pause")) { m.K = s2; return; } if (s.equals("resume")) { m.L = s2; return; } if (s.equals("stop")) { m.M = s2; return; } if (s.equals("error")) { m.N = s2; } } } } else if (s != null && s.length() != 0 && s2 != null && s2.length() != 0) { final AdMarvelActivity adMarvelActivity = (AdMarvelActivity)this.adMarvelActivityReference.get(); if (adMarvelActivity != null) { if (s.equals("loadeddata")) { adMarvelActivity.k = s2; return; } if (s.equals("play")) { adMarvelActivity.l = s2; return; } if (s.equals("canplay")) { adMarvelActivity.m = s2; return; } if (s.equals("timeupdate")) { adMarvelActivity.n = s2; return; } if (s.equals("ended")) { adMarvelActivity.o = s2; return; } if (s.equals("pause")) { adMarvelActivity.p = s2; return; } if (s.equals("error")) { adMarvelActivity.q = s2; } } } } @JavascriptInterface public void registerInterstitialCloseCallback(final String r) { if (r != null && r.length() > 0) { final AdMarvelActivity adMarvelActivity = (AdMarvelActivity)this.adMarvelActivityReference.get(); if (adMarvelActivity != null) { adMarvelActivity.r = r; } } } @JavascriptInterface public void registeraccelerationevent(final String s) { final Context context = (Context)this.contextReference.get(); if (context != null) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null && !d.b()) { final com.admarvel.android.util.d a = com.admarvel.android.util.d.a(); if (a != null && a.a(context)) { a.b(s); a.a(context, d); } } } } @JavascriptInterface public void registerheadingevent(final String s) { final Context context = (Context)this.contextReference.get(); if (context != null) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null && !d.b()) { final com.admarvel.android.util.d a = com.admarvel.android.util.d.a(); if (a != null && a.a(context)) { a.c(s); a.a(context, d); } } } } @JavascriptInterface public void registernetworkchangeevent(final String s) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null && !d.b()) { b.a(d, s); } } @JavascriptInterface public void registershakeevent(final String s, final String s2, final String s3) { final Context context = (Context)this.contextReference.get(); if (context != null) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null && !d.b()) { final com.admarvel.android.util.d a = com.admarvel.android.util.d.a(); if (a != null && a.a(context)) { a.a(s); a.a(s2, s3); a.a(context, d); } } } } @JavascriptInterface public void reportAdMarvelAdHistory() { final Context context = (Context)this.contextReference.get(); if (context != null) { AdMarvelUtils.reportAdMarvelAdHistory(context); } } @JavascriptInterface public void reportAdMarvelAdHistory(final int n) { final Context context = (Context)this.contextReference.get(); if (context != null) { AdMarvelUtils.reportAdMarvelAdHistory(n, context); } } @JavascriptInterface public void resumeVideo() { if (!this.isInterstitial && Version.getAndroidSDKVersion() >= 14) { Logging.log("window.ADMARVEL.resumeVideo()"); final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null) { new Handler(Looper.getMainLooper()).post((Runnable)new m$y(m, d)); } } } } @JavascriptInterface public void sdkclosebutton(final String s, final String s2) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d == null || !d.b()) { if (!this.isInterstitial) { final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { m.g = false; m.h = false; m.i = false; if (s != null && s.equals("true")) { m.g = true; m.i = true; return; } if (s != null && s.equals("false") && s2 != null && s2.equals("true")) { m.g = true; m.h = true; m.i = false; } } } else if (s != null && s.equals("false")) { if (s2 != null && s2.equals("true")) { if (d != null) { d.a(true); } } else if (d != null) { d.a(false); } } else if (s != null && s.equals("true")) { d.m(); } } } @JavascriptInterface public void sdkclosebutton(final String s, final String s2, final String j) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if ((d == null || !d.b()) && !this.isInterstitial) { final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { m.g = false; m.h = false; m.i = false; if (s != null && s.equals("true")) { m.g = true; m.i = true; } else if (s != null && s.equals("false") && s2 != null && s2.equals("true")) { m.g = true; m.h = true; m.i = false; } if (j != null && j.length() > 0) { m.j = j; } } } } @JavascriptInterface public void seekVideoTo(final float n) { if (!this.isInterstitial) { if (Version.getAndroidSDKVersion() >= 14) { Logging.log("window.ADMARVEL.seekToVideo()"); final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null && m.z != null && m.z.length() > 0) { new Handler(Looper.getMainLooper()).post((Runnable)new m$z(m, d, n)); } } } } else { Logging.log("window.ADMARVEL.seekToVideo()"); final AdMarvelActivity adMarvelActivity = (AdMarvelActivity)this.adMarvelActivityReference.get(); if (adMarvelActivity != null) { final d d2 = (d)this.adMarvelInternalWebViewReference.get(); if (d2 != null && this.videoUrl != null && this.videoUrl.length() > 0) { adMarvelActivity.g.post((Runnable)new AdMarvelActivity$q(adMarvelActivity, d2, n)); } } } } @JavascriptInterface public void setInitialAudioState(final String s) { if (!this.isInterstitial && Version.getAndroidSDKVersion() >= 14) { Logging.log("window.ADMARVEL.setInitialAudioState()"); final m m = (m)this.adMarvelWebViewReference.get(); if (m != null && s != null && s.trim().length() > 0) { if (s.equalsIgnoreCase("mute")) { m.P = true; return; } if (s.equalsIgnoreCase("unmute")) { m.P = false; } } } } @JavascriptInterface public void setVideoContainerHeight(final int e) { if (!this.isInterstitial && Version.getAndroidSDKVersion() >= 14) { Logging.log("ADMARVEL.setVideoContainerHeight " + e); final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { m.E = e; } } } @JavascriptInterface public void setVideoDimensions(final int c, final int d, final int a, final int b) { if (!this.isInterstitial) { Logging.log("ADMARVEL.setVideoDimensions " + c + " " + d + " " + a + " " + b); final m m = (m)this.adMarvelWebViewReference.get(); if (m != null && Version.getAndroidSDKVersion() >= 14) { m.A = a; m.B = b; m.C = c; m.D = d; final d d2 = (d)this.adMarvelInternalWebViewReference.get(); if (d2 != null && !d2.b()) { new Handler(Looper.getMainLooper()).post((Runnable)new m$x(m, d2, c, d, a, b)); } } } } @JavascriptInterface public void setVideoUrl(final String videoUrl) { if (this.isInterstitial) { Logging.log("window.ADMARVEL.setVideoUrl(\"" + videoUrl + "\")"); final AdMarvelActivity adMarvelActivity = (AdMarvelActivity)this.adMarvelActivityReference.get(); if (adMarvelActivity != null) { this.videoUrl = videoUrl; adMarvelActivity.j = true; } } } @JavascriptInterface public void setbackgroundcolor(final String s) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null && !d.b()) { int n; if ("0".equals(s)) { n = 0; } else { final long long1 = Long.parseLong(s.replace("#", ""), 16); long n2 = 0L; Label_0110: { if (s.length() != 7) { n2 = long1; if (s.length() != 6) { break Label_0110; } } n2 = (long1 | 0xFFFFFFFFFF000000L); } n = (int)n2; } d.setBackgroundColor(n); if (!this.isInterstitial) { final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { m.c = n; new Handler(Looper.getMainLooper()).post((Runnable)new m$aa(m)); } } } } @JavascriptInterface public void setsoftwarelayer() { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d == null || d.b() || Version.getAndroidSDKVersion() < 11 || this.isInterstitial || this.adMarvelWebViewReference.get() == null) { return; } new Handler(Looper.getMainLooper()).post((Runnable)new m$af(d)); } @JavascriptInterface public void stopVideo() { if (!this.isInterstitial) { if (Version.getAndroidSDKVersion() >= 14) { Logging.log("window.ADMARVEL.stopVideo()"); final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null) { new Handler(Looper.getMainLooper()).post((Runnable)new m$ab(m, d)); } } } } else { Logging.log("window.ADMARVEL.stopVideo()"); final AdMarvelActivity adMarvelActivity = (AdMarvelActivity)this.adMarvelActivityReference.get(); if (adMarvelActivity != null) { final d d2 = (d)this.adMarvelInternalWebViewReference.get(); if (d2 != null) { adMarvelActivity.g.post((Runnable)new AdMarvelActivity$s(adMarvelActivity, d2)); } } } } @JavascriptInterface public void storepicture(String a, final String s) { final Context context = (Context)this.contextReference.get(); if (context != null) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if (d != null && !d.b()) { a = r.a(a, context); if (!r.c(d.getContext(), "android.permission.WRITE_EXTERNAL_STORAGE") || !"mounted".equals(Environment.getExternalStorageState())) { if (s != null) { d.e(s + "(NO)"); } } else { if (context instanceof Activity) { final AlertDialog$Builder alertDialog$Builder = new AlertDialog$Builder((Context)context); alertDialog$Builder.setMessage((CharSequence)"Allow storing image in your Gallery?").setCancelable(false).setPositiveButton((CharSequence)"Yes", (DialogInterface$OnClickListener)new DialogInterface$OnClickListener() { public void onClick(final DialogInterface dialogInterface, final int n) { if (Version.getAndroidSDKVersion() < 8) { e.a().b().execute(new r$l(d, a, s)); return; } e.a().b().execute(new r$k(d, a, s)); } }).setNegativeButton((CharSequence)"No", (DialogInterface$OnClickListener)new DialogInterface$OnClickListener() { public void onClick(final DialogInterface dialogInterface, final int n) { if (s != null) { d.e(s + "(\"NO\")"); } dialogInterface.cancel(); } }); alertDialog$Builder.create().show(); return; } d.e(s + "(\"NO\")"); } } } } @JavascriptInterface public void triggerVibration(final String s) { int n = 10000; Label_0036: while (true) { Label_0059: { if (s == null || s.trim().length() <= 0) { break Label_0059; } while (true) { int int1 = 0; Label_0066: { try { int1 = Integer.parseInt(s); if (int1 > 10000) { Logging.log("Time mentioned is greater than Max duration "); r.a((Context)this.contextReference.get(), n); return; } break Label_0066; } catch (NumberFormatException ex) { Logging.log("NumberFormatException so setting vibrate time to 500 Milli Sec"); } break; } n = int1; continue Label_0036; } } n = 500; continue Label_0036; } } @JavascriptInterface public void updateAudioState(final String s) { if (!this.isInterstitial && Version.getAndroidSDKVersion() >= 14) { Logging.log("window.ADMARVEL.updateAudioState()"); final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { new Handler(Looper.getMainLooper()).post((Runnable)new m$ad(m, s)); } } } @JavascriptInterface public void updatestate(final String s) { final d d = (d)this.adMarvelInternalWebViewReference.get(); if ((d == null || !d.b()) && !this.isInterstitial) { final m m = (m)this.adMarvelWebViewReference.get(); if (m != null) { new Handler(Looper.getMainLooper()).post((Runnable)new m$ae(s, m)); } } } }
4d00a6236a220035b5ec1a8d2c3e062167b23fe8
537c9f18d919b19e69ab9f503c6c06a5498703fc
/src/main/java/com/duol/leetcode/y21/m3/d30/no27/remove_element/Solution.java
6ae1c7c4a80d4ce246a062a59c924cdad84bdebe
[ "MIT" ]
permissive
Duolaimon/algorithm
fc3a7658efe7baf98e5eff3293defed0770c6d46
eb9ffccb7a28d058a9e748dd54f7fc2367796909
refs/heads/master
2022-05-28T10:45:06.737836
2021-04-21T05:35:00
2021-04-21T05:35:00
235,233,466
0
0
MIT
2022-05-20T21:23:56
2020-01-21T01:41:15
Java
UTF-8
Java
false
false
2,360
java
/** * Leetcode - remove_element */ package com.duol.leetcode.y21.m3.d30.no27.remove_element; import java.util.*; import com.duol.common.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * 27. 移除元素 * * 给你一个数组 nums和一个值 val,你需要 原地 移除所有数值等于val的元素,并返回移除后数组的新长度。 * * 不要使用额外的数组空间,你必须仅使用 O(1) 额外空间并 原地 修改输入数组。 * * 元素的顺序可以改变。你不需要考虑数组中超出新长度后面的元素。 * * * * 说明: * * 为什么返回数值是整数,但输出的答案是数组呢? * * 请注意,输入数组是以「引用」方式传递的,这意味着在函数里修改输入数组对于调用者是可见的。 * * 你可以想象内部操作如下: * * // nums 是以“引用”方式传递的。也就是说,不对实参作任何拷贝 * int len = removeElement(nums, val); * * // 在函数里修改输入数组对于调用者是可见的。 * // 根据你的函数返回的长度, 它会打印出数组中 该长度范围内 的所有元素。 * for (int i = 0; i < len; i++) { * print(nums[i]); * } * * * 示例 1: * * 输入:nums = [3,2,2,3], val = 3 * 输出:2, nums = [2,2] * 解释:函数应该返回新的长度 2, 并且 nums 中的前两个元素均为 2。你不需要考虑数组中超出新长度后面的元素。例如,函数返回的新长度为 2 ,而 nums = [2,2,3,3] 或 nums = [2,2,0,0],也会被视作正确答案。 * 示例 2: * * 输入:nums = [0,1,2,2,3,0,4,2], val = 2 * 输出:5, nums = [0,1,4,0,3] * 解释:函数应该返回新的长度 5, 并且 nums 中的前五个元素为 0, 1, 3, 0, 4。注意这五个元素可为任意顺序。你不需要考虑数组中超出新长度后面的元素。 * * * 提示: * * 0 <= nums.length <= 100 * 0 <= nums[i] <= 50 * 0 <= val <= 100 * * 来源:力扣(LeetCode) * 链接:https://leetcode-cn.com/problems/remove-element * 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 */ interface Solution { // use this Object to print the log (call from slf4j facade) static Logger log = LoggerFactory.getLogger(Solution.class); int removeElement(int[] nums, int val); }
3542d5b11dbd533fab0d49b74413fa26ca6b0a2d
5417124e8aff763063677d79ae4ff0dde95c983d
/src/com/lsd/testToken/exception/ExpiredException.java
0138e025b4c6a08cf55883e1f6af0cf1ea976fe3
[]
no_license
jianghuabin/testToken
71cfac3f84c02a212c60029b3e9b71c15dcd94b0
d86694d42b52db5b78931da0c22c0de8a167cc0e
refs/heads/master
2021-01-11T11:58:20.858673
2017-01-19T05:48:42
2017-01-19T05:48:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
743
java
package com.lsd.testToken.exception; public class ExpiredException extends TokenException { public ExpiredException() { // TODO Auto-generated constructor stub } public ExpiredException(String message) { super(message); // TODO Auto-generated constructor stub } public ExpiredException(Throwable cause) { super(cause); // TODO Auto-generated constructor stub } public ExpiredException(String message, Throwable cause) { super(message, cause); // TODO Auto-generated constructor stub } public ExpiredException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); // TODO Auto-generated constructor stub } }
fa7ab3a240e8531b830e7dcd7812bb66b446732e
5ff723cdf5824a04f56eb1853eac5d2190dc4b45
/task-manager/src/main/java/com/snow/umtask/listener/JobExceptionListener.java
88f445260e5eca98ca5a1993d7900f3f7d78fb8d
[]
no_license
lovexuxu123456/snow-repository
60fe788a5a3bc7700512644d00c6a8c7fbcd4dd2
d763f699c5337b48567582c07426a45ae79876a8
refs/heads/master
2020-03-28T08:40:27.215968
2018-09-09T02:05:19
2018-09-09T02:05:19
147,980,735
0
0
null
null
null
null
UTF-8
Java
false
false
3,897
java
package com.snow.umtask.listener; import com.alibaba.fastjson.JSON; import com.snow.umtask.entity.EmailListenerInfo; import com.snow.umtask.service.EmailListenerInfoService; import com.snow.umtask.service.ExceptionJobService; import com.snow.umtask.util.Constant; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.quartz.listeners.JobListenerSupport; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class JobExceptionListener extends JobListenerSupport { Logger logger = LoggerFactory.getLogger(JobExceptionListener.class); @Autowired private ExceptionJobService exceptionJobService; @Autowired private EmailListenerInfoService emailListenerInfoService; private String name; public JobExceptionListener(String name){ this.name = name; } public JobExceptionListener(){ this(Constant.EXCEPTION_LISTENER); } /** * Scheduler 在 JobDetail 将要被执行时调用这个方法 */ @Override public void jobExecutionVetoed(JobExecutionContext context) { System.out.println("Scheduler 在 JobDetail 将要被执行时调用这个方法"); } /** * Scheduler 在 JobDetail 即将被执行,但又被 TriggerListener否决了时调用这个方法。 */ @Override public void jobToBeExecuted(JobExecutionContext context) { System.out.println("Job监听器:MyJobListener.jobToBeExecuted()"); } /** * Scheduler 在 JobDetail 被执行之后调用这个方法。 */ @Override public void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException) { String simpleListenerName = context.getJobDetail().getJobClass().getSimpleName() + "_Then_" + "EMAIL"; EmailListenerInfo info = emailListenerInfoService.selectByPrimaryKey(simpleListenerName); if(jobException!=null) { System.out.println("Job邮件监听器:" + context.getJobDetail().getDescription() +"执行异常结束"); if(info != null && info.getAllowSendExceptionEmail() == 1){ System.out.println("我发送异常邮件了哦"); System.out.println("参数:"+JSON.toJSONString(info)); System.out.println("异常收件人:" + JSON.toJSONString(info.getReceiveExceptionPersonArray())); System.out.println("正常收件人:" + JSON.toJSONString(info.getReceiveExceptionPersonArray())); System.out.println("是否允许发送异常邮件:" + info.getAllowSendExceptionEmail()); System.out.println("是否允许发送正常结束邮件" + info.getAllowSendNormalEmail()); } //保存异常信息到数据库中 exceptionJobService.saveExceptionJob(context.getJobDetail().getKey().toString(), jobException.getMessage()); return; } if(info != null && info.getAllowSendNormalEmail() == 1){ System.out.println("我发送正常结束的邮件了哦"); System.out.println("参数:"+JSON.toJSONString(info)); System.out.println("异常收件人:" + JSON.toJSONString(info.getReceiveExceptionPersonArray())); System.out.println("正常收件人:" + JSON.toJSONString(info.getReceiveExceptionPersonArray())); System.out.println("是否允许发送异常邮件:" + info.getAllowSendExceptionEmail()); System.out.println("是否允许发送正常结束邮件" + info.getAllowSendNormalEmail()); } System.out.println("Job邮件监听器:" + context.getJobDetail().getDescription() +"执行结束"); } @Override public String getName() { return this.name; } }
96d48ea3e89ea1d2daaeb41aae34cffe1e1d5f54
1d1055343e529037008939423e1c75aa04d68870
/TC/app/src/main/java/com/example/tc/MainActivity.java
cdd4f55e6fafe5af819ce15112b900f1f0248278
[]
no_license
Hassad1916/Android-studio-3
526d78ca73e3d39cdea67184aeda7c9c94d71742
38334f25a894b81855953327dc1fe3c1dd0c2615
refs/heads/main
2023-01-09T18:56:07.201757
2020-11-12T06:45:18
2020-11-12T06:45:18
312,190,973
0
0
null
null
null
null
UTF-8
Java
false
false
1,853
java
package com.example.tc; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import java.text.DecimalFormat; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button button = (Button)findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { DecimalFormat nf = new DecimalFormat("0.00");//小數後兩位 EditText tmpc = (EditText)findViewById(R.id.editTextTextPersonName); //華氏 double c = Double.parseDouble(tmpc.getText().toString()); double f = (c * 9 / 5) + 32; TextView trans_Ans = (TextView)findViewById(R.id.textView4); trans_Ans.setText("" + nf.format(f) + " F"); } }); Button button1 = (Button)findViewById(R.id.button2); button1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { DecimalFormat nf = new DecimalFormat("0.00");//小數後兩位 EditText tmpf = (EditText)findViewById(R.id.editTextTextPersonName); //攝氏 double f = Double.parseDouble(tmpf.getText().toString()); double c = (f - 32) * 5 / 9; TextView trans_Ans = (TextView)findViewById(R.id.textView4); trans_Ans.setText("" + nf.format(c)+" C"); } }); } }
44d8304b78d6d3c8cf0be0fa1aafcfe09287cf16
edffe52b2220ec128d190a28222a417bbcb43bf8
/owl-transformer/src/main/java/com/owl/trans/etl/mr/ald/AnalyserLogDataMapper.java
ba282f608b46f5909e540ce2989b7597133b18cf
[]
no_license
tangxc227/bd-owl
b75fe7550d42d49af5b5a6c795c2a5cf59ed1fae
3311d2f3a01d634ef9029f0bbd2f2f53dda4507d
refs/heads/master
2020-04-12T02:20:10.126515
2018-12-24T09:07:46
2018-12-24T09:07:46
156,675,754
0
0
null
null
null
null
UTF-8
Java
false
false
4,596
java
package com.owl.trans.etl.mr.ald; import com.owl.trans.common.EventEnum; import com.owl.trans.common.EventLogConstants; import com.owl.trans.etl.util.LoggerUtil; import org.apache.commons.lang.StringUtils; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.io.NullWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Mapper; import org.apache.log4j.Logger; import java.io.IOException; import java.util.Map; import java.util.zip.CRC32; /** * @Author: tangxc * @Description: * @Date: Created in 11:07 2018/12/24 * @Modified by: */ public class AnalyserLogDataMapper extends Mapper<Object, Text, NullWritable, Put> { private static final Logger LOGGER = Logger.getLogger(AnalyserLogDataMapper.class); // 主要用于标志,方便查看过滤数据 private int inputRecords, filterRecords, outputRecords; private byte[] family = Bytes.toBytes(EventLogConstants.EVENT_LOGS_FAMILY_NAME); private CRC32 crc32 = new CRC32(); @Override protected void map(Object key, Text value, Context context) throws IOException, InterruptedException { this.inputRecords++; LOGGER.debug("处理数据:" + value.toString()); try { // 解析日志 Map<String, String> clientInfo = LoggerUtil.handleLog(value.toString()); if (clientInfo.isEmpty()) { this.filterRecords++; return; } String eventAliasName = clientInfo.get(EventLogConstants.LOG_COLUMN_NAME_EVENT_NAME); EventEnum eventEnum = EventEnum.valueOfAlias(eventAliasName); switch (eventEnum) { case LAUNCH: case PAGEVIEW: case CHARGEREQUEST: case CHARGESUCCESS: case CHARGEREFUND: case EVENT: // 处理数据 this.handleData(clientInfo, eventEnum, context); break; default: this.filterRecords++; LOGGER.warn("该事件没法进行解析,事件名称为:" + eventAliasName); } } catch (Exception e) { this.filterRecords++; LOGGER.error("处理数据发生异常, 数据:" + value, e); } } @Override protected void cleanup(Context context) throws IOException, InterruptedException { super.cleanup(context); LOGGER.info("输入数据:" + this.inputRecords + ";输出数据:" + this.outputRecords + ";过滤数据:" + this.filterRecords); } private void handleData(Map<String, String> clientInfo, EventEnum eventEnum, Context context) throws IOException, InterruptedException { String uuid = clientInfo.get(EventLogConstants.LOG_COLUMN_NAME_UUID); String memberId = clientInfo.get(EventLogConstants.LOG_COLUMN_NAME_MEMBER_ID); String serverTime = clientInfo.get(EventLogConstants.LOG_COLUMN_NAME_SERVER_TIME); if (StringUtils.isNotBlank(serverTime)) { // 去掉浏览器信息 clientInfo.remove(EventLogConstants.LOG_COLUMN_NAME_USER_AGENT); String rowKey = this.generateRowKey(uuid, memberId, eventEnum.alias, serverTime); Put put = new Put(Bytes.toBytes(rowKey)); for (Map.Entry<String, String> entry : clientInfo.entrySet()) { if (StringUtils.isNotBlank(entry.getKey()) && StringUtils.isNotBlank(entry.getValue())) { put.add(family, Bytes.toBytes(entry.getKey()), Bytes.toBytes(entry.getValue())); } } context.write(NullWritable.get(), put); this.outputRecords++; } else { this.filterRecords++; } } /** * 根据uuid memberid servertime创建rowkey * * @param uuid * @param memberId * @param alias * @param serverTime * @return */ private String generateRowKey(String uuid, String memberId, String alias, String serverTime) { StringBuilder builder = new StringBuilder(); builder.append(serverTime).append("_"); this.crc32.reset(); if (StringUtils.isNotBlank(uuid)) { this.crc32.update(uuid.getBytes()); } if (StringUtils.isNotBlank(memberId)) { this.crc32.update(memberId.getBytes()); } this.crc32.update(alias.getBytes()); builder.append(this.crc32.getValue() % 100000000L); return builder.toString(); } }
cdf5a1074e002894513d8feb27cdade4feb11c69
594dbe9ad659263e560e2d84d02dae411e3ff2ca
/glaf-web/src/main/java/com/glaf/report/core/service/ReportTmpMappingServiceImpl.java
d10be5656e6cd78b2e9e256c4e61f5b309e28b10
[]
no_license
eosite/openyourarm
670b3739f9abb81b36a7d90846b6d2e68217b443
7098657ee60bf6749a13c0ea19d1ac1a42a684a0
refs/heads/master
2021-05-08T16:38:30.406098
2018-01-24T03:38:45
2018-01-24T03:38:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,068
java
package com.glaf.report.core.service; import java.util.Date; import java.util.List; import java.util.Map; import java.util.Map.Entry; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.ibatis.session.RowBounds; import org.mybatis.spring.SqlSessionTemplate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.glaf.core.config.Environment; import com.glaf.core.dao.EntityDAO; import com.glaf.core.id.IdGenerator; import com.glaf.core.jdbc.DBConnectionFactory; import com.glaf.core.security.Authentication; import com.glaf.core.util.DBUtils; import com.glaf.datamgr.jdbc.DataSetBuilder; import com.glaf.report.core.domain.ReportTmpDataSetMapping; import com.glaf.report.core.domain.ReportTmpMapping; import com.glaf.report.core.domain.ReportTmpMappingEntity; import com.glaf.report.core.mapper.ReportTmpMappingMapper; import com.glaf.report.core.query.ReportTmpDataSetMappingQuery; import com.glaf.report.core.query.ReportTmpMappingQuery; @Service("com.glaf.report.core.service.reportTmpMappingService") @Transactional(readOnly = true) public class ReportTmpMappingServiceImpl implements ReportTmpMappingService { protected final Logger logger = LoggerFactory.getLogger(getClass()); protected EntityDAO entityDAO; protected IdGenerator idGenerator; protected JdbcTemplate jdbcTemplate; protected SqlSessionTemplate sqlSessionTemplate; protected ReportTmpMappingMapper reportTmpMappingMapper; protected ReportTmpDataSetMappingService reportTmpDataSetMappingService; protected ReportTmpColMappingService reportTmpColMappingService; public ReportTmpMappingServiceImpl() { } @Transactional public void bulkInsert(List<ReportTmpMapping> list) { for (ReportTmpMapping reportTmpMapping : list) { if (StringUtils.isEmpty(reportTmpMapping.getId())) { reportTmpMapping.setId(idGenerator.getNextId("REPORT_TMP_MAPPING")); } } if (StringUtils.equals(DBUtils.ORACLE, DBConnectionFactory.getDatabaseType())) { // reportTmpMappingMapper.bulkInsertReportTmpMapping_oracle(list); } else { // reportTmpMappingMapper.bulkInsertReportTmpMapping(list); } } @Transactional public void deleteById(String id) { if (id != null) { reportTmpMappingMapper.deleteReportTmpMappingById(id); } } @Transactional public void deleteByIds(List<String> ids) { if (ids != null && !ids.isEmpty()) { for (String id : ids) { reportTmpMappingMapper.deleteReportTmpMappingById(id); } } } public int count(ReportTmpMappingQuery query) { return reportTmpMappingMapper.getReportTmpMappingCount(query); } public List<ReportTmpMapping> list(ReportTmpMappingQuery query) { List<ReportTmpMapping> list = reportTmpMappingMapper.getReportTmpMappings(query); return list; } /** * 根据查询参数获取记录总数 * * @return */ public int getReportTmpMappingCountByQueryCriteria(ReportTmpMappingQuery query) { return reportTmpMappingMapper.getReportTmpMappingCount(query); } /** * 根据查询参数获取一页的数据 * * @return */ public List<ReportTmpMapping> getReportTmpMappingsByQueryCriteria(int start, int pageSize, ReportTmpMappingQuery query) { RowBounds rowBounds = new RowBounds(start, pageSize); List<ReportTmpMapping> rows = sqlSessionTemplate.selectList("getReportTmpMappings", query, rowBounds); return rows; } public ReportTmpMapping getReportTmpMapping(String id) { if (id == null) { return null; } ReportTmpMapping reportTmpMapping = reportTmpMappingMapper.getReportTmpMappingById(id); return reportTmpMapping; } @Transactional public void save(ReportTmpMapping reportTmpMapping) { if (StringUtils.isEmpty(reportTmpMapping.getId())) { reportTmpMapping.setId(idGenerator.getNextId("REPORT_TMP_MAPPING")); reportTmpMapping.setCreateDatetime(new Date()); reportTmpMapping.setDeleteFlag(0); reportTmpMapping.setSystemId(Environment.DEFAULT_SYSTEM_NAME); reportTmpMapping.setCreator(Authentication.getAuthenticatedActorId()); reportTmpMappingMapper.insertReportTmpMapping(reportTmpMapping); } else { reportTmpMapping.setModifyDatetime(new Date()); reportTmpMapping.setModifier(Authentication.getAuthenticatedActorId()); reportTmpMappingMapper.updateReportTmpMapping(reportTmpMapping); } } public ReportTmpMappingEntity getReportTmpDatasetMapping(String tmpMappingId) { ReportTmpMappingEntity reportTmpMappingEntity = new ReportTmpMappingEntity(); Map<String, String> dataSetMappingMap = reportTmpDataSetMappingService .getReportTmpDataSetMappingMap(tmpMappingId); reportTmpMappingEntity.setDatasetMapping(dataSetMappingMap); Map<String, Map<String, String>> colMappingMap = reportTmpColMappingService .getReportTmpColMappingMap(tmpMappingId); reportTmpMappingEntity.setDatasetColMapping(colMappingMap); return reportTmpMappingEntity; } public JSONObject getReportDatasetData(String tmpMappingId, JSONObject paramJson) { JSONObject reportDataJson = new JSONObject(); ReportTmpDataSetMappingQuery query = new ReportTmpDataSetMappingQuery(); query.setTmpMappingId(tmpMappingId); List<ReportTmpDataSetMapping> dataSets = this.reportTmpDataSetMappingService.list(query); if (CollectionUtils.isNotEmpty(dataSets)) { for (ReportTmpDataSetMapping dataSet : dataSets) { String dataSetId = dataSet.getMappingDataSetId(); String dataSetCode = dataSet.getDataSetCode(); if (StringUtils.isNotBlank(dataSetId)) { DataSetBuilder builder = new DataSetBuilder(); Object rows = builder.getJsonArray(dataSetId, paramJson.getJSONObject(dataSetCode)); reportDataJson.put(dataSetCode, rows); } } } return reportDataJson; } public JSONObject transReportDatasetData(ReportTmpMappingEntity reportTmpMappingEntity, JSONObject data) { JSONObject reportDataJson = new JSONObject(); if (data != null) { // 获取报表模板数据集映射 //Map<String, String> datasetMappingMap = reportTmpMappingEntity.getDatasetMapping(); // 获取报表模板数据集列映射 Map<String, Map<String, String>> datasetColMappingMap = reportTmpMappingEntity.getDatasetColMapping(); //String datasetCode = null; Map<String, String> colsMapping = null; JSONArray datasetData = null; String datasetDataStr = null; String colCode = null; String mappingColCode = null; for (String datasetCode : data.keySet()) { //datasetCode = datasetMappingMap.get(mappingDatasetCode); // 获取数据集列映射 colsMapping = datasetColMappingMap.get(datasetCode); datasetData = data.getJSONArray(datasetCode); // 转换为字符串 if (datasetData != null && colsMapping != null) { datasetDataStr = datasetData.toJSONString(); for (Entry<String, String> colMapping : colsMapping.entrySet()) { colCode = colMapping.getValue(); mappingColCode = colMapping.getKey(); // 将映射列CODE替换为模板数据集列CODE datasetDataStr=datasetDataStr.replaceAll("\""+mappingColCode+"\"", "\""+colCode+"\""); } reportDataJson.put(datasetCode, JSONArray.parseArray(datasetDataStr)); } } } return reportDataJson; } @javax.annotation.Resource public void setEntityDAO(EntityDAO entityDAO) { this.entityDAO = entityDAO; } @javax.annotation.Resource public void setIdGenerator(IdGenerator idGenerator) { this.idGenerator = idGenerator; } @javax.annotation.Resource(name = "com.glaf.report.core.mapper.ReportTmpMappingMapper") public void setReportTmpMappingMapper(ReportTmpMappingMapper reportTmpMappingMapper) { this.reportTmpMappingMapper = reportTmpMappingMapper; } @javax.annotation.Resource public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; } @javax.annotation.Resource public void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate) { this.sqlSessionTemplate = sqlSessionTemplate; } @javax.annotation.Resource public void setReportTmpDataSetMappingService(ReportTmpDataSetMappingService reportTmpDataSetMappingService) { this.reportTmpDataSetMappingService = reportTmpDataSetMappingService; } @javax.annotation.Resource public void setReportTmpColMappingService(ReportTmpColMappingService reportTmpColMappingService) { this.reportTmpColMappingService = reportTmpColMappingService; } @Override public JSONObject getReportData(String tmpMappingId, JSONObject paramJson) { // 获取源报表数据 JSONObject srcReportData = getReportDatasetData(tmpMappingId, paramJson); // 获取报表模板数据集映射 ReportTmpMappingEntity reportTmpMappingEntity = getReportTmpDatasetMapping(tmpMappingId); // 获取转换后的报表数据 JSONObject desReportData = transReportDatasetData(reportTmpMappingEntity, srcReportData); return desReportData; } }
099a40c216f7798bea81b218c798b5f146ad168d
3c22504d849008c3b97b105f49dcd020b2479324
/src/main/java/com/lxy/community/dto/CommentCreateDTO.java
69d87a0f2f975ee489536c5878403aad41f3c6d5
[]
no_license
Marioyyyy/community
67b59b775d0bddbf5aadf5bc782df89b4690a95d
5311b1cde236abd18af4b09b39e38dc6852758c7
refs/heads/main
2023-07-17T06:24:26.388494
2021-09-05T11:49:58
2021-09-05T11:49:58
392,595,613
0
0
null
null
null
null
UTF-8
Java
false
false
178
java
package com.lxy.community.dto; import lombok.Data; @Data public class CommentCreateDTO { private Integer parentId; private String content; private Integer type; }
62494eae573850e73d75ffef91255871b7e8ffeb
574ab1524deab1ef482c8e307f3390cdd493246f
/src/main/java/com/tictac/co/App.java
8a5bf3d57993e33cb4717299d410957661b51bcf
[]
no_license
tictac-app/tictacapp
64c58e1a40c762a31539ad7813721b0ddb8d34ae
66c2a7375f9433321d0c04acc47f002ca2b4a6f1
refs/heads/master
2022-12-01T08:36:56.508174
2020-08-05T21:57:35
2020-08-05T21:57:35
283,319,234
0
0
null
null
null
null
UTF-8
Java
false
false
176
java
package com.tictac.co; /** * Hello world! * */ public class App { public static void main( String[] args ) { System.out.println( "Hello World!" ); } }
64775bf1bed6a97ab13ba4e339a1f7d597470188
cc8bbaadf89ce62518f4f61a52c163c3c97b7925
/src/main/java/com/onshape/api/responses/DocumentsGetDocumentsResponse.java
eb300cf2e58f147baba282cfc492d67523e987b5
[ "MIT" ]
permissive
onshape-public/java-client
192e3e52b8e738d5043b46319575e34d697bdfc1
bbe754316fb4b70ffcbbeda5020fdcd9e96f85a9
refs/heads/master
2022-11-23T18:17:24.783431
2021-10-20T14:57:55
2021-10-20T14:57:55
155,573,642
4
4
MIT
2022-10-05T03:51:28
2018-10-31T14:44:48
Java
UTF-8
Java
false
false
4,020
java
// The MIT License (MIT) // // Copyright (c) 2018 - Present Onshape Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. // package com.onshape.api.responses; import com.fasterxml.jackson.annotation.JsonProperty; import com.onshape.api.Onshape; import com.onshape.api.exceptions.OnshapeException; import com.onshape.api.types.AbstractResponseObject; import java.lang.Override; import java.lang.String; import javax.validation.constraints.NotNull; /** * Response object for getDocuments API endpoint. * &copy; 2018-Present Onshape Inc. */ public final class DocumentsGetDocumentsResponse extends AbstractResponseObject { /** * URL of previous page of results */ @JsonProperty("previous") @NotNull String previous; /** * URL of current page of results */ @JsonProperty("href") @NotNull String href; /** * URL of next page of results */ @JsonProperty("next") @NotNull String next; /** * Array of documents */ @JsonProperty("items") @NotNull DocumentsGetDocumentsResponseItems[] items; /** * Fetch next page of results * @param onshape The Onshape client object. * @return Next page of results or null if this is last page. * @throws OnshapeException On HTTP or serialization error. */ public final DocumentsGetDocumentsResponse next(Onshape onshape) throws OnshapeException { return (next==null ? null : onshape.get(next, DocumentsGetDocumentsResponse.class)); } /** * Fetch previous page of results * @param onshape The Onshape client object. * @return Previous page of results or null if this is first page. * @throws OnshapeException On HTTP or serialization error. */ public final DocumentsGetDocumentsResponse previous(Onshape onshape) throws OnshapeException { return (previous==null ? null : onshape.get(previous, DocumentsGetDocumentsResponse.class)); } /** * Refresh this page of results * @param onshape The Onshape client object. * @return Updated response. * @throws OnshapeException On HTTP or serialization error. */ public final DocumentsGetDocumentsResponse refresh(Onshape onshape) throws OnshapeException { return onshape.get(href, DocumentsGetDocumentsResponse.class); } /** * Get URL of previous page of results * * @return URL of previous page of results * */ public final String getPrevious() { return this.previous; } /** * Get URL of current page of results * * @return URL of current page of results * */ public final String getHref() { return this.href; } /** * Get URL of next page of results * * @return URL of next page of results * */ public final String getNext() { return this.next; } /** * Get Array of documents * * @return Array of documents * */ public final DocumentsGetDocumentsResponseItems[] getItems() { return this.items; } @Override public String toString() { return Onshape.toString(this); } }
909a5103bab2ebdaf7cfc523a50b74468f7822bc
39b7e86a2b5a61a1f7befb47653f63f72e9e4092
/src/main/java/com/alipay/api/response/KoubeiMarketingMallShoppromoinfoQueryResponse.java
0f356c5932ffb29daac3b606b6438a5e5711da7c
[ "Apache-2.0" ]
permissive
slin1972/alipay-sdk-java-all
dbec0604c2d0b76d8a1ebf3fd8b64d4dd5d21708
63095792e900bbcc0e974fc242d69231ec73689a
refs/heads/master
2020-08-12T14:18:07.203276
2019-10-13T09:00:11
2019-10-13T09:00:11
214,782,009
0
0
Apache-2.0
2019-10-13T07:56:34
2019-10-13T07:56:34
null
UTF-8
Java
false
false
918
java
package com.alipay.api.response; import java.util.List; import com.alipay.api.internal.mapping.ApiField; import com.alipay.api.internal.mapping.ApiListField; import com.alipay.api.domain.ShopPromoInfo; import com.alipay.api.AlipayResponse; /** * ALIPAY API: koubei.marketing.mall.shoppromoinfo.query response. * * @author auto create * @since 1.0, 2019-01-07 20:51:15 */ public class KoubeiMarketingMallShoppromoinfoQueryResponse extends AlipayResponse { private static final long serialVersionUID = 3246426675613355777L; /** * 店铺营销信息详情 */ @ApiListField("shop_promo_infos") @ApiField("shop_promo_info") private List<ShopPromoInfo> shopPromoInfos; public void setShopPromoInfos(List<ShopPromoInfo> shopPromoInfos) { this.shopPromoInfos = shopPromoInfos; } public List<ShopPromoInfo> getShopPromoInfos( ) { return this.shopPromoInfos; } }
f88ddc23723ba2d1874c0d7b986a1c0c005053c8
7dfb1538fd074b79a0f6a62674d4979c7c55fd6d
/src/repl_it/Android.java
49b1a59d436aff50220df1568094ca99c46c69c1
[]
no_license
kutluduman/Java-Programming
424a4ad92e14f2d4cc700c8a9352ff7408aa993f
d55b8a61ab3a654f954e33db1cb244e36bbcc7da
refs/heads/master
2022-04-18T03:54:50.219846
2020-04-18T05:45:45
2020-04-18T05:45:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,353
java
package repl_it; import java.util.Scanner; public class Android { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); double version = scanner.nextDouble(); if (version == 1.5 ) { System.out.println("Cupcake "); } else if (version == 1.6) { System.out.println("Donut "); } else if (version == 2.1) { System.out.println("Eclair "); } else if (version == 2.2) { System.out.println("Froyo "); } else if ( version == 2.3) { System.out.println("Gingerbread "); } else if ( version == 3.1 ) { System.out.println("Honeycomb "); } else if ( version == 4.0 ) { System.out.println("Ice Cream Sandwich "); } else if ( version>=4.1 && version<=4.31) { System.out.println("Jelly Bean "); } else if (version>=4.4 && version<=4.4) { System.out.println("KitKat "); } else if (version>=5.0 && version<=5.1) { System.out.println("Lollipop "); } else if (version>=8.0 && version<=8.1) { System.out.println("Oreo"); } else if (version == 9.0) { System.out.println("Pie "); } else { System.out.println("Sorry, I don't know this version! "); } } }
e2dbde519915b364b5c9cba04d8ee40729e3d630
702375a246be24f8613cda292ff4423c0457fa94
/LawyerProject/app/src/main/java/com/lawyer/android/adapter/MenuAdapter.java
4969748170229d8e1f94d0470e5cc2b2c926d201
[]
no_license
hczcgq/0825
7e47a805cdddf97763f604cfb46a2e3aedb120e6
329770b0c386764476a4c8f34edd4fb536c87852
refs/heads/master
2016-09-10T14:38:15.541270
2015-09-14T15:49:25
2015-09-14T15:49:25
41,426,600
0
0
null
null
null
null
UTF-8
Java
false
false
1,183
java
package com.lawyer.android.adapter; import android.content.Context; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.lawyer.android.R; import com.lawyer.android.bean.MenuEntity; import java.util.List; /** * Created by hm-soft on 2015/8/26. */ public class MenuAdapter extends BaseAdapterHelpter<MenuEntity>{ private Context context; private List<MenuEntity> datas; public MenuAdapter(Context context, List<MenuEntity> datas) { super(context, datas); this.context=context; this.datas=datas; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolderHelper holder = ViewHolderHelper.get(context, convertView, parent, R.layout.view_menu_item, position); ImageView iconImageView=holder.getView(R.id.iconImageView); TextView nameTextView=holder.getView(R.id.nameTextView); MenuEntity item=datas.get(position); iconImageView.setImageResource(item.getIcon()); nameTextView.setText(item.getName()); return holder.getConvertView(); } }
301656616d26f201a243f93c7f8fbfa690636e02
7596630710b96589a5bc867a67332ebf2f05fda1
/src/WeightedGraph/UnionFind.java
ecba8fa4211d7e47788eb54e5784fc5864ca4164
[]
no_license
frankwuyue/Algorithm
41dd093c126a796000f1cd781832e1cb031a40f8
926005058802de8b82b927b66eace21c7ec62ac8
refs/heads/master
2022-06-07T13:12:10.700024
2020-05-05T06:14:13
2020-05-05T06:14:13
261,376,113
0
0
null
null
null
null
UTF-8
Java
false
false
1,248
java
package WeightedGraph; public class UnionFind { private int[] parent; private int count; private int[] rank; // rank[i] stands for rank/depth of union rooted by i UnionFind(int n) { this.count = n; parent = new int[n]; rank = new int[n]; for (int i = 0; i < n; i++) { parent[i] = i; rank[i] = 1; } } public int find(int n) { if (n >= count) { throw new IllegalArgumentException("Over Capacity!"); } // while (parent[n] != n) { // parent[n] = parent[parent[n]]; // n = parent[n]; // } // return n; if (parent[n] != n) { parent[n] = find(parent[n]); } return parent[n]; } public boolean isConnected(int p, int q) { return find(p) == find(q); } public void union(int p, int q) { int pId = find(p); int qId = find(q); if (pId == qId) { return; } if (rank[pId] < rank[qId]) { parent[pId] = qId; } else if (rank[qId] < rank[pId]) { parent[qId] = pId; } else { parent[pId] = qId; rank[qId] += 1; } } }
f444311dcff8b8669747e7c2072de0d07123527a
4e1e5e2518e2d9e43fe35b245cd9680b8a88ec32
/src/java/com/yitong/app/action/judicial/dxzpzfdj/ZfdjAction.java
9b25c9aaa951a27e85e826501e39f96904243ff9
[]
no_license
MoonLuckSir/MoonRepository
df0592f2f43bb04bcfa4cdbd0f02582f2743604c
12ad3b4dcbcbc639d90e11366dbd81ab8ba2c172
refs/heads/master
2021-01-12T15:41:00.492001
2016-10-25T01:56:00
2016-10-25T01:56:00
71,849,484
0
0
null
null
null
null
UTF-8
Java
false
false
64,829
java
package com.yitong.app.action.judicial.dxzpzfdj; import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.net.URLEncoder; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFCellStyle; import org.apache.poi.hssf.usermodel.HSSFClientAnchor; import org.apache.poi.hssf.usermodel.HSSFFont; import org.apache.poi.hssf.usermodel.HSSFPatriarch; import org.apache.poi.hssf.usermodel.HSSFRichTextString; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFSimpleShape; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.util.CellRangeAddress; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import cfca.safeguard.Result; import cfca.safeguard.api.bank.ClientEnvironment; import cfca.safeguard.api.bank.Constants; import cfca.safeguard.api.bank.SGBusiness; import cfca.safeguard.api.bank.bean.tx.upstream.Tx100401; import cfca.safeguard.api.bank.bean.tx.upstream.Tx100403; import cfca.safeguard.api.bank.bean.tx.upstream.Tx100404; import cfca.safeguard.api.bank.bean.tx.upstream.Tx100405; import cfca.safeguard.api.bank.util.ResultUtil; import cfca.safeguard.tx.Attachment; import cfca.safeguard.tx.Transaction; import cfca.safeguard.tx.business.bank.TxCaseReport_Transaction; import cfca.safeguard.tx.business.bank.TxExceptionalEvent_Account; import cfca.safeguard.tx.business.bank.TxExceptionalEvent_Accounts; import cfca.safeguard.tx.business.bank.TxExceptionalEvent_Transaction; import cfca.safeguard.tx.business.bank.TxInvolvedAccount_Account; import cfca.safeguard.tx.business.bank.TxUnusualOpencard_Accounts; import com.oreilly.servlet.ServletUtils; import com.yitong.app.service.judicial.dxzpzfdj.ZfdjService; import com.yitong.commons.action.BaseAction; import com.yitong.commons.model.IListPage; import com.yitong.commons.util.ParamUtil; import com.yitong.commons.util.StringUtil; public class ZfdjAction extends BaseAction { protected static final Logger logger = Logger.getLogger(ZfdjAction.class); private ZfdjService zfdjService; public ZfdjService getZfdjService() { return zfdjService; } public void setZfdjService(ZfdjService zfdjService) { this.zfdjService = zfdjService; } /** * 司法查询:止付查询 * * @param mapping * @param form * @param request * @param response * @return * @throws UnsupportedEncodingException */ @SuppressWarnings("unchecked") public ActionForward toZfTaskList(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { Map params = new HashMap(); ParamUtil.putStr2Map(request, "APPLICATIONID", params); ParamUtil.putStr2Map(request, "STATUS", params); ParamUtil.putStr2Map(request, "ksr", params); ParamUtil.putStr2Map(request, "jsr", params); int pageNo = ParamUtil.getInt(request, "pageNo", 1); IListPage page = zfdjService.pageQueryZfTask(params, pageNo); request.setAttribute("page", page); return mapping.findForward("list"); } @SuppressWarnings("unchecked") public ActionForward toView(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { String APPLICATIONID = ParamUtil.get(request, "APPLICATIONID"); Map params = new HashMap(); ParamUtil.putStr2Map(request, "APPLICATIONID", params); Map entry = zfdjService.load(APPLICATIONID); request.setAttribute("rst", entry); return mapping.findForward("view"); } /** * 司法查询:止付反馈查询 * * @param mapping * @param form * @param request * @param response * @return * @throws UnsupportedEncodingException */ @SuppressWarnings("unchecked") public ActionForward toZffkTaskList(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { Map params = new HashMap(); ParamUtil.putStr2Map(request, "APPLICATIONID", params); int pageNo = ParamUtil.getInt(request, "pageNo", 1); IListPage page = zfdjService.pageQueryZffkTask(params, pageNo); request.setAttribute("page", page); return mapping.findForward("zffklist"); } @SuppressWarnings("unchecked") public ActionForward toZffkView(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { String APPLICATIONID = ParamUtil.get(request, "APPLICATIONID"); Map params = new HashMap(); ParamUtil.putStr2Map(request, "APPLICATIONID", params); Map entry = zfdjService.zffkload(APPLICATIONID); request.setAttribute("rst", entry); return mapping.findForward("zffkview"); } /** * 司法查询:止付解除查询 * * @param mapping * @param form * @param request * @param response * @return * @throws UnsupportedEncodingException */ @SuppressWarnings("unchecked") public ActionForward toJcTaskList(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { Map params = new HashMap(); ParamUtil.putStr2Map(request, "APPLICATIONID", params); ParamUtil.putStr2Map(request, "STATUS", params); ParamUtil.putStr2Map(request, "ksr", params); ParamUtil.putStr2Map(request, "jsr", params); int pageNo = ParamUtil.getInt(request, "pageNo", 1); IListPage page = zfdjService.pageQueryJcTask(params, pageNo); request.setAttribute("page", page); return mapping.findForward("jclist"); } @SuppressWarnings("unchecked") public ActionForward toJcView(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { String APPLICATIONID = ParamUtil.get(request, "APPLICATIONID"); Map params = new HashMap(); ParamUtil.putStr2Map(request, "APPLICATIONID", params); Map entry = zfdjService.jcload(APPLICATIONID); request.setAttribute("rst", entry); return mapping.findForward("jcview"); } /** * 司法查询:止付解除反馈查询 * * @param mapping * @param form * @param request * @param response * @return * @throws UnsupportedEncodingException */ @SuppressWarnings("unchecked") public ActionForward toJcfkTaskList(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { Map params = new HashMap(); ParamUtil.putStr2Map(request, "APPLICATIONID", params); int pageNo = ParamUtil.getInt(request, "pageNo", 1); IListPage page = zfdjService.pageQueryJcfkTask(params, pageNo); request.setAttribute("page", page); return mapping.findForward("jcfklist"); } @SuppressWarnings("unchecked") public ActionForward toJcfkView(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { String APPLICATIONID = ParamUtil.get(request, "APPLICATIONID"); Map params = new HashMap(); ParamUtil.putStr2Map(request, "APPLICATIONID", params); Map entry = zfdjService.jcfkload(APPLICATIONID); request.setAttribute("rst", entry); return mapping.findForward("jcfkview"); } /** * 司法查询:止付延期查询 * * @param mapping * @param form * @param request * @param response * @return * @throws UnsupportedEncodingException */ @SuppressWarnings("unchecked") public ActionForward toYqTaskList(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { Map params = new HashMap(); ParamUtil.putStr2Map(request, "APPLICATIONID", params); ParamUtil.putStr2Map(request, "STATUS", params); ParamUtil.putStr2Map(request, "ksr", params); ParamUtil.putStr2Map(request, "jsr", params); int pageNo = ParamUtil.getInt(request, "pageNo", 1); IListPage page = zfdjService.pageQueryYqTask(params, pageNo); request.setAttribute("page", page); return mapping.findForward("yqlist"); } @SuppressWarnings("unchecked") public ActionForward toYqView(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { String APPLICATIONID = ParamUtil.get(request, "APPLICATIONID"); Map params = new HashMap(); ParamUtil.putStr2Map(request, "APPLICATIONID", params); Map entry = zfdjService.yqload(APPLICATIONID); request.setAttribute("rst", entry); return mapping.findForward("yqview"); } /** * 司法查询:止付延期反馈查询 * * @param mapping * @param form * @param request * @param response * @return * @throws UnsupportedEncodingException */ @SuppressWarnings("unchecked") public ActionForward toYqfkTaskList(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { Map params = new HashMap(); ParamUtil.putStr2Map(request, "APPLICATIONID", params); int pageNo = ParamUtil.getInt(request, "pageNo", 1); IListPage page = zfdjService.pageQueryYqfkTask(params, pageNo); request.setAttribute("page", page); return mapping.findForward("yqfklist"); } @SuppressWarnings("unchecked") public ActionForward toYqfkView(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { String APPLICATIONID = ParamUtil.get(request, "APPLICATIONID"); Map params = new HashMap(); ParamUtil.putStr2Map(request, "APPLICATIONID", params); Map entry = zfdjService.yqfkload(APPLICATIONID); request.setAttribute("rst", entry); return mapping.findForward("yqfkview"); } /** * 司法查询:冻结查询 * * @param mapping * @param form * @param request * @param response * @return * @throws UnsupportedEncodingException */ @SuppressWarnings("unchecked") public ActionForward toDjTaskList(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { Map params = new HashMap(); ParamUtil.putStr2Map(request, "APPLICATIONID", params); ParamUtil.putStr2Map(request, "ACCOUNTNUMBER", params); ParamUtil.putStr2Map(request, "STATUS", params); ParamUtil.putStr2Map(request, "ksr", params); ParamUtil.putStr2Map(request, "jsr", params); int pageNo = ParamUtil.getInt(request, "pageNo", 1); IListPage page = zfdjService.pageQueryDjTask(params, pageNo); request.setAttribute("page", page); return mapping.findForward("djlist"); } @SuppressWarnings("unchecked") public ActionForward toDjView(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { String APPLICATIONID = ParamUtil.get(request, "APPLICATIONID"); Map params = new HashMap(); ParamUtil.putStr2Map(request, "APPLICATIONID", params); Map entry = zfdjService.djload(APPLICATIONID); request.setAttribute("rst", entry); return mapping.findForward("djview"); } /** * 司法查询:冻结反馈查询 * * @param mapping * @param form * @param request * @param response * @return * @throws UnsupportedEncodingException */ @SuppressWarnings("unchecked") public ActionForward toDjfkTaskList(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { Map params = new HashMap(); ParamUtil.putStr2Map(request, "APPLICATIONID", params); int pageNo = ParamUtil.getInt(request, "pageNo", 1); IListPage page = zfdjService.pageQueryDjfkTask(params, pageNo); request.setAttribute("page", page); return mapping.findForward("djfklist"); } @SuppressWarnings("unchecked") public ActionForward toDjfkView(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { String APPLICATIONID = ParamUtil.get(request, "APPLICATIONID"); Map params = new HashMap(); ParamUtil.putStr2Map(request, "APPLICATIONID", params); Map entry = zfdjService.djfkload(APPLICATIONID); request.setAttribute("rst", entry); return mapping.findForward("djfkview"); } /** * 司法查询:冻结解除查询 * * @param mapping * @param form * @param request * @param response * @return * @throws UnsupportedEncodingException */ @SuppressWarnings("unchecked") public ActionForward toDjjcTaskList(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { Map params = new HashMap(); ParamUtil.putStr2Map(request, "APPLICATIONID", params); ParamUtil.putStr2Map(request, "ORIGINALAPPLICATIONID", params); ParamUtil.putStr2Map(request, "ACCOUNTNUMBER", params); ParamUtil.putStr2Map(request, "STATUS", params); ParamUtil.putStr2Map(request, "ksr", params); ParamUtil.putStr2Map(request, "jsr", params); int pageNo = ParamUtil.getInt(request, "pageNo", 1); IListPage page = zfdjService.pageQueryDjjcTask(params, pageNo); request.setAttribute("page", page); return mapping.findForward("djjclist"); } @SuppressWarnings("unchecked") public ActionForward toDjjcView(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { String APPLICATIONID = ParamUtil.get(request, "APPLICATIONID"); Map params = new HashMap(); ParamUtil.putStr2Map(request, "APPLICATIONID", params); Map entry = zfdjService.djjcload(APPLICATIONID); request.setAttribute("rst", entry); return mapping.findForward("djjcview"); } /** * 司法查询:冻结解除反馈查询 * * @param mapping * @param form * @param request * @param response * @return * @throws UnsupportedEncodingException */ @SuppressWarnings("unchecked") public ActionForward toDjjcfkTaskList(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { Map params = new HashMap(); ParamUtil.putStr2Map(request, "APPLICATIONID", params); int pageNo = ParamUtil.getInt(request, "pageNo", 1); IListPage page = zfdjService.pageQueryDjjcfkTask(params, pageNo); request.setAttribute("page", page); return mapping.findForward("djjcfklist"); } @SuppressWarnings("unchecked") public ActionForward toDjjcfkView(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { String APPLICATIONID = ParamUtil.get(request, "APPLICATIONID"); Map params = new HashMap(); ParamUtil.putStr2Map(request, "APPLICATIONID", params); Map entry = zfdjService.djjcfkload(APPLICATIONID); request.setAttribute("rst", entry); return mapping.findForward("djjcfkview"); } /** * 司法查询:冻结延期查询 * * @param mapping * @param form * @param request * @param response * @return * @throws UnsupportedEncodingException */ @SuppressWarnings("unchecked") public ActionForward toDjyqTaskList(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { Map params = new HashMap(); ParamUtil.putStr2Map(request, "APPLICATIONID", params); ParamUtil.putStr2Map(request, "ORIGINALAPPLICATIONID", params); ParamUtil.putStr2Map(request, "ACCOUNTNUMBER", params); ParamUtil.putStr2Map(request, "STATUS", params); ParamUtil.putStr2Map(request, "ksr", params); ParamUtil.putStr2Map(request, "jsr", params); int pageNo = ParamUtil.getInt(request, "pageNo", 1); IListPage page = zfdjService.pageQueryDjyqTask(params, pageNo); request.setAttribute("page", page); return mapping.findForward("djyqlist"); } @SuppressWarnings("unchecked") public ActionForward toDjyqView(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { String APPLICATIONID = ParamUtil.get(request, "APPLICATIONID"); Map params = new HashMap(); ParamUtil.putStr2Map(request, "APPLICATIONID", params); Map entry = zfdjService.djyqload(APPLICATIONID); request.setAttribute("rst", entry); return mapping.findForward("djyqview"); } /** * 司法查询:冻结延期反馈查询 * * @param mapping * @param form * @param request * @param response * @return * @throws UnsupportedEncodingException */ @SuppressWarnings("unchecked") public ActionForward toDjyqfkTaskList(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { Map params = new HashMap(); ParamUtil.putStr2Map(request, "APPLICATIONID", params); int pageNo = ParamUtil.getInt(request, "pageNo", 1); IListPage page = zfdjService.pageQueryDjyqfkTask(params, pageNo); request.setAttribute("page", page); return mapping.findForward("djyqfklist"); } @SuppressWarnings("unchecked") public ActionForward toDjyqfkView(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { String APPLICATIONID = ParamUtil.get(request, "APPLICATIONID"); Map params = new HashMap(); ParamUtil.putStr2Map(request, "APPLICATIONID", params); Map entry = zfdjService.djyqfkload(APPLICATIONID); request.setAttribute("rst", entry); return mapping.findForward("djyqfkview"); } /** * 司法查询:司法查控业务统计表 * * @param mapping * @param form * @param request * @param response * @return * @throws UnsupportedEncodingException */ public ActionForward toYwtjOperation(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { return mapping.findForward("ywtjview"); } /** * 司法查询:生成业务统计表 * * @param mapping * @param form * @param request * @param response * @return * @throws ParseException * @throws UnsupportedEncodingException */ public ActionForward makeYwtjExcel(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ParseException { response.setContentType("application/x-msdownload"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd 00:00:00"); Map params = new HashMap(); String startDay = request.getParameter("ksr"); String endDay = request.getParameter("jsr"); params.put("ksr", startDay+" 00:00:00"); params.put("jsr", endDay+" 23:59:59"); Map<String, String> map = zfdjService.dxzpSfckAddUp(params); //开始生成Excel统计表 int totalColNum = 4; //这里是poi操作excel的基本导入命令 思路 创建工作簿 工作簿创建工作表 工作表创建行 行创建单元格 HSSFWorkbook wk = new HSSFWorkbook(); HSSFSheet sheet = wk.createSheet("业务统计表"); //设置四个列宽 sheet.setColumnWidth(0, 6000) ; sheet.setColumnWidth(1, 6000) ; sheet.setColumnWidth(2, 6000) ; sheet.setColumnWidth(3, 6000) ; //标题单元格样式 HSSFCellStyle titleCellStyle = wk.createCellStyle() ; HSSFFont titleCellfont = wk.createFont(); titleCellStyle.setAlignment(CellStyle.ALIGN_CENTER);//水平居中 titleCellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);//垂直居中 titleCellfont.setFontHeightInPoints((short) 14);// 设置字体大小 titleCellfont.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);//加粗 //第二行单元格样式 HSSFCellStyle secCellStyle = wk.createCellStyle(); secCellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER); //斜线单元格样式 HSSFCellStyle patriarchCellStyle = wk.createCellStyle() ; HSSFFont patriarchCellfont = wk.createFont(); patriarchCellfont.setFontHeightInPoints((short) 9);// 设置字体大小 patriarchCellStyle.setAlignment(CellStyle.ALIGN_CENTER);//水平居中 patriarchCellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);//垂直居中 patriarchCellStyle.setFont(patriarchCellfont); //其他单元格样式 HSSFCellStyle otherCellStyle = wk.createCellStyle() ; otherCellStyle.setWrapText(true); //设置自动换行 otherCellStyle.setAlignment(CellStyle.ALIGN_CENTER);//水平居中 otherCellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);//垂直居中 //设置标题 HSSFRow titleRow = sheet.createRow(0); HSSFCell titleCell = titleRow.createCell(0); titleCell.setCellValue("业务统计表"); titleCell.setCellStyle(titleCellStyle); titleRow.setHeight((short) 1000); sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 3)); //设置第二行 HSSFRow secRow = sheet.createRow(1); secRow.setHeight((short)400); HSSFCell unitCell = secRow.createCell(0); HSSFCell dateCell = secRow.createCell(3); unitCell.setCellValue("填报单位:(公章)"); unitCell.setCellStyle(secCellStyle); dateCell.setCellValue("日期:"); dateCell.setCellStyle(secCellStyle); //设置表头行 HSSFRow tableHeaderRow = sheet.createRow(2); tableHeaderRow.setHeight((short) 700) ; //将表头所有列设置成数组 HSSFCell[] tableHeaderCell = new HSSFCell[totalColNum]; //将第一行所有列名写入到一个string数组里 String[] colNames = new String[totalColNum]; colNames[0] = ""; colNames[1] = "业务笔数\r(单位:笔)"; colNames[2] = "账户数量\r(单位:笔)"; colNames[3] = "金额\r(单位:元)"; //循环遍历第二行所有列 for(int i=0;i<totalColNum;i++){ //挨个创建表头单元格 tableHeaderCell[i] = tableHeaderRow.createCell(i); if(i == 0){ tableHeaderCell[0].setCellValue("业务种类 处理结果") ; tableHeaderCell[0].setCellStyle(patriarchCellStyle) ; }else{ //设置第一行单元格的值 也就是表头的名称 这里的new HSSFRichTextString(colNames[i]) 是把值都转换为文本类型 tableHeaderCell[i].setCellValue(new HSSFRichTextString(colNames[i])); tableHeaderCell[i].setCellStyle(otherCellStyle) ; } } //画线(由左上到右下的斜线) HSSFPatriarch patriarch = sheet.createDrawingPatriarch(); HSSFClientAnchor a = new HSSFClientAnchor(0, 0, 1023, 255, (short)0, 2, (short)0, 2); HSSFSimpleShape shape1 = patriarch.createSimpleShape(a); shape1.setShapeType(HSSFSimpleShape.OBJECT_TYPE_LINE); shape1.setLineStyle(HSSFSimpleShape.LINESTYLE_SOLID) ; HSSFClientAnchor b = new HSSFClientAnchor(0, 0, 1023, 255, (short)3, 5, (short)3, 5); HSSFSimpleShape shape2 = patriarch.createSimpleShape(b); shape2.setShapeType(HSSFSimpleShape.OBJECT_TYPE_LINE); shape2.setLineStyle(HSSFSimpleShape.LINESTYLE_SOLID) ; //下面的一段代码是将结果集里的值插入到excel中去 for(int k=3;k<7;k++){//设置行 //循环创建行 从第二行开始 HSSFRow row = sheet.createRow(k); row.setHeight((short) 700) ; for(int i=0;i<totalColNum;i++){//设置列 //创建每个单元格 HSSFCell cell = row.createCell(i); cell.setCellStyle(otherCellStyle); //为单元格赋值 同样的使用new HSSFRichTextString()是为了将值都转化为文本格式处理 //rs.getString(i+1)结果集是从1开始遍历值的 if(k == 3 && i == 0){//第二行第一列 cell.setCellValue(new HSSFRichTextString("紧急止付")); } if(k == 3 && i == 1){//第二行第二列 紧急止付业务笔数 cell.setCellValue(new HSSFRichTextString( map.get("zfBizNum"))); } if(k == 3 && i == 2){//第二行第三列 紧急止付账户数量 cell.setCellValue(new HSSFRichTextString(map.get("zfAcctNum"))); } if(k == 3 && i == 3){//第二行第四列 紧急止付金额 cell.setCellValue(new HSSFRichTextString(map.get("zfAcctBalance"))); } if(k == 4 && i == 0){//第三行第一列 cell.setCellValue(new HSSFRichTextString("快速冻结")); } if(k == 4 && i == 1){//第三行第二列 快速冻结业务笔数 cell.setCellValue(new HSSFRichTextString( map.get("djBizNum"))); } if(k == 4 && i == 2){//第三行第三列 快速冻结账户数量 cell.setCellValue(new HSSFRichTextString( map.get("djAcctNum"))); } if(k == 4 && i == 3){//第三行第四列 快速冻结金额 cell.setCellValue(new HSSFRichTextString( map.get("djAcctBalance"))); } if(k == 5 && i == 0){//第四行第一列 快速查询 cell.setCellValue(new HSSFRichTextString("快速查询")); } if(k == 5 && i == 1){//第四行第二列 快速查询业务笔数 cell.setCellValue(new HSSFRichTextString( map.get("qryBizNum"))); } if(k == 5 && i == 2){//第四行第三列 快速查询账户数量 cell.setCellValue(new HSSFRichTextString( map.get("qryAcctNum"))); } if(k == 5 && i == 3){//第四行第四列 快速查询金额 无效 cell.setCellValue(new HSSFRichTextString("")); cell.setCellStyle(patriarchCellStyle); } if(k == 6 && i == 0){//第五行第一列 cell.setCellValue(new HSSFRichTextString("合计")); } if(k == 6 && i == 1){//第五行第二列 合计业务笔数 cell.setCellValue(new HSSFRichTextString( map.get("totalBizNum"))); } if(k == 6 && i == 2){//第五行第三列 合计账户数量 cell.setCellValue(new HSSFRichTextString(map.get("totalAcctNum"))); } if(k == 6 && i == 3){//第五行第四列 合计金额 cell.setCellValue(new HSSFRichTextString(map.get("totalAcctBalance"))); } } } System.out.println("模板生成成功"); String filename = "sfckywtjbb_"+startDay+"_"+endDay+".xls"; OutputStream os= null; try { response.setHeader("Content-Disposition","attachment;"+"filename="+new String(filename.getBytes(), "ISO-8859-1")); os=response.getOutputStream(); wk.write(os); os.flush(); } catch (Exception e) { e.getStackTrace(); }finally{ if(os != null){ try { os.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } return null; } /** * 司法查询:跳转到出错信息 * * @param mapping * @param form * @param request * @param response * @return * @throws UnsupportedEncodingException */ public ActionForward toErrorInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException { System.out.println(ParamUtil.get(request, "errorInfo")); String errorInfo = URLDecoder.decode(ParamUtil.get(request, "errorInfo"), "utf-8") ; request.setAttribute("errorInfo", errorInfo); return mapping.findForward("errorInfo"); } /** * 法律文书下载 * @param mapping * @param form * @param request * @param response * @return */ public ActionForward downLoadFile(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { String savePath = request.getParameter("savePath"); File file = new File(savePath); if(!file.exists()){ request.setAttribute("msg", "无法下载,"+savePath+"路径下文件未找到!"); return mapping.findForward(FAILURE); } String[] filenames = savePath.split("/"); System.out.println(filenames[filenames.length-1]); try { response.reset(); response.setContentType("application/octet-stream"); response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(filenames[filenames.length-1], "UTF-8")); ServletOutputStream out = null; out = response.getOutputStream(); ServletUtils.returnFile(savePath, out);// 下载文件 out.close(); } catch (UnsupportedEncodingException ex) {// iso8559_1编码异常 ex.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { } return null; } /** * 异常开卡可疑名单上报页面 * @param mapping * @param form * @param request * @param response * @return */ @SuppressWarnings("unchecked") public ActionForward toSendCard(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { return mapping.findForward("toSendCard"); } /** * 异常开卡可疑名单上报方法 * @param mapping * @param form * @param request * @param response * @return */ @SuppressWarnings("unchecked") public ActionForward sendCard(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { Tx100403 tx100403 = new Tx100403(); String featureCode = request.getParameter("featureCode");//事件特征码 String IDType = request.getParameter("IDType");//证件类型 String IDNumber = request.getParameter("IDNumber");//证件号 String IDName = request.getParameter("IDName");//姓名 String cardNumber = request.getParameter("cardNumber");//卡/折号 String accountOpenTime = request.getParameter("accountOpenTime");//开卡时间 String accountOpenPlace = request.getParameter("accountOpenPlace");//开卡地点 String operatorName = request.getParameter("operatorName");//经办人姓名 String operatorPhoneNumber = request.getParameter("operatorPhoneNumber");//经办人电话 String transSerialNumber = StringUtil.getTransSerialNumber();//传输报文流水号 //String newTransSerialNumber = StringUtil.getTransSerialNumber();//传输报文流水号 String applicationId = StringUtil.getApplicationID();//业务申请编号 Map params = new HashMap(); params.put("TRANSSERIALNUMBER", transSerialNumber); params.put("JSJG", "111111000000");//接收机构ID params.put("FROMTGORGANIZATIONID", "402361018886");//托管机构编码 params.put("TXCODE", "100403");//交易编码 params.put("APPLICATIONID", applicationId);//业务申请编号 params.put("FEATURECODE", featureCode);//事件特征码 params.put("BANKID", "402361018886");//上报结构 params.put("IDTYPE", IDType);//证件类型 params.put("IDNUMBER", IDNumber);//证件号 params.put("IDNAME", IDName);//姓名 params.put("CARDNUMBER", cardNumber);//卡/折号 params.put("ACCOUNTOPENTIME", accountOpenTime);//开卡时间 params.put("ACCOUNTOPENPLACE", accountOpenPlace);//开卡地点 params.put("OPERATORNAME", operatorName);//经办人姓名 params.put("OPERATORPHONENUMBER", operatorPhoneNumber);//经办人电话 params.put("STATUS", "0"); //params.put("ERRORINFO", ""); tx100403.setTxCode("100403");//交易编码 tx100403.setMessageFrom("111111000000");//接收机构ID,默认值为 111111000000 tx100403.setTransSerialNumber(transSerialNumber);//传输报文流水号 tx100403.setApplicationID(applicationId);//业务申请编号 tx100403.setFeatureCode(featureCode);//事件特征码 tx100403.setIdType(IDType);//证件类型 tx100403.setIdNumber(IDNumber);//证件号 tx100403.setIdName(IDName);//姓名 tx100403.setOperatorName(operatorName);//经办人姓名 tx100403.setOperatorPhoneNumber(operatorPhoneNumber);//经办人电话 List<TxUnusualOpencard_Accounts> list = new ArrayList<TxUnusualOpencard_Accounts>(); TxUnusualOpencard_Accounts txUnusualOpencard_Accounts = new TxUnusualOpencard_Accounts(); txUnusualOpencard_Accounts.setCardNumber(cardNumber); txUnusualOpencard_Accounts.setAccountOpenTime(accountOpenTime); txUnusualOpencard_Accounts.setAccountOpenPlace(accountOpenPlace); list.add(txUnusualOpencard_Accounts); tx100403.setAccountsList(list); String requestXML= ""; //String requestXML = sgBusiness.tx100403(tx100403,fromTGOrganizationId); try { ClientEnvironment.initTxClientEnvironment("../cfca"); SGBusiness sgBusiness = new SGBusiness(); requestXML = sgBusiness.tx100403(tx100403, tx100403.getMessageFrom()); String responseXML = sgBusiness.sendPackagedRequestXML(requestXML); Result result = ResultUtil.chageXMLToResult(responseXML); System.out.println(result.getCode()); if (Constants.SUCCESS_CODE_VALUE.equals(result.getCode())) {//成功 //params.put("NEWTRANSSERIALNUMBER", newTransSerialNumber); //params.put("CODE", "100000");//返回码 params.put("ERRORINFO", "100000" + "");//返回消息 }else{//失败 //params.put("NEWTRANSSERIALNUMBER", newTransSerialNumber); //params.put("CODE", "111111");//返回码失败 params.put("ERRORINFO", "111111" + result.getDescription());//返回消息 } } catch (Exception e) { e.printStackTrace(); } zfdjService.insertYckk(params); request.setAttribute("msg", "发送成功!"); return mapping.findForward(SUCCESS); } /** * 涉案账户可疑名单上报页面 * @param mapping * @param form * @param request * @param response * @return */ @SuppressWarnings("unchecked") public ActionForward toSendAccount(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { return mapping.findForward("toSendAccount"); } /** * 涉案账户可疑名单上报方法 * @param mapping * @param form * @param request * @param response * @return */ @SuppressWarnings("unchecked") public ActionForward sendAccount(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { Tx100404 tx100404 = new Tx100404(); String FEATURECODE = request.getParameter("FEATURECODE");//事件特征码 String CARDNUMBER = request.getParameter("CARDNUMBER");//卡/折号 String ACCOUNTNAME = request.getParameter("ACCOUNTNAME");//账户名 String IDTYPE = request.getParameter("IDTYPE");//证件类型 String IDNUMBER = request.getParameter("IDNUMBER");//证件号 String PHONENUMBER = request.getParameter("PHONENUMBER");//联系电话 String ADDRESS = request.getParameter("ADDRESS");//通讯地址 String POSTCODE = request.getParameter("POSTCODE");//邮政编码 String ACCOUNTOPENPLACE = request.getParameter("ACCOUNTOPENPLACE");//开卡地点 String ACCOUNTNUMBER = request.getParameter("ACCOUNTNUMBER");//定位账户账号 String ACCOUNTSERIAL = request.getParameter("ACCOUNTSERIAL");//一般(子)账户序号 String ACCOUNTTYPE = request.getParameter("ACCOUNTTYPE");//一般(子)账户类别 String ACCOUNTSTATUS = request.getParameter("ACCOUNTSTATUS");//账户状态 String CURRENCY = request.getParameter("CURRENCY");//币种 String CASHREMIT = request.getParameter("CASHREMIT");//钞汇标志 String TRANSACTIONSERIAL = request.getParameter("TRANSACTIONSERIAL");//交易流水号 String TRANSACTIONTIME = request.getParameter("TRANSACTIONTIME");//交易时间 String TRANSACTIONTYPE = request.getParameter("TRANSACTIONTYPE");//交易类型 String BORROWINGSIGNS = request.getParameter("BORROWINGSIGNS");//借贷标志 String TRANSACTIONAMOUNT = request.getParameter("TRANSACTIONAMOUNT");//交易金额 String ACCOUNTBALANCE = request.getParameter("ACCOUNTBALANCE");//交易余额 String OPPONENTNAME = request.getParameter("OPPONENTNAME");//交易对方名称 String OPPONENTACCOUNTNUMBER = request.getParameter("OPPONENTACCOUNTNUMBER");//交易对方账卡号 String OPPONENTCREDENTIALNUMBER = request.getParameter("OPPONENTCREDENTIALNUMBER");//交易对方证件号码 String OPPONENTDEPOSITBANKID = request.getParameter("OPPONENTDEPOSITBANKID");//交易对方账号开户行 String TRANSACTIONREMARK = request.getParameter("TRANSACTIONREMARK");//交易摘要 String TRANSACTIONBRANCHNAME = request.getParameter("TRANSACTIONBRANCHNAME");//交易网点名称 String TRANSACTIONBRANCHCODE = request.getParameter("TRANSACTIONBRANCHCODE");//交易网点代码 String LOGNUMBER = request.getParameter("LOGNUMBER");//日志号 String SUMMONSNUMBER = request.getParameter("SUMMONSNUMBER");//传票号 String VOUCHERTYPE = request.getParameter("VOUCHERTYPE");//凭证种类 String VOUCHERCODE = request.getParameter("VOUCHERCODE");//凭证号 String CASHMARK = request.getParameter("CASHMARK");//现金标志 String TERMINALNUMBER = request.getParameter("TERMINALNUMBER");//终端号 String TRANSACTIONSTATUS = request.getParameter("TRANSACTIONSTATUS");//交易是否成功 String TRANSACTIONADDRESS = request.getParameter("TRANSACTIONADDRESS");//交易发生地 String MERCHANTNAME = request.getParameter("MERCHANTNAME");//商户名称 String MERCHANTCODE = request.getParameter("MERCHANTCODE");//商户号 String IPADDRESS = request.getParameter("IPADDRESS");//IP地址 String MAC = request.getParameter("MAC");//MAC地址 String TELLERCODE = request.getParameter("TELLERCODE");//交易柜员号 String REPORTORGNAME = request.getParameter("REPORTORGNAME");//上报机构名称 String OPERATORNAME = request.getParameter("OPERATORNAME");//经办人姓名 String OPERATORPHONENUMBER = request.getParameter("OPERATORPHONENUMBER");//经办人电话 String REMARK = request.getParameter("REMARK");//备注 String transSerialNumber = StringUtil.getTransSerialNumber();//传输报文流水号 //String newTransSerialNumber = StringUtil.getTransSerialNumber();//传输报文流水号 String applicationId = StringUtil.getApplicationID();//业务申请编号 tx100404.setTransSerialNumber(transSerialNumber); tx100404.setTxCode("100404"); tx100404.setMessageFrom("111111000000"); tx100404.setApplicationID(applicationId); tx100404.setFeatureCode(FEATURECODE); tx100404.setBankID("402361018886"); tx100404.setCardNumber(CARDNUMBER); tx100404.setAccountName(ACCOUNTNAME); tx100404.setIdType(IDTYPE); tx100404.setIdNumber(IDNUMBER); tx100404.setPhoneNumber(PHONENUMBER); tx100404.setAddress(ADDRESS); tx100404.setPostCode(POSTCODE); tx100404.setAccountOpenPlace(ACCOUNTOPENPLACE); List<TxInvolvedAccount_Account> accountList = new ArrayList<TxInvolvedAccount_Account>(); TxInvolvedAccount_Account txInvolvedAccount_Account = new TxInvolvedAccount_Account(); txInvolvedAccount_Account.setAccountNumber(ACCOUNTNAME); txInvolvedAccount_Account.setAccountType(ACCOUNTTYPE); txInvolvedAccount_Account.setAccountStatus(ACCOUNTSTATUS); txInvolvedAccount_Account.setCurrency(CURRENCY); txInvolvedAccount_Account.setCashRemit(CASHREMIT); List<Transaction> transactionList = new ArrayList<Transaction>(); Transaction transaction = new Transaction(); transaction.setTransactionType(TRANSACTIONTYPE); transaction.setBorrowingSigns(BORROWINGSIGNS); transaction.setCurrency(CURRENCY); transaction.setTransactionAmount(TRANSACTIONAMOUNT); transaction.setAccountBalance(ACCOUNTBALANCE); transaction.setTransactionTime(TRANSACTIONTIME); transaction.setTransactionSerial(TRANSACTIONSERIAL); transaction.setOpponentName(OPPONENTNAME); transaction.setOpponentAccountNumber(OPPONENTACCOUNTNUMBER); transaction.setOpponentCredentialNumber(OPPONENTCREDENTIALNUMBER); transaction.setOpponentDepositBankID(OPPONENTDEPOSITBANKID); transaction.setTransactionRemark(TRANSACTIONREMARK); transaction.setTransactionBranchName(TRANSACTIONBRANCHNAME); transaction.setTransactionBranchCode(TRANSACTIONBRANCHCODE); transaction.setLogNumber(LOGNUMBER); transaction.setSummonsNumber(SUMMONSNUMBER); transaction.setVoucherType(VOUCHERTYPE); transaction.setVoucherCode(VOUCHERCODE); transaction.setCashMark(CASHMARK); transaction.setTerminalNumber(TERMINALNUMBER); transaction.setTransactionStatus(TRANSACTIONSTATUS); transaction.setTransactionAddress(TRANSACTIONADDRESS); transaction.setMerchantName(MERCHANTNAME); transaction.setMerchantCode(MERCHANTCODE); transaction.setIpAddress(IPADDRESS); transaction.setMac(MAC); transaction.setTellerCode(TELLERCODE); transaction.setRemark(REMARK); transactionList.add(transaction); txInvolvedAccount_Account.setTransactionList(transactionList); accountList.add(txInvolvedAccount_Account); tx100404.setAccountList(accountList); tx100404.setReportOrgName(REPORTORGNAME); tx100404.setOperatorName(OPERATORNAME); tx100404.setOperatorPhoneNumber(OPERATORPHONENUMBER); Map params = new HashMap(); params.put("TRANSSERIALNUMBER", transSerialNumber); params.put("JSJG", "111111000000"); params.put("FROMTGORGANIZATIONID", ""); params.put("TXCODE", "100404"); params.put("APPLICATIONID", applicationId); params.put("FEATURECODE", FEATURECODE); params.put("BANKID", "402361018886"); params.put("CARDNUMBER", CARDNUMBER); params.put("ACCOUNTNAME", ACCOUNTNAME); params.put("IDTYPE", IDTYPE); params.put("IDNUMBER", IDNUMBER); params.put("PHONENUMBER", PHONENUMBER); params.put("ADDRESS", ADDRESS); params.put("POSTCODE", POSTCODE); params.put("ACCOUNTOPENPLACE", ACCOUNTOPENPLACE); params.put("ACCOUNTNUMBER", ACCOUNTNUMBER); params.put("ACCOUNTSERIAL", ACCOUNTSERIAL); params.put("ACCOUNTTYPE", ACCOUNTTYPE); params.put("ACCOUNTSTATUS", ACCOUNTSTATUS); params.put("CURRENCY", CURRENCY); params.put("CASHREMIT", CASHREMIT); params.put("TRANSACTIONTYPE", TRANSACTIONTYPE); params.put("BORROWINGSIGNS", BORROWINGSIGNS); params.put("TRANSACTIONAMOUNT", TRANSACTIONAMOUNT); params.put("ACCOUNTBALANCE", ACCOUNTBALANCE); params.put("TRANSACTIONTIME", TRANSACTIONTIME); params.put("TRANSACTIONSERIAL", TRANSACTIONSERIAL); params.put("OPPONENTNAME", OPPONENTNAME); params.put("OPPONENTACCOUNTNUMBER", OPPONENTACCOUNTNUMBER); params.put("OPPONENTCREDENTIALNUMBER", OPPONENTCREDENTIALNUMBER); params.put("OPPONENTDEPOSITBANKID", OPPONENTDEPOSITBANKID); params.put("TRANSACTIONREMARK", TRANSACTIONREMARK); params.put("TRANSACTIONBRANCHNAME", TRANSACTIONBRANCHNAME); params.put("TRANSACTIONBRANCHCODE", TRANSACTIONBRANCHCODE); params.put("LOGNUMBER", LOGNUMBER); params.put("SUMMONSNUMBER", SUMMONSNUMBER); params.put("VOUCHERTYPE", VOUCHERTYPE); params.put("VOUCHERCODE", VOUCHERCODE); params.put("CASHMARK", CASHMARK); params.put("TERMINALNUMBER", TERMINALNUMBER); params.put("TRANSACTIONSTATUS", TRANSACTIONSTATUS); params.put("TRANSACTIONADDRESS", TRANSACTIONADDRESS); params.put("MERCHANTNAME", MERCHANTNAME); params.put("MERCHANTCODE", MERCHANTCODE); params.put("IPADDRESS", IPADDRESS); params.put("MAC", MAC); params.put("TELLERCODE", TELLERCODE); params.put("REMARK", REMARK); params.put("REPORTORGNAME", REPORTORGNAME); params.put("REMARK", REMARK); params.put("REPORTORGNAME", "安徽省农村信用联合社"); params.put("OPERATORNAME", OPERATORNAME); params.put("OPERATORPHONENUMBER", OPERATORPHONENUMBER); params.put("STATUS", ""); String requestXML= ""; //String requestXML = sgBusiness.tx100404(tx100404,fromTGOrganizationId); try { ClientEnvironment.initTxClientEnvironment("../cfca"); SGBusiness sgBusiness = new SGBusiness(); requestXML = sgBusiness.tx100404(tx100404, tx100404.getMessageFrom()); String responseXML = sgBusiness.sendPackagedRequestXML(requestXML); Result result = ResultUtil.chageXMLToResult(responseXML); if (Constants.SUCCESS_CODE_VALUE.equals(result.getCode())) {//成功 //params.put("NEWTRANSSERIALNUMBER", newTransSerialNumber); //params.put("CODE", "100000");//返回码 params.put("ERRORINFO", "");//返回消息 }else{//失败 //params.put("NEWTRANSSERIALNUMBER", newTransSerialNumber); //params.put("CODE", "111111");//返回码失败 params.put("ERRORINFO", result.getDescription());//返回消息 } } catch (Exception e) { e.printStackTrace(); } zfdjService.insertSazh(params); request.setAttribute("msg", "发送成功!"); return mapping.findForward(SUCCESS); } /** * 异常事件可疑名单上报页面 * @param mapping * @param form * @param request * @param response * @return */ @SuppressWarnings("unchecked") public ActionForward toSendEvent(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { return mapping.findForward("toSendEvent"); } /** * 异常事件可疑名单上报方法 * @param mapping * @param form * @param request * @param response * @return */ @SuppressWarnings("unchecked") public ActionForward sendEvent(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { Tx100405 tx100405 = new Tx100405(); String ACCOUNTNAME = request.getParameter("ACCOUNTNAME");//主账户名称 String CARDNUMBER = request.getParameter("CARDNUMBER");//主账户 String ACCOUNTNUMBER = request.getParameter("ACCOUNTNUMBER");//定位账户账号 String ACCOUNTSERIAL = request.getParameter("ACCOUNTSERIAL");//一般(子)账户序号 String ACCOUNTTYPE = request.getParameter("ACCOUNTTYPE");//一般(子)账户类别 String ACCOUNTSTATUS = request.getParameter("ACCOUNTSTATUS");//账户状态 String CURRENCY = request.getParameter("CURRENCY");//币种 String CASHREMIT = request.getParameter("CASHREMIT");//钞汇标志 String FEATURECODE = request.getParameter("FEATURECODE");//事件特征码 String TRANSACTIONTYPE = request.getParameter("TRANSACTIONTYPE");//交易类型 String BORROWINGSIGNS = request.getParameter("BORROWINGSIGNS");//借贷标志 String TRANSACTIONAMOUNT = request.getParameter("TRANSACTIONAMOUNT");//交易金额 String ACCOUNTBALANCE = request.getParameter("ACCOUNTBALANCE");//交易余额 String TRANSACTIONTIME = request.getParameter("TRANSACTIONTIME");//交易时间 String TRANSACTIONSERIAL = request.getParameter("TRANSACTIONSERIAL");//交易流水号 String OPPONENTNAME = request.getParameter("OPPONENTNAME");//交易对方名称 String OPPONENTACCOUNTNUMBER = request.getParameter("OPPONENTACCOUNTNUMBER");//交易对方账卡号 String OPPONENTCREDENTIALNUMBER = request.getParameter("OPPONENTCREDENTIALNUMBER");//交易对方证件号码 String OPPONENTDEPOSITBANKID = request.getParameter("OPPONENTDEPOSITBANKID");//交易对方账号开户行 String TRANSACTIONREMARK = request.getParameter("TRANSACTIONREMARK");//交易摘要 String TRANSACTIONBRANCHNAME = request.getParameter("TRANSACTIONBRANCHNAME");//交易网点名称 String TRANSACTIONBRANCHCODE = request.getParameter("TRANSACTIONBRANCHCODE");//交易网点代码 String LOGNUMBER = request.getParameter("LOGNUMBER");//日志号 String SUMMONSNUMBER = request.getParameter("SUMMONSNUMBER");//传票号 String VOUCHERTYPE = request.getParameter("VOUCHERTYPE");//凭证种类 String VOUCHERCODE = request.getParameter("VOUCHERCODE");//凭证号 String CASHMARK = request.getParameter("CASHMARK");//现金标志 String TERMINALNUMBER = request.getParameter("TERMINALNUMBER");//终端号 String TRANSACTIONSTATUS = request.getParameter("TRANSACTIONSTATUS");//交易是否成功 String TRANSACTIONADDRESS = request.getParameter("TRANSACTIONADDRESS");//交易发生地 String MERCHANTNAME = request.getParameter("MERCHANTNAME");//商户名称 String MERCHANTCODE = request.getParameter("MERCHANTCODE");//商户号 String IPADDRESS = request.getParameter("IPADDRESS");//IP地址 String MAC = request.getParameter("MAC");//MAC地址 String TELLERCODE = request.getParameter("TELLERCODE");//交易柜员号 String REMARK = request.getParameter("REMARK");//备注 String OPERATORNAME = request.getParameter("OPERATORNAME");//经办人姓名 String OPERATORPHONENUMBER = request.getParameter("OPERATORPHONENUMBER");//经办人电话 String transSerialNumber = StringUtil.getTransSerialNumber();//传输报文流水号 //String newTransSerialNumber = StringUtil.getTransSerialNumber();//传输报文流水号 String applicationId = StringUtil.getApplicationID();//业务申请编号 tx100405.setTransSerialNumber(transSerialNumber); tx100405.setApplicationID(applicationId); tx100405.setBankID("402361018886"); tx100405.setOperatorName(OPERATORNAME); tx100405.setOperatorPhoneNumber(OPERATORPHONENUMBER); List<TxExceptionalEvent_Accounts> accountsList = new ArrayList<TxExceptionalEvent_Accounts>(); TxExceptionalEvent_Accounts txExceptionalEvent_Accounts = new TxExceptionalEvent_Accounts(); txExceptionalEvent_Accounts.setAccountName(ACCOUNTNAME); txExceptionalEvent_Accounts.setCardNumber(CARDNUMBER); txExceptionalEvent_Accounts.setRemark(REMARK); TxExceptionalEvent_Account txExceptionalEvent_Account = new TxExceptionalEvent_Account(); txExceptionalEvent_Account.setAccountNumber(ACCOUNTNUMBER); txExceptionalEvent_Account.setAccountType(ACCOUNTTYPE); txExceptionalEvent_Account.setAccountStatus(ACCOUNTSTATUS); txExceptionalEvent_Account.setCurrency(CURRENCY); txExceptionalEvent_Account.setCashRemit(CASHREMIT); List<TxExceptionalEvent_Transaction> transactionList = new ArrayList<TxExceptionalEvent_Transaction>(); TxExceptionalEvent_Transaction transaction = new TxExceptionalEvent_Transaction(); transaction.setFeatureCode(FEATURECODE); //事件特征码 transaction.setTransactionType(TRANSACTIONTYPE); transaction.setBorrowingSigns(BORROWINGSIGNS); transaction.setCurrency(CURRENCY); transaction.setTransactionAmount(TRANSACTIONAMOUNT); transaction.setAccountBalance(ACCOUNTBALANCE); transaction.setTransactionTime(TRANSACTIONTIME); transaction.setTransactionSerial(TRANSACTIONSERIAL); transaction.setOpponentName(OPPONENTNAME); transaction.setOpponentAccountNumber(OPPONENTACCOUNTNUMBER); transaction.setOpponentCredentialNumber(OPPONENTCREDENTIALNUMBER); transaction.setOpponentDepositBankID(OPPONENTDEPOSITBANKID); transaction.setTransactionRemark(TRANSACTIONREMARK); transaction.setTransactionBranchName(TRANSACTIONBRANCHNAME); transaction.setTransactionBranchCode(TRANSACTIONBRANCHCODE); transaction.setLogNumber(LOGNUMBER); transaction.setSummonsNumber(SUMMONSNUMBER); transaction.setVoucherType(VOUCHERTYPE); transaction.setVoucherCode(VOUCHERCODE); transaction.setCashMark(CASHMARK); transaction.setTerminalNumber(TERMINALNUMBER); transaction.setTransactionStatus(TRANSACTIONSTATUS); transaction.setTransactionAddress(TRANSACTIONADDRESS); transaction.setMerchantName(MERCHANTNAME); transaction.setMerchantCode(MERCHANTCODE); transaction.setIpAddress(IPADDRESS); transaction.setMac(MAC); transaction.setTellerCode(TELLERCODE); transaction.setRemark(REMARK); transactionList.add(transaction); txExceptionalEvent_Account.setTransactionList(transactionList); List<TxExceptionalEvent_Account> txInvolvedAccount_AccountList = new ArrayList<TxExceptionalEvent_Account>(); txInvolvedAccount_AccountList.add(txExceptionalEvent_Account); txExceptionalEvent_Accounts.setAccountList(txInvolvedAccount_AccountList); accountsList.add(txExceptionalEvent_Accounts); tx100405.setAccountsList(accountsList); Map params = new HashMap(); params.put("TRANSSERIALNUMBER", transSerialNumber); params.put("JSJG", "111111000000"); params.put("FROMTGORGANIZATIONID", ""); params.put("TXCODE", "100405"); params.put("APPLICATIONID", applicationId); params.put("BANKID", "402361018886"); params.put("OPERATORNAME", OPERATORNAME); params.put("OPERATORPHONENUMBER", OPERATORPHONENUMBER); params.put("ACCOUNTNAME", ACCOUNTNAME); params.put("CARDNUMBER", CARDNUMBER); params.put("REMARK", REMARK); params.put("ACCOUNTNUMBER", ACCOUNTNUMBER); params.put("ACCOUNTSERIAL", ACCOUNTSERIAL); params.put("ACCOUNTTYPE", ACCOUNTTYPE); params.put("ACCOUNTSTATUS", ACCOUNTSTATUS); params.put("CURRENCY", CURRENCY); params.put("CASHREMIT", CASHREMIT); params.put("FEATURECODE", FEATURECODE); params.put("TRANSACTIONTYPE", TRANSACTIONTYPE); params.put("BORROWINGSIGNS", BORROWINGSIGNS); params.put("TRANSACTIONAMOUNT", TRANSACTIONAMOUNT); params.put("ACCOUNTBALANCE", ACCOUNTBALANCE); params.put("TRANSACTIONTIME", TRANSACTIONTIME); params.put("TRANSACTIONSERIAL", TRANSACTIONSERIAL); params.put("OPPONENTNAME", OPPONENTNAME); params.put("OPPONENTACCOUNTNUMBER", OPPONENTACCOUNTNUMBER); params.put("OPPONENTCREDENTIALNUMBER", OPPONENTCREDENTIALNUMBER); params.put("OPPONENTDEPOSITBANKID", OPPONENTDEPOSITBANKID); params.put("TRANSACTIONREMARK", TRANSACTIONREMARK); params.put("TRANSACTIONBRANCHNAME", TRANSACTIONBRANCHNAME); params.put("TRANSACTIONBRANCHCODE", TRANSACTIONBRANCHCODE); params.put("LOGNUMBER", LOGNUMBER); params.put("SUMMONSNUMBER", SUMMONSNUMBER); params.put("VOUCHERTYPE", VOUCHERTYPE); params.put("VOUCHERCODE", VOUCHERCODE); params.put("CASHMARK", CASHMARK); params.put("TERMINALNUMBER", TERMINALNUMBER); params.put("TRANSACTIONSTATUS", TRANSACTIONSTATUS); params.put("TRANSACTIONADDRESS", TRANSACTIONADDRESS); params.put("MERCHANTNAME", MERCHANTNAME); params.put("MERCHANTCODE", MERCHANTCODE); params.put("IPADDRESS", IPADDRESS); params.put("MAC", MAC); params.put("TELLERCODE", TELLERCODE); params.put("STATUS", "0"); String requestXML= ""; //String requestXML = sgBusiness.tx100405(tx100405, fromTGOrganizationId); try { ClientEnvironment.initTxClientEnvironment("../cfca"); SGBusiness sgBusiness = new SGBusiness(); requestXML = sgBusiness.tx100405(tx100405, tx100405.getMessageFrom()); String responseXML = sgBusiness.sendPackagedRequestXML(requestXML); Result result = ResultUtil.chageXMLToResult(responseXML); if (Constants.SUCCESS_CODE_VALUE.equals(result.getCode())) {//成功 //params.put("NEWTRANSSERIALNUMBER", newTransSerialNumber); //params.put("CODE", "100000");//返回码 params.put("ERRORINFO", "");;//返回消息 }else{//失败 //params.put("NEWTRANSSERIALNUMBER", newTransSerialNumber); //params.put("CODE", "111111");//返回码失败 params.put("ERRORINFO", result.getDescription()); } } catch (Exception e) { e.printStackTrace(); } zfdjService.insertYcsj(params); request.setAttribute("msg", "发送成功!"); return mapping.findForward(SUCCESS); } /** * 案件举报页面 * @param mapping * @param form * @param request * @param response * @return */ @SuppressWarnings("unchecked") public ActionForward toAjjb(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { return mapping.findForward("toAjjb"); } /** * 案件举报上报方法 * @param mapping * @param form * @param request * @param response * @return */ @SuppressWarnings("unchecked") public ActionForward ajjb(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { Tx100401 tx100401 = new Tx100401(); String APPLICATIONTYPE = request.getParameter("APPLICATIONTYPE");//案件举报类型 String ISINITIALNODE = request.getParameter("ISINITIALNODE");//是否主动发送初始节点 String REPORTENDTIME = request.getParameter("REPORTENDTIME");//上报时间 String VICTIMNAME = request.getParameter("VICTIMNAME");//受害人姓名 String VICTIMPHONENUMBER = request.getParameter("VICTIMPHONENUMBER");//受害人联系电话 String VICTIMIDTYPE = request.getParameter("VICTIMIDTYPE");//证件类型 String VICTIMIDNUMBER = request.getParameter("VICTIMIDNUMBER");//证件号 String ACCIDENTDESCRIPTION = request.getParameter("ACCIDENTDESCRIPTION");//事件描述 String REPORTORGNAME = request.getParameter("REPORTORGNAME");//上报机构名称 String OPERATORNAME = request.getParameter("OPERATORNAME");//经办人姓名 String OPERATORPHONENUMBER = request.getParameter("OPERATORPHONENUMBER");//经办人电话 String ID = request.getParameter("ID");//交易流水号 String TYPE = request.getParameter("TYPE");//交易类型 String TIME = request.getParameter("TIME");//交易时间 String CURRENCY = request.getParameter("CURRENCY");//币种 String TRANSFERAMOUNT = request.getParameter("TRANSFERAMOUNT");//交易金额 String TRANSFEROUTBANKID = request.getParameter("TRANSFEROUTBANKID");//转出账户所属银行机构编码 String TRANSFEROUTBANKNAME = request.getParameter("TRANSFEROUTBANKNAME");//转出账户所属银行名称 String TRANSFEROUTACCOUNTNAME = request.getParameter("TRANSFEROUTACCOUNTNAME");//转出账户名 String TRANSFEROUTACCOUNTNUMBER = request.getParameter("TRANSFEROUTACCOUNTNUMBER");//转出卡/折号 String TRANSFERINBANKID = request.getParameter("TRANSFERINBANKID");//转入账户所属银行机构编码 String TRANSFERINBANKNAME = request.getParameter("TRANSFERINBANKNAME");//转入账户账户所属银行名称 String TRANSFERINACCOUNTNAME = request.getParameter("TRANSFERINACCOUNTNAME");//转入账户账户名 String TRANSFERINACCOUNTNUMBER = request.getParameter("TRANSFERINACCOUNTNUMBER");//转入账户卡/折号 String IP = request.getParameter("IP");//IP地址 String MAC = request.getParameter("MAC");//MAC地址 String DEVICEID = request.getParameter("DEVICEID");//设备ID String PLACE = request.getParameter("PLACE");//交易地点 String REMARK = request.getParameter("REMARK");//备注 String ISCEASED = request.getParameter("ISCEASED");//是否已止付 String transSerialNumber = StringUtil.getTransSerialNumber();//传输报文流水号 //String newTransSerialNumber = StringUtil.getTransSerialNumber();//传输报文流水号 String applicationId = StringUtil.getApplicationID();//业务申请编号 tx100401.setTransSerialNumber(transSerialNumber); tx100401.setApplicationID(applicationId); tx100401.setApplicationType(APPLICATIONTYPE); tx100401.setReportEndTime(REPORTENDTIME); tx100401.setVictimName(VICTIMNAME); tx100401.setVictimPhoneNumber(VICTIMPHONENUMBER); tx100401.setVictimIDType(VICTIMIDTYPE); tx100401.setVictimIDNumber(VICTIMIDNUMBER); tx100401.setAccidentDescription(ACCIDENTDESCRIPTION); tx100401.setReportOrgName(REPORTORGNAME); tx100401.setOperatorName(OPERATORNAME); tx100401.setOperatorPhoneNumber(OPERATORPHONENUMBER); List<TxCaseReport_Transaction> list = new ArrayList<TxCaseReport_Transaction>(); TxCaseReport_Transaction txCaseReport_Transaction = new TxCaseReport_Transaction(); txCaseReport_Transaction.setId(ID); txCaseReport_Transaction.setTime(TIME); txCaseReport_Transaction.setType(TYPE); txCaseReport_Transaction.setCurrency(CURRENCY); txCaseReport_Transaction.setTransferAmount(TRANSFERAMOUNT); txCaseReport_Transaction.setTransferOutBankID(TRANSFEROUTBANKID); txCaseReport_Transaction.setTransferOutBankName(TRANSFEROUTBANKNAME); txCaseReport_Transaction.setTransferOutAccountName(TRANSFEROUTACCOUNTNAME); txCaseReport_Transaction.setTransferOutAccountNumber(TRANSFEROUTACCOUNTNUMBER); txCaseReport_Transaction.setTransferInBankID(TRANSFERINBANKID); txCaseReport_Transaction.setTransferInBankName(TRANSFERINBANKNAME); //txCaseReport_Transaction.setTransferInAccountName(TRANSFERINACCOUNTNAME + System.currentTimeMillis()); txCaseReport_Transaction.setTransferInAccountName(TRANSFERINACCOUNTNAME); txCaseReport_Transaction.setTransferInAccountNumber(TRANSFERINACCOUNTNUMBER); txCaseReport_Transaction.setIp(IP); txCaseReport_Transaction.setMac(MAC); txCaseReport_Transaction.setDeviceID(DEVICEID); txCaseReport_Transaction.setPlace(PLACE); txCaseReport_Transaction.setRemark(REMARK); txCaseReport_Transaction.setIsCeased(ISCEASED); list.add(txCaseReport_Transaction); tx100401.setTransactionList(list); List<Attachment> attachmentList = new ArrayList<Attachment>(); // Attachment attachment = new Attachment(); // attachment.setContent(""); // attachment.setFilename("heh.jpg"); // attachmentList.add(attachment); // tx100401.setAttachmentList(attachmentList); Map params = new HashMap(); params.put("TRANSSERIALNUMBER", transSerialNumber); params.put("JSJG", "111111000000");//402361018886 params.put("TXCODE", "100401"); params.put("ISINITIALNODE", ISINITIALNODE); params.put("FROMTGORGANIZATIONID", ""); params.put("APPLICATIONID", applicationId); params.put("APPLICATIONTYPE", APPLICATIONTYPE); params.put("REPORTENDTIME", REPORTENDTIME); params.put("VICTIMNAME", VICTIMNAME); params.put("VICTIMPHONENUMBER", VICTIMPHONENUMBER); params.put("VICTIMIDTYPE", VICTIMIDTYPE); params.put("VICTIMIDNUMBER", VICTIMIDNUMBER); params.put("ACCIDENTDESCRIPTION", ACCIDENTDESCRIPTION); params.put("REPORTORGNAME", REPORTORGNAME); params.put("OPERATORNAME", OPERATORNAME); params.put("OPERATORPHONENUMBER", OPERATORPHONENUMBER); params.put("ID", ID); params.put("TIME", TIME); params.put("TYPE", TYPE); params.put("CURRENCY", CURRENCY); params.put("TRANSFERAMOUNT", TRANSFERAMOUNT); params.put("TRANSFEROUTBANKID", TRANSFEROUTBANKID); params.put("TRANSFEROUTBANKNAME", TRANSFEROUTBANKNAME); params.put("TRANSFEROUTACCOUNTNAME", TRANSFEROUTACCOUNTNAME); params.put("TRANSFEROUTACCOUNTNUMBER", TRANSFEROUTACCOUNTNUMBER); params.put("TRANSFERINBANKID", TRANSFERINBANKID); params.put("TRANSFERINBANKNAME", TRANSFERINBANKNAME); params.put("TRANSFERINACCOUNTNAME", TRANSFERINACCOUNTNAME); params.put("TRANSFERINACCOUNTNUMBER", TRANSFERINACCOUNTNUMBER); params.put("IP", IP); params.put("MAC", MAC); params.put("DEVICEID", DEVICEID); params.put("PLACE", PLACE); params.put("REMARK", REMARK); params.put("ISCEASED", ISCEASED); params.put("STATUS", "0"); String requestXML= ""; //String requestXML = sgBusiness.tx100401(tx100401, fromTGOrganizationId, mode, to); try { ClientEnvironment.initTxClientEnvironment("../cfca"); SGBusiness sgBusiness = new SGBusiness(); requestXML = sgBusiness.tx100401(tx100401, tx100401.getMessageFrom(), "01", tx100401.getMessageFrom()); String responseXML = sgBusiness.sendPackagedRequestXML(requestXML); Result result = ResultUtil.chageXMLToResult(responseXML); if (Constants.SUCCESS_CODE_VALUE.equals(result.getCode())) {//成功 //params.put("CODE", "100000");//返回码 params.put("ERRORINFO", "");;//返回消息 }else{//失败 //params.put("CODE", "111111");//返回码失败 params.put("ERRORINFO", result.getDescription()); } } catch (Exception e) { e.printStackTrace(); } zfdjService.insertAjjb(params); request.setAttribute("msg", "发送成功!"); return mapping.findForward(SUCCESS); } }
8e5e9b1bf249a5c2dd88c1b0bdfd154043e31e0f
c79d32b780dccf68c66a693ccc93969bae805d9c
/PO/lab4/AviaoMedio.java
3cb39dc0c4d707e70eb043fc5a486578ec965f94
[]
no_license
Tiburso/Trabalhos-IST
1ac065bd1328f37ff8d3d90960cae25ddafd5d27
2e473c3bf8a536899304c58b24e45f433962f2a4
refs/heads/master
2021-01-15T00:56:00.603234
2021-01-03T15:51:34
2021-01-03T15:51:34
242,820,217
1
0
null
null
null
null
UTF-8
Java
false
false
178
java
public class AviaoMedio extends Aviao { public AviaoMedio(Motor motor) { super(motor); } public void trocarMotor(Motor motor) { setMotor(motor); setMotor(motor); } }
8e49ba7effa71edb15b9135d0728a57298b9d6b8
0de4853c59899f9f4a4fa4a323ece2a456d6071b
/src/main/java/com/prevsec/couchburp/controller/BurpController.java
65215b1935a10cdd6b11b0e913232518ceb216f5
[]
no_license
BenKettlewell/couchburp
88ed87ea5ba1f2ddc2e36dcbedc51eebdae16cff
7810c113d41567bce7e30b3c9bbc7fd87b5181ac
refs/heads/master
2021-01-18T01:40:35.930601
2016-06-30T21:58:07
2016-06-30T21:58:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
23,155
java
/******************************************************************************* * Author: William Patrick Herrin * Date: 2016 * Email: [email protected], [email protected] *******************************************************************************/ /* Component of CouchDB collaboration plugin for Burp Suite Professional Edition * Author: William Patrick Herrin * Date: Jun 20, 2016 * Email: [email protected], [email protected] */ package com.prevsec.couchburp.controller; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintStream; import java.net.URL; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.Collectors; import javax.persistence.EntityExistsException; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTree; import javax.swing.table.TableModel; import javax.swing.text.BadLocationException; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.MutableTreeNode; import javax.swing.tree.TreeModel; import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; import org.apache.commons.lang3.StringUtils; import org.json.JSONException; import org.json.JSONObject; import org.lightcouch.Changes; import org.lightcouch.ChangesResult.Row; import org.lightcouch.CouchDbClient; import org.lightcouch.Response; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.mashape.unirest.http.HttpMethod; import com.mashape.unirest.http.Unirest; import com.mashape.unirest.http.exceptions.UnirestException; import com.prevsec.couchburp.CouchClient; import com.prevsec.couchburp.UUIDManager; import com.prevsec.couchburp.models.BurpTableModel; import com.prevsec.couchburp.models.HttpRequestResponse; import com.prevsec.couchburp.models.Note; import com.prevsec.couchburp.models.OWASPCategory; import com.prevsec.couchburp.ui.BurpFrame; import com.prevsec.couchburp.ui.HttpPane; import com.prevsec.couchburp.ui.NotePane; import com.prevsec.test.TestFactory; import burp.IBurpExtenderCallbacks; import burp.IContextMenuFactory; import burp.IContextMenuInvocation; import burp.IHttpRequestResponse; import burp.IScanIssue; public class BurpController implements IContextMenuFactory { private BurpFrame frame; private CouchClient client; // This is invisible, so the name is whatever private DefaultMutableTreeNode root = new DefaultMutableTreeNode("CouchDB"); private DefaultTreeModel treeModel = new DefaultTreeModel(root); private JTree tree = new JTree(treeModel); private IBurpExtenderCallbacks callbacks; private boolean isBurp; private Logger log = Logger.getLogger(this.getClass().getName()); private URL url; private String rootmessage; private String connectmessage; private UUIDManager uuidManager; private CouchDbClient cdbclient; private BurpTableModel tableModel = new BurpTableModel(); private Executor exec = Executors.newCachedThreadPool(); private List<HttpRequestResponse> tryLater = new ArrayList<HttpRequestResponse>(); private JPanel infoPanel; public BurpController(IBurpExtenderCallbacks callbacks, boolean isBurp) { this.isBurp = isBurp; if (isBurp) { this.callbacks = callbacks; } callbacks.registerContextMenuFactory(BurpController.this); System.setOut(new PrintStream(callbacks.getStdout())); System.setErr(new PrintStream(callbacks.getStderr())); } public void init() { rootmessage = "Json error. Are you sure this is the root directory of a CouchDB instance at: " + url.toString() + "?"; connectmessage = "Unable to establish HTTP connection with: " + url.toString(); } public boolean testConnection() throws UnirestException, JSONException { try { return Unirest.get(url.toString()).asJson().getBody().getObject().getString("couchdb").equals("Welcome"); } catch (UnirestException e) { log.log(Level.SEVERE, connectmessage); throw new UnirestException(connectmessage); } catch (JSONException e) { log.log(Level.SEVERE, rootmessage); throw new JSONException(rootmessage); } } public void createDB(String name) throws EntityExistsException, UnirestException { actionDB(HttpMethod.PUT, name); } private String parseError(JSONObject response) { return "error: " + response.getString("error") + "\nreason:" + response.getString("reason"); } public void deleteDB(String name) throws EntityExistsException, UnirestException { actionDB(HttpMethod.DELETE, name); } private void actionDB(HttpMethod method, String name) throws EntityExistsException, UnirestException { try { JSONObject response = new JSONObject(); switch (method) { case PUT: response = Unirest.put(url + name).asJson().getBody().getObject(); break; case DELETE: response = Unirest.delete(url + name).asJson().getBody().getObject(); break; } if (!response.optBoolean("ok")) { String error = parseError(response); log.warning(error); throw new EntityExistsException(error); } } catch (UnirestException e) { log.severe(connectmessage); throw new UnirestException(connectmessage); } } public void configClient(String string) { try { this.url = new URL(string); init(); if (!testConnection()) { String error = "Unable to create CouchClient"; log.severe(error); throw new Exception(error); } cdbclient = new CouchDbClient("testinng", true, "http", "127.0.0.1", 5984, null, null); JOptionPane.showMessageDialog(null, "Connection to CouchDB established"); listen(); } catch (Exception e) { JOptionPane.showMessageDialog(null, e.getMessage()); } } // Leaving this here because why not. Not using do to possible loop with // listening on both the jtree and databases for changes. // private void listenup() { // treeModel.addTreeModelListener(new TreeModelListener() { // // @Override // public void treeStructureChanged(TreeModelEvent e) { // // TODO Auto-generated method stub // // } // // @Override // public void treeNodesRemoved(TreeModelEvent e) { // // TODO Auto-generated method stub // // } // // @Override // public void treeNodesInserted(TreeModelEvent e) { // int index = e.getChildIndices()[0]; // DefaultMutableTreeNode node = (DefaultMutableTreeNode) // root.getChildAt(index); // DefaultMutableTreeNode parent = (DefaultMutableTreeNode) // node.getParent(); // Object userObject = node.getUserObject(); // Object parentUserObject = parent.getUserObject(); // if (userObject instanceof HttpRequestResponse) { // HttpRequestResponse requestResponse = (HttpRequestResponse) userObject; // if (parentUserObject instanceof HttpRequestResponse) { // HttpRequestResponse parentRequestResponse = (HttpRequestResponse) // parentUserObject; // requestResponse.setParentUuid(parentRequestResponse.getUUID()); // requestResponse.setCategory(parentRequestResponse.getCategory()); // } else if (parentUserObject instanceof OWASPCategory) { // OWASPCategory category = (OWASPCategory) parentUserObject; // requestResponse.setCategory(category); // } // client.put(requestResponse); // } // } // // @Override // public void treeNodesChanged(TreeModelEvent e) { // // TODO Auto-generated method stub // // } // }); // // } private void listen() { Runnable runnable = new Runnable() { // TODO - WTF it do this for???? @Override public void run() { Changes changes = cdbclient.changes().continuousChanges(); while (changes.hasNext()) { try { System.out.println("found changes"); Row row = changes.next(); List<HttpRequestResponse> httpRequestResponse = getAllHttps(); List<Note> note = getAllNotes(); rebuildTree(httpRequestResponse, note); } catch (Exception e) { } } } }; exec.execute(runnable); } private List<Note> getAllNotes() { return getAllDocs().stream().filter(e -> e.get("type").getAsString().equals("note")).map(e -> new Note(e)) .collect(Collectors.toList()); } protected synchronized void rebuildTree(List<HttpRequestResponse> httpRequestResponse, List<Note> notes) { root.removeAllChildren(); List<HttpRequestResponse> topLevel = httpRequestResponse.stream().filter(e -> e.getParentUuid() == null) .collect(Collectors.toList()); log.info("Toplevel size is: " + topLevel.size()); List<HttpRequestResponse> children = httpRequestResponse.stream().filter(e -> e.getParentUuid() != null) .collect(Collectors.toList()); for (HttpRequestResponse http : topLevel) { try { addAuto(http); } catch (Exception e) { } } for (HttpRequestResponse http : children) { try { addAuto(http); } catch (Exception e) { } } for (Note note : notes) { try { addAuto(note); } catch (Exception e) { } } tree.updateUI(); expandAll(); } private void addAuto(Note note) { searchByUUID(note.getParentUUID()).add(new DefaultMutableTreeNode(note)); } private void expandAll() { for (int i = 0; i < tree.getRowCount(); i++) { tree.expandRow(i); } } private List<HttpRequestResponse> getAllHttps() { return getAllDocs().stream().filter(e -> e.get("type").getAsString().equals("http")) .map(e -> new HttpRequestResponse(e)).collect(Collectors.toList()); // List<HttpRequestResponse> httpList = new // ArrayList<HttpRequestResponse>(); // for (JsonObject json : getAllDocs()) { // System.out.println(json.toString()); // try { // HttpRequestResponse requestResponse = new HttpRequestResponse(json); // httpList.add(requestResponse); // } catch (Exception e) { // System.out.println(e.getMessage()); // } // } // return httpList; } private List<JsonObject> getAllDocs() { return cdbclient.view("_all_docs").includeDocs(true).query(JsonObject.class); } private void addAutoIn(HttpRequestResponse requestResponse) { // Check to see if we have any id's already in the model DefaultMutableTreeNode search = searchByUUID(requestResponse.getUUID()); HttpRequestResponse searchHttp = (HttpRequestResponse) search.getUserObject(); // Enter this if we find an id if (search != null) { // Checks if the incoming http has a parent if the current http has // a parent if (requestResponse.getParentUuid() != null && searchHttp.getParentUuid() != null) { String parentUUID = requestResponse.getParentUuid(); String searchUUID = searchHttp.getParentUuid(); // Lets compare if the parent has changed if (!parentUUID.equals(searchUUID)) { // Search for the new parent value DefaultMutableTreeNode newparent = searchByUUID(parentUUID); // If we don't have the parent. We will have to come back to // this one. if (newparent == null) { tryLater.add(requestResponse); // Otherwise, we'll add the new parent } else { search.setParent(newparent); } } } } if (search == null) { return; } // if (requestResponse) String currentRevision = ((HttpRequestResponse) search.getUserObject()).getRevision(); // searchedHttp.getRevision(); } private JsonObject getJsonObject(String id) { try { BufferedReader reader = new BufferedReader(new InputStreamReader(cdbclient.find(id))); String line; StringBuilder sb = new StringBuilder(); while ((line = reader.readLine()) != null) { sb.append(line); } System.out.println(sb.toString()); return new JsonParser().parse(new InputStreamReader(cdbclient.find(id))).getAsJsonObject(); } catch (Exception e) { return null; } } private JSONObject getById(String id) throws UnirestException { return Unirest.get(url.toString()).asJson().getBody().getObject(); } private void update(DefaultMutableTreeNode search, Object object) { if (object instanceof HttpRequestResponse) { HttpRequestResponse newHttp = (HttpRequestResponse) object; HttpRequestResponse oldhttp = (HttpRequestResponse) search.getUserObject(); int newRev = Integer.parseInt(StringUtils.substringBefore(newHttp.getRevision(), "-")); int oldRev = Integer.parseInt(StringUtils.substringBefore(oldhttp.getRevision(), "-")); if (newRev > oldRev) { search.setUserObject(object); } } } public void addAuto(HttpRequestResponse httpRequestResponse) { if (httpRequestResponse.getParentUuid() == null) { DefaultMutableTreeNode categoryParent = searchByCategoryOrCreate(httpRequestResponse); categoryParent.add(new DefaultMutableTreeNode(httpRequestResponse)); } else { searchByUUID(httpRequestResponse.getParentUuid()).add(new DefaultMutableTreeNode(httpRequestResponse)); } } public void addAutoOut(Object object) { // We store our list of changed nodes here to delete if something // happens to go wrong. List<DefaultMutableTreeNode> changes = new ArrayList<DefaultMutableTreeNode>(); try { if (object == null) { log.warning("Can't add nothing to the tree???"); } DefaultMutableTreeNode parentNode; if (object instanceof HttpRequestResponse) { log.fine("Object detected as: " + HttpRequestResponse.class.getName()); HttpRequestResponse requestResponse = (HttpRequestResponse) object; if (requestResponse.getParentUuid() != null) { log.info( "Object has a parent uuid defined. Searching for uuid: " + requestResponse.getParentUuid()); DefaultMutableTreeNode uuidParentNode = searchByUUID(requestResponse.getParentUuid()); if (uuidParentNode == null) { log.severe("Parent uuid specified but the parent object does not exist."); return; } parentNode = uuidParentNode; } else { DefaultMutableTreeNode categoryParent = searchByCategory((HttpRequestResponse) object); if (categoryParent == null) { log.info("Category does not currently exist. Creating category: " + requestResponse.getCategoryAsString()); categoryParent = addChild(root, requestResponse.getCategory()); log.fine("Category created"); changes.add(categoryParent); } log.info("Category found as: " + ((OWASPCategory) categoryParent.getUserObject()).toString() + ". Adding..."); parentNode = categoryParent; } DefaultMutableTreeNode childNode = addChild(parentNode, requestResponse); changes.add(childNode); // Add Stuff to couch db Response response = cdbclient.post(requestResponse.toJson()); if (response.getError() == null) { requestResponse.setUUID(response.getId()); requestResponse.setRevision(response.getRev()); } else { log.severe("Couch DB error: " + response.getError() + ". Reason: " + response.getReason()); log.severe("Deleting element from tree"); childNode.removeFromParent(); } log.fine("Added child node to parent."); } } catch (Exception e) { log.severe("Exception caught. Rolling back changes."); for (DefaultMutableTreeNode node : changes) { log.severe("Removing: " + node.toString()); node.removeFromParent(); tree.updateUI(); } } } /** Remove all nodes except the root node. */ public void clear() { root.removeAllChildren(); treeModel.reload(); } public DefaultMutableTreeNode searchByUUID(String uuid) { if (uuid == null) { log.warning("Unable to search by a null uuid"); return null; } Enumeration<DefaultMutableTreeNode> searchEnum = root.depthFirstEnumeration(); log.fine("Searching tree by depth first for uuid: " + uuid); while (searchEnum.hasMoreElements()) { DefaultMutableTreeNode currentNode = searchEnum.nextElement(); if (currentNode.getUserObject() instanceof HttpRequestResponse) { log.fine("Found a node that is an instance of HttpRequestResponse"); HttpRequestResponse parentRequestResponse = (HttpRequestResponse) currentNode.getUserObject(); String parentuuid = parentRequestResponse.getUUID(); log.fine("Comparing uuid: " + uuid + " to uuid: " + parentuuid != null ? parentuuid : "null"); if (parentuuid.equals(uuid)) { log.info("Match found for uuid: " + uuid); return currentNode; } } } return null; } /** Remove the currently selected node. */ public void removeCurrentNode() { TreePath currentSelection = tree.getSelectionPath(); if (currentSelection != null) { DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode) (currentSelection.getLastPathComponent()); MutableTreeNode parent = (MutableTreeNode) (currentNode.getParent()); if (parent != null) { treeModel.removeNodeFromParent(currentNode); return; } } } /** Add child to the currently selected node. */ public DefaultMutableTreeNode addToSelected(Object child) { DefaultMutableTreeNode parentNode = null; TreePath parentPath = tree.getSelectionPath(); if (parentPath == null) { parentNode = root; } else { parentNode = (DefaultMutableTreeNode) (parentPath.getLastPathComponent()); } return addChild(parentNode, child); } public DefaultMutableTreeNode addChild(DefaultMutableTreeNode parent, Object child) { DefaultMutableTreeNode childNode = new DefaultMutableTreeNode(child); if (parent == null) { log.warning("No parent specified. Setting parent to root."); parent = root; } // It is key to invoke this on the TreeModel, and NOT // DefaultMutableTreeNode treeModel.insertNodeInto(childNode, parent, parent.getChildCount()); // Make sure the user can see the lovely new node. tree.scrollPathToVisible(new TreePath(childNode.getPath())); return childNode; } private DefaultMutableTreeNode searchByCategoryOrCreate(HttpRequestResponse object) { DefaultMutableTreeNode search; if ((search = searchByCategory(object)) == null) { root.add(search = new DefaultMutableTreeNode(object.getCategory())); } return search; } private DefaultMutableTreeNode searchByCategory(HttpRequestResponse object) { log.fine("Searching for suitable parents for " + object.toString()); Enumeration<DefaultMutableTreeNode> searchenum = root.breadthFirstEnumeration(); while (searchenum.hasMoreElements()) { DefaultMutableTreeNode node = searchenum.nextElement(); log.fine("Testing node with value: " + node.toString()); Object userObject = node.getUserObject(); if (userObject instanceof OWASPCategory) { if (object.getCategory().compareTo((OWASPCategory) userObject) == 0) { log.fine("OWASP category is: " + object.getCategoryAsString() + " with path: " + node.toString()); return node; } } } return null; } public void setFrame(BurpFrame frame) { this.frame = frame; } public TreeModel getTreeModel() { return treeModel; } public void addDomain() { String hostname = JOptionPane.showInputDialog("Enter hostname:"); String description = JOptionPane.showInputDialog("Description:"); try { client.createDB(hostname); } catch (Exception e) { JOptionPane.showMessageDialog(null, e.getMessage()); } // DBDescriptor descriptor = new DBDescriptor(hostname, description, // null); tree.updateUI(); } public JTree getTree() { tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); return tree; } public void removeSelectedNode() { TreePath path = tree.getSelectionPath(); } public TableModel getTableModel() { return tableModel; } public void addToStash(HttpRequestResponse http) { tableModel.addHttp(http); } public void stashToTree(int rowIndex) { if (rowIndex != -1) { cdbclient.post(tableModel.getHttp(rowIndex).toJson()); } } public void updatePreview(DefaultMutableTreeNode node) { Object userobject = node.getUserObject(); if (userobject instanceof HttpRequestResponse) { infoPanel.removeAll(); infoPanel.add(new HttpPane(true, (HttpRequestResponse) userobject, this, callbacks)); } else if (userobject instanceof Note) { infoPanel.removeAll(); try { infoPanel.add(new NotePane(true, (Note) userobject, this)); } catch (BadLocationException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public void multiTest() { HttpRequestResponse requestResponse = TestFactory.createHttpRequestResponse("123"); cdbclient.post(requestResponse.toJson()); cdbclient.post(requestResponse.toJson()); requestResponse = TestFactory.createHttpRequestResponse("1234", "1-12345"); cdbclient.post(requestResponse.toJson()); cdbclient.post(requestResponse.toJson()); } public void setInfo(JPanel infoPanel) { this.infoPanel = infoPanel; } @Override public List<JMenuItem> createMenuItems(IContextMenuInvocation invocation) { List<JMenuItem> menu = new ArrayList<JMenuItem>(); JMenuItem send = new JMenuItem("Send to Stash"); send.addActionListener(e -> menuAction(invocation)); menu.add(send); return menu; } public void menuAction(IContextMenuInvocation invocation) { if (invocation.getInvocationContext() == invocation.CONTEXT_SCANNER_RESULTS) { IScanIssue[] scanIssues = invocation.getSelectedIssues(); for (IScanIssue issue : scanIssues) { for (IHttpRequestResponse http : issue.getHttpMessages()) { HttpRequestResponse requestResponse = new HttpRequestResponse(null, null, new String(http.getRequest()), new String(http.getResponse()), http.getComment(), null, http.getHighlight(), http.getHttpService()); tableModel.addHttp(requestResponse); tableModel.fireTableDataChanged(); } } } else { IHttpRequestResponse[] messages = invocation.getSelectedMessages(); for (IHttpRequestResponse http : messages) { HttpRequestResponse requestResponse = new HttpRequestResponse(null, null, new String(http.getRequest()), new String(http.getResponse()), http.getComment(), null, http.getHighlight(), http.getHttpService()); tableModel.addHttp(requestResponse); tableModel.fireTableDataChanged(); } } } public void updatePreview(int selectedRow) { HttpRequestResponse http = tableModel.getHttp(selectedRow); infoPanel.removeAll(); infoPanel.add(new HttpPane(true, http, this, callbacks)); } public void updateNote(Note note) { if (note.getUuid() == null) { cdbclient.post(note.toJson()); } else { cdbclient.update(note.toJson()); } infoPanel.removeAll(); } public void updateHttp(HttpRequestResponse http) { if (http.getUUID() == null) { cdbclient.post(http.toJson()); } else { cdbclient.update(http.toJson()); } infoPanel.removeAll(); } public void addByCategory(int selectedRow) { HttpRequestResponse http = tableModel.getHttp(selectedRow); if (http.getUUID() == null) { cdbclient.post(http.toJson()); } else { cdbclient.update(http.toJson()); } } public void addToSelected(int selectedRow, Object lastSelectedPathComponent) { HttpRequestResponse parent = (HttpRequestResponse) lastSelectedPathComponent; HttpRequestResponse http = tableModel.getHttp(selectedRow); http.setParentUuid(parent.getUUID()); if (http.getUUID() == null) { cdbclient.post(http.toJson()); } else { cdbclient.update(http.toJson()); } } }
8b4498ca8d3c4fcb54b06f9ed67dd7e36b94f4f7
6b8481e0fa05e6f6201d02de44dbbb4132c1d675
/app/src/main/java/com/roman/tihai/lab_021/TextOneActivity.java
8b7b20619523bc55bed6649de144678ebce4d218
[]
no_license
Rtihai/Lab_02.1Challenge
523298733485549e4a461077be9e8a58c2643f3f
c4b101edf40ae2c75cad4fed95b3a6094c4ca5ad
refs/heads/master
2020-05-16T23:06:23.632703
2019-04-27T18:40:45
2019-04-27T18:40:45
183,355,177
0
0
null
null
null
null
UTF-8
Java
false
false
341
java
package com.roman.tihai.lab_021; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class TextOneActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_text1); } }
bbb0fd3cf3398e7ab6c2e8b3c75761ab8a627a94
5ef16fb742e57d55117de7f30586d67d74d531e4
/NIO and Socket Programming/Spring Boot In Action/spring-boot-demo-21-1/src/main/java/com/roncoo/example/component/RoncooJmsComponent.java
4a62ae532203678d0e60ef874ef67607aec9a390
[]
no_license
frankdevhub/Coding-Laboratory
58f7c146b44b46b04d0cc4b825938c2dc3f8dd6d
651b4976a014368ab87e2cc4642096118e82d96b
refs/heads/master
2022-04-10T19:12:26.880040
2020-03-26T18:57:02
2020-03-26T18:57:02
115,873,337
5
1
null
null
null
null
UTF-8
Java
false
false
700
java
package com.roncoo.example.component; import javax.jms.Queue; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jms.annotation.JmsListener; import org.springframework.jms.core.JmsMessagingTemplate; import org.springframework.stereotype.Component; /** * * @author wujing */ @Component public class RoncooJmsComponent { @Autowired private JmsMessagingTemplate jmsMessagingTemplate; @Autowired private Queue queue; public void send(String msg) { this.jmsMessagingTemplate.convertAndSend(this.queue, msg); } @JmsListener(destination = "roncoo.queue") public void receiveQueue(String text) { System.out.println("接受到:" + text); } }
6f841e0626b47162a664b84b145782dc75b10bea
9e1af24290392bafa4e3b9c9bc12afbff897ced2
/myhadoop2/src/main/java/fulljoin/reduce/JoinMapper2.java
8411c903b5a0b081c7d49142b8906f1579b0f700
[]
no_license
piwang1994/big12
239d6b82d0d2f0744499ea1de91854b9e903f92f
08ff6daf75777d6cb784aa7d36aca85ce088415f
refs/heads/master
2020-03-29T18:15:08.059879
2018-09-25T03:20:49
2018-09-25T03:20:49
150,201,729
1
0
null
null
null
null
UTF-8
Java
false
false
999
java
package fulljoin.reduce; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.lib.input.FileSplit; import java.io.IOException; /** * Created by Administrator on 2018/9/21. */ public class JoinMapper2 extends Mapper<LongWritable,Text ,ComboKey , Text> { protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { String line = value.toString(); String[] arr = line.split(",") ; FileSplit split = (FileSplit) context.getInputSplit(); int type = 0 ; int cid = 0 ; int oid = 0 ; if(split.getPath().getName().contains("cust")){ type = 0 ; cid = Integer.parseInt(arr[0]) ; } else{ type = 1 ; cid = Integer.parseInt(arr[arr.length - 1]); oid = Integer.parseInt(arr[0]); } ComboKey keyOut = new ComboKey(); keyOut.setType(type); keyOut.setCid(cid); keyOut.setOid(oid); context.write(keyOut, value); } }