blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6e87bdc7dfbf8e2596535fbefd180285ee7e15b6 | b21a2f3ff7e3f037022a0fd4812468a5554664f3 | /AuctionHouse/src/ui/Main.java | dc8ca27b602cd70e15f6ba7757a3149079a3176a | [] | no_license | JimmyCN1/UBCx-Software-Construction-2-Week9PracticeProblems | 2f660e3f918f1590cbabb8d477c121329fe76015 | 3b6fc3658d63cfb6cbcc9e97eb16282a82d1299e | refs/heads/master | 2020-05-31T06:13:06.100755 | 2019-06-04T10:44:18 | 2019-06-04T10:44:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,827 | java | package ui;
import model.AuctionHouse;
import model.Auctioneer;
import model.Bidder;
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
// private static Scanner userInput = new Scanner(System.in);
// private static AuctionHouse auctionHouse;
// private static Auctioneer auctioneer;
// private static Bidder b1, b2, b3, b4, b5, b6;
// private static ArrayList<Bidder> bidders;
public static void main(String[] args) {
new AuctionHouse();
// AuctionHouse auctionHouse = new AuctionHouse();
// boolean itemSold = false;
// String userResponse = "";
// auctionHouse.populateAuctionHouse();
// System.out.print("Bidding starts at $1.00, enter your initial bid: ");
// auctioneer.acceptBid(userInput.nextDouble());
// displayHighestBid();
//
// while (!itemSold) {
// System.out.println("\nWould you like to bid again? (y/n): ");
// userResponse = userInput.next();
//
// if (userResponse.equalsIgnoreCase("y")) {
// System.out.print("Enter your new bid: ");
// auctioneer.acceptBid(userInput.nextDouble());
// displayHighestBid();
// } else {
// System.out.println("Item has been sold at: $" + gethighestBid());
// itemSold = true;
// }
// }
}
// private static void populateAuctionHouse() {
// auctioneer = new Auctioneer("John Smith");
// b1 = new Bidder("Anthony Estey", 100.00);
// b2 = new Bidder("Ian Cavers", 55.00);
// b3 = new Bidder("Elisa Baniassad", 65.00);
// b4 = new Bidder("James Yoo", 5.00);
// b5 = new Bidder("Amy Zhu", 5.50);
// b6 = new Bidder("James Xiao", 8.49);
// auctioneer.addObserver(b1);
// auctioneer.addObserver(b2);
// auctioneer.addObserver(b3);
// auctioneer.addObserver(b4);
// auctioneer.addObserver(b5);
// auctioneer.addObserver(b6);
// addBiddersToList();
// }
// private static void addBiddersToList() {
// bidders = new ArrayList<>();
// bidders.add(b1);
// bidders.add(b2);
// bidders.add(b3);
// bidders.add(b4);
// bidders.add(b5);
// bidders.add(b6);
// }
// private static void displayHighestBid() {
// System.out.println("The current highest bid is at: " + gethighestBid());
// }
//
// private static double gethighestBid() {
// double max = 0.0;
// for (Bidder b : bidders) {
// if (max < b.getPersonalBid()) {
// max = b.getPersonalBid();
// }
// }
// if (max == 0) {
// return auctioneer.getCurrentBid();
// } else {
// return max;
// }
// }
} | [
"[email protected]"
] | |
26637ad961cc19d691562a0d510c9a65db34e85e | c69f0d9395d0758b9229c8f7d7f908c570ad0c07 | /SeleniumAutomation1/src/test/java/com/javabasics/BucleStatement.java | 0c33ec408170db505031053e272cd95c1b2d4775 | [] | no_license | ThonnyMo/web-selenium-cursoselenium | 3791d933fe6860f50d6c1247247158ca53ece6eb | 0d5a38944b6c362a7c2eef18d67fae3ab7b6114d | refs/heads/master | 2023-07-11T18:25:40.789500 | 2021-08-12T04:38:59 | 2021-08-12T04:38:59 | 395,089,871 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 838 | java | package com.javabasics;
public class BucleStatement {
public static void main(String[] args) {
// TODO Auto-generated method stub
// WHILE
// int numero = 1;
//
// while(numero<10) {
// System.out.println("el número es: " + numero);
// ++numero;
// System.out.println("Valor actual numero es: " + numero);
// }
// DO WHILE
// int num = 10;
// int count = 0;
// int suma = 0;
//
// do {
//
// suma = suma + (num+num);
// System.out.println("La suma hasta el momento es: " + suma);
// ++count;
//
// }while(suma<100);
// System.out.println("El número se sumó: " + count + " veces");
//
// FOR
int numero = 10;
for (int i=0; i <= numero; i++) {
System.out.println("numero: " + i);
}
}
}
| [
"[email protected]"
] | |
a4859626aaf66696aa8bf6fce6ce82c7051a02cc | f89a5fce7dd5cd5702e3b4c09c2aa8dd3c0b84d1 | /src/com/jc/ext/DelCookie.java | 78717179424028f05dd7157c34688a1f4267542d | [] | no_license | care001/cswechat | 5726a2b37163d12946adeed87d708aff43836bb2 | 1c32098a42a5f7cd1c23392147c24a49cfe9b8d5 | refs/heads/master | 2021-01-12T23:34:27.342803 | 2017-01-16T01:21:25 | 2017-01-16T01:21:25 | 60,591,491 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,382 | java | package com.jc.ext;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.json.JSONObject;
import com.jc.util.CookieUtil;
/**
*
* @author qianjia
* 2016.6.5
*/
@WebServlet("/DelCookie.ext")
public class DelCookie extends HttpServlet{
private static final long serialVersionUID = -3692170308778424641L;
private static Logger logger = Logger.getLogger(DelCookie.class);
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
Cookie[] cookies = req.getCookies();
JSONObject result = new JSONObject();
try {
if(cookies!=null){
for(int i=0;i<cookies.length;i++){
if(cookies[i].getName().equals(CookieUtil.LOGINCOOK)){
Cookie cookie = new Cookie(CookieUtil.LOGINCOOK, null);
cookie.setMaxAge(0);
cookie.setPath("/");//根据你创建cookie的路径进行填写
resp.addCookie(cookie);
}
}
}
} catch (Exception e) {
logger.info("delete cookie:"+e);
}
PrintWriter out = resp.getWriter();
out.print(result.toString());
out.close();
}
} | [
"[email protected]"
] | |
a82ed12428c69d11a8e4f84991089d290b37ab4a | fd9ab07f319b8f56d8fd20d3cdb06a7ba9561c0b | /custom/src/main/java/com/github/sioncheng/sia/custom/PointBean.java | 9969931f58e212e5df5c2fb487cb359fef8adc32 | [] | no_license | sioncheng/springinaction | f9272bd311aca95538d777d4ab15b4c731699afb | e695ccea2313df7dfe6d656b595ef36a6b1f51e2 | refs/heads/master | 2021-01-23T02:10:43.391666 | 2018-10-14T10:48:47 | 2018-10-14T10:48:47 | 92,912,760 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,533 | java | package com.github.sioncheng.sia.custom;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.InitializingBean;
public class PointBean implements
BeanNameAware, BeanFactoryAware, InitializingBean {
public PointBean() {
}
public void setBeanName(String s) {
System.out.println("=============== set bean name " + s);
Util.printCallstack();
}
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
System.out.println("=============== set bean factory " + beanFactory);
Util.printCallstack();
}
public void init() {
System.out.println("=============== init");
Util.printCallstack();
}
public void destroy() {
System.out.println("=============== destroy");
Util.printCallstack();
}
public void afterPropertiesSet() {
System.out.println("=============== after properties set");
Util.printCallstack();
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
@Override
public String toString() {
return String.format("(%d,%d)", this.x, this.y);
}
private int x;
private int y;
}
| [
"[email protected]"
] | |
37370d495e5762fbfed5e7d5933fd2e70888d64e | df6503904e113d233751ca9a2b3cfa81f563a4b0 | /smemsb/smemsb-system/src/main/java/com/cunzhang/smemsb/modules/system/service/dto/DeptQueryCriteria.java | af7bf1212c185cce1a6c9e8d50e5afefba5eb35d | [
"Apache-2.0"
] | permissive | Wang-ErHu/smems | 8ae2ffe309c94116f095a1340ed5390d52d1358e | 0b10adc19894d45a22d257526c4de63a5bad7397 | refs/heads/master | 2022-07-11T13:03:36.632672 | 2019-10-08T17:00:57 | 2019-10-08T17:00:57 | 213,692,026 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 450 | java | package com.cunzhang.smemsb.modules.system.service.dto;
import com.cunzhang.smemsb.annotation.Query;
import lombok.Data;
import java.util.Set;
/**
* @author wtCunZhang
* @date 2019-03-25
*/
@Data
public class DeptQueryCriteria{
@Query(type = Query.Type.IN, propName="id")
private Set<Long> ids;
@Query(type = Query.Type.INNER_LIKE)
private String name;
@Query
private Boolean enabled;
@Query
private Long pid;
} | [
"[email protected]"
] | |
22f55c1c97197acc368fa42278117315e20bed7f | f7834f317db916e3fa510be9bc1b54e678b11f86 | /src/Obstacle.java | b344b53f38c2314b615670faa520788b7fef9bcc | [] | no_license | IsraelBanez/Project-MyWorld | 9cc89f777be0b0be26bd0cf5d8739a6c005ce80e | 50027d0ec371baf0f0752a442226a3b7d9d003b7 | refs/heads/master | 2023-02-26T09:14:05.673751 | 2020-06-10T19:55:56 | 2020-06-10T19:55:56 | 335,798,344 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 320 | java | import processing.core.PImage;
import java.util.List;
import java.util.Optional;
import java.util.Random;
public class Obstacle extends Entity
{
public Obstacle(
String id,
Point position,
List<PImage> images)
{
super(id, position, images, 0, "obstacle");
}
}
| [
"[email protected]"
] | |
559def33d1094981d75dc43fa0c17402c85084c6 | ec99a18bd9bcacccd364b02100ae1dfdb742e0a6 | /app/build/generated/source/apt/debug/com/hsdi/NetMe/ui/startup/LoginActivity$$ViewBinder.java | 61bf9965f5dd8cd7ece6b0638b9185ed5ed91b5a | [
"MIT"
] | permissive | huohong01/truck | 591784163060e8be570790b5dbe49d804258b71b | c9d1df9b07542b64b34f2748d42f5c69dc2fd3d0 | refs/heads/master | 2021-06-29T05:49:57.770165 | 2017-09-20T15:51:00 | 2017-09-20T15:51:00 | 104,228,220 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,222 | java | // Generated code from Butter Knife. Do not modify!
package com.hsdi.NetMe.ui.startup;
import android.view.View;
import butterknife.ButterKnife.Finder;
import butterknife.ButterKnife.ViewBinder;
public class LoginActivity$$ViewBinder<T extends com.hsdi.NetMe.ui.startup.LoginActivity> implements ViewBinder<T> {
@Override public void bind(final Finder finder, final T target, Object source) {
View view;
view = finder.findRequiredView(source, 2131689709, "field 'usernameTV'");
target.usernameTV = finder.castView(view, 2131689709, "field 'usernameTV'");
view = finder.findRequiredView(source, 2131689713, "field 'passwordET'");
target.passwordET = finder.castView(view, 2131689713, "field 'passwordET'");
view = finder.findRequiredView(source, 2131689715, "field 'rememberMe'");
target.rememberMe = finder.castView(view, 2131689715, "field 'rememberMe'");
view = finder.findRequiredView(source, 2131689710, "field 'loginClear'");
target.loginClear = finder.castView(view, 2131689710, "field 'loginClear'");
}
@Override public void unbind(T target) {
target.usernameTV = null;
target.passwordET = null;
target.rememberMe = null;
target.loginClear = null;
}
}
| [
"[email protected]"
] | |
986cd4493c47cf4949c411d2fc2ec03071b64c50 | b49270ca21889bfa16e0c16f9222933284d9a993 | /login/src/main/java/com/abhee/login/repository/RoleRepository.java | 0f0a2cfabcb0a2b6a5cb111b45b3492eeaa5e9c4 | [] | no_license | abhee2010/Spring-Project | e1a10f92cc22a00c5b4a2249a47c5001d444ab1e | 2658ca2dd5bce6e913008a0d666c89864af19ab4 | refs/heads/master | 2020-04-30T22:04:15.939896 | 2019-04-24T09:57:42 | 2019-04-24T09:57:42 | 177,109,337 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 325 | java | package com.abhee.login.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.abhee.login.model.Role;
@Repository("roleRepository")
public interface RoleRepository extends JpaRepository<Role, Integer> {
Role findByRole(String role);
}
| [
"[email protected]"
] | |
a6463bc352b7b355ed6c506e9f98b1d85a55d8b7 | fc4e0c9d846bddb5768fde39ee07284a668a1e75 | /0894_AllPossibleFullBinaryTree/Solution.java | c6d5fec45366575a36cd71820ac3ce7a57ac4492 | [] | no_license | chialin-liu/Leetcode | d9f9ce94ac8cc3bdb71145d9fc59d7c2311e4ef7 | bf5ee75fe266353ce574d8aa38973f325b239079 | refs/heads/master | 2020-06-19T09:48:08.036214 | 2020-03-14T09:55:00 | 2020-03-14T09:55:00 | 196,667,938 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 953 | java | /**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
class Solution {
public List<TreeNode> allPossibleFBT(int N) {
List<TreeNode> res = new ArrayList<>();
if(N % 2 == 0){
return new ArrayList<TreeNode>();
}
if(N == 1){
TreeNode newNode = new TreeNode(0);
res.add(newNode);
return res;
}
for(int i = 1; i < N; i++){
List<TreeNode> left = allPossibleFBT(i);
List<TreeNode> right = allPossibleFBT(N - 1 - i);
for(TreeNode l: left){
for(TreeNode r: right){
TreeNode cur = new TreeNode(0);
cur.left = l;
cur.right = r;
res.add(cur);
}
}
}
return res;
}
}
| [
"[email protected]"
] | |
ac13698950dadac9daf26679110a8b86fd6291a5 | 722f7058f5e94da02dd08546c227f63a4c47d594 | /src/main/java/com/hb/remi/myapp/web/rest/errors/ExceptionTranslator.java | 2b6947b1d4f9eff101156b9f7ea96a0c89e450f9 | [] | no_license | raudibertHB/remia-hb-kanban | 2334bd8d334f5ad95131b66078e936912de469c7 | 74439cd3b1c053429743967a7f14f7aa6208ee2a | refs/heads/main | 2023-06-15T04:54:46.569714 | 2021-07-09T14:45:12 | 2021-07-09T14:45:12 | 384,438,259 | 0 | 0 | null | 2021-07-09T14:45:13 | 2021-07-09T13:00:35 | Java | UTF-8 | Java | false | false | 9,578 | java | package com.hb.remi.myapp.web.rest.errors;
import java.net.URI;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.dao.ConcurrencyFailureException;
import org.springframework.dao.DataAccessException;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.HttpMessageConversionException;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.context.request.NativeWebRequest;
import org.zalando.problem.DefaultProblem;
import org.zalando.problem.Problem;
import org.zalando.problem.ProblemBuilder;
import org.zalando.problem.Status;
import org.zalando.problem.StatusType;
import org.zalando.problem.spring.web.advice.ProblemHandling;
import org.zalando.problem.spring.web.advice.security.SecurityAdviceTrait;
import org.zalando.problem.violations.ConstraintViolationProblem;
import tech.jhipster.config.JHipsterConstants;
import tech.jhipster.web.util.HeaderUtil;
/**
* Controller advice to translate the server side exceptions to client-friendly json structures.
* The error response follows RFC7807 - Problem Details for HTTP APIs (https://tools.ietf.org/html/rfc7807).
*/
@ControllerAdvice
public class ExceptionTranslator implements ProblemHandling, SecurityAdviceTrait {
private static final String FIELD_ERRORS_KEY = "fieldErrors";
private static final String MESSAGE_KEY = "message";
private static final String PATH_KEY = "path";
private static final String VIOLATIONS_KEY = "violations";
@Value("${jhipster.clientApp.name}")
private String applicationName;
private final Environment env;
public ExceptionTranslator(Environment env) {
this.env = env;
}
/**
* Post-process the Problem payload to add the message key for the front-end if needed.
*/
@Override
public ResponseEntity<Problem> process(@Nullable ResponseEntity<Problem> entity, NativeWebRequest request) {
if (entity == null) {
return null;
}
Problem problem = entity.getBody();
if (!(problem instanceof ConstraintViolationProblem || problem instanceof DefaultProblem)) {
return entity;
}
HttpServletRequest nativeRequest = request.getNativeRequest(HttpServletRequest.class);
String requestUri = nativeRequest != null ? nativeRequest.getRequestURI() : StringUtils.EMPTY;
ProblemBuilder builder = Problem
.builder()
.withType(Problem.DEFAULT_TYPE.equals(problem.getType()) ? ErrorConstants.DEFAULT_TYPE : problem.getType())
.withStatus(problem.getStatus())
.withTitle(problem.getTitle())
.with(PATH_KEY, requestUri);
if (problem instanceof ConstraintViolationProblem) {
builder
.with(VIOLATIONS_KEY, ((ConstraintViolationProblem) problem).getViolations())
.with(MESSAGE_KEY, ErrorConstants.ERR_VALIDATION);
} else {
builder.withCause(((DefaultProblem) problem).getCause()).withDetail(problem.getDetail()).withInstance(problem.getInstance());
problem.getParameters().forEach(builder::with);
if (!problem.getParameters().containsKey(MESSAGE_KEY) && problem.getStatus() != null) {
builder.with(MESSAGE_KEY, "error.http." + problem.getStatus().getStatusCode());
}
}
return new ResponseEntity<>(builder.build(), entity.getHeaders(), entity.getStatusCode());
}
@Override
public ResponseEntity<Problem> handleMethodArgumentNotValid(MethodArgumentNotValidException ex, @Nonnull NativeWebRequest request) {
BindingResult result = ex.getBindingResult();
List<FieldErrorVM> fieldErrors = result
.getFieldErrors()
.stream()
.map(
f ->
new FieldErrorVM(
f.getObjectName().replaceFirst("DTO$", ""),
f.getField(),
StringUtils.isNotBlank(f.getDefaultMessage()) ? f.getDefaultMessage() : f.getCode()
)
)
.collect(Collectors.toList());
Problem problem = Problem
.builder()
.withType(ErrorConstants.CONSTRAINT_VIOLATION_TYPE)
.withTitle("Method argument not valid")
.withStatus(defaultConstraintViolationStatus())
.with(MESSAGE_KEY, ErrorConstants.ERR_VALIDATION)
.with(FIELD_ERRORS_KEY, fieldErrors)
.build();
return create(ex, problem, request);
}
@ExceptionHandler
public ResponseEntity<Problem> handleEmailAlreadyUsedException(
com.hb.remi.myapp.service.EmailAlreadyUsedException ex,
NativeWebRequest request
) {
EmailAlreadyUsedException problem = new EmailAlreadyUsedException();
return create(
problem,
request,
HeaderUtil.createFailureAlert(applicationName, true, problem.getEntityName(), problem.getErrorKey(), problem.getMessage())
);
}
@ExceptionHandler
public ResponseEntity<Problem> handleUsernameAlreadyUsedException(
com.hb.remi.myapp.service.UsernameAlreadyUsedException ex,
NativeWebRequest request
) {
LoginAlreadyUsedException problem = new LoginAlreadyUsedException();
return create(
problem,
request,
HeaderUtil.createFailureAlert(applicationName, true, problem.getEntityName(), problem.getErrorKey(), problem.getMessage())
);
}
@ExceptionHandler
public ResponseEntity<Problem> handleInvalidPasswordException(
com.hb.remi.myapp.service.InvalidPasswordException ex,
NativeWebRequest request
) {
return create(new InvalidPasswordException(), request);
}
@ExceptionHandler
public ResponseEntity<Problem> handleBadRequestAlertException(BadRequestAlertException ex, NativeWebRequest request) {
return create(
ex,
request,
HeaderUtil.createFailureAlert(applicationName, true, ex.getEntityName(), ex.getErrorKey(), ex.getMessage())
);
}
@ExceptionHandler
public ResponseEntity<Problem> handleConcurrencyFailure(ConcurrencyFailureException ex, NativeWebRequest request) {
Problem problem = Problem.builder().withStatus(Status.CONFLICT).with(MESSAGE_KEY, ErrorConstants.ERR_CONCURRENCY_FAILURE).build();
return create(ex, problem, request);
}
@Override
public ProblemBuilder prepare(final Throwable throwable, final StatusType status, final URI type) {
Collection<String> activeProfiles = Arrays.asList(env.getActiveProfiles());
if (activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_PRODUCTION)) {
if (throwable instanceof HttpMessageConversionException) {
return Problem
.builder()
.withType(type)
.withTitle(status.getReasonPhrase())
.withStatus(status)
.withDetail("Unable to convert http message")
.withCause(
Optional.ofNullable(throwable.getCause()).filter(cause -> isCausalChainsEnabled()).map(this::toProblem).orElse(null)
);
}
if (throwable instanceof DataAccessException) {
return Problem
.builder()
.withType(type)
.withTitle(status.getReasonPhrase())
.withStatus(status)
.withDetail("Failure during data access")
.withCause(
Optional.ofNullable(throwable.getCause()).filter(cause -> isCausalChainsEnabled()).map(this::toProblem).orElse(null)
);
}
if (containsPackageName(throwable.getMessage())) {
return Problem
.builder()
.withType(type)
.withTitle(status.getReasonPhrase())
.withStatus(status)
.withDetail("Unexpected runtime exception")
.withCause(
Optional.ofNullable(throwable.getCause()).filter(cause -> isCausalChainsEnabled()).map(this::toProblem).orElse(null)
);
}
}
return Problem
.builder()
.withType(type)
.withTitle(status.getReasonPhrase())
.withStatus(status)
.withDetail(throwable.getMessage())
.withCause(
Optional.ofNullable(throwable.getCause()).filter(cause -> isCausalChainsEnabled()).map(this::toProblem).orElse(null)
);
}
private boolean containsPackageName(String message) {
// This list is for sure not complete
return StringUtils.containsAny(message, "org.", "java.", "net.", "javax.", "com.", "io.", "de.", "com.hb.remi.myapp");
}
}
| [
"[email protected]"
] | |
27cca9445884cad5acdfc694afafaa10015077e0 | 2effb68ff07d4df1c0a240eb1a39d0c8b858054e | /app/src/androidTest/java/com/ferdidolot/geoquiz/ApplicationTest.java | c471796791007d626b7064995010dafde2a1ce48 | [] | no_license | ferdidolot/GeoQuiz | 44aec4280a66583e5c4da558d444d01632716c9b | a0cd81e2e261eee4a3e7a110faac6d511f429f52 | refs/heads/master | 2021-01-01T04:04:52.564374 | 2016-05-10T04:39:50 | 2016-05-10T04:39:50 | 58,430,149 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 353 | java | package com.ferdidolot.geoquiz;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"[email protected]"
] | |
522b173b9194e1962b565bdda0f06f3fba9ab1ce | 5ea57cabb94a9a14d7461100891eb8e15ddc303f | /src/server/twitter/ThoughtPhrase.java | c4bcb0d8a1d76b1f3fa0992970634a756f3c3a19 | [] | no_license | sdp-2011/sdp-10 | 0f8eac05ef53d95b7a8db470acf504fc10728ab6 | a9777d0c5b6b46c2b53c5fb9bf53718050b81e33 | refs/heads/master | 2020-05-04T15:37:45.718593 | 2011-05-17T18:06:49 | 2011-05-17T18:06:49 | 1,530,106 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 862 | java | package server.twitter;
import java.util.ArrayList;
import java.util.Random;
public class ThoughtPhrase extends Phrase {
private ArrayList<String> myPhrases = new ArrayList<String>();
/**
* Constructor that instantiates base phrases for this class.
* Phrases for missing the goal.
*/
public ThoughtPhrase() {
myPhrases.add("This will be evil! Check it: ");
myPhrases.add("No one can defeat me now: ");
myPhrases.add("I can't keep my thoughts to myself: ");
myPhrases.add("Best plan for world domination: ");
myPhrases.add("This will bring world domination: ");
myPhrases.add("I can't think of anything else: ");
myPhrases.add("The newest way to world domination: ");
}
public String getPhrase() {
Random randomIndex = new Random();
int myIndex = randomIndex.nextInt(myPhrases.size());
return myPhrases.get(myIndex);
}
}
| [
"[email protected]"
] | |
2f975c66579a55a1419da6afa80868caec14237b | d1e57113670d094c27299cb305ebd9e51b6fa4e6 | /src/main/java/com/example/persistence/hibernate/dao/HibernateDAOFactory.java | 235026e3d17b139de300078c95f8f38c5d0e7407 | [] | no_license | rajivj2/example2 | d76ee8b2c1c1abac786347fc7679f0c500003f98 | fbe1e242567b226a915c6dd6a2f6c10ecaeb5dfd | refs/heads/master | 2021-01-01T18:41:59.290477 | 2014-11-07T14:04:15 | 2014-11-07T14:04:15 | 23,829,465 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 570 | java | package com.example.persistence.hibernate.dao;
import com.example.persistence.dao.AccountDAO;
import com.example.persistence.dao.DAOFactory;
import com.example.persistence.dao.StatusDAO;
public class HibernateDAOFactory extends DAOFactory {
private StatusDAO statusDAO;
private AccountDAO accountDAO;
public HibernateDAOFactory(StatusDAO statusDAO, AccountDAO accountDAO) {
this.statusDAO = statusDAO;
this.accountDAO = accountDAO;
}
public StatusDAO getStatusDAO() {
return statusDAO;
}
public AccountDAO getAccountDAO() {
return accountDAO;
}
} | [
"[email protected]"
] | |
b3fa9e6a91f99b9b6953361a7705119603db2109 | 03ea675f2026c42dffe2c9f6940c886f2aefc0a2 | /src/main/java/com/jk/mapper/RoleMapper.java | a3fa786c3c471982370d7baf0598d6e3024616f4 | [] | no_license | guochunhao/good | 1a6a83643bb7668bcc37c0c5bab4cd6673a1b629 | fc971c5869a61106e0db51526c495c53b1c3a302 | refs/heads/master | 2021-01-01T18:35:24.025040 | 2017-06-29T15:22:54 | 2017-06-29T15:22:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 307 | java | package com.jk.mapper;
import com.jk.model.Role;
import com.jk.util.MyMapper;
/**
* Created by JK on 2017/2/8.
*/
public interface RoleMapper extends MyMapper<Role> {
/**
* 根据用户ID查询角色对象信息
* @param userId
* @return
*/
Role findByUserId(Long userId);
}
| [
"[email protected]"
] | |
d757a82b057d5d5a54f50e8399ed514e262473eb | c3bb807d1c1087254726c4cd249e05b8ed595aaa | /src/oc/wh40k/units/dk/DKSuperHeavyTankSquadron.java | b5e4d6458ea049f9f6d0325694dd9f2d560a3cc8 | [] | no_license | spacecooky/OnlineCodex30k | f550ddabcbe6beec18f02b3e53415ed5c774d92f | db6b38329b2046199f6bbe0f83a74ad72367bd8d | refs/heads/master | 2020-12-31T07:19:49.457242 | 2014-05-04T14:23:19 | 2014-05-04T14:23:19 | 55,958,944 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,120 | java | package oc.wh40k.units.dk;
import oc.Eintrag;
import oc.OptionsEinzelUpgrade;
import oc.RuestkammerStarter;
public class DKSuperHeavyTankSquadron extends Eintrag {
OptionsEinzelUpgrade oe1;
RuestkammerStarter t1;
RuestkammerStarter t2;
RuestkammerStarter t3;
public DKSuperHeavyTankSquadron() {
name = "Super Heavy Tank Squadron";
grundkosten = 0;
this.überschriftSetzen = true;
this.gesamtpunkteImmerAnzeigen=false;
add(ico = new oc.Picture("oc/wh40k/images/IGLemanRussSquadron.jpg"));
seperator();
t1 = new RuestkammerStarter(ID, randAbstand, cnt, "DKSuperHeavyTank", "Super Heavy Tank");
t1.initKammer();
t1.setButtonText("Super Heavy Tank 1");
add(t1);
seperator();
t2 = new RuestkammerStarter(ID, randAbstand, cnt, "DKSuperHeavyTank", "Super Heavy Tank");
t2.initKammer();
t2.setButtonText("Super Heavy Tank 2");
add(t2);
seperator();
t3 = new RuestkammerStarter(ID, randAbstand, cnt, "DKSuperHeavyTank", "Super Heavy Tank");
t3.initKammer();
t3.setButtonText("Super Heavy Tank 3");
add(t3);
complete();
}
@Override
public void refreshen() {
}
}
| [
"spacecooky@b551ab73-3a01-0010-9fae-47f737f7a8aa"
] | spacecooky@b551ab73-3a01-0010-9fae-47f737f7a8aa |
c885bd0330d34f32b09e420e98463833d4d542ff | 6d8f7387335177b135793d004b9eb23dea1fc331 | /src/main/java/com/sgic/trainer/entity/Payment.java | 743eb86eec94c27e8b26f41d5daa25ac1ef48fe8 | [] | no_license | jananthan93/TrainerPayment | 070f32d72756c32ae43e3b7521d924e2fbe2249a | cf5627bd9b8178be4170ed48984ec6f6b7e2d152 | refs/heads/master | 2020-04-20T06:58:13.665668 | 2019-02-06T06:57:24 | 2019-02-06T06:57:24 | 168,698,897 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,495 | java | package com.sgic.trainer.entity;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(schema = "payment", name = "payment")
public class Payment implements Serializable {
/**
*
*/
private static final long serialVersionUID = -3323930356795011743L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private Double amount;
private Date dateOfPayment;
private Integer invoiceNo;
@ManyToOne
@JoinColumn(name = "trainingSchedule_id")
private TrainingSchedule trainingSchedule;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Double getAmount() {
return amount;
}
public void setAmount(Double amount) {
this.amount = amount;
}
public Date getDateOfPayment() {
return dateOfPayment;
}
public void setDateOfPayment(Date dateOfPayment) {
this.dateOfPayment = dateOfPayment;
}
public Integer getInvoiceNo() {
return invoiceNo;
}
public void setInvoiceNo(Integer invoiceNo) {
this.invoiceNo = invoiceNo;
}
public TrainingSchedule getTrainingSchedule() {
return trainingSchedule;
}
public void setTrainingSchedule(TrainingSchedule trainingSchedule) {
this.trainingSchedule = trainingSchedule;
}
}
| [
"[email protected]"
] | |
781f1f9228bc12f69d2f7ac7d2a4b9622684bbdf | 243977865b0b321984e836d90a709d298fd49612 | /src/main/java/com/example/demo/infrastructure/repository/CustomJpaRepositoryImpl.java | fff050489cb9d059bda227bec89096eb865e415a | [] | no_license | AdilsonVicente/algafood-api | 3d3f80d2d0c13e6ada1f752be8d06c17bc5af3af | fe517b92f5d81e77f3bec66ee46c8c4b595854d5 | refs/heads/adilson | 2023-08-12T02:51:43.975627 | 2021-09-28T23:38:19 | 2021-09-28T23:38:19 | 410,109,743 | 0 | 0 | null | 2021-09-28T23:38:20 | 2021-09-24T21:46:15 | Java | UTF-8 | Java | false | false | 1,007 | java | package com.example.demo.infrastructure.repository;
import java.util.Optional;
import javax.persistence.EntityManager;
import org.springframework.data.jpa.repository.support.JpaEntityInformation;
import org.springframework.data.jpa.repository.support.SimpleJpaRepository;
import com.example.demo.domain.repository.CustomJpaRepository;
public class CustomJpaRepositoryImpl<T, ID> extends SimpleJpaRepository<T, ID>
implements CustomJpaRepository<T, ID> {
private EntityManager manager;
public CustomJpaRepositoryImpl(JpaEntityInformation<T, ?> entityInformation,
EntityManager entityManager) {
super(entityInformation, entityManager);
this.manager = entityManager;
}
@Override
public Optional<T> buscarPrimeiro() {
var jpql = "from " + getDomainClass().getName();
T entity = manager.createQuery(jpql, getDomainClass()).setMaxResults(1).getSingleResult();
return Optional.ofNullable(entity);
}
@Override
public void detach(T entity) {
manager.detach(entity);
}
}
| [
"[email protected]"
] | |
001ec08e761e40618a13c11e5fd27f2b66021363 | 03a2c330d5c7e528441ed117afa00623560810be | /src/uno/Uno.java | 8a1ead0f78f361f75de5c4dad71b700f0ce3b874 | [] | no_license | sin11368/Deliverable_3 | ae90827d605797e740ad5cf4947da82725b2368d | 1a78a16069a1009bf20d587de24820d9ea9cb577 | refs/heads/master | 2023-07-10T14:55:02.423085 | 2021-08-19T01:56:36 | 2021-08-19T01:56:36 | 397,754,548 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,989 | java | package uno;
/*
* 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.
*/
import java.util.ArrayList;
import java.util.Scanner;
/**
* @author Gurveer
*/
public class Uno {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter number of players:");
int n = scanner.nextInt();
//array player
ArrayList<Player> player = new ArrayList<>();
for (int j = 0; j < n; j++) {
System.out.println("\nEnter " + Integer.parseInt(String.valueOf(j + 1)) + " player name:");
String s = scanner.next();
player.add(new Player(s));
}
Game game = new Game("UNO");
game.setPlayers(player);
System.out.println("\nWant to start the game? the press 'yes' or 'no'");
String startgame = scanner.next();
System.out.println("\n");
if (startgame.toLowerCase().equals("yes")) {
String playerwins;
GameState gameState = new GameState(n);
int currentPlayer = 0;
int input;
boolean isOver = false;
while(!isOver) {
currentPlayer = gameState.getCurrPlayer();
System.out.println(gameState.getPlayerOptions(currentPlayer));
System.out.println("\n");
System.out.println("Deck Card - " + gameState.getDeckCard());
System.out.println("\n" + game.getPlayers().get(currentPlayer).getName() + " please choose your card from above.");
input = scanner.nextInt();
System.out.println("\n");
try {
isOver = gameState.makeMove(currentPlayer, input);
} catch (IllegalArgumentException e) {
System.out.println("Invalid move play again\n");
}
}
playerwins = game.getPlayers().get(currentPlayer).getName();
System.out.println("Congratulations!!!!!! The WINNER is " + playerwins);
} else {
return;
}
}
}
| [
"[email protected]"
] | |
c7a1ee42a64ff489a0c505bb0afbf9b650f6eaa9 | 53f3bf31c34e8834a58b676b4e5ca35eeacc3115 | /src/main/java/com/matiasiturbide/medicinecabinet/config/ResourceServerConfig.java | 164b0f8951fda1581cd9374bfaab8cef1fa33c17 | [
"MIT"
] | permissive | BW-Med-Cabinet-2/back-end | 674a0c53ab898f71a375f442f931a1c01d0bcab5 | a93dd1d6fd0226241a0f1fe116bb7b4e59c4713f | refs/heads/master | 2022-12-04T06:44:14.210172 | 2020-08-26T22:51:56 | 2020-08-26T22:51:56 | 289,372,898 | 0 | 0 | MIT | 2020-08-28T17:12:09 | 2020-08-21T22:00:33 | Java | UTF-8 | Java | false | false | 2,959 | java | package com.matiasiturbide.medicinecabinet.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer;
import org.springframework.security.oauth2.provider.error.OAuth2AccessDeniedHandler;
/**
* Once the client has gained authorization, users need to gain authentication. This class is response for handling that.
* It also configures which roles have access to which endpoints. So controls the users' access!
*/
@Configuration
@EnableResourceServer
public class ResourceServerConfig
extends ResourceServerConfigurerAdapter
{
private static final String RESOURCE_ID = "resource_id";
@Override
public void configure(ResourceServerSecurityConfigurer resources)
{
resources.resourceId(RESOURCE_ID)
.stateless(false);
}
/**
* This method configures which roles can access which endpoints
*
* @param http Our HttpSecurity object that is maintains by Spring
* @throws Exception in case the configurations fails
*/
@Override
public void configure(HttpSecurity http)
throws
Exception
{
http.authorizeRequests()
.antMatchers("/",
"/h2-console/**",
"/swagger-resources/**",
"/swagger-resource/**",
"/swagger-ui.html",
"/v2/api-docs",
"/webjars/**",
"/createnewuser",
"/predict")
.permitAll()
.antMatchers(HttpMethod.POST,
"/users/**")
.hasAnyRole("ADMIN")
.antMatchers(HttpMethod.DELETE,
"/users/**")
.hasAnyRole("ADMIN")
.antMatchers(HttpMethod.PUT,
"/users/**")
.hasAnyRole("ADMIN")
.antMatchers("/users/**",
"/useremails/**",
"/oauth/revoke-token",
"/logout")
.authenticated()
.antMatchers("/roles/**")
.hasAnyRole("ADMIN")
.and()
.exceptionHandling()
.accessDeniedHandler(new OAuth2AccessDeniedHandler());
http.csrf()
.disable();
http.headers()
.frameOptions()
.disable();
http.logout()
.disable();
}
}
| [
"[email protected]"
] | |
4b2be3e808191f43bff7f7545fd8155a5691dcf1 | 10e5aa56e0d32747dcd05f27ef35d8e76cedc242 | /eureka-producer/src/main/java/com/cz/eurekaproducer/indicator/CustomHealthIndicator.java | 6164355ef3d9215f800f29c91d88a966c7552570 | [] | no_license | Wo1verien/SpringCloud-example | 2b7a7d27fa716847fe0e5752d272825a9233a93a | 183647a56f7c29113035f59f6ca3bc573e4bd3e0 | refs/heads/master | 2022-05-06T11:55:29.736954 | 2019-10-28T10:56:38 | 2019-10-28T10:56:38 | 209,197,165 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 767 | java | package com.cz.eurekaproducer.indicator;
import org.springframework.boot.actuate.health.AbstractHealthIndicator;
import org.springframework.boot.actuate.health.Health;
import org.springframework.stereotype.Component;
/**
* Created 2019-09-20.
*
* @author changzheng
*/
@Component
public class CustomHealthIndicator extends AbstractHealthIndicator {
@Override
protected void doHealthCheck(Health.Builder builder) throws Exception {
// Use the builder to build the health status details that should be reported.
// If you throw an exception, the status will be DOWN with the exception message
builder.up()
.withDetail("app", "Alive and Kicking")
.withDetail("error", "Nothing! I'm good.");
}
}
| [
"[email protected]"
] | |
9ea673d104099aa84be522bce0342793af128de2 | c229d4d9f973885291d146e7ddc8bebd3767aa74 | /rocketmq-client/src/main/java/com/alibaba/rocketmq/client/impl/consumer/RebalanceImpl.java | 1a20dc9ed8019872fcc7d7416b0b42d21202a119 | [
"Apache-2.0"
] | permissive | lb2158/RocketMQ-3.0.8 | c628526d994a6d581614de0def7b4be4649fb4eb | c4ea34c8792499fd2f1de30a49d22a72b625500c | refs/heads/master | 2021-06-16T03:09:22.478215 | 2017-05-10T21:22:05 | 2017-05-10T21:22:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,412 | java | /**
* Copyright (C) 2010-2013 Alibaba Group Holding Limited
*
* 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.alibaba.rocketmq.client.impl.consumer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.slf4j.Logger;
import com.alibaba.rocketmq.client.consumer.AllocateMessageQueueStrategy;
import com.alibaba.rocketmq.client.impl.FindBrokerResult;
import com.alibaba.rocketmq.client.impl.factory.MQClientFactory;
import com.alibaba.rocketmq.client.log.ClientLogger;
import com.alibaba.rocketmq.common.MixAll;
import com.alibaba.rocketmq.common.message.MessageQueue;
import com.alibaba.rocketmq.common.protocol.body.LockBatchRequestBody;
import com.alibaba.rocketmq.common.protocol.body.UnlockBatchRequestBody;
import com.alibaba.rocketmq.common.protocol.heartbeat.MessageModel;
import com.alibaba.rocketmq.common.protocol.heartbeat.SubscriptionData;
/**
* Rebalance的具体实现
*
* @author shijia.wxr<[email protected]>
* @since 2013-6-22
*/
public abstract class RebalanceImpl {
protected static final Logger log = ClientLogger.getLog();
// 分配好的队列,消息存储也在这里
protected final ConcurrentHashMap<MessageQueue, ProcessQueue> processQueueTable =
new ConcurrentHashMap<MessageQueue, ProcessQueue>(64);
// 可以订阅的所有队列(定时从Name Server更新最新版本)
protected final ConcurrentHashMap<String/* topic */, Set<MessageQueue>> topicSubscribeInfoTable =
new ConcurrentHashMap<String, Set<MessageQueue>>();
// 订阅关系,用户配置的原始数据
protected final ConcurrentHashMap<String /* topic */, SubscriptionData> subscriptionInner =
new ConcurrentHashMap<String, SubscriptionData>();
protected String consumerGroup;
protected MessageModel messageModel;
protected AllocateMessageQueueStrategy allocateMessageQueueStrategy;
protected MQClientFactory mQClientFactory;
public RebalanceImpl(String consumerGroup, MessageModel messageModel,
AllocateMessageQueueStrategy allocateMessageQueueStrategy, MQClientFactory mQClientFactory) {
this.consumerGroup = consumerGroup;
this.messageModel = messageModel;
this.allocateMessageQueueStrategy = allocateMessageQueueStrategy;
this.mQClientFactory = mQClientFactory;
}
public void unlock(final MessageQueue mq, final boolean oneway) {
FindBrokerResult findBrokerResult =
this.mQClientFactory.findBrokerAddressInSubscribe(mq.getBrokerName(), MixAll.MASTER_ID, true);
if (findBrokerResult != null) {
UnlockBatchRequestBody requestBody = new UnlockBatchRequestBody();
requestBody.setConsumerGroup(this.consumerGroup);
requestBody.setClientId(this.mQClientFactory.getClientId());
requestBody.getMqSet().add(mq);
try {
this.mQClientFactory.getMQClientAPIImpl().unlockBatchMQ(findBrokerResult.getBrokerAddr(),
requestBody, 1000, oneway);
log.warn("unlock messageQueue. group:{}, clientId:{}, mq:{}",//
this.consumerGroup, //
this.mQClientFactory.getClientId(), //
mq);
}
catch (Exception e) {
log.error("unlockBatchMQ exception, " + mq, e);
}
}
}
public void unlockAll(final boolean oneway) {
HashMap<String, Set<MessageQueue>> brokerMqs = this.buildProcessQueueTableByBrokerName();
for (final Map.Entry<String, Set<MessageQueue>> entry : brokerMqs.entrySet()) {
final String brokerName = entry.getKey();
final Set<MessageQueue> mqs = entry.getValue();
if (mqs.isEmpty())
continue;
FindBrokerResult findBrokerResult =
this.mQClientFactory.findBrokerAddressInSubscribe(brokerName, MixAll.MASTER_ID, true);
if (findBrokerResult != null) {
UnlockBatchRequestBody requestBody = new UnlockBatchRequestBody();
requestBody.setConsumerGroup(this.consumerGroup);
requestBody.setClientId(this.mQClientFactory.getClientId());
requestBody.setMqSet(mqs);
try {
this.mQClientFactory.getMQClientAPIImpl().unlockBatchMQ(findBrokerResult.getBrokerAddr(),
requestBody, 1000, oneway);
for (MessageQueue mq : mqs) {
ProcessQueue processQueue = this.processQueueTable.get(mq);
if (processQueue != null) {
processQueue.setLocked(false);
log.info("the message queue unlock OK, Group: {} {}", this.consumerGroup, mq);
}
}
}
catch (Exception e) {
log.error("unlockBatchMQ exception, " + mqs, e);
}
}
}
}
private HashMap<String/* brokerName */, Set<MessageQueue>> buildProcessQueueTableByBrokerName() {
HashMap<String, Set<MessageQueue>> result = new HashMap<String, Set<MessageQueue>>();
for (MessageQueue mq : this.processQueueTable.keySet()) {
Set<MessageQueue> mqs = result.get(mq.getBrokerName());
if (null == mqs) {
mqs = new HashSet<MessageQueue>();
result.put(mq.getBrokerName(), mqs);
}
mqs.add(mq);
}
return result;
}
public boolean lock(final MessageQueue mq) {
FindBrokerResult findBrokerResult =
this.mQClientFactory.findBrokerAddressInSubscribe(mq.getBrokerName(), MixAll.MASTER_ID, true);
if (findBrokerResult != null) {
LockBatchRequestBody requestBody = new LockBatchRequestBody();
requestBody.setConsumerGroup(this.consumerGroup);
requestBody.setClientId(this.mQClientFactory.getClientId());
requestBody.getMqSet().add(mq);
try {
Set<MessageQueue> lockedMq =
this.mQClientFactory.getMQClientAPIImpl().lockBatchMQ(
findBrokerResult.getBrokerAddr(), requestBody, 1000);
for (MessageQueue mmqq : lockedMq) {
ProcessQueue processQueue = this.processQueueTable.get(mmqq);
if (processQueue != null) {
processQueue.setLocked(true);
processQueue.setLastLockTimestamp(System.currentTimeMillis());
}
}
boolean lockOK = lockedMq.contains(mq);
log.info("the message queue lock {}, {} {}",//
(lockOK ? "OK" : "Failed"), //
this.consumerGroup, //
mq);
return lockOK;
}
catch (Exception e) {
log.error("lockBatchMQ exception, " + mq, e);
}
}
return false;
}
public void lockAll() {
HashMap<String, Set<MessageQueue>> brokerMqs = this.buildProcessQueueTableByBrokerName();
Iterator<Entry<String, Set<MessageQueue>>> it = brokerMqs.entrySet().iterator();
while (it.hasNext()) {
Entry<String, Set<MessageQueue>> entry = it.next();
final String brokerName = entry.getKey();
final Set<MessageQueue> mqs = entry.getValue();
if (mqs.isEmpty())
continue;
FindBrokerResult findBrokerResult =
this.mQClientFactory.findBrokerAddressInSubscribe(brokerName, MixAll.MASTER_ID, true);
if (findBrokerResult != null) {
LockBatchRequestBody requestBody = new LockBatchRequestBody();
requestBody.setConsumerGroup(this.consumerGroup);
requestBody.setClientId(this.mQClientFactory.getClientId());
requestBody.setMqSet(mqs);
try {
Set<MessageQueue> lockOKMQSet =
this.mQClientFactory.getMQClientAPIImpl().lockBatchMQ(
findBrokerResult.getBrokerAddr(), requestBody, 1000);
// 锁定成功的队列
for (MessageQueue mq : lockOKMQSet) {
ProcessQueue processQueue = this.processQueueTable.get(mq);
if (processQueue != null) {
if (!processQueue.isLocked()) {
log.info("the message queue locked OK, Group: {} {}", this.consumerGroup, mq);
}
processQueue.setLocked(true);
processQueue.setLastLockTimestamp(System.currentTimeMillis());
}
}
// 锁定失败的队列
for (MessageQueue mq : mqs) {
if (!lockOKMQSet.contains(mq)) {
ProcessQueue processQueue = this.processQueueTable.get(mq);
if (processQueue != null) {
processQueue.setLocked(false);
log.warn("the message queue locked Failed, Group: {} {}", this.consumerGroup,
mq);
}
}
}
}
catch (Exception e) {
log.error("lockBatchMQ exception, " + mqs, e);
}
}
}
}
public void doRebalance() {
Map<String, SubscriptionData> subTable = this.getSubscriptionInner();
if (subTable != null) {
/*
* chen.si 针对每个topic,检查当前consumer group中的 活动consumer list是否有变化,如果变化了,需要重新调整 分区
*/
for (final Map.Entry<String, SubscriptionData> entry : subTable.entrySet()) {
final String topic = entry.getKey();
try {
this.rebalanceByTopic(topic);
}
catch (Exception e) {
if (!topic.startsWith(MixAll.RETRY_GROUP_TOPIC_PREFIX)) {
log.warn("rebalanceByTopic Exception", e);
}
}
}
}
this.truncateMessageQueueNotMyTopic();
}
private void rebalanceByTopic(final String topic) {
switch (messageModel) {
case BROADCASTING: {
Set<MessageQueue> mqSet = this.topicSubscribeInfoTable.get(topic);
if (mqSet != null) {
boolean changed = this.updateProcessQueueTableInRebalance(topic, mqSet);
if (changed) {
this.messageQueueChanged(topic, mqSet, mqSet);
log.info("messageQueueChanged {} {} {} {}",//
consumerGroup,//
topic,//
mqSet,//
mqSet);
}
}
else {
log.warn("doRebalance, {}, but the topic[{}] not exist.", consumerGroup, topic);
}
break;
}
case CLUSTERING: {
/*
* chen.si topic下的所有的分区队列
*/
Set<MessageQueue> mqSet = this.topicSubscribeInfoTable.get(topic);
/*
* chen.si 一个consumer,会有一个唯一的clientId。这里通过clientId来标识 同一个consumer group下的当前活动的所有consumer。
*/
List<String> cidAll = this.mQClientFactory.findConsumerIdList(topic, consumerGroup);
if (null == mqSet) {
if (!topic.startsWith(MixAll.RETRY_GROUP_TOPIC_PREFIX)) {
log.warn("doRebalance, {}, but the topic[{}] not exist.", consumerGroup, topic);
}
}
if (null == cidAll) {
log.warn("doRebalance, {} {}, get consumer id list failed", consumerGroup, topic);
}
if (mqSet != null && cidAll != null) {
List<MessageQueue> mqAll = new ArrayList<MessageQueue>();
mqAll.addAll(mqSet);
// 排序
Collections.sort(mqAll);
Collections.sort(cidAll);
AllocateMessageQueueStrategy strategy = this.allocateMessageQueueStrategy;
// 执行分配算法
List<MessageQueue> allocateResult = null;
try {
allocateResult = strategy.allocate(this.mQClientFactory.getClientId(), mqAll, cidAll);
}
catch (Throwable e) {
log.error("AllocateMessageQueueStrategy.allocate Exception", e);
}
Set<MessageQueue> allocateResultSet = new HashSet<MessageQueue>();
if (allocateResult != null) {
allocateResultSet.addAll(allocateResult);
}
// 更新本地队列
boolean changed = this.updateProcessQueueTableInRebalance(topic, allocateResultSet);
if (changed) {
log.info("rebalanced result changed. mqSet={}, ConsumerId={}, mqSize={}, cidSize={}",
allocateResult, this.mQClientFactory.getClientId(), mqAll.size(), cidAll.size());
/*
* chen.si 当前consumer负责的分区队列有变化,需要通知consumer。 当前consumer需要重新调整fetch
*/
this.messageQueueChanged(topic, mqSet, allocateResultSet);
log.info("messageQueueChanged {} {} {} {}",//
consumerGroup,//
topic,//
mqSet,//
allocateResultSet);
log.info("messageQueueChanged consumerIdList: {}",//
cidAll);
}
}
break;
}
default:
break;
}
}
public abstract void messageQueueChanged(final String topic, final Set<MessageQueue> mqAll,
final Set<MessageQueue> mqDivided);
private boolean updateProcessQueueTableInRebalance(final String topic, final Set<MessageQueue> mqSet) {
boolean changed = false;
// 将多余的队列删除
Iterator<Entry<MessageQueue, ProcessQueue>> it = this.processQueueTable.entrySet().iterator();
while (it.hasNext()) {
Entry<MessageQueue, ProcessQueue> next = it.next();
MessageQueue mq = next.getKey();
ProcessQueue pq = next.getValue();
if (mq.getTopic().equals(topic)) {
if (!mqSet.contains(mq)) {
changed = true;
it.remove();
pq.setDroped(true);
log.info("doRebalance, {}, remove unnecessary mq, {}", consumerGroup, mq);
this.removeUnnecessaryMessageQueue(mq, pq);
}
}
}
// 增加新增的队列
List<PullRequest> pullRequestList = new ArrayList<PullRequest>();
for (MessageQueue mq : mqSet) {
if (!this.processQueueTable.containsKey(mq)) {
PullRequest pullRequest = new PullRequest();
pullRequest.setConsumerGroup(consumerGroup);
pullRequest.setMessageQueue(mq);
pullRequest.setProcessQueue(new ProcessQueue());
// 这个需要根据策略来设置
long nextOffset = this.computePullFromWhere(mq);
if (nextOffset >= 0) {
pullRequest.setNextOffset(nextOffset);
pullRequestList.add(pullRequest);
changed = true;
this.processQueueTable.put(mq, pullRequest.getProcessQueue());
log.info("doRebalance, {}, add a new mq, {}", consumerGroup, mq);
}
else {
// 等待此次Rebalance做重试
log.warn("doRebalance, {}, add new mq failed, {}", consumerGroup, mq);
}
}
}
this.dispatchPullRequest(pullRequestList);
return changed;
}
public abstract void removeUnnecessaryMessageQueue(final MessageQueue mq, final ProcessQueue pq);
public abstract void dispatchPullRequest(final List<PullRequest> pullRequestList);
public abstract long computePullFromWhere(final MessageQueue mq);
private void truncateMessageQueueNotMyTopic() {
Map<String, SubscriptionData> subTable = this.getSubscriptionInner();
for (MessageQueue mq : this.processQueueTable.keySet()) {
if (!subTable.containsKey(mq.getTopic())) {
ProcessQueue pq = this.processQueueTable.remove(mq);
if (pq != null) {
pq.setDroped(true);
log.info("doRebalance, {}, truncateMessageQueueNotMyTopic remove unnecessary mq, {}",
consumerGroup, mq);
}
}
}
}
public ConcurrentHashMap<String, SubscriptionData> getSubscriptionInner() {
return subscriptionInner;
}
public ConcurrentHashMap<MessageQueue, ProcessQueue> getProcessQueueTable() {
return processQueueTable;
}
public ConcurrentHashMap<String, Set<MessageQueue>> getTopicSubscribeInfoTable() {
return topicSubscribeInfoTable;
}
public String getConsumerGroup() {
return consumerGroup;
}
public void setConsumerGroup(String consumerGroup) {
this.consumerGroup = consumerGroup;
}
public MessageModel getMessageModel() {
return messageModel;
}
public void setMessageModel(MessageModel messageModel) {
this.messageModel = messageModel;
}
public AllocateMessageQueueStrategy getAllocateMessageQueueStrategy() {
return allocateMessageQueueStrategy;
}
public void setAllocateMessageQueueStrategy(AllocateMessageQueueStrategy allocateMessageQueueStrategy) {
this.allocateMessageQueueStrategy = allocateMessageQueueStrategy;
}
public MQClientFactory getmQClientFactory() {
return mQClientFactory;
}
public void setmQClientFactory(MQClientFactory mQClientFactory) {
this.mQClientFactory = mQClientFactory;
}
}
| [
"[email protected]"
] | |
a2433f856412e32a8be525c8be1af67560b2e495 | 37f8e06f7d830e66acffbe0c6110f04e9f27dcc5 | /Basic/src/sortingAlgorithms/SelectionSort.java | c49a9238caa1960a1e2d5f3a8a18fd5c422fe246 | [] | no_license | Gaurav41/TCS_Coding_Practise | af52aab290152e7c1b32e0a9dac9280aff79fe19 | b040e19c9fc10defa63cd5ec5d2f5315b8a1b318 | refs/heads/master | 2023-01-06T03:15:58.964809 | 2020-11-02T08:28:28 | 2020-11-02T08:28:28 | 309,286,708 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 739 | java | package sortingAlgorithms;
public class SelectionSort {
public static void main(String[] args) {
int a[] = { 50, 60, 30, 80, 40 };
int n = a.length;
int min = 0;
for (int i = 0; i < n-1; i++)
{
//min = a[i]; assume ith ele as min
for (int j = i + 1; j < n; j++)
{
if (a[j] < a[i])
{ //swap min with a[j]
//min = [j];
int temp = a[j];
a[j] = a[i];
a[i] = temp;
}
}
System.out.print("\nPass "+i+": ");
for (int i1 : a)
{
System.out.print(i1 + " ");
}
}
/*for (int i1 : a)
{
System.out.print(i1 + " ");
}*/
}
}
/*
{ 50, 60, 30, 80, 40 }
Pass 0: 30 60 50 80 40
Pass 1: 30 40 60 80 50
Pass 2: 30 40 50 80 60
Pass 3: 30 40 50 60 80
*/ | [
"[email protected]"
] | |
1f62195c4eddef1864cb0361df0dc0636bf52ed2 | 512d995c8d7517cab9d2280aadfcb08fc648cd91 | /app/src/main/java/com/maiso/alura_eclipse/CopiarActivity.java | 143611346c092bef5d85a5ddbb0f626ad5813692 | [] | no_license | maisonsouza/Alura---ANDROID-I-CRIE-SUA-APP-FANT-STICA-NO-ECLIPSE | 62150636b98c70112d0d3aaeb07d53b16e91f151 | e7f7b7333c8a5e7e225b58e46038880f6fd892b2 | refs/heads/master | 2021-01-11T04:57:06.658963 | 2016-12-11T19:55:43 | 2016-12-11T19:55:43 | 76,195,966 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,022 | java | package com.maiso.alura_eclipse;
import android.app.Activity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
/**
* Created by maiso on 10/12/2016.
*/
public class CopiarActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ola_mundo);
Button botao = (Button) findViewById(R.id.botao_copiar);
final EditText entrada = (EditText) findViewById(R.id.campo);
final TextView saida = (TextView) findViewById(R.id.texto);
botao.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.i("OlaMundo","Botão Clicado");
saida.setText(entrada.getText());
}
});
}
}
| [
"[email protected]"
] | |
cc63d1f44050694f19700176d31b919d20149d48 | db5cc1214f5cc7586589b0adfb99df0bfa663ddf | /0589. N叉树的前序遍历.java | 0468f9d4d4af7e4181ab0b3967c44a1b18bcef88 | [] | no_license | messi1002/leetcode | cc46e2cf7a156447574b3e274a2e2c9ebc5b7125 | e967827a916fd3227f9d3b57bed119430765cd05 | refs/heads/master | 2020-04-29T16:53:35.990201 | 2020-04-06T11:39:00 | 2020-04-06T11:39:00 | 176,278,113 | 7 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,068 | java | // 1.递归函数定义: 前序遍历以root节点为根节点的N叉树
private void traversal(Node root, List list) {
// 递归终止条件
if (root == null) {
return;
}
// 递归过程
// 处理当前节点
list.add(root.val);
// 前序遍历root节点的每个子树
for (Node node: root.children) {
traversal(node, list);
}
}
public List<Integer> preorder(Node root) {
List<Integer> list = new ArrayList<Integer>();
traversal(root, list);
return list;
}
// 2.迭代
public List<Integer> preorder(Node root) {
Stack<Node> stack = new Stack<>();
List<Integer> list = new ArrayList<>();
if (root == null) {
return list;
}
stack.push(root);
while (!stack.isEmpty()) {
root = stack.pop();
list.add(root.val);
// 将N叉树的子树从右向左推入栈中,这样子树出栈的顺序是从左到右。
Collections.reverse(root.children);
for (Node n: root.children) {
stack.push(n);
}
}
return list;
} | [
"[email protected]"
] | |
4cf7138df819abe38976d8894b88f8c78616469e | db0f154b5e6cf9cff065722e78702257c50d92bc | /gen/br/com/alrs/teste/R.java | 7e77749031da23a2b2fd3cdedf98824ea2f1e34f | [] | no_license | andreronquetti/TestOnClick | 182e39bc84594ed88405c7b0a66ca41cf015816e | abb65ea61b897bc7b5c90d0364d795e934e187be | refs/heads/master | 2021-05-27T12:41:49.412444 | 2012-03-23T15:45:31 | 2012-03-23T15:45:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 820 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package br.com.alrs.teste;
public final class R {
public static final class attr {
}
public static final class drawable {
public static final int ic_launcher=0x7f020000;
}
public static final class id {
public static final int button1=0x7f050000;
public static final int button2=0x7f050001;
public static final int button3=0x7f050002;
}
public static final class layout {
public static final int main=0x7f030000;
}
public static final class string {
public static final int app_name=0x7f040001;
public static final int hello=0x7f040000;
}
}
| [
"[email protected]"
] | |
633707c4e46256f87bb5accc8cf19eaaefae4f87 | abaef763782099646ccdbfa7789c2194a8700dcf | /myCharStream/src/com/ssx05JiHeYuWenJian/TxtToArrayDemo.java | 493286d5da75eb54820ac18a146732114d3191ed | [] | no_license | TionKior/JavaSE | dc302350e7fb3388ad623521a7e7169188165ffb | c6c232b93c526576a463d81c502795bc598e909b | refs/heads/main | 2023-04-13T07:25:49.934107 | 2021-04-26T08:43:23 | 2021-04-26T08:43:23 | 358,766,049 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 864 | java | package com.ssx05JiHeYuWenJian;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
public class TxtToArrayDemo {
public static void main(String[] args) throws IOException {
//创建字符缓冲输入流对象
BufferedReader br = new BufferedReader(new FileReader("myCharStream\\array.txt"));
//创建ArrayList集合对象
ArrayList<String> array = new ArrayList<String>();
//调用字符缓冲输入流对象的方法读数据
String line;
while ((line = br.readLine()) != null) {
//把读取到的字符串数据存储到集合中
array.add(line);
}
//释放资源
br.close();
//遍历集合
for (String s : array) {
System.out.println(s);
}
}
}
| [
"[email protected]"
] | |
f09fffa8b3b3e3e60c5f2b5d2ea1934607bf1f8f | 1ad3942a27702a7707ee8404474a7a0c887d30ab | /Lab 08/src/Deck.java | 0e809ca08fa7659d01b2a84fd2a9dbd8d4934e60 | [] | no_license | John-K408/RANDOM__ANIMATION | c592514e1c53a9cc8a4c6c05209840ded4b0b110 | 1c8ee5e0b09483f2a4463aadbf4f5de86b6caef4 | refs/heads/master | 2020-12-01T22:50:41.935201 | 2019-12-29T20:36:32 | 2019-12-29T20:36:32 | 230,800,607 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 922 | java | public class Deck {
public Card[] deckElements = new Card[52];
int topOfDeck = 0;
public Deck(){
int Index = 0;
for(int suit = 0; suit < 4; suit++)
for(int rank = 0; rank < 13; rank++){
deckElements[Index]= new Card(suit,rank);
Index++;
}
}
public void shuffle(){
for (int i = 51; i > 0 ; i --){
int j = (int)(Math.random()*(i+1));
Card a = deckElements[i];
deckElements[i] =deckElements[j];
deckElements[j] = a;
}
}
public Hand getHand(int n){
// n is the number of cards to get from the deck and give to each hand.
Hand toReturn = new Hand(n);
for(int i = 0; i < n; i ++){
toReturn.addCard(deckElements[i+topOfDeck]);
}
topOfDeck = topOfDeck + n;
return toReturn;
}
public int size(){
return 52 - topOfDeck;
}
}
| [
"[email protected]"
] | |
22f6e33bc68a6e92a917461f75fa52f3348233a3 | 31702665b2bbf11ecf6dda7f5e7c4cc31cc2b905 | /src/main/java/com/csh/mms/service/ProductionInfoService.java | f809426698a8f1ec6e9f22b86dc44a558f7240a3 | [] | no_license | cuishenghong/MMS_BackEnd | 600d3d12c3698e248b7550978a6245937150bbb6 | cce6d969a866e1500187af472dbb2f4416e4bff7 | refs/heads/master | 2023-05-05T14:50:53.879131 | 2021-05-23T03:44:56 | 2021-05-23T03:44:56 | 308,349,969 | 0 | 1 | null | 2021-05-23T03:44:57 | 2020-10-29T14:16:18 | Java | UTF-8 | Java | false | false | 497 | java | package com.csh.mms.service;
import org.apache.ibatis.annotations.Param;
import com.csh.mms.domain.ProductionInfo;
import com.csh.mms.dto.InventoryProdDto;
import com.github.pagehelper.Page;
public interface ProductionInfoService {
ProductionInfo getProdInfo(@Param("id") String id);
void deleteProd(InventoryProdDto dto);
void updateProd(InventoryProdDto dto);
Page<InventoryProdDto> getProdList(InventoryProdDto prod);
void insertProd(InventoryProdDto dto);
}
| [
"cuishh123"
] | cuishh123 |
c20a77c7186b85dd145277a52635edaa05735093 | e48bbaf1bd1089f256a4832d4e45f45ef87bd585 | /p2psys-web/src/main/java/com/rongdu/p2psys/active/ActiveAction.java | 7f4697ce81918155ed084ffc1a41a7477e7cfe9c | [] | no_license | rebider/pro_bank | 330d5d53913424d8629622f045fc9b26ad893591 | 37799f63d63e8a2df1f63191a92baf5b01e88a3f | refs/heads/master | 2021-06-17T21:15:58.363591 | 2017-05-25T09:45:38 | 2017-05-25T09:45:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,076 | java | package com.rongdu.p2psys.active;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import java.util.Random;
import net.sf.json.JSONObject;
import org.apache.http.client.ClientProtocolException;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;
import com.rongdu.p2psys.core.web.BaseAction;
import com.rongdu.p2psys.crowdfunding.domain.LeaderFactory;
import com.rongdu.p2psys.crowdfunding.service.LeaderFactoryService;
import com.rongdu.p2psys.nb.wechat.domain.WechatCache;
import com.rongdu.p2psys.nb.wechat.service.WechatCacheService;
import com.rongdu.p2psys.util.WechatData;
import com.rongdu.p2psys.util.WechatJSSign;
import com.rongdu.p2psys.util.WechatUtil;
/**
* 各种h5活动页面
* @author Jinx
*
*/
@SuppressWarnings("rawtypes")
public class ActiveAction extends BaseAction{
@Autowired
private LeaderFactoryService leaderFactoryService;
@Autowired
private WechatCacheService wechatCacheService;
private Map<String,Object> data;
@Action(value = "/active/index",results = { @Result(name = "index", type = "ftl", location = "/nb/active/cf-index.htm")})
public String index(){
return "index";
}
@Action(value = "/active/wechat/index",results = { @Result(name = "index", type = "ftl", location = "/nb/active/cf-wechat-index.htm"),@Result(name = "pro", type = "ftl", location = "/nb/cf/wechat/pro/index.html")})
public String wechatindex() throws ParseException{
request.setAttribute("id",1);
Date now = new Date();
String myString = "2016-03-22 16:00:00";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date d = sdf.parse(myString);
if(d.after(now)){
return "index";
}
return "pro";
}
@Action(value = "/active/wechat/invite",results = { @Result(name = "invite", type = "ftl", location = "/nb/active/cf-wechat-invite.html")})
public String wechatInvite(){
return "invite";
}
@Action(value = "/active/wechat/info",results = { @Result(name = "info", type = "ftl", location = "/nb/active/cf-wechat-info.html")})
public String info(){
return "info";
}
@Action(value = "/active/wechat/result",results = { @Result(name = "result", type = "ftl", location = "/nb/active/cf-wechat-result.html")})
public String result() throws ClientProtocolException, IOException{
request.setAttribute("timestamp", "");
request.setAttribute("nonceStr", "");
request.setAttribute("signature", "");
String url = request.getRequestURL().toString();
String queryString = request.getQueryString();
String appId = WechatData.A_APP_ID;
String appSecret = WechatData.A_APP_SECRET;
if (null != queryString && !"".equals(queryString)) {
url = url + "?" + queryString;
}
WechatCache wechatCache = wechatCacheService.getByAppId(appId, "JsApi");
WechatJSSign wechatJSSign = new WechatJSSign();
String jsapi_ticket = wechatJSSign.checkWechatCache(appId, appSecret,wechatCache);
Map<String, String> ret = WechatJSSign.createSign(jsapi_ticket, url,appId, appSecret);
request.setAttribute("appId", appId);
request.setAttribute("timestamp", ret.get("timestamp").toString());
request.setAttribute("nonceStr", ret.get("nonceStr").toString());
request.setAttribute("signature", ret.get("signature").toString());
int r = paramInt("r");
int id = paramInt("id");
if(0==r){
r = 1+new Random().nextInt(5);
LeaderFactory leaderFactory = leaderFactoryService.find(id);
leaderFactory.setResult(r);
leaderFactoryService.doUpdate(leaderFactory);
}
request.setAttribute("r",r);
return "result";
}
@Action(value = "/active/wechat/box",results = { @Result(name = "box", type = "ftl", location = "/nb/active/cf-wechat-box.html")})
public String wechatBox() throws ClientProtocolException, IOException{
request.setAttribute("timestamp", "");
request.setAttribute("nonceStr", "");
request.setAttribute("signature", "");
String code = request.getParameter("code");
request.setAttribute("nick","");
if (null != code && !"".equals(code)) {
JSONObject result = WechatUtil.getUserInfoFirst(code,WechatData.A_APP_ID, WechatData.A_APP_SECRET);
if(null!=result){
System.out.println("第一次微信授权获取信息:"+result.toString());
String accessToken = result.get("access_token").toString();
String openid = result.get("openid").toString();
JSONObject json = WechatUtil.getRealUserInfo(accessToken, openid);
request.setAttribute("nick",getRealNickName(json.getString("nickname").toString()));
}
}
String url = request.getRequestURL().toString();
String queryString = request.getQueryString();
String appId = WechatData.A_APP_ID;
String appSecret = WechatData.A_APP_SECRET;
if (null != queryString && !"".equals(queryString)) {
url = url + "?" + queryString;
}
WechatCache wechatCache = wechatCacheService.getByAppId(appId, "JsApi");
WechatJSSign wechatJSSign = new WechatJSSign();
String jsapi_ticket = wechatJSSign.checkWechatCache(appId, appSecret,wechatCache);
Map<String, String> ret = WechatJSSign.createSign(jsapi_ticket, url,appId, appSecret);
request.setAttribute("appId", appId);
request.setAttribute("timestamp", ret.get("timestamp").toString());
request.setAttribute("nonceStr", ret.get("nonceStr").toString());
request.setAttribute("signature", ret.get("signature").toString());
/*
https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa37b227117def502&redirect_uri=http://www.800zf.cn/active/wechat/box.action&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect
*/return "box";
}
public static String getRealNickName(String nick){
StringBuilder nicksb = new StringBuilder();
int l = nick.length();
for (int i = 0; i < l; i++) {
char _s = nick.charAt(i);
if (isEmojiCharacter(_s)) {
nicksb.append(_s);
}
}
return nicksb.toString();
}
@Action(value = "/active/wechat/bubble",results = { @Result(name = "bubble", type = "ftl", location = "/nb/active/cf-wechat-bubble.html")})
public String bubble(){
return "bubble";
}
@Action(value = "/active/swf",results = { @Result(name = "swf", type = "ftl", location = "/nb/active/cf-swf.html")})
public String swf(){
return "swf";
}
public static boolean isEmojiCharacter(char codePoint){
return (codePoint==0x0)||(codePoint==0x9)||
(codePoint==0xA)||(codePoint==0xD)||
((codePoint>=0x20)&&(codePoint<= 0xD7FF))||
((codePoint>=0xE000)&&(codePoint<= 0xFFFD))||
((codePoint>=0x10000)&&(codePoint<=0x10FFFF));
}
public Map<String, Object> getData() {
return data;
}
public void setData(Map<String, Object> data) {
this.data = data;
}
}
| [
"[email protected]"
] | |
e42068966582ac060c73b87f25524d6b2710f103 | cb5e302cbbb3da0d6d6b0011768cd7466efa6183 | /src/com/tencent/tauth/Tencent.java | 4f0e693259f664e2b6575648f1370305b4e14439 | [] | no_license | marcusrogerio/miband-1 | e6cdcfce00d7186e25e184ca4c258a72b0aba097 | b3498784582eb30eb2b06c3d054bcf80b04138d0 | refs/heads/master | 2021-05-06T23:33:01.192152 | 2014-08-30T11:42:00 | 2014-08-30T11:42:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,225 | java | package com.tencent.tauth;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.widget.Toast;
import com.tencent.a.a.c;
import com.tencent.connect.auth.QQAuth;
import com.tencent.connect.auth.QQToken;
import com.tencent.connect.avatar.QQAvatar;
import com.tencent.connect.share.QQShare;
import com.tencent.connect.share.QzoneShare;
import com.tencent.open.SocialApi;
import com.tencent.open.TaskGuide;
import com.tencent.utils.HttpUtils;
import com.tencent.utils.SystemUtils;
import org.json.JSONObject;
public class Tencent
{
private QQAuth a;
private Context b;
private LocationApi c;
private Tencent(String paramString, Context paramContext)
{
this.b = paramContext;
this.a = QQAuth.createInstance(paramString, paramContext);
}
// ERROR //
private static boolean a(Context paramContext, String paramString)
{
// Byte code:
// 0: new 30 android/content/ComponentName
// 3: dup
// 4: aload_0
// 5: invokevirtual 36 android/content/Context:getPackageName ()Ljava/lang/String;
// 8: ldc 38
// 10: invokespecial 41 android/content/ComponentName:<init> (Ljava/lang/String;Ljava/lang/String;)V
// 13: astore_2
// 14: aload_0
// 15: invokevirtual 45 android/content/Context:getPackageManager ()Landroid/content/pm/PackageManager;
// 18: aload_2
// 19: iconst_0
// 20: invokevirtual 51 android/content/pm/PackageManager:getActivityInfo (Landroid/content/ComponentName;I)Landroid/content/pm/ActivityInfo;
// 23: pop
// 24: new 30 android/content/ComponentName
// 27: dup
// 28: aload_0
// 29: invokevirtual 36 android/content/Context:getPackageName ()Ljava/lang/String;
// 32: ldc 53
// 34: invokespecial 41 android/content/ComponentName:<init> (Ljava/lang/String;Ljava/lang/String;)V
// 37: astore 8
// 39: aload_0
// 40: invokevirtual 45 android/content/Context:getPackageManager ()Landroid/content/pm/PackageManager;
// 43: aload 8
// 45: iconst_0
// 46: invokevirtual 51 android/content/pm/PackageManager:getActivityInfo (Landroid/content/ComponentName;I)Landroid/content/pm/ActivityInfo;
// 49: pop
// 50: iconst_1
// 51: ireturn
// 52: astore_3
// 53: new 55 java/lang/StringBuilder
// 56: dup
// 57: ldc 57
// 59: invokespecial 60 java/lang/StringBuilder:<init> (Ljava/lang/String;)V
// 62: aload_1
// 63: invokevirtual 64 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 66: ldc 66
// 68: invokevirtual 64 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 71: invokevirtual 69 java/lang/StringBuilder:toString ()Ljava/lang/String;
// 74: astore 4
// 76: new 55 java/lang/StringBuilder
// 79: dup
// 80: invokespecial 70 java/lang/StringBuilder:<init> ()V
// 83: aload 4
// 85: invokevirtual 64 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 88: ldc 72
// 90: invokevirtual 64 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 93: aload_1
// 94: invokevirtual 64 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 97: ldc 74
// 99: invokevirtual 64 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 102: ldc 76
// 104: invokevirtual 64 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 107: invokevirtual 69 java/lang/StringBuilder:toString ()Ljava/lang/String;
// 110: astore 5
// 112: invokestatic 81 com/tencent/a/a/c:a ()Lcom/tencent/a/a/c;
// 115: pop
// 116: ldc 83
// 118: aload 5
// 120: invokestatic 86 com/tencent/a/a/c:d (Ljava/lang/String;Ljava/lang/String;)V
// 123: iconst_0
// 124: ireturn
// 125: astore 9
// 127: new 55 java/lang/StringBuilder
// 130: dup
// 131: invokespecial 70 java/lang/StringBuilder:<init> ()V
// 134: ldc 88
// 136: invokevirtual 64 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 139: ldc 90
// 141: invokevirtual 64 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 144: invokevirtual 69 java/lang/StringBuilder:toString ()Ljava/lang/String;
// 147: astore 10
// 149: invokestatic 81 com/tencent/a/a/c:a ()Lcom/tencent/a/a/c;
// 152: pop
// 153: ldc 92
// 155: aload 10
// 157: invokestatic 86 com/tencent/a/a/c:d (Ljava/lang/String;Ljava/lang/String;)V
// 160: iconst_0
// 161: ireturn
//
// Exception table:
// from to target type
// 0 24 52 android/content/pm/PackageManager$NameNotFoundException
// 24 50 125 android/content/pm/PackageManager$NameNotFoundException
}
public static Tencent createInstance(String paramString, Context paramContext)
{
Tencent localTencent = new Tencent(paramString, paramContext);
if (!a(paramContext, paramString))
return null;
c.a("openSDK_LOG", "createInstance() --end");
return localTencent;
}
public int ask(Activity paramActivity, Bundle paramBundle, IUiListener paramIUiListener)
{
new SocialApi(paramActivity, this.a.getQQToken()).ask(paramActivity, paramBundle, paramIUiListener);
return 0;
}
public int brag(Activity paramActivity, Bundle paramBundle, IUiListener paramIUiListener)
{
new SocialApi(paramActivity, this.a.getQQToken()).brag(paramActivity, paramBundle, paramIUiListener);
return 0;
}
public int challenge(Activity paramActivity, Bundle paramBundle, IUiListener paramIUiListener)
{
new SocialApi(paramActivity, this.a.getQQToken()).challenge(paramActivity, paramBundle, paramIUiListener);
return 0;
}
public int deleteLocation(Activity paramActivity, Bundle paramBundle, IUiListener paramIUiListener)
{
if (this.c == null)
this.c = new LocationApi(paramActivity, this.a.getQQToken());
this.c.deleteLocation(paramActivity, paramBundle, paramIUiListener);
return 0;
}
public String getAccessToken()
{
return this.a.getQQToken().getAccessToken();
}
public String getAppId()
{
return this.a.getQQToken().getAppId();
}
public long getExpiresIn()
{
return this.a.getQQToken().getExpireTimeInSecond();
}
public String getOpenId()
{
return this.a.getQQToken().getOpenId();
}
public QQToken getQQToken()
{
return this.a.getQQToken();
}
public int gift(Activity paramActivity, Bundle paramBundle, IUiListener paramIUiListener)
{
new SocialApi(paramActivity, this.a.getQQToken()).gift(paramActivity, paramBundle, paramIUiListener);
return 0;
}
public void grade(Activity paramActivity, Bundle paramBundle, IUiListener paramIUiListener)
{
new SocialApi(paramActivity, this.a.getQQToken()).grade(paramActivity, paramBundle, paramIUiListener);
}
public int invite(Activity paramActivity, Bundle paramBundle, IUiListener paramIUiListener)
{
new SocialApi(paramActivity, this.a.getQQToken()).invite(paramActivity, paramBundle, paramIUiListener);
return 0;
}
public boolean isReady()
{
return (isSessionValid()) && (getOpenId() != null);
}
public boolean isSessionValid()
{
return this.a.isSessionValid();
}
public boolean isSupportSSOLogin(Activity paramActivity)
{
if (SystemUtils.getAppVersionName(paramActivity, "com.tencent.mobileqq") == null)
{
Toast.makeText(paramActivity, "没有安装手Q", 0).show();
return false;
}
if (SystemUtils.checkMobileQQ(paramActivity))
{
Toast.makeText(paramActivity, "已安装的手Q版本支持SSO登陆", 0).show();
return true;
}
Toast.makeText(paramActivity, "已安装的手Q版本不支持SSO登陆", 0).show();
return false;
}
public int login(Activity paramActivity, String paramString, IUiListener paramIUiListener)
{
return this.a.login(paramActivity, paramString, paramIUiListener);
}
public int loginWithOEM(Activity paramActivity, String paramString1, IUiListener paramIUiListener, String paramString2, String paramString3, String paramString4)
{
return this.a.loginWithOEM(paramActivity, paramString1, paramIUiListener, paramString2, paramString3, paramString4);
}
public void logout(Context paramContext)
{
this.a.getQQToken().setAccessToken(null, "0");
this.a.getQQToken().setOpenId(null);
}
public boolean onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
{
return false;
}
public int reAuth(Activity paramActivity, String paramString, IUiListener paramIUiListener)
{
return this.a.reAuth(paramActivity, paramString, paramIUiListener);
}
public int reactive(Activity paramActivity, Bundle paramBundle, IUiListener paramIUiListener)
{
new SocialApi(paramActivity, this.a.getQQToken()).reactive(paramActivity, paramBundle, paramIUiListener);
return 0;
}
public JSONObject request(String paramString1, Bundle paramBundle, String paramString2)
{
return HttpUtils.request(this.a.getQQToken(), this.b, paramString1, paramBundle, paramString2);
}
public void requestAsync(String paramString1, Bundle paramBundle, String paramString2, IRequestListener paramIRequestListener, Object paramObject)
{
HttpUtils.requestAsync(this.a.getQQToken(), this.b, paramString1, paramBundle, paramString2, paramIRequestListener);
}
public int searchNearby(Activity paramActivity, Bundle paramBundle, IUiListener paramIUiListener)
{
if (this.c == null)
this.c = new LocationApi(paramActivity, this.a.getQQToken());
this.c.searchNearby(paramActivity, paramBundle, paramIUiListener);
return 0;
}
public void setAccessToken(String paramString1, String paramString2)
{
c.a("openSDK_LOG", "setAccessToken(), expiresIn = " + paramString2);
this.a.setAccessToken(paramString1, paramString2);
}
public void setAvatar(Activity paramActivity, Bundle paramBundle, IUiListener paramIUiListener)
{
String str = paramBundle.getString("picture");
int i = paramBundle.getInt("exitAnim");
new QQAvatar(this.b, this.a.getQQToken()).setAvatar(paramActivity, Uri.parse(str), paramIUiListener, i);
}
public void setAvatar(Activity paramActivity, Bundle paramBundle, IUiListener paramIUiListener, int paramInt1, int paramInt2)
{
paramBundle.putInt("exitAnim", paramInt2);
paramActivity.overridePendingTransition(paramInt1, 0);
setAvatar(paramActivity, paramBundle, paramIUiListener);
}
public void setOpenId(String paramString)
{
c.a("openSDK_LOG", "setOpenId() --start");
this.a.setOpenId(this.b, paramString);
c.a("openSDK_LOG", "setOpenId() --end");
}
public void shareToQQ(Activity paramActivity, Bundle paramBundle, IUiListener paramIUiListener)
{
new QQShare(paramActivity, this.a.getQQToken()).shareToQQ(paramActivity, paramBundle, paramIUiListener);
}
public void shareToQzone(Activity paramActivity, Bundle paramBundle, IUiListener paramIUiListener)
{
new QzoneShare(paramActivity, this.a.getQQToken()).shareToQzone(paramActivity, paramBundle, paramIUiListener);
}
public void showTaskGuideWindow(Activity paramActivity, Bundle paramBundle, IUiListener paramIUiListener)
{
new TaskGuide(paramActivity, this.a.getQQToken()).showTaskGuideWindow(paramActivity, paramBundle, paramIUiListener);
}
public int story(Activity paramActivity, Bundle paramBundle, IUiListener paramIUiListener)
{
new SocialApi(paramActivity, this.a.getQQToken()).story(paramActivity, paramBundle, paramIUiListener);
return 0;
}
public void voice(Activity paramActivity, Bundle paramBundle, IUiListener paramIUiListener)
{
new SocialApi(paramActivity, this.a.getQQToken()).voice(paramActivity, paramBundle, paramIUiListener);
}
}
/* Location: C:\Users\Fernando\Desktop\Mibandesv2.3\classes-dex2jar.jar
* Qualified Name: com.tencent.tauth.Tencent
* JD-Core Version: 0.6.2
*/ | [
"[email protected]"
] | |
9966f01d2117024106c3ada3e8e4a084eb17ed72 | 3fdf2d22d6019921998053b6a7a9736ede2cc3c9 | /Programming/Semester 2 CS142/Lab 4/Lab4_Question1.java | 86af56c97b7442f674399647346f02253553aa9a | [] | no_license | keeffy96/College-14-16 | d5c2ec48e744302b89fb3083aaf9d2edbf5964b1 | 5974bfc9f1a0545f7bd14cd78aaa4623db76aede | refs/heads/master | 2020-05-29T08:53:00.423144 | 2016-09-29T16:50:27 | 2016-09-29T16:50:27 | 69,584,746 | 0 | 0 | null | null | null | null | WINDOWS-1250 | Java | false | false | 1,105 | java | /*Write a Java method called detectDuplicateLetter() that takes in a String as its only parameter.
*Your method should print the message “Duplicate letter found” only if any of the letters in the String are repeated.
*Otherwise your method should not print any message.
*/
import java.util.Scanner;
public class Lab4_Question1
{
public static void main (String args[])
{
Scanner scan = new Scanner(System.in);
System.out.println("Please enter a string: ");
//call the method and get it to check the users input
detectDuplicateLetter(scan.nextLine());
}
public static void detectDuplicateLetter(String word)
{
//i represents current letter to be checked
for(int i=0;i<word.length()-1;i++)
{
//j runs through every other letter except the ones already checked and compares them to i
for(int j=i+1;j<word.length();j++)
{
//comparing the letter at i with the other letters
if(word.charAt(i)==word.charAt(j))
{
System.out.println("Duplicate letter found.");
j=word.length();//ends inner loop
i=word.length();//ends outer loop
}
}
}
}
} | [
"[email protected]"
] | |
8304eab3b622890cc2020c93f36f8f622888ad37 | 124ec22771f79f0d245bda39d253e492118ecaa9 | /src/main/java/org/camunda/cockpit/plugin/statistics/db/IncidentInstanceCountDto.java | 2ec9495b8a5a4dd0ed655894d73f85088851d101 | [
"Apache-2.0"
] | permissive | entfrickler/camunda-cockpit-plugin-statistics | cc37c2feed13849e09532d971eb0ec4c59325fe3 | 52577b0b9f49c84d02c38a1731da0e5353ac5a33 | refs/heads/master | 2021-01-18T18:46:28.917853 | 2014-09-18T14:22:39 | 2014-09-18T14:22:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,337 | java | package org.camunda.cockpit.plugin.statistics.db;
import java.util.Date;
public class IncidentInstanceCountDto {
private String incidentMsg;
private int messageCount;
private String incidentType;
private String activityId;
private String processKey;
private String processName;
private Date createTime;
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getIncidentMsg() {
return incidentMsg;
}
public void setIncidentMsg(String incidentMsg) {
this.incidentMsg = incidentMsg;
}
public int getMessageCount() {
return messageCount;
}
public void setMessageCount(int messageCount) {
this.messageCount = messageCount;
}
public String getIncidentType() {
return incidentType;
}
public void setIncidentType(String incidentType) {
this.incidentType = incidentType;
}
public String getActivityId() {
return activityId;
}
public void setActivityId(String activityId) {
this.activityId = activityId;
}
public String getProcessKey() {
return processKey;
}
public void setProcessKey(String processKey) {
this.processKey = processKey;
}
public String getProcessName() {
return processName;
}
public void setProcessName(String processName) {
this.processName = processName;
}
}
| [
"[email protected]"
] | |
112f502625a6c5c3b44db9b0a1cb2b331f8149bc | 9fd5d240e3940a600aaa91a3436357a32db532ab | /lu-utils/src/main/java/com/benchu/lu/utils/StringUtils.java | fd48fdea60bbcb81ff0a7398b9f484a0357a9bd9 | [] | no_license | wangshihu/lugi | 1843b90cd265449bb0b3f85c704c69e018db470a | aa919d1f133951fbbf83597116da53766d715ecd | refs/heads/master | 2021-01-12T06:51:04.769180 | 2017-04-13T03:54:48 | 2017-04-13T03:54:48 | 76,841,164 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 207 | java | package com.benchu.lu.utils;
/**
* @author benchu
* @version 2017/3/10.
*/
public class StringUtils {
public static boolean isEmpty(String str) {
return str == null || str.isEmpty();
}
}
| [
"[email protected]"
] | |
4dbd5e3d810bece38281918e1bd1b00fb3c519a0 | 2851c7cb17933ca75d7eb1b43cc4d93f104fbc3c | /SalesTool/src/ca/demo/salestool/Main.java | 5686572cb179200c5ea2fceb1cb15858185fee22 | [] | no_license | kunalsbhere/Sales-Tool | 85ef3ac90f85576d72283dcb77c3a7f68beb6d34 | 597d1b7efcffc2594c8026a8cb479c4cbfa23d96 | refs/heads/master | 2020-06-17T23:19:22.400604 | 2016-11-28T10:57:24 | 2016-11-28T10:57:24 | 74,956,955 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 367 | java | package ca.demo.salestool;
public class Main {
public static void main(String[] args) {
SalesData data= new SalesData();
displayGreeting();
data.display();
}
public static void displayGreeting(){
System.out.println("Hello Happy Sales People!");
System.out.println("This app has sales data");
System.out.println("modified");
}
}
| [
"[email protected]"
] | |
f5bfb158394d7f6ee50af5c29ba219450eccdb1b | b66a1d6ccbd16a2d57baa9a16d14c25f62929d20 | /src/java/Hibernate/ProductHibDAO.java | 47eac5ab9b11610e8520eda42d10b5d0cc9c2030 | [] | no_license | myothuzarwin/CameraOnlineShopping | e74b0fbd717a1d8dd11d8f5c3f636f4f30b6402f | c1ca85ad0fc96e9442c350473b977a81bcaf78c9 | refs/heads/master | 2021-01-15T15:06:02.685783 | 2017-08-08T14:59:22 | 2017-08-08T14:59:22 | 99,703,061 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,676 | 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 Hibernate;
import EntityCollection.ProductEntity;
import EntityCollection.ReviewEntity;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import myApp.HibernateUtil;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
/**
*
* @author myothuzar
*/
public class ProductHibDAO {
// List<ProductEntity> results;
public ProductHibDAO() {
}
/* public ArrayList<ProductEntity> Checkcategory(int cid) {
ArrayList<ProductEntity> results = new ArrayList<ProductEntity>();
try {
String sql = " SELECT product.pname,product.description,product.price,product.photopath,product.pid,product.qty "
+ " FROM onlineshopping.category,onlineshopping.product WHERE category.cid=product.cid and category.cid= " + cid + " ";
ResultSet rs = null;
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
while (rs.next()) {
ProductEntity result1 = new ProductEntity();
result1.setProductname(rs.getString("pname"));
result1.setDescription(rs.getString("description"));
result1.setPrice(rs.getDouble("price"));
result1.setPhotopath(rs.getString("photopath"));
result1.setProductid(rs.getInt("pid"));
result1.setQty(rs.getInt("qty"));
results.add(result1);
}
} catch (Exception ex) {
System.err.println(ex.getMessage());
}
return results;
}
*/
public List<ProductEntity> ShowAllProduct() {
List<ProductEntity> results;
Session session = HibernateUtil.getSession();
try {
results = session.createQuery("from ProductEntity").list();
return results;
}
catch (Exception e) {
System.out.print("Error while fetching " + e);
return null;
} finally {
session.close();
}
}
public ProductEntity ShowDetail(int productid) {
ProductEntity result = new ProductEntity();
Session session = HibernateUtil.getSession();
try {
String hql = "FROM ProductEntity P WHERE P.productid=:productid";
Query query = session.createQuery(hql);
query.setParameter("productid", productid);
result = (ProductEntity) query.uniqueResult();
}catch (Exception e) {
System.out.print("Error while fetching " + e);
return null;
} finally {
session.close();
}
return result;
}
/**
public int InsertComment(ReviewEntity review) {
int rateID = 0;
Session session = HibernateUtil.getSession();
Transaction tx = null;
try {
tx = session.beginTransaction();
rateID = (Integer) session.save(review);
tx.commit();
} catch (RuntimeException e) {
System.out.println(e.getMessage() + " " + e.getStackTrace());
if (tx != null) {
tx.rollback();
}
throw e;
} finally {
session.close();
}
return rateID;
}
**/
}
| [
"[email protected]"
] | |
4ff4c3e7d3d68c94536f0da9b587733289bfe1c6 | 2c5c366d3e1c33745abef1fa4b43349324a12fc2 | /src/com/jmk/wk5/abstract_factory/ThinCrustDough.java | 7f83f60c2c769ea38a6519d74071ee32b5d53c18 | [] | no_license | LunaticSeeker/Java2 | 145df3ec59e52eabeb711436d58a162723d56e77 | 8a412788e3c875dc290993c91a79bf1a39b64504 | refs/heads/master | 2021-03-12T20:24:42.769817 | 2015-12-03T01:06:29 | 2015-12-03T01:06:29 | 41,780,387 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 221 | java | package com.jmk.wk5.abstract_factory;
public class ThinCrustDough implements Dough {
String dough;
public ThinCrustDough() {
dough = "Thin Crust Dough";
}
public String getIngredient() {
return dough;
}
}
| [
"[email protected]"
] | |
931604c04697a8d450e9a0863deee63fe87ef2a2 | 92050c639cf84b6fada08ecfc1ab831a3b1ee3df | /src/adroitschools/setup/ProgrameLevelsAndPeriodsController.java | c2d694759eb1b483ae72e540ca30e862018ae876 | [] | no_license | Dandikairos/AdroitSchools | c378cdb49d9071fb5abc528413b954934d6d66c5 | 4a9cf9197caa6fb491c1bf475a26c2ae3c6d5beb | refs/heads/master | 2022-12-14T16:38:17.218055 | 2018-02-17T08:51:02 | 2018-02-17T08:51:02 | 106,653,180 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,244 | 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 adroitschools.setup;
import com.jfoenix.controls.JFXButton;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Scene;
import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
/**
* FXML Controller class
*
* @author Okello
*/
public class ProgrameLevelsAndPeriodsController implements Initializable {
@FXML
private AnchorPane programmeLevelsAndPeriods;
@FXML
private JFXButton newClass;
@FXML
private TextField search;
@FXML
private JFXButton awards;
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
}
@FXML
private void createNewStudyLevel(ActionEvent event) {
try {
AnchorPane root = FXMLLoader.load(getClass().getResource("ProgrameLevelAndPeriodCard.fxml"));
Scene scene = new Scene(root);
Stage stage = new Stage();
stage.setMaximized(true);
stage.setScene(scene);
stage.show();
} catch (IOException ex) {
Logger.getLogger(UsersController.class.getName()).log(Level.SEVERE, null, ex);
}
}
@FXML
private void gotoAwards(ActionEvent event) {
try {
AnchorPane root = FXMLLoader.load(getClass().getResource("Awards.fxml"));
Scene scene = new Scene(root);
Stage stage = new Stage();
stage.setTitle("Awards");
stage.setMaximized(true);
stage.setScene(scene);
stage.show();
} catch (IOException ex) {
Logger.getLogger(UsersController.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
| [
"[email protected]"
] | |
8070456e1fa73d0ebad29bcec4b204487878d3f8 | edafb96741ddcb3fb41a9820c6d76eb65ecc8ba6 | /src/Petugas.java | 4d54c299f19d27cf672d45adb7a5a49907a268f9 | [] | no_license | Redha-ftr/Projek-Aplikasi-Vibrary | ad05c4e6604f9f470d5c8d3e5eaf49bae29ee2b3 | 97b32d2a8919196a221b8bda153188840d8302b1 | refs/heads/main | 2023-07-04T00:45:56.569342 | 2021-07-29T06:50:33 | 2021-07-29T06:50:33 | 369,170,781 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,412 | 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.
*/
/**
*
* @author EED
*/
public class Petugas {
private String id;
private String nama;
private String alamat;
private String jk;
private int notelp;
private int nik;
private String password;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getNama() {
return nama;
}
public void setNama(String nama) {
this.nama = nama;
}
public String getAlamat() {
return alamat;
}
public void setAlamat(String alamat) {
this.alamat = alamat;
}
public String getJk() {
return jk;
}
public void setJk(String jk) {
this.jk = jk;
}
public int getNotelp() {
return notelp;
}
public void setNotelp(int notelp) {
this.notelp = notelp;
}
public int getNik() {
return nik;
}
public void setNik(int nik) {
this.nik = nik;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
| [
"[email protected]"
] | |
c77b0cd67408a09c974ce21ef762355af5db4f5c | 9a05e3143becb98cecb5223217d95dbc2b61b21a | /app/src/main/java/com/iigo/keystore/KeyStoreUtil.java | 413104181a876b27c50b45c77e3b940259ad5abc | [] | no_license | zhengsen/KeyStore | 84f1f6fc09c385019f2d2813bf385f153d1178d7 | 321d2e1455f09f229908a9a897b297e208eadb86 | refs/heads/master | 2020-08-11T13:00:06.220338 | 2018-08-09T04:02:34 | 2018-08-09T04:02:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,978 | java | package com.iigo.keystore;
import android.content.Context;
import android.security.KeyPairGeneratorSpec;
import android.text.TextUtils;
import java.io.IOException;
import java.math.BigInteger;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.PrivateKey;
import java.security.Signature;
import java.security.SignatureException;
import java.security.UnrecoverableEntryException;
import java.security.cert.CertificateException;
import java.security.interfaces.RSAPublicKey;
import java.util.Calendar;
import java.util.Enumeration;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.security.auth.x500.X500Principal;
/**
* @author SamLeung
* @Emial [email protected]
* @date 2018/6/14 0014 12:15
*/
public class KeyStoreUtil {
private static KeyStoreUtil INSTANCE;
private static Object LOCK = new Object();
private KeyStore keyStore;
private X500Principal x500Principal; //自签署证书
private static final String CIPHER_TRANSFORMATION = "RSA/ECB/PKCS1Padding";
private KeyStoreUtil(){
init();
}
private void init() {
try {
keyStore = KeyStore.getInstance("AndroidKeyStore");
keyStore.load(null);
/**
* CN commonName
* O organizationName
* OU organizationalUnitName
* C countryName
* */
x500Principal = new X500Principal("CN=Duke, OU=JavaSoft, O=Sun Microsystems, C=US");
} catch (KeyStoreException e) {
e.printStackTrace();
} catch (CertificateException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public static KeyStoreUtil get(){
if (INSTANCE == null){
synchronized (LOCK){
if (INSTANCE == null){
INSTANCE = new KeyStoreUtil();
}
}
}
return INSTANCE;
}
/**
* 获取当前应用密钥库中的条目
*
* @return
* */
public Enumeration<String> getAliases(){
if (keyStore == null) {
return null;
}
try {
return keyStore.aliases();
} catch (KeyStoreException e) {
e.printStackTrace();
}
return null;
}
/**
* 先判断是否存在该别名
* */
public boolean containsAlias(String alias) {
if (keyStore == null || TextUtils.isEmpty(alias)){
return false;
}
boolean contains = false;
try{
contains = keyStore.containsAlias(alias);
}catch (Exception e){
e.printStackTrace();
}
return contains;
}
/**
* 生成新的密钥
*
* @param context
* @param alias 存储在KeyStore中的别名
* */
public KeyPair generateKey(Context context, String alias){
if (containsAlias(alias)){
return null;
}
try {
Calendar endDate = Calendar.getInstance();
endDate.add(Calendar.YEAR, 10);
KeyPairGeneratorSpec spec = new KeyPairGeneratorSpec.Builder(context.getApplicationContext())
.setAlias(alias)
.setSubject(x500Principal)
.setSerialNumber(BigInteger.ONE)
.setStartDate(Calendar.getInstance().getTime())
.setEndDate(endDate.getTime())
.build();
KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA", "AndroidKeyStore");
generator.initialize(spec);
return generator.generateKeyPair();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (NoSuchProviderException e) {
e.printStackTrace();
} catch (InvalidAlgorithmParameterException e) {
e.printStackTrace();
} catch (NullPointerException e){
e.printStackTrace();
}
return null;
}
public void deleteKey(final String alias){
try{
keyStore.deleteEntry(alias);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 加密
*
* @param data 要加密的数据
* @param alias KeyStore中的别名
* */
public byte[] encrypt(byte[] data, String alias){
try {
//取出密钥
KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry)keyStore.getEntry(alias, null);
RSAPublicKey publicKey = (RSAPublicKey) privateKeyEntry.getCertificate().getPublicKey();
Cipher cipher = Cipher.getInstance(CIPHER_TRANSFORMATION);
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
return cipher.doFinal(data);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (UnrecoverableEntryException e) {
e.printStackTrace();
} catch (NoSuchPaddingException e) {
e.printStackTrace();
} catch (KeyStoreException e) {
e.printStackTrace();
} catch (BadPaddingException e) {
e.printStackTrace();
} catch (IllegalBlockSizeException e) {
e.printStackTrace();
}
return null;
}
/**
* 解密
*
* @param data 要解密的数据
* @param alias KeyStore中的别名
* */
public byte[] decrypt(byte[] data, String alias){
try {
//取出密钥
KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry)keyStore.getEntry(alias, null);
PrivateKey privateKey = privateKeyEntry.getPrivateKey();
Cipher cipher = Cipher.getInstance(CIPHER_TRANSFORMATION);
cipher.init(Cipher.DECRYPT_MODE, privateKey);
return cipher.doFinal(data);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (UnrecoverableEntryException e) {
e.printStackTrace();
} catch (NoSuchPaddingException e) {
e.printStackTrace();
} catch (KeyStoreException e) {
e.printStackTrace();
} catch (BadPaddingException e) {
e.printStackTrace();
} catch (IllegalBlockSizeException e) {
e.printStackTrace();
}
return null;
}
/**
* 对数据进行签名
*
* @param data
* @param alias
* */
public byte[] sign(byte[] data, String alias){
try{
//取出密钥
KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry)keyStore.getEntry(alias, null);
Signature s = Signature.getInstance("SHA1withRSA");
s.initSign(privateKeyEntry.getPrivateKey());
s.update(data);
return s.sign();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (KeyStoreException e) {
e.printStackTrace();
} catch (UnrecoverableEntryException e) {
e.printStackTrace();
} catch (SignatureException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
}
return null;
}
/**
* 验证数据签名
*
* @param data 原始数据
* @param signatureData 签署的数据
* @param alias
* */
public boolean verify (byte[] data, byte[] signatureData, String alias){
try{
//取出密钥
KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry)keyStore.getEntry(alias, null);
Signature s = Signature.getInstance("SHA1withRSA");
s.initVerify(privateKeyEntry.getCertificate());
s.update(data);
return s.verify(signatureData);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (SignatureException e) {
e.printStackTrace();
} catch (UnrecoverableEntryException e) {
e.printStackTrace();
} catch (KeyStoreException e) {
e.printStackTrace();
}
return false;
}
}
| [
"[email protected]"
] | |
b3c34d94360475a32af614d4841c9ead76f30d38 | 730d0e683845e261b14691f5a3c733a3f0cd4816 | /javaBasic/src/stream/FilteringExample.java | 3e2fedb1e90bd933c9121c37489f006426052cff | [] | no_license | JoongSeokD/javaBasic | 542e1f6e215b295f7f467550d9578bb61b3f6b87 | adab1515cd5f5fe095a14d2e056bcafc9d235294 | refs/heads/master | 2020-11-24T06:46:09.802114 | 2019-12-23T10:31:33 | 2019-12-23T10:31:33 | 228,015,343 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 668 | java | package stream;
import java.util.Arrays;
import java.util.List;
public class FilteringExample {
public static void main(String[] args) {
List<String> names = Arrays.asList("홍길동", "일지매", "강감찬", "강소라", "홍예몽", "일수", "홍길동");
// 중복제거
names.stream()
.distinct()
.forEach(n -> System.out.println(n));
System.out.println();
// 필터링
names.stream()
.filter( n -> n.startsWith("홍"))
.forEach( n-> System.out.println(n));
System.out.println();
// 중복 제거 후 필터링
names.stream()
.distinct()
.filter( n-> n.startsWith("홍"))
.forEach(System.out::println);
}
}
| [
"[email protected]"
] | |
17ca371dfe19d43334e138ef3d89a41f772b4638 | 59eec811a28ba89810b53a64151c269252f193e6 | /src/main/java/com/example/demo/entity/Customer.java | 5200f840ef2423624fda9d3cefeee40dfcef9cb8 | [] | no_license | Jhon-20/Customer | 1c22f7711d12efdf503b76a8c0f107fe9f04b5d8 | a840612b0508ae5bfd9c5c0c2b80051819453737 | refs/heads/main | 2023-06-05T07:35:25.110968 | 2021-06-19T01:02:50 | 2021-06-19T01:02:50 | 377,957,343 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 418 | java | package com.example.demo.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor @NoArgsConstructor @Builder
public class Customer {
private Long id;
private String numberId;
private String firstName;
private String lasName;
private String email;
private String phtoUrl;
private Region region;
private String state;
}
| [
"[email protected]"
] | |
e593efbcb53ff0f8726de1d0a9d61310cb1ab278 | 0cc3358e3e8f81b854f9409d703724f0f5ea2ff7 | /src/za/co/mmagon/jwebswing/plugins/jqxwidgets/listmenu/JQXListMenuChildren.java | fe27e38b9a9eb5d46844f26e9482f5cc638c63ac | [] | no_license | jsdelivrbot/JWebMP-CompleteFree | c229dd405fe44d6c29ab06eedaecb7a733cbb183 | d5f020a19165418eb21507204743e596bee2c011 | refs/heads/master | 2020-04-10T15:12:35.635284 | 2018-12-10T01:03:58 | 2018-12-10T01:03:58 | 161,101,028 | 0 | 0 | null | 2018-12-10T01:45:25 | 2018-12-10T01:45:25 | null | UTF-8 | Java | false | false | 954 | java | /*
* Copyright (C) 2017 Marc Magon
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package za.co.mmagon.jwebswing.plugins.jqxwidgets.listmenu;
import za.co.mmagon.jwebswing.base.html.interfaces.GlobalChildren;
/**
*
* @author Marc Magon
* @since 07 Aug 2015
* @version 1.0
*/
public interface JQXListMenuChildren extends GlobalChildren
{
}
| [
"[email protected]"
] | |
694a81e2f0ff8bfb367042a67e354376c4957a05 | d2ca05ccd25740492212b0292c856d8c415491e8 | /TeamCode/src/main/java/org/firstinspires/ftc/teamcode/roadRunnerTuner/drive/opmode/BackAndForth.java | 406ff5557a66475fadbf9418d27e4ebf03cca05c | [
"BSD-3-Clause"
] | permissive | NicholasLee76/roboGray2020 | 60558a80cc0d44334f4aef5d2cc0da26c5b624d2 | ad239a75294894962d10c79cd96d1018f61f3cee | refs/heads/master | 2023-05-04T21:45:28.326157 | 2021-05-28T17:14:07 | 2021-05-28T17:14:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,498 | java | package org.firstinspires.ftc.teamcode.roadRunnerTuner.drive.opmode;
import com.acmerobotics.dashboard.config.Config;
import com.acmerobotics.roadrunner.geometry.Pose2d;
import com.acmerobotics.roadrunner.trajectory.Trajectory;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import org.firstinspires.ftc.teamcode.roadRunnerTuner.drive.SampleMecanumDrive;
/*
* Op mode for preliminary tuning of the follower PID coefficients (located in the drive base
* classes). The robot drives back and forth in a straight line indefinitely. Utilization of the
* dashboard is recommended for this tuning routine. To access the dashboard, connect your computer
* to the RC's WiFi network. In your browser, navigate to https://192.168.49.1:8080/dash if you're
* using the RC phone or https://192.168.43.1:8080/dash if you are using the Control Hub. Once
* you've successfully connected, start the program, and your robot will begin moving forward and
* backward. You should observe the target position (green) and your pose estimate (blue) and adjust
* your follower PID coefficients such that you follow the target position as accurately as possible.
* If you are using SampleMecanumDrive, you should be tuning TRANSLATIONAL_PID and HEADING_PID.
* If you are using SampleTankDrive, you should be tuning AXIAL_PID, CROSS_TRACK_PID, and HEADING_PID.
* These coefficients can be tuned live in dashboard.
*
* This opmode is designed as a convenient, coarse tuning for the follower PID coefficients. It
* is recommended that you use the FollowerPIDTuner opmode for further fine tuning.
*/
@Config
@Autonomous(group = "drive")
@Disabled
public class BackAndForth extends LinearOpMode {
public static double DISTANCE = 50;
@Override
public void runOpMode() throws InterruptedException {
SampleMecanumDrive drive = new SampleMecanumDrive(hardwareMap);
Trajectory trajectoryForward = drive.trajectoryBuilder(new Pose2d())
.forward(DISTANCE)
.build();
Trajectory trajectoryBackward = drive.trajectoryBuilder(trajectoryForward.end())
.back(DISTANCE)
.build();
waitForStart();
while (opModeIsActive() && !isStopRequested()) {
drive.followTrajectory(trajectoryForward);
drive.followTrajectory(trajectoryBackward);
}
}
}
| [
"[email protected]"
] | |
e1fd5a1c8bc35fe5a5a1ff7966c5b04e46be3283 | 7ebbb0b7b348f80abb1d4eb0f5bbe5b5b1fbb19e | /src/main/java/com/wzw/tomcat/Request.java | 06dbdc77f6e23ea33804c83456dfed4c3e1ff469 | [] | no_license | wzw197749957/tomcat | 9dcf4dceceedbaff82a82829106c66824a0c8bee | fb4f5c716ec16d8152e2e69bae624cc5a5eeb46a | refs/heads/master | 2022-12-28T14:51:21.284785 | 2020-10-16T09:42:20 | 2020-10-16T09:42:20 | 302,505,368 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,230 | java | package com.wzw.tomcat;
import com.wzw.tomcat.container.Context;
import java.io.IOException;
import java.io.InputStream;
public class Request {
private String url; //请求路径
private String method; //请求方法GET,POST
private String host; //请求的主机名称
private String contextName; //请求上下文名称
private String port;
private Context context;
private InputStream inputStream; // 输入流,其他属性从输入流中解析出来
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public String getContextName() {
return contextName;
}
public void setContextName(String contextName) {
this.contextName = contextName;
}
public String getPort() {
return port;
}
public void setPort(String port) {
this.port = port;
}
public Context getContext() {
return context;
}
public void setContext(Context context) {
this.context = context;
}
public InputStream getInputStream() {
return inputStream;
}
public void setInputStream(InputStream inputStream) {
this.inputStream = inputStream;
}
// 构造器,输入流传入
public Request(InputStream inputStream) throws IOException {
this.inputStream = inputStream;
int count = 0;
while (count == 0) {
count = this.inputStream.available();
}
byte[] bytes = new byte[count];
inputStream.read(bytes);
String instr = new String(bytes);
String[] split = instr.split("\n");
String firstLine = split[0];
String[] s = firstLine.split(" ");
String secLine = split[1];
String[] s1 = secLine.split(" ");
this.method = s[0];
this.url = s[1];
String[] split1 = s1[1].split(":");
this.host = split1[0];
}
}
| [
"[email protected]"
] | |
d254590067638e7620fa4e8933a5b9c5f456aa9d | 5979db5cdaf9c0e9268b09cc2e62c509bb538a00 | /app/src/main/java/com/fragmentdemo2/MainActivity.java | 270e2b37cb86810d0beb7a12c754bb276b6484db | [] | no_license | SandeepKaur1520/FragmentDemo2 | 414785593652c10a98f52a31fcda255cab45fb27 | f5bd8aa09ce526daae78ab82303eb047591668a0 | refs/heads/master | 2020-06-07T14:38:36.342720 | 2019-06-21T06:23:22 | 2019-06-21T06:23:22 | 193,042,638 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 673 | java | package com.fragmentdemo2;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends AppCompatActivity {
Fragment fragment1=new NewFragment();
Fragment getFragment2=new SecondFragment();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void Fragment1(View view){
getSupportFragmentManager().beginTransaction().replace(R.id.fragment1,fragment1).commit();
}
public void myClick(View view) {
}
}
| [
"[email protected]"
] | |
84542fdd7c80c83121ccaa2609ba88e8a95d091d | e002f72866a065eda7f850a1b2b76fdbfc2acebe | /akka/akka-quick-start/src/main/java/com/coolbeevip/akka/quickstart/protocols/entity/Visitor.java | 635ff58701c7fe0e8c5db0cbd5cc858948a4e108 | [] | no_license | fossabot/tutorials | d72f6a5e58febc74af3b77327fcd317c74928331 | 7bff28929e3e7a2b4ef282857b2f621c3dcef120 | refs/heads/master | 2023-07-15T09:39:53.630641 | 2021-08-25T04:27:21 | 2021-08-25T04:27:21 | 399,688,838 | 0 | 0 | null | 2021-08-25T04:27:16 | 2021-08-25T04:27:16 | null | UTF-8 | Java | false | false | 482 | java | package com.coolbeevip.akka.quickstart.protocols.entity;
import java.util.UUID;
/**
* 访客
* @author zhanglei
*/
public class Visitor {
public UUID id;
public String name;
public VisitorGender gender;
public Visitor(UUID id, String name, VisitorGender gender) {
this.id = id;
this.name = name;
this.gender = gender;
}
public String getTitle() {
return String.format("%s %s", this.gender == VisitorGender.male ? "Mr." : "Ms.", this.name);
}
}
| [
"[email protected]"
] | |
c5d495f8aaec11f21c602c781b4fde479debae71 | 321c932f3d260a1a328a3a6aebeba09e44ab5cb1 | /VideoPool.java | 572b1492d135b84e4a0119e06d1f4a5b23c8dca5 | [] | no_license | thecitycoder/GoogleHashCode_2017 | 199a6c19de651b27d895313e40a535077148ab6e | 308250661ec23a4a5eeecca0a38685352d367b94 | refs/heads/master | 2020-04-06T04:01:50.722292 | 2017-02-24T18:33:07 | 2017-02-24T18:33:07 | 83,071,131 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 107 | java | import java.util.ArrayList;
public class VideoPool {
ArrayList<Video> videos = new ArrayList<>();
}
| [
"[email protected]"
] | |
e18f66ff26d5a6321d3a4ee4a7e4965118c552aa | 9da7fd37062cfb35873f762e3e0e933fffc9f3d5 | /resources/sphinx4-0.1alpha/edu/cmu/sphinx/decoder/search/SimpleBreadthFirstSearchManager.java | 320315ce271d24404fb1503b0a3163ba81b6283a | [
"BSD-2-Clause"
] | permissive | oasysokubo/VoiceRec | f7e45fc90610791013e5153ba5715ad68d552546 | 26566fe84413546b69db38d2a3027eb56a55c332 | refs/heads/master | 2020-04-17T05:54:27.183997 | 2019-01-17T22:08:15 | 2019-01-17T22:08:15 | 166,303,166 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,965 | java | /*
* Copyright 1999-2002 Carnegie Mellon University.
* Portions Copyright 2002 Sun Microsystems, Inc.
* Portions Copyright 2002 Mitsubishi Electric Research Laboratories.
* All Rights Reserved. Use is subject to license terms.
*
* See the file "license.terms" for information on usage and
* redistribution of this file, and for a DISCLAIMER OF ALL
* WARRANTIES.
*
*/
package edu.cmu.sphinx.decoder.search;
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import edu.cmu.sphinx.decoder.pruner.Pruner;
import edu.cmu.sphinx.decoder.scorer.AcousticScorer;
import edu.cmu.sphinx.linguist.Linguist;
import edu.cmu.sphinx.linguist.SearchState;
import edu.cmu.sphinx.linguist.SearchStateArc;
import edu.cmu.sphinx.linguist.WordSearchState;
import edu.cmu.sphinx.result.Result;
import edu.cmu.sphinx.util.LogMath;
import edu.cmu.sphinx.util.StatisticsVariable;
import edu.cmu.sphinx.util.Timer;
import edu.cmu.sphinx.util.props.PropertyException;
import edu.cmu.sphinx.util.props.PropertySheet;
import edu.cmu.sphinx.util.props.PropertyType;
import edu.cmu.sphinx.util.props.Registry;
/**
* Provides the breadth first search. To perform recognition an application
* should call initialize before recognition begins, and repeatedly call <code> recognize </code>
* until Result.isFinal() returns true. Once a final result has been obtained,
* <code> terminate </code> should be called.
*
* All scores and probabilities are maintained in the log math log domain.
*/
// TODO - need to add in timing code.
public class SimpleBreadthFirstSearchManager implements SearchManager {
/**
* Sphinx property that defines the name of the linguist to be used by this
* search manager.
*/
public final static String PROP_LINGUIST = "linguist";
/**
* Sphinx property that defines the name of the linguist to be used by this
* search manager.
*/
public final static String PROP_PRUNER = "pruner";
/**
* Sphinx property that defines the name of the scorer to be used by this
* search manager.
*/
public final static String PROP_SCORER = "scorer";
/**
* Sphinx property that defines the name of the logmath to be used by this
* search manager.
*/
public final static String PROP_LOG_MATH = "logMath";
/**
* Sphinx property that defines the name of the active list factory to be
* used by this search manager.
*/
public final static String PROP_ACTIVE_LIST_FACTORY = "activeListFactory";
/**
* A sphinx property than, when set to <code>true</code> will cause the
* recognizer to count up all the tokens in the active list after every
* frame.
*/
public final static String PROP_SHOW_TOKEN_COUNT = "showTokenCount";
/**
* The default value for the PROP_SHOW_TOKEN_COUNT property
*/
public final static boolean PROP_SHOW_TOKEN_COUNT_DEFAULT = false;
/**
* Property that sets the minimum score relative to the maximum score in
* the word list for pruning. Words with a score less than
* relativeBeamWidth * maximumScore will be pruned from the list
*/
public final static String PROP_RELATIVE_WORD_BEAM_WIDTH = "relativeWordBeamWidth";
/**
* The default value for the PROP_RELATIVE_WORD_BEAM_WIDTH property
*/
public final static double PROP_RELATIVE_WORD_BEAM_WIDTH_DEFAULT = 0.0;
/**
* A sphinx property that controls whether or not relative beam pruning
* will be performed on the entry into a state.
*/
public final static String PROP_WANT_ENTRY_PRUNING = "wantEntryPruning";
/**
* The default value for the PROP_WANT_ENTRY_PRUNING property
*/
public final static boolean PROP_WANT_ENTRY_PRUNING_DEFAULT = false;
/**
* A sphinx property that controls the number of frames processed for every
* time the decode growth step is skipped. Setting this property to zero
* disables grow skipping. Setting this number to a small integer will
* increase the speed of the decoder but will also decrease its accuracy.
* The higher the number, the less often the grow code is skipped.
*/
public final static String PROP_GROW_SKIP_INTERVAL = "growSkipInterval";
/**
* The default value for the PROP_GROW_SKIP_INTERVAL property.
*/
public final static int PROP_GROW_SKIP_INTERVAL_DEFAULT = 0;
private Linguist linguist; // Provides grammar/language info
private Pruner pruner; // used to prune the active list
private AcousticScorer scorer; // used to score the active list
private int currentFrameNumber; // the current frame number
private ActiveList activeList; // the list of active tokens
private List resultList; // the current set of results
private LogMath logMath;
private Logger logger;
// ------------------------------------
// monitoring data
// ------------------------------------
private Timer scoreTimer; // TODO move these timers out
private Timer pruneTimer;
private Timer growTimer;
private String name;
private StatisticsVariable totalTokensScored;
private StatisticsVariable tokensPerSecond;
private StatisticsVariable curTokensScored;
private StatisticsVariable tokensCreated;
private StatisticsVariable viterbiPruned;
private StatisticsVariable beamPruned;
private StatisticsVariable wordsPruned;
private boolean showTokenCount;
private boolean wantEntryPruning;
private Map bestTokenMap;
private List wordList;
private Map wordMap;
private float logRelativeWordBeamWidth;
private int totalHmms;
private double startTime = 0;
private float threshold;
private float wordThreshold;
private int growSkipInterval = 0;
private ActiveListFactory activeListFactory;
/*
* (non-Javadoc)
*
* @see edu.cmu.sphinx.util.props.Configurable#register(java.lang.String,
* edu.cmu.sphinx.util.props.Registry)
*/
public void register(String name, Registry registry)
throws PropertyException {
this.name = name;
registry.register(PROP_LOG_MATH, PropertyType.COMPONENT);
registry.register(PROP_LINGUIST, PropertyType.COMPONENT);
registry.register(PROP_PRUNER, PropertyType.COMPONENT);
registry.register(PROP_SCORER, PropertyType.COMPONENT);
registry.register(PROP_ACTIVE_LIST_FACTORY, PropertyType.COMPONENT);
registry.register(PROP_SHOW_TOKEN_COUNT, PropertyType.BOOLEAN);
registry.register(PROP_RELATIVE_WORD_BEAM_WIDTH, PropertyType.DOUBLE);
registry.register(PROP_WANT_ENTRY_PRUNING, PropertyType.BOOLEAN);
registry.register(PROP_GROW_SKIP_INTERVAL, PropertyType.INT);
}
/*
* (non-Javadoc)
*
* @see edu.cmu.sphinx.util.props.Configurable#newProperties(edu.cmu.sphinx.util.props.PropertySheet)
*/
public void newProperties(PropertySheet ps) throws PropertyException {
logger = ps.getLogger();
logMath = (LogMath) ps.getComponent(PROP_LOG_MATH, LogMath.class);
linguist = (Linguist) ps.getComponent(PROP_LINGUIST, Linguist.class);
pruner = (Pruner) ps.getComponent(PROP_PRUNER, Pruner.class);
scorer = (AcousticScorer) ps.getComponent(PROP_SCORER,
AcousticScorer.class);
activeListFactory = (ActiveListFactory) ps.getComponent(
PROP_ACTIVE_LIST_FACTORY, ActiveListFactory.class);
showTokenCount = ps.getBoolean(PROP_SHOW_TOKEN_COUNT,
PROP_SHOW_TOKEN_COUNT_DEFAULT);
double relativeWordBeamWidth = ps.getDouble(
PROP_RELATIVE_WORD_BEAM_WIDTH,
PROP_RELATIVE_WORD_BEAM_WIDTH_DEFAULT);
growSkipInterval = ps.getInt(PROP_GROW_SKIP_INTERVAL,
PROP_GROW_SKIP_INTERVAL_DEFAULT);
wantEntryPruning = ps.getBoolean(PROP_WANT_ENTRY_PRUNING,
PROP_WANT_ENTRY_PRUNING_DEFAULT);
logRelativeWordBeamWidth = logMath.linearToLog(relativeWordBeamWidth);
}
/**
* Called at the start of recognition. Gets the search manager ready to
* recognize
*/
public void startRecognition() {
linguist.startRecognition();
pruner.startRecognition();
scorer.startRecognition();
localStart();
if (startTime == 0.0) {
startTime = System.currentTimeMillis();
}
}
/**
* Performs the recognition for the given number of frames.
*
* @param nFrames
* the number of frames to recognize
*
* @return the current result or null if there is no Result (due to the
* lack of frames to recognize)
*/
public Result recognize(int nFrames) {
boolean done = false;
boolean noData = false;
Result result = null;
for (int i = 0; i < nFrames && !done; i++) {
done = recognize();
if (done && currentFrameNumber <= 0) {
noData = true;
}
}
if (!noData) {
result = new Result(activeList, resultList, currentFrameNumber,
done);
}
if (showTokenCount) {
showTokenCount();
}
return result;
}
/**
* Terminates a recognition
*/
public void stopRecognition() {
localStop();
scorer.stopRecognition();
pruner.stopRecognition();
linguist.stopRecognition();
}
/**
* Performs recognition for one frame. Returns true if recognition has been
* completed.
*
* @return <code>true</code> if recognition is completed.
*/
protected boolean recognize() {
boolean more = scoreTokens(); // score emitting tokens
if (more) {
pruneBranches(); // eliminate poor branches
currentFrameNumber++;
if (growSkipInterval == 0
|| (currentFrameNumber % growSkipInterval) != 0) {
growBranches(); // extend remaining branches
}
}
return !more;
}
/**
* Gets the initial grammar node from the linguist and creates a
* GrammarNodeToken
*/
protected void localStart() {
currentFrameNumber = 0;
curTokensScored.value = 0;
ActiveList newActiveList = activeListFactory.newInstance();
SearchState state = linguist.getSearchGraph().getInitialState();
newActiveList.add(new Token(state, currentFrameNumber));
activeList = newActiveList;
growBranches();
}
/**
* Local cleanup for this search manager
*/
protected void localStop() {
}
/**
* Goes through the active list of tokens and expands each token, finding
* the set of successor tokens until all the successor tokens are emitting
* tokens.
*
*/
protected void growBranches() {
int mapSize = activeList.size() * 10;
if (mapSize == 0) {
mapSize = 1;
}
growTimer.start();
bestTokenMap = new HashMap(mapSize);
ActiveList oldActiveList = activeList;
Iterator oldListIterator = activeList.iterator();
resultList = new LinkedList();
activeList = activeListFactory.newInstance();
threshold = oldActiveList.getBeamThreshold();
wordThreshold = oldActiveList.getBestScore() + logRelativeWordBeamWidth;
while (oldListIterator.hasNext()) {
Token token = (Token) oldListIterator.next();
collectSuccessorTokens(token);
}
growTimer.stop();
if (logger.isLoggable(Level.FINE)) {
int hmms = activeList.size();
totalHmms += hmms;
logger.fine("Frame: " + currentFrameNumber + " Hmms: "
+ hmms + " total " + totalHmms);
}
}
/**
* Calculate the acoustic scores for the active list. The active list
* should contain only emitting tokens.
*
* @return <code>true</code> if there are more frames to score,
* otherwise, false
*
*/
protected boolean scoreTokens() {
boolean moreTokens;
Token bestToken = null;
scoreTimer.start();
bestToken = (Token) scorer.calculateScores(activeList.getTokens());
scoreTimer.stop();
moreTokens = (bestToken != null);
activeList.setBestToken(bestToken);
curTokensScored.value += activeList.size();
totalTokensScored.value += activeList.size();
tokensPerSecond.value = totalTokensScored.value / getTotalTime();
if (logger.isLoggable(Level.FINE)) {
logger.fine(currentFrameNumber + " " + activeList.size()
+ " " + curTokensScored.value + " "
+ (int) tokensPerSecond.value);
}
return moreTokens;
}
/**
* Returns the total time since we start4ed
*
* @return the total time (in seconds)
*/
private double getTotalTime() {
return (System.currentTimeMillis() - startTime) / 1000.0;
}
/**
* Removes unpromising branches from the active list
*
*/
protected void pruneBranches() {
int startSize = activeList.size();
pruneTimer.start();
activeList = pruner.prune(activeList);
beamPruned.value += startSize - activeList.size();
pruneTimer.stop();
}
/**
* Gets the best token for this state
*
* @param state
* the state of interest
*
* @return the best token
*/
protected Token getBestToken(SearchState state) {
Token best = (Token) bestTokenMap.get(state);
if (logger.isLoggable(Level.FINER) && best != null) {
logger.finer("BT " + best + " for state " + state);
}
return best;
}
/**
* Sets the best token for a given state
*
* @param token
* the best token
*
* @param state
* the state
*
* @return the previous best token for the given state, or null if no
* previous best token
*/
protected Token setBestToken(Token token, SearchState state) {
return (Token) bestTokenMap.put(state, token);
}
/**
* Collects the next set of emitting tokens from a token and accumulates
* them in the active or result lists
*
* @param token
* the token to collect successors from
*/
protected void collectSuccessorTokens(Token token) {
SearchState state = token.getSearchState();
// If this is a final state, add it to the final list
if (token.isFinal()) {
resultList.add(token);
}
if (token.getScore() < threshold) {
return;
}
if (state instanceof WordSearchState
&& token.getScore() < wordThreshold) {
return;
}
SearchStateArc[] arcs = state.getSuccessors();
// For each successor
// calculate the entry score for the token based upon the
// predecessor token score and the transition probabilities
// if the score is better than the best score encountered for
// the SearchState and frame then create a new token, add
// it to the lattice and the SearchState.
// If the token is an emitting token add it to the list,
// othewise recursively collect the new tokens successors.
for (int i = 0; i < arcs.length; i++) {
SearchStateArc arc = arcs[i];
SearchState nextState = arc.getState();
// We're actually multiplying the variables, but since
// these come in log(), multiply gets converted to add
float logEntryScore = token.getScore() + arc.getProbability();
if (wantEntryPruning) {
if (logEntryScore < threshold) {
continue;
}
if (nextState instanceof WordSearchState
&& logEntryScore < wordThreshold) {
continue;
}
}
Token bestToken = getBestToken(nextState);
boolean firstToken = bestToken == null;
if (firstToken || bestToken.getScore() <= logEntryScore) {
Token newToken = token.child(nextState, logEntryScore, arc
.getLanguageProbability(), arc
.getInsertionProbability(), currentFrameNumber);
tokensCreated.value++;
setBestToken(newToken, nextState);
if (!newToken.isEmitting()) {
collectSuccessorTokens(newToken);
} else {
if (firstToken) {
activeList.add(newToken);
} else {
activeList.replace(bestToken, newToken);
viterbiPruned.value++;
}
}
} else {
viterbiPruned.value++;
}
}
}
/**
* Counts all the tokens in the active list (and displays them). This is an
* expensive operation.
*/
private void showTokenCount() {
if (logger.isLoggable(Level.INFO)) {
Set tokenSet = new HashSet();
for (Iterator i = activeList.iterator(); i.hasNext();) {
Token token = (Token) i.next();
while (token != null) {
tokenSet.add(token);
token = token.getPredecessor();
}
}
logger.info("Token Lattice size: " + tokenSet.size());
tokenSet = new HashSet();
for (Iterator i = resultList.iterator(); i.hasNext();) {
Token token = (Token) i.next();
while (token != null) {
tokenSet.add(token);
token = token.getPredecessor();
}
}
logger.info("Result Lattice size: " + tokenSet.size());
}
}
/**
* Returns the best token map.
*
* @return the best token map
*/
protected Map getBestTokenMap() {
return bestTokenMap;
}
/**
* Sets the best token Map.
*
* @param bestTokenMap
* the new best token Map
*/
protected void setBestTokenMap(Map bestTokenMap) {
this.bestTokenMap = bestTokenMap;
}
/**
* Returns the result list.
*
* @return the result list
*/
public List getResultList() {
return resultList;
}
/**
* Returns the current frame number.
*
* @return the current frame number
*/
public int getCurrentFrameNumber() {
return currentFrameNumber;
}
/**
* Returns the Timer for growing.
*
* @return the Timer for growing
*/
public Timer getGrowTimer() {
return growTimer;
}
/**
* Returns the tokensCreated StatisticsVariable.
*
* @return the tokensCreated StatisticsVariable.
*/
public StatisticsVariable getTokensCreated() {
return tokensCreated;
}
/*
* (non-Javadoc)
*
* @see edu.cmu.sphinx.decoder.search.SearchManager#allocate()
*/
public void allocate() throws IOException {
totalTokensScored = StatisticsVariable
.getStatisticsVariable("totalTokensScored");
tokensPerSecond = StatisticsVariable
.getStatisticsVariable("tokensScoredPerSecond");
curTokensScored = StatisticsVariable
.getStatisticsVariable("curTokensScored");
tokensCreated = StatisticsVariable
.getStatisticsVariable("tokensCreated");
viterbiPruned = StatisticsVariable
.getStatisticsVariable("viterbiPruned");
beamPruned = StatisticsVariable.getStatisticsVariable("beamPruned");
wordsPruned = StatisticsVariable.getStatisticsVariable("wordsPruned");
linguist.allocate();
pruner.allocate();
scorer.allocate();
scoreTimer = Timer.getTimer("scoring");
pruneTimer = Timer.getTimer("pruning");
growTimer = Timer.getTimer("growing");
}
/*
* (non-Javadoc)
*
* @see edu.cmu.sphinx.decoder.search.SearchManager#deallocate()
*/
public void deallocate() {
scorer.deallocate();
pruner.deallocate();
linguist.deallocate();
}
/*
* (non-Javadoc)
*
* @see edu.cmu.sphinx.util.props.Configurable#getName()
*/
public String getName() {
return name;
}
}
| [
"[email protected]"
] | |
b1dfb57401c5e44f33b42163d74f8bfe25170f1e | 116e07a854c97303538a8c641377d00e59770554 | /libs/cinemanna-player-library/src/main/java/org/earthlink/cinemana/player/AmazingTextView.java | e0119e7d2b6c87feb108a7f8633e5a65bd5ec289 | [] | no_license | adindagadis/SOLUSI-PAPB-6 | 7904ec1882788bce3d59fbdc797ac5497d1b6860 | a1eda19ebda1e84da39f92c4426d710836bcbeeb | refs/heads/master | 2020-03-19T14:29:24.996278 | 2018-06-10T11:44:33 | 2018-06-10T11:44:33 | 136,625,301 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,507 | java | package org.earthlink.cinemana.player;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.GradientDrawable;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.TextView;
/**
* Created by ucsunup on 16-9-26.
*/
public class AmazingTextView extends TextView {
private Context mContext;
private float mRadius = 10f;
private int mBackGroundColor = 0X0d0d0d;
private float mHeight;
private float mWidth;
public AmazingTextView(Context paramContext) {
super(paramContext);
this.mContext = paramContext;
}
public AmazingTextView(Context paramContext, AttributeSet paramAttributeSet) {
super(paramContext, paramAttributeSet);
this.mContext = paramContext;
getParameter(paramAttributeSet);
}
public AmazingTextView(Context paramContext, AttributeSet paramAttributeSet, int paramInt) {
super(paramContext, paramAttributeSet, paramInt);
this.mContext = paramContext;
getParameter(paramAttributeSet);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public AmazingTextView(Context paramContext, AttributeSet paramAttributeSet, int paramInt1, int paramInt2) {
super(paramContext, paramAttributeSet, paramInt1, paramInt2);
this.mContext = paramContext;
getParameter(paramAttributeSet);
}
public float getRadius() {
return this.mRadius;
}
public void setRadius(int radius) {
this.mRadius = radius;
}
public int getmBackGroundColor() {
return mBackGroundColor;
}
public void setmBackGroundColor(int mBackGroundColor) {
this.mBackGroundColor = mBackGroundColor;
}
private void getParameter(AttributeSet paramAttributeSet) {
// init bg as gradient
setBackgroundResource(R.drawable.recstyletext);
TypedArray a = mContext.obtainStyledAttributes(paramAttributeSet, R.styleable.AmazingTextView);
this.mRadius = a.getDimension(R.styleable.AmazingTextView_radius, mRadius);
this.mBackGroundColor = a.getColor(R.styleable.AmazingTextView_backgroundColor, mBackGroundColor);
a.recycle();
initView();
}
private void initView() {
GradientDrawable gd = (GradientDrawable) getBackground();
mRadius = mRadius < 0 ? 0 : mRadius;
gd.setCornerRadius(mRadius);
gd.setColor(mBackGroundColor);
}
} | [
"[email protected]"
] | |
bb4efdd0c78536c840633830021e01530bccb624 | 2a450aaf12e1616e4389c0b618339f1bd2d6a712 | /server/services/Department.java | 86bd83eedb36afcf58b13709f07d0892cf7a59b7 | [] | no_license | TahjidEshan/Java-Socket-Practice | 4b17b90b00b07e330984cd6fd8881185d9ad0c6f | ec1409317d4185e52ab7b6f7082a787cd36ada1b | refs/heads/master | 2021-01-19T10:49:04.161143 | 2017-02-16T19:39:08 | 2017-02-16T19:39:08 | 82,216,980 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 397 | java | //package com.bracu.server.services;
public class Department {
public String departmentName;
public Department(String departmentName) {
this.departmentName = departmentName;
}
public String getDepartmentName() {
return this.departmentName;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
}
| [
"[email protected]"
] | |
740745381149a3bf6bbc2e18756acd34b90f0d2d | 5153226f4279f6965e9dd9de647780b1c9ab3dd4 | /rescue-bots-android/src/br/com/rescue_bots_android/app/FrameMarkers/RObject.java | d2897bf304db58c96ca1fbaf18baee0d2ed3d0e2 | [
"MIT"
] | permissive | jairodealmeida/rescue_bot | 68292bb5a0699d09bdd93606bf8e80956d6aac34 | 3e1c1dd7a279157f54b69e7791dc0e41d9811a3a | refs/heads/master | 2021-12-10T00:33:42.147947 | 2016-06-28T21:29:55 | 2016-06-28T21:29:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 46,368 | java | /*===============================================================================
Copyright (c) 2016 PTC Inc. All Rights Reserved.
Copyright (c) 2012-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved.
Vuforia is a trademark of PTC Inc., registered in the United States and other
countries.
===============================================================================*/
package br.com.rescue_bots_android.app.FrameMarkers;
import java.nio.Buffer;
import com.vuforia.samples.SampleApplication.utils.MeshObject;
public class RObject extends MeshObject
{
// Data for drawing the 3D plane as overlay
private static final double letterVertices[] = { 2.008290, -0.050000,
0.882192, 1.931250, 0.000000, 0.982192, 1.818130, -0.050000,
0.882192, 1.787500, 0.000000, 0.982192, 0.200000, 1.466669,
0.982192, 0.200000, 2.199999, 0.982192, 0.150000, 1.483329,
0.882192, 0.150000, 2.249999, 0.882192, 1.861480, 1.912629,
0.882192, 1.818060, 1.887499, 0.982192, 1.927870, 1.745319,
0.882192, 1.879510, 1.732029, 0.982192, 1.779690, 1.076799,
0.882192, 1.722220, 1.103819, 0.982192, 1.566790, 0.940169,
0.882192, 1.500000, 0.967189, 0.982192, 1.643750, 0.644790,
0.982192, 1.787500, 0.322400, 0.982192, 1.702290, 0.636280,
0.882192, 1.849460, 0.306220, 0.882192, 1.643750, 0.644790,
-0.000877, 1.702290, 0.636280, 0.099123, 1.787500, 0.322400,
-0.000877, 1.849460, 0.306220, 0.099123, 1.931250, 0.000000,
-0.000877, 2.008290, -0.050000, 0.099123, 2.008290, -0.050000,
0.882192, 1.931250, 0.000000, 0.982192, 1.500000, 0.967189,
-0.000877, 1.722220, 1.103819, -0.000877, 1.566790, 0.940169,
0.099123, 1.779690, 1.076799, 0.099123, 1.500000, 0.967189,
-0.000877, 1.566790, 0.940169, 0.099123, 1.566790, 0.940169,
0.882192, 1.500000, 0.967189, 0.982192, 1.900000, 1.553129,
0.982192, 1.855560, 1.299129, 0.982192, 1.950000, 1.553129,
0.882192, 1.907420, 1.281119, 0.882192, 1.900000, 1.553129,
-0.000877, 1.950000, 1.553129, 0.099123, 1.855560, 1.299129,
-0.000877, 1.907420, 1.281119, 0.099123, 1.722220, 1.103819,
-0.000877, 1.779690, 1.076799, 0.099123, 1.779690, 1.076799,
0.882192, 1.722220, 1.103819, 0.982192, 1.879510, 1.732029,
-0.000877, 1.818060, 1.887499, -0.000877, 1.927870, 1.745319,
0.099123, 1.861480, 1.912629, 0.099123, 1.139060, 2.199999,
0.982192, 1.377430, 2.179949, 0.982192, 1.139060, 2.249999,
0.882192, 1.390410, 2.228339, 0.882192, 1.569620, 2.119789,
0.982192, 1.715630, 2.019529, 0.982192, 1.594330, 2.163349,
0.882192, 1.750820, 2.055049, 0.882192, 1.569620, 2.119789,
-0.000877, 1.594330, 2.163349, 0.099123, 1.715630, 2.019529,
-0.000877, 1.750820, 2.055049, 0.099123, 1.715630, 2.019529,
-0.000877, 1.750820, 2.055049, 0.099123, 1.750820, 2.055049,
0.882192, 1.715630, 2.019529, 0.982192, 1.139060, 2.199999,
-0.000877, 1.139060, 2.249999, 0.099123, 1.377430, 2.179949,
-0.000877, 1.390410, 2.228339, 0.099123, 0.490800, 2.249999,
0.882192, 0.513020, 2.199999, 0.982192, 0.820490, 2.249999,
0.882192, 0.826040, 2.199999, 0.982192, 0.826040, 2.199999,
-0.000877, 0.513020, 2.199999, -0.000877, 0.820490, 2.249999,
0.099123, 0.490800, 2.249999, 0.099123, 0.200000, 1.466669,
-0.000877, 0.150000, 1.483329, 0.099123, 0.200000, 2.199999,
-0.000877, 0.150000, 2.249999, 0.099123, 0.200000, 2.199999,
-0.000877, 0.150000, 2.249999, 0.099123, 0.150000, 2.249999,
0.882192, 0.200000, 2.199999, 0.982192, 0.600000, 0.899999,
0.982192, 0.600000, 0.600000, 0.982192, 0.650000, 0.849999,
0.882192, 0.650000, 0.572220, 0.882192, 0.483330, -0.050000,
0.882192, 0.466670, 0.000000, 0.982192, 0.316670, -0.050000,
0.882192, 0.333330, 0.000000, 0.982192, 0.150000, -0.050000,
0.882192, 0.200000, 0.000000, 0.982192, 0.150000, 0.716669,
0.882192, 0.200000, 0.733330, 0.982192, 0.200000, 0.733330,
-0.000877, 0.200000, 0.000000, -0.000877, 0.150000, 0.716670,
0.099123, 0.150000, -0.050000, 0.099123, 0.333330, 0.000000,
-0.000877, 0.466670, 0.000000, -0.000877, 0.316670, -0.050000,
0.099123, 0.483330, -0.050000, 0.099123, 0.200000, 0.000000,
-0.000877, 0.150000, -0.050000, 0.099123, 0.150000, -0.050000,
0.882192, 0.200000, 0.000000, 0.982192, 0.600000, 0.300000,
0.982192, 0.600000, 0.000000, 0.982192, 0.650000, 0.272220,
0.882192, 0.650000, -0.050000, 0.882192, 0.600000, 0.300000,
-0.000877, 0.650000, 0.272220, 0.099123, 0.600000, 0.000000,
-0.000877, 0.650000, -0.050000, 0.099123, 0.600000, 0.000000,
-0.000877, 0.650000, -0.050000, 0.099123, 0.650000, -0.050000,
0.882192, 0.600000, 0.000000, 0.982192, 0.600000, 0.899999,
-0.000877, 0.650000, 0.850000, 0.099123, 0.600000, 0.600000,
-0.000877, 0.650000, 0.572220, 0.099123, 1.194970, 0.563200,
0.882192, 1.233330, 0.600000, 0.982192, 1.067510, 0.849999,
0.882192, 1.100000, 0.899999, 0.982192, 0.924450, 0.849999,
0.882192, 0.933330, 0.899999, 0.982192, 0.785280, 0.849999,
0.882192, 0.766670, 0.899999, 0.982192, 0.766670, 0.899999,
-0.000877, 0.933330, 0.899999, -0.000877, 0.785280, 0.850000,
0.099123, 0.924450, 0.850000, 0.099123, 0.600000, 0.899999,
-0.000877, 0.650000, 0.850000, 0.099123, 0.650000, 0.849999,
0.882192, 0.600000, 0.899999, 0.982192, 1.100000, 0.899999,
-0.000877, 1.233330, 0.600000, -0.000877, 1.067510, 0.850000,
0.099123, 1.194970, 0.563200, 0.099123, 1.100000, 0.899999,
-0.000877, 1.067510, 0.850000, 0.099123, 1.067510, 0.849999,
0.882192, 1.100000, 0.899999, 0.982192, 1.467510, -0.050000,
0.882192, 1.500000, 0.000000, 0.982192, 1.328310, 0.263200,
0.882192, 1.366670, 0.300000, 0.982192, 1.366670, 0.300000,
-0.000877, 1.500000, 0.000000, -0.000877, 1.328310, 0.263200,
0.099123, 1.467510, -0.050000, 0.099123, 1.787500, 0.000000,
-0.000877, 1.931250, 0.000000, -0.000877, 1.818130, -0.050000,
0.099123, 2.008290, -0.050000, 0.099123, 1.643750, 0.000000,
-0.000877, 1.637870, -0.050000, 0.099123, 1.500000, 0.000000,
-0.000877, 1.467510, -0.050000, 0.099123, 1.643750, 0.000000,
0.982192, 1.500000, 0.000000, 0.982192, 1.637870, -0.050000,
0.882192, 1.467510, -0.050000, 0.882192, 0.600000, 1.199999,
0.982192, 0.761460, 1.199999, 0.982192, 0.650000, 1.249999,
0.882192, 0.783680, 1.249999, 0.882192, 1.454860, 1.735939,
0.982192, 1.398440, 1.805469, 0.982192, 1.411600, 1.710319,
0.882192, 1.363600, 1.769589, 0.882192, 0.949310, 1.849999,
0.882192, 0.943750, 1.899999, 0.982192, 0.794100, 1.849999,
0.882192, 0.771880, 1.899999, 0.982192, 0.650000, 1.649999,
0.882192, 0.600000, 1.666669, 0.982192, 0.650000, 1.449999,
0.882192, 0.600000, 1.433329, 0.982192, 0.600000, 1.433329,
-0.000877, 0.600000, 1.666669, -0.000877, 0.650000, 1.449999,
0.099123, 0.650000, 1.649999, 0.099123, 0.600000, 1.199999,
-0.000877, 0.650000, 1.249999, 0.099123, 0.650000, 1.249999,
0.882192, 0.600000, 1.199999, 0.982192, 0.771880, 1.899999,
-0.000877, 0.943750, 1.899999, -0.000877, 0.794100, 1.849999,
0.099123, 0.949310, 1.849999, 0.099123, 0.600000, 1.899999,
-0.000877, 0.650000, 1.849999, 0.099123, 0.600000, 1.899999,
-0.000877, 0.650000, 1.849999, 0.099123, 0.600000, 1.899999,
0.982192, 0.650000, 1.849999, 0.882192, 0.650000, 1.849999,
0.882192, 0.600000, 1.899999, 0.982192, 1.227600, 1.889499,
0.982192, 1.115630, 1.899999, 0.982192, 1.214990, 1.841069,
0.882192, 1.115630, 1.849999, 0.882192, 1.227600, 1.889499,
-0.000877, 1.214990, 1.841069, 0.099123, 1.115630, 1.899999,
-0.000877, 1.115630, 1.849999, 0.099123, 1.454860, 1.735939,
-0.000877, 1.411600, 1.710319, 0.099123, 1.398440, 1.805469,
-0.000877, 1.363600, 1.769589, 0.099123, 1.321880, 1.857989,
-0.000877, 1.297650, 1.814259, 0.099123, 1.398440, 1.805469,
-0.000877, 1.363600, 1.769589, 0.099123, 1.321880, 1.857989,
0.982192, 1.297650, 1.814259, 0.882192, 1.363600, 1.769589,
0.882192, 1.398440, 1.805469, 0.982192, 1.362090, 1.331249,
0.882192, 1.396880, 1.295309, 0.982192, 1.410930, 1.392539,
0.882192, 1.454170, 1.366839, 0.982192, 1.450000, 1.557809,
0.882192, 1.500000, 1.557809, 0.982192, 1.440400, 1.639729,
0.882192, 1.488720, 1.653389, 0.982192, 1.488720, 1.653389,
-0.000877, 1.500000, 1.557809, -0.000877, 1.440400, 1.639729,
0.099123, 1.450000, 1.557809, 0.099123, 1.454170, 1.366839,
-0.000877, 1.396880, 1.295309, -0.000877, 1.410930, 1.392539,
0.099123, 1.362090, 1.331249, 0.099123, 1.488540, 1.454339,
-0.000877, 1.440230, 1.468059, 0.099123, 1.488540, 1.454339,
0.982192, 1.440230, 1.468059, 0.882192, 1.084380, 1.249999,
0.882192, 1.084380, 1.199999, 0.982192, 1.199590, 1.259029,
0.882192, 1.212150, 1.210589, 0.982192, 1.212150, 1.210589,
-0.000877, 1.084380, 1.199999, -0.000877, 1.199590, 1.259029,
0.099123, 1.084380, 1.249999, 0.099123, 1.396880, 1.295309,
-0.000877, 1.316320, 1.242359, -0.000877, 1.362090, 1.331249,
0.099123, 1.292160, 1.286109, 0.099123, 1.396880, 1.295309,
0.982192, 1.362090, 1.331249, 0.882192, 1.316320, 1.242359,
0.982192, 1.292160, 1.286109, 0.882192, 0.600000, 1.199999,
-0.000877, 0.650000, 1.249999, 0.099123, 0.761460, 1.199999,
-0.000877, 0.783680, 1.249999, 0.099123, 0.922920, 1.199999,
-0.000877, 0.928470, 1.249999, 0.099123, 0.922920, 1.199999,
0.982192, 0.928470, 1.249999, 0.882192, 1.931250, 0.000000,
-0.000877, 1.787500, 0.000000, -0.000877, 1.787500, 0.322400,
-0.000877, 1.643750, 0.000000, -0.000877, 0.600000, 0.000000,
-0.000877, 0.466670, 0.000000, -0.000877, 0.600000, 0.300000,
-0.000877, 0.200000, 0.000000, -0.000877, 0.200000, 0.733330,
-0.000877, 0.333330, 0.000000, -0.000877, 0.200000, 2.199999,
-0.000877, 0.513020, 2.199999, -0.000877, 0.200000, 1.466669,
-0.000877, 0.600000, 0.600000, -0.000877, 0.600000, 0.899999,
-0.000877, 1.500000, 0.000000, -0.000877, 1.366670, 0.300000,
-0.000877, 1.643750, 0.644790, -0.000877, 1.233330, 0.600000,
-0.000877, 1.500000, 0.967189, -0.000877, 1.100000, 0.899999,
-0.000877, 0.826040, 2.199999, -0.000877, 0.600000, 1.899999,
-0.000877, 0.600000, 1.666669, -0.000877, 0.771880, 1.899999,
-0.000877, 0.600000, 1.433329, -0.000877, 0.943750, 1.899999,
-0.000877, 1.139060, 2.199999, -0.000877, 1.115630, 1.899999,
-0.000877, 1.377430, 2.179949, -0.000877, 1.227600, 1.889499,
-0.000877, 1.321880, 1.857989, -0.000877, 1.569620, 2.119789,
-0.000877, 1.398440, 1.805469, -0.000877, 1.715630, 2.019529,
-0.000877, 1.454860, 1.735939, -0.000877, 1.818060, 1.887499,
-0.000877, 1.879510, 1.732029, -0.000877, 1.488720, 1.653389,
-0.000877, 1.900000, 1.553129, -0.000877, 1.500000, 1.557809,
-0.000877, 1.855560, 1.299129, -0.000877, 1.488540, 1.454339,
-0.000877, 1.722220, 1.103819, -0.000877, 1.454170, 1.366839,
-0.000877, 1.396880, 1.295309, -0.000877, 1.316320, 1.242359,
-0.000877, 1.212150, 1.210589, -0.000877, 1.084380, 1.199999,
-0.000877, 0.933330, 0.899999, -0.000877, 0.922920, 1.199999,
-0.000877, 0.766670, 0.899999, -0.000877, 0.761460, 1.199999,
-0.000877, 0.600000, 1.199999, -0.000877, 1.931250, 0.000000,
0.982192, 1.787500, 0.322400, 0.982192, 1.787500, 0.000000,
0.982192, 1.643750, 0.000000, 0.982192, 0.200000, 2.199999,
0.982192, 0.200000, 1.466669, 0.982192, 0.513020, 2.199999,
0.982192, 0.200000, 0.000000, 0.982192, 0.333330, 0.000000,
0.982192, 0.200000, 0.733330, 0.982192, 0.600000, 0.000000,
0.982192, 0.600000, 0.300000, 0.982192, 0.466670, 0.000000,
0.982192, 0.600000, 0.600000, 0.982192, 0.600000, 0.899999,
0.982192, 0.826040, 2.199999, 0.982192, 0.600000, 1.899999,
0.982192, 0.600000, 1.666669, 0.982192, 0.771880, 1.899999,
0.982192, 0.600000, 1.433329, 0.982192, 0.943750, 1.899999,
0.982192, 1.139060, 2.199999, 0.982192, 1.115630, 1.899999,
0.982192, 1.377430, 2.179949, 0.982192, 1.227600, 1.889499,
0.982192, 1.321880, 1.857989, 0.982192, 1.569620, 2.119789,
0.982192, 1.398440, 1.805469, 0.982192, 1.715630, 2.019529,
0.982192, 1.454860, 1.735939, 0.982192, 1.818060, 1.887499,
0.982192, 1.879510, 1.732029, 0.982192, 1.488720, 1.653389,
0.982192, 1.900000, 1.553129, 0.982192, 1.500000, 1.557809,
0.982192, 1.855560, 1.299129, 0.982192, 1.488540, 1.454339,
0.982192, 1.722220, 1.103819, 0.982192, 1.454170, 1.366839,
0.982192, 1.500000, 0.967189, 0.982192, 1.396880, 1.295309,
0.982192, 1.316320, 1.242359, 0.982192, 0.600000, 1.199999,
0.982192, 0.761460, 1.199999, 0.982192, 0.766670, 0.899999,
0.982192, 0.922920, 1.199999, 0.982192, 0.933330, 0.899999,
0.982192, 1.084380, 1.199999, 0.982192, 1.100000, 0.899999,
0.982192, 1.212150, 1.210589, 0.982192, 1.233330, 0.600000,
0.982192, 1.643750, 0.644790, 0.982192, 1.366670, 0.300000,
0.982192, 1.500000, 0.000000, 0.982192 };
private static final double letterNormals[] = { 0.806947, -0.523728,
0.273029, 0.617799, -0.400959, 0.676429, 0.000000, -0.961330,
0.275400, 0.000000, -0.894429, 0.447210, -0.894429, -0.000000,
0.447209, -0.577350, 0.577350, 0.577350, -0.980440, -0.000000,
0.196820, -0.670717, 0.670716, 0.316668, 0.857972, 0.490280,
0.153330, 0.776188, 0.443048, 0.448598, 0.926017, 0.257489,
0.276029, 0.876071, 0.178890, 0.447770, 0.709349, -0.668679,
0.222919, 0.550641, -0.661291, 0.509401, 0.875818, -0.258199,
0.407769, 0.779814, -0.228821, 0.582693, 0.816903, 0.364241,
0.447211, 0.816903, 0.364241, 0.447211, 0.895459, 0.399269,
0.196820, 0.878005, 0.391488, 0.275398, 0.816903, 0.364241,
-0.447211, 0.878005, 0.391488, -0.275398, 0.816903, 0.364241,
-0.447211, 0.895459, 0.399269, -0.196820, 0.617799, -0.400959,
-0.676429, 0.769579, -0.499479, -0.397829, 0.806947, -0.523728,
0.273029, 0.617799, -0.400959, 0.676429, 0.779814, -0.228821,
-0.582693, 0.550641, -0.661291, -0.509401, 0.911197, -0.269609,
-0.311499, 0.698108, -0.644748, -0.311359, 0.779814, -0.228821,
-0.582693, 0.911197, -0.269609, -0.311499, 0.875818, -0.258199,
0.407769, 0.779814, -0.228821, 0.582693, 0.894109, -0.026590,
0.447059, 0.814011, -0.314330, 0.488450, 0.971948, -0.021630,
0.234199, 0.907416, -0.338548, 0.248959, 0.894109, -0.026590,
-0.447059, 0.950098, -0.021810, -0.311189, 0.814011, -0.314330,
-0.488450, 0.924006, -0.344708, -0.165499, 0.550641, -0.661291,
-0.509401, 0.698108, -0.644748, -0.311359, 0.709349, -0.668679,
0.222919, 0.550641, -0.661291, 0.509401, 0.876071, 0.178890,
-0.447770, 0.776188, 0.443049, -0.448598, 0.946434, 0.255561,
-0.197361, 0.844837, 0.482758, -0.230639, 0.037540, 0.893797,
0.446898, 0.140311, 0.883354, 0.447212, 0.041610, 0.972508,
0.229120, 0.207590, 0.938948, 0.274379, 0.351501, 0.821921,
0.448211, 0.579859, 0.680558, 0.447889, 0.449650, 0.871259,
0.196780, 0.680910, 0.678390, 0.275950, 0.351501, 0.821921,
-0.448211, 0.447998, 0.850635, -0.275168, 0.579859, 0.680558,
-0.447889, 0.688377, 0.697996, -0.197329, 0.579859, 0.680558,
-0.447889, 0.688377, 0.697996, -0.197329, 0.680910, 0.678390,
0.275950, 0.579859, 0.680558, 0.447889, 0.037540, 0.893797,
-0.446898, 0.040640, 0.951629, -0.304550, 0.140311, 0.883354,
-0.447212, 0.205850, 0.958722, -0.196160, 0.000000, 0.980440,
0.196820, 0.000000, 0.894429, 0.447210, 0.000000, 0.961330,
0.275400, 0.000000, 0.894429, 0.447210, 0.000000, 0.894429,
-0.447210, 0.000000, 0.894429, -0.447210, 0.000000, 0.980440,
-0.196820, 0.000000, 0.961330, -0.275400, -0.894429, 0.000000,
-0.447209, -0.952228, 0.000000, -0.305389, -0.577350, 0.577350,
-0.577350, -0.690808, 0.690808, -0.213469, -0.577350, 0.577350,
-0.577350, -0.690808, 0.690808, -0.213469, -0.670717, 0.670716,
0.316668, -0.577350, 0.577350, 0.577350, 0.577350, -0.577350,
0.577350, 0.894429, -0.000000, 0.447209, 0.670717, -0.670716,
0.316668, 0.961330, -0.000000, 0.275400, 0.000000, -0.980440,
0.196820, 0.000000, -0.894429, 0.447210, 0.000000, -0.952228,
0.305389, 0.000000, -0.894429, 0.447210, -0.690808, -0.690808,
0.213469, -0.577350, -0.577350, 0.577350, -0.952228, -0.000000,
0.305389, -0.894429, -0.000000, 0.447209, -0.894429, 0.000000,
-0.447209, -0.577350, -0.577350, -0.577350, -0.980440, 0.000000,
-0.196820, -0.670717, -0.670716, -0.316668, 0.000000, -0.894429,
-0.447210, 0.000000, -0.894429, -0.447210, 0.000000, -0.973250,
-0.229750, 0.000000, -0.961330, -0.275400, -0.577350, -0.577350,
-0.577350, -0.670717, -0.670716, -0.316668, -0.690808, -0.690808,
0.213469, -0.577350, -0.577350, 0.577350, 0.894429, -0.000000,
0.447209, 0.577350, -0.577350, 0.577350, 0.980440, -0.000000,
0.196820, 0.670717, -0.670716, 0.316668, 0.894429, 0.000000,
-0.447209, 0.961330, 0.000000, -0.275400, 0.577350, -0.577350,
-0.577350, 0.690808, -0.690808, -0.213469, 0.577350, -0.577350,
-0.577350, 0.690808, -0.690808, -0.213469, 0.670717, -0.670716,
0.316668, 0.577350, -0.577350, 0.577350, 0.577350, -0.577350,
-0.577350, 0.643966, -0.643966, -0.413057, 0.894429, 0.000000,
-0.447209, 0.980440, 0.000000, -0.196820, -0.895939, -0.398189,
0.196820, -0.817340, -0.363260, 0.447210, -0.508951, -0.783161,
0.357250, -0.468021, -0.720172, 0.512161, 0.000000, -0.988273,
0.152700, 0.000000, -0.894429, 0.447210, 0.000000, -0.961330,
0.275400, 0.000000, -0.894429, 0.447210, 0.000000, -0.894429,
-0.447210, 0.000000, -0.894429, -0.447210, 0.000000, -0.980440,
-0.196820, 0.000000, -0.973250, -0.229750, 0.577350, -0.577350,
-0.577350, 0.643966, -0.643966, -0.413057, 0.670717, -0.670716,
0.316668, 0.577350, -0.577350, 0.577350, -0.468021, -0.720172,
-0.512161, -0.817340, -0.363260, -0.447210, -0.524523, -0.807114,
-0.271002, -0.878474, -0.390432, -0.275401, -0.468021, -0.720172,
-0.512161, -0.524523, -0.807114, -0.271002, -0.508951, -0.783161,
0.357250, -0.468021, -0.720172, 0.512161, -0.637380, -0.739790,
0.215540, -0.468021, -0.720172, 0.512161, -0.878474, -0.390432,
0.275401, -0.817340, -0.363260, 0.447210, -0.817340, -0.363260,
-0.447210, -0.468021, -0.720172, -0.512161, -0.895939, -0.398189,
-0.196820, -0.417170, -0.882900, -0.215540, 0.000000, -0.894429,
-0.447210, 0.617799, -0.400959, -0.676429, 0.000000, -0.980440,
-0.196820, 0.769579, -0.499479, -0.397829, 0.000000, -0.894429,
-0.447210, 0.000000, -0.952228, -0.305389, -0.468021, -0.720172,
-0.512161, -0.417170, -0.882900, -0.215540, 0.000000, -0.894429,
0.447210, -0.468021, -0.720172, 0.512161, 0.000000, -0.973250,
0.229750, -0.637380, -0.739790, 0.215540, 0.577350, 0.577350,
0.577350, 0.000000, 0.894429, 0.447210, 0.670717, 0.670716,
0.316668, 0.000000, 0.961330, 0.275400, -0.768386, -0.455847,
0.449207, -0.637610, -0.627140, 0.447380, -0.837279, -0.495509,
0.231160, -0.630498, -0.725437, 0.276069, 0.000000, -0.980440,
0.196820, 0.000000, -0.894429, 0.447210, 0.000000, -0.961330,
0.275400, 0.000000, -0.894429, 0.447210, 0.983001, -0.000000,
0.183600, 0.894429, -0.000000, 0.447209, 0.961330, -0.000000,
0.275400, 0.894429, -0.000000, 0.447209, 0.894429, 0.000000,
-0.447209, 0.894429, 0.000000, -0.447209, 0.980440, 0.000000,
-0.196820, 0.983001, 0.000000, -0.183600, 0.577350, 0.577350,
-0.577350, 0.643960, 0.643970, -0.413060, 0.670717, 0.670716,
0.316668, 0.577350, 0.577350, 0.577350, 0.000000, -0.894429,
-0.447210, 0.000000, -0.894429, -0.447210, 0.000000, -0.980440,
-0.196820, 0.000000, -0.961330, -0.275400, 0.577350, -0.577350,
-0.577350, 0.643960, -0.643970, -0.413060, 0.577350, -0.577350,
-0.577350, 0.643960, -0.643970, -0.413060, 0.577350, -0.577350,
0.577350, 0.670717, -0.670716, 0.316668, 0.670717, -0.670716,
0.316668, 0.577350, -0.577350, 0.577350, -0.215700, -0.868838,
0.445639, -0.041010, -0.894018, 0.446149, -0.159610, -0.960047,
0.229859, -0.043630, -0.972311, 0.229580, -0.215700, -0.868838,
-0.445639, -0.197410, -0.952958, -0.230000, -0.041010, -0.894018,
-0.446149, -0.044300, -0.987296, -0.152589, -0.768386, -0.455847,
-0.449207, -0.818929, -0.484789, -0.307139, -0.637604, -0.627144,
-0.447383, -0.649083, -0.734653, -0.197421, -0.434250, -0.782631,
-0.446000, -0.399869, -0.874008, -0.276069, -0.637604, -0.627144,
-0.447383, -0.649083, -0.734653, -0.197421, -0.434249, -0.782627,
0.446008, -0.414610, -0.888329, 0.197410, -0.630498, -0.725437,
0.276069, -0.637610, -0.627140, 0.447380, -0.655991, 0.718631,
0.230750, -0.636372, 0.628182, 0.447681, -0.824593, 0.474961,
0.307341, -0.773163, 0.447601, 0.449302, -0.982607, -0.027240,
0.183689, -0.894642, -0.003470, 0.446771, -0.936603, -0.215471,
0.276311, -0.854439, -0.262640, 0.448279, -0.854441, -0.262630,
-0.448280, -0.894642, -0.003470, -0.446771, -0.953603, -0.227171,
-0.197571, -0.982798, 0.019110, -0.183690, -0.773163, 0.447602,
-0.449301, -0.636372, 0.628182, -0.447681, -0.843170, 0.485340,
-0.231320, -0.613630, 0.755219, -0.230440, -0.857982, 0.251430,
-0.447940, -0.939063, 0.204511, -0.276291, -0.857982, 0.251430,
0.447940, -0.956268, 0.215699, 0.197549, -0.046450, 0.981923,
0.183491, -0.036020, 0.894312, 0.445991, -0.155469, 0.948675,
0.275399, -0.196521, 0.873874, 0.444662, -0.196521, 0.873874,
-0.444662, -0.036020, 0.894312, -0.445991, -0.164040, 0.966607,
-0.196879, -0.030400, 0.982551, -0.183490, -0.636372, 0.628182,
-0.447681, -0.416420, 0.792661, -0.445290, -0.613630, 0.755219,
-0.230440, -0.377208, 0.884056, -0.275969, -0.636372, 0.628182,
0.447681, -0.655991, 0.718631, 0.230750, -0.416420, 0.792661,
0.445290, -0.391622, 0.898715, 0.197341, 0.577350, 0.577350,
-0.577350, 0.643960, 0.643970, -0.413060, 0.000000, 0.894429,
-0.447210, 0.000000, 0.980440, -0.196820, 0.000000, 0.894429,
-0.447210, 0.000000, 0.961330, -0.275400, 0.000000, 0.894429,
0.447210, 0.000000, 0.980440, 0.196820, 0.000000, 0.000000,
-1.000000, 0.000000, 0.000000, -1.000000, 0.000000, 0.000000,
-1.000000, 0.000000, 0.000000, -1.000000, 0.000000, 0.000000,
-1.000000, 0.000000, 0.000000, -1.000000, 0.000000, 0.000000,
-1.000000, 0.000000, 0.000000, -1.000000, 0.000000, 0.000000,
-1.000000, 0.000000, 0.000000, -1.000000, 0.000000, 0.000000,
-1.000000, 0.000000, 0.000000, -1.000000, 0.000000, 0.000000,
-1.000000, 0.000000, 0.000000, -1.000000, 0.000000, 0.000000,
-1.000000, 0.000000, 0.000000, -1.000000, 0.000000, 0.000000,
-1.000000, 0.000000, 0.000000, -1.000000, 0.000000, 0.000000,
-1.000000, 0.000000, 0.000000, -1.000000, 0.000000, 0.000000,
-1.000000, 0.000000, 0.000000, -1.000000, 0.000000, 0.000000,
-1.000000, 0.000000, 0.000000, -1.000000, 0.000000, 0.000000,
-1.000000, 0.000000, 0.000000, -1.000000, 0.000000, 0.000000,
-1.000000, 0.000000, 0.000000, -1.000000, 0.000000, 0.000000,
-1.000000, 0.000000, 0.000000, -1.000000, 0.000000, 0.000000,
-1.000000, 0.000000, 0.000000, -1.000000, 0.000000, 0.000000,
-1.000000, 0.000000, 0.000000, -1.000000, 0.000000, 0.000000,
-1.000000, 0.000000, 0.000000, -1.000000, 0.000000, 0.000000,
-1.000000, 0.000000, 0.000000, -1.000000, 0.000000, 0.000000,
-1.000000, 0.000000, 0.000000, -1.000000, 0.000000, 0.000000,
-1.000000, 0.000000, 0.000000, -1.000000, 0.000000, 0.000000,
-1.000000, 0.000000, 0.000000, -1.000000, 0.000000, 0.000000,
-1.000000, 0.000000, 0.000000, -1.000000, 0.000000, 0.000000,
-1.000000, 0.000000, 0.000000, -1.000000, 0.000000, 0.000000,
-1.000000, 0.000000, 0.000000, -1.000000, 0.000000, 0.000000,
-1.000000, 0.000000, 0.000000, -1.000000, 0.000000, 0.000000,
-1.000000, 0.000000, 0.000000, -1.000000, 0.000000, -0.000000,
1.000000, 0.000000, -0.000000, 1.000000, 0.000000, -0.000000,
1.000000, 0.000000, -0.000000, 1.000000, 0.000000, -0.000000,
1.000000, 0.000000, -0.000000, 1.000000, 0.000000, -0.000000,
1.000000, 0.000000, -0.000000, 1.000000, 0.000000, -0.000000,
1.000000, 0.000000, -0.000000, 1.000000, 0.000000, -0.000000,
1.000000, 0.000000, -0.000000, 1.000000, 0.000000, -0.000000,
1.000000, 0.000000, -0.000000, 1.000000, 0.000000, -0.000000,
1.000000, 0.000000, -0.000000, 1.000000, 0.000000, -0.000000,
1.000000, 0.000000, -0.000000, 1.000000, 0.000000, -0.000000,
1.000000, 0.000000, -0.000000, 1.000000, 0.000000, -0.000000,
1.000000, 0.000000, -0.000000, 1.000000, 0.000000, -0.000000,
1.000000, 0.000000, -0.000000, 1.000000, 0.000000, -0.000000,
1.000000, 0.000000, -0.000000, 1.000000, 0.000000, -0.000000,
1.000000, 0.000000, -0.000000, 1.000000, 0.000000, -0.000000,
1.000000, 0.000000, -0.000000, 1.000000, 0.000000, -0.000000,
1.000000, 0.000000, -0.000000, 1.000000, 0.000000, -0.000000,
1.000000, 0.000000, -0.000000, 1.000000, 0.000000, -0.000000,
1.000000, 0.000000, -0.000000, 1.000000, 0.000000, -0.000000,
1.000000, 0.000000, -0.000000, 1.000000, 0.000000, -0.000000,
1.000000, 0.000000, -0.000000, 1.000000, 0.000000, -0.000000,
1.000000, 0.000000, -0.000000, 1.000000, 0.000000, -0.000000,
1.000000, 0.000000, -0.000000, 1.000000, 0.000000, -0.000000,
1.000000, 0.000000, -0.000000, 1.000000, 0.000000, -0.000000,
1.000000, 0.000000, -0.000000, 1.000000, 0.000000, -0.000000,
1.000000, 0.000000, -0.000000, 1.000000, 0.000000, -0.000000,
1.000000, 0.000000, -0.000000, 1.000000, 0.000000, -0.000000,
1.000000, 0.000000, -0.000000, 1.000000 };
private static final double letterTexcoords[] = { 0.790001, 0.795853,
0.771362, 0.773301, 0.746388, 0.834364, 0.736582, 0.773301,
0.255825, 0.005894, 0.377102, 0.005894, 0.258580, 0.108994,
0.385370, 0.029244, 0.151218, 0.368698, 0.152988, 0.262385,
0.118863, 0.341286, 0.124608, 0.262385, 0.609761, 0.929175,
0.633076, 0.942701, 0.609761, 0.979281, 0.633076, 0.995000,
0.383450, 0.336853, 0.383450, 0.412132, 0.302851, 0.344950,
0.334023, 0.422020, 0.203997, 0.336853, 0.253424, 0.344950,
0.203997, 0.412132, 0.284596, 0.422020, 0.203997, 0.487414,
0.222251, 0.499090, 0.365196, 0.499090, 0.383450, 0.487414,
0.403874, 0.995000, 0.403874, 0.942701, 0.427189, 0.979281,
0.427189, 0.929175, 0.203997, 0.261571, 0.222251, 0.267880,
0.365196, 0.267880, 0.383450, 0.261571, 0.091951, 0.262385,
0.045585, 0.262385, 0.084739, 0.341286, 0.044869, 0.327581,
0.091951, 0.499090, 0.084739, 0.420188, 0.045585, 0.499090,
0.044869, 0.392776, 0.009932, 0.499090, 0.005000, 0.475011,
0.005000, 0.286463, 0.009932, 0.262385, 0.124608, 0.499090,
0.152988, 0.499090, 0.118863, 0.420188, 0.151218, 0.433894,
0.863788, 0.526370, 0.913105, 0.526370, 0.849629, 0.600269,
0.901249, 0.600269, 0.952867, 0.526370, 0.983075, 0.526370,
0.945804, 0.625943, 0.990355, 0.548921, 0.952867, 0.748069,
0.945804, 0.687006, 0.983075, 0.748069, 0.990355, 0.725517,
0.177089, 0.499090, 0.183573, 0.475011, 0.183573, 0.286463,
0.177089, 0.262385, 0.863788, 0.748069, 0.849629, 0.674169,
0.913105, 0.748069, 0.901249, 0.674169, 0.722658, 0.625943,
0.734267, 0.526370, 0.786146, 0.600269, 0.799028, 0.526370,
0.799028, 0.748069, 0.734267, 0.748069, 0.786146, 0.674169,
0.722658, 0.687006, 0.255825, 0.235445, 0.258580, 0.172220,
0.377102, 0.235445, 0.385370, 0.212095, 0.669506, 0.748069,
0.659162, 0.725517, 0.659162, 0.548921, 0.669506, 0.526370,
0.383495, 0.773170, 0.383495, 0.843222, 0.365281, 0.784846,
0.334177, 0.854897, 0.530132, 0.824393, 0.633076, 0.828314,
0.569947, 0.863618, 0.633076, 0.859696, 0.005000, 0.029244,
0.013269, 0.005894, 0.131790, 0.069119, 0.134546, 0.005894,
0.134546, 0.235445, 0.013269, 0.235445, 0.131790, 0.132345,
0.005000, 0.212095, 0.403874, 0.859696, 0.403874, 0.828314,
0.506817, 0.863618, 0.467003, 0.824393, 0.403874, 0.891075,
0.427189, 0.902843, 0.609761, 0.902843, 0.633076, 0.891075,
0.383495, 0.913273, 0.383495, 0.983325, 0.303073, 0.924949,
0.365281, 0.995000, 0.204437, 0.913273, 0.253755, 0.924949,
0.204437, 0.983325, 0.222651, 0.995000, 0.403874, 0.796935,
0.427189, 0.785168, 0.609761, 0.785168, 0.633076, 0.796935,
0.204437, 0.773170, 0.222651, 0.784846, 0.204437, 0.843222,
0.284859, 0.854897, 0.303073, 0.606942, 0.383495, 0.595267,
0.365281, 0.536891, 0.383495, 0.525215, 0.472062, 0.631385,
0.472836, 0.527470, 0.443527, 0.591195, 0.438356, 0.527470,
0.438356, 0.758836, 0.472836, 0.758836, 0.443527, 0.654920,
0.472062, 0.695110, 0.403874, 0.758836, 0.414218, 0.735301,
0.414218, 0.551005, 0.403874, 0.527470, 0.204437, 0.525215,
0.204437, 0.595267, 0.222651, 0.536891, 0.253755, 0.606942,
0.507319, 0.758836, 0.500597, 0.735301, 0.500597, 0.551005,
0.507319, 0.527470, 0.365281, 0.747045, 0.383495, 0.735370,
0.334177, 0.676993, 0.383495, 0.665318, 0.204437, 0.665318,
0.204437, 0.735370, 0.284859, 0.676993, 0.222651, 0.747045,
0.736582, 0.995000, 0.771362, 0.995000, 0.746388, 0.895426,
0.790001, 0.972448, 0.701802, 0.995000, 0.702775, 0.933937,
0.667023, 0.995000, 0.659162, 0.972448, 0.701802, 0.773301,
0.667023, 0.773301, 0.702775, 0.872875, 0.659162, 0.795853,
0.184058, 0.995000, 0.184058, 0.950984, 0.165844, 0.981369,
0.134740, 0.941896, 0.621629, 0.527470, 0.636014, 0.527470,
0.618679, 0.631385, 0.628591, 0.551005, 0.124372, 0.649002,
0.184058, 0.653546, 0.134740, 0.691314, 0.184058, 0.700400,
0.926955, 0.834364, 0.929980, 0.773301, 0.879574, 0.834364,
0.873524, 0.773301, 0.873524, 0.995000, 0.929980, 0.995000,
0.879574, 0.895426, 0.926955, 0.895426, 0.817071, 0.995000,
0.829168, 0.972448, 0.829168, 0.795853, 0.817071, 0.773301,
0.005000, 0.700400, 0.005000, 0.653546, 0.085422, 0.691314,
0.064686, 0.649002, 0.986433, 0.995000, 0.974336, 0.972448,
0.005000, 0.747257, 0.023214, 0.733627, 0.986433, 0.773301,
0.974336, 0.795853, 0.165844, 0.733627, 0.184058, 0.747257,
0.184058, 0.576165, 0.184058, 0.606689, 0.124372, 0.594034,
0.124372, 0.621513, 0.005000, 0.576165, 0.064686, 0.594034,
0.005000, 0.606689, 0.064686, 0.621513, 0.621629, 0.758836,
0.618679, 0.695110, 0.636014, 0.758836, 0.628591, 0.735301,
0.005000, 0.550462, 0.054318, 0.566557, 0.005000, 0.529591,
0.023214, 0.539089, 0.184058, 0.550462, 0.103636, 0.566557,
0.165844, 0.539089, 0.184058, 0.529591, 0.537902, 0.551005,
0.530467, 0.527470, 0.548570, 0.591195, 0.545266, 0.527470,
0.584008, 0.604592, 0.584775, 0.527470, 0.601343, 0.604592,
0.604550, 0.527470, 0.604550, 0.758836, 0.584775, 0.758836,
0.601343, 0.681714, 0.584008, 0.681714, 0.545266, 0.758836,
0.530467, 0.758836, 0.548570, 0.654920, 0.537902, 0.735301,
0.563368, 0.758836, 0.566673, 0.681714, 0.563368, 0.527470,
0.566673, 0.604592, 0.124372, 0.873620, 0.184058, 0.862951,
0.124372, 0.844823, 0.184058, 0.828119, 0.005000, 0.828119,
0.005000, 0.862951, 0.064686, 0.844823, 0.064686, 0.873620,
0.005000, 0.777759, 0.005000, 0.799721, 0.023214, 0.787243,
0.054318, 0.816030, 0.184058, 0.777759, 0.165844, 0.787243,
0.184058, 0.799721, 0.103636, 0.816030, 0.005000, 0.995000,
0.023214, 0.981369, 0.005000, 0.950984, 0.085422, 0.941896,
0.005000, 0.906967, 0.064686, 0.902424, 0.184058, 0.906967,
0.124372, 0.902424, 0.690185, 0.501138, 0.666412, 0.501138,
0.666412, 0.428431, 0.642639, 0.501138, 0.470025, 0.501138,
0.447975, 0.501138, 0.470025, 0.433483, 0.403874, 0.501138,
0.403874, 0.335759, 0.425924, 0.501138, 0.403874, 0.005000,
0.455641, 0.005000, 0.403874, 0.170379, 0.470025, 0.365828,
0.470025, 0.298172, 0.618866, 0.501138, 0.596816, 0.433483,
0.642639, 0.355727, 0.574764, 0.365828, 0.618866, 0.283020,
0.552714, 0.298172, 0.507407, 0.005000, 0.470025, 0.072655,
0.470025, 0.125275, 0.498450, 0.072655, 0.470025, 0.177897,
0.526874, 0.072655, 0.559174, 0.005000, 0.555299, 0.072655,
0.598595, 0.009522, 0.573817, 0.075023, 0.589409, 0.082129,
0.630379, 0.023089, 0.602070, 0.093973, 0.654526, 0.045699,
0.611401, 0.109654, 0.671466, 0.075474, 0.681629, 0.110535,
0.617000, 0.128270, 0.685017, 0.150880, 0.618866, 0.149825,
0.677668, 0.208162, 0.616971, 0.173159, 0.655616, 0.252207,
0.611286, 0.192892, 0.601812, 0.209023, 0.588489, 0.220964,
0.571262, 0.228129, 0.550131, 0.230517, 0.525151, 0.298172,
0.523429, 0.230517, 0.497589, 0.298172, 0.496727, 0.230517,
0.470025, 0.230517, 0.995000, 0.501138, 0.971227, 0.428431,
0.971227, 0.501138, 0.947454, 0.501138, 0.708689, 0.005000,
0.708689, 0.170379, 0.760455, 0.005000, 0.708689, 0.501138,
0.730739, 0.501138, 0.708689, 0.335759, 0.774840, 0.501138,
0.774840, 0.433483, 0.752790, 0.501138, 0.774840, 0.365828,
0.774840, 0.298172, 0.812222, 0.005000, 0.774840, 0.072655,
0.774840, 0.125275, 0.803265, 0.072655, 0.774840, 0.177897,
0.831689, 0.072655, 0.863989, 0.005000, 0.860114, 0.072655,
0.903410, 0.009522, 0.878631, 0.075023, 0.894223, 0.082129,
0.935194, 0.023089, 0.906885, 0.093973, 0.959341, 0.045699,
0.916215, 0.109654, 0.976281, 0.075474, 0.986443, 0.110535,
0.921815, 0.128270, 0.989832, 0.150880, 0.923681, 0.149825,
0.982482, 0.208162, 0.921785, 0.173159, 0.960431, 0.252207,
0.916101, 0.192892, 0.923681, 0.283020, 0.906627, 0.209023,
0.893304, 0.220964, 0.774840, 0.230517, 0.801542, 0.230517,
0.802404, 0.298172, 0.828244, 0.230517, 0.829966, 0.298172,
0.854946, 0.230517, 0.857529, 0.298172, 0.876076, 0.228129,
0.879579, 0.365828, 0.947454, 0.355727, 0.901631, 0.433483,
0.923681, 0.501138 };
private static final short letterIndices[] = { 0, 1, 2, 2, 1, 3, 4, 5, 6,
6, 5, 7, 8, 9, 10, 10, 9, 11, 12, 13, 14, 14, 13, 15, 16, 17, 18,
18, 17, 19, 20, 21, 22, 22, 21, 23, 22, 23, 24, 24, 23, 25, 21, 18,
23, 23, 18, 19, 19, 26, 23, 23, 26, 25, 17, 27, 19, 19, 27, 26, 28,
29, 30, 30, 29, 31, 32, 33, 20, 20, 33, 21, 31, 12, 30, 30, 12, 14,
34, 18, 33, 33, 18, 21, 35, 16, 34, 34, 16, 18, 36, 37, 38, 38, 37,
39, 40, 41, 42, 42, 41, 43, 44, 42, 45, 45, 42, 43, 41, 38, 43, 43,
38, 39, 39, 46, 43, 43, 46, 45, 47, 46, 37, 37, 46, 39, 48, 49, 50,
50, 49, 51, 40, 48, 41, 41, 48, 50, 51, 8, 50, 50, 8, 10, 10, 38,
50, 50, 38, 41, 36, 38, 11, 11, 38, 10, 52, 53, 54, 54, 53, 55, 56,
57, 58, 58, 57, 59, 60, 61, 62, 62, 61, 63, 64, 65, 49, 49, 65, 51,
61, 58, 63, 63, 58, 59, 66, 8, 65, 65, 8, 51, 67, 9, 66, 66, 9, 8,
68, 69, 70, 70, 69, 71, 70, 71, 60, 60, 71, 61, 69, 54, 71, 71, 54,
55, 55, 58, 71, 71, 58, 61, 53, 56, 55, 55, 56, 58, 72, 73, 74, 74,
73, 75, 76, 77, 78, 78, 77, 79, 68, 76, 69, 69, 76, 78, 79, 72, 78,
78, 72, 74, 74, 54, 78, 78, 54, 69, 52, 54, 75, 75, 54, 74, 80, 81,
82, 82, 81, 83, 77, 84, 79, 79, 84, 85, 81, 6, 83, 83, 6, 7, 86,
72, 85, 85, 72, 79, 73, 72, 87, 87, 72, 86, 88, 89, 90, 90, 89, 91,
92, 93, 94, 94, 93, 95, 96, 97, 98, 98, 97, 99, 100, 101, 102, 102,
101, 103, 80, 100, 81, 81, 100, 102, 103, 96, 102, 102, 96, 98, 98,
6, 102, 102, 6, 81, 99, 4, 98, 98, 4, 6, 104, 105, 106, 106, 105,
107, 104, 106, 108, 108, 106, 109, 107, 92, 106, 106, 92, 94, 94,
110, 106, 106, 110, 109, 95, 111, 94, 94, 111, 110, 112, 113, 114,
114, 113, 115, 116, 117, 118, 118, 117, 119, 105, 120, 107, 107,
120, 121, 117, 114, 119, 119, 114, 115, 122, 92, 121, 121, 92, 107,
93, 92, 123, 123, 92, 122, 124, 125, 126, 126, 125, 127, 126, 127,
116, 116, 127, 117, 125, 90, 127, 127, 90, 91, 91, 114, 127, 127,
114, 117, 89, 112, 91, 91, 112, 114, 128, 129, 130, 130, 129, 131,
132, 133, 134, 134, 133, 135, 136, 137, 138, 138, 137, 139, 140,
136, 141, 141, 136, 138, 139, 132, 138, 138, 132, 134, 134, 142,
138, 138, 142, 141, 143, 142, 135, 135, 142, 134, 144, 145, 146,
146, 145, 147, 148, 149, 137, 137, 149, 139, 147, 128, 146, 146,
128, 130, 150, 132, 149, 149, 132, 139, 151, 133, 150, 150, 133,
132, 152, 153, 154, 154, 153, 155, 156, 157, 158, 158, 157, 159,
145, 156, 147, 147, 156, 158, 159, 152, 158, 158, 152, 154, 154,
128, 158, 158, 128, 147, 129, 128, 155, 155, 128, 154, 160, 161,
162, 162, 161, 163, 164, 165, 166, 166, 165, 167, 164, 160, 165,
165, 160, 162, 168, 169, 170, 170, 169, 171, 171, 167, 170, 170,
167, 165, 163, 0, 162, 162, 0, 2, 2, 170, 162, 162, 170, 165, 168,
170, 3, 3, 170, 2, 172, 173, 174, 174, 173, 175, 176, 177, 178,
178, 177, 179, 180, 181, 182, 182, 181, 183, 184, 185, 186, 186,
185, 187, 188, 189, 190, 190, 189, 191, 192, 188, 193, 193, 188,
190, 191, 184, 190, 190, 184, 186, 186, 194, 190, 190, 194, 193,
195, 194, 187, 187, 194, 186, 196, 197, 198, 198, 197, 199, 200,
201, 189, 189, 201, 191, 202, 196, 203, 203, 196, 198, 204, 185,
205, 205, 185, 184, 184, 191, 205, 205, 191, 201, 199, 180, 198,
198, 180, 182, 182, 206, 198, 198, 206, 203, 207, 206, 183, 183,
206, 182, 208, 209, 210, 210, 209, 211, 212, 213, 214, 214, 213,
215, 197, 214, 199, 199, 214, 215, 213, 210, 215, 215, 210, 211,
211, 180, 215, 215, 180, 199, 181, 180, 209, 209, 180, 211, 216,
217, 218, 218, 217, 219, 220, 221, 212, 212, 221, 213, 222, 223,
220, 220, 223, 221, 224, 208, 225, 225, 208, 210, 210, 213, 225,
225, 213, 221, 217, 178, 219, 219, 178, 179, 226, 225, 223, 223,
225, 221, 227, 224, 226, 226, 224, 225, 228, 229, 230, 230, 229,
231, 232, 233, 234, 234, 233, 235, 236, 237, 238, 238, 237, 239,
216, 236, 217, 217, 236, 238, 239, 232, 238, 238, 232, 234, 234,
178, 238, 238, 178, 217, 176, 178, 235, 235, 178, 234, 240, 241,
242, 242, 241, 243, 244, 245, 237, 237, 245, 239, 240, 242, 244,
244, 242, 245, 246, 233, 247, 247, 233, 232, 232, 239, 247, 247,
239, 245, 243, 228, 242, 242, 228, 230, 230, 247, 242, 242, 247,
245, 231, 246, 230, 230, 246, 247, 248, 249, 250, 250, 249, 251,
252, 253, 254, 254, 253, 255, 256, 257, 258, 258, 257, 259, 257,
252, 259, 259, 252, 254, 260, 261, 262, 262, 261, 263, 261, 258,
263, 263, 258, 259, 255, 248, 254, 254, 248, 250, 250, 263, 254,
254, 263, 259, 262, 263, 251, 251, 263, 250, 264, 265, 266, 266,
265, 267, 268, 269, 253, 253, 269, 255, 266, 267, 268, 268, 267,
269, 270, 249, 271, 271, 249, 248, 248, 255, 271, 271, 255, 269,
265, 174, 267, 267, 174, 175, 175, 271, 267, 267, 271, 269, 173,
270, 175, 175, 270, 271, 272, 273, 274, 273, 275, 274, 276, 277,
278, 279, 280, 281, 282, 283, 284, 281, 280, 277, 277, 280, 278,
278, 280, 285, 285, 280, 286, 280, 284, 286, 287, 288, 275, 275,
288, 274, 274, 288, 289, 288, 290, 289, 289, 290, 291, 290, 292,
291, 283, 293, 284, 284, 293, 294, 294, 295, 284, 294, 293, 296,
295, 297, 284, 296, 293, 298, 293, 299, 298, 298, 299, 300, 299,
301, 300, 300, 301, 302, 302, 301, 303, 301, 304, 303, 303, 304,
305, 304, 306, 305, 305, 306, 307, 306, 308, 307, 308, 309, 307,
307, 309, 310, 309, 311, 310, 310, 311, 312, 311, 313, 312, 312,
313, 314, 313, 315, 314, 314, 315, 316, 315, 291, 316, 316, 291,
317, 317, 291, 318, 291, 292, 318, 318, 292, 319, 319, 292, 320,
292, 321, 320, 320, 321, 322, 321, 323, 322, 322, 323, 324, 323,
286, 324, 324, 286, 325, 286, 284, 325, 284, 297, 325, 326, 327,
328, 328, 327, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338,
334, 338, 335, 338, 337, 335, 337, 339, 335, 339, 340, 335, 335,
340, 331, 332, 331, 341, 331, 342, 341, 342, 331, 343, 342, 344,
341, 343, 331, 345, 344, 346, 341, 341, 346, 347, 346, 348, 347,
347, 348, 349, 348, 350, 349, 350, 351, 349, 349, 351, 352, 351,
353, 352, 352, 353, 354, 353, 355, 354, 354, 355, 356, 356, 355,
357, 355, 358, 357, 357, 358, 359, 358, 360, 359, 359, 360, 361,
360, 362, 361, 361, 362, 363, 362, 364, 363, 363, 364, 365, 364,
366, 365, 366, 367, 365, 345, 331, 368, 331, 340, 368, 368, 340,
369, 340, 370, 369, 369, 370, 371, 370, 372, 371, 371, 372, 373,
372, 374, 373, 373, 374, 375, 367, 375, 365, 375, 374, 365, 374,
376, 365, 365, 376, 377, 376, 378, 377, 377, 378, 327, 378, 379,
327, 327, 379, 329 };
Buffer mVertBuff;
Buffer mTexCoordBuff;
Buffer mNormBuff;
Buffer mIndBuff;
public RObject()
{
mVertBuff = fillBuffer(letterVertices);
mTexCoordBuff = fillBuffer(letterTexcoords);
mNormBuff = fillBuffer(letterNormals);
mIndBuff = fillBuffer(letterIndices);
}
@Override
public Buffer getBuffer(BUFFER_TYPE bufferType)
{
Buffer result = null;
switch (bufferType)
{
case BUFFER_TYPE_VERTEX:
result = mVertBuff;
break;
case BUFFER_TYPE_TEXTURE_COORD:
result = mTexCoordBuff;
break;
case BUFFER_TYPE_INDICES:
result = mIndBuff;
break;
case BUFFER_TYPE_NORMALS:
result = mNormBuff;
default:
break;
}
return result;
}
@Override
public int getNumObjectVertex()
{
return letterVertices.length / 3;
}
@Override
public int getNumObjectIndex()
{
return letterIndices.length;
}
}
| [
"[email protected]"
] | |
de6964918efa47e95608b55f083c4c834e652227 | 449cc92656d1f55bd7e58692657cd24792847353 | /weixin/src/main/java/com/lj/business/weixin/service/impl/handler/ChatFriendsHandler.java | 6a5c5d701456a1f4025159119e00528c9aae1f4c | [] | no_license | cansou/HLM | f80ae1c71d0ce8ead95c00044a318796820a8c1e | 69d859700bfc074b5948b6f2c11734ea2e030327 | refs/heads/master | 2022-08-27T16:40:17.206566 | 2019-12-18T06:48:10 | 2019-12-18T06:48:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,207 | java | package com.lj.business.weixin.service.impl.handler;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.lj.business.member.dto.shopterminal.FindShopTerminalReturn;
import com.lj.business.member.service.IShopTerminalService;
import com.lj.business.supcon.dto.friends.AddCommentInfoMessage;
import com.lj.business.supcon.dto.friends.AddFriendsInfoMessage;
import com.lj.business.supcon.dto.friends.AddFriendsPicDownMessage;
import com.lj.business.supcon.dto.friends.AddLikesInfoMessage;
import com.lj.business.supcon.service.IChatFriendsFacade;
import com.lj.business.supcon.service.ICommonService;
import com.lj.business.weixin.dto.ImCommentInfoDto;
import com.lj.business.weixin.dto.ImFriendsInfoDto;
import com.lj.business.weixin.dto.ImLikeInfoDto;
import com.lj.business.weixin.dto.ToDownloadPic;
@Component
public class ChatFriendsHandler {
private static Logger LOG = LoggerFactory.getLogger(ChatFriendsHandler.class);
@Autowired
ICommonService commonService;
@Resource
FriendsQueryHandler friendsQueryHandler;
@Resource
IShopTerminalService shopTerminalService;
public boolean sendFriendsMessage(ImFriendsInfoDto imFriendsInfoDto){
try {
LOG.debug(" begin send add friends info to wx :{} ,noWxShop:{} , imei:{} ",imFriendsInfoDto,imFriendsInfoDto.getNoWxShop());
FindShopTerminalReturn shopTerminal = friendsQueryHandler.getShopTerminalServiceByNoWx(imFriendsInfoDto.getNoWx());
AddFriendsInfoMessage addFriendsInfoMessage = new AddFriendsInfoMessage();
addFriendsInfoMessage.setFriendsCode(imFriendsInfoDto.getCode());
addFriendsInfoMessage.setMemberNoGm(imFriendsInfoDto.getMemberNo());
addFriendsInfoMessage.setNickName(imFriendsInfoDto.getNickName());
addFriendsInfoMessage.setNoWxShop(imFriendsInfoDto.getNoWxShop());
addFriendsInfoMessage.setResources(imFriendsInfoDto.getImgAddr());
addFriendsInfoMessage.setShareTitle(imFriendsInfoDto.getSharetitle());
addFriendsInfoMessage.setShareUrl(imFriendsInfoDto.getShareurl());
addFriendsInfoMessage.setType(imFriendsInfoDto.getType());
addFriendsInfoMessage.setContent(imFriendsInfoDto.getContent());
addFriendsInfoMessage.setHeadImg(shopTerminal.getHeadAddress());
addFriendsInfoMessage.setWhoType(imFriendsInfoDto.getWhoType());
addFriendsInfoMessage.setWhoNoWxs(imFriendsInfoDto.getWhoNoWxs());
addFriendsInfoMessage.setRemindNoWxs(imFriendsInfoDto.getRemindNoWxs());
IChatFriendsFacade basic = commonService.getHessianIChatFriendsFacade(addFriendsInfoMessage.getNoWxShop());
basic.sendFriendsInfo(addFriendsInfoMessage);
LOG.debug("send friends success wait result callback :{}",addFriendsInfoMessage);
return true;
} catch (Exception e) {
LOG.error("send friends fail , :{}",imFriendsInfoDto);
}
return false;
}
public boolean sendLikesMessage(ImLikeInfoDto imLikeInfoDto,String memberNoGm){
try {
LOG.debug(" begin send add likes info to wx :{}",imLikeInfoDto);
AddLikesInfoMessage addLikesInfoMessage = new AddLikesInfoMessage();
addLikesInfoMessage.setFriendsId(imLikeInfoDto.getFriendsId());
addLikesInfoMessage.setLikesCode(imLikeInfoDto.getCode());
addLikesInfoMessage.setImei(imLikeInfoDto.getImei());
addLikesInfoMessage.setMemberNo(imLikeInfoDto.getMemberNo());
addLikesInfoMessage.setNickName(imLikeInfoDto.getNickname());
addLikesInfoMessage.setNoWxShop(imLikeInfoDto.getNoWxShop());
addLikesInfoMessage.setMemberNoGm(memberNoGm);
IChatFriendsFacade basic = commonService.getHessianIChatFriendsFacade(addLikesInfoMessage.getNoWxShop());
basic.sendLikeInfo(addLikesInfoMessage);
LOG.debug(" end send add likes info :{}",addLikesInfoMessage);
return true;
} catch (Exception e) {
LOG.error("send friends fail , :{}",imLikeInfoDto);
}
return false;
}
public boolean sendCommentMessage(ImCommentInfoDto imCommentInfoDto,String memberNoGm,String commentSvrId){
try {
LOG.debug(" begin send comment to zk wx :{} ,data :{} ",imCommentInfoDto.getNoWxShop(),imCommentInfoDto);
AddCommentInfoMessage addCommentInfoMessage = new AddCommentInfoMessage();
addCommentInfoMessage.setCommentCode(imCommentInfoDto.getCode());
addCommentInfoMessage.setFriendsId(imCommentInfoDto.getFriendsId());
addCommentInfoMessage.setContent(imCommentInfoDto.getContent());
addCommentInfoMessage.setImei(imCommentInfoDto.getImei());
addCommentInfoMessage.setMemberNoGm(memberNoGm);
addCommentInfoMessage.setNickName(imCommentInfoDto.getNickname());
addCommentInfoMessage.setNoWxShop(imCommentInfoDto.getNoWxShop());
addCommentInfoMessage.setToNickName(imCommentInfoDto.getTonickname());
addCommentInfoMessage.setToNoWx(imCommentInfoDto.getTousername());
// addCommentInfoMessage.setShopNo(imCommentInfoDto.getShopNo());
addCommentInfoMessage.setCommentSerId(commentSvrId);
IChatFriendsFacade basic = commonService.getHessianIChatFriendsFacade(addCommentInfoMessage.getNoWxShop());
basic.sendCommentInfo(addCommentInfoMessage);
LOG.debug("end send comment to zk wx :{} ", addCommentInfoMessage);
return true;
} catch (Exception e) {
LOG.error("send comment friends fail , :{}",e,imCommentInfoDto);
}
return false;
}
public boolean sendFriendsPicDownMessage(ToDownloadPic toDownloadPic){
try {
LOG.debug(" begin send download img to zk wx data :{} ",toDownloadPic);
AddFriendsPicDownMessage addFriendsPicDownMessage = new AddFriendsPicDownMessage();
addFriendsPicDownMessage.setEncKey(toDownloadPic.getEncKey());
addFriendsPicDownMessage.setFriendsId(toDownloadPic.getFriendsId());
addFriendsPicDownMessage.setImgUrl(toDownloadPic.getImgUrl());
addFriendsPicDownMessage.setNoWx(toDownloadPic.getNoWx());
IChatFriendsFacade basic = commonService.getHessianIChatFriendsFacade(addFriendsPicDownMessage.getNoWx());
basic.sendPicUrlDownLoad(addFriendsPicDownMessage);
} catch (Exception e) {
LOG.error(" SEND DOWNLOAD IMG error , {}",toDownloadPic,e);
}
return false;
}
}
| [
"[email protected]"
] | |
bd233eaf02465363ce5dab72de51f290f1e9e669 | 16e536456c3791e908ddcd11a31083963b9e88ca | /dev/back/src/test/java/laurent/fitness/controller/TimestampFacilityControllerTest.java | a3cc7bfc296aada4e62cf681137b5461ca9c8dbd | [
"MIT"
] | permissive | laurentpicardLP2/smartFitness | 4e7b198045fb20956ee45f4d58ae1ab681131b27 | b52fa5f011f817409326f8510d2a0133a986aa51 | refs/heads/master | 2023-01-12T01:20:01.712826 | 2019-06-27T18:50:46 | 2019-06-27T18:50:46 | 177,403,297 | 1 | 0 | MIT | 2023-01-07T04:07:01 | 2019-03-24T11:08:08 | null | UTF-8 | Java | false | false | 2,596 | java | package laurent.fitness.controller;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.json.JacksonTester;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.MediaType;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import com.fasterxml.jackson.databind.ObjectMapper;
import laurent.fitness.model.Evenement;
import laurent.fitness.model.TimestampFacility;
import laurent.fitness.services.TimestampFacilityService;
@RunWith(SpringRunner.class)
@SpringBootTest
@AutoConfigureMockMvc
public class TimestampFacilityControllerTest {
@Autowired
MockMvc mockMvc;
@Autowired
private ObjectMapper objectMapper;
JacksonTester<Evenement> evenementJacksonTester;
@MockBean
TimestampFacilityService timestampFacilityService;
@Before
public void setUp() {
JacksonTester.initFields(this, objectMapper);
}
@Test
@WithMockUser(roles={"CUSTOMER"})
public void addTimestampFacility() throws Exception {
TimestampFacility timestampFacility = new TimestampFacility();
when(this.timestampFacilityService.saveTimestampFacility(timestampFacility)).thenReturn(new TimestampFacility());
String jsonContent = "";
this.mockMvc.perform(post("/timestampfacilityctrl/addtimestampfacility/1/Elliptique 1/Elliptique").contentType(MediaType.APPLICATION_JSON_UTF8).content(jsonContent))
.andExpect(status().isOk());
}
//Remarque : il n'y a pas besoin dede @Test deleteTimestampFacility car il n'y a jamais de requête directe
//depuis le front pour supprimer un timestampFacility
@Test
@WithMockUser(roles={"CUSTOMER"})
public void deleteTimestampFacility() throws Exception {
doNothing().when(this.timestampFacilityService).deleteTimestampFacility(1);
this.mockMvc.perform(delete("/timestampfacilityctrl/deletetimestampfacility/1")).andExpect(status().isOk());
}
}
| [
"[email protected]"
] | |
9ca605bdeb7850cdfa0cf150b14321db3203b4f7 | e19640d1d657fadb81d877fb812d9024319e994c | /RoketUp/app/src/main/java/syahrulgunawan/roketup/data/Data.java | bbb4c4b1641ab229a7f74f999ae36eef4152a588 | [] | no_license | 1syahrulgunawan1/PROYEK_PPB | d9755c0d531627073929de1653462659ca77fc87 | 5bca7c034ddec506e5c67e32c20b12ccf8fab238 | refs/heads/master | 2020-03-10T12:11:23.788923 | 2018-06-06T04:54:24 | 2018-06-06T04:54:24 | 129,371,756 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 471 | java | package syahrulgunawan.roketup.data;
public class Data {
private String id, roket;
public Data() {
}
public Data(String id, String roket) {
this.id = id;
this.roket = roket;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getRoket() {
return roket;
}
public void setRoket(String roket) {
this.roket = roket;
}
} | [
"[email protected]"
] | |
2489fc77d7d6ac2263d72ad761de6ec74dfb99e7 | c1ebfa07c881d14946afc8a6c19c23ad3cc1124f | /remapper-api/src/main/java/me/hp888/remapper/api/config/ConfigurationLoader.java | 011ac8d9f94e0375a9f5b55087d25742d514ee3f | [] | no_license | v404/ForgeModRemapper | 7c8f697e2ac30119d52863b19c895800b506826a | e17d803e6649f5be21b07dfe0320881cdb48c0c7 | refs/heads/master | 2020-07-26T01:35:19.451689 | 2019-09-14T18:48:50 | 2019-09-14T18:48:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 185 | java | package me.hp888.remapper.api.config;
import java.io.IOException;
/**
* @author hp888 on 14.09.2019.
*/
public interface ConfigurationLoader
{
void load() throws IOException;
} | [
"[email protected]"
] | |
19cf446cc724309792b35229423cb9e48bcd5a98 | f19cce37f3684b68bebd0480ae85b23ddf56e22a | /src/Adaptado/Escudo.java | 9f6da2b9142ce4089e02618da12f7f6043e5a0d6 | [] | no_license | cristianrodriguez05/CatalogoPJAnimado | c3633e6d0b50010e918033748e971abc5c3f1ad6 | 59a6ed12e0dd09e71a2f3581ee307b4ccc706b09 | refs/heads/master | 2020-05-22T03:42:18.594649 | 2019-06-05T15:39:05 | 2019-06-05T15:39:05 | 186,217,230 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 370 | 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 Adaptado;
import javax.swing.ImageIcon;
/**
*
* @author estudiantes
*/
public interface Escudo {
public ImageIcon tipoEscudo();
public String descripcion();
}
| [
"[email protected]"
] | |
69457e015c524eb7c8a525a7b5b3993d190ed718 | d8fb55885b3a021cbf984d9e8358b3a2b6baae9d | /mapp/src/main/java/com/hzecool/app/bean/event/SearchNaviEvent.java | 8df972b85e1bb05da4ba5898fa5efc6f58d97769 | [] | no_license | tututututututu/RecycleNow | d01de026de54973ed1232536d5b5d7359eea496e | bab035dca7933795020d5505b1b72d47f5a492c1 | refs/heads/master | 2020-03-19T03:12:00.861945 | 2018-07-25T15:54:11 | 2018-07-25T15:54:11 | 135,704,436 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 522 | java | package com.hzecool.app.bean.event;
/**
* Created by wangzhiguo on 2017/4/19.
*/
public class SearchNaviEvent extends BaseEvent {
private int position;
private String inputContent;
public int getPosition() {
return position;
}
public void setPosition(int position) {
this.position = position;
}
public String getInputContent() {
return inputContent;
}
public void setInputContent(String inputContent) {
this.inputContent = inputContent;
}
}
| [
"[email protected]"
] | |
657d1840de2d50ba643e1d5505edd0b8bf58b003 | b73da3cc5688aa838251b10382351a0b5b957c2a | /HelloWorld/src/helloworld/HelloWorld.java | 9d71ae2466cce7d7786f005ee3db3c6b2f9088eb | [] | no_license | MikhailMamro/Java | 585169367fee829508399b32ce852344c6b0822e | b665cb10d57fe73fec6baad17a9666e22dfb70e6 | refs/heads/master | 2021-01-01T05:15:17.663525 | 2016-12-28T08:53:08 | 2016-12-28T08:53:08 | 77,516,063 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 159 | java |
package helloworld;
public class HelloWorld {
public static void main(String[] args) {
System.out.printf("Hello World");
}
}
| [
"[email protected]"
] | |
c62b492910466c70e24bd6074e8525c9c56f5c9b | e719fda0ac7da65d8de44c72ec14036967f27883 | /src/test/java/firstClassVersions/JunitExample.java | 00647a9096130c2ab39f50a24a800b50894201c0 | [] | no_license | eyilmaz4/Junit_IQ_7_13_20 | b27bffd0f244f3371b63b6025b9efc340a567c3c | 508b8d9462be51f70d02772043625cfa36421372 | refs/heads/master | 2022-12-23T10:50:38.153897 | 2020-09-23T20:37:47 | 2020-09-23T20:37:47 | 297,759,193 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,881 | java | package firstClassVersions;
import Resource.Base;
import org.junit.Assert;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
/**
* @author: Esra
*/
public class JunitExample extends Base {
//static WebDriver driver;
// @BeforeAll
// public static void setUp(){
// WebDriverManager.chromedriver().setup(); //instead of System.setProperty("webDriver.crome.driver",(path")
// driver= new ChromeDriver();
// driver.get("https://opensource-demo.orangehrmlive.com/");
// driver.manage().window().maximize();
// }
@Test
public void login(){
driver.findElement(By.id("txtUsername")).sendKeys("Admin");
driver.findElement(By.id("txtPassword")).sendKeys("admin123");
driver.findElement(By.id("btnLogin")).click();
}
@Test
public void addEmployee()throws InterruptedException{
Actions action= new Actions(driver);
WebElement pim= driver.findElement(By.xpath("//a[@id='menu_pim_viewPimModule']/b"));
action.moveToElement(pim).build().perform();
WebElement addEmployee=driver.findElement(By.linkText("Add Employee"));
addEmployee.click();
driver.findElement(By.id("firstName")).sendKeys("Esra");
driver.findElement(By.id("lastName")).sendKeys("Yilmaz");
String expectedID=driver.findElement(By.cssSelector("#employeeId")).getAttribute("value");
driver.findElement(By.id("btnSave")).click();
String actualID= driver.findElement(By.id("personal_txtEmployeeId")).getAttribute("value");
Assert.assertEquals("not equal",expectedID,actualID);
driver.findElement(By.xpath("//a[text()='Welcome Admin']")).click();
Thread.sleep(5000);
driver.findElement(By.linkText("Logout")).click();
}
} | [
"[email protected]"
] | |
4b86f547a53cbd2d27530be4d196adb32d1afaa4 | 08ccbdde44cdf3c65969c0b5f2b6c31bb0bf4e2a | /src/main/java/com/wearock/fakeingestor/Main.java | 12719b2bff6da9006cd3f9633a355c9849ff7a29 | [] | no_license | wearock/fake-ingestor | 5ef4013c89b8cf7fe955888de4592efe4ed31658 | 122e3185128ac3f5f945ccb78c0e4b5cfc057b1b | refs/heads/master | 2020-05-28T11:49:42.872642 | 2019-06-03T05:33:52 | 2019-06-03T05:33:52 | 175,156,437 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 536 | java | package com.wearock.fakeingestor;
import javax.xml.ws.Endpoint;
import com.wearock.fakeingestor.services.*;
public class Main {
public static void main(String[] args) {
String server = "127.0.0.1:9999";
if (args.length > 0) {
server = args[0];
}
Endpoint.publish(String.format("http://%s/auth/ws", server), new Authentication());
Endpoint.publish(String.format("http://%s/upload/ws", server), new Upload(server));
System.out.println("Services up and running!");
}
}
| [
"[email protected]"
] | |
c14c03e867d1a92722efd731211e8b291673dacd | 206b1549f1bb22a1af0865ebb7678c28341cd1bf | /back/src/main/java/com/smacul/demo/model/ArtFullMod.java | 50cab132b38ca9c3149b34c246a6ab191f47633f | [
"MIT"
] | permissive | hjy200022/NewsRecommend | 29383f5582d3fa051c1f5a2999436dac5e4cfd8f | ea694c194a9cef5124f20a4e7eb464b4210ec925 | refs/heads/main | 2022-12-29T20:25:50.248819 | 2020-06-03T10:29:44 | 2020-06-03T10:29:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,747 | java | package com.smacul.demo.model;
import com.smacul.demo.bean.ArtFeatureCount;
import com.smacul.demo.bean.Customer;
import java.sql.Timestamp;
public class ArtFullMod {
private Integer artId;
private String artTitle;
private String artContent;
private String artSpider;
private String artType;
private String artTags;
private String artImageUrl;
private Timestamp artTime;
private Integer artLegal;
private Integer artCusId;
// 文章作者
private Customer customer;
private ArtFeatureCount artFeature;
// 浏览者-文章的行为
private CusArtBehaviorMod cusArtBehavior;
public Integer getArtId() {
return artId;
}
public void setArtId(Integer artId) {
this.artId = artId;
}
public String getArtTitle() {
return artTitle;
}
public void setArtTitle(String artTitle) {
this.artTitle = artTitle;
}
public String getArtContent() {
return artContent;
}
public void setArtContent(String artContent) {
this.artContent = artContent;
}
public String getArtSpider() {
return artSpider;
}
public void setArtSpider(String artSpider) {
this.artSpider = artSpider;
}
public String getArtType() {
return artType;
}
public void setArtType(String artType) {
this.artType = artType;
}
public String getArtTags() {
return artTags;
}
public void setArtTags(String artTags) {
this.artTags = artTags;
}
public String getArtImageUrl() {
return artImageUrl;
}
public void setArtImageUrl(String artImageUrl) {
this.artImageUrl = artImageUrl;
}
public Timestamp getArtTime() {
return artTime;
}
public void setArtTime(Timestamp artTime) {
this.artTime = artTime;
}
public Integer getArtLegal() {
return artLegal;
}
public void setArtLegal(Integer artLegal) {
this.artLegal = artLegal;
}
public Integer getArtCusId() {
return artCusId;
}
public void setArtCusId(Integer artCusId) {
this.artCusId = artCusId;
}
public Customer getCustomer() {
return customer;
}
public void setCustomer(Customer customer) {
this.customer = customer;
}
public ArtFeatureCount getArtFeature() {
return artFeature;
}
public void setArtFeature(ArtFeatureCount artFeature) {
this.artFeature = artFeature;
}
public CusArtBehaviorMod getCusArtBehavior() {
return cusArtBehavior;
}
public void setCusArtBehavior(CusArtBehaviorMod cusArtBehavior) {
this.cusArtBehavior = cusArtBehavior;
}
}
| [
"[email protected]"
] | |
f077799209bae234cd668a64dd3fd29264fa6e31 | 5cc4d1b811b40cd59423c060f850c5b65f3d1e95 | /manport/src/main/java/com/akinkemer/manport/domain/BaseEntity.java | 4916b1156911e9cbea5fff56f2c48142984c7083 | [] | no_license | akinkemer/MANPORT-Spring-Project | ea145e40a0696c0f35e4d170542a23df268b10d3 | 9836309946924917874c9c5098791db85efa7d2f | refs/heads/main | 2023-03-27T21:07:59.438350 | 2021-03-30T21:46:38 | 2021-03-30T21:46:38 | 352,193,611 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 340 | java | package com.akinkemer.manport.domain;
import javax.persistence.*;
@MappedSuperclass
public abstract class BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}
| [
"[email protected]"
] | |
268a5125f33ff10ac7aeea19a73ca4f1ae99bcba | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/3/3_f2852f3a12fd557c01f1ad6136930204a1fe7e50/ImageOverlayInfo/3_f2852f3a12fd557c01f1ad6136930204a1fe7e50_ImageOverlayInfo_s.java | 216e7ad55af08d9a642a7a37e75a4c9d9273ce98 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 2,351 | java | package com.parworks.androidlibrary.response;
import java.io.IOException;
import java.io.Serializable;
import java.util.List;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
@SuppressWarnings("serial")
public class ImageOverlayInfo implements Serializable {
private String site;
private String content;
private String id;
private String imageId;
private String accuracy;
private String name;
private List<OverlayPoint> points;
/**
* The configuration object by parsing the content value.
*
* The reason to not replace content String with this object
* is to better handle old overlay content without the JSON
* format.
*/
private OverlayConfiguration configuration;
public String getSite() {
return site;
}
public void setSite(String site) {
this.site = site;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
// parse the content whenever this is set
parseOverlayContent();
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getImageId() {
return imageId;
}
public void setImageId(String imageId) {
this.imageId = imageId;
}
public String getAccuracy() {
return accuracy;
}
public void setAccuracy(String accuracy) {
this.accuracy = accuracy;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<OverlayPoint> getPoints() {
return points;
}
public void setPoints(List<OverlayPoint> points) {
this.points = points;
}
public OverlayConfiguration getConfiguration() {
return configuration;
}
private void parseOverlayContent() {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
try {
this.configuration = mapper.readValue(content, OverlayConfiguration.class);
} catch (IOException e) {
// when failing to parse the overlay content,
// generate an empty object and use default for everything
this.configuration = new OverlayConfiguration();
}
}
}
| [
"[email protected]"
] | |
21f64a67d597c98f1804656e7934709284e9c05e | cf45a1737fa4918004ee6c0bad687962907f5ad2 | /app/src/main/java/me/aerovulpe/sunshine/DetailActivity.java | af7b75daba6bd9bcbc66b24e7ead7d177dc041af | [] | no_license | RigDaddy/Sunshine-2 | e81cc7c77f2231118e0ac0bfc2b203d70454fcc5 | bec69744ee81b3cb7cd1a4440b08b7559e2599e8 | refs/heads/master | 2021-01-18T03:49:47.652970 | 2014-12-29T20:56:57 | 2014-12-29T20:56:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,752 | java | package me.aerovulpe.sunshine;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class DetailActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
if (savedInstanceState == null) {
String date = getIntent()
.getStringExtra(ForecastFragment.EXTRA_WEATHER_DATE);
Bundle args = new Bundle();
args.putString(ForecastFragment.EXTRA_WEATHER_DATE, date);
DetailFragment swap = new DetailFragment();
swap.setArguments(args);
getFragmentManager().beginTransaction()
.replace(R.id.weather_detail_container, swap)
.commit();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_detail, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
Intent intent = new Intent(this, SettingsActivity.class);
startActivity(intent);
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"[email protected]"
] | |
85e68c129a205d0512c257359ca6c9c47453e85c | 31c1a57f92aac554918af05887fd06e50a8ca5c3 | /src/main/java/org/llama/library/net/download/DownListener.java | 5ac193d4e673788ad674e321be1c91c8731327de | [] | no_license | tonny1228/entlib | 5dffe14382ea8a0ddaa0dcf4877a1b5a7cb3d159 | 48d807930a61051aa117517da18f48e5bd30eb40 | refs/heads/master | 2021-01-20T18:36:28.878229 | 2016-07-21T06:55:07 | 2016-07-21T06:55:07 | 60,682,204 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,487 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.llama.library.net.download;
import java.math.BigDecimal;
import org.llama.library.log.LogFactory;
import org.llama.library.log.Logger;
/**
* 下载监听器,存储下载进度
*
* @author tonny
*/
public class DownListener extends Thread {
private Logger log = LogFactory.getLogger(DownListener.class);
private DownTask dlTask;
private Recorder recoder;
DownListener(DownTask dlTask) {
this.dlTask = dlTask;
this.recoder = new Recorder(dlTask);
}
@Override
public void run() {
BigDecimal completeTot = null;
long start = System.currentTimeMillis();
long end = start;
while (!dlTask.isComplete()) {
int percent = dlTask.getCurPercent();
completeTot = new BigDecimal(dlTask.getCompletedTot());
end = System.currentTimeMillis();
if (end - start > 1000) {
BigDecimal pos = new BigDecimal(((end - start) / 1000) * 1024);
log.info("下载速度 :{0} k/s, {1}% 已完成.", completeTot.divide(pos, 0, BigDecimal.ROUND_HALF_EVEN), percent);
}
recoder.record();
try {
sleep(3000);
} catch (InterruptedException ex) {
throw new RuntimeException(ex);
}
}
int costTime = +(int) ((System.currentTimeMillis() - start) / 1000);
dlTask.setCostTime(costTime);
String time = DownloadUtils.changeSecToHMS(costTime);
dlTask.rename();
recoder.remove();
log.info("Download finished in {0}. ", time);
}
}
| [
"[email protected]"
] | |
88544bc335347033f98ca2bb8707cca8cefccdd3 | c3445da9eff3501684f1e22dd8709d01ff414a15 | /LIS/sinosoft-parents/lis-business/src/main/java/com/sinosoft/lis/tb/ParseGuideInUI.java | dc210dd3ba2d4496384ca267f8a00186ef584dcf | [] | no_license | zhanght86/HSBC20171018 | 954403d25d24854dd426fa9224dfb578567ac212 | c1095c58c0bdfa9d79668db9be4a250dd3f418c5 | refs/heads/master | 2021-05-07T03:30:31.905582 | 2017-11-08T08:54:46 | 2017-11-08T08:54:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,567 | java | package com.sinosoft.lis.tb;
import org.apache.log4j.Logger;
import com.sinosoft.utility.CErrors;
import com.sinosoft.utility.VData;
/**
* <p>
* Title: Web业务系统
* </p>
* <p>
* Description:被保险人资料变更功能类
* </p>
* <p>
* Copyright: Copyright (c) 2002
* </p>
* <p>
* Company: Sinosoft
* </p>
*
* @author Tjj
* @version 1.0
*/
public class ParseGuideInUI {
private static Logger logger = Logger.getLogger(ParseGuideInUI.class);
/** 错误处理类,每个需要错误处理的类中都放置该类 */
public CErrors mErrors = new CErrors();
/** 往后面传输数据的容器 */
private VData mInputData = new VData();
/** 往界面传输数据的容器 */
private VData mResult = new VData();
/** 数据操作字符串 */
private String mOperate;
public ParseGuideInUI() {
}
/**
* 传输数据的公共方法
*/
public boolean submitData(VData cInputData, String cOperate) {
// 将操作数据拷贝到本类中
this.mOperate = cOperate;
ParseGuideIn tParseGuideIn = new ParseGuideIn();
logger.debug("---UI BEGIN---" + mOperate);
mResult = tParseGuideIn.getResult();
if (tParseGuideIn.submitData(cInputData, cOperate) == false) {
// @@错误处理
this.mErrors.copyAllErrors(tParseGuideIn.mErrors);
return false;
} else {
if (tParseGuideIn.mErrors.needDealError()) {
this.mErrors.copyAllErrors(tParseGuideIn.mErrors);
}
}
return true;
}
public VData getResult() {
return mResult;
}
public static void main(String[] args) {
logger.debug("-------test...");
}
}
| [
"[email protected]"
] | |
de97b8215d62690bf3ba610187781553f6ed6079 | 70357cb8ec5aac912793652ccaf512289d133dc5 | /comp_vision/src/instances/ImageTags.java | 3db1d701752f797144021319253206c009d06e05 | [] | no_license | pritesh1/dsprojects | 6163814e0e5faffbd8d17da8fb830df936edeea7 | 94bb53b766f11cc8a57622049bde30f9e897c2b1 | refs/heads/master | 2020-09-22T07:56:25.227623 | 2016-09-06T15:34:17 | 2016-09-06T15:34:17 | 66,671,089 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 21,659 | java | package instances;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;
import org.openimaj.ml.clustering.FloatCentroidsResult;
import org.openimaj.ml.clustering.assignment.HardAssigner;
public class ImageTags {
private static HashMap<String, String> url2keywords = new HashMap<String, String>();
private static HashMap<String, String> url2access = new HashMap<String, String>();
private static StringBuffer pageSource = new StringBuffer(2000);
private static boolean stop = false;
private static FloatCentroidsResult fcr = null;
private static List<String> keyList = null;
private static RGBInstances iRep = new RGBInstances();
static int[] SIFThistogram = new int[1200];
public static String location = System
.getProperty("DOWNLOAD_LOCATION",
"/Users/Andreea/Documents/Research/Data/images project/data/cotraining files/arff_newdata/");
private static void runSift(File filename) throws IOException{
int testCount = 10;
int i=0;
int lines = getTotalLines(filename.getParentFile().getAbsolutePath()+"_SIFT_TMP");
for(; i<keyList.size()&&testCount>0;i++){
if(i<lines){
continue;
}
System.out.println("iteration - "+i);
try{
iRep.getSIFTFeaturesForURL(keyList.get(i), filename.getParentFile().getAbsolutePath(), filename.getAbsolutePath() + "SIFT.arff", fcr);
} catch (IOException e) {
e.printStackTrace();
}
testCount--;
}
if(i == keyList.size())
stop = true;
}
private static int getTotalLines(String filestr) throws IOException{
File file = new File(filestr);
if(!file.exists()){
return 0;
}
String url;
int count = 0;
BufferedReader br = new BufferedReader(new FileReader(file));
while((url = br.readLine())!=null){
count++;
}
return count;
}
private static File printUnique(File file) throws IOException{
FileInputStream inputStream;
try {
inputStream = new FileInputStream(file);
DataInputStream in = new DataInputStream(inputStream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
Set<String> lines = new HashSet<String>();
String line = null;
int count = 0;
while ((line = (br.readLine())) != null) {
if (!lines.contains(line.toString())) {
lines.add(line);
}
}
String fileName = file.getAbsolutePath();
fileName = fileName.substring(0, fileName.length() - 4);
File nFile = new File(fileName + "_unique");
FileWriter fw = new FileWriter(nFile);
for (String str : lines) {
fw.write(str + "\n");
}
fw.close();
br.close();
return nFile;
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return file;
}
public static void addFeaturesHeader(String file, String keyword, char attribute, int count){
File fileOut = new File(file);
if(fileOut.exists()){
return;
}
try{
FileWriter fw = new FileWriter(file);
String lsp = "\n";
fw.write("@relation " + keyword + " " + lsp);
for (int i = 0; i < count; i++)
{
fw.write("@attribute "+ attribute + i + " numeric" + lsp);
}
fw.write("@attribute class" + attribute +" {\"public\", \"private\"}" + lsp);
fw.write("@data" + lsp);
fw.close();
}
catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
private static int getNumberOfLines(File filename, String sep) {
if (!filename.exists())
return 0;
FileInputStream inputStream;
try {
inputStream = new FileInputStream(filename);
DataInputStream in = new DataInputStream(inputStream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String url;
String lastUrl = null;
while ((url = br.readLine()) != null) {
lastUrl = url;
}
if (lastUrl == null)
return 0;
String[] strarr = lastUrl.split(sep);
return Integer.parseInt(strarr[0]);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return 0;
}
public static String getUrlID(String staticUrl){
String [] splitStrs = staticUrl.split("/");
int numSplits = splitStrs.length;
//System.out.println(splitStrs[numSplits-1]);
String[] urlIdSplit = splitStrs[numSplits-1].split("_");
//System.out.println(urlIdSplit[0]);
return urlIdSplit[0].trim();
}
public static void getPageSource(HttpURLConnection con){
if(pageSource.length()>0){
pageSource.delete(0, pageSource.length()-1);
}
InputStream in;
try{
in = new BufferedInputStream(con.getInputStream());
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String line;
while((line = br.readLine())!=null){
pageSource.append(line+"\n");
}
} catch (Exception e) {
e.printStackTrace();
}
}
public static String getImageKeyWords(){
try{
String[] lines = pageSource.toString().split(System.getProperty("line.separator"));
for(String line : lines){
// pastreaza din pagina sursa doar partea cu keywords
if (line.contains("<meta") && line.contains("keywords")) {
pageSource.delete(0, pageSource.length() - 1);
pageSource.append(line);
}
if(pageSource!=null){
int st = pageSource.indexOf("content");
int en = pageSource.indexOf(">", st);
String imageLink = pageSource.substring(st + 9, en - 1);
return imageLink;
}
}
}catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static String populateKeywords(String url, String staticUrl){
HttpURLConnection con = null;
try {
con = (HttpURLConnection) new URL(url).openConnection();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("orignal url: " + con.getURL());
System.out.println("connected url: " + con.getURL());
String keywords = null;
try{
con.connect();
if(con.getInstanceFollowRedirects()){
// downloads the page source
getPageSource(con);
// extract the keywords
keywords = getImageKeyWords();
System.out.println("Keywords of the image are - " + keywords);
} else{
staticUrl = null;
}
} catch (IOException e) {
e.printStackTrace();
}
return keywords;
}
private static boolean canConnect(String url) {
HttpURLConnection con = null;
try {
con = (HttpURLConnection) new URL(url).openConnection();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
try {
con.connect();
if (con.getInstanceFollowRedirects()) {
return true;
} else {
return false;
}
} catch (IOException e) {
return false;
}
}
private static void addToMD(String string, String keyWords, String privacy,
File mdFile, int urlCount) {
try {
FileWriter fw = new FileWriter(mdFile, true);
fw.write(urlCount + "-" + string + ":" + keyWords + "_" + privacy
+ "\n");
fw.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static ArrayList<float[]> getCodeBookFloatList(File cbFile){
FileInputStream inputStream;
ArrayList<float[]> f2 = new ArrayList<float[]>();
try{
inputStream = new FileInputStream(cbFile);
DataInputStream in = new DataInputStream(inputStream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
StringBuffer line = new StringBuffer(700000);
int count = 0;
while((line.append(br.readLine())).toString()!=null){
String[] strarr = line.toString().split(" ");
if (strarr.length == 1) {
System.out.println(line);
return f2;
}
String floatVals = strarr[1];
// values for each attribute
String[] floatArr = floatVals.split(";");
for(String floatVal : floatArr){
String[] floats = floatVal.split(",");
// flist contains the feature for an attribute
ArrayList<Float> flist = new ArrayList<Float>();
for (String flt : floats) {
flist.add(Float.parseFloat(flt));
}
//transforms arraylist in float vector
float[] flarr = new float[flist.size()];
for (int i = 0; i < flarr.length; i++)
flarr[i] = flist.get(i);
f2.add(flarr);
}
line.delete(0, line.length() - 1);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return f2;
}
public static void populateDictionary(File mdFile) {
FileInputStream inputStream;
try {
inputStream = new FileInputStream(mdFile);
DataInputStream in = new DataInputStream(inputStream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
StringBuffer url = new StringBuffer(2000);
int count = 0;
while ((url.append(br.readLine())).toString() != null) {
//System.out.println(count + " ");
String[] starr = url.toString().split("-");
String keyval = "";
for (int i = 1; i < starr.length; i++){
keyval += starr[i];
}
String[] kvp = keyval.split("jpg:");
if (kvp.length == 1)
break;
String urlkey = kvp[0] + "jpg";
urlkey = urlkey.trim();
count++;
if(url2keywords.containsKey(urlkey))
System.out.println("collision key - " + urlkey);
url2keywords.put(urlkey.trim(), kvp[1]);
url.delete(0, url.length() - 1);
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static List<String> getURLList(File mdFile) {
FileInputStream inputStream;
try {
inputStream = new FileInputStream(mdFile);
DataInputStream in = new DataInputStream(inputStream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
StringBuffer url = new StringBuffer(2000);
List<String> list = new ArrayList<String>();
while ((url.append(br.readLine())).toString() != null) {
String[] starr = url.toString().split("-");
String keyval = "";
for (int i = 1; i < starr.length; i++)
keyval += starr[i];
String[] kvp = keyval.split("jpg:");
if (kvp.length == 1)
break;
String urlkey = kvp[0] + "jpg";
list.add(urlkey);
url.delete(0, url.length() - 1);
}
return list;
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
private static void addImageTagsHeader(String string, int dataCount) {
try {
FileWriter fw = new FileWriter(string);
String lsp = "\n";
fw.write("@relation keywords" + lsp);
for (int i = 0; i < dataCount; i++)
{
fw.write("@attribute a" + i + " numeric" + lsp);
}
fw.write("@attribute class {\"public\", \"private\"}" + lsp);
fw.write("@data" + lsp);
fw.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public static void printSparseMatrix(String fileName) {
HashMap<String, Integer> kw2int = new HashMap<String, Integer>();
int count = 0;
// extracts all the KEYWORDS and their frequency
for (String url : keyList) {
url = url.trim();
String keywords = url2keywords.get(url);
String[] words = keywords.split(",");
for (String word : words) {
if (!kw2int.containsKey(word)) {
kw2int.put(word, count);
count++;
}
}
}
File filename = new File(fileName);
//puts ARFF HEADER
addImageTagsHeader(filename.getAbsolutePath(), kw2int.size());
FileWriter fw = null;
String lsp = "\n";
try {
fw = new FileWriter(filename, true);
for (String url : keyList) {
fw.write("{ ");
url = url.trim();
// extracts KEYWORDS
String keywords = url2keywords.get(url);
String[] words = keywords.split(",");
// PUTS IN SET KEYWORDS FREQUENCY IN THEIR NATURAL ORDER
Set<Integer> wordset = new TreeSet<Integer>();
for (String word : words) {
wordset.add(kw2int.get(word));
}
// WRITES THE INDEX FROM WORDSET
for (Integer index : wordset) {
fw.write(index.toString() + " 1 ,");
}
fw.write(new Integer(kw2int.size()).toString());
fw.write(" \"" + url2access.get(url) + "\"}\n");
// fw.write(" ?}\n");
}
fw.close();
} catch (FileNotFoundException e1) {
e1.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
private static void getSIFTFeature(String URL, String floatLine, FloatCentroidsResult fcr, File file) throws IOException {
FileWriter FW = null;
try {
FW = new FileWriter(file, true);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String[] strarr = floatLine.toString().split(" ");
if (strarr.length == 1) {
System.out.println(floatLine);
// return f2;
}
String floatVals = strarr[1];
String[] floatArr = floatVals.split(";");
HardAssigner<float[], ?, ?> assigner = fcr
.defaultHardAssigner();
for (int i = 0; i < SIFThistogram.length; i++) {
SIFThistogram[i] = 0;
}
for (String floatval : floatArr) {
String[] floats = floatval.split(",");
ArrayList<Float> flist = new ArrayList<Float>();
for (String flt : floats) {
flist.add(Float.parseFloat(flt));
}
float[] flarr = new float[flist.size()];
for (int i = 0; i < flarr.length; i++)
flarr[i] = flist.get(i);
int classLabel = assigner.assign(flarr);
SIFThistogram[classLabel] = SIFThistogram[classLabel] + 1;
}
FW.write("{ ");
for (int i = 0; i < SIFThistogram.length; i++) {
if (SIFThistogram[i] > 0) {
FW.write("" + i + " " + SIFThistogram[i] + ", ");
}
}
FW.write(new Integer(SIFThistogram.length).toString() + " ");
FW.write(" \"" + url2access.get(URL) + "\"}\n");
FW.close();
}
private static void getAllSIFTFeatures(File cbFile, List<String> urlList,FloatCentroidsResult fcr, File file )
{
iRep.addSIFTHeader(file.getAbsolutePath() ,
1200, "sift");
FileInputStream inputStream;
try {
inputStream = new FileInputStream(cbFile);
DataInputStream in = new DataInputStream(inputStream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
StringBuffer line = new StringBuffer(700000);
int count = 0;
while ((line.append(br.readLine())).toString() != null) {
// System.out.println(count++);
System.out.println("iteration - " + count);
String[] strarr = line.toString().split(" ");
if (strarr.length == 1) {
System.out.println(line);
return;
}
getSIFTFeature(urlList.get(count), line.toString(), fcr, file);
count++;
line.delete(0, line.length() - 1);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void run(File filename) throws IOException{
if(filename.exists()){
try{
FileInputStream inputStream = new FileInputStream(filename);
DataInputStream in = new DataInputStream(inputStream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String url = null;
ArrayList<float[]> f2 = new ArrayList<float[]>();
int urlCount = 0;
File cbFile = new File(filename.getAbsolutePath() + "_codebook");
File mdFile = new File(filename.getAbsolutePath() + "_metadata");
File rgbFile = new File(filename.getAbsolutePath() + "_rgb");
//iRep = rgb instance
iRep.addRGBHeader(rgbFile);
addFeaturesHeader(filename.getAbsolutePath() + "_facial", "facial", 'f', 2);
addFeaturesHeader(filename.getAbsolutePath() + "_edge", "edge", 'e', 144);
int numLines = 0;
int numLines1 = getNumberOfLines(cbFile, " ");
int numLines2 = getNumberOfLines(mdFile, "-");
if (numLines1 != numLines2)
{
System.err.println("invalid number of lines in the arff files");
in.close();
br.close();
return;
}
else{
numLines = numLines1;
}
while((url = br.readLine())!=null){
url = url.trim();
String[] starr = url.split(",");
String staticUrl = starr[1].trim();
staticUrl = staticUrl.replace("\"", "");
String privacy = starr[3].trim();
privacy = privacy.replace("\"", "");
url2access.put(staticUrl, privacy);
if (urlCount < numLines) {
urlCount++;
continue;
}
urlCount++;
System.out.print(urlCount + " ");
System.out.println(url);
//constructs the url of the page that contins the image
url = "http://flickr.com/photo.gne?id=" + getUrlID(staticUrl);
if(canConnect(url)){
boolean featuresPresent = true;
String keyWords = populateKeywords(url, staticUrl);
if(keyWords!=null){
{
try{
featuresPresent = instances.Codebook.loadCodebook(
staticUrl, f2, cbFile, urlCount);
} catch (Exception e) {
e.printStackTrace();
}
}
// if it has keywords and the codebook is loaded
//puts the keywords
url2keywords.put(staticUrl, keyWords);
// loads the data in the metadata file
addToMD(staticUrl, keyWords, privacy, mdFile, urlCount);
}
}
System.out.println("putting " + staticUrl + " with "+ privacy);
}
f2 = getCodeBookFloatList(cbFile);
populateDictionary(mdFile);
System.out.println("a total of " + url2keywords.size() + " lines");
//FC FILE = FLOAT CENTROIDS
File fcFile = new File(filename.getAbsolutePath() + "_fcr");
if (fcr == null) {
if (fcFile.exists()) {
fcr = new FloatCentroidsResult();
// A Scanner breaks its input into tokens using a delimiter pattern, which by default matches whitespace.
Scanner sc = new Scanner(fcFile);
fcr.readASCII(sc);
sc.close();
} else {
fcr = instances.Codebook.getCodeBook(f2, fcFile);
}
}
keyList = getURLList(mdFile);
// writes ARFF for TAGS
printSparseMatrix(filename.getAbsolutePath() + "TAGS.arff");
url2keywords.clear();
iRep.url2access = url2access;
File siftFile = new File(filename.getAbsolutePath() + "SIFT.arff");
getAllSIFTFeatures(cbFile, keyList, fcr, siftFile);
in.close();
br.close();
}
catch (IOException e) {
e.printStackTrace();
}
}
}
public static List<String> getURLList1(File metaFile) {
List<String> urlList = new ArrayList<String>();
if (!metaFile.exists())
return urlList;
FileInputStream inputStream;
try {
inputStream = new FileInputStream(metaFile);
DataInputStream in = new DataInputStream(inputStream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String url;
while ((url = br.readLine()) != null) {
String[] urlLines = url.split("jpg:");
String urlLine = urlLines[0];
String[] ulrkp = urlLine.split("-");
int key = Integer.parseInt( ulrkp[0] );
String val = ulrkp[1] + "jpg";
urlList.add(val.trim());
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return urlList;
}
@SuppressWarnings("resource")
private static int getNumLines(File filename) {
if (!filename.exists())
return 0;
FileInputStream inputStream;
try {
inputStream = new FileInputStream(filename);
DataInputStream in = new DataInputStream(inputStream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String url;
String lastUrl = null;
int lineCount = 0;
while ((url = br.readLine()) != null) {
lineCount++;
lastUrl = url;
}
if (lastUrl == null)
return 0;
return lineCount - 147;
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return 0;
}
public static void run_edge(File metaFile)
{
System.out.println("adding edge feature");
addFeaturesHeader(metaFile.getAbsolutePath() + "_edge", "edge", 'e', 144);
List<String> urls = getURLList1(metaFile);
int urlCount = 0;
int numLines = getNumLines(new File( metaFile.getAbsolutePath() + "_edge"));
for (String url : urls) {
urlCount++;
if(urlCount < numLines)
continue;
else if (canConnect(url)) {
// String keyWords = "";
try {
iRep.getEdgeDirectionCoherenceFeatures(url,
metaFile.getAbsolutePath() + "_edge",
url2access.get(url));
} catch (IOException e) {
// TODO Auto-generated catch block
System.err.println("error in url - " + url + " - count:" + urlCount);
System.exit(0);
//e.printStackTrace();
}
}
}
}
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
File folder = new File(location);
File[] listOfFiles = folder.listFiles();
for(int i=0;i<listOfFiles.length;i++){
File file = listOfFiles[i];
if(file.getName().endsWith("csv")){
File nFile = printUnique(file);
run(nFile);
}
}
}
}
| [
"[email protected]"
] | |
7740348739584ba99afaf14d727508b0682de0e5 | 03df23efee13d92b845ae47cfe293c9d13b00a73 | /src/main/java/org/blendee/sql/binder/BlobBinder.java | 526792aeef46215e5a64b3d44d7c4fe6d808c3e1 | [
"MIT"
] | permissive | blendee/blendee | ff394b8711d5a675db792813790cad1bfb12640d | ffb5fd81637714b5d8d3ec7359bcca516dd5a8cc | refs/heads/master | 2021-08-22T11:54:36.588983 | 2021-08-21T16:03:08 | 2021-08-21T16:03:08 | 77,333,384 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,142 | java | package org.blendee.sql.binder;
import java.sql.Blob;
import org.blendee.jdbc.BPreparedStatement;
import org.blendee.sql.Binder;
/**
* {@link BPreparedStatement} に {@link Blob} の値を設定するための {@link Binder} です。
* @author 千葉 哲嗣
*/
public final class BlobBinder extends Binder {
private final Blob value;
/**
* パラメータの値を持つインスタンスを生成します。
* @param value このインスタンスの値
*/
public BlobBinder(Blob value) {
this.value = value;
}
@Override
public void bind(int index, BPreparedStatement statement) {
statement.setBlob(index, value);
}
@Override
public String toString() {
return String.valueOf(value);
}
@Override
public Binder replicate() {
throw new UnsupportedOperationException();
}
@Override
public boolean canEvalValue() {
return true;
}
@Override
public Object getValue() {
return value;
}
/**
* このインスタンスの持つ値を返します。
* @return 値
*/
public Blob getBlobValue() {
return value;
}
@Override
protected Object getSpecificallyValue() {
return value;
}
}
| [
"[email protected]"
] | |
41ae2c1fd108f52ff2cd05c1df8ef54cb7d4cdc8 | e15d5915c9290910c9444a9b3eb59ce6a2befd47 | /br/com/caelum/contas/modelo/SeguroDeVida.java | d2ddae8ddadbb56e15433f1aa24d4261bcbcdcfb | [] | no_license | richardyamamoto/fj11-contas | b7a3df21dd81de36af37a544d4c03a3cb1fe3f4f | 4716bff7b9082991ced2f5cb2bc933ca916df9a5 | refs/heads/master | 2020-09-14T16:17:40.362683 | 2019-11-21T16:09:27 | 2019-11-21T16:09:27 | 223,181,213 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 693 | java | package br.com.caelum.contas.modelo;
public class SeguroDeVida implements Tributavel{
private double valor;
private String titular;
private int apolice;
@Override
public double getValorImposto() {
return 42 + this.valor * 0.02;
}
public double getValor() {
return valor;
}
public void setValor(double valor) {
this.valor = valor;
}
public String getTitular() {
return titular;
}
public void setTitular(String titular) {
this.titular = titular;
}
public int getApolice() {
return apolice;
}
public void setApolice(int apolice) {
this.apolice = apolice;
}
}
| [
"[email protected]"
] | |
11c9e86c8c983289f72a6d51825f0a0b1ff6deeb | dca733ff2de531822c17b9f340cd120de1ee0f4d | /taskforce-lib/java/src/main/java/org/teapotech/block/executor/file/GetFilePathBlockExecutor.java | a1cdf3c9de6f88271d4b3c8c6440169781d7a201 | [] | no_license | less-xx/taskforces | 42fb95db4408b137d40e78aa75f3b918a29bb61d | ff7beacedd66a8c3296636e9384a27b2ed58fded | refs/heads/master | 2022-09-30T19:53:59.871028 | 2019-12-22T22:56:13 | 2019-12-22T22:56:13 | 178,956,854 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,290 | java | /**
*
*/
package org.teapotech.block.executor.file;
import java.io.File;
import org.teapotech.block.exception.BlockExecutionException;
import org.teapotech.block.exception.InvalidBlockException;
import org.teapotech.block.executor.AbstractBlockExecutor;
import org.teapotech.block.executor.BlockExecutionContext;
import org.teapotech.block.executor.BlockExecutionProgress.BlockStatus;
import org.teapotech.block.model.Block;
import org.teapotech.block.model.BlockValue;
import org.teapotech.block.util.BlockExecutorUtils;
/**
* @author lessdev
*
*/
public class GetFilePathBlockExecutor extends AbstractBlockExecutor {
public GetFilePathBlockExecutor(Block block) {
super(block);
}
public GetFilePathBlockExecutor(BlockValue blockValue) {
super(blockValue);
}
@Override
protected Object doExecute(BlockExecutionContext context) throws Exception {
updateBlockStatus(context, BlockStatus.Running);
BlockValue bv = this.block.getBlockValueByName("file", null);
if (bv == null) {
throw new InvalidBlockException(block.getId(), block.getType(), "Missing file value");
}
File file = (File) BlockExecutorUtils.execute(bv, context);
if (!file.exists()) {
throw new BlockExecutionException("Cannot find file. ");
}
return file.getAbsolutePath();
}
}
| [
"[email protected]"
] | |
49716cda56cc583a1e80fff3942b761bbb835af2 | 588e19eb0bcdf1f32404d86ea4bdb0bf933fa39e | /app/src/main/java/com/project/zekiguler/notresang/KanAlFragment.java | 753a9711f1f5f42f003f12ce0b1b34a8ef497d02 | [] | no_license | zekiguler4/NotreSang | 7a390fc9e3e0b282592a84014aa34aa442de6a2a | daa6c3a172180d8ce20d9fb17d23ab450937478f | refs/heads/master | 2020-05-24T08:01:16.414361 | 2019-05-17T08:10:00 | 2019-05-17T08:10:00 | 187,173,208 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,284 | java | package com.project.zekiguler.notresang;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import java.util.Date;
import java.util.UUID;
public class KanAlFragment extends Fragment implements View.OnClickListener {
public Spinner kanGrubu, aciliyetGrubu;
public String latitude = "0.0", longitude = "0.0";
public String[] gruplar = {"0 RH(+)", "0 RH(-)", "A RH(+)", "A RH(-)", "B RH(+)", "B RH(-)", "AB RH(+)", "AB RH(-)"};
public String[] aciliyet = {"Kritik", "Çok Acil", "Acil", "Normal"};
public EditText hastaAdi, irtibatNo, hastaneAdi, aciklama;
public String hastaadi, irtibatno, hastaneadi, aciklamaa, kan, aciliyett;
public Button kanAraButton;
public AlertDialog.Builder alertDialogBuilder;
FirebaseDatabase firebaseDatabase;
DatabaseReference myRef;
FirebaseAuth mAuth;
public SharedPreferences locationInfo;
public static KanAlFragment newInstance() {
KanAlFragment fragment = new KanAlFragment();
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_kanal, container, false);
ArrayAdapter<String> dataAdapterforKanGrubu, dataAdapterforAciliyet;
kanGrubu = view.findViewById(R.id.kanalGrubu);
dataAdapterforKanGrubu = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, gruplar);
dataAdapterforKanGrubu.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
kanGrubu.setAdapter(dataAdapterforKanGrubu);
aciliyetGrubu = view.findViewById(R.id.aciliyetGrubu);
dataAdapterforAciliyet = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, aciliyet);
dataAdapterforAciliyet.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
aciliyetGrubu.setAdapter(dataAdapterforAciliyet);
hastaAdi = view.findViewById(R.id.kanalisimAlani);
irtibatNo = view.findViewById(R.id.irtibatNo);
hastaneAdi = view.findViewById(R.id.hastaneAdi);
aciklama = view.findViewById(R.id.aciklamaAlani);
kanAraButton = view.findViewById(R.id.kanarabutton);
kanAraButton.setOnClickListener(this);
alertDialogBuilder = new AlertDialog.Builder(getActivity());
mAuth = FirebaseAuth.getInstance();
firebaseDatabase = FirebaseDatabase.getInstance();
myRef = firebaseDatabase.getReference();
locationInfo = getActivity().getSharedPreferences("locationInfo", Context.MODE_PRIVATE);
return view;
}
public void onClick(View v) {
if (v == kanAraButton) {
InputMethodManager inputManager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
hastaadi = hastaAdi.getText().toString();
irtibatno = irtibatNo.getText().toString();
hastaneadi = hastaneAdi.getText().toString();
aciklamaa = aciklama.getText().toString();
kan = kanGrubu.getSelectedItem().toString();
aciliyett = aciliyetGrubu.getSelectedItem().toString();
latitude = locationInfo.getString("latitude", "0.0");
longitude = locationInfo.getString("longitude", "0.0");
if (hastaadi.equals("") || irtibatno.equals("") || aciklamaa.equals("") || hastaneadi.equals("") ||
latitude.equals("0.0") || longitude.equals("0.0")) {
String message = "";
if (hastaadi.equals("")) {
message = "Hasta Adı Eksik Girilmiştir. \n";
}
if (irtibatno.equals("")) {
message = message + "İrtibat No Eksik Girilmiştir. \n";
}
if (hastaneadi.equals("")) {
message = message + "Hastane Adı Eksik Girilmiştir. \n";
}
if (aciklamaa.equals("")) {
message = message + "Açıklama Eksik Girilmiştir. \n";
}
if (latitude.equals("0.0") || longitude.equals("0.0")){
message = message + "Konum Bilgisi Eksik, Konum Hizmetlerini Açınız";
}
alertDialogBuilder.setMessage(message);
} else {
UUID uuid1 = UUID.randomUUID();
Date date = new Date();
long dateByMilliSeconds = date.getTime();
String uuidString = uuid1.toString();
myRef.child("KanIlanlari").child(uuidString).child("IlanHastaAdi").setValue(hastaadi);
myRef.child("KanIlanlari").child(uuidString).child("IlanIrtibatNo").setValue(irtibatno);
myRef.child("KanIlanlari").child(uuidString).child("IlanHastaneAdi").setValue(hastaneadi);
myRef.child("KanIlanlari").child(uuidString).child("IlanKanGrubu").setValue(kan);
myRef.child("KanIlanlari").child(uuidString).child("IlanAciliyet").setValue(aciliyett);
myRef.child("KanIlanlari").child(uuidString).child("IlanAciklama").setValue(aciklamaa);
myRef.child("KanIlanlari").child(uuidString).child("IlanKonumLat").setValue(latitude);
myRef.child("KanIlanlari").child(uuidString).child("IlanKonumLon").setValue(longitude);
myRef.child("KanIlanlari").child(uuidString).child("IlanDate").setValue(Long.toString(dateByMilliSeconds));
alertDialogBuilder.setMessage("Kayıt Oluşturuldu\n\n" + "Hasta Adı: " + hastaadi + "\n" + "İrtibat No: " + irtibatno + "\n" +
"Hastane Adı: " + hastaneadi + "\n" + "Kan Grubu: " + kan + "\n" + "Aciliyet: " + aciliyett +
"\n" + "Açıklama: " + aciklamaa);
}
alertDialogBuilder.setCancelable(false);
alertDialogBuilder.setPositiveButton("Tamam", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
hastaAdi.setText("");
irtibatNo.setText("");
hastaneAdi.setText("");
aciklama.setText("");
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
}
} | [
"[email protected]"
] | |
447e4a3648c74d45cd90325d5687d2703bea5a5b | 66f61baf1cd0d7932a1f2183f9c76361361be6e2 | /github_trending/src/main/java/dao/DBUtil.java | 9bb3dbd04d0609f0c6e1b8a8b33c7447ce6a670b | [] | no_license | codersimon6/Crawler | 42f5dfd17fa51a639f6041371d9c467dab603477 | 52ccdb178a2185dc8ad539861f73eb61e2b5ba78 | refs/heads/main | 2023-03-11T07:39:43.093434 | 2021-02-28T02:20:14 | 2021-02-28T02:20:14 | 342,814,548 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,093 | java | package dao;
import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class DBUtil {
private static String url = "jdbc:mysql://39.104.88.216:3306/java_github_crawler?useSSL=true&useUnicode=true&CharacterEncoding=utf-8";
private static String USERNAME = "root";
private static String PASSWORD = "Aa1234...";
private static volatile DataSource dataSource = null;
// 双重校验锁,保证线程安全
private static DataSource getDateSource() {
if (dataSource == null) {
synchronized (DBUtil.class) {
if (dataSource == null) {
MysqlDataSource mysqlDataSource = new MysqlDataSource();
mysqlDataSource.setServerName("39.104.88.216");
mysqlDataSource.setPort(3306);
mysqlDataSource.setUser("root");
mysqlDataSource.setPassword("Aa1234...");
mysqlDataSource.setDatabaseName("java_github_crawler");
mysqlDataSource.setUseSSL(false);
mysqlDataSource.setCharacterEncoding("utf8");
dataSource = mysqlDataSource;
}
}
}
return dataSource;
}
public static Connection getConnection() {
try {
return getDateSource().getConnection();
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
public static void close(Connection connection, PreparedStatement preparedStatement,
ResultSet resultSet) {
try {
if (resultSet != null) resultSet.close();
if (preparedStatement != null) preparedStatement.close();
if (connection != null) connection.close();
} catch (SQLException throwables) {
throwables.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
88fc55c4fd4268de22f4bca616678c80eb03a081 | f11be72dd0aa7efae0d8d4f81099b862a8c74a00 | /test-framework/org.jboss.tools.forge.reddeer/src/org/jboss/tools/forge/reddeer/condition/ForgeConsoleHasText.java | 6b875fc1ff51105a70fcf7c80d9314a127dce014 | [] | no_license | jbosstools/jbosstools-forge | 1b7a3a555a8bb8ca6ebe726453478b90328f7633 | 7631b1627965050c46bed5c795cb7154e5af5add | refs/heads/main | 2023-04-14T06:07:13.067155 | 2023-04-07T12:08:58 | 2023-04-07T12:08:58 | 6,308,279 | 3 | 18 | null | 2023-04-07T12:08:59 | 2012-10-20T11:22:55 | Java | UTF-8 | Java | false | false | 1,483 | java | /*******************************************************************************
* Copyright (c) 2017 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.forge.reddeer.condition;
import org.eclipse.reddeer.common.condition.AbstractWaitCondition;
import org.jboss.tools.forge.reddeer.view.ForgeConsoleView;
/**
* Returns true if the console contains a given text
*
* @author psrna
*
*/
public class ForgeConsoleHasText extends AbstractWaitCondition {
private String text;
/**
* Construct the condition with a given text.
*
* @param text Text
*/
public ForgeConsoleHasText(String text) {
this.text = text;
}
@Override
public boolean test() {
String consoleText = getConsoleText();
return consoleText.contains(text);
}
@Override
public String description() {
String consoleText = getConsoleText();
return "console contains '" + text + "'\n" + consoleText;
}
private static String getConsoleText() {
ForgeConsoleView forgeConsoleView = new ForgeConsoleView();
forgeConsoleView.open();
return forgeConsoleView.getConsoleText();
}
}
| [
"[email protected]"
] | |
47d134c24523cbb5e66f8428a2edad7306d158a3 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/17/17_71073e4c78e70bdff6bf07d4dc0a3980a602a521/ItemTag/17_71073e4c78e70bdff6bf07d4dc0a3980a602a521_ItemTag_t.java | a430862670eda339b92a4c60e9167036cbbeb970 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 41,249 | java | /**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.app.webui.jsptag;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.jstl.fmt.LocaleSupport;
import javax.servlet.jsp.tagext.TagSupport;
import org.apache.commons.lang.ArrayUtils;
import org.apache.log4j.Logger;
import org.dspace.app.util.DCInputsReaderException;
import org.dspace.app.util.MetadataExposure;
import org.dspace.app.util.Util;
import org.dspace.app.webui.util.StyleSelection;
import org.dspace.app.webui.util.UIUtil;
import org.dspace.browse.BrowseException;
import org.dspace.content.Bitstream;
import org.dspace.content.Bundle;
import org.dspace.content.Collection;
import org.dspace.content.DCDate;
import org.dspace.content.DCValue;
import org.dspace.content.Item;
import org.dspace.content.authority.MetadataAuthorityManager;
import org.dspace.core.ConfigurationManager;
import org.dspace.core.Constants;
import org.dspace.core.Context;
import org.dspace.core.I18nUtil;
import org.dspace.core.PluginManager;
import org.dspace.core.Utils;
/**
* <P>
* JSP tag for displaying an item.
* </P>
* <P>
* The fields that are displayed can be configured in <code>dspace.cfg</code>
* using the <code>webui.itemdisplay.(style)</code> property. The form is
* </P>
*
* <PRE>
*
* <schema prefix>.<element>[.<qualifier>|.*][(date)|(link)], ...
*
* </PRE>
*
* <P>
* For example:
* </P>
*
* <PRE>
*
* dc.title = Dublin Core element 'title' (unqualified)
* dc.title.alternative = DC element 'title', qualifier 'alternative'
* dc.title.* = All fields with Dublin Core element 'title' (any or no qualifier)
* dc.identifier.uri(link) = DC identifier.uri, render as a link
* dc.date.issued(date) = DC date.issued, render as a date
* dc.identifier.doi(doi) = DC identifier.doi, render as link to http://dx.doi.org
* dc.identifier.hdl(handle) = DC identifier.hanlde, render as link to http://hdl.handle.net
* dc.relation.isPartOf(resolver) = DC relation.isPartOf, render as link to the base url of the resolver
* according to the specified urn in the metadata value (doi:xxxx, hdl:xxxxx,
* urn:issn:xxxx, etc.)
*
* </PRE>
*
* <P>
* When using "resolver" in webui.itemdisplay to render identifiers as resolvable
* links, the base URL is taken from <code>webui.resolver.<n>.baseurl</code>
* where <code>webui.resolver.<n>.urn</code> matches the urn specified in the metadata value.
* The value is appended to the "baseurl" as is, so the baseurl need to end with slash almost in any case.
* If no urn is specified in the value it will be displayed as simple text.
*
* <PRE>
*
* webui.resolver.1.urn = doi
* webui.resolver.1.baseurl = http://dx.doi.org/
* webui.resolver.2.urn = hdl
* webui.resolver.2.baseurl = http://hdl.handle.net/
*
* </PRE>
*
* For the doi and hdl urn defaults values are provided, respectively http://dx.doi.org/ and
* http://hdl.handle.net/ are used.<br>
*
* If a metadata value with style: "doi", "handle" or "resolver" matches a URL
* already, it is simply rendered as a link with no other manipulation.
* </P>
*
* <PRE>
*
* <P>
* If an item has no value for a particular field, it won't be displayed. The
* name of the field for display will be drawn from the current UI dictionary,
* using the key:
* </P>
*
* <PRE>
*
* "metadata.<style.>.<field>"
*
* e.g. "metadata.thesis.dc.title" "metadata.thesis.dc.contributor.*"
* "metadata.thesis.dc.date.issued"
*
*
* if this key is not found will be used the more general one
*
* "metadata.<field>"
*
* e.g. "metadata.dc.title" "metadata.dc.contributor.*"
* "metadata.dc.date.issued"
*
* </PRE>
*
* <P>
* You need to specify which strategy use for select the style for an item.
* </P>
*
* <PRE>
*
* plugin.single.org.dspace.app.webui.util.StyleSelection = \
* org.dspace.app.webui.util.CollectionStyleSelection
* #org.dspace.app.webui.util.MetadataStyleSelection
*
* </PRE>
*
* <P>
* With the Collection strategy you can also specify which collections use which
* views.
* </P>
*
* <PRE>
*
* webui.itemdisplay.<style>.collections = <collection handle>, ...
*
* </PRE>
*
* <P>
* FIXME: This should be more database-driven
* </P>
*
* <PRE>
*
* webui.itemdisplay.thesis.collections = 123456789/24, 123456789/35
*
* </PRE>
*
* <P>
* With the Metadata strategy you MUST specify which metadata use as name of the
* style.
* </P>
*
* <PRE>
*
* webui.itemdisplay.metadata-style = schema.element[.qualifier|.*]
*
* e.g. "dc.type"
*
* </PRE>
*
* @author Robert Tansley
* @version $Revision$
*/
public class ItemTag extends TagSupport
{
private static final String HANDLE_DEFAULT_BASEURL = "http://hdl.handle.net/";
private static final String DOI_DEFAULT_BASEURL = "http://dx.doi.org/";
/** Item to display */
private transient Item item;
/** Collections this item appears in */
private transient Collection[] collections;
/** The style to use - "default" or "full" */
private String style;
/** Whether to show preview thumbs on the item page */
private boolean showThumbs;
/** Default DC fields to display, in absence of configuration */
private static String defaultFields = "dc.title, dc.title.alternative, dc.contributor.*, dc.subject, dc.date.issued(date), dc.publisher, dc.identifier.citation, dc.relation.ispartofseries, dc.description.abstract, dc.description, dc.identifier.govdoc, dc.identifier.uri(link), dc.identifier.isbn, dc.identifier.issn, dc.identifier.ismn, dc.identifier";
/** log4j logger */
private static Logger log = Logger.getLogger(ItemTag.class);
private StyleSelection styleSelection = (StyleSelection) PluginManager.getSinglePlugin(StyleSelection.class);
/** Hashmap of linked metadata to browse, from dspace.cfg */
private static Map<String,String> linkedMetadata;
/** Hashmap of urn base url resolver, from dspace.cfg */
private static Map<String,String> urn2baseurl;
/** regex pattern to capture the style of a field, ie <code>schema.element.qualifier(style)</code> */
private Pattern fieldStylePatter = Pattern.compile(".*\\((.*)\\)");
private static final long serialVersionUID = -3841266490729417240L;
static {
int i;
linkedMetadata = new HashMap<String, String>();
String linkMetadata;
i = 1;
do {
linkMetadata = ConfigurationManager.getProperty("webui.browse.link."+i);
if (linkMetadata != null) {
String[] linkedMetadataSplit = linkMetadata.split(":");
String indexName = linkedMetadataSplit[0].trim();
String metadataName = linkedMetadataSplit[1].trim();
linkedMetadata.put(indexName, metadataName);
}
i++;
} while (linkMetadata != null);
urn2baseurl = new HashMap<String, String>();
String urn;
i = 1;
do {
urn = ConfigurationManager.getProperty("webui.resolver."+i+".urn");
if (urn != null) {
String baseurl = ConfigurationManager.getProperty("webui.resolver."+i+".baseurl");
if (baseurl != null){
urn2baseurl.put(urn, baseurl);
} else {
log.warn("Wrong webui.resolver configuration, you need to specify both webui.resolver.<n>.urn and webui.resolver.<n>.baseurl: missing baseurl for n = "+i);
}
}
i++;
} while (urn != null);
// Set sensible default if no config is found for doi & handle
if (!urn2baseurl.containsKey("doi")){
urn2baseurl.put("doi",DOI_DEFAULT_BASEURL);
}
if (!urn2baseurl.containsKey("hdl")){
urn2baseurl.put("hdl",HANDLE_DEFAULT_BASEURL);
}
}
public ItemTag()
{
super();
getThumbSettings();
}
public int doStartTag() throws JspException
{
try
{
if (style == null || style.equals(""))
{
style = styleSelection.getStyleForItem(item);
}
if (style.equals("full"))
{
renderFull();
}
else
{
render();
}
}
catch (SQLException sqle)
{
throw new JspException(sqle);
}
catch (IOException ie)
{
throw new JspException(ie);
}
catch (DCInputsReaderException ex)
{
throw new JspException(ex);
}
return SKIP_BODY;
}
/**
* Get the item this tag should display
*
* @return the item
*/
public Item getItem()
{
return item;
}
/**
* Set the item this tag should display
*
* @param itemIn
* the item to display
*/
public void setItem(Item itemIn)
{
item = itemIn;
}
/**
* Get the collections this item is in
*
* @return the collections
*/
public Collection[] getCollections()
{
return (Collection[]) ArrayUtils.clone(collections);
}
/**
* Set the collections this item is in
*
* @param collectionsIn
* the collections
*/
public void setCollections(Collection[] collectionsIn)
{
collections = (Collection[]) ArrayUtils.clone(collectionsIn);
}
/**
* Get the style this tag should display
*
* @return the style
*/
public String getStyle()
{
return style;
}
/**
* Set the style this tag should display
*
* @param styleIn
* the Style to display
*/
public void setStyle(String styleIn)
{
style = styleIn;
}
public void release()
{
style = "default";
item = null;
collections = null;
}
/**
* Render an item in the given style
*/
private void render() throws IOException, SQLException, DCInputsReaderException
{
JspWriter out = pageContext.getOut();
HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
Context context = UIUtil.obtainContext(request);
Locale sessionLocale = UIUtil.getSessionLocale(request);
String configLine = styleSelection.getConfigurationForStyle(style);
if (configLine == null)
{
configLine = defaultFields;
}
out.println("<table class=\"table itemDisplayTable\">");
/*
* Break down the configuration into fields and display them
*
* FIXME?: it may be more efficient to do some processing once, perhaps
* to a more efficient intermediate class, but then it would become more
* difficult to reload the configuration "on the fly".
*/
StringTokenizer st = new StringTokenizer(configLine, ",");
while (st.hasMoreTokens())
{
String field = st.nextToken().trim();
boolean isDate = false;
boolean isLink = false;
boolean isResolver = false;
boolean isNoBreakLine = false;
boolean isDisplay = false;
String style = null;
Matcher fieldStyleMatcher = fieldStylePatter.matcher(field);
if (fieldStyleMatcher.matches()){
style = fieldStyleMatcher.group(1);
}
String browseIndex;
try
{
browseIndex = getBrowseField(field);
}
catch (BrowseException e)
{
log.error(e);
browseIndex = null;
}
// Find out if the field should rendered with a particular style
if (style != null)
{
isDate = style.contains("date");
isLink = style.contains("link");
isNoBreakLine = style.contains("nobreakline");
isDisplay = style.equals("inputform");
isResolver = style.contains("resolver") || urn2baseurl.keySet().contains(style);
field = field.replaceAll("\\("+style+"\\)", "");
}
// Get the separate schema + element + qualifier
String[] eq = field.split("\\.");
String schema = eq[0];
String element = eq[1];
String qualifier = null;
if (eq.length > 2 && eq[2].equals("*"))
{
qualifier = Item.ANY;
}
else if (eq.length > 2)
{
qualifier = eq[2];
}
// check for hidden field, even if it's configured..
if (MetadataExposure.isHidden(context, schema, element, qualifier))
{
continue;
}
// FIXME: Still need to fix for metadata language?
DCValue[] values = item.getMetadata(schema, element, qualifier, Item.ANY);
if (values.length > 0)
{
out.print("<tr><td class=\"metadataFieldLabel\">");
String label = null;
try
{
label = I18nUtil.getMessage("metadata."
+ (style != null ? style + "." : "") + field,
context);
}
catch (MissingResourceException e)
{
// if there is not a specific translation for the style we
// use the default one
label = LocaleSupport.getLocalizedMessage(pageContext,
"metadata." + field);
}
out.print(label);
out.print(": </td><td class=\"metadataFieldValue\">");
//If the values are in controlled vocabulary and the display value should be shown
if (isDisplay){
List<String> displayValues = new ArrayList<String>();
displayValues = Util.getControlledVocabulariesDisplayValueLocalized(item, values, schema, element, qualifier, sessionLocale);
if (displayValues != null && !displayValues.isEmpty())
{
for (int d = 0; d < displayValues.size(); d++)
{
out.print(displayValues.get(d));
if (d<displayValues.size()-1) out.print(" <br/>");
}
}
out.print("</td>");
continue;
}
for (int j = 0; j < values.length; j++)
{
if (values[j] != null && values[j].value != null)
{
if (j > 0)
{
if (isNoBreakLine)
{
String separator = ConfigurationManager
.getProperty("webui.itemdisplay.nobreakline.separator");
if (separator == null)
{
separator = "; ";
}
out.print(separator);
}
else
{
out.print("<br />");
}
}
if (isLink)
{
out.print("<a href=\"" + values[j].value + "\">"
+ Utils.addEntities(values[j].value) + "</a>");
}
else if (isDate)
{
DCDate dd = new DCDate(values[j].value);
// Parse the date
out.print(UIUtil.displayDate(dd, false, false, (HttpServletRequest)pageContext.getRequest()));
}
else if (isResolver)
{
String value = values[j].value;
if (value.startsWith("http://")
|| value.startsWith("https://")
|| value.startsWith("ftp://")
|| value.startsWith("ftps://"))
{
// Already a URL, print as if it was a regular link
out.print("<a href=\"" + value + "\">"
+ Utils.addEntities(value) + "</a>");
}
else
{
String foundUrn = null;
if (!style.equals("resolver"))
{
foundUrn = style;
}
else
{
for (String checkUrn : urn2baseurl.keySet())
{
if (value.startsWith(checkUrn))
{
foundUrn = checkUrn;
}
}
}
if (foundUrn != null)
{
if (value.startsWith(foundUrn + ":"))
{
value = value.substring(foundUrn.length()+1);
}
String url = urn2baseurl.get(foundUrn);
out.print("<a href=\"" + url
+ value + "\">"
+ Utils.addEntities(values[j].value)
+ "</a>");
}
else
{
out.print(value);
}
}
}
else if (browseIndex != null)
{
String argument, value;
if ( values[j].authority != null &&
values[j].confidence >= MetadataAuthorityManager.getManager()
.getMinConfidence( values[j].schema, values[j].element, values[j].qualifier))
{
argument = "authority";
value = values[j].authority;
}
else
{
argument = "value";
value = values[j].value;
}
out.print("<a class=\"" + ("authority".equals(argument)?"authority ":"") + browseIndex + "\""
+ "href=\"" + request.getContextPath() + "/browse?type=" + browseIndex + "&" + argument + "="
+ URLEncoder.encode(value, "UTF-8") + "\">" + Utils.addEntities(values[j].value)
+ "</a>");
}
else
{
out.print(Utils.addEntities(values[j].value));
}
}
}
out.println("</td></tr>");
}
}
listCollections();
out.println("</table><br/>");
listBitstreams();
if (ConfigurationManager
.getBooleanProperty("webui.licence_bundle.show"))
{
out.println("<br/><br/>");
showLicence();
}
}
/**
* Render full item record
*/
private void renderFull() throws IOException, SQLException
{
JspWriter out = pageContext.getOut();
HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
Context context = UIUtil.obtainContext(request);
// Get all the metadata
DCValue[] values = item.getMetadata(Item.ANY, Item.ANY, Item.ANY, Item.ANY);
out.println("<div class=\"panel panel-info\"><div class=\"panel-heading\">"
+ LocaleSupport.getLocalizedMessage(pageContext,
"org.dspace.app.webui.jsptag.ItemTag.full") + "</div>");
// Three column table - DC field, value, language
out.println("<table class=\"panel-body table itemDisplayTable\">");
out.println("<tr><th id=\"s1\" class=\"standard\">"
+ LocaleSupport.getLocalizedMessage(pageContext,
"org.dspace.app.webui.jsptag.ItemTag.dcfield")
+ "</th><th id=\"s2\" class=\"standard\">"
+ LocaleSupport.getLocalizedMessage(pageContext,
"org.dspace.app.webui.jsptag.ItemTag.value")
+ "</th><th id=\"s3\" class=\"standard\">"
+ LocaleSupport.getLocalizedMessage(pageContext,
"org.dspace.app.webui.jsptag.ItemTag.lang")
+ "</th></tr>");
for (int i = 0; i < values.length; i++)
{
if (!MetadataExposure.isHidden(context, values[i].schema, values[i].element, values[i].qualifier))
{
out.print("<tr><td headers=\"s1\" class=\"metadataFieldLabel\">");
out.print(values[i].schema);
out.print("." + values[i].element);
if (values[i].qualifier != null)
{
out.print("." + values[i].qualifier);
}
out.print("</td><td headers=\"s2\" class=\"metadataFieldValue\">");
out.print(Utils.addEntities(values[i].value));
out.print("</td><td headers=\"s3\" class=\"metadataFieldValue\">");
if (values[i].language == null)
{
out.print("-");
}
else
{
out.print(values[i].language);
}
out.println("</td></tr>");
}
}
listCollections();
out.println("</table></div><br/>");
listBitstreams();
if (ConfigurationManager
.getBooleanProperty("webui.licence_bundle.show"))
{
out.println("<br/><br/>");
showLicence();
}
}
/**
* List links to collections if information is available
*/
private void listCollections() throws IOException
{
JspWriter out = pageContext.getOut();
HttpServletRequest request = (HttpServletRequest) pageContext
.getRequest();
if (collections != null)
{
out.print("<tr><td class=\"metadataFieldLabel\">");
if (item.getHandle()==null) // assume workspace item
{
out.print(LocaleSupport.getLocalizedMessage(pageContext,
"org.dspace.app.webui.jsptag.ItemTag.submitted"));
}
else
{
out.print(LocaleSupport.getLocalizedMessage(pageContext,
"org.dspace.app.webui.jsptag.ItemTag.appears"));
}
out.print("</td><td class=\"metadataFieldValue\">");
for (int i = 0; i < collections.length; i++)
{
out.print("<a href=\"");
out.print(request.getContextPath());
out.print("/handle/");
out.print(collections[i].getHandle());
out.print("\">");
out.print(collections[i].getMetadata("name"));
out.print("</a><br/>");
}
out.println("</td></tr>");
}
}
/**
* List bitstreams in the item
*/
private void listBitstreams() throws IOException
{
JspWriter out = pageContext.getOut();
HttpServletRequest request = (HttpServletRequest) pageContext
.getRequest();
out.print("<div class=\"panel panel-info\">");
out.println("<div class=\"panel-heading\">"
+ LocaleSupport.getLocalizedMessage(pageContext,
"org.dspace.app.webui.jsptag.ItemTag.files")
+ "</div>");
try
{
Bundle[] bundles = item.getBundles("ORIGINAL");
boolean filesExist = false;
for (Bundle bnd : bundles)
{
filesExist = bnd.getBitstreams().length > 0;
if (filesExist)
{
break;
}
}
// if user already has uploaded at least one file
if (!filesExist)
{
out.println("<div class=\"panel-body\">"
+ LocaleSupport.getLocalizedMessage(pageContext,
"org.dspace.app.webui.jsptag.ItemTag.files.no")
+ "</div>");
}
else
{
boolean html = false;
String handle = item.getHandle();
Bitstream primaryBitstream = null;
Bundle[] bunds = item.getBundles("ORIGINAL");
Bundle[] thumbs = item.getBundles("THUMBNAIL");
// if item contains multiple bitstreams, display bitstream
// description
boolean multiFile = false;
Bundle[] allBundles = item.getBundles();
for (int i = 0, filecount = 0; (i < allBundles.length)
&& !multiFile; i++)
{
filecount += allBundles[i].getBitstreams().length;
multiFile = (filecount > 1);
}
// check if primary bitstream is html
if (bunds[0] != null)
{
Bitstream[] bits = bunds[0].getBitstreams();
for (int i = 0; (i < bits.length) && !html; i++)
{
if (bits[i].getID() == bunds[0].getPrimaryBitstreamID())
{
html = bits[i].getFormat().getMIMEType().equals(
"text/html");
primaryBitstream = bits[i];
}
}
}
out
.println("<table class=\"table panel-body\"><tr><th id=\"t1\" class=\"standard\">"
+ LocaleSupport.getLocalizedMessage(pageContext,
"org.dspace.app.webui.jsptag.ItemTag.file")
+ "</th>");
if (multiFile)
{
out
.println("<th id=\"t2\" class=\"standard\">"
+ LocaleSupport
.getLocalizedMessage(pageContext,
"org.dspace.app.webui.jsptag.ItemTag.description")
+ "</th>");
}
out.println("<th id=\"t3\" class=\"standard\">"
+ LocaleSupport.getLocalizedMessage(pageContext,
"org.dspace.app.webui.jsptag.ItemTag.filesize")
+ "</th><th id=\"t4\" class=\"standard\">"
+ LocaleSupport.getLocalizedMessage(pageContext,
"org.dspace.app.webui.jsptag.ItemTag.fileformat")
+ "</th><th> </th></tr>");
// if primary bitstream is html, display a link for only that one to
// HTMLServlet
if (html)
{
// If no real Handle yet (e.g. because Item is in workflow)
// we use the 'fake' Handle db-id/1234 where 1234 is the
// database ID of the item.
if (handle == null)
{
handle = "db-id/" + item.getID();
}
out.print("<tr><td headers=\"t1\" class=\"standard\">");
out.print("<a target=\"_blank\" href=\"");
out.print(request.getContextPath());
out.print("/html/");
out.print(handle + "/");
out
.print(UIUtil.encodeBitstreamName(primaryBitstream
.getName(), Constants.DEFAULT_ENCODING));
out.print("\">");
out.print(primaryBitstream.getName());
out.print("</a>");
if (multiFile)
{
out.print("</td><td headers=\"t2\" class=\"standard\">");
String desc = primaryBitstream.getDescription();
out.print((desc != null) ? desc : "");
}
out.print("</td><td headers=\"t3\" class=\"standard\">");
out.print(UIUtil.formatFileSize(primaryBitstream.getSize()));
out.print("</td><td headers=\"t4\" class=\"standard\">");
out.print(primaryBitstream.getFormatDescription());
out
.print("</td><td class=\"standard\"><a class=\"btn btn-primary\" target=\"_blank\" href=\"");
out.print(request.getContextPath());
out.print("/html/");
out.print(handle + "/");
out
.print(UIUtil.encodeBitstreamName(primaryBitstream
.getName(), Constants.DEFAULT_ENCODING));
out.print("\">"
+ LocaleSupport.getLocalizedMessage(pageContext,
"org.dspace.app.webui.jsptag.ItemTag.view")
+ "</a></td></tr>");
}
else
{
for (int i = 0; i < bundles.length; i++)
{
Bitstream[] bitstreams = bundles[i].getBitstreams();
for (int k = 0; k < bitstreams.length; k++)
{
// Skip internal types
if (!bitstreams[k].getFormat().isInternal())
{
// Work out what the bitstream link should be
// (persistent
// ID if item has Handle)
String bsLink = "target=\"_blank\" href=\""
+ request.getContextPath();
if ((handle != null)
&& (bitstreams[k].getSequenceID() > 0))
{
bsLink = bsLink + "/bitstream/"
+ item.getHandle() + "/"
+ bitstreams[k].getSequenceID() + "/";
}
else
{
bsLink = bsLink + "/retrieve/"
+ bitstreams[k].getID() + "/";
}
bsLink = bsLink
+ UIUtil.encodeBitstreamName(bitstreams[k]
.getName(),
Constants.DEFAULT_ENCODING) + "\">";
out
.print("<tr><td headers=\"t1\" class=\"standard\">");
out.print("<a ");
out.print(bsLink);
out.print(bitstreams[k].getName());
out.print("</a>");
if (multiFile)
{
out
.print("</td><td headers=\"t2\" class=\"standard\">");
String desc = bitstreams[k].getDescription();
out.print((desc != null) ? desc : "");
}
out
.print("</td><td headers=\"t3\" class=\"standard\">");
out.print(UIUtil.formatFileSize(bitstreams[k].getSize()));
out
.print("</td><td headers=\"t4\" class=\"standard\">");
out.print(bitstreams[k].getFormatDescription());
out
.print("</td><td class=\"standard\" align=\"center\">");
// is there a thumbnail bundle?
if ((thumbs.length > 0) && showThumbs)
{
String tName = bitstreams[k].getName() + ".jpg";
String tAltText = LocaleSupport.getLocalizedMessage(pageContext, "org.dspace.app.webui.jsptag.ItemTag.thumbnail");
Bitstream tb = thumbs[0]
. getBitstreamByName(tName);
if (tb != null)
{
String myPath = request.getContextPath()
+ "/retrieve/"
+ tb.getID()
+ "/"
+ UIUtil.encodeBitstreamName(tb
.getName(),
Constants.DEFAULT_ENCODING);
out.print("<a ");
out.print(bsLink);
out.print("<img src=\"" + myPath + "\" ");
out.print("alt=\"" + tAltText
+ "\" /></a><br />");
}
}
out.print("<a class=\"btn btn-primary\" ");
out
.print(bsLink
+ LocaleSupport
.getLocalizedMessage(
pageContext,
"org.dspace.app.webui.jsptag.ItemTag.view")
+ "</a></td></tr>");
}
}
}
}
out.println("</table>");
}
}
catch(SQLException sqle)
{
throw new IOException(sqle.getMessage(), sqle);
}
out.println("</div>");
}
private void getThumbSettings()
{
showThumbs = ConfigurationManager
.getBooleanProperty("webui.item.thumbnail.show");
}
/**
* Link to the item licence
*/
private void showLicence() throws IOException
{
JspWriter out = pageContext.getOut();
HttpServletRequest request = (HttpServletRequest) pageContext
.getRequest();
Bundle[] bundles = null;
try
{
bundles = item.getBundles("LICENSE");
}
catch(SQLException sqle)
{
throw new IOException(sqle.getMessage(), sqle);
}
out.println("<table align=\"center\" class=\"table attentionTable\"><tr>");
out.println("<td class=\"attentionCell\"><p><strong>"
+ LocaleSupport.getLocalizedMessage(pageContext,
"org.dspace.app.webui.jsptag.ItemTag.itemprotected")
+ "</strong></p>");
for (int i = 0; i < bundles.length; i++)
{
Bitstream[] bitstreams = bundles[i].getBitstreams();
for (int k = 0; k < bitstreams.length; k++)
{
out.print("<div align=\"center\" class=\"standard\">");
out.print("<strong><a class=\"btn btn-primary\" target=\"_blank\" href=\"");
out.print(request.getContextPath());
out.print("/retrieve/");
out.print(bitstreams[k].getID() + "/");
out.print(UIUtil.encodeBitstreamName(bitstreams[k].getName(),
Constants.DEFAULT_ENCODING));
out
.print("\">"
+ LocaleSupport
.getLocalizedMessage(pageContext,
"org.dspace.app.webui.jsptag.ItemTag.viewlicence")
+ "</a></strong></div>");
}
}
out.println("</td></tr></table>");
}
/**
* Return the browse index related to the field. <code>null</code> if the field is not a browse field
* (look for <cod>webui.browse.link.<n></code> in dspace.cfg)
*
* @param field
* @return the browse index related to the field. Null otherwise
* @throws BrowseException
*/
private String getBrowseField(String field) throws BrowseException
{
for (String indexName : linkedMetadata.keySet())
{
StringTokenizer bw_dcf = new StringTokenizer(linkedMetadata.get(indexName), ".");
String[] bw_tokens = { "", "", "" };
int i = 0;
while(bw_dcf.hasMoreTokens())
{
bw_tokens[i] = bw_dcf.nextToken().toLowerCase().trim();
i++;
}
String bw_schema = bw_tokens[0];
String bw_element = bw_tokens[1];
String bw_qualifier = bw_tokens[2];
StringTokenizer dcf = new StringTokenizer(field, ".");
String[] tokens = { "", "", "" };
int j = 0;
while(dcf.hasMoreTokens())
{
tokens[j] = dcf.nextToken().toLowerCase().trim();
j++;
}
String schema = tokens[0];
String element = tokens[1];
String qualifier = tokens[2];
if (schema.equals(bw_schema) // schema match
&& element.equals(bw_element) // element match
&& (
(bw_qualifier != null) && ((qualifier != null && qualifier.equals(bw_qualifier)) // both not null and equals
|| bw_qualifier.equals("*")) // browse link with jolly
|| (bw_qualifier == null && qualifier == null)) // both null
)
{
return indexName;
}
}
return null;
}
}
| [
"[email protected]"
] | |
a67df29b77e806f0ce204ad85046fa998b8a04e3 | e89f5f316ffdf9ecc910a0e762e44ad43fb89733 | /HW1/AndersonJamesH1/src/def/Item.java | bddd5c8125844359d2dd0050e665c95ccde933b8 | [] | no_license | snaco/CEN-213 | 25e2fa73a1e5a4a36d4cf684c69d252b05ee3ae0 | fafb033cbb3b7c12ecc571fb81a97c071f4601ef | refs/heads/master | 2021-06-15T10:41:32.916860 | 2017-03-09T19:35:03 | 2017-03-09T19:35:03 | 79,979,783 | 0 | 0 | null | 2021-10-19T20:26:51 | 2017-01-25T03:28:36 | Java | UTF-8 | Java | false | false | 635 | java | package def;
public class Item {
private int weight;
private String name;
//Constructor
public Item(String name, int weight){
this.name=name; this.weight=weight;
}
//Returns a string with the name of the item
public String getName(){
return this.name;
}
//Returns an integer value of the weight of the item
public int getWeight(){
return this.weight;
}
//Returns a thorough description of all item attributes
//This will be overloaded by subclasses as subclasses will have more attributes than an "Item"
public String examine(){
return ("This is a "+name+" with weight "+weight+".");
}
}
| [
"[email protected]"
] | |
829155b4611297cbd328a5b00670955e891559d3 | 8eeae616d687bcad1d90873dd1eca4e2360b6228 | /src/main/java/sbjpa/exception/BankTransactionException.java | 1e2a8f7f14ca7778f905093fbbc6b796264b931c | [] | no_license | AlinaP2021/SpringBootJPA | 8d95c8b13933ad4a61060b4e3687d84125922478 | 964a8e59fcd267375da04c69168f0a18ca9337fa | refs/heads/master | 2023-09-04T22:07:56.028890 | 2021-11-23T18:00:42 | 2021-11-23T18:00:42 | 429,965,224 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 171 | java | package sbjpa.exception;
public class BankTransactionException extends Exception {
public BankTransactionException(String message) {
super(message);
}
}
| [
"[email protected]"
] | |
cdea7fe778efe4c5e7ae9201c8c00b4e0ed48d02 | 768754287090c335417da829e2c68c7482225c95 | /2553/2109209_RE.java | ecfe4177d003ef25a9a1f456492bf8e955083d37 | [] | no_license | zhangfaen/pku-online-judge | f6a276eaac28a39b00133133ccaf3402f5334184 | e770ce41debe1cf832f4859528c7c751509ab97c | refs/heads/master | 2021-04-23T16:52:00.365894 | 2020-03-25T09:59:52 | 2020-03-25T09:59:52 | 249,941,140 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,550 | java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
public class Main
{
static LinkedList [] mapa;
static LinkedList [] mapt;
static int [] order;
static int tag;
static boolean [] vst;
static int [] id;
static int [] id_degree_cnt;
public static void main(String[] args) throws IOException
{
BufferedReader cin = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
while(true)
{
String s=cin.readLine().trim();
String [] sa=s.split(" +");
int n,m;
n=Integer.parseInt(sa[0]);
if(n==0)break;
m=Integer.parseInt(sa[1]);
mapa=new LinkedList[n];
mapt=new LinkedList[n];
for(int i=0;i<n;i++)
{
mapa[i]=new LinkedList<Integer>();
mapt[i]=new LinkedList<Integer>();
}
if(m>0)
{
s=cin.readLine().trim();
sa=s.split(" +");
}
else sa=new String[] {};
for(int i=0;i<sa.length-1;i+=2)
{
int from=Integer.parseInt(sa[i])-1;
int to=Integer.parseInt(sa[i+1])-1;
mapa[from].add(to);
mapt[to].add(from);
}
order=new int[n];
tag=0;
vst=new boolean[n];
for(int i=0;i<n;i++)
if(vst[i]==false)
{
vst[i]=true;
dfsa(i);
}
id=new int[n];
tag=0;
Arrays.fill(vst,false);
for(int i=n-1;i>=0;i--)
{
if(vst[order[i]]==false)
{
vst[order[i]]=true;
dfst(order[i]);
tag++;
}
}
id_degree_cnt=new int[tag];
for(int i=0;i<n;i++)
{
LinkedList ll=mapa[i];
for(int j=0;j<ll.size();j++)
{
int next=(Integer)ll.get(j);
if(id[i]!=id[next])
id_degree_cnt[id[i]]++;
}
}
List<Integer>rel=new ArrayList<Integer>(n);
for(int i=0;i<n;i++)
if(id_degree_cnt[id[i]]==0)
rel.add(i);
for(int d:rel)
out.print((d+1)+" ");
out.println();
}
out.flush();
out.close();
}
public static void dfsa(int ci)
{
for(int i=0;i<mapa[ci].size();i++)
{
int next=(Integer)mapa[ci].get(i);
if(vst[next]==false)
{
vst[next]=true;
dfsa(next);
}
}
order[tag++]=ci;
}
public static void dfst(int ci)
{
id[ci]=tag;
for(int i=0;i<mapt[ci].size();i++)
{
int next=(Integer)mapt[ci].get(i);
if(vst[next]==false)
{
vst[next]=true;
dfst(next);
}
}
}
} | [
"[email protected]"
] | |
eacaed4b98460ecb243158164ce109ccd0ffa73f | 48be897636812ad9aa3f0bb2b432f602f9a2efdc | /src/main/java/com/transaction/core/utils/SpringUtil.java | 73ed7c8fdd733ccdfd360ec89fd3edc76c776056 | [] | no_license | yuxiaomo/Transaction | 26aff4ea132a2a05e839ced51a0d9c5061fe99b0 | 43e757ec7bb3e9a0d2386a71fba8189e1befeb69 | refs/heads/master | 2022-04-08T15:12:55.772887 | 2020-03-12T13:39:57 | 2020-03-12T13:39:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,537 | java | package com.transaction.core.utils;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
/**
* @author kfm bg384656
* @date 2019/6/21 13:31
*/
@Component
public class SpringUtil implements ApplicationContextAware {
private static ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
if (SpringUtil.applicationContext == null) {
SpringUtil.applicationContext = applicationContext;
}
}
/**
* 获取spring容器上下文
* @return
*/
public static ApplicationContext getApplicationContext() {
return applicationContext;
}
/**
* 根据bean名称获取bean
* @param name
* @return
*/
public static Object getBean(String name) {
return getApplicationContext().getBean(name);
}
/**
* 根据bean类型获取bean
* @param clazz
* @param <T>
* @return
*/
public static <T> T getBean(Class<T> clazz) {
return getApplicationContext().getBean(clazz);
}
/**
* 通过name,以及Clazz返回指定的Bean
* @param name
* @param clazz
* @param <T>
* @return
*/
public static <T> T getBean(String name, Class<T> clazz) {
return getApplicationContext().getBean(name, clazz);
}
}
| [
"[email protected]"
] | |
e2a81fe8df62fbfb1b5983de6bc939d7bdcc7c9a | 18797dcf96be558540ee8183b55b0c2795d40be6 | /app/src/main/java/com/demo/app/MainActivity.java | cc2a65e360c9a8ce0df603395497579fcaa96b98 | [] | no_license | avasilistov/LocationUpdatesApp | 1ba2727c9d5d0193d5e55b39f1a97d369f8205da | 3e9ed09050fe11a87f9c2ab348e667e848bb4a3f | refs/heads/master | 2023-03-21T14:04:24.309341 | 2021-03-19T10:12:34 | 2021-03-19T10:12:34 | 349,379,508 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,837 | java | package com.demo.app;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import android.Manifest;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.content.pm.PackageManager;
import android.location.Location;
import android.os.Bundle;
import android.os.IBinder;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.material.snackbar.Snackbar;
public class MainActivity extends AppCompatActivity {
private static final String TAG = "MainActivity";
private MyReceiver myReceiver;
private static final int REQUEST_PERMISSIONS_REQUEST_CODE = 34;
private LocationUpdatesService service;
private boolean mBound = false;
private TextView textView;
private final ServiceConnection mServiceConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName arg0, IBinder arg1) {
service = ((LocationUpdatesService.LocationUpdatesServiceBinder) arg1).getService();
mBound = true;
}
@Override
public void onServiceDisconnected(ComponentName name) {
service = null;
mBound = false;
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myReceiver = new MyReceiver();
textView = findViewById(R.id.text_view);
}
@Override
protected void onStart() {
super.onStart();
ContextCompat.startForegroundService(this, new Intent(this, LocationUpdatesService.class));
if (!checkPermissions()) {
requestPermissions();
}
Boolean status = bindService(new Intent(this, LocationUpdatesService.class), mServiceConnection,
Context.BIND_AUTO_CREATE);
}
@Override
protected void onResume() {
super.onResume();
LocalBroadcastManager.getInstance(this).registerReceiver(myReceiver,
new IntentFilter(LocationUpdatesService.ACTION_BROADCAST));
}
@Override
protected void onPause() {
LocalBroadcastManager.getInstance(this).unregisterReceiver(myReceiver);
super.onPause();
}
@Override
protected void onStop() {
if (mBound) {
unbindService(mServiceConnection);
mBound = false;
}
super.onStop();
}
private boolean checkPermissions() {
return PackageManager.PERMISSION_GRANTED == ActivityCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_FINE_LOCATION)&&
PackageManager.PERMISSION_GRANTED == ActivityCompat.checkSelfPermission(this,
Manifest.permission.WRITE_EXTERNAL_STORAGE);
}
private void requestPermissions() {
boolean shouldProvideRationale =
ActivityCompat.shouldShowRequestPermissionRationale(this,
Manifest.permission.ACCESS_FINE_LOCATION);
if (shouldProvideRationale) {
Log.i(TAG, "Displaying permission rationale to provide additional context.");
Snackbar.make(
findViewById(R.id.activity_main),
R.string.permission_rationale,
Snackbar.LENGTH_INDEFINITE)
.setAction(R.string.ok, new View.OnClickListener() {
@Override
public void onClick(View view) {
// Request permission
getPermissions();
}
})
.show();
} else {
Log.i(TAG, "Requesting permission");
getPermissions();
}
}
private void getPermissions() {
String[] perm = new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE,Manifest.permission.ACCESS_FINE_LOCATION};
ActivityCompat.requestPermissions(MainActivity.this,
perm,
REQUEST_PERMISSIONS_REQUEST_CODE);
}
private class MyReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Location location = intent.getParcelableExtra(LocationUpdatesService.EXTRA_LOCATION);
if (location != null) {
textView.setText(location.getLatitude()+" "+location.getLongitude());
}
}
}
} | [
"[email protected]"
] | |
c4cdf211439dc4486ed6d987983a9bbc4c412440 | 82f7f5b36494c67f5fd497755afd489597ee6cd8 | /app/src/main/java/com/example/asc/activity/ui/ShineAnimator.java | 71a0239cb491b92b060c21e762f9f176ba0167df | [] | no_license | HiIex/ASC | fc76827c44d084eda6a7c96f384c519b47d10558 | a9c7239f6d1954a796a8de36a1f23cf2bd333f57 | refs/heads/master | 2023-01-22T09:14:54.956311 | 2020-11-30T05:34:14 | 2020-11-30T05:34:14 | 317,120,431 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 803 | java | package com.example.asc.activity.ui;
import android.animation.ValueAnimator;
import android.graphics.Canvas;
public class ShineAnimator extends ValueAnimator {
float MAX_VALUE = 1.5f;
long ANIM_DURATION = 1500;
Canvas canvas;
ShineAnimator() {
setFloatValues(1f, MAX_VALUE);
setDuration(ANIM_DURATION);
setStartDelay(200);
setInterpolator(new EasingInterpolator(Ease.QUART_OUT));
}
ShineAnimator(long duration,float max_value,long delay) {
setFloatValues(1f, max_value);
setDuration(duration);
setStartDelay(delay);
setInterpolator(new EasingInterpolator(Ease.QUART_OUT));
}
void startAnim() {
start();
}
public void setCanvas(Canvas canvas) {
this.canvas = canvas;
}
} | [
"[email protected]"
] | |
94d6741ec546edbef442ffe46738748ebcd3544c | 8160730dbfc837ba0f5882743c84e5ec22756879 | /cloudnet/src/main/java/de/dytanic/cloudnet/command/commands/CommandLocalTemplate.java | 1dc90eb66f186071884ff4a7898b8b9f99ee5fd7 | [] | no_license | derrop/CloudNet-v3 | 60198fdbade1e6a532650811f61e3e939f326163 | 754a196b07efb2a4b8574001b996d9e0a133f30c | refs/heads/master | 2020-07-25T23:00:44.559269 | 2019-06-21T12:28:55 | 2019-06-21T12:29:54 | 208,450,593 | 0 | 0 | null | 2019-12-22T12:40:04 | 2019-09-14T14:17:37 | null | UTF-8 | Java | false | false | 6,047 | java | package de.dytanic.cloudnet.command.commands;
import de.dytanic.cloudnet.CloudNet;
import de.dytanic.cloudnet.command.ICommandSender;
import de.dytanic.cloudnet.common.Properties;
import de.dytanic.cloudnet.common.language.LanguageManager;
import de.dytanic.cloudnet.driver.service.ServiceEnvironmentType;
import de.dytanic.cloudnet.driver.service.ServiceTemplate;
import de.dytanic.cloudnet.template.ITemplateStorage;
import de.dytanic.cloudnet.template.LocalTemplateStorage;
import de.dytanic.cloudnet.template.LocalTemplateStorageUtil;
import de.dytanic.cloudnet.util.InstallableAppVersion;
import java.util.Arrays;
public final class CommandLocalTemplate extends CommandDefault {
public CommandLocalTemplate()
{
super("local-template", "localt", "lt");
}
@Override
public void execute(ICommandSender sender, String command, String[] args, String commandLine, Properties properties)
{
if (args.length == 0)
{
sender.sendMessage(
"lt list | prefix=<name> name=<name>",
"lt install <" + Arrays.toString(ServiceEnvironmentType.values()) + ">",
"lt install <prefix> <name> <" + Arrays.toString(ServiceEnvironmentType.values()) + "> <version>",
"lt delete <prefix> <name>",
"lt create <prefix> <name> <" + Arrays.toString(ServiceEnvironmentType.values()) + ">"
);
return;
}
ITemplateStorage storage = getCloudNet().getServicesRegistry().getService(ITemplateStorage.class, LocalTemplateStorage.LOCAL_TEMPLATE_STORAGE);
if (storage == null)
throw new UnsupportedOperationException("Storage cannot be found!");
if (args[0].equalsIgnoreCase("list"))
{
for (ServiceTemplate serviceTemplate : storage.getTemplates())
{
if (properties.containsKey("prefix") && serviceTemplate.getPrefix().toLowerCase().contains(properties.get("prefix")))
continue;
if (properties.containsKey("name") && serviceTemplate.getName().toLowerCase().contains(properties.get("name")))
continue;
this.displayTemplate(sender, serviceTemplate);
}
}
if (args[0].equalsIgnoreCase("install"))
{
if (args.length == 2)
{
try
{
ServiceEnvironmentType environmentType = ServiceEnvironmentType.valueOf(args[1].toUpperCase());
sender.sendMessage("ServiceType: " + environmentType);
for (InstallableAppVersion installableAppVersion : InstallableAppVersion.VERSIONS)
if (installableAppVersion.getServiceEnvironment() == environmentType)
sender.sendMessage("- " + installableAppVersion.getVersion() + " * Environment: " + installableAppVersion.getEnvironmentType());
} catch (Exception ignored)
{
}
return;
}
if (args.length == 5)
{
ServiceTemplate serviceTemplate = new ServiceTemplate(args[1], args[2], LocalTemplateStorage.LOCAL_TEMPLATE_STORAGE);
try
{
InstallableAppVersion installableAppVersion = InstallableAppVersion.getVersion(ServiceEnvironmentType.valueOf(args[3].toUpperCase()), args[4]);
if (installableAppVersion != null)
{
sender.sendMessage(LanguageManager.getMessage("command-local-template-install-try")
.replace("%environment%", installableAppVersion.getServiceEnvironment().name())
.replace("%version%", installableAppVersion.getVersion())
);
if (LocalTemplateStorageUtil.installApplicationJar(storage, serviceTemplate, installableAppVersion))
sender.sendMessage(LanguageManager.getMessage("command-local-template-install-success")
.replace("%environment%", installableAppVersion.getServiceEnvironment().name())
.replace("%version%", installableAppVersion.getVersion())
);
else
sender.sendMessage(LanguageManager.getMessage("command-local-template-install-failed")
.replace("%environment%", installableAppVersion.getServiceEnvironment().name())
.replace("%version%", installableAppVersion.getVersion())
);
}
} catch (Exception ignored)
{
}
getCloudNet().deployTemplateInCluster(serviceTemplate, storage.toZipByteArray(serviceTemplate));
}
}
if (args[0].equalsIgnoreCase("delete") && args.length == 3)
{
storage.delete(new ServiceTemplate(args[1], args[2], LocalTemplateStorage.LOCAL_TEMPLATE_STORAGE));
sender.sendMessage(LanguageManager.getMessage("command-local-template-delete-template-success"));
}
if (args[0].equalsIgnoreCase("create") && args.length == 4)
{
try
{
ServiceEnvironmentType environment = ServiceEnvironmentType.valueOf(args[3].toUpperCase());
if (LocalTemplateStorageUtil.createAndPrepareTemplate(storage, args[1], args[2], environment))
sender.sendMessage(LanguageManager.getMessage("command-local-template-create-template-success"));
} catch (Exception ignored)
{
}
}
}
private void displayTemplate(ICommandSender sender, ServiceTemplate serviceTemplate)
{
sender.sendMessage("- " + serviceTemplate.getStorage() + ":" + serviceTemplate.getPrefix() + "/" + serviceTemplate.getName());
}
} | [
"[email protected]"
] | |
d9b17b788dca3a82a2792619875fa32c4df00d7e | 94e2d23a702575aad8f7fe55a5847dae7b029357 | /Labs/Bank Lab/Runner.java | 75f0df6a4e681140ba0adaf91cf9c14d820015ed | [] | no_license | neilbalch/APCS | f5174eded9542f1f57db5d386235f7be2985962a | 57e83732cbe8915518f4ff32df0e9647848d2037 | refs/heads/master | 2020-03-27T00:06:32.808553 | 2019-07-06T02:08:24 | 2019-07-06T02:08:24 | 145,594,517 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 310 | java | import javax.swing.*;
public class Runner {
public static void main(String[] args) {
JFrame fr = new JFrame("Bank");
Screen sc = new Screen();
fr.add(sc);
fr.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
fr.pack();
fr.setVisible(true);
}
}
| [
"[email protected]"
] | |
aae2796cf01427f8abaa6270c4bfffb310c4b06b | 1baccfbe0f4c77e64cde05d81e5eb7bf7ff97e15 | /trackingserver/src/com/smartappservices/gps/client/Client43.java | 131972d8d016dc776bae0d0456662651f69b73bc | [] | no_license | atulchauhan01/commserver | 667cda33593fff832112e472e9055abcdeca82bc | 2ea45de6c5f19b55d05fb575a04b9868bccfe1f5 | refs/heads/master | 2016-09-01T21:24:12.725233 | 2014-09-20T13:16:25 | 2014-09-20T13:16:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,327 | java | package com.smartappservices.gps.client;
import java.io.BufferedOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.Socket;
public class Client43 extends Thread {
//String of device tk106
//private static String data ="(020000000043BP05000020000000034111214A2606.6947N09145.9674E000.0121212155.3200000000L02AE630C)";
//String of device SkyTrack
private static String data = "(119996096676BP05000009996096676111107A3020.8757N07650.2781E000.0090120245.310001000000L0000001F)";
/**
*
*/
private static Socket socket;
/**
*
*/
private static PrintWriter printWriter;
/**
*
*/
private static DataOutputStream dataOutputStream;
/**
*
*/
private static BufferedOutputStream bufferedOutputStream;
/**
*
*/
private static InetAddress inetAddress = null;
/**
*
*/
// private static byte[] ipAddr = new byte[] {(byte)8,(byte)22,(byte)201,(byte)39};
static void publishData() {
try {
inetAddress = InetAddress.getByName("68.67.69.9");
//inetAddress = InetAddress.getLocalHost();
System.err.println(inetAddress);
socket = new Socket(inetAddress, 4014);
System.err.println("socket" + socket);
dataOutputStream = new DataOutputStream(socket.getOutputStream());
} catch (IOException e) {
System.out.println(e.getMessage());
}
}
/**
*
*/
public void run() {
try {
for (int i = 0; i < 500; i++) {
System.out.println("Thread executed!" + data);
dataOutputStream.writeBytes(data);
Thread.sleep(10000L);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
*
*/
public static void main(String[] args) {
Client43 client = new Client43();
Client43.publishData();
Thread clientThread = new Client43();
clientThread.start();
}
}
| [
"[email protected]"
] | |
00713bb39c3ec80c8cd639d6e77ead4e8b60a77e | e3b91410227cc141e5907f20932e281e9e0fc051 | /src/main/java/com/nl/tracker/model/ServiceRequest.java | 65fd37fdf65e17a5c9e631a8530f807036ab7150 | [] | no_license | nlevi/OnCallTimeTracker | 07d27ec4795b852baf8326975bf9ff30aaa54bd4 | 5cce6f9c25266ab3b3ffa233f162e65138db3021 | refs/heads/master | 2021-04-26T13:34:37.620238 | 2018-01-18T18:30:13 | 2018-01-18T18:30:13 | 79,553,607 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,940 | java | package com.nl.tracker.model;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
/**
* Created by levin1 on 1/26/2017.
*/
@Entity
@Table(name = "SERVICE_REQUEST")
public class ServiceRequest implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@Column(name = "sr_id", unique = true, nullable = false)
private long srId;
@Column(name = "subject")
private String subject;
@Column(name = "customer_name")
private String customerName;
@Column(name = "site_id")
private long siteId;
@Column(name = "creation_date")
private Date creationDate;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "created_by", referencedColumnName = "id")
private User createdBy;
@Column(name = "severity")
private String severity;
public long getSrId() {
return srId;
}
public void setSrId(long id) {
this.srId = id;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public long getSiteId() {
return siteId;
}
public void setSiteId(long siteId) {
this.siteId = siteId;
}
public Date getCreationDate() {
return creationDate;
}
public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}
public User getCreatedBy() {
return createdBy;
}
public void setCreatedBy(User createdBy) {
this.createdBy = createdBy;
}
public String getSeverity() {
return severity;
}
public void setSeverity(String severity) {
this.severity = severity;
}
}
| [
"[email protected]"
] | |
74dba8c33ddde1ae3886cf92fdef2cffbf7267d6 | 8ed92f2dd6d2cb7ca69ec869c9944b83e724e673 | /argouml-core-diagrams-sequence2/tests/org/argouml/sequence2/diagram/TestFigMessageSpline.java | 86aa91489bbbb90b313ba73043134a83745b7e39 | [] | no_license | danilofes/argouml-refactorings | e74c68c3a556fad9915f7a7e51cf7bd98634b02b | 893bcb1c3e8dcb60ca97ad3ee2adf48103307ce4 | refs/heads/master | 2021-01-10T12:44:46.359352 | 2015-11-03T15:59:42 | 2015-11-03T15:59:42 | 45,476,515 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,034 | java | /* $Id: TestFigMessageSpline.java 19907 2012-12-30 13:06:01Z closettop_nightlybuild $
*****************************************************************************
* Copyright (c) 2009-2012 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* bobtarling
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
*/
// Copyright (c) 2007 The Regents of the University of California. All
// Rights Reserved. Permission to use, copy, modify, and distribute this
// software and its documentation without fee, and without a written
// agreement is hereby granted, provided that the above copyright notice
// and this paragraph appear in all copies. This software program and
// documentation are copyrighted by The Regents of the University of
// California. The software program and documentation are supplied "AS
// IS", without any accompanying services from The Regents. The Regents
// does not warrant that the operation of the program will be
// uninterrupted or error-free. The end-user understands that the program
// was developed for research purposes and is advised not to rely
// exclusively on the program for any reason. IN NO EVENT SHALL THE
// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
package org.argouml.sequence2.diagram;
import java.awt.Point;
import junit.framework.TestCase;
/**
* Tests for the FigMessageSpline class.
* @author penyaskito
*/
public class TestFigMessageSpline extends TestCase {
private FigMessageSpline spline = null;
private Point start = new Point(15, 15);
private Point end = new Point(15, 35);
/**
* Test the constructor that receives a point
*/
public void testConstructor() {
spline = new FigMessageSpline(start);
assertEquals("The spline start point is incorrect",
start, spline.getPoint(0));
assertEquals("The spline has not the correct number of points",
5, spline.getPoints().length);
assertEquals("The spline end point is incorrect",
end, spline.getPoint(4));
}
}
| [
"[email protected]"
] | |
8de5f0a104bd0b2a7aa461b806ef6776d6b622fc | e8fc16e8422b72b4980f604ec0e9454a9dcb813e | /src/ca/durhamcollege/Person.java | b79e0f308a1617febedf808ccb44c5deff0ac583 | [] | no_license | MuzhdaEhsan/OOP3200-F2020-JavaLab4 | 03da0d1eb6c500d5891124f9a0ca0eb4c88d34fe | 28906a7571d4a5f043b65ebfd2d70cc563bbb938 | refs/heads/master | 2023-01-28T00:46:50.397549 | 2020-12-14T04:08:58 | 2020-12-14T04:08:58 | 321,229,308 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,495 | java | /*
* Copyright 2018 Thom MacDonald.
* The intent of this material is for learning. Educational use is
* considered fair use. Attribution is appreciated but not required.
*/
package ca.durhamcollege;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Arrays;
/**
* A class to represent a person. Contains first, last and any number of middle
* names, as well as well as a birth date. This is a 'concrete' class, meaning
* that objects of class Person may be instantiated.
*
* ADD THIS CLASS TO YOUR LAB PROJECT. DO NOT MODIFY THIS CLASS.
*
* @author Thom MacDonald {[email protected]}
* @author Tom Tsiliopoulos {[email protected]}
* @since version 0.2 (2020-12-09).
*/
public abstract class Person
{
// ATTRIBUTES
private ArrayList<String> myNames; // Stores the person's names
private LocalDate myBirthDate; // the person's birth date
//public final int MAXIMUM_AGE = 150; //
/**
* Initializes a person object based on parameters.
*
* @param fullName - the intended full name, in order, separated by spaces.
* @param birthDate - the intended birth date.
* @throws IllegalArgumentException when fullName contains less than one
* character or when fullName contains something other than letters, spaces,
* hyphens, or apostrophes.
*/
public Person(String fullName, LocalDate birthDate)
{
myBirthDate = birthDate;
this.setNames(fullName);
}
/**
* Sets the birth date based on a parameter. No class specific validation.
* @param birthDate the intended birth date
*/
public void setBirthDate(LocalDate birthDate)
{
myBirthDate = birthDate;
}
/**
* Returns the birth date.
*
* @return this birth date.
*/
public LocalDate getBirthDate()
{
return myBirthDate;
}
/**
* Returns the person's current age in years.
* @return age in years.
*/
public int getAge()
{
return (myBirthDate.until(LocalDate.now())).getYears();
}
/**
* Sets person's names based on a full string.
*
* @param fullName
* @throws IllegalArgumentException when fullName contains less than one
* character or when fullName contains something other than letters, spaces,
* hyphens, or apostrophes.
*/
final public void setNames(String fullName)
{
// trim any leading or trailing spaces
fullName = fullName.trim();
// if there are no characters, throw an exception
if (fullName.length() < 1)
{
throw new IllegalArgumentException("Person names must be at least "
+ "one character.");
}
// check that all the characters are legal...
// for each character position,
for (int index = 0; index < fullName.length(); index++)
{
// extract the character at this position
char letter = fullName.charAt(index);
// if the character is not a letter...
if (!Character.isAlphabetic(letter))
{
// if the character is not a space, apostrophe or hyphen...
if (letter != ' ' && letter != '\'' && letter != '-')
{
// throw an exception.
throw new IllegalArgumentException(String.format("\"%s\" "
+ "is invalid. Person names can only contain "
+ "letters, spaces, hyphens, and apostrophes.",
fullName));
}
}
}
// set/reset myNames to a new ArrayList
myNames = new ArrayList<>();
// split fullNames on spaces and add all the resulting strings to myNames
myNames.addAll(Arrays.asList(fullName.split(" +")));
}
/**
* Gets the person's last name. If the person has one name, it is returned.
*
* @return last name
*/
public String getLastName()
{
return myNames.get(myNames.size() - 1);
}
/**
* Gets the person's first name. If the person has one name, it is returned.
*
* @return first name
*/
public String getFirstName()
{
return myNames.get(0);
}
/**
* Gets the person's name as a formatted string. The last name followed by a
* coma, then the first name, followed by a list of as many middle initials
* as are needed. If the person has one name only, it is returned.
* @return the formatted name.
*/
public String getName()
{
// starts with last name
StringBuilder builder = new StringBuilder(getLastName());
// if there is more than one name...
if (myNames.size() > 1)
{
// add a coma and the first name
builder.append(", ");
builder.append(getFirstName());
// if there are more than two names...
if (myNames.size() > 2)
{
// loop for each middle name position...
for (int index = 1; index < myNames.size() - 1; index++)
{
// add the initial.
builder.append(String.format(" %c.",
myNames.get(index).charAt(0)));
}
}
}
// return the formatted name
return builder.toString();
}
}
| [
"[email protected]"
] | |
95dcd8ead73bcc47232ef56a16a6602e99b54fa1 | ae53ea4290feee68ed31f2b86145bff53c8e1f66 | /Android-app/app/src/main/java/com/example/sht/homework/Class_Environment.java | 0b0912fda8f33a8b721a3c4bd2269f99cad9e0aa | [] | no_license | SummerMemories/Android_Project | 66753f0d324450a2d86812462b16a95358709060 | 4f7a1110121fd9ca2c213c831af29d23cda96308 | refs/heads/master | 2020-08-16T13:04:24.718146 | 2019-10-19T11:55:14 | 2019-10-19T11:55:14 | 214,817,276 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,729 | java | package com.example.sht.homework;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.sht.homework.EnvironmentCenter.CSDN;
import com.example.sht.homework.EnvironmentCenter.IRemenber;
import com.example.sht.homework.EnvironmentCenter.Microsoft;
import com.example.sht.homework.EnvironmentCenter.Pexels;
import com.jude.rollviewpager.RollPagerView;
import com.jude.rollviewpager.adapter.StaticPagerAdapter;
import com.jude.rollviewpager.hintview.ColorPointHintView;
import java.util.ArrayList;
import java.util.List;
public class Class_Environment {
private String name;
private int imageId;
public Class_Environment(String name, int imageId){
this.name = name;
this.imageId = imageId;
}
public String getName(){
return name;
}
public int getImageId(){
return imageId;
}
public static class Environment extends Fragment {
public int time=3000;
private List<Class_Environment> worldList = new ArrayList<>();
private RollPagerView mRollViewPager;
private Class_Environment_Adapter adapter_bottom_2;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.activity_environment,container,false);
return view;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
initWorldBottom();
RecyclerView recyclerView_2 = (RecyclerView) getActivity().findViewById(R.id.recycler_bottom_view);
StaggeredGridLayoutManager layoutManager_bottom_2 = new StaggeredGridLayoutManager(2,StaggeredGridLayoutManager.VERTICAL);
recyclerView_2.setLayoutManager(layoutManager_bottom_2);
recyclerView_2.addItemDecoration(new SpaceItemDecoration(0));
adapter_bottom_2 = new Class_Environment_Adapter(worldList);
recyclerView_2.setAdapter(adapter_bottom_2);
mRollViewPager = (RollPagerView) getActivity().findViewById(R.id.roll_view_pager);
mRollViewPager.setPlayDelay(2000);
mRollViewPager.setAnimationDurtion(500);
mRollViewPager.setAdapter(new TestNormalAdapter());
mRollViewPager.setHintView(new ColorPointHintView(getActivity(), Color.RED,Color.WHITE));
TextView game = (TextView) getActivity().findViewById(R.id.environment_game);
game.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(),Toolbar_game.class);
startActivity(intent);
}
});
TextView hlju = (TextView) getActivity().findViewById(R.id.environment_hlju);
hlju.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(),Toolbar_hlju.class);
startActivity(intent);
}
});
ImageButton q = (ImageButton) getActivity().findViewById(R.id.multimedia_camera_rankings);
q.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(),Microsoft.class);
startActivity(intent);
}
});
q.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
ImageButton a = (ImageButton) getActivity().findViewById(R.id.multimedia_camera_classification);
a.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(),CSDN.class);
startActivity(intent);
}
});
a.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
ImageButton z = (ImageButton) getActivity().findViewById(R.id.multimedia_camera_special);
z.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(),IRemenber.class);
startActivity(intent);
}
});
z.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
ImageButton w = (ImageButton) getActivity().findViewById(R.id.multimedia_camera_mine);
w.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(),Pexels.class);
startActivity(intent);
}
});
w.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
}
private class TestNormalAdapter extends StaticPagerAdapter {
private int[] imgs = {
R.drawable.enironment_circle_14st,
R.drawable.enironment_circle_7st,
R.drawable.nironment_circle_13st,
R.drawable.enironment_circle_11st,
};
@Override
public View getView(ViewGroup container, int position) {
ImageView view = new ImageView(container.getContext());
view.setImageResource(imgs[position]);
view.setScaleType(ImageView.ScaleType.CENTER_CROP);
view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
return view;
}
@Override
public int getCount() {
return imgs.length;
}
}
private void initWorldBottom() {
for (int i = 0 ;i < 1; i++){
Class_Environment xiaochou = new Class_Environment(
"美股反弹科技股领涨 亚马逊涨4.03%阿里巴...",R.drawable.enironment_circle_1st);
worldList.add(xiaochou);
Class_Environment guandao = new Class_Environment(
"口碑饿了么合并 阿里成立本地生活服务平台",R.drawable.enironment_circle_5st);
worldList.add(guandao);
Class_Environment xiahu = new Class_Environment(
"传特斯拉以近10亿元的价格获上海建厂用地",R.drawable.enironment_circle_2st);
worldList.add(xiahu);
Class_Environment lanmo = new Class_Environment(
"世界知识论坛:三七互娱杨军畅谈中国游戏...",R.drawable.enironment_circle_3st);
worldList.add(lanmo);
Class_Environment landiao = new Class_Environment(
"国务院新方案推动“互联网+”加快5G商用",R.drawable.enironment_circle_4st);
worldList.add(landiao);
Class_Environment hongyin = new Class_Environment(
"醒醒吧!AI妄想症 计算机比我们更聪明?",R.drawable.enironment_circle_10st);
worldList.add(hongyin);
Class_Environment renzidie = new Class_Environment(
"歌尔股份:虚拟现实产业增速放缓 但坚定长期发展战略",R.drawable.enironment_circle_12st);
worldList.add(renzidie);
Class_Environment meigui = new Class_Environment(
"小米不敌OPPO,上月销量将被OPPO超过!",R.drawable.enironment_circle_13st);
worldList.add(meigui);
Class_Environment paodan = new Class_Environment(
"9月手机品牌全球出货量排行:苹果超华为重回全球第二",R.drawable.enironment_circle_15st);
worldList.add(paodan);
Class_Environment yuemeidie = new Class_Environment(
"谷歌神经网络人声分离技术再突破!词错率低至23.4%",R.drawable.enironment_circle_6st);
worldList.add(yuemeidie);
Class_Environment yuemeidie1 = new Class_Environment(
"变革开始?谷歌在发布会上一次未提及Android",R.drawable.enironment_circle_7st);
worldList.add(yuemeidie1);
Class_Environment yuemeidie2 = new Class_Environment(
"微软将在上海设立微软亚洲研究院",R.drawable.enironment_circle_8st);
worldList.add(yuemeidie2);
Class_Environment yuemeidie3 = new Class_Environment(
"编程科普,C、C++、Java、PHP、Python分别用来开发什么?",R.drawable.enironment_circle_9st);
worldList.add(yuemeidie3);
// adapter_bottom_2.notifyDataSetChanged();
}
}
}
}
| [
"[email protected]"
] | |
52d1ac4c2df42de9bff283037932b87a3ed5083c | de0e4177e234795c0d383ab48493c6fa0373ec6e | /IntroductionToJavaProgramming/src/chapter03/questions/question18.java | c6fc83058d6e998e4f69270f1da06a6ef2362cb7 | [] | no_license | darcy1026/IntroductionToJavaProgramming | 3cf0d9cc33fd6ddea69884c26c009525671c7ced | 4b52c956e68e43816b8a3e7843af73504b9833c6 | refs/heads/master | 2020-06-28T00:55:08.320650 | 2019-08-01T18:40:52 | 2019-08-01T18:40:52 | 200,099,319 | 1 | 0 | null | null | null | null | WINDOWS-1258 | Java | false | false | 1,217 | java | package chapter03.questions;
import java.util.Scanner;
public class question18 {
public static void main(String[] args) {
/*
* (Cost of shipping) A shipping company uses the following function to
* calculate the cost (in dollars) of shipping based on the weight of the
* package (in pounds). c(w) = d 3.5, if 0 6 w 6 = 1 5.5, if 1 6 w 6 = 3 8.5, if
* 3 6 w 6 = 10 10.5, if 10 6 w 6 = 20 Write a program that prompts the user to
* enter the weight of the package and display the shipping cost. If the weight
* is greater than 50, display a message “the package cannot be shipped.”
*/
Scanner input = new Scanner(System.in);
System.out.println("Enter the weight of the package in pounds.");
double weight = input.nextDouble();
if (0 < weight && weight <= 1) {
System.out.println("The price is 3.5");
} else if (1 < weight && weight <= 3) {
System.out.println("The price is 5.5");
} else if (3 < weight && weight <= 10) {
System.out.println("The price is 8.5");
} else if (10 < weight && weight <= 20) {
System.out.println("The price is 10.5");
} else {
System.out.println("Your package can not be shipped.");
}
}
}
| [
"[email protected]"
] | |
260fb9497f16e81114b7ee53856e26d7e205b03b | 2fac4ffcde4f24e06acb82517b523ae3212c58c2 | /src/main/java/com/ibanity/apis/client/products/ponto_connect/services/impl/ReauthorizationRequestServiceImpl.java | 75a6988e9de638c045031ba3be7c5355db119dfb | [
"MIT"
] | permissive | ibanity/ibanity-java | 41f83f7a508aea71e6d7245200ba755a4f85d7e2 | c8aec83721cd49b43b32ac3b325c555f7b05be26 | refs/heads/master | 2023-07-23T07:36:10.224344 | 2023-04-27T23:54:41 | 2023-06-02T12:19:31 | 124,887,360 | 3 | 10 | MIT | 2023-08-28T08:35:50 | 2018-03-12T12:41:45 | Java | UTF-8 | Java | false | false | 3,885 | java | package com.ibanity.apis.client.products.ponto_connect.services.impl;
import com.ibanity.apis.client.http.IbanityHttpClient;
import com.ibanity.apis.client.jsonapi.DataApiModel;
import com.ibanity.apis.client.jsonapi.RequestApiModel;
import com.ibanity.apis.client.models.IbanityProduct;
import com.ibanity.apis.client.products.ponto_connect.models.Account;
import com.ibanity.apis.client.products.ponto_connect.models.ReauthorizationRequest;
import com.ibanity.apis.client.products.ponto_connect.models.create.ReauthorizationRequestCreateQuery;
import com.ibanity.apis.client.products.ponto_connect.services.ReauthorizationRequestService;
import com.ibanity.apis.client.services.ApiUrlProvider;
import lombok.*;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse;
import java.math.BigDecimal;
import java.net.URI;
import java.time.LocalDate;
import java.util.UUID;
import java.util.function.Function;
import static com.ibanity.apis.client.mappers.IbanityModelMapper.mapResource;
import static com.ibanity.apis.client.mappers.IbanityModelMapper.toIbanityModel;
import static com.ibanity.apis.client.mappers.ModelMapperHelper.buildRequest;
import static com.ibanity.apis.client.utils.URIHelper.buildUri;
public class ReauthorizationRequestServiceImpl implements ReauthorizationRequestService {
private final ApiUrlProvider apiUrlProvider;
private final IbanityHttpClient ibanityHttpClient;
public ReauthorizationRequestServiceImpl(ApiUrlProvider apiUrlProvider, IbanityHttpClient ibanityHttpClient) {
this.apiUrlProvider = apiUrlProvider;
this.ibanityHttpClient = ibanityHttpClient;
}
@Override
public com.ibanity.apis.client.products.ponto_connect.models.ReauthorizationRequest create(ReauthorizationRequestCreateQuery reauthorizationRequestCreateQuery) {
URI uri = buildUri(getUrl(reauthorizationRequestCreateQuery.getAccountId()));
ReauthorizationRequest reauthorizationRequest = toRequest(reauthorizationRequestCreateQuery);
RequestApiModel requestApiModel = buildRequest(com.ibanity.apis.client.products.ponto_connect.models.ReauthorizationRequest.RESOURCE_TYPE, reauthorizationRequest);
HttpResponse response = ibanityHttpClient.post(uri, requestApiModel, reauthorizationRequestCreateQuery.getAdditionalHeaders(), reauthorizationRequestCreateQuery.getAccessToken());
return mapResource(response, customMapping());
}
private Function<DataApiModel, com.ibanity.apis.client.products.ponto_connect.models.ReauthorizationRequest> customMapping() {
return dataApiModel -> {
com.ibanity.apis.client.products.ponto_connect.models.ReauthorizationRequest reauthorizationRequest = toIbanityModel(dataApiModel, com.ibanity.apis.client.products.ponto_connect.models.ReauthorizationRequest.class);
reauthorizationRequest.setRedirectLink(dataApiModel.getLinks().getRedirect());
return reauthorizationRequest;
};
}
private String getUrl(UUID accountId) {
return StringUtils.removeEnd(
apiUrlProvider.find(IbanityProduct.PontoConnect, "account", "reauthorizationRequests")
.replace(Account.API_URL_TAG_ID, accountId.toString())
.replace(com.ibanity.apis.client.products.ponto_connect.models.ReauthorizationRequest.API_URL_TAG_ID, ""),
"/");
}
private ReauthorizationRequest toRequest(ReauthorizationRequestCreateQuery reauthorizationRequestCreateQuery) {
return ReauthorizationRequest.builder()
.redirectUri(reauthorizationRequestCreateQuery.getRedirectUri())
.build();
}
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor(access = AccessLevel.PRIVATE)
private static class ReauthorizationRequest {
private String redirectUri;
}
}
| [
"[email protected]"
] | |
20347d50ce1918bea438f0020866c31dc68ba57f | e28a2d8cbcefb204931471bc0b27d18b129fd6dd | /src/main/java/ml/work/main/service/DomicilioService.java | 3280eeaf48326327dfd1c062eaa25897a600fbae | [] | no_license | lucaslattuca/ApiDelivery | 12764c591ac0227c66ed7db58fcc0a97c8871396 | 2d0d876762c9c0234dfc46a55a4a0fa4fda37d0d | refs/heads/master | 2022-03-03T02:31:27.293352 | 2019-10-22T12:56:02 | 2019-10-22T12:56:02 | 193,517,956 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,998 | java | package ml.work.main.service;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.springframework.stereotype.Service;
import ml.work.main.dtos.DomicilioDTO;
import ml.work.main.entities.Domicilio;
import ml.work.main.repositories.DomicilioRepository;
@Service
public class DomicilioService implements ObjectService<DomicilioDTO> {
private DomicilioRepository domicilioRepository;
public DomicilioService(DomicilioRepository domicilioRepository) {
this.domicilioRepository = domicilioRepository;
}
@Override
public List<DomicilioDTO> getAll() {
List<DomicilioDTO> result = new ArrayList<>();
for (Domicilio domicilio : domicilioRepository.findAll()) {
DomicilioDTO temp = new DomicilioDTO();
temp.setCalle(domicilio.getCalle());
temp.setDistrito(domicilio.getDistrito());
temp.setId_domicilio(domicilio.getId_domicilio());
temp.setNumCasa(domicilio.getNumCasa());
temp.setNumDepartamento(domicilio.getNumDepartamento());
temp.setNumPiso(domicilio.getNumPiso());
// temp.setPersonas(domicilio.getPersonas());
result.add(temp);
}
return result;
}
@Override
public DomicilioDTO getOne(int id) {
Optional<Domicilio> aOptional = domicilioRepository.findById(id);
DomicilioDTO temp = new DomicilioDTO();
try {
Domicilio domicilio = aOptional.get();
temp.setCalle(domicilio.getCalle());
temp.setDistrito(domicilio.getDistrito());
temp.setId_domicilio(domicilio.getId_domicilio());
temp.setNumCasa(domicilio.getNumCasa());
temp.setNumDepartamento(domicilio.getNumDepartamento());
temp.setNumPiso(domicilio.getNumPiso());
// temp.setPersonas(domicilio.getPersonas());
} catch (Exception e) {
System.out.println("No existe el id");
}
return temp;
}
@Override
public DomicilioDTO save(DomicilioDTO t) {
Domicilio domicilio = new Domicilio();
domicilio.setCalle(t.getCalle());
domicilio.setNumCasa(t.getNumCasa());
domicilio.setNumDepartamento(t.getNumDepartamento());
domicilio.setNumPiso(t.getNumPiso());
domicilio.setDistrito(t.getDistrito());
// domicilio.setPersonas(t.getPersonas());
domicilioRepository.save(domicilio);
t.setId_domicilio(domicilio.getId_domicilio());
return t;
}
@Override
public DomicilioDTO update(DomicilioDTO t, int id) {
Optional<Domicilio> pOptional = domicilioRepository.findById(id);
Domicilio temp = new Domicilio();
try {
temp = pOptional.get();
temp.setCalle(t.getCalle());
temp.setNumCasa(t.getNumCasa());
temp.setNumDepartamento(t.getNumDepartamento());
temp.setNumPiso(t.getNumPiso());
temp.setDistrito(t.getDistrito());
// temp.setPersonas(t.getPersonas());
domicilioRepository.save(temp);
t.setId_domicilio(temp.getId_domicilio());
} catch (Exception e) {
System.out.println("No existe");
}
return t;
}
@Override
public boolean delete(int id) {
try {
domicilioRepository.deleteById(id);
} catch (Exception e) {
return false;
}
return true;
}
}
| [
"[email protected]"
] | |
7f2f5f4e27772c3584d127610b4fb1e23f1cb1c4 | 26910c44d13c4e6f4674c697e8c57f75f8772929 | /backend/src/main/java/com/devsuperior/dsdeliver/entities/Order.java | 259196898a41d9ddd568e3e7ac12e39abb079fbd | [] | no_license | GermanoDC/dsdeliver-sds2 | 3e405b4c762dcc13370d85e95953f892c24e8663 | 61880fd66ad2fc8a90778793099e67da55566560 | refs/heads/main | 2023-02-14T17:44:13.208549 | 2021-01-09T00:27:00 | 2021-01-09T00:27:00 | 327,632,282 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,589 | java | package com.devsuperior.dsdeliver.entities;
import java.io.Serializable;
import java.time.Instant;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
@Entity
@Table(name = "tb_order")
public class Order implements Serializable{
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String address;
private Double latitude;
private Double longitude;
private Instant moment;
private OrderStatus status;
@ManyToMany
@JoinTable(name = "tb_order_product",
joinColumns = @JoinColumn(name = "order_id"),
inverseJoinColumns = @JoinColumn(name = "product_id"))
private Set<Product> products = new HashSet<>();
public Order() {}
public Order(Long id, String address, Double latitude, Double longitude, Instant moment, OrderStatus status,
Double total) {
super();
this.id = id;
this.address = address;
this.latitude = latitude;
this.longitude = longitude;
this.moment = moment;
this.status = status;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public Double getLatitude() {
return latitude;
}
public void setLatitude(Double latitude) {
this.latitude = latitude;
}
public Double getLongitude() {
return longitude;
}
public void setLongitude(Double longitude) {
this.longitude = longitude;
}
public Instant getMoment() {
return moment;
}
public void setMoment(Instant moment) {
this.moment = moment;
}
public OrderStatus getStatus() {
return status;
}
public void setStatus(OrderStatus status) {
this.status = status;
}
public Set<Product> getProducts() {
return products;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Order other = (Order) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
}
| [
"[email protected]"
] | |
fdd40b4dc6f93363023eef07ca573a97aa22aa9f | a349e4fe2b1a1e490c85dbadd7d6a43d5916571e | /app/src/test/java/com/example/kon/myapplication/ExampleUnitTest.java | 1f058906aa52b9f2b5068fd1b03956c9a5200866 | [] | no_license | mixail9/taskny | 17f763ea2b020fa343a3384c413b86cf992f0b2f | 956ef3cd1dedbbf299599383fec2656f5681dfa0 | refs/heads/master | 2020-04-15T10:58:32.057321 | 2019-01-12T19:33:53 | 2019-01-12T19:33:53 | 164,608,087 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 390 | java | package com.example.kon.myapplication;
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);
}
} | [
"[email protected]"
] | |
3fb03f3dcff8e68c3616ce2aa7506de40d279235 | b1e3d6cc40843c6c0745c2d7d4da7b31941c5ce5 | /OnlineMobileStore/src/main/java/com/mobile/application/service/UserServicesAdmin.java | 8a5a9769cfd66ec4284e8b94fd7094e85b460be6 | [] | no_license | saikishore-cilla/MobileStoreApplication | 32ad3a59f5ff3a792d4d6f60fd4059bd720d2d3b | 71f27c13fdde162ddbb843960bc6683511b21640 | refs/heads/master | 2023-01-23T20:38:39.504305 | 2020-11-25T06:52:57 | 2020-11-25T06:52:57 | 315,853,308 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 519 | java | package com.mobile.application.service;
import java.util.List;
import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mobile.application.model.User;
import com.mobile.application.repository.UserRepository;
@Service
@Transactional
public class UserServicesAdmin {
@Autowired
UserRepository userRepo;
public List<User> getAllUsers(){
return (List<User>) userRepo.findAll();
}
}
| [
"MY PC@DESKTOP-5FIH6JD"
] | MY PC@DESKTOP-5FIH6JD |
bee68c0a405157680288eb190bbec2d472e81eb9 | c68ef436f09a435f097e7b047312803c263f8078 | /plugin/src/main/java/bin/mt/plugin/GoogleWebTranslationEngine.java | 981dcb6535733bf04834316109a2fa3f4548da3a | [] | no_license | erqut520/MT-Translation-Plugin | eba53a92429970faa091d2c18f9ebdcdd0c16f0d | f5dd6d1103585159e37c16865047f56007b758d4 | refs/heads/master | 2023-03-17T16:38:47.847024 | 2020-09-02T05:18:17 | 2020-09-02T05:18:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,871 | java | package bin.mt.plugin;
import android.support.annotation.NonNull;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import bin.mt.plugin.api.LocalString;
import bin.mt.plugin.api.translation.BaseTranslationEngine;
/**
* 谷歌翻译Web版
*
* @author Bin
*/
public class GoogleWebTranslationEngine extends BaseTranslationEngine {
private List<String> sourceLanguages = Arrays.asList("auto",
"zh", "zh-TW", "en", "af", "am", "ar", "az", "be", "bg", "bn", "bs", "ca",
"ceb", "co", "cs", "cy", "da", "de", "el", "eo", "es", "et", "eu", "fa",
"fi", "fr", "fy", "ga", "gd", "gl", "gu", "ha", "haw", "hi", "hmn", "hr",
"ht", "hu", "hy", "id", "ig", "is", "it", "iw", "ja", "jw", "ka", "kk",
"km", "kn", "ko", "ku", "ky", "la", "lb", "lo", "lt", "lv", "mg", "mi",
"mk", "ml", "mn", "mr", "ms", "mt", "my", "ne", "nl", "no", "ny", "pa",
"pl", "ps", "pt", "ro", "ru", "sd", "si", "sk", "sl", "sm", "sn", "so",
"sq", "sr", "st", "su", "sv", "sw", "ta", "te", "tg", "th", "tl", "tr",
"uk", "ur", "uz", "vi", "xh", "yi", "yo", "zu");
private List<String> targetLanguages = Arrays.asList(
"zh", "zh-TW", "en", "af", "am", "ar", "az", "be", "bg", "bn", "bs", "ca",
"ceb", "co", "cs", "cy", "da", "de", "el", "eo", "es", "et", "eu", "fa",
"fi", "fr", "fy", "ga", "gd", "gl", "gu", "ha", "haw", "hi", "hmn", "hr",
"ht", "hu", "hy", "id", "ig", "is", "it", "iw", "ja", "jw", "ka", "kk",
"km", "kn", "ko", "ku", "ky", "la", "lb", "lo", "lt", "lv", "mg", "mi",
"mk", "ml", "mn", "mr", "ms", "mt", "my", "ne", "nl", "no", "ny", "pa",
"pl", "ps", "pt", "ro", "ru", "sd", "si", "sk", "sl", "sm", "sn", "so",
"sq", "sr", "st", "su", "sv", "sw", "ta", "te", "tg", "th", "tl", "tr",
"uk", "ur", "uz", "vi", "xh", "yi", "yo", "zu");
private LocalString string;
@Override
protected void init() {
string = getContext().getAssetLocalString("String");
GoogleWebTranslator.readState(getContext().getPreferences());
}
@NonNull
@Override
public String name() {
return string.get("gtw");
}
@NonNull
@Override
public List<String> loadSourceLanguages() {
return sourceLanguages;
}
@NonNull
@Override
public List<String> loadTargetLanguages(String sourceLanguage) {
return targetLanguages;
}
@NonNull
@Override
public String translate(String text, String sourceLanguage, String targetLanguage) throws IOException {
return GoogleWebTranslator.translate(text, sourceLanguage, targetLanguage);
}
@Override
public void onFinish() {
GoogleWebTranslator.saveState(getContext().getPreferences());
}
}
| [
"[email protected]"
] | |
86bea512d59943ef46c6e1592bcf49ef11074a8f | 22396b2e711f96d21636519efd2b7cc4f72f93ed | /KadabraAPI/src/autotuner/configs/knobs/number/ranged/RangedKnob.java | 9de34213389a563174e215868f6678c12fc60b75 | [
"Apache-2.0"
] | permissive | specs-feup/kadabra | 44efa670ff020409a7819c5f835ea0ae3f8f9e96 | a4aa20d607b5f71583a9f9ff670f120455372a2d | refs/heads/master | 2023-08-31T12:00:42.472690 | 2023-07-22T16:43:36 | 2023-07-22T16:43:36 | 194,742,059 | 4 | 1 | Apache-2.0 | 2023-08-21T22:07:14 | 2019-07-01T20:57:44 | Java | UTF-8 | Java | false | false | 3,452 | java | /**
* Copyright 2017 SPeCS.
*
* 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. under the License.
*/
package autotuner.configs.knobs.number.ranged;
import java.util.List;
import pt.up.fe.specs.util.SpecsCollections;
/**
* Representation of a range that contains an upper limit, lower limit and the current value
*
* @author tdrc
*
* @param <T>
*/
public interface RangedKnob<T extends Number> {
T getUpperLimit();
T getLowerLimit();
T getValue();
/**
* Increments the value by the defined step if the value maintains inside the bounds
*
* @return true if it was possible to increment i.e., it is still inside bounds
*/
boolean inc();
/**
* Increments the value given by the defined step, does not guarantee bound correctness (use
* {@link #inBounds(Number)} method)
*
* @return the incremented value
*/
T ascend(T reference);
/**
* Decrements the value by the defined step if the value maintains inside the bounds
*
* @return true if it was possible to decrement, i.e., it is still inside bounds
*/
boolean dec();
/**
* Decrements the value given by the defined step, does not guarantee bound correctness (use
* {@link #inBounds(Number)} or {@link #canDescend(Number)} method)
*
* @return the decremented value
*/
T descend(T reference);
/**
* Verifies if it is possible to descend further than the given value, based on the defined step
*
* @return true if possible, false otherwise
*/
default boolean canDescend(T reference) {
T value = descend(reference);
return inBounds(value);
}
/**
* Invokes {@link #descend(Number)} and {@link #ascend(Number)} methods and only adds the new values to the list if
* they are {@link #inBounds(Number)}.
*
* @param referenceValue
* @return
*/
default List<T> getSurrounding(T reference) {
return getSurrounding(reference, false);
}
default List<T> getSurrounding(T reference, boolean includeSelf) {
List<T> sides = SpecsCollections.newArrayList();
T next = descend(reference);
if (inBounds(next)) {
sides.add(next);
}
next = ascend(reference);
if (inBounds(next)) {
sides.add(next);
}
if (includeSelf) {
sides.add(reference);
}
return sides;
}
/**
* Verifies if it is possible to descend further than the given value, based on the defined step
*
* @return true if possible, false otherwise
*/
default boolean canClimb(T reference) {
T value = ascend(reference);
return inBounds(value);
}
void setValue(T value);
boolean inBounds(T value);
int estimateVersions();
void setValueFromNumber(Number value);
// boolean canInc();
//
// boolean canDec();
}
| [
"[email protected]"
] | |
f70bdb05c6c62a35b329025ed5777e2cfea1a271 | a7004fb4b96b4142a9f7c63e0b5daade9012844c | /Cats.java | 3f2a06fdb7ae7e92e4a63c1f8ee15944fadf4254 | [] | no_license | Alex4589/CS111 | e2bd37ea9f96050d9c462d21ca65351fae4aa28a | 88b4aaafcc195daeb276213e5e2e1a82f1e62a4c | refs/heads/main | 2023-08-11T15:06:23.132804 | 2021-09-28T17:48:33 | 2021-09-28T17:48:33 | 407,278,857 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 417 | java | /*
9/15/2021
*/
public class Cats{
public static void main(String[] args){
int anaCats = Integer.parseInt(args[0]);
int ellenCats = Integer.parseInt(args[1]);
if ((anaCats < 0 ) || (ellenCats < 0)){
System.out.println("ERROR");
}else {
int totalCats = anaCats + ellenCats;
System.out.println("Total cats = " + totalCats);
}
}
} | [
"[email protected]"
] | |
5bcd4ecec249eadeb8602244d0ade1f6bfa29a61 | c82eff99c47ac1a433b22285e7898ca27f0b9f4e | /jmock/src/main/java/org/jmock/internal/perf/distribution/Distribution.java | b96b04b30178cb6f4e8c0f91c6dc6810a9025d19 | [
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | Wiijah/jmock-library | 5e72a12b95462c6072e99933cb9bf4a263bd9809 | 98213a72c5eea79ed4f5a2b46510d681ea582ac0 | refs/heads/master | 2021-09-02T05:01:50.946358 | 2017-12-25T11:21:00 | 2017-12-25T11:21:00 | 115,027,699 | 0 | 0 | null | 2017-12-21T16:51:50 | 2017-12-21T16:51:49 | null | UTF-8 | Java | false | false | 101 | java | package org.jmock.internal.perf.distribution;
public interface Distribution {
double sample();
} | [
"[email protected]"
] | |
0c7740cb5cec477960189636fd2c708ddb6272ed | 21f9c5bc83157e31e715085f747aed025f430391 | /Project2Server/src/main/java/com/ex/config/PersistenceConfig.java | 1cab6cd53c532b5bcac028261c84f1d00daa59fb | [] | no_license | timmycahill/Hello-There | 2441a4fc2b78cfd5f8749c665c37d48e1b0d3e64 | 6e7ac8e6f2daa53720bc9f4c918b65ea9a86353c | refs/heads/master | 2023-02-06T23:44:28.577967 | 2020-12-29T23:06:38 | 2020-12-29T23:06:38 | 325,384,668 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,556 | java | package com.ex.config;
import com.zaxxer.hikari.HikariDataSource;
import java.util.Properties;
import javax.sql.DataSource;
import org.postgresql.Driver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.orm.hibernate4.HibernateTransactionManager;
import org.springframework.orm.hibernate4.LocalSessionFactoryBean;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration
@EnableTransactionManagement
public class PersistenceConfig {
/**
* This bean sets up the database configurations
* @return returns the configured dataSource bean
*/
@Bean
public DataSource dataSource() {
System.out.println("Setting up datasource");
HikariDataSource ds = new HikariDataSource();
ds.setJdbcUrl("jdbc:postgresql://project2.cyrfeoigkzgl.us-east-1.rds.amazonaws.com:5432/postgres");
ds.setUsername("postgres");
ds.setPassword("p4sSw0rD");
ds.setDriverClassName(Driver.class.getName());
return ds;
}
/**
* This bean sets up the projects our LocalSessionFactoryBean
* @return returns the configured entityManager bean
*/
@Bean
public LocalSessionFactoryBean entityManager() {
System.out.println("Setting up Session Factory");
LocalSessionFactoryBean sf = new LocalSessionFactoryBean();
sf.setDataSource(this.dataSource());
sf.setPackagesToScan("com.ex.Models");
sf.setHibernateProperties(this.getHibernateProperties());
return sf;
}
/**
* this bean sets up the projects transactionManager
* @return returns the configured transactionManager bean
*/
@Bean
public HibernateTransactionManager transactionManager() {
System.out.println("Setting up Transaction Manager");
HibernateTransactionManager txManager = new HibernateTransactionManager();
txManager.setSessionFactory(this.entityManager().getObject());
return txManager;
}
/**
* this method configures our Hibernate properties for the project
* @return returns property configuration object for Hibernate
*/
private Properties getHibernateProperties() {
Properties props = new Properties();
props.setProperty("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect");
props.setProperty("hibernate.show_sql", "true");
props.setProperty("hibernate.format_sql", "true");
return props;
}
} | [
"[email protected]"
] | |
aff1d63c733b7b5e852284a5b3d6690ad7167753 | 8ae9de0cd6364a8e6eee21adb5cb19ccca23e1d5 | /allgame/src/main/java/uni/poo/allgame/controller/UsuarioController.java | 93ebe7bbdce9dbb8064cae20c3174c13fbfe2e38 | [] | no_license | JhanAntezana/JhanAntezana.github.io | 96bb78420bcb07daedd3f974473ce5301138f746 | 3f97b6fdaca7427fa736c67261daf511cb9c4eff | refs/heads/main | 2023-03-09T14:26:24.765034 | 2021-02-28T03:31:50 | 2021-02-28T03:31:50 | 343,012,470 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,127 | java | package uni.poo.allgame.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import uni.poo.allgame.dto.Usuario;
import uni.poo.allgame.service.UsuarioService;
@RestController
@RequestMapping("/usuarios")
public class UsuarioController {
@Autowired
UsuarioService usuarioService;
@PostMapping
public @ResponseBody String registrarUsuario(@RequestBody Usuario usuario){
return usuarioService.registrarUsuario(usuario);
}
@GetMapping
public @ResponseBody Usuario obtenerUsuario(@RequestParam String username){
return usuarioService.obtenerUsuario(username);
}
@DeleteMapping
public @ResponseBody String eliminarUsuario(@RequestParam String username){
usuarioService.eliminarUsuario(username);
return "Usuario eliminado";
}
@GetMapping("/logIn/{emailOrUsername}/{password}")
public @ResponseBody Usuario logIn(@PathVariable String emailOrUsername, @PathVariable String password){
return usuarioService.obtenerUsuario(emailOrUsername);
}
}
| [
"[email protected]"
] | |
0ff59d9d5e9df586b360e3e87f00558ac0d4b9f8 | a55d97b4ccb389cac9a109446c4bde611971f427 | /POS/src/First/Bill_receipt.java | 05e24aa1e28ebe92624b12423a7a83d543651e16 | [] | no_license | sahanmadu/Java-POS | b7aa028f137d86ed229027019aebf9f6d624e9b4 | b1672bec788c492dde1f2fc149fff0bab8109e2b | refs/heads/master | 2022-11-18T18:20:04.665269 | 2020-07-22T11:20:34 | 2020-07-22T11:20:34 | 281,655,854 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,267 | 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 First;
/**
*
* @author Eranga
*/
public class Bill_receipt extends javax.swing.JFrame {
/**
* Creates new form Bill_receipt
*/
public Bill_receipt() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 1095, Short.MAX_VALUE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 583, Short.MAX_VALUE)
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Bill_receipt.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Bill_receipt.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Bill_receipt.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Bill_receipt.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Bill_receipt().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel jPanel1;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.