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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6ee6b6949a8bfae62d72850b945c743e81bddb0f | 87c4d8551bd90c93c43d2ff68a76820ab20812c0 | /springboot_chap05/springboot/src/main/java/com/heynas/springboot/demo/service/StudentService2.java | 13e97c313cb707e68a6693d6280da89c5e8d7b3a | [] | no_license | evrimulgen/ROM_MicroService_Springboot | e374434af02750d5f0c372936556f4ef9e68e82c | 4a1eb36605132faef9312b630d2d05fef2f5ba14 | refs/heads/master | 2020-04-06T13:50:51.890288 | 2018-09-24T16:43:06 | 2018-09-24T16:43:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 827 | java | package com.heynas.springboot.demo.service;
import com.heynas.springboot.demo.core.PersistenceManager;
import com.heynas.springboot.demo.dao.StudentJpaRepository;
import com.heynas.springboot.demo.domain.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.List;
/**
* <p> Description: StudentService </p>
* <pre> </pre>
*
* Copyright: © 2012-2017 Heynas Studio. All rights reserved.
*
* @author William
* @version 1.0
*/
@Service
@Transactional
public class StudentService2 {
@Autowired
PersistenceManager persistenceManager;
public String add(Student student) {
persistenceManager.add(student);
return student.getUuid();
}
}
| [
"[email protected]"
] | |
2ebaf79156df96e95c61bc27ca60afe1e9243f5c | d1a6d1e511df6db8d8dd0912526e3875c7e1797d | /genny_JavaWithLambdasApi21/applicationModule/src/main/java/applicationModulepackageJava5/Foo628.java | 2f48d5374400d11f36157d772ee2fd15efd4658c | [] | no_license | NikitaKozlov/generated-project-for-desugaring | 0bc1443ab3ddc84cd289331c726761585766aea7 | 81506b3711004185070ca4bb9a93482b70011d36 | refs/heads/master | 2020-03-20T00:35:06.996525 | 2018-06-12T09:30:37 | 2018-06-12T09:30:37 | 137,049,317 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 575 | java | package applicationModulepackageJava5;
public class Foo628 {
public void foo0() {
final Runnable anything0 = () -> System.out.println("anything");
new applicationModulepackageJava5.Foo627().foo9();
}
public void foo1() {
foo0();
}
public void foo2() {
foo1();
}
public void foo3() {
foo2();
}
public void foo4() {
foo3();
}
public void foo5() {
foo4();
}
public void foo6() {
foo5();
}
public void foo7() {
foo6();
}
public void foo8() {
foo7();
}
public void foo9() {
foo8();
}
}
| [
"[email protected]"
] | |
5cf8fc7acd58e5331dfe6af32506247ea258bf00 | 0ddb2d28af7259e1c3ebbe1ed594c5074e476fdb | /PSA/Leader(AMCAT).java | 3c13a161c62b5e1e2d699fd466986d8666b17776 | [] | no_license | Kritika1300/DS-ALGO | baa93ed9080475f0eceb53a47fb4999d06d02020 | 0f580e8446f3fc379008680767acdcd46a99911b | refs/heads/master | 2023-05-07T06:25:55.686716 | 2021-06-01T17:48:54 | 2021-06-01T17:48:54 | 286,824,876 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,881 | java | <!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags always come first -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="node_modules/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="node_modules/bootstrap-social/bootstrap-social.css">
<link href="css/styles1.css" rel="stylesheet">
<title>HI -TECH SPARES</title>
</head>
<body>
<nav class="navbar navbar-dark navbar-expand-sm fixed-top">
<div class="container">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#Navbar">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand mr-auto" href="#">HI-TECH SPARES</a>
<div class="collapse navbar-collapse" id="Navbar">
<ul class="navbar-nav mr-auto">
<li class="nav-item active"><a class="nav-link" href="./ProjectWt.html"><span class="fa fa-home fa-lg"></span> Home</a></li>
<li class="nav-item"><a class="nav-link" href="#"><span class="fa fa-info fa-lg"></span> About</a></li>
<li class="nav-item"><a class="nav-link" href="#"><span class="fa fa-address fa-lg"></span> Contact</a></li>
<li class="nav-item"><a class="nav-link" href="#"><span class="fa fa-shopping cart fa-lg"></span> Product</a></li>
</ul>
</div>
</div>
</nav>
<header class = "jumbotron">
<div class = "container">
<div class = "row row-header align-items-center">
<div class = "col-12 col-sm-6">
<h1>HI-TECH SPARES</h1>
<p style ="color:azure"><i><strong>Committed to connecting</strong></i></p>
</div>
<div class = "col-12 col-sm">
</div>
</div>
</div>
</header>
<div class = "container">
<div class ="row row-content align-items-center">
<div class = " col-sm-6">
<img src="Galaxy-S20_S20_S20_Ultra_5G_full_rgb.png" alt="p_image">
</div>
<div class = " col-sm-6">
<p><h1>Samsung Galaxy S20 </h1><br>Samsung Galaxy S20 is powered by a 2GHz octa-core Samsung Exynos 990 processor.<br>
It comes with 8GB of RAM. <br>It runs Android 10 and is powered by a 4000mAh non-removable battery. <br>Supports wireless charging, as well as proprietary fast charging.<br>
Samsung Galaxy S20 on the rear packs a 12-megapixel primary camera with an f/1.8 aperture; a second 64-megapixel camera with an f/2.0 aperture and a third 12-megapixel camera with an f/2.2 aperture. The rear camera setup has autofocus.<br>
Price :<strike>₹ 72,990</strike> ₹ 67,699 </p>
</div>
</div>
<div class ="row row-content align-items-center">
<div class = " col-sm-6">
<img src="Vivo-X30-5G.jpg" alt="p1_image">
</div>
<div class = " col-sm-6">
<p><h1>Vivo X30 </h1><br>Vivo X30 5G is powered by an octa-core Samsung Exynos 980 processor.<br>
It comes with 8GB of RAM. <br>It runs Android 9 Pie and is powered by a 4350mAh battery. <br>Supports wireless charging, as well as proprietary fast charging.<br>
As far as the cameras are concerned, the Vivo X30 5G on the rear packs a 64-megapixel primary camera with an f/1.8 aperture; a second 32-megapixel camera with an f/2.0 aperture and a third 8-megapixel camera with an f/2.2 aperture. The rear camera setup has autofocus. It sports a 32-megapixel camera on the front for selfies.<br>
Price :<strike>₹ 72,990</strike> ₹ 67,699 </p>
</div>
</div>
<div class ="row row-content align-items-center">
<div class = "col-sm-6">
<p class="product-list"><h3><u>Upcoming Products</u></h3>
<ol >
<li>OPPO Reno3 Pro <small> (Expected launch date : 1<sup>st </sup>Sept 2020)</small></li>
<li>OPPO Reno Ace <small> (Expected launch date : 21<sup>st </sup>Aug 2020)</small></li>
<li>Samsung Galaxy M51 <small> (Expected launch date : 4<sup>th </sup>Sept 2020)</small></li>
<li>Samsung Galaxy A51s <small> (Expected launch date : 2<sup>nd </sup>Sept 2020)</small></li>
<li>Xiaomi Redmi 8<small> (Expected launch date : 21<sup>st </sup>Aug 2020)</small></li>
</ol>
</div>
<div class = "col-sm-6">
<center>
<table id = "mytable" >
<tr> <th> Product Name</th>
<th> Price Drop</th></tr>
<tr> <td> Iphone XR</td>
<td> Rs 63,900 </td></tr>
<tr> <td> Vivo V19</td>
<td> Rs 24,990 </td></tr>
<tr> <td> Samsung Galaxy M21</td>
<td> Rs 18,599 </td></tr>
<tr> <td> Samsung Galaxy A50s</td>
<td> Rs 21,070 </td></tr>
</table>
</center>
</div>
</div>
<div class ="row row-content align-items-center">
<div class = " links col-sm-12" >
<p><h4>   For more information visit:</h4>
<ul>
<li><a href ="https://www.wikipedia.org/ " target="_blank">Wikipedia</a></li>
<li><a href ="https://www.google.co.in/ " target="_self">Google</a></li>
</ul>
</div>
</div>
</div>
<footer class = "footer">
<div class = "container">
<div class = "row">
<div class = "col-4 offset-1 col-sm-2">
<h5><big>Links</big></h5>
<ul class = "list-unstyled">
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
<li><a href="product.html">Product</a></li>
</ul>
</div>
<div class = "col-7 col-sm-5">
<h5><big>Our Address</big></h5>
<address>
SCO 1020-21<br>
Sector 22-B<br>
Chandigarh<br>
<i class="fa fa-phone fa-lg"></i>:9417173539<br>
<i class="fa fa-envelope fa-lg"></i>: <a href="mailto:[email protected]">[email protected]</a>
</address>
</div>
<div class = "col-12 col-sm-4 align-self-center">
<div class = "text-center">
<a class="btn btn-social-icon btn-google" href="http://google.com/+"><i class="fa fa-google-plus"></i></a>
<a class="btn btn-social-icon btn-facebook" href="http://www.facebook.com/profile.php?id="><i class="fa fa-facebook"></i></a>
<a class="btn btn-social-icon btn-linkedin" href="http://www.linkedin.com/in/"><i class="fa fa-linkedin"></i></a>
<a class="btn btn-social-icon btn-twitter" href="http://twitter.com/"><i class="fa fa-twitter"></i></a>
<a class="btn btn-social-icon btn-google" href="http://youtube.com/"><i class="fa fa-youtube"></i></a>
<a class="btn btn-social-icon" href="mailto:"><i class="fa fa-envelope-o"></i></a>
</div>
</div>
</div>
<div class = "row justify-content-center">
<div class = "col-auto">
<p>© Copyright 2020 Hitech-Spares</p>
</div>
</div>
</div>
</footer>
<!-- jQuery first, then Popper.js, then Bootstrap JS. -->
<script src="node_modules/jquery/dist/jquery.slim.min.js"></script>
<script src="node_modules/popper.js/dist/umd/popper.min.js"></script>
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
</body>
</html> | [
"[email protected]"
] | |
8169509059a265351225949215eefb848c418471 | 8db711e9ced848a4426d8a59d7364ef21bd7b5e6 | /src/main/java/com/bugzilla/bdd/page/BrowserPage.java | 2801c8fc0696c05647a13e9addb94252da36dc3b | [] | no_license | Shailjapandey/Bugzilla_BDD_Java | b8fad31d4cb0cecec78c53bfef8f6cc9d0726b2c | 8e26b71fee43bbe945ce505bb0289d10e780d7c1 | refs/heads/master | 2021-06-24T15:52:09.931196 | 2019-12-01T10:04:04 | 2019-12-01T10:04:04 | 223,699,247 | 0 | 0 | null | 2021-04-26T20:39:32 | 2019-11-24T05:54:01 | HTML | UTF-8 | Java | false | false | 229 | java | package com.bugzilla.bdd.page;
import org.openqa.selenium.WebDriver;
public class BrowserPage extends PageBase {
private WebDriver driver;
public BrowserPage(WebDriver driver) {
super(driver);
this.driver = driver;
}
}
| [
"[email protected]"
] | |
c6202a78389b59d51d78c31d3bed7944d47931db | 12a28a1f6dc719ea9d46cf04d59ba222686014f9 | /src/test/java/com/example/mongodb/BookResourceTest.java | 1511cdd8730a2550409152ef55a4157019feec9a | [] | no_license | juazugas/quarkus-mongodb-opentracing | ca9e59db913514f7aee0c2ef74277ae82230ffa3 | fede2966d2ffc4fa94660211e5f3db19706115f1 | refs/heads/master | 2023-01-29T02:17:40.962574 | 2020-12-13T22:40:36 | 2020-12-13T22:40:36 | 295,403,744 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 432 | java | package com.example.mongodb;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;
import static io.restassured.RestAssured.given;
import static org.hamcrest.CoreMatchers.is;
@QuarkusTest
public class BookResourceTest {
@Test
public void testHelloEndpoint() {
given()
.when().get("/hello")
.then()
.statusCode(200)
.body(is("hello"));
}
} | [
"[email protected]"
] | |
9fc1dc96085f07a499209fbd566369eab5a91ae1 | 175427d385017b3d61e7266d1f492c6b05eb015b | /Charge.java | 2ae27fc50f1069a134a75dbb2b07401b7c424599 | [] | no_license | mukeshranjan674/charge | 7376d44f26eb0585220e6e4bbb4a99b3a15d8341 | e3dd5ed5ed87c77df1faf0a8e89b7d9d2d9d6512 | refs/heads/master | 2022-12-27T15:33:29.405347 | 2020-09-29T11:35:17 | 2020-09-29T11:35:17 | 299,593,764 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 714 | java | class Charge{
private static final double k = 8.99e09;
private final double rx;
private final double ry;
private final double q;
public Charge( double x0, double y0, double q0) {
this.rx = x0;
this.ry = y0;
this.q = q0;
}
private double potentialAt(double x , double y) {
double dx = x - rx;
double dy = y - ry;
return q / Math.sqrt(dx*dx + dy*dy);
}
public static void main(String[] args) {
double x = Double.parseDouble(args[0]);
double y = Double.parseDouble(args[1]);
Charge c1 = new Charge(0.51, 0.63, 21.31);
Charge c2 = new Charge(0.13, 0.50, 51.56);
double v1 = c1.potentialAt(x, y);
double v2 = c2.potentialAt(x , y);
System.out.printf("%.2e\n" , (v1+v2));
}
}
| [
"[email protected]"
] | |
8fd697ab1d79b9413c480e4b201d44687eda7227 | 0b64b31872985e3a7413da6bac22d7279a361fb7 | /src/main/java/me/wcc/homenvi/controller/CollectorController.java | 0c2628eab0ca9dad90e87e08b562f61532f7eb24 | [
"MIT"
] | permissive | TTcheng/Homenvi-backend | fe673cc0bbb0c0590b177486675d596b34b824e4 | 07ec2f3b06b152a09192b452d99a983611dda400 | refs/heads/master | 2023-04-28T04:26:26.260171 | 2021-03-08T15:48:13 | 2021-03-08T15:48:13 | 173,906,728 | 1 | 1 | MIT | 2023-04-14T17:48:53 | 2019-03-05T08:32:37 | Java | UTF-8 | Java | false | false | 3,485 | java | package me.wcc.homenvi.controller;
import io.swagger.annotations.Api;
import me.wcc.base.domain.Page;
import me.wcc.base.infra.constant.BaseConstants;
import me.wcc.base.infra.utils.Results;
import me.wcc.homenvi.entity.Collector;
import me.wcc.homenvi.exception.UnauthorizedCollectorException;
import me.wcc.homenvi.service.CollectorService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import io.choerodon.mybatis.pagehelper.annotation.SortDefault;
import io.choerodon.mybatis.pagehelper.domain.PageRequest;
import io.choerodon.mybatis.pagehelper.domain.Sort;
import io.swagger.annotations.ApiOperation;
import springfox.documentation.annotations.ApiIgnore;
/**
* 终端采集节点 管理 API
*
* @author [email protected]
* @date 2019-04-12 19:17:00
*/
@Api(tags = "采集器管理")
@RestController("collectorController")
public class CollectorController {
private static final Logger LOGGER = LoggerFactory.getLogger(CollectorController.class);
private final CollectorService collectorService;
public CollectorController(CollectorService collectorService) {
this.collectorService = collectorService;
}
@ApiOperation(value = "采集节点刷新信息")
@GetMapping("/openApi/collectors/refresh")
public ResponseEntity<String> refresh(Collector collector) {
try {
collectorService.refresh(collector);
} catch (UnauthorizedCollectorException e) {
LOGGER.error("Unauthorized Collector : {}", collector);
return new ResponseEntity<>(HttpStatus.UNAUTHORIZED);
}
return Results.success(BaseConstants.FIELD_SUCCESS);
}
/**
* 列表
*/
@ApiOperation(value = "终端采集节点列表")
@GetMapping("/homenvi/collectors")
public ResponseEntity<Page<Collector>> list(Collector collector, @ApiIgnore @SortDefault(value = Collector.FIELD_ID,
direction = Sort.Direction.DESC) PageRequest pageRequest) {
Page<Collector> list = collectorService.pageAndSort(pageRequest, collector);
return Results.success(list);
}
/**
* 详细
*/
@ApiOperation(value = "终端采集节点明细")
@RequestMapping("/homenvi/collectors/{id}")
public ResponseEntity<Collector> detail(@PathVariable Long id) {
Collector collector = collectorService.selectByPrimaryKey(id);
return Results.success(collector);
}
/**
* 创建
*/
@ApiOperation(value = "创建终端采集节点")
@PostMapping("/homenvi/collectors")
public ResponseEntity<Collector> create(@RequestBody Collector collector) {
collectorService.insertSelective(collector);
return Results.success(collector);
}
/**
* 修改
*/
@ApiOperation(value = "修改终端采集节点")
@PutMapping("/homenvi/collectors")
public ResponseEntity<Collector> update(@RequestBody Collector collector) {
collectorService.updateByPrimaryKeySelective(collector);
return Results.success(collector);
}
/**
* 删除
*/
@ApiOperation(value = "删除终端采集节点")
@DeleteMapping("/homenvi/collectors/{id}")
public ResponseEntity<Collector> remove(@PathVariable Long id) {
collectorService.deleteByPrimaryKey(id);
return Results.success();
}
}
| [
"[email protected]"
] | |
4dfae404a7b93637211f121374c78b6eb2dfc1bb | e6c51943104fa6b1350935dd24e0e31fe04da406 | /apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/routerinterface/impl/RouterInterfaceManager.java | bbcc04f1d335a1594ef719e4f19473019c85e09a | [
"Apache-2.0"
] | permissive | onfsdn/atrium-onos | bf7feed533b4e210a47312cbf31c614e036375ac | cd39c45d4ee4b23bd77449ac326148d3f6a23ef4 | refs/heads/support/atrium-16A | 2021-01-17T22:06:52.781691 | 2016-02-09T18:13:31 | 2016-02-09T18:13:31 | 51,386,951 | 3 | 4 | null | 2016-07-19T19:28:21 | 2016-02-09T18:03:47 | Java | UTF-8 | Java | false | false | 9,986 | java | /*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc.routerinterface.impl;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.slf4j.LoggerFactory.getLogger;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
import org.onlab.util.KryoNamespace;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
import org.onosproject.store.serializers.KryoNamespaces;
import org.onosproject.store.service.EventuallyConsistentMap;
import org.onosproject.store.service.EventuallyConsistentMapEvent;
import org.onosproject.store.service.EventuallyConsistentMapListener;
import org.onosproject.store.service.StorageService;
import org.onosproject.store.service.WallClockTimestamp;
import org.onosproject.vtnrsc.RouterId;
import org.onosproject.vtnrsc.RouterInterface;
import org.onosproject.vtnrsc.SubnetId;
import org.onosproject.vtnrsc.TenantId;
import org.onosproject.vtnrsc.VirtualPortId;
import org.onosproject.vtnrsc.router.RouterService;
import org.onosproject.vtnrsc.routerinterface.RouterInterfaceEvent;
import org.onosproject.vtnrsc.routerinterface.RouterInterfaceListener;
import org.onosproject.vtnrsc.routerinterface.RouterInterfaceService;
import org.onosproject.vtnrsc.subnet.SubnetService;
import org.onosproject.vtnrsc.virtualport.VirtualPortService;
import org.slf4j.Logger;
import com.google.common.collect.Sets;
/**
* Provides implementation of the Router interface service.
*/
@Component(immediate = true)
@Service
public class RouterInterfaceManager implements RouterInterfaceService {
private static final String SUBNET_ID_NULL = "Subnet ID cannot be null";
private static final String ROUTER_INTERFACE_NULL = "Router Interface cannot be null";
private static final String ROUTER_INTERFACE = "vtn-router-interface-store";
private static final String VTNRSC_APP = "org.onosproject.vtnrsc";
private static final String LISTENER_NOT_NULL = "Listener cannot be null";
private static final String EVENT_NOT_NULL = "event cannot be null";
private final Logger log = getLogger(getClass());
private final Set<RouterInterfaceListener> listeners = Sets
.newCopyOnWriteArraySet();
private EventuallyConsistentMapListener<SubnetId, RouterInterface> routerInterfaceListener =
new InnerRouterInterfaceStoreListener();
protected EventuallyConsistentMap<SubnetId, RouterInterface> routerInterfaceStore;
protected ApplicationId appId;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected StorageService storageService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected CoreService coreService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected VirtualPortService virtualPortService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected SubnetService subnetService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected RouterService routerService;
@Activate
public void activate() {
appId = coreService.registerApplication(VTNRSC_APP);
KryoNamespace.Builder serializer = KryoNamespace
.newBuilder()
.register(KryoNamespaces.API)
.register(RouterId.class, TenantId.class, VirtualPortId.class,
RouterInterface.class, SubnetId.class);
routerInterfaceStore = storageService
.<SubnetId, RouterInterface>eventuallyConsistentMapBuilder()
.withName(ROUTER_INTERFACE).withSerializer(serializer)
.withTimestampProvider((k, v) -> new WallClockTimestamp())
.build();
routerInterfaceStore.addListener(routerInterfaceListener);
log.info("Started");
}
@Deactivate
public void deactivate() {
routerInterfaceStore.removeListener(routerInterfaceListener);
routerInterfaceStore.destroy();
listeners.clear();
log.info("Stopped");
}
@Override
public boolean exists(SubnetId subnetId) {
checkNotNull(subnetId, SUBNET_ID_NULL);
return routerInterfaceStore.containsKey(subnetId);
}
@Override
public Collection<RouterInterface> getRouterInterfaces() {
return Collections
.unmodifiableCollection(routerInterfaceStore.values());
}
@Override
public RouterInterface getRouterInterface(SubnetId subnetId) {
checkNotNull(subnetId, SUBNET_ID_NULL);
return routerInterfaceStore.get(subnetId);
}
@Override
public boolean addRouterInterface(RouterInterface routerInterface) {
checkNotNull(routerInterface, ROUTER_INTERFACE_NULL);
if (!virtualPortService.exists(routerInterface.portId())) {
log.debug("The port ID of interface is not exist whose identifier is {}",
routerInterface.portId().toString());
throw new IllegalArgumentException(
"port ID of interface doesn't exist");
}
verifyRouterInterfaceData(routerInterface);
routerInterfaceStore.put(routerInterface.subnetId(), routerInterface);
if (!routerInterfaceStore.containsKey(routerInterface.subnetId())) {
log.debug("The router interface is created failed whose identifier is {}",
routerInterface.subnetId().toString());
return false;
}
return true;
}
@Override
public boolean removeRouterInterface(RouterInterface routerInterface) {
checkNotNull(routerInterface, ROUTER_INTERFACE_NULL);
if (!routerInterfaceStore.containsKey(routerInterface.subnetId())) {
log.debug("The router interface is not exist whose identifier is {}",
routerInterface.subnetId().toString());
throw new IllegalArgumentException("subnet ID doesn't exist");
}
verifyRouterInterfaceData(routerInterface);
routerInterfaceStore
.remove(routerInterface.subnetId(), routerInterface);
if (routerInterfaceStore.containsKey(routerInterface.subnetId())) {
log.debug("The router interface deleted is failed whose identifier is {}",
routerInterface.subnetId().toString());
return false;
}
return true;
}
@Override
public void addListener(RouterInterfaceListener listener) {
checkNotNull(listener, LISTENER_NOT_NULL);
listeners.add(listener);
}
@Override
public void removeListener(RouterInterfaceListener listener) {
checkNotNull(listener, LISTENER_NOT_NULL);
listeners.remove(listener);
}
/**
* Verifies validity of Router interface data.
*
* @param routers router instance
*/
private void verifyRouterInterfaceData(RouterInterface routerInterface) {
checkNotNull(routerInterface, ROUTER_INTERFACE_NULL);
if (!subnetService.exists(routerInterface.subnetId())) {
log.debug("The subnet ID of interface is not exist whose identifier is {}",
routerInterface.subnetId().toString());
throw new IllegalArgumentException(
"subnet ID of interface doesn't exist");
}
if (!routerService.exists(routerInterface.routerId())) {
log.debug("The router ID of interface is not exist whose identifier is {}",
routerInterface.routerId().toString());
throw new IllegalArgumentException(
"router ID of interface doesn't exist");
}
}
private class InnerRouterInterfaceStoreListener
implements
EventuallyConsistentMapListener<SubnetId, RouterInterface> {
@Override
public void event(EventuallyConsistentMapEvent<SubnetId, RouterInterface> event) {
checkNotNull(event, EVENT_NOT_NULL);
RouterInterface routerInterface = event.value();
if (EventuallyConsistentMapEvent.Type.PUT == event.type()) {
notifyListeners(new RouterInterfaceEvent(
RouterInterfaceEvent.Type.ROUTER_INTERFACE_PUT,
routerInterface));
}
if (EventuallyConsistentMapEvent.Type.REMOVE == event.type()) {
notifyListeners(new RouterInterfaceEvent(
RouterInterfaceEvent.Type.ROUTER_INTERFACE_DELETE,
routerInterface));
}
}
}
/**
* Notifies specify event to all listeners.
*
* @param event Floating IP event
*/
private void notifyListeners(RouterInterfaceEvent event) {
checkNotNull(event, EVENT_NOT_NULL);
listeners.forEach(listener -> listener.event(event));
}
}
| [
"[email protected]"
] | |
65643c94cdecaa6ec930b043daece4e6211cc61c | 226a54cd74579009c4e69acf28c84260c39853d0 | /vpp/org/overturetool/ast/imp/OmlMode.java | 60b7934d99f4d57eba66fccddab39509a22ff0a4 | [] | no_license | carvil/jml_vdm_mapper | 8e5fd5b599d7f6171feb16e66864ebfb97a5c0f0 | 5e8b9e8feb8367673b44180923134525129474ff | refs/heads/master | 2021-01-21T00:43:39.073767 | 2012-02-11T17:08:16 | 2012-02-11T17:08:16 | 3,416,436 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,815 | java | //
// THIS FILE IS AUTOMATICALLY GENERATED!!
//
// Generated at Mon 07-Jul-2008 by the VDM++ to JAVA Code Generator
// (v8.1.1b - Fri 06-Jun-2008 09:02:11)
//
// Supported compilers:
// jdk1.4
//
// ***** VDMTOOLS START Name=HeaderComment KEEP=NO
// ***** VDMTOOLS END Name=HeaderComment
// ***** VDMTOOLS START Name=package KEEP=NO
package org.overturetool.ast.imp;
// ***** VDMTOOLS END Name=package
// ***** VDMTOOLS START Name=imports KEEP=YES
import jp.co.csk.vdm.toolbox.VDM.*;
import java.util.*;
import org.overturetool.ast.itf.*;
// ***** VDMTOOLS END Name=imports
public class OmlMode extends OmlNode implements IOmlMode {
// ***** VDMTOOLS START Name=vdmComp KEEP=NO
static UTIL.VDMCompare vdmComp = new UTIL.VDMCompare();
// ***** VDMTOOLS END Name=vdmComp
// ***** VDMTOOLS START Name=val KEEP=NO
private Long val = null;
// ***** VDMTOOLS END Name=val
// ***** VDMTOOLS START Name=OmlMode KEEP=NO
public OmlMode () throws CGException {
try {
val = null;
}
catch (Exception e){
e.printStackTrace(System.out);
System.out.println(e.getMessage());
}
}
// ***** VDMTOOLS END Name=OmlMode
// ***** VDMTOOLS START Name=identity KEEP=NO
public String identity () throws CGException {
return new String("Mode");
}
// ***** VDMTOOLS END Name=identity
// ***** VDMTOOLS START Name=accept KEEP=NO
public void accept (final IOmlVisitor pVisitor) throws CGException {
pVisitor.visitMode((IOmlMode) this);
}
// ***** VDMTOOLS END Name=accept
// ***** VDMTOOLS START Name=OmlMode KEEP=NO
public OmlMode (final Long pv) throws CGException {
try {
val = null;
}
catch (Exception e){
e.printStackTrace(System.out);
System.out.println(e.getMessage());
}
setValue(pv);
}
// ***** VDMTOOLS END Name=OmlMode
// ***** VDMTOOLS START Name=OmlMode KEEP=NO
public OmlMode (final Long pv, final Long pline, final Long pcolumn) throws CGException {
try {
val = null;
}
catch (Exception e){
e.printStackTrace(System.out);
System.out.println(e.getMessage());
}
{
setValue(pv);
setPosition(pline, pcolumn);
}
}
// ***** VDMTOOLS END Name=OmlMode
// ***** VDMTOOLS START Name=setValue KEEP=NO
public void setValue (final Long pval) throws CGException {
val = UTIL.NumberToLong(UTIL.clone(pval));
}
// ***** VDMTOOLS END Name=setValue
// ***** VDMTOOLS START Name=getValue KEEP=NO
public Long getValue () throws CGException {
return val;
}
// ***** VDMTOOLS END Name=getValue
// ***** VDMTOOLS START Name=getStringValue KEEP=NO
public String getStringValue () throws CGException {
String rexpr_1 = null;
rexpr_1 = OmlModeQuotes.getQuoteName(val);
return rexpr_1;
}
// ***** VDMTOOLS END Name=getStringValue
}
;
| [
"[email protected]"
] | |
8bd49b769b9c7d5d7133f0b8eb0f7ef5610ef86f | 20c5ea44527c347e49ce1de8f50905edd24ef9a6 | /app/src/main/java/com/yakovleviv/rebenok/MainActivity.java | e05ba90e85ecc32640435588abb8f0d207458268 | [] | no_license | HackilYakovlev/Rebenok | 423a836bd15922519287b7bc690852e60fe8e8df | 977889ca95b6f03b8759e676369ed7b9f480144e | refs/heads/master | 2023-06-08T18:23:03.104347 | 2021-07-02T07:17:22 | 2021-07-02T07:17:22 | 382,263,707 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,318 | java | package com.yakovleviv.rebenok;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getLocation(this);
}
// FETCH LOCATION FROM ACTIVITY AS BELOW
public void getLocation(Context context) {
Log.d("Main Activity", "1");
SingleShotLocationProvider.requestSingleUpdate(context,
new SingleShotLocationProvider.LocationCallback() {
@Override
public void onNewLocationAvailable(SingleShotLocationProvider.GPSCoordinates loc) {
SingleShotLocationProvider.GPSCoordinates location = loc;
Log.d("Main Activity", "getLocation() LAT: " + location.latitude + ", LON: " + location.longitude);
TextView location_txt = (TextView) findViewById(R.id.location_txt);
location_txt.setText("getLocation() LAT: " + location.latitude + ", LON: " + location.longitude);
}
});
}
}
| [
"[email protected]"
] | |
8fd4859621184bd9b24472ac507c571ad8e144b9 | b29c3b9920c863e305205e94a9a66ef011e3ea95 | /arko/src/practice/bitwise/ElementOccuringOnce.java | a4582dbb7d978915f665477cf9f8e0566f0faf8a | [] | no_license | arko2405/practice | 5935a0b13a7e3b1668f56c1a87286481fce72fb6 | 2cf3cb42015c3132a6f8ca4752ae9581a4731948 | refs/heads/master | 2020-12-24T06:08:25.526908 | 2017-07-14T17:10:40 | 2017-07-14T17:10:40 | 73,175,986 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,044 | java | package practice.bitwise;
public class ElementOccuringOnce {
public static void main(String[] args) {
int arr[] = { 1, 1, 3, 2, 2, 2, 5, 3, 1, 3 };
int n = arr.length;
System.out.println("The element with single occurrence is "
+ getSingleOccurence(arr, n));
}
static int getSingleOccurence(int arr[], int n) {
int result = 0;
for (int i = 1 << 31; i != 0; i = i >>> 1) {
int sum = 0;
for (int j = 0; j < n; j++) {
if ((i & arr[j]) != 0)
sum++;
}
if (sum % 3 != 0)
result = result | i;
}
return result;
}
static int getSingle(int arr[], int n) {
int ones = 0, twos = 0;
int common_bit_mask;
for (int i = 0; i < n; i++) {
twos = twos | (ones & arr[i]);
ones = ones ^ arr[i];
common_bit_mask = ~(ones & twos);
ones &= common_bit_mask;
twos &= common_bit_mask;
System.out.println(Integer.toBinaryString(ones) + " "
+ Integer.toBinaryString(twos) + " "
+ Integer.toBinaryString(common_bit_mask));
}
return ones;
}
}
| [
"[email protected]"
] | |
5dab7c76835186f7286a4fbfc5286f7ac8234acf | 18d49a4165b69fd1e42427bf0b455512cc738fc2 | /src/main/java/com/issuetracker/model/repositories/UserRepository.java | dbb03d95deee11309c811140bdb2fd54630f4225 | [] | no_license | izharkou/issuetracker_illia_zharkou | 87b3a8ce54f5ed17963966cf60562db5b95d3448 | 92e94aa7055cae3626fa4acb72ebcbe7953cd893 | refs/heads/master | 2021-01-22T04:49:47.414844 | 2014-07-13T20:01:16 | 2014-07-13T20:01:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 508 | java | package com.issuetracker.model.repositories;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.CrudRepository;
import com.issuetracker.model.domains.User;
/**
* User repository.
*
* @author Illia Zharkou
*/
public interface UserRepository extends CrudRepository<User, Long>,
JpaSpecificationExecutor<User> {
/**
* Find user by his email.
*
* @param email
* @return user
*/
public User findByEmail(String email);
}
| [
"[email protected]"
] | |
4755d4d6dfb46df715666b1c5bbee5034a76c888 | 0381f3d58e9a24eb1dd7fbc73744c4acb3f61180 | /app/src/main/java/com/code19/androidcommon/MainActivity.java | 2c87e7bb7ba5dfd9e5b71b7e4803f1b7412642cc | [
"Apache-2.0"
] | permissive | yibulaxi/AndroidCommon | 1efc48e189e4aaf801d4c0b1c9b8a37a5bf91a90 | 5b13a15b65ca6aec11dfe8a2f7314747185e4594 | refs/heads/master | 2021-06-06T13:44:32.338374 | 2016-06-22T13:47:50 | 2016-06-22T13:47:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,678 | java | /*
* Copyright (C) 2016 [email protected]
*
* 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.code19.androidcommon;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import com.code19.androidcommon.ui.activity.AppManagerActivity;
import com.code19.androidcommon.ui.activity.DeviceActivity;
import com.code19.androidcommon.ui.activity.VerificationActivity;
import com.code19.library.L;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private static final String TAG = "ghost";
private Context c = this;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button virification = (Button) findViewById(R.id.virification);
Button deviceutils = (Button) findViewById(R.id.deviceutils);
Button systemutils = (Button) findViewById(R.id.systemutils);
Button netutils = (Button) findViewById(R.id.netutils);
Button fileutils = (Button) findViewById(R.id.fileutils);
Button logutils = (Button) findViewById(R.id.logutils);
Button apputils = (Button) findViewById(R.id.apputils);
systemutils.setOnClickListener(this);
netutils.setOnClickListener(this);
fileutils.setOnClickListener(this);
logutils.setOnClickListener(this);
apputils.setOnClickListener(this);
deviceutils.setOnClickListener(this);
virification.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.apputils:
startActivity(new Intent(MainActivity.this, AppManagerActivity.class));
break;
case R.id.deviceutils:
startActivity(new Intent(MainActivity.this, DeviceActivity.class));
break;
case R.id.logutils:
testLog();
break;
case R.id.fileutils:
break;
case R.id.netutils:
break;
case R.id.systemutils:
break;
case R.id.virification:
startActivity(new Intent(MainActivity.this, VerificationActivity.class));
break;
}
}
private String xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><!-- Copyright w3school.com.cn --><note><to>George</to><from>John</from><heading>Reminder</heading><body>Don't forget the meeting!</body></note>";
private String json = "{'type1': {'0': {'age': 12,'name': 'zhangsdan'},'1': {'age': 13,'name': 'lisi'},'num': '123'},'type3': {'0': {'age': 14,'name': 'wangwu'},'1': {'age': 15,'name': 'maliu'},'num': '456',}}";
private void testLog() {
L.init(true, "admin");
L.v("Verbose...");
L.d("Debug...");
L.i("info。。。");
L.w("Warn...");
L.e("Error...");
L.a("ASSERT...");
L.json(json);
L.xml(xml);
}
}
| [
"[email protected]"
] | |
d436cb1c99175a480fb7adad23d2c4bf341e73b8 | 7d413b57c82230e29538e986bf3a983677047fc9 | /src/main/java/com/xd/mybatisplus/config/security/SecurityConfig.java | 641a98df4b7d7d0efed3e541a16b3c0f327b31e6 | [] | no_license | RedJupid/mybatis-plus | 1b656295e210a68b7d26eae764162a790a6a86c9 | 491fe9c9ff95233a3b292f360dbe8bee4d5f21cb | refs/heads/master | 2022-07-01T12:15:11.158309 | 2019-06-06T03:00:40 | 2019-06-06T03:00:40 | 189,338,167 | 0 | 0 | null | 2022-06-17T02:11:58 | 2019-05-30T03:20:16 | Java | UTF-8 | Java | false | false | 1,041 | java | //package com.xd.mybatisplus.config.security;
//
//import org.springframework.context.annotation.Configuration;
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
//
//
//@Configuration
//@EnableWebSecurity
//public class SecurityConfig extends WebSecurityConfigurerAdapter {
//
// @Override
// protected void configure(HttpSecurity http) throws Exception {
// http.csrf().disable()
// .httpBasic().authenticationEntryPoint(new MyAuthenticationEntryPoint())
// .and()
// .authorizeRequests()
// .antMatchers("/swagger-ui.html",
// "/swagger-resources/**",
// "/v2/api-docs",
// "/login").permitAll()
// .anyRequest()
// .authenticated();
//
//
// }
//}
| [
"[email protected]"
] | |
7245cc6e9f8cf38e57f995fb19c81389586b5039 | d72bde006af3643a0ec53c85ac6e07fb8f622fdc | /eclipse-workspace/weather/weatherpkg/Predictor.java | d788381d2a167cd094b7e1c4d78f0f8abc66605a | [] | no_license | CodingDeficiency/riddles | b9f26bae9d883f9a85b538598022e162eae88dc2 | 2bba0434c05c7b20e3e4ebddaf6959462427dfe9 | refs/heads/master | 2020-12-05T18:23:12.111394 | 2020-01-29T22:40:14 | 2020-01-29T22:40:14 | 232,204,906 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,672 | java | package weatherpkg;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Scanner;
import java.util.TreeSet;
public class Predictor implements PredictorADT
{
private TreeSet<DayStats> allDays;
public Predictor ()
{
allDays = new TreeSet<DayStats>();
ProcessFile();
}
public void addDay (DayStats newDay)
{
allDays.add(newDay);
}
public DayStats getDay (DayStats tester)
{
DayStats toReturn = allDays.floor(tester);
if (toReturn == null)
return null;
if (toReturn.equals(tester))
return toReturn;
return null;
}
public DayStats predictDay(int m, int d, int y)
{
DayStats day = new DayStats(m, d, 2016);
DayStats toReturn = getDay(day);
if (toReturn == null)
toReturn = allDays.ceiling(day);
if (toReturn == null)
toReturn = allDays.floor(day);
return toReturn;
}
public TempData predictAverageDailyTemp(int m, int d, int y)
{
DayStats day = predictDay(m, d, y);
TempData avgTemp = new TempData(1200, day.getAverageTemp());
return avgTemp;
}
public ArrayList<TempData> predictAverageDailyTemps(int m, int d, int y, int numDays)
{
ArrayList<TempData> toReturn = new ArrayList<TempData>();
for (int i = 0; i < numDays; i++ )
{
toReturn.add(predictAverageDailyTemp(m, d+i, y));
}
return toReturn;
}
public WindData predictAverageDailyWind(int m, int d, int y)
{
DayStats day = predictDay(m, d, y);
WindData avgWind = new WindData(1200, day.getAverageWindSpeed(), day.getAverageWindDirection());
return avgWind;
}
public ArrayList<WindData> predictAverageDailyWinds(int m, int d, int y, int numDays)
{
ArrayList<WindData> toReturn = new ArrayList<WindData>();
for (int i = 0; i < numDays; i++ )
{
toReturn.add(predictAverageDailyWind(m, d+i, y));
}
return toReturn;
}
public void ProcessFile () {
InputStreamReader myInfile = null;
try
{
myInfile = new InputStreamReader(getClass().getResourceAsStream("/weatherpkg/weatherDataAll.txt"));
}
catch (Exception e) {System.err.println("Didn't open file");}
Scanner scan = new Scanner(myInfile);
try
{
String aLine = null;
for (int i=0; i < 6; i++)
aLine = scan.nextLine(); // consume headings
// sample line 13963,20170101,53,12,OVC006, ,5, ,BR, ,46, ,7.8, ,46, ,7.7, ,46, ,7.8, ,100, ,6, ,20, , , ,29.66, , , , , ,29.95, ,AA, , T, ,29.94,
while ((aLine = scan.nextLine())!=null) {
String[] tokens = aLine.split(",");
String dateToken = tokens[1];
try {
int m = Integer.parseInt(dateToken.substring(4, 6));
int d = Integer.parseInt(dateToken.substring(6, 8));
int y = Integer.parseInt(dateToken.substring(0, 4));
DayStats testAdd = new DayStats(m,d,y);
DayStats toAdd = this.getDay(testAdd);
if (toAdd == null) {
// this day has never been added so add newly create day
toAdd = testAdd;
this.addDay(toAdd);
}
int timeInt = Integer.parseInt(tokens[2]);
int temp1 = -999;
try {
temp1 = Integer.parseInt(tokens[10].trim()); // trim removes extra white space
} catch (Exception e) {
// ignore this temp entry it must not be a valid integer
}
int temp2 = -999;
try {
temp2 = Integer.parseInt(tokens[14].trim()); // trim removes extra white space
} catch (Exception e) {
// ignore this temp entry it must not be a valid integer
}
if (temp1 != -999 && temp2 != -999){
toAdd.addTemp(new TempData(timeInt,temp1,temp2));
}
else if (temp1 == -999 && temp2 != -999){
toAdd.addTemp(new TempData(timeInt,temp2));
}
else if (temp1 != -999 && temp2 == -999){
toAdd.addTemp(new TempData(timeInt,temp1));
}
// else just ignore this temp entry because neither was a valid temp
try {
int windspeed = Integer.parseInt(tokens[24].trim());
int winddirection = Integer.parseInt(tokens[26].trim());
toAdd.addWind(new WindData(timeInt,windspeed,winddirection));
} catch (Exception e) {
// ignore this wind entry if anything could not be parsed
}
//System.out.println(toAdd);
} catch (Exception e) {
// Ignore this entire line because there was a problem with either the date
// or the time
}
}
}
catch (Exception e){
if (myInfile == null)
return;
try
{
myInfile.close( );
scan.close();
}
catch (IOException e2) { }
}
}
}
| [
"[email protected]"
] | |
797fc2bf98a22b19f21966ec4a5c622e80ed1434 | 9c9b3af4a8e340a4bd3e4abc173645ff1022a288 | /Sales Application/src/com/b07/inventory/ItemTypes.java | 90c8158797c56daa7f6fc671f9cf9e2ba53c9f3a | [] | no_license | YousufMadi/Sales-Application-B07 | ee87b816679ccc04e124dc67c8f0176445881ac4 | 54918fc5dee1e921293513eacf647cfccd0add9f | refs/heads/master | 2021-01-06T18:02:48.538530 | 2020-02-10T00:27:11 | 2020-02-10T00:27:11 | 241,429,743 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,231 | java | package com.b07.inventory;
/**
* The Enum ItemTypes.
*/
public enum ItemTypes {
FISHING_ROD("FISHING_ROD", 0), HOCKEY_STICK("HOCKEY_STICK", 1), SKATES("SKATES",
2), RUNNING_SHOES("RUNNING_SHOES", 3), PROTEIN_BAR("PROTEIN_BAR", 4);
/**
* Instantiates a new roles.
*
* @param item the item
* @param itemNum the item num
*/
private ItemTypes(final String item, final int itemNum) {};
/**
* Check if this role a valid roles.
*
* @param item the item
* @return true, if given role is a type of Roles
*/
public static boolean checkItem(String item) {
if (item != null) {
for (ItemTypes i : ItemTypes.values()) {
if (i.name().equalsIgnoreCase(item)) {
return true;
}
}
}
return false;
}
/**
* Get the respective Roles of string input.
*
* @param item the item
* @return acording Roles if role is of type role, null otherwise
*/
public static ItemTypes getItemType(String item) {
if (item != null) {
for (ItemTypes i : ItemTypes.values()) {
if (i.name().equalsIgnoreCase(item)) {
return i;
}
}
}
return null;
}
}
| [
"[email protected]"
] | |
db668496364006bb7332fec0c1e8b99b75d04240 | 9800c78a106677141615c4d434addcf585f88459 | /src/main/java/ru/mytracky/security/jwt/JwtTokenProvider.java | f63434a3aebfe63bc717ebc77e3b95624ca67b91 | [] | no_license | Pkyfen/MyTracky | b04008b16c953ac1a7bd7d5bc83d62b16bf34e91 | cf071978ad35d13781de1f11bc76cb746c7ca7cd | refs/heads/master | 2022-07-14T08:46:06.381651 | 2019-10-15T21:14:34 | 2019-10-15T21:14:34 | 208,141,794 | 0 | 1 | null | 2022-03-08T21:18:20 | 2019-09-12T20:35:00 | Java | UTF-8 | Java | false | false | 4,277 | java | package ru.mytracky.security.jwt;
import io.jsonwebtoken.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;
import ru.mytracky.model.Role;
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Date;
import java.util.List;
@Component
public class JwtTokenProvider {
@Value("${jwt.token.secret}")
private String secret;
@Value("${jwt.token.expired}")
private long validityInMilliseconds;
private UserDetailsService userDetailsService;
public void setUserDetailsService(UserDetailsService userDetailsService) {
this.userDetailsService = userDetailsService;
}
@Bean
public BCryptPasswordEncoder passwordEncoder() {
BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
return bCryptPasswordEncoder;
}
@PostConstruct
protected void init() {
secret = Base64.getEncoder().encodeToString(secret.getBytes());
}
public String createToken(String username, List<Role> roles) {
Claims claims = Jwts.claims().setSubject(username);
claims.put("roles", getRoleNames(roles));
Date now = new Date();
Date validity = new Date(now.getTime() + validityInMilliseconds);
return Jwts.builder()//
.setClaims(claims)//
.setIssuedAt(now)//
.setExpiration(validity)//
.signWith(SignatureAlgorithm.HS256, secret)//
.compact();
}
public String createToken(String username, Long id, List<Role> roles) {
Claims claims = Jwts.claims().setSubject(username).setId(String.valueOf(id));
claims.put("roles", getRoleNames(roles));
Date now = new Date();
Date validity = new Date(now.getTime() + validityInMilliseconds);
return Jwts.builder()//
.setClaims(claims)//
.setIssuedAt(now)//
.setExpiration(validity)//
.signWith(SignatureAlgorithm.HS256, secret)//
.compact();
}
public Authentication getAuthentication(String token) {
UserDetails userDetails = this.userDetailsService.loadUserByUsername(getUsername(token));
return new UsernamePasswordAuthenticationToken(userDetails, "", userDetails.getAuthorities());
}
public Long getId(String token){
return Long.parseLong(Jwts.parser().setSigningKey(secret).parseClaimsJws(token).getBody().getId());
}
public String getUsername(String token) {
return Jwts.parser().setSigningKey(secret).parseClaimsJws(token).getBody().getSubject();
}
public String resolveToken(HttpServletRequest req) {
String bearerToken = req.getHeader("Authorization");
if (bearerToken != null && bearerToken.startsWith("Bearer_")) {
return bearerToken.substring(7, bearerToken.length());
}
return null;
}
public boolean validateToken(String token) {
try {
Jws<Claims> claims = Jwts.parser().setSigningKey(secret).parseClaimsJws(token);
if (claims.getBody().getExpiration().before(new Date())) {
return false;
}
return true;
}catch (ExpiredJwtException e){
System.out.println(e);
return false;
} catch (JwtException | IllegalArgumentException e) {
System.out.println(e);
throw new JwtAuthenticationException("JWT token is expired or invalid");
}
}
private List<String> getRoleNames(List<Role> userRoles) {
List<String> result = new ArrayList<>();
userRoles.forEach(role -> {
result.add(role.getName());
});
return result;
}
}
| [
"[email protected]"
] | |
fcaa0ef01dc09d188d1d0dc359c6acbdd77c5abc | 9f50dc524724acc742a89472eedbf94ce1ad2c96 | /src/main/java/problems/p063.java | 0768f7fb2fe5594edd46f57f65ad0701b7d14f68 | [] | no_license | kennycason/euler | 9624a78c32f40c2be8bc31635086c5fa5d465191 | 5cadb35490e134a449cbc2ac5a547cf201ac9776 | refs/heads/master | 2020-12-24T15:06:01.087902 | 2016-05-17T05:24:03 | 2016-05-17T05:24:03 | 9,514,823 | 4 | 3 | null | null | null | null | UTF-8 | Java | false | false | 704 | java | package problems;
import main.Problem;
import main.annotations.Solved;
@Solved
public class p063 extends Problem {
public static void main(String[] args) {
Problem p = new p063();
p.run();
System.out.println(p.answer());
}
public void run() {
int count = 0;
for(int b = 1; b < 10; b++) {
for(int p = 1; p < 25; p++) {
double n = Math.pow(b, p);
int digits = (int) Math.log10(n) + 1;
if(p > digits) {
break;
}
if(digits == p) {
count++;
}
}
}
this.answer = count;
}
}
| [
"[email protected]"
] | |
53b4268be0f1c6fd8af76461a4440cc48915b291 | 57789e1e1bf68fb2e694ed10b7109088b4bc613c | /alite-deconflictiontools/src/main/java/tt/jointeuclid2ni/probleminstance/EarliestArrivalProblemXMLConstants.java | ad3248318a3734c31a5eeedc1ad467278f697c44 | [] | no_license | acoskunUSC/flipping | bebaaca6090dbdf2fbeed250f121eb0ff2c13102 | 04dee4892665fa8fd733d79b3ed7e9bbe6c45408 | refs/heads/main | 2023-03-28T05:23:52.958050 | 2021-03-23T14:48:13 | 2021-03-23T14:48:13 | 350,735,993 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,287 | java | package tt.jointeuclid2ni.probleminstance;
public class EarliestArrivalProblemXMLConstants {
public static final String ID = "id";
public static final String PROBLEM = "multiagentproblem";
public static final String ENVIRONMENT = "environment";
public static final String OBSTACLES = "obstacles";
public static final String OBSTACLE = "obstacle";
public static final String CIRCLE = "circle";
public static final String GRAPH = "graph";
public static final String VERTICES = "vertices";
public static final String EDGES = "edges";
public static final String EDGE = "edge";
public static final String POINT = "point";
public static final String X = "x";
public static final String Y = "y";
public static final String BOUNDARY = "boundary";
public static final String BOUNDS = "bounds";
public static final String AGENTS = "agents";
public static final String AGENT = "agent";
public static final String START = "start";
public static final String TARGET = "target";
public static final String BODY_RADIUS = "radius";
public static final String MAX_SPEED = "maxspeed";
public static final String DOCKS = "docks";
public static final String TASKS = "tasks";
public static final String TASK = "task";
}
| [
"[email protected]"
] | |
9c39e33fad1ca403abeda7bf40a131fc87c5b0d5 | 1d5b20a38fbc9dbf3ee43f929066d358527285b7 | /231.power-of-two.java | dff914add3c96e49ad027a2a1232bd8371f1ad00 | [] | no_license | pintojoey/leetcode | 3d7ec64749ac32c4e66a50aed725e754cebe7e1c | c27ab8483b408d4a2ca0c19f6bb88bfae99ef7f7 | refs/heads/master | 2020-04-08T14:58:16.353446 | 2019-01-09T05:44:20 | 2019-01-09T05:44:20 | 159,459,837 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 170 | java | class Solution {
public boolean isPowerOfTwo(int n) {
if (n==0)return false;
while(n%2==0){
n=n>>1;
}
return n==1;
}
}
| [
"[email protected]"
] | |
e8163f7934e3ad6566b39e37c6147e5aefebeecd | f39072895106010e5895f97fad1700af47e35798 | /src/com/ch3d/silencer/service/CallSilencerService.java | 83ec837a09b58df735142fcc6e3f76c9c8732dbf | [
"Apache-2.0"
] | permissive | Ch3D/Silencer | 6707003911189e632bfc262b3caa6e66f3d97100 | cdb6478f7906f219042923722f86ba59b8ea65f9 | refs/heads/master | 2021-01-19T11:02:53.599208 | 2013-12-09T15:09:59 | 2013-12-09T15:09:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,178 | java |
package com.ch3d.silencer.service;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.media.AudioManager;
import android.os.IBinder;
import android.util.Log;
public class CallSilencerService extends Service implements SensorEventListener
{
private static final int STREAM_TYPE = AudioManager.STREAM_RING;
private static final String TAG = CallSilencerService.class.getSimpleName();
private static final float NS2S = 1.0f / 1000000000.0f;
private static final float EPSILON = 0;
private static final float DEGREE_PERCENT = 180f / 100f;
private final float[] deltaRotationVector = new float[4];
private int angleTotal = 0;
private long timestamp;
private SensorManager mSensorManager;
private AudioManager mAudioManager;
private int mInitialVolume;
private int mInitialRinger;
private void changeRingerMode(final int mode) {
if (mAudioManager.getRingerMode() != mode) {
mAudioManager.setRingerMode(mode);
}
}
private boolean checkSensor()
{
return !mSensorManager.getSensorList(Sensor.TYPE_GYROSCOPE).isEmpty();
}
@Override
public void onAccuracyChanged(final Sensor arg0, final int arg1)
{
}
@Override
public IBinder onBind(final Intent arg0)
{
return null;
}
@Override
public void onCreate()
{
super.onCreate();
Log.d(TAG, "Starting service...");
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
mInitialVolume = mAudioManager.getStreamVolume(STREAM_TYPE);
mInitialRinger = mAudioManager.getRingerMode();
if (!checkSensor())
{
Log.w(TAG, "Service stopped : appropriate sensor not found");
stopSelf();
}
final Sensor gyroSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE);
if (gyroSensor == null)
{
Log.w(TAG, "Service stopped : unable to get default gyroscope sensor");
stopSelf();
}
Log.d(TAG, "Service started");
mSensorManager.registerListener(this, gyroSensor, SensorManager.SENSOR_DELAY_UI);
}
@Override
public void onDestroy()
{
super.onDestroy();
Log.d(TAG, "Service stopping...");
mSensorManager.unregisterListener(this);
restoreAudioSettings();
}
@Override
public void onSensorChanged(final SensorEvent event)
{
if (timestamp != 0) {
final float dT = (event.timestamp - timestamp) * NS2S;
float axisX = event.values[0];
float axisY = event.values[1];
float axisZ = event.values[2];
final float omegaMagnitude = (float) Math.sqrt((axisX * axisX) + (axisY * axisY)
+ (axisZ * axisZ));
if (omegaMagnitude > EPSILON) {
axisX /= omegaMagnitude;
axisY /= omegaMagnitude;
axisZ /= omegaMagnitude;
}
final float thetaOverTwo = (omegaMagnitude * dT) / 2.0f;
final float sinThetaOverTwo = (float) Math.sin(thetaOverTwo);
final float cosThetaOverTwo = (float) Math.cos(thetaOverTwo);
deltaRotationVector[0] = sinThetaOverTwo * axisX;
deltaRotationVector[1] = sinThetaOverTwo * axisY;
deltaRotationVector[2] = sinThetaOverTwo * axisZ;
deltaRotationVector[3] = cosThetaOverTwo;
}
timestamp = event.timestamp;
final float[] deltaRotationMatrix = new float[9];
SensorManager.getRotationMatrixFromVector(deltaRotationMatrix, deltaRotationVector);
final float[] orientation = new float[3];
SensorManager.getOrientation(deltaRotationMatrix, orientation);
// final long o1 = Math.round(Math.toDegrees(orientation[0]));
// final long o2 = Math.round(Math.toDegrees(orientation[1]));
final long o3 = Math.round(Math.toDegrees(orientation[2]));
angleTotal += o3;
final int vol = (int) ((180 - Math.abs(angleTotal)) / DEGREE_PERCENT);
final float volUnit = mInitialVolume / 100f;
final int finalVol = (int) (volUnit * vol);
if (finalVol < 1) {
changeRingerMode(AudioManager.RINGER_MODE_SILENT);
} else {
changeRingerMode(mInitialRinger);
}
mAudioManager.setStreamVolume(STREAM_TYPE, finalVol, 0);
// Log.d(TAG, "angle = " + angleTotal);
// Log.d(TAG, "angle vol = " + vol);
// Log.d(TAG, "angle totalVol = " + totalVol);
}
@Override
public int onStartCommand(final Intent intent, final int flags, final int startId)
{
return START_NOT_STICKY;
}
private void restoreAudioSettings() {
changeRingerMode(mInitialRinger);
mAudioManager.setStreamVolume(STREAM_TYPE, mInitialVolume, 0);
}
}
| [
"[email protected]"
] | |
3e9821205d77e479b55640b3a047e0080c151f8e | 77e1403d26732646d81604a3b7efd2213a1fe15d | /ECE4960p1/Gradual.java | fcbdb55595f19c4449e60a34276af59aedea63f0 | [] | no_license | yuanhe772/Homework-Version-Control | 0c962498628d8eae1ff1eab6ac0995cc5139905c | a78d9b8ce3a9b078d8ca68102bbc47ab444f7e6a | refs/heads/master | 2021-04-29T23:58:25.353756 | 2018-08-06T06:31:06 | 2018-08-06T06:31:06 | 121,567,018 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,254 | java | /** Last Update: 02/15/2018; Author: Yuan He (yh772); Platform: Eclipse, Java8 */
public class Gradual {
static float normal = Float.MIN_NORMAL;
static float x = normal/2;
static float y = normal;
public static void generateXY() {
while ( x>0 && y>0 && x-y!=0 && y/x!=1) {
System.out.println(x+" "+y +" " +Float.MIN_NORMAL);
x = x/10;
y = y/10;
}
//要往report里面写gradual underflow detected
}
public static void XsubY() {
System.out.println("X - Y = " + (x-y));
}
public static void XdividedY() {
System.out.println("X / Y = " + (x/y));
}
public static void sinx_x(){
x = normal;
float prev = (float) (Math.sin(1.23456789012345*x)/x);
float prevfloat = 0;
float curr = (float) (Math.sin(1.23456789012345*x)/x);
while ( x>0 ) {
prevfloat = x;
prev = (float) (Math.sin(1.23456789012345*x)/x);
if(prev!=curr) {
System.out.println("single-precision float's precision"
+ " decreases at value =" + x);
}
System.out.println(x+" "
+ Math.sin(1.23456789012345*x)/x);
x = x/10;
curr = (float) (Math.sin(1.23456789012345*x)/x);
}
System.out.println("When normalized smallest single-precision float divided by 10^n, denormalized bottom is " + prevfloat);
}
}
| [
"[email protected]"
] | |
a7f9a0513dbcc8c6badf907be6362836f8b19d5c | 133e7168e426bcfb924acac7cef3e354f410372b | /src/com/tourneureric/javalearn002/JavaTestTemplate.java | 04b1a511a246f85a6a8b994f54fb3185639bd8ca | [] | no_license | tourneureric/JavaLearn | a905f4c106c0fb6f0e82f36d6522e03f1409cce4 | af89c12c948adef4b5f92dee2bc5720746d5acf2 | refs/heads/master | 2020-05-20T21:02:17.203672 | 2019-10-25T13:00:03 | 2019-10-25T13:00:03 | 185,753,944 | 5 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,059 | java |
package com.tourneureric.javalearn002;
import java.util.Scanner;
public class JavaTestTemplate {
Scanner sc;
private void doit() {
Log.log(Log.LOG_DEBUG, "JavaTestTemplate::doit() [begin]");
Log.log(Log.LOG_DEBUG, "JavaTestTemplate::doit() [end]");
}
public void main() {
Log.log(Log.LOG_DEBUG, "JavaTestTemplate::main() [begin]");
if (JavaLearn.JL_RUN) {
try {
String again = "n";
sc = new Scanner(System.in);
do {
doit();
P.print("Voulez-vous continuer (o/n) ?");
again = sc.nextLine();
} while (again.equalsIgnoreCase("o"));
P.print("Fin");
sc.close();
} catch (Exception e) { Log.error("in main()"); throw e; }
Log.log(Log.LOG_DEBUG, "JavaTestTemplate::main() [end]");
}
}
public JavaTestTemplate () {
Log.log(Log.LOG_DEBUG, "JavaTestTemplate::JavaTestTemplate() [begin]");
P.print("JavaTestTemplate : instanciation");
Log.log(Log.LOG_DEBUG, "JavaTestTemplate::JavaTestTemplate() [end]");
}
}
| [
"[email protected]"
] | |
27e1e970d942bdbde7764eac87b3fafd51f7fe76 | 26b3a82082d70c465b77373bf43dcb373dce4ee9 | /src/main/java/com/karthik/hibernate/Assignment71/FlowerShop.java | a9ac3c8990f81a89281e994b7ad1cd2efd7083fe | [] | no_license | karthik78180/Assignment71 | d7e4254193307dd20353ebb92d2bc389393e833a | 49ac699e72e755812f546249693e72a5157e0a0f | refs/heads/master | 2021-06-28T03:33:04.683222 | 2017-09-15T19:02:55 | 2017-09-15T19:02:55 | 103,691,454 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,114 | java | package com.karthik.hibernate.Assignment71;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import lombok.Data;
@Entity
@Table(name = "FLOWERSHOP")
@Data
public class FlowerShop {
@Id
@Column(name = "FSID", nullable=false)
// @GeneratedValue(strategy=GenerationType.SEQUENCE)
private String flowerShopId;
@Column(name = "SHOPNAME", nullable=false)
private String flowerShopName;
// private String typesOfFlowers;
// @JoinTable
// (
// name="FLOWER_TYPE",
// joinColumns={ @JoinColumn(name="EMP_ID", referencedColumnName="FSID") },
// inverseJoinColumns={ @JoinColumn(name="PHONE_ID", referencedColumnName="FID", unique=true) }
// )
@OneToMany
@CollectionTable(name="FLOWERSHOP_FLOWER")
private List<Flower> flowers = new ArrayList<Flower>();
@OneToMany
@CollectionTable(name="FLOWERSHOP_SHOPMANAGERS")
private List<Manager> managers = new ArrayList<Manager>();
} | [
"[email protected]"
] | |
4ec10ed2728d45ea5adaf6484381b960de83d0f8 | d36d5ba4d8d1df1ad4494c94bd39252e128c5b5b | /com.jaspersoft.studio.server/src/com/jaspersoft/studio/server/JRSBuiltInParameterProvider.java | 2a6daf25ea25e168be197ab6e8e499f511f1ca32 | [] | no_license | xviakoh/jaspersoft-xvia-plugin | 6dfca36eb27612f136edc4c206e631d8dd8470f0 | c037a0568a518e858a201fda257a8fa416af3908 | refs/heads/master | 2021-01-01T19:35:32.905460 | 2015-06-18T15:21:11 | 2015-06-18T15:21:11 | 37,666,261 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,537 | java | package com.jaspersoft.studio.server;
import java.io.IOException;
import net.sf.jasperreports.engine.design.JRDesignExpression;
import net.sf.jasperreports.engine.design.JRDesignParameter;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.w3c.tools.codec.Base64Decoder;
import org.w3c.tools.codec.Base64Encoder;
import org.w3c.tools.codec.Base64FormatException;
import com.jaspersoft.studio.prm.ParameterSet;
import com.jaspersoft.studio.prm.ParameterSetProvider;
import com.jaspersoft.studio.utils.jasper.JasperReportsConfiguration;
public class JRSBuiltInParameterProvider {
public static final String PARAMETERSET_JRS = "Jaspersoft Server Built In Parameters";
public static void init() {
ScopedPreferenceStore pstore = JasperReportsConfiguration.getDefaultInstance().getPrefStore();
ParameterSet pset = ParameterSetProvider.getParameterSet(PARAMETERSET_JRS, pstore);
if (pset == null) {
pset = new ParameterSet();
pset.setName(PARAMETERSET_JRS);
pset.setBuiltIn(true);
JRDesignParameter p = new JRDesignParameter();
p.setName("LoggedInUser");
p.setDescription("Not usable in query input control, but is used as parameter to report");
p.setValueClassName("com.jaspersoft.jasperserver.api.metadata.user.domain.client.UserImpl");
p.setDefaultValueExpression(new JRDesignExpression("new com.jaspersoft.jasperserver.api.metadata.user.domain.client.UserImpl()"));
p.setForPrompting(false);
pset.getParameters().add(p);
p = new JRDesignParameter();
p.setName("LoggedInUsername");
p.setDescription("Of logged in user");
p.setValueClassName("java.lang.String");
p.setDefaultValueExpression(new JRDesignExpression("\"joeuser\""));
p.setForPrompting(false);
pset.getParameters().add(p);
p = new JRDesignParameter();
p.setName("LoggedInUserFullName");
p.setDescription("Of logged in user");
p.setValueClassName("java.lang.String");
p.setDefaultValueExpression(new JRDesignExpression("\"Joe Smith\""));
p.setForPrompting(false);
pset.getParameters().add(p);
p = new JRDesignParameter();
p.setName("LoggedInUserEmailAddress");
p.setDescription("Of logged in user");
p.setValueClassName("java.lang.String");
p.setDefaultValueExpression(new JRDesignExpression("\"[email protected]\""));
p.setForPrompting(false);
pset.getParameters().add(p);
p = new JRDesignParameter();
p.setName("LoggedInUserEnabled");
p.setDescription("Is logged in user enabled?");
p.setValueClassName("java.lang.Boolean");
p.setDefaultValueExpression(new JRDesignExpression("Boolean.TRUE"));
p.setForPrompting(false);
pset.getParameters().add(p);
p = new JRDesignParameter();
p.setName("LoggedInUserExternallyDefined");
p.setDescription("Is logged in user externally defined? ie. authenticated externally");
p.setValueClassName("java.lang.Boolean");
p.setDefaultValueExpression(new JRDesignExpression("Boolean.FALSE"));
p.setForPrompting(false);
pset.getParameters().add(p);
p = new JRDesignParameter();
p.setName("LoggedInUserTenantId");
p.setDescription("Of logged in user. Only relevant in Pro/Enterprise.");
p.setValueClassName("java.lang.String");
p.setDefaultValueExpression(new JRDesignExpression(""));
p.setForPrompting(false);
pset.getParameters().add(p);
p = new JRDesignParameter();
p.setName("LoggedInUserRoles");
p.setDescription("Current set of roles of logged in user. Useful for $X parameter");
p.setValueClassName("java.util.Collection");
p.setNestedTypeName("java.util.String");
p.setDefaultValueExpression(new JRDesignExpression("new ArrayList()"));
p.setForPrompting(false);
pset.getParameters().add(p);
p = new JRDesignParameter();
p.setName("LoggedInUserAttributes");
p.setDescription("Not usable in query input control, but is used as parameter to report. Empty map if no attributes");
p.setValueClassName("java.util.Map");
p.setNestedTypeName("java.util.String");
p.setDefaultValueExpression(new JRDesignExpression("new HashMap()"));
p.setForPrompting(false);
pset.getParameters().add(p);
p = new JRDesignParameter();
p.setName("LoggedInUserAttributeNames");
p.setDescription("User profile attribute names. Useful for $X parameters. Empty collection if no attributes");
p.setValueClassName("java.util.Collection");
p.setNestedTypeName("java.util.String");
p.setDefaultValueExpression(new JRDesignExpression("new ArrayList()"));
p.setForPrompting(false);
pset.getParameters().add(p);
p = new JRDesignParameter();
p.setName("LoggedInUserAttributeValues");
p.setDescription("");
p.setValueClassName("java.util.Collection");
p.setDefaultValueExpression(new JRDesignExpression("new ArrayList()"));
p.setForPrompting(false);
pset.getParameters().add(p);
ParameterSetProvider.storeParameterSet(pset, pstore);
}
try {
String str = pstore.getString(ParameterSet.PARAMETER_SETS);
if (str != null) {
try {
str = new Base64Decoder(str).processString();
} catch (Base64FormatException e) {
e.printStackTrace();
return;
}
String[] sets = str.split("\n");
for (String key : sets) {
if (key.equals(PARAMETERSET_JRS))
return;
}
}
str = PARAMETERSET_JRS + (str == null ? "" : "\n" + str);
pstore.setValue(ParameterSet.PARAMETER_SETS, new Base64Encoder(str).processString());
} finally {
try {
pstore.save();
} catch (IOException e) {
Activator.getDefault().logError(e);
}
}
}
}
| [
"[email protected]"
] | |
188ec97229027c73bc15fb578077acb0a7be93bb | 83e81c25b1f74f88ed0f723afc5d3f83e7d05da8 | /packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java | 5ad7a25055473654805929f7e7f9d73a04814822 | [
"Apache-2.0",
"LicenseRef-scancode-unicode"
] | permissive | Ankits-lab/frameworks_base | 8a63f39a79965c87a84e80550926327dcafb40b7 | 150a9240e5a11cd5ebc9bb0832ce30e9c23f376a | refs/heads/main | 2023-02-06T03:57:44.893590 | 2020-11-14T09:13:40 | 2020-11-14T09:13:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 36,609 | java | /*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.systemui.statusbar;
import static com.android.systemui.plugins.DarkIconDispatcher.getTint;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.app.Notification;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.os.Parcelable;
import android.os.UserHandle;
import android.service.notification.StatusBarNotification;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.FloatProperty;
import android.util.Log;
import android.util.Property;
import android.util.TypedValue;
import android.view.ViewDebug;
import android.view.accessibility.AccessibilityEvent;
import android.view.animation.Interpolator;
import androidx.core.graphics.ColorUtils;
import com.android.internal.statusbar.StatusBarIcon;
import com.android.internal.util.ContrastColorUtil;
import com.android.systemui.Interpolators;
import com.android.systemui.R;
import com.android.systemui.statusbar.notification.NotificationIconDozeHelper;
import com.android.systemui.statusbar.notification.NotificationUtils;
import java.text.NumberFormat;
import java.util.Arrays;
public class StatusBarIconView extends AnimatedImageView implements StatusIconDisplayable {
public static final int NO_COLOR = 0;
/**
* Multiply alpha values with (1+DARK_ALPHA_BOOST) when dozing. The chosen value boosts
* everything above 30% to 50%, making it appear on 1bit color depths.
*/
private static final float DARK_ALPHA_BOOST = 0.67f;
/**
* Status icons are currently drawn with the intention of being 17dp tall, but we
* want to scale them (in a way that doesn't require an asset dump) down 2dp. So
* 17dp * (15 / 17) = 15dp, the new height. After the first call to {@link #reloadDimens} all
* values will be in px.
*/
private float mSystemIconDesiredHeight = 15f;
private float mSystemIconIntrinsicHeight = 17f;
private float mSystemIconDefaultScale = mSystemIconDesiredHeight / mSystemIconIntrinsicHeight;
private final int ANIMATION_DURATION_FAST = 100;
public static final int STATE_ICON = 0;
public static final int STATE_DOT = 1;
public static final int STATE_HIDDEN = 2;
private static final String TAG = "StatusBarIconView";
private static final Property<StatusBarIconView, Float> ICON_APPEAR_AMOUNT
= new FloatProperty<StatusBarIconView>("iconAppearAmount") {
@Override
public void setValue(StatusBarIconView object, float value) {
object.setIconAppearAmount(value);
}
@Override
public Float get(StatusBarIconView object) {
return object.getIconAppearAmount();
}
};
private static final Property<StatusBarIconView, Float> DOT_APPEAR_AMOUNT
= new FloatProperty<StatusBarIconView>("dot_appear_amount") {
@Override
public void setValue(StatusBarIconView object, float value) {
object.setDotAppearAmount(value);
}
@Override
public Float get(StatusBarIconView object) {
return object.getDotAppearAmount();
}
};
private boolean mAlwaysScaleIcon;
private int mStatusBarIconDrawingSizeIncreased = 1;
private int mStatusBarIconDrawingSize = 1;
private int mStatusBarIconSize = 1;
private StatusBarIcon mIcon;
@ViewDebug.ExportedProperty private String mSlot;
private Drawable mNumberBackground;
private Paint mNumberPain;
private int mNumberX;
private int mNumberY;
private String mNumberText;
private StatusBarNotification mNotification;
private final boolean mBlocked;
private int mDensity;
private boolean mNightMode;
private float mIconScale = 1.0f;
private final Paint mDotPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private float mDotRadius;
private int mStaticDotRadius;
private int mVisibleState = STATE_ICON;
private float mIconAppearAmount = 1.0f;
private ObjectAnimator mIconAppearAnimator;
private ObjectAnimator mDotAnimator;
private float mDotAppearAmount;
private OnVisibilityChangedListener mOnVisibilityChangedListener;
private int mDrawableColor;
private int mIconColor;
private int mDecorColor;
private float mDozeAmount;
private ValueAnimator mColorAnimator;
private int mCurrentSetColor = NO_COLOR;
private int mAnimationStartColor = NO_COLOR;
private final ValueAnimator.AnimatorUpdateListener mColorUpdater
= animation -> {
int newColor = NotificationUtils.interpolateColors(mAnimationStartColor, mIconColor,
animation.getAnimatedFraction());
setColorInternal(newColor);
};
private final NotificationIconDozeHelper mDozer;
private int mContrastedDrawableColor;
private int mCachedContrastBackgroundColor = NO_COLOR;
private float[] mMatrix;
private ColorMatrixColorFilter mMatrixColorFilter;
private boolean mIsInShelf;
private Runnable mLayoutRunnable;
private boolean mDismissed;
private Runnable mOnDismissListener;
private boolean mIncreasedSize;
private boolean mShowsConversation;
public StatusBarIconView(Context context, String slot, StatusBarNotification sbn) {
this(context, slot, sbn, false);
}
public StatusBarIconView(Context context, String slot, StatusBarNotification sbn,
boolean blocked) {
super(context);
mDozer = new NotificationIconDozeHelper(context);
mBlocked = blocked;
mSlot = slot;
mNumberPain = new Paint();
mNumberPain.setTextAlign(Paint.Align.CENTER);
mNumberPain.setColor(context.getColor(R.drawable.notification_number_text_color));
mNumberPain.setAntiAlias(true);
setNotification(sbn);
setScaleType(ScaleType.CENTER);
mDensity = context.getResources().getDisplayMetrics().densityDpi;
Configuration configuration = context.getResources().getConfiguration();
mNightMode = (configuration.uiMode & Configuration.UI_MODE_NIGHT_MASK)
== Configuration.UI_MODE_NIGHT_YES;
initializeDecorColor();
reloadDimens();
maybeUpdateIconScaleDimens();
}
public StatusBarIconView(Context context, AttributeSet attrs) {
super(context, attrs);
mDozer = new NotificationIconDozeHelper(context);
mBlocked = false;
mAlwaysScaleIcon = true;
reloadDimens();
maybeUpdateIconScaleDimens();
mDensity = context.getResources().getDisplayMetrics().densityDpi;
}
/** Should always be preceded by {@link #reloadDimens()} */
private void maybeUpdateIconScaleDimens() {
// We do not resize and scale system icons (on the right), only notification icons (on the
// left).
if (mNotification != null || mAlwaysScaleIcon) {
updateIconScaleForNotifications();
} else {
updateIconScaleForSystemIcons();
}
}
private void updateIconScaleForNotifications() {
final float imageBounds = mIncreasedSize ?
mStatusBarIconDrawingSizeIncreased : mStatusBarIconDrawingSize;
final int outerBounds = mStatusBarIconSize;
mIconScale = imageBounds / (float)outerBounds;
updatePivot();
}
// Makes sure that all icons are scaled to the same height (15dp). If we cannot get a height
// for the icon, it uses the default SCALE (15f / 17f) which is the old behavior
private void updateIconScaleForSystemIcons() {
float iconHeight = getIconHeight();
if (iconHeight != 0) {
mIconScale = mSystemIconDesiredHeight / iconHeight;
} else {
mIconScale = mSystemIconDefaultScale;
}
}
private float getIconHeight() {
Drawable d = getDrawable();
if (d != null) {
return (float) getDrawable().getIntrinsicHeight();
} else {
return mSystemIconIntrinsicHeight;
}
}
public float getIconScaleIncreased() {
return (float) mStatusBarIconDrawingSizeIncreased / mStatusBarIconDrawingSize;
}
public float getIconScale() {
return mIconScale;
}
@Override
protected void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
int density = newConfig.densityDpi;
if (density != mDensity) {
mDensity = density;
reloadDimens();
updateDrawable();
maybeUpdateIconScaleDimens();
}
boolean nightMode = (newConfig.uiMode & Configuration.UI_MODE_NIGHT_MASK)
== Configuration.UI_MODE_NIGHT_YES;
if (nightMode != mNightMode) {
mNightMode = nightMode;
initializeDecorColor();
}
}
private void reloadDimens() {
boolean applyRadius = mDotRadius == mStaticDotRadius;
Resources res = getResources();
mStaticDotRadius = res.getDimensionPixelSize(R.dimen.overflow_dot_radius);
mStatusBarIconSize = res.getDimensionPixelSize(R.dimen.status_bar_icon_size);
mStatusBarIconDrawingSizeIncreased =
res.getDimensionPixelSize(R.dimen.status_bar_icon_drawing_size_dark);
mStatusBarIconDrawingSize =
res.getDimensionPixelSize(R.dimen.status_bar_icon_drawing_size);
if (applyRadius) {
mDotRadius = mStaticDotRadius;
}
mSystemIconDesiredHeight = res.getDimension(
com.android.internal.R.dimen.status_bar_system_icon_size);
mSystemIconIntrinsicHeight = res.getDimension(
com.android.internal.R.dimen.status_bar_system_icon_intrinsic_size);
mSystemIconDefaultScale = mSystemIconDesiredHeight / mSystemIconIntrinsicHeight;
}
public void setNotification(StatusBarNotification notification) {
mNotification = notification;
if (notification != null) {
setContentDescription(notification.getNotification());
}
maybeUpdateIconScaleDimens();
}
private static boolean streq(String a, String b) {
if (a == b) {
return true;
}
if (a == null && b != null) {
return false;
}
if (a != null && b == null) {
return false;
}
return a.equals(b);
}
public boolean equalIcons(Icon a, Icon b) {
if (a == b) return true;
if (a.getType() != b.getType()) return false;
switch (a.getType()) {
case Icon.TYPE_RESOURCE:
return a.getResPackage().equals(b.getResPackage()) && a.getResId() == b.getResId();
case Icon.TYPE_URI:
case Icon.TYPE_URI_ADAPTIVE_BITMAP:
return a.getUriString().equals(b.getUriString());
default:
return false;
}
}
/**
* Returns whether the set succeeded.
*/
public boolean set(StatusBarIcon icon) {
final boolean iconEquals = mIcon != null && equalIcons(mIcon.icon, icon.icon);
final boolean levelEquals = iconEquals
&& mIcon.iconLevel == icon.iconLevel;
final boolean visibilityEquals = mIcon != null
&& mIcon.visible == icon.visible;
final boolean numberEquals = mIcon != null
&& mIcon.number == icon.number;
mIcon = icon.clone();
setContentDescription(icon.contentDescription);
if (!iconEquals) {
if (!updateDrawable(false /* no clear */)) return false;
// we have to clear the grayscale tag since it may have changed
setTag(R.id.icon_is_grayscale, null);
// Maybe set scale based on icon height
maybeUpdateIconScaleDimens();
}
if (!levelEquals) {
setImageLevel(icon.iconLevel);
}
if (!numberEquals) {
if (icon.number > 0 && getContext().getResources().getBoolean(
R.bool.config_statusBarShowNumber)) {
if (mNumberBackground == null) {
mNumberBackground = getContext().getResources().getDrawable(
R.drawable.ic_notification_overlay);
}
placeNumber();
} else {
mNumberBackground = null;
mNumberText = null;
}
invalidate();
}
if (!visibilityEquals) {
setVisibility(icon.visible && !mBlocked ? VISIBLE : GONE);
}
return true;
}
public void updateDrawable() {
updateDrawable(true /* with clear */);
}
private boolean updateDrawable(boolean withClear) {
if (mIcon == null) {
return false;
}
Drawable drawable;
try {
drawable = getIcon(mIcon);
} catch (OutOfMemoryError e) {
Log.w(TAG, "OOM while inflating " + mIcon.icon + " for slot " + mSlot);
return false;
}
if (drawable == null) {
Log.w(TAG, "No icon for slot " + mSlot + "; " + mIcon.icon);
return false;
}
if (withClear) {
setImageDrawable(null);
}
setImageDrawable(drawable);
return true;
}
public Icon getSourceIcon() {
return mIcon.icon;
}
private Drawable getIcon(StatusBarIcon icon) {
return getIcon(getContext(), icon);
}
/**
* Returns the right icon to use for this item
*
* @param context Context to use to get resources
* @return Drawable for this item, or null if the package or item could not
* be found
*/
public static Drawable getIcon(Context context, StatusBarIcon statusBarIcon) {
int userId = statusBarIcon.user.getIdentifier();
if (userId == UserHandle.USER_ALL) {
userId = UserHandle.USER_SYSTEM;
}
Drawable icon = statusBarIcon.icon.loadDrawableAsUser(context, userId);
TypedValue typedValue = new TypedValue();
context.getResources().getValue(R.dimen.status_bar_icon_scale_factor, typedValue, true);
float scaleFactor = typedValue.getFloat();
// No need to scale the icon, so return it as is.
if (scaleFactor == 1.f) {
return icon;
}
return new ScalingDrawableWrapper(icon, scaleFactor);
}
public StatusBarIcon getStatusBarIcon() {
return mIcon;
}
@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(event);
if (mNotification != null) {
event.setParcelableData(mNotification.getNotification());
}
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
if (mNumberBackground != null) {
placeNumber();
}
}
@Override
public void onRtlPropertiesChanged(int layoutDirection) {
super.onRtlPropertiesChanged(layoutDirection);
updateDrawable();
}
@Override
protected void onDraw(Canvas canvas) {
if (mIconAppearAmount > 0.0f) {
canvas.save();
canvas.scale(mIconScale * mIconAppearAmount, mIconScale * mIconAppearAmount,
getWidth() / 2, getHeight() / 2);
super.onDraw(canvas);
canvas.restore();
}
if (mNumberBackground != null) {
mNumberBackground.draw(canvas);
canvas.drawText(mNumberText, mNumberX, mNumberY, mNumberPain);
}
if (mDotAppearAmount != 0.0f) {
float radius;
float alpha = Color.alpha(mDecorColor) / 255.f;
if (mDotAppearAmount <= 1.0f) {
radius = mDotRadius * mDotAppearAmount;
} else {
float fadeOutAmount = mDotAppearAmount - 1.0f;
alpha = alpha * (1.0f - fadeOutAmount);
radius = NotificationUtils.interpolate(mDotRadius, getWidth() / 4, fadeOutAmount);
}
mDotPaint.setAlpha((int) (alpha * 255));
canvas.drawCircle(mStatusBarIconSize / 2, getHeight() / 2, radius, mDotPaint);
}
}
@Override
protected void debug(int depth) {
super.debug(depth);
Log.d("View", debugIndent(depth) + "slot=" + mSlot);
Log.d("View", debugIndent(depth) + "icon=" + mIcon);
}
void placeNumber() {
final String str;
final int tooBig = getContext().getResources().getInteger(
android.R.integer.status_bar_notification_info_maxnum);
if (mIcon.number > tooBig) {
str = getContext().getResources().getString(
android.R.string.status_bar_notification_info_overflow);
} else {
NumberFormat f = NumberFormat.getIntegerInstance();
str = f.format(mIcon.number);
}
mNumberText = str;
final int w = getWidth();
final int h = getHeight();
final Rect r = new Rect();
mNumberPain.getTextBounds(str, 0, str.length(), r);
final int tw = r.right - r.left;
final int th = r.bottom - r.top;
mNumberBackground.getPadding(r);
int dw = r.left + tw + r.right;
if (dw < mNumberBackground.getMinimumWidth()) {
dw = mNumberBackground.getMinimumWidth();
}
mNumberX = w-r.right-((dw-r.right-r.left)/2);
int dh = r.top + th + r.bottom;
if (dh < mNumberBackground.getMinimumWidth()) {
dh = mNumberBackground.getMinimumWidth();
}
mNumberY = h-r.bottom-((dh-r.top-th-r.bottom)/2);
mNumberBackground.setBounds(w-dw, h-dh, w, h);
}
private void setContentDescription(Notification notification) {
if (notification != null) {
String d = contentDescForNotification(mContext, notification);
if (!TextUtils.isEmpty(d)) {
setContentDescription(d);
}
}
}
public String toString() {
return "StatusBarIconView(slot=" + mSlot + " icon=" + mIcon
+ " notification=" + mNotification + ")";
}
public StatusBarNotification getNotification() {
return mNotification;
}
public String getSlot() {
return mSlot;
}
public static String contentDescForNotification(Context c, Notification n) {
String appName = "";
try {
Notification.Builder builder = Notification.Builder.recoverBuilder(c, n);
appName = builder.loadHeaderAppName();
} catch (RuntimeException e) {
Log.e(TAG, "Unable to recover builder", e);
// Trying to get the app name from the app info instead.
Parcelable appInfo = n.extras.getParcelable(
Notification.EXTRA_BUILDER_APPLICATION_INFO);
if (appInfo instanceof ApplicationInfo) {
appName = String.valueOf(((ApplicationInfo) appInfo).loadLabel(
c.getPackageManager()));
}
}
CharSequence title = n.extras.getCharSequence(Notification.EXTRA_TITLE);
CharSequence text = n.extras.getCharSequence(Notification.EXTRA_TEXT);
CharSequence ticker = n.tickerText;
// Some apps just put the app name into the title
CharSequence titleOrText = TextUtils.equals(title, appName) ? text : title;
CharSequence desc = !TextUtils.isEmpty(titleOrText) ? titleOrText
: !TextUtils.isEmpty(ticker) ? ticker : "";
return c.getString(R.string.accessibility_desc_notification_icon, appName, desc);
}
/**
* Set the color that is used to draw decoration like the overflow dot. This will not be applied
* to the drawable.
*/
public void setDecorColor(int iconTint) {
mDecorColor = iconTint;
updateDecorColor();
}
private void initializeDecorColor() {
if (mNotification != null) {
setDecorColor(getContext().getColor(mNightMode
? com.android.internal.R.color.notification_default_color_dark
: com.android.internal.R.color.notification_default_color_light));
}
}
private void updateDecorColor() {
int color = NotificationUtils.interpolateColors(mDecorColor, Color.WHITE, mDozeAmount);
if (mDotPaint.getColor() != color) {
mDotPaint.setColor(color);
if (mDotAppearAmount != 0) {
invalidate();
}
}
}
/**
* Set the static color that should be used for the drawable of this icon if it's not
* transitioning this also immediately sets the color.
*/
public void setStaticDrawableColor(int color) {
mDrawableColor = color;
setColorInternal(color);
updateContrastedStaticColor();
mIconColor = color;
mDozer.setColor(color);
}
private void setColorInternal(int color) {
mCurrentSetColor = color;
updateIconColor();
}
private void updateIconColor() {
if (mShowsConversation) {
setColorFilter(null);
return;
}
if (mCurrentSetColor != NO_COLOR) {
if (mMatrixColorFilter == null) {
mMatrix = new float[4 * 5];
mMatrixColorFilter = new ColorMatrixColorFilter(mMatrix);
}
int color = NotificationUtils.interpolateColors(
mCurrentSetColor, Color.WHITE, mDozeAmount);
updateTintMatrix(mMatrix, color, DARK_ALPHA_BOOST * mDozeAmount);
mMatrixColorFilter.setColorMatrixArray(mMatrix);
setColorFilter(null); // setColorFilter only invalidates if the instance changed.
setColorFilter(mMatrixColorFilter);
} else {
mDozer.updateGrayscale(this, mDozeAmount);
}
}
/**
* Updates {@param array} such that it represents a matrix that changes RGB to {@param color}
* and multiplies the alpha channel with the color's alpha+{@param alphaBoost}.
*/
private static void updateTintMatrix(float[] array, int color, float alphaBoost) {
Arrays.fill(array, 0);
array[4] = Color.red(color);
array[9] = Color.green(color);
array[14] = Color.blue(color);
array[18] = Color.alpha(color) / 255f + alphaBoost;
}
public void setIconColor(int iconColor, boolean animate) {
if (mIconColor != iconColor) {
mIconColor = iconColor;
if (mColorAnimator != null) {
mColorAnimator.cancel();
}
if (mCurrentSetColor == iconColor) {
return;
}
if (animate && mCurrentSetColor != NO_COLOR) {
mAnimationStartColor = mCurrentSetColor;
mColorAnimator = ValueAnimator.ofFloat(0.0f, 1.0f);
mColorAnimator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
mColorAnimator.setDuration(ANIMATION_DURATION_FAST);
mColorAnimator.addUpdateListener(mColorUpdater);
mColorAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mColorAnimator = null;
mAnimationStartColor = NO_COLOR;
}
});
mColorAnimator.start();
} else {
setColorInternal(iconColor);
}
}
}
public int getStaticDrawableColor() {
return mDrawableColor;
}
/**
* A drawable color that passes GAR on a specific background.
* This value is cached.
*
* @param backgroundColor Background to test against.
* @return GAR safe version of {@link StatusBarIconView#getStaticDrawableColor()}.
*/
int getContrastedStaticDrawableColor(int backgroundColor) {
if (mCachedContrastBackgroundColor != backgroundColor) {
mCachedContrastBackgroundColor = backgroundColor;
updateContrastedStaticColor();
}
return mContrastedDrawableColor;
}
private void updateContrastedStaticColor() {
if (Color.alpha(mCachedContrastBackgroundColor) != 255) {
mContrastedDrawableColor = mDrawableColor;
return;
}
// We'll modify the color if it doesn't pass GAR
int contrastedColor = mDrawableColor;
if (!ContrastColorUtil.satisfiesTextContrast(mCachedContrastBackgroundColor,
contrastedColor)) {
float[] hsl = new float[3];
ColorUtils.colorToHSL(mDrawableColor, hsl);
// This is basically a light grey, pushing the color will only distort it.
// Best thing to do in here is to fallback to the default color.
if (hsl[1] < 0.2f) {
contrastedColor = Notification.COLOR_DEFAULT;
}
boolean isDark = !ContrastColorUtil.isColorLight(mCachedContrastBackgroundColor);
contrastedColor = ContrastColorUtil.resolveContrastColor(mContext,
contrastedColor, mCachedContrastBackgroundColor, isDark);
}
mContrastedDrawableColor = contrastedColor;
}
@Override
public void setVisibleState(int state) {
setVisibleState(state, true /* animate */, null /* endRunnable */);
}
public void setVisibleState(int state, boolean animate) {
setVisibleState(state, animate, null);
}
@Override
public boolean hasOverlappingRendering() {
return false;
}
public void setVisibleState(int visibleState, boolean animate, Runnable endRunnable) {
setVisibleState(visibleState, animate, endRunnable, 0);
}
/**
* Set the visibleState of this view.
*
* @param visibleState The new state.
* @param animate Should we animate?
* @param endRunnable The runnable to run at the end.
* @param duration The duration of an animation or 0 if the default should be taken.
*/
public void setVisibleState(int visibleState, boolean animate, Runnable endRunnable,
long duration) {
boolean runnableAdded = false;
if (visibleState != mVisibleState) {
mVisibleState = visibleState;
if (mIconAppearAnimator != null) {
mIconAppearAnimator.cancel();
}
if (mDotAnimator != null) {
mDotAnimator.cancel();
}
if (animate) {
float targetAmount = 0.0f;
Interpolator interpolator = Interpolators.FAST_OUT_LINEAR_IN;
if (visibleState == STATE_ICON) {
targetAmount = 1.0f;
interpolator = Interpolators.LINEAR_OUT_SLOW_IN;
}
float currentAmount = getIconAppearAmount();
if (targetAmount != currentAmount) {
mIconAppearAnimator = ObjectAnimator.ofFloat(this, ICON_APPEAR_AMOUNT,
currentAmount, targetAmount);
mIconAppearAnimator.setInterpolator(interpolator);
mIconAppearAnimator.setDuration(duration == 0 ? ANIMATION_DURATION_FAST
: duration);
mIconAppearAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mIconAppearAnimator = null;
runRunnable(endRunnable);
}
});
mIconAppearAnimator.start();
runnableAdded = true;
}
targetAmount = visibleState == STATE_ICON ? 2.0f : 0.0f;
interpolator = Interpolators.FAST_OUT_LINEAR_IN;
if (visibleState == STATE_DOT) {
targetAmount = 1.0f;
interpolator = Interpolators.LINEAR_OUT_SLOW_IN;
}
currentAmount = getDotAppearAmount();
if (targetAmount != currentAmount) {
mDotAnimator = ObjectAnimator.ofFloat(this, DOT_APPEAR_AMOUNT,
currentAmount, targetAmount);
mDotAnimator.setInterpolator(interpolator);;
mDotAnimator.setDuration(duration == 0 ? ANIMATION_DURATION_FAST
: duration);
final boolean runRunnable = !runnableAdded;
mDotAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mDotAnimator = null;
if (runRunnable) {
runRunnable(endRunnable);
}
}
});
mDotAnimator.start();
runnableAdded = true;
}
} else {
setIconAppearAmount(visibleState == STATE_ICON ? 1.0f : 0.0f);
setDotAppearAmount(visibleState == STATE_DOT ? 1.0f
: visibleState == STATE_ICON ? 2.0f
: 0.0f);
}
}
if (!runnableAdded) {
runRunnable(endRunnable);
}
}
private void runRunnable(Runnable runnable) {
if (runnable != null) {
runnable.run();
}
}
public void setIconAppearAmount(float iconAppearAmount) {
if (mIconAppearAmount != iconAppearAmount) {
mIconAppearAmount = iconAppearAmount;
invalidate();
}
}
public float getIconAppearAmount() {
return mIconAppearAmount;
}
public int getVisibleState() {
return mVisibleState;
}
public void setDotAppearAmount(float dotAppearAmount) {
if (mDotAppearAmount != dotAppearAmount) {
mDotAppearAmount = dotAppearAmount;
invalidate();
}
}
@Override
public void setVisibility(int visibility) {
super.setVisibility(visibility);
if (mOnVisibilityChangedListener != null) {
mOnVisibilityChangedListener.onVisibilityChanged(visibility);
}
}
public float getDotAppearAmount() {
return mDotAppearAmount;
}
public void setOnVisibilityChangedListener(OnVisibilityChangedListener listener) {
mOnVisibilityChangedListener = listener;
}
public void setDozing(boolean dozing, boolean fade, long delay) {
mDozer.setDozing(f -> {
mDozeAmount = f;
updateDecorColor();
updateIconColor();
updateAllowAnimation();
}, dozing, fade, delay, this);
}
private void updateAllowAnimation() {
if (mDozeAmount == 0 || mDozeAmount == 1) {
setAllowAnimation(mDozeAmount == 0);
}
}
/**
* This method returns the drawing rect for the view which is different from the regular
* drawing rect, since we layout all children at position 0 and usually the translation is
* neglected. The standard implementation doesn't account for translation.
*
* @param outRect The (scrolled) drawing bounds of the view.
*/
@Override
public void getDrawingRect(Rect outRect) {
super.getDrawingRect(outRect);
float translationX = getTranslationX();
float translationY = getTranslationY();
outRect.left += translationX;
outRect.right += translationX;
outRect.top += translationY;
outRect.bottom += translationY;
}
public void setIsInShelf(boolean isInShelf) {
mIsInShelf = isInShelf;
}
public boolean isInShelf() {
return mIsInShelf;
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
if (mLayoutRunnable != null) {
mLayoutRunnable.run();
mLayoutRunnable = null;
}
updatePivot();
}
private void updatePivot() {
if (isLayoutRtl()) {
setPivotX((1 + mIconScale) / 2.0f * getWidth());
} else {
setPivotX((1 - mIconScale) / 2.0f * getWidth());
}
setPivotY((getHeight() - mIconScale * getWidth()) / 2.0f);
}
public void executeOnLayout(Runnable runnable) {
mLayoutRunnable = runnable;
}
public void setDismissed() {
mDismissed = true;
if (mOnDismissListener != null) {
mOnDismissListener.run();
}
}
public boolean isDismissed() {
return mDismissed;
}
public void setOnDismissListener(Runnable onDismissListener) {
mOnDismissListener = onDismissListener;
}
@Override
public void onDarkChanged(Rect area, float darkIntensity, int tint) {
int areaTint = getTint(area, this, tint);
ColorStateList color = ColorStateList.valueOf(areaTint);
setImageTintList(color);
setDecorColor(areaTint);
}
@Override
public boolean isIconVisible() {
return mIcon != null && mIcon.visible;
}
@Override
public boolean isIconBlocked() {
return mBlocked;
}
public void setIncreasedSize(boolean increasedSize) {
mIncreasedSize = increasedSize;
maybeUpdateIconScaleDimens();
}
/**
* Sets whether this icon shows a person and should be tinted.
* If the state differs from the supplied setting, this
* will update the icon colors.
*
* @param showsConversation Whether the icon shows a person
*/
public void setShowsConversation(boolean showsConversation) {
if (mShowsConversation != showsConversation) {
mShowsConversation = showsConversation;
updateIconColor();
}
}
/**
* @return if this icon shows a conversation
*/
public boolean showsConversation() {
return mShowsConversation;
}
public interface OnVisibilityChangedListener {
void onVisibilityChanged(int newVisibility);
}
}
| [
"[email protected]"
] | |
2b4eab400a4a516015f6127efe2b238bb2c4cb6e | e0d398c650cb143c7cf529efd05c2088164b3c8b | /Homework5/zheng-hw5/Employee.java | d081bab2a77934f6957ad6e08bc6c68b064d14ef | [] | no_license | zhengronggift/Java_Programming | 8e962109173ad68082d2169ff55a99d325807366 | d2764446f12d0e7fe35f5aadfe0448cea4ee29a6 | refs/heads/master | 2022-03-23T21:59:32.449232 | 2019-12-02T05:44:08 | 2019-12-02T05:44:08 | 203,625,160 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,885 | java |
abstract class Employee {
// Member variables
private double base_salary;
private String userName;
private String set_password;
//default constructor set name to "" and base salary to 0
Employee()
{
userName = "";
base_salary = 0;
set_password = "";
}
//set the salary and name to the variables passed in
Employee(String n, double s)
{
base_salary = s;
userName = n;
}
//return the name
public String getName()
{
//System.out.print("user name: ");
//System.out.println(userName);
return userName;
}
//return the salary
public double getBaseSalary()
{
//System.out.print("base salary: ");
//System.out.println(base_salary);
return base_salary;
}
//call checkpassword method first, if true, set password, else throw exception
protected void setPW(String p)
{
boolean check = checkPassword(p);
if (check == true)
{
set_password = p;
}
else
{
throw new IllegalArgumentException("Password not right");
}
}
//check the password to match employee's password
public boolean isPasswordMatch(String s)
{
try {
//System.out.print("pasword match: ");
//System.out.println(set_password.compareTo(s));
if (set_password.compareTo(s) == 0)
{
return true;
}
else
return false;
} catch (NullPointerException e) {
return false;
}
}
//check the password, length > 8, least 1 number, least 1 letter, and no special character
public boolean checkPassword(String s)
{
String get_special=s.replaceAll("[a-zA-Z0-9]", "");
String get_number=s.replaceAll("[^0-9]", "");
String get_letter=s.replaceAll("[^a-zA-Z]", "");
if (s.length() >= 8 && get_number.length() >= 1 && get_letter.length() >= 1 && get_special.length() == 0)
{
return true;
}
else
{
return false;
}
}
//abstract method for child class to add
abstract public double getSalary();
}
| [
"[email protected]"
] | |
1c446c5f1ee1936d03eecb2bc6f2b201b7fb7006 | 46e933069dfc21878d27785cf7ca74358ac5758e | /core-restdocs/src/main/java/com/ego/core/restdocs/web/controller/HomeController.java | 3160b7f2450bc118e29a399dff24c69a782cb5cf | [] | no_license | yiguixia007/SpringBootLearn | ba2aa61fa9cfaf5a006754c49e90938965d91178 | d4264396e29e8bf7898221db7a50b854d22e12b4 | refs/heads/master | 2020-04-08T01:57:20.555526 | 2018-12-23T08:39:32 | 2018-12-23T08:39:32 | 158,916,060 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 557 | java | package com.ego.core.restdocs.web.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Collections;
import java.util.Map;
/**
* @author ego
* @since 2018-11-27 09:02
**/
@RestController
@RequestMapping("/home")
public class HomeController {
@GetMapping("/greeting")
public Map<String,String> greeting(){
return Collections.singletonMap("message", "Hello World");
}
}
| [
"[email protected]"
] | |
864792d9ace5926cc992ebeec9dbe6d34b79b909 | 99e818caced73433993bb89b4b4bf91ceec3719d | /src/util/Input.java | c8ab3ecc6168a0b6cbe848327e5d81099a2d29f2 | [] | no_license | ramon-villarreal-leal/codeup-java-exercises | 4b9ad5aa2493785157b01de16be5dc16826db04a | ec38df7ae30046aa0b9ce9aaf569873c0a6cf3e8 | refs/heads/master | 2022-11-11T01:49:49.138643 | 2020-06-26T15:37:59 | 2020-06-26T15:37:59 | 268,579,399 | 0 | 0 | null | 2020-06-14T18:08:06 | 2020-06-01T16:50:53 | Java | UTF-8 | Java | false | false | 2,349 | java | package util;
import java.util.Scanner;
public class Input {
private Scanner scanner;
public Input() {
this.scanner = new Scanner(System.in);
}
public String getString() {
return scanner.nextLine();
}
public String getString(String prompt) {
System.out.println(prompt);
return scanner.nextLine();
}
public boolean yesNo() {
// System.out.println("Different ways to say yes");
String answer = getString();
if (answer.equalsIgnoreCase("yes")
||answer.equalsIgnoreCase("y")||answer.equalsIgnoreCase("yee")) {
return true;
} else {
return false;
}
}
//original getInt()
// public int getInt(){
// return scanner.nextInt();
// }
public int getInt() {
String userInput = scanner.nextLine();
try{
return Integer.parseInt(userInput);
}catch(NumberFormatException e) {
System.out.println("Need a valid integer.");
return getInt();
}
}
public int getInt(int min, int max) {
System.out.printf("Enter a number between %d and %d%n", min, max);
int answer = getInt();
if (answer >= min && answer <= max) {
System.out.println("You entered within the range!");
return answer;
} else {
//CALL THIS INSTEAD OF GETINT() LINE 35!!!
System.out.println("You need to enter a number in the range!");
return getInt(min, max);
}
}
public double getDouble() {
String userInput = scanner.nextLine();
try{
return Double.parseDouble(userInput);
}catch(NumberFormatException e){ //checked exception most general
System.out.println("enter a valid double number");
return getDouble();
}
}
public double getDouble(double min, double max){
System.out.printf("Enter a decimal between %.4f - %.4f%n", min, max);
double floatAnswer = getDouble();
if(floatAnswer >= min && floatAnswer <= max) {
return floatAnswer;
} else {
System.out.println("Please enter a number in the correct range between " + min + " " + "and " + max);
return getDouble(min,max);
}
}
}
| [
"[email protected]"
] | |
4d057a4fb50bf1642d8ac07cf741795abd1efa5c | 27eef98cbf6520c5ba5c6284fd2ba6eabad834fe | /Project/src/day1/ChromeLaunch.java | 37f4db91784e45025d43836e693ab7076d680fc0 | [] | no_license | shaath/Saurmi_Srikanth_Chatanya | 1f57cf6e85173cf46f4264d83371b0a28d9d64f3 | 68d2e23f0b0b83971d0548de4cb73bea73eda43f | refs/heads/master | 2021-01-13T11:18:02.781779 | 2017-02-09T02:14:37 | 2017-02-09T02:14:37 | 81,398,589 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 310 | java | package day1;
import org.openqa.selenium.chrome.ChromeDriver;
public class ChromeLaunch {
public static void main(String[] args)
{
System.setProperty("webdriver.chrome.driver", "F:\\Cdownloads\\chromedriver.exe");
ChromeDriver driver=new ChromeDriver();
driver.get("http://facebook.com");
}
}
| [
"[email protected]"
] | |
43bf658fcb4afe0d1fb3a6a6df555284aa942380 | 6bdf78e9d7c318d0b84799998ca67b431bbbdb8d | /app/src/main/java/com/example/rivtour/Place.java | be46dfee4d4f22b9a0e9129f33bf5c8246dcae68 | [] | no_license | georgediepiriye/RivTour | 73eeba88830a5d00cb9dd14e8b4c756a30c3521f | 55a627be4a4da888b38dc020d981c7dd4fd1bf0a | refs/heads/master | 2022-06-07T17:28:54.228888 | 2020-05-07T17:58:59 | 2020-05-07T17:58:59 | 262,121,877 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 642 | java | package com.example.rivtour;
public class Place {
/**
* variable for image Id's
*/
private int mImageResourceId;
/**
* variable for name of place
*/
private String mName;
/**
* constructor for places object
*/
public Place(int imageResourceId, String name) {
mImageResourceId = imageResourceId;
mName = name;
}
/**
* gets the name of the image resource Id
*/
public int getImageResourceId() {
return mImageResourceId;
}
/**
* gets the name of the place
*/
public String getName() {
return mName;
}
}
| [
"[email protected]"
] | |
a41342ce993e88278cefe8bfb319a0e2dc1d7d8c | f344f112459f93885eb73eabd4cfa8ec57bf80b8 | /distribute/src/main/java/proxy/DynamicProxyHandler.java | 59d57cf5a1e52ede6887081d3f9fea0b6e63e3e5 | [] | no_license | jacktomas/practise | 50d731d41a29810bb50bc5f5e7ce9dd18023aa38 | c8921a412bb47736a0d425ee095fcccd2b58b739 | refs/heads/master | 2021-01-12T03:13:38.278565 | 2017-04-19T15:43:05 | 2017-04-19T15:43:05 | 78,182,390 | 0 | 0 | null | 2017-01-06T07:52:35 | 2017-01-06T06:55:56 | null | UTF-8 | Java | false | false | 716 | java | package proxy;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
/**
* Created by Administrator on 2017/3/20.
*/
public class DynamicProxyHandler implements InvocationHandler {
private Object testProxy;
public DynamicProxyHandler(Object proxy) {
this.testProxy = proxy;
}
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
System.out.println("this is proxy : " + proxy.getClass() + ",method : " + method + " ,args: " + args);
if (args != null) {
for (Object arg : args) {
System.out.println(" "+arg);
}
}
return method.invoke(testProxy, args);
}
}
| [
"[email protected]"
] | |
856fe1baee504fd93ea730ea4f26abfa2ec59ddc | 00ee55a6598cdbac087ccfd26cc36a578dbb485e | /saml/src/main/java/pl/edu/icm/unity/saml/idp/web/filter/SSOResponseHandler.java | 48fe063240cfb395ac8b79b078d618eade01c776 | [] | no_license | ngohuusang/unity | c01672c9f94be235162a85def395a0c7f7ab6ecd | bbb56b56d5c6e980955c0c14de098f86b273fbc7 | refs/heads/master | 2021-05-12T13:24:38.096590 | 2017-11-02T18:11:43 | 2017-11-02T18:11:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,268 | java | /*
* Copyright (c) 2014 ICM Uniwersytet Warszawski All rights reserved.
* See LICENCE.txt file for licensing information.
*/
package pl.edu.icm.unity.saml.idp.web.filter;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import eu.unicore.samly2.exceptions.SAMLServerException;
import pl.edu.icm.unity.saml.SamlProperties.Binding;
import pl.edu.icm.unity.saml.idp.FreemarkerHandler;
import pl.edu.icm.unity.saml.idp.processor.AuthnResponseProcessor;
import pl.edu.icm.unity.saml.web.ResponseHandlerBase;
import pl.edu.icm.unity.webui.idpcommon.EopException;
import xmlbeans.org.oasis.saml2.protocol.ResponseDocument;
/**
* Helper to send responses in SSO authn case, when working in non-Vaadin environment (plain servlets).
* @author K. Benedyczak
*/
public class SSOResponseHandler extends ResponseHandlerBase
{
public SSOResponseHandler(FreemarkerHandler freemarker)
{
super(freemarker);
}
public void sendResponse(Binding binding, ResponseDocument responseDoc, String serviceUrl,
String relayState, HttpServletRequest request, HttpServletResponse response)
throws IOException, EopException
{
try
{
super.sendResponse(binding, responseDoc, serviceUrl, relayState,
response, "SSO Authentication response");
} finally
{
cleanContext(request.getSession(), false);
}
}
public void handleException(AuthnResponseProcessor samlProcessor,
Exception e, Binding binding, String serviceUrl,
String relayState, HttpServletRequest request, HttpServletResponse response,
boolean invalidate)
throws EopException, IOException
{
SAMLServerException convertedException = samlProcessor.convert2SAMLError(e, null, true);
ResponseDocument respDoc = samlProcessor.getErrorResponse(convertedException);
try
{
super.sendResponse(binding, respDoc, serviceUrl, relayState, response,
"SSO Authentication error response");
} finally
{
cleanContext(request.getSession(), invalidate);
}
}
protected void cleanContext(HttpSession httpSession, boolean invalidate)
{
httpSession.removeAttribute(SamlParseServlet.SESSION_SAML_CONTEXT);
if (invalidate)
httpSession.invalidate();
}
}
| [
"[email protected]"
] | |
f0d9c066d134d4f294d7853db8cefdf4c7d1ee11 | a0b3b09891bd89844b010d9ddb036fbc842e734d | /TreeMap/Mytreemap.java | 41a04cdaaa61b8810e5a052139eafb297f6e763f | [] | no_license | Jjessore/suyash-collection_framework | 7d1621bd20516e38929070db16f622bb77d4c6d9 | 3a06dc536bdad9f4224ee9d053af3e72f01f9e40 | refs/heads/master | 2023-03-17T19:30:15.940928 | 2017-11-05T22:18:49 | 2017-11-05T22:18:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 895 | java | import java.util.*;
class Mycomp implements Comparator
{
public int compare(Object o1,Object o2)
{
Temp t1=(Temp)o1;
Temp t2=(Temp)o2;
if(t1.salary>t2.salary)
return 1;
else if(t1.salary<t2.salary)
return -1;
else
return 0;
}
}
class Mytreemap
{
public static void main(String... w)
{
Comparator m=new Mycomp();
TreeMap t=new TreeMap(m);
t.put(new Temp(10),"cc");
t.put(new Temp(2),"bb");
t.put(new Temp(12),"gg");
t.put(new Temp(3),"aa");
t.put(new Temp(2),"gg");
Set s=t.entrySet();
Iterator i=s.iterator();
while(i.hasNext())
{
Map.Entry e=(Map.Entry)i.next();
Temp k=(Temp)e.getKey();
String v=(String)e.getValue();
System.out.println(k.salary+"="+v);
}
}
}
class Temp
{
int salary;
Temp(int salary)
{
this.salary=salary;
}
}
/* OUTPUT-
2=gg
3=aa
10=cc
12=gg */ | [
"[email protected]"
] | |
3f6fcac06100f4510f5f76c5368cba53b3227143 | ec947acfa871ec6361257ac0f9fd5166f60fca89 | /fridge-common/src/main/java/com/jiangjun/fridge/service/impl/FoodKindServiceImpl.java | 423d3e87eaef47e8d443603f57bc04596dc8f556 | [] | no_license | amolei/myFridge | ef92fc77ca8b52e5e6ec1bea1e03375d8ee55eb4 | 9b1e3ae72cd637e250e2258a99097b7292a757b4 | refs/heads/master | 2021-01-16T23:23:12.034936 | 2016-07-31T01:15:32 | 2016-07-31T01:15:32 | 58,942,426 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,595 | java | package com.jiangjun.fridge.service.impl;
import com.jiangjun.fridge.dao.IFoodKindDao;
import com.jiangjun.fridge.dto.FoodKindDto;
import com.jiangjun.fridge.service.FoodKindService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by jiangjun on 16/6/12.
*/
@Service("foodKindService")
public class FoodKindServiceImpl implements FoodKindService {
@Resource
private IFoodKindDao foodKindDao;
public List<FoodKindDto> list() {
return foodKindDao.list();
}
public void addFoodKind(FoodKindDto foodKindDto) {
List<FoodKindDto> list = foodKindDao.list();
if(list != null && list.size() > 0){
foodKindDto.setSort(list.get(list.size() - 1).getSort() + 1);
}else {
foodKindDto.setSort(1);
}
foodKindDao.addFoodKind(foodKindDto);
}
public FoodKindDto queryById(long kind_id) {
return foodKindDao.queryById(kind_id);
}
public FoodKindDto queryByName(String food_kind_name) {
return foodKindDao.queryByName(food_kind_name);
}
public void delFoodKindById(long kind_id) {
foodKindDao.delFoodKindById(kind_id);
}
public void update(FoodKindDto foodKindDto){foodKindDao.update(foodKindDto);}
public List<FoodKindDto> listLtBySort(Integer sort){
return foodKindDao.listLtBySort(sort);
}
public List<FoodKindDto> listGtBySort(Integer sort){
return foodKindDao.listGtBySort(sort);
}
}
| [
"[email protected]"
] | |
c373861652deb5c5d1899828ce99aab7d7314ff0 | 0004f36d725a4b71e69e284935858fa17f7e48cd | /src/main/java/com/happyProject/admin/model/Notices.java | 8368fe5fb29c8a24e6fb89fde1c9847ddd5d8cff | [] | no_license | liuleiy/happyProject | 202bb78d4b12e51e5ed047c9a6f90629a55ec333 | f55705ce304deb35af79672bc1086efdb1156387 | refs/heads/master | 2020-03-29T18:08:23.885847 | 2018-10-30T02:17:53 | 2018-10-30T02:17:53 | 150,196,446 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,793 | java | package com.happyProject.admin.model;
import java.util.Date;
import org.springframework.data.mongodb.core.mapping.Document;
@Document(collection = "col_notice")
public class Notices {
private String id;// 公告ID
private String userid;// 玩家
private Integer rtype;// 类型,1=公告消息,2=广播消息,rtype消息类型,0玩家个人购买消息,1公告消息,2广播消息,3系统消息
private Integer atype;// 分包类型
private Integer acttype;// 操作类型,0=无操作,1=支付,2=活动,
private Integer top;// 置顶
private Integer num;// 广播次数
private Integer del;// 是否移除
private String content;// 广播内容
private Date etime;// 过期时间
private Date ctime; // 创建时间
public Notices(String id, String userid, Integer rtype, Integer atype, Integer acttype, Integer top, Integer num,
Integer del, String content, Date etime, Date ctime) {
super();
this.id = id;
this.userid = userid;
this.rtype = rtype;
this.atype = atype;
this.acttype = acttype;
this.top = top;
this.num = num;
this.del = del;
this.content = content;
this.etime = etime;
this.ctime = ctime;
}
public Notices() {
super();
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUserid() {
return userid;
}
public void setUserid(String userid) {
this.userid = userid;
}
public Integer getRtype() {
return rtype;
}
public void setRtype(Integer rtype) {
this.rtype = rtype;
}
public Integer getAtype() {
return atype;
}
public void setAtype(Integer atype) {
this.atype = atype;
}
public Integer getActtype() {
return acttype;
}
public void setActtype(Integer acttype) {
this.acttype = acttype;
}
public Integer getTop() {
return top;
}
public void setTop(Integer top) {
this.top = top;
}
public Integer getNum() {
return num;
}
public void setNum(Integer num) {
this.num = num;
}
public Integer getDel() {
return del;
}
public void setDel(Integer del) {
this.del = del;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Date getEtime() {
return etime;
}
public void setEtime(Date etime) {
this.etime = etime;
}
public Date getCtime() {
return ctime;
}
public void setCtime(Date ctime) {
this.ctime = ctime;
}
@Override
public String toString() {
return "Notices [id=" + id + ", userid=" + userid + ", rtype=" + rtype + ", atype=" + atype + ", acttype="
+ acttype + ", top=" + top + ", num=" + num + ", del=" + del + ", content=" + content + ", etime="
+ etime + ", ctime=" + ctime + "]";
}
}
| [
"Administrator@MFKJ-1712311654"
] | Administrator@MFKJ-1712311654 |
e6bb823416aa39b137e4e1418209d722d7b5793c | 5ec0e38fc6417a0ba25e29d3fff6e1334c4e439a | /src/main/java/io/biblia/workflows/definition/DatasetAttributesConstants.java | 6bcac7455e98ff88c5fe07d2fbc1a0f6d964f83d | [
"Apache-2.0"
] | permissive | jadielam/scientific-workflows | a93f69c24200e4a3759fcec0c6e7c37b02bad89a | 7ec307aaf84a192c823913110b886aab31faef15 | refs/heads/master | 2021-04-09T17:31:37.837039 | 2017-04-11T02:14:03 | 2017-04-11T02:14:03 | 52,480,032 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 164 | java | package io.biblia.workflows.definition;
public interface DatasetAttributesConstants {
String DATASET_PATH = "path";
String DATASET_SIZE_IN_MB = "sizeInMB";
}
| [
"[email protected]"
] | |
6a83ec5332e55529bf5ba6bbb97aaf1537371ee4 | 1e676afdbd07d8321cd0279c19bb611fd2ad86fe | /app/src/main/java/com/me/bui/architecturecomponents/MainActivity.java | 28a9191594647c089d3274908208bb387ad1980e | [] | no_license | maobui/architecture_components | d1a4cbf056a2714acbc733ed2287559dd9da210f | 7cf4aa80a04970979bcebff0ae4138ce1768b9d9 | refs/heads/master | 2021-07-15T11:38:32.679850 | 2018-10-07T04:13:03 | 2018-10-07T04:13:03 | 146,962,877 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,412 | java | package com.me.bui.architecturecomponents;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import com.me.bui.architecturecomponents.api.GithubService;
import com.me.bui.architecturecomponents.di.Injectable;
import com.me.bui.architecturecomponents.ui.RepoFragment;
import javax.inject.Inject;
import dagger.android.AndroidInjection;
import dagger.android.AndroidInjector;
import dagger.android.DispatchingAndroidInjector;
import dagger.android.support.HasSupportFragmentInjector;
public class MainActivity extends AppCompatActivity implements Injectable, HasSupportFragmentInjector{
@Inject
DispatchingAndroidInjector<Fragment> fragmentDispatchingAndroidInjector;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String tag = RepoFragment.TAG;
if (getSupportFragmentManager().findFragmentByTag(tag) == null) {
RepoFragment fragment = RepoFragment.newInstance();
getSupportFragmentManager().beginTransaction()
.add(R.id.container, fragment, tag)
.commit();
}
}
@Override
public AndroidInjector<Fragment> supportFragmentInjector() {
return fragmentDispatchingAndroidInjector;
}
}
| [
"[email protected]"
] | |
1857d4193d05a7ea89f7df847dc568147ad844eb | 255b1468a5806849c51a0b15157c6ffc3caa3cf7 | /Test2.1/src/test/java/pages/ReceiptPage.java | 12dcd8a92d511938237bcefa2ffbbe09a30fffc1 | [] | no_license | xeratum/TestIHMTv1 | c580f29cefac8c0024d2ee5a96eec36d7e56bf95 | 609e0243ccf456adfa6e6107dba22e7fe13184bf | refs/heads/master | 2020-03-23T12:48:14.742627 | 2018-07-19T14:21:59 | 2018-07-19T14:21:59 | 141,582,944 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 441 | java | package pages;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import pages.PageObject;
public class ReceiptPage extends PageObject {
@FindBy(tagName = "h1")
private WebElement header;
public ReceiptPage(WebDriver driver) {
super(driver);
}
public String confirmationHeader(){
return header.getText();
}
} | [
"[email protected]"
] | |
fa7d870a9c45775c1c30e8e60e2d5f62165cd797 | 883b76bf6a242b76660dd2d04d77c2e6ee95ee49 | /src/main/java/com/algorithm/leetcode/list/LeetCode237_DeleteListNode.java | 0f76747061f7e8895cad71a6836fc112502d40ff | [] | no_license | smileszx/algorithm-bug-free | a0b4a34dec1c2fa2818e04b438b6b191d56a0d1b | 28d5758734f3a53b7b62319315b529e192705dca | refs/heads/master | 2022-12-01T04:29:17.686748 | 2020-03-15T14:32:24 | 2020-03-15T14:32:24 | 211,521,935 | 0 | 0 | null | 2022-11-15T23:32:25 | 2019-09-28T15:32:56 | Java | UTF-8 | Java | false | false | 3,179 | java | package com.algorithm.leetcode.list;
import com.algorithm.leetcode.list.ListNode;
import com.algorithm.leetcode.list.ListNodeUtil;
/**
* @Description 237. 删除链表中的节点
* 请编写一个函数,使其可以删除某个链表中给定的(非末尾)节点,你将只被给定要求被删除的节点。
* 现有一个链表 -- head = [4,5,1,9],它可以表示为:
* 示例 1:
* 输入: head = [4,5,1,9], node = 5
* 输出: [4,1,9]
* 解释: 给定你链表中值为 5 的第二个节点,那么在调用了你的函数之后,该链表应变为 4 -> 1 -> 9.
* 示例 2:
* 输入: head = [4,5,1,9], node = 1
* 输出: [4,5,9]
* 解释: 给定你链表中值为 1 的第三个节点,那么在调用了你的函数之后,该链表应变为 4 -> 5 -> 9.
* <p>
* 说明:
* <p>
* - 链表至少包含两个节点。
* - 链表中所有节点的值都是唯一的。
* - 给定的节点为非末尾节点并且一定是链表中的一个有效节点。
* - 不要从你的函数中返回任何结果。
* <p>
* 来源:力扣(LeetCode)
* 链接:https://leetcode-cn.com/problems/delete-node-in-a-linked-list
* 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
* @Author victor su
* @Date 2019/8/9 13:32
**/
public class LeetCode237_DeleteListNode {
public static void main(String[] args) {
/**
* 算法说明:初始化条件
* - 链表至少包含两个节点。
* - 链表中所有节点的值都是唯一的。
* - 给定的节点为非末尾节点并且一定是链表中的一个有效节点。
* - 不要从你的函数中返回任何结果。
*/
ListNode head = null;
int[] arr = {13, 14, 9, 14, 13, 520};
for (int i= 0; i<arr.length; i++) {
head = ListNodeUtil.add(head, arr[i]);
}
System.out.println("初始化ListNode: " + ListNodeUtil.traverseListNode(head));
ListNode target = new ListNode(9);
deleteListNode(head, target);
System.out.printf("删除节点[%d]后:" + ListNodeUtil.traverseListNode(head), target.val);
}
/**
* 删除单链表节点
* @param head
* @param node
*/
public static void deleteListNode(ListNode head, ListNode node) {
ListNode prev = null;
//遍历单链表,判断待删除节点位置
for (ListNode x = head; x != null; x = x.next) {
if (node.val == x.val) {
if (x.next == null) {
prev.next = null;
} else {
x.val = x.next.val;
x.next = x.next.next;
}
}
//跳出本次循环后将节点放在临时节点中,作为下次循环的前驱节点
prev = x;
}
//LeetCode算法题也有陷阱,只要求提供解题思路,测试肯定有隐含操作
//将后继节点变成待删除节点,偷梁换柱,不必管前驱节点,效果是待删除节点消失
// node.val = node.next.val;
// node.next = node.next.next;
}
}
| [
"[email protected]"
] | |
b0c1eaa7aa90ddae3ba38daa35e8a64db9dd9529 | 67652efc926e075ab09dc2926626661b98f30d7b | /src/Sudoku/Computationlogic/GameGenerator.java | b83e64653e751c0e98799c5934d59f8f52729ef2 | [] | no_license | Maina-Alex/JavaFx-Sudoku-game | 05f5d3c23d7110f33445b9f69fa43e1cc26f970b | 45080cdd2198b7c28a974ab96cb6ae9767dcb2fc | refs/heads/master | 2023-03-08T12:09:25.394785 | 2021-02-14T19:26:46 | 2021-02-14T19:26:46 | 338,882,252 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,199 | java | package Sudoku.Computationlogic;
import Sudoku.ProblemDomain.Coordinates;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import static Sudoku.ProblemDomain.SudokuGame.GRID_BOUNDARY;
public class GameGenerator {
public static int[][] getNewGameGrid(){
return unsolveGame(getSolvedGame());
}
private static int[][] unsolveGame(int[][] solvedGame) {
Random random = new Random(System.currentTimeMillis());
boolean solvable=false;
int [][]solvableArray= new int[GRID_BOUNDARY][GRID_BOUNDARY];
while(solvable==false){
SudokuUtilities.copySudokuArrayValues(solvedGame,solvableArray);
int index=0;
while(index<40){
int xCoordinate= random.nextInt(GRID_BOUNDARY);
int yCoordinates=random.nextInt(GRID_BOUNDARY);
if(solvableArray[xCoordinate][yCoordinates] !=0){
solvableArray[xCoordinate][yCoordinates]=0;
index++;
}
}
int[][] toBeSolved = new int[GRID_BOUNDARY][GRID_BOUNDARY];
SudokuUtilities.copySudokuArrayValues(solvableArray,toBeSolved);
solvable=SudokuSolver.puzzleIsSolvable(toBeSolved);
}
return solvableArray;
}
private static int[][] getSolvedGame() {
Random random= new Random(System.currentTimeMillis());
int[][] newGrid= new int[GRID_BOUNDARY][GRID_BOUNDARY];
for(int value=1; value<=GRID_BOUNDARY;value++) {
int allocations = 0;
int interrupt = 0;
List<Coordinates> allocTracker = new ArrayList<>();
int attempts = 0;
while (allocations < GRID_BOUNDARY) {
if (interrupt > 200) {
allocTracker.forEach(coord -> {
newGrid[coord.getX()][coord.getY()] = 0;
});
interrupt = 0;
allocations = 0;
allocTracker.clear();
attempts++;
if (attempts > 500) {
clearArray(newGrid);
attempts = 0;
value = 1;
}
}
int xCoordinate = random.nextInt(GRID_BOUNDARY);
int yCoordinate = random.nextInt(GRID_BOUNDARY);
if (newGrid[xCoordinate][yCoordinate] == 0) {
newGrid[xCoordinate][yCoordinate] = value;
if (GameLogic.sudokuIsInvalid(newGrid)) {
newGrid[xCoordinate][yCoordinate] = 0;
interrupt++;
} else {
allocTracker.add(new Coordinates(xCoordinate, yCoordinate));
allocations++;
}
}
}
}
return newGrid;
}
private static void clearArray(int[][] newGrid) {
for(int xIndex=0;xIndex<GRID_BOUNDARY;xIndex++){
for(int yIndex=0; yIndex<GRID_BOUNDARY; yIndex++){
newGrid[xIndex][yIndex]=0;
}
}
}
} | [
"[email protected]"
] | |
2014733ec52b3977af8e280a002ebc32ce94f82f | f48811926cdc1ad68df43c0a9472eee3e28f321e | /src/main/java/com/bjpowernode/crm/workbench/domain/Tran.java | 6ac48aec129f3a475c49e32ac05a900d4fa3e6dc | [] | no_license | tzn0125/crm2021 | f44e4b99239baf7b120aebbfd30bdd137448ac0d | da8e13b80b894a49e3fa6e49b8aa7dce4b22f8d8 | refs/heads/master | 2023-07-25T01:08:34.212594 | 2021-09-06T11:57:25 | 2021-09-06T11:57:25 | 403,386,909 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,168 | java | package com.bjpowernode.crm.workbench.domain;
public class Tran {
private String id;
private String owner;
private String money; //交易金额
private String name; //交易名称
private String expectedDate; //预计成交日期
private String customerId;
private String stage; //交易阶段
private String type; //交易类型
private String source; //交易来源
private String activityId;
private String contactsId;
private String createBy;
private String createTime;
private String editBy;
private String editTime;
private String description;
private String contactSummary; //联系纪要
private String nextContactTime; //下次联系时间
private String possibility;
public String getPossibility() {
return possibility;
}
public void setPossibility(String possibility) {
this.possibility = possibility;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
public String getMoney() {
return money;
}
public void setMoney(String money) {
this.money = money;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getExpectedDate() {
return expectedDate;
}
public void setExpectedDate(String expectedDate) {
this.expectedDate = expectedDate;
}
public String getCustomerId() {
return customerId;
}
public void setCustomerId(String customerId) {
this.customerId = customerId;
}
public String getStage() {
return stage;
}
public void setStage(String stage) {
this.stage = stage;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getActivityId() {
return activityId;
}
public void setActivityId(String activityId) {
this.activityId = activityId;
}
public String getContactsId() {
return contactsId;
}
public void setContactsId(String contactsId) {
this.contactsId = contactsId;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getEditBy() {
return editBy;
}
public void setEditBy(String editBy) {
this.editBy = editBy;
}
public String getEditTime() {
return editTime;
}
public void setEditTime(String editTime) {
this.editTime = editTime;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getContactSummary() {
return contactSummary;
}
public void setContactSummary(String contactSummary) {
this.contactSummary = contactSummary;
}
public String getNextContactTime() {
return nextContactTime;
}
public void setNextContactTime(String nextContactTime) {
this.nextContactTime = nextContactTime;
}
}
| [
"[email protected]"
] | |
553a976bfc6dcd09755a067d39d3db48d9b3f7ca | 522370099e803b14d016abaa2db03490284f20eb | /src/main/java/com/tencentcloudapi/live/v20180801/models/CreateLiveCallbackTemplateRequest.java | 4fe006b6c10cc58bb0ef7f033d7f5322c756b23d | [
"Apache-2.0"
] | permissive | diaolingzc/tencentcloud-sdk-java | 65277f6631d9d50cfc361f3f8b9401b689e0fbeb | 677fa638f037d69963751d48f055997911572c77 | refs/heads/master | 2020-09-03T09:42:09.778129 | 2019-11-05T11:42:29 | 2019-11-05T11:42:29 | 219,438,072 | 0 | 0 | Apache-2.0 | 2019-11-04T07:04:16 | 2019-11-04T07:04:16 | null | UTF-8 | Java | false | false | 8,505 | java | /*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* 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.tencentcloudapi.live.v20180801.models;
import com.tencentcloudapi.common.AbstractModel;
import com.google.gson.annotations.SerializedName;
import com.google.gson.annotations.Expose;
import java.util.HashMap;
public class CreateLiveCallbackTemplateRequest extends AbstractModel{
/**
* 模板名称,非空的字符串。
长度上限:255字节。
*/
@SerializedName("TemplateName")
@Expose
private String TemplateName;
/**
* 描述信息。
长度上限:1024字节。
*/
@SerializedName("Description")
@Expose
private String Description;
/**
* 开播回调URL,
相关协议文档:[事件消息通知](/document/product/267/32744)。
*/
@SerializedName("StreamBeginNotifyUrl")
@Expose
private String StreamBeginNotifyUrl;
/**
* 断流回调URL,
相关协议文档:[事件消息通知](/document/product/267/32744)。
*/
@SerializedName("StreamEndNotifyUrl")
@Expose
private String StreamEndNotifyUrl;
/**
* 录制回调URL,
相关协议文档:[事件消息通知](/document/product/267/32744)。
*/
@SerializedName("RecordNotifyUrl")
@Expose
private String RecordNotifyUrl;
/**
* 截图回调URL,
相关协议文档:[事件消息通知](/document/product/267/32744)。
*/
@SerializedName("SnapshotNotifyUrl")
@Expose
private String SnapshotNotifyUrl;
/**
* 鉴黄回调URL,
相关协议文档:[事件消息通知](/document/product/267/32741)。
*/
@SerializedName("PornCensorshipNotifyUrl")
@Expose
private String PornCensorshipNotifyUrl;
/**
* 回调key,回调URL公用,鉴权回调说明详见回调格式文档
*/
@SerializedName("CallbackKey")
@Expose
private String CallbackKey;
/**
* 获取模板名称,非空的字符串。
长度上限:255字节。
* @return TemplateName 模板名称,非空的字符串。
长度上限:255字节。
*/
public String getTemplateName() {
return this.TemplateName;
}
/**
* 设置模板名称,非空的字符串。
长度上限:255字节。
* @param TemplateName 模板名称,非空的字符串。
长度上限:255字节。
*/
public void setTemplateName(String TemplateName) {
this.TemplateName = TemplateName;
}
/**
* 获取描述信息。
长度上限:1024字节。
* @return Description 描述信息。
长度上限:1024字节。
*/
public String getDescription() {
return this.Description;
}
/**
* 设置描述信息。
长度上限:1024字节。
* @param Description 描述信息。
长度上限:1024字节。
*/
public void setDescription(String Description) {
this.Description = Description;
}
/**
* 获取开播回调URL,
相关协议文档:[事件消息通知](/document/product/267/32744)。
* @return StreamBeginNotifyUrl 开播回调URL,
相关协议文档:[事件消息通知](/document/product/267/32744)。
*/
public String getStreamBeginNotifyUrl() {
return this.StreamBeginNotifyUrl;
}
/**
* 设置开播回调URL,
相关协议文档:[事件消息通知](/document/product/267/32744)。
* @param StreamBeginNotifyUrl 开播回调URL,
相关协议文档:[事件消息通知](/document/product/267/32744)。
*/
public void setStreamBeginNotifyUrl(String StreamBeginNotifyUrl) {
this.StreamBeginNotifyUrl = StreamBeginNotifyUrl;
}
/**
* 获取断流回调URL,
相关协议文档:[事件消息通知](/document/product/267/32744)。
* @return StreamEndNotifyUrl 断流回调URL,
相关协议文档:[事件消息通知](/document/product/267/32744)。
*/
public String getStreamEndNotifyUrl() {
return this.StreamEndNotifyUrl;
}
/**
* 设置断流回调URL,
相关协议文档:[事件消息通知](/document/product/267/32744)。
* @param StreamEndNotifyUrl 断流回调URL,
相关协议文档:[事件消息通知](/document/product/267/32744)。
*/
public void setStreamEndNotifyUrl(String StreamEndNotifyUrl) {
this.StreamEndNotifyUrl = StreamEndNotifyUrl;
}
/**
* 获取录制回调URL,
相关协议文档:[事件消息通知](/document/product/267/32744)。
* @return RecordNotifyUrl 录制回调URL,
相关协议文档:[事件消息通知](/document/product/267/32744)。
*/
public String getRecordNotifyUrl() {
return this.RecordNotifyUrl;
}
/**
* 设置录制回调URL,
相关协议文档:[事件消息通知](/document/product/267/32744)。
* @param RecordNotifyUrl 录制回调URL,
相关协议文档:[事件消息通知](/document/product/267/32744)。
*/
public void setRecordNotifyUrl(String RecordNotifyUrl) {
this.RecordNotifyUrl = RecordNotifyUrl;
}
/**
* 获取截图回调URL,
相关协议文档:[事件消息通知](/document/product/267/32744)。
* @return SnapshotNotifyUrl 截图回调URL,
相关协议文档:[事件消息通知](/document/product/267/32744)。
*/
public String getSnapshotNotifyUrl() {
return this.SnapshotNotifyUrl;
}
/**
* 设置截图回调URL,
相关协议文档:[事件消息通知](/document/product/267/32744)。
* @param SnapshotNotifyUrl 截图回调URL,
相关协议文档:[事件消息通知](/document/product/267/32744)。
*/
public void setSnapshotNotifyUrl(String SnapshotNotifyUrl) {
this.SnapshotNotifyUrl = SnapshotNotifyUrl;
}
/**
* 获取鉴黄回调URL,
相关协议文档:[事件消息通知](/document/product/267/32741)。
* @return PornCensorshipNotifyUrl 鉴黄回调URL,
相关协议文档:[事件消息通知](/document/product/267/32741)。
*/
public String getPornCensorshipNotifyUrl() {
return this.PornCensorshipNotifyUrl;
}
/**
* 设置鉴黄回调URL,
相关协议文档:[事件消息通知](/document/product/267/32741)。
* @param PornCensorshipNotifyUrl 鉴黄回调URL,
相关协议文档:[事件消息通知](/document/product/267/32741)。
*/
public void setPornCensorshipNotifyUrl(String PornCensorshipNotifyUrl) {
this.PornCensorshipNotifyUrl = PornCensorshipNotifyUrl;
}
/**
* 获取回调key,回调URL公用,鉴权回调说明详见回调格式文档
* @return CallbackKey 回调key,回调URL公用,鉴权回调说明详见回调格式文档
*/
public String getCallbackKey() {
return this.CallbackKey;
}
/**
* 设置回调key,回调URL公用,鉴权回调说明详见回调格式文档
* @param CallbackKey 回调key,回调URL公用,鉴权回调说明详见回调格式文档
*/
public void setCallbackKey(String CallbackKey) {
this.CallbackKey = CallbackKey;
}
/**
* 内部实现,用户禁止调用
*/
public void toMap(HashMap<String, String> map, String prefix) {
this.setParamSimple(map, prefix + "TemplateName", this.TemplateName);
this.setParamSimple(map, prefix + "Description", this.Description);
this.setParamSimple(map, prefix + "StreamBeginNotifyUrl", this.StreamBeginNotifyUrl);
this.setParamSimple(map, prefix + "StreamEndNotifyUrl", this.StreamEndNotifyUrl);
this.setParamSimple(map, prefix + "RecordNotifyUrl", this.RecordNotifyUrl);
this.setParamSimple(map, prefix + "SnapshotNotifyUrl", this.SnapshotNotifyUrl);
this.setParamSimple(map, prefix + "PornCensorshipNotifyUrl", this.PornCensorshipNotifyUrl);
this.setParamSimple(map, prefix + "CallbackKey", this.CallbackKey);
}
}
| [
"[email protected]"
] | |
94127cc016b8728642ccd9956915ab1805689591 | fbdc3cdf92e3ed3bb2c0b657586d9885010323a7 | /config/src/test/java/com/yahoo/config/subscription/ConfigApiTest.java | 5419100fcf15cb7ff7101b3d3274452705e90f6d | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | mjason3/vespa | e1d7379404e9174b94603d68471949a35c3fe657 | 7d75ae24c6cbba6be53c065f59d4199b9a2b7924 | refs/heads/master | 2021-05-12T12:49:07.300046 | 2018-01-14T07:12:58 | 2018-01-14T07:12:58 | 117,419,113 | 1 | 0 | null | 2018-01-14T09:56:47 | 2018-01-14T09:56:47 | null | UTF-8 | Java | false | false | 2,126 | java | // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.subscription;
import com.yahoo.config.ConfigInstance;
import com.yahoo.foo.*;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.is;
/**
* Tests ConfigSubscriber API, and the ConfigHandle class.
*
* @author <a href="[email protected]">Harald Musum</a>
* @since 5.1
*/
public class ConfigApiTest {
private static final String CONFIG_ID = "raw:" + "times 1\n";
@Test
public void testConfigSubscriber() {
ConfigSubscriber subscriber = new ConfigSubscriber();
ConfigHandle<AppConfig> h = subscriber.subscribe(AppConfig.class, CONFIG_ID);
assertNotNull(h);
subscriber.nextConfig();
assertNotNull(h.getConfig());
assertEquals(AppConfig.CONFIG_DEF_NAME, ConfigInstance.getDefName(h.getConfig().getClass()));
assertThat(h.isChanged(), is(true));
assertTrue(h.toString().startsWith("Handle changed: true\nSub:\n"));
subscriber.close();
assertThat(subscriber.state(), is(ConfigSubscriber.State.CLOSED));
}
/**
* Verifies that we get an exception when trying to subscribe after close() has been called
* for a ConfigSubscriber
*/
@Test(expected = IllegalStateException.class)
public void testSubscribeAfterClose() {
ConfigSubscriber subscriber = new ConfigSubscriber();
subscriber.subscribe(AppConfig.class, CONFIG_ID);
subscriber.nextConfig();
subscriber.close();
subscriber.subscribe(AppConfig.class, CONFIG_ID);
}
/**
* Verifies that it is not possible to to subscribe again after calling nextConfig()
*/
@Test(expected = IllegalStateException.class)
public void testSubscribeAfterNextConfig() {
ConfigSubscriber subscriber = new ConfigSubscriber();
subscriber.subscribe(AppConfig.class, CONFIG_ID);
subscriber.nextConfig();
subscriber.subscribe(AppConfig.class, CONFIG_ID);
subscriber.close();
}
}
| [
"[email protected]"
] | |
a71b1dcd2842f1a9e40a1a7636cab675a28f93a5 | a0f1001a3e872a17d21ec76461cc6761286c5734 | /day01/WangChuJie/app/src/main/java/com/example/wangchujie/fragment/ImgFragment.java | 7b3785f87403cf905b9cb6e2603603d17a6f4ea5 | [] | no_license | JohnZhang1000/group6 | e7d0a447a77cc9e0426e9ba602fef2293d6f105a | a26297b745585e60f03264effa8a81ccb063e5f0 | refs/heads/main | 2023-02-08T22:48:08.882603 | 2021-01-05T00:26:52 | 2021-01-05T00:26:52 | 322,816,503 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,053 | java | package com.example.wangchujie.fragment;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.example.wangchujie.R;
import com.example.wangchujie.adapter.ImgFragmentAdapter;
import com.example.wangchujie.bean.ImgBean;
import com.example.wangchujie.bean.TextBean;
import com.example.wangchujie.bean.VideoBean;
import com.example.wangchujie.presenter.SofaPresenter;
import com.example.wangchujie.view.SofaView;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadmoreListener;
import java.util.ArrayList;
public class ImgFragment extends Fragment implements SofaView {
private static final String TAG = "ImgFragment";
private RecyclerView mRec;
private ArrayList<ImgBean.DataBeanX.DataBean> imgBeans;
private ImgFragmentAdapter mAdapter;
private SofaPresenter sofaPresenter;
private SmartRefreshLayout mSmart;
private int pageCount = 12;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_img, null);
initView(view);
initData();
initSmart();
return view;
}
private void initSmart() {
mSmart.setOnRefreshLoadmoreListener(new OnRefreshLoadmoreListener() {
@Override
public void onLoadmore(RefreshLayout refreshlayout) {
pageCount++;
initData();
}
@Override
public void onRefresh(RefreshLayout refreshlayout) {
pageCount = 12;
imgBeans.clear();
initData();
}
});
}
private void initData() {
sofaPresenter.getImg(pageCount);
}
private void initView(View view) {
sofaPresenter = new SofaPresenter(this);
mRec = view.findViewById(R.id.img_rec);
mSmart = view.findViewById(R.id.smart);
imgBeans = new ArrayList<>();
mRec.setLayoutManager(new LinearLayoutManager(getContext()));
mAdapter = new ImgFragmentAdapter(imgBeans,getContext());
mRec.setAdapter(mAdapter);
}
@Override
public void success(ImgBean imgBean) {
imgBeans.addAll(imgBean.getData().getData());
mAdapter.notifyDataSetChanged();
mSmart.finishRefresh();
mSmart.finishLoadmore();
}
@Override
public void fail(String msg) {
Log.d(TAG, "fail: "+msg);
}
@Override
public void getVideo(VideoBean videoBean) {
}
@Override
public void getText(TextBean textBean) {
}
}
| [
"[email protected]"
] | |
7015e56d9d9bc1110b085672627160eb08627c3d | 4b09b325bac9d595f1f2b40fbb47645028f34385 | /src/main/java/com/shop/validator/ValidationResult.java | 6ee5880014e2a766fc24194f63d9712c3b8b18e0 | [] | no_license | tlxhlll/seckill | 8f73b8191fb964e26b7dc15d396d1deb8d8ff568 | f0d43d9226e014c4d20440880ab52ce8c2c1e74d | refs/heads/master | 2023-04-13T11:49:05.823803 | 2021-04-24T03:19:26 | 2021-04-24T03:19:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 728 | java | package com.shop.validator;
import org.apache.commons.lang3.StringUtils;
import java.util.HashMap;
import java.util.Map;
public class ValidationResult {
private boolean hasErrors = false;
private Map<String, String> errorMsgMap = new HashMap<>();
public boolean isHasErrors() {
return hasErrors;
}
public void setHasErrors(boolean hasErrors) {
this.hasErrors = hasErrors;
}
public Map<String, String> getErrorMsgMap() {
return errorMsgMap;
}
public void setErrorMsgMap(Map<String, String> errorMsgMap) {
this.errorMsgMap = errorMsgMap;
}
public String getErrorMsg(){
return StringUtils.join(errorMsgMap.values().toArray(),",");
}
}
| [
"[email protected]"
] | |
3ad3ffdfb1761632a8bde43da68fd438ee4de1a3 | b00c54389a95d81a22e361fa9f8bdf5a2edc93e3 | /packages/apps/ManagedProvisioning/src/com/android/managedprovisioning/task/DeleteNonRequiredAppsTask.java | 07b9749babe52e4771b71d71d69f8b823a5bb18b | [] | no_license | mirek190/x86-android-5.0 | 9d1756fa7ff2f423887aa22694bd737eb634ef23 | eb1029956682072bb7404192a80214189f0dc73b | refs/heads/master | 2020-05-27T01:09:51.830208 | 2015-10-07T22:47:36 | 2015-10-07T22:47:36 | 41,942,802 | 15 | 20 | null | 2020-03-09T00:21:03 | 2015-09-05T00:11:19 | null | UTF-8 | Java | false | false | 13,472 | java | /*
* Copyright 2014, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.managedprovisioning.task;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.ComponentInfo;
import android.content.pm.IPackageDeleteObserver;
import android.content.pm.IPackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.Xml;
import com.android.internal.util.FastXmlSerializer;
import com.android.managedprovisioning.ProvisionLogger;
import com.android.managedprovisioning.R;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlSerializer;
/**
* Removes all system apps with a launcher that are not required.
* Also disables sharing via Bluetooth and Nfc, and components that listen to
* ACTION_INSTALL_SHORTCUT.
* This class is called a first time when a user is created, but also after a system update.
* In this case, it checks if the system apps that have been added need to be disabled.
*/
public class DeleteNonRequiredAppsTask {
private final Callback mCallback;
private final Context mContext;
private final IPackageManager mIpm;
private final String mMdmPackageName;
private final PackageManager mPm;
private final int mReqAppsList;
private final int mVendorReqAppsList;
private final int mUserId;
private final boolean mNewProfile; // If we are provisioning a new profile.
private final boolean mDisableInstallShortcutListeners;
private static final String TAG_SYSTEM_APPS = "system-apps";
private static final String TAG_PACKAGE_LIST_ITEM = "item";
private static final String ATTR_VALUE = "value";
public DeleteNonRequiredAppsTask(Context context, String mdmPackageName, int userId,
int requiredAppsList, int vendorRequiredAppsList, boolean newProfile,
boolean disableInstallShortcutListeners, Callback callback) {
mCallback = callback;
mContext = context;
mMdmPackageName = mdmPackageName;
mUserId = userId;
mIpm = IPackageManager.Stub.asInterface(ServiceManager.getService("package"));
mPm = context.getPackageManager();
mReqAppsList = requiredAppsList;
mVendorReqAppsList = vendorRequiredAppsList;
mNewProfile = newProfile;
mDisableInstallShortcutListeners = disableInstallShortcutListeners;
}
public void run() {
if (mNewProfile) {
disableNfcBluetoothSharing();
}
deleteNonRequiredApps();
}
private void disableNfcBluetoothSharing() {
ProvisionLogger.logd("Disabling Nfc and Bluetooth sharing.");
disableComponent(new ComponentName("com.android.nfc", "com.android.nfc.BeamShareActivity"));
disableComponent(new ComponentName("com.android.bluetooth",
"com.android.bluetooth.opp.BluetoothOppLauncherActivity"));
}
private void deleteNonRequiredApps() {
ProvisionLogger.logd("Deleting non required apps.");
File file = new File(mContext.getFilesDir() + File.separator + "system_apps"
+ File.separator + "user" + mUserId + ".xml");
file.getParentFile().mkdirs(); // Creating the folder if it does not exist
Set<String> currentApps = getCurrentSystemApps();
Set<String> previousApps;
if (mNewProfile) {
// If this userId was a managed profile before, file may exist. In this case, we ignore
// what is in this file.
previousApps = new HashSet<String>();
} else {
if (file.exists()) {
previousApps = readSystemApps(file);
} else {
// If for some reason, the system apps have not been written to file before, we will
// not delete any system apps this time.
writeSystemApps(currentApps, file);
mCallback.onSuccess();
return;
}
}
writeSystemApps(currentApps, file);
Set<String> newApps = currentApps;
newApps.removeAll(previousApps);
if (mDisableInstallShortcutListeners) {
Intent actionShortcut = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
if (previousApps.isEmpty()) {
// Here, all the apps are in newApps.
// It is faster to do it this way than to go through all the apps one by one.
disableReceivers(actionShortcut);
} else {
// Here, all the apps are not in newApps. So we have to go through all the new
// apps one by one.
for (String newApp : newApps) {
actionShortcut.setPackage(newApp);
disableReceivers(actionShortcut);
}
}
}
Set<String> packagesToDelete = newApps;
packagesToDelete.removeAll(getRequiredApps());
packagesToDelete.retainAll(getCurrentAppsWithLauncher());
// com.android.server.telecom should not handle CALL intents in the managed profile.
if (mNewProfile) {
packagesToDelete.add("com.android.server.telecom");
}
int size = packagesToDelete.size();
if (size > 0) {
PackageDeleteObserver packageDeleteObserver =
new PackageDeleteObserver(packagesToDelete.size());
for (String packageName : packagesToDelete) {
try {
mIpm.deletePackageAsUser(packageName, packageDeleteObserver, mUserId,
PackageManager.DELETE_SYSTEM_APP);
} catch (RemoteException neverThrown) {
// Never thrown, as we are making local calls.
ProvisionLogger.loge("This should not happen.", neverThrown);
}
}
} else {
mCallback.onSuccess();
}
}
private void disableReceivers(Intent intent) {
List<ResolveInfo> receivers = mPm.queryBroadcastReceivers(intent, 0, mUserId);
for (ResolveInfo ri : receivers) {
// One of ri.activityInfo, ri.serviceInfo, ri.providerInfo is not null. Let's find which
// one.
ComponentInfo ci;
if (ri.activityInfo != null) {
ci = ri.activityInfo;
} else if (ri.serviceInfo != null) {
ci = ri.serviceInfo;
} else {
ci = ri.providerInfo;
}
disableComponent(new ComponentName(ci.packageName, ci.name));
}
}
private void disableComponent(ComponentName toDisable) {
try {
mIpm.setComponentEnabledSetting(toDisable,
PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP,
mUserId);
} catch (RemoteException neverThrown) {
ProvisionLogger.loge("This should not happen.", neverThrown);
} catch (Exception e) {
ProvisionLogger.logw("Component not found, not disabling it: "
+ toDisable.toShortString());
}
}
/**
* Returns the set of package names of apps that are in the system image,
* whether they have been deleted or not.
*/
private Set<String> getCurrentSystemApps() {
Set<String> apps = new HashSet<String>();
List<ApplicationInfo> aInfos = null;
try {
aInfos = mIpm.getInstalledApplications(
PackageManager.GET_UNINSTALLED_PACKAGES, mUserId).getList();
} catch (RemoteException neverThrown) {
// Never thrown, as we are making local calls.
ProvisionLogger.loge("This should not happen.", neverThrown);
}
for (ApplicationInfo aInfo : aInfos) {
if ((aInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
apps.add(aInfo.packageName);
}
}
return apps;
}
private Set<String> getCurrentAppsWithLauncher() {
Intent launcherIntent = new Intent(Intent.ACTION_MAIN);
launcherIntent.addCategory(Intent.CATEGORY_LAUNCHER);
List<ResolveInfo> resolveInfos = mPm.queryIntentActivitiesAsUser(launcherIntent,
PackageManager.GET_UNINSTALLED_PACKAGES, mUserId);
Set<String> apps = new HashSet<String>();
for (ResolveInfo resolveInfo : resolveInfos) {
apps.add(resolveInfo.activityInfo.packageName);
}
return apps;
}
private void writeSystemApps(Set<String> packageNames, File file) {
try {
FileOutputStream stream = new FileOutputStream(file, false);
XmlSerializer serializer = new FastXmlSerializer();
serializer.setOutput(stream, "utf-8");
serializer.startDocument(null, true);
serializer.startTag(null, TAG_SYSTEM_APPS);
for (String packageName : packageNames) {
serializer.startTag(null, TAG_PACKAGE_LIST_ITEM);
serializer.attribute(null, ATTR_VALUE, packageName);
serializer.endTag(null, TAG_PACKAGE_LIST_ITEM);
}
serializer.endTag(null, TAG_SYSTEM_APPS);
serializer.endDocument();
stream.close();
} catch (IOException e) {
ProvisionLogger.loge("IOException trying to write the system apps", e);
}
}
private Set<String> readSystemApps(File file) {
Set<String> result = new HashSet<String>();
if (!file.exists()) {
return result;
}
try {
FileInputStream stream = new FileInputStream(file);
XmlPullParser parser = Xml.newPullParser();
parser.setInput(stream, null);
int type = parser.next();
int outerDepth = parser.getDepth();
while ((type=parser.next()) != XmlPullParser.END_DOCUMENT
&& (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
continue;
}
String tag = parser.getName();
if (tag.equals(TAG_PACKAGE_LIST_ITEM)) {
result.add(parser.getAttributeValue(null, ATTR_VALUE));
} else {
ProvisionLogger.loge("Unknown tag: " + tag);
}
}
stream.close();
} catch (IOException e) {
ProvisionLogger.loge("IOException trying to read the system apps", e);
} catch (XmlPullParserException e) {
ProvisionLogger.loge("XmlPullParserException trying to read the system apps", e);
}
return result;
}
protected Set<String> getRequiredApps() {
HashSet<String> requiredApps = new HashSet<String> (Arrays.asList(
mContext.getResources().getStringArray(mReqAppsList)));
requiredApps.addAll(Arrays.asList(
mContext.getResources().getStringArray(mVendorReqAppsList)));
requiredApps.add(mMdmPackageName);
return requiredApps;
}
/**
* Runs the next task when all packages have been deleted or shuts down the activity if package
* deletion fails.
*/
class PackageDeleteObserver extends IPackageDeleteObserver.Stub {
private final AtomicInteger mPackageCount = new AtomicInteger(0);
public PackageDeleteObserver(int packageCount) {
this.mPackageCount.set(packageCount);
}
@Override
public void packageDeleted(String packageName, int returnCode) {
if (returnCode != PackageManager.DELETE_SUCCEEDED) {
ProvisionLogger.logw(
"Could not finish the provisioning: package deletion failed");
mCallback.onError();
}
int currentPackageCount = mPackageCount.decrementAndGet();
if (currentPackageCount == 0) {
ProvisionLogger.logi("All non-required system apps have been uninstalled.");
mCallback.onSuccess();
}
}
}
public abstract static class Callback {
public abstract void onSuccess();
public abstract void onError();
}
}
| [
"[email protected]"
] | |
c8a5d587c7fefa416ea6e1f3150d6acf90b6d2d8 | ebcf79a04e074dfc752950786b482b8b87a7a3a6 | /src/main/java/com/springboot/Cd11Application.java | c310d4d40cfbf0e8cf2ca21cb6f799ca39097272 | [
"Apache-2.0"
] | permissive | spring-team/cd11 | bc18285981617344c06ebafb1e729c3c3a354f6f | 16af63680dd82861cea56221fe22289e6b68f392 | refs/heads/master | 2021-09-11T14:26:28.186763 | 2018-03-24T04:18:54 | 2018-03-24T04:18:54 | 125,800,963 | 0 | 0 | Apache-2.0 | 2018-04-05T01:10:05 | 2018-03-19T04:22:33 | Shell | UTF-8 | Java | false | false | 302 | java | package com.springboot;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Cd11Application {
public static void main(String[] args) {
SpringApplication.run(Cd11Application.class, args);
}
}
| [
"[email protected]"
] | |
e9f3ba8e74da491254a3c44868826ed24560099a | e71259a84b787fa6a0f75940a2ff8d4bdf4a939a | /chapter1_2/GeneralizedArrayQueue.java | 63560e1ae7534b85f085b6491095a5bfbfd69f94 | [] | no_license | yuwensong0/Algorithms4 | 2ad4d79587ea4c5cf0db65150d5b8e484c404246 | aca70bad61575df0484c21fd192fb80843d173c0 | refs/heads/master | 2021-08-06T13:07:52.043203 | 2017-09-26T05:51:24 | 2017-09-26T05:51:24 | 95,553,608 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,006 | java | package chapter1_2;
public class GeneralizedArrayQueue<E> {
private E[] queue = (E[]) new Object[1];
private int N = 0;
private void resize(int max) {
E[] temp = (E[]) new Object[max];
for (int i = 0; i < N; i++) {
temp[i] = queue[i];
}
queue = temp;
}
public boolean isEmpty() {
return N == 0;
}
public void insert(E e) {
if (N == queue.length) {
resize(2 * N);
}
queue[N++] = e;
}
public E delete(int k) {
if (k > N) {
return null;
}
E e = queue[k - 1];
for (int i = k - 1; i < N; i++) {
queue[i] = queue[i + 1];
}
N--;
return e;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
GeneralizedArrayQueue<Integer> queue = new GeneralizedArrayQueue<>();
System.out.println(queue.isEmpty());
queue.insert(1);
queue.insert(2);
queue.insert(3);
System.out.println(queue.delete(2));
System.out.println(queue.delete(2));
System.out.println(queue.delete(2));
System.out.println(queue.isEmpty());
}
}
| [
"[email protected]"
] | |
a52208caec3fafcd4ef1229b094adccc3a08cab6 | 5202202519ac47ca6649a832c7c03395308ef567 | /app/src/main/java/com/example/myapplication/FoodList.java | 6f594660c00cfa597ccf36332f8223a5177bf0dc | [] | no_license | hasantunahan/MyApplication | 21a0e73926d353f60d2ea0c2bac0032ed49102d2 | 70d9aca8a93740d8c9aa8691934f962728bc2ea1 | refs/heads/master | 2022-04-08T22:28:36.955679 | 2020-03-17T07:27:13 | 2020-03-17T07:27:13 | 194,802,360 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,004 | java | package com.example.myapplication;
import android.content.Intent;
import android.graphics.Color;
import android.icu.text.DecimalFormat;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.RequiresApi;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.andremion.counterfab.CounterFab;
import com.bumptech.glide.Glide;
import com.example.myapplication.Common.Common;
import com.example.myapplication.Database.Database;
import com.example.myapplication.Interface.ItemClickListener;
import com.example.myapplication.Model.Food;
import com.example.myapplication.Model.Order;
import com.example.myapplication.Model.Rating;
import com.example.myapplication.ViewHolder.FoodViewHolder;
import com.firebase.ui.database.FirebaseRecyclerAdapter;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.mancj.materialsearchbar.MaterialSearchBar;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class FoodList extends AppCompatActivity {
RecyclerView recyclerView;
RecyclerView.LayoutManager layoutManager;
CounterFab fab;
FirebaseDatabase database;
DatabaseReference foodList;
private Intent intent;
private TextView urunlistesi_ismi;
private ImageView geriButton;
String categoryId="";
private int begenisayisi;
private String foodidKey;
private ImageView searchImage;
FirebaseRecyclerAdapter<Food, FoodViewHolder> adapter;
//arama
FirebaseRecyclerAdapter<Food,FoodViewHolder> searchAdapter;
List<String> suggestList=new ArrayList<>();
MaterialSearchBar searchView;
Database localDB;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_food_list);
//categori ismi icin
urunlistesi_ismi=findViewById(R.id.urunlistesi);
geriButton=findViewById(R.id.geriFoodlist);
searchImage=findViewById(R.id.searcImage);
searchImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
searchView.setVisibility(View.VISIBLE);
}
});
intent=getIntent();
String kategori_ismi=intent.getStringExtra("kategori_ismi");
urunlistesi_ismi.setText(kategori_ismi);
geriButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(FoodList.this,Home.class);
startActivity(intent);
}
});
//Fİrebase
database = FirebaseDatabase.getInstance();
foodList=database.getReference("Food");
localDB =new Database(this);
recyclerView =(RecyclerView) findViewById(R.id.recycler_food);
recyclerView.setHasFixedSize(true);
layoutManager=new GridLayoutManager(this,1);
recyclerView.setLayoutManager(layoutManager);
//intent çapırdık
if(getIntent()!=null)
categoryId = getIntent().getStringExtra("CategoryId");
if(!categoryId.isEmpty() && categoryId !=null)
{
if(Common.isConnectedToInternet(getApplicationContext()))
loadListFood(categoryId);
else{
Toast.makeText(FoodList.this, "İnternet bağlantınızı kontrol ediniz", Toast.LENGTH_SHORT).show();
return;
}
}
searchView=(MaterialSearchBar) findViewById(R.id.searchBar);
searchView.setHint("Buradan arayabilirsiniz");
searchView.setTextColor(Color.BLUE); // set the text color
fab = (CounterFab) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent cartIntent = new Intent(FoodList.this,Cart.class);
startActivity(cartIntent);
}
});
fab.setCount(new Database(this).getCountCart());
//Önerileri yükle
loadSuggest();
searchView.setLastSuggestions(suggestList);
searchView.setCardViewElevation(10);
searchView.addTextChangeListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
List<String> suggest=new ArrayList<String>();
for(String search:suggestList){
if(search.toLowerCase().contains(searchView.getText().toLowerCase()))
suggest.add(search);
}
searchView.setLastSuggestions(suggest);
}
@Override
public void afterTextChanged(Editable s) {
}
});
searchView.setOnSearchActionListener(new MaterialSearchBar.OnSearchActionListener() {
@Override
public void onSearchStateChanged(boolean enabled) {
if(!enabled)
recyclerView.setAdapter(adapter);
}
@Override
public void onSearchConfirmed(CharSequence text) {
startSearch(text);
}
@Override
public void onButtonClicked(int buttonCode) {
}
});
}
private void startSearch(CharSequence text) {
searchAdapter=new FirebaseRecyclerAdapter<Food, FoodViewHolder>(
Food.class,
R.layout.food_item,
FoodViewHolder.class,
foodList.orderByChild("name").equalTo(text.toString())
) {
@Override
protected void populateViewHolder(FoodViewHolder viewHolder, Food model, int position) {
String buyuk=model.getName().toUpperCase();
viewHolder.food_name.setText(buyuk);
/* Picasso.with(getBaseContext()).load(model.getImage())
.into(viewHolder.food_image);*/
// Picasso.get().load(model.getImage()).resize(100,100).centerCrop().into(viewHolder.food_image);
Glide.with(getApplicationContext()).load(model.getImage()).into(viewHolder.food_image);
final Food local=model;
viewHolder.setItemClickListener(new ItemClickListener() {
@Override
public void onClick(View view, int position, boolean isLongClick) {
Intent foodDetail=new Intent(FoodList.this,FoodDetail.class);
foodDetail.putExtra("FoodId",searchAdapter.getRef(position).getKey());
startActivity(foodDetail);
}
});
}
};//
recyclerView.setAdapter(searchAdapter);
}//
private void loadSuggest() {
foodList.orderByChild("menuId").equalTo(categoryId)
.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for(DataSnapshot postSnapshot:dataSnapshot.getChildren()){
Food item=postSnapshot.getValue(Food.class);
suggestList.add(item.getName());
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
private void loadListFood(String categoryId) {
adapter=new FirebaseRecyclerAdapter<Food, FoodViewHolder>(Food.class,
R.layout.food_item,
FoodViewHolder.class,
foodList.orderByChild("menuId").equalTo(categoryId)) {
@Override
protected void populateViewHolder(final FoodViewHolder viewHolder, final Food model, final int position) {
viewHolder.food_name.setText(model.getName().toUpperCase());
viewHolder.price.setText(model.getPrice()+" ₺");
/* Picasso.with(getBaseContext()).load(model.getImage())
.into(viewHolder.food_image);*/
Glide.with(FoodList.this).load(model.getImage()).into(viewHolder.food_image);
// Picasso.get().load(model.getImage()).resize(100,100).centerCrop().into(viewHolder.food_image);
//Picasso.get().load(model.getImage()).resize(1000,1000).centerCrop().into(viewHolder.food_image);
viewHolder.sepet_image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Database(getBaseContext()).addToChart(new Order(
adapter.getRef(position).getKey(),
model.getName(),
"1",
model.getPrice().toString(),
model.getDiscount()
));
Toast.makeText(FoodList.this,"Sepete eklendi",Toast.LENGTH_SHORT).show();
fab.setCount(new Database(getApplicationContext()).getCountCart());
}
});
viewHolder.share_image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent shareIntent =new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
String sharedBody="body";
String shareSub="sub";
shareIntent.putExtra(Intent.EXTRA_SUBJECT,shareSub);
shareIntent.putExtra(Intent.EXTRA_SUBJECT,sharedBody);
startActivity(Intent.createChooser(shareIntent,"Paylaş"));
}
});
/*viewHolder.yorumlar_image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(FoodList.this,Yorumlar.class);
intent.putExtra("FoodId",adapter.getRef(position).getKey());
startActivity(intent);
}
});*/
//likeeee
/* if(localDB.isFavorite(adapter.getRef(position).getKey()))
viewHolder.fav_image.setImageResource(R.drawable.ic_favorite_black_24dp);
viewHolder.fav_image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(!localDB.isFavorite(adapter.getRef(position).getKey()))
{
localDB.addToFavorites(adapter.getRef(position).getKey());
viewHolder.fav_image.setImageResource(R.drawable.ic_favorite_black_24dp);
Toast.makeText(FoodList.this, "Favorilere eklendi", Toast.LENGTH_SHORT).show();
}
else {
localDB.removeFromFavorites(adapter.getRef(position).getKey());
viewHolder.fav_image.setImageResource(R.drawable.ic_favorite_border_black_24dp);
Toast.makeText(FoodList.this, "Favorilerden silindi", Toast.LENGTH_SHORT).show();
}
}
});*/
////fav_basla
//viewHolder.fav_image.setImageResource(R.drawable.ic_favorite_black_24dp);
final DatabaseReference fav_Ref=FirebaseDatabase.getInstance().getReference("Favori");
fav_Ref.child(FirebaseAuth.getInstance().getCurrentUser().getDisplayName()).child(adapter.getRef(position).getKey()).addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
if( dataSnapshot.exists()){
viewHolder.fav_image.setImageResource(R.drawable.ic_favorite_black_24dp);
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
viewHolder.fav_image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
fav_Ref.child(FirebaseAuth.getInstance().getCurrentUser().getDisplayName()).child(adapter.getRef(position).getKey()).addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
if(!dataSnapshot.exists()){
HashMap<String,Object> hashMap=new HashMap<>();
hashMap.put("name",model.getName());
hashMap.put("image",model.getImage());
hashMap.put("description",model.getDescription());
hashMap.put("foodId",model.getFoodId());
hashMap.put("price",model.getPrice());
hashMap.put("discount",model.getDiscount());
hashMap.put("menuId",model.getMenuId());
DatabaseReference reference2=FirebaseDatabase.getInstance().getReference("Favori");
reference2.child(FirebaseAuth.getInstance().getCurrentUser().getDisplayName()).child(adapter.getRef(position).getKey()).setValue(hashMap);
viewHolder.fav_image.setImageResource(R.drawable.ic_favorite_black_24dp);
Toast.makeText(FoodList.this, "Favorilere eklendi", Toast.LENGTH_SHORT).show();
Intent intent=new Intent(FoodList.this,Favoriler.class);
intent.putExtra("FoodId",adapter.getRef(position).getKey());
// startActivity(intent);
}else{
fav_Ref.child(FirebaseAuth.getInstance().getCurrentUser().getDisplayName()).child(adapter.getRef(position).getKey()).removeValue();
viewHolder.fav_image.setImageResource(R.drawable.ic_favorite_border_black_24dp);
Toast.makeText(FoodList.this, "Favorilerden silindi", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
});
///fav_bitti
final Food local=model;
viewHolder.setItemClickListener(new ItemClickListener() {
@Override
public void onClick(View view, int position, boolean isLongClick) {
Intent foodDetail=new Intent(FoodList.this,FoodDetail.class);
foodDetail.putExtra("FoodId",adapter.getRef(position).getKey());
startActivity(foodDetail);
}
});
FirebaseDatabase.getInstance().getReference("Rating").child(adapter.getRef(position).getKey()).addValueEventListener(new ValueEventListener() {
int count=0;
float sum=0;
@RequiresApi(api = Build.VERSION_CODES.N)
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
if(dataSnapshot.exists()){
for (DataSnapshot snapshot : dataSnapshot.getChildren()){
Rating r= snapshot.getValue(Rating.class);
if(r.getFoodId().equals(adapter.getRef(position).getKey())){
count++;
sum += Float.parseFloat(r.getRateValues());
}
}
if( count !=0){
float avg=sum/count;
String x = new DecimalFormat("#,#0.0").format(avg);
viewHolder.yorumsayisi.setText("("+count+" yorum)");
if(avg >=4){
//iewHolder.kalitekontrol.setVisibility(View.VISIBLE);
viewHolder.ratingOrt.setText(x);
viewHolder.ratingBarfoodlist.setRating(avg);
}
}
count=0;
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}//viewHolder bitiş
};//fonk
recyclerView.setAdapter(adapter);
}
@Override
protected void onResume() {
super.onResume();
fab.setCount(new Database(this).getCountCart());
}
}
| [
"[email protected]"
] | |
45a484a3012f969a7ee592cfa2c47b85efeb16a6 | 297accaf59d0f0d5c957534432ec7a69288ccb97 | /src/shopping/visitor/bundleDiscountVisitor.java | f6f01c15c68131035e461fab57abc07e37b6d8c0 | [] | no_license | SimingZheng/Shopping_System | e5bb62ee1a5a90d5e01736c9d7e7e2bad0ab03af | 6d4fb5042db8a13eb90815d08d48b051e61f0f62 | refs/heads/master | 2023-04-15T22:46:27.771576 | 2021-04-21T02:43:29 | 2021-04-21T02:43:29 | 308,734,812 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 599 | java | package shopping.visitor;
public class bundleDiscountVisitor implements visitor{
private double furnitureBundlingCost;
private double electricProductBundlingCost;
//collect data about the book
@Override
public double visit(furniture furniture){
furnitureBundlingCost += furniture.getPrice() * 0.8;
return furnitureBundlingCost;
}
//add other visitors here
@Override
public double visit(electricProduct electricProduct){
electricProductBundlingCost += electricProduct.getPrice() * 0.9;
return electricProductBundlingCost;
}
}
| [
"[email protected]"
] | |
ef775f10edbb32e4f752e959c702dad3a25e93a0 | a5948828d8101231cdc3a551f8c228eb7be1b872 | /s-ramp-api/src/main/java/org/s_ramp/xmlns/_2010/s_ramp/ServiceComposition.java | 3ac2cb4efaa7440573e57951aeb3432a4b5754a1 | [] | no_license | tejones/s-ramp | dcc1bcee84afde6a962755df3693f6b15416e446 | 580b0a0aa105e401e249ed67630b5972dca31d91 | refs/heads/master | 2021-01-17T12:49:29.544731 | 2013-01-17T18:26:16 | 2013-01-17T18:26:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,832 | java | /*
* Copyright 2011 JBoss Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.09.05 at 05:25:27 PM EDT
//
package org.s_ramp.xmlns._2010.s_ramp;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for ServiceComposition complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ServiceComposition">
* <complexContent>
* <extension base="{http://s-ramp.org/xmlns/2010/s-ramp}Composition">
* <anyAttribute/>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ServiceComposition")
public class ServiceComposition
extends Composition
implements Serializable
{
private static final long serialVersionUID = -509452316952780407L;
}
| [
"[email protected]"
] | |
70c346fbf2ba4f257bd122ba5163856f1c8ab84c | 4d702835e9b4f82e71a87926f87bdca09ae0e182 | /src/main/java/com/epam/yevheniy/chornenky/market/place/filters/EncodingFilter.java | 842252d019178e92b95d606bfe0b54111a2a703a | [] | no_license | uadima/SERVLET-API-TRAINING | 18539051bf50ea7322a01ea2f770ae9f9b1e84b5 | 0a6ca6f13facaee9eaae150d0bb05c8ad3e25e74 | refs/heads/master | 2023-07-25T03:33:08.073261 | 2021-09-03T23:34:05 | 2021-09-03T23:34:05 | 402,920,372 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 526 | java | package com.epam.yevheniy.chornenky.market.place.filters;
import javax.servlet.*;
import java.io.IOException;
public class EncodingFilter implements Filter {
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
try {
filterChain.doFilter(servletRequest, servletResponse);
}
finally {
servletResponse.setContentType("text/html; charset=UTF-8");
}
}
}
| [
"evgeny,[email protected]"
] | evgeny,[email protected] |
98d1f0fc9fb0a5e05ae15df16e39d399b7775cbc | 74b47b895b2f739612371f871c7f940502e7165b | /aws-java-sdk-sagemaker/src/main/java/com/amazonaws/services/sagemaker/model/transform/FileSystemDataSourceMarshaller.java | d035f86095ccfce67ca1a97845e94ef9ca310180 | [
"Apache-2.0"
] | permissive | baganda07/aws-sdk-java | fe1958ed679cd95b4c48f971393bf03eb5512799 | f19bdb30177106b5d6394223a40a382b87adf742 | refs/heads/master | 2022-11-09T21:55:43.857201 | 2022-10-24T21:08:19 | 2022-10-24T21:08:19 | 221,028,223 | 0 | 0 | Apache-2.0 | 2019-11-11T16:57:12 | 2019-11-11T16:57:11 | null | UTF-8 | Java | false | false | 3,036 | java | /*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.sagemaker.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.sagemaker.model.*;
import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;
/**
* FileSystemDataSourceMarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class FileSystemDataSourceMarshaller {
private static final MarshallingInfo<String> FILESYSTEMID_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("FileSystemId").build();
private static final MarshallingInfo<String> FILESYSTEMACCESSMODE_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("FileSystemAccessMode").build();
private static final MarshallingInfo<String> FILESYSTEMTYPE_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("FileSystemType").build();
private static final MarshallingInfo<String> DIRECTORYPATH_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("DirectoryPath").build();
private static final FileSystemDataSourceMarshaller instance = new FileSystemDataSourceMarshaller();
public static FileSystemDataSourceMarshaller getInstance() {
return instance;
}
/**
* Marshall the given parameter object.
*/
public void marshall(FileSystemDataSource fileSystemDataSource, ProtocolMarshaller protocolMarshaller) {
if (fileSystemDataSource == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(fileSystemDataSource.getFileSystemId(), FILESYSTEMID_BINDING);
protocolMarshaller.marshall(fileSystemDataSource.getFileSystemAccessMode(), FILESYSTEMACCESSMODE_BINDING);
protocolMarshaller.marshall(fileSystemDataSource.getFileSystemType(), FILESYSTEMTYPE_BINDING);
protocolMarshaller.marshall(fileSystemDataSource.getDirectoryPath(), DIRECTORYPATH_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| [
""
] | |
c834b2debdab55a685b66d3868ed7d616f23ba42 | e37a100903339649df1fd2b013b996f75bb0877a | /Proj08JerseyFirstApp/src/main/java/com/nt/gauti/EmployeeRest.java | e0ea781ec4f8c5d942d816c3d5f8f7408f609e06 | [] | no_license | GautRepo/webClass | 0fba39e102e678ae426722f58639538c95f8275c | 289a14b9aa8ea23e8608460459f2c9649182da36 | refs/heads/master | 2023-04-01T02:08:01.043122 | 2021-04-05T11:51:38 | 2021-04-05T11:51:38 | 348,030,870 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 218 | java | package com.nt.gauti;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@Path("/emp")
public class EmployeeRest {
@GET
@Path("/msg")
public String getMsg() {
return "This is my first App";
}
}
| [
"Dell@DESKTOP-7EO5D98"
] | Dell@DESKTOP-7EO5D98 |
979464cb4995f82ee0a92fabf0bda94826644371 | e1cdf800029497003d14dff4aa70ebcaedd0c92c | /Mp Salesperson 2/AmitLibs/src/com/Amitlibs/utils/MemoryCache.java | 271e48318159d77cfac20607add78bbd6911b1fa | [] | no_license | HarshitaInani/salespersonApp | 0c3629e537c30c188ed1a6f1fb151cdba9bc439a | f3ea2e4c5075751ffb0aa710715441d1369d455f | refs/heads/master | 2020-03-29T01:37:33.919697 | 2018-09-19T05:54:14 | 2018-09-19T05:54:14 | 149,398,425 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,295 | java | package com.Amitlibs.utils;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import android.graphics.Bitmap;
import android.util.Log;
public class MemoryCache {
private static final String TAG = "MemoryCache";
private Map<String, Bitmap> cache = Collections.synchronizedMap(new LinkedHashMap<String, Bitmap>(10, 1.5f, true));// Last argument true
// for LRU ordering
private long size = 0;// current allocated size
private long limit = 1000000;// max memory in bytes
public MemoryCache() {
// use 25% of available heap size
setLimit(Runtime.getRuntime().maxMemory() / 4);
}
public void setLimit(long new_limit) {
limit = new_limit;
Log.i(TAG, "MemoryCache will use up to " + limit / 1024. / 1024. + "MB");
}
public Bitmap get(String id) {
try {
if (!cache.containsKey(id))
return null;
// NullPointerException sometimes happen here http://code.google.com/p/osmdroid/issues/detail?id=78
return cache.get(id);
} catch (NullPointerException ex) {
ex.printStackTrace();
return null;
}
}
public void put(String id, Bitmap bitmap) {
try {
if (cache.containsKey(id))
size -= getSizeInBytes(cache.get(id));
cache.put(id, bitmap);
size += getSizeInBytes(bitmap);
checkSize();
} catch (Throwable th) {
th.printStackTrace();
}
}
private void checkSize() {
Log.i(TAG, "cache size=" + size + " length=" + cache.size());
if (size > limit) {
Iterator<Entry<String, Bitmap>> iter = cache.entrySet().iterator();// least recently accessed item will be the first one
// iterated
while (iter.hasNext()) {
Entry<String, Bitmap> entry = iter.next();
size -= getSizeInBytes(entry.getValue());
iter.remove();
if (size <= limit)
break;
}
Log.i(TAG, "Clean cache. New size " + cache.size());
}
}
public void clear() {
try {
// NullPointerException sometimes happen here http://code.google.com/p/osmdroid/issues/detail?id=78
cache.clear();
size = 0;
} catch (NullPointerException ex) {
ex.printStackTrace();
}
}
long getSizeInBytes(Bitmap bitmap) {
if (bitmap == null)
return 0;
return bitmap.getRowBytes() * bitmap.getHeight();
}
} | [
"[email protected]"
] | |
2b5c1cb9ee55aba47b4a78687e6557ac1b13fcf4 | 61464a8686141a3153acb9c980cf5b5d2f737171 | /soul-ee/src/test/java/com/jason/common/utils/ResourceUtilsExample.java | dcae707378537a13962600f1602a45a6b56192b1 | [
"Apache-2.0"
] | permissive | sdpku/JavaSamples | f8c2ee9e3cf66508fe87f4ceca42ad12b68780dd | db0123c12e5de92b08160568708a0a70690761ff | refs/heads/master | 2020-06-06T22:15:26.310365 | 2017-05-17T17:44:08 | 2017-05-17T17:44:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,541 | java | package com.jason.common.utils;
import java.io.File;
import org.springframework.util.ResourceUtils;
/**
* @ClassName: ResourceUtilsExample
* @Description: TODO(地址加载文件资源)
* @author Jason Chiu:[email protected]
* @date 2013-8-16 下午05:51:06
*
*/
//对于位于远程服务器(Web 服务器或 FTP 服务器)的文件资源,您则可以方便地通过 UrlResource 进行访问。
//为了方便访问不同类型的资源,您必须使用相应的 Resource 实现类,是否可以在不显式使用 Resource 实现类的情况下,仅根据带特殊前缀的资源地址直接加载文件资源呢? Spring 提供了一个 ResourceUtils 工具类,它支持“classpath:”和“file:”的地址前缀,它能够从指定的地址加载文件资源,请看下面的例子:
//虽然 JDK 的 java.util.ResourceBundle 类也可以通过相似的方式获取本地化文件资源,但是其返回的是 ResourceBundle 类型的对象。如果您决定统一使用 Spring 的 Resource 接表征文件资源,那么 LocalizedResourceHelper 就是获取文件资源的非常适合的帮助类了。
public class ResourceUtilsExample {
public static void main(String[] args) throws Throwable {
File clsFile = ResourceUtils.getFile("classpath:conf/file1.txt");
System.out.println(clsFile.isFile());
String httpFilePath = "file:D:/masterSpring/chapter23/src/conf/file1.txt";
File httpFile = ResourceUtils.getFile(httpFilePath);
System.out.println(httpFile.isFile());
}
} | [
"[email protected]"
] | |
c17aa2174ca99c5bc4d23d969b3b2fd1ccee223e | d9e01f7097c29e1fe644f31d25669a3f37b5227a | /cloud-mall-cart-order/src/main/java/com/imooc/cloud/mall/practice/cartorder/feign/ProductFeignClient.java | 7288a3a614574f4197ccd8c93fbb8c3ca27659d9 | [] | no_license | Rex0520/imooc-mall-cloud | 5baf86e67759b4485a51e4713f7dcd91581ce0fe | 961f975528eb203a2c24ebe216b6d022acdd59c8 | refs/heads/master | 2023-06-19T08:46:15.285063 | 2021-07-20T07:38:01 | 2021-07-20T07:38:01 | 387,717,494 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 760 | java | package com.imooc.cloud.mall.practice.cartorder.feign;
import com.imooc.cloud.mall.practice.categoryproduct.model.pojo.Product;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @description: 商品FeignClient
* @author: Rex
* @create: 2021-07-13 19:07
*/
@FeignClient(value = "cloud-mall-category-product")
public interface ProductFeignClient {
@GetMapping("product/detailForFeign")
Product detailForFeign(@RequestParam Integer id);
@PostMapping("product/updateStock")
void updateStock(@RequestParam Integer productId, @RequestParam Integer stock);
}
| [
"[email protected]"
] | |
023f91f8097ba73d3d7e03d13db1e116d4ca9f3e | 5d070f3bccd54cddb3259102f2019443298126db | /com/chartboost/sdk/impl/bw.java | 73514f4c2da758b33898bf8b7f100fa7aaf46121 | [] | no_license | ajayscariya/Touch2Kill-files | 683e5d002df2d23b084ab5b0786762e14f038ba0 | 7660e584c5b7f743a1535b75476d1c0ef050dc7e | refs/heads/master | 2020-04-10T19:06:11.795665 | 2016-09-14T17:19:20 | 2016-09-14T17:19:20 | 68,216,032 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,000 | java | package com.chartboost.sdk.impl;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
public class bw {
public static final char f1078a;
public static final String f1079b;
static {
f1078a = File.separatorChar;
Writer bxVar = new bx(4);
PrintWriter printWriter = new PrintWriter(bxVar);
printWriter.println();
f1079b = bxVar.toString();
printWriter.close();
}
public static void m1070a(InputStream inputStream) {
m1069a((Closeable) inputStream);
}
public static void m1071a(OutputStream outputStream) {
m1069a((Closeable) outputStream);
}
public static void m1069a(Closeable closeable) {
if (closeable != null) {
try {
closeable.close();
} catch (IOException e) {
}
}
}
public static byte[] m1073a(InputStream inputStream, long j) throws IOException {
if (j <= 2147483647L) {
return m1072a(inputStream, (int) j);
}
throw new IllegalArgumentException("Size cannot be greater than Integer max value: " + j);
}
public static byte[] m1072a(InputStream inputStream, int i) throws IOException {
int i2 = 0;
if (i < 0) {
throw new IllegalArgumentException("Size must be equal or greater than zero: " + i);
} else if (i == 0) {
return new byte[0];
} else {
byte[] bArr = new byte[i];
while (i2 < i) {
int read = inputStream.read(bArr, i2, i - i2);
if (read == -1) {
break;
}
i2 += read;
}
if (i2 == i) {
return bArr;
}
throw new IOException("Unexpected readed size. current: " + i2 + ", excepted: " + i);
}
}
}
| [
"[email protected]"
] | |
3a2e166f61cc9ef402b11438036bb5bedeba3943 | 31e2712e42fc67727738cb364eac494bcc1bc16a | /src/main/java/ro/tuc/ds2020/services/ProjectService.java | 6d7b5218c4ecd851404f7f63bf1d0611b0420323 | [] | no_license | paulrednic/BT_Challenge | 791a6c0b2c8f963bbd8d6f640ab9a55519fcef0d | 6975022d78a3dbaca5849038e54aabd4523f8372 | refs/heads/main | 2023-06-27T17:55:22.150073 | 2021-07-28T16:13:24 | 2021-07-28T16:13:24 | 390,411,588 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,032 | java | package ro.tuc.ds2020.services;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.rest.webmvc.ResourceNotFoundException;
import ro.tuc.ds2020.dtos.EmployeeDTO;
import ro.tuc.ds2020.dtos.ProjectDTO;
import ro.tuc.ds2020.dtos.builders.EmployeeBuilder;
import ro.tuc.ds2020.dtos.builders.ProjectBuilder;
import ro.tuc.ds2020.entities.Employee;
import ro.tuc.ds2020.entities.Project;
import ro.tuc.ds2020.repositories.ProjectRepository;
import java.util.List;
import java.util.stream.Collectors;
public class ProjectService {
private final ProjectRepository projectRepository;
@Autowired
public ProjectService(ProjectRepository projectRepository) {
this.projectRepository = projectRepository;
}
public List<ProjectDTO> findProjects() {
List<Project> projectList = projectRepository.findAll();
return projectList.stream()
.map(ProjectBuilder::toProjectDTO)
.collect(Collectors.toList());
}
public ProjectDTO findProjectByName(String name) {
List<Project> project = projectRepository.findByName(name);
return ProjectBuilder.toProjectDTO(project.get(0));
}
public ProjectDTO addEmployeeToProject(ProjectDTO projectDTO, EmployeeDTO employeeDTO) {
Project project = projectRepository.findById(projectDTO.getId()).orElseThrow(() -> new ResourceNotFoundException("Project not found"));
List<Employee> employees = project.getEmployees(); //initial list of employees on project
employees.add(EmployeeBuilder.toEntity(employeeDTO)); //add new employee
project.setEmployees(employees); //add updated list of employees
projectRepository.save(project);
System.out.println("Project updated in db");
return ProjectBuilder.toProjectDTO(project);
}
public ProjectDTO deleteEmployeeFromProject(ProjectDTO projectDTO, EmployeeDTO employeeDTO) {
Project project = projectRepository.findById(projectDTO.getId()).orElseThrow(() -> new ResourceNotFoundException("Project not found"));
List<Employee> employees = project.getEmployees(); //initial list of employees on project
for (Employee employee : employees) {
if(employee.getId() == employeeDTO.getId())
employees.remove(employee);
}
project.setEmployees(employees); //add updated list of employees
projectRepository.save(project);
System.out.println("Project updated in db");
return ProjectBuilder.toProjectDTO(project);
}
public List<EmployeeDTO> getEmployeeOfProject(ProjectDTO projectDTO) {
Project project = projectRepository.findById(projectDTO.getId()).orElseThrow(() -> new ResourceNotFoundException("Project not found"));
List<Employee> employees = project.getEmployees(); //initial list of employees on project
return employees.stream()
.map(EmployeeBuilder::toEmployeeDTO)
.collect(Collectors.toList());
}
}
| [
"[email protected]"
] | |
7e44745ceb6d39de9b9b7ac7e912a635e60797f7 | 05416f2551b7245c93cef051c9caa67d7a542b61 | /app/src/main/java/com/example/sippahealth/FixturesData.java | 9b309d52340c64fdb1ff542857cdfe6178507009 | [] | no_license | brhwang0/SippaHealth | b36a4b959d4798b3fd63eb1cdb28ea47a475159d | 50b6b3aa4b1a89e71d4d5b5dc347d917d6c81526 | refs/heads/master | 2022-11-25T07:40:55.530723 | 2020-07-29T22:09:07 | 2020-07-29T22:09:07 | 281,223,581 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,944 | java | package com.example.sippahealth;
import java.security.SecureRandom;
import java.util.ArrayList;
/*
* this is to store default data we will not use this in future only for demo purposes. this will be stored in the server
*/
abstract class FixturesData {
static SecureRandom rnd = new SecureRandom();
static ArrayList<String> avatars = new ArrayList<String>() {
{
add("http://i.imgur.com/pv1tBmT.png");
add("http://i.imgur.com/R3Jm1CL.png");
add("http://i.imgur.com/ROz4Jgh.png");
add("http://i.imgur.com/Qn9UesZ.png");
}
};
static final ArrayList<String> groupChatImages = new ArrayList<String>() {
{
add("http://i.imgur.com/hRShCT3.png");
add("http://i.imgur.com/zgTUcL3.png");
add("http://i.imgur.com/mRqh5w1.png");
}
};
static final ArrayList<String> groupChatTitles = new ArrayList<String>() {
{
add("Samuel, Michelle");
add("Jordan, Jordan, Zoe");
add("Julia, Angel, Kyle, Jordan");
}
};
static final ArrayList<String> names = new ArrayList<String>() {
{
add("Samuel Reynolds");
add("Kyle Hardman");
add("Zoe Milton");
add("Angel Ogden");
add("Zoe Milton");
add("Angelina Mackenzie");
add("Kyle Oswald");
add("Abigail Stevenson");
add("Julia Goldman");
add("Jordan Gill");
add("Michelle Macey");
}
};
static final ArrayList<String> messages = new ArrayList<String>() {
{
add("Hello!");
add("This is my phone number - +1 (234) 567-89-01");
add("Here is my e-mail - [email protected]");
add("Hey! Check out this awesome link! www.github.com");
add("Hello! No problem. I can today at 2 pm. And after we can go to the office.");
add("At first, for some time, I was not able to answer him one word");
add("At length one of them called out in a clear, polite, smooth dialect, not unlike in sound to the Italian");
add("By the bye, Bob, said Hopkins");
add("He made his passenger captain of one, with four of the men; and himself, his mate, and five more, went in the other; and they contrived their business very well, for they came up to the ship about midnight.");
add("So saying he unbuckled his baldric with the bugle");
add("Just then her head struck against the roof of the hall: in fact she was now more than nine feet high, and she at once took up the little golden key and hurried off to the garden door.");
}
};
static final ArrayList<String> images = new ArrayList<String>() {
{
add("https://habrastorage.org/getpro/habr/post_images/e4b/067/b17/e4b067b17a3e414083f7420351db272b.jpg");
add("https://cdn.pixabay.com/photo/2017/12/25/17/48/waters-3038803_1280.jpg");
}
};
// static String getRandomId() {
// return Long.toString(UUID.randomUUID().getLeastSignificantBits());
// }
//
// static String getRandomAvatar() {
// return avatars.get(rnd.nextInt(avatars.size()));
// }
//
// static String getRandomGroupChatImage() {
// return groupChatImages.get(rnd.nextInt(groupChatImages.size()));
// }
//
// static String getRandomGroupChatTitle() {
// return groupChatTitles.get(rnd.nextInt(groupChatTitles.size()));
// }
//
// static String getRandomName() {
// return names.get(rnd.nextInt(names.size()));
// }
static String getRandomMessage() {
return messages.get(rnd.nextInt(messages.size()));
}
static String getRandomImage() {
return images.get(rnd.nextInt(images.size()));
}
// static boolean getRandomBoolean() {
// return rnd.nextBoolean();
// }
}
| [
"[email protected]"
] | |
bee142ea45ef8a8bf7b9a08de592525e4e59ff73 | 513d40934b4441f71b658d7f85344c899984ef5a | /LatteNews/app/src/main/java/com/dyx/ln/MainActivity.java | a83961f4a068caba6a5d182da637e7995fb95f65 | [] | no_license | DoubleDa/LatteNews | a8d0e8aa6f435fc00d9c6c13924625ede77dc841 | f82a1afd62454a31d57aade4e5c74cf4779e2ba4 | refs/heads/master | 2021-07-15T10:17:29.420565 | 2017-10-20T18:25:01 | 2017-10-20T18:25:01 | 106,709,149 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,701 | java | package com.dyx.ln;
import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
public class MainActivity extends AppCompatActivity {
@BindView(R.id.tool_bar)
Toolbar toolBar;
@BindView(R.id.tab_layout)
TabLayout tabLayout;
@BindView(R.id.app_bar_layout)
AppBarLayout appBarLayout;
@BindView(R.id.view_pager)
ViewPager viewPager;
private Unbinder mUnbinder;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mUnbinder = ButterKnife.bind(this);
initView();
}
private void initView() {
setSupportActionBar(toolBar);
initViewPager();
}
private void initViewPager() {
int menuSize = getMenus().size();
for (int i = 0; i < menuSize; i++) {
tabLayout.addTab(tabLayout.newTab().setText(getMenus().get(i)));
}
List<Fragment> fragments = new ArrayList<>();
for (int i = 0; i < menuSize; i++) {
fragments.add(new NewsListFragment());
}
NewsListAdapter newsListAdapter = new NewsListAdapter(getSupportFragmentManager(), fragments, getMenus());
viewPager.setAdapter(newsListAdapter);
tabLayout.setupWithViewPager(viewPager);
tabLayout.setTabsFromPagerAdapter(newsListAdapter);
}
private List<String> getMenus() {
List<String> results = new ArrayList<>();
results.add("推荐");
results.add("新闻");
results.add("娱乐");
results.add("体育");
results.add("财经");
results.add("汽车");
results.add("军事");
results.add("直播");
results.add("视频");
results.add("段子");
results.add("时尚");
results.add("本地");
results.add("手机");
results.add("科技");
results.add("游戏");
results.add("数码");
results.add("教育");
results.add("健康");
results.add("独家");
results.add("航空");
results.add("旅游");
results.add("亲子");
results.add("艺术");
return results;
}
@Override
protected void onDestroy() {
super.onDestroy();
mUnbinder.unbind();
}
}
| [
"[email protected]"
] | |
4724be2bc00a38acd1c1974ef7389c50c759664f | 301334e830691155bd74b72f7bc6e875e08f7016 | /Main_UI/app/src/main/java/com/example/akchen/main_ui/Adapter/MyShowAdapter.java | 733ed9653f6c9171f35b726189ab7d9fc1658251 | [] | no_license | alanlzw/AndroidWeatherApp_Main_UI | 5ebbf1641a62941233da2a1f0c77ea35076199d0 | f790a0092588f90c492ec319c3e0ebbb58e06c49 | refs/heads/master | 2021-01-15T09:51:12.007423 | 2016-07-21T01:31:51 | 2016-07-21T01:31:51 | 63,518,484 | 1 | 0 | null | 2016-07-17T06:42:03 | 2016-07-17T06:42:02 | null | UTF-8 | Java | false | false | 1,399 | java | package com.example.akchen.main_ui.Adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.example.akchen.main_ui.R;
import java.util.List;
/**
* Created by AkChen on 2016/7/10 0010.
*/
public class MyShowAdapter extends BaseAdapter {
private Context context;
private List list;
public MyShowAdapter(Context context, List list) {
this.context = context;
this.list = list;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return list.size();
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
if(convertView==null){
convertView= LayoutInflater.from(context).inflate(R.layout.adaper_line, null);
final TextView edit = (TextView) convertView.findViewById(R.id.id_list_item);
edit.setText((String)list.get(position));
}
return convertView;
}
}
| [
"[email protected]"
] | |
2f90bc00aaedb6f9e6c7bad20206d0dc4c46f470 | 62628dc5245c4612d001c7f0e7149e4e9a59429c | /Programas/java/LIBRO_COMM_BD_JAVA_ejemplos/BD_SERVLETS-Codigo/GeneraRespuestas.java | fe5aa0b6e99a81a0f03683a1c5d68d6b2ab39d85 | [
"CC0-1.0"
] | permissive | felipeescallon/lenguajes_programacion | b3ae3477765b3100b8b454b1868e19f3a0cfc64c | 5b88bf2a95492e799c94e414997365a14db05c05 | refs/heads/main | 2023-07-13T01:37:29.360547 | 2021-08-26T14:42:20 | 2021-08-26T14:42:20 | 386,758,230 | 1 | 0 | null | null | null | null | ISO-8859-3 | Java | false | false | 2,348 | java | import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class GeneraRespuestas extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
String Leccion = request.getParameter("Leccion");
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<body>");
out.println("<h1>Lección: "+Leccion+"</h1>");
GeneraRespuestas(request,out,Leccion);
out.println("</body>");
out.println("</html>");
}
private void GeneraRespuestas(HttpServletRequest request,PrintWriter out,String Leccion){
boolean SolucionA,SolucionB,SolucionC,SolucionD,RaUsuario,RbUsuario,RcUsuario,RdUsuario,Acertado;
int NumPregunta;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String BaseDeDatos = "jdbc:odbc:Tests";
Connection Conexion = DriverManager.getConnection(BaseDeDatos);
Statement SentenciaSQL = Conexion.createStatement();
ResultSet Preguntas = SentenciaSQL.executeQuery("SELECT * FROM Test WHERE Leccion="+Leccion);
while (Preguntas.next()) {
NumPregunta = Preguntas.getInt("NumPregunta");
SolucionA = Preguntas.getBoolean("Solucion1");
SolucionB = Preguntas.getBoolean("Solucion2");
SolucionC = Preguntas.getBoolean("Solucion3");
SolucionD = Preguntas.getBoolean("Solucion4");
RaUsuario = new Boolean(request.getParameter("R"+NumPregunta+"a")).booleanValue();
RbUsuario = new Boolean(request.getParameter("R"+NumPregunta+"b")).booleanValue();
RcUsuario = new Boolean(request.getParameter("R"+NumPregunta+"c")).booleanValue();
RdUsuario = new Boolean(request.getParameter("R"+NumPregunta+"d")).booleanValue();
Acertado = (SolucionA==RaUsuario && SolucionB==RbUsuario &&
SolucionC==RcUsuario && SolucionD==RdUsuario);
out.println("<h2>"+NumPregunta+". "+Acertado+"</h2>");
}
Preguntas.close();
Conexion.close();
SentenciaSQL.close();
}
catch (ClassNotFoundException e) {
System.out.println("Clase no encontrada");
}
catch (SQLException e) {
System.out.println(e);
}
}
} | [
"[email protected]"
] | |
03d22e22021f2e480ad70ce135e7dd51e69946e2 | ef720e1da8ccf28b49ea3d0046ab3136c043c7e1 | /GemsJaxServer/src/org/gemsjax/server/module/NotificationModule.java | fafcb5d35ecfbb0a031f7dadb214e9f57dae38d0 | [] | no_license | frwck/GemsJax-2.0 | 66927ebefb47a2ab75f70b9ab284cd6843284f34 | 5bc22f8923a963c3b269681c7a7a5056d854a01f | refs/heads/master | 2020-03-30T11:29:11.272090 | 2012-05-29T12:34:28 | 2012-05-29T12:34:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,974 | java | package org.gemsjax.server.module;
import java.io.IOException;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import org.gemsjax.server.communication.channel.handler.NotificationChannelHandler;
import org.gemsjax.server.persistence.dao.NotificationDAO;
import org.gemsjax.server.persistence.dao.exception.DAOException;
import org.gemsjax.server.persistence.dao.exception.NotFoundException;
import org.gemsjax.server.persistence.dao.hibernate.HibernateNotificationDAO;
import org.gemsjax.server.persistence.notification.CollaborationRequestNotificationImpl;
import org.gemsjax.server.persistence.notification.ExperimentRequestNotificationImpl;
import org.gemsjax.server.persistence.notification.FriendshipRequestNotificationImpl;
import org.gemsjax.server.persistence.notification.NotificationImpl;
import org.gemsjax.server.persistence.notification.QuickNotificationImpl;
import org.gemsjax.server.persistence.request.CollaborateRequestImpl;
import org.gemsjax.server.persistence.request.FriendshipRequestImpl;
import org.gemsjax.shared.collaboration.Collaborateable;
import org.gemsjax.shared.communication.message.notification.CollaborationRequestNotification;
import org.gemsjax.shared.communication.message.notification.ExperimentRequestNotification;
import org.gemsjax.shared.communication.message.notification.FriendshipRequestNotification;
import org.gemsjax.shared.communication.message.notification.GetAllNotificationsAnswerMessage;
import org.gemsjax.shared.communication.message.notification.LiveExperimentRequestNotification;
import org.gemsjax.shared.communication.message.notification.LiveFriendshipNotificationMessage;
import org.gemsjax.shared.communication.message.notification.NotificationError;
import org.gemsjax.shared.communication.message.notification.NotificationErrorMessage;
import org.gemsjax.shared.communication.message.notification.QuickNotification;
import org.gemsjax.shared.communication.message.notification.SuccessfulNotificationMessage;
import org.gemsjax.shared.communication.message.request.FriendshipRequest;
import org.gemsjax.shared.communication.message.request.LiveFriendshipRequestMessage;
import org.gemsjax.shared.experiment.Experiment;
import org.gemsjax.shared.notification.Notification;
import org.gemsjax.shared.user.RegisteredUser;
public class NotificationModule implements NotificationChannelHandler{
private static NotificationModule INSTANCE = new NotificationModule();
private NotificationDAO dao;
private NotificationModule()
{
dao = new HibernateNotificationDAO();
}
public static NotificationModule getInstance(){
return INSTANCE;
}
public void onFriendshipAccepted(RegisteredUser notificationReceiver, RegisteredUser acceptor) throws DAOException
{
FriendshipRequestNotificationImpl r = dao.createFriendshipRequestNotification(notificationReceiver, acceptor, true);
// chek if the notification receiver is online right now, and sent him a live notification
OnlineUser ou = OnlineUserManager.getInstance().getOnlineUser(notificationReceiver);
if (ou != null)
try {
ou.getNotificationChannel().send(new LiveFriendshipNotificationMessage(new FriendshipRequestNotification(r.getId(), r.getDate(), r.isRead(), r.getAcceptor().getDisplayedName(), r.getAcceptor().getUsername(),r.isAccepted())));
} catch (IOException e) {
// TODO What to do if message cant be sent
e.printStackTrace();
}
}
public void onFriendshipRejected(RegisteredUser notificationReceiver, RegisteredUser acceptor) throws DAOException
{
FriendshipRequestNotificationImpl r = dao.createFriendshipRequestNotification(notificationReceiver, acceptor, false);
// chek if the notification receiver is online right now, and sent him a live notification
OnlineUser ou = OnlineUserManager.getInstance().getOnlineUser(notificationReceiver);
if (ou != null)
try {
ou.getNotificationChannel().send(new LiveFriendshipNotificationMessage(new FriendshipRequestNotification(r.getId(), r.getDate(), r.isRead(), r.getAcceptor().getDisplayedName(), r.getAcceptor().getUsername(),r.isAccepted())));
} catch (IOException e) {
// TODO What to do if message cant be sent
e.printStackTrace();
}
}
public void onAdminExperimentAccepted(RegisteredUser notificationReceiver, RegisteredUser acceptor, Experiment experiment) throws DAOException
{
ExperimentRequestNotificationImpl r = dao.createExperimentRequestNotification(notificationReceiver, acceptor, experiment,true);
// chek if the notification receiver is online right now, and sent him a live notification
OnlineUser ou = OnlineUserManager.getInstance().getOnlineUser(notificationReceiver);
if (ou != null)
try {
ou.getNotificationChannel().send(new LiveExperimentRequestNotification(new ExperimentRequestNotification(r.getId(), r.getDate(), r.isRead(), r.getAcceptor().getDisplayedName(), r.getAcceptor().getUsername(),r.isAccepted(), r.getExperiment().getId(), r.getExperiment().getName())));
} catch (IOException e) {
// TODO What to do if message cant be sent
e.printStackTrace();
}
}
public void onAdminExperimentRejected(RegisteredUser notificationReceiver, RegisteredUser acceptor, Experiment experiment) throws DAOException
{
ExperimentRequestNotificationImpl r = dao.createExperimentRequestNotification(notificationReceiver, acceptor, experiment,false);
// chek if the notification receiver is online right now, and sent him a live notification
OnlineUser ou = OnlineUserManager.getInstance().getOnlineUser(notificationReceiver);
if (ou != null)
try {
ou.getNotificationChannel().send(new LiveExperimentRequestNotification(new ExperimentRequestNotification(r.getId(), r.getDate(), r.isRead(), r.getAcceptor().getDisplayedName(), r.getAcceptor().getUsername(),r.isAccepted(), r.getExperiment().getId(), r.getExperiment().getName())));
} catch (IOException e) {
// TODO What to do if message cant be sent
e.printStackTrace();
}
}
public void onCollaborationAccepted(RegisteredUser notificationReceiver, RegisteredUser acceptor, Collaborateable collaborateable) throws DAOException
{
CollaborationRequestNotificationImpl r = dao.createCollaborationRequestNotification(notificationReceiver, acceptor, collaborateable,true);
// chek if the notification receiver is online right now, and sent him a live notification
OnlineUser ou = OnlineUserManager.getInstance().getOnlineUser(notificationReceiver);
if (ou != null)
try {
ou.getNotificationChannel().send(new LiveExperimentRequestNotification(new ExperimentRequestNotification(r.getId(), r.getDate(), r.isRead(), r.getAcceptor().getDisplayedName(), r.getAcceptor().getUsername(),r.isAccepted(), r.getCollaborateable().getId(), r.getCollaborateable().getName())));
} catch (IOException e) {
// TODO What to do if message cant be sent
e.printStackTrace();
}
}
public void onCollaborationRejected(RegisteredUser notificationReceiver, RegisteredUser acceptor, Collaborateable collaborateable) throws DAOException
{
CollaborationRequestNotificationImpl r = dao.createCollaborationRequestNotification(notificationReceiver, acceptor, collaborateable,false);
// chek if the notification receiver is online right now, and sent him a live notification
OnlineUser ou = OnlineUserManager.getInstance().getOnlineUser(notificationReceiver);
if (ou != null)
try {
ou.getNotificationChannel().send(new LiveExperimentRequestNotification(new ExperimentRequestNotification(r.getId(), r.getDate(), r.isRead(), r.getAcceptor().getDisplayedName(), r.getAcceptor().getUsername(),r.isAccepted(), r.getCollaborateable().getId(), r.getCollaborateable().getName())));
} catch (IOException e) {
// TODO What to do if message cant be sent
e.printStackTrace();
}
}
public long getUnreadNotifications(RegisteredUser user){
return dao.getUnreadCount(user);
}
@Override
public void onMarkNotificationAsRead(String referenceId,
long notificationId, OnlineUser u) {
try {
Notification n = dao.getNotification(notificationId);
if (n.getReceiver().getId() == u.getId()){
try {
dao.setRead(n, true);
u.getNotificationChannel().send(new SuccessfulNotificationMessage(referenceId));
} catch (IOException e) {
// TODO What to do if message cant be sent
e.printStackTrace();
} catch (DAOException e) {
try {
u.getNotificationChannel().send(new NotificationErrorMessage(referenceId, NotificationError.DATABASE));
} catch (IOException e1) {
// TODO What to do if message cant be sent
e1.printStackTrace();
}
}
} else
try {
u.getNotificationChannel().send(new NotificationErrorMessage(referenceId, NotificationError.PERMISSION_DENIED));
} catch (IOException e) {
// TODO What to do if message cant be sent
e.printStackTrace();
}
} catch (NotFoundException e) {
try {
u.getNotificationChannel().send(new NotificationErrorMessage(referenceId, NotificationError.NOT_FOUND));
} catch (IOException e1) {
// TODO What to do if message cant be sent
e1.printStackTrace();
}
}
}
@Override
public void onDeleteNotification(String referenceId, long notificationId,
OnlineUser u) {
try {
Notification n = dao.getNotification(notificationId);
if (n.getReceiver().getId() == u.getId()){
try {
dao.deleteNotification(n);
u.getNotificationChannel().send(new SuccessfulNotificationMessage(referenceId));
} catch (IOException e) {
// TODO What to do if message cant be sent
e.printStackTrace();
} catch (DAOException e) {
try {
u.getNotificationChannel().send(new NotificationErrorMessage(referenceId, NotificationError.DATABASE));
} catch (IOException e1) {
// TODO What to do if message cant be sent
e1.printStackTrace();
}
}
} else
try {
u.getNotificationChannel().send(new NotificationErrorMessage(referenceId, NotificationError.PERMISSION_DENIED));
} catch (IOException e) {
// TODO What to do if message cant be sent
e.printStackTrace();
}
} catch (NotFoundException e) {
try {
u.getNotificationChannel().send(new NotificationErrorMessage(referenceId, NotificationError.NOT_FOUND));
} catch (IOException e1) {
// TODO What to do if message cant be sent
e1.printStackTrace();
}
}
}
@Override
public void onGetAllNotifications(String referenceId, OnlineUser u) {
RegisteredUser user = (RegisteredUser) u.getUser();
List<Notification> notifications = dao.getNotificationsFor(user);
Set<QuickNotification> quicks = new LinkedHashSet<QuickNotification>();
Set<ExperimentRequestNotification> experiments = new LinkedHashSet<ExperimentRequestNotification>();
Set<FriendshipRequestNotification> friends = new LinkedHashSet<FriendshipRequestNotification>();
Set<CollaborationRequestNotification> collaborations = new LinkedHashSet<CollaborationRequestNotification>();
for (Notification n: notifications){
if (n instanceof QuickNotificationImpl)
quicks.add(new QuickNotification(n.getId(), n.getDate(), n.isRead(), ((QuickNotificationImpl) n).getQuickNotificationType(), ((QuickNotificationImpl) n).getOptionalMessage()));
else
if (n instanceof ExperimentRequestNotificationImpl)
experiments.add(new ExperimentRequestNotification(n.getId(),n.getDate(),n.isRead(), ((ExperimentRequestNotificationImpl) n).getAcceptor().getDisplayedName(), ((ExperimentRequestNotificationImpl) n).getAcceptor().getUsername(), ((ExperimentRequestNotificationImpl) n).isAccepted(),((ExperimentRequestNotificationImpl) n).getExperiment().getId(), ((ExperimentRequestNotificationImpl) n).getExperiment().getName()));
else
if (n instanceof FriendshipRequestNotificationImpl)
friends.add(new FriendshipRequestNotification(n.getId(), n.getDate(), n.isRead(), ((FriendshipRequestNotificationImpl) n).getAcceptor().getDisplayedName(), ((FriendshipRequestNotificationImpl) n).getAcceptor().getUsername(), ((FriendshipRequestNotificationImpl) n).isAccepted()));
else
if (n instanceof CollaborationRequestNotificationImpl)
collaborations.add(new CollaborationRequestNotification(n.getId(), n.getDate(), n.isRead(), ((CollaborationRequestNotificationImpl) n).getAcceptor().getDisplayedName(), ((CollaborationRequestNotificationImpl) n).getAcceptor().getUsername(),((CollaborationRequestNotificationImpl) n).isAccepted(), ((CollaborationRequestNotificationImpl) n).getCollaborateable().getId(), ((CollaborationRequestNotificationImpl) n).getCollaborateable().getName()));
}
try {
u.getNotificationChannel().send(new GetAllNotificationsAnswerMessage(referenceId, quicks, experiments, friends, collaborations));
} catch (IOException e) {
// TODO What to do if message cant be sent
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
fb9dfc3c49993ff73e876fcbe6f38f7685e33001 | eb140c99ede2dd9cdc2b33055876c4e850c052ca | /src/main/java/br/com/casadocodigo/loja/converters/AutorConverter.java | 3255da338c516df4cb451da2a52c8bae2283ce92 | [] | no_license | ojaoferreira/casadocodigo | 0300bb00b5e632f910f1dd3aa0ea9ee67e76db04 | 7eaea6b672674672202fed051c45234e8459b0df | refs/heads/master | 2020-03-22T13:52:22.435707 | 2018-07-08T04:43:03 | 2018-07-08T04:43:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 833 | java | package br.com.casadocodigo.loja.converters;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;
import br.com.casadocodigo.loja.models.Autor;
@FacesConverter("autorConverter")
public class AutorConverter implements Converter {
@Override
public Object getAsObject(FacesContext context, UIComponent component, String id) {
if (id == null || id.trim().isEmpty()) {
return null;
}
Autor autor = new Autor();
autor.setId(Integer.valueOf(id));
return autor;
}
@Override
public String getAsString(FacesContext context, UIComponent component, Object autorObject) {
if (autorObject == null) {
return null;
}
Autor autor = (Autor) autorObject;
return autor.getId().toString();
}
}
| [
"[email protected]"
] | |
eaca08271f37f932e136bcd9f2dfbd076c653199 | e76bf266147b4b77f40425c5c8730dd55a4108fd | /videoentryphone-android/app/src/main/java/com/example/bartek/praca_inzynierska/ReceivePhoneCall.java | ed9b8add6f9051ed9763430e5216ce8719aa0047 | [] | no_license | BarKar96/IntelligentBiometricEntryphone | d8c28ec725565b6d8d48112b2b9388b7bc1c7fd8 | 5b5ac312f2c51b3be383a0092512b4460d23c28a | refs/heads/master | 2020-04-29T03:27:58.521601 | 2019-03-15T11:53:58 | 2019-03-15T11:53:58 | 175,810,719 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,594 | java | package com.example.bartek.praca_inzynierska;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Chronometer;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
public class ReceivePhoneCall extends AppCompatActivity implements View.OnClickListener
{
private Button btnEndPhoneCall;
private Button btnLetIn;
private Button btnMuteMicrophone;
private Chronometer chronometer;
private InetAddress inetAddress;
private PhoneCall phoneCall;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_receive_phone_call);
initiate();
setButtonListeners();
startCall();
Log.i("ReceivePhoneCall", "after onCreate");
}
private void initiate()
{
btnEndPhoneCall = (Button) findViewById(R.id.btnEndPhoneCall);
btnLetIn = (Button) findViewById(R.id.btnLetIn);
btnMuteMicrophone = (Button) findViewById(R.id.btnMuteMicrophone);
chronometer = (Chronometer) findViewById(R.id.simpleChronometer);
}
private void setButtonListeners()
{
btnLetIn.setOnClickListener(this);
btnEndPhoneCall.setOnClickListener(this);
btnMuteMicrophone.setOnClickListener(this);
}
private void startCall()
{
try
{
inetAddress = InetAddress.getByName(MainActivity.addressRPi);
phoneCall = new PhoneCall(inetAddress);
phoneCall.initializeMicrophone();
phoneCall.initializeSpeakers();
chronometer.start();
Log.i("TCPSender: ", "OK");
String messageToSend = encryptWithAES("OK");
TCPSender tcpSender = new TCPSender();
tcpSender.execute(messageToSend);
}
catch (UnknownHostException e)
{
e.printStackTrace();
}
}
public void f()
{
chronometer.stop();
phoneCall.deactivateSpeakers();
phoneCall.deactivateMicrophone();
}
@Override
public void onClick(View v)
{
if (v == btnLetIn)
{
String messageToSend = encryptWithAES("LETIN");
Log.i("ReceivePhoneCall","btnLetIn - onClick");
TCPSender tcpSender = new TCPSender();
tcpSender.execute(messageToSend);
f();
finish();
startActivity(new Intent(this, MainActivity.class));
}
else if (v == btnEndPhoneCall)
{
String messageToSend = encryptWithAES("BYE");
Log.i("ReceivePhoneCall","btnEndPhoneCall - onClick");
TCPSender tcpSender = new TCPSender();
tcpSender.execute(messageToSend);
f();
finish();
startActivity(new Intent(this, MainActivity.class));
}
else if (v == btnMuteMicrophone)
{
if (phoneCall.isMicrophoneActivated())
{
phoneCall.deactivateMicrophone();
btnMuteMicrophone.setBackgroundResource(R.drawable.microphone_unmute);
}
else
{
phoneCall.initializeMicrophone();
btnMuteMicrophone.setBackgroundResource(R.drawable.microphone_mute);
}
}
}
private String encryptWithAES(String message)
{
Crypt c = Crypt.getInstance();
String messageToSend = null;
try {
messageToSend = c.encrypt_string(message);
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (NoSuchPaddingException e) {
e.printStackTrace();
} catch (InvalidAlgorithmParameterException e) {
e.printStackTrace();
} catch (IllegalBlockSizeException e) {
e.printStackTrace();
} catch (BadPaddingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return messageToSend;
}
}
| [
"[email protected]"
] | |
d5ed18e14bd949052eedc3dab333cd7b73144763 | c757d1ea86976d4b98c82fc78b3b3498828e996c | /src/main/java/com/jala/architect/conf/SystemLogAspect.java | 4ea9f03bf6dad8501d02be610fc79ded4dc74b13 | [] | no_license | WangWei0905/manage-system | 976b3168c4d7ab96436583ec1e407a2013fa5367 | f2554a138c36f69c18e27ba7ce71f54a48d791da | refs/heads/master | 2021-07-08T10:13:06.222191 | 2017-10-03T13:04:12 | 2017-10-03T13:04:21 | 105,529,978 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,608 | java | package com.jala.architect.conf;
import com.jala.architect.annotation.SystemControllerLog;
import com.jala.architect.annotation.SystemServiceLog;
import com.jala.architect.constant.Constants;
import com.jala.architect.utils.ClientIpUtil;
import com.jala.architect.utils.ThreadPool;
import com.jala.model.vo.SystemLog;
import com.jala.model.vo.User;
import com.jala.service.SystemLogService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.*;
import org.nutz.json.Json;
import org.nutz.json.JsonFormat;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.NamedThreadLocal;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.lang.reflect.Method;
import java.util.Date;
import java.util.Map;
/**
* Spring AOP实现日志管理
*
* @author ww
* @date 2017/9/6
*/
@Aspect
@Component
public class SystemLogAspect {
private Log log = LogFactory.getLog(SystemLogAspect.class);
private static final ThreadLocal<Date> beginTimeThreadLocal = new NamedThreadLocal<Date>("ThreadLocal beginTime");
@Autowired
private SystemLogService systemLogService;
@Autowired(required=false)
private HttpServletRequest request;
/**
* controller层切点,注解方式
*/
//@Pointcut("execution(* *..controller..*Controller*.*(..))")
@Pointcut("@annotation(com.jala.architect.annotation.SystemControllerLog)")
public void controllerAspect() {
log.info("========controllerAspect===========");
}
/**
* Service层切点,注解方式
*/
@Pointcut("@annotation(com.jala.architect.annotation.SystemServiceLog)")
public void serviceAspect() {
log.info("========ServiceAspect===========");
}
/**
* 前置通知 (在方法执行之前返回)用于拦截Controller层记录用户的操作的开始时间
* @param joinPoint 切点
* @throws InterruptedException
*/
@Before("controllerAspect()")
public void doBefore(JoinPoint joinPoint) throws InterruptedException{
//线程绑定变量(该数据只有当前请求的线程可见)
Date beginTime=new Date();
beginTimeThreadLocal.set(beginTime);
}
/**
* 后置通知(在方法执行之后返回) 用于拦截Controller层操作
* @param joinPoint 切点
*/
@After("controllerAspect()")
public void after(JoinPoint joinPoint){
try {
HttpSession session = request.getSession();
//读取session中的用户
User user = (User) session.getAttribute(Constants.SESSION_KEY_LOGIN_NAME);
if (null != user) {
//日志标题
String logTitle = getControllerMethodDescription(joinPoint);
//日志类型
String logType = "info";
//日志请求url
String logUrl = request.getRequestURI();
//请求方式
String logMethod = request.getMethod();
//请求参数
Map<String,String[]> logParams=request.getParameterMap();
//请求用户
String logUserName = user.getUserLoginName();
//请求IP
String logIp = ClientIpUtil.getIpAddr(request);
//请求开始时间
Date logStartTime = beginTimeThreadLocal.get();
long beginTime = beginTimeThreadLocal.get().getTime();
long endTime = System.currentTimeMillis();
//请求耗时
Long logElapsedTime = endTime - beginTime;
SystemLog systemLog = new SystemLog(logTitle,logType,logUrl,logMethod,logUserName,logIp,logStartTime,logElapsedTime);
systemLog.setMapToParams(logParams);
ThreadPool.getPool().execute(new SaveSystemLogThread(systemLog,systemLogService,logIp));
}
} catch (Exception e) {
log.error("AOP后置通知异常", e);
}
}
/**
* 异常通知 用于拦截service层记录异常日志
* @param joinPoint
* @param e
*/
@AfterThrowing(pointcut="serviceAspect()", throwing="e")
public void doAfterThrowing(JoinPoint joinPoint, Throwable e) {
try {
HttpSession session = request.getSession();
//读取session中的用户
User user = (User) session.getAttribute(Constants.SESSION_KEY_LOGIN_NAME);
if (null != user) {
//日志标题
String logTitle = getServiceMethodDescription(joinPoint);
//日志类型
String logType = "error";
//日志请求url
String logUrl = joinPoint.getTarget().getClass().getName() + "." + joinPoint.getSignature().getName() + "()";
//请求方式
String logMethod = request.getMethod();
//请求参数
Map<String,String[]> logParams=request.getParameterMap();
//请求用户
String logUserName = user.getUserLoginName();
//请求IP
String logIp = ClientIpUtil.getIpAddr(request);
//请求开始时间
Date logStartTime = beginTimeThreadLocal.get();
long beginTime = beginTimeThreadLocal.get().getTime();
long endTime = System.currentTimeMillis();
//请求耗时
Long logElapsedTime = endTime - beginTime;
//异常描述
String LogException = e.toString();
SystemLog systemLog = new SystemLog(logTitle,logType,logUrl,logMethod,LogException,logUserName,logIp,logStartTime,logElapsedTime);
systemLog.setMapToParams(logParams);
ThreadPool.getPool().execute(new SaveSystemLogThread(systemLog,systemLogService,logIp));
}
} catch (Exception e1) {
log.error("AOP异常通知异常", e1);
}
}
/**
* 保存日志
*/
private static class SaveSystemLogThread implements Runnable {
private SystemLog systemLog;
private SystemLogService systemLogService;
private String logIp;
public SaveSystemLogThread(SystemLog systemLog, SystemLogService systemLogService,String logIp) {
this.systemLog = systemLog;
this.systemLogService = systemLogService;
this.logIp = logIp;
}
@Override
public void run() {
String logIpAddress = ClientIpUtil.getIpAddrSource(logIp);
systemLog.setLogIpAddress(logIpAddress);
systemLogService.insertSelective(systemLog);
}
}
/**
* 获取注解中对方法的描述信息 用于Controller层注解
* @param joinPoint 切点
* @return 方法描述
* @throws Exception
*/
public static String getControllerMethodDescription(JoinPoint joinPoint) throws Exception{
//获取目标类名
String targetName = joinPoint.getTarget().getClass().getName();
//获取方法名
String methodName = joinPoint.getSignature().getName();
//获取相关参数
Object[] arguments = joinPoint.getArgs();
//生成类对象
Class targetClass = Class.forName(targetName);
//获取该类中的方法
Method[] methods = targetClass.getMethods();
String description = "";
for(Method method : methods) {
if(!method.getName().equals(methodName)) {
continue;
}
Class[] clazzs = method.getParameterTypes();
if(clazzs.length != arguments.length) {//比较方法中参数个数与从切点中获取的参数个数是否相同,原因是方法可以重载哦
continue;
}
description = method.getAnnotation(SystemControllerLog.class).description();
}
return description;
}
/**
* 获取注解中对方法的描述信息 用于Service层注解
* @param joinPoint 切点
* @return 方法描述
* @throws Exception
*/
public static String getServiceMethodDescription(JoinPoint joinPoint) throws Exception{
//获取目标类名
String targetName = joinPoint.getTarget().getClass().getName();
//获取方法名
String methodName = joinPoint.getSignature().getName();
//获取相关参数
Object[] arguments = joinPoint.getArgs();
//生成类对象
Class targetClass = Class.forName(targetName);
//获取该类中的方法
Method[] methods = targetClass.getMethods();
String description = "";
for(Method method : methods) {
if(!method.getName().equals(methodName)) {
continue;
}
Class[] clazzs = method.getParameterTypes();
if(clazzs.length != arguments.length) {//比较方法中参数个数与从切点中获取的参数个数是否相同,原因是方法可以重载哦
continue;
}
description = method.getAnnotation(SystemServiceLog.class).description();
}
return description;
}
}
| [
"[email protected]"
] | |
aeff5e59b401fc8290d4c11f8730da0ac05a10e7 | d8537b3fc4733e77cbc41546587b9fc6cd022968 | /3.JavaMultithreading/src/com/javarush/task/task27/task2712/RandomOrderGeneratorTask.java | 51494b488ae325a7102133ef81da42ad39098029 | [] | no_license | kostya-wolf/JavaRushTasks | ea99a5f415776811ea346185235fe4283305c6ac | cae10b23d43a80ecac6efc2a86a451b27358d19d | refs/heads/master | 2021-09-21T01:38:03.504059 | 2021-09-09T11:48:48 | 2021-09-09T11:48:48 | 187,481,714 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 911 | java | package com.javarush.task.task27.task2712;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Волковы on 07.09.2018.
*/
public class RandomOrderGeneratorTask implements Runnable {
List<Tablet> tablets = new ArrayList<>();
int interval;
public RandomOrderGeneratorTask(List<Tablet> tablets, int interval) {
this.tablets = tablets;
this.interval = interval;
}
@Override
public void run() {
while (!Thread.currentThread().isInterrupted()) {
try {
if (!tablets.isEmpty()) {
Tablet randomTablet = tablets.get((int) (Math.random() * tablets.size()));
randomTablet.createTestOrder();
}
Thread.sleep(interval);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
}
} | [
"[email protected]"
] | |
5ac3f051925dc5c0efb0b6466c8c990630d7446b | 9c998a5482245bd05c158925b8f60a954882caa9 | /src/main/java/com/epam/java/ft/models/OrderType.java | 6e4617e79b29935832ba6d34524ca5dc696916bd | [] | no_license | Gekol/Gekol.github.io | e057209c5dd6c33e3e53cef9a298cad9b017eaf2 | 341331554cad8bb149aabe34faaf377eb8bf7dfb | refs/heads/main | 2020-12-23T19:46:56.381625 | 2020-12-05T11:26:19 | 2020-12-05T11:26:19 | 237,254,571 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,035 | java | package com.epam.java.ft.models;
import java.util.Objects;
public class OrderType {
private int id;
private String type;
public OrderType(int id, String type) {
this.id = id;
this.type = type;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
OrderType orderType = (OrderType) o;
return id == orderType.id &&
Objects.equals(type, orderType.type);
}
@Override
public int hashCode() {
return Objects.hash(id, type);
}
@Override
public String toString() {
return "OrderType{" +
"id=" + id +
", type='" + type + '\'' +
'}';
}
}
| [
"[email protected]"
] | |
39353339a603ca3ad49601e344a5a909fca83541 | 29d73d332a6961bf37c5f57003d9d1ac1a738780 | /app/src/main/java/com/kloudsync/techexcel/ui/MainActivityV2.java | 122bae593bda7735160f0d642b34483235998d52 | [] | no_license | xfengwang/androidkloud | a6b8ccbcccbe89eae9091553be696e0cec158799 | b3638844002c4bbc208cd9018e8ec5e473192108 | refs/heads/master | 2022-10-15T05:11:42.269304 | 2020-06-11T02:30:11 | 2020-06-11T02:30:11 | 271,429,810 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 45,387 | java | //package com.kloudsync.techexcel.ui;
//
//import android.Manifest;
//import android.annotation.SuppressLint;
//import android.app.ProgressDialog;
//import android.content.Context;
//import android.content.DialogInterface;
//import android.content.Intent;
//import android.content.SharedPreferences;
//import android.content.pm.PackageManager;
//import android.graphics.drawable.Drawable;
//import android.net.Uri;
//import android.os.Bundle;
//import android.os.Handler;
//import android.os.Message;
//import android.support.v4.app.ActivityCompat;
//import android.support.v4.app.Fragment;
//import android.support.v4.app.FragmentManager;
//import android.support.v4.app.FragmentPagerAdapter;
//import android.support.v4.app.FragmentTransaction;
//import android.support.v7.app.AlertDialog;
//import android.text.TextUtils;
//import android.util.Log;
//import android.view.View;
//import android.view.View.OnClickListener;
//import android.widget.RelativeLayout;
//import android.widget.TextView;
//import android.widget.Toast;
//
//import com.kloudsync.techexcel.R;
//import com.kloudsync.techexcel.app.App;
//import com.kloudsync.techexcel.bean.EventRefreshTab;
//import com.kloudsync.techexcel.bean.EventWxFilePath;
//import com.kloudsync.techexcel.bean.UserPath;
//import com.kloudsync.techexcel.config.AppConfig;
//import com.kloudsync.techexcel.dialog.AddDocToSpaceDialog;
//import com.kloudsync.techexcel.dialog.AddWxDocDialog;
//import com.kloudsync.techexcel.dialog.CenterToast;
//import com.kloudsync.techexcel.dialog.UploadFileDialog;
//import com.kloudsync.techexcel.dialog.message.CustomizeMessageItemProvider;
//import com.kloudsync.techexcel.dialog.message.FriendMessageItemProvider;
//import com.kloudsync.techexcel.dialog.message.GroupMessageItemProvider;
//import com.kloudsync.techexcel.dialog.message.KnowledgeMessageItemProvider;
//import com.kloudsync.techexcel.dialog.message.SendFileMessageItemProvider;
//import com.kloudsync.techexcel.dialog.message.ShareMessageItemProvider;
//import com.kloudsync.techexcel.dialog.message.SystemMessageItemProvider;
//import com.kloudsync.techexcel.docment.WeiXinApi;
//import com.kloudsync.techexcel.frgment.ContactFragment;
//import com.kloudsync.techexcel.frgment.TeamDocumentsFragment;
//import com.kloudsync.techexcel.frgment.PersonalCenterFragment;
//import com.kloudsync.techexcel.frgment.ServiceFragment;
//import com.kloudsync.techexcel.frgment.TopicFragment;
//import com.kloudsync.techexcel.frgment.TwoToOneFragment;
//import com.kloudsync.techexcel.help.AddDocumentTool;
//import com.kloudsync.techexcel.help.ContactHelpInterface;
//import com.kloudsync.techexcel.info.School;
//import com.kloudsync.techexcel.mvp.BaseActivity;
//import com.kloudsync.techexcel.mvp.presenter.MainPresenter;
//import com.kloudsync.techexcel.mvp.view.IMainActivityView;
//import com.kloudsync.techexcel.personal.PersonalCollectionActivity;
//import com.kloudsync.techexcel.response.NetworkResponse;
//import com.kloudsync.techexcel.service.UploadService;
//import com.kloudsync.techexcel.start.LoginGet;
//import com.kloudsync.techexcel.tool.DensityUtil;
//import com.kloudsync.techexcel.tool.DocumentUploadTool;
//import com.kloudsync.techexcel.view.CustomViewPager;
//import com.lidroid.xutils.HttpUtils;
//import com.lidroid.xutils.exception.HttpException;
//import com.lidroid.xutils.http.RequestParams;
//import com.lidroid.xutils.http.ResponseInfo;
//import com.lidroid.xutils.http.callback.RequestCallBack;
//import com.lidroid.xutils.http.client.HttpRequest;
//import com.pgyersdk.update.DownloadFileListener;
//import com.pgyersdk.update.PgyUpdateManager;
//import com.pgyersdk.update.UpdateManagerListener;
//import com.pgyersdk.update.javabean.AppBean;
//import com.tencent.mm.sdk.openapi.IWXAPI;
//import com.tencent.mm.sdk.openapi.WXAPIFactory;
//import com.ub.kloudsync.activity.TeamSpaceBean;
//import com.ub.service.activity.SocketService;
//import com.ub.techexcel.tools.FileUtilsType;
//import com.ub.techexcel.tools.ServiceInterfaceTools;
//import com.umeng.analytics.MobclickAgent;
//
//import org.greenrobot.eventbus.EventBus;
//import org.greenrobot.eventbus.Subscribe;
//import org.greenrobot.eventbus.ThreadMode;
//import org.java_websocket.client.WebSocketClient;
//
//import java.io.File;
//import java.net.URLEncoder;
//import java.util.ArrayList;
//import java.util.List;
//
//import io.rong.imkit.RongIM;
//import io.rong.imlib.RongIMClient;
//import io.rong.imlib.RongIMClient.ConnectCallback;
//import io.rong.imlib.RongIMClient.ErrorCode;
//import retrofit2.Call;
//import retrofit2.Callback;
//import retrofit2.Response;
//
////import com.wuyr.rippleanimation.RippleAnimation;
//
//
//public class MainActivityV2 extends BaseActivity<MainPresenter<IMainActivityView>> implements AddWxDocDialog.OnDocSavedListener, AddDocToSpaceDialog.OnSpaceSelectedListener,IMainActivityView{
//
// private List<TextView> tvs = new ArrayList<TextView>();
// private TextView tv_redcontact;
// private CustomViewPager vp;
// private RelativeLayout rl_update;
// private FragmentPagerAdapter mAdapter;
// private List<Fragment> mTabs = new ArrayList<Fragment>();
// private TextView tv_community;
// private int tvIDs[] = {R.id.tv_service, R.id.tv_dialogue, R.id.tv_contact,
// R.id.tv_community, R.id.tv_personal_center};
// private int drawIDs[] = {R.drawable.tab_d_02, R.drawable.tab_d_01,
// R.drawable.tab_d_03, R.drawable.tab_d_04,
// R.drawable.tab_d_05};
//// private int draw_selectIDs[] = {R.drawable.tab_c_02, R.drawable.tab_c_01,
//// R.drawable.tab_c_03, R.drawable.tab_c_04, R.drawable.tab_c_05};
//
// public static RongIMClient mRongIMClient;
// public static MainActivityV2 instance = null;
//
// private SharedPreferences sharedPreferences;
// private SharedPreferences.Editor editor;
// private WebSocketClient mWebSocketClient;
//
// public static boolean RESUME = false;
//
// private boolean flag_update;
//
// private boolean flag_dialog;
//
// Intent service;
//
// App app;
//
// private static ContactHelpInterface chi;
//
// MainPresenter mainPresenter;
//
// @SuppressLint("HandlerLeak")
// Handler handler = new Handler() {
//
// public void handleMessage(Message msg) {
// switch (msg.what) {
// case AppConfig.RONGCONNECT_ERROR:
// sharedPreferences = getSharedPreferences(AppConfig.LOGININFO,
// MODE_PRIVATE);
// editor = sharedPreferences.edit();
// editor.putBoolean("isLogIn", false);
// editor.commit();
// Toast.makeText(getApplicationContext(), (String) msg.obj,
// Toast.LENGTH_LONG).show();
// RongIM.getInstance().disconnect();
// final Intent intent = getPackageManager()
// .getLaunchIntentForPackage(getPackageName());
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
// startActivity(intent);
// finish();
// break;
// case AppConfig.OnlineGunDan:
// if (1 == vp.getCurrentItem()) {
// GoTOTab(0);
// }
// RongIM.getInstance().disconnect();
// AppConfig.Online = 1;
// flag_dialog = false;
// Toast.makeText(MainActivityV2.this,
// getResources().getString(R.string.Dialog_GunDan), Toast.LENGTH_LONG).show();
// break;
// case AppConfig.UPLOADHEAD:
// rl_update.setVisibility(View.GONE);
// Toast.makeText(getApplicationContext(),
// getString(R.string.uploadsuccess),
// Toast.LENGTH_SHORT).show();
// Intent i = new Intent(getApplicationContext(), PersonalCollectionActivity.class);
// startActivity(i);
// break;
// case AppConfig.UPLOADFAILD:
// rl_update.setVisibility(View.GONE);
// Toast.makeText(getApplicationContext(),
// getString(R.string.uploadfailure),
// Toast.LENGTH_SHORT).show();
// break;
//
// default:
// break;
// }
// }
//
// ;
// };
//
// long systemTime = 0;
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
//// PgyUpdateManager.register(this);
// requestRongCloudOnlineStatus();
// getCompanyInfo();
// initUpdate();
// StartWBServiceHAHA();
// GetMaZhang();
// }
//
// @Override
// protected void initData() {
// mainPresenter = new MainPresenter();
// instance = this;
// app = (App) getApplication();
// app.CheckLanguage();
// sharedPreferences = getSharedPreferences(AppConfig.LOGININFO,
// MODE_PRIVATE);
// editor = sharedPreferences.edit();
// EventBus.getDefault().register(this);
// editor.putBoolean("isLogIn", true).commit();
// checkPermission();
// String wechatFilePath = getIntent().getStringExtra("wechat_data_path");
// if (!TextUtils.isEmpty(wechatFilePath)) {
// showWxAddDocumentDialog(wechatFilePath);
// }
// }
//
// @Override
// protected void initPresenter() {
// mPresenter = mainPresenter;
// }
//
// private void requestRongCloudOnlineStatus() {
// ServiceInterfaceTools.getinstance().getRongCloudOnlineStatus().enqueue(new Callback<NetworkResponse<Integer>>() {
// @Override
// public void onResponse(Call<NetworkResponse<Integer>> call, Response<NetworkResponse<Integer>> response) {
// if (response != null && response.isSuccessful() && response.body() != null) {
// if (response.body().getRetData() == null) {
// return;
// }
// AppConfig.Online = response.body().getRetData();
// }
// }
//
// @Override
// public void onFailure(Call<NetworkResponse<Integer>> call, Throwable t) {
//
// }
// });
//
// Log.e("user_token", "user_token:" + AppConfig.UserToken);
// }
//
// private void checkPermission() {
// if (ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
// != PackageManager.PERMISSION_GRANTED
// || ActivityCompat.checkSelfPermission(this, Manifest.permission.LOCATION_HARDWARE)
// != PackageManager.PERMISSION_GRANTED
// || ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
// != PackageManager.PERMISSION_GRANTED
// || ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE)
// != PackageManager.PERMISSION_GRANTED
// || ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA)
// != PackageManager.PERMISSION_GRANTED) {
// ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE,
// Manifest.permission.LOCATION_HARDWARE, Manifest.permission.READ_EXTERNAL_STORAGE,
// Manifest.permission.ACCESS_FINE_LOCATION,
// Manifest.permission.READ_PHONE_STATE,
// Manifest.permission.CALL_PHONE,
// Manifest.permission.CAMERA,
// Manifest.permission.RECORD_AUDIO}, 0x0010);
// }
// }
//
//
//
// UserPath userPath;
// private void getCompanyInfo() {
// LoginGet lg = new LoginGet();
// userPath = new UserPath();
// lg.setSchoolTeamGetListener(new LoginGet.SchoolTeamGetListener() {
// @Override
// public void getST(School school) {
// Log.e("GetShoolInfo","school:" + school);
// if (school != null) {
// TeamSpaceBean team = school.getTeamSpaceBean();
// AppConfig.SchoolID = school.getSchoolID();
// editor.putInt("SchoolID", school.getSchoolID());
// editor.putString("SchoolName", school.getSchoolName());
// editor.putString("teamname", team.getName());
// editor.putInt("teamid", team.getItemID());
// editor.commit();
// userPath.setCompanyName(school.getSchoolName());
// userPath.setCompanyId(school.getSchoolID());
// userPath.setTeamName(team.getName());
// userPath.setTeamId(team.getItemID());
// } else {
// editor.putString("SchoolName", "");
// editor.putString("teamname", "");
// editor.putInt("teamid", -1);
// editor.commit();
// }
// initDatas();
// }
// });
// lg.GetUserPreference(this, 10001 + "");
//
// }
//
// private IWXAPI api;
//
// private void GetMaZhang() {
// WeiXinApi.getInstance().init(this);
//
// api = WXAPIFactory.createWXAPI(MainActivityV2.this,
// AppConfig.WX_APP_ID, true);
// api.registerApp(AppConfig.WX_APP_ID);
// api.handleIntent(getIntent(), WeiXinApi.getInstance());
// WeiXinApi.getInstance().setApi(api);
// }
//
// @Override
// protected void onNewIntent(Intent intent) {
// // TODO Auto-generated method stub
// super.onNewIntent(intent);
// setIntent(intent);
// api.handleIntent(intent, WeiXinApi.getInstance());
// }
//
//
// private void UpOrNoOutInfo() {
// if (!TextUtils.isEmpty(AppConfig.OUTSIDE_PATH)) {
// Intent service2 = new Intent(MainActivityV2.this, UploadService.class);
// service2.setFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
// startService(service2);
// } else {
// return;
// }
// }
//
// private void StartWBServiceHAHA() {
// service = new Intent(getApplicationContext(), SocketService.class);
// startService(service);
// }
//
// ProgressDialog progressDialog;
// private void initUpdate() {
// // TODO Auto-generated method stub
// new PgyUpdateManager.Builder()
// .setForced(false) //设置是否强制更新,非自定义回调更新接口此方法有用
// .setUserCanRetry(false) //失败后是否提示重新下载,非自定义下载 apk 回调此方法有用
// .setDeleteHistroyApk(false) // 检查更新前是否删除本地历史 Apk
// .setUpdateManagerListener(new UpdateManagerListener() {
// @Override
// public void onNoUpdateAvailable() {
// //没有更新是回调此方法
// Log.e("pgyer", "there is no new version");
// }
//
// @Override
// public void onUpdateAvailable(final AppBean appBean) {
// //有更新是回调此方法
// Log.e("pgyer", "there is new version can update"
// + "new versionCode is " + appBean.getVersionCode());
//
// //调用以下方法,DownloadFileListener 才有效;如果完全使用自己的下载方法,不需要设置DownloadFileListener
////
// new AlertDialog.Builder(MainActivityV2.this)
// .setTitle(getResources().getString(R.string.update))
// .setMessage(getResources().getString(R.string.update_message))
// .setPositiveButton(getResources().getString(R.string.No), new DialogInterface.OnClickListener() {
// @Override
// public void onClick(DialogInterface dialog,
// int which) {
// // TODO Auto-generated method stub
// dialog.dismiss();
// }
// })
// .setNegativeButton(
// getResources().getString(R.string.update),
// new DialogInterface.OnClickListener() {
// @Override
// public void onClick(
// DialogInterface dialog,
// int which) {
// PgyUpdateManager.downLoadApk(appBean.getDownloadURL());
// }
// }).show();
// }
//
// @Override
// public void checkUpdateFailed(Exception e) {
// //更新检测失败回调
// Log.e("pgyer", "check update failed ", e);
//
// }
// })
// //注意 :下载方法调用 PgyUpdateManager.downLoadApk(appBean.getDownloadURL()); 此回调才有效
// .setDownloadFileListener(new DownloadFileListener() { // 使用蒲公英提供的下载方法,这个接口才有效。
// @Override
// public void downloadFailed() {
// //下载失败
// Log.e("pgyer", "download apk failed");
// if (progressDialog != null) {
// progressDialog.cancel();
// progressDialog = null;
// }
//
// }
//
// @Override
// public void downloadSuccessful(Uri uri) {
// Log.e("pgyer", "download apk failed");
// if (progressDialog != null) {
// progressDialog.cancel();
// progressDialog = null;
// }
// PgyUpdateManager.installApk(uri); // 使用蒲公英提供的安装方法提示用户 安装apk
//
// }
//
// @Override
// public void onProgressUpdate(Integer... integers) {
// Log.e("pgyer", "update download apk progress : " + integers[0]);
// if (progressDialog == null) {
// progressDialog = new ProgressDialog(MainActivityV2.this);
// progressDialog.setProgressStyle(1);
// progressDialog.setCancelable(false);
// progressDialog.setMessage(getResources().getString(R.string.downloading));
// progressDialog.show();
// } else {
// if (integers != null && integers.length > 0) {
// progressDialog.setProgress(integers[0]);
// }
//
// }
// }
// }).register();
// }
//
// @Override
// public void initView() {
// rl_update = (RelativeLayout) findViewById(R.id.rl_update);
// vp = (CustomViewPager) findViewById(R.id.vp);
// tv_redcontact = (TextView) findViewById(R.id.tv_redcontact);
// tv_community = (TextView) findViewById(R.id.tv_community);
////
//// GetTvShow();
//// GetTabName();
//// RongConnect();
//
// }
//
// @Override
// protected int getLayout() {
// return R.layout.activity_main;
// }
//
// private void GetTabName() {
// String[] tab = getResources().getStringArray(R.array.tabname);
// for (int i = 0; i < tvIDs.length; i++) {
// tvs.get(i).setText(tab[i]);
// }
//
// }
//
// private void GetTabName2() {
// String[] tab = getResources().getStringArray(R.array.tabname2);
// for (int i = 0; i < tvIDs.length; i++) {
// tvs.get(i).setText(tab[i]);
// }
// }
//
// private void GetTvShow() {
// for (int i = 0; i < tvIDs.length; i++) {
// TextView tv = (TextView) findViewById(tvIDs[i]);
// if (i == 0) {
// Drawable d = getResources().getDrawable(draw_selectIDs[i]);
// d.setBounds(0, 0, DensityUtil.dp2px(getApplicationContext(), 20),
// DensityUtil.dp2px(getApplicationContext(), 20)); // 必须设置图片大小,否则不显示
// tv.setTextColor(getResources().getColor(R.color.skyblue));
// tv.setCompoundDrawables(null, d, null, null);
// } else {
// Drawable d = getResources().getDrawable(drawIDs[i]);
// d.setBounds(0, 0, DensityUtil.dp2px(getApplicationContext(), 20),
// DensityUtil.dp2px(getApplicationContext(), 20)); // 必须设置图片大小,否则不显示
// tv.setTextColor(getResources().getColor(R.color.darkgrey));
// tv.setCompoundDrawables(null, d, null, null);
// }
// tv.setOnClickListener(new myOnClick());
// tvs.add(tv);
// }
// }
//
// private void RongConnect() {
// RongIM.connect(AppConfig.RongUserToken, new ConnectCallback() {
//
// @Override
// public void onError(ErrorCode arg0) {
// Toast.makeText(getApplicationContext(), "connect onError",
// Toast.LENGTH_SHORT).show();
// }
//
// @Override
// public void onSuccess(String arg0) {
// /*Toast.makeText(getApplicationContext(), "connect onSuccess",
// Toast.LENGTH_SHORT).show();*/
// AppConfig.RongUserID = arg0;
//
// RongIM.registerMessageTemplate(new CustomizeMessageItemProvider());
// RongIM.registerMessageTemplate(new KnowledgeMessageItemProvider());
// RongIM.registerMessageTemplate(new SystemMessageItemProvider());
// RongIM.registerMessageTemplate(new FriendMessageItemProvider());
// RongIM.registerMessageTemplate(new GroupMessageItemProvider());
// RongIM.registerMessageTemplate(new SendFileMessageItemProvider());
//// RongIM.registerMessageTemplate(new CourseMessageItemProvider());
// RongIM.registerMessageTemplate(new ShareMessageItemProvider());
//
//// initDatas();
// flag_dialog = true;
// if (RongIM.getInstance() != null
// && RongIM.getInstance().getRongIMClient() != null) {
// /**
// * 设置连接状态变化的监听器.
// */
// RongIM.getInstance()
// .getRongIMClient()
// .setConnectionStatusListener(
// new MyConnectionStatusListener());
// }
// AppConfig.Online = 0;
// }
//
//
// @Override
// public void onTokenIncorrect() {
// Log.e("Token Incorrect", "Token Incorrect");
// Message msg = new Message();
// msg.what = AppConfig.RONGCONNECT_ERROR;
// msg.obj = "连接错误";
// handler.sendMessage(msg);
// }
// });
//// getToken();
// }
//
// @Override
// public void showLoading() {
//
// }
//
// @Override
// public void dismissLoading() {
//
// }
//
// @Override
// public void toast(String msg) {
//
// }
//
// @Override
// public Context getContext() {
// return null;
// }
//
// @Override
// public void initBottomTabs() {
//
// }
//
// @Override
// public void showWxAddDocumentDialog(String wxPath) {
// if (addWxDocDialog != null) {
// addWxDocDialog.dismiss();
// addWxDocDialog = null;
// }
//
// addWxDocDialog = new AddWxDocDialog(this, wxPath);
// addWxDocDialog.setSavedListener(this);
// addWxDocDialog.show();
//
// }
//
//
// private class MyConnectionStatusListener implements
// RongIMClient.ConnectionStatusListener {
//
// @Override
// public void onChanged(ConnectionStatus connectionStatus) {
//
// switch (connectionStatus) {
//
// case CONNECTED:// 连接成功。
//
// break;
// case DISCONNECTED:// 断开连接。
//
// break;
// case CONNECTING:// 连接中。
//
// break;
// case NETWORK_UNAVAILABLE:// 网络不可用。
//
// break;
// case KICKED_OFFLINE_BY_OTHER_CLIENT:// 用户账户在其他设备登录,本机会被踢掉线
// if (!instance.isFinishing()) {
// Message msg = new Message();
// msg.what = AppConfig.OnlineGunDan;
//// msg.obj = "该账号已在其他设备上登录";
// handler.sendMessage(msg);
// }
//
// break;
// default:
// break;
// }
// }
// }
//
// TopicFragment topicFragment = new TopicFragment();
// private void initDatas() {
// TeamDocumentsFragment documentsFragment = new TeamDocumentsFragment();
// TwoToOneFragment twoToOneFragment = new TwoToOneFragment();
// ServiceFragment serviceFragment = new ServiceFragment();
//// UpgradeFragment upgradeFragment = new UpgradeFragment();
//// CommunityFragment communityFragment = new CommunityFragment();
// PersonalCenterFragment personalCenterFragment = new PersonalCenterFragment();
//
// mTabs = new ArrayList<Fragment>();
// mTabs.add(documentsFragment);
// mTabs.add(twoToOneFragment);
// mTabs.add(serviceFragment);
// mTabs.add(topicFragment);
//// mTabs.add(upgradeFragment);
// if (sharedPreferences.getBoolean("enable_sync", false)) {
// tv_community.setVisibility(View.VISIBLE);
// } else {
// tv_community.setVisibility(View.GONE);
// }
//
// mTabs.add(personalCenterFragment);
//
// mAdapter = new FragmentPagerAdapter(getSupportFragmentManager()) {
//
// @Override
// public int getCount() {
// return mTabs.size();
// }
//
// @Override
// public Fragment getItem(int position) {
// return mTabs.get(position);
// }
// };
// vp.setAdapter(mAdapter);
// vp.setOffscreenPageLimit(5);
// GoTOTab(0);
// Log.e("user_info", "user_token:" + AppConfig.UserToken + ",company_id:" + AppConfig.SchoolID);
//
// }
//
// private void initDatas2() {
// TeamDocumentsFragment documentsFragment = new TeamDocumentsFragment();
// TwoToOneFragment twoToOneFragment = new TwoToOneFragment();
// ServiceFragment serviceFragment = new ServiceFragment();
// TopicFragment topicFragment = new TopicFragment();
// PersonalCenterFragment personalCenterFragment = new PersonalCenterFragment();
//
// mTabs = new ArrayList<Fragment>();
// mTabs.add(documentsFragment);
// mTabs.add(twoToOneFragment);
// mTabs.add(serviceFragment);
// mTabs.add(topicFragment);
// mTabs.add(personalCenterFragment);
//
// mAdapter = new FragmentPagerAdapter(getSupportFragmentManager()) {
//
// @Override
// public int getCount() {
// return mTabs.size();
// }
//
// @Override
// public Fragment getItem(int position) {
// return mTabs.get(position);
// }
// };
// vp.setAdapter(mAdapter);
// vp.setOffscreenPageLimit(4);
//// GoTOTab(0);
//
// }
//
// protected class myOnClick implements OnClickListener {
// @Override
// public void onClick(View v) {
// /*if(AppConfig.SOCKET!=null){
// Log.e("lalala",AppConfig.SOCKET.isClosed() + ";" + AppConfig.SOCKET.isConnected());
// }else{
// Log.e("lalala","Socket null");
// }*/
// switch (v.getId()) {
// case R.id.tv_dialogue:
// if (!flag_dialog) {
// RongConnect();
// }
// GoTOTab(1);
// break;
// case R.id.tv_service:
// GoTOTab(0);
// break;
// case R.id.tv_contact:
// GoTOTab(2);
// break;
// case R.id.tv_community:
// GoTOTab(3);
// break;
// case R.id.tv_personal_center:
// GoTOTab(4);
// break;
// default:
// break;
// }
//
// }
//
// }
//
// public void GoTOTab(int s) {
// for (int i = 0; i < tvs.size(); i++) {
// if (i == s) {
// // 必须设置图片大小,否则不显示ad
// Drawable d = getResources().getDrawable(draw_selectIDs[s]);
// d.setBounds(0, 0, DensityUtil.dp2px(getApplicationContext(), 20),
// DensityUtil.dp2px(getApplicationContext(), 20)); // 必须设置图片大小,否则不显示
// tvs.get(s).setTextColor(getResources().getColor(R.color.skyblue));
// tvs.get(s).setCompoundDrawables(null, d, null, null);
// } else {
// Drawable d = getResources().getDrawable(drawIDs[i]);
// d.setBounds(0, 0, DensityUtil.dp2px(getApplicationContext(), 20),
// DensityUtil.dp2px(getApplicationContext(), 20)); // 必须设置图片大小,否则不显示
// tvs.get(i).setTextColor(getResources().getColor(R.color.darkgrey));
// tvs.get(i).setCompoundDrawables(null, d, null, null);
// }
// }
//
// vp.setCurrentItem(s, false);
// }
//
// private void UpdateOutData() {
// RequestParams params = new RequestParams();
// params.setHeader("UserToken", AppConfig.UserToken);
//
// params.addBodyParameter("Content-Type", "multipart/form-data");// 设定传送的内容类型
// // params.setContentType("application/octet-stream");
// File file = new File(AppConfig.OUTSIDE_PATH);
// if (file.exists()) {
// int lastSlash = 0;
// lastSlash = AppConfig.OUTSIDE_PATH.lastIndexOf("/");
// String name = AppConfig.OUTSIDE_PATH.substring(lastSlash + 1, AppConfig.OUTSIDE_PATH.length());
// params.addBodyParameter(name, file);
// String url = null;
// try {
// url = AppConfig.URL_PUBLIC + "EventAttachment/AddNewFavoriteMultipart?FileName="
// + URLEncoder.encode(LoginGet.getBase64Password(name), "UTF-8")
// + "&Guid=" + AppConfig.DEVICE_ID + System.currentTimeMillis()
// + "&Total=1&Index=1";
// Log.e("hahaha", url + ":" + name);
// } catch (Exception e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// Log.e("url", url);
// HttpUtils http = new HttpUtils();
// http.configResponseTextCharset("UTF-8");
// http.send(HttpRequest.HttpMethod.POST, url, params,
// new RequestCallBack<String>() {
// @Override
// public void onStart() {
// Toast.makeText(getApplicationContext(),
// getString(R.string.upload),
// Toast.LENGTH_LONG).show();
// }
//
// @Override
// public void onLoading(long total, long current,
// boolean isUploading) {
//
// }
//
// @Override
// public void onSuccess(ResponseInfo<String> responseInfo) {
// Log.e("hahaha", responseInfo + "");
// Message message = new Message();
// message.what = AppConfig.UPLOADHEAD;
// handler.sendEmptyMessage(message.what);
// }
//
// @Override
// public void onFailure(HttpException error, String msg) {
// Log.e("error", msg.toString());
// Message message = new Message();
// message.what = AppConfig.UPLOADFAILD;
// handler.sendEmptyMessage(message.what);
// }
// });
// } else {
// Toast.makeText(getApplicationContext(), getString(R.string.nofile),
// Toast.LENGTH_LONG).show();
// }
//
// AppConfig.OUTSIDE_PATH = "";
// }
//
// public void DisplayRed(boolean flag_r) {
// tv_redcontact.setVisibility(flag_r ? View.VISIBLE : View.GONE);
// if (chi != null) {
// chi.RefreshRed(flag_r);
// }
// }
//
//
// private void KillFile() {
// FileUtilsType fileUtils = new FileUtilsType(getApplicationContext());
// fileUtils.deleteFile();
// fileUtils.deleteFile2();
// }
//
// @Override
// protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// super.onActivityResult(requestCode, resultCode, data);
//
// }
//
// @Override
// public void onAttachFragment(Fragment fragment) {
// super.onAttachFragment(fragment);
// if (fragment.getClass().equals(ContactFragment.class)) {
// chi = (ContactHelpInterface) fragment;
// }
// }
//
// @Override
// public void onWindowFocusChanged(boolean hasFocus) {
// super.onWindowFocusChanged(hasFocus);
// /*if (!flag_update) {
// UpOrNoOutInfo();
// flag_update = true;
// }*/
//// flag_update = !flag_update;
//// if (!TextUtils.isEmpty(AppConfig.OUTSIDE_PATH) && flag_update) {
//// UpOrNoOutInfo();
//// }
// }
//
//
// public void onResume() {
// super.onResume();
//
// if (RESUME) {
// FragmentManager fm = getSupportFragmentManager();
// FragmentTransaction ft = fm.beginTransaction();
// for (int i = 0; i < mTabs.size(); i++) {
// Fragment fragment = (Fragment) mTabs.get(i);
// ft.remove(fragment);
// }
//// ft.commit();
// //华为用ft.commit(),会引发异常(Can not perform this action after onSaveInstanceState),改用这个就不会了,而且效果一样
// ft.commitAllowingStateLoss();
// ft = null;
// fm.executePendingTransactions();
//
// GetTabName();
// initDatas();
// GoTOTab(4);
// }
//
// if (AppConfig.isRefreshRed) {
// DisplayRed(false);
// }
//
// AppConfig.isToPersonalCenter = false;
// AppConfig.isRefreshRed = false;
//
// MobclickAgent.onPageStart("MainActivity");
// MobclickAgent.onResume(this);
// Log.e("time_interval", "interval:" + (System.currentTimeMillis() - systemTime));//统计时长
//
// }
//
// public void onPause() {
// super.onPause();
// MobclickAgent.onPageEnd("MainActivity");
// MobclickAgent.onPause(this);
//
// }
//
// @Subscribe(threadMode = ThreadMode.MAIN)
// public void toastRequestErrorMessage(String message) {
// if (TextUtils.isEmpty(message)) {
// message = getString(R.string.operate_failure);
// }
// Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();
// }
//
// @Subscribe(threadMode = ThreadMode.MAIN)
// public void refreshTabs(EventRefreshTab eventRefreshTab) {
// boolean enableSync = sharedPreferences.getBoolean("enable_sync", false);
// Log.e("MainActivity", "enableSync:" + enableSync);
// if (enableSync) {
// tv_community.setVisibility(View.VISIBLE);
// } else {
// tv_community.setVisibility(View.GONE);
// }
// }
//
// @Override
// protected void onDestroy() {
// // TODO Auto-generated method stub
// super.onDestroy();
// instance = null;
// app.setMainActivityInstance(null);
// AppConfig.isUpdateCustomer = false;
// AppConfig.isUpdateDialogue = false;
// AppConfig.HASUPDATAINFO = false;
// stopService(service);
// EventBus.getDefault().unregister(this);
// app.getThreadMgr().shutDown();
// KillFile();
// }
//
// AddWxDocDialog addWxDocDialog;
//
// @Subscribe(threadMode = ThreadMode.MAIN)
// public void fromWeChat(EventWxFilePath filePath) {
// Log.e("check_dialog", "show dialog");
// if (addWxDocDialog != null) {
// addWxDocDialog.dismiss();
// addWxDocDialog = null;
// }
// addWxDocDialog = new AddWxDocDialog(this, filePath.getPath());
// addWxDocDialog.setSavedListener(this);
// addWxDocDialog.show();
//
// }
//
//
// private UploadFileDialog uploadFileDialog;
//
// private AddDocToSpaceDialog addDocToSpaceDialog;
//
// @Override
// public void onSpaceSelected(int spaceId) {
// AddDocumentTool.addDocumentToSpace(this, filePath, spaceId, new DocumentUploadTool.DocUploadDetailLinstener() {
// @Override
// public void uploadStart() {
// runOnUiThread(new Runnable() {
// @Override
// public void run() {
// if (uploadFileDialog == null) {
// uploadFileDialog = new UploadFileDialog(MainActivityV2.this);
// uploadFileDialog.setTile("uploading");
// uploadFileDialog.show();
//
// } else {
// if (!uploadFileDialog.isShowing()) {
// uploadFileDialog.show();
// }
// }
// }
// });
// }
//
// @Override
// public void uploadFile(final int progress) {
// runOnUiThread(new Runnable() {
// @Override
// public void run() {
// if (uploadFileDialog != null && uploadFileDialog.isShowing()) {
// uploadFileDialog.setProgress(progress);
// }
// }
// });
// }
//
// @Override
// public void convertFile(final int progress) {
// runOnUiThread(new Runnable() {
// @Override
// public void run() {
// if (uploadFileDialog != null && uploadFileDialog.isShowing()) {
// uploadFileDialog.setTile("Converting");
// uploadFileDialog.setProgress(progress);
// }
// }
// });
// }
//
// @Override
// public void uploadFinished() {
// runOnUiThread(new Runnable() {
// @Override
// public void run() {
//// addDocSucc();
// if (uploadFileDialog != null) {
// uploadFileDialog.cancel();
// }
// new CenterToast.Builder(getApplicationContext()).setSuccess(true).setMessage(getResources().getString(R.string.create_success)).create().show();
// EventBus.getDefault().post(new TeamSpaceBean());
// }
// });
//
// }
//
// @Override
// public void uploadError(String message) {
// runOnUiThread(new Runnable() {
// @Override
// public void run() {
// Toast.makeText(getApplicationContext(), "add favorite success", Toast.LENGTH_SHORT).show();
// }
// });
// }
// });
// }
//
// String filePath;
// @Override
// public void onSaveSpace(String path) {
// this.filePath = path;
// if (addDocToSpaceDialog != null) {
// addDocToSpaceDialog.dismiss();
// }
// addDocToSpaceDialog = new AddDocToSpaceDialog(this);
// addDocToSpaceDialog.setOnSpaceSelectedListener(this);
// addDocToSpaceDialog.show();
// }
//
//
// @Override
// public void onSaveFavorite(String path) {
// AddDocumentTool.addDocumentToFavorite(this, path, new DocumentUploadTool.DocUploadDetailLinstener() {
// @Override
// public void uploadStart() {
// runOnUiThread(new Runnable() {
// @Override
// public void run() {
// if (uploadFileDialog != null) {
// uploadFileDialog.cancel();
// }
// uploadFileDialog = new UploadFileDialog(MainActivityV2.this);
// uploadFileDialog.setTile("uploading");
// uploadFileDialog.show();
// }
// });
// }
//
// @Override
// public void uploadFile(final int progress) {
// runOnUiThread(new Runnable() {
// @Override
// public void run() {
// if (uploadFileDialog != null && uploadFileDialog.isShowing()) {
// uploadFileDialog.setProgress(progress);
// }
// }
// });
//
// }
//
// @Override
// public void convertFile(final int progress) {
// runOnUiThread(new Runnable() {
// @Override
// public void run() {
// if (uploadFileDialog != null && uploadFileDialog.isShowing()) {
// uploadFileDialog.setTile("Converting");
// uploadFileDialog.setProgress(progress);
// }
// }
// });
//
// }
//
// @Override
// public void uploadFinished() {
// runOnUiThread(new Runnable() {
// @Override
// public void run() {
// if (uploadFileDialog != null && uploadFileDialog.isShowing()) {
// uploadFileDialog.cancel();
// Toast.makeText(getApplicationContext(), "add favorite success", Toast.LENGTH_SHORT).show();
// Intent intent = new Intent(MainActivityV2.this, PersonalCollectionActivity.class);
// startActivity(intent);
//
// }
// }
// });
// }
//
// @Override
// public void uploadError(final String message) {
// runOnUiThread(new Runnable() {
// @Override
// public void run() {
// if (uploadFileDialog != null && uploadFileDialog.isShowing()) {
// uploadFileDialog.cancel();
// }
// String errorMessage = message;
// if (TextUtils.isEmpty(errorMessage)) {
// errorMessage = getString(R.string.operate_failure);
// }
// Toast.makeText(getApplicationContext(), errorMessage, Toast.LENGTH_SHORT).show();
// }
// });
// }
// });
// }
//
//
//}
| [
"[email protected]"
] | |
a27834f9880905cd1e1aa0bf54fb9f7736eddde1 | 51de3ea6616feb708169fc246dab6c8636c491f5 | /result/com.beust.jcommander.internal.Maps/traditional_mutants/java.util.Map_newHashMap(T)/AOIU_2/Maps.java | 05f54f98e8ab995c7a068b24f2808e14e277ad5e | [
"Apache-2.0"
] | permissive | ps073006/main_mujava | ab442a597b514cc8491b8b5bd551e8e90e0aa5c6 | c62f68d78c65d91f9dbf5a9a72df152cdda05a9d | refs/heads/master | 2021-01-10T04:37:47.416163 | 2016-01-19T19:36:28 | 2016-01-19T19:36:28 | 49,980,696 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 723 | java | // This is a mutant program.
// Author : ysma
package com.beust.jcommander.internal;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
public class Maps
{
public static <K,V> java.util.Map<K,V> newHashMap()
{
return new java.util.HashMap<K,V>();
}
public static <K,V> java.util.Map<K,V> newLinkedHashMap()
{
return new java.util.LinkedHashMap<K,V>();
}
public static <T> java.util.Map<T,T> newHashMap( T... parameters )
{
java.util.Map<T,T> result = Maps.newHashMap();
for (int i = 0; i < parameters.length; i += 2) {
result.put( parameters[i], parameters[-i + 1] );
}
return result;
}
}
| [
"[email protected]"
] | |
4dbe3ec4e6d579fe6550742095bad66099a14614 | b3ae7b8e9d1ae8032d487d52a2bdae756383dd40 | /app/src/main/java/de/jzbor/epos/threading/UniHandler.java | eee6ea21e868502952ac5d36fd808851b455c5fb | [] | no_license | jzbor/EpOs | 015fc8bb04330dd52487d5de80d6fd789465e390 | 03db66c65dad5cc32e79a4eaa7891ac8a7091354 | refs/heads/master | 2020-04-30T10:35:31.134822 | 2019-11-17T16:13:11 | 2019-11-17T16:13:11 | 176,781,122 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,244 | java | package de.jzbor.epos.threading;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.widget.Toast;
import java.io.File;
import java.io.IOException;
import java.io.InvalidClassException;
import de.jzbor.epos.App;
import de.jzbor.epos.R;
import de.jzbor.epos.activities.MainActivity;
import de.jzbor.hgvinfo.DataHandler;
import de.jzbor.hgvinfo.model.Calendar;
import de.jzbor.hgvinfo.model.Notifications;
import de.jzbor.hgvinfo.model.Schedule;
import de.jzbor.hgvinfo.model.Subplan;
public class UniHandler extends Handler implements DataHandler {
public static final String TAG = "UniHandler";
public MainActivity activity;
public UniHandler(MainActivity activity) {
this.activity = activity;
}
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case TOAST: {
toast((String) msg.obj);
break;
}
case RESPONSE_SUBPLAN: {
Subplan subplan = (Subplan) (msg.obj);
boolean saved = subplan.save(activity.getApplicationContext().getCacheDir(),
activity.getString(R.string.filename_subplan));
if (saved)
activity.onUpdateSucceeded();
else
activity.onUpdateFailed();
// Missing else? onUpdateFailure?
break;
}
case RESPONSE_SCHEDULE: {
Schedule schedule = (Schedule) (msg.obj);
try {
if (new File(activity.getCacheDir(), activity.getString(R.string.filename_schedule)).exists()) {
try {
Schedule oldSchedule = (Schedule) App.openObject(activity.getApplicationContext().getCacheDir(),
activity.getString(R.string.filename_schedule));
schedule.setAdditionalClasses(oldSchedule.getAdditionalClasses());
} catch (InvalidClassException e) {
// This is necessary to avoid problems with old versions of the serialized schedule
Log.e(App.TAG, "Apparently the serialized schedule object was" +
" created by an older version of the app");
e.printStackTrace();
}
}
//schedule.filter();
App.saveObject(activity.getApplicationContext().getCacheDir(), activity.getString(R.string.filename_schedule), schedule);
activity.onUpdateSucceeded();
} catch (IOException | ClassNotFoundException e) {
e.printStackTrace();
activity.onUpdateFailed();
}
Message recMsg = obtainMessage(UPDATE_NEXT_LESSON, schedule.nextLesson());
recMsg.sendToTarget();
break;
}
case RESPONSE_PERSONAL: {
String[] pers = (String[]) (msg.obj);
try {
App.saveObject(activity.getApplicationContext().getCacheDir(), activity.getString(R.string.filename_personal), pers);
activity.onUpdateSucceeded();
} catch (IOException e) {
e.printStackTrace();
activity.onUpdateFailed();
}
break;
}
case RESPONSE_DATES: {
Calendar calendar = (Calendar) (msg.obj);
try {
App.saveObject(activity.getApplicationContext().getCacheDir(), activity.getString(R.string.filename_dates), calendar);
activity.onUpdateSucceeded();
} catch (IOException e) {
e.printStackTrace();
activity.onUpdateFailed();
}
break;
}
case RESPONSE_NOTIFICATIONS: {
Notifications notifications = (Notifications) (msg.obj);
try {
App.saveObject(activity.getApplicationContext().getCacheDir(), activity.getString(R.string.filename_news), notifications);
activity.onUpdateSucceeded();
} catch (IOException e) {
e.printStackTrace();
activity.onUpdateFailed();
}
break;
}
case REPORT_NAME_CLASS: {
try {
App.saveObject(activity.getCacheDir(), activity.getString(R.string.filename_personal), msg.obj);
} catch (IOException e) {
e.printStackTrace();
activity.onUpdateFailed();
}
break;
}
case UPDATE_NEXT_LESSON: {
activity.updateNextLesson((String) msg.obj);
break;
}
case ERROR_UNKNOWN: {
activity.onUpdateFailed();
break;
}
case ERROR_CONNECTION: {
activity.onUpdateFailed();
break;
}
case ERROR_PARSING: {
activity.onUpdateFailed();
break;
}
case ERROR_LOGIN: {
activity.onUpdateFailed();
break;
}
case ERROR_SAVING: {
activity.onUpdateFailed();
break;
}
default: {
activity.onUpdateFailed();
break;
}
}
}
private void toast(String string) {
Toast.makeText(activity, string, Toast.LENGTH_SHORT).show();
}
@Override
public void handle(int type, int id, Object object) {
if (object != null) {
System.out.println("Handle: " + type + " - " + id + " - " + object.getClass());
} else {
System.out.println("Handle: " + type + " - " + id + " - Object is null object: " + object);
}
Message msg = obtainMessage(type, object);
msg.sendToTarget();
}
}
| [
"[email protected]"
] | |
f215f323baf29c089e81cc0ef36a24fadd6bae1b | 40505ead4240c2c021477bb5a618217bd371ac55 | /mus-mysql-agent-core/src/main/java/net/vickymedia/mysql/agent/config/ZKProperty.java | 6884db0a81e0a57de4d5699e154d7cdfe9112cff | [] | no_license | phantasy1234/mysql-ha | ae62c04fc8fc687af9bd08e890eea0dc258f3394 | f67f3b29068a0d24395d3a28bc4fff838015aadc | refs/heads/master | 2021-01-10T05:31:15.419002 | 2016-03-01T07:02:12 | 2016-03-01T07:02:12 | 52,855,143 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 400 | java | package net.vickymedia.mysql.agent.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* User: weijie.song
* Date: 16/2/3 下午6:17
*/
@Data
@ConfigurationProperties(prefix = "zookeeper")
public class ZKProperty {
String zkServer;
int sessionTimeoutMs;
int connectionTimeoutMs;
int baseSleepTimeMs;
int maxRetries;
String zkNode;
}
| [
"[email protected]"
] | |
dedb3db8e6cca8257c1dbd03e39650b45a6c17d0 | 6d109557600329b936efe538957dfd0a707eeafb | /src/com/google/api/ads/dfp/v201302/DimensionFilter.java | 3325a0e3d868d1c680a96d49c2be61680f7e2939 | [
"Apache-2.0"
] | permissive | google-code-export/google-api-dfp-java | 51b0142c19a34cd822a90e0350eb15ec4347790a | b852c716ef6e5d300363ed61e15cbd6242fbac85 | refs/heads/master | 2020-05-20T03:52:00.420915 | 2013-12-19T23:08:40 | 2013-12-19T23:08:40 | 32,133,590 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,580 | java | /**
* DimensionFilter.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.google.api.ads.dfp.v201302;
public class DimensionFilter implements java.io.Serializable {
private java.lang.String _value_;
private static java.util.HashMap _table_ = new java.util.HashMap();
// Constructor
protected DimensionFilter(java.lang.String value) {
_value_ = value;
_table_.put(_value_,this);
}
public static final java.lang.String _ADVERTISERS = "ADVERTISERS";
public static final java.lang.String _ACTIVE_ADVERTISERS = "ACTIVE_ADVERTISERS";
public static final java.lang.String _HOUSE_ADVERTISERS = "HOUSE_ADVERTISERS";
public static final java.lang.String _NON_HOUSE_ADVERTISERS = "NON_HOUSE_ADVERTISERS";
public static final java.lang.String _ALL_SALESPEOPLE = "ALL_SALESPEOPLE";
public static final java.lang.String _WHOLE_NETWORK = "WHOLE_NETWORK";
public static final java.lang.String _CURRENT_USER_ORDERS = "CURRENT_USER_ORDERS";
public static final java.lang.String _STARTED_ORDERS = "STARTED_ORDERS";
public static final java.lang.String _COMPLETED_ORDERS = "COMPLETED_ORDERS";
public static final java.lang.String _MOBILE_LINE_ITEMS = "MOBILE_LINE_ITEMS";
public static final java.lang.String _WEB_LINE_ITEMS = "WEB_LINE_ITEMS";
public static final java.lang.String _ACTIVE_AD_UNITS = "ACTIVE_AD_UNITS";
public static final java.lang.String _INACTIVE_AD_UNITS = "INACTIVE_AD_UNITS";
public static final java.lang.String _MOBILE_INVENTORY_UNITS = "MOBILE_INVENTORY_UNITS";
public static final java.lang.String _WEB_INVENTORY_UNITS = "WEB_INVENTORY_UNITS";
public static final java.lang.String _ARCHIVED_AD_UNITS = "ARCHIVED_AD_UNITS";
public static final java.lang.String _ACTIVE_PLACEMENTS = "ACTIVE_PLACEMENTS";
public static final java.lang.String _INACTIVE_PLACEMENTS = "INACTIVE_PLACEMENTS";
public static final java.lang.String _ARCHIVED_PLACEMENTS = "ARCHIVED_PLACEMENTS";
public static final java.lang.String _OPTIMIZABLE_ORDERS = "OPTIMIZABLE_ORDERS";
public static final java.lang.String _PARTNER_STATS_TYPE_ESTIMATED = "PARTNER_STATS_TYPE_ESTIMATED";
public static final java.lang.String _PARTNER_STATS_TYPE_RECONCILED = "PARTNER_STATS_TYPE_RECONCILED";
public static final DimensionFilter ADVERTISERS = new DimensionFilter(_ADVERTISERS);
public static final DimensionFilter ACTIVE_ADVERTISERS = new DimensionFilter(_ACTIVE_ADVERTISERS);
public static final DimensionFilter HOUSE_ADVERTISERS = new DimensionFilter(_HOUSE_ADVERTISERS);
public static final DimensionFilter NON_HOUSE_ADVERTISERS = new DimensionFilter(_NON_HOUSE_ADVERTISERS);
public static final DimensionFilter ALL_SALESPEOPLE = new DimensionFilter(_ALL_SALESPEOPLE);
public static final DimensionFilter WHOLE_NETWORK = new DimensionFilter(_WHOLE_NETWORK);
public static final DimensionFilter CURRENT_USER_ORDERS = new DimensionFilter(_CURRENT_USER_ORDERS);
public static final DimensionFilter STARTED_ORDERS = new DimensionFilter(_STARTED_ORDERS);
public static final DimensionFilter COMPLETED_ORDERS = new DimensionFilter(_COMPLETED_ORDERS);
public static final DimensionFilter MOBILE_LINE_ITEMS = new DimensionFilter(_MOBILE_LINE_ITEMS);
public static final DimensionFilter WEB_LINE_ITEMS = new DimensionFilter(_WEB_LINE_ITEMS);
public static final DimensionFilter ACTIVE_AD_UNITS = new DimensionFilter(_ACTIVE_AD_UNITS);
public static final DimensionFilter INACTIVE_AD_UNITS = new DimensionFilter(_INACTIVE_AD_UNITS);
public static final DimensionFilter MOBILE_INVENTORY_UNITS = new DimensionFilter(_MOBILE_INVENTORY_UNITS);
public static final DimensionFilter WEB_INVENTORY_UNITS = new DimensionFilter(_WEB_INVENTORY_UNITS);
public static final DimensionFilter ARCHIVED_AD_UNITS = new DimensionFilter(_ARCHIVED_AD_UNITS);
public static final DimensionFilter ACTIVE_PLACEMENTS = new DimensionFilter(_ACTIVE_PLACEMENTS);
public static final DimensionFilter INACTIVE_PLACEMENTS = new DimensionFilter(_INACTIVE_PLACEMENTS);
public static final DimensionFilter ARCHIVED_PLACEMENTS = new DimensionFilter(_ARCHIVED_PLACEMENTS);
public static final DimensionFilter OPTIMIZABLE_ORDERS = new DimensionFilter(_OPTIMIZABLE_ORDERS);
public static final DimensionFilter PARTNER_STATS_TYPE_ESTIMATED = new DimensionFilter(_PARTNER_STATS_TYPE_ESTIMATED);
public static final DimensionFilter PARTNER_STATS_TYPE_RECONCILED = new DimensionFilter(_PARTNER_STATS_TYPE_RECONCILED);
public java.lang.String getValue() { return _value_;}
public static DimensionFilter fromValue(java.lang.String value)
throws java.lang.IllegalArgumentException {
DimensionFilter enumeration = (DimensionFilter)
_table_.get(value);
if (enumeration==null) throw new java.lang.IllegalArgumentException();
return enumeration;
}
public static DimensionFilter fromString(java.lang.String value)
throws java.lang.IllegalArgumentException {
return fromValue(value);
}
public boolean equals(java.lang.Object obj) {return (obj == this);}
public int hashCode() { return toString().hashCode();}
public java.lang.String toString() { return _value_;}
public java.lang.Object readResolve() throws java.io.ObjectStreamException { return fromValue(_value_);}
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.EnumSerializer(
_javaType, _xmlType);
}
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.EnumDeserializer(
_javaType, _xmlType);
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(DimensionFilter.class);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v201302", "DimensionFilter"));
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
}
| [
"[email protected]@e5600b00-1bfd-11df-acd4-e1cde50d4098"
] | [email protected]@e5600b00-1bfd-11df-acd4-e1cde50d4098 |
bc56b9b06595e4ba14a09ac025e66a34c2f2a8ca | e785743c24fc221f05c3232da41cd928177c76a9 | /src/main/java/pt/isel/ls/model/data/dtos/DTOType.java | e913b345d577cc6b804cd2ae8fa9b1db4340234b | [] | no_license | razor54/LS | 39c103deb36b53770718453521a77f1767482342 | fe02ed1e8b7057922410856b6c75d11ac4ca9fc9 | refs/heads/master | 2021-03-16T06:04:43.372016 | 2017-09-13T21:27:18 | 2017-09-13T21:27:18 | 103,452,351 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 140 | java | package pt.isel.ls.model.data.dtos;
public enum DTOType {
Message, //table updates
Data, //gets
Info //static
}
| [
"[email protected]"
] | |
91ec4eafac0e75910ab5349008fecf531b976002 | 6af6a6b0c3e199ddc39cc8ccce4e4bf8f77a7e3f | /OOPS1/src/academy/learnjava/Car.java | 68ddef43d08a139899c99cc6e657ed43e873b8da | [] | no_license | kavishb12/Java_Practice | e4d289980fc3b755dc8a4f5a10f4fd1d1c8b0748 | bff2f84b729731388833e8cd5da52a2fc1e68211 | refs/heads/master | 2023-01-03T11:51:08.093650 | 2020-10-30T18:18:55 | 2020-10-30T18:18:55 | 298,893,221 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 49 | java | package academy.learnjava;
public class Car {
}
| [
"[email protected]"
] | |
04ed7cd46815a745da0c8fe268df4217fcab9fbb | e41c2e6175325b4a63a98307476127ab6028c88b | /cxf/soap(wsdl)/02-spring-db/src/main/java/com/mycompany/study/ws/server/service/UserServiceImpl.java | 73e23f4e8905b63461cef7f135ba909e66325ea6 | [] | no_license | usedtolove/webservice-study | db9202fa175d56230d7a9bfdf2b62e8c6032c1f6 | 377b727d7a8c7b2cbc68e7d8ef58cc0f08de5f00 | refs/heads/master | 2021-01-11T11:08:54.310831 | 2013-05-26T10:24:54 | 2013-05-26T10:24:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 864 | java | package com.mycompany.study.ws.server.service;
import com.mycompany.study.ws.server.dao.UserDao;
import com.mycompany.study.ws.server.entity.User;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
@Service
@Transactional
public class UserServiceImpl implements UserService{
@Resource
private UserDao userDao;
public List<User> getList() {
return userDao.getList();
}
public User getById(String id) {
return userDao.getById(id);
}
public void create(User user) {
userDao.create(user);
}
public void update(User user){
userDao.update(user);
}
public void deleteById(String id) {
User user = userDao.getById(id);
userDao.deleteById(user);
}
}
| [
"[email protected]"
] | |
2188473884d36b782ccb566ffc604acc5750a4b8 | fb9615628a33b2af930745e20dc22969c8e4c31c | /app/src/main/java/com/example/xudong/myquick/DataBase/outcome.java | d4fa2de7d7b0e37c2fa0806d2d7c5826339d2db7 | [] | no_license | xudong21150713/MyQuick | 872f4ccd331e796cc9fa50aaed8a85551180f971 | 19082da4226cb76fe68b3e6c5c5665d3920e17f0 | refs/heads/master | 2020-05-18T07:13:24.975433 | 2019-04-30T12:32:20 | 2019-04-30T12:32:20 | 184,258,494 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 719 | java | package com.example.xudong.myquick.DataBase;
import com.google.gson.Gson;
public class outcome {
public int id; //支出编号
public String income_type;//支出类型 分alipay(支付宝),wechatpay(微信支付),cash(现金支付),card(银行卡转账)
public double cash1; //支出金额
public String date;//支出日期
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
return id == ((user) o).id;
}
@Override
public int hashCode() {
return id;
}
@Override
public String toString() {
return new Gson().toJson(this);
}
}
| [
"[email protected]"
] | |
fa417dad420b0bdfbb7256219aa8d50aa78b29cc | 2c42ff8e677790139f972934d0604ed9baf61930 | /Files From Teacher/Java/3-JAVA第三阶段/2019-6-20-SSH/spring/src/main/java/com/woniuxy/s_aop2/RootConfig.java | 1f5067c148d62ab280a32ddc1edaee157df6b445 | [] | no_license | DukeTiny/education | ee845c0e5b0d171337c6f52052e054379e1ddc1b | 8ec8aaec07897ca93d16b08a7ef431beb680eaf3 | refs/heads/master | 2022-12-25T03:46:06.741009 | 2019-10-15T17:11:04 | 2019-10-15T17:11:04 | 215,351,747 | 0 | 0 | null | 2022-12-16T09:59:04 | 2019-10-15T16:56:27 | TSQL | UTF-8 | Java | false | false | 592 | java | package com.woniuxy.s_aop2;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.test.context.ContextConfiguration;
@ContextConfiguration
@ComponentScan
@EnableAspectJAutoProxy // 等价于xml配置中的<aop:aspectj-autoproxy />
public class RootConfig {
@Bean
public ICalc c2() {
ICalc c = new CalcImpl();
return c;
}
@Bean
public ICalc c3() {
ICalc c = new CalcImpl();
return c;
}
}
| [
"[email protected]"
] | |
e6faa6fd6ad97afb07af33061b0506a53e65d97b | 1ff42f817b12fb783d70ce50ddf919e9354c3097 | /src/main/java/com/chapter1/exercise/Ex_1_1_24.java | bb9f8edc518dd3c7f03aac4d2f30e6998495c001 | [] | no_license | tomisme-dev/algorithm | 9659d0155594fe03e8a6415b4570399d5648cada | 8b3e9f635458c81b57390f3bd13cac38d3c73a52 | refs/heads/master | 2022-03-14T06:36:24.301947 | 2019-11-08T09:33:52 | 2019-11-08T09:33:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 969 | java | package com.chapter1.exercise;
public class Ex_1_1_24 {
public static void main(String[] args) {
System.out.println(greaterCommonDivisor(105, 24));
System.out.println(greaterCommonDivisor(1111111, 1234567));
System.out.println(greaterCommonDivisor2(105, 24));
System.out.println(greaterCommonDivisor2(1111111, 1234567));
}
public static int greaterCommonDivisor(int p, int q) {
int max = Math.max(p, q);
int min = Math.min(p, q);
System.out.printf("(%d, %d)\n", max, min);
if(max % min == 0) {
return min;
}
return greaterCommonDivisor(min, max % min);
}
public static int greaterCommonDivisor2(int p, int q) {
int max = Math.max(p, q);
int min = Math.min(p, q);
System.out.printf("(%d, %d)\n", max, min);
if(max % min == 0) {
return min;
}
return greaterCommonDivisor(min, max - min);
}
}
| [
"[email protected]"
] | |
20031d7325396518e5b3ad6d757a9b77b76b52f0 | b96bad6ac044500b098dddb6819a93c5732dba9d | /src/main/java/Item.java | fdf68662b1029ae853fcd92fafcdbe492d0fbc07 | [] | no_license | derekjpopovich/asurite_review | dfbb4e94490b70d7199d5eb698658ff76e5b9964 | 2c3a873ad1f09ffd0c472969bf01229ec0635494 | refs/heads/master | 2020-03-07T23:59:35.418053 | 2018-04-05T14:33:42 | 2018-04-05T14:33:42 | 127,795,266 | 0 | 0 | null | 2018-04-05T14:32:43 | 2018-04-02T18:22:10 | Java | UTF-8 | Java | false | false | 321 | java | package main.java;
/**
Class: Item.java
Description: Item class for program. Array of Items are used in the sort methods
*/
public final class Item {
public int key;
//constructor
public Item(int keyValue) {
key = keyValue;
}
// further components and methods
}
| [
"[email protected]"
] | |
50c5b47f2300e67b54ddb2efce6fec29980f47bf | f51d514f6149166346bd6efd8887c839ef09a632 | /gamecomposer/src/main/java/de/mirkosertic/gamecomposer/objectinspector/utils/DoublePropertyEditor.java | 0a8e1372ec397b971dc09e00442198f077e91031 | [] | no_license | mirkosertic/GameComposer | fae3c72a381a640344e885ac9b3235fd86c8c954 | bbe0c583c9bba894f3fa3e2f80eb0a73025e3f58 | refs/heads/master | 2023-08-16T22:59:10.068628 | 2023-04-28T07:41:10 | 2023-04-28T07:41:10 | 13,907,695 | 67 | 21 | null | 2023-09-12T04:52:16 | 2013-10-27T18:24:00 | Java | UTF-8 | Java | false | false | 2,789 | java | /*
* Copyright 2016 Mirko Sertic
*
* 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 de.mirkosertic.gamecomposer.objectinspector.utils;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import org.controlsfx.control.PropertySheet;
import org.controlsfx.property.editor.PropertyEditor;
import org.controlsfx.validation.ValidationSupport;
import org.controlsfx.validation.Validator;
public class DoublePropertyEditor implements PropertyEditor<Double> {
private Double value;
private final HBox editor;
private final TextField inputfield;
private PropertySheet.Item item;
private final ValidationSupport validationSupport;
public DoublePropertyEditor(PropertySheet.Item aItem) {
item = aItem;
inputfield = new TextField();
inputfield.setMaxWidth(50);
inputfield.focusedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
if (!newValue) {
if (!validationSupport.isInvalid()) {
value = Double.valueOf(inputfield.getText());
item.setValue(value);
}
}
}
});
validationSupport = new ValidationSupport();
Validator theValidator = Validator.combine(
Validator.createEmptyValidator("A value is required"),
Validator.createPredicateValidator(new DoublePredicate(), "Value is not a valid number")
);
validationSupport.registerValidator(inputfield, theValidator);
editor = new HBox();
editor.setAlignment(Pos.BASELINE_LEFT);
editor.getChildren().add(inputfield);
}
@Override
public Node getEditor() {
return editor;
}
@Override
public Double getValue() {
return value;
}
@Override
public void setValue(Double aValue) {
value = aValue;
inputfield.setText("" + value);
validationSupport.redecorate();
}
} | [
"[email protected]"
] | |
e666dbc6b83e6578237cf4e79d73a11cbbbb805c | 13748a20e8ec57fdf2ff6de0a098fabafc8cade9 | /src/main/java/com/dragon/apps/service/MenuHandleService.java | 8774ff2ae0cacc3e9d0e56e92fdc72b3ee7e51fe | [] | no_license | yunzhonghe/wx | bba2abd88b4c1c247f0ae511885072408383096b | 5a342f2ec287f6c28a8272df64d0135fff327841 | refs/heads/master | 2016-09-11T03:15:22.880202 | 2014-12-05T06:53:49 | 2014-12-05T06:53:49 | 25,929,520 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,478 | java | package com.dragon.apps.service;
import com.dragon.spider.api.BaseAPI;
import com.dragon.spider.api.config.ApiConfig;
import com.dragon.spider.api.request.MenuRequest;
import com.dragon.spider.api.response.BaseResponse;
import com.dragon.spider.api.response.GetMenuResponse;
import com.dragon.spider.util.BeanUtil;
import com.dragon.spider.util.JSONUtil;
/**
* 菜单相关API
* @author peiyu
*/
public class MenuHandleService extends BaseAPI {
public MenuHandleService(ApiConfig config) {
super(config);
}
/**
* 创建菜单
* @param request 请求对象
*/
public void createMenu(MenuRequest request) {
BeanUtil.requireNonNull(request, "request is null");
String url = BASE_API_URL + "cgi-bin/menu/create?access_token=#";
executePost(url, request.toJsonString());
}
/**
* 获取所有菜单
* @return 菜单列表对象
*/
public GetMenuResponse getMenu() {
GetMenuResponse response = null;
String url = BASE_API_URL + "cgi-bin/menu/get?access_token=#";
BaseResponse r = executeGet(url);
if(null == r.getErrcode() || "".equals(r.getErrcode())) {
response = JSONUtil.toBean(r.getErrmsg(), GetMenuResponse.class);
}
return response;
}
/**
* 删除所有菜单
*/
public void deleteMenu() {
String url = BASE_API_URL + "cgi-bin/menu/delete?access_token=#";
executeGet(url);
}
}
| [
"[email protected]"
] | |
deea2c2380e8afab2ea6423e1a9342b25f992655 | 936282bd790a755bbdc56102fa05c5795629f148 | /src/main/java/pe/edu/tecsup/tienda/services/CategoriaServiceImpl.java | a4b93e3bb9748bd846bef2d76e022300e22d1ec9 | [] | no_license | cuellar2020/SpringTiendaWeb | e1d707f3b4adf1aa855356680207735c6c8870a4 | 8defe187bf733960f5329d23d27c9dd182d5326f | refs/heads/master | 2023-08-04T12:18:29.156023 | 2021-09-15T00:38:47 | 2021-09-15T00:38:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 674 | java | package pe.edu.tecsup.tienda.services;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pe.edu.tecsup.tienda.entities.Categoria;
import pe.edu.tecsup.tienda.repositories.CategoriaRepository;
@Service
public class CategoriaServiceImpl
implements CategoriaService {
private static final Logger log
= LoggerFactory.getLogger(CategoriaServiceImpl.class);
@Autowired
private CategoriaRepository categoriaRepository;
@Override
public List<Categoria> findAll() {
return categoriaRepository.findAll();
}
}
| [
"[email protected]"
] | |
c280f869fd2c1c4b66e2640be7f1264e881f4e34 | 0b31f39e1e472fd2126f282b70c413582e13f4dd | /app/src/main/java/com/geostar/smackandroid/message/data/dao/DaoSession.java | 68f6d3ab59c341feb4dba23aaf6d5d48f211bde5 | [] | no_license | JustDoITs/SmackAndroid | cd9d43cb46bfec6f6dd82e7a887d265e337cf3e2 | 8b7b42174d14282eed54ec2986369c6b3bbbf86c | refs/heads/master | 2020-12-26T04:48:36.390564 | 2016-07-28T01:12:32 | 2016-07-28T01:12:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,338 | java | package com.geostar.smackandroid.message.data.dao;
import android.database.sqlite.SQLiteDatabase;
import java.util.Map;
import de.greenrobot.dao.AbstractDao;
import de.greenrobot.dao.AbstractDaoSession;
import de.greenrobot.dao.identityscope.IdentityScopeType;
import de.greenrobot.dao.internal.DaoConfig;
import com.geostar.smackandroid.message.data.dao.ChatMessage;
import com.geostar.smackandroid.message.data.dao.ChatMessageDao;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* {@inheritDoc}
*
* @see de.greenrobot.dao.AbstractDaoSession
*/
public class DaoSession extends AbstractDaoSession {
private final DaoConfig chatMessageDaoConfig;
private final ChatMessageDao chatMessageDao;
public DaoSession(SQLiteDatabase db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
daoConfigMap) {
super(db);
chatMessageDaoConfig = daoConfigMap.get(ChatMessageDao.class).clone();
chatMessageDaoConfig.initIdentityScope(type);
chatMessageDao = new ChatMessageDao(chatMessageDaoConfig, this);
registerDao(ChatMessage.class, chatMessageDao);
}
public void clear() {
chatMessageDaoConfig.getIdentityScope().clear();
}
public ChatMessageDao getChatMessageDao() {
return chatMessageDao;
}
}
| [
"[email protected]"
] | |
e1360bbe596ca1866c789bf0002b390172c5a5a3 | ceb2c622fc6c9d3883783131f9deb450032dae95 | /P3_9.java | f45335e053b2d8040ba2c74e9869a0755000d991 | [] | no_license | SL170031312/SL170031312_Programs | cd9ac645094c73a64f7bf077286bfd7afe38c260 | dc69238184e6b60cf07c46a15bd6d7b99ce83053 | refs/heads/master | 2022-11-06T04:25:07.734841 | 2020-06-25T16:10:15 | 2020-06-25T16:10:15 | 236,766,269 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 431 | java | package arrays;
import java.util.Scanner;
public class P3_9 {
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
int n=s.nextInt();
int d=0;
int[] a=new int[n];
int[] b=new int[100];
for(int i=0;i<n;i++) {
a[i]=s.nextInt();
d=a[i];
b[d]++;
}
int max=b[0],ind=0;
for(int j=0;j<100;j++) {
if(max<b[j]) {
max=b[j];
ind=j;
}
}System.out.println(ind);
}
}
| [
"[email protected]"
] | |
e544bd3b100e9b64aba722c092c9a1dc655e13e3 | 1e8eb8b40f49b8aeab5b332b7b76b5bd448ed2e6 | /Java/14:10:2016/Employee.java | 337f679957313acda11d6bc7a49946e15c384819 | [] | no_license | theod0sis/AFDEmp | 03af76d372471c2df4974e5e9c2d6b5c455c5b68 | dd5d0d3e2752d93d658dd2eae792eded6d7c33a2 | refs/heads/master | 2022-07-07T15:52:51.683750 | 2020-07-05T11:19:43 | 2020-07-05T11:19:43 | 70,476,707 | 0 | 0 | null | 2022-06-21T00:05:31 | 2016-10-10T10:16:50 | Java | UTF-8 | Java | false | false | 681 | java | import java.util.*;
public class Employee {
private String name;
private String surname;
private int birthyear;
public void setName( String name){
this.name=name;
}
public String getName(){
return this.name;
}
public void setSurname( String surname){
this.surname=surname ;
}
public String getSurname(){
return (surname);
}
public void setBirthyear(int birthyear){
this.birthyear=birthyear;
}
public int getBirthyear(){
return this.birthyear;
}
public int age(){
return ( 2016 - birthyear) ;
}
public String toString(){
return( "Name: " + name + " Surname: " + surname + " birthyear: " + birthyear);
}
}
| [
"[email protected]"
] | |
6e7ce94061825bb0848d3e88909080ce27f8ac8a | 01ea1bad00192787f5032e0b0ec4eab406898501 | /src/main/java/com/xu/webservice/task/DynamicScheduleTask.java | 56bfcea8cce564c876fb332d998dffad752e702a | [] | no_license | CharleyXu/webservice | 5e5a8dd2f1d2a9eb48aec12979413dd6b3653d0e | 912c3ec790862349e5c889bdd54beaf40e187f36 | refs/heads/master | 2021-01-25T14:33:37.809160 | 2018-06-20T11:27:37 | 2018-06-20T11:27:37 | 123,710,976 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,751 | java | package com.xu.webservice.task;
import com.google.common.base.Strings;
import java.time.LocalTime;
import java.util.Date;
import java.util.concurrent.ScheduledFuture;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.Trigger;
import org.springframework.scheduling.TriggerContext;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.scheduling.support.CronTrigger;
import org.springframework.stereotype.Component;
/**
* @author charlie Created on 2018/3/20.
*
* 默认Core线程数 1 , 即时生效
*/
@Component
public class DynamicScheduleTask {
private ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
private ScheduledFuture<?> future;
@Value("${cascading.caseTransmit.cron}")
private String cron;
public void setCron(String cron) {
this.cron = cron;
stopCron();
//必须初始化才能用
threadPoolTaskScheduler.initialize();
future = threadPoolTaskScheduler.schedule(new Runnable() {
@Override
public void run() {
try {
System.out.println("Run Task:" + LocalTime.now());
} catch (Exception e) {
e.printStackTrace();
System.out.println("Run Error" + LocalTime.now());
}
}
}, new Trigger() {
@Override
public Date nextExecutionTime(TriggerContext triggerContext) {
if (Strings.isNullOrEmpty(cron)) {
return null;
}
CronTrigger trigger = new CronTrigger(cron);// 定时任务触发,可修改定时任务的执行周期
Date nextExecDate = trigger.nextExecutionTime(triggerContext);
return nextExecDate;
}
});
}
public void stopCron() {
if (future != null) {
//取消任务调度
future.cancel(true);
}
}
}
| [
"[email protected]"
] | |
ffd80a83a5cc94dc7c729b9724f881f9b2d9109d | 80d090e762c638d07a65de58312708b01e67d278 | /src/main/java/io/ebean/enhance/asm/tree/analysis/SourceInterpreter.java | 40f29570cc644a0da3a356340a40a271894b469e | [
"Apache-2.0"
] | permissive | ajcamilo/ebean-agent | 4c5b781a1b19ad372bfffbd6f14492db0bb95b67 | f194eeef802dab6ff64f6eab8375ef99f3898e61 | refs/heads/master | 2021-01-23T12:22:06.225631 | 2017-06-26T16:58:42 | 2017-06-26T16:58:42 | 93,152,908 | 0 | 0 | null | 2017-06-02T10:01:06 | 2017-06-02T10:01:06 | null | UTF-8 | Java | false | false | 6,435 | java | /***
* ASM: a very small and fast Java bytecode manipulation framework
* Copyright (c) 2000-2011 INRIA, France Telecom
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package io.ebean.enhance.asm.tree.analysis;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import io.ebean.enhance.asm.Opcodes;
import io.ebean.enhance.asm.tree.FieldInsnNode;
import io.ebean.enhance.asm.tree.LdcInsnNode;
import io.ebean.enhance.asm.Type;
import io.ebean.enhance.asm.tree.AbstractInsnNode;
import io.ebean.enhance.asm.tree.InvokeDynamicInsnNode;
import io.ebean.enhance.asm.tree.MethodInsnNode;
/**
* An {@link Interpreter} for {@link SourceValue} values.
*
* @author Eric Bruneton
*/
public class SourceInterpreter extends Interpreter<SourceValue> implements
Opcodes {
public SourceInterpreter() {
super(ASM5);
}
protected SourceInterpreter(final int api) {
super(api);
}
@Override
public SourceValue newValue(final Type type) {
if (type == Type.VOID_TYPE) {
return null;
}
return new SourceValue(type == null ? 1 : type.getSize());
}
@Override
public SourceValue newOperation(final AbstractInsnNode insn) {
int size;
switch (insn.getOpcode()) {
case LCONST_0:
case LCONST_1:
case DCONST_0:
case DCONST_1:
size = 2;
break;
case LDC:
Object cst = ((LdcInsnNode) insn).cst;
size = cst instanceof Long || cst instanceof Double ? 2 : 1;
break;
case GETSTATIC:
size = Type.getType(((FieldInsnNode) insn).desc).getSize();
break;
default:
size = 1;
}
return new SourceValue(size, insn);
}
@Override
public SourceValue copyOperation(final AbstractInsnNode insn,
final SourceValue value) {
return new SourceValue(value.getSize(), insn);
}
@Override
public SourceValue unaryOperation(final AbstractInsnNode insn,
final SourceValue value) {
int size;
switch (insn.getOpcode()) {
case LNEG:
case DNEG:
case I2L:
case I2D:
case L2D:
case F2L:
case F2D:
case D2L:
size = 2;
break;
case GETFIELD:
size = Type.getType(((FieldInsnNode) insn).desc).getSize();
break;
default:
size = 1;
}
return new SourceValue(size, insn);
}
@Override
public SourceValue binaryOperation(final AbstractInsnNode insn,
final SourceValue value1, final SourceValue value2) {
int size;
switch (insn.getOpcode()) {
case LALOAD:
case DALOAD:
case LADD:
case DADD:
case LSUB:
case DSUB:
case LMUL:
case DMUL:
case LDIV:
case DDIV:
case LREM:
case DREM:
case LSHL:
case LSHR:
case LUSHR:
case LAND:
case LOR:
case LXOR:
size = 2;
break;
default:
size = 1;
}
return new SourceValue(size, insn);
}
@Override
public SourceValue ternaryOperation(final AbstractInsnNode insn,
final SourceValue value1, final SourceValue value2,
final SourceValue value3) {
return new SourceValue(1, insn);
}
@Override
public SourceValue naryOperation(final AbstractInsnNode insn,
final List<? extends SourceValue> values) {
int size;
int opcode = insn.getOpcode();
if (opcode == MULTIANEWARRAY) {
size = 1;
} else {
String desc = (opcode == INVOKEDYNAMIC) ? ((InvokeDynamicInsnNode) insn).desc
: ((MethodInsnNode) insn).desc;
size = Type.getReturnType(desc).getSize();
}
return new SourceValue(size, insn);
}
@Override
public void returnOperation(final AbstractInsnNode insn,
final SourceValue value, final SourceValue expected) {
}
@Override
public SourceValue merge(final SourceValue d, final SourceValue w) {
if (d.insns instanceof SmallSet && w.insns instanceof SmallSet) {
Set<AbstractInsnNode> s = ((SmallSet<AbstractInsnNode>) d.insns)
.union((SmallSet<AbstractInsnNode>) w.insns);
if (s == d.insns && d.size == w.size) {
return d;
} else {
return new SourceValue(Math.min(d.size, w.size), s);
}
}
if (d.size != w.size || !d.insns.containsAll(w.insns)) {
HashSet<AbstractInsnNode> s = new HashSet<AbstractInsnNode>();
s.addAll(d.insns);
s.addAll(w.insns);
return new SourceValue(Math.min(d.size, w.size), s);
}
return d;
}
}
| [
"[email protected]"
] | |
dbf395fd9ccb4ed4f187d567329d9d01e9c2f242 | 5b98fc9ff503d3b3ed49e56b6b2a896b94e4d39b | /pedometer/src/edu/hui/pedometer/startMapActivity.java | 5b4673d6900df28a7470edb9e2f4f46dfe683c70 | [] | no_license | hui8958/StreetViewPedometerAndroid | e7d801354afa2642aa3c43a83c3daabb76182393 | 6beab96e70c36c312292dac6a390cbe6b4bd74df | refs/heads/master | 2021-01-23T06:25:07.728497 | 2017-03-27T17:59:04 | 2017-03-27T17:59:04 | 86,364,064 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,359 | java | package edu.hui.pedometer;
import java.util.Date;
import java.util.HashMap;
import android.support.v4.app.FragmentActivity;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.GoogleMap.*;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.maps.SupportMapFragment;
import edu.hui.pedometer.R;
import edu.hui.pedometer.tools.EventInfo;
import edu.hui.pedometer.tools.GoogleCity;
import edu.hui.pedometer.tools.ExtendAppication;
import edu.hui.pedometer.tools.commandInfo;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.location.Location;
import android.os.Bundle;
import android.preference.PreferenceManager;
public class startMapActivity extends FragmentActivity implements
OnMapClickListener, OnMapLongClickListener, OnMarkerClickListener,
InfoWindowAdapter, OnInfoWindowClickListener {
final int RQS_GooglePlayServices = 1;
Location myLocation;
TextView tvLocInfo;
private GoogleMap myMap;
private SupportMapFragment mMapFragment;
private ExtendAppication ws = null;
private PedometerSettings mPedometerSettings;
private HashMap<Marker, EventInfo> eventMarkerMap;
private View window = null;
Marker currentMkr = null;
private SharedPreferences mSettings;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.maps);
ws = (ExtendAppication) this.getApplicationContext();
mMapFragment = ((SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.my_map));
mMapFragment.getView().setVisibility(View.VISIBLE);
myMap = mMapFragment.getMap();
myMap.setMyLocationEnabled(true);
myMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
eventMarkerMap = new HashMap<Marker, EventInfo>();
window = getLayoutInflater().inflate(R.layout.content, null);
mSettings = PreferenceManager.getDefaultSharedPreferences(this);
mPedometerSettings = new PedometerSettings(mSettings);
myMap.setOnMapClickListener(this);
myMap.setOnMapLongClickListener(this);
myMap.setOnMarkerClickListener(this);
myMap.setInfoWindowAdapter(this);
myMap.setOnInfoWindowClickListener(this);
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
int resultCode =GooglePlayServicesUtil
.isGooglePlayServicesAvailable(getApplicationContext());
if (resultCode == ConnectionResult.SUCCESS) {
Toast.makeText(getApplicationContext(),
"isGooglePlayServicesAvailable SUCCESS", Toast.LENGTH_LONG)
.show();
} else {
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
RQS_GooglePlayServices);
}
}
/*
* @Override public boolean onOptionsItemSelected(MenuItem item) { switch
* (item.getItemId()) { case R.id.menu_legalnotices: String LicenseInfo =
* GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(
* getApplicationContext()); AlertDialog.Builder LicenseDialog = new
* AlertDialog.Builder(MainActivity.this);
* LicenseDialog.setTitle("Legal Notices");
* LicenseDialog.setMessage(LicenseInfo); LicenseDialog.show(); return true;
* } return super.onOptionsItemSelected(item); }
*/
@Override
public void onMapLongClick(LatLng point) {
// TODO Auto-generated method stub
Marker mk = myMap.addMarker(new MarkerOptions().position(point).title(
point.toString()));
EventInfo EventInfo = new EventInfo(point, "Right now - event",
new Date(), "Exercise");
eventMarkerMap.put(mk, EventInfo);
}
@Override
public void onMapClick(LatLng point) {
// TODO Auto-generated method stub
myMap.animateCamera(CameraUpdateFactory.newLatLng(point));
}
@Override
public boolean onMarkerClick(Marker arg0) {
// TODO Auto-generated method stub
arg0.showInfoWindow();
// ws.getResponse(commandInfo.geoInfo+String.valueOf(m.getPosition().longitude)+"|"+m.getPosition().latitude);
return true;
}
@Override
public View getInfoContents(Marker marker) {
// TODO Auto-generated method stub
currentMkr = marker;
// EventInfo eventInfo = eventMarkerMap.get(marker);
GoogleCity gc = new GoogleCity(marker.getPosition().longitude,
marker.getPosition().latitude);
String title = gc.getName();
TextView txtTitle = ((TextView) window
.findViewById(R.id.txtInfoWindowTitle));
if (title != null) {
// Spannable string allows us to edit the formatting of the text.
SpannableString titleText = new SpannableString(title);
titleText.setSpan(new ForegroundColorSpan(Color.RED), 0,
titleText.length(), 0);
txtTitle.setText(titleText);
} else {
txtTitle.setText("");
}
// TextView txtSubTitle = ((TextView) window
// .findViewById(R.id.txtInfoWindowEventType));
// txtSubTitle.setText("");
Log.v("maps", "InfoWindow!");
return window;
}
@Override
public View getInfoWindow(Marker marker) {
// TODO Auto-generated method stub
return null;
}
@Override
public void onInfoWindowClick(Marker marker) {
// TODO Auto-generated method stub
currentMkr = marker;
// EventInfo eventInfo = eventMarkerMap.get(marker);
/*
* Toast.makeText(getBaseContext(), "The date of " + eventInfo.getName()
* + " is " + eventInfo.getSomeDate().toLocaleString(),
* Toast.LENGTH_LONG).show();
*/
new AlertDialog.Builder(this)
.setTitle("Notice")
.setMessage("what do you want to do?")
.setIcon(R.drawable.icon)
.setPositiveButton("View",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int whichButton) {
setResult(RESULT_OK);// ������������
// ws.getResponse(commandInfo.geoInfo+String.valueOf(currentMkr.getPosition().longitude)+"|"+currentMkr.getPosition().latitude);
ws.getUdpMgr()
.send(commandInfo.geoInfo
+ String.valueOf(currentMkr
.getPosition().longitude)
+ "|"
+ currentMkr.getPosition().latitude,
mPedometerSettings
.getIpAddress(),8001);
// finish();
}
})
.setNeutralButton("Start",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int whichButton) {
// currentMkr.remove();
ws.getUdpMgr()
.send(commandInfo.startInfo
+ String.valueOf(currentMkr
.getPosition().longitude)
+ "|"
+ currentMkr.getPosition().latitude,
mPedometerSettings
.getIpAddress(),8001);
finish();
}
})
.setNegativeButton("Cancel",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int whichButton) {
// ������������
}
}).show();
}
}
| [
"[email protected]"
] | |
a9449c891c55911574271248618f3c72ddc64b97 | 797e7473284b23039a3b3f42535fb4725daeaffa | /src/main/java/sv/gob/mined/apps/bnprove/mvn/modelo/Pais.java | 8976186690a257ccfa7472ee9943ca642e7f708d | [] | no_license | rramirezech1/bnprove-mvn | 2778904da8809163b6f6312101b39983f7b76580 | 47929cd99ffdfd51ba774cfbf1f7e23088bbdd85 | refs/heads/master | 2023-03-08T04:07:07.952677 | 2023-02-22T23:42:38 | 2023-02-22T23:42:38 | 195,832,657 | 0 | 0 | null | 2022-12-09T22:57:32 | 2019-07-08T14:47:13 | Java | UTF-8 | Java | false | false | 2,327 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package sv.gob.mined.apps.bnprove.mvn.modelo;
import java.util.Date;
/**
*
* @author Infosoft
*/
public class Pais {
private String pais;
private String name;
private String descripcion;
private Date fechaActualizacion;
private String nacionalidad;
public java.util.Date fechaDeInsercion;
public java.util.Date fechaDeModificacion;
public java.util.Date fechaDeEliminacion;
public Integer estadoDeEliminacion;
public Pais() {
}
public String getDescripcion() {
return descripcion;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
public Date getFechaActualizacion() {
return fechaActualizacion;
}
public void setFechaActualizacion(Date fechaActualizacion) {
this.fechaActualizacion = fechaActualizacion;
}
public String getNacionalidad() {
return nacionalidad;
}
public void setNacionalidad(String nacionalidad) {
this.nacionalidad = nacionalidad;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPais() {
return pais;
}
public void setPais(String pais) {
this.pais = pais;
}
public Date getFechaDeInsercion() {
return fechaDeInsercion;
}
public void setFechaDeInsercion(Date fechaDeInsercion) {
this.fechaDeInsercion = fechaDeInsercion;
}
public Date getFechaDeModificacion() {
return fechaDeModificacion;
}
public void setFechaDeModificacion(Date fechaDeModificacion) {
this.fechaDeModificacion = fechaDeModificacion;
}
public Date getFechaDeEliminacion() {
return fechaDeEliminacion;
}
public void setFechaDeEliminacion(Date fechaDeEliminacion) {
this.fechaDeEliminacion = fechaDeEliminacion;
}
public Integer getEstadoDeEliminacion() {
return estadoDeEliminacion;
}
public void setEstadoDeEliminacion(Integer estadoDeEliminacion) {
this.estadoDeEliminacion = estadoDeEliminacion;
}
@Override
public String toString() {
return descripcion;
}
} | [
"[email protected]"
] | |
afeb7d3dedadb824e170e785a1a7aa4e276aefb1 | 17abe434c2bc8995fbc73f7f81217e49a0283c2e | /src/main/java/com/google/gwt/i18n/client/impl/cldr/LocalizedNamesImpl_ksf.java | ea56155d36ba71a1d6e5b9b5105ca48e940e3003 | [
"Apache-2.0"
] | permissive | aliz-ai/gwt-mock-2.5.1 | 6d7d41c9f29d3110eef5c74b23a3d63b3af5e71b | af5495454005f2bba630b8d869fde75930d4ec2e | refs/heads/master | 2022-12-31T06:00:31.983924 | 2020-07-13T12:06:47 | 2020-07-13T12:06:47 | 55,702,877 | 1 | 1 | NOASSERTION | 2020-10-13T09:09:21 | 2016-04-07T14:48:45 | Java | UTF-8 | Java | false | false | 19,904 | java | /*
* Copyright 2012 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.gwt.i18n.client.impl.cldr;
import com.google.gwt.core.client.JavaScriptObject;
// DO NOT EDIT - GENERATED FROM CLDR DATA:
// cldrVersion=21.0
// number=$Revision: 6546 $
// type=root
// date=$Date: 2012-02-07 13:32:35 -0500 (Tue, 07 Feb 2012) $
/**
* Localized names for the "ksf" locale.
*/
public class LocalizedNamesImpl_ksf extends LocalizedNamesImpl {
@Override
public String[] loadSortedRegionCodes() {
return new String[] {
"AC",
"AF",
"ZA",
"AL",
"DZ",
"US",
"AD",
"AI",
"AO",
"AG",
"AN",
"AQ",
"SA",
"AR",
"AM",
"AW",
"AX",
"HT",
"AZ",
"BB",
"BS",
"BH",
"BD",
"BL",
"BW",
"BQ",
"BN",
"BR",
"BF",
"BG",
"BI",
"BT",
"BV",
"AE",
"BA",
"BO",
"BY",
"BZ",
"BE",
"BJ",
"BM",
"TD",
"CC",
"CL",
"CN",
"CY",
"CP",
"CW",
"CX",
"CZ",
"DK",
"DG",
"DE",
"DJ",
"DM",
"DO",
"EA",
"EH",
"EU",
"FJ",
"PH",
"FI",
"FO",
"GA",
"GM",
"GH",
"GG",
"GN",
"GW",
"GQ",
"GL",
"GR",
"GD",
"GS",
"GY",
"GF",
"GP",
"GU",
"GT",
"HK",
"HM",
"IC",
"IE",
"IM",
"IN",
"ID",
"IQ",
"IR",
"IL",
"IT",
"JM",
"JP",
"JE",
"GI",
"JO",
"GE",
"NC",
"KH",
"CM",
"CA",
"CV",
"QA",
"KZ",
"KG",
"KI",
"CO",
"KM",
"KP",
"KR",
"ES",
"HR",
"CU",
"KW",
"NL",
"GB",
"CG",
"CD",
"CR",
"CI",
"KE",
"LA",
"LB",
"LY",
"LR",
"LI",
"LT",
"LU",
"LS",
"LV",
"MG",
"MW",
"MV",
"ML",
"MT",
"MY",
"MA",
"MK",
"MQ",
"YT",
"ME",
"MF",
"FM",
"MO",
"MC",
"MZ",
"MU",
"MR",
"MM",
"MD",
"MS",
"MN",
"MX",
"NA",
"NE",
"NG",
"NI",
"NU",
"NR",
"NO",
"NP",
"OM",
"AT",
"PK",
"PW",
"PA",
"PG",
"PY",
"PN",
"PL",
"PT",
"PF",
"PR",
"PE",
"FR",
"QO",
"RU",
"RS",
"RW",
"RO",
"RE",
"SV",
"WS",
"AS",
"CF",
"ST",
"SY",
"SG",
"SJ",
"SK",
"SI",
"SO",
"LK",
"SS",
"SD",
"SR",
"SZ",
"CH",
"SE",
"SX",
"SL",
"SC",
"KN",
"SM",
"PM",
"LC",
"SH",
"VC",
"SN",
"CS",
"TA",
"TJ",
"TZ",
"TF",
"TL",
"TR",
"TM",
"TG",
"TK",
"TN",
"TV",
"TO",
"TH",
"TT",
"TW",
"UG",
"UA",
"UM",
"UY",
"UZ",
"WF",
"VU",
"VA",
"VN",
"VE",
"YE",
"ZM",
"ZW",
"VI",
"VG",
"KY",
"IS",
"MH",
"IO",
"FK",
"MP",
"PS",
"SB",
"TC",
"CK",
"NZ",
"NF",
"HN",
"HU",
"AU",
"EG",
"EC",
"ER",
"EE",
"ET",
};
}
@Override
protected void loadNameMapJava() {
super.loadNameMapJava();
namesMap.put("AD", "andɔrǝ");
namesMap.put("AE", "bǝlɔŋ bǝ kaksa bɛ táatáaŋzǝn");
namesMap.put("AF", "afganistáŋ");
namesMap.put("AG", "antiga ri barbúda");
namesMap.put("AI", "angiya");
namesMap.put("AL", "albaní");
namesMap.put("AM", "armɛní");
namesMap.put("AN", "antíyǝ nɛlandé");
namesMap.put("AO", "angóla");
namesMap.put("AR", "arjǝntín");
namesMap.put("AS", "samɔa a amɛrika");
namesMap.put("AT", "otric");
namesMap.put("AU", "ɔstralí");
namesMap.put("AW", "aruba");
namesMap.put("AZ", "azabecán");
namesMap.put("BA", "bɔsnyɛ ri hɛrsǝgɔvín");
namesMap.put("BB", "baabaadǝ");
namesMap.put("BD", "baŋladɛ́c");
namesMap.put("BE", "bɛljík");
namesMap.put("BF", "bukína fǝ́ asɔ");
namesMap.put("BG", "bulgarí");
namesMap.put("BH", "barǝ́n");
namesMap.put("BI", "burundí");
namesMap.put("BJ", "bɛnǝ́n");
namesMap.put("BM", "bɛɛmúdǝ");
namesMap.put("BN", "brunǝ́");
namesMap.put("BO", "bɔɔlíví");
namesMap.put("BR", "brɛsíl");
namesMap.put("BS", "baamás");
namesMap.put("BT", "bután");
namesMap.put("BW", "botswana");
namesMap.put("BY", "bɛlaris");
namesMap.put("BZ", "bɛliz");
namesMap.put("CA", "kanada");
namesMap.put("CD", "kɔngó anyɔ́n");
namesMap.put("CF", "santrafrík");
namesMap.put("CG", "kɔngó");
namesMap.put("CH", "swís");
namesMap.put("CI", "kɔtiwuár");
namesMap.put("CK", "zɛ i kúk");
namesMap.put("CL", "cíli");
namesMap.put("CM", "kamɛrún");
namesMap.put("CN", "cín");
namesMap.put("CO", "kolɔmbí");
namesMap.put("CR", "kɔstaríka");
namesMap.put("CS", "sɛrbí ri mɔntǝnɛgro");
namesMap.put("CU", "kuba");
namesMap.put("CV", "kapvɛr");
namesMap.put("CY", "cíprɛ");
namesMap.put("CZ", "cɛ́k");
namesMap.put("DE", "djɛrman");
namesMap.put("DJ", "dyibutí");
namesMap.put("DK", "danmak");
namesMap.put("DM", "dɔminik");
namesMap.put("DO", "dɔminik rɛpublík");
namesMap.put("DZ", "aljɛrí");
namesMap.put("EC", "ɛkwatɛǝ́");
namesMap.put("EE", "ɛstoní");
namesMap.put("EG", "ɛjípt");
namesMap.put("ER", "ɛritrɛ́");
namesMap.put("ES", "kpanyá");
namesMap.put("ET", "ɛtyɔpí");
namesMap.put("FI", "fínlan");
namesMap.put("FJ", "fíji");
namesMap.put("FK", "zǝ maalwín");
namesMap.put("FM", "mikronɛ́si");
namesMap.put("FR", "pɛrɛsǝ́");
namesMap.put("GA", "gabɔŋ");
namesMap.put("GB", "kǝlɔŋ kǝ kǝtáatáaŋzǝn");
namesMap.put("GD", "grɛnadǝ");
namesMap.put("GE", "jɔrjí");
namesMap.put("GF", "guyán i pɛrɛsǝ́");
namesMap.put("GH", "gána");
namesMap.put("GI", "jibraltá");
namesMap.put("GL", "grínlan");
namesMap.put("GM", "gambí");
namesMap.put("GN", "ginɛ́");
namesMap.put("GP", "gwadɛlúp");
namesMap.put("GQ", "ginɛ́ ɛkwatɔrial");
namesMap.put("GR", "grɛ́k");
namesMap.put("GT", "gwátǝmala");
namesMap.put("GU", "gwám");
namesMap.put("GW", "ginɛ́ bisɔ́");
namesMap.put("GY", "guyán");
namesMap.put("HN", "ɔnduras");
namesMap.put("HR", "krwasí");
namesMap.put("HT", "ayiti");
namesMap.put("HU", "ɔngrí");
namesMap.put("ID", "indonɛsí");
namesMap.put("IE", "ilán");
namesMap.put("IL", "israɛ́l");
namesMap.put("IN", "indí");
namesMap.put("IO", "zǝ ingɛrís ncɔ́m wa indi");
namesMap.put("IQ", "irák");
namesMap.put("IR", "iráŋ");
namesMap.put("IS", "zǝ i glás");
namesMap.put("IT", "italí");
namesMap.put("JM", "jamaík");
namesMap.put("JO", "jɔrdán");
namesMap.put("JP", "japɔ́ŋ");
namesMap.put("KE", "kɛnya");
namesMap.put("KG", "kigistáŋ");
namesMap.put("KH", "kambodj");
namesMap.put("KI", "kiribáti");
namesMap.put("KM", "komɔr");
namesMap.put("KN", "sɛnkrǝstɔ́f ri nyɛ́vǝ");
namesMap.put("KP", "korɛanɔ́r");
namesMap.put("KR", "korɛasud");
namesMap.put("KW", "kuwɛit");
namesMap.put("KY", "zǝ i gan");
namesMap.put("KZ", "kazakstáŋ");
namesMap.put("LA", "laɔs");
namesMap.put("LB", "libáŋ");
namesMap.put("LC", "sɛntlísí");
namesMap.put("LI", "lictɛnstɛ́n");
namesMap.put("LK", "srílaŋka");
namesMap.put("LR", "libɛrya");
namesMap.put("LS", "lǝsóto");
namesMap.put("LT", "litwaní");
namesMap.put("LU", "luksɛmbúr");
namesMap.put("LV", "lɛtoní");
namesMap.put("LY", "libí");
namesMap.put("MA", "marɔk");
namesMap.put("MC", "monako");
namesMap.put("MD", "mɔldaví");
namesMap.put("MG", "madagaska");
namesMap.put("MH", "zǝ i marcál");
namesMap.put("MK", "másǝdwán");
namesMap.put("ML", "mali");
namesMap.put("MM", "myanmár");
namesMap.put("MN", "mɔŋolí");
namesMap.put("MP", "zǝ maryánnɔ́r");
namesMap.put("MQ", "matiník");
namesMap.put("MR", "mwaritaní");
namesMap.put("MS", "mɔnsɛrat");
namesMap.put("MT", "maltǝ");
namesMap.put("MU", "mwarís");
namesMap.put("MV", "maldivǝ");
namesMap.put("MW", "malawi");
namesMap.put("MX", "mɛksík");
namesMap.put("MY", "malɛsí");
namesMap.put("MZ", "mosambík");
namesMap.put("NA", "namibí");
namesMap.put("NC", "kalɛdoní anyɔ́n");
namesMap.put("NE", "nijɛ́r");
namesMap.put("NF", "zɛ nɔ́fɔlk");
namesMap.put("NG", "nijɛ́rya");
namesMap.put("NI", "níkarágwa");
namesMap.put("NL", "kǝlɔŋ kǝ ázǝ");
namesMap.put("NO", "nɔrvɛjǝ");
namesMap.put("NP", "nɛpal");
namesMap.put("NR", "nwarú");
namesMap.put("NU", "niwɛ́");
namesMap.put("NZ", "zɛlan anyɔ́n");
namesMap.put("OM", "oman");
namesMap.put("PA", "panama");
namesMap.put("PE", "pɛrú");
namesMap.put("PF", "pɔlinɛsí a pɛrɛsǝ́");
namesMap.put("PG", "papwazí ginɛ́ anyɔ́n");
namesMap.put("PH", "filipǝ́n");
namesMap.put("PK", "pakistáŋ");
namesMap.put("PL", "polɔ́n");
namesMap.put("PM", "sɛnpyɛr ri mikɛlɔŋ");
namesMap.put("PN", "pitkɛ́n");
namesMap.put("PR", "pɔtoríko");
namesMap.put("PS", "zǝ palɛstínǝ");
namesMap.put("PT", "portugál");
namesMap.put("PW", "palwa");
namesMap.put("PY", "paragwɛ́");
namesMap.put("QA", "katá");
namesMap.put("RE", "rɛunyɔŋ");
namesMap.put("RO", "rɔmaní");
namesMap.put("RU", "risí");
namesMap.put("RW", "rwanda");
namesMap.put("SA", "arabí saodí");
namesMap.put("SB", "zǝ salomɔ́n");
namesMap.put("SC", "sɛcɛl");
namesMap.put("SD", "sudan");
namesMap.put("SE", "swɛdǝ");
namesMap.put("SG", "siŋapó");
namesMap.put("SH", "sɛntɛ́len");
namesMap.put("SI", "slovɛní");
namesMap.put("SK", "slovakí");
namesMap.put("SL", "syɛraleon");
namesMap.put("SM", "sɛnmarǝn");
namesMap.put("SN", "sɛnɛgal");
namesMap.put("SO", "somalí");
namesMap.put("SR", "surinam");
namesMap.put("ST", "saotomɛ́ ri priŋsib");
namesMap.put("SV", "salvadɔr");
namesMap.put("SY", "sirí");
namesMap.put("SZ", "swazilan");
namesMap.put("TC", "zǝ tirk ri kakɔs");
namesMap.put("TD", "caád");
namesMap.put("TG", "togo");
namesMap.put("TH", "tɛlan");
namesMap.put("TJ", "tadjikistaŋ");
namesMap.put("TK", "tokǝlao");
namesMap.put("TL", "timor anǝ á ɛst");
namesMap.put("TM", "tirkmɛnistaŋ");
namesMap.put("TN", "tunɛsí");
namesMap.put("TO", "tɔŋa");
namesMap.put("TR", "tirkí");
namesMap.put("TT", "tɛrinitɛ ri tobago");
namesMap.put("TV", "tuwalu");
namesMap.put("TW", "tɛwán");
namesMap.put("TZ", "tanzaní");
namesMap.put("UA", "ukrain");
namesMap.put("UG", "uganda");
namesMap.put("US", "amɛrika");
namesMap.put("UY", "urugwɛ́");
namesMap.put("UZ", "usbɛkistaŋ");
namesMap.put("VA", "watikáŋ");
namesMap.put("VC", "sɛnvǝnsǝŋ ri grɛnadín");
namesMap.put("VE", "wɛnǝzwɛla");
namesMap.put("VG", "zǝ bɛ gɔn inɛ a ingɛrís");
namesMap.put("VI", "zǝ bɛ gɔn inɛ á amɛrika");
namesMap.put("VN", "wyɛtnám");
namesMap.put("VU", "wanwatu");
namesMap.put("WF", "walis ri futuna");
namesMap.put("WS", "samɔa");
namesMap.put("YE", "yɛmɛn");
namesMap.put("YT", "mayɔ́t");
namesMap.put("ZA", "afrik anǝ a sud");
namesMap.put("ZM", "zambí");
namesMap.put("ZW", "zimbabwɛ́");
}
@Override
protected JavaScriptObject loadNameMapNative() {
return overrideMap(super.loadNameMapNative(), loadMyNameMap());
}
private native JavaScriptObject loadMyNameMap() /*-{
return {
"AD": "andɔrǝ",
"AE": "bǝlɔŋ bǝ kaksa bɛ táatáaŋzǝn",
"AF": "afganistáŋ",
"AG": "antiga ri barbúda",
"AI": "angiya",
"AL": "albaní",
"AM": "armɛní",
"AN": "antíyǝ nɛlandé",
"AO": "angóla",
"AR": "arjǝntín",
"AS": "samɔa a amɛrika",
"AT": "otric",
"AU": "ɔstralí",
"AW": "aruba",
"AZ": "azabecán",
"BA": "bɔsnyɛ ri hɛrsǝgɔvín",
"BB": "baabaadǝ",
"BD": "baŋladɛ́c",
"BE": "bɛljík",
"BF": "bukína fǝ́ asɔ",
"BG": "bulgarí",
"BH": "barǝ́n",
"BI": "burundí",
"BJ": "bɛnǝ́n",
"BM": "bɛɛmúdǝ",
"BN": "brunǝ́",
"BO": "bɔɔlíví",
"BR": "brɛsíl",
"BS": "baamás",
"BT": "bután",
"BW": "botswana",
"BY": "bɛlaris",
"BZ": "bɛliz",
"CA": "kanada",
"CD": "kɔngó anyɔ́n",
"CF": "santrafrík",
"CG": "kɔngó",
"CH": "swís",
"CI": "kɔtiwuár",
"CK": "zɛ i kúk",
"CL": "cíli",
"CM": "kamɛrún",
"CN": "cín",
"CO": "kolɔmbí",
"CR": "kɔstaríka",
"CS": "sɛrbí ri mɔntǝnɛgro",
"CU": "kuba",
"CV": "kapvɛr",
"CY": "cíprɛ",
"CZ": "cɛ́k",
"DE": "djɛrman",
"DJ": "dyibutí",
"DK": "danmak",
"DM": "dɔminik",
"DO": "dɔminik rɛpublík",
"DZ": "aljɛrí",
"EC": "ɛkwatɛǝ́",
"EE": "ɛstoní",
"EG": "ɛjípt",
"ER": "ɛritrɛ́",
"ES": "kpanyá",
"ET": "ɛtyɔpí",
"FI": "fínlan",
"FJ": "fíji",
"FK": "zǝ maalwín",
"FM": "mikronɛ́si",
"FR": "pɛrɛsǝ́",
"GA": "gabɔŋ",
"GB": "kǝlɔŋ kǝ kǝtáatáaŋzǝn",
"GD": "grɛnadǝ",
"GE": "jɔrjí",
"GF": "guyán i pɛrɛsǝ́",
"GH": "gána",
"GI": "jibraltá",
"GL": "grínlan",
"GM": "gambí",
"GN": "ginɛ́",
"GP": "gwadɛlúp",
"GQ": "ginɛ́ ɛkwatɔrial",
"GR": "grɛ́k",
"GT": "gwátǝmala",
"GU": "gwám",
"GW": "ginɛ́ bisɔ́",
"GY": "guyán",
"HN": "ɔnduras",
"HR": "krwasí",
"HT": "ayiti",
"HU": "ɔngrí",
"ID": "indonɛsí",
"IE": "ilán",
"IL": "israɛ́l",
"IN": "indí",
"IO": "zǝ ingɛrís ncɔ́m wa indi",
"IQ": "irák",
"IR": "iráŋ",
"IS": "zǝ i glás",
"IT": "italí",
"JM": "jamaík",
"JO": "jɔrdán",
"JP": "japɔ́ŋ",
"KE": "kɛnya",
"KG": "kigistáŋ",
"KH": "kambodj",
"KI": "kiribáti",
"KM": "komɔr",
"KN": "sɛnkrǝstɔ́f ri nyɛ́vǝ",
"KP": "korɛanɔ́r",
"KR": "korɛasud",
"KW": "kuwɛit",
"KY": "zǝ i gan",
"KZ": "kazakstáŋ",
"LA": "laɔs",
"LB": "libáŋ",
"LC": "sɛntlísí",
"LI": "lictɛnstɛ́n",
"LK": "srílaŋka",
"LR": "libɛrya",
"LS": "lǝsóto",
"LT": "litwaní",
"LU": "luksɛmbúr",
"LV": "lɛtoní",
"LY": "libí",
"MA": "marɔk",
"MC": "monako",
"MD": "mɔldaví",
"MG": "madagaska",
"MH": "zǝ i marcál",
"MK": "másǝdwán",
"ML": "mali",
"MM": "myanmár",
"MN": "mɔŋolí",
"MP": "zǝ maryánnɔ́r",
"MQ": "matiník",
"MR": "mwaritaní",
"MS": "mɔnsɛrat",
"MT": "maltǝ",
"MU": "mwarís",
"MV": "maldivǝ",
"MW": "malawi",
"MX": "mɛksík",
"MY": "malɛsí",
"MZ": "mosambík",
"NA": "namibí",
"NC": "kalɛdoní anyɔ́n",
"NE": "nijɛ́r",
"NF": "zɛ nɔ́fɔlk",
"NG": "nijɛ́rya",
"NI": "níkarágwa",
"NL": "kǝlɔŋ kǝ ázǝ",
"NO": "nɔrvɛjǝ",
"NP": "nɛpal",
"NR": "nwarú",
"NU": "niwɛ́",
"NZ": "zɛlan anyɔ́n",
"OM": "oman",
"PA": "panama",
"PE": "pɛrú",
"PF": "pɔlinɛsí a pɛrɛsǝ́",
"PG": "papwazí ginɛ́ anyɔ́n",
"PH": "filipǝ́n",
"PK": "pakistáŋ",
"PL": "polɔ́n",
"PM": "sɛnpyɛr ri mikɛlɔŋ",
"PN": "pitkɛ́n",
"PR": "pɔtoríko",
"PS": "zǝ palɛstínǝ",
"PT": "portugál",
"PW": "palwa",
"PY": "paragwɛ́",
"QA": "katá",
"RE": "rɛunyɔŋ",
"RO": "rɔmaní",
"RU": "risí",
"RW": "rwanda",
"SA": "arabí saodí",
"SB": "zǝ salomɔ́n",
"SC": "sɛcɛl",
"SD": "sudan",
"SE": "swɛdǝ",
"SG": "siŋapó",
"SH": "sɛntɛ́len",
"SI": "slovɛní",
"SK": "slovakí",
"SL": "syɛraleon",
"SM": "sɛnmarǝn",
"SN": "sɛnɛgal",
"SO": "somalí",
"SR": "surinam",
"ST": "saotomɛ́ ri priŋsib",
"SV": "salvadɔr",
"SY": "sirí",
"SZ": "swazilan",
"TC": "zǝ tirk ri kakɔs",
"TD": "caád",
"TG": "togo",
"TH": "tɛlan",
"TJ": "tadjikistaŋ",
"TK": "tokǝlao",
"TL": "timor anǝ á ɛst",
"TM": "tirkmɛnistaŋ",
"TN": "tunɛsí",
"TO": "tɔŋa",
"TR": "tirkí",
"TT": "tɛrinitɛ ri tobago",
"TV": "tuwalu",
"TW": "tɛwán",
"TZ": "tanzaní",
"UA": "ukrain",
"UG": "uganda",
"US": "amɛrika",
"UY": "urugwɛ́",
"UZ": "usbɛkistaŋ",
"VA": "watikáŋ",
"VC": "sɛnvǝnsǝŋ ri grɛnadín",
"VE": "wɛnǝzwɛla",
"VG": "zǝ bɛ gɔn inɛ a ingɛrís",
"VI": "zǝ bɛ gɔn inɛ á amɛrika",
"VN": "wyɛtnám",
"VU": "wanwatu",
"WF": "walis ri futuna",
"WS": "samɔa",
"YE": "yɛmɛn",
"YT": "mayɔ́t",
"ZA": "afrik anǝ a sud",
"ZM": "zambí",
"ZW": "zimbabwɛ́"
};
}-*/;
}
| [
"[email protected]"
] | |
94e913ed10e404ec0619639874ee1b86bbc5cc94 | ca70b3fdacde9671d55a03c398046dd62364d47a | /src/chapter06/section13/newpkg/Person.java | 1e5342aee2b7df1d76a6bef9b0c95b4912e86737 | [] | no_license | hanhays/java20190828 | 22c5253aa97558817bc163bf55c03bb0d3b187a4 | 83354be2795aca16b9a70a6c3d5b21d9e90feb73 | refs/heads/master | 2020-12-08T15:59:54.683074 | 2019-09-30T00:22:31 | 2019-09-30T00:22:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 330 | java | package chapter06.section13.newpkg;
class Person2 {
}
public class Person {
private int privateField = 0;
int defaultField = 0;
protected int protectedField = 0;
public int publicField = 0;
public Person() {
privateField = 10;
defaultField = 20;
}
void method() {
privateField = 20;
defaultField = 30;
}
}
| [
"602@choongang"
] | 602@choongang |
4b2df5b822ff8c1bd693cc6f5bcb51f67bec332a | 43a17e106805c58f44f6473d8ef670f67553c0ce | /.svn/pristine/2c/2c2ad84d2225615ecba83e554f8f243c881204c1.svn-base | 54b5025c6a9fadcac241d47097dda42146bcd992 | [
"Apache-2.0"
] | permissive | Spider-007/Android_example_view12 | db45571005094a4921279b12f5ddcb792780ee03 | 00a22fc31dfd870226964d696a2c9edb5dc1654a | refs/heads/master | 2020-08-18T06:29:12.546416 | 2019-10-17T14:39:00 | 2019-10-17T14:39:00 | 215,756,231 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 290 | package com.htmitech.domain;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface TreeNodePid
{
}
| [
"[email protected]"
] | ||
0dc92d7a0e6558021505569157049af2e939f789 | fe0622b62c8ff249f5c3f22109d6e89f1f30e525 | /src/main/java/cn/net/colin/controller/test/HelloController.java | 63240ca39927abfb79a87968a5478ba7091070f4 | [] | no_license | siasColin/springboot2example | ec58876b998ec9adbeba1d211370bda352dc3f34 | 7127ce49411f38940748a32b2b946b01afc8e23f | refs/heads/master | 2023-04-27T01:50:24.912515 | 2023-02-23T06:24:12 | 2023-02-23T06:24:12 | 244,126,899 | 4 | 3 | null | 2023-04-14T17:33:08 | 2020-03-01T10:14:27 | Java | UTF-8 | Java | false | false | 2,494 | java | package cn.net.colin.controller.test;
import cn.net.colin.common.exception.entity.ResultInfo;
import cn.net.colin.common.exception.entity.ResultCode;
import cn.net.colin.common.util.SnowflakeIdWorker;
import cn.net.colin.model.sysManage.SysArea;
import cn.net.colin.service.sysManage.ISysAreaService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.sql.DataSource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* Created by colin on 2020-2-27.
* ClassPathResource classPathResource = new ClassPathResource("static/model/pztjmodel.xls");
* InputStream inputStream = classPathResource.getInputStream();
*/
@Controller
@RequestMapping("/hello")
public class HelloController {
Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
DataSource dataSource;
@Autowired
ISysAreaService sysAreaService;
@RequestMapping("/hello")
@ResponseBody
public Object hello(){
logger.info(dataSource.getClass().getName());
return "HelloWorld!";
}
@RequestMapping("/helloResult")
@ResponseBody
public ResultInfo helloResult(){
return ResultInfo.of(ResultCode.SUCCESS);
}
@RequestMapping("/date")
@ResponseBody
public Object hello(Date date){
return date;
}
@RequestMapping("/insertBatch")
@ResponseBody
public Object insertBatch(){
List<SysArea> areaList = new ArrayList<SysArea>();
for (int i= 0;i<2;i++) {
SysArea sysArea = new SysArea();
sysArea.setId(SnowflakeIdWorker.generateId());
sysArea.setAreaCode(sysArea.getId()+"");
sysArea.setAreaName(sysArea.getId()+"name");
sysArea.setParentCode("0");
sysArea.setAreaLevel(0);
areaList.add(sysArea);
}
int num = sysAreaService.insertBatch(areaList);
return num;
}
@RequestMapping("/helloSecurity")
@ResponseBody
public Object helloSecurity(){
Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
System.out.println(principal);
return principal;
}
}
| [
"[email protected]"
] | |
0c7e3fe424caead838c07916e87e33c8b06367d0 | f908384df4424aaf0ec83b8466a5dc5f88496307 | /3eme/ProjetPI javafx/src/projet/service/IProduitService.java | c6485bf42fb753f782ae831411a35f1d27ce15f1 | [] | no_license | Ahmed-Amine-Soltani/projet_integre_esprit | 7c76ec625cb3f03367638dd456a239ba3ff57820 | e5d7f39127498e021a8b4b7cbef4102e3ee6a867 | refs/heads/master | 2023-03-14T11:09:31.833023 | 2021-03-05T17:20:13 | 2021-03-05T17:20:13 | 344,866,963 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 821 | 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 projet.service;
import java.util.List;
import projet.models.Produit;
/**
*
* @author yassine
*/
public interface IProduitService {
public List<Produit> listProduits();
public List<Produit> getListProduitsFilter(String filter,String categorie,String sous_categorie,String tri);
public Produit getProduit(int id);
public boolean ajouterProduit(Produit p);
public boolean modifierProduit(Produit p);
public boolean supprimerProduit(int id);
public List<Produit> search(String libelle);
public boolean exportXLS();
}
| [
"[email protected]"
] | |
c11722659140f6def58cf4af62cba1887ff5deb2 | 119a9ba8328894eef767f99845e9032b684734aa | /src/main/java/org/me/web/system/department/service/IDepartmentService.java | 0d648d8f78591710ad1962735021731982aa1da0 | [] | no_license | 845642761/cms1 | 1cb5bddd3067c4860dcc75b8aecb1d1bba6af52d | 5b92857ac5d899ecdccbccd7814c77280926ae7e | refs/heads/master | 2021-05-01T02:53:22.768009 | 2016-11-08T07:03:30 | 2016-11-08T07:03:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 507 | java | package org.me.web.system.department.service;
import java.util.List;
import org.me.web.system.department.entity.Department;
public interface IDepartmentService {
/**
* 保存
* @param dept
* @return dept id
* @date 2016年5月16日 11:05:07
*/
public String insert(Department dept);
public Department getById(String id);
public void delByIds(List<String> ids);
public void delById(String id);
public void update(Department dept);
public List<Department> getList(Department t);
}
| [
"[email protected]"
] | |
9fee598515a8d66975819272518d4eb8d54bb289 | 42808ddbb1c9bbddbdd029810efcf3b7bedd27b2 | /tp1/src/main/java/webapp/BonjourServiceServlet.java | 803b4bc1bada8e6e37c356062e31e448ecd8b0b3 | [] | no_license | DgrinderHZ/J2E-Workshops | 913bbe04f98225fedef5c9c32af61f51a175575f | 926dbde81a7bc20182dc65e379ab346b89b12a15 | refs/heads/master | 2020-12-03T20:14:08.325886 | 2020-02-06T03:41:57 | 2020-02-06T03:41:57 | 231,471,061 | 1 | 1 | null | null | null | null | WINDOWS-1250 | Java | false | false | 2,051 | java |
package webapp;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(urlPatterns = "/bonjourParam.do")
public class BonjourServiceServlet extends HttpServlet {
public int compte;
public void doGet(HttpServletRequest req, HttpServletResponse rep) throws IOException, ServletException
{
rep.setContentType ("text/html") ;
PrintWriter page = rep.getWriter() ;
page.println ("<html>") ;
page.println ("<head>") ;
page.println ("<title> Servlet Bonjour </title>") ;
page.println ("</head>") ;
String nom = req.getParameter("prenom") ;
page.println("<body>") ;
if (nom == null)
{
page.println ("BONJOUR") ;
}
else
{
page.println ("<font size=+2>") ;
page.println ("BONJOUR " + nom) ;
}
page.println("</br>Number of calls is "+ compte) ;
page.println ("</body>") ;
compte++;
}
public void doPost (HttpServletRequest req, HttpServletResponse rep) throws IOException, ServletException
{
rep.setContentType ("text/html") ;
PrintWriter page = rep.getWriter() ;
page.println ("<html>") ;
page.println ("<head>") ;
page.println ("<title> Servlet Bonjour </title>") ;
page.println ("</head>") ;
String nom = req.getParameter("prenom") ;
if (nom == null){
page.println ("<body>") ;
page.println ("BONJOUR") ;
page.println("</br>Number of calls is "+ compte) ;
page.println ("</body>") ;
}
else{
page.println ("<body>") ;
page.println ("<font size=+2>") ;
page.println ("BONJOUR " + nom) ;
page.println("</br>Number of calls is "+ compte) ;
page.println ("</body>") ;
}
}
public void init(ServletConfig Config) throws ServletException
{
compte = 0; // compteur du nombre d’appels de la servlet
}
} | [
"[email protected]"
] | |
f64d1bf6e7a95905cbdfcb475ea25c5a70e6363b | c8b8571d4e0de910a490218712b44eef34a78925 | /arbiter-deeplearning4j/src/main/java/org/deeplearning4j/arbiter/layers/BatchNormalizationSpace.java | 773503e648b25b7a0745c059744ab1138acd776f | [] | no_license | jayden11/Arbiter | b2652c770d38feb520617b90789971b770b841be | 987f31de02006523b4a02446429d27d110080a35 | refs/heads/master | 2020-12-03T00:26:57.522159 | 2017-06-30T04:52:12 | 2017-06-30T04:52:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,608 | java | package org.deeplearning4j.arbiter.layers;
import lombok.AccessLevel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.deeplearning4j.arbiter.optimize.api.ParameterSpace;
import org.deeplearning4j.arbiter.optimize.parameter.FixedValue;
import org.deeplearning4j.arbiter.util.LeafUtils;
import org.deeplearning4j.nn.conf.layers.BatchNormalization;
import java.util.List;
/**
* LayerSpace for batch normalization layers
*
* @author Alex Black
*/
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor(access = AccessLevel.PRIVATE) //For Jackson JSON/YAML deserialization
public class BatchNormalizationSpace extends FeedForwardLayerSpace<BatchNormalization> {
protected ParameterSpace<Double> decay;
protected ParameterSpace<Double> eps;
protected ParameterSpace<Boolean> isMinibatch;
protected ParameterSpace<Boolean> lockGammaBeta;
protected ParameterSpace<Double> gamma;
protected ParameterSpace<Double> beta;
private BatchNormalizationSpace(Builder builder) {
super(builder);
this.decay = builder.decay;
this.eps = builder.eps;
this.isMinibatch = builder.isMinibatch;
this.lockGammaBeta = builder.lockGammaBeta;
this.gamma = builder.gamma;
this.beta = builder.beta;
this.numParameters = LeafUtils.countUnique(collectLeaves());
}
@Override
public List<ParameterSpace> collectLeaves() {
List<ParameterSpace> list = super.collectLeaves();
if (decay != null) list.addAll(decay.collectLeaves());
if (eps != null) list.addAll(eps.collectLeaves());
if (isMinibatch != null) list.addAll(isMinibatch.collectLeaves());
if (lockGammaBeta != null) list.addAll(lockGammaBeta.collectLeaves());
if (gamma != null) list.addAll(gamma.collectLeaves());
if (beta != null) list.addAll(beta.collectLeaves());
return list;
}
@Override
public BatchNormalization getValue(double[] parameterValues) {
BatchNormalization.Builder b = new BatchNormalization.Builder();
setLayerOptionsBuilder(b, parameterValues);
return b.build();
}
protected void setLayerOptionsBuilder(BatchNormalization.Builder builder, double[] values) {
super.setLayerOptionsBuilder(builder, values);
if (decay != null) builder.decay(decay.getValue(values));
if (eps != null) builder.eps(eps.getValue(values));
if (isMinibatch != null) builder.minibatch(isMinibatch.getValue(values));
if (lockGammaBeta != null) builder.lockGammaBeta(lockGammaBeta.getValue(values));
if (gamma != null) builder.gamma(gamma.getValue(values));
if (beta != null) builder.beta(beta.getValue(values));
}
@Override
public String toString() {
return toString(", ");
}
@Override
public String toString(String delim) {
StringBuilder sb = new StringBuilder();
sb.append("BatchNormalizationSpace(").append(super.toString(delim));
if(decay != null) sb.append("decay: ").append(decay).append(delim);
if(eps != null) sb.append("eps: ").append(eps).append(delim);
if(isMinibatch != null) sb.append("isMinibatch: ").append(isMinibatch).append(delim);
if(lockGammaBeta != null) sb.append("lockGammaBeta: ").append(lockGammaBeta).append(delim);
if(gamma != null) sb.append("gamma: ").append(gamma).append(delim);
if(beta != null) sb.append("beta: ").append(beta).append(delim);
sb.append(")");
return sb.toString();
}
public static class Builder extends FeedForwardLayerSpace.Builder<Builder> {
protected ParameterSpace<Double> decay;
protected ParameterSpace<Double> eps;
protected ParameterSpace<Boolean> isMinibatch;
protected ParameterSpace<Boolean> lockGammaBeta;
protected ParameterSpace<Double> gamma;
protected ParameterSpace<Double> beta;
public Builder minibatch(boolean minibatch) {
return minibatch(new FixedValue<>(minibatch));
}
public Builder minibatch(ParameterSpace<Boolean> minibatch) {
this.isMinibatch = minibatch;
return this;
}
public Builder gamma(double gamma) {
return gamma(new FixedValue<>(gamma));
}
public Builder gamma(ParameterSpace<Double> gamma) {
this.gamma = gamma;
return this;
}
public Builder beta(double beta) {
return beta(new FixedValue<>(beta));
}
public Builder beta(ParameterSpace<Double> beta) {
this.beta = beta;
return this;
}
public Builder eps(double eps) {
return eps(new FixedValue<>(eps));
}
public Builder eps(ParameterSpace<Double> eps) {
this.eps = eps;
return this;
}
public Builder decay(double decay) {
return decay(new FixedValue<Double>(decay));
}
public Builder decay(ParameterSpace<Double> decay) {
this.decay = decay;
return this;
}
public Builder lockGammaBeta(boolean lockGammaBeta) {
return lockGammaBeta(new FixedValue<>(lockGammaBeta));
}
public Builder lockGammaBeta(ParameterSpace<Boolean> lockGammaBeta) {
this.lockGammaBeta = lockGammaBeta;
return this;
}
@Override
public BatchNormalizationSpace build() {
return new BatchNormalizationSpace(this);
}
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.