blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3f7789da8d835d6a561ede1666a1c14959012bdf | 01ef5aafb745ca655f3a21e132854eab941e6153 | /src/main/java/org/apache/tomee/website/contributors/Github.java | 446944492efd9f71e04d1e89aa8253748c9beccc | [] | no_license | apache/tomee-site-generator | a8a9ac7940269354400bb07333ca08aaff6d338f | 0b028aaac820624aa6623fe9b222d78acb9300e1 | refs/heads/main | 2023-08-18T05:48:31.502044 | 2023-06-12T11:25:30 | 2023-06-12T11:25:30 | 96,287,283 | 10 | 48 | null | 2023-03-23T19:33:47 | 2017-07-05T07:00:07 | Java | UTF-8 | Java | false | false | 5,548 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.tomee.website.contributors;
import org.apache.johnzon.jaxrs.JohnzonProvider;
import org.apache.openejb.loader.IO;
import org.tomitribe.swizzle.stream.StreamBuilder;
import javax.json.bind.Jsonb;
import javax.json.bind.JsonbBuilder;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Response;
import java.io.IOException;
import java.io.InputStream;
import java.io.UncheckedIOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class Github {
private static final Logger log = Logger.getLogger(Github.class.getName());
private final Client client = ClientBuilder.newClient().register(new JohnzonProvider<>());
public List<Contributor> getContributors() {
final List<URI> repositoryURIs = getRepositoryURIs();
final List<Contributor> list = repositoryURIs.stream()
.map(this::getContributorsForRepository)
.flatMap(Collection::stream)
.collect(Collectors.toList());
return Contributor.unique(list);
}
/**
* List all the repositories for Apache TomEE
*/
public List<URI> getRepositoryURIs() {
try {
final WebTarget github = client.target("https://github.com");
final String content = github.path("/apache").queryParam("q", "tomee").request().get(String.class);
final List<String> links = new ArrayList<String>();
StreamBuilder.create(IO.read(content))
.watch("href=\"/apache/tomee", "\"", links::add)
.run();
return links.stream()
.filter(s -> !s.contains("/"))
.filter(s -> !s.equals("-site-pub"))
.filter(s -> !s.equals("-site"))
.distinct()
.map(s -> "https://github.com/apache/tomee" + s)
.map(URI::create)
.collect(Collectors.toList());
} catch (IOException e) {
throw new UncheckedIOException("Unable to list TomEE repositories", e);
}
}
/**
* Get the contributor-data json for the specified repository
*/
private List<Contributor> getContributorsForRepository(final URI repositoryUri) {
final Response response = client.target(repositoryUri.toASCIIString())
.path("graphs/contributors-data")
.request()
.header("referer", repositoryUri.toASCIIString() + "/graphs/contributors")
.header("authority", "github.com")
.header("pragma", "no-cache")
.header("cache-control", "no-cache")
.header("sec-ch-ua", "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"90\", \"Google Chrome\";v=\"90\"")
.header("accept", "application/json")
.header("sec-ch-ua-mobile", "?0")
.header("user-agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36")
.header("sec-fetch-site", "same-origin")
.header("sec-fetch-mode", "cors")
.header("sec-fetch-dest", "empty")
.header("accept-language", "en-US,en;q=0.9,es;q=0.8")
.get();
if (response.getStatus() != 200) {
log.severe("Unexpected status from " + repositoryUri + ": " + response.getStatus());
return Collections.EMPTY_LIST;
}
if (!response.getHeaderString("content-type").startsWith("application/json")) {
log.severe("Unexpected content-type from " + repositoryUri + ": " + response.getHeaderString("content-type"));
return Collections.EMPTY_LIST;
}
final String json;
try {
json = IO.slurp((InputStream) response.getEntity());
} catch (IOException e) {
throw new UncheckedIOException("Unable to read response from " + repositoryUri, e);
}
final ContributorData[] data;
try {
final Jsonb jsonb = JsonbBuilder.create();
data = jsonb.fromJson(json, ContributorData[].class);
} catch (final Exception e) {
throw new IllegalStateException("Unable to unmarshal response from " + repositoryUri + "\n\n" + json, e);
}
return Stream.of(data)
.map(ContributorData::asContributor)
.collect(Collectors.toList());
}
}
| [
"david.blevins@gmail.com"
] | david.blevins@gmail.com |
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;
}
}
| [
"406036741@qq.com"
] | 406036741@qq.com |
91627a5c14bd3b58bef0a66d976bdeeb806bccb7 | a0caa255f3dbe524437715adaee2094ac8eff9df | /HOLD/sources/defpackage/oc.java | ad86b0483ccfc7302e7ccabbee8402f3ead0c4d7 | [] | no_license | AndroidTVDeveloper/com.google.android.tvlauncher | 16526208b5b48fd48931b09ed702fe606fe7d694 | 0f959c41bbb5a93e981145f371afdec2b3e207bc | refs/heads/master | 2021-01-26T07:47:23.091351 | 2020-02-26T20:58:19 | 2020-02-26T20:58:19 | 243,363,961 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 539 | java | package defpackage;
import android.util.Property;
/* renamed from: oc reason: default package */
/* compiled from: PG */
public final class oc extends Property {
public oc(Class cls, String str) {
super(cls, str);
}
public final /* bridge */ /* synthetic */ Object get(Object obj) {
blk blk = (blk) obj;
throw null;
}
public final /* bridge */ /* synthetic */ void set(Object obj, Object obj2) {
blk blk = (blk) obj;
((Float) obj2).floatValue();
throw null;
}
}
| [
"eliminater74@gmail.com"
] | eliminater74@gmail.com |
7e973663ffb4bcfa6e5e3313f9d525e53738f294 | 4b3dc08d18bf01ba476a639c1a32eb5c862b9330 | /NewCMS_Hibernate_Annotations/src/com/deloitte/cms/dao/impl/CustomerDAOImpl.java | 655267db8784aeacc420ba18c6287821629a9a63 | [] | no_license | chiraggarg96/deloittetrng | 10e6e1cc444ebd626e37385487f1ade9c09b4b07 | 976949c5a9b20eac8b7acb2315a1b112bb6b96fb | refs/heads/master | 2022-12-20T12:07:08.195535 | 2019-08-09T10:09:39 | 2019-08-09T10:09:39 | 196,966,372 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,066 | java | package com.deloitte.cms.dao.impl;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Configuration;
import com.deloitte.cms.dao.CustomerDAO;
import com.deloitte.cms.model.Customer;
public class CustomerDAOImpl implements CustomerDAO {
AnnotationConfiguration configuration = new AnnotationConfiguration().configure();
SessionFactory factory = configuration.buildSessionFactory();
Session session = factory.openSession();
Transaction transaction = session.beginTransaction();
@Override
public List<Customer> getAllCustomer() {
// Connection connection =DbUtility.getMyConnection();
//List<Customer> customerList = new ArrayList<>();
session=factory.openSession();
Query query=session.createQuery("from com.deloitte.cms.model.Customer ");
return query.list();
/*Iterator<Customer> iterator=query.iterate();
while(iterator.hasNext())
{
Customer customer=iterator.next();
customerList.add(customer);
}
return customerList;*/
}
@Override
public boolean insertCustomer(Customer customer) {
Session session = factory.openSession();
Transaction transaction = session.beginTransaction();
session.save(customer);
transaction.commit();
session.close();
/* factory.close(); */
return true;
}
@Override
public boolean updateCustomer(Customer customer) {
Session session = factory.openSession();
Transaction transaction = session.beginTransaction();
session.update(customer);
transaction.commit();
return true;
}
@Override
public boolean deleteCustomer(int customerID) {
Session session2 = factory.openSession();
Transaction transaction = session2.beginTransaction();
Customer customer = new Customer();
customer.setCustomerId(customerID);
session.delete(customer);
transaction.commit();
/*
* session.close(); factory.close();
*/
return true;
}
@Override
public Customer searchCustomerById(int customerID) {
Session session = factory.openSession();
Transaction transaction = session.beginTransaction();
Customer customer = new Customer();
customer = (Customer) session.get(Customer.class, customerID);
transaction.commit();
session.close();
/* factory.close(); */
return customer;
}
@Override
public boolean isCustomerExists(int customerId) {
Session session = factory.openSession();
Transaction transaction = session.beginTransaction();
Customer customer = new Customer();
customer = (Customer) session.get(Customer.class, customerId);
transaction.commit();
session.close();
// factory.close();
if (customer == null)
return false;
return true;
}
}
| [
"noreply@github.com"
] | chiraggarg96.noreply@github.com |
906d4675d6a045ffdc1984bbdd7fcd6e276b1c9e | 9e8187c35ef08c67186679f6d472603a8f7b2d6d | /lab4/mujavaHome/result/BackPack/traditional_mutants/int_BackPack_Solution(int,int,int,int)/AORB_4/BackPack.java | c231792230c81ca46e01d324a8d5bfc8614730cf | [] | no_license | cxdzb/software-testing-technology | 8b79f99ec859a896042cdf5bccdadfd11f65b64c | 5fb1305dd2dd028c035667c71e0abf57a489360b | refs/heads/master | 2021-01-09T15:24:42.561680 | 2020-04-16T06:18:58 | 2020-04-16T06:18:58 | 242,354,593 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 851 | java | // This is a mutant program.
// Author : ysma
public class BackPack
{
public int[][] BackPack_Solution( int m, int n, int[] w, int[] p )
{
int[][] c = new int[n - 1][m + 1];
for (int i = 0; i < n + 1; i++) {
c[i][0] = 0;
}
for (int j = 0; j < m + 1; j++) {
c[0][j] = 0;
}
for (int i = 1; i < n + 1; i++) {
for (int j = 1; j < m + 1; j++) {
if (w[i - 1] <= j) {
if (c[i - 1][j] < c[i - 1][j - w[i - 1]] + p[i - 1]) {
c[i][j] = c[i - 1][j - w[i - 1]] + p[i - 1];
} else {
c[i][j] = c[i - 1][j];
}
} else {
c[i][j] = c[i - 1][j];
}
}
}
return c;
}
}
| [
"1005968086@qq.com"
] | 1005968086@qq.com |
4895902d37f1fcb59526e3fad595a7fe1284cf48 | b453ec6498c4145fe3ac2cc59432906f1b32d3a9 | /src/main/java/org/sid/cinema/entities/Projection.java | 8a0c377173e5998ac5be1a69bc3632eebb2fc599 | [] | no_license | Elbadri0/cinema-BackEnd | 4861b19b6973490519bf45043505b01327e6bdeb | 08c0589034a167b0d8b5405a50770a7fdce82ee6 | refs/heads/main | 2023-02-25T19:09:42.491616 | 2021-01-24T15:07:13 | 2021-01-24T15:07:13 | 332,319,417 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,054 | java | package org.sid.cinema.entities;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty.Access;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Entity
@Data @AllArgsConstructor @NoArgsConstructor
public class Projection {
@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
private Long id;
private Date dateProjecion;
private double prix;
@ManyToOne
@JsonProperty(access=Access.WRITE_ONLY)
private Salle salle;
@ManyToOne
private Film film;
@OneToMany(mappedBy="projection")
@JsonProperty(access=Access.WRITE_ONLY)
private Collection<Ticket> tickets;
@ManyToOne
@JsonProperty(access=Access.WRITE_ONLY)
private Seance seance;
}
| [
"noreply@github.com"
] | Elbadri0.noreply@github.com |
f622fc695d2b75d84d58a4d172699c1ce4d376b9 | c75a55acc3d1ec15f2ff5103d53c367c5fe51170 | /src/main/java/com/bnuz/propertyManagementSystem/controller/ComplaintAndSuggestionController.java | 536f4bbad30405c6d6e8ee5422e00e23f5aebd80 | [] | no_license | HarryBlackCatQAQ/propertyManagementSystem | 1045147c9c2a2c3af6dd814c799259638495f95e | 0ff0bb767889b5564b1de14e00ff2295ce10296d | refs/heads/master | 2023-04-18T07:30:49.128178 | 2019-09-20T10:57:14 | 2019-09-20T10:57:14 | 209,702,321 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,258 | java | package com.bnuz.propertyManagementSystem.controller;
import com.bnuz.propertyManagementSystem.model.ComplaintAndSuggestionSheet;
import com.bnuz.propertyManagementSystem.model.Result;
import com.bnuz.propertyManagementSystem.service.ComplaintAndSuggestionSheetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @Author: Harry
* @Date: 2019-09-20 15:16
* @Version 1.0
*/
@RestController
@RequestMapping("/ComplaintAndSuggestion")
public class ComplaintAndSuggestionController {
@PostMapping(value = "/create")
public Result createComplaintAndSuggestionSheet(@RequestBody ComplaintAndSuggestionSheet complaintAndSuggestionSheet){
return new Result();
}
@PostMapping(value = "/query")
public Result queryComplaintAndSuggestionSheet(){
return new Result();
}
@PostMapping(value = "/update")
public Result updateComplaintAndSuggestionSheet(){
return new Result();
}
@PostMapping(value = "/queryRt")
public Result queryComplaintAndSuggestionSheetByRoot(){
return new Result();
}
@PostMapping(value ="/updateFeedBack")
public Result updateFeedBack(){
return new Result();
}
} | [
"641779160@qq.com"
] | 641779160@qq.com |
36f47e0a06549150a530969bddec0be4fd3f947b | a17e5255e2c122457ff4b782188d0bf5067b8b61 | /app/src/main/java/com/example/zhaoxu/lottery/Info/GlobalParams.java | f9e33eddcf9a12bd69d14c8df79ffe31a3a13dce | [] | no_license | zhaoxukl1314/Lottery | f45eb73200347a549f6ce920f3f2bd21881f1989 | 7af298fa0e803e9f8c2839ac58b6a1120a754c76 | refs/heads/master | 2020-04-18T01:02:49.434471 | 2016-11-03T12:15:54 | 2016-11-03T12:15:54 | 66,238,452 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 192 | java | package com.example.zhaoxu.lottery.Info;
/**
* Created by Administrator on 2016/9/19.
*/
public class GlobalParams {
public static String PROXY = "";
public static int PORT = 0;
}
| [
"zhaoxukl1314@163.com"
] | zhaoxukl1314@163.com |
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()));
}
}
| [
"gutomarzagao@gmail.com"
] | gutomarzagao@gmail.com |
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);
}
}
| [
"janbee.shaik05@gmail.com"
] | janbee.shaik05@gmail.com |
0197f62bcfa0b0d4fce39e6ac116d1824cb0b9d7 | 0d6500b9eab0dfc5208d691028ad91247c6d36f7 | /Shortest Job First Scheduler./sjf.java | 773c453725414d559278d8441f03d78a50226fcc | [] | no_license | simpleParadox/Pass-time | 706fb5813e0dedb7c1cf96bbaa95692e18503873 | 46476d86e0b74c148706d248245f9864aa773623 | refs/heads/master | 2021-12-30T02:52:56.346511 | 2021-12-20T07:42:42 | 2021-12-20T07:42:42 | 104,652,615 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,675 | java | import java.util.*;
class Proc{
String name;
int at;
int bt;
}
class sjf{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter the total number of processes: ");
int n = sc.nextInt();
ArrayList<Proc> process = new ArrayList<Proc>();
//Assuming all the processes will arive in non-decreasing order of their arrival time. If not, sort it accordingly.
for(int i = 0; i < n; i++){
System.out.print("\nEnter the process name: ");
String name = sc.next();
System.out.print("\nEnter the process arrival time: ");
int at = sc.nextInt();
System.out.print("\nEnter the process burst time: ");
int bt = sc.nextInt();
Proc temp = new Proc();
temp.name = name;
temp.at = at;
temp.bt = bt;
process.add(temp);
}
// Heap will be implemented using an ArrayList for dynamic arrival of processes.
ArrayList<Proc> p = new ArrayList<Proc>();
p.add(process.remove(0));
int totalExecTime = 0;
while(process.size()>0){
if(p.isEmpty()==false){
Proc temp = p.remove(0);
totalExecTime += temp.bt;
System.out.print(temp.name + " ");
}
else
totalExecTime += 1;
while(process.size()>0 && totalExecTime>=process.get(0).at){
p.add(process.remove(0));
}
// Heapify here.
int n1 = p.size() - 1;
int i = n1;
if(i>=0){
Proc temp1 = new Proc();
temp1 = p.get(n1);
while(i>0 && p.get((i / 2)).bt > temp1.bt){
p.set(i, p.get(i / 2));
i = i / 2;
}
p.set(i, temp1);
}
}
// To print the remaining process.
for(int j = 0; j < p.size(); j++){
System.out.print(p.get(j).name + " ");
}
}
} | [
"noreply@github.com"
] | simpleParadox.noreply@github.com |
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;
}
}
| [
"1281797783@qq.com"
] | 1281797783@qq.com |
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;
}
}
| [
"chphakphoom@gmail.com"
] | chphakphoom@gmail.com |
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;
}
}
| [
"jeenie828@gmail.com"
] | jeenie828@gmail.com |
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();
}
| [
"Andre.Ponnouradjane@non.schneider-electric.com"
] | Andre.Ponnouradjane@non.schneider-electric.com |
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
*/ | [
"datkts0106@gmail.com"
] | datkts0106@gmail.com |
0902b976428f93d6c6a50e33ea6e04f6e736be13 | 851eaed10254bb9964fcae3987519bfaf392ae6a | /src/main/java/net/testaholic_acme_site/web/rest/ThAlertPromptsResource.java | a752a12a065201b928c73355dd79c8145ac4c7cd | [
"MIT"
] | permissive | BulkSecurityGeneratorProject/acme_site | c1d4739fe669cf2615cc88dd1e1e6205e6009667 | 9bcf48168e3dce90283353e0fb75f6be9e080bc2 | refs/heads/master | 2022-12-13T20:24:46.381118 | 2017-01-23T00:57:53 | 2017-01-23T00:57:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,178 | java | package net.testaholic_acme_site.web.rest;
import com.codahale.metrics.annotation.Timed;
import net.testaholic_acme_site.domain.ThAlertPrompts;
import net.testaholic_acme_site.repository.ThAlertPromptsRepository;
import net.testaholic_acme_site.web.rest.util.HeaderUtil;
import net.testaholic_acme_site.web.rest.util.PaginationUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.inject.Inject;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
/**
* REST controller for managing ThAlertPrompts.
*/
@RestController
@RequestMapping("/api")
public class ThAlertPromptsResource {
private final Logger log = LoggerFactory.getLogger(ThAlertPromptsResource.class);
@Inject
private ThAlertPromptsRepository thAlertPromptsRepository;
/**
* POST /th-alert-prompts : Create a new thAlertPrompts.
*
* @param thAlertPrompts the thAlertPrompts to create
* @return the ResponseEntity with status 201 (Created) and with body the new thAlertPrompts, or with status 400 (Bad Request) if the thAlertPrompts has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@RequestMapping(value = "/th-alert-prompts",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<ThAlertPrompts> createThAlertPrompts(@RequestBody ThAlertPrompts thAlertPrompts) throws URISyntaxException {
log.debug("REST request to save ThAlertPrompts : {}", thAlertPrompts);
if (thAlertPrompts.getId() != null) {
return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert("thAlertPrompts", "idexists", "A new thAlertPrompts cannot already have an ID")).body(null);
}
ThAlertPrompts result = thAlertPromptsRepository.save(thAlertPrompts);
return ResponseEntity.created(new URI("/api/th-alert-prompts/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert("thAlertPrompts", result.getId().toString()))
.body(result);
}
/**
* PUT /th-alert-prompts : Updates an existing thAlertPrompts.
*
* @param thAlertPrompts the thAlertPrompts to update
* @return the ResponseEntity with status 200 (OK) and with body the updated thAlertPrompts,
* or with status 400 (Bad Request) if the thAlertPrompts is not valid,
* or with status 500 (Internal Server Error) if the thAlertPrompts couldnt be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@RequestMapping(value = "/th-alert-prompts",
method = RequestMethod.PUT,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<ThAlertPrompts> updateThAlertPrompts(@RequestBody ThAlertPrompts thAlertPrompts) throws URISyntaxException {
log.debug("REST request to update ThAlertPrompts : {}", thAlertPrompts);
if (thAlertPrompts.getId() == null) {
return createThAlertPrompts(thAlertPrompts);
}
ThAlertPrompts result = thAlertPromptsRepository.save(thAlertPrompts);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert("thAlertPrompts", thAlertPrompts.getId().toString()))
.body(result);
}
/**
* GET /th-alert-prompts : get all the thAlertPrompts.
*
* @param pageable the pagination information
* @return the ResponseEntity with status 200 (OK) and the list of thAlertPrompts in body
* @throws URISyntaxException if there is an error to generate the pagination HTTP headers
*/
@RequestMapping(value = "/th-alert-prompts",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<List<ThAlertPrompts>> getAllThAlertPrompts(Pageable pageable)
throws URISyntaxException {
log.debug("REST request to get a page of ThAlertPrompts");
Page<ThAlertPrompts> page = thAlertPromptsRepository.findAll(pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/th-alert-prompts");
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
/**
* GET /th-alert-prompts/:id : get the "id" thAlertPrompts.
*
* @param id the id of the thAlertPrompts to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the thAlertPrompts, or with status 404 (Not Found)
*/
@RequestMapping(value = "/th-alert-prompts/{id}",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<ThAlertPrompts> getThAlertPrompts(@PathVariable Long id) {
log.debug("REST request to get ThAlertPrompts : {}", id);
ThAlertPrompts thAlertPrompts = thAlertPromptsRepository.findOne(id);
return Optional.ofNullable(thAlertPrompts)
.map(result -> new ResponseEntity<>(
result,
HttpStatus.OK))
.orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND));
}
/**
* DELETE /th-alert-prompts/:id : delete the "id" thAlertPrompts.
*
* @param id the id of the thAlertPrompts to delete
* @return the ResponseEntity with status 200 (OK)
*/
@RequestMapping(value = "/th-alert-prompts/{id}",
method = RequestMethod.DELETE,
produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<Void> deleteThAlertPrompts(@PathVariable Long id) {
log.debug("REST request to delete ThAlertPrompts : {}", id);
thAlertPromptsRepository.delete(id);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert("thAlertPrompts", id.toString())).build();
}
}
| [
"williamrussellajb@gmail.com"
] | williamrussellajb@gmail.com |
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);
}
} | [
"ratamovic@gmail.com"
] | ratamovic@gmail.com |
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 |
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);
}
}
| [
"blazeorion@gmail.com"
] | blazeorion@gmail.com |
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);
}
}
}
}
| [
"pojankolli@users.noreply.github.com"
] | pojankolli@users.noreply.github.com |
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();}
} | [
"Abduljaleel@Abduljaleels-MacBook-Pro.local"
] | Abduljaleel@Abduljaleels-MacBook-Pro.local |
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;
}
}
| [
"sholev@users.noreply.github.com"
] | sholev@users.noreply.github.com |
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);
}
}
| [
"mariosergio952@hotmail.com.br"
] | mariosergio952@hotmail.com.br |
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(){}
} | [
"blazej1@interia.eu"
] | blazej1@interia.eu |
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 {
}
| [
"bennett.andr@gmail.com"
] | bennett.andr@gmail.com |
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);
} | [
"mr_ziyoung@sina.cn"
] | mr_ziyoung@sina.cn |
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 {
}
| [
"70356354+jewelny2011@users.noreply.github.com"
] | 70356354+jewelny2011@users.noreply.github.com |
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);
}
| [
"psurbhi@lb.com"
] | psurbhi@lb.com |
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;
}
| [
"fbasios@admin.grnet.gr"
] | fbasios@admin.grnet.gr |
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]);
}
}
| [
"vivek.k.mishra@jpmorgan.com"
] | vivek.k.mishra@jpmorgan.com |
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;
}
} | [
"youngethan4@gmail.com"
] | youngethan4@gmail.com |
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);
}
| [
"s.booth@epcc.ed.ac.uk"
] | s.booth@epcc.ed.ac.uk |
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 + "]";
}
}
| [
"mins941011@gmail.com"
] | mins941011@gmail.com |
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);
} | [
"mikroplu@ut.ee"
] | mikroplu@ut.ee |
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");
}
}
| [
"1609539827@qq.com"
] | 1609539827@qq.com |
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;
}
}
| [
"mehdi.kazemi8@gmail.com"
] | mehdi.kazemi8@gmail.com |
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;
}
}
| [
"jimblackler@google.com"
] | jimblackler@google.com |
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);
}
}
| [
"rbouadjenek@gmail.com"
] | rbouadjenek@gmail.com |
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);
}
}
| [
"1622535@students.wits.ac.za"
] | 1622535@students.wits.ac.za |
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;
}
}
| [
"anaflaviacamelorc@gmail.com"
] | anaflaviacamelorc@gmail.com |
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);
}
}
}
| [
"asif.devand153@gmail.com"
] | asif.devand153@gmail.com |
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);
}
}
| [
"guillempejo@gmail.com"
] | guillempejo@gmail.com |
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();
}
| [
"lens.huygh@gmail.com"
] | lens.huygh@gmail.com |
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;
}
}
| [
"emiliopedrollo@gmail.com"
] | emiliopedrollo@gmail.com |
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();
}
}
}
| [
"fernandomvmoutinho@gmail.com"
] | fernandomvmoutinho@gmail.com |
574299ec005144376f6199dc505c91a3dab23840 | 4ec118b65711f7b893e2a28ff687af62378433be | /SPRING/MVC Legacy/productBarCode/ProductDemo/src/main/java/com/demoProduct/org/ZXingHelper.java | b530f02cca2642da8fe2ec9e4388960428a994a4 | [] | no_license | Runnergo/cursoJava | 05a82c972396b562ae6fcb2a12d2bcff92dd7c88 | 30a15863070fd4336c94a081e88ffcab2684dfec | refs/heads/master | 2022-12-26T19:43:30.465395 | 2019-11-20T18:48:49 | 2019-11-20T18:48:49 | 215,093,033 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,140 | java |
package com.demoProduct.org;
import java.io.ByteArrayOutputStream;
import java.util.Hashtable;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.Writer;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.oned.Code128Writer;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
public class ZXingHelper {
public static byte[] getBarCodeImage(String text, int width, int height) {
try {
Hashtable<EncodeHintType, ErrorCorrectionLevel> hintMap = new Hashtable<EncodeHintType, ErrorCorrectionLevel>();
hintMap.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L);
Writer writer = new Code128Writer();
BitMatrix bitMatrix = writer.encode(text, BarcodeFormat.CODE_128, width, height);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
MatrixToImageWriter.writeToStream(bitMatrix, "png", byteArrayOutputStream);
return byteArrayOutputStream.toByteArray();
} catch (Exception e) {
return null;
}
}
}
| [
"noreply@github.com"
] | Runnergo.noreply@github.com |
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绑定
}
} | [
"cuncinc@foxmail.com"
] | cuncinc@foxmail.com |
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;
} | [
"nhoxbypass@gmail.com"
] | nhoxbypass@gmail.com |
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;
}
| [
"jefferson.farias7@gmail.com"
] | jefferson.farias7@gmail.com |
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;
}
}
| [
"a@awews.com"
] | a@awews.com |
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);
}
} | [
"gergana.peikova@gmail.com"
] | gergana.peikova@gmail.com |
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();
}
}
}
| [
"277627117@qq.com"
] | 277627117@qq.com |
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;
}
}
}
| [
"906982564@qq.com"
] | 906982564@qq.com |
04d29ba3eb24216e44c74ab1ce63b59a65c67ba1 | 465be102f53c08822529e9aafddb23c9944438d5 | /dashboard/server/src/main/java/build/bazel/dashboard/github/team/GithubTeamService.java | c8bc2737375d2b9c81811e7790ad862e9d087372 | [
"Apache-2.0"
] | permissive | davido/continuous-integration | 253fb8b319844aacf820149facb2e238fa752071 | 2b59cdef0c8d4d38450a0cf9f92bc27a0eb75b8b | refs/heads/master | 2023-05-13T00:38:53.512512 | 2023-05-08T13:44:38 | 2023-05-08T13:44:38 | 150,254,963 | 0 | 0 | Apache-2.0 | 2018-09-25T11:31:56 | 2018-09-25T11:31:56 | null | UTF-8 | Java | false | false | 583 | java | package build.bazel.dashboard.github.team;
import io.reactivex.rxjava3.core.Flowable;
import lombok.Builder;
import lombok.RequiredArgsConstructor;
import lombok.Value;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Service
@Slf4j
@RequiredArgsConstructor
public class GithubTeamService {
private final GithubTeamRepo githubTeamRepo;
@Builder
@Value
static class TeamsCacheKey {
String owner;
String repo;
}
public Flowable<GithubTeam> findAll(String owner, String repo) {
return githubTeamRepo.list(owner, repo);
}
}
| [
"noreply@github.com"
] | davido.noreply@github.com |
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();
}
}
| [
"mlara@atsistemas.com"
] | mlara@atsistemas.com |
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);
}
}
| [
"josemaria.arranz@bqreaders.com"
] | josemaria.arranz@bqreaders.com |
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("先等等,待會到");
}
}
}
| [
"tommy770221@gmail.com"
] | tommy770221@gmail.com |
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());
}
}
| [
"zengqinrui@szy.cn"
] | zengqinrui@szy.cn |
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();
}
}
| [
"blackrushx@gmail.com"
] | blackrushx@gmail.com |
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";
}
}
| [
"1466926982@qq.com"
] | 1466926982@qq.com |
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;
}
} | [
"hamdane.khalil.hisseine@gmail.com"
] | hamdane.khalil.hisseine@gmail.com |
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 ask@quickfixengine.org 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);
}
}
| [
"niepoo123@gmail.com"
] | niepoo123@gmail.com |
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
} | [
"mcho@lab.analytics.northwestern.edu"
] | mcho@lab.analytics.northwestern.edu |
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());
}
}
} | [
"lxp@globeteam.com"
] | lxp@globeteam.com |
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);
}
}
| [
"avdey87@gmail.com"
] | avdey87@gmail.com |
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
} | [
"mmll1199@protonmail.com"
] | mmll1199@protonmail.com |
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());
}
}
| [
"antal.micky@yahoo.com"
] | antal.micky@yahoo.com |
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>€82.67</TD></TR>"
+ "<TR><TD>Silver Teapot</TD>"
+ "<TD>€64.55</TD></TR>"
+ "<TR><TD>Gold Pocket Watch</TD>"
+ "<TD>€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( "€", 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 );
}
}
| [
"798422668@qq.com"
] | 798422668@qq.com |
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";
}
} | [
"christian.fusco@mymail.champlain.edu"
] | christian.fusco@mymail.champlain.edu |
0a580114c14d0643cfc4207effa1508cddbc6bf7 | 1ad500e6128773accdf0f86e2f2cc8e6f8f22b56 | /JAVA-Delaware Technical/C1t4/src/C1t4.java | e1802244125afdc3bd7dca7c8e4e6c0999bf4cfb | [] | no_license | SolidDarrama/JAVA | 8315995abf44d69271c3b89b7eb0795f8aebaa35 | d2508c18c553e1c16c36874aa97f707c58aa7299 | refs/heads/master | 2021-08-24T03:41:08.412300 | 2017-12-07T23:01:50 | 2017-12-07T23:01:50 | 104,121,369 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 196 | java | //Jose Guadarrama
//09.19.2013
//Chapter 1 Test 4
public class C1t4
{
public static void main(String[] args)
{
System.out.print("5 + -20 = ");
System.out.print(5 + -20);
}
}
| [
"noreply@github.com"
] | SolidDarrama.noreply@github.com |
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;
}
}
| [
"quentin_sauvage@ens.univ-artois.fr"
] | quentin_sauvage@ens.univ-artois.fr |
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));
}
}
}
| [
"yangdiansheng@foxmail.com"
] | yangdiansheng@foxmail.com |
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));
}
}
| [
"60908560+saruhiremath@users.noreply.github.com"
] | 60908560+saruhiremath@users.noreply.github.com |
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>
* @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}
* }
*
* @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 <double>
* 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 <double>
* The epsilon for round-off error.
* (default 1.0e-12)</pre>
*
* <pre> -L <double>
* The epsilon parameter in epsilon-insensitive loss function.
* (default 1.0e-3)</pre>
*
* <pre> -W <double>
* The random number seed.
* (default 1)</pre>
*
<!-- options-end -->
*
* @author Remco Bouckaert (remco@cs.waikato.ac.nz,rrb@xm.co.nz)
* @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 <double>
* 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 <double>
* The epsilon for round-off error.
* (default 1.0e-12)</pre>
*
* <pre> -L <double>
* The epsilon parameter in epsilon-insensitive loss function.
* (default 1.0e-3)</pre>
*
* <pre> -W <double>
* 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 $");
}
}
| [
"adarsh431593@gmail.com"
] | adarsh431593@gmail.com |
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());
}
}
}
| [
"juanmanuelcalderon812@gmail.com"
] | juanmanuelcalderon812@gmail.com |
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);
}
}
| [
"new9hyun@gmail.com"
] | new9hyun@gmail.com |
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;
}
}
| [
"Tibin.John11@kzoo.edu"
] | Tibin.John11@kzoo.edu |
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();
}
| [
"andyhome.liu@gmail.com"
] | andyhome.liu@gmail.com |
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 |
900ab55ce5c40eaa896b0a0645e1d514faaa8be0 | 7d9103738ba6f115be6594ebd80c5a46976c328b | /src/main/View.java | f0fd9a96300859c687e0519ebaee388433c49b8d | [] | no_license | AndrewCrossman/FishNite-DNERR- | ea5acd755e89825d229df8d53c5f994a85c8b40b | e758c34db7b1c1c933c6966910cef16f3a0ac994 | refs/heads/master | 2021-09-24T14:39:43.880072 | 2021-09-19T23:59:11 | 2021-09-19T23:59:11 | 160,631,250 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,683 | java | package main;
import controller.ControlListener;
import model.InfoCard;
import model.QuizCard;
import model.ScubaSam;
import view.*;
import java.awt.*;
import java.util.Collection;
import java.util.LinkedList;
import javax.swing.*;
public class View {
/////////////////////////////////////////////////////////////////////////////////////
//Attributes
private static final int fps = 30;
private static Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
//private static Dimension screenSize = new Dimension(1920, 1080);
private InfoCard currentCard;
private JFrame frame; // the frame
private int score;
private JPanel content;
private CardLayout layouts;
private Collection<DrawableObject> drawQueue;
private MenuPanel menu;
private InstructionsPanel instructions;
private GamePanel game;
private InfoPanel infoPanel;
private SummaryPanel summary;
private String gameState; //determines the state of the game (e.g. menu, game, summary)
/////////////////////////////////////////////////////////////////////////////////////
//Constructor
/**
* Constructor for View
* @param controlListener
*/
public View(ControlListener controlListener) {
drawQueue = new LinkedList<>();
//set background
// sets up card layout
content = new BackPanel();
layouts = new CardLayout();
content.setLayout(layouts);
menu = new MenuPanel("./images/OtherResources/logo.png/");
instructions = new InstructionsPanel();
game = new GamePanel(drawQueue);
summary = new SummaryPanel();
infoPanel = new InfoPanel();
// this adds different panels that can be viewed
content.add(menu, "menu");
content.add(instructions, "instructions");
content.add(game, "game");
content.add(summary, "summary");
content.add(infoPanel, "popup");
//layouts.show(content, "menu"); // this is how you set which JPanel is shown,
//use this ^ to skip menu to debug game
layouts.first(content); //set menu to first in layout.
this.frame = new JFrame();
frame.addKeyListener(controlListener);
frame.setTitle("FISHNITE: ESTUARY CORRAL");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(screenSize);
frame.add(content);
frame.setVisible(true);
}
///////////////////////////////////////////////////////////////////////////////////////
//Methods
/**
* Getter for fps
* @return
*/
public int getFps() {
return fps;
}
/**
* Getter for screenSize
* @return
*/
public static Dimension getSize() {
return screenSize;
}
/**
* Getter for drawQueue
* @return
*/
public Collection<DrawableObject> getDrawQueue() {
return drawQueue;
}
/**
* Getter for gameState
* @return
*/
public String getGameState(){
return this.gameState;
}
//updates the view
/**
* Updates the view with new information
* @param drawQueue
* @param gameState
* @param infoCard
* @param score
* @param research
* @param timeElapsed
* @param sam
*/
public void update(Collection<DrawableObject> drawQueue, String gameState, InfoCard infoCard, int score, int research, long timeElapsed, ScubaSam sam) {
this.score= score;
currentCard = infoCard;
summary.setPoints(this.score);
game.setPoints(score);
long countingDown = 180000-timeElapsed;
long elapsedSeconds = countingDown / 1000;
long secondsDisplay = elapsedSeconds % 60;
long elapsedMinutes = elapsedSeconds / 60;
if (sam!=null) {
game.setNetpwr((sam.getNet().getMaxWeight()/10)-5);
game.setSpeed(sam.getController().getVelAmount()-5);
if((sam.getNet().getMaxWeight()- sam.getNet().getWeight())/10!=0) {
game.setNetsize("Net Space Left: "+(sam.getNet().getMaxWeight() - sam.getNet().getWeight()) / 10);
}
else{
game.setNetsize("Return to Boat!");
}
}
// clock display
if (secondsDisplay==0){
game.setClock(elapsedMinutes+":00");
}
else if (secondsDisplay<10){
game.setClock(elapsedMinutes+":0"+secondsDisplay);
}
else {
game.setClock(elapsedMinutes + ":" + secondsDisplay);
}
// Pauses game so that holding enter won't cycle from summary -> menu -> instructions -> game
if(this.gameState != gameState) {
setGameState(gameState);
try {
Thread.sleep(400);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
// updates view based on current gameState
switch (this.gameState) {
case "menu":
menu.repaint();
break;
case "instructions":
instructions.repaint();
break;
case "game":
game.repaint();
break;
case "popup":
if (infoCard instanceof QuizCard){
infoPanel.update(currentCard);
} else {
infoPanel.update(currentCard);
}
game.repaint();
infoPanel.repaint();
layouts.show(content, "popup");
break;
case "summary":
summary.repaint();
break;
}
}
/**
* Setter for gameState
* @param gameState
*/
public void setGameState(String gameState) {
this.gameState = gameState;
switch(gameState){
case "menu":
layouts.show(content,"menu");
break;
case "instructions":
layouts.show(content, "instructions");
break;
case "game":
layouts.show(content, "game");
break;
case "summary":
layouts.show(content, "summary");
break;
case "popup":
// moved layouts from here to update to prevent previous fish from showing
break;
}
}
} | [
"noreply@github.com"
] | AndrewCrossman.noreply@github.com |
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;
}
}
}
| [
"ahabweemma@gmail.com"
] | ahabweemma@gmail.com |
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;
}
}
}
| [
"hzmodao@163.com"
] | hzmodao@163.com |
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));
}
}
}
}
| [
"commit+ghdevapi.up@users.noreply.github.com"
] | commit+ghdevapi.up@users.noreply.github.com |
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();
}
}
| [
"rui@deniable.org"
] | rui@deniable.org |
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}";
}
}
| [
"gaochuanming@runix.com"
] | gaochuanming@runix.com |
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;
}
}
| [
"andrew@rover.io"
] | andrew@rover.io |
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 {
}
| [
"karsten.saller@es.tu-darmstadt.de"
] | karsten.saller@es.tu-darmstadt.de |
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);
}
| [
"406701239@qq.com"
] | 406701239@qq.com |
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 |
149b3b86b526a87295f2b5570785ec18ab4d5cd8 | ac2cfb0e101917274974bb614adea3cbc2813aaa | /ProyectoAYDAdminVic/src/mx/uam/ayd/proyecto/negocio/dominio/Venta.java | 41cea6d978e820acf8430d94f7e8754d121aa6af | [] | no_license | ErickESC/AdmInVic | b64b90bd8f49ec5c7b4265ec439b6a13c356426a | 29c480221f7483060b8cfe569b796787e406ff33 | refs/heads/master | 2021-06-30T10:53:41.657968 | 2021-02-24T19:17:38 | 2021-02-24T19:17:38 | 223,452,474 | 0 | 3 | null | 2021-02-24T19:19:08 | 2019-11-22T17:24:39 | Java | UTF-8 | Java | false | false | 1,519 | 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 mx.uam.ayd.proyecto.negocio.dominio;
import java.sql.Date;
import java.util.List;
/**
*
* @author Cruz
*/
public class Venta {
private String idVenta;
private int total;
private String articuloEnVenta;
private java.sql.Date date;
/**
* Constructor
* @param idVenta
* @param total
* @param articuloEnVenta
* @param date
*/
public Venta(String idVenta, int total, String articuloEnVenta, Date date) {
this.idVenta = idVenta;
this.total = total;
this.articuloEnVenta = articuloEnVenta;
this.date = date;
}
//Getter y Setters
public String getIdVenta() {
return idVenta;
}
public void setIdVenta(String idVenta) {
this.idVenta = idVenta;
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public String getArticuloEnVenta() {
return articuloEnVenta;
}
public void setArticuloEnVenta(String articuloEnVenta) {
this.articuloEnVenta = articuloEnVenta;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
}
| [
"noreply@github.com"
] | ErickESC.noreply@github.com |
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();
}
}
| [
"rahul.raj4778@gmail.com"
] | rahul.raj4778@gmail.com |
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.
* © 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);
}
}
| [
"peter.harman@deltatheta.com"
] | peter.harman@deltatheta.com |
021be9e5a87fb88f4826a2e2e43ecaedad90b01a | 44d8aa309f709422f32d4815490a3eec05544489 | /build/src/main/java/com/mypurecloud/sdk/v2/api/request/GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest.java | 594560c7ecc4ada4a74cfbce42077e5729c25d28 | [
"MIT"
] | permissive | MyPureCloud/platform-client-sdk-java | a25146f15a0ef96f5c0c4655af3dc8aa77e48843 | 250d47418a9642fce5c7d6697f87d978ec39a257 | refs/heads/master | 2023-08-17T01:42:17.287918 | 2023-08-15T07:03:28 | 2023-08-15T07:03:28 | 86,601,855 | 7 | 14 | MIT | 2023-02-27T14:26:49 | 2017-03-29T15:56:50 | HTML | UTF-8 | Java | false | false | 17,098 | java | package com.mypurecloud.sdk.v2.api.request;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.mypurecloud.sdk.v2.ApiException;
import com.mypurecloud.sdk.v2.ApiClient;
import com.mypurecloud.sdk.v2.ApiRequest;
import com.mypurecloud.sdk.v2.ApiRequestBuilder;
import com.mypurecloud.sdk.v2.ApiResponse;
import com.mypurecloud.sdk.v2.Configuration;
import com.mypurecloud.sdk.v2.model.*;
import com.mypurecloud.sdk.v2.Pair;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;
import com.mypurecloud.sdk.v2.model.ActivityCodeContainer;
import com.mypurecloud.sdk.v2.model.AddAdherenceExplanationAdminRequest;
import com.mypurecloud.sdk.v2.model.AddAdherenceExplanationAgentRequest;
import com.mypurecloud.sdk.v2.model.AddShiftTradeRequest;
import com.mypurecloud.sdk.v2.model.AddWorkPlanRotationRequest;
import com.mypurecloud.sdk.v2.model.AdherenceExplanationAsyncResponse;
import com.mypurecloud.sdk.v2.model.AdherenceExplanationJob;
import com.mypurecloud.sdk.v2.model.AdherenceExplanationResponse;
import com.mypurecloud.sdk.v2.model.AdminTimeOffRequestPatch;
import com.mypurecloud.sdk.v2.model.AgentManagementUnitReference;
import com.mypurecloud.sdk.v2.model.AgentPossibleWorkShiftsRequest;
import com.mypurecloud.sdk.v2.model.AgentPossibleWorkShiftsResponse;
import com.mypurecloud.sdk.v2.model.AgentQueryAdherenceExplanationsRequest;
import com.mypurecloud.sdk.v2.model.AgentQueryAdherenceExplanationsResponse;
import com.mypurecloud.sdk.v2.model.AgentTimeOffRequestPatch;
import com.mypurecloud.sdk.v2.model.AsyncForecastOperationResult;
import com.mypurecloud.sdk.v2.model.AsyncIntradayResponse;
import com.mypurecloud.sdk.v2.model.AvailableTimeOffRequest;
import com.mypurecloud.sdk.v2.model.AvailableTimeOffResponse;
import com.mypurecloud.sdk.v2.model.BuAgentScheduleHistoryResponse;
import com.mypurecloud.sdk.v2.model.BuAsyncAgentSchedulesQueryResponse;
import com.mypurecloud.sdk.v2.model.BuAsyncAgentSchedulesSearchResponse;
import com.mypurecloud.sdk.v2.model.BuAsyncScheduleResponse;
import com.mypurecloud.sdk.v2.model.BuAsyncScheduleRunResponse;
import com.mypurecloud.sdk.v2.model.BuCopyScheduleRequest;
import com.mypurecloud.sdk.v2.model.BuCreateBlankScheduleRequest;
import com.mypurecloud.sdk.v2.model.BuCurrentAgentScheduleSearchResponse;
import com.mypurecloud.sdk.v2.model.BuForecastGenerationResult;
import com.mypurecloud.sdk.v2.model.BuForecastResultResponse;
import com.mypurecloud.sdk.v2.model.BuGenerateScheduleRequest;
import com.mypurecloud.sdk.v2.model.BuGetCurrentAgentScheduleRequest;
import com.mypurecloud.sdk.v2.model.BuHeadcountForecastResponse;
import com.mypurecloud.sdk.v2.model.BuQueryAdherenceExplanationsRequest;
import com.mypurecloud.sdk.v2.model.BuQueryAdherenceExplanationsResponse;
import com.mypurecloud.sdk.v2.model.BuQueryAgentSchedulesRequest;
import com.mypurecloud.sdk.v2.model.BuRescheduleRequest;
import com.mypurecloud.sdk.v2.model.BuRescheduleResult;
import com.mypurecloud.sdk.v2.model.BuScheduleListing;
import com.mypurecloud.sdk.v2.model.BuScheduleMetadata;
import com.mypurecloud.sdk.v2.model.BuScheduleRun;
import com.mypurecloud.sdk.v2.model.BuScheduleRunListing;
import com.mypurecloud.sdk.v2.model.BuSearchAgentSchedulesRequest;
import com.mypurecloud.sdk.v2.model.BuShortTermForecast;
import com.mypurecloud.sdk.v2.model.BuShortTermForecastListing;
import com.mypurecloud.sdk.v2.model.BulkShiftTradeStateUpdateRequest;
import com.mypurecloud.sdk.v2.model.BulkUpdateShiftTradeStateResponse;
import com.mypurecloud.sdk.v2.model.BusinessUnitActivityCode;
import com.mypurecloud.sdk.v2.model.BusinessUnitActivityCodeListing;
import com.mypurecloud.sdk.v2.model.BusinessUnitListing;
import com.mypurecloud.sdk.v2.model.BusinessUnitResponse;
import com.mypurecloud.sdk.v2.model.CalendarUrlResponse;
import com.mypurecloud.sdk.v2.model.CopyBuForecastRequest;
import com.mypurecloud.sdk.v2.model.CopyWorkPlan;
import com.mypurecloud.sdk.v2.model.CopyWorkPlanRotationRequest;
import com.mypurecloud.sdk.v2.model.CreateActivityCodeRequest;
import com.mypurecloud.sdk.v2.model.CreateAdminTimeOffRequest;
import com.mypurecloud.sdk.v2.model.CreateAgentTimeOffRequest;
import com.mypurecloud.sdk.v2.model.CreateBusinessUnitRequest;
import com.mypurecloud.sdk.v2.model.CreateManagementUnitApiRequest;
import com.mypurecloud.sdk.v2.model.CreatePlanningGroupRequest;
import com.mypurecloud.sdk.v2.model.CreateServiceGoalTemplate;
import com.mypurecloud.sdk.v2.model.CreateTimeOffLimitRequest;
import com.mypurecloud.sdk.v2.model.CreateTimeOffPlanRequest;
import com.mypurecloud.sdk.v2.model.CreateWorkPlan;
import com.mypurecloud.sdk.v2.model.CurrentUserScheduleRequestBody;
import com.mypurecloud.sdk.v2.model.ErrorBody;
import com.mypurecloud.sdk.v2.model.ForecastPlanningGroupsResponse;
import com.mypurecloud.sdk.v2.model.GenerateBuForecastRequest;
import com.mypurecloud.sdk.v2.model.HistoricalImportDeleteJobResponse;
import com.mypurecloud.sdk.v2.model.HistoricalImportStatusListing;
import com.mypurecloud.sdk.v2.model.ImportForecastResponse;
import com.mypurecloud.sdk.v2.model.ImportForecastUploadResponse;
import com.mypurecloud.sdk.v2.model.ImportScheduleUploadResponse;
import com.mypurecloud.sdk.v2.model.IntradayPlanningGroupRequest;
import java.time.LocalDate;
import com.mypurecloud.sdk.v2.model.LongTermForecastResultResponse;
import com.mypurecloud.sdk.v2.model.ManagementUnit;
import com.mypurecloud.sdk.v2.model.ManagementUnitListing;
import com.mypurecloud.sdk.v2.model.MatchShiftTradeRequest;
import com.mypurecloud.sdk.v2.model.MatchShiftTradeResponse;
import com.mypurecloud.sdk.v2.model.ModelingStatusResponse;
import com.mypurecloud.sdk.v2.model.MoveManagementUnitRequest;
import com.mypurecloud.sdk.v2.model.MoveManagementUnitResponse;
import com.mypurecloud.sdk.v2.model.NotificationsResponse;
import com.mypurecloud.sdk.v2.model.PatchBuScheduleRunRequest;
import com.mypurecloud.sdk.v2.model.PatchShiftTradeRequest;
import com.mypurecloud.sdk.v2.model.PlanningGroup;
import com.mypurecloud.sdk.v2.model.PlanningGroupList;
import com.mypurecloud.sdk.v2.model.ProcessScheduleUpdateUploadRequest;
import com.mypurecloud.sdk.v2.model.QueryAdherenceExplanationsResponse;
import com.mypurecloud.sdk.v2.model.QueryTimeOffLimitValuesRequest;
import com.mypurecloud.sdk.v2.model.QueryTimeOffLimitValuesResponse;
import com.mypurecloud.sdk.v2.model.QueryWaitlistPositionsRequest;
import com.mypurecloud.sdk.v2.model.ScheduleGenerationResult;
import com.mypurecloud.sdk.v2.model.ScheduleUploadProcessingResponse;
import com.mypurecloud.sdk.v2.model.SchedulingStatusResponse;
import com.mypurecloud.sdk.v2.model.SearchShiftTradesRequest;
import com.mypurecloud.sdk.v2.model.SearchShiftTradesResponse;
import com.mypurecloud.sdk.v2.model.ServiceGoalTemplate;
import com.mypurecloud.sdk.v2.model.ServiceGoalTemplateList;
import com.mypurecloud.sdk.v2.model.SetTimeOffLimitValuesRequest;
import com.mypurecloud.sdk.v2.model.ShiftTradeListResponse;
import com.mypurecloud.sdk.v2.model.ShiftTradeMatchesSummaryResponse;
import com.mypurecloud.sdk.v2.model.ShiftTradeResponse;
import com.mypurecloud.sdk.v2.model.TimeOffBalanceRequest;
import com.mypurecloud.sdk.v2.model.TimeOffBalancesResponse;
import com.mypurecloud.sdk.v2.model.TimeOffLimit;
import com.mypurecloud.sdk.v2.model.TimeOffLimitListing;
import com.mypurecloud.sdk.v2.model.TimeOffPlan;
import com.mypurecloud.sdk.v2.model.TimeOffPlanListing;
import com.mypurecloud.sdk.v2.model.TimeOffRequestList;
import com.mypurecloud.sdk.v2.model.TimeOffRequestListing;
import com.mypurecloud.sdk.v2.model.TimeOffRequestQueryBody;
import com.mypurecloud.sdk.v2.model.TimeOffRequestResponse;
import com.mypurecloud.sdk.v2.model.UpdateActivityCodeRequest;
import com.mypurecloud.sdk.v2.model.UpdateAdherenceExplanationStatusRequest;
import com.mypurecloud.sdk.v2.model.UpdateBusinessUnitRequest;
import com.mypurecloud.sdk.v2.model.UpdateManagementUnitRequest;
import com.mypurecloud.sdk.v2.model.UpdateNotificationsRequest;
import com.mypurecloud.sdk.v2.model.UpdateNotificationsResponse;
import com.mypurecloud.sdk.v2.model.UpdatePlanningGroupRequest;
import com.mypurecloud.sdk.v2.model.UpdateScheduleUploadResponse;
import com.mypurecloud.sdk.v2.model.UpdateServiceGoalTemplate;
import com.mypurecloud.sdk.v2.model.UpdateTimeOffLimitRequest;
import com.mypurecloud.sdk.v2.model.UpdateTimeOffPlanRequest;
import com.mypurecloud.sdk.v2.model.UpdateWorkPlanRotationRequest;
import com.mypurecloud.sdk.v2.model.UploadUrlRequestBody;
import com.mypurecloud.sdk.v2.model.UserListScheduleRequestBody;
import com.mypurecloud.sdk.v2.model.UserScheduleAdherence;
import com.mypurecloud.sdk.v2.model.UserScheduleAdherenceListing;
import com.mypurecloud.sdk.v2.model.UserScheduleContainer;
import com.mypurecloud.sdk.v2.model.ValidateWorkPlanResponse;
import com.mypurecloud.sdk.v2.model.ValidationServiceRequest;
import com.mypurecloud.sdk.v2.model.WaitlistPositionListing;
import com.mypurecloud.sdk.v2.model.WeekScheduleListResponse;
import com.mypurecloud.sdk.v2.model.WeekScheduleResponse;
import com.mypurecloud.sdk.v2.model.WeekShiftTradeListResponse;
import com.mypurecloud.sdk.v2.model.WfmAgent;
import com.mypurecloud.sdk.v2.model.WfmHistoricalAdherenceBulkQuery;
import com.mypurecloud.sdk.v2.model.WfmHistoricalAdherenceBulkResponse;
import com.mypurecloud.sdk.v2.model.WfmHistoricalAdherenceQuery;
import com.mypurecloud.sdk.v2.model.WfmHistoricalAdherenceQueryForTeams;
import com.mypurecloud.sdk.v2.model.WfmHistoricalAdherenceQueryForUsers;
import com.mypurecloud.sdk.v2.model.WfmHistoricalAdherenceResponse;
import com.mypurecloud.sdk.v2.model.WfmHistoricalShrinkageRequest;
import com.mypurecloud.sdk.v2.model.WfmHistoricalShrinkageResponse;
import com.mypurecloud.sdk.v2.model.WfmHistoricalShrinkageTeamsRequest;
import com.mypurecloud.sdk.v2.model.WfmIntradayPlanningGroupListing;
import com.mypurecloud.sdk.v2.model.WfmProcessUploadRequest;
import com.mypurecloud.sdk.v2.model.WfmUserEntityListing;
import com.mypurecloud.sdk.v2.model.WorkPlan;
import com.mypurecloud.sdk.v2.model.WorkPlanListResponse;
import com.mypurecloud.sdk.v2.model.WorkPlanRotationListResponse;
import com.mypurecloud.sdk.v2.model.WorkPlanRotationResponse;
import com.mypurecloud.sdk.v2.model.WorkPlanValidationRequest;
public class GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest {
private String businessUnitId;
public String getBusinessUnitId() {
return this.businessUnitId;
}
public void setBusinessUnitId(String businessUnitId) {
this.businessUnitId = businessUnitId;
}
public GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest withBusinessUnitId(String businessUnitId) {
this.setBusinessUnitId(businessUnitId);
return this;
}
private LocalDate weekDateId;
public LocalDate getWeekDateId() {
return this.weekDateId;
}
public void setWeekDateId(LocalDate weekDateId) {
this.weekDateId = weekDateId;
}
public GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest withWeekDateId(LocalDate weekDateId) {
this.setWeekDateId(weekDateId);
return this;
}
private String forecastId;
public String getForecastId() {
return this.forecastId;
}
public void setForecastId(String forecastId) {
this.forecastId = forecastId;
}
public GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest withForecastId(String forecastId) {
this.setForecastId(forecastId);
return this;
}
private Boolean forceDownloadService;
public Boolean getForceDownloadService() {
return this.forceDownloadService;
}
public void setForceDownloadService(Boolean forceDownloadService) {
this.forceDownloadService = forceDownloadService;
}
public GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest withForceDownloadService(Boolean forceDownloadService) {
this.setForceDownloadService(forceDownloadService);
return this;
}
private final Map<String, String> customHeaders = new HashMap<>();
public Map<String, String> getCustomHeaders() {
return this.customHeaders;
}
public void setCustomHeaders(Map<String, String> customHeaders) {
this.customHeaders.clear();
this.customHeaders.putAll(customHeaders);
}
public void addCustomHeader(String name, String value) {
this.customHeaders.put(name, value);
}
public GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest withCustomHeader(String name, String value) {
this.addCustomHeader(name, value);
return this;
}
public ApiRequest<Void> withHttpInfo() {
// verify the required parameter 'businessUnitId' is set
if (this.businessUnitId == null) {
throw new IllegalStateException("Missing the required parameter 'businessUnitId' when building request for GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest.");
}
// verify the required parameter 'weekDateId' is set
if (this.weekDateId == null) {
throw new IllegalStateException("Missing the required parameter 'weekDateId' when building request for GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest.");
}
// verify the required parameter 'forecastId' is set
if (this.forecastId == null) {
throw new IllegalStateException("Missing the required parameter 'forecastId' when building request for GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest.");
}
return ApiRequestBuilder.create("GET", "/api/v2/workforcemanagement/businessunits/{businessUnitId}/weeks/{weekDateId}/shorttermforecasts/{forecastId}/longtermforecastdata")
.withPathParameter("businessUnitId", businessUnitId)
.withPathParameter("weekDateId", weekDateId)
.withPathParameter("forecastId", forecastId)
.withQueryParameters("forceDownloadService", "", forceDownloadService)
.withCustomHeaders(customHeaders)
.withContentTypes("application/json")
.withAccepts("application/json")
.withAuthNames("PureCloud OAuth")
.build();
}
public static Builder builder() {
return new Builder();
}
public static Builder builder(String businessUnitId, LocalDate weekDateId, String forecastId) {
return new Builder()
.withRequiredParams(businessUnitId, weekDateId, forecastId);
}
public static class Builder {
private final GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest request;
private Builder() {
request = new GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest();
}
public Builder withBusinessUnitId(String businessUnitId) {
request.setBusinessUnitId(businessUnitId);
return this;
}
public Builder withWeekDateId(LocalDate weekDateId) {
request.setWeekDateId(weekDateId);
return this;
}
public Builder withForecastId(String forecastId) {
request.setForecastId(forecastId);
return this;
}
public Builder withForceDownloadService(Boolean forceDownloadService) {
request.setForceDownloadService(forceDownloadService);
return this;
}
public Builder withRequiredParams(String businessUnitId, LocalDate weekDateId, String forecastId) {
request.setBusinessUnitId(businessUnitId);
request.setWeekDateId(weekDateId);
request.setForecastId(forecastId);
return this;
}
public GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest build() {
// verify the required parameter 'businessUnitId' is set
if (request.businessUnitId == null) {
throw new IllegalStateException("Missing the required parameter 'businessUnitId' when building request for GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest.");
}
// verify the required parameter 'weekDateId' is set
if (request.weekDateId == null) {
throw new IllegalStateException("Missing the required parameter 'weekDateId' when building request for GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest.");
}
// verify the required parameter 'forecastId' is set
if (request.forecastId == null) {
throw new IllegalStateException("Missing the required parameter 'forecastId' when building request for GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest.");
}
return request;
}
}
}
| [
"purecloud-jenkins@ininica.com"
] | purecloud-jenkins@ininica.com |
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;
}
} | [
"lovexuxu123456@outlook.com"
] | lovexuxu123456@outlook.com |
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();
}
}
| [
"m201973311@hust.edu.cn"
] | m201973311@hust.edu.cn |
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;
}
| [
"mariotrinity45@gmail.com"
] | mariotrinity45@gmail.com |
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);
}
| [
"hejiageng@baijia.com"
] | hejiageng@baijia.com |
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;
}
}
| [
"weishang80@qq.com"
] | weishang80@qq.com |
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 |