blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
500f8a4deb093d3aebdbafacd864fc8350dc7ef3 | d16d9c35f3a1dfb2aa363c53066b4b0e604124d7 | /dealbookbackend/DealBook/src/main/java/com/euclid/dealbook/service/ImportService.java | dcf3f6fd6e78b6ea25940dfaeff74c412f7175ca | [] | no_license | MattySun007/OfficeTaskMgr | b5407da701b73706524318d25c6b0ab6bfeb7c6c | 7f6cf245d0f121631e699087f8e03db9012cf650 | refs/heads/master | 2022-12-17T07:53:37.879356 | 2020-09-19T00:51:11 | 2020-09-19T00:51:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 926 | java | package com.euclid.dealbook.service;
import java.io.File;
import java.util.List;
import org.springframework.web.multipart.MultipartFile;
import com.euclid.dealbook.dao.Activity;
import com.euclid.dealbook.dao.Contact;
import com.euclid.dealbook.exception.ApplicationException;
/**
* @author Bittu
*
*/
public interface ImportService {
/**
* Method to import contacts from the excel file. This method will read only xls
* and xlsx formated files. Method will throw {@linkplain ApplicationException}
* if any other formated files are present or file not found in the given
* location.
*
* @param fileAbsolutePath
* @return
* @throws ApplicationException
*/
List<Contact> importContacts(MultipartFile file) throws ApplicationException;
List<Contact> importContacts(File file) throws ApplicationException;
List<Activity> importActivities(MultipartFile activityFile) throws ApplicationException;
}
| [
"aashish.dugar@outlook.com"
] | aashish.dugar@outlook.com |
7a27379fb4b258d67284608d7e9bd67a4e34e6dd | 26a8a32810fd58a3255e591309c675d1d91ca772 | /contract-backend/src/main/java/com/along101/contract/controller/TestController.java | 7392ac65e9c40d8af032f34a3c700e5cd4a40ad1 | [] | no_license | along101/contract-center | fe118744b45fdb4aa9909292f16cc9b5df27c462 | 57ccd2361c50afc8f464a1a0d57878f04f06b99d | refs/heads/master | 2020-03-22T07:38:21.124096 | 2018-07-04T12:10:38 | 2018-07-04T12:10:38 | 139,714,072 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,150 | java | package com.along101.contract.controller;
import com.along101.atlas.api.AppControllerApiClient;
import com.along101.atlas.api.CloudControllerApiClient;
import com.along101.atlas.model.AppDto;
import com.along101.atlas.model.EnvUrl;
import com.along101.contract.entity.ProtoFileEntity;
import com.along101.contract.service.CodegenService;
import com.along101.contract.service.ProtoFileService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
/**
* Created by qiankai02 on 2017/8/14.
*/
@RestController
@RequestMapping(value = "/test")
@Slf4j
public class TestController {
@Autowired
AppControllerApiClient appControllerApiClient;
@Autowired
private ProtoFileService protoFileService;
@Autowired
private CloudControllerApiClient cloudControllerApiClient;
@Autowired
private CodegenService codegenService;
@RequestMapping(method = RequestMethod.GET)
public String test() {
String detail = cloudControllerApiClient.deleteCloudUsingDELETE(47L).getBody().getDetail();
log.info(detail);
AppDto appDto = new AppDto();
appDto.setId(20L);
appDto.setAppId("1000002070l");
appDto.setName("demo-test");
List<EnvUrl> envUrls = new ArrayList<>();
EnvUrl envUrl = new EnvUrl();
envUrl.setEnvName("uat");
envUrl.setUrl("/testttt");
envUrls.add(envUrl);
appDto.setEnvUrls(envUrls);
AppDto detail1 = appControllerApiClient.updateAppUsingPUT(appDto).getBody().getDetail();
return detail1.getName();
}
@RequestMapping(path = "upload", method = RequestMethod.POST)
@ResponseBody
public String upLoadFile(@RequestParam String appId,
@RequestParam Long orgId,
@RequestParam String username,
MultipartFile[] multipartFiles) throws IOException {
List<ProtoFileEntity> protoFileEntities = protoFileService.addProtoFiles(appId, orgId, username, multipartFiles);
return "";
}
@RequestMapping(path = "downloadzip", method = RequestMethod.GET)
public void download(@RequestParam String path, HttpServletResponse response) throws IOException {
response.setContentType("application/force-download");
response.setHeader("Content-Disposition", "attachment; filename=abc.zip");
ZipOutputStream zipOutputStream = new ZipOutputStream(response.getOutputStream());
zipOutputStream.putNextEntry(new ZipEntry("a/b/a.proto"));
zipOutputStream.write("a".getBytes(StandardCharsets.UTF_8));
zipOutputStream.putNextEntry(new ZipEntry("a/b/c.proto"));
zipOutputStream.write("c".getBytes(StandardCharsets.UTF_8));
zipOutputStream.close();
}
}
| [
"yinzuolong@ppdai.com"
] | yinzuolong@ppdai.com |
1b8247bc3815a83fd938c3d6f3315efb98949fff | b2148e1036ad3ce2f576a4b42c32d3e95482e40b | /yb-warehouse-server/src/main/java/com/warehouse/entity/CheckStockDetailEntity.java | 1b289bdfa7e31178e9f6dc0b7625d88d0b7690d9 | [] | no_license | jbzhang99/YS_Distribute | 211e78269479dbce8aa235618dbd4b021b40cb98 | 58a091be3fad6e65231bb05477d84c0a0399c5e7 | refs/heads/master | 2020-09-21T09:54:00.410573 | 2019-10-17T08:03:37 | 2019-10-17T08:03:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,987 | java | package com.warehouse.entity;
import java.util.Date;
public class CheckStockDetailEntity {
private Integer checkStockDetailId;
private Integer checkStockId;
private Integer productId;
private String productSpu;
private String productName;
private String productSku;
private String colorName;
private String sizeName;
private Integer productQuantity;
private Double productPrice;
private Double productTotalPrice;
private Date createTime;
private Date updateTime;
public Integer getCheckStockDetailId() {
return checkStockDetailId;
}
public void setCheckStockDetailId(Integer checkStockDetailId) {
this.checkStockDetailId = checkStockDetailId;
}
public Integer getCheckStockId() {
return checkStockId;
}
public void setCheckStockId(Integer checkStockId) {
this.checkStockId = checkStockId;
}
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public String getProductSpu() {
return productSpu;
}
public void setProductSpu(String productSpu) {
this.productSpu = productSpu == null ? null : productSpu.trim();
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName == null ? null : productName.trim();
}
public String getProductSku() {
return productSku;
}
public void setProductSku(String productSku) {
this.productSku = productSku == null ? null : productSku.trim();
}
public String getColorName() {
return colorName;
}
public void setColorName(String colorName) {
this.colorName = colorName == null ? null : colorName.trim();
}
public String getSizeName() {
return sizeName;
}
public void setSizeName(String sizeName) {
this.sizeName = sizeName == null ? null : sizeName.trim();
}
public Integer getProductQuantity() {
return productQuantity;
}
public void setProductQuantity(Integer productQuantity) {
this.productQuantity = productQuantity;
}
public Double getProductPrice() {
return productPrice;
}
public void setProductPrice(Double productPrice) {
this.productPrice = productPrice;
}
public Double getProductTotalPrice() {
return productTotalPrice;
}
public void setProductTotalPrice(Double productTotalPrice) {
this.productTotalPrice = productTotalPrice;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
} | [
"chenxc@milmila.com"
] | chenxc@milmila.com |
07cc2dab28c46b174eda642862bfd2a26992f94b | 0cc9d848b93c8ef04c90c864ff7c7ab6f693296e | /core/src/server/webclient/services/HashtagService.java | ba7f0fdf0b54b6beaea8f3aa570f2a614c9960e8 | [] | no_license | hongyu-wang/ZhiYin | c641edcb4e641c4e0d43f6bd9acf968204528b42 | f518e2486d2be3496efdb68d4609be5fed01f83c | refs/heads/master | 2021-06-08T18:53:25.285933 | 2016-11-23T06:02:56 | 2016-11-23T06:02:56 | 52,044,688 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 896 | java | package server.webclient.services;
import server.model.structureModels.ServerModel;
import tools.serverTools.server.MockServer;
import tools.serverTools.server.ServerInteraction;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
/**
* @author rsang
*/
@Path("/hashtagservice")
public class HashtagService {
@GET
@Path("/param/{param}")
@Produces("text/plain")
public String getClichedMessage(@PathParam("param") String msg) {
return msg;
}
/**
* Using Jackson.
*
*/
@GET
@Path("/getHashtagByName/{param}")
@Produces("application/json")
public long getHashtagByName(@PathParam("param") String hashtag) {
MockServer mockServer = ServerInteraction.getServer();
long hashtagKey = mockServer.getUserKeybyName(hashtag);
return hashtagKey;
}
} | [
"kevin97illu@gmail.com"
] | kevin97illu@gmail.com |
84161dca4f574aa08268e6e33e0bfe854771749c | 934b51878b16c7e6f5dcb770a2b848ffd072554b | /src/main/java/Snippet.java | 5e63abf63b98e4e64870fa2671a1c4ad98958a53 | [] | no_license | irinka1/Offline13 | f67734f05487d7ba80e949b9a3bceac9577492e7 | 0fdd9c02a0242932ce3fc335c2a3be9cb6cdfb3c | refs/heads/master | 2021-07-01T06:07:42.260623 | 2017-09-21T19:11:04 | 2017-09-21T19:11:04 | 104,372,936 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 172 | java | import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public class Snippet {
public TopLevel topLevelComment;
}
| [
"irenmast@gmail.com"
] | irenmast@gmail.com |
a0a9cabf746ef026dc00a61950260fa94a25425a | 0cd358d8302bc19482563466041d250ac0b22896 | /networking/Ex5 RMI/Put&Get strings/src/MessagePoolServer.java | 061cd625da3db3cbf0b1b019157e93e798a2a446 | [] | no_license | denisMihaylov/University | 5ebea3e85de9abfe7847f1f37dc6ce85e97db102 | 00a6c5f99a152d4eeae285e64b0adc68f3112790 | refs/heads/master | 2021-01-14T08:23:24.295721 | 2018-06-26T10:57:30 | 2018-06-26T10:57:30 | 44,089,873 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,289 | java | import java.rmi.registry.Registry;
import java.rmi.registry.LocateRegistry;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.util.LinkedList;
import java.util.Scanner;
public class MessagePoolServer implements MessagePool {
LinkedList<String> MessageQueue;
public MessagePoolServer() {
this.MessageQueue = new LinkedList<>();
}
@Override
public void put(String msg) throws RemoteException {
try {
if (msg.length() == 0) {
throw new MessageNullException("Message is null.");
}
} catch (MessageNullException ex) {
System.out.println("MessageNullException");
}
if (msg.length() > 500) {
throw new RuntimeException("Message too big");
}
try {
if (MessageQueue.size() == 100) {
throw new QueueFullException("Queue is full.");
}
} catch (QueueFullException ex) {
System.out.println("QueueFullException");
}
MessageQueue.add(msg);
}
@Override
public String get() throws RemoteException {
try {
if (MessageQueue.isEmpty()) {
throw new QueueEmptyException("Queue is empty.");
}
} catch (QueueEmptyException ex) {
System.out.println("QueueEmptyException");
}
return MessageQueue.poll();
}
public static void main(String args[]) {
System.out.println("Enter global IP address of the RMI server to bind to:");
Scanner in = new Scanner(System.in);
String serverIP = in.next();
System.setProperty("java.rmi.server.hostname", serverIP);
// Otherwise binds to localhost only
try {
MessagePoolServer obj = new MessagePoolServer();
MessagePool stub = (MessagePool) UnicastRemoteObject.exportObject(obj, 1099);
LocateRegistry.createRegistry(1099);
Registry registry = LocateRegistry.getRegistry();
registry.rebind("MessagePool", stub);
System.out.println("Server is started");
} catch (RemoteException e) {
System.out.println("Error: " + e.getMessage());
}
}
}
| [
"denis.mihaylov93@gmail.com"
] | denis.mihaylov93@gmail.com |
8280ff215f725b081faf2ae2e84b3f6c538d484a | 842132eecbddaa1c8e501041df19a6001da73622 | /rest-spring/src/main/java/rest/Query.java | 3c18c89270db3a4b6834a4180b5be78cbb6b9f02 | [] | no_license | niklasgerdt/TemplatesAndTools | d519b748e1ad3b22e78946e2309c06684017a142 | c1b291bfe40b71519147f89e526da32558f4710f | refs/heads/master | 2020-12-25T19:59:00.103598 | 2014-12-19T09:35:25 | 2014-12-19T09:35:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 70 | java | package rest;
public interface Query {
public String query();
}
| [
"gerdtni@gmail.com"
] | gerdtni@gmail.com |
6d43cae5522f7d5c770db6f06dac415e177e1f73 | 62752936c36dc6137509a9eadd8e20916ee0d89a | /2019/Praticas/ProjetoBase/src/pt/ipleiria/estg/dei/aed/analisecomplexidade/algoritmos/SubsequenciaSomaMaximaDeOrdemN2.java | 9e025a00fdec595c2b819ab1bb1d892a1b1d0d54 | [] | no_license | TiagoCaetanoPT/Algoritmos-e-Estrutura-de-Dados | c9cff86e665b6fac7f617c1fc64fe13122f80744 | 9bcf3f294945a29faafbe09ce7888d2c8beae250 | refs/heads/master | 2021-10-07T20:59:54.225562 | 2021-09-30T20:51:47 | 2021-09-30T20:51:47 | 211,334,913 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,396 | java | package pt.ipleiria.estg.dei.aed.analisecomplexidade.algoritmos;
import pt.ipleiria.estg.dei.aed.utils.EstatisticaDeIteracoes;
import pt.ipleiria.estg.dei.aed.utils.Par;
/**
* @author Actual code:
* Carlos Urbano<carlos.urbano@ipleiria.pt>
* Catarina Reis<catarina.reis@ipleiria.pt>
* Marco Ferreira<marco.ferreira@ipleiria.pt>
* João Ramos<joao.f.ramos@ipleiria.pt>
* Original code: José Magno<jose.magno@ipleiria.pt>
*/
public class SubsequenciaSomaMaximaDeOrdemN2 extends SubsequenciaSomaMaxima {
@Override
public long executar(EstatisticaDeIteracoes estatistica, Par<Integer, Integer> indicesInicialEFinal, int... elementos) {
long somaMaxima = 0, somaAtual;
int inicio = 0, fim = 0;
for (int i = 0; i < elementos.length; i++) {
if (elementos[i] <= 0) {
continue;
}
somaAtual = 0;
for (int j = i; j < elementos.length; j++) {
somaAtual += elementos[j];
if (somaAtual > somaMaxima) {
inicio = i;
fim = j;
somaMaxima = somaAtual;
}
estatistica.incrementarIteracoes();
}
}
indicesInicialEFinal.setPrimeiro(inicio);
indicesInicialEFinal.setSegundo(fim);
return somaMaxima;
}
}
| [
"tiago.o.caetano@gmail.com"
] | tiago.o.caetano@gmail.com |
e6f5732705f6bdab74d50981c32162da87ea8460 | ab302571f903516e85e340f4d1aeb3fd78a7e52c | /ass4/src/Consumer.java | 3b0679f231474c8cba84e2d9dcb0062664392eb6 | [] | no_license | nventuri97/RetiLab | 2dc51efc4b9ce2f874905e09edde2e0f3d5491e3 | 146a369202ff6b573ce607f74802df84fcc203de | refs/heads/master | 2020-08-15T19:09:29.502878 | 2019-12-18T14:24:20 | 2019-12-18T14:24:20 | 215,393,363 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,623 | java | import java.io.File;
import java.io.IOException;
public class Consumer implements Runnable {
private SharedStructure sh;
public Consumer(SharedStructure sh){
this.sh=sh;
}
public void run(){
while(!sh.emptyQueue() && sh.isFinish()) {
try {
//prendo il path dalla coda
String path = sh.get();
if(path!=null) {
File dir=new File(path);
if (dir.isDirectory()) {
//se il path precedente è una cartalla estraggo i file e le sottocartelle interne
File[] files = dir.listFiles();
if (files != null)
for (File file : files) {
//stampo a sencoda del tipo di file
if (file != null)
if (file.isDirectory()) {
System.out.print("Directory: " + file.getCanonicalFile() + "\n");
System.out.flush();
} else if (file.isFile()) {
System.out.print("File: " + file.getCanonicalFile() + "\n");
System.out.flush();
}
}
}
}
} catch (InterruptedException e) {
e.printStackTrace();
} catch (IOException e){
e.printStackTrace();
}
}
}
}
| [
"n.venturi3@studenti.unipi.it"
] | n.venturi3@studenti.unipi.it |
ff18af134dd9a3227936201a6606b69773a56de4 | c03273a83041c926ca5ff853a267255915736d11 | /app/src/main/java/com/example/danijela/sparkle/model/Credentials.java | 0c696b2c716fe07c2d5b08977e989ba3fd358fe3 | [] | no_license | paulohpcardoso/Sparkle | 27e904aa678d07f02bce6a3a975733e4a1ec572c | 327001c675ecdcd0e39826f0e6c107e82ebe7cd3 | refs/heads/master | 2020-04-02T01:27:15.177958 | 2018-06-04T14:04:21 | 2018-06-04T14:04:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 303 | java | package com.example.danijela.sparkle.model;
import com.example.danijela.sparkle.R;
import java.util.Stack;
/**
* Created by danijela on 9/27/16.
*/
public class Credentials {
public static User getLoggedUser()
{
return new User(1, "Felipa", "Stallone", R.drawable.user_8);
}
}
| [
"danijela.kankaza@gmail.com"
] | danijela.kankaza@gmail.com |
a5c11687a31598ac54c1ba859148a192ffcd8042 | b6488131753d7fd06db4ed484c0e98f55888a07b | /src/main/java/com/github/mjeanroy/dbunit/core/resources/ClasspathResourceLoader.java | f59d950cd36c5601b151a918f24d7939c3294cc9 | [] | no_license | mjeanroy/dbunit-plus | 7af7bdd18a0ff910c9254cda47d2eb45af1fce46 | cb6620427c089923c06ce8c7ffee9cc08ab2eeb2 | refs/heads/master | 2023-08-31T01:56:04.065941 | 2023-08-14T16:09:49 | 2023-08-14T16:09:49 | 48,915,700 | 19 | 8 | null | 2023-09-14T15:35:49 | 2016-01-02T16:21:19 | Java | UTF-8 | Java | false | false | 2,692 | java | /**
* The MIT License (MIT)
*
* Copyright (c) 2015-2021 Mickael Jeanroy
*
* 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.mjeanroy.dbunit.core.resources;
import com.github.mjeanroy.dbunit.exception.ResourceNotFoundException;
import java.net.URL;
import static com.github.mjeanroy.dbunit.core.resources.Resources.toFile;
/**
* Load {@link Resource} from the classpath.
*/
class ClasspathResourceLoader extends AbstractResourceLoaderStrategy {
/**
* Each resource must match this prefix, for example:
* <ul>
* <li>{@code classpath:/foo.txt} match</li>
* <li>{@code classpath/foo.txt} does not match</li>
* <li>{@code foo.txt} does not match</li>
* </ul>
*/
private static final String PREFIX = "classpath:";
/**
* The singleton instance.
*/
private static final ClasspathResourceLoader INSTANCE = new ClasspathResourceLoader();
/**
* Get the loader instance.
*
* @return Loader instance.
*/
static ClasspathResourceLoader getInstance() {
return INSTANCE;
}
/**
* Create the loader.
* This constructor should not be called directly, use {@link #getInstance()} instead.
*/
private ClasspathResourceLoader() {
super(PREFIX);
}
@Override
Resource doLoad(String path) throws Exception {
final String prefix = extractPrefix(path);
final String resourcePath = prefix != null && !prefix.isEmpty() ?
path.substring(prefix.length()) :
path;
final URL url = getClass().getResource(resourcePath);
if (url == null) {
throw new ResourceNotFoundException(path);
}
return Resources.isFileURL(url) ?
new FileResource(toFile(url)) :
new ClasspathResource(url);
}
}
| [
"mickael.jeanroy@gmail.com"
] | mickael.jeanroy@gmail.com |
94e6f40dd67fd19484d1b606e9f6daaa4c79d4b6 | b9a7cde0c900ac117fbf4f61fc9395816353c3f0 | /app/src/main/java/com/school/twohand/wxapi/WXEntryActivity.java | 53b59c8659acfd0ef68024230bcd704332aaf79d | [] | no_license | ExtrNight/SchoolTwoHandApp | 586f44e1d1c30dc54c9aa9dc796e39f6759f2fd1 | aaebc1fdd754acff4515334b274f60c2844fa1e1 | refs/heads/master | 2021-05-03T16:56:18.100985 | 2016-11-22T06:57:40 | 2016-11-22T06:57:40 | 72,004,026 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,094 | java | /*
* 官网地站:http://www.mob.com
* 技术支持QQ: 4006852216
* 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复)
*
* Copyright (c) 2013年 mob.com. All rights reserved.
*/
package com.school.twohand.wxapi;
import android.content.Intent;
import android.widget.Toast;
import cn.sharesdk.wechat.utils.WXAppExtendObject;
import cn.sharesdk.wechat.utils.WXMediaMessage;
import cn.sharesdk.wechat.utils.WechatHandlerActivity;
/** 微信客户端回调activity示例 */
public class WXEntryActivity extends WechatHandlerActivity {
/**
* 处理微信发出的向第三方应用请求app message
* <p>
* 在微信客户端中的聊天页面有“添加工具”,可以将本应用的图标添加到其中
* 此后点击图标,下面的代码会被执行。Demo仅仅只是打开自己而已,但你可
* 做点其他的事情,包括根本不打开任何页面
*/
public void onGetMessageFromWXReq(WXMediaMessage msg) {
if (msg != null) {
Intent iLaunchMyself = getPackageManager().getLaunchIntentForPackage(getPackageName());
startActivity(iLaunchMyself);
}
}
/**
* 处理微信向第三方应用发起的消息
* <p>
* 此处用来接收从微信发送过来的消息,比方说本demo在wechatpage里面分享
* 应用时可以不分享应用文件,而分享一段应用的自定义信息。接受方的微信
* 客户端会通过这个方法,将这个信息发送回接收方手机上的本demo中,当作
* 回调。
* <p>
* 本Demo只是将信息展示出来,但你可做点其他的事情,而不仅仅只是Toast
*/
public void onShowMessageFromWXReq(WXMediaMessage msg) {
if (msg != null && msg.mediaObject != null
&& (msg.mediaObject instanceof WXAppExtendObject)) {
WXAppExtendObject obj = (WXAppExtendObject) msg.mediaObject;
Toast.makeText(this, obj.extInfo, Toast.LENGTH_SHORT).show();
}
}
}
| [
"1398508918@qq.com"
] | 1398508918@qq.com |
82a526be153e8f589f73177b3dba5f894cc3eaa7 | 71e3c14dd08ce9c6724274dc23e7d1d801e1aff4 | /src/main/java/com/squareequation/service/aop/EquationService.java | 9241d0c6c548c8ffe9ac410838f3d581844ca43b | [] | no_license | YuriiZub/EquationSquare | 999d20b5d79744fb482299cf3eae2aaa9ff71d24 | 1dc23b716f3db953ec4869059a06a924c9a2aaae | refs/heads/master | 2022-12-23T22:50:14.996592 | 2019-05-30T20:27:14 | 2019-05-30T20:27:14 | 179,681,785 | 0 | 0 | null | 2022-12-15T23:24:26 | 2019-04-05T12:59:24 | Java | UTF-8 | Java | false | false | 268 | java | package com.squareequation.service.aop;
import com.squareequation.model.EquationEntity;
/**
* dao Service
*
* @author Created by Yurii Zub on 5/3/2019.
* @interface
*/
public interface EquationService {
void saveSolution(EquationEntity equationEntity);
}
| [
"metalzub@.gmail.com"
] | metalzub@.gmail.com |
72a9677c1eb9d5f648d53364fedf47935348fd8a | 5f4a68698e391a3062cce2bdc42cd0b586269673 | /src/com/anxpp/designpattern/state/SaveDataController.java | 1d2381e7d6273f41a39b67b786d0bd60f832a957 | [] | no_license | GageChan/DesignPattern | 468ef57babab5f19fa04fe93f8bbf3726ddc2d09 | bdf8cbf5e77915d10101f32eb69bbc0b37406a2f | refs/heads/master | 2020-07-18T10:40:40.194407 | 2019-09-04T04:32:39 | 2019-09-04T04:32:39 | 206,231,300 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 421 | java | package com.anxpp.designpattern.state;
//环境(Context)
public class SaveDataController {
private ISaveData saveData;
public void save(String data){
//为了演示,此处的大的数据其实也是很小的
if(data.length()<1<<2)
saveData = SaveSmallData.instance;
else if(data.length()<1<<4)
saveData = SaveMiddleData.instance;
else
saveData = SaveBigData.instance;
saveData.save(data);
}
}
| [
"gagechan@foxmail.com"
] | gagechan@foxmail.com |
c061793ea42944ace22d8ab96e60f137bdf06d8b | 819b29d01434ca930f99e8818293cc1f9aa58e18 | /src/contest/hackerrank/Journey_To_The_Moon.java | 88d74582b06647f8f8980f09df15b9185b5eca84 | [
"Apache-2.0",
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | ANUJ581/competitive-programming-1 | 9bd5de60163d9a46680043d480455c8373fe26a7 | d8ca9efe9762d9953bcacbc1ca1fe0da5cbe6ac4 | refs/heads/master | 2020-08-06T18:43:09.688000 | 2019-10-06T04:54:47 | 2019-10-06T04:54:47 | 213,110,718 | 0 | 0 | NOASSERTION | 2019-10-06T04:54:18 | 2019-10-06T04:54:18 | null | UTF-8 | Java | false | false | 2,232 | java | package contest.hackerrank;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class Journey_To_The_Moon {
static BufferedReader br;
static PrintWriter out;
static StringTokenizer st;
static ArrayList<ArrayList<Integer>> adj = new ArrayList<ArrayList<Integer>>();
static int n, m;
static boolean[] v;
public static void main(String[] args) throws IOException {
br = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(new OutputStreamWriter(System.out));
// br = new BufferedReader(new FileReader("in.txt"));
// out = new PrintWriter(new FileWriter("out.txt"));
n = readInt();
m = readInt();
v = new boolean[n];
for (int i = 0; i < n; i++)
adj.add(new ArrayList<Integer>());
for (int i = 0; i < m; i++) {
int a = readInt();
int b = readInt();
adj.get(a).add(b);
adj.get(b).add(a);
}
ArrayList<Long> sz = new ArrayList<Long>();
for (int i = 0; i < n; i++)
if (!v[i])
sz.add((long)dfs(i));
for (int i = 0; i < sz.size(); i++)
if (i > 0)
sz.set(i, sz.get(i - 1) + sz.get(i));
long ans = 0;
for (int i = 0; i < sz.size() - 1; i++) {
ans += (sz.get(i + 1) - sz.get(i)) * sz.get(i);
}
out.println(ans);
out.close();
}
static int dfs(int i) {
v[i] = true;
int cnt = 1;
for (int j : adj.get(i))
if (!v[j])
cnt += dfs(j);
return cnt;
}
static String next() throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine().trim());
return st.nextToken();
}
static long readLong() throws IOException {
return Long.parseLong(next());
}
static int readInt() throws IOException {
return Integer.parseInt(next());
}
static double readDouble() throws IOException {
return Double.parseDouble(next());
}
static char readCharacter() throws IOException {
return next().charAt(0);
}
static String readLine() throws IOException {
return br.readLine().trim();
}
} | [
"jeffrey.xiao1998@gmail.com"
] | jeffrey.xiao1998@gmail.com |
d56d002870e0b32eec3872e838ea761a76decdcd | 66e37ab9d94cc5b8acaa83c35c17aa0e41f0aa53 | /AplikasiKeuangan/app/src/main/java/oki/candra/aplikasikeuangan/FormActivity.java | b067eb86646c2833f14ae1de8684134e3c57fd37 | [] | no_license | ocand21/android | a6e7517886fd6079b97d37be1fd5a26a817f31b7 | e65b3137a82fbec8531f607a117589955e8d882f | refs/heads/master | 2020-05-20T12:25:08.760019 | 2017-02-20T03:37:21 | 2017-02-20T03:37:21 | 80,480,491 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,986 | java | package oki.candra.aplikasikeuangan;
import android.content.Intent;
import android.support.annotation.IntegerRes;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
public class FormActivity extends AppCompatActivity {
private String [] jenisStr = {"Pemasukan", "Pengeluaran"};
private EditText edtNama, edtJumlah, edtKeterangan;
private Spinner spnJenis;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_form);
spnJenis = (Spinner) findViewById(R.id.spn_jenis);
ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, jenisStr);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spnJenis.setAdapter(adapter);
edtNama = (EditText) findViewById(R.id.edt_nama);
edtJumlah = (EditText) findViewById(R.id.edt_jumlah);
edtKeterangan = (EditText) findViewById(R.id.edt_keterangan);
}
public void saveTransaksi(View view)
{
TransaksiHelper dbHelper = new TransaksiHelper(this);
String nama = edtNama.getText().toString();
int jenis = spnJenis.getSelectedItemPosition()+1;
int jumlah = Integer.parseInt(edtJumlah.getText().toString());
String keterangan = edtKeterangan.getText().toString();
dbHelper.insertTransaksi(nama, jenis, jumlah, keterangan);
Log.d("form.transaksi", nama+" - "+ Integer.toString(jenis)+" - "+Integer.toString(jumlah)
+" - "+keterangan);
Toast.makeText(this, "Transaksi "+nama+" berhasil disimpan", Toast.LENGTH_SHORT).show();
//startActivity(new Intent(this, MainActivity.class));
finish();
}
}
| [
"okicandra21@gmail.com"
] | okicandra21@gmail.com |
9fd61098c485918ad21f18978f2952afa95bb342 | 0ce9af4a9413aa3a62df74f4630f4b1fb96b0a30 | /Exercise2/src/main/java/Calculator.java | 2e59012a4ed0d76a56a22676693fe14d9a3ed635 | [] | no_license | LeeDillon/Java8ExerciseBook | 4035d2489b0a56e6d2d151ebf61312edeaf5ee3f | 5ace0540f3970bbc66e28a3856fa8e3515ab8816 | refs/heads/main | 2023-07-11T03:18:45.105063 | 2021-08-25T11:57:58 | 2021-08-25T11:57:58 | 399,390,673 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 500 | java |
public class Calculator {
double n1;
double n2;
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println(multiplication(5,2));
}
public static double addition(double n1, double n2) {
return n1 + n2;
}
public static double subtraction(double n1, double n2) {
return n1 - n2;
}
public static double division(double n1, double n2) {
return n1 / n2;
}
public static double multiplication(double n1, double n2) {
return n1 * n2;
}
}
| [
"lee.dillon1@outlook.com"
] | lee.dillon1@outlook.com |
a3ed79c873b0f49d46f1afaf50a18ef6f7e162d8 | ab6d5c56b0ba44d72d4b2659e577924c80874aed | /src/main/java/com/resource/api/dao/INegocioDao.java | 2ae8d96a5f0975b8eddec77cd5b7da8c386bc86e | [] | no_license | LeonardoCuraca/businessmanagerwebservice | 583269a67fa5aaaec4dc28973477d45de36c2ed9 | 74c368261049cced8643bed6380abd6a8d0904fb | refs/heads/master | 2020-09-10T17:45:11.242398 | 2019-12-10T05:54:04 | 2019-12-10T05:54:04 | 221,784,462 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 486 | java | package com.resource.api.dao;
import java.util.List;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import com.resource.api.entity.Negocio;
public interface INegocioDao extends CrudRepository<Negocio,Long>{
public List<Negocio>findByNegusuario(Long usuid);
@Query(value = "select * from negocios where negid = ?1 and negpassword = ?2", nativeQuery = true)
public Negocio login(Long negid, String negpassword);
}
| [
"leonardo.curaca@tecsup.edu.pe"
] | leonardo.curaca@tecsup.edu.pe |
0d1be98a58cd043be861ed8a55647c620f04665d | 5adad0594ee64b0351d656e0eec256b894f55da5 | /src/AIPlayer.java | ebe25649977ae16d8eabf9e0b9bf7f0c902835b2 | [] | no_license | EMHodges/Tic-Tac-Toe | 9c7fa531735d923c0336954529c4ccc008df6b85 | 8488d4133904e5132ee1c48f5222c78dc7a623f6 | refs/heads/master | 2022-11-12T17:38:38.940539 | 2020-06-27T20:24:13 | 2020-06-27T20:24:13 | 275,344,065 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 244 | java | public class AIPlayer extends AbstractPlayer {
AIPlayer(Player playerID, Counter playerCounter) {
super(playerID, playerCounter);
}
@Override
public void takeTurn(Board board) {
System.out.print("AI");
}
}
| [
"elizabeth.mae.hodges@gmail.com"
] | elizabeth.mae.hodges@gmail.com |
6068bc91df3ceb6d0440545ff2b892a4896dd0e3 | 2970f2e02e3c6333637344eafda13836e79793c0 | /pws/src/com/ask/pws/SimWatcher.java | a265b261b8a0168df1f88eff14ee5c1412c5ce44 | [] | no_license | raidenawkward/ask | c6a7e8806f56d91788b9848952389e90d6e84d2a | 1378d4db5855bd60d667bdcc3d397ec8c5eb40c6 | refs/heads/master | 2020-12-24T15:41:31.043597 | 2012-08-07T11:24:27 | 2012-08-07T11:26:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,676 | java | package com.ask.pws;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.util.EncodingUtils;
import android.content.Context;
import android.telephony.SmsManager;
import android.telephony.TelephonyManager;
/**
* @author Raiden Awkward
* @category sim card watcher
*/
public class SimWatcher implements Watcher {
private List<String> targetNumbers;
private SmsManager smsManager;
static private String TARGET_PHONE_NUMBER = "13672077950";
static public String RECORD_FILE_NAME = "simrecord";
public SimWatcher() {
smsManager = SmsManager.getDefault();
targetNumbers = new ArrayList<String>();
targetNumbers.add(TARGET_PHONE_NUMBER);
}
public boolean onWatch() {
String currentSim = getCurrentSimSeries();
String recordSim = getSimRecord();
if (recordSim == null) {
setSimRecord(currentSim);
String text = "sim changed with empty record: " + currentSim;
sendSMS(text);
return true;
}
if (!currentSim.equals(recordSim)) {
String text = "sim changed: " + currentSim;
setSimRecord(currentSim);
sendSMS(text);
} else {
//sendSMS("sim does not change");
}
return true;
}
public void sendSMS(String text) {
if (text == null)
return;
if (text.length() <= 0)
return;
for (int i = 0; i < targetNumbers.size(); i++) {
String number = targetNumbers.get(i);
if (number == null)
continue;
if (number.length() <= 0)
continue;
smsManager.sendTextMessage(number, null, text, null, null);
}
}
public String getSimRecord() {
String res = null;
try {
FileInputStream fin = BootCompleteReceiver.context.openFileInput(RECORD_FILE_NAME);
int length = fin.available();
if (length <= 0)
return res;
byte [] buffer = new byte[length];
fin.read(buffer);
res = EncodingUtils.getString(buffer, "UTF-8");
fin.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return res;
}
public void setSimRecord(String content) {
try {
FileOutputStream fout = BootCompleteReceiver.context.openFileOutput(RECORD_FILE_NAME, Context.MODE_PRIVATE);
byte [] bytes = content.getBytes();
fout.write(bytes);
fout.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public String getCurrentSimSeries() {
TelephonyManager tm = (TelephonyManager) BootCompleteReceiver.context.getSystemService(Context.TELEPHONY_SERVICE);
return tm.getSimSerialNumber();
}
}
| [
"raiden.ht@gmail.com"
] | raiden.ht@gmail.com |
066dbd0b6502d4a9ccc3465fdc5d1219e5df00a3 | 4cca68eec29ba76560889875a82fafd917a1be81 | /android/AndroidTutorial/app/src/main/java/org/shenit/tutorial/android/fragment/SimpleTextFragment.java | 25c24ddc09d12c8913c47b9e01912db3d30c50e7 | [
"MIT"
] | permissive | devryan915/edu | 56f772057708f702a19d879ba5b7ff9ae2b108b8 | 91d7dc9886ebf9182d133319ee9cd412f2a5c7ba | refs/heads/master | 2021-01-12T07:09:29.030901 | 2016-09-27T04:25:17 | 2016-09-27T04:25:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 646 | java | package org.shenit.tutorial.android.fragment;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import org.shenit.tutorial.android.R;
/**
* This example shows how to create a simple fragment
*/
public class SimpleTextFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_simple_text, container, false);
}
}
| [
"jgnan1981@163.com"
] | jgnan1981@163.com |
f2718d3f164f2c043a125864edd6e881b11802e5 | ecb7e109a62f6a2a130e3320ed1fb580ba4fc2de | /reference-code/esr/esale-customers/src/main/java/jp/co/softbrain/esales/customers/service/dto/CustomersListSearchConditionsDTO.java | 8aa9292c513af065b00192039367a9f7cad631c5 | [] | no_license | nisheeth84/prjs_sample | df732bc1eb58bc4fd4da6e76e6d59a2e81f53204 | 3fb10823ca4c0eb3cd92bcd2d5d4abc8d59436d9 | refs/heads/master | 2022-12-25T22:44:14.767803 | 2020-10-07T14:55:52 | 2020-10-07T14:55:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,139 | java | package jp.co.softbrain.esales.customers.service.dto;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* DTO class for the entity {@link CustomersListSearchConditionsDTO}
*
* @author nguyenvanchien3
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class CustomersListSearchConditionsDTO extends BaseDTO implements Serializable {
/**
* @serialVersionUID
*/
private static final long serialVersionUID = 8971838611596494475L;
/**
* customerListSearchConditionId
*/
private Long customerListSearchConditionId;
/**
* customerListId
*/
private Long customerListId;
/**
* fieldId
*/
private Long fieldId;
/**
* searchType
*/
private Integer searchType;
/**
* searchOption
*/
private Integer searchOption;
/**
* searchValue
*/
private String searchValue;
/**
* fieldOrder
*/
private Integer fieldOrder;
/**
* timeZoneOffset
*/
private Integer timeZoneOffset;
/**
* fieldValue
*/
private String fieldValue;
}
| [
"phamkhachoabk@gmail.com"
] | phamkhachoabk@gmail.com |
a36fb372877529105e1b68017a5d9df720105a25 | 4ff46178bfa0e85bc18e04ea89d9060a10e700e6 | /cap3/ControlandoLoops.java | b8509d557718bcd2a920abf4d6cdc93ef8a888cd | [] | no_license | bertdev/java-caelum | 7b0dab1391e600267248bbcbaadcb5d0f0766393 | f062d94af466b939206eebe1669639b5b686561a | refs/heads/main | 2023-08-23T04:21:27.667144 | 2021-10-15T22:49:25 | 2021-10-15T22:49:25 | 382,503,579 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 569 | java | public class ControlandoLoops {
public static void main(String[] args) {
//as vezes podemos quere controlar um loop usando os comandos break e continue
//break irá fazer o loop parar
//continue irá fazer o loop seguir para a proxima execução
for (int i = 0; i < 50; i++) {
if (i % 19 == 0) {
System.out.println("Encontrei um número divisivel por 19 entre 0 e 50");
break;
}
}
for (int i = 0; i < 100; i++) {
if (i > 50 && i < 60) {
System.out.println(i);
continue;
}
}
}
} | [
"bert@pop-os.localdomain"
] | bert@pop-os.localdomain |
cc22a647ef4c09ecc20b28e91c5445e8f92ec9e5 | 2b542a93f97c421063b278e2356c2e12f1f458bf | /src/main/java/com/starterkit/springboot/brs/model/bus/Bus.java | 6016e39f63b8b6a9a0f5c57362cdd585b1e952aa | [
"MIT"
] | permissive | sengatang/springboot-starterkit | dcc6f6fb7bf57a8f6a1920a569241f0a3ad60fa4 | ae9a09008ba894d1f1d6a158ec3e8f184d39abb4 | refs/heads/master | 2022-11-15T13:23:22.038979 | 2020-07-07T06:00:01 | 2020-07-07T06:00:01 | 277,533,403 | 1 | 0 | MIT | 2020-07-06T12:17:25 | 2020-07-06T12:17:24 | null | UTF-8 | Java | false | false | 860 | java | package com.starterkit.springboot.brs.model.bus;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.IndexDirection;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;
/**
* Created by Arpit Khandelwal.
*/
@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
@Document(collection = "bus")
public class Bus {
@Id
private String id;
@Indexed(unique = true, direction = IndexDirection.DESCENDING, dropDups = true)
private String code;
private int capacity;
private String make;
@DBRef(lazy = true)
private Agency agency;
}
| [
"khandelwal.arpit@outlook.com"
] | khandelwal.arpit@outlook.com |
e020d73661ef44af5ccfdad05b9de91bf0d31cb1 | e32f6ca95a02cd0199caf7791084ef9fa29f012a | /SICOMED_Android/src/com/example/androidtablayout/P_Autenticacion.java | 3a79a731ed887eadbfaeecdab8ebac2dbba56a13 | [] | no_license | lpastenpinto/Sicomed | 14b8b957676f7d735fe15f14f8bb3cf42da8641e | 7b9d4183ff17f81e6fc5c8b606a1170731d20550 | refs/heads/master | 2020-06-28T12:02:24.659412 | 2016-09-06T17:15:12 | 2016-09-06T17:15:12 | 67,522,201 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,915 | java | package com.example.androidtablayout;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicHeader;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HTTP;
import org.apache.http.protocol.HttpContext;
import org.apache.http.util.EntityUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class P_Autenticacion extends Activity {
static String HOST ="https://miguelost.cloudant.com/";
static String DBNAME ="sicomed";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_p_inicio);
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
//Localizar los controles
final TextView User =(TextView)findViewById(R.id.Txt1);
final EditText txtUser = (EditText)findViewById(R.id.texto1);
final TextView Pass =(TextView)findViewById(R.id.Txt2);
final EditText txtPass = (EditText)findViewById(R.id.texto2);
final Button btnbuscar = (Button)findViewById(R.id.btn);
btnbuscar.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
//Verifica Conexion Internet
boolean bool = Verificar_Conexion_Internet();
if(bool==true){
final String Rut = txtUser.getText().toString();
JSONObject Ficha_Clinica = FuncionesCouch.GetFichaClinica(HOST, DBNAME, Rut);
try {
if(Ficha_Clinica.getString("_id").equals(Rut)){
final String Pass = txtPass.getText().toString();
if(Ficha_Clinica.getString("password").equals(Pass)){
//Creamos el Intent
Intent intent_0 = new Intent(P_Autenticacion.this, P_Busqueda.class);
Bundle b = new Bundle();
//Creamos la informaci�n a pasar entre actividades
b.putString("rut", Rut);
//A�adimos la informaci�n al intent
intent_0.putExtras(b);
//Iniciamos la nueva actividad
startActivity(intent_0);
}else{
builder.setTitle("Error");
builder.setMessage("Contrase�a Incorrecta");
builder.setPositiveButton("OK",null);
builder.create();
builder.show();
}
}else{
builder.setTitle("Error");
builder.setMessage("El Usuario no se encuentra en la Base de datos\nIngrese Usuario existente");
builder.setPositiveButton("OK",null);
builder.create();
builder.show();
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
builder.setTitle("Error");
builder.setMessage("El Usuario no se encuentra en la Base de datos\nIngrese Usuario existente");
builder.setPositiveButton("OK",null);
builder.create();
builder.show();
}
}else{
builder.setTitle("Error Conexion BD");
builder.setMessage("Imposible conectar a Base de datos.\nIntente mas tarde");
builder.setPositiveButton("OK",null);
builder.create();
builder.show();
}
}
});
}
public boolean Verificar_Conexion_Internet()
{
try {
//make a URL to a known source
URL url = new URL("http://www.google.com");
//abrir coneccion
HttpURLConnection urlConnect = (HttpURLConnection)url.openConnection();
//intenrar realizar coneccion
Object objData = urlConnect.getContent();
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
return true;
}
} | [
"lpastenpinto@gmail.com"
] | lpastenpinto@gmail.com |
c30ff2be75eeb3bd74b14116adcac0f0de2a7cb3 | 65b5a6c34afc57529182b6152a2b8dfd39e35ee4 | /app/src/main/java/com/example/nr12/database/ScriptSQL.java | be479aa38171f32b323fa759d3f0f7676e3cef21 | [] | no_license | MarksSenai/mobile | b593fa0535962c569c407bfee3da43cc4e815f82 | 7fd2f6267755e282ecfec79b6aad714f7e729c84 | refs/heads/main | 2023-04-23T02:10:26.676708 | 2021-04-27T19:54:45 | 2021-04-27T19:54:45 | 362,234,158 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,013 | java | package com.example.nr12.database;
import android.util.Log;
import com.example.nr12.dominio.entidades.Maquina;
/**
* Created by Fabiano on 25/09/2017.
*/
public class ScriptSQL {
public static String getCreateConfig(){
StringBuilder sqlBuilder = new StringBuilder();
sqlBuilder.append("CREATE TABLE IF NOT EXISTS CONFIG ( ");
sqlBuilder.append("ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, ");
sqlBuilder.append("URL VARCHAR (45), ");
sqlBuilder.append("EMAIL VARCHAR (45) NOT NULL, ");
sqlBuilder.append("SENHA VARCHAR (45) NOT NULL ");
sqlBuilder.append(");");
Log.i("INFO", sqlBuilder.toString());
return sqlBuilder.toString();
}
public static String getCreateRisco(){
StringBuilder sqlBuilder = new StringBuilder();
sqlBuilder.append("CREATE TABLE IF NOT EXISTS RISCO ( ");
sqlBuilder.append("ID INTEGER PRIMARY KEY NOT NULL, ");
sqlBuilder.append("NOME VARCHAR (45) NOT NULL ");
sqlBuilder.append(");");
Log.i("INFO", sqlBuilder.toString());
return sqlBuilder.toString();
}
public static String getCreatePerigo(){
StringBuilder sqlBuilder = new StringBuilder();
sqlBuilder.append("CREATE TABLE IF NOT EXISTS PERIGO ( ");
sqlBuilder.append("ID INTEGER PRIMARY KEY NOT NULL, ");
sqlBuilder.append("NOME VARCHAR (45) NOT NULL ");
sqlBuilder.append(");");
Log.i("INFO", sqlBuilder.toString());
return sqlBuilder.toString();
}
public static String getCreatePerigoRisco() {
StringBuilder sqlBuilder = new StringBuilder();
sqlBuilder.append("CREATE TABLE IF NOT EXISTS PERIGORISCO ( ");
sqlBuilder.append("PERIGO INTEGER NOT NULL REFERENCES PERIGO (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, ");
sqlBuilder.append("RISCO INTEGER NOT NULL REFERENCES RISCO (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, ");
sqlBuilder.append("PRIMARY KEY (PERIGO,RISCO) ");
sqlBuilder.append(");");
Log.i("INFO", sqlBuilder.toString());
return sqlBuilder.toString();
}
public static String getCreateTipoMaquina(){
StringBuilder sqlBuilder = new StringBuilder();
sqlBuilder.append("CREATE TABLE IF NOT EXISTS TIPOMAQUINA ( ");
sqlBuilder.append("ID INTEGER PRIMARY KEY NOT NULL, ");
sqlBuilder.append("NOME VARCHAR (200) NOT NULL ");
sqlBuilder.append(");");
Log.i("INFO", sqlBuilder.toString());
return sqlBuilder.toString();
}
public static String getCreateSistemaSeguranca(){
StringBuilder sqlBuilder = new StringBuilder();
sqlBuilder.append("CREATE TABLE IF NOT EXISTS SISTEMASEGURANCA ( ");
sqlBuilder.append("ID INTEGER PRIMARY KEY NOT NULL, ");
sqlBuilder.append("NOME VARCHAR (100) NOT NULL ");
sqlBuilder.append(");");
Log.i("INFO", sqlBuilder.toString());
return sqlBuilder.toString();
}
public static String getCreateCliente(){
StringBuilder sqlBuilder = new StringBuilder();
sqlBuilder.append("CREATE TABLE IF NOT EXISTS CLIENTE (");
sqlBuilder.append("ID INTEGER NOT NULL PRIMARY KEY, ");
sqlBuilder.append("NOME VARCHAR (45), ");
sqlBuilder.append("CNPJ VARCHAR (14) UNIQUE NOT NULL, ");
sqlBuilder.append("ENDERECO VARCHAR (60), ");
sqlBuilder.append("NUMERO INTEGER, ");
sqlBuilder.append("BAIRRO VARCHAR (45), ");
sqlBuilder.append("CIDADE VARCHAR (45), ");
sqlBuilder.append("ESTADO VARCHAR (2), ");
sqlBuilder.append("CEP VARCHAR (8), ");
sqlBuilder.append("TELEFONE VARCHAR (11), ");
sqlBuilder.append("EMAIL VARCHAR (60) ");
sqlBuilder.append(");");
Log.i("INFO", sqlBuilder.toString());
return sqlBuilder.toString();
}
public static String getCreateMaquina(){
StringBuilder sqlBuilder = new StringBuilder();
sqlBuilder.append("CREATE TABLE IF NOT EXISTS " + Maquina.TABELA + " (");
sqlBuilder.append(Maquina.IDLOCAL + " INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, ");
sqlBuilder.append(Maquina.IDEXT + " INTEGER, ");
sqlBuilder.append(Maquina.CLIENTEID + " INTEGER NOT NULL REFERENCES CLIENTE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, ");
sqlBuilder.append(Maquina.TIPOMAQUINAID + " INTEGER NOT NULL REFERENCES TIPOMAQUINA (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, ");
sqlBuilder.append(Maquina.NOME + " VARCHAR (45) NOT NULL, ");
sqlBuilder.append(Maquina.MODELO + " VARCHAR (45), ");
sqlBuilder.append(Maquina.NUMEROSERIE + " VARCHAR (45), ");
sqlBuilder.append(Maquina.NUMEROPATRIMONIO + " VARCHAR (45), ");
sqlBuilder.append(Maquina.CAPACIDADE + " VARCHAR (15), ");
sqlBuilder.append(Maquina.OPERADORES + " INTEGER, ");
sqlBuilder.append(Maquina.ANO + " INTEGER, ");
sqlBuilder.append(Maquina.FABRICANTE + " VARCHAR (45), ");
sqlBuilder.append(Maquina.SETOR + " VARCHAR (45) ");
sqlBuilder.append(");");
Log.i("INFO", sqlBuilder.toString());
return sqlBuilder.toString();
}
public static String getCreateLaudo(){
StringBuilder sqlBuilder = new StringBuilder();
sqlBuilder.append("CREATE TABLE IF NOT EXISTS LAUDO (");
sqlBuilder.append("ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, ");
sqlBuilder.append("MAQUINAID INTEGER NOT NULL REFERENCES MAQUINA (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, ");
sqlBuilder.append("STATUS VARCHAR (45) NOT NULL, ");
sqlBuilder.append("DATAINICIAL DATE, ");
sqlBuilder.append("DATAFINAL DATE ");
sqlBuilder.append(");");
Log.i("INFO", sqlBuilder.toString());
return sqlBuilder.toString();
}
public static String getCreatePontoPerigo(){
StringBuilder sqlBuilder = new StringBuilder();
sqlBuilder.append("CREATE TABLE IF NOT EXISTS PONTOPERIGO ( ");
sqlBuilder.append("ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, ");
sqlBuilder.append("LAUDOID INTEGER NOT NULL REFERENCES LAUDO (ID) ON DELETE CASCADE ON UPDATE CASCADE, ");
sqlBuilder.append("PONTOPERIGO VARCHAR(100) NOT NULL, ");
sqlBuilder.append("FACE VARCHAR (45) NOT NULL, ");
sqlBuilder.append("SISTEMASEGURANCAID INTEGER REFERENCES SISTEMASEGURANCA (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, ");
sqlBuilder.append("ANEXO1 CHAR (1) NOT NULL ");
sqlBuilder.append(");");
Log.i("INFO", sqlBuilder.toString());
return sqlBuilder.toString();
}
public static String getCreatePerigoPontoPerigo(){
StringBuilder sqlBuilder = new StringBuilder();
sqlBuilder.append("CREATE TABLE IF NOT EXISTS PERIGOPONTOPERIGO ( ");
sqlBuilder.append("PERIGOID INTEGER REFERENCES PERIGO (ID) ON DELETE CASCADE ON UPDATE CASCADE NOT NULL, ");
sqlBuilder.append("PONTOPERIGOID INTEGER REFERENCES PONTOPERIGO (ID) ON DELETE CASCADE ON UPDATE CASCADE NOT NULL, ");
sqlBuilder.append("PRIMARY KEY (PERIGOID,PONTOPERIGOID) ");
sqlBuilder.append(");");
Log.i("INFO", sqlBuilder.toString());
return sqlBuilder.toString();
}
public static String getCreateRiscoPontoPerigo(){
StringBuilder sqlBuilder = new StringBuilder();
sqlBuilder.append("CREATE TABLE IF NOT EXISTS RISCOPONTOPERIGO ( ");
sqlBuilder.append("RISCOID INTEGER REFERENCES RISCO (ID) ON DELETE CASCADE ON UPDATE CASCADE NOT NULL, ");
sqlBuilder.append("PONTOPERIGOID INTEGER REFERENCES PONTOPERIGO (ID) ON DELETE CASCADE ON UPDATE CASCADE NOT NULL, ");
sqlBuilder.append("PRIMARY KEY (RISCOID,PONTOPERIGOID) ");
sqlBuilder.append(");");
Log.i("INFO", sqlBuilder.toString());
return sqlBuilder.toString();
}
}
| [
"rodrigop@fluig.com"
] | rodrigop@fluig.com |
0c96c353ef448247cdca6ecce7ccb3df161d619b | 3b84ee2fa50146859154b336147ccb6b7b0d8641 | /FlipdogSpellChecker/my/apache/http/impl/cookie/BestMatchSpec.java | dd2309cab163066103ee708ade7de2662ba98e36 | [] | no_license | DarthYogurt/Dragonbreath | 5ac8883b75480a9a778f6b30d98c518b3544375d | 72f3e53cde17aacff812dce67f89b87d0b427a0e | refs/heads/master | 2016-08-03T16:43:36.614188 | 2013-11-12T00:11:29 | 2013-11-12T00:11:29 | 14,119,806 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,251 | java | package my.apache.http.impl.cookie;
import java.util.Iterator;
import java.util.List;
import my.apache.http.FormattedHeader;
import my.apache.http.Header;
import my.apache.http.HeaderElement;
import my.apache.http.annotation.NotThreadSafe;
import my.apache.http.cookie.Cookie;
import my.apache.http.cookie.CookieOrigin;
import my.apache.http.cookie.CookieSpec;
import my.apache.http.cookie.MalformedCookieException;
import my.apache.http.cookie.SetCookie2;
import my.apache.http.message.ParserCursor;
import my.apache.http.util.CharArrayBuffer;
@NotThreadSafe
public class BestMatchSpec
implements CookieSpec
{
private BrowserCompatSpec compat;
private final String[] datepatterns;
private RFC2109Spec obsoleteStrict;
private final boolean oneHeader;
private RFC2965Spec strict;
public BestMatchSpec()
{
this(null, false);
}
public BestMatchSpec(String[] paramArrayOfString, boolean paramBoolean)
{
if (paramArrayOfString == null);
for (String[] arrayOfString = null; ; arrayOfString = (String[])paramArrayOfString.clone())
{
this.datepatterns = arrayOfString;
this.oneHeader = paramBoolean;
return;
}
}
private BrowserCompatSpec getCompat()
{
if (this.compat == null)
this.compat = new BrowserCompatSpec(this.datepatterns);
return this.compat;
}
private RFC2109Spec getObsoleteStrict()
{
if (this.obsoleteStrict == null)
this.obsoleteStrict = new RFC2109Spec(this.datepatterns, this.oneHeader);
return this.obsoleteStrict;
}
private RFC2965Spec getStrict()
{
if (this.strict == null)
this.strict = new RFC2965Spec(this.datepatterns, this.oneHeader);
return this.strict;
}
public List<Header> formatCookies(List<Cookie> paramList)
{
if (paramList == null)
throw new IllegalArgumentException("List of cookies may not be null");
int i = 2147483647;
int j = 1;
Iterator localIterator = paramList.iterator();
while (true)
{
if (!localIterator.hasNext())
{
if (i <= 0)
break label107;
if (j == 0)
break;
return getStrict().formatCookies(paramList);
}
Cookie localCookie = (Cookie)localIterator.next();
if (!(localCookie instanceof SetCookie2))
j = 0;
if (localCookie.getVersion() < i)
i = localCookie.getVersion();
}
return getObsoleteStrict().formatCookies(paramList);
label107: return getCompat().formatCookies(paramList);
}
public int getVersion()
{
return getStrict().getVersion();
}
public Header getVersionHeader()
{
return getStrict().getVersionHeader();
}
public boolean match(Cookie paramCookie, CookieOrigin paramCookieOrigin)
{
if (paramCookie == null)
throw new IllegalArgumentException("Cookie may not be null");
if (paramCookieOrigin == null)
throw new IllegalArgumentException("Cookie origin may not be null");
if (paramCookie.getVersion() > 0)
{
if ((paramCookie instanceof SetCookie2))
return getStrict().match(paramCookie, paramCookieOrigin);
return getObsoleteStrict().match(paramCookie, paramCookieOrigin);
}
return getCompat().match(paramCookie, paramCookieOrigin);
}
public List<Cookie> parse(Header paramHeader, CookieOrigin paramCookieOrigin)
throws MalformedCookieException
{
if (paramHeader == null)
throw new IllegalArgumentException("Header may not be null");
if (paramCookieOrigin == null)
throw new IllegalArgumentException("Cookie origin may not be null");
HeaderElement[] arrayOfHeaderElement1 = paramHeader.getElements();
int i = 0;
int j = 0;
int k = arrayOfHeaderElement1.length;
int m = 0;
NetscapeDraftHeaderParser localNetscapeDraftHeaderParser;
CharArrayBuffer localCharArrayBuffer;
if (m >= k)
{
if ((j == 0) && (i != 0))
break label245;
localNetscapeDraftHeaderParser = NetscapeDraftHeaderParser.DEFAULT;
if (!(paramHeader instanceof FormattedHeader))
break label183;
localCharArrayBuffer = ((FormattedHeader)paramHeader).getBuffer();
}
for (ParserCursor localParserCursor = new ParserCursor(((FormattedHeader)paramHeader).getValuePos(), localCharArrayBuffer.length()); ; localParserCursor = new ParserCursor(0, localCharArrayBuffer.length()))
{
HeaderElement[] arrayOfHeaderElement2 = new HeaderElement[1];
arrayOfHeaderElement2[0] = localNetscapeDraftHeaderParser.parseHeader(localCharArrayBuffer, localParserCursor);
return getCompat().parse(arrayOfHeaderElement2, paramCookieOrigin);
HeaderElement localHeaderElement = arrayOfHeaderElement1[m];
if (localHeaderElement.getParameterByName("version") != null)
i = 1;
if (localHeaderElement.getParameterByName("expires") != null)
j = 1;
m++;
break;
label183: String str = paramHeader.getValue();
if (str == null)
throw new MalformedCookieException("Header value is null");
localCharArrayBuffer = new CharArrayBuffer(str.length());
localCharArrayBuffer.append(str);
}
label245: if ("Set-Cookie2".equals(paramHeader.getName()))
return getStrict().parse(arrayOfHeaderElement1, paramCookieOrigin);
return getObsoleteStrict().parse(arrayOfHeaderElement1, paramCookieOrigin);
}
public String toString()
{
return "best-match";
}
public void validate(Cookie paramCookie, CookieOrigin paramCookieOrigin)
throws MalformedCookieException
{
if (paramCookie == null)
throw new IllegalArgumentException("Cookie may not be null");
if (paramCookieOrigin == null)
throw new IllegalArgumentException("Cookie origin may not be null");
if (paramCookie.getVersion() > 0)
{
if ((paramCookie instanceof SetCookie2))
{
getStrict().validate(paramCookie, paramCookieOrigin);
return;
}
getObsoleteStrict().validate(paramCookie, paramCookieOrigin);
return;
}
getCompat().validate(paramCookie, paramCookieOrigin);
}
}
/* Location: C:\Programming\Android2Java\FlipdogSpellchecker_dex2jar.jar
* Qualified Name: my.apache.http.impl.cookie.BestMatchSpec
* JD-Core Version: 0.6.2
*/ | [
"deric.walintukan@gmail.com"
] | deric.walintukan@gmail.com |
5010ed4bf12e4f74e5d1666ea1b97c8da9919a6e | c297bfc1dfcb344190525a19fda435b2e23e8c26 | /impexp-core/src/main/java/org/citydb/concurrent/PoolSizeAdaptationStrategy.java | 7d1d70f44e651ea44b356346cdf38af842b34c86 | [
"Apache-2.0",
"LGPL-3.0-only"
] | permissive | StOriJimmy/importer-exporter | c4777c3d5942ba4820ef7f2dd6a344456072ebb0 | f7ac9d33447a61aae0ab499d2b704246e91a9b36 | refs/heads/master | 2020-05-17T18:51:51.057815 | 2019-05-12T02:01:47 | 2019-05-12T02:01:47 | 183,896,422 | 0 | 0 | Apache-2.0 | 2019-05-12T02:01:47 | 2019-04-28T10:58:21 | Java | UTF-8 | Java | false | false | 1,124 | java | /*
* 3D City Database - The Open Source CityGML Database
* http://www.3dcitydb.org/
*
* Copyright 2013 - 2019
* Chair of Geoinformatics
* Technical University of Munich, Germany
* https://www.gis.bgu.tum.de/
*
* The 3D City Database is jointly developed with the following
* cooperation partners:
*
* virtualcitySYSTEMS GmbH, Berlin <http://www.virtualcitysystems.de/>
* M.O.S.S. Computer Grafik Systeme GmbH, Taufkirchen <http://www.moss.de/>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.citydb.concurrent;
public enum PoolSizeAdaptationStrategy {
AGGRESSIVE,
STEPWISE,
NONE
}
| [
"cnagel@virtualcitysystems.de"
] | cnagel@virtualcitysystems.de |
0266fa2739dd4ed5c539ea8a360bfd732edda6c1 | dcd2284c30504dec863d2096cc882ca557957385 | /src/main/java/com/senac/arithomazini/motelbrasil/controller/ClienteController.java | b1104887f6fc33fa677933f7ec934416276cafbf | [] | no_license | rodrigo1523/motelbrasil | 8f5ac486a194c2363e2eee473babeeeb5bb221c9 | 0002a3eb38b96dc57ad6a784a782d435d3f939bf | refs/heads/master | 2022-05-24T10:21:17.450806 | 2020-05-04T23:38:39 | 2020-05-04T23:38:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,353 | java | package com.senac.arithomazini.motelbrasil.controller;
import com.senac.arithomazini.motelbrasil.dao.ClienteDAO;
import com.senac.arithomazini.motelbrasil.model.Cliente;
import com.senac.arithomazini.motelbrasil.model.Motel;
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.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.servlet.ModelAndView;
import java.util.List;
@Controller
public class ClienteController {
@Autowired
private ClienteDAO clienteDAO;
@GetMapping("/clientes")
public ModelAndView clientes(){
List<Cliente> clientes = clienteDAO.findAll();
ModelAndView mv = new ModelAndView("clientes");
mv.addObject("clientesCadastrados", clientes);
return mv;
}
@GetMapping("/cadastroClientes")
public ModelAndView cadastrarCliente(Cliente cliente){
ModelAndView mv = new ModelAndView("cadastro_cliente");
mv.addObject("cliente", cliente);
return mv;
}
@PostMapping("/salvarCliente")
public String salvarCliente(@ModelAttribute Cliente cliente){
clienteDAO.save(cliente);
return "index";
}
}
| [
"ari.thomazini@gmail.com"
] | ari.thomazini@gmail.com |
1be697027fed296cdbdd65d32345bcd0201be5e2 | 5b9dcc28d0a19ac1d18d4a3252187e68df359d71 | /EjerciciosProgramados2/src/soda/Producto.java | db94f292ef96624e4666703c396c172e96fda994 | [] | no_license | APAntony/EjerciciosProgramados2 | 86f8580a251d771fd27e46919d84323a89f200ea | 2168e8fa859cbc159e1d4a34e88f1dfc6c7ff7a6 | refs/heads/main | 2023-05-01T20:46:10.876591 | 2021-05-16T21:15:01 | 2021-05-16T21:15:01 | 365,294,887 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 965 | java | package soda;
/**
*
* @author Antony Artavia
*/
public class Producto {
private String nombre;
private double precio;
private String descripcion;
public Producto(String nombre, double precio, String descripcion) {
this.nombre = nombre;
this.precio = precio;
this.descripcion = descripcion;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public double getPrecio() {
return precio;
}
public void setPrecio(double precio) {
this.precio = precio;
}
public String getDescripcion() {
return descripcion;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
@Override
public String toString() {
return "Producto{" + "nombre: " + nombre + ", precio: " + precio + ", descripcion: " + descripcion + '}';
}
}
| [
"42627754+APAntony@users.noreply.github.com"
] | 42627754+APAntony@users.noreply.github.com |
04eac9638714975b87f7309460e1049fa542b2fd | 9dbfca30b701338ebc1d6063eebf99efd2e14b3e | /ColorImageApp/app/src/test/java/com/example/ash/colorimageapp/ExampleUnitTest.java | 83ceb1a57b7401fb5e1dbc4cc06bbacaa183cf24 | [] | no_license | abusayadhussain/Color-Image-App | fee45cf2fcde594db1f673d4a98abfc796176944 | d3279b888cd9367bfd67d5cdf4075a7207a8b53b | refs/heads/master | 2020-04-07T01:39:17.123322 | 2018-11-17T03:36:15 | 2018-11-17T03:36:15 | 157,947,360 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 390 | java | package com.example.ash.colorimageapp;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"sayed4642@diu.edu.bd"
] | sayed4642@diu.edu.bd |
a806ab04bd1cae64a7d510a4bae0182744204ac0 | 9292e5d7b9cd81c498b0f45b0ba24f246b5ef5f7 | /src/main/java/com/sparrow/pay/exception/VatExceedPriceException.java | b9891362890988dae6b8c3b8ef7acdff952be461 | [] | no_license | jhkim593/PayProject | fec6fa58dc57ac92125955004cfe375ade9bd1cf | b7e0c052f60e93204f660a4855169a6621eb0f4a | refs/heads/master | 2023-09-04T15:53:27.522708 | 2021-10-29T07:02:19 | 2021-10-29T07:02:19 | 417,398,250 | 0 | 0 | null | 2021-10-22T04:28:14 | 2021-10-15T06:58:17 | Java | UTF-8 | Java | false | false | 329 | java | package com.sparrow.pay.exception;
public class VatExceedPriceException extends RuntimeException {
public VatExceedPriceException(String msg, Throwable t) {
super(msg, t);
}
public VatExceedPriceException(String msg) {
super(msg);
}
public VatExceedPriceException() {
super();
}
} | [
"fpdlwjzlr@naver.com"
] | fpdlwjzlr@naver.com |
7b1f140e814538f39e561d8816c1810378e95555 | ccf4e3f5d255db99694258dd5e0b962089fa05df | /ADOPTME/app/src/main/java/com/group9/adoptme/AdMLogin.java | 413e16681496d921ba11dc1f08e001837ac2d46c | [] | no_license | SyrhaShane/CC107_Sat7301230Group9 | 5a1a44aeb3769531f0ab04642b6864fefec15c74 | 314a7d9b902990fb6d1d566d566fab3ec94c7683 | refs/heads/main | 2023-04-05T16:31:54.418601 | 2021-04-12T02:35:29 | 2021-04-12T02:35:29 | 340,727,935 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,139 | java | package com.group9.adoptme;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.HashMap;
import java.util.Map;
import android.os.Bundle;
public class AdMLogin extends AppCompatActivity {
private EditText data_username,
data_password;
private Button button_login;
TextView text_signup;
//private ProgressBar progressBar;
private static String URL ="https://groupadoptme.000webhostapp.com/AdoptMe/login1.php";
SessionManager sessionManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ad_m_login);
sessionManager = new SessionManager( this);
text_signup = findViewById(R.id.textView_signup);
data_username = findViewById(R.id.username);
data_password = findViewById(R.id.password);
button_login = findViewById(R.id.button_login);
text_signup.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent signup = new Intent(AdMLogin.this, AdMRegister.class);
startActivity(signup);
}
});
}
public void login(View view) {
String username = data_username.getText().toString().trim();
String password = data_password.getText().toString().trim();
if(!username.equals("") && !password.equals("")){
StringRequest stringRequest = new StringRequest(Request.Method.POST, URL, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
if (response.equals("success")) {
Intent intent = new Intent(AdMLogin.this, ADMProfile.class);
startActivity(intent);
} else if (response.equals("failure")) {
Toast.makeText(AdMLogin.this, "Invalid Login ID/Password", Toast.LENGTH_SHORT).show();
}
}
}, new Response.ErrorListener(){
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(AdMLogin.this,error.toString().trim(), Toast.LENGTH_SHORT).show();
}
}){
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> data = new HashMap<>();
data.put("username",username);
data.put("password",password);
return data;
}
};
RequestQueue requestQueue = Volley.newRequestQueue(getApplicationContext());
requestQueue.add(stringRequest);
}else{
Toast.makeText(this, "Fields can not be empty!", Toast.LENGTH_SHORT).show();
}
}
public void onBackPressed(){
new AlertDialog.Builder(this)
.setMessage("Close this Application?")
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
})
.setNegativeButton("No", null)
.show();
}
}
| [
"syrhastodomingo@gmail.com"
] | syrhastodomingo@gmail.com |
13d67a5fe1d6c69d6a4203a40e163fa3b22cd672 | ffafb6fee589aa7887bce6c177538988c8148d33 | /oa/src/com/huawei/oa/domain/PageBean.java | 56d0958166499b3a872b09a9e8105aae7fb90aff | [] | no_license | githubhuige/oa | cb73e7d94c633edf07012a48a045299262fe0c98 | 762942615c6aaa355e7aeb4e6417e70a361931b7 | refs/heads/master | 2021-01-10T10:47:04.603264 | 2015-10-28T14:18:49 | 2015-10-28T14:18:49 | 45,117,233 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,475 | java | package com.huawei.oa.domain;
import java.util.List;
public class PageBean {
//通过传递过来的参数或者配置的参数
private int currentPage;//当前页面
private int pageSize;//每页显示多少条记录
//通过查询数据库获取到的
private List recordList;//本页的数据列表
private int recordCount;//总记录数
//通过计算获取到的
private int pageCount;//总页数
private int beginPageIndex;//页码列表的开始索引
private int endPageIndex;//页码列表的结束索引
public PageBean(int currentPage, int pageSize, List recordList,
int recordCount) {
super();
this.currentPage = currentPage;
this.pageSize = pageSize;
this.recordList = recordList;
this.recordCount = recordCount;
//总页数
pageCount = (recordCount + pageSize-1) / pageSize;
//页码列表的开始索引
//页码列表的结束索引
//>>总页数小于或者等于10
if(pageCount <= 10){
beginPageIndex = 1;
endPageIndex = pageCount;
}else{
//>> 总页码大于10页时,就只显示当前页附近的共10个页码
// 默认显示 前4页 + 当前页 + 后5页
beginPageIndex = currentPage - 4;
endPageIndex = currentPage + 5;
//如果前面不足4个,则显示前10个
if(beginPageIndex < 1){
beginPageIndex = 1;
endPageIndex = 10;
}else if(endPageIndex > pageCount){
//如果后面不足5个,则显示后面10个
beginPageIndex = pageCount - 9;
endPageIndex = pageCount;
}
}
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public List getRecordList() {
return recordList;
}
public void setRecordList(List recordList) {
this.recordList = recordList;
}
public int getRecordCount() {
return recordCount;
}
public void setRecordCount(int recordCount) {
this.recordCount = recordCount;
}
public int getPageCount() {
return pageCount;
}
public void setPageCount(int pageCount) {
this.pageCount = pageCount;
}
public int getBeginPageIndex() {
return beginPageIndex;
}
public void setBeginPageIndex(int beginPageIndex) {
this.beginPageIndex = beginPageIndex;
}
public int getEndPageIndex() {
return endPageIndex;
}
public void setEndPageIndex(int endPageIndex) {
this.endPageIndex = endPageIndex;
}
}
| [
"3240357319@qq.com"
] | 3240357319@qq.com |
b0f6009cf177aba73f71daf471232f384241a5ea | 1ebd084ab2e6a43c31212ce74341fc52919081d9 | /materialtab/src/at/markushi/ui/RevealColorView.java | 1a554b8db21daf364a749fc33b679f39ba8615e2 | [
"Apache-2.0"
] | permissive | shengyuemao/LouJiReader | 896db85168d4d29108c46130b44feab7c4a5363c | fd29addb0d17bc7386be9dbc6df729a5e7df60cc | refs/heads/master | 2021-01-06T20:37:04.556330 | 2015-11-03T07:53:14 | 2015-11-03T07:53:14 | 35,618,594 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,485 | java | package at.markushi.ui;
import it.neokree.materialtabtest.R;
import android.animation.Animator;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.OvalShape;
import android.os.Build;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewPropertyAnimator;
import at.markushi.ui.util.BakedBezierInterpolator;
import at.markushi.ui.util.UiHelper;
public class RevealColorView extends ViewGroup {
public static final int ANIMATION_REVEAL = 0;
public static final int ANIMATION_HIDE = 2;
private static final float SCALE = 8f;
private View inkView;
private int inkColor;
private ShapeDrawable circle;
private ViewPropertyAnimator animator;
public RevealColorView(Context context) {
this(context, null);
}
public RevealColorView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public RevealColorView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
if (isInEditMode()) {
return;
}
inkView = new View(context);
addView(inkView);
circle = new ShapeDrawable(new OvalShape());
UiHelper.setBackground(inkView, circle);
inkView.setVisibility(View.INVISIBLE);
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
inkView.layout(left, top, left + inkView.getMeasuredWidth(), top + inkView.getMeasuredHeight());
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
final int width = MeasureSpec.getSize(widthMeasureSpec);
final int height = MeasureSpec.getSize(heightMeasureSpec);
setMeasuredDimension(width, height);
final float circleSize = (float) Math.sqrt(width * width + height * height) * 2f;
final int size = (int) (circleSize / SCALE);
final int sizeSpec = MeasureSpec.makeMeasureSpec(size, MeasureSpec.EXACTLY);
inkView.measure(sizeSpec, sizeSpec);
}
public void reveal(final int x, final int y, final int color, Animator.AnimatorListener listener) {
final int duration = getResources().getInteger(R.integer.rcv_animationDurationReveal);
reveal(x, y, color, 0, duration, listener);
}
public void reveal(final int x, final int y, final int color, final int startRadius, long duration, final Animator.AnimatorListener listener) {
if (color == inkColor) {
return;
}
inkColor = color;
if (animator != null) {
animator.cancel();
}
circle.getPaint().setColor(color);
inkView.setVisibility(View.VISIBLE);
final float startScale = startRadius * 2f / inkView.getHeight();
final float finalScale = calculateScale(x, y) * SCALE;
prepareView(inkView, x, y, startScale);
animator = inkView.animate().scaleX(finalScale).scaleY(finalScale).setDuration(duration).setListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
if (listener != null) {
listener.onAnimationStart(animator);
}
}
@Override
public void onAnimationEnd(Animator animation) {
setBackgroundColor(color);
inkView.setVisibility(View.INVISIBLE);
if (listener != null) {
listener.onAnimationEnd(animation);
}
}
@Override
public void onAnimationCancel(Animator animator) {
if (listener != null) {
listener.onAnimationCancel(animator);
}
}
@Override
public void onAnimationRepeat(Animator animator) {
if (listener != null) {
listener.onAnimationRepeat(animator);
}
}
});
prepareAnimator(animator, ANIMATION_REVEAL);
animator.start();
}
public void hide(final int x, final int y, final int color, final Animator.AnimatorListener listener) {
final int duration = getResources().getInteger(R.integer.rcv_animationDurationHide);
hide(x, y, color, 0, duration, listener);
}
public void hide(final int x, final int y, final int color, final int endRadius, final long duration, final Animator.AnimatorListener listener) {
inkColor = Color.TRANSPARENT;
if (animator != null) {
animator.cancel();
}
inkView.setVisibility(View.VISIBLE);
setBackgroundColor(color);
final float startScale = calculateScale(x, y) * SCALE;
final float finalScale = endRadius * SCALE / inkView.getWidth();
prepareView(inkView, x, y, startScale);
animator = inkView.animate().scaleX(finalScale).scaleY(finalScale).setDuration(duration).setListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
if (listener != null) {
listener.onAnimationStart(animator);
}
}
@Override
public void onAnimationEnd(Animator animation) {
inkView.setVisibility(View.INVISIBLE);
if (listener != null) {
listener.onAnimationEnd(animation);
}
}
@Override
public void onAnimationCancel(Animator animator) {
if (listener != null) {
listener.onAnimationCancel(animator);
}
}
@Override
public void onAnimationRepeat(Animator animator) {
if (listener != null) {
listener.onAnimationRepeat(animator);
}
}
});
prepareAnimator(animator, ANIMATION_HIDE);
animator.start();
}
@SuppressLint("NewApi")
public ViewPropertyAnimator prepareAnimator(ViewPropertyAnimator animator, int type) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
animator.withLayer();
}
animator.setInterpolator(BakedBezierInterpolator.getInstance());
return animator;
}
private void prepareView(View view, int x, int y, float scale) {
final int centerX = (view.getWidth() / 2);
final int centerY = (view.getHeight() / 2);
view.setTranslationX(x - centerX);
view.setTranslationY(y - centerY);
view.setPivotX(centerX);
view.setPivotY(centerY);
view.setScaleX(scale);
view.setScaleY(scale);
}
/**
* calculates the required scale of the ink-view to fill the whole view
*
* @param x circle center x
* @param y circle center y
* @return
*/
private float calculateScale(int x, int y) {
final float centerX = getWidth() / 2f;
final float centerY = getHeight() / 2f;
final float maxDistance = (float) Math.sqrt(centerX * centerX + centerY * centerY);
final float deltaX = centerX - x;
final float deltaY = centerY - y;
final float distance = (float) Math.sqrt(deltaX * deltaX + deltaY * deltaY);
final float scale = 0.5f + (distance / maxDistance) * 0.5f;
return scale;
}
} | [
"shengshidaxia@163.com"
] | shengshidaxia@163.com |
374689633307a2684ff45919410c5de77543133c | 44e7adc9a1c5c0a1116097ac99c2a51692d4c986 | /aws-java-sdk-dataexchange/src/main/java/com/amazonaws/services/dataexchange/model/State.java | cdb273d26fb46b094932a3bbae7568dce9170745 | [
"Apache-2.0"
] | permissive | QiAnXinCodeSafe/aws-sdk-java | f93bc97c289984e41527ae5bba97bebd6554ddbe | 8251e0a3d910da4f63f1b102b171a3abf212099e | refs/heads/master | 2023-01-28T14:28:05.239019 | 2020-12-03T22:09:01 | 2020-12-03T22:09:01 | 318,460,751 | 1 | 0 | Apache-2.0 | 2020-12-04T10:06:51 | 2020-12-04T09:05:03 | null | UTF-8 | Java | false | false | 1,840 | java | /*
* Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.dataexchange.model;
import javax.annotation.Generated;
/**
*
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public enum State {
WAITING("WAITING"),
IN_PROGRESS("IN_PROGRESS"),
ERROR("ERROR"),
COMPLETED("COMPLETED"),
CANCELLED("CANCELLED"),
TIMED_OUT("TIMED_OUT");
private String value;
private State(String value) {
this.value = value;
}
@Override
public String toString() {
return this.value;
}
/**
* Use this in place of valueOf.
*
* @param value
* real value
* @return State corresponding to the value
*
* @throws IllegalArgumentException
* If the specified value does not map to one of the known values in this enum.
*/
public static State fromValue(String value) {
if (value == null || "".equals(value)) {
throw new IllegalArgumentException("Value cannot be null or empty!");
}
for (State enumEntry : State.values()) {
if (enumEntry.toString().equals(value)) {
return enumEntry;
}
}
throw new IllegalArgumentException("Cannot create enum from " + value + " value!");
}
}
| [
""
] | |
1e9b82e9c7e4201f83da1fb8016a00470c0f14eb | b6afe059d82b4f6a15cb14b34ac5b05531a879d9 | /Problems/Desks/src/Main.java | 031ca0989f4789e5326e6c53bddca93b1d39d6a3 | [
"MIT"
] | permissive | batetolast1/Hyperskill | f82e4cd751a981fbf6cf968879482a07e4094e51 | 310f3bd38ecdf94f387178823ac2824bab100526 | refs/heads/master | 2022-11-30T12:15:05.810025 | 2020-07-25T16:24:12 | 2020-07-25T16:24:12 | 277,817,082 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 443 | java | import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
// put your code here
int sum = 0;
for (int i = 0; i < 3; i++) {
int c = scanner.nextInt();
if (c % 2 == 0) {
sum += c / 2;
} else {
sum += c / 2 + 1;
}
}
System.out.println(sum);
}
} | [
"batetolast1@gmail.com"
] | batetolast1@gmail.com |
efa27eff0bc9d1b03b7699ceb1454d9b69fa4352 | 6a0f08b0ce01c7f513077de4ad03e4378512aed3 | /app/src/main/java/com/example/com/myapplication/contentprovider/MyProvider.java | 6eef47bd2719f8c3639b67782282182bd1bff49a | [] | no_license | genvay/MyApplication | a7c4caf0deed46923f3c18fc69432f986e791cfe | 8ef5dbbdf42f509a554df589e1370b380f247cdd | refs/heads/master | 2021-01-22T18:23:08.660456 | 2015-08-07T11:56:19 | 2015-08-07T11:56:19 | 39,023,118 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,264 | java | package com.example.com.myapplication.contentprovider;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.net.Uri;
/**
* Created by majingwei on 2015/7/30.
*/
public class MyProvider extends ContentProvider {
public static final int TABLE1_DIR = 0;
public static final int TABLE1_ITEM = 1;
public static final int TABLE2_DIR = 2;
public static final int TABLE2_ITEM = 3;
private static UriMatcher uriMatcher;
static {
uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
uriMatcher.addURI("com.example.com.myapplication.provider", "table1", TABLE1_DIR);
uriMatcher.addURI("com.example.com.myapplication.provider", "table1/#", TABLE1_ITEM);
uriMatcher.addURI("com.example.com.myapplication.provider", "table2", TABLE2_DIR);
uriMatcher.addURI("com.example.com.myapplication.provider", "table2/#", TABLE2_ITEM);
}
@Override
public boolean onCreate() {
return false;
}
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
return null;
}
@Override
public Uri insert(Uri uri, ContentValues values) {
return null;
}
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
return 0;
}
@Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
return 0;
}
@Override
public String getType(Uri uri) {
switch (uriMatcher.match(uri)) {
case TABLE1_DIR:
return "vnd.android.cursor.dir/vnd.com.example.com.myapplication.provider.table1";
case TABLE1_ITEM:
return "vnd.android.cursor.item/vnd.com.example.com.myapplication.provider.table1";
case TABLE2_DIR:
return "vnd.android.cursor.dir/vnd.com.example.com.myapplication.provider.table2";
case TABLE2_ITEM:
return "vnd.android.cursor.item/vnd.com.example.com.myapplication.provider.table2";
default:
break;
}
return null;
}
}
| [
"genvay.ma@gmail.com"
] | genvay.ma@gmail.com |
aa1f3192437a6dc31aa07ecaa764102d8f6a4530 | 51d4440d4268ee5041de44525d9546d7f325601c | /javaiii-module2-part2-vasyatech/src/GuestBook/ContactViewController.java | b7c38e7a50bfb017c123d7f5f91ea7af469f1a88 | [] | no_license | vasyatech/ucsd-java3 | b7ca9822019c0fc3a4b5978ff625efe393810078 | bf57c1b5f9fcb73048a7dd2a9b20b3a67fadac82 | refs/heads/main | 2023-07-13T14:46:19.050769 | 2021-08-19T01:37:36 | 2021-08-19T01:37:36 | 397,777,843 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,507 | java | package GuestBook;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Collections;
import javax.swing.*;
public class ContactViewController implements ActionListener{
private JTextArea textArea = new JTextArea(6, 25);
private JTextField firstNameTextField = new JTextField(20);
private JTextField lastNameTextField = new JTextField(20);
private JTextField addressNameTextField = new JTextField(20);
private JTextField phoneNameTextField = new JTextField(20);
private JButton button = new JButton("Submit");
private ArrayList<Contact> contacts = new ArrayList<Contact>();
public ContactViewController() {
super();
show();
}
public void show() {
JFrame frame = new JFrame();
JLabel firstNameLabel = new JLabel("First Name");
JLabel lastNameLabel = new JLabel("Last Name");
JLabel addressLabel = new JLabel("Address");
JLabel phoneLabel = new JLabel("Phone");
button.addActionListener(this);
frame.setResizable(false);
JPanel leftPanel = new JPanel();
JPanel rightPanel = new JPanel();
frame.add(leftPanel);
frame.add(rightPanel);
frame.setLayout(new GridLayout(0,2));
leftPanel.setLayout(new GridBagLayout());
leftPanel.setBackground(UIManager.getColor("control"));
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = GridBagConstraints.RELATIVE;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.insets = new Insets(2, 2, 2, 2);
gbc.anchor = GridBagConstraints.EAST;
leftPanel.add(firstNameLabel, gbc);
leftPanel.add(lastNameLabel, gbc);
leftPanel.add(addressLabel, gbc);
leftPanel.add(phoneLabel, gbc);
gbc.gridx = 1;
gbc.gridy = 0;
gbc.weightx = 1.0;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.CENTER;
leftPanel.add(firstNameTextField, gbc);
gbc.gridx = 1;
gbc.gridy = GridBagConstraints.RELATIVE;
leftPanel.add(lastNameTextField, gbc);
leftPanel.add(addressNameTextField, gbc);
leftPanel.add(phoneNameTextField, gbc);
gbc.weightx = 0.0;
gbc.fill = GridBagConstraints.NONE;
leftPanel.add(button, gbc);
textArea.setEditable(false);
rightPanel.add(textArea);
JScrollPane scrollPane = new JScrollPane (textArea,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
rightPanel.add(scrollPane);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e){
Contact contact;
if(e.getSource()==button){
if (firstNameTextField.getText().isEmpty()) {
JOptionPane.showMessageDialog(firstNameTextField, "First Name required");
return;
}
contact = new Contact(firstNameTextField.getText(),
lastNameTextField.getText(),
addressNameTextField.getText(),
phoneNameTextField.getText());
for (Contact c : contacts) {
if (c.getContact().equals(contact.getContact())) {
JOptionPane.showMessageDialog(null, "A duplicate contact cannot be submitted");
return;
}
}
contacts.add(contact);
Collections.sort(contacts);
firstNameTextField.setText("");
lastNameTextField.setText("");
addressNameTextField.setText("");
phoneNameTextField.setText("");
textArea.setText("");
for (Contact c : contacts) {
textArea.append(c.getContact());
}
}
}
}
| [
"vastar@users.noreply.github.com"
] | vastar@users.noreply.github.com |
2bc8a417bd698dfaaba350bfe9e8025f1a5d2c70 | c2544543fe7fa96b805bfb1bdff80e9197cf71ce | /services/classicmodels/src/com/testingprocedurecombinations/classicmodels/models/procedure/ProcedureInInoutOutResponse.java | b644f73eca6d83f85f8f608e16e4c1d4af3e0b75 | [] | no_license | Sushma-M/ProcedureCombinations_9_0_0_1 | 5a5f34f0b2bac9157be35c0abf0c9935278743dd | 6f6be91182c2e74c8b05f2fef35baf17c9a03cc4 | refs/heads/master | 2020-03-29T05:30:52.323893 | 2018-09-20T09:39:42 | 2018-09-20T09:39:42 | 149,585,243 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,838 | java | /*Copyright (c) 2016-2017 wavemaker.com All Rights Reserved.
This software is the confidential and proprietary information of wavemaker.com You shall not disclose such Confidential Information and shall use it only in accordance
with the terms of the source code license agreement you entered into with wavemaker.com*/
package com.testingprocedurecombinations.classicmodels.models.procedure;
/*This is a Studio Managed File. DO NOT EDIT THIS FILE. Your changes may be reverted by Studio.*/
import java.io.Serializable;
import java.sql.Date;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.wavemaker.runtime.data.annotations.ColumnAlias;
public class ProcedureInInoutOutResponse implements Serializable {
@JsonProperty("ordNumber")
@ColumnAlias("ordNumber")
private Integer ordNumber;
@JsonProperty("shipDate")
@ColumnAlias("shipDate")
private Date shipDate;
public Integer getOrdNumber() {
return this.ordNumber;
}
public void setOrdNumber(Integer ordNumber) {
this.ordNumber = ordNumber;
}
public Date getShipDate() {
return this.shipDate;
}
public void setShipDate(Date shipDate) {
this.shipDate = shipDate;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof ProcedureInInoutOutResponse)) return false;
final ProcedureInInoutOutResponse procedureInInoutOutResponse = (ProcedureInInoutOutResponse) o;
return Objects.equals(getOrdNumber(), procedureInInoutOutResponse.getOrdNumber()) &&
Objects.equals(getShipDate(), procedureInInoutOutResponse.getShipDate());
}
@Override
public int hashCode() {
return Objects.hash(getOrdNumber(),
getShipDate());
}
}
| [
"imtiyaz.mohammad@wavemaker.com"
] | imtiyaz.mohammad@wavemaker.com |
eeff1b2f76e05e3c96eab9954454089a7f6544db | b83c23dfe7475a9e4f873623f89057a680b68430 | /src/main/java/com/bullhornsdk/data/model/entity/core/customobjectinstances/opportunity/OpportunityCustomObjectInstance.java | 4c3a751d3e82f212a04738c865c70fd574da0fec | [
"MIT"
] | permissive | bullhorn/sdk-rest | facb49ef476b10298b96e996dfce3c4dd44a8736 | 8137396440e6eb155574bdbefb4df8866b79e25c | refs/heads/master | 2023-08-23T11:42:44.276572 | 2023-08-08T18:27:17 | 2023-08-08T18:27:17 | 35,240,105 | 41 | 52 | MIT | 2023-09-07T19:50:41 | 2015-05-07T19:46:25 | Java | UTF-8 | Java | false | false | 562 | java | package com.bullhornsdk.data.model.entity.core.customobjectinstances.opportunity;
import com.bullhornsdk.data.model.entity.core.customobjectinstances.CustomObjectInstance;
import com.bullhornsdk.data.model.entity.core.standard.Opportunity;
public abstract class OpportunityCustomObjectInstance extends CustomObjectInstance {
private Opportunity opportunity;
public Opportunity getOpportunity() {
return opportunity;
}
public void setOpportunity(Opportunity opportunity) {
this.opportunity = opportunity;
}
}
| [
"rmcdole@bullhorn.com"
] | rmcdole@bullhorn.com |
bf97887e1c250e43bc1581bc8aabcff37e4f4503 | 51a1c3ede1c78b1559523ae1dff7c138e5247c26 | /Java/Array_to_Map.java | dd4eee4dac21e4734137be97fba7eb257cda2af6 | [] | no_license | asenin/Code-Bits | 34098bf24730cbbfec372cc7f13a6e4d4b07b2ee | f070cb7d963fdee6d348b2584ea5faf3c36939d4 | refs/heads/main | 2023-05-12T07:44:59.453748 | 2021-06-04T09:16:02 | 2021-06-04T09:16:02 | 373,770,744 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 533 | java | import java.util.Map;
import org.apache.commons.lang.ArrayUtils;
public class Main {
public static void main(String[] args) {
String[][] countries = { { "United States", "New York" }, { "United Kingdom", "London" },
{ "Netherland", "Amsterdam" }, { "Japan", "Tokyo" }, { "France", "Paris" } };
Map countryCapitals = ArrayUtils.toMap(countries);
System.out.println("Capital of Japan is " + countryCapitals.get("Japan"));
System.out.println("Capital of France is " + countryCapitals.get("France"));
}
}
| [
"noreply@github.com"
] | noreply@github.com |
305cce94a4c0aa8512a33ec539bd12a3a602901c | c571479b5dfea6891ca6e0eed66293ff7cd843f7 | /ShoppingList/app/src/main/java/fi/jamk/shoppinglist/ShoppingListDatabaseOpenHelper.java | b5683c3defb84b0eb7631e1dd7a83d796f629d83 | [] | no_license | littlesun16997/android | 1623f2e971bc8c699299c69bb210aa219b5960c1 | eb0eeea1375f9ea0228e9e138f9ca078e06c86e2 | refs/heads/master | 2020-03-28T13:04:21.975929 | 2018-09-11T18:42:42 | 2018-09-11T18:42:42 | 148,363,112 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 842 | java | package fi.jamk.shoppinglist;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class ShoppingListDatabaseOpenHelper extends SQLiteOpenHelper {
private static final String DATABASE_NAME = "shoppinglisttable.db";
private static final int DATABASE_VERSION = 1;
// Constructor
public ShoppingListDatabaseOpenHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
// database creation
@Override
public void onCreate(SQLiteDatabase database) {
ShoppingListDatabase.onCreate(database);
}
// database upgrade
public void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) {
ShoppingListDatabase.onUpgrade(database, oldVersion, newVersion);
}
} | [
"L8445@student.jamk.fi"
] | L8445@student.jamk.fi |
209e5afb1c371cce9f4da92d29b9292ad7b886ef | e977c424543422f49a25695665eb85bfc0700784 | /benchmark/icse15/429856/buggy-version/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java | b08872d180abc020c1ffa8029bd694f192fc17c2 | [] | no_license | amir9979/pattern-detector-experiment | 17fcb8934cef379fb96002450d11fac62e002dd3 | db67691e536e1550245e76d7d1c8dced181df496 | refs/heads/master | 2022-02-18T10:24:32.235975 | 2019-09-13T15:42:55 | 2019-09-13T15:42:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 32,403 | java | /*
Derby - Class org.apache.derby.iapi.types.DataTypeDescriptor
Copyright 1999, 2004 The Apache Software Foundation or its licensors, as applicable.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.apache.derby.iapi.types;
import org.apache.derby.iapi.services.io.Formatable;
import org.apache.derby.iapi.error.StandardException;
import org.apache.derby.iapi.services.loader.ClassFactory;
import org.apache.derby.catalog.TypeDescriptor;
import org.apache.derby.catalog.types.TypeDescriptorImpl;
import org.apache.derby.iapi.services.sanity.SanityManager;
import org.apache.derby.iapi.services.io.StoredFormatIds;
import org.apache.derby.iapi.services.io.FormatIdUtil;
import org.apache.derby.iapi.services.io.Formatable;
import org.apache.derby.iapi.error.StandardException;
import org.apache.derby.iapi.types.RowLocation;
import org.apache.derby.iapi.services.loader.ClassFactory;
import org.apache.derby.iapi.services.loader.ClassInspector;
import org.apache.derby.iapi.reference.SQLState;
import java.io.ObjectOutput;
import java.io.ObjectInput;
import java.io.IOException;
import java.sql.Types;
/**
* This is an implementation of DataTypeDescriptor from the generic language
* datatype module interface.
*
* @author Jeff Lichtman
* @version 1.0
*/
public final class DataTypeDescriptor implements TypeDescriptor, Formatable
{
/********************************************************
**
** This class implements Formatable. That means that it
** can write itself to and from a formatted stream. If
** you add more fields to this class, make sure that you
** also write/read them with the writeExternal()/readExternal()
** methods.
**
** If, inbetween releases, you add more fields to this class,
** then you should bump the version number emitted by the getTypeFormatId()
** method.
**
********************************************************/
/*
** Static creators
*/
/**
* Get a descriptor that corresponds to a builtin JDBC type.
*
* @param jdbcType The int type of the JDBC type for which to get
* a corresponding SQL DataTypeDescriptor
*
* @return A new DataTypeDescriptor that corresponds to the Java type.
* A null return value means there is no corresponding SQL type
*/
public static DataTypeDescriptor getBuiltInDataTypeDescriptor
(
int jdbcType
)
{
return DataTypeDescriptor.getBuiltInDataTypeDescriptor(jdbcType, true);
}
public static DataTypeDescriptor getBuiltInDataTypeDescriptor
(
int jdbcType,
int length
)
{
return DataTypeDescriptor.getBuiltInDataTypeDescriptor(jdbcType, true, length);
}
/**
* Get a descriptor that corresponds to a builtin JDBC type.
*
* @param jdbcType The int type of the JDBC type for which to get
* a corresponding SQL DataTypeDescriptor
* @param isNullable TRUE means it could contain NULL, FALSE means
* it definitely cannot contain NULL.
*
* @return A new DataTypeDescriptor that corresponds to the Java type.
* A null return value means there is no corresponding SQL type
*/
public static DataTypeDescriptor getBuiltInDataTypeDescriptor
(
int jdbcType,
boolean isNullable
)
{
TypeId typeId = TypeId.getBuiltInTypeId(jdbcType);
if (typeId == null)
{
return null;
}
return new DataTypeDescriptor(typeId, isNullable);
}
/**
* Get a descriptor that corresponds to a builtin JDBC type.
*
* @param jdbcType The int type of the JDBC type for which to get
* a corresponding SQL DataTypeDescriptor
* @param isNullable TRUE means it could contain NULL, FALSE means
* it definitely cannot contain NULL.
*
* @return A new DataTypeDescriptor that corresponds to the Java type.
* A null return value means there is no corresponding SQL type
*/
public static DataTypeDescriptor getBuiltInDataTypeDescriptor
(
int jdbcType,
boolean isNullable,
int maxLength
)
{
TypeId typeId = TypeId.getBuiltInTypeId(jdbcType);
if (typeId == null)
{
return null;
}
return new DataTypeDescriptor(typeId, isNullable, maxLength);
}
/**
* Get a DataTypeServices that corresponds to a builtin SQL type
*
* @param sqlTypeName The name of the type for which to get
* a corresponding SQL DataTypeDescriptor
*
* @return A new DataTypeDescriptor that corresponds to the Java type.
* A null return value means there is no corresponding SQL type (only for 'char')
*/
public static DataTypeDescriptor getBuiltInDataTypeDescriptor
(
String sqlTypeName
)
{
return new DataTypeDescriptor(TypeId.getBuiltInTypeId(sqlTypeName), true);
}
/**
* Get a DataTypeServices that corresponds to a builtin SQL type
*
* @param sqlTypeName The name of the type for which to get
* a corresponding SQL DataTypeDescriptor
*
* @return A new DataTypeDescriptor that corresponds to the Java type.
* A null return value means there is no corresponding SQL type (only for 'char')
*/
public static DataTypeDescriptor getBuiltInDataTypeDescriptor
(
String sqlTypeName,
int length
)
{
return new DataTypeDescriptor(TypeId.getBuiltInTypeId(sqlTypeName), true, length);
}
/**
* Get a DataTypeServices that corresponds to a Java type
*
* @param javaTypeName The name of the Java type for which to get
* a corresponding SQL DataTypeDescriptor
*
* @return A new DataTypeDescriptor that corresponds to the Java type.
* A null return value means there is no corresponding SQL type (only for 'char')
*/
public static DataTypeDescriptor getSQLDataTypeDescriptor
(
String javaTypeName
)
{
return DataTypeDescriptor.getSQLDataTypeDescriptor(javaTypeName, true);
}
/**
* Get a DataTypeServices that corresponds to a Java type
*
* @param javaTypeName The name of the Java type for which to get
* a corresponding SQL DataTypeDescriptor
* @param isNullable TRUE means it could contain NULL, FALSE means
* it definitely cannot contain NULL.
*
* @return A new DataTypeDescriptor that corresponds to the Java type.
* A null return value means there is no corresponding SQL type (only for 'char')
*/
public static DataTypeDescriptor getSQLDataTypeDescriptor
(
String javaTypeName,
boolean isNullable
)
{
TypeId typeId = TypeId.getSQLTypeForJavaType(javaTypeName);
if (typeId == null)
{
return null;
}
return new DataTypeDescriptor(typeId, isNullable);
}
/**
* Get a DataTypeDescriptor that corresponds to a Java type
*
* @param javaTypeName The name of the Java type for which to get
* a corresponding SQL DataTypeDescriptor
* @param precision The number of decimal digits
* @param scale The number of digits after the decimal point
* @param isNullable TRUE means it could contain NULL, FALSE means
* it definitely cannot contain NULL.
* @param maximumWidth The maximum width of a data value
* represented by this type.
*
* @return A new DataTypeDescriptor that corresponds to the Java type.
* A null return value means there is no corresponding SQL type.
*/
public static DataTypeDescriptor getSQLDataTypeDescriptor
(
String javaTypeName,
int precision,
int scale,
boolean isNullable,
int maximumWidth
)
{
TypeId typeId = TypeId.getSQLTypeForJavaType(javaTypeName);
if (typeId == null)
{
return null;
}
return new DataTypeDescriptor(typeId,
precision,
scale,
isNullable,
maximumWidth);
}
/*
** Instance fields & methods
*/
private TypeDescriptorImpl typeDescriptor;
private TypeId typeId;
/**
* Public niladic constructor. Needed for Formatable interface to work.
*
*/
public DataTypeDescriptor() {}
/**
* Constructor for use with numeric types
*
* @param typeId The typeId of the type being described
* @param precision The number of decimal digits.
* @param scale The number of digits after the decimal point.
* @param isNullable TRUE means it could contain NULL, FALSE means
* it definitely cannot contain NULL.
* @param maximumWidth The maximum number of bytes for this datatype
*/
public DataTypeDescriptor(TypeId typeId, int precision, int scale,
boolean isNullable, int maximumWidth)
{
this.typeId = typeId;
typeDescriptor = new TypeDescriptorImpl(typeId.getBaseTypeId(),
precision,
scale,
isNullable,
maximumWidth);
}
/**
* Constructor for use with non-numeric types
*
* @param typeId The typeId of the type being described
* @param isNullable TRUE means it could contain NULL, FALSE means
* it definitely cannot contain NULL.
* @param maximumWidth The maximum number of bytes for this datatype
*/
public DataTypeDescriptor(TypeId typeId, boolean isNullable,
int maximumWidth)
{
this.typeId = typeId;
typeDescriptor = new TypeDescriptorImpl(typeId.getBaseTypeId(),
isNullable,
maximumWidth);
}
public DataTypeDescriptor(TypeId typeId, boolean isNullable) {
this.typeId = typeId;
typeDescriptor = new TypeDescriptorImpl(typeId.getBaseTypeId(),
typeId.getMaximumPrecision(),
typeId.getMaximumScale(),
isNullable,
typeId.getMaximumMaximumWidth());
}
public DataTypeDescriptor(DataTypeDescriptor source, boolean isNullable)
{
this.typeId = source.typeId;
typeDescriptor = new TypeDescriptorImpl(source.typeDescriptor,
source.getPrecision(),
source.getScale(),
isNullable,
source.getMaximumWidth());
}
/**
* Constructor for internal uses only.
* (This is useful when the precision and scale are potentially wider than
* those in the source, like when determining the dominant data type.)
*
* @param source The DTSI to copy
* @param precision The number of decimal digits.
* @param scale The number of digits after the decimal point.
* @param isNullable TRUE means it could contain NULL, FALSE means
* it definitely cannot contain NULL.
* @param maximumWidth The maximum number of bytes for this datatype
*/
public DataTypeDescriptor(DataTypeDescriptor source,
int precision,
int scale,
boolean isNullable,
int maximumWidth)
{
this.typeId = source.typeId;
typeDescriptor = new TypeDescriptorImpl(source.typeDescriptor,
precision,
scale,
isNullable,
maximumWidth);
}
/**
* Constructor for internal uses only
*
* @param source The DTSI to copy
* @param isNullable TRUE means it could contain NULL, FALSE means
* it definitely cannot contain NULL.
* @param maximumWidth The maximum number of bytes for this datatype
*/
public DataTypeDescriptor(DataTypeDescriptor source, boolean isNullable,
int maximumWidth)
{
this.typeId = source.typeId;
typeDescriptor = new TypeDescriptorImpl(source.typeDescriptor,
isNullable,
maximumWidth);
}
/**
* Constructor for use in reconstructing a DataTypeDescriptor from a
* TypeDescriptorImpl and a TypeId
*
* @param source The TypeDescriptorImpl to construct this DTSI from
*/
public DataTypeDescriptor(TypeDescriptorImpl source, TypeId typeId)
{
typeDescriptor = source;
this.typeId = typeId;;
}
/* DataTypeDescriptor Interface */
public DataValueDescriptor normalize(DataValueDescriptor source,
DataValueDescriptor cachedDest)
throws StandardException
{
if (SanityManager.DEBUG) {
if (cachedDest != null) {
if (!getTypeId().isUserDefinedTypeId()) {
String t1 = getTypeName();
String t2 = cachedDest.getTypeName();
if (!t1.equals(t2)) {
if (!(((t1.equals("DECIMAL") || t1.equals("NUMERIC"))
&& (t2.equals("DECIMAL") || t2.equals("NUMERIC"))) ||
(t1.startsWith("INT") && t2.startsWith("INT")))) //INT/INTEGER
SanityManager.THROWASSERT(
"Normalization of " + t2 + " being asked to convert to " + t1);
}
}
}
}
if (source.isNull())
{
if (!isNullable())
throw StandardException.newException(SQLState.LANG_NULL_INTO_NON_NULL,"");
if (cachedDest == null)
cachedDest = getNull();
else
cachedDest.setToNull();
} else {
if (cachedDest == null)
cachedDest = getNull();
int jdbcId = getJDBCTypeId();
cachedDest.normalize(this, source);
//doing the following check after normalize so that normalize method would get called on long varchs and long varbinary
//Need normalize to be called on long varchar for bug 5592 where we need to enforce a lenght limit in db2 mode
if ((jdbcId == Types.LONGVARCHAR) || (jdbcId == Types.LONGVARBINARY)) {
// special case for possible streams
if (source.getClass() == cachedDest.getClass())
return source;
}
}
return cachedDest;
}
/**
* Get the dominant type (DataTypeDescriptor) of the 2.
* For variable length types, the resulting type will have the
* biggest max length of the 2.
* If either side is nullable, then the result will also be nullable.
*
* @param otherDTS DataTypeDescriptor to compare with.
* @param cf A ClassFactory
*
* @return DataTypeDescriptor DTS for dominant type
*
* @exception StandardException Thrown on error
*/
public DataTypeDescriptor getDominantType(DataTypeDescriptor otherDTS, ClassFactory cf)
throws StandardException
{
boolean nullable;
TypeId thisType;
TypeId otherType;
DataTypeDescriptor higherType = null;
DataTypeDescriptor lowerType = null;
int maximumWidth;
int precision = getPrecision();
int scale = getScale();
thisType = getTypeId();
otherType = otherDTS.getTypeId();
/* The result is nullable if either side is nullable */
nullable = isNullable() || otherDTS.isNullable();
/*
** The result will have the maximum width of both sides
*/
maximumWidth = (getMaximumWidth() > otherDTS.getMaximumWidth())
? getMaximumWidth() : otherDTS.getMaximumWidth();
/* We need 2 separate methods of determining type dominance - 1 if both
* types are system built-in types and the other if at least 1 is
* a user type. (typePrecedence is meaningless for user types.)
*/
if (!thisType.userType() && !otherType.userType())
{
TypeId higherTypeId;
TypeId lowerTypeId;
if (thisType.typePrecedence() > otherType.typePrecedence())
{
higherType = this;
lowerType = otherDTS;
higherTypeId = thisType;
lowerTypeId = otherType;
}
else
{
higherType = otherDTS;
lowerType = this;
higherTypeId = otherType;
lowerTypeId = thisType;
}
//Following is checking if higher type argument is real and other argument is decimal/bigint/integer/smallint,
//then result type should be double
if (higherTypeId.isRealTypeId() && (!lowerTypeId.isRealTypeId()) && lowerTypeId.isNumericTypeId())
{
higherType = DataTypeDescriptor.getBuiltInDataTypeDescriptor(Types.DOUBLE);
higherTypeId = TypeId.getBuiltInTypeId(Types.DOUBLE);
}
/*
** If we have a DECIMAL/NUMERIC we have to do some
** extra work to make sure the resultant type can
** handle the maximum values for the two input
** types. We cannot just take the maximum for
** precision. E.g. we want something like:
**
** DEC(10,10) and DEC(3,0) => DEC(13,10)
**
** (var)char type needs some conversion handled later.
*/
if (higherTypeId.isDecimalTypeId() && (!lowerTypeId.isStringTypeId()))
{
precision = higherTypeId.getPrecision(this, otherDTS);
if (precision > 31) precision = 31; //db2 silently does this and so do we
scale = higherTypeId.getScale(this, otherDTS);
/* maximumWidth needs to count possible leading '-' and
* decimal point and leading '0' if scale > 0. See also
* sqlgrammar.jj(exactNumericType). Beetle 3875
*/
maximumWidth = (scale > 0) ? precision + 3 : precision + 1;
}
else if (thisType.typePrecedence() != otherType.typePrecedence())
{
precision = higherType.getPrecision();
scale = higherType.getScale();
/* GROSS HACKS:
* If we are doing an implicit (var)char->(var)bit conversion
* then the maximum width for the (var)char as a (var)bit
* is really 16 * its width as a (var)char. Adjust
* maximumWidth accordingly.
* If we are doing an implicit (var)char->decimal conversion
* then we need to increment the decimal's precision by
* 2 * the maximum width for the (var)char and the scale
* by the maximum width for the (var)char. The maximumWidth
* becomes the new precision + 3. This is because
* the (var)char could contain any decimal value from XXXXXX
* to 0.XXXXX. (In other words, we don't know which side of the
* decimal point the characters will be on.)
*/
if (lowerTypeId.isStringTypeId())
{
if (higherTypeId.isBitTypeId() &&
! (higherTypeId.isLongConcatableTypeId()))
{
if (lowerTypeId.isLongConcatableTypeId())
{
if (maximumWidth > (Integer.MAX_VALUE / 16))
maximumWidth = Integer.MAX_VALUE;
else
maximumWidth *= 16;
}
else
{
int charMaxWidth;
int fromWidth = lowerType.getMaximumWidth();
if (fromWidth > (Integer.MAX_VALUE / 16))
charMaxWidth = Integer.MAX_VALUE;
else
charMaxWidth = 16 * fromWidth;
maximumWidth = (maximumWidth >= charMaxWidth) ?
maximumWidth : charMaxWidth;
}
}
}
/*
* If we are doing an implicit (var)char->decimal conversion
* then the resulting decimal's precision could be as high as
* 2 * the maximum width (precisely 2mw-1) for the (var)char
* and the scale could be as high as the maximum width
* (precisely mw-1) for the (var)char.
* The maximumWidth becomes the new precision + 3. This is
* because the (var)char could contain any decimal value from
* XXXXXX to 0.XXXXX. (In other words, we don't know which
* side of the decimal point the characters will be on.)
*
* We don't follow this algorithm for long varchar because the
* maximum length of a long varchar is maxint, and we don't
* want to allocate a huge decimal value. So in this case,
* the precision, scale, and maximum width all come from
* the decimal type.
*/
if (lowerTypeId.isStringTypeId() &&
! (lowerTypeId.isLongConcatableTypeId()) &&
higherTypeId.isDecimalTypeId() )
{
int charMaxWidth = lowerType.getMaximumWidth();
int charPrecision;
/*
** Be careful not to overflow when calculating the
** precision. Remember that we will be adding
** three to the precision to get the maximum width.
*/
if (charMaxWidth > (Integer.MAX_VALUE - 3) / 2)
charPrecision = Integer.MAX_VALUE - 3;
else
charPrecision = charMaxWidth * 2;
if (precision < charPrecision)
precision = charPrecision;
if (scale < charMaxWidth)
scale = charMaxWidth;
maximumWidth = precision + 3;
}
}
}
else
{
/* At least 1 type is not a system built-in type */
ClassInspector cu = cf.getClassInspector();
TypeId thisCompType = (TypeId) thisType;
TypeId otherCompType = (TypeId) otherType;
if (cu.assignableTo(thisCompType.getCorrespondingJavaTypeName(),
otherCompType.getCorrespondingJavaTypeName()))
{
higherType = otherDTS;
}
else
{
if (SanityManager.DEBUG)
SanityManager.ASSERT(
cu.assignableTo(otherCompType.getCorrespondingJavaTypeName(),
thisCompType.getCorrespondingJavaTypeName()),
otherCompType.getCorrespondingJavaTypeName() +
" expected to be assignable to " +
thisCompType.getCorrespondingJavaTypeName());
higherType = this;
}
precision = higherType.getPrecision();
scale = higherType.getScale();
}
higherType = new DataTypeDescriptor(higherType,
precision, scale, nullable, maximumWidth);
return higherType;
}
/**
* Check whether or not the 2 types (DataTypeDescriptor) have the same type
* and length.
* This is useful for UNION when trying to decide whether a NormalizeResultSet
* is required.
*
* @param otherDTS DataTypeDescriptor to compare with.
*
* @return boolean Whether or not the 2 DTSs have the same type and length.
*/
public boolean isExactTypeAndLengthMatch(DataTypeDescriptor otherDTS)
{
/* Do both sides have the same length? */
if (getMaximumWidth() != otherDTS.getMaximumWidth())
{
return false;
}
if (getScale() != otherDTS.getScale())
{
return false;
}
if (getPrecision() != otherDTS.getPrecision())
{
return false;
}
TypeId thisType = getTypeId();
TypeId otherType = otherDTS.getTypeId();
/* Do both sides have the same type? */
if ( ! thisType.equals(otherType))
{
return false;
}
return true;
}
/**
* @see TypeDescriptor#getMaximumWidth
*/
public int getMaximumWidth()
{
return typeDescriptor.getMaximumWidth();
}
/**
* @see TypeDescriptor#getMaximumWidthInBytes
*/
public int getMaximumWidthInBytes()
{
return typeDescriptor.getMaximumWidthInBytes();
}
/**
* Gets the TypeId for the datatype.
*
* @return The TypeId for the datatype.
*/
public TypeId getTypeId()
{
return typeId;
}
/**
Get a Null for this type.
*/
public DataValueDescriptor getNull() {
return typeId.getNull();
}
/**
* Gets the name of this datatype.
*
*
* @return the name of this datatype
*/
public String getTypeName()
{
return typeId.getSQLTypeName();
}
/**
* Get the jdbc type id for this type. JDBC type can be
* found in java.sql.Types.
*
* @return a jdbc type, e.g. java.sql.Types.DECIMAL
*
* @see Types
*/
public int getJDBCTypeId()
{
return typeId.getJDBCTypeId();
}
/**
* Returns the number of decimal digits for the datatype, if applicable.
*
* @return The number of decimal digits for the datatype. Returns
* zero for non-numeric datatypes.
*/
public int getPrecision()
{
return typeDescriptor.getPrecision();
}
/**
* Returns the number of digits to the right of the decimal for
* the datatype, if applicable.
*
* @return The number of digits to the right of the decimal for
* the datatype. Returns zero for non-numeric datatypes.
*/
public int getScale()
{
return typeDescriptor.getScale();
}
/**
* Returns TRUE if the datatype can contain NULL, FALSE if not.
* JDBC supports a return value meaning "nullability unknown" -
* I assume we will never have columns where the nullability is unknown.
*
* @return TRUE if the datatype can contain NULL, FALSE if not.
*/
public boolean isNullable()
{
return typeDescriptor.isNullable();
}
/**
* Set the nullability of the datatype described by this descriptor
*
* @param nullable TRUE means set nullability to TRUE, FALSE
* means set it to FALSE
*/
public void setNullability(boolean nullable)
{
typeDescriptor.setNullability(nullable);
}
/**
Compare if two TypeDescriptors are exactly the same
@param aTypeDescriptor the typeDescriptor to compare to.
*/
public boolean equals(Object aTypeDescriptor)
{
return typeDescriptor.equals(aTypeDescriptor);
}
/**
* Converts this data type descriptor (including length/precision)
* to a string. E.g.
*
* VARCHAR(30)
*
* or
*
* java.util.Hashtable
*
* @return String version of datatype, suitable for running through
* the Parser.
*/
public String getSQLstring()
{
return typeId.toParsableString( this );
}
/**
* Get the simplified type descriptor that is intended to be stored
* in the system tables.
*/
public TypeDescriptorImpl getCatalogType()
{
return typeDescriptor;
}
/**
* Get the estimated memory usage for this type descriptor.
*/
public double estimatedMemoryUsage() {
switch (typeId.getTypeFormatId())
{
case StoredFormatIds.LONGVARBIT_TYPE_ID:
/* Who knows? Let's just use some big number */
return 10000.0;
case StoredFormatIds.BIT_TYPE_ID:
return (double) ( ( ((float) getMaximumWidth()) / 8.0) + 0.5);
case StoredFormatIds.BOOLEAN_TYPE_ID:
return 4.0;
case StoredFormatIds.CHAR_TYPE_ID:
case StoredFormatIds.VARCHAR_TYPE_ID:
case StoredFormatIds.NATIONAL_CHAR_TYPE_ID:
case StoredFormatIds.NATIONAL_VARCHAR_TYPE_ID:
return (double) (2.0 * getMaximumWidth());
case StoredFormatIds.LONGVARCHAR_TYPE_ID:
case StoredFormatIds.NATIONAL_LONGVARCHAR_TYPE_ID:
/* Who knows? Let's just use some big number */
return 10000.0;
case StoredFormatIds.DECIMAL_TYPE_ID:
/*
** 0.415 converts from number decimal digits to number of 8-bit digits.
** Add 1.0 for the sign byte, and 0.5 to force it to round up.
*/
return (double) ( (getPrecision() * 0.415) + 1.5 );
case StoredFormatIds.DOUBLE_TYPE_ID:
return 8.0;
case StoredFormatIds.INT_TYPE_ID:
return 4.0;
case StoredFormatIds.LONGINT_TYPE_ID:
return 8.0;
case StoredFormatIds.REAL_TYPE_ID:
return 4.0;
case StoredFormatIds.SMALLINT_TYPE_ID:
return 2.0;
case StoredFormatIds.TINYINT_TYPE_ID:
return 1.0;
case StoredFormatIds.REF_TYPE_ID:
/* I think 12 is the right number */
return 12.0;
case StoredFormatIds.USERDEFINED_TYPE_ID_V3:
if (typeId.userType()) {
/* Who knows? Let's just use some medium-sized number */
return 256.0;
}
case StoredFormatIds.DATE_TYPE_ID:
case StoredFormatIds.TIME_TYPE_ID:
case StoredFormatIds.TIMESTAMP_TYPE_ID:
return 12.0;
default:
return 0.0;
}
}
/**
* Compare JdbcTypeIds to determine if they represent equivalent
* SQL types. For example Types.NUMERIC and Types.DECIMAL are
* equivalent
*
* @param existingType JDBC type id of Cloudscape data type
* @param jdbcTypeId JDBC type id passed in from application.
*
* @return boolean true if types are equivalent, false if not
*/
public static boolean isJDBCTypeEquivalent(int existingType, int jdbcTypeId)
{
// Any type matches itself.
if (existingType == jdbcTypeId)
return true;
// To a numeric type
if (DataTypeDescriptor.isNumericType(existingType)) {
if (DataTypeDescriptor.isNumericType(jdbcTypeId))
return true;
if (DataTypeDescriptor.isCharacterType(jdbcTypeId))
return true;
return false;
}
// To character type.
if (DataTypeDescriptor.isCharacterType(existingType)) {
if (DataTypeDescriptor.isCharacterType(jdbcTypeId))
return true;
if (DataTypeDescriptor.isNumericType(jdbcTypeId))
return true;
switch (jdbcTypeId) {
case Types.DATE:
case Types.TIME:
case Types.TIMESTAMP:
return true;
default:
break;
}
return false;
}
// To binary type
if (DataTypeDescriptor.isBinaryType(existingType)) {
if (DataTypeDescriptor.isBinaryType(jdbcTypeId))
return true;
return false;
}
// To DATE, TIME
if (existingType == Types.DATE || existingType == Types.TIME) {
if (DataTypeDescriptor.isCharacterType(jdbcTypeId))
return true;
if (jdbcTypeId == Types.TIMESTAMP)
return true;
return false;
}
// To TIMESTAMP
if (existingType == Types.TIMESTAMP) {
if (DataTypeDescriptor.isCharacterType(jdbcTypeId))
return true;
if (jdbcTypeId == Types.DATE)
return true;
return false;
}
// To CLOB
if (existingType == Types.CLOB && DataTypeDescriptor.isCharacterType(jdbcTypeId))
return true;
return false;
}
public static boolean isNumericType(int jdbcType) {
switch (jdbcType) {
case Types.BIT:
case org.apache.derby.iapi.reference.JDBC30Translation.SQL_TYPES_BOOLEAN:
case Types.TINYINT:
case Types.SMALLINT:
case Types.INTEGER:
case Types.BIGINT:
case Types.REAL:
case Types.FLOAT:
case Types.DOUBLE:
case Types.DECIMAL:
case Types.NUMERIC:
return true;
default:
return false;
}
}
/**
* Check whether a JDBC type is one of the character types that are
* compatible with the Java type <code>String</code>.
*
* <p><strong>Note:</strong> <code>CLOB</code> is not compatible with
* <code>String</code>. See tables B-4, B-5 and B-6 in the JDBC 3.0
* Specification.
*
* <p> There are some non-character types that are compatible with
* <code>String</code> (examples: numeric types, binary types and
* time-related types), but they are not covered by this method.
*
* @param jdbcType a JDBC type
* @return <code>true</code> iff <code>jdbcType</code> is a character type
* and compatible with <code>String</code>
* @see java.sql.Types
*/
private static boolean isCharacterType(int jdbcType) {
switch (jdbcType) {
case Types.CHAR:
case Types.VARCHAR:
case Types.LONGVARCHAR:
return true;
default:
return false;
}
}
/**
* Check whether a JDBC type is compatible with the Java type
* <code>byte[]</code>.
*
* <p><strong>Note:</strong> <code>BLOB</code> is not compatible with
* <code>byte[]</code>. See tables B-4, B-5 and B-6 in the JDBC 3.0
* Specification.
*
* @param jdbcType a JDBC type
* @return <code>true</code> iff <code>jdbcType</code> is compatible with
* <code>byte[]</code>
* @see java.sql.Types
*/
private static boolean isBinaryType(int jdbcType) {
switch (jdbcType) {
case Types.BINARY:
case Types.VARBINARY:
case Types.LONGVARBINARY:
return true;
default:
return false;
}
}
/**
* Determine if an ASCII stream can be inserted into a column or parameter
* of type <code>jdbcType</code>.
*
* @param jdbcType JDBC type of column or parameter
* @return <code>true</code> if an ASCII stream can be inserted;
* <code>false</code> otherwise
*/
public static boolean isAsciiStreamAssignable(int jdbcType) {
return jdbcType == Types.CLOB || isCharacterType(jdbcType);
}
/**
* Determine if a binary stream can be inserted into a column or parameter
* of type <code>jdbcType</code>.
*
* @param jdbcType JDBC type of column or parameter
* @return <code>true</code> if a binary stream can be inserted;
* <code>false</code> otherwise
*/
public static boolean isBinaryStreamAssignable(int jdbcType) {
return jdbcType == Types.BLOB || isBinaryType(jdbcType);
}
/**
* Determine if a character stream can be inserted into a column or
* parameter of type <code>jdbcType</code>.
*
* @param jdbcType JDBC type of column or parameter
* @return <code>true</code> if a character stream can be inserted;
* <code>false</code> otherwise
*/
public static boolean isCharacterStreamAssignable(int jdbcType) {
// currently, we support the same types for ASCII streams and
// character streams
return isAsciiStreamAssignable(jdbcType);
}
public String toString()
{
return typeDescriptor.toString();
}
// Formatable methods
/**
* Read this object from a stream of stored objects.
*
* @param in read this.
*
* @exception IOException thrown on error
* @exception ClassNotFoundException thrown on error
*/
public void readExternal( ObjectInput in )
throws IOException, ClassNotFoundException
{
/* NOTE: We only write out the generic type id.
* typeId will be reset to be the generic type id
* when we get read back in since the generic
* one is all that is needed at execution time.
*/
typeId = (TypeId) in.readObject();
typeDescriptor = (TypeDescriptorImpl) in.readObject();
}
/**
* Write this object to a stream of stored objects.
*
* @param out write bytes here.
*
* @exception IOException thrown on error
*/
public void writeExternal( ObjectOutput out )
throws IOException
{
out.writeObject( typeId );
out.writeObject( typeDescriptor );
}
/**
* Get the formatID which corresponds to this class.
*
* @return the formatID of this class
*/
public int getTypeFormatId() { return StoredFormatIds.DATA_TYPE_SERVICES_IMPL_V01_ID; }
}
| [
"durieuxthomas@hotmail.com"
] | durieuxthomas@hotmail.com |
ccd34ce5cbc4baa46699489f450a9a7caa5f3db4 | 07555a5b4da41d2070ac83f610a54c6acb6d040b | /flightreservaion/src/main/java/com/myappnadir/flightreservaion/services/ReservationService.java | 4b282f8e28b4588b8c7ba5aa71d79687f09eb2d7 | [] | no_license | benmenadir/project-tuto | c79c658953763322a54d584983baa2fdf7b4bd30 | 80fd12223ec74da485c6e2f860f0f473279a7f06 | refs/heads/master | 2020-04-11T11:37:35.460460 | 2018-12-14T08:36:41 | 2018-12-14T08:36:41 | 161,754,279 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 279 | java | package com.myappnadir.flightreservaion.services;
import com.myappnadir.flightreservaion.dto.ReservationRequest;
import com.myappnadir.flightreservaion.entities.Reservation;
public interface ReservationService {
public Reservation bookFlight(ReservationRequest request) ;
}
| [
"nb@192.168.1.1"
] | nb@192.168.1.1 |
e13cedd55f09f8e87de6c6de5ba9e254757525a7 | ae79978115f0abb2cc3f90db7b1c43c225ca5a63 | /soontemple-1/src/main/java/cn/dz/daima/utils/HttpUtil.java | 67d9c5285bdac2648b5d44d76adf2393655e8c87 | [] | no_license | shenguidao/mytemple | 035a9e6f478925378c6eb94d58babd5473341065 | 0e49bfb636ce014755be85b4f4d402137687dc86 | refs/heads/master | 2022-07-10T17:32:21.427861 | 2020-03-09T05:39:43 | 2020-03-09T05:39:43 | 245,951,505 | 0 | 0 | null | 2022-06-21T02:56:48 | 2020-03-09T05:29:22 | Java | UTF-8 | Java | false | false | 4,166 | java | package cn.dz.daima.utils;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
/**
* @Description(描述): http请求,接口url调用,相关公共类
* @Author: ethan
* @CreateDate: 2019/1/8 11:34
* @UpdateUser: ethan
* @UpdateDate: 2019/1/8 11:34
* @UpdateRemark:
* @Version: 1.0
*/
public class HttpUtil {
/**
* HttpURLConnection POST请求
* @param url 接口链接
* @param param 参数
* @return
*/
public static String httpUrlConnectionPostxml(String url, String param){
InputStream is = null;
BufferedReader br = null;
HttpURLConnection uRLConnection = null;
try {
URL realUrl = new URL(url);
uRLConnection = (HttpURLConnection)realUrl.openConnection();
uRLConnection.setDoInput(true);
uRLConnection.setDoOutput(true);
uRLConnection.setRequestMethod("POST");
uRLConnection.setUseCaches(false);
uRLConnection.setInstanceFollowRedirects(false);
uRLConnection.setRequestProperty("Content-Type", "application/xml");
uRLConnection.connect();
uRLConnection.setConnectTimeout(15000);
uRLConnection.setReadTimeout(15000);
DataOutputStream out = new DataOutputStream(uRLConnection.getOutputStream());
//String content = "username="+username+"&password="+password;
out.writeBytes(param);
out.flush();
out.close();
is = uRLConnection.getInputStream();
br = new BufferedReader(new InputStreamReader(is,"utf-8"));
String response = "";
String readLine = null;
while((readLine =br.readLine()) != null){
//response = br.readLine();
response = response + readLine;
}
is.close();
br.close();
uRLConnection.disconnect();
return response;
} catch (MalformedURLException e) {
e.printStackTrace();
return null;
} catch (IOException e) {
e.printStackTrace();
return null;
} finally {
try{
if(is!=null){
is.close();
}
if(br!=null){
br.close();
}
if(uRLConnection!=null){
uRLConnection.disconnect();
}
}
catch(IOException ex){
ex.printStackTrace();
}
}
}
public static String getXmlInfo(String eaorder) {
StringBuilder sb = new StringBuilder();
sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
sb.append("<orderOutboundRequest version=\"0.1\" login=\"HvUhFfcw\" password=\"RZZEKJKUec0FUtho\">");
sb.append("<queries>");
sb.append("<query>");
sb.append("<attribute>erpNumber</attribute>");
sb.append("<eq>"+eaorder+"</eq>");
sb.append("</query>");
/* sb.append("<query>");
sb.append("<attribute>pickupSla</attribute>");
sb.append("<ge>2017-1-1</ge>");
sb.append("<le>2018-7-31</le>");
sb.append("</query>");
sb.append("<query>");
sb.append("<attribute>customText1</attribute>");
sb.append("<eq>STANDSP</eq>");
sb.append("</query>");
sb.append("<query>");
sb.append("<attribute>customText14</attribute>");
sb.append("<eq>2600158714</eq>");
sb.append("</query>"); */
sb.append("</queries>");
sb.append("<includeOrderInfo>true</includeOrderInfo>");
/* sb.append("<includeOrderPosition>true</includeOrderPosition>");
sb.append("<includeLocationHistory>true</includeLocationHistory>"); */
sb.append("<orderBy>");
sb.append("<desc>pickupSla</desc>");
sb.append("</orderBy>");
sb.append("<start>1</start>");
sb.append("<count>10</count>");
sb.append("</orderOutboundRequest>");
return sb.toString();
}
}
| [
"810307877@qq.com"
] | 810307877@qq.com |
9eb30ca94d8826297ef064fd386546804e39b478 | 78ad5cba4823599428273d36deb549f3d955e8b9 | /src/test/java/com/susu/Loader.java | f424a7f073bbc48b09993fd705d5383db9dc47cb | [] | no_license | vilinian/behavior3java | 7f2251cf71a8e530fb0f802355f44aceecb8ebab | e10e568e1145e26aae79673751ea5c81105d016b | refs/heads/master | 2020-11-25T08:40:24.067213 | 2019-11-05T06:12:18 | 2019-11-05T06:12:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 917 | java | package com.susu;
import com.susu.b3.B3Loader;
import com.susu.b3.actions.Log;
import com.susu.b3.core.BaseNode;
import com.susu.b3.core.BehaviorTree;
import com.susu.b3.core.Blackboard;
import java.util.HashMap;
import java.util.Map;
/**
* 测试用例
*
* @author SilenceSu
* @Email Silence.Sx@Gmail.com
* Created by Silence on 2019/3/2.
*/
public class Loader {
public static void main(String[] args) {
//自定义扩展log
Map<String, Class<? extends BaseNode>> extendNodes = new HashMap<String, Class<? extends BaseNode>>() {
{
put("Log", Log.class);
}
};
String confJson = Loader.class.getResource("/").getPath() + "tree.json";
BehaviorTree behaviorTree = B3Loader.loadB3Tree(confJson, extendNodes);
Blackboard blackboard = new Blackboard();
behaviorTree.tick(new Object(), blackboard);
}
}
| [
"silence.sx@gmail.com"
] | silence.sx@gmail.com |
53ef2d7851104d7d5d0308bc7dc266b3eecda956 | 6037b64f9c703fd5dc90bf01b91d1b4690cb3c3a | /src/main/java/com/vaguehope/onosendai/C.java | 7e0a597a67fc2d61bcc7b0b67fe1240efa199983 | [
"Apache-2.0"
] | permissive | phtan/Onosendai | 784fcf1ed55bda7f9688c6a7bf89365cc33f9e16 | ded437bbbf2c3d831871527f22a885b70c5d4eb5 | refs/heads/master | 2021-01-18T09:47:38.957303 | 2013-12-28T15:43:43 | 2013-12-28T15:43:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,164 | java | package com.vaguehope.onosendai;
import java.util.concurrent.TimeUnit;
public interface C {
String TAG = "onosendai";
String CONFIG_FILE_NAME = "deck.conf";
int MAX_MEMORY_IMAGE_CACHE = 20 * 1024 * 1024;
int DB_CONNECT_TIMEOUT_SECONDS = 5;
int TWEET_FETCH_PAGE_SIZE = 20;
int TWITTER_TIMELINE_MAX_FETCH = TWEET_FETCH_PAGE_SIZE * 5;
int TWITTER_ME_MAX_FETCH = TWEET_FETCH_PAGE_SIZE;
int TWITTER_MENTIONS_MAX_FETCH = TWEET_FETCH_PAGE_SIZE;
int TWITTER_LIST_MAX_FETCH = TWEET_FETCH_PAGE_SIZE * 5;
int TWITTER_SEARCH_MAX_FETCH = TWEET_FETCH_PAGE_SIZE * 5;
String DATA_TW_MAX_COL_ENTRIES = "500";
// Arbitrary values.
int UPDATER_MIN_COLUMS_TO_USE_THREADPOOL = 2;
int UPDATER_MAX_THREADS = 3;
// Form main activity.
int IMAGE_LOADER_MAX_THREADS = 3;
// Tweet Lists.
long SCROLL_TIME_LABEL_TIMEOUT_MILLIS = 3000L;
// Updates.
float MIN_BAT_UPDATE = 0.30f;
float MIN_BAT_SEND = 0.20f;
float MIN_BAT_CLEANUP = 0.50f;
// Disc caches.
long IMAGE_DISC_CACHE_TOUCH_AFTER_MILLIS = TimeUnit.DAYS.toMillis(5);
long IMAGE_DISC_CACHE_EXPIRY_MILLIS = TimeUnit.DAYS.toMillis(10);
long TMP_SCALED_IMG_EXPIRY_MILLIS = TimeUnit.DAYS.toMillis(7);
}
| [
"haku@vaguehope.com"
] | haku@vaguehope.com |
421ceaf5315ffc728e9b862d006777978fce4fbf | ab50d8013f1c7eaf0130108e73c0726147c970bb | /src/com/team6072/frc2018/paths/PathContainer.java | b613c8d66b5c9ebe0800540bd7bcd5b46cdef26b | [
"MIT"
] | permissive | CDM-Robotics/6072-base-2018 | 2a59ae9c0f10b83115fdf7da0ed7254133c14381 | 89b107dd4ecf58ca6bbc83be326fa31f45ab28a5 | refs/heads/master | 2021-06-30T22:45:30.185924 | 2017-09-17T17:50:25 | 2017-09-17T17:50:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 449 | java | package com.team6072.frc2018.paths;
import com.team6072.lib.util.control.Path;
import com.team6072.lib.util.math.RigidTransform2d;
/**
* Interface containing all information necessary for a path including the Path itself, the Path's starting pose, and
* whether or not the robot should drive in reverse along the path.
*/
public interface PathContainer {
Path buildPath();
RigidTransform2d getStartPose();
boolean isReversed();
}
| [
"chrh02@gmail.com"
] | chrh02@gmail.com |
bb70d519c391d4e3bdeb82e2d7cba4e24a2ff327 | 28006cbabeb1b2f79ecf11205273045d02a15a3d | /src/org/usfirst/frc/team1482/pidControl.java | 8ec8290ed437c8ea128054c0be5e0089425997ee | [] | no_license | team1482BGHS/Robot_2015_New | bc14589031852e915f93fb680e4d379e5e75d2e6 | 33d89646bbc3e8959d5ad0a5ede516cd98bca057 | refs/heads/master | 2021-01-20T16:59:09.832754 | 2015-04-01T00:25:10 | 2015-04-01T00:25:10 | 29,884,777 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 570 | java | package org.usfirst.frc.team1482;
import edu.wpi.first.wpilibj.PIDOutput;
import edu.wpi.first.wpilibj.SpeedController;
import edu.wpi.first.wpilibj.hal.CanTalonSRX;
public class pidControl implements PIDOutput{
CanTalonSRX motor1;
CanTalonSRX motor2;
public pidControl(CanTalonSRX motor1, CanTalonSRX motor2){
this.motor1 = motor1;
this.motor2 = motor2;
}
@Override
public void pidWrite(double output) {
motor1.Set(-output);
motor2.Set(-output);
// TODO Auto-generated method stub
System.out.println("Settings speed to" + output);
}
}
| [
"frc1482@gmail.com"
] | frc1482@gmail.com |
764d73d0643cf645f035682bece52f9f7948b7bc | c22a90c4bd1472c7f34bc078e9dd4e36c6b3b8ad | /errai-ioc/src/test/java/org/jboss/errai/ioc/tests/wiring/client/res/BeanManagerDependentBean.java | c888d09f1dcaf9e4ea1522ccc8c1a510cda7fcef | [] | no_license | rjkennedy98/errai | 3a2fcd0fa81bfa4fb553678b03678900361d0094 | 3169d5c3901715d8a87e6eec5c012b1eeda2fe61 | refs/heads/master | 2021-01-16T00:42:27.229064 | 2013-01-31T19:52:32 | 2013-01-31T19:52:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 368 | java | package org.jboss.errai.ioc.tests.wiring.client.res;
import org.jboss.errai.ioc.client.container.IOCBeanManager;
import javax.inject.Inject;
import javax.inject.Singleton;
/**
* @author Mike Brock
*/
@Singleton
public class BeanManagerDependentBean {
@Inject IOCBeanManager beanManager;
public IOCBeanManager getBeanManager() {
return beanManager;
}
}
| [
"brockm@gmail.com"
] | brockm@gmail.com |
9806ec80ad6529f9d8012428cabbd71b0ace25df | 9600278baea90afa57337537d9ab31837944ff8c | /src/test/java/suites/TestSuites.java | a87af74acb27c93da86487dd92d2cc2fdb92571c | [
"Apache-2.0"
] | permissive | khitrova/JavaAppium | c027836c8d53476d517726bac1097ef1b408db27 | b259d4978495f0f5d725b606de768f539f2b038a | refs/heads/main | 2023-08-28T08:47:38.523356 | 2021-11-15T20:35:04 | 2021-11-15T20:35:04 | 427,013,838 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 396 | java | package suites;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import tests.ArticleTests;
import tests.ChangeAppConditionTests;
import tests.MyListTests;
import tests.SearchTests;
@RunWith(Suite.class)
@Suite.SuiteClasses({
ArticleTests.class,
ChangeAppConditionTests.class,
MyListTests.class,
SearchTests.class
})
public class TestSuites {}
| [
"akhitrova@jetsmarter.com"
] | akhitrova@jetsmarter.com |
531ab8c8f01fa0f4825e6ad8a59dd299e3a42d3d | 84b4a8f9537d3dd7b7f0b36697c1d3b465292270 | /Carencias/src/main/java/ar/com/smg/carencias/Carencia.java | e598dbf019eca0c89971cc6cc718a382e423c778 | [] | no_license | GustavoArenas/Prestaciones | 68bde0d772f426aa69ed5db0da772a42db7638a2 | 80a0c13d43a6d31e19e89bc0b3b4b3b916a3a408 | refs/heads/master | 2020-04-18T23:24:45.710090 | 2016-08-22T17:45:24 | 2016-08-22T17:45:24 | 66,296,007 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,281 | java | package ar.com.smg.carencias;
/**
* This class was automatically generated by the data modeler tool.
*/
public class Carencia implements java.io.Serializable
{
static final long serialVersionUID = 1L;
private java.lang.Integer meses;
private java.lang.Integer nomen;
private java.lang.String plan;
private java.lang.Integer prestac;
public Carencia()
{
}
public java.lang.Integer getMeses()
{
return this.meses;
}
public void setMeses(java.lang.Integer meses)
{
this.meses = meses;
}
public java.lang.Integer getNomen()
{
return this.nomen;
}
public void setNomen(java.lang.Integer nomen)
{
this.nomen = nomen;
}
public java.lang.String getPlan()
{
return this.plan;
}
public void setPlan(java.lang.String plan)
{
this.plan = plan;
}
public java.lang.Integer getPrestac()
{
return this.prestac;
}
public void setPrestac(java.lang.Integer prestac)
{
this.prestac = prestac;
}
public Carencia(java.lang.Integer meses, java.lang.Integer nomen,
java.lang.String plan, java.lang.Integer prestac)
{
this.meses = meses;
this.nomen = nomen;
this.plan = plan;
this.prestac = prestac;
}
} | [
""
] | |
73dc70cdf6e9fc2f43a42b0ea9f84d46df2fe43a | 7d13274282a09d47f1fc8372f5d1588731b249a4 | /app/src/main/java/com/example/jfood_android/PesananFetchRequest.java | d3c07b556cd83c96fee3d553dc36a99422967862 | [] | no_license | faqihar/jfood-android | 99faf755d3406804c427866760cba815b9859295 | 66f09809fe5478b303406f34f527f390e81ed047 | refs/heads/master | 2022-10-02T14:45:28.242512 | 2020-06-07T06:09:44 | 2020-06-07T06:09:44 | 259,705,451 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 661 | java | package com.example.jfood_android;
import androidx.annotation.Nullable;
import com.android.volley.Response;
import com.android.volley.toolbox.StringRequest;
import java.util.HashMap;
import java.util.Map;
public class PesananFetchRequest extends StringRequest {
private static String URL = "http://10.0.2.2:8080/invoice/customer/";
private Map<String, String> params;
public PesananFetchRequest(int currentUserId, Response.Listener<String> listener) {
super(Method.GET, URL+currentUserId, listener, null);
params = new HashMap<>();
}
@Override
public Map<String, String> getParams(){
return params;
}
} | [
"faqih.achmad@ui.ac.id"
] | faqih.achmad@ui.ac.id |
493b8b6d5d6afef6be27fbebcde7ace66817af54 | f009dc33f9624aac592cb66c71a461270f932ffa | /src/main/java/com/alipay/api/response/AlipayUserApplepayProvisioningbundleCreateResponse.java | b4bca0c35ab0e5d1c4692cac3902d8b9b98db2cd | [
"Apache-2.0"
] | permissive | 1093445609/alipay-sdk-java-all | d685f635af9ac587bb8288def54d94e399412542 | 6bb77665389ba27f47d71cb7fa747109fe713f04 | refs/heads/master | 2021-04-02T16:49:18.593902 | 2020-03-06T03:04:53 | 2020-03-06T03:04:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,243 | java | package com.alipay.api.response;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.domain.OpenApiResponseHeader;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: alipay.user.applepay.provisioningbundle.create response.
*
* @author auto create
* @since 1.0, 2020-02-19 17:00:05
*/
public class AlipayUserApplepayProvisioningbundleCreateResponse extends AlipayResponse {
private static final long serialVersionUID = 6557713725187977316L;
/**
* 卡id(由固定前缀+32位数字构成)
*/
@ApiField("provisioning_bundle_identifier")
private String provisioningBundleIdentifier;
/**
* ApplePay公用响应头
*/
@ApiField("response_header")
private OpenApiResponseHeader responseHeader;
public void setProvisioningBundleIdentifier(String provisioningBundleIdentifier) {
this.provisioningBundleIdentifier = provisioningBundleIdentifier;
}
public String getProvisioningBundleIdentifier( ) {
return this.provisioningBundleIdentifier;
}
public void setResponseHeader(OpenApiResponseHeader responseHeader) {
this.responseHeader = responseHeader;
}
public OpenApiResponseHeader getResponseHeader( ) {
return this.responseHeader;
}
}
| [
"ben.zy@antfin.com"
] | ben.zy@antfin.com |
9ce89e0f652af5ad7ee4fe88ceefe7e113e9c43e | e9663a041fe42b4dfe4467fb8f5e75f90d25cbb9 | /android-ikaros/ikaros/src/main/java/org/camera/preview/CameraSurfacePreview.java | 2999f8dae09b0a21ca12a1e7da954a481c94e6a6 | [
"Apache-2.0"
] | permissive | platisd/palingenesis | 0635baf65e1cc2d4d8246b544d1c61ebc3774825 | d668fae56e3ec3bd7bedb89194d4721c0dc61635 | refs/heads/master | 2020-07-23T18:08:52.521224 | 2019-09-10T20:58:33 | 2019-09-10T20:58:33 | 207,661,571 | 0 | 0 | Apache-2.0 | 2019-09-10T20:56:18 | 2019-09-10T20:56:17 | null | UTF-8 | Java | false | false | 1,406 | java | package org.camera.preview;
import android.content.Context;
import android.graphics.PixelFormat;
import android.util.AttributeSet;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import org.camera.camera.CameraWrapper;
public class CameraSurfacePreview extends SurfaceView implements SurfaceHolder.Callback {
public static final String TAG = "CameraSurfacePreview";
SurfaceHolder mSurfaceHolder;
Context mContext;
CameraWrapper mCameraWrapper;
@SuppressWarnings("deprecation")
public CameraSurfacePreview(Context context, AttributeSet attrs) {
super(context, attrs);
this.mSurfaceHolder = getHolder();
this.mContext = getContext();
this.mSurfaceHolder.setFormat(PixelFormat.TRANSPARENT);
this.mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
this.mSurfaceHolder.addCallback(this);
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
Log.i(TAG, "surfaceCreated...");
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
Log.i(TAG, "surfaceChanged...");
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
Log.i(TAG, "surfaceDestroyed...");
CameraWrapper.getInstance().doStopCamera();
}
public SurfaceHolder getSurfaceHolder(){
return this.mSurfaceHolder;
}
}
| [
"ddjohn@gmail.com"
] | ddjohn@gmail.com |
fb8c784606e038b1379739b413d3aae7198e7184 | 04279cd12d0151867ff34a1ce68d7869341d5269 | /app/src/main/java/com/xtdar/app/view/activity/UnityPlayerActivity.java | ab530e35192c6cbdf83cb01fc659d356b67cd4b9 | [] | no_license | hmxbanz/XiaoTaiDou | ca8b318ebdaf8638f019d41a4aafe45686e6d000 | 4171ac32a004af57c506d9de4309941586224621 | refs/heads/master | 2021-01-20T14:23:47.545722 | 2017-06-19T06:02:28 | 2017-06-19T06:02:28 | 90,604,512 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,520 | java | package com.xtdar.app.view.activity;
import com.unity3d.player.*;
import android.app.Activity;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.PixelFormat;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
public class UnityPlayerActivity extends Activity
{
protected UnityPlayer mUnityPlayer; // don't change the name of this variable; referenced from native code
// Setup activity layout
@Override protected void onCreate (Bundle savedInstanceState)
{
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
getWindow().setFormat(PixelFormat.RGBX_8888); // <--- This makes xperia play happy
mUnityPlayer = new UnityPlayer(this);
setContentView(mUnityPlayer);
mUnityPlayer.requestFocus();
}
@Override protected void onNewIntent(Intent intent)
{
// To support deep linking, we need to make sure that the client can get access to
// the last sent intent. The clients access this through a JNI api that allows them
// to get the intent set on launch. To update that after launch we have to manually
// replace the intent with the one caught here.
setIntent(intent);
}
// Quit Unity
@Override protected void onDestroy ()
{
mUnityPlayer.quit();
super.onDestroy();
}
// Pause Unity
@Override protected void onPause()
{
super.onPause();
mUnityPlayer.pause();
}
// Resume Unity
@Override protected void onResume()
{
super.onResume();
mUnityPlayer.resume();
}
// Low Memory Unity
@Override public void onLowMemory()
{
super.onLowMemory();
mUnityPlayer.lowMemory();
}
// Trim Memory Unity
@Override public void onTrimMemory(int level)
{
super.onTrimMemory(level);
if (level == TRIM_MEMORY_RUNNING_CRITICAL)
{
mUnityPlayer.lowMemory();
}
}
// This ensures the layout will be correct.
@Override public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
mUnityPlayer.configurationChanged(newConfig);
}
// Notify Unity of the focus change.
@Override public void onWindowFocusChanged(boolean hasFocus)
{
super.onWindowFocusChanged(hasFocus);
mUnityPlayer.windowFocusChanged(hasFocus);
}
// For some reason the multiple keyevent type is not supported by the ndk.
// Force event injection by overriding dispatchKeyEvent().
@Override public boolean dispatchKeyEvent(KeyEvent event)
{
if (event.getAction() == KeyEvent.ACTION_MULTIPLE)
return mUnityPlayer.injectEvent(event);
return super.dispatchKeyEvent(event);
}
// Pass any events not handled by (unfocused) views straight to UnityPlayer
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { return mUnityPlayer.injectEvent(event); }
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { return mUnityPlayer.injectEvent(event); }
@Override public boolean onTouchEvent(MotionEvent event) { return mUnityPlayer.injectEvent(event); }
/*API12*/ public boolean onGenericMotionEvent(MotionEvent event) { return mUnityPlayer.injectEvent(event); }
}
| [
"Admin"
] | Admin |
c35fe338fc4fcd22bc0426ee4321af4b2a765cab | 4b02716fe4b91399d2bfda4dda3becc31a9d793a | /huigou-core-api/src/main/java/com/huigou/uasp/bmp/opm/domain/model/management/BizManagement.java | cc7862ea37c1356dc7deb59fd8ab926fc6e2d278 | [] | no_license | wuyounan/drawio | 19867894fef13596be31f4f5db4296030f2a19b6 | d0d1a0836e6b3602c27a53846a472a0adbe15e93 | refs/heads/develop | 2022-12-22T05:12:08.062112 | 2020-02-06T07:28:12 | 2020-02-06T07:28:12 | 241,046,824 | 0 | 2 | null | 2022-12-16T12:13:57 | 2020-02-17T07:38:48 | JavaScript | UTF-8 | Java | false | false | 2,450 | java | package com.huigou.uasp.bmp.opm.domain.model.management;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import com.huigou.data.domain.listener.CreatorAndModifierListener;
import com.huigou.data.domain.model.AbstractEntity;
import com.huigou.data.domain.model.Creator;
import com.huigou.data.domain.model.Modifier;
import com.huigou.uasp.bmp.opm.domain.model.org.Org;
/**
* 业务管理权限
*
* @author gongmm
*/
@Entity
@Table(name = "SA_OPBizManagement")
@EntityListeners({ CreatorAndModifierListener.class })
public class BizManagement extends AbstractEntity {
private static final long serialVersionUID = -5682982361543414322L;
/**
* 管理者
*/
@ManyToOne()
@JoinColumn(name = "manager_id")
private Org manager;
/**
* 业务管理权限类别
*/
@ManyToOne()
@JoinColumn(name = "manage_type_id")
private BizManagementType bizManagementType;
/**
* 下属
*/
@ManyToOne()
@JoinColumn(name = "subordination_id")
private Org subordination;
/**
* 创建者和修改者
*/
@Embedded
private Creator creator;
@Embedded
private Modifier modifier;
public Org getManager() {
return manager;
}
public void setManager(Org manager) {
this.manager = manager;
}
public BizManagementType getBizManagementType() {
return bizManagementType;
}
public void setBizManagementType(BizManagementType bizManagementType) {
this.bizManagementType = bizManagementType;
}
public Org getSubordination() {
return subordination;
}
public void setSubordination(Org subordination) {
this.subordination = subordination;
}
public Creator getCreator() {
return creator;
}
public void setCreator(Creator creator) {
this.creator = creator;
}
public Modifier getModifier() {
return modifier;
}
public void setModifier(Modifier modifier) {
this.modifier = modifier;
}
public boolean isAllocated(Org manager, BizManagementType bizManagementType, Org subordination) {
return this.manager.equals(manager) && this.bizManagementType.equals(bizManagementType) && this.subordination.equals(subordination);
}
}
| [
"2232911026@qq.com"
] | 2232911026@qq.com |
cf5818cb4280c66821a93c0b053e0af9f4fa0ccf | 0f0b75d189bec77cde5f6870de0c746959665b28 | /demos/substance-demo/src/main/java/org/pushingpixels/demo/substance/main/check/FakeAccordion.java | c1cc7ab5b83b687b1f4bdd396aec74ec671faef0 | [
"BSD-3-Clause"
] | permissive | vad-babushkin/radiance | 08f21bf6102261a1bba6407bab738ab33baf9cd5 | 42d17c7018e009f16131e3ddc0e3e980f42770f6 | refs/heads/master | 2021-03-27T22:28:06.062205 | 2020-03-06T03:27:26 | 2020-03-06T03:27:26 | 247,813,010 | 1 | 0 | BSD-3-Clause | 2020-03-16T20:44:39 | 2020-03-16T20:44:38 | null | UTF-8 | Java | false | false | 4,435 | java | /*
* Copyright (c) 2005-2020 Radiance Kirill Grouchnikov. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* o Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.pushingpixels.demo.substance.main.check;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.util.ArrayList;
import java.util.List;
public class FakeAccordion extends JPanel {
public static class FakeAccordionPanel extends JPanel {
private JPanel content;
private FakeAccordionPanel(String title, Icon icon, JPanel content) {
super(new BorderLayout());
JButton titleLabel = new JButton(title);
titleLabel.setIcon(icon);
titleLabel.addActionListener(
(ActionEvent ae) -> setCollapsed(this.content.isVisible()));
this.content = content;
this.add(titleLabel, BorderLayout.NORTH);
this.add(content, BorderLayout.CENTER);
}
public void setCollapsed(boolean isCollapsed) {
this.content.setVisible(!isCollapsed);
}
}
private List<FakeAccordionPanel> panels = new ArrayList<>();
private class FakeAccordionLayout implements LayoutManager {
@Override
public void addLayoutComponent(String name, Component comp) {
}
@Override
public void removeLayoutComponent(Component comp) {
}
@Override
public Dimension minimumLayoutSize(Container parent) {
return this.preferredLayoutSize(parent);
}
@Override
public Dimension preferredLayoutSize(Container parent) {
int combinedHeight = 0;
for (FakeAccordionPanel panel : panels) {
combinedHeight += panel.getPreferredSize().height;
}
combinedHeight += (panels.size() + 1) * 4;
return new Dimension(parent.getWidth(), combinedHeight);
}
@Override
public void layoutContainer(Container parent) {
int y = 4;
for (FakeAccordionPanel panel : panels) {
int prefPanelHeight = panel.getPreferredSize().height;
panel.setBounds(4, y, parent.getWidth() - 8, prefPanelHeight);
y += prefPanelHeight;
y += 4;
}
}
}
public FakeAccordion() {
this.setLayout(new FakeAccordionLayout());
}
public FakeAccordionPanel addPanel(String title, Icon icon, JPanel content) {
FakeAccordionPanel result = new FakeAccordionPanel(title, icon, content);
panels.add(result);
this.add(result);
invalidate();
doLayout();
repaint();
return result;
}
public void removeLastPanel() {
FakeAccordionPanel panelToRemove = this.panels.get(this.panels.size() - 1);
panels.remove(panelToRemove);
this.remove(panelToRemove);
invalidate();
doLayout();
repaint();
}
}
| [
"kirill.grouchnikov@gmail.com"
] | kirill.grouchnikov@gmail.com |
b8f1ae7107edf2eb74c41561c9c07d6739bdfecc | 870eb9a97b6553956c47064a45db3795efb60f23 | /ParkAssistApp/app/src/main/java/com/example/parkassistapp/Fragments/FragmentDetail.java | cb16053c2dfe0c4695ff5d65e157b95c1841d6bf | [] | no_license | PieterBi/MobileDevHerexamen2020 | 94343444775ca16a4777721c7e7c962d13c92165 | 1fd807d41b20debd283d28bd3d4043600692e5d9 | refs/heads/master | 2022-12-02T09:29:58.178974 | 2020-08-19T07:54:37 | 2020-08-19T07:54:37 | 286,332,988 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,900 | java | package com.example.parkassistapp.Fragments;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.example.parkassistapp.DAL.ParkingGarageDbHelper;
import com.example.parkassistapp.Model.ParkingGarage;
import com.example.parkassistapp.R;
public class FragmentDetail extends Fragment implements View.OnClickListener {
private ParkingGarage selectedGarage;
private TextView tvCompany, tvName, tvCoordinatesX, tvCoordinatesY;
private Button btnSaveGarage;
private boolean isSavedGarage;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View view = inflater.inflate(R.layout.fragment_detail, container, false);
tvCompany = (TextView) view.findViewById(R.id.tv_company);
tvName = (TextView) view.findViewById(R.id.tv_name);
tvCoordinatesX = (TextView) view.findViewById(R.id.tv_coordinatesx);
tvCoordinatesY = (TextView) view.findViewById(R.id.tv_coordinatesy);
btnSaveGarage = (Button) view.findViewById((R.id.btn_savegarage));
btnSaveGarage.setOnClickListener(this);
return view;
}
public void setGarageDetail(ParkingGarage parkingGarage)
{
selectedGarage = parkingGarage;
tvCompany.setText(selectedGarage.getCompany());
tvName.setText(selectedGarage.getName());
tvCoordinatesX.setText(String.valueOf(selectedGarage.getCoordinateX()));
tvCoordinatesY.setText(String.valueOf(selectedGarage.getCoordinateY()));
setIsAlreadySaved(selectedGarage.getId());
}
private void setIsAlreadySaved(int id)
{
//if the ID is assigned, it comes from the local db
if(id != 0)
{
btnSaveGarage.setText("I am leaving the garage");
isSavedGarage = true;
}
else
{
btnSaveGarage.setText("I am parking here");
isSavedGarage = false;
}
}
private void switchBooleanIsSavedGarage()
{
isSavedGarage = !isSavedGarage;
if(isSavedGarage)
{
btnSaveGarage.setText("I am leaving the garage");
}
else
{
btnSaveGarage.setText("I am parking here");
}
}
@Override
public void onClick(View view)
{
ParkingGarageDbHelper dbHelper = new ParkingGarageDbHelper(getActivity().getApplicationContext());
if(isSavedGarage)
{
dbHelper.deleteGarage(selectedGarage, getActivity());
}
else
{
dbHelper.insertGarage(selectedGarage, getActivity());
}
switchBooleanIsSavedGarage();
}
}
| [
"pieterbillet@hotmail.com"
] | pieterbillet@hotmail.com |
a9e0e81c62b1e547130ec90afec1ba90f466e11b | f556c1df501bf4323c8a32a98df9466d109fe7bd | /src/main/java/com/example/myproject/config/WebMvcConfig.java | 2e1de30cb3602368df752175be9ecaf71eaa29e9 | [] | no_license | yiwuxia/springboot-websocket-demo | 17e0d42528241db9c20a1a344296efda4c891218 | 453352646501fc7dcdac44816cdd2b60ed7f6826 | refs/heads/master | 2021-06-25T18:03:11.063450 | 2019-09-05T01:27:10 | 2019-09-05T01:27:10 | 206,447,241 | 0 | 0 | null | 2021-03-31T21:23:08 | 2019-09-05T01:22:34 | Java | UTF-8 | Java | false | false | 715 | java | package com.example.myproject.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
/**
* @Description TODO
* @Author lijin
* @Date 2019/8/26 10:59
* @Version 1.0
**/
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("POST", "GET", "PUT", "OPTIONS", "DELETE")
.maxAge(3600)
.allowCredentials(true);
}
}
| [
"740393778@qq.com"
] | 740393778@qq.com |
907d92d46306028fc8aa474acb6ad2c97b96be0e | 2a2c9edbabd1b2bdb47d4a4bdc134bc86e0dbd1f | /src/StorageProxyReadTest.java | ebc2861efb9391133344463bf886d2c5dffe7fd9 | [] | no_license | nezdolik/storage-proxy-adventures | 51d08fbf8760e4029ba316c538f36941adc6cfdd | 069cec3e404c03a64602aa7a7dee49e006785133 | refs/heads/master | 2021-05-05T01:30:39.890417 | 2018-01-31T10:18:17 | 2018-01-31T10:23:09 | 119,670,532 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,610 | java | import static com.google.common.base.Charsets.UTF_8;
import java.nio.ByteBuffer;
import org.apache.cassandra.config.CFMetaData;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.db.ClusteringBound;
import org.apache.cassandra.db.ColumnFamilyStore;
import org.apache.cassandra.db.ConsistencyLevel;
import org.apache.cassandra.db.DecoratedKey;
import org.apache.cassandra.db.Keyspace;
import org.apache.cassandra.db.SinglePartitionReadCommand;
import org.apache.cassandra.db.Slice;
import org.apache.cassandra.db.rows.Cell;
import org.apache.cassandra.db.rows.Row;
import org.apache.cassandra.db.rows.RowIterator;
import org.apache.cassandra.service.StorageProxy;
import org.apache.cassandra.service.StorageService;
public class StorageProxyReadTest {
private static final String KS = "system_schema";
private static final String CFS = "keyspaces";
public static void main(String[] args) throws Exception {
setup();
run();
}
private static void setup() {
System.setProperty("cassandra.config", "cassandra.yaml");
System.setProperty("cassandra.storagedir", "lib1");
DatabaseDescriptor.daemonInitialization();
StorageService.instance.initServer();
}
private static void run() throws Exception {
/**
* Check is all live nodes have agreed upon schema version
*/
StorageProxy.describeSchemaVersions();
final ColumnFamilyStore cfs = Keyspace.open(KS).getColumnFamilyStore(CFS);
//verify that config is loaded
System.out.println("Cluster name: " + DatabaseDescriptor.getClusterName());
//the slice of rows to query, we want to look at all rows
Slice slice = Slice.make(ClusteringBound.BOTTOM, ClusteringBound.TOP);
//key for system_auth keyspace_name
final DecoratedKey dk = dk(cfs.metadata, "system_auth");
//prepare simple read command
SinglePartitionReadCommand cmd = SinglePartitionReadCommand.create(cfs.metadata,
0, dk, slice);
doRead(cmd);
}
private static Row doRead(final SinglePartitionReadCommand cmd) throws Exception {
//read from closest replica
RowIterator itor = StorageProxy.readOne(cmd, ConsistencyLevel.ANY, System.nanoTime());
Row row = itor.next();
Iterable<Cell> cells = row.cells();
for (Cell cell : cells) {
//cell value is represented by ByteBuffer
System.out.println(cell.column() +": " + new String(cell.value().array(), "UTF-8"));
}
return row;
}
private static DecoratedKey dk(CFMetaData cfs, String key) {
return cfs.partitioner.decorateKey(ByteBuffer.wrap(key.getBytes(UTF_8)));
}
}
| [
"nezdolik@spotify.com"
] | nezdolik@spotify.com |
77261a79b99826db0b2e9a7bbd8c956c4ddef3f4 | 513038bd06c25541dd9ecccc7dfa28a2827cafb4 | /src/com/example/soapdemo3/ImageListActivity.java | 6c08c991f0bfa55c6841282aa11b4ecf843dafbc | [] | no_license | zykgy/soapDemo3 | fe4fa0d634bda528a31c094d925c3ce4ff51a1d6 | f98b554a44f3c7b108ee78b573246bd68acab5d1 | refs/heads/master | 2020-04-08T00:40:38.178892 | 2013-06-18T01:16:40 | 2013-06-18T01:16:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,496 | java | /*******************************************************************************
* Copyright 2011-2013 Sergey Tarasevich
*
* 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.example.soapdemo3;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import com.example.soapdemo3.Constants.Extra;
import com.example.soapdemo3.R;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.assist.ImageLoadingListener;
import com.nostra13.universalimageloader.core.assist.SimpleImageLoadingListener;
import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer;
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer;
/**
* @author Sergey Tarasevich (nostra13[at]gmail[dot]com)
*/
public class ImageListActivity extends AbsListViewBaseActivity {
DisplayImageOptions options;
private ArrayList<Category> categories;
private ArrayList<String> imageUrls;
private ArrayList<String> categoriesPicterusName;
//String[] imageUrls;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ac_image_list);
// Bundle bundle = getIntent().getExtras();
// imageUrls = bundle.getStringArray(Extra.IMAGES);
Bundle bundle =getIntent().getBundleExtra("categorie");
categories =bundle.getParcelableArrayList(Extra.IMAGES);
imageUrls =new ArrayList<String>();
categoriesPicterusName =new ArrayList<String>();
for (Category category : categories) {
if(category.getParentcat()==0){
categoriesPicterusName.add(category.getName());
imageUrls.add(WebToolKit.CategoriesPicterusURL+category.getImage());
}
}
options = new DisplayImageOptions.Builder()
.showStubImage(R.drawable.ic_stub)
.showImageForEmptyUri(R.drawable.ic_empty)
.showImageOnFail(R.drawable.ic_error)
.cacheInMemory()
.cacheOnDisc()
.displayer(new RoundedBitmapDisplayer(20))
.build();
listView = (ListView) findViewById(android.R.id.list);
((ListView) listView).setAdapter(new ItemAdapter());
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//startImagePagerActivity(position);
}
});
}
@Override
public void onBackPressed() {
AnimateFirstDisplayListener.displayedImages.clear();
super.onBackPressed();
}
private void startImagePagerActivity(int position) {
Intent intent = new Intent(this, ImagePagerActivity.class);
intent.putExtra(Extra.IMAGES, imageUrls);
intent.putExtra(Extra.IMAGE_POSITION, position);
startActivity(intent);
}
class ItemAdapter extends BaseAdapter {
private ImageLoadingListener animateFirstListener = new AnimateFirstDisplayListener();
private class ViewHolder {
public TextView text;
public ImageView image;
}
@Override
public int getCount() {
return /*imageUrls.length*/imageUrls.size();
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
View view = convertView;
final ViewHolder holder;
if (convertView == null) {
view = getLayoutInflater().inflate(R.layout.item_list_image, parent, false);
holder = new ViewHolder();
holder.text = (TextView) view.findViewById(R.id.text);
holder.image = (ImageView) view.findViewById(R.id.image);
view.setTag(holder);
} else {
holder = (ViewHolder) view.getTag();
}
//holder.text.setText("Item " + (position + 1));
holder.text.setText(categoriesPicterusName.get(position));
imageLoader.displayImage(imageUrls.get(position)/*imageUrls[position]*/, holder.image, options, animateFirstListener);
return view;
}
}
private static class AnimateFirstDisplayListener extends SimpleImageLoadingListener {
static final List<String> displayedImages = Collections.synchronizedList(new LinkedList<String>());
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
if (loadedImage != null) {
ImageView imageView = (ImageView) view;
boolean firstDisplay = !displayedImages.contains(imageUri);
if (firstDisplay) {
FadeInBitmapDisplayer.animate(imageView, 500);
displayedImages.add(imageUri);
}
}
}
}
} | [
"zhongkensla@gmail.com"
] | zhongkensla@gmail.com |
477c93d0ea99bb6c8b6416e6461f3bee3ec5e9e4 | e1aa611b40c00433d3e073c26e9f75472b3b7006 | /src/main/java/com/agh/compilers/antlr4/HTMLParserBaseListener.java | 4ffcae2f10f9c351caccff81827cf0dea8a67501 | [] | no_license | poznas/antlr4-playground | 05d88d50a16279d7c0c92de6269ff49e7dcedd73 | 04cfce92f230044ff12153a62846edf2f2b46eea | refs/heads/master | 2020-06-01T05:39:21.222784 | 2019-06-09T22:06:13 | 2019-06-09T22:06:13 | 190,660,003 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,536 | java | package com.agh.compilers.antlr4;// Generated from HTMLParser.g4 by ANTLR 4.7.2
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.tree.ErrorNode;
import org.antlr.v4.runtime.tree.TerminalNode;
/**
* This class provides an empty implementation of {@link HTMLParserListener},
* which can be extended to create a listener which only needs to handle a subset
* of the available methods.
*/
public class HTMLParserBaseListener implements HTMLParserListener {
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterHtmlDocument(HTMLParser.HtmlDocumentContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitHtmlDocument(HTMLParser.HtmlDocumentContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterHtmlElements(HTMLParser.HtmlElementsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitHtmlElements(HTMLParser.HtmlElementsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterHtmlElement(HTMLParser.HtmlElementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitHtmlElement(HTMLParser.HtmlElementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterHtmlContent(HTMLParser.HtmlContentContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitHtmlContent(HTMLParser.HtmlContentContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterHtmlAttribute(HTMLParser.HtmlAttributeContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitHtmlAttribute(HTMLParser.HtmlAttributeContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterHtmlAttributeName(HTMLParser.HtmlAttributeNameContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitHtmlAttributeName(HTMLParser.HtmlAttributeNameContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterHtmlAttributeValue(HTMLParser.HtmlAttributeValueContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitHtmlAttributeValue(HTMLParser.HtmlAttributeValueContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterHtmlTagName(HTMLParser.HtmlTagNameContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitHtmlTagName(HTMLParser.HtmlTagNameContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterHtmlChardata(HTMLParser.HtmlChardataContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitHtmlChardata(HTMLParser.HtmlChardataContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterHtmlMisc(HTMLParser.HtmlMiscContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitHtmlMisc(HTMLParser.HtmlMiscContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterHtmlComment(HTMLParser.HtmlCommentContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitHtmlComment(HTMLParser.HtmlCommentContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterXhtmlCDATA(HTMLParser.XhtmlCDATAContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitXhtmlCDATA(HTMLParser.XhtmlCDATAContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterDtd(HTMLParser.DtdContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitDtd(HTMLParser.DtdContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterXml(HTMLParser.XmlContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitXml(HTMLParser.XmlContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterScriptlet(HTMLParser.ScriptletContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitScriptlet(HTMLParser.ScriptletContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterScript(HTMLParser.ScriptContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitScript(HTMLParser.ScriptContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterStyle(HTMLParser.StyleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitStyle(HTMLParser.StyleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterEveryRule(ParserRuleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitEveryRule(ParserRuleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void visitTerminal(TerminalNode node) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void visitErrorNode(ErrorNode node) { }
}
| [
"misterdannypl@gmail.com"
] | misterdannypl@gmail.com |
b0e909e5f06f804b806b8fd4f2ed04416864e677 | 6dd05fe5cd782bb0705da058907e419e6646120d | /KontohanteringsProgramUppgift/src/kontohantering/data/Mortgage.java | 43d69dc352746764bf3db3471b89e099bce6cc51 | [] | no_license | jolindse/kontohantering | 8864691a28503b21454821d1f1efd78f0dcb7386 | 523bb1c7806f985d6739619f96bd793f0ac83fe8 | refs/heads/master | 2020-06-07T18:35:15.001545 | 2015-09-29T07:58:36 | 2015-09-29T07:58:36 | 41,854,045 | 0 | 0 | null | null | null | null | ISO-8859-15 | Java | false | false | 3,428 | java | package kontohantering.data;
import static kontohantering.data.ModelConstants.CUSTOMER_RATINGS;
import static kontohantering.data.ModelConstants.LOAN_RATES;
import static kontohantering.data.ModelConstants.LOAN_RATIO;
/*
* Mortage class
* ---------------------
* Provides assets for Customer-objects and
* methods for mortages.
*/
public class Mortgage {
private boolean hasMortage;
private double amount;
private double maxAmount;
private Customer currCustomer;
private char custRating;
private int ratingIndex;
private int years;
public Mortgage (Customer currCustomer){
this.currCustomer = currCustomer;
setIndex();
amount = 0;
years = 0;
hasMortage = false;
}
public Mortgage (Customer currCustomer, double amount, int years){
this.currCustomer = currCustomer;
this.amount = amount;
this.years = years;
setIndex();
if (amount < 1){
hasMortage = false;
} else {
hasMortage = true;
}
}
public boolean applyForMortgage(int aYears, double aAmount){
/*
* Method to check if mortgage can be applied.
*/
boolean mortOk = false;
double maxAmount = getMaxAmount();
if (aAmount <= maxAmount && aYears < 13){
amount = aAmount;
years = aYears;
hasMortage = true;
mortOk = true;
}
return mortOk;
}
public void payOffMortgage(){
/*
* Method to nullify mortgage
*/
amount = 0;
years = 0;
hasMortage = false;
}
private void setIndex(){
/*
* Sets the index value so that correct interest can be applied
*/
custRating = currCustomer.getCustomerRating();
ratingIndex = new String(CUSTOMER_RATINGS).indexOf(custRating);
}
public double getInterest(){
return LOAN_RATES[ratingIndex];
}
public double getAmount(){
return amount;
}
public int getYears(){
return years;
}
public boolean getHasMortgage(){
return hasMortage;
}
public double calculateMonthlyPayments(int currYears, double currAmount){
/*
* Calculates the monthly cost of a mortgage
*/
int months = currYears * 12;
double totalCost = calculateTotalCost(currYears, currAmount);
double monthlyPayment = totalCost/months;
return monthlyPayment;
}
public double calculateTotalCost(int currYears, double currAmount){
/*
* Calculates the total cost of mortgage including interest
*/
int months = currYears * 12;
double interest = getInterest() / 12;
double totalCost = (currAmount * (interest*Math.pow((1+interest),months))/((Math.pow(1+interest, months))-1))*months;
return totalCost;
}
public double getMaxAmount(){
/*
* Calculates the max amount a customer can borrow based on customer rating and balance
*/
double totalBalance = currCustomer.getTotalBalance();
double ratio = LOAN_RATIO[ratingIndex];
maxAmount = totalBalance * (1+ratio);
return maxAmount;
}
@Override
public String toString() {
/*
* Returns nicely formatted string for output of mortgage
*/
if (!hasMortage){
return "Inget lån.";
} else {
double monthPayment = 0;
double unusedMaxAmount = getMaxAmount() - amount;
if (years > 0 && amount > 0){
monthPayment = calculateMonthlyPayments(years, amount);
}
return String.format("Lånebelopp:\t\t%.2f SEK"
+ "\nOutnyttjat lånebelopp:\t%.2f SEK"
+ "\nMaxbelopp:\t\t%.2f SEK"
+ "\n\nMånatlig betalning:\t%.2f SEK"
+ "\nÅr:\t\t\t"+years
+ "\n",amount,unusedMaxAmount,getMaxAmount(),monthPayment);
}
}
}
| [
"jolindse@hotmail.com"
] | jolindse@hotmail.com |
72f30ba4985e351c4770fba20e978afd9d2bb880 | 91e252cd6d6d8efd9b21ec86ea18eb0a15f5ae72 | /src/main/java/com/developer/aws/s3example/service/AwsS3UploadService.java | 098c4149c4c371bce5329931ba996f1db13e9ae3 | [] | no_license | dpcampillo/s3-examples | cf1f5e823d3e5dd9bcc24b4de44f81f671091aee | 1eb9c9d10c3a986ae46b8f690a41c735fba1581c | refs/heads/master | 2020-12-27T21:40:59.005232 | 2020-02-03T21:46:45 | 2020-02-03T21:46:45 | 238,067,617 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 538 | java | package com.developer.aws.s3example.service;
import com.amazonaws.services.s3.AmazonS3;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@Service
public class AwsS3UploadService {
@Value("${aws.param.bucket-name}")
private String bucketName;
private final AmazonS3 amazonS3;
public AwsS3UploadService(AmazonS3 amazonS3){
this.amazonS3 = amazonS3;
}
public boolean checkBucket(){
return amazonS3.doesBucketExistV2(bucketName);
}
}
| [
"daaperez@bancolombia.com.co"
] | daaperez@bancolombia.com.co |
749bf805a91f7e3ac43c83d5ad81f8de9ab1a408 | ee0e085f5223e8545f65d7efd0c399be03645688 | /src/main/java/ovh/kocproz/markpages/data/model/PersistentLoginsModel.java | de6cdb3ad9861f2f5bc33ccb12001f3b82b89de8 | [
"MIT"
] | permissive | KocproZ/MDPages | bcf1e734c498fc810f281ba7ea6eea76d858c42a | 9d48cb363f4df862654ac34ba13f7b8072f4732d | refs/heads/master | 2021-05-11T02:41:54.423501 | 2019-10-09T19:39:51 | 2019-10-09T19:39:51 | 118,370,179 | 6 | 2 | MIT | 2019-11-04T20:31:53 | 2018-01-21T20:15:41 | Java | UTF-8 | Java | false | false | 736 | java | package ovh.kocproz.markpages.data.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import java.sql.Timestamp;
@Entity
@Table(name = "persistent_logins")
public class PersistentLoginsModel {
@NotNull
@Column(name = "username", nullable = false, length = 32)
private String username;
@Id
@NotNull
@Column(name = "series", nullable = false, length = 64)
private String series;
@NotNull
@Column(name = "token", nullable = false, length = 64)
private String token;
@NotNull
@Column(name = "last_used", nullable = false)
private Timestamp last_user;
}
| [
"kocproz@protonmail.com"
] | kocproz@protonmail.com |
7b4ecbbb9bce712cedc18048736c41411f0b0758 | bab9f88869e3c71d6f0445e6f1d64546e6a9f5da | /src/main/java/com/thread/test/lee/LongestCommonPrefix.java | 7c5c584bd57bdbce5ac3fea7c6177576e91c2314 | [] | no_license | guolei1204/adt | ae6f11be302aae66438f68bbb112c574e7949ade | e04c803b4073beb349bfcc449f489d7d2ad25359 | refs/heads/master | 2022-05-01T00:26:17.854829 | 2022-03-17T10:58:53 | 2022-03-17T10:58:53 | 136,132,276 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 833 | java | package com.thread.test.lee;
public class LongestCommonPrefix {
public static String m1(String[] args) {
if (args == null || args.length == 0) {
return "";
}
StringBuilder sb = new StringBuilder();
int fl = args[0].length();
for (int i = 0; i < fl; i++) {
char curr = args[0].charAt(i);
for (int j = 1; j < args.length; j++) {
if(i > args[j].length() || args[j].charAt(i) != curr){
return sb.toString();
}
}
sb.append(curr);
}
return sb.toString();
}
public static void main(String[] args) {
String[] arr = new String[]{
"flower", "flow", "floght"
};
String r = m1(arr);
System.out.println(r);
}
}
| [
"guolei_1204@foxmail.com"
] | guolei_1204@foxmail.com |
dc8839f81bddcc06d1c047946d6e60481dd9670e | 46c6ac170987816c0a7fcb86e6b4ff687fe7c80a | /DesignPatterns/src/main/java/com/ttn/designpatterns/exercise/exercise2/Circle.java | e7aae42c71f95157a2ae01dffdaa95487e199556 | [] | no_license | ajay-kmr/design-pattern | 0a3babab0f6c52813829132403562045319af0d7 | 227c4e7bb2b10e73797c9bed76aefe93e32718c6 | refs/heads/master | 2021-01-01T19:41:51.738590 | 2017-07-29T17:34:38 | 2017-07-29T17:34:38 | 98,655,306 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 394 | java | package com.ttn.designpatterns.exercise.exercise2;
public class Circle implements Shape {
private int x;
private int y;
private int radius;
public Circle(int x, int y, int radius) {
this.x = x;
this.y = y;
this.radius = radius;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public int getRadius() {
return radius;
}
}
| [
"ajay.kumar@tothenew.com"
] | ajay.kumar@tothenew.com |
d842ae7764e6bf96fe61282f356ff1e1b4eb9643 | 647a4dc063f18d6258833107d3dc6b1e6bf04db4 | /src/main/samples/MapFileReadFile.java | d5a49f265bd3aa2fac3f86538aa6d6534d76be13 | [] | no_license | heyhwi/hadoop-exercise | beae401697f44734233216f34b24637527bc6e2d | c230c0555f076a64c2e20a78d749b15667a53596 | refs/heads/master | 2022-05-07T22:41:07.189131 | 2019-06-16T14:47:40 | 2019-06-16T14:47:40 | 185,336,497 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,163 | java | import java.io.IOException;
import java.net.URI;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.io.IOUtils;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.MapFile;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.util.ReflectionUtils;
public class MapFileReadFile {
public static void main(String[] args) throws IOException {
String uri = "你想要读取的MapFile文件位置";
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(URI.create(uri), conf);
MapFile.Reader reader = null;
try {
reader = new MapFile.Reader(fs, uri, conf);
WritableComparable key = (WritableComparable) ReflectionUtils.newInstance(reader.getKeyClass(), conf);
Writable value = (Writable) ReflectionUtils.newInstance(reader.getValueClass(), conf);
while (reader.next(key, value)) {
System.out.printf("%s\t%s\n", key, value);
}
//支持随机读取
reader.get(new IntWritable(7), value);
System.out.printf("%s\n", value);
} finally {
IOUtils.closeStream(reader);
}
}
}
| [
"huweichu@gmail.com"
] | huweichu@gmail.com |
86ca20132c7bdec346e7e7c57170b2b01f263318 | f9d13358bfb45c5622767964705bc1a26029a5b2 | /Xmu Lecture/src/com/lecture/lectureapp/SubscribeMyadapter.java | 3339294e27ae116578b49b7fb45c2a04029079dc | [] | no_license | xmulectureapp/Mac-Chen-Version | 129311cafe8f2331e1b75ad98f78f7dc9e134b89 | 87068ed5853664fbf931a7258eebfb82d28b566a | refs/heads/master | 2020-12-24T17:26:52.139125 | 2014-08-21T00:33:06 | 2014-08-21T00:33:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,042 | java | package com.lecture.lectureapp;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.lecture.DBCenter.DBCenter;
import com.lecture.layoutUtil.PopMenuView;
import com.lecture.layoutUtil.PopShareView;
import com.lecture.lectureapp.R;
import com.lecture.lectureapp.SubscribeMyadapter.ViewHolder;
import com.lecture.lectureapp.R.string;
import com.lecture.lectureapp.wxapi.WXEntryActivity;
import com.lecture.localdata.Event;
import com.lecture.localdata.ReminderInfo;
import com.lecture.util.LikeInterface;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.provider.CalendarContract.Events;
import android.provider.CalendarContract.Reminders;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
public class SubscribeMyadapter extends BaseAdapter
{
private LayoutInflater mInflater;
private Context mContext;
private Event event;
private List<Event> mData;
private DBCenter dbCenter;
//下面是咸鱼的代码,用于解决点赞的bug 2014 - 08 - 09 22:13
ConnectivityManager mConnectivityManager;
NetworkInfo mNetworkInfo;
//下面是咸鱼的增加,用于实现分享 2014-08-11 20:34
private PopShareView popShareMenu;
public final class ViewHolder
{
public TextView lectureName;
public ImageView line1;
public TextView lectureAddr;
public TextView lectureTime;
public TextView lectureSpeaker;
public LinearLayout linearlayoutid;
public TextView lectureId;
public ImageView line2;
public ImageView shareIcon;
public TextView shareText;
public ImageView line3;
public ImageView commentIcon;
public TextView commentText;
public ImageView line4;
public ImageView likeIcon;
public TextView likeText;
public ImageView line5;
public ImageView remindIcon;
public TextView remindText;
public LinearLayout linearlayoutShare;
public LinearLayout linearlayoutComment;
public LinearLayout linearlayoutLike;
public LinearLayout linearlayoutRemind;
}
//用于更新ListView时
public void setMData(List<Event> list){
mData = list;
}
//用于设置DBCenter
public void setDBCenter(DBCenter dbCenter){
this.dbCenter = dbCenter;
}
public SubscribeMyadapter(Context context)
{
this.mContext=context;
this.mInflater = LayoutInflater.from(context);
}
public SubscribeMyadapter(Context context, List<Event> list)
{
this.mContext=context;
this.mInflater = LayoutInflater.from(context);
mData = list;
//下面是咸鱼的代码,用于解决点赞的bug 2014 - 08 - 09 22:13
//下面获取网络状态操作的 初始化操作
mConnectivityManager = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
mNetworkInfo = mConnectivityManager.getActiveNetworkInfo();
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return mData.size();
}
@Override
public Object getItem(int arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public long getItemId(int arg0) {
// TODO Auto-generated method stub
return 0;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent)
{
ViewHolder holder = null;
//if (convertView == null)
//{
holder=new ViewHolder();
convertView = mInflater.inflate(R.layout.item, null);
holder.lectureName = (TextView)convertView.findViewById(R.id.lecture_name);
holder.line1 = (ImageView)convertView.findViewById(R.id.line_1);
holder.lectureTime = (TextView)convertView.findViewById(R.id.lecture_time);
holder.lectureAddr = (TextView)convertView.findViewById(R.id.lecture_addr);
holder.linearlayoutid = (LinearLayout)convertView.findViewById(R.id.linearlayout_id);
holder.lectureSpeaker = (TextView)convertView.findViewById(R.id.lecture_speaker);
holder.lectureId = (TextView)convertView.findViewById(R.id.lecture_id);
holder.line2 = (ImageView)convertView.findViewById(R.id.line_2);
holder.shareIcon = (ImageView)convertView.findViewById(R.id.share_icon);
holder.shareText = (TextView)convertView.findViewById(R.id.share_text);
holder.line3 = (ImageView)convertView.findViewById(R.id.line_3);
holder.commentIcon = (ImageView)convertView.findViewById(R.id.comment_icon);
holder.commentText = (TextView)convertView.findViewById(R.id.comment_text);
holder.line4 = (ImageView)convertView.findViewById(R.id.line_4);
holder.likeIcon = (ImageView)convertView.findViewById(R.id.like_icon);
holder.likeText = (TextView)convertView.findViewById(R.id.like_text);
holder.line5 = (ImageView)convertView.findViewById(R.id.line_5);
holder.remindIcon = (ImageView)convertView.findViewById(R.id.remind_icon);
holder.remindText = (TextView)convertView.findViewById(R.id.remind_text);
holder.linearlayoutShare = (LinearLayout)convertView.findViewById(R.id.linearlayout_share);
holder.linearlayoutComment = (LinearLayout)convertView.findViewById(R.id.linearlayout_comment);
holder.linearlayoutLike = (LinearLayout)convertView.findViewById(R.id.linearlayout_like);
holder.linearlayoutRemind = (LinearLayout)convertView.findViewById(R.id.linearlayout_remind);
convertView.setTag(holder);
//}
//else
//{
holder = (ViewHolder)convertView.getTag();
//}
/****************************
//下面是来自咸鱼的增加,用于实现不同校区的讲座标题显示为不同的颜色 2014 08 10 22:02
switch (mData.get(position).getAddress().substring(0, 1)) {
case "思":
holder.lectureName.setTextColor( convertView.getResources().getColor(R.color.item_title_blue));
break;
case "漳":
holder.lectureName.setTextColor( convertView.getResources().getColor(R.color.item_title_green));
break;
case "翔":
holder.lectureName.setTextColor( convertView.getResources().getColor(R.color.item_title_yellow));
break;
case "厦":
holder.lectureName.setTextColor( convertView.getResources().getColor(R.color.item_title_orange));
break;
default:
Log.i("标题颜色设置出错", "请联系开发者!");
break;
}
*********************************/
holder.lectureName.setText(mData.get(position).getTitle());
holder.lectureTime.setText("时间: " + mData.get(position).getTime());
holder.lectureAddr.setText("地点: " + mData.get(position).getAddress());
holder.lectureSpeaker.setText("主讲: " + mData.get(position).getSpeaker());
holder.lectureId.setText(mData.get(position).getUid());
final ImageView likeIcon_change = holder.likeIcon;
final TextView likeText_change = holder.likeText;
final ImageView remindIcon_change = holder.remindIcon;
final TextView remindText_change = holder.remindText;
event = mData.get(position);
//下面的代码用于实现点赞后消失的BUG,Yao, 尼玛,看来你还是不行呀!还是放弃吧!^ ^
if(mData.get(position).isLike()){
holder.likeIcon.setImageDrawable(convertView.getResources().getDrawable(R.drawable.like_red));
holder.likeText.setTextColor(convertView.getResources().getColor(R.color.main_menu_pressed));
}
else {
holder.likeIcon.setImageDrawable(convertView.getResources().getDrawable(R.drawable.like));
holder.likeText.setTextColor(convertView.getResources().getColor(R.color.item_content));
}
//按赞BUG以解决,You still have a long way to go, no a lot BUGs to go! ahahaha!
if(mData.get(position).getLikeCount() > 0){
holder.likeText.setText( adaptPlace( String.format("%d", mData.get(position).getLikeCount()) ) );
}
//holder.likeText.setText(mData.get(position).getLikeCount()); //No package identifier when getting value for resource
//下面的代码使用于 收藏按钮
if(mData.get(position).isReminded()){
holder.remindIcon.setImageDrawable(convertView.getResources().getDrawable(R.drawable.remind_red));
remindText_change.setTextColor(convertView.getResources().getColor(R.color.main_menu_pressed));
}
else {
holder.remindIcon.setImageDrawable(convertView.getResources().getDrawable(R.drawable.remind));
}
holder.linearlayoutShare.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
event = mData.get(position);// 用于保存event信息,再popShareMenu中使用
//下面是咸鱼的增加,用于实现分享 2014-08-11 20:34
//实例化
popShareMenu = new PopShareView( ((Activity)mContext), shareItemsOnClick);
//显示窗口
popShareMenu.showAtLocation( ( (Activity)mContext ).findViewById(R.id.mainview) , Gravity.BOTTOM|Gravity.CENTER_HORIZONTAL, 0, 0); //设置layout在PopupWindow中显示的位置
/****************************************************
event = mData.get(position);
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
//sendIntent.setType("text/plain");
sendIntent.setType("image/jpg");
sendIntent.putExtra(Intent.EXTRA_TITLE, "分享");
sendIntent.putExtra(Intent.EXTRA_TEXT,
"Hi,跟你分享一个有趣的讲座。" + "\n"
+ "主题:" + event.getTitle()+ "\n"
+ "时间:" + event.getTime()+"\n"
+ "地点:" + event.getAddress()+ "\n"
+ "主讲:" + event.getSpeaker() + "\n"
+ "(来自厦大讲座网)" + "\n"
+ event.getLink());
//sendIntent.putExtra(Intent.EXTRA_TEXT, event.getAddress());
//sendIntent.putExtra(Intent.EXTRA_TEXT, event.getSpeaker());
sendIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(sendIntent);
****************************************************/
}
});
holder.linearlayoutComment.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if( hasEmail(mContext) ){
//有填写邮箱,进入评论
event = mData.get(position);
//把该则讲座对应的event传入Bundle,来自KunCheng
Bundle detail_bundle = new Bundle();
detail_bundle.putSerializable("LectureComment",event);
Intent intent = new Intent(mContext,CommentView.class);
intent.putExtras(detail_bundle);
mContext.startActivity(intent);
}
}
});
holder.linearlayoutLike.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// showInfo3();
event = mData.get(position);
if ( !event.isLike() )
{
//下面是咸鱼的代码,用于解决点赞的bug 2014 - 08 - 09 22:13
mNetworkInfo = mConnectivityManager.getActiveNetworkInfo();
if( mNetworkInfo != null ){
event.setLike(!event.isLike());
likeIcon_change.setImageDrawable(v.getResources().getDrawable(R.drawable.like_red));
likeText_change.setTextColor(v.getResources().getColor(R.color.main_menu_pressed));
event.updateLikeCount(1);//1 表示+1
//喜欢的话,进行数据表LikeTable更新
DBCenter.setLike(dbCenter.getReadableDatabase(), event.getUid(), true);
//LikeInterface.LikeGo(event.getUid(), "1");
DBCenter.likeDBSync(dbCenter.getReadableDatabase(), event.getUid(), "1");
//下面一句解决马上变Like数字
likeText_change.setText( adaptPlace( String.format("%d", mData.get(position).getLikeCount()) ) );
}
else {
Toast.makeText(mContext, "请连接网络后按赞!", Toast.LENGTH_SHORT).show();
}
}
else
{
//下面是咸鱼的代码,用于解决点赞的bug 2014 - 08 - 09 22:13
mNetworkInfo = mConnectivityManager.getActiveNetworkInfo();
if( mNetworkInfo != null ){
event.setLike(!event.isLike());
likeIcon_change.setImageDrawable(v.getResources().getDrawable(R.drawable.like));
likeText_change.setTextColor(v.getResources().getColor(R.color.main_menu_normal));
event.updateLikeCount(-1);//-1 表示+ (-1)
//喜欢的话,进行数据表LikeTable更新
DBCenter.setLike(dbCenter.getReadableDatabase(), event.getUid(), false);
new LikeInterface().LikeGo(event.getUid(), "0");
//LikeInterface.LikeGo(event.getUid(), "0");// 0 代表不喜欢
DBCenter.likeDBSync(dbCenter.getReadableDatabase(), event.getUid(), "0");
//下面一句解决马上变Like数字
//下面代码由 咸鱼 添加,用于解决按赞数为0 的时候,文字设成 按赞
if(event.getLikeCount() == 0 )
likeText_change.setText( "点赞" );
else
likeText_change.setText( adaptPlace( String.format("%d", mData.get(position).getLikeCount()) ) );
}
else {
Toast.makeText(mContext, "请连接网络后按赞!", Toast.LENGTH_SHORT).show();
}
}
}
});
holder.linearlayoutRemind.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
event = mData.get(position);
event.setReminded(!event.isReminded());
if (event.isReminded())
{
remindIcon_change.setImageDrawable(v.getResources().getDrawable(R.drawable.remind_red));
remindText_change.setTextColor(v.getResources().getColor(R.color.main_menu_pressed));
//添加到日历
insertIntoCalender();
//收藏的话,进行数据表CollectionTable更新
DBCenter.setRemind(dbCenter.getReadableDatabase(), event.getUid(), event.getReminderID(), event.getEventID(), true);
}
else
{
remindIcon_change.setImageDrawable(v.getResources().getDrawable(R.drawable.remind));
remindText_change.setTextColor(v.getResources().getColor(R.color.main_menu_normal));
//从日历删除
deleteFromCalender();
//不收藏,进行数据表CollectionTable更新
DBCenter.setRemind(dbCenter.getReadableDatabase(), event.getUid(), "", "", false);
}
}
});
return convertView;
}
//下面用于给按赞添加一个空格如果只有个位数的话
public String adaptPlace(String s){
if(s.length() == 1)
return " " + s + " ";
else if(s.length() == 2)
return " " + s + " ";
else
return s;
}
public void insertIntoCalender() {
long calId = 1;
GregorianCalendar startDate = event.getTimeCalendar();
GregorianCalendar endDate = event.getTimeCalendar();
startDate.set(Calendar.HOUR_OF_DAY, 8);
startDate.set(Calendar.MINUTE, 0);
ContentResolver cr1 = mContext.getContentResolver(); // 添加新event,步骤是固定的
ContentValues values = new ContentValues();
values.put(Events.DTSTART, startDate.getTime().getTime()); // 添加提醒时间,即讲座的日期
values.put(Events.DTEND, endDate.getTime().getTime());
values.put(Events.TITLE, event.getTitle());
values.put(Events.DESCRIPTION, event.getSpeaker());
values.put(Events.EVENT_LOCATION, event.getAddress());
values.put(Events.CALENDAR_ID, calId);
values.put(Events.EVENT_TIMEZONE, "GMT+8");
Uri uri = cr1.insert(Events.CONTENT_URI, values);
Long eventId = Long.parseLong(uri.getLastPathSegment()); // 获取刚才添加的event的Id
ContentResolver cr2 = mContext.getContentResolver(); // 为刚才新添加的event添加reminder
ContentValues values1 = new ContentValues();
values1.put(Reminders.MINUTES, 10); // 设置提前几分钟提醒
values1.put(Reminders.EVENT_ID, eventId);
values1.put(Reminders.METHOD, Reminders.METHOD_ALERT); //设置该事件为提醒
Uri newReminder = cr2.insert(Reminders.CONTENT_URI, values1); // 调用这个方法返回值是一个Uri
long reminderId = Long.parseLong(newReminder.getLastPathSegment());
// 记录数据
ReminderInfo reminderInfo = new ReminderInfo(eventId, reminderId);
//event.setReminderInfo( reminderInfo );
event.setReminderID( String.format( "%d", reminderInfo.getReminderId() ) );
event.setEventID( String.format( "%d", reminderInfo.getEventId() ) );
Toast.makeText(mContext, "添加到收藏和日历 成功", Toast.LENGTH_SHORT).show();
}
public void deleteFromCalender() {
Uri deleteReminderUri = null;
Uri deleteEventUri = null;
deleteReminderUri = ContentUris.withAppendedId(Reminders.CONTENT_URI,
Long.parseLong( event.getReminderID() ) );
deleteEventUri = ContentUris.withAppendedId(Events.CONTENT_URI,
Long.parseLong( event.getEventID() ) );
int rowR = mContext.getContentResolver().delete(deleteReminderUri,
null, null);
int rowE = mContext.getContentResolver().delete(deleteEventUri, null,
null);
if (rowE > 0 && rowR > 0) {
Toast.makeText(mContext, "从收藏和日历 删除成功", Toast.LENGTH_SHORT).show();
} else
Toast.makeText(mContext, "从收藏和日历 删除失败", Toast.LENGTH_SHORT).show();
}
//下面是咸鱼的修改,用于添加没有填写邮箱禁止评论的功能 2014年8月6日 23:16
public Boolean hasEmail(Context context){
SharedPreferences sharedPre = context.getSharedPreferences("config",
context.MODE_PRIVATE);
if( sharedPre.getString("email", "").equals("") ){
Toast.makeText(context, "Hi,请先到设置中心\"我\"中设置邮箱后便可评论!",Toast.LENGTH_LONG).show();
return false;
}
return true;
}
//为弹出窗口popShareMenu实现监听类
private OnClickListener shareItemsOnClick = new OnClickListener(){
public void onClick(View v) {
Intent intent;
switch (v.getId()) {
case R.id.wechat_share:
Toast.makeText(mContext, "微信好友", Toast.LENGTH_LONG).show();
intent = new Intent(mContext, WXEntryActivity.class);
intent.putExtra("shareEvent", event);
mContext.startActivity(intent);
if(popShareMenu != null)
popShareMenu.dismiss();
break;
case R.id.wechat_circle_share:
Toast.makeText(mContext, "微信朋友圈", Toast.LENGTH_LONG).show();
intent = new Intent(mContext, WXEntryActivity.class);
intent.putExtra("shareEvent", event);
intent.putExtra("isSharedToSession", false);
mContext.startActivity(intent);
if(popShareMenu != null)
popShareMenu.dismiss();
break;
case R.id.weibo_share:
Toast.makeText(mContext, "新浪微博", Toast.LENGTH_LONG).show();
Intent sendIntent = new Intent();
ComponentName comp = new ComponentName("com.sina.weibo", "com.sina.weibo.EditActivity");
sendIntent.setComponent(comp);
if( event != null){
try {
sendIntent.setAction(Intent.ACTION_SEND);
//sendIntent.setType("text/plain");
sendIntent.setType("text");
sendIntent.putExtra(Intent.EXTRA_TITLE, "分享");
sendIntent.putExtra(Intent.EXTRA_TEXT,
"#" + event.getAddress().substring(0, 4) + "讲座#"
+ "【" + event.getTitle()+ "】" + " "
+ "时间: " + event.getCustomTime() +" | "
+ "地点: " + "#" + event.getAddress().substring(0, 4) + "#" + event.getAddress().substring(4) + " | "
+ "主讲: " + event.getSpeaker() + " | "
+ "详情点击: "
+ event.getLink() + " From #厦大讲座App Especially#" );
sendIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(sendIntent);
}
catch (Exception e) {
Toast.makeText(mContext, "您的微博未打开 或者 版本过低,未能够分享!", Toast.LENGTH_LONG).show();
}
}
if(popShareMenu != null)
popShareMenu.dismiss();
break;
default:
break;
}
}
};
}// end adapter
| [
"xianyuxmu@gmail.com"
] | xianyuxmu@gmail.com |
fd33cf59af2a4fc74c681ffd1a59edfad0b0f8e0 | dd5874dc1a4d1813825467a2dea7bcc3b79b48be | /hm-crm/src/main/java/com/crm/controller/crm/BeiDouSMSCodeAPI.java | a3cf8f215cfd1ac8e4883209620852bcf52e1224 | [] | no_license | Whisky-Xo/hm_work | 93b7c3a45c30ade4e6ce1b987f369d9ec2828a49 | 02848084ad7bc783586cc851efec998af3ff2bc1 | refs/heads/master | 2021-01-19T20:31:09.559028 | 2017-04-17T14:52:59 | 2017-04-17T14:52:59 | 88,515,230 | 1 | 3 | null | null | null | null | UTF-8 | Java | false | false | 10,722 | java | package com.crm.controller.crm;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONObject;
import com.crm.api.CrmBaseApi;
import com.crm.api.constant.QieinConts;
import com.crm.common.util.CookieCompoment;
import com.crm.common.util.SMSUtils;
import com.crm.common.util.StringUtil;
import com.crm.common.util.UtilRegex;
import com.crm.common.util.WebUtils;
import com.crm.exception.EduException;
import com.crm.model.ClientInfo;
import com.crm.model.Company;
import com.crm.model.Shop;
import com.crm.model.SmsCode;
import com.crm.model.Staff;
import com.crm.service.ClientInfoService;
import com.crm.service.ShopService;
import com.crm.service.StaffService;
import com.crm.service.impl.SmsCodeServiceImpl;
import com.taobao.api.ApiException;
/**
* CRM3.0北斗新星:短信接口
*
* @author JingChenglong 2017-02-15 11:19
*
*/
@Controller
@RequestMapping("/client")
public class BeiDouSMSCodeAPI {
@Autowired
StaffService staffService;/* 职工管理 */
@Autowired
ShopService shopService;/* 门店 */
@Autowired
ClientInfoService clientInfoService;/* 客资 */
@Autowired
CrmBaseApi crmBaseApi;/* 后端接口调用 */
@Autowired
SmsCodeServiceImpl smsCodeServiceImpl;/* 短信模板 */
private static final Company QIEIN = new Company();
private static Map<String, Object> reqContent;
static {
QIEIN.setCompName(QieinConts.QIEIN);
}
/*-- 短信预览--预约进店短信 --*/
@RequestMapping(value = "msg_preview", method = RequestMethod.POST)
@ResponseBody
public Model msgPreview(@RequestParam Map<String, String> maps, Model model, HttpServletRequest request,
HttpServletResponse response) {
Staff staff = getStaffDetail(request);
/*-- 参数提取 --*/
String kzId = StringUtil.nullToStrTrim(maps.get("kzid"));
String yyShopId = StringUtil.nullToStrTrim(maps.get("shopid"));
String yyTime = StringUtil.nullToStrTrim(maps.get("yytime"));
String phone = StringUtil.nullToStrTrim(maps.get("phone"));
/*-- 参数校验 --*/
if (StringUtil.isEmpty(kzId) || StringUtil.isEmpty(yyShopId) || StringUtil.isEmpty(yyTime)
|| StringUtil.isEmpty(phone)) {
model.addAttribute("code", "999999");
model.addAttribute("msg", "参数不完整或格式错误");
return model;
}
/*-- 获取客资详细信息 --*/
ClientInfo client = new ClientInfo();
client.setKzId(kzId);
client.setCompanyId(staff.getCompanyId());
try {
client = clientInfoService.getClientInfo(client);
} catch (Exception e) {
model.addAttribute("code", "999999");
model.addAttribute("msg", "客资信息获取失败");
return model;
}
/*-- 客资校验 --*/
if (client == null) {
model.addAttribute("code", "999999");
model.addAttribute("msg", "客资不存在");
return model;
}
if (!UtilRegex.validateMobile(phone)) {
model.addAttribute("code", "999999");
model.addAttribute("msg", "客户电话号码无效");
return model;
}
/*-- 获取客资遇到门店信息 --*/
Shop shop = shopService.getByShopId(Integer.valueOf(yyShopId));
if (shop == null) {
model.addAttribute("code", "999999");
model.addAttribute("msg", "未获取到门店信息");
return model;
}
// 获取短信模板配置
SmsCode smsCode = null;
try {
smsCode = getSmsTemplate(staff.getCompanyId(), SmsCode.YYJD);
} catch (EduException e) {
model.addAttribute("code", "999999");
model.addAttribute("msg", e.getMessage());
return model;
}
// 生成预览短信
String smsPrew = null;
try {
smsPrew = getYyjdSmsPreview(smsCode, client, shop, phone, yyTime);
} catch (Exception e) {
model.addAttribute("code", "999999");
model.addAttribute("msg", "生成预览短信失败,请联系管理员校验短信模板");
return model;
}
model.addAttribute("code", "100000");
model.addAttribute("msg", "成功");
model.addAttribute("sms", smsPrew);
return model;
}
/*-- 发送预约进店短息 --*/
@RequestMapping(value = "send_msg", method = RequestMethod.POST)
@ResponseBody
public Model sendMsg(@RequestParam Map<String, String> maps, Model model, HttpServletRequest request,
HttpServletResponse response) {
Staff staff = getStaffDetail(request);
/*-- 参数提取 --*/
String kzId = StringUtil.nullToStrTrim(maps.get("kzid"));
String yyShopId = StringUtil.nullToStrTrim(maps.get("shopid"));
String yyTime = StringUtil.nullToStrTrim(maps.get("yytime"));
String phone = StringUtil.nullToStrTrim(maps.get("phone"));
/*-- 参数校验 --*/
if (StringUtil.isEmpty(kzId) || StringUtil.isEmpty(yyShopId) || StringUtil.isEmpty(yyTime)
|| StringUtil.isEmpty(phone)) {
model.addAttribute("code", "999999");
model.addAttribute("msg", "参数不完整或格式错误");
return model;
}
/*-- 获取客资详细信息 --*/
ClientInfo client = new ClientInfo();
client.setKzId(kzId);
client.setCompanyId(staff.getCompanyId());
try {
client = clientInfoService.getClientInfo(client);
} catch (Exception e) {
model.addAttribute("code", "999999");
model.addAttribute("msg", "客资信息获取失败");
return model;
}
/*-- 客资校验 --*/
if (client == null) {
model.addAttribute("code", "999999");
model.addAttribute("msg", "客资不存在");
return model;
}
if (!UtilRegex.validateMobile(phone)) {
model.addAttribute("code", "999999");
model.addAttribute("msg", "客户电话号码无效");
return model;
}
/*-- 获取客资遇到门店信息 --*/
Shop shop = shopService.getByShopId(Integer.valueOf(yyShopId));
if (shop == null) {
model.addAttribute("code", "999999");
model.addAttribute("msg", "未获取到门店信息");
return model;
}
// 获取短信模板配置
SmsCode smsCode = null;
try {
smsCode = getSmsTemplate(staff.getCompanyId(), SmsCode.YYJD);
} catch (EduException e) {
model.addAttribute("code", "999999");
model.addAttribute("msg", e.getMessage());
return model;
}
String yyCode;
try {
yyCode = getYyCode(client, smsCode);
} catch (Exception e) {
model.addAttribute("code", "999999");
model.addAttribute("msg", e.getMessage());
return model;
}
/*-- 发送短息 --*/
String address = shop.getAddress() + "," + shop.getMerchantShowName();
try {
String rst = SMSUtils.sendKzComeShopJinFuRen(phone, yyCode, yyTime, address, shop.getMerchantShowPhone(),
smsCode);
JSONObject json = JSONObject.parseObject(rst);
if (!"0".equals(json.getJSONObject("alibaba_aliqin_fc_sms_num_send_response").getJSONObject("result")
.getString("err_code"))) {
model.addAttribute("code", "999999");
model.addAttribute("msg", "短信发送失败,请稍后重试。");
return model;
}
} catch (ApiException e) {
model.addAttribute("code", "999999");
model.addAttribute("msg", "短信发送失败,请稍后重试。");
return model;
} catch (EduException e) {
model.addAttribute("code", "999999");
model.addAttribute("msg", "短信发送失败,请稍后重试。");
return model;
} catch (Exception e) {
model.addAttribute("code", "999999");
model.addAttribute("msg", "短信发送失败,请稍后重试。");
return model;
}
/*-- 修改状态,日志记录 --*/
reqContent = new HashMap<String, Object>();
reqContent.put("ip", WebUtils.getIP(request));
reqContent.put("kzids", kzId);
reqContent.put("operaid", staff.getId());
reqContent.put("companyid", staff.getCompanyId());
reqContent.put("code", yyCode);
try {
crmBaseApi.doService(reqContent, "doAddSendSmsLog");
} catch (EduException e) {
e.printStackTrace();
}
model.addAttribute("code", "100000");
model.addAttribute("msg", "发送成功");
return model;
}
// 根据短信模板过滤生成预览短信-预约进店
public String getYyjdSmsPreview(SmsCode smsCode, ClientInfo info, Shop shop, String phone, String yyTime)
throws Exception {
if (smsCode == null || info == null || StringUtil.isEmpty(smsCode.getSpare3())) {
return "";
}
String template = smsCode.getSpare3();
template = template.replace("${code}", getYyCode(info, smsCode));
template = template.replace("${time}", yyTime);
template = template.replace("${address}",
StringUtil.nullToStr((shop.getAddress())) + "," + shop.getMerchantShowName());
template = template.replace("${telno}", shop.getMerchantShowPhone());
template = "【" + smsCode.getSign() + "】" + template;
return template;
}
// 获取预约进店编码
public String getYyCode(ClientInfo client, SmsCode smcCode) throws EduException {
if (client == null) {
throw new EduException("客资信息获取失败");
}
String code = StringUtil.nullToStrTrim(smcCode.getSpare1());
code += client.getKzNum();
code += StringUtil.nullToStrTrim(smcCode.getSpare2());
return code;
}
// 获取短信模板
public SmsCode getSmsTemplate(Integer companyId, String smsType) throws EduException {
if (companyId == null || companyId == 0) {
throw new EduException("企业信息不能为空");
}
if (StringUtil.isEmpty(smsType)) {
throw new EduException("短信模板类型不能为空");
}
HashMap<String, Object> param = new HashMap<String, Object>();
param.put("companyId", companyId);
param.put("smsType", smsType);
SmsCode smsCode = null;
try {
smsCode = smsCodeServiceImpl.getSmsCodeByCondition(param);
} catch (EduException e) {
throw new EduException("短信模板获取失败");
} finally {
if (smsCode == null) {
throw new EduException("企业未配置该短信模板,请联系管理员。");
}
if (StringUtil.isEmpty(smsCode.getUrl()) || StringUtil.isEmpty(smsCode.getAppKey())
|| StringUtil.isEmpty(smsCode.getSecret())) {
throw new EduException("企业短信参数不完整,请联系管理员。");
}
}
if (!smsCode.getIsShow()) {
throw new EduException("预约进店短信功能被管理员限定,请联系管理员。");
}
return smsCode;
}
// 获取登录人详细信息
public Staff getStaffDetail(HttpServletRequest request) {
Staff staff = CookieCompoment.getLoginUser(request);
if (staff == null) {
return null;
}
return staffService.getStaffInfoById(staff.getId());
}
} | [
"whisky@123.com"
] | whisky@123.com |
c1f5c893aab62f6b335d751904be1658591f906d | 4d35671419183d68d8ed0cf3dd5d79dda27653fc | /src/test/java/com/github/ajunte/bundler/GetAbsolutePathTest.java | adc8649fb10142bd0e957bd6cde0a526f9102a20 | [
"Apache-2.0"
] | permissive | jradolfo/ajunte-maven-plugin | 796175db5f70a729b2dbb007eee60f0822450224 | 0c0906bdcd80da53c7671d0628220f7e72341a62 | refs/heads/master | 2022-06-21T07:36:56.022458 | 2022-06-13T14:14:16 | 2022-06-13T14:14:16 | 142,805,953 | 0 | 0 | Apache-2.0 | 2022-06-13T14:11:47 | 2018-07-30T00:30:17 | Java | UTF-8 | Java | false | false | 4,307 | java | package com.github.ajunte.bundler;
import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat;
import java.io.File;
import java.util.Collection;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import com.github.jradolfo.ajunte.util.PathNormalizator;
@RunWith(Parameterized.class)
public class GetAbsolutePathTest {
private static final Object[][] CONFIG = new Object[][]{
{"work/proj/src/base/index-dev.html", "url/app.css", "file/img.png", "work/proj/src/base/url/file/img.png"},
{"work/proj/src/base/index-dev.html", "url/app.css", "img.png", "work/proj/src/base/url/img.png"},
{"work/proj/src/base/index-dev.html", "url/app.css", "../img.png", "work/proj/src/base/img.png"},
{"work/proj/src/base/index-dev.html", "app.css", "file/img.png", "work/proj/src/base/file/img.png"},
{"work/proj/src/base/index-dev.html", "app.css", "img.png", "work/proj/src/base/img.png"},
{"work/proj/src/base/index-dev.html", "app.css", "../img.png", "work/proj/src/img.png"},
{"work/proj/src/base/index-dev.html", "../app.css", "file/img.png", "work/proj/src/file/img.png"},
{"work/proj/src/base/index-dev.html", "../app.css", "img.png", "work/proj/src/img.png"},
{"work/proj/src/base/index-dev.html", "../app.css", "../img.png", "work/proj/img.png"},
{"work/proj/src/index-dev.html", "url/app.css", "file/img.png", "work/proj/src/url/file/img.png"},
{"work/proj/src/index-dev.html", "url/app.css", "img.png", "work/proj/src/url/img.png"},
{"work/proj/src/index-dev.html", "url/app.css", "../img.png", "work/proj/src/img.png"},
{"work/proj/src/index-dev.html", "app.css", "file/img.png", "work/proj/src/file/img.png"},
{"work/proj/src/index-dev.html", "app.css", "img.png", "work/proj/src/img.png"},
{"work/proj/src/index-dev.html", "app.css", "../img.png", "work/proj/img.png"},
{"work/proj/src/index-dev.html", "../app.css", "file/img.png", "work/proj/file/img.png"},
{"work/proj/src/index-dev.html", "../app.css", "img.png", "work/proj/img.png"},
{"work/proj/src/index-dev.html", "../app.css", "../img.png", "work/img.png"},
{"work/proj/src/base/lib/index-dev.html", "url/app.css", "file/img.png", "work/proj/src/base/lib/url/file/img.png"},
{"work/proj/src/base/lib/index-dev.html", "url/app.css", "img.png", "work/proj/src/base/lib/url/img.png"},
{"work/proj/src/base/lib/index-dev.html", "url/app.css", "../img.png", "work/proj/src/base/lib/img.png"},
{"work/proj/src/base/lib/index-dev.html", "app.css", "file/img.png", "work/proj/src/base/lib/file/img.png"},
{"work/proj/src/base/lib/index-dev.html", "app.css", "img.png", "work/proj/src/base/lib/img.png"},
{"work/proj/src/base/lib/index-dev.html", "app.css", "../img.png", "work/proj/src/base/img.png"},
{"work/proj/src/base/lib/index-dev.html", "../app.css", "file/img.png", "work/proj/src/base/file/img.png"},
{"work/proj/src/base/lib/index-dev.html", "../app.css", "img.png", "work/proj/src/base/img.png"},
{"work/proj/src/base/lib/index-dev.html", "../app.css", "../img.png", "work/proj/src/img.png"},
};
@Parameterized.Parameters(name = "{index} {0} {1} {2} {3}")
public static Collection<Object[]> data() {
return asList(CONFIG);
}
String sourceBasePath;
String sourceCssPath;
String resourcePath;
String absoluteResourcePath;
public GetAbsolutePathTest(String sourceBasePath, String sourceCssPath, String resourcePath, String absoluteResourcePath) {
this.sourceBasePath = sourceBasePath;
this.sourceCssPath = sourceCssPath;
this.resourcePath = resourcePath;
this.absoluteResourcePath = absoluteResourcePath.replace('/', File.separatorChar);
}
private PathNormalizator pathNormalizator = new PathNormalizator();
@Test
public void test() throws Exception {
// assertThat(pathNormalizator.getAbsoluteResourcePath(sourceBasePath, sourceCssPath, resourcePath).toString())
// .endsWith(absoluteResourcePath);
}
} | [
"jradolfo@gmail.com"
] | jradolfo@gmail.com |
93ba6824893c473eb26f13bd2e2fcd7e895a5b32 | 82e46838b3e9a1e7d466fd194e4bfeace8521a6c | /Custome_listView/app/src/main/java/com/example/custome_listview/MainActivity.java | ee59026e166d7137388db43f43037e83bbab18dc | [] | no_license | manojgoud554/Assignment | 45fbb61a266ae8375861ea58e3dd18de51f305a1 | 08f0618ab5520576c60677f2aca47ce84eccf3ac | refs/heads/master | 2023-01-12T12:29:57.203000 | 2020-11-20T03:49:23 | 2020-11-20T03:49:23 | 314,070,582 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,560 | java | package com.example.custome_listview;
import androidx.appcompat.app.AppCompatActivity;
import android.media.Image;
import android.os.Bundle;
import android.widget.ListView;
import com.example.custome_listview.Models.Movies;
import com.example.custome_listview.adpaters.MoviesCustomAdpater;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
ListView listView;
ArrayList<Movies> movies;
Integer[] images={
R.drawable.annihilation,
R.drawable.kabir_singh,
R.drawable.deadpool2,
R.drawable.uri,R.drawable.jersey,
R.drawable.kgf,
};
public ArrayList<Movies> getArrayMovies(){
ArrayList<Movies> movies=new ArrayList<>();
movies.add(new Movies("Movie Name: Annihilation","IMDb: 8.2/10","Plot:\n " +
"A mysterious quarantined zone of mutating plants and animals caused by an alien presence. Annihilation was released theatrically in Canada and the United States" +
" by Paramount Pictures on February 23, 2018, and in China on April 13, 2018.","Category: Sci-Fi/Mystery ‧ 2 hours","Release Date: 2018",images ));
movies.add(new Movies("Movie Name: Kabir singh","IMDb: 8.0/5,"Plot:\n " +
"Kabir, a genius yet hostile medical student, falls in love with Preeti from his college. When Preeti's father spots the couple kissing, he opposes" +
" their relationship and decides to marry her off.","Category: Crime/Romance ‧ 2h 52m","Release Date: 2019",images ));
movies.add(new Movies("Movie Name: Deadpool 2","IMDb: 7.5/10 ","Plot:\n " +
"Deadpool protects a young mutant Russell from the authorities and gets thrown in prison. However, he escapes and forms a team of mutants to prevent a time-travelling" +
" mercenary from killing Russell.","Category: Hero/Comedy ‧ 2h 14m","Release Date: 2018",images ));
movies.add(new Movies("Movie Name: URI","IMDb: 8.3/10,"Plot:\n " +
"Major Vihaan Singh Shergill of the Indian Army leads a covert operation against a group of militants who attacked a base in Uri, Kashmir, in " +
"2016 and killed many soldiers.","Category: Action/War ‧ 2h 18m ","Release Date: 2019",images));
movies.add(new Movies("Movie Name: Jersey","IMDb: 9/10","Plot:\n " +
"Jersey 2019 was a Telugu sports drama film that starred actor Nani in the lead role. The plot of this film revolved around a cricketer who tried to revive his career " +
"even after he failed.","Category: Sports/Drama ‧ 2h 40m","Release Date: 2019",images));
movies.add(new Movies("Movie Name: K.G.F (CH 1)","IMDb: 9/10","Plot:\n " +
"The film centres around Raja Krishnappa Bairya Rocky, born into poverty, who arrives in Bombay (now Mumbai) in the 1960s, on a quest for power and wealth as desired by his dying mother. Involved with the gold mafia there, he is recruited to kill Garuda, the" +
" oppressive heir-in-waiting, in Kolar Gold Fields.","Category: Action/Drama ‧ 2h 50m","Release Date: 2019",images));
return movies;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
listView=findViewById(R.id.MoviesListView);
movies=getArrayMovies();
MoviesCustomAdpater adpater=new MoviesCustomAdpater(movies);
listView.setAdapter(adpater);
}
} | [
"manojgoud554@gmail.com"
] | manojgoud554@gmail.com |
32a7b107ad28d5d50a7bd1d56f78076555a252ac | 237c6750e81ff6dd718f6e6a6bf7233089ec299d | /src/SL/SL_practice6.java | f9ce40e337f1a42a1d2c8a5535375a52e7afb4bb | [] | no_license | lievre95/Reviewing_JDK12 | f850c9c661337891909572cc222028b042c8e303 | dc78a4dfc9f377f4b53b655a676d44ee913922a8 | refs/heads/master | 2023-06-24T04:46:19.260448 | 2021-07-23T01:42:06 | 2021-07-23T01:42:06 | 262,161,031 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 101 | java | package SL;
public class SL_practice6 {
public static void main(String[] args) {
}
}
| [
"ivandoga95@gmail.com"
] | ivandoga95@gmail.com |
0da6529c5e1bd59e6124186de8b799a548f13d9e | ed44df19374f0e86a9faa58ad57c77a641c73ac7 | /aws-java-sdk-elasticache/src/main/java/com/amazonaws/services/elasticache/AmazonElastiCacheClientBuilder.java | 6ba2933e2e0b7970ea012f3c0e695e99708cdc3a | [
"Apache-2.0"
] | permissive | da-demo-account/aws-sdk-java | 2ef5c1f4e29e02fcc9e3310accb71f2f71183ef9 | fe64a1bbb11d9385a96e11e27fdafe606ad5c0d9 | refs/heads/master | 2021-01-11T21:36:38.624023 | 2017-01-11T20:46:23 | 2017-01-11T20:46:23 | 78,815,415 | 0 | 0 | null | 2017-01-13T04:31:36 | 2017-01-13T04:31:36 | null | UTF-8 | Java | false | false | 2,303 | java | /*
* Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.elasticache;
import com.amazonaws.ClientConfigurationFactory;
import com.amazonaws.annotation.NotThreadSafe;
import com.amazonaws.client.builder.AwsSyncClientBuilder;
import com.amazonaws.client.AwsSyncClientParams;
/**
* Fluent builder for {@link com.amazonaws.services.elasticache.AmazonElastiCache}. Use of the builder is preferred over
* using constructors of the client class.
**/
@NotThreadSafe
public final class AmazonElastiCacheClientBuilder extends AwsSyncClientBuilder<AmazonElastiCacheClientBuilder, AmazonElastiCache> {
private static final ClientConfigurationFactory CLIENT_CONFIG_FACTORY = new ClientConfigurationFactory();
/**
* @return Create new instance of builder with all defaults set.
*/
public static AmazonElastiCacheClientBuilder standard() {
return new AmazonElastiCacheClientBuilder();
}
/**
* @return Default client using the {@link com.amazonaws.auth.DefaultAWSCredentialsProviderChain} and
* {@link com.amazonaws.regions.DefaultAwsRegionProviderChain} chain
*/
public static AmazonElastiCache defaultClient() {
return standard().build();
}
private AmazonElastiCacheClientBuilder() {
super(CLIENT_CONFIG_FACTORY);
}
/**
* Construct a synchronous implementation of AmazonElastiCache using the current builder configuration.
*
* @param params
* Current builder configuration represented as a parameter object.
* @return Fully configured implementation of AmazonElastiCache.
*/
@Override
protected AmazonElastiCache build(AwsSyncClientParams params) {
return new AmazonElastiCacheClient(params);
}
}
| [
""
] | |
48fa15431fa12bb6722cdab76af2d6076b2d841a | 4465dbf695c62f06cc2c9e1438f894d5ce233292 | /random/src/test/java/ga/rugal/amazon/storageoptimization/SolutionTest.java | 7fdfac1539c9874ee0424651efe448510eb68185 | [] | no_license | Rugal/algorithm | d7e12d802fee56f96533f18c84ed097bf64db34e | 130aba9c156af73cab4b971e59f56909b01cb908 | refs/heads/master | 2023-09-04T04:30:47.571420 | 2023-08-26T06:13:51 | 2023-08-26T06:13:51 | 49,036,223 | 10 | 4 | null | null | null | null | UTF-8 | Java | false | false | 903 | java | package ga.rugal.amazon.storageoptimization;
import java.util.stream.Stream;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
public class SolutionTest {
private final Solution solution = new Solution();
static Stream<Arguments> source() {
return Stream.of(
Arguments.of(3, 3, new int[]{2}, new int[]{2}, 4),
Arguments.of(2, 2, new int[]{1}, new int[]{2}, 4),
Arguments.of(3, 2, new int[]{1, 2, 3}, new int[]{1, 2}, 12),
Arguments.of(6, 6, new int[]{4}, new int[]{2}, 4)
);
}
@ParameterizedTest
@MethodSource("source")
public void storageOpt(final int n, final int m, final int[] h, final int[] v, final int expected) {
Assertions.assertEquals(expected, this.solution.storageOpt(n, m, h, v));
}
}
| [
"rugal.bernstein.0@gmail.com"
] | rugal.bernstein.0@gmail.com |
2a920c582aed6f5693cd0a5a869e1dd7ee4322d7 | 0a4851c6d02c76acd7c856713c275d3d2045a78a | /BackEnd Con Front/eckotur.web.test/src/test/java/com/pineapple/eckotur/web/test/RegisterTest.java | 4488077cfb888ed46ae1e382d24f083410877617 | [] | no_license | Uniandes-ISIS2603-backup/2015-SoftwarePineApple | a68b64836b1609feacfa72c38379fc37b4ad26bb | 3c8189478012bc02ffc21fc687554a11ee5389ea | refs/heads/master | 2020-04-11T10:51:11.491094 | 2015-05-14T14:59:56 | 2015-05-14T14:59:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,873 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.pineapple.eckotur.web.test;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.junit.AfterClass;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.BeforeClass;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
import org.junit.runners.MethodSorters;
import org.junit.FixMethodOrder;
import org.junit.Test;
/**
*
* @author JuanCruz
*/
public class RegisterTest {
// Es la instancia inicial del web driver que controlará el navegador firefox
private static WebDriver driver;
// url en el cual se aloja la página web (en este caso localhost:8080)
private static String baseUrl;
// variable que indica si varios alert consecutivos (alert javascript) se tomarán
private static boolean acceptNextAlert = true;
private static StringBuffer verificationErrors = new StringBuffer();
/*La anotación @BeforeClass indica lo que se debe ejecutar ANTES de correr el archivo de pruebas. Este método instancia un nuevo driver firefox (causando la apertura de una ventana física de firefox).*/
@BeforeClass
public static void setUp() throws Exception {
driver = new FirefoxDriver();
// se define el url base del proyecto web
baseUrl = "http://localhost:8080/Eckotur.service/login.html";
/* Indica cuanto se espera para la respuesta de cualquier comando realizado hacia el navegador*/
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
// La anotación @AfterClass indica lo que se debe ejecutar DESPUES de ejecutar
// el archivo de pruebas. Este método cierra la ventana de firefox
// abierta por @BeforeClass que se utilizó para la prueba.
@AfterClass
public static void tearDown() throws Exception {
// Se cierra el navegador.
driver.quit();
// Se verifica que se haya cerrado efectivamente el navegador.
String verificationErrorString = verificationErrors.toString();
if (!"".equals(verificationErrorString)) {
fail(verificationErrorString);
}
}
@Test
public void t1Register() throws Exception {
boolean success = false;
/**
* Comando que busca el elemento 'name1' en el html actual. Ver ids en country.tpl.html
* Posteriormente limpia su contenido (comando clear).
*/
driver.findElement(By.id("nombre")).clear();
/**
* Comando que simula la escritura de un valor en el elemento(sendKeys)
* con el String de parámetro sobre // el elemento encontrado.
*/
driver.findElement(By.id("nombre")).sendKeys("Juan");
/**
* Comando que busca el elemento 'name1' en el html actual. Ver ids en country.tpl.html
* Posteriormente limpia su contenido (comando clear).
*/
driver.findElement(By.id("usuario")).clear();
/**
* Comando que simula la escritura de un valor en el elemento(sendKeys)
* con el String de parámetro sobre // el elemento encontrado.
*/
driver.findElement(By.id("usuario")).sendKeys("usuario");
/**
* Comando que busca el elemento 'name1' en el html actual. Ver ids en country.tpl.html
* Posteriormente limpia su contenido (comando clear).
*/
driver.findElement(By.id("correo")).clear();
/**
* Comando que simula la escritura de un valor en el elemento(sendKeys)
* con el String de parámetro sobre // el elemento encontrado.
*/
driver.findElement(By.id("correo")).sendKeys("usuario@gmail.com");
/**
* Comando que busca el elemento 'name1' en el html actual. Ver ids en country.tpl.html
* Posteriormente limpia su contenido (comando clear).
*/
driver.findElement(By.id("pass")).clear();
/**
* Comando que simula la escritura de un valor en el elemento(sendKeys)
* con el String de parámetro sobre // el elemento encontrado.
*/
driver.findElement(By.id("pass")).sendKeys("contrasena");
/**
* Comando que busca el elemento 'name1' en el html actual. Ver ids en country.tpl.html
* Posteriormente limpia su contenido (comando clear).
*/
driver.findElement(By.id("pass2")).clear();
/**
* Comando que simula la escritura de un valor en el elemento(sendKeys)
* con el String de parámetro sobre // el elemento encontrado.
*/
driver.findElement(By.id("pass2")).sendKeys("contrasena");
/**
* Comando que busca el boton Save y luego hace click
* Comando que duerme el Thread del test por 2 segundos
*/
driver.findElement(By.id("btnRegistro")).click();
Thread.sleep(2000);
/** Comando que obtiene todos los elementos de la tabla
* Se realiza la verificación si el elemento creado está en la lista
*/
if (driver.getCurrentUrl().contains("account.html")) {
success = true;
}
/**
* la prueba es exitosa si se encontró
* el nuevo elemento creado en la lista.
*/
assertTrue(success);
Thread.sleep(2000);
}
}
| [
"jd.cruz12@uniandes.edu.co"
] | jd.cruz12@uniandes.edu.co |
066d48653052bae7d9ad6897fbf8f8a2c560981c | fe322adf78393a4b6439833425f07bb4d5b0163f | /src/DataFileParser.java | 388ecedaff33507291e2a5752f5e23d463bd4824 | [] | no_license | RAlanWright/Netflix-CSV-Filter | 1a393035afdff7266f636452ff030ddebbe73a28 | 6c4ac34c8c30551bdfdef9864decc702ae37f00b | refs/heads/main | 2023-04-17T10:13:09.684359 | 2021-05-01T02:19:40 | 2021-05-01T02:19:40 | 363,304,484 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,355 | java | import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
public class DataFileParser {
// Make a method to hold the below code
// List<Media> media = readMediaFromCSV("netflix_titles.csv");
// for(Media m : media) {
// System.out.println(m);
// }
// DataFileParser(String fileName) {
// try {
// // Setting up for file print
// PrintWriter pw = new PrintWriter(new FileOutputStream("outputTest.txt"));
//
// // Print each line to file
// for (Media m : media) {
// pw.println(m);
// }
// // Close after finished
// pw.close();
//
// } catch (FileNotFoundException e) {
// System.out.println("Problem writing to file :(");
// }
// catch (Exception e) {
// e.printStackTrace();
// System.exit(1);
// }
// }
// Default constructor
public DataFileParser() {
}
// Take in file and read each line
protected static List<Media> readMediaFromCSV(String fileName) {
List<Media> media = new ArrayList<>();
Path pathToFile = Paths.get(fileName);
System.out.println(pathToFile.toAbsolutePath());
try (BufferedReader br = Files.newBufferedReader(pathToFile, StandardCharsets.UTF_8)) {
String line = br.readLine();
while (line != null) {
String[] attributes = line.split(",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)");
Media mediaItem = createMedia(attributes);
media.add(mediaItem);
line = br.readLine();
}
} catch (IOException e) {
e.printStackTrace();
}
return media;
}
public static boolean isMovie(String field) {
return field.toLowerCase().contains("min");
}
// public void filterTitle(String titleString) {
// boolean found = false;
// for (int i = 0; i < media.size(); i++) {
//
// }
// }
private static Media createMedia(String[] metadata) {
String type = metadata[1];
String title = metadata[2];
String director = metadata[3];
String cast = metadata[4];
String country = metadata[5];
// String dateAdded = metadata[6];
String releaseYear = metadata[7];
String rating = metadata[8];
String genre = metadata[10];
String description = metadata[11];
String[] duration = metadata[9].split(" ");
// System.out.println(metadata[1]);
// Skip header line
// if (metadata[0].equals("show_id")) {
// return null;
if (metadata[1].equals("Movie")) {
// Ignore " min" for duration column
// String[] duration = metadata[9].split(" ");
// Only grab the int from movieDuration and parse it as int
// int duration = Integer.parseInt(movieDuration[0]);
return new Movie(type, title, director, cast, country, releaseYear, rating, genre, duration[0], description);
} else {
return new Series(type, title, director, cast, country, releaseYear, rating, genre, duration[0], description);
}
}
} | [
"wright.alan88@gmail.com"
] | wright.alan88@gmail.com |
db5befecf84ecb41e90a82f8ffb4b90233ce824c | 611b2f6227b7c3b4b380a4a410f357c371a05339 | /src/main/java/android/support/v7/widget/AppCompatImageHelper.java | 688306219fe16b253997f2247ed7b2c7f4f4efed | [] | no_license | obaby/bjqd | 76f35fcb9bbfa4841646a8888c9277ad66b171dd | 97c56f77380835e306ea12401f17fb688ca1373f | refs/heads/master | 2022-12-04T21:33:17.239023 | 2020-08-25T10:53:15 | 2020-08-25T10:53:15 | 290,186,830 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,530 | java | package android.support.v7.widget;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.RippleDrawable;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.RestrictTo;
import android.support.v4.widget.ImageViewCompat;
import android.support.v7.appcompat.R;
import android.support.v7.content.res.AppCompatResources;
import android.util.AttributeSet;
import android.widget.ImageView;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public class AppCompatImageHelper {
private TintInfo mImageTint;
private TintInfo mInternalImageTint;
private TintInfo mTmpInfo;
private final ImageView mView;
public AppCompatImageHelper(ImageView imageView) {
this.mView = imageView;
}
public void loadFromAttributes(AttributeSet attributeSet, int i) {
int resourceId;
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(this.mView.getContext(), attributeSet, R.styleable.AppCompatImageView, i, 0);
try {
Drawable drawable = this.mView.getDrawable();
if (!(drawable != null || (resourceId = obtainStyledAttributes.getResourceId(R.styleable.AppCompatImageView_srcCompat, -1)) == -1 || (drawable = AppCompatResources.getDrawable(this.mView.getContext(), resourceId)) == null)) {
this.mView.setImageDrawable(drawable);
}
if (drawable != null) {
DrawableUtils.fixDrawable(drawable);
}
if (obtainStyledAttributes.hasValue(R.styleable.AppCompatImageView_tint)) {
ImageViewCompat.setImageTintList(this.mView, obtainStyledAttributes.getColorStateList(R.styleable.AppCompatImageView_tint));
}
if (obtainStyledAttributes.hasValue(R.styleable.AppCompatImageView_tintMode)) {
ImageViewCompat.setImageTintMode(this.mView, DrawableUtils.parseTintMode(obtainStyledAttributes.getInt(R.styleable.AppCompatImageView_tintMode, -1), (PorterDuff.Mode) null));
}
} finally {
obtainStyledAttributes.recycle();
}
}
public void setImageResource(int i) {
if (i != 0) {
Drawable drawable = AppCompatResources.getDrawable(this.mView.getContext(), i);
if (drawable != null) {
DrawableUtils.fixDrawable(drawable);
}
this.mView.setImageDrawable(drawable);
} else {
this.mView.setImageDrawable((Drawable) null);
}
applySupportImageTint();
}
/* access modifiers changed from: package-private */
public boolean hasOverlappingRendering() {
return Build.VERSION.SDK_INT < 21 || !(this.mView.getBackground() instanceof RippleDrawable);
}
/* access modifiers changed from: package-private */
public void setSupportImageTintList(ColorStateList colorStateList) {
if (this.mImageTint == null) {
this.mImageTint = new TintInfo();
}
this.mImageTint.mTintList = colorStateList;
this.mImageTint.mHasTintList = true;
applySupportImageTint();
}
/* access modifiers changed from: package-private */
public ColorStateList getSupportImageTintList() {
if (this.mImageTint != null) {
return this.mImageTint.mTintList;
}
return null;
}
/* access modifiers changed from: package-private */
public void setSupportImageTintMode(PorterDuff.Mode mode) {
if (this.mImageTint == null) {
this.mImageTint = new TintInfo();
}
this.mImageTint.mTintMode = mode;
this.mImageTint.mHasTintMode = true;
applySupportImageTint();
}
/* access modifiers changed from: package-private */
public PorterDuff.Mode getSupportImageTintMode() {
if (this.mImageTint != null) {
return this.mImageTint.mTintMode;
}
return null;
}
/* access modifiers changed from: package-private */
public void applySupportImageTint() {
Drawable drawable = this.mView.getDrawable();
if (drawable != null) {
DrawableUtils.fixDrawable(drawable);
}
if (drawable == null) {
return;
}
if (shouldApplyFrameworkTintUsingColorFilter() && applyFrameworkTintUsingColorFilter(drawable)) {
return;
}
if (this.mImageTint != null) {
AppCompatDrawableManager.tintDrawable(drawable, this.mImageTint, this.mView.getDrawableState());
} else if (this.mInternalImageTint != null) {
AppCompatDrawableManager.tintDrawable(drawable, this.mInternalImageTint, this.mView.getDrawableState());
}
}
/* access modifiers changed from: package-private */
public void setInternalImageTint(ColorStateList colorStateList) {
if (colorStateList != null) {
if (this.mInternalImageTint == null) {
this.mInternalImageTint = new TintInfo();
}
this.mInternalImageTint.mTintList = colorStateList;
this.mInternalImageTint.mHasTintList = true;
} else {
this.mInternalImageTint = null;
}
applySupportImageTint();
}
private boolean shouldApplyFrameworkTintUsingColorFilter() {
int i = Build.VERSION.SDK_INT;
if (i <= 21) {
return i == 21;
}
if (this.mInternalImageTint != null) {
return true;
}
return false;
}
private boolean applyFrameworkTintUsingColorFilter(@NonNull Drawable drawable) {
if (this.mTmpInfo == null) {
this.mTmpInfo = new TintInfo();
}
TintInfo tintInfo = this.mTmpInfo;
tintInfo.clear();
ColorStateList imageTintList = ImageViewCompat.getImageTintList(this.mView);
if (imageTintList != null) {
tintInfo.mHasTintList = true;
tintInfo.mTintList = imageTintList;
}
PorterDuff.Mode imageTintMode = ImageViewCompat.getImageTintMode(this.mView);
if (imageTintMode != null) {
tintInfo.mHasTintMode = true;
tintInfo.mTintMode = imageTintMode;
}
if (!tintInfo.mHasTintList && !tintInfo.mHasTintMode) {
return false;
}
AppCompatDrawableManager.tintDrawable(drawable, tintInfo, this.mView.getDrawableState());
return true;
}
}
| [
"obaby.lh@gmail.com"
] | obaby.lh@gmail.com |
478f0a840ead326387df50ee37c336308d913f1b | 4caa6621c9d280ba535d5f16a986f7439dc7e43a | /ZzhLibExt/src/main/java/com/zzh/zlibs/base/BaseActivity.java | 74963ebcca5601b7f2c5515aac4cea9291cf511d | [] | no_license | zzhhz/ZzhLibs | cbbe42946b14c98748f81930ab02641816445a6c | 1b9c6912948391da3979e0b5cbff77f43453ffff | refs/heads/master | 2021-07-14T23:28:02.286220 | 2021-03-04T08:03:28 | 2021-03-04T08:03:28 | 80,974,131 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,146 | java | package com.zzh.zlibs.base;
import android.Manifest;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.zzh.zlibs.R;
import com.zzh.zlibs.swipe.activity.SwipeBackActivity;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;
import androidx.core.content.PermissionChecker;
/**
* Created by zzh on 2016/1/29.
* 对BaseActivity的一些封装:<br />
* 全局Context<br />
* Handler<br />
* Toast<br />
* 初始化View控件<br />
* 初始化数据<br />
* 给控件设置监听事件<br />
* 滑动退出当前页面<br />
* 广播没有封装,因为可以用第三方库,例如EventBus.
*/
public abstract class BaseActivity extends SwipeBackActivity implements View.OnClickListener {
protected static String TAG;
protected Context mContext;
protected BaseHandler mHandler;
protected Toast mToast;
protected Toolbar mToolbar;
protected TextView mTitle;
//权限
protected static final int REQUEST_CODE_READ_PERMISSION = 2000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TAG = this.getLocalClassName();
mContext = this;
if (mHandler == null)
mHandler = new BaseHandler();
int layoutResId = setLayoutId();
setContentView(layoutResId);
init();
}
protected abstract int setLayoutId();
/**
* 有toolbar,但是没有title
*
* @param toolbarId toolbar
* @param resId 返回按钮
* @param title 标题
* @param clickListener 点击事件
*/
protected void toolbars(int toolbarId, int resId, String title, Toolbar.OnClickListener clickListener) {
setToolbar(toolbarId);
toolbars(title, resId, clickListener);
}
/**
* 有toolbar,但是没有title
*
* @param toolbar toolbar
* @param resId 返回按钮
* @param title 标题
* @param clickListener 点击事件
*/
protected void toolbars(Toolbar toolbar, int resId, String title, Toolbar.OnClickListener clickListener) {
setToolbar(toolbar);
toolbars(title, resId, clickListener);
}
/**
* 有toolbar,有title
*
* @param toolbarId toolbar
* @param titleId toolbar里面的标题
* @param title 标题
* @param ic_back 返回按钮
* @param clickListener 点击事件
*/
protected void toolbars(int toolbarId, int titleId, String title, int ic_back, Toolbar.OnClickListener clickListener) {
setToolbar(toolbarId);
setToolBarTitle(titleId);
toolbars(title, ic_back, clickListener);
}
/**
* @param toolbar toolbar
* @param titleId toolbar里面的标题
* @param title 标题
* @param ic_back 返回按钮
* @param clickListener 点击事件
*/
protected void toolbars(Toolbar toolbar, int titleId, String title, int ic_back, Toolbar.OnClickListener clickListener) {
setToolbar(toolbar);
setToolBarTitle(titleId);
toolbars(title, ic_back, clickListener);
}
//设置Toolbar
protected void toolbars(String title) {
toolbars(title, null);
}
protected void setToolbarAndTitle(int toolbarId, int titleId){
setToolbar(toolbarId);
setToolBarTitle(titleId);
}
public void setToolbar(int toolbarId) {
this.mToolbar = (Toolbar) findViewById(toolbarId);
}
public void setToolBarTitle(int titleId) {
this.mTitle = mToolbar.findViewById(titleId);
}
public void setToolbar(Toolbar mToolbar) {
this.mToolbar = mToolbar;
}
public Toolbar getToolbar() {
return mToolbar;
}
protected void toolbars(String title, Toolbar.OnClickListener clickListener) {
toolbars(title, -1, clickListener);
}
protected void toolbars(String title, int ic_back, Toolbar.OnClickListener clickListener) {
try {
mToolbar = getToolbar();
if (mToolbar == null) {
this.mToolbar = (Toolbar) findViewById(R.id.toolbar);
}
} catch (Exception ex) {
Log.e(TAG, "-----没有设置toolbar");
}
if (mToolbar == null)
return;
mToolbar.setTitle("");
if (ic_back > 0)
mToolbar.setNavigationIcon(ic_back);
if (title != null && mTitle != null) {
mTitle.setText(title);
}
setSupportActionBar(mToolbar);
if (clickListener == null) {
mToolbar.setNavigationOnClickListener(new Toolbar.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
} else {
mToolbar.setNavigationOnClickListener(clickListener);
}
}
private void initBroadCast() {
/*if (mReceiver == null)
mReceiver = new BaseReceiver();*/
/*if (mFilter == null)
mFilter = new IntentFilter();
initBroadCast();
mContext.registerReceiver(mReceiver, mFilter);*/
//mFilter.addAction();
}
protected void init() {
initView();
initData();
initSetListener();
}
/**
* 初始化控件使用
*/
protected abstract void initView();
/**
* 初始化数据
*/
protected abstract void initData();
/**
* 设置监听事件
*/
protected abstract void initSetListener();
/**
* 在子Activity中处理handler
*
* @param msg 发送过来的msg
*/
protected abstract void handlerMessage(Message msg);
/**
* 处理广播
*
* @param context 上下文
* @param intent 数据
*/
protected void onBroadCastReceiver(Context context, Intent intent) {
}
public class BaseHandler extends Handler {
@Override
public void handleMessage(Message msg) {
handlerMessage(msg);
}
}
/**
* 广播
*/
/*private class BaseReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
onBroadCastReceiver(context, intent);
}
}*/
/**
* 显示的文字提示信息
*
* @param str 显示文字
*/
protected void showMessage(String str) {
if (mToast == null) {
mToast = Toast.makeText(mContext, str, Toast.LENGTH_SHORT);
mToast.setGravity(Gravity.CENTER, 0, 0);
} else {
mToast.setText(str);
}
mToast.show();
}
@Override
protected void onDestroy() {
super.onDestroy();
/*if (mReceiver != null)
mContext.unregisterReceiver(mReceiver);*/
if (mHandler != null) {
mHandler.removeCallbacksAndMessages(null);
}
}
/**
* 6.0处理申请权限,大于Build.VERSION_CODES.M,则申请权限,否则可以直接使用权限
*
* @param permission 申请的权限
* @param code
*/
protected void requestPermission(String[] permission, int code) {
if (permission == null) {
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
ActivityCompat.requestPermissions(this, permission, code);
} else {
notifyPermission(code, true);
}
}
protected void requestReadStoragePermission() {
String[] permission = {
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE
};
boolean result = true;//默认已经都授权了
outer:
for (String per : permission) {
result = verifyGrantPermission(per);
if (!result) {
break outer;
}
}
if (!result) {
requestPermission(permission, REQUEST_CODE_READ_PERMISSION);
} else {
notifyPermission(REQUEST_CODE_READ_PERMISSION, true);
}
}
//判断是否授予了权限
protected boolean verifyGrantPermission(String permission) {
boolean result;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
result = (checkSelfPermission(permission) == PackageManager.PERMISSION_GRANTED);
} else {
result = PermissionChecker.checkSelfPermission(this, permission)
== PermissionChecker.PERMISSION_GRANTED;
}
return result;
}
//验证是否申请了权限
public static boolean verifyPermissions(int[] grantResults) {
if (grantResults.length < 1) {
return false;
}
for (int result : grantResults) {
if (result != PackageManager.PERMISSION_GRANTED) {
return false;
}
}
return true;
}
//申请到权限
protected void notifyPermission(int code, boolean flag) {
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (verifyPermissions(grantResults)) {
notifyPermission(requestCode, true);
} else {
notifyPermission(requestCode, false);
}
/*switch (requestCode){
case REQUEST_CODE_READ_PERMISSION:
boolean verifyPermissions = verifyPermissions(grantResults);
loge("-----------"+requestCode+"---"+verifyPermissions);
if (verifyPermissions){
notifyPermission(requestCode);
}
break;
}*/
}
}
| [
"zzh_hz@126.com"
] | zzh_hz@126.com |
b3ec47b361e966115ffda86f046b367c3416ce49 | 9713d2403e100e8574bd85530ab83e3d57b86235 | /shared/src/kz/maks/realestate/shared/refs/Internet.java | 7375c84729758bab3eebf8df782c8b7d7308f5ca | [] | no_license | nusip/RealEstate | 468f435fbe1a09c4dca7020f83e3a8df181933d8 | 7c39917c1a8f71c4be37c3f6f3fdd557ce3863dd | refs/heads/master | 2021-03-19T07:39:10.155419 | 2016-09-03T13:34:23 | 2016-09-03T13:34:23 | 94,367,297 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 660 | java | package kz.maks.realestate.shared.refs;
import kz.maks.core.shared.models.HasTitle;
import kz.maks.core.shared.Utils;
public enum Internet implements HasTitle {
ADSL("ADSL"),
TV_CABLE("через TV кабель"),
PROVODNOY("проводной"),
OPTIKA("оптика");
private final String title;
Internet(String title) {
this.title = title;
}
@Override
public String getTitle() {
return title;
}
@Override
public String toString() {
return title;
}
public static Internet getByTitle(String title) {
return (Internet) Utils.findByTitle(values(), title);
}
}
| [
"nusip.maks@gmail.com"
] | nusip.maks@gmail.com |
6680d8fd38e8290928f25a48eee3571f8482831c | 8aedc89162f6499697d2b77a056f951d08a4b540 | /shoe-association-rest/src/main/java/com/ligq/shoe/constants/ScoreType.java | aca40f6f1e98ac6ae7669ad70deadb5c052c88a3 | [] | no_license | ligq10/shoe-association-service | 6ace26ab003ba13a11e3ebcad28067ab5359bbfb | f20c77c6a138a07931f09b9941014df4f4ec2ca3 | refs/heads/master | 2021-01-21T13:48:36.246881 | 2016-05-09T04:37:29 | 2016-05-09T04:37:29 | 48,353,929 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 819 | java | package com.ligq.shoe.constants;
import org.springframework.util.StringUtils;
/**
* 评分类型
* @author ligq
*
*/
public enum ScoreType {
PLUS("plus","加分"),
REDUCE("reduce","减分");
private String value;
private String desc;
private ScoreType(String value, String desc){
this.value = value;
this.desc = desc;
}
public String getValue() {
return value;
}
public String getDesc() {
return desc;
}
public static ScoreType getScoreTypeByValue(String value){
if(StringUtils.isEmpty(value)){
return null;
}
for(ScoreType scoreType : ScoreType.values()){
if(value.equals(scoreType.getValue())){
return scoreType;
}
}
throw new IllegalArgumentException("value值非法,没有符合的枚举对象");
}
}
| [
"892832444@qq.com"
] | 892832444@qq.com |
a8ca50a4c9428a1754ff86e58b14a27bca56f2d2 | 7d489d0f989ddbd9ca7d633fee2881b48403160c | /src/functions/matedit/multi/Greenscreen.java | 2de720ee0093d2b162b045cb354c2400420f8bca | [] | no_license | mfkiwl/EasyVision | 224ea515052cece4772f967c9360614217e25f11 | 6910129110377c16c9b46af010c3323bcc4da6f4 | refs/heads/master | 2022-12-27T04:10:20.059611 | 2020-06-02T11:31:30 | 2020-06-02T11:31:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,987 | java | package functions.matedit.multi;
import java.awt.Image;
import java.util.Map;
import org.opencv.core.Mat;
import org.opencv.video.BackgroundSubtractor;
import org.opencv.video.Video;
import database.ImageHandler;
import functions.matedit.ChangeResolution;
public class Greenscreen extends MultiMatEditFunction {
/**
*
*/
private static final long serialVersionUID = 8003205441002816111L;
public Greenscreen() {
super();
}
public Greenscreen(Boolean empty) {
}
@Override
public int getNrFunctionInputs() {
return 0;
}
@Override
public int getNrMatInputs() {
// TODO Auto-generated method stub
return 3;
}
@Override
protected Mat apply(Map<Integer, Mat> matsIn) {
Mat matBasicImage=matsIn.get(0);
Mat matOverlayImage;
Mat colorToOverlay;
Mat matOut;
try {
matOverlayImage=matsIn.get(1);
colorToOverlay=matsIn.get(2);
int rows=matBasicImage.rows();
int cols=matBasicImage.cols();
if(matOverlayImage.rows()!=rows || matOverlayImage.cols()!=cols) {
matOverlayImage=ChangeResolution.apply(matOverlayImage, cols, rows);
}
if(colorToOverlay.rows()!=rows || colorToOverlay.cols()!=cols) {
colorToOverlay=ChangeResolution.apply(colorToOverlay, cols, rows);
}
matOut=matBasicImage.clone();
for(int col=0;col<cols;col++) {
for(int row=0;row<rows;row++) {
if(colorToOverlay.get(row, col)[0]>127) {
double[] dataOverlay=matOverlayImage.get(row, col);
if(dataOverlay==null) {
return matBasicImage;
}
matOut.put(row, col, dataOverlay);
}
}
}
}catch (NullPointerException e) {
return matBasicImage;
}catch (Exception e) {
e.printStackTrace();
return matBasicImage;
}
return matOut;
}
@Override
public void clearMatsIn(Map<Integer, Mat> matsIn) {
matsIn.remove(0);
matsIn.remove(2);
}
@Override
public Image getRepresentationImage() {
return ImageHandler.getImage("res/icons/greenscreen.png");
}
}
| [
"Simon.Senoner@outlook.com"
] | Simon.Senoner@outlook.com |
1e986eb67a008eac1ef19ed863d0331ce9095fc4 | 8f3b71040595c28dec2d8b89cd93df2e7143fdb5 | /LeonidsLib/src/main/java/com/plattysoft/leonids/initializers/CircleParticleInitializer.java | f17cc2562ad8ec8cdebab311cabb026cf4208702 | [
"Apache-2.0"
] | permissive | davyskiba/Leonids | 901966f59fa2a070ea9266fcf12120a11f2a393c | 8a49eb222389e7a0e83a25b9c1c2f05b4ca428aa | refs/heads/master | 2021-01-18T16:56:14.645881 | 2016-09-16T13:24:06 | 2016-09-16T13:24:06 | 67,201,260 | 0 | 0 | null | 2016-09-15T10:28:29 | 2016-09-02T07:36:06 | Java | UTF-8 | Java | false | false | 1,454 | java | package com.plattysoft.leonids.initializers;
import com.plattysoft.leonids.Particle;
import java.util.Random;
public class CircleParticleInitializer implements ParticleInitializer {
private int centerX;
private int centerY;
private float speed;
private float speedVariation;
private double angleVariation;
private Random random;
public CircleParticleInitializer(int centerX, int centerY, float speed) {
this.centerX = centerX;
this.centerY = centerY;
this.speed = speed;
speedVariation=0f;
angleVariation=0f;
random=new Random();
}
public void setSpeedVariation(float speedVariation) {
this.speedVariation = speedVariation;
}
public void setAngleVariation(double angleVariation) {
this.angleVariation = Math.toRadians(angleVariation);
}
@Override
public void initParticle(Particle p, Random r) {
float relativeX = p.mCurrentX - centerX;
float relativeY = p.mCurrentY - centerY;
double calculatedAngleRadians = Math.atan2(relativeY, relativeX)+ Math.PI/2;
double angleRadians=calculatedAngleRadians-angleVariation+(random.nextDouble()*2*angleVariation);
float particleSpeed=speed-speedVariation+(random.nextFloat()*2*speedVariation);
p.mSpeedX = (float) (particleSpeed * Math.cos(angleRadians));
p.mSpeedY = (float) (particleSpeed * Math.sin(angleRadians));
}
}
| [
"wojciech.dawiskiba@blstream.com"
] | wojciech.dawiskiba@blstream.com |
7a206de484a8fc2f60e300a2e37fd26a156d312b | aa24f79c7161fbbb46eb83b9426b8379be952a6f | /Echo_Sos/src/main/java/cm/allpha/Echo_Sos/service/EchoSosArticleService.java | e5dcb60aef0a3c52ee13b8ab3c34860582598bba | [] | no_license | tendaallpha/Echo_Sos | 6966389d3a14f19d972fd8e08b6f8d452a43bede | c029fd35102a995f2d285c4cfe8223fc97cc0486 | refs/heads/master | 2020-04-05T14:42:01.874444 | 2019-01-03T02:26:03 | 2019-01-03T02:26:03 | 156,933,507 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,295 | java | package cm.allpha.Echo_Sos.service;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import cm.allpha.Echo_Sos.controller.EchoSosArticleController;
import cm.allpha.Echo_Sos.model.EchoSosArticle;
import cm.allpha.Echo_Sos.persistence.EchoSosArticleInterface;
@Service
public class EchoSosArticleService {
@Autowired
private EchoSosArticleInterface articleInterface;
public List<EchoSosArticle> getAllArticles() {
return articleInterface.findAll();
}
public void addArticle(EchoSosArticle article) {
articleInterface.save(article);
}
public void addArticleWithImage(MultipartFile[] files, EchoSosArticle echoSosArticle) throws IOException {
echoSosArticle = articleInterface.save(echoSosArticle);
int id = echoSosArticle.getId_article();
for (int i = 0; i < 1; i++) {
Path fileNameAndPath = Paths.get(EchoSosArticleController.uploadDirectry, id + "");
Files.write(fileNameAndPath, files[i].getBytes());
}
}
public EchoSosArticle getIdArticle(Integer id) {
return articleInterface.findById(id).get();
}
}
| [
"tendaallpha@gmail.com"
] | tendaallpha@gmail.com |
9e10f161d8d522cea79bc3d133a925d9e4fce091 | 2cb86346ca9cb4574e92edc9cc7ac8326594286b | /main/ZimbraSelenium/src/java/com/zimbra/qa/selenium/projects/ajax/tests/calendar/appointments/views/day/singleday/GetAppointment.java | d17a0089613b0441d49887f0dfaf5f6398a3bf47 | [] | no_license | Ppalanivelu/zimbra-sources | 97a1896a457fd63ba83a69af14a89ce23e25d68d | 8df201c545422002e39a1509e2ab5fab90686353 | refs/heads/master | 2021-01-18T07:44:30.114100 | 2013-02-07T23:35:23 | 2013-02-07T23:35:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,986 | java | package com.zimbra.qa.selenium.projects.ajax.tests.calendar.appointments.views.day.singleday;
import java.util.*;
import org.testng.annotations.Test;
import com.zimbra.qa.selenium.framework.core.Bugs;
import com.zimbra.qa.selenium.framework.items.AppointmentItem;
import com.zimbra.qa.selenium.framework.ui.Button;
import com.zimbra.qa.selenium.framework.util.*;
import com.zimbra.qa.selenium.projects.ajax.core.AjaxCommonTest;
public class GetAppointment extends AjaxCommonTest {
public GetAppointment() {
logger.info("New "+ GetAppointment.class.getCanonicalName());
// All tests start at the Calendar page
super.startingPage = app.zPageCalendar;
// Make sure we are using an account with day view
super.startingAccountPreferences = new HashMap<String, String>() {
private static final long serialVersionUID = -2913827779459595178L;
{
put("zimbraPrefCalendarInitialView", "day");
}};
}
@Bugs(ids = "69132")
@Test( description = "View a basic appointment in day view",
groups = { "smoke" })
public void GetAppointment_01() throws HarnessException {
// Create the appointment on the server
// Create the message data to be sent
String subject = "appointment" + ZimbraSeleniumProperties.getUniqueString();
String location = "location" + ZimbraSeleniumProperties.getUniqueString();
String content = "content" + ZimbraSeleniumProperties.getUniqueString();
// Absolute dates in UTC zone
Calendar now = Calendar.getInstance();
ZDate startUTC = new ZDate(now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1, now.get(Calendar.DAY_OF_MONTH), 12, 0, 0);
ZDate endUTC = new ZDate(now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1, now.get(Calendar.DAY_OF_MONTH), 14, 0, 0);
// EST timezone string
String tz = ZTimeZone.TimeZoneEST.getID();
// Create an appointment
app.zGetActiveAccount().soapSend(
"<CreateAppointmentRequest xmlns='urn:zimbraMail'>"
+ "<m>"
+ "<inv>"
+ "<comp status='CONF' fb='B' class='PUB' transp='O' allDay='0' name='"+ subject +"' loc='"+ location +"' >"
+ "<s d='"+ startUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS() +"' tz='"+ tz +"'/>"
+ "<e d='"+ endUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS() +"' tz='"+ tz +"'/>"
+ "<or a='"+ app.zGetActiveAccount().EmailAddress + "'/>"
+ "</comp>"
+ "</inv>"
+ "<su>"+ subject + "</su>"
+ "<mp ct='text/plain'>"
+ "<content>"+ content +"</content>"
+ "</mp>"
+ "</m>"
+ "</CreateAppointmentRequest>");
//-- GUI Action
app.zPageCalendar.zToolbarPressButton(Button.B_REFRESH);
//-- Verification
//verify appt displayed in day view
boolean found = false;
List<AppointmentItem> items = app.zPageCalendar.zListGetAppointments();
for (AppointmentItem item : items ) {
if ( subject.equals(item.getSubject()) ) {
found = true;
break;
}
}
ZAssert.assertTrue(found, "Verify appt gets displayed in day view");
}
}
| [
"github.dennis@dieploegers.de"
] | github.dennis@dieploegers.de |
82e3926cddcbc9fac75d3b58943b4acbb960e898 | 7793d34de493c90d0ad2fb1cb86826366d7ac470 | /app/src/main/java/com/yinyutech/xiaolerobot/utils/DemoUtils.java | 0a8e2fcbd300a36a5a5978a49d52bc3b4b0a4e44 | [] | no_license | tiejiang/robot-for-mobile-side | ada9088c0907566e89e72ee6288342866a75c97d | 2ca09195723fb7c900d88cd5d8e731c919e6753b | refs/heads/master | 2021-07-09T01:21:31.670867 | 2017-10-08T10:19:34 | 2017-10-08T10:19:34 | 106,063,555 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 39,473 | java | package com.yinyutech.xiaolerobot.utils;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.AssetFileDescriptor;
import android.content.res.Resources;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.drawable.Drawable;
import android.media.ExifInterface;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Build;
import android.os.Vibrator;
import android.provider.MediaStore;
import android.text.TextUtils;
import android.text.format.DateFormat;
import android.util.Log;
import com.yinyutech.xiaolerobot.common.CCPAppManager;
import com.yuntongxun.ecsdk.ECDeviceType;
import com.yuntongxun.ecsdk.ECNetworkType;
import junit.framework.Assert;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.List;
import java.util.Random;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created by Jorstin on 2015/3/18.
*/
public class DemoUtils {
public static final String TAG = "ECDemo.DemoUtils";
private static final int MAX_DECODE_PICTURE_SIZE = 1920 * 1440;
public static boolean inNativeAllocAccessError = false;
public static final String ALLCHAR = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
public static final String LETTERCHAR = "abcdefghijkllmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
/** 当前SDK版本号 */
private static int mSdkint = -1;
//获取5位随机数字和5位随机字母(作为荣联云通讯ID)
public static String getRandomNumber(int len){
String a = "";
for(int i=0;i<len;i++ ) {
a += String.valueOf ((int)(10*(Math.random())));
}
return a.trim();
}
/**
* 返回一个定长的随机纯字母字符串(只包含大小写字母)
*
* @param length
* 随机字符串长度
* @return 随机字符串
*/
public static String generateMixString(int length) {
StringBuffer sb = new StringBuffer();
Random random = new Random();
for (int i = 0; i < length; i++) {
sb.append(ALLCHAR.charAt(random.nextInt(LETTERCHAR.length())));
}
return sb.toString();
}
/**
* 返回一个定长的随机纯大写字母字符串(只包含大小写字母)
*
* @param length
* 随机字符串长度
* @return 随机字符串
*/
public static String generateLowerString(int length) {
return generateMixString(length).toLowerCase();
}
/**
* 计算语音文件的时间长度
*
* @param file
* @return
*/
public static int calculateVoiceTime(String file) {
File _file = new File(file);
if (!_file.exists()) {
return 0;
}
// 650个字节就是1s
int duration = (int) Math.ceil(_file.length() / 650);
if (duration > 60) {
return 60;
}
if (duration < 1) {
return 1;
}
return duration;
}
private static MessageDigest md = null;
public static String md5(final String c) {
if (md == null) {
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
}
if (md != null) {
md.update(c.getBytes());
return byte2hex(md.digest());
}
return "";
}
public static String byte2hex(byte b[]) {
String hs = "";
String stmp = "";
for (int n = 0; n < b.length; n++) {
stmp = Integer.toHexString(b[n] & 0xff);
if (stmp.length() == 1)
hs = hs + "0" + stmp;
else
hs = hs + stmp;
if (n < b.length - 1)
hs = (new StringBuffer(String.valueOf(hs))).toString();
}
return hs.toUpperCase();
}
/**
* 将集合转换成字符串,用特殊字符做分隔符
*
* @param srcList
* 转换前集合
* @param separator
* 分隔符
* @return
*/
public static String listToString(List<String> srcList, String separator) {
if (srcList == null) {
return "";
}
StringBuilder sb = new StringBuilder("");
for (int i = 0; i < srcList.size(); ++i)
if (i == srcList.size() - 1) {
sb.append(((String) srcList.get(i)).trim());
} else {
sb.append(((String) srcList.get(i)).trim() + separator);
}
return sb.toString();
}
/**
* SDK版本号
*
* @return
*/
public static int getSdkint() {
if (mSdkint < 0) {
mSdkint = Build.VERSION.SDK_INT;
}
return mSdkint;
}
/**
* Java文件操作 获取文件扩展名 Get the file extension, if no extension or file name
*
*/
public static String getExtensionName(String filename) {
if ((filename != null) && (filename.length() > 0)) {
int dot = filename.lastIndexOf('.');
if ((dot > -1) && (dot < (filename.length() - 1))) {
return filename.substring(dot + 1);
}
}
return "";
}
/**
* Java文件操作 获取不带扩展名的文件名
*/
public static String getFileNameNoEx(String filename) {
if ((filename != null) && (filename.length() > 0)) {
int dot = filename.lastIndexOf('.');
if ((dot > -1) && (dot < (filename.length()))) {
return filename.substring(0, dot);
}
}
return filename;
}
/**
* 返回文件名
*
* @param pathName
* @return
*/
public static String getFilename(String pathName) {
File file = new File(pathName);
if (!file.exists()) {
return "";
}
return file.getName();
}
/**
* 过滤字符串为空
*
* @param str
* @return
*/
public static String nullAsNil(String str) {
if (str == null) {
return "";
}
return str;
}
/**
* 将字符串转换成整型,如果为空则返回默认值
*
* @param str
* 字符串
* @param def
* 默认值
* @return
*/
public static int getInt(String str, int def) {
try {
if (str == null) {
return def;
}
return Integer.parseInt(str);
} catch (NumberFormatException e) {
e.printStackTrace();
}
return def;
}
/**
* 删除号码中的所有非数字
*
* @param str
* @return
*/
public static String filterUnNumber(String str) {
if (str == null) {
return null;
}
if (str.startsWith("+86")) {
str = str.substring(3, str.length());
}
// if (str.contains("#")) {
//
// return str.replaceAll("#", "@");
// }
// 只允数字
String regEx = "[^0-9]";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(str);
// 替换与模式匹配的所有字符(即非数字的字符将被""替换)
// 对voip造成的负数号码,做处理
if (str.startsWith("-")) {
return "-" + m.replaceAll("").trim();
} else {
return m.replaceAll("").trim();
}
}
/**
*
* @param c
* @return
*/
public static boolean characterChinese(char c) {
Character.UnicodeBlock unicodeBlock = Character.UnicodeBlock.of(c);
return ((unicodeBlock != Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS)
&& (unicodeBlock != Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS)
&& (unicodeBlock != Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A)
&& (unicodeBlock != Character.UnicodeBlock.GENERAL_PUNCTUATION)
&& (unicodeBlock != Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION) && (unicodeBlock != Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS));
}
public static String getGroupShortId(String id) {
/*
* if(TextUtils.isEmpty(id) || !id.startsWith("G")) { return id; }
* return id.substring(id.length() - 6 , id.length());
*/
return id;
}
public static final String PHONE_PREFIX = "+86";
/**
* 去除+86
*
* @param phoneNumber
* @return
*/
public static String formatPhone(String phoneNumber) {
if (phoneNumber == null) {
return "";
}
if (phoneNumber.startsWith(PHONE_PREFIX)) {
return phoneNumber.substring(PHONE_PREFIX.length()).trim();
}
return phoneNumber.trim();
}
/**
*
* @param userData
* @return
*/
public static String getFileNameFormUserdata(String userData) {
if (TextUtils.isEmpty(userData) || "null".equals(userData)) {
return "";
}
return userData.substring(
userData.indexOf("fileName=") + "fileName=".length(),
userData.length());
}
static MediaPlayer mediaPlayer = null;
public static void playNotifycationMusic(Context context, String voicePath)
throws IOException {
// paly music ...
AssetFileDescriptor fileDescriptor = context.getAssets().openFd(
voicePath);
if (mediaPlayer == null) {
mediaPlayer = new MediaPlayer();
}
if (mediaPlayer.isPlaying()) {
mediaPlayer.stop();
}
mediaPlayer.reset();
mediaPlayer.setDataSource(fileDescriptor.getFileDescriptor(),
fileDescriptor.getStartOffset(), fileDescriptor.getLength());
mediaPlayer.prepare();
mediaPlayer.setLooping(false);
mediaPlayer.start();
}
/**
* @param context
* @param intent
* @param appPath
* @return
*/
public static String resolvePhotoFromIntent(Context context, Intent intent,
String appPath) {
if (context == null || intent == null || appPath == null) {
// LogUtil.e(LogUtil.getLogUtilsTag(DemoUtils.class),
// "resolvePhotoFromIntent fail, invalid argument");
return null;
}
Uri uri = Uri.parse(intent.toURI());
Cursor cursor = context.getContentResolver().query(uri, null, null,
null, null);
try {
String pathFromUri = null;
if (cursor != null && cursor.getCount() > 0) {
cursor.moveToFirst();
int columnIndex = cursor
.getColumnIndex(MediaStore.MediaColumns.DATA);
// if it is a picasa image on newer devices with OS 3.0 and up
if (uri.toString().startsWith(
"content://com.google.android.gallery3d")) {
// Do this in a background thread, since we are fetching a
// large image from the web
pathFromUri = saveBitmapToLocal(appPath,
createChattingImageByUri(intent.getData()));
} else {
// it is a regular local image file
pathFromUri = cursor.getString(columnIndex);
}
cursor.close();
// LogUtil.d(TAG, "photo from resolver, path: " + pathFromUri);
return pathFromUri;
} else {
if (intent.getData() != null) {
pathFromUri = intent.getData().getPath();
if (new File(pathFromUri).exists()) {
// LogUtil.d(TAG, "photo from resolver, path: "
// + pathFromUri);
return pathFromUri;
}
}
// some devices (OS versions return an URI of com.android
// instead of com.google.android
if ((intent.getAction() != null)
&& (!(intent.getAction().equals("inline-data")))) {
// use the com.google provider, not the com.android
// provider.
// Uri.parse(intent.getData().toString().replace("com.android.gallery3d","com.google.android.gallery3d"));
pathFromUri = saveBitmapToLocal(appPath, (Bitmap) intent
.getExtras().get("data"));
// LogUtil.d(TAG, "photo from resolver, path: " + pathFromUri);
return pathFromUri;
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (cursor != null) {
cursor.close();
}
}
// LogUtil.e(TAG, "resolve photo from intent failed ");
return null;
}
/**
*
* @param uri
* @return
*/
public static Bitmap createChattingImageByUri(Uri uri) {
return createChattingImage(0, null, null, uri, 0.0F, 400, 800);
}
/**
*
* @param resource
* @param path
* @param b
* @param uri
* @param dip
* @param width
* @param height
* @return
*/
public static Bitmap createChattingImage(int resource, String path,
byte[] b, Uri uri, float dip, int width, int height) {
if (width <= 0 || height <= 0) {
return null;
}
BitmapFactory.Options options = new BitmapFactory.Options();
int outWidth = 0;
int outHeight = 0;
int sampleSize = 0;
try {
do {
if (dip != 0.0F) {
options.inDensity = (int) (160.0F * dip);
}
options.inJustDecodeBounds = true;
decodeMuilt(options, b, path, uri, resource);
//
outWidth = options.outWidth;
outHeight = options.outHeight;
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
if (outWidth <= width || outHeight <= height) {
sampleSize = 0;
setInNativeAlloc(options);
Bitmap decodeMuiltBitmap = decodeMuilt(options, b, path,
uri, resource);
return decodeMuiltBitmap;
} else {
options.inSampleSize = (int) Math.max(outWidth / width,
outHeight / height);
sampleSize = options.inSampleSize;
}
} while (sampleSize != 0);
} catch (IncompatibleClassChangeError e) {
e.printStackTrace();
throw ((IncompatibleClassChangeError) new IncompatibleClassChangeError(
"May cause dvmFindCatchBlock crash!").initCause(e));
} catch (Throwable throwable) {
throwable.printStackTrace();
BitmapFactory.Options catchOptions = new BitmapFactory.Options();
if (dip != 0.0F) {
catchOptions.inDensity = (int) (160.0F * dip);
}
catchOptions.inPreferredConfig = Bitmap.Config.RGB_565;
if (sampleSize != 0) {
catchOptions.inSampleSize = sampleSize;
}
setInNativeAlloc(catchOptions);
try {
return decodeMuilt(options, b, path, uri, resource);
} catch (IncompatibleClassChangeError twoE) {
twoE.printStackTrace();
throw ((IncompatibleClassChangeError) new IncompatibleClassChangeError(
"May cause dvmFindCatchBlock crash!").initCause(twoE));
} catch (Throwable twoThrowable) {
twoThrowable.printStackTrace();
}
}
return null;
}
/**
* save image from uri
*
* @param outPath
* @param bitmap
* @return
*/
public static String saveBitmapToLocal(String outPath, Bitmap bitmap) {
try {
String imagePath = outPath
+ DemoUtils.md5(DateFormat.format("yyyy-MM-dd-HH-mm-ss",
System.currentTimeMillis()).toString()) + ".jpg";
File file = new File(imagePath);
if (!file.exists()) {
file.createNewFile();
}
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(
new FileOutputStream(file));
bitmap.compress(Bitmap.CompressFormat.PNG, 100,
bufferedOutputStream);
bufferedOutputStream.close();
// LogUtil.d(TAG, "photo image from data, path:" + imagePath);
return imagePath;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static String saveBitmapToLocal(File file, Bitmap bitmap) {
try {
if (!file.exists()) {
file.createNewFile();
}
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(
new FileOutputStream(file));
bitmap.compress(Bitmap.CompressFormat.PNG, 100,
bufferedOutputStream);
bufferedOutputStream.close();
// LogUtil.d(TAG,
// "photo image from data, path:" + file.getAbsolutePath());
return file.getAbsolutePath();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
*
* @param options
* @param data
* @param path
* @param uri
* @param resource
* @return
*/
public static Bitmap decodeMuilt(BitmapFactory.Options options,
byte[] data, String path, Uri uri, int resource) {
try {
if (!checkByteArray(data) && TextUtils.isEmpty(path) && uri == null
&& resource <= 0) {
return null;
}
if (checkByteArray(data)) {
return BitmapFactory.decodeByteArray(data, 0, data.length,
options);
}
if (uri != null) {
InputStream inputStream = CCPAppManager.getContext()
.getContentResolver().openInputStream(uri);
Bitmap localBitmap = BitmapFactory.decodeStream(inputStream,
null, options);
inputStream.close();
return localBitmap;
}
if (resource > 0) {
return BitmapFactory.decodeResource(CCPAppManager.getContext()
.getResources(), resource, options);
}
return BitmapFactory.decodeFile(path, options);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static void setInNativeAlloc(BitmapFactory.Options options) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH
&& !inNativeAllocAccessError) {
try {
BitmapFactory.Options.class.getField("inNativeAlloc")
.setBoolean(options, true);
return;
} catch (Exception e) {
inNativeAllocAccessError = true;
}
}
}
public static boolean checkByteArray(byte[] b) {
return b != null && b.length > 0;
}
public static Bitmap getSuitableBitmap(String filePath) {
if (TextUtils.isEmpty(filePath)) {
// LogUtil.e(TAG, "filepath is null or nil");
return null;
}
if (!new File(filePath).exists()) {
// LogUtil.e(TAG,
// "getSuitableBmp fail, file does not exist, filePath = "
// + filePath);
return null;
}
try {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
Bitmap decodeFile = BitmapFactory.decodeFile(filePath, options);
if (decodeFile != null) {
decodeFile.recycle();
}
if ((options.outWidth <= 0) || (options.outHeight <= 0)) {
// LogUtil.e(TAG, "get bitmap fail, file is not a image file = "
// + filePath);
return null;
}
int maxWidth = 960;
int width = 0;
int height = 0;
if ((options.outWidth <= options.outHeight * 2.0D)
&& options.outWidth > 480) {
height = maxWidth;
width = options.outWidth;
}
if ((options.outHeight <= options.outWidth * 2.0D)
|| options.outHeight <= 480) {
width = maxWidth;
height = options.outHeight;
}
Bitmap bitmap = extractThumbNail(filePath, width, height, false);
if (bitmap == null) {
// LogUtil.e(TAG,
// "getSuitableBmp fail, temBmp is null, filePath = "
// + filePath);
return null;
}
int degree = readPictureDegree(filePath);
if (degree != 0) {
bitmap = degreeBitmap(bitmap, degree);
}
return bitmap;
} catch (Exception e) {
// LogUtil.e(TAG, "decode bitmap err: " + e.getMessage());
return null;
}
}
public static String bytes2kb(long bytes) {
BigDecimal filesize = new BigDecimal(bytes);
BigDecimal megabyte = new BigDecimal(1024 * 1024);
float returnValue = filesize.divide(megabyte, 2, BigDecimal.ROUND_UP)
.floatValue();
if (returnValue > 1)
return (returnValue + "MB");
BigDecimal kilobyte = new BigDecimal(1024);
returnValue = filesize.divide(kilobyte, 2, BigDecimal.ROUND_UP)
.floatValue();
return (returnValue + "KB");
}
/**
* 读取图片属性:旋转的角度
*
* @param path
* 图片绝对路径
* @return degree旋转的角度
*/
public static int readPictureDegree(String path) {
int degree = 0;
try {
ExifInterface exifInterface = new ExifInterface(path);
int orientation = exifInterface.getAttributeInt(
ExifInterface.TAG_ORIENTATION,
ExifInterface.ORIENTATION_NORMAL);
switch (orientation) {
case ExifInterface.ORIENTATION_ROTATE_90:
degree = 90;
break;
case ExifInterface.ORIENTATION_ROTATE_180:
degree = 180;
break;
case ExifInterface.ORIENTATION_ROTATE_270:
degree = 270;
break;
}
} catch (IOException e) {
e.printStackTrace();
}
return degree;
}
/**
*
* @param src
* @param degree
* @return
*/
public static Bitmap degreeBitmap(Bitmap src, float degree) {
if (degree == 0.0F) {
return src;
}
Matrix matrix = new Matrix();
matrix.reset();
matrix.setRotate(degree, src.getWidth() / 2, src.getHeight() / 2);
Bitmap resultBitmap = Bitmap.createBitmap(src, 0, 0, src.getWidth(),
src.getHeight(), matrix, true);
boolean filter = true;
if (resultBitmap == null) {
// LogUtil.e(TAG, "resultBmp is null: ");
filter = true;
} else {
filter = false;
}
if (resultBitmap != src) {
src.recycle();
}
// LogUtil.d(TAG, "filter: " + filter + " degree:" + degree);
return resultBitmap;
}
/**
* 得到指定路径图片的options
*
* @param srcPath
* @return Options {@link BitmapFactory.Options}
*/
public final static BitmapFactory.Options getBitmapOptions(String srcPath) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(srcPath, options);
return options;
}
/**
* 压缩发送到服务器的图片
*
* @param origPath
* 原始图片路径
* @param widthLimit
* 图片宽度限制
* @param heightLimit
* 图片高度限制
* @param format
* 图片格式
* @param quality
* 图片压缩率
* @param authorityDir
* 图片目录
* @param outPath
* 图片详细目录
* @return
*/
public static boolean createThumbnailFromOrig(String origPath,
int widthLimit, int heightLimit, Bitmap.CompressFormat format,
int quality, String authorityDir, String outPath) {
Bitmap bitmapThumbNail = extractThumbNail(origPath, widthLimit,
heightLimit, false);
if (bitmapThumbNail == null) {
return false;
}
try {
saveImageFile(bitmapThumbNail, quality, format, authorityDir,
outPath);
return true;
} catch (IOException e) {
// LogUtil.e(TAG, "create thumbnail from orig failed: " + outPath);
}
return false;
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static Bitmap extractThumbNail(final String path, final int width,
final int height, final boolean crop) {
Assert.assertTrue(path != null && !path.equals("") && height > 0
&& width > 0);
BitmapFactory.Options options = new BitmapFactory.Options();
try {
options.inJustDecodeBounds = true;
Bitmap tmp = BitmapFactory.decodeFile(path, options);
if (tmp != null) {
tmp.recycle();
tmp = null;
}
// LogUtil.d(TAG, "extractThumbNail: round=" + width + "x" + height
// + ", crop=" + crop);
final double beY = options.outHeight * 1.0 / height;
final double beX = options.outWidth * 1.0 / width;
// LogUtil.d(TAG, "extractThumbNail: extract beX = " + beX
// + ", beY = " + beY);
options.inSampleSize = (int) (crop ? (beY > beX ? beX : beY)
: (beY < beX ? beX : beY));
if (options.inSampleSize <= 1) {
options.inSampleSize = 1;
}
// NOTE: out of memory error
while (options.outHeight * options.outWidth / options.inSampleSize > MAX_DECODE_PICTURE_SIZE) {
options.inSampleSize++;
}
int newHeight = height;
int newWidth = width;
if (crop) {
if (beY > beX) {
newHeight = (int) (newWidth * 1.0 * options.outHeight / options.outWidth);
} else {
newWidth = (int) (newHeight * 1.0 * options.outWidth / options.outHeight);
}
} else {
if (beY < beX) {
newHeight = (int) (newWidth * 1.0 * options.outHeight / options.outWidth);
} else {
newWidth = (int) (newHeight * 1.0 * options.outWidth / options.outHeight);
}
}
options.inJustDecodeBounds = false;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
options.inMutable = true;
}
// LogUtil.i(TAG, "bitmap required size=" + newWidth + "x" + newHeight
// + ", orig=" + options.outWidth + "x" + options.outHeight
// + ", sample=" + options.inSampleSize);
Bitmap bm = BitmapFactory.decodeFile(path, options);
setInNativeAlloc(options);
if (bm == null) {
Log.e(TAG, "bitmap decode failed");
return null;
}
// LogUtil.i(
// TAG,
// "bitmap decoded size=" + bm.getWidth() + "x"
// + bm.getHeight());
final Bitmap scale = Bitmap.createScaledBitmap(bm, newWidth,
newHeight, true);
if (scale != null) {
bm.recycle();
bm = scale;
}
if (crop) {
final Bitmap cropped = Bitmap.createBitmap(bm,
(bm.getWidth() - width) >> 1,
(bm.getHeight() - height) >> 1, width, height);
if (cropped == null) {
return bm;
}
bm.recycle();
bm = cropped;
// LogUtil.i(
// TAG,
// "bitmap croped size=" + bm.getWidth() + "x"
// + bm.getHeight());
}
return bm;
} catch (final OutOfMemoryError e) {
// LogUtil.e(TAG, "decode bitmap failed: " + e.getMessage());
options = null;
}
return null;
}
public static void saveImageFile(Bitmap bitmap, int quality,
Bitmap.CompressFormat format, String authorityDir, String outPath)
throws IOException {
if (!TextUtils.isEmpty(authorityDir) && !TextUtils.isEmpty(outPath)) {
// LogUtil.d(TAG, "saving to " + authorityDir + outPath);
File file = new File(authorityDir);
if (!file.exists()) {
file.mkdirs();
}
File outfile = new File(file, outPath);
outfile.createNewFile();
try {
FileOutputStream outputStream = new FileOutputStream(outfile);
bitmap.compress(format, quality, outputStream);
outputStream.flush();
} catch (Exception e) {
// LogUtil.e(TAG, "saveImageFile fil=" + e.getMessage());
}
}
}
private static int mScreenWidth;
// public static int getImageMinWidth(Context context) {
// if (mScreenWidth <= 0) {
// mScreenWidth = DensityUtil.getImageWeidth(context, 1.0F)
// - DensityUtil.getDisplayMetrics(context, 40F);
// mScreenWidth = mScreenWidth / 4;
// }
// return mScreenWidth;
// }
// public static int getImageMinWidth2(Context context) {
// if (mScreenWidth <= 0) {
// mScreenWidth = DensityUtil.getImageWeidth(context, 1.0F)
// - DensityUtil.getDisplayMetrics(context, 40F);
// mScreenWidth = mScreenWidth / 4;
// }
// return mScreenWidth;
// }
/**
* 获取图片被旋转的角度
*
* @param filePath
* @return
*/
public static int getBitmapDegrees(String filePath) {
if (TextUtils.isEmpty(filePath)) {
// LogUtil.d(TAG, "filePath is null or nil");
return 0;
}
if (!new File(filePath).exists()) {
// LogUtil.d(TAG, "file not exist:" + filePath);
return 0;
}
ExifInterface exifInterface = null;
try {
if (Integer.valueOf(Build.VERSION.SDK).intValue() >= 5) {
exifInterface = new ExifInterface(filePath);
int attributeInt = -1;
if (exifInterface != null) {
attributeInt = exifInterface.getAttributeInt(
ExifInterface.TAG_ORIENTATION, -1);
}
if (attributeInt != -1) {
switch (attributeInt) {
case ExifInterface.ORIENTATION_FLIP_VERTICAL:
case ExifInterface.ORIENTATION_TRANSPOSE:
case ExifInterface.ORIENTATION_TRANSVERSE:
return 0;
case ExifInterface.ORIENTATION_ROTATE_180:
return 180;
case ExifInterface.ORIENTATION_ROTATE_90:
return 90;
case ExifInterface.ORIENTATION_ROTATE_270:
return 270;
default:
break;
}
}
}
} catch (IOException e) {
// LogUtil.e(TAG, "cannot read exif :" + e.getMessage());
} finally {
exifInterface = null;
}
return 0;
}
/**
* 旋转图片
*
* @param srcPath
* @param degrees
* @param format
* @param root
* @param fileName
* @return
*/
public static boolean rotateCreateBitmap(String srcPath, int degrees,
Bitmap.CompressFormat format, String root, String fileName) {
Bitmap decodeFile = BitmapFactory.decodeFile(srcPath);
if (decodeFile == null) {
// LogUtil.e(TAG, "rotate: create bitmap fialed");
return false;
}
int width = decodeFile.getWidth();
int height = decodeFile.getHeight();
Matrix matrix = new Matrix();
matrix.setRotate(degrees, width / 2.0F, height / 2.0F);
Bitmap createBitmap = Bitmap.createBitmap(decodeFile, 0, 0, width,
height, matrix, true);
decodeFile.recycle();
try {
saveImageFile(createBitmap, 60, format, root, fileName);
return true;
} catch (Exception e) {
// LogUtil.e(TAG, "create thumbnail from orig failed: " + fileName);
}
return false;
}
// /**
// * 生成一张缩略图
// *
// * @param bitmap
// * @param paramFloat
// * @return
// */
// public static Bitmap processBitmap(Bitmap bitmap, float paramFloat) {
// Assert.assertNotNull(bitmap);
// Bitmap resultBitmap = Bitmap.createBitmap(bitmap.getWidth(),
// bitmap.getHeight(), Bitmap.Config.ARGB_8888);
// Canvas canvas = new Canvas(resultBitmap);
// Paint paint = new Paint();
// Rect localRect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
// RectF rectF = new RectF(localRect);
// paint.setAntiAlias(true);
// paint.setDither(true);
// paint.setFilterBitmap(true);
// canvas.drawARGB(0, 0, 0, 0);
// paint.setColor(-4144960);
// canvas.drawRoundRect(rectF, paramFloat, paramFloat, paint);
// paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
// canvas.drawBitmap(bitmap, localRect, localRect, paint);
// bitmap.recycle();
// return resultBitmap;
// }
/**
*
* @param stream
* @param dip
* @return
*/
public static Bitmap decodeStream(InputStream stream, float dip) {
BitmapFactory.Options options = new BitmapFactory.Options();
if (dip != 0.0F) {
options.inDensity = (int) (160.0F * dip);
}
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
setInNativeAlloc(options);
try {
Bitmap bitmap = BitmapFactory.decodeStream(stream, null, options);
return bitmap;
} catch (OutOfMemoryError e) {
options.inPreferredConfig = Bitmap.Config.RGB_565;
setInNativeAlloc(options);
try {
Bitmap bitmap = BitmapFactory.decodeStream(stream, null,
options);
return bitmap;
} catch (OutOfMemoryError e2) {
}
}
return null;
}
public static String getLastText(String text) {
if (text == null) {
return null;
}
for (int i = text.length() - 1; i >= 0; --i) {
int j = text.charAt(i);
if ((j >= 19968) && (j <= 40869)) {
return String.valueOf(j);
}
}
return null;
}
/**
*
* @return
*/
public static Paint newPaint() {
Paint paint = new Paint(1);
paint.setFilterBitmap(true);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
return paint;
}
// public static Drawable getDrawable(Context context, int resid,
// Bitmap defaultMask) {
// return getDrawable(((BitmapDrawable) context.getResources()
// .getDrawable(resid)).getBitmap(), defaultMask, newPaint());
// }
// public static Drawable getDrawable(Bitmap bitmap, Bitmap defaultMask) {
// return getDrawable(bitmap, defaultMask, newPaint(), true);
// }
// public static Drawable getDrawable(Bitmap photo, Bitmap mask,
// Paint paramPaint) {
// return getDrawable(photo, mask, paramPaint, true);
// }
/*
*
*/
public static Bitmap newBitmap(int width, int height, Bitmap.Config config) {
try {
Bitmap bitmap = Bitmap.createBitmap(width, height, config);
return bitmap;
} catch (Throwable localThrowable) {
// LogUtil.e(TAG, localThrowable.getMessage());
}
return null;
}
// public static Drawable getDrawable(Bitmap src, Bitmap mask, Paint paint,
// boolean stroke) {
// if (src == null)
// return null;
// if ((stroke) && (src.getHeight() != src.getWidth()))
// try {
// int maxSize = Math.max(src.getWidth(), src.getHeight());
// Bitmap bitmap = newBitmap(maxSize, maxSize,
// Bitmap.Config.ARGB_8888);
// Canvas canvas = new Canvas(bitmap);
// canvas.drawColor(-1);
// canvas.drawBitmap(src, (maxSize - src.getWidth()) / 2,
// (maxSize - src.getHeight()) / 2, new Paint());
// PhotoBitmapDrawable photo = new PhotoBitmapDrawable(bitmap,
// mask, paint);
// return photo;
// } catch (Exception e) {
// e.printStackTrace();
// return new PhotoBitmapDrawable(src, mask, paint);
// }
// return new PhotoBitmapDrawable(src, mask, paint);
// }
public static boolean checkUpdater(String serVer) {
String version = CCPAppManager.getVersion();
return compareVersion(version, serVer) == -1;
}
public static int compareVersion(String curVer, String serVer) {
if (curVer.equals(serVer) || serVer == null) {
return 0;
}
String[] version1Array = curVer.split("\\.");
String[] version2Array = serVer.split("\\.");
int index = 0;
int minLen = Math.min(version1Array.length, version2Array.length);
long diff = 0;
while (index < minLen
&& (diff = Long.parseLong(getStringNum(version1Array[index]))
- Long.parseLong(getStringNum(version2Array[index]))) == 0) {
index++;
}
if (diff == 0) {
for (int i = index; i < version1Array.length; i++) {
if (i >= 4 || Integer.parseInt(version1Array[i]) > 0) {
// 没有新版本
return 1;
}
}
for (int i = index; i < version2Array.length; i++) {
if (Integer.parseInt(version2Array[i]) > 0) {
// 有新版本更新
return -1;
}
}
return 0;
} else {
return diff > 0 ? 1 : -1;
}
}
private static String getStringNum(String str) {
String regEx = "[^0-9]";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(str);
return m.replaceAll("").trim();
}
public static boolean saveImage(String url) {
return saveImage(url, ".jpg");
}
public static boolean saveImage(String url, String ext) {
// if (TextUtils.isEmpty(url)) {
// return false;
// }
// String filePath = url;
// File dir = new File(FileAccessor.APPS_ROOT_DIR, "ECDemo_IM");
// if (!dir.exists())
// dir.mkdirs();
// long timeMillis = System.currentTimeMillis();
// int result = FileUtils.copyFile(
// dir.getAbsolutePath(),
// "ecexport" + timeMillis,
// ext,
// FileUtils.readFlieToByte(filePath, 0,
// FileUtils.decodeFileLength(filePath)));
// if (result == 0) {
// ExportImgUtil.refreshingMediaScanner(CCPAppManager.getContext(),
// "ecexport" + timeMillis + ext);
// ToastUtil.showMessage("图片已保存至" + dir.getAbsolutePath(),
// Toast.LENGTH_LONG);
// return false;
// }
// ToastUtil.showMessage("图片保存失败");
return true;
}
public static int getScreenWidth(Activity activity) {
return activity.getWindowManager().getDefaultDisplay().getWidth();
}
public static int getScreenHeight(Activity activity) {
return activity.getWindowManager().getDefaultDisplay().getHeight();
}
/**
*
* @param context
* @param id
* @return
*/
public static Drawable getDrawables(Context context, int id) {
Drawable drawable = getResources(context).getDrawable(id);
drawable.setBounds(0, 0, drawable.getMinimumWidth(),
drawable.getMinimumHeight());
return drawable;
}
/**
*
* @Title: getResource
* @Description: TODO
* @param context
* @return Resources
*/
public static Resources getResources(Context context) {
return context.getResources();
}
// public static DisplayImageOptions getChatDisplayImageOptions() {
// return mChatDiaplayOptions;
// }
// static DisplayImageOptions mChatDiaplayOptions = new DisplayImageOptions.Builder()
// .cacheInMemory(true)// 设置下载的图片是否缓存在内存中
// .cacheOnDisk(true)// 设置下载的图片是否缓存在SD卡中
// .considerExifParams(true) // 是否考虑JPEG图像EXIF参数(旋转,翻转)
// .imageScaleType(ImageScaleType.EXACTLY_STRETCHED)// 设置图片以如何的编码方式显示
// .bitmapConfig(Bitmap.Config.RGB_565)// 设置图片的解码类型//
// .resetViewBeforeLoading(true)// 设置图片在下载前是否重置,复位
// .build();
//
// public static DisplayImageOptions.Builder getChatDisplayImageOptionsBuilder() {
// return new DisplayImageOptions.Builder().cacheInMemory(true)// 设置下载的图片是否缓存在内存中
// .cacheOnDisk(true)// 设置下载的图片是否缓存在SD卡中
// .considerExifParams(true) // 是否考虑JPEG图像EXIF参数(旋转,翻转)
// .imageScaleType(ImageScaleType.EXACTLY_STRETCHED)// 设置图片以如何的编码方式显示
// .bitmapConfig(Bitmap.Config.RGB_565)// 设置图片的解码类型//
// .resetViewBeforeLoading(true);// 设置图片在下载前是否重置,复位;
// }
private static final long[] SHAKE_PATTERN = { 300L, 200L, 300L, 200L };
private static final long[] SHAKE_MIC_PATTERN = { 300L, 200L };
public static String getLastwords(String srcText, String p) {
try {
String[] array = TextUtils.split(srcText, p);
int index = (array.length - 1 < 0) ? 0 : array.length - 1;
return array[index];
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* msg shake
*
* @param context
* @param isShake
*/
public static void shake(Context context, boolean isShake) {
Vibrator vibrator = (Vibrator) context
.getSystemService(Context.VIBRATOR_SERVICE);
if (vibrator == null) {
return;
}
if (isShake) {
vibrator.vibrate(SHAKE_PATTERN, -1);
return;
}
vibrator.cancel();
}
/**
* msg shake
*
* @param context
* @param isShake
*/
public static void shakeControlMic(Context context, boolean isShake) {
Vibrator vibrator = (Vibrator) context
.getSystemService(Context.VIBRATOR_SERVICE);
if (vibrator == null) {
return;
}
if (isShake) {
vibrator.vibrate(SHAKE_MIC_PATTERN, -1);
return;
}
vibrator.cancel();
}
public static String getDeviceWithType (ECDeviceType deviceType){
if(deviceType == null) {
return "未知";
}
switch (deviceType) {
case ANDROID_PHONE:
return "Android手机";
case IPHONE:
return "iPhone手机";
case IPAD:
return "iPad平板";
case ANDROID_PAD:
return "Android平板";
case PC:
return "PC";
case WEB:
return "Web";
default:
return "未知";
}
}
public static String getNetWorkWithType(ECNetworkType type){
if(type == null) {
return "未知";
}
switch (type) {
case ECNetworkType_WIFI:
return "wifi";
case ECNetworkType_4G:
return "4G";
case ECNetworkType_3G:
return "3G";
case ECNetworkType_GPRS:
return "GRPS";
case ECNetworkType_LAN:
return "Internet";
default:
return "其他";
}
}
}
| [
"315904145@qq.com"
] | 315904145@qq.com |
1229b54b43a42f7405a0242b23f5668217daabe9 | c6d93152ab18b0e282960b8ff224a52c88efb747 | /huntkey/code/biz-class/src/main/java/com/huntkey/rx/edm/constant/GoveGoveGoveSetbProperty.java | 071d13c6244e51edf64c72526e35c8483e734100 | [] | no_license | BAT6188/company-database | adfe5d8b87b66cd51efd0355e131de164b69d3f9 | 40d0342345cadc51ca2555840e32339ca0c83f51 | refs/heads/master | 2023-05-23T22:18:22.702550 | 2018-12-25T00:58:15 | 2018-12-25T00:58:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 243 | java | package com.huntkey.rx.edm.constant;
import com.huntkey.rx.base.PropertyBaseEntity;
/**
*
* 数据库字段常量类
*
*/
public class GoveGoveGoveSetbProperty {
//政府
public static final String GOVE_GOVE = "gove_gove";
} | [
"729235023@qq.com"
] | 729235023@qq.com |
ca2600da572f0746d2359d3992cb953fc80b538c | 9647a975917035050032d3e3b803301a1f25452b | /src/com/plan/server/SearchUser.java | 3e6f3d6e2cf33b9055ba49f8f1a2056625b685b7 | [] | no_license | webplan/PlanServer | f66dfb32a2530a85c3d02b3fedab40ce5bd66a36 | 7545336c9c6bb331c07830d009abb190397e479b | refs/heads/master | 2021-01-10T21:56:28.696505 | 2015-06-24T13:57:31 | 2015-06-24T13:57:31 | 37,074,876 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,688 | java | package com.plan.server;/**
* Created by snow on 15-5-31.
*/
import com.opensymphony.xwork2.ActionSupport;
import com.plan.data.UserEntity;
import com.plan.function.*;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
public class SearchUser extends ActionSupport implements ServletResponseAware {
private static final long serialVersionUID = 1L;
private HttpServletResponse response;
@Override
public void setServletResponse(HttpServletResponse httpServletResponse) {
this.response = httpServletResponse;
}
private String account;
private String token;
private String nickname;
//定义处理用户请求的execute方法
public String execute() {
System.err.println("SearchUser:" + account + "," + token+","+nickname);
String ret = "";
JSONObject obj = new JSONObject();
try {
DataOperate dataop = new DataOperate();
boolean istoken = Config.CheckToken(dataop, account, token);
if (istoken) {//token正確
List it = dataop.SelectTb("from UserEntity as user where user.nickname like '%"+ nickname +"%'");
JSONArray jsonArray = new JSONArray();
for (int i = 0; i < it.size(); i++) {
UserEntity user = (UserEntity) it.get(i);
JSONObject jsonObject = new JSONObject();
jsonObject.put("account", user.getAccount());
jsonObject.put("nickname", user.getNickname());
jsonObject.put("avatar_url", user.getAvatag());
jsonArray.put(jsonObject);
}
obj.put("status", 1);
obj.put("users", jsonArray);
}else
obj.put("status", 2);
} catch (Exception e) {
try {
obj.put("status", 0);
} catch (JSONException e1) {
e1.printStackTrace();
}
}
ret = obj.toString();
PrintToHtml.PrintToHtml(response, ret);
return null;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
} | [
"913704951@qq.com"
] | 913704951@qq.com |
01ea2caa4df3a8ae250a6c76ef0a369fde1771cb | af339c933e261bd9dfc7aee9f9489b71ebe4614e | /src/main/java/co/enspyr/endpointstemplate/TemplateAPI.java | dfe33c6eb9ac5a6b7993790b9ea309cdf8b1aa46 | [
"Apache-2.0"
] | permissive | nickmeinhold/endpoints-template | fa9fdd62a8e59481cec3320ca3121ce8af401128 | df2935e321efd9e4c0f4ef10b3f6183b9337d43e | refs/heads/master | 2016-08-05T04:35:57.514385 | 2015-03-30T10:21:07 | 2015-03-30T10:21:07 | 32,628,166 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,112 | java | package co.enspyr.endpointstemplate;
import static co.enspyr.endpointstemplate.OfyService.ofy;
import com.google.api.server.spi.config.Api;
import com.google.api.server.spi.config.ApiMethod;
import com.google.api.server.spi.response.UnauthorizedException;
import com.google.appengine.api.users.User;
import com.googlecode.objectify.Key;
import javax.inject.Named;
/**
* Defines v1 of a template API, which provides simple methods for a user profile.
*/
@Api(
name = "enpointstemplateapi",
version = "v1",
scopes = {Constants.EMAIL_SCOPE},
clientIds = {Constants.WEB_CLIENT_ID, Constants.ANDROID_CLIENT_ID, Constants.IOS_CLIENT_ID},
audiences = {Constants.ANDROID_AUDIENCE}
)
public class TemplateAPI {
@ApiMethod(name = "setDisplayName", path = "setDisplayName")
public Profile setDisplayName(final User user, @Named("name") String name) throws UnauthorizedException {
if (user == null) {
throw new UnauthorizedException("Authorization required");
}
String userId = user.getUserId();
// Get the Profile from the datastore if it exists, otherwise create a new one
Profile profile = ofy().load().key(Key.create(Profile.class, userId)).now();
if (profile == null) profile = new Profile(user);
profile.setDisplayName(name);
// Save the entity in the datastore
ofy().save().entity(profile).now();
return profile;
}
@ApiMethod(name = "getProfile", path = "getProfile")
public Profile getProfile(final User user) throws UnauthorizedException {
if (user == null) {
throw new UnauthorizedException("Authorization required");
}
String userId = user.getUserId();
Key key = Key.create(Profile.class, userId);
// Get the Profile from the datastore if it exists, otherwise create a new one
Profile profile = (Profile) ofy().load().key(key).now();
if (profile == null) {
profile = new Profile(user);
// Save the entity in the datastore
ofy().save().entity(profile).now();
}
return profile;
}
}
| [
"nick.meinhold@gmail.com"
] | nick.meinhold@gmail.com |
c5664393e57843fd9ea93571986c1dd209aa65b2 | 17c30fed606a8b1c8f07f3befbef6ccc78288299 | /P9_8_0_0/src/main/java/dalvik/system/DexPathList.java | 1462f597d2e1ac84ed8b045d005716d95cb85582 | [] | no_license | EggUncle/HwFrameWorkSource | 4e67f1b832a2f68f5eaae065c90215777b8633a7 | 162e751d0952ca13548f700aad987852b969a4ad | refs/heads/master | 2020-04-06T14:29:22.781911 | 2018-11-09T05:05:03 | 2018-11-09T05:05:03 | 157,543,151 | 1 | 0 | null | 2018-11-14T12:08:01 | 2018-11-14T12:08:01 | null | UTF-8 | Java | false | false | 20,674 | java | package dalvik.system;
import android.system.ErrnoException;
import android.system.OsConstants;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import libcore.io.ClassPathURLStreamHandler;
import libcore.io.IoUtils;
import libcore.io.Libcore;
final class DexPathList {
private static final String DEX_SUFFIX = ".dex";
private static final String zipSeparator = "!/";
private final ClassLoader definingContext;
private Element[] dexElements;
private IOException[] dexElementsSuppressedExceptions;
private final List<File> nativeLibraryDirectories;
private final NativeLibraryElement[] nativeLibraryPathElements;
private final List<File> systemNativeLibraryDirectories;
static class Element {
private final DexFile dexFile;
private boolean initialized;
private final File path;
private ClassPathURLStreamHandler urlHandler;
public Element(DexFile dexFile, File dexZipPath) {
this.dexFile = dexFile;
this.path = dexZipPath;
}
public Element(DexFile dexFile) {
this.dexFile = dexFile;
this.path = null;
}
public Element(File path) {
this.path = path;
this.dexFile = null;
}
@Deprecated
public Element(File dir, boolean isDirectory, File zip, DexFile dexFile) {
System.err.println("Warning: Using deprecated Element constructor. Do not use internal APIs, this constructor will be removed in the future.");
if (dir != null && (zip != null || dexFile != null)) {
throw new IllegalArgumentException("Using dir and zip|dexFile no longer supported.");
} else if (isDirectory && (zip != null || dexFile != null)) {
throw new IllegalArgumentException("Unsupported argument combination.");
} else if (dir != null) {
this.path = dir;
this.dexFile = null;
} else {
this.path = zip;
this.dexFile = dexFile;
}
}
private String getDexPath() {
String str = null;
if (this.path != null) {
if (!this.path.isDirectory()) {
str = this.path.getAbsolutePath();
}
return str;
} else if (this.dexFile != null) {
return this.dexFile.getName();
} else {
return null;
}
}
public String toString() {
if (this.dexFile == null) {
return (this.path.isDirectory() ? "directory \"" : "zip file \"") + this.path + "\"";
} else if (this.path == null) {
return "dex file \"" + this.dexFile + "\"";
} else {
return "zip file \"" + this.path + "\"";
}
}
public synchronized void maybeInit() {
if (!this.initialized) {
if (this.path == null || this.path.isDirectory()) {
this.initialized = true;
return;
}
try {
this.urlHandler = new ClassPathURLStreamHandler(this.path.getPath());
} catch (IOException ioe) {
System.logE("Unable to open zip file: " + this.path, ioe);
this.urlHandler = null;
}
this.initialized = true;
}
}
public Class<?> findClass(String name, ClassLoader definingContext, List<Throwable> suppressed) {
return this.dexFile != null ? this.dexFile.loadClassBinaryName(name, definingContext, suppressed) : null;
}
public URL findResource(String name) {
maybeInit();
if (this.urlHandler != null) {
return this.urlHandler.getEntryUrlOrNull(name);
}
if (this.path != null && this.path.isDirectory()) {
File resourceFile = new File(this.path, name);
if (resourceFile.exists()) {
try {
return resourceFile.toURI().toURL();
} catch (MalformedURLException ex) {
throw new RuntimeException(ex);
}
}
}
return null;
}
}
static class NativeLibraryElement {
private boolean initialized;
private final File path;
private ClassPathURLStreamHandler urlHandler;
private final String zipDir;
public NativeLibraryElement(File dir) {
this.path = dir;
this.zipDir = null;
}
public NativeLibraryElement(File zip, String zipDir) {
this.path = zip;
this.zipDir = zipDir;
if (zipDir == null) {
throw new IllegalArgumentException();
}
}
public String toString() {
if (this.zipDir == null) {
return "directory \"" + this.path + "\"";
}
return "zip file \"" + this.path + "\"" + (!this.zipDir.isEmpty() ? ", dir \"" + this.zipDir + "\"" : "");
}
public synchronized void maybeInit() {
if (!this.initialized) {
if (this.zipDir == null) {
this.initialized = true;
return;
}
try {
this.urlHandler = new ClassPathURLStreamHandler(this.path.getPath());
} catch (IOException ioe) {
System.logE("Unable to open zip file: " + this.path, ioe);
this.urlHandler = null;
}
this.initialized = true;
}
}
public String findNativeLibrary(String name) {
maybeInit();
if (this.zipDir == null) {
String entryPath = new File(this.path, name).getPath();
if (IoUtils.canOpenReadOnly(entryPath)) {
return entryPath;
}
} else if (this.urlHandler != null) {
String entryName = this.zipDir + '/' + name;
if (this.urlHandler.isEntryStored(entryName)) {
return this.path.getPath() + DexPathList.zipSeparator + entryName;
}
}
return null;
}
}
public DexPathList(ClassLoader definingContext, ByteBuffer[] dexFiles) {
if (definingContext == null) {
throw new NullPointerException("definingContext == null");
} else if (dexFiles == null) {
throw new NullPointerException("dexFiles == null");
} else if (Arrays.stream(dexFiles).anyMatch(new -$Lambda$xxvwQBVHC44UYbpcpA8j0sUqLOo())) {
throw new NullPointerException("dexFiles contains a null Buffer!");
} else {
this.definingContext = definingContext;
this.nativeLibraryDirectories = Collections.emptyList();
this.systemNativeLibraryDirectories = splitPaths(System.getProperty("java.library.path"), true);
this.nativeLibraryPathElements = makePathElements(this.systemNativeLibraryDirectories);
ArrayList<IOException> suppressedExceptions = new ArrayList();
this.dexElements = makeInMemoryDexElements(dexFiles, suppressedExceptions);
if (suppressedExceptions.size() > 0) {
this.dexElementsSuppressedExceptions = (IOException[]) suppressedExceptions.toArray(new IOException[suppressedExceptions.size()]);
} else {
this.dexElementsSuppressedExceptions = null;
}
}
}
static /* synthetic */ boolean lambda$-dalvik_system_DexPathList_3307(ByteBuffer v) {
return v == null;
}
public DexPathList(ClassLoader definingContext, String dexPath, String librarySearchPath, File optimizedDirectory) {
if (definingContext == null) {
throw new NullPointerException("definingContext == null");
} else if (dexPath == null) {
throw new NullPointerException("dexPath == null");
} else {
if (optimizedDirectory != null) {
if (optimizedDirectory.exists()) {
boolean canWrite;
if (optimizedDirectory.canRead()) {
canWrite = optimizedDirectory.canWrite();
} else {
canWrite = false;
}
if (!canWrite) {
throw new IllegalArgumentException("optimizedDirectory not readable/writable: " + optimizedDirectory);
}
}
throw new IllegalArgumentException("optimizedDirectory doesn't exist: " + optimizedDirectory);
}
this.definingContext = definingContext;
ArrayList<IOException> suppressedExceptions = new ArrayList();
this.dexElements = makeDexElements(splitDexPath(dexPath), optimizedDirectory, suppressedExceptions, definingContext);
this.nativeLibraryDirectories = splitPaths(librarySearchPath, false);
this.systemNativeLibraryDirectories = splitPaths(System.getProperty("java.library.path"), true);
List<File> allNativeLibraryDirectories = new ArrayList(this.nativeLibraryDirectories);
allNativeLibraryDirectories.addAll(this.systemNativeLibraryDirectories);
this.nativeLibraryPathElements = makePathElements(allNativeLibraryDirectories);
if (suppressedExceptions.size() > 0) {
this.dexElementsSuppressedExceptions = (IOException[]) suppressedExceptions.toArray(new IOException[suppressedExceptions.size()]);
} else {
this.dexElementsSuppressedExceptions = null;
}
}
}
public String toString() {
List<File> allNativeLibraryDirectories = new ArrayList(this.nativeLibraryDirectories);
allNativeLibraryDirectories.addAll(this.systemNativeLibraryDirectories);
return "DexPathList[" + Arrays.toString(this.dexElements) + ",nativeLibraryDirectories=" + Arrays.toString((File[]) allNativeLibraryDirectories.toArray(new File[allNativeLibraryDirectories.size()])) + "]";
}
public List<File> getNativeLibraryDirectories() {
return this.nativeLibraryDirectories;
}
public void addDexPath(String dexPath, File optimizedDirectory) {
List<IOException> suppressedExceptionList = new ArrayList();
Element[] newElements = makeDexElements(splitDexPath(dexPath), optimizedDirectory, suppressedExceptionList, this.definingContext);
if (newElements != null && newElements.length > 0) {
Element[] oldElements = this.dexElements;
this.dexElements = new Element[(oldElements.length + newElements.length)];
System.arraycopy(oldElements, 0, this.dexElements, 0, oldElements.length);
System.arraycopy(newElements, 0, this.dexElements, oldElements.length, newElements.length);
}
if (suppressedExceptionList.size() > 0) {
IOException[] newSuppressedExceptions = (IOException[]) suppressedExceptionList.toArray(new IOException[suppressedExceptionList.size()]);
if (this.dexElementsSuppressedExceptions != null) {
IOException[] oldSuppressedExceptions = this.dexElementsSuppressedExceptions;
this.dexElementsSuppressedExceptions = new IOException[(oldSuppressedExceptions.length + newSuppressedExceptions.length)];
System.arraycopy(oldSuppressedExceptions, 0, this.dexElementsSuppressedExceptions, 0, oldSuppressedExceptions.length);
System.arraycopy(newSuppressedExceptions, 0, this.dexElementsSuppressedExceptions, oldSuppressedExceptions.length, newSuppressedExceptions.length);
return;
}
this.dexElementsSuppressedExceptions = newSuppressedExceptions;
}
}
private static List<File> splitDexPath(String path) {
return splitPaths(path, false);
}
private static List<File> splitPaths(String searchPath, boolean directoriesOnly) {
List<File> result = new ArrayList();
if (searchPath != null) {
for (String path : searchPath.split(File.pathSeparator)) {
if (directoriesOnly) {
try {
if (!OsConstants.S_ISDIR(Libcore.os.stat(path).st_mode)) {
}
} catch (ErrnoException e) {
}
}
result.add(new File(path));
}
}
return result;
}
private static Element[] makeInMemoryDexElements(ByteBuffer[] dexFiles, List<IOException> suppressedExceptions) {
IOException suppressed;
Element[] elements = new Element[dexFiles.length];
int i = 0;
int length = dexFiles.length;
int elementPos = 0;
while (i < length) {
int elementPos2;
ByteBuffer buf = dexFiles[i];
try {
elementPos2 = elementPos + 1;
try {
elements[elementPos] = new Element(new DexFile(buf));
} catch (IOException e) {
suppressed = e;
}
} catch (IOException e2) {
suppressed = e2;
elementPos2 = elementPos;
System.logE("Unable to load dex file: " + buf, suppressed);
suppressedExceptions.add(suppressed);
i++;
elementPos = elementPos2;
}
i++;
elementPos = elementPos2;
}
if (elementPos != elements.length) {
return (Element[]) Arrays.copyOf(elements, elementPos);
}
return elements;
}
private static Element[] makeDexElements(List<File> files, File optimizedDirectory, List<IOException> suppressedExceptions, ClassLoader loader) {
IOException suppressed;
Element[] elements = new Element[files.size()];
int elementsPos = 0;
for (File file : files) {
int elementsPos2;
if (file.isDirectory()) {
elementsPos2 = elementsPos + 1;
elements[elementsPos] = new Element(file);
elementsPos = elementsPos2;
} else if (!file.isFile()) {
System.logW("ClassLoader referenced unknown path: " + file);
} else if (file.getName().endsWith(DEX_SUFFIX)) {
try {
dex = loadDexFile(file, optimizedDirectory, loader, elements);
if (dex != null) {
elementsPos2 = elementsPos + 1;
try {
elements[elementsPos] = new Element(dex, null);
elementsPos = elementsPos2;
} catch (IOException e) {
suppressed = e;
elementsPos = elementsPos2;
System.logE("Unable to load dex file: " + file, suppressed);
suppressedExceptions.add(suppressed);
}
}
} catch (IOException e2) {
suppressed = e2;
System.logE("Unable to load dex file: " + file, suppressed);
suppressedExceptions.add(suppressed);
}
} else {
dex = null;
try {
dex = loadDexFile(file, optimizedDirectory, loader, elements);
} catch (IOException suppressed2) {
suppressedExceptions.add(suppressed2);
}
if (dex == null) {
elementsPos2 = elementsPos + 1;
elements[elementsPos] = new Element(file);
elementsPos = elementsPos2;
} else {
elementsPos2 = elementsPos + 1;
elements[elementsPos] = new Element(dex, file);
elementsPos = elementsPos2;
}
}
}
if (elementsPos != elements.length) {
return (Element[]) Arrays.copyOf(elements, elementsPos);
}
return elements;
}
private static DexFile loadDexFile(File file, File optimizedDirectory, ClassLoader loader, Element[] elements) throws IOException {
if (optimizedDirectory == null) {
return new DexFile(file, loader, elements);
}
return DexFile.loadDex(file.getPath(), optimizedPathFor(file, optimizedDirectory), 0, loader, elements);
}
private static String optimizedPathFor(File path, File optimizedDirectory) {
String fileName = path.getName();
if (!fileName.endsWith(DEX_SUFFIX)) {
int lastDot = fileName.lastIndexOf(".");
if (lastDot < 0) {
fileName = fileName + DEX_SUFFIX;
} else {
StringBuilder sb = new StringBuilder(lastDot + 4);
sb.append(fileName, 0, lastDot);
sb.append(DEX_SUFFIX);
fileName = sb.toString();
}
}
return new File(optimizedDirectory, fileName).getPath();
}
private static Element[] makePathElements(List<File> files, File optimizedDirectory, List<IOException> suppressedExceptions) {
return makeDexElements(files, optimizedDirectory, suppressedExceptions, null);
}
private static NativeLibraryElement[] makePathElements(List<File> files) {
NativeLibraryElement[] elements = new NativeLibraryElement[files.size()];
int elementsPos = 0;
for (File file : files) {
String path = file.getPath();
int elementsPos2;
if (path.contains(zipSeparator)) {
String[] split = path.split(zipSeparator, 2);
elementsPos2 = elementsPos + 1;
elements[elementsPos] = new NativeLibraryElement(new File(split[0]), split[1]);
elementsPos = elementsPos2;
} else if (file.isDirectory()) {
elementsPos2 = elementsPos + 1;
elements[elementsPos] = new NativeLibraryElement(file);
elementsPos = elementsPos2;
}
}
if (elementsPos != elements.length) {
return (NativeLibraryElement[]) Arrays.copyOf(elements, elementsPos);
}
return elements;
}
public Class<?> findClass(String name, List<Throwable> suppressed) {
for (Element element : this.dexElements) {
Class<?> clazz = element.findClass(name, this.definingContext, suppressed);
if (clazz != null) {
return clazz;
}
}
if (this.dexElementsSuppressedExceptions != null) {
suppressed.addAll(Arrays.asList(this.dexElementsSuppressedExceptions));
}
return null;
}
public URL findResource(String name) {
for (Element element : this.dexElements) {
URL url = element.findResource(name);
if (url != null) {
return url;
}
}
return null;
}
public Enumeration<URL> findResources(String name) {
ArrayList<URL> result = new ArrayList();
for (Element element : this.dexElements) {
URL url = element.findResource(name);
if (url != null) {
result.add(url);
}
}
return Collections.enumeration(result);
}
public String findLibrary(String libraryName) {
String fileName = System.mapLibraryName(libraryName);
for (NativeLibraryElement element : this.nativeLibraryPathElements) {
String path = element.findNativeLibrary(fileName);
if (path != null) {
return path;
}
}
return null;
}
List<String> getDexPaths() {
List<String> dexPaths = new ArrayList();
for (Element e : this.dexElements) {
String dexPath = e.getDexPath();
if (dexPath != null) {
dexPaths.add(dexPath);
}
}
return dexPaths;
}
}
| [
"lygforbs0@mail.com"
] | lygforbs0@mail.com |
44433f645fdd1f60563ef47dc82b9990882a0958 | a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb | /imgsearch-20200320/src/main/java/com/aliyun/imgsearch20200320/models/SearchImageResponseBody.java | 4fb53aa4cf9c7b8c4a8da013c851fee1331ae281 | [
"Apache-2.0"
] | permissive | aliyun/alibabacloud-java-sdk | 83a6036a33c7278bca6f1bafccb0180940d58b0b | 008923f156adf2e4f4785a0419f60640273854ec | refs/heads/master | 2023-09-01T04:10:33.640756 | 2023-09-01T02:40:45 | 2023-09-01T02:40:45 | 288,968,318 | 40 | 45 | null | 2023-06-13T02:47:13 | 2020-08-20T09:51:08 | Java | UTF-8 | Java | false | false | 3,548 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.imgsearch20200320.models;
import com.aliyun.tea.*;
public class SearchImageResponseBody extends TeaModel {
@NameInMap("Data")
public SearchImageResponseBodyData data;
@NameInMap("RequestId")
public String requestId;
public static SearchImageResponseBody build(java.util.Map<String, ?> map) throws Exception {
SearchImageResponseBody self = new SearchImageResponseBody();
return TeaModel.build(map, self);
}
public SearchImageResponseBody setData(SearchImageResponseBodyData data) {
this.data = data;
return this;
}
public SearchImageResponseBodyData getData() {
return this.data;
}
public SearchImageResponseBody setRequestId(String requestId) {
this.requestId = requestId;
return this;
}
public String getRequestId() {
return this.requestId;
}
public static class SearchImageResponseBodyDataMatchList extends TeaModel {
@NameInMap("DataId")
public String dataId;
@NameInMap("EntityId")
public String entityId;
@NameInMap("ExtraData")
public String extraData;
@NameInMap("ImageUrl")
public String imageUrl;
@NameInMap("Score")
public Float score;
public static SearchImageResponseBodyDataMatchList build(java.util.Map<String, ?> map) throws Exception {
SearchImageResponseBodyDataMatchList self = new SearchImageResponseBodyDataMatchList();
return TeaModel.build(map, self);
}
public SearchImageResponseBodyDataMatchList setDataId(String dataId) {
this.dataId = dataId;
return this;
}
public String getDataId() {
return this.dataId;
}
public SearchImageResponseBodyDataMatchList setEntityId(String entityId) {
this.entityId = entityId;
return this;
}
public String getEntityId() {
return this.entityId;
}
public SearchImageResponseBodyDataMatchList setExtraData(String extraData) {
this.extraData = extraData;
return this;
}
public String getExtraData() {
return this.extraData;
}
public SearchImageResponseBodyDataMatchList setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
return this;
}
public String getImageUrl() {
return this.imageUrl;
}
public SearchImageResponseBodyDataMatchList setScore(Float score) {
this.score = score;
return this;
}
public Float getScore() {
return this.score;
}
}
public static class SearchImageResponseBodyData extends TeaModel {
@NameInMap("MatchList")
public java.util.List<SearchImageResponseBodyDataMatchList> matchList;
public static SearchImageResponseBodyData build(java.util.Map<String, ?> map) throws Exception {
SearchImageResponseBodyData self = new SearchImageResponseBodyData();
return TeaModel.build(map, self);
}
public SearchImageResponseBodyData setMatchList(java.util.List<SearchImageResponseBodyDataMatchList> matchList) {
this.matchList = matchList;
return this;
}
public java.util.List<SearchImageResponseBodyDataMatchList> getMatchList() {
return this.matchList;
}
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
0dff3ab510f056d5d55571c94e04568a112e1fd8 | 2b6bdcd77f28b5ff2cdce710b68d27f5b937077b | /patch/src/main/java/org/xbo/hotfix/PatchGenerator.java | d4fb09ca212a60da694e1882a54e17045ef95b91 | [] | no_license | xbo2018/hotfix | 4369d22439a8599355a453c470db11da311bfe0b | 656d327ed3aece5e00c7e6f5e3fb79d949046bc1 | refs/heads/master | 2020-12-09T20:02:04.671404 | 2020-05-10T13:12:57 | 2020-05-10T13:46:43 | 233,405,300 | 2 | 1 | null | 2020-10-13T18:49:20 | 2020-01-12T14:28:54 | Java | UTF-8 | Java | false | false | 150 | java | package org.xbo.hotfix;
import net.bytebuddy.agent.builder.AgentBuilder;
public interface PatchGenerator {
AgentBuilder createPatchBuilder();
}
| [
"xbo9527@qq.com"
] | xbo9527@qq.com |
f75c0df7b3858ca280661505b9062da2380d765c | 9e190dab20607c54e6196dcc249e1d2e22d9c884 | /src/cn/esbuy/service/impl/GoodServiceImpl.java | 601f0d187522381fb8621f8b9a35a92285c623a8 | [] | no_license | Alexd-star/esbuy | 3d4af5936751d8e67464848084127cc15690ade7 | bcad7c2f954a057a5013e2ecd936be6e484a7015 | refs/heads/master | 2023-04-10T13:38:03.857484 | 2021-04-24T10:01:58 | 2021-04-24T10:01:58 | 361,127,213 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,256 | java | package cn.esbuy.service.impl;
import java.util.List;
import cn.esbuy.dao.GoodDao;
import cn.esbuy.dao.impl.GoodDaoImpl;
import cn.esbuy.entity.Good;
import cn.esbuy.entity.GoodVo;
import cn.esbuy.service.GoodService;
public class GoodServiceImpl implements GoodService {
GoodDao goodDao = new GoodDaoImpl();
@Override
public List<GoodVo> getList() {
return goodDao.selectList(null);
}
@Override
public List<GoodVo> getList(Integer top) {
return goodDao.selectList(top);
}
@Override
public List<GoodVo> getList(int tid, String gdname) {
return goodDao.selectList(tid, gdname);
}
@Override
public Good getGood(int gdid) {
return goodDao.selectGood(gdid);
}
@Override
public boolean addGood(Good good) {
if (goodDao.insertGood(good) >= 1) {
return true;
}
return false;
}
@Override
public boolean editGood(Good good) {
if (goodDao.updateGood(good) >= 1) {
return true;
}
return false;
}
@Override
public boolean removeGood(int gdid) {
if (goodDao.deleteGood(gdid) >= 1) {
return true;
}
return false;
}
}
| [
"2631266845@qq.com"
] | 2631266845@qq.com |
68ac14f5a7d5401b943e1a784480157d85e0e49c | 379a066debc289afcb1c4936077df81702e8e218 | /app/src/main/java/com/daasuu/bl/Bubble.java | e7dbcb19bc5c89d5c57e10be8ab48a35a3b89479 | [] | no_license | xuchengcan/EasyView | f0b387645ff01f5b12d86e2ec2fd7a70cce33d4f | f32b35da960a6432e29e5f01e05f434abdc94437 | refs/heads/master | 2021-01-11T22:42:29.841642 | 2019-02-23T07:34:16 | 2019-02-23T07:34:16 | 79,014,416 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,337 | java | package com.daasuu.bl;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
/**
* Created by sudamasayuki on 16/03/27.
*/
class Bubble extends Drawable {
private RectF mRect;
private Path mPath = new Path();
private Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private Path mStrokePath;
private Paint mStrokePaint;
private float mArrowWidth;
private float mCornersRadius;
private float mArrowHeight;
private float mArrowPosition;
private float mStrokeWidth;
public Bubble(RectF rect, float arrowWidth, float cornersRadius, float arrowHeight, float arrowPosition, float strokeWidth, int strokeColor, int bubbleColor, ArrowDirection arrowDirection) {
this.mRect = rect;
this.mArrowWidth = arrowWidth;
this.mCornersRadius = cornersRadius;
this.mArrowHeight = arrowHeight;
this.mArrowPosition = arrowPosition;
this.mStrokeWidth = strokeWidth;
mPaint.setColor(bubbleColor);
if (strokeWidth > 0) {
mStrokePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mStrokePaint.setColor(strokeColor);
mStrokePath = new Path();
initPath(arrowDirection, mPath, strokeWidth);
initPath(arrowDirection, mStrokePath, 0);
} else {
initPath(arrowDirection, mPath, 0);
}
}
@Override
protected void onBoundsChange(Rect bounds) {
super.onBoundsChange(bounds);
}
@Override
public void draw(Canvas canvas) {
if (mStrokeWidth > 0) {
canvas.drawPath(mStrokePath, mStrokePaint);
}
canvas.drawPath(mPath, mPaint);
}
@Override
public int getOpacity() {
return PixelFormat.TRANSLUCENT;
}
@Override
public void setAlpha(int alpha) {
mPaint.setAlpha(alpha);
}
@Override
public void setColorFilter(ColorFilter cf) {
mPaint.setColorFilter(cf);
}
@Override
public int getIntrinsicWidth() {
return (int) mRect.width();
}
@Override
public int getIntrinsicHeight() {
return (int) mRect.height();
}
private void initPath(ArrowDirection arrowDirection, Path path, float strokeWidth) {
switch (arrowDirection) {
case LEFT:
if (mCornersRadius <= 0) {
initLeftSquarePath(mRect, path, strokeWidth);
break;
}
if (strokeWidth > 0 && strokeWidth > mCornersRadius) {
initLeftSquarePath(mRect, path, strokeWidth);
break;
}
initLeftRoundedPath(mRect, path, strokeWidth);
break;
case TOP:
if (mCornersRadius <= 0) {
initTopSquarePath(mRect, path, strokeWidth);
break;
}
if (strokeWidth > 0 && strokeWidth > mCornersRadius) {
initTopSquarePath(mRect, path, strokeWidth);
break;
}
initTopRoundedPath(mRect, path, strokeWidth);
break;
case RIGHT:
if (mCornersRadius <= 0) {
initRightSquarePath(mRect, path, strokeWidth);
break;
}
if (strokeWidth > 0 && strokeWidth > mCornersRadius) {
initRightSquarePath(mRect, path, strokeWidth);
break;
}
initRightRoundedPath(mRect, path, strokeWidth);
break;
case BOTTOM:
if (mCornersRadius <= 0) {
initBottomSquarePath(mRect, path, strokeWidth);
break;
}
if (strokeWidth > 0 && strokeWidth > mCornersRadius) {
initBottomSquarePath(mRect, path, strokeWidth);
break;
}
initBottomRoundedPath(mRect, path, strokeWidth);
break;
}
}
private void initLeftRoundedPath(RectF rect, Path path, float strokeWidth) {
path.moveTo(mArrowWidth + rect.left + mCornersRadius + strokeWidth, rect.top + strokeWidth);
path.lineTo(rect.width() - mCornersRadius - strokeWidth, rect.top + strokeWidth);
path.arcTo(new RectF(rect.right - mCornersRadius, rect.top + strokeWidth, rect.right - strokeWidth,
mCornersRadius + rect.top), 270, 90);
path.lineTo(rect.right - strokeWidth, rect.bottom - mCornersRadius - strokeWidth);
path.arcTo(new RectF(rect.right - mCornersRadius, rect.bottom - mCornersRadius,
rect.right - strokeWidth, rect.bottom - strokeWidth), 0, 90);
path.lineTo(rect.left + mArrowWidth + mCornersRadius + strokeWidth, rect.bottom - strokeWidth);
path.arcTo(new RectF(rect.left + mArrowWidth + strokeWidth, rect.bottom - mCornersRadius,
mCornersRadius + rect.left + mArrowWidth, rect.bottom - strokeWidth), 90, 90);
path.lineTo(rect.left + mArrowWidth + strokeWidth, mArrowHeight + mArrowPosition - (strokeWidth / 2));
path.lineTo(rect.left + strokeWidth + strokeWidth, mArrowPosition + mArrowHeight / 2);
path.lineTo(rect.left + mArrowWidth + strokeWidth, mArrowPosition + (strokeWidth / 2));
path.lineTo(rect.left + mArrowWidth + strokeWidth, rect.top + mCornersRadius + strokeWidth);
path.arcTo(new RectF(rect.left + mArrowWidth + strokeWidth, rect.top + strokeWidth, mCornersRadius
+ rect.left + mArrowWidth, mCornersRadius + rect.top), 180, 90);
path.close();
}
private void initLeftSquarePath(RectF rect, Path path, float strokeWidth) {
path.moveTo(mArrowWidth + rect.left + strokeWidth, rect.top + strokeWidth);
path.lineTo(rect.width() - strokeWidth, rect.top + strokeWidth);
path.lineTo(rect.right - strokeWidth, rect.bottom - strokeWidth);
path.lineTo(rect.left + mArrowWidth + strokeWidth, rect.bottom - strokeWidth);
path.lineTo(rect.left + mArrowWidth + strokeWidth, mArrowHeight + mArrowPosition - (strokeWidth / 2));
path.lineTo(rect.left + strokeWidth + strokeWidth, mArrowPosition + mArrowHeight / 2);
path.lineTo(rect.left + mArrowWidth + strokeWidth, mArrowPosition + (strokeWidth / 2));
path.lineTo(rect.left + mArrowWidth + strokeWidth, rect.top + strokeWidth);
path.close();
}
private void initTopRoundedPath(RectF rect, Path path, float strokeWidth) {
path.moveTo(rect.left + Math.min(mArrowPosition, mCornersRadius) + strokeWidth, rect.top + mArrowHeight + strokeWidth);
path.lineTo(rect.left + mArrowPosition + (strokeWidth / 2), rect.top + mArrowHeight + strokeWidth);
path.lineTo(rect.left + mArrowWidth / 2 + mArrowPosition, rect.top + strokeWidth + strokeWidth);
path.lineTo(rect.left + mArrowWidth + mArrowPosition - (strokeWidth / 2), rect.top + mArrowHeight + strokeWidth);
path.lineTo(rect.right - mCornersRadius - strokeWidth, rect.top + mArrowHeight + strokeWidth);
path.arcTo(new RectF(rect.right - mCornersRadius,
rect.top + mArrowHeight + strokeWidth, rect.right - strokeWidth, mCornersRadius + rect.top + mArrowHeight), 270, 90);
path.lineTo(rect.right - strokeWidth, rect.bottom - mCornersRadius - strokeWidth);
path.arcTo(new RectF(rect.right - mCornersRadius, rect.bottom - mCornersRadius,
rect.right - strokeWidth, rect.bottom - strokeWidth), 0, 90);
path.lineTo(rect.left + mCornersRadius + strokeWidth, rect.bottom - strokeWidth);
path.arcTo(new RectF(rect.left + strokeWidth, rect.bottom - mCornersRadius,
mCornersRadius + rect.left, rect.bottom - strokeWidth), 90, 90);
path.lineTo(rect.left + strokeWidth, rect.top + mArrowHeight + mCornersRadius + strokeWidth);
path.arcTo(new RectF(rect.left + strokeWidth, rect.top + mArrowHeight + strokeWidth, mCornersRadius
+ rect.left, mCornersRadius + rect.top + mArrowHeight), 180, 90);
path.close();
}
private void initTopSquarePath(RectF rect, Path path, float strokeWidth) {
path.moveTo(rect.left + mArrowPosition + strokeWidth, rect.top + mArrowHeight + strokeWidth);
path.lineTo(rect.left + mArrowPosition + (strokeWidth / 2), rect.top + mArrowHeight + strokeWidth);
path.lineTo(rect.left + mArrowWidth / 2 + mArrowPosition, rect.top + strokeWidth + strokeWidth);
path.lineTo(rect.left + mArrowWidth + mArrowPosition - (strokeWidth / 2), rect.top + mArrowHeight + strokeWidth);
path.lineTo(rect.right - strokeWidth, rect.top + mArrowHeight + strokeWidth);
path.lineTo(rect.right - strokeWidth, rect.bottom - strokeWidth);
path.lineTo(rect.left + strokeWidth, rect.bottom - strokeWidth);
path.lineTo(rect.left + strokeWidth, rect.top + mArrowHeight + strokeWidth);
path.lineTo(rect.left + mArrowPosition + strokeWidth, rect.top + mArrowHeight + strokeWidth);
path.close();
}
private void initRightRoundedPath(RectF rect, Path path, float strokeWidth) {
path.moveTo(rect.left + mCornersRadius + strokeWidth, rect.top + strokeWidth);
path.lineTo(rect.width() - mCornersRadius - mArrowWidth - strokeWidth, rect.top + strokeWidth);
path.arcTo(new RectF(rect.right - mCornersRadius - mArrowWidth,
rect.top + strokeWidth, rect.right - mArrowWidth - strokeWidth, mCornersRadius + rect.top), 270, 90);
path.lineTo(rect.right - mArrowWidth - strokeWidth, mArrowPosition + (strokeWidth / 2));
path.lineTo(rect.right - strokeWidth - strokeWidth, mArrowPosition + mArrowHeight / 2);
path.lineTo(rect.right - mArrowWidth - strokeWidth, mArrowPosition + mArrowHeight - (strokeWidth / 2));
path.lineTo(rect.right - mArrowWidth - strokeWidth, rect.bottom - mCornersRadius - strokeWidth);
path.arcTo(new RectF(rect.right - mCornersRadius - mArrowWidth, rect.bottom - mCornersRadius,
rect.right - mArrowWidth - strokeWidth, rect.bottom - strokeWidth), 0, 90);
path.lineTo(rect.left + mArrowWidth + strokeWidth, rect.bottom - strokeWidth);
path.arcTo(new RectF(rect.left + strokeWidth, rect.bottom - mCornersRadius,
mCornersRadius + rect.left, rect.bottom - strokeWidth), 90, 90);
path.arcTo(new RectF(rect.left + strokeWidth, rect.top + strokeWidth, mCornersRadius
+ rect.left, mCornersRadius + rect.top), 180, 90);
path.close();
}
private void initRightSquarePath(RectF rect, Path path, float strokeWidth) {
path.moveTo(rect.left + strokeWidth, rect.top + strokeWidth);
path.lineTo(rect.width() - mArrowWidth - strokeWidth, rect.top + strokeWidth);
path.lineTo(rect.right - mArrowWidth - strokeWidth, mArrowPosition + (strokeWidth / 2));
path.lineTo(rect.right - strokeWidth - strokeWidth, mArrowPosition + mArrowHeight / 2);
path.lineTo(rect.right - mArrowWidth - strokeWidth, mArrowPosition + mArrowHeight - (strokeWidth / 2));
path.lineTo(rect.right - mArrowWidth - strokeWidth, rect.bottom - strokeWidth);
path.lineTo(rect.left + strokeWidth, rect.bottom - strokeWidth);
path.lineTo(rect.left + strokeWidth, rect.top + strokeWidth);
path.close();
}
private void initBottomRoundedPath(RectF rect, Path path, float strokeWidth) {
path.moveTo(rect.left + mCornersRadius + strokeWidth, rect.top + strokeWidth);
path.lineTo(rect.width() - mCornersRadius - strokeWidth, rect.top + strokeWidth);
path.arcTo(new RectF(rect.right - mCornersRadius,
rect.top + strokeWidth, rect.right - strokeWidth, mCornersRadius + rect.top), 270, 90);
path.lineTo(rect.right - strokeWidth, rect.bottom - mArrowHeight - mCornersRadius - strokeWidth);
path.arcTo(new RectF(rect.right - mCornersRadius, rect.bottom - mCornersRadius - mArrowHeight,
rect.right - strokeWidth, rect.bottom - mArrowHeight - strokeWidth), 0, 90);
path.lineTo(rect.left + mArrowWidth + mArrowPosition - (strokeWidth / 2), rect.bottom - mArrowHeight - strokeWidth);
path.lineTo(rect.left + mArrowPosition + mArrowWidth / 2, rect.bottom - strokeWidth - strokeWidth);
path.lineTo(rect.left + mArrowPosition + (strokeWidth / 2), rect.bottom - mArrowHeight - strokeWidth);
path.lineTo(rect.left + Math.min(mCornersRadius, mArrowPosition) + strokeWidth, rect.bottom - mArrowHeight - strokeWidth);
path.arcTo(new RectF(rect.left + strokeWidth, rect.bottom - mCornersRadius - mArrowHeight,
mCornersRadius + rect.left, rect.bottom - mArrowHeight - strokeWidth), 90, 90);
path.lineTo(rect.left + strokeWidth, rect.top + mCornersRadius + strokeWidth);
path.arcTo(new RectF(rect.left + strokeWidth, rect.top + strokeWidth, mCornersRadius
+ rect.left, mCornersRadius + rect.top), 180, 90);
path.close();
}
private void initBottomSquarePath(RectF rect, Path path, float strokeWidth) {
path.moveTo(rect.left + strokeWidth, rect.top + strokeWidth);
path.lineTo(rect.right - strokeWidth, rect.top + strokeWidth);
path.lineTo(rect.right - strokeWidth, rect.bottom - mArrowHeight - strokeWidth);
path.lineTo(rect.left + mArrowWidth + mArrowPosition - (strokeWidth / 2), rect.bottom - mArrowHeight - strokeWidth);
path.lineTo(rect.left + mArrowPosition + mArrowWidth / 2, rect.bottom - strokeWidth - strokeWidth);
path.lineTo(rect.left + mArrowPosition + (strokeWidth / 2), rect.bottom - mArrowHeight - strokeWidth);
path.lineTo(rect.left + mArrowPosition + strokeWidth, rect.bottom - mArrowHeight - strokeWidth);
path.lineTo(rect.left + strokeWidth, rect.bottom - mArrowHeight - strokeWidth);
path.lineTo(rect.left + strokeWidth, rect.top + strokeWidth);
path.close();
}
} | [
"617322616@qq.com"
] | 617322616@qq.com |
5b39c4f11d777fb6baf1fc781733f62ed56aff50 | 3f7a5d7c700199625ed2ab3250b939342abee9f1 | /src/gcom/gui/seguranca/acesso/ExibirSubstituirValidadorAutorizadorAction.java | 752c6ec4ec3e3cad1d3480e942e9e00f24bf0cbd | [] | no_license | prodigasistemas/gsan-caema | 490cecbd2a784693de422d3a2033967d8063204d | 87a472e07e608c557e471d555563d71c76a56ec5 | refs/heads/master | 2021-01-01T06:05:09.920120 | 2014-10-08T20:10:40 | 2014-10-08T20:10:40 | 24,958,220 | 1 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 11,401 | java | /*
* Copyright (C) 2007-2007 the GSAN - Sistema Integrado de Gestão de Serviços de Saneamento
*
* This file is part of GSAN, an integrated service management system for Sanitation
*
* GSAN is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License.
*
* GSAN is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
/*
* GSAN - Sistema Integrado de Gestão de Serviços de Saneamento
* Copyright (C) <2007>
* Adriano Britto Siqueira
* Alexandre Santos Cabral
* Ana Carolina Alves Breda
* Ana Maria Andrade Cavalcante
* Aryed Lins de Araújo
* Bruno Leonardo Rodrigues Barros
* Carlos Elmano Rodrigues Ferreira
* Cláudio de Andrade Lira
* Denys Guimarães Guenes Tavares
* Eduardo Breckenfeld da Rosa Borges
* Fabíola Gomes de Araújo
* Flávio Leonardo Cavalcanti Cordeiro
* Francisco do Nascimento Júnior
* Homero Sampaio Cavalcanti
* Ivan Sérgio da Silva Júnior
* José Edmar de Siqueira
* José Thiago Tenório Lopes
* Kássia Regina Silvestre de Albuquerque
* Leonardo Luiz Vieira da Silva
* Márcio Roberto Batista da Silva
* Maria de Fátima Sampaio Leite
* Micaela Maria Coelho de Araújo
* Nelson Mendonça de Carvalho
* Newton Morais e Silva
* Pedro Alexandre Santos da Silva Filho
* Rafael Corrêa Lima e Silva
* Rafael Francisco Pinto
* Rafael Koury Monteiro
* Rafael Palermo de Araújo
* Raphael Veras Rossiter
* Roberto Sobreira Barbalho
* Rodrigo Avellar Silveira
* Rosana Carvalho Barbosa
* Sávio Luiz de Andrade Cavalcante
* Tai Mu Shih
* Thiago Augusto Souza do Nascimento
* Tiago Moreno Rodrigues
* Vivianne Barbosa Sousa
*
* Este programa é software livre; você pode redistribuí-lo e/ou
* modificá-lo sob os termos de Licença Pública Geral GNU, conforme
* publicada pela Free Software Foundation; versão 2 da
* Licença.
* Este programa é distribuído na expectativa de ser útil, mas SEM
* QUALQUER GARANTIA; sem mesmo a garantia implícita de
* COMERCIALIZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM
* PARTICULAR. Consulte a Licença Pública Geral GNU para obter mais
* detalhes.
* Você deve ter recebido uma cópia da Licença Pública Geral GNU
* junto com este programa; se não, escreva para Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307, USA.
*/
package gcom.gui.seguranca.acesso;
import gcom.fachada.Fachada;
import gcom.gui.ActionServletException;
import gcom.gui.GcomAction;
import gcom.seguranca.acesso.usuario.FiltroSolicitacaoAcesso;
import gcom.seguranca.acesso.usuario.FiltroSolicitacaoAcessoSituacao;
import gcom.seguranca.acesso.usuario.FiltroUsuario;
import gcom.seguranca.acesso.usuario.SolicitacaoAcesso;
import gcom.seguranca.acesso.usuario.SolicitacaoAcessoSituacao;
import gcom.seguranca.acesso.usuario.Usuario;
import gcom.util.ConstantesSistema;
import gcom.util.Util;
import gcom.util.filtro.ConectorOr;
import gcom.util.filtro.ParametroSimples;
import gcom.util.filtro.ParametroSimplesIn;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
/**
* Descrição da classe
*
* @author Rômulo Aurélio
* @date 15/05/2006
*/
public class ExibirSubstituirValidadorAutorizadorAction extends GcomAction {
public ActionForward execute(ActionMapping actionMapping,
ActionForm actionForm, HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse) {
ActionForward retorno = actionMapping.findForward("exibirSubstituirValidadorAutorizador");
Fachada fachada = Fachada.getInstancia();
HttpSession sessao = httpServletRequest.getSession(false);
SubstituirValidadorAutorizadorActionForm form = (SubstituirValidadorAutorizadorActionForm) actionForm;
// Limpar
if(httpServletRequest.getParameter("menu") != null && !httpServletRequest.getParameter("menu").equals("")){
form.setUsuarioTipo("3");
form.setCodigoNovoUsuario("");
form.setNomeNovoUsuario("");
form.setCodigoUsuario("");
form.setNomeUsuario("");
form.setSolicitacaoSituacao(null);
}
//[IT0003] Obter Solicitações de Acesso.
if(httpServletRequest.getParameter("botao") != null && !httpServletRequest.getParameter("botao").equals("")){
FiltroUsuario filtroUsuario = new FiltroUsuario();
filtroUsuario.adicionarParametro(new ParametroSimples(FiltroUsuario.LOGIN, form.getCodigoUsuario()));
Collection<?> colUsuario = fachada.pesquisar(filtroUsuario, Usuario.class.getName());
Usuario usuario = null;
if(colUsuario != null && !colUsuario.isEmpty()){
usuario = (Usuario) Util.retonarObjetoDeColecao(colUsuario);
}else{
throw new ActionServletException(
"atencao.pesquisa.usuario.inexistente");
}
String usuarioTipo = form.getUsuarioTipo();
if(form.getUsuarioTipo() == null || ( form.getUsuarioTipo()!= null && form.getUsuarioTipo().equals("") ) ){
throw new ActionServletException(
"atencao.usuario_tipo_obrigatorio");
}
FiltroSolicitacaoAcesso filtro = new FiltroSolicitacaoAcesso();
// 1.1
if(usuarioTipo.equals("1")){
filtro.adicionarParametro(new ParametroSimples(FiltroSolicitacaoAcesso.USUARIO_RESPONSAVEL_ID, usuario.getId()));
}else if(usuarioTipo.equals("2")){
if(usuario.getFuncionario() != null){
filtro.adicionarParametro(new ParametroSimples(FiltroSolicitacaoAcesso.FUNCIONARIO_RESPONSAVEL_ID, usuario.getFuncionario().getId()));
}else{
throw new ActionServletException("atencao.usuario_informado_nao_autorizador");
}
}else{
if(usuario.getFuncionario() != null){
filtro.adicionarParametro(new ParametroSimples(FiltroSolicitacaoAcesso.USUARIO_RESPONSAVEL_ID, usuario.getId(),ConectorOr.CONECTOR_OR, 2));
filtro.adicionarParametro(new ParametroSimples(FiltroSolicitacaoAcesso.FUNCIONARIO_RESPONSAVEL_ID, usuario.getFuncionario().getId()));
}else{
filtro.adicionarParametro(new ParametroSimples(FiltroSolicitacaoAcesso.USUARIO_RESPONSAVEL_ID, usuario.getId()));
}
}
String[] solicitacaoSituacao = form.getSolicitacaoSituacao();
// 2
if(solicitacaoSituacao != null && solicitacaoSituacao.length != 0){
Collection<String> colecaoIdsSolicitacaoSituacao = new ArrayList();
for(int i = 0; i<solicitacaoSituacao.length;i++){
if(solicitacaoSituacao[i] != null && !(solicitacaoSituacao[i]).equals("")){
colecaoIdsSolicitacaoSituacao.add(solicitacaoSituacao[i]);
}
}
filtro.adicionarParametro(new ParametroSimplesIn(FiltroSolicitacaoAcesso.SOLICITACAO_ACESSO_SITUACAO_ID, colecaoIdsSolicitacaoSituacao));
}
filtro.adicionarCaminhoParaCarregamentoEntidade(FiltroSolicitacaoAcesso.USUARIO_SOLICITANTE);
filtro.adicionarCaminhoParaCarregamentoEntidade(FiltroSolicitacaoAcesso.USUARIO_RESPONSAVEL);
filtro.adicionarCaminhoParaCarregamentoEntidade(FiltroSolicitacaoAcesso.SOLICITACAO_ACESSO_SITUACAO);
Collection<?> colecaoSolicitacaoAcesso = fachada.pesquisar(filtro, SolicitacaoAcesso.class.getName());
if(colecaoSolicitacaoAcesso != null && !colecaoSolicitacaoAcesso.isEmpty()){
sessao.setAttribute("colecaoSolicitacaoAcesso", colecaoSolicitacaoAcesso);
sessao.setAttribute("totalSolicitacoes", colecaoSolicitacaoAcesso.size());
}else{
sessao.removeAttribute("colecaoSolicitacaoAcesso");
sessao.removeAttribute("totalSolicitacoes");
throw new ActionServletException("atencao.pesquisa.nenhumresultado");
}
}else{
//remove a lista de solicitação de acesso para que a nova pesquisa seja exibida
//sessao.removeAttribute("colecaoSolicitacaoAcesso");
}
//verifica se o codigo do usuário foi digitado
String idDigitadoEnterUsuario = (String) form.getCodigoUsuario();
if (idDigitadoEnterUsuario != null
&& !idDigitadoEnterUsuario.trim().equals("")
) {
FiltroUsuario filtroUsuario = new FiltroUsuario();
filtroUsuario.adicionarParametro(new ParametroSimples(
FiltroUsuario.LOGIN, idDigitadoEnterUsuario));
Collection usuarioEncontrado = fachada.pesquisar(filtroUsuario,
Usuario.class.getName());
if (usuarioEncontrado != null && !usuarioEncontrado.isEmpty()) {
form.setCodigoUsuario(((Usuario) ((List) usuarioEncontrado)
.get(0)).getLogin().toString());
form.setNomeUsuario(((Usuario) ((List) usuarioEncontrado)
.get(0)).getNomeUsuario());
form.setUsuarioOK("true");
} else {
httpServletRequest.setAttribute("corUsuario","exception");
form.setNomeUsuario(ConstantesSistema.USUARIO_INEXISTENTE);
form.setCodigoUsuario("");
form.setUsuarioOK("false");
}
}
//verifica se o codigo do novo usuário foi digitado foi digitado
String idDigitadoEnterUsuarioNovo = (String) form.getCodigoNovoUsuario();
if (idDigitadoEnterUsuarioNovo != null
&& !idDigitadoEnterUsuarioNovo.trim().equals("")) {
FiltroUsuario filtroUsuario = new FiltroUsuario();
filtroUsuario.adicionarParametro(new ParametroSimples(
FiltroUsuario.LOGIN, idDigitadoEnterUsuarioNovo));
Collection usuarioEncontrado = fachada.pesquisar(filtroUsuario,
Usuario.class.getName());
if (usuarioEncontrado != null && !usuarioEncontrado.isEmpty()) {
form.setCodigoNovoUsuario(((Usuario) ((List) usuarioEncontrado)
.get(0)).getLogin().toString());
form.setNomeNovoUsuario(((Usuario) ((List) usuarioEncontrado)
.get(0)).getNomeUsuario());
form.setNovoUsuarioOK("true");
} else {
httpServletRequest.setAttribute("corUsuarioNovo","exception");
form.setNomeNovoUsuario(ConstantesSistema.USUARIO_INEXISTENTE);
form.setCodigoNovoUsuario("");
form.setNovoUsuarioOK("false");
}
}
FiltroSolicitacaoAcessoSituacao filtro = new FiltroSolicitacaoAcessoSituacao();
filtro.adicionarParametro(new ParametroSimples(FiltroSolicitacaoAcessoSituacao.INDICADOR_USO, ConstantesSistema.SIM));
Collection<?> colecaoSolicitacaoAcessoSituacao = this.getFachada().pesquisar(filtro,
SolicitacaoAcessoSituacao.class.getName());
sessao.setAttribute("colecaoSolicitacaoAcessoSituacao", colecaoSolicitacaoAcessoSituacao);
return retorno;
}
}
| [
"felipesantos2089@gmail.com"
] | felipesantos2089@gmail.com |
120a814bf0c47482c4e6403a31e9d553c033050d | 485b38e694463520229ad3be20cddf383dbde06b | /MorrisGame/src/BoardPosition.java | d855baaac66f898a569bc6aadc2d6f6a7b692935 | [] | no_license | jasonleakey/AI | 691c13a3fc50c51b3eccb29600845f03a5efad36 | fb9badb67281463e3c13dfef47348fda6fc3d27c | refs/heads/master | 2021-03-12T23:18:52.738351 | 2014-04-11T15:51:59 | 2014-04-11T15:51:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,392 | java | import java.util.Arrays;
import java.util.List;
/**
* Author: Jason Huang
*/
// Present a Morris Board.
public class BoardPosition {
char[] mBoard = new char[BOARD_SIZE];
// 23 pieces.
// a0, d0, g0, b1, d1, f1, c2, e2, a3, b3, c3, e3, f3, g3, c4, d4, e4, b5, d5, f5, a6, d6, g6
public static final int BOARD_SIZE = 23;
public BoardPosition(char[] b) throws IllegalArgumentException {
validateBoard(b);
for (int i = 0; i < BOARD_SIZE; i++) {
this.mBoard[i] = b[i];
}
}
public BoardPosition(String b) throws IllegalArgumentException {
validateBoard(b.toCharArray());
for (int i = 0; i < BOARD_SIZE; i++) {
this.mBoard[i] = b.charAt(i);
}
}
public BoardPosition(BoardPosition b) {
validateBoard(b.mBoard);
for (int i = 0; i < BOARD_SIZE; i++) {
this.mBoard[i] = b.mBoard[i];
}
}
private void validateBoard(char[] b) {
if (null == b || b.length != BOARD_SIZE) {
throw new IllegalArgumentException("The board length should be 23!");
}
for (int i = 0; i < BOARD_SIZE; i++) {
char c = b[i];
if (c != 'x' && c != 'W' && c != 'B') {
throw new IllegalArgumentException("The board has invalid letters: " + c);
}
}
}
public BoardPosition swap() {
BoardPosition bCopy = new BoardPosition(this);
for (int i = 0; i < BOARD_SIZE; i++) {
char c = bCopy.mBoard[i];
if ('W' == c) {
bCopy.mBoard[i] = 'B';
} else if ('B' == c) {
bCopy.mBoard[i] = 'W';
}
}
return bCopy;
}
public int getNumWhitePieces() {
int count = 0;
for (int i = 0; i < BOARD_SIZE; i++) {
char c = mBoard[i];
if ('W' == c) {
count++;
}
}
return count;
}
public int getNumBlackPieces() {
int count = 0;
for (int i = 0; i < BOARD_SIZE; i++) {
char c = mBoard[i];
if ('B' == c) {
count++;
}
}
return count;
}
public int getNumWhiteMills() {
int count = 0;
count += ((isWhite(0) && mill(0, 1, 2)) ? 1 : 0);
count += ((isWhite(3) && mill(3, 4, 5)) ? 1 : 0);
count += ((isWhite(8) && mill(8, 9, 10)) ? 1 : 0);
count += ((isWhite(11) && mill(11, 12, 13)) ? 1 : 0);
count += ((isWhite(14) && mill(14, 15, 16)) ? 1 : 0);
count += ((isWhite(17) && mill(17, 18, 19)) ? 1 : 0);
count += ((isWhite(20) && mill(20, 21, 22)) ? 1 : 0);
count += ((isWhite(0) && mill(0, 8, 20)) ? 1 : 0);
count += ((isWhite(3) && mill(3, 9, 17)) ? 1 : 0);
count += ((isWhite(6) && mill(6, 10, 14)) ? 1 : 0);
count += ((isWhite(15) && mill(15, 18, 21)) ? 1 : 0);
count += ((isWhite(7) && mill(7, 11, 16)) ? 1 : 0);
count += ((isWhite(5) && mill(5, 12, 19)) ? 1 : 0);
count += ((isWhite(2) && mill(2, 13, 22)) ? 1 : 0);
count += ((isWhite(0) && mill(0, 3, 6)) ? 1 : 0);
count += ((isWhite(2) && mill(2, 5, 7)) ? 1 : 0);
count += ((isWhite(14) && mill(14, 17, 20)) ? 1 : 0);
count += ((isWhite(16) && mill(16, 19, 22)) ? 1 : 0);
return count;
}
public int getNumBlackMills() {
int count = 0;
count += ((isBlack(0) && mill(0, 1, 2)) ? 1 : 0);
count += ((isBlack(3) && mill(3, 4, 5)) ? 1 : 0);
count += ((isBlack(8) && mill(8, 9, 10)) ? 1 : 0);
count += ((isBlack(11) && mill(11, 12, 13)) ? 1 : 0);
count += ((isBlack(14) && mill(14, 15, 16)) ? 1 : 0);
count += ((isBlack(17) && mill(17, 18, 19)) ? 1 : 0);
count += ((isBlack(20) && mill(20, 21, 22)) ? 1 : 0);
count += ((isBlack(0) && mill(0, 8, 20)) ? 1 : 0);
count += ((isBlack(3) && mill(3, 9, 17)) ? 1 : 0);
count += ((isBlack(6) && mill(6, 10, 14)) ? 1 : 0);
count += ((isBlack(15) && mill(15, 18, 21)) ? 1 : 0);
count += ((isBlack(7) && mill(7, 11, 16)) ? 1 : 0);
count += ((isBlack(5) && mill(5, 12, 19)) ? 1 : 0);
count += ((isBlack(2) && mill(2, 13, 22)) ? 1 : 0);
count += ((isBlack(0) && mill(0, 3, 6)) ? 1 : 0);
count += ((isBlack(2) && mill(2, 5, 7)) ? 1 : 0);
count += ((isBlack(14) && mill(14, 17, 20)) ? 1 : 0);
count += ((isBlack(16) && mill(16, 19, 22)) ? 1 : 0);
return count;
}
public boolean isEmpty(int j) {
return (mBoard[j] == 'x');
}
public boolean isWhite(int j) {
return (mBoard[j] == 'W');
}
public boolean isBlack(int j) {
return (mBoard[j] == 'B');
}
public char get(int j) {
return mBoard[j];
}
public void setWhiteAt(int j) {
mBoard[j] = 'W';
}
public void setBlackAt(int j) {
mBoard[j] = 'B';
}
public void setEmptyAt(int j) {
mBoard[j] = 'x';
}
public void disp() {
System.out.println(mBoard[20] + "-----" + mBoard[21] + "-----" + mBoard[22]);
System.out.println("|\\ | /|");
System.out.println("| " + mBoard[17] + "---" + mBoard[18] + "---" + mBoard[19] + " |");
System.out.println("| |\\ | /| |");
System.out.println("| | " + mBoard[14] + "-" + mBoard[15] + "-" + mBoard[16] + " | |");
System.out.println("| | | | | |");
System.out.println(mBoard[8] + "-" + mBoard[9] + "-" + mBoard[10] + " " + mBoard[11] + "-"
+ mBoard[12] + "-" + mBoard[13]);
System.out.println("| | | | | |");
System.out.println("| | " + mBoard[6] + "---" + mBoard[7] + " | |");
System.out.println("| |/ \\| |");
System.out.println("| " + mBoard[3] + "---" + mBoard[4] + "---" + mBoard[5] + " |");
System.out.println("|/ | \\|");
System.out.println(mBoard[0] + "-----" + mBoard[1] + "-----" + mBoard[2]);
}
@Override
public String toString() {
return String.valueOf(mBoard);
}
public static List<Integer> neighbors(int j) throws IllegalArgumentException {
switch (j) {
case 0:
return Arrays.asList(1, 3, 8);
case 1:
return Arrays.asList(0, 2, 4);
case 2:
return Arrays.asList(1, 5, 13);
case 3:
return Arrays.asList(0, 4, 6, 9);
case 4:
return Arrays.asList(1, 3, 5);
case 5:
return Arrays.asList(2, 4, 7, 12);
case 6:
return Arrays.asList(3, 7, 10);
case 7:
return Arrays.asList(5, 6, 11);
case 8:
return Arrays.asList(0, 9, 20);
case 9:
return Arrays.asList(3, 8, 10, 17);
case 10:
return Arrays.asList(6, 9, 14);
case 11:
return Arrays.asList(7, 12, 16);
case 12:
return Arrays.asList(5, 11, 13, 19);
case 13:
return Arrays.asList(2, 12, 22);
case 14:
return Arrays.asList(10, 15, 17);
case 15:
return Arrays.asList(14, 16, 18);
case 16:
return Arrays.asList(11, 15, 19);
case 17:
return Arrays.asList(9, 14, 18, 20);
case 18:
return Arrays.asList(15, 17, 19, 21);
case 19:
return Arrays.asList(12, 16, 18, 22);
case 20:
return Arrays.asList(8, 17, 21);
case 21:
return Arrays.asList(18, 20, 22);
case 22:
return Arrays.asList(13, 19, 21);
default:
throw new IllegalArgumentException("Invalid location: " + j);
}
}
public boolean closeMill(int j) {
if (isEmpty(j)) {
throw new IllegalArgumentException("The mill cannot have x");
}
switch (j) {
case 0:
return (mill(j, 1, 2) || mill(j, 3, 6) || mill(j, 8, 20));
case 1:
return (mill(j, 0, 2));
case 2:
return (mill(j, 0, 1) || mill(j, 5, 7) || mill(j, 13, 22));
case 3:
return (mill(j, 0, 6) || mill(j, 4, 5) || mill(j, 9, 17));
case 4:
return (mill(j, 3, 5));
case 5:
return (mill(j, 2, 7) || mill(j, 3, 4) || mill(j, 12, 19));
case 6:
return (mill(j, 0, 3) || mill(j, 10, 14));
case 7:
return (mill(j, 2, 5) || mill(j, 11, 16));
case 8:
return (mill(j, 0, 20) || mill(j, 9, 10));
case 9:
return (mill(j, 3, 17) || mill(j, 8, 10));
case 10:
return (mill(j, 6, 14) || mill(j, 8, 9));
case 11:
return (mill(j, 12, 13) || mill(j, 7, 16));
case 12:
return (mill(j, 5, 19) || mill(j, 11, 13));
case 13:
return (mill(j, 2, 22) || mill(j, 11, 12));
case 14:
return (mill(j, 6, 10) || mill(j, 15, 16) || mill(j, 17, 20));
case 15:
return (mill(j, 14, 16) || mill(j, 18, 21));
case 16:
return (mill(j, 14, 15) || mill(j, 7, 11) || mill(j, 19, 22));
case 17:
return (mill(j, 3, 9) || mill(j, 18, 19) || mill(j, 14, 20));
case 18:
return (mill(j, 15, 21) || mill(j, 17, 19));
case 19:
return (mill(j, 5, 12) || mill(j, 17, 18) || mill(j, 16, 22));
case 20:
return (mill(j, 0, 8) || mill(j, 14, 17) || mill(j, 21, 22));
case 21:
return (mill(j, 15, 18) || mill(j, 20, 22));
case 22:
return (mill(j, 2, 13) || mill(j, 20, 21) || mill(j, 16, 19));
default:
throw new IllegalArgumentException("Invalid location: " + j);
}
}
private boolean mill(int i, int j, int k) {
return mBoard[i] == mBoard[j] && mBoard[i] == mBoard[k];
}
}
| [
"jasonleakey@uKi.(none)"
] | jasonleakey@uKi.(none) |
4d14285538870ac6f7c3070b35ac3a0560a08e80 | a24037f1f1de486243a78f53daa93ea1f4e443fc | /OOP Assignment/Assignment03/src/com/techlabs/reflection/GetterAndSetter.java | 60a52a8bd6744430cf99c0a6269c168fe771451e | [] | no_license | prasadsim/swabhav | 137a6f9f05dea9824cb80f0d419dcadca81aecfb | 4f8514783c0249bb849514f308668dc8f4051bb7 | refs/heads/master | 2023-05-10T14:38:35.271930 | 2020-11-23T16:18:19 | 2020-11-23T16:18:19 | 234,708,167 | 0 | 1 | null | 2023-05-07T19:09:02 | 2020-01-18T09:03:27 | Java | UTF-8 | Java | false | false | 1,841 | java | package com.techlabs.reflection;
import java.lang.reflect.Method;
public class GetterAndSetter {
public static void main(String[] args) {
Class<?> reflectionClassForSystem = System.class;
Class<?> reflectionClassForString = String.class;
Class<?> reflectionClassForObject = Object.class;
int getSystem = 0, setSystem = 0, getString = 0, setString = 0, getObject = 0, setObject = 0;
String classNameForSystem = reflectionClassForSystem.getName();
System.out.println("Name of class is : " + classNameForSystem);
String classNameForString = reflectionClassForString.getName();
System.out.println("Name of class is : " + classNameForString);
String classNameForObject = reflectionClassForObject.getName();
System.out.println("Name of class is : " + classNameForObject);
Method[] classMethodsForSystem = reflectionClassForSystem.getMethods();
for (Method a : classMethodsForSystem) {
if (a.getName().startsWith("get")) {
getSystem++;
} else if (a.getName().startsWith("set")) {
setSystem++;
}
}
Method[] classMethodsForString = reflectionClassForString.getMethods();
for (Method a : classMethodsForString) {
if (a.getName().startsWith("get")) {
getString++;
} else if (a.getName().startsWith("set")) {
setString++;
}
}
Method[] classMethodsForObject = reflectionClassForObject.getMethods();
for (Method a : classMethodsForObject) {
if (a.getName().startsWith("get")) {
getObject++;
} else if (a.getName().startsWith("set")) {
setObject++;
}
}
System.out.println("System Class \tList of Methods are get:" + getSystem + "\tset:" + setSystem);
System.out.println("String Class \tList of Methods are get:" + getString + "\tset:" + setString);
System.out.println("Object Class \tList of Methods are get:" + getObject + "\tset:" + setObject);
}
}
| [
"prasadsim075@gmail.com"
] | prasadsim075@gmail.com |
bd270abe316da48bdf6f3fefdc187517dab7907a | 8775c40da47dd19d623d1ddaf39e6cbe43b9911d | /src/main/java/chapter03/aio/demo/TimeClient.java | 41e558f8516ca6f356b53d35f5872c3ff9f1c662 | [] | no_license | liu-wh-boring/J2SE-IO | fb573624fe0a60e354d21424e40ed38240b181f7 | 02b9ce099bdf7c2205499c088ebde5435496808c | refs/heads/master | 2022-07-26T19:12:31.786018 | 2019-09-04T07:22:56 | 2019-09-04T07:22:56 | 206,245,734 | 1 | 0 | null | 2022-06-29T15:58:49 | 2019-09-04T06:16:55 | Java | UTF-8 | Java | false | false | 473 | java | package chapter03.aio.demo;
public class TimeClient {
public static void main(String[] args) {
int port = 8080;
//通过一个独立的I/O线程创建异步时间服务器客户端handler,
//在实际项目中,我们不需要独立的线程创建异步连接对象,因为底层都是通过JDK的系统回调实现的.
new Thread(new AsyncTimeClientHandler("127.0.0.1", port), "AIO-AsyncTimeClientHandler-001").start();
}
}
| [
"liukuixfan@163.com"
] | liukuixfan@163.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.