blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3b3540d851827ab74d3122a53c0e8f2862d572d3 | ac92fe2fc9ed3df9e254c05553b43312a6ad3b73 | /app/src/main/java/com/example/kwons/cafepay/TumblerRegister.java | 38bcd5e6a7d11bdb895506665047ac223b7a78d7 | [] | no_license | kwonsye/CafePay | e017d323a668a92909a4e6edf7c43193a3a9814b | fb85618434ff925ab5559b55a470a144f20138e2 | refs/heads/master | 2020-03-24T20:08:25.873805 | 2018-11-20T02:14:27 | 2018-11-20T02:14:27 | 142,961,685 | 0 | 1 | null | 2018-08-11T17:45:57 | 2018-07-31T04:19:38 | Java | UTF-8 | Java | false | false | 286 | java | package com.example.kwons.cafepay;
/**
* Created by sujin.kim on 2018. 8. 11..
*/
public class TumblerRegister {
String serial;
String userId;
TumblerRegister(String serial, String userId){
this.serial = serial;
this.userId = userId;
}
}
| [
"sujin.kim1414@gmail.com"
] | sujin.kim1414@gmail.com |
d5d5167672151decbf934dcfa450319c530782a2 | 0d6806161eefdaff08b8ec8e835b7cc35148dbd3 | /src/test/java/org/egoi/client/model/EmailReportByLocationTest.java | fd4337b5dec7a1e9348c39942ab7b54f7c2fac6e | [] | no_license | E-goi/sdk-java | bfe44f75a4629143a87ae718fff6a9baea0cc0cb | 3486755e202c23330931dd3b45d7feefcebe464e | refs/heads/master | 2023-05-02T12:31:03.274025 | 2023-04-18T07:41:19 | 2023-04-18T07:41:19 | 232,095,048 | 3 | 1 | null | 2022-12-12T17:31:28 | 2020-01-06T12:20:53 | Java | UTF-8 | Java | false | false | 5,846 | java | /*
* APIv3 (New)
* # Introduction This is our new version of API. We invite you to start using it and give us your feedback # Getting Started E-goi can be integrated with many environments and programming languages via our REST API. We've created a developer focused portal to give your organization a clear and quick overview of how to integrate with E-goi. The developer portal focuses on scenarios for integration and flow of events. We recommend familiarizing yourself with all of the content in the developer portal, before start using our rest API. The E-goi APIv3 is served over HTTPS. To ensure data privacy, unencrypted HTTP is not supported. Request data is passed to the API by POSTing JSON objects to the API endpoints with the appropriate parameters. BaseURL = api.egoiapp.com # RESTful Services This API supports 5 HTTP methods: * <b>GET</b>: The HTTP GET method is used to **read** (or retrieve) a representation of a resource. * <b>POST</b>: The POST verb is most-often utilized to **create** new resources. * <b>PATCH</b>: PATCH is used for **modify** capabilities. The PATCH request only needs to contain the changes to the resource, not the complete resource * <b>PUT</b>: PUT is most-often utilized for **update** capabilities, PUT-ing to a known resource URI with the request body containing the newly-updated representation of the original resource. * <b>DELETE</b>: DELETE is pretty easy to understand. It is used to **delete** a resource identified by a URI. # Authentication We use a custom authentication method, you will need a apikey that you can find in your account settings. Below you will see a curl example to get your account information: #!/bin/bash curl -X GET 'https://api.egoiapp.com/my-account' \\ -H 'accept: application/json' \\ -H 'Apikey: <YOUR_APY_KEY>' Here you can see a curl Post example with authentication: #!/bin/bash curl -X POST 'http://api.egoiapp.com/tags' \\ -H 'accept: application/json' \\ -H 'Apikey: <YOUR_APY_KEY>' \\ -H 'Content-Type: application/json' \\ -d '{`name`:`Your custom tag`,`color`:`#FFFFFF`}' # SDK Get started quickly with E-goi with our integration tools. Our SDK is a modern open source library that makes it easy to integrate your application with E-goi services. * <a href='https://github.com/E-goi/sdk-java'>Java</a> * <a href='https://github.com/E-goi/sdk-php'>PHP</a> * <a href='https://github.com/E-goi/sdk-python'>Python</a> * <a href='https://github.com/E-goi/sdk-ruby'>Ruby</a> * <a href='https://github.com/E-goi/sdk-javascript'>Javascript</a> * <a href='https://github.com/E-goi/sdk-csharp'>C#</a> # Stream Limits Stream limits are security mesures we have to make sure our API have a fair use policy, for this reason, any request that creates or modifies data (**POST**, **PATCH** and **PUT**) is limited to a maximum of **20MB** of content length. If you arrive to this limit in one of your request, you'll receive a HTTP code **413 (Request Entity Too Large)** and the request will be ignored. To avoid this error in importation's requests, it's advised the request's division in batches that have each one less than 20MB. # Timeouts Timeouts set a maximum waiting time on a request's response. Our API, sets a default timeout for each request and when breached, you'll receive an HTTP **408 (Request Timeout)** error code. You should take into consideration that response times can vary widely based on the complexity of the request, amount of data being analyzed, and the load on the system and workspace at the time of the query. When dealing with such errors, you should first attempt to reduce the complexity and amount of data under analysis, and only then, if problems are still occurring ask for support. For all these reasons, the default timeout for each request is **10 Seconds** and any request that creates or modifies data (**POST**, **PATCH** and **PUT**) will have a timeout of **60 Seconds**. Specific timeouts may exist for specific requests, these can be found in the request's documentation. # Callbacks A callback is an asynchronous API request that originates from the API server and is sent to the client in response to a previous request sent by that client. The API will make a **POST** request to the address defined in the URL with the information regarding the event of interest and share data related to that event. <a href='/usecases/callbacks/' target='_blank'>[Go to callbacks documentation]</a> ***Note:*** Only http or https protocols are supported in the Url parameter. <security-definitions/>
*
* The version of the OpenAPI document: 3.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.egoi.client.model;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.egoi.client.model.EmailReportByLocationLocationInner;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
/**
* Model tests for EmailReportByLocation
*/
public class EmailReportByLocationTest {
private final EmailReportByLocation model = new EmailReportByLocation();
/**
* Model tests for EmailReportByLocation
*/
@Test
public void testEmailReportByLocation() {
// TODO: test EmailReportByLocation
}
/**
* Test the property 'location'
*/
@Test
public void locationTest() {
// TODO: test location
}
}
| [
"integrations@e-goi.com"
] | integrations@e-goi.com |
f3ae4395373af65f8f9497d91ba4cc774de45968 | 06e9e39feb8410193ca9dc969a497a4cdd60db9b | /app/src/main/java/com/mnm/sense/map/LineManager.java | 7dc3e9aea2f14860f61bb865422aa92516247af6 | [
"BSD-3-Clause"
] | permissive | shomimn/sense | fcdd65f27daab843d5f1e6de2e2058d890816ea8 | 039612ba339a4ec30d6be3b28161ea20eb593a8c | refs/heads/master | 2021-01-12T21:09:14.943195 | 2017-06-02T19:07:44 | 2017-06-02T19:07:44 | 68,477,029 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 375 | java | package com.mnm.sense.map;
import java.util.ArrayList;
public class LineManager
{
private ArrayList<AttributedFeature> lines;
public LineManager()
{
lines = new ArrayList<>();
}
public void add(AttributedFeature line)
{
lines.add(line);
}
public ArrayList<AttributedFeature> getLines()
{
return lines;
}
}
| [
"shomimn@gmail.com"
] | shomimn@gmail.com |
66b75764c9b52db8cbe0dbde1743df5c433498c4 | f328c7598b01fcdf777ae6b42a1665670a3f79ce | /modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/internal/model/swagger/AuthorizationDeclaration.java | d7e73bd3da99a47485d98f49eb31b6b8e5332484 | [] | no_license | dldinternet/restlet-framework-java | d21e3e9f5a908f7c7a18959cbcff022c55cbabb6 | 47bb64c9a41b3b650b0ce9a9634238f3b83a742f | refs/heads/master | 2020-12-28T19:47:14.386335 | 2014-11-01T18:01:28 | 2014-11-01T18:01:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 401 | java | package org.restlet.ext.apispark.internal.model.swagger;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@JsonInclude(Include.NON_NULL)
public class AuthorizationDeclaration {
private String type;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
| [
"quilicicf@gmail.com"
] | quilicicf@gmail.com |
d03afd1517ba85431aa8c1f046bba5a3a415737f | 8a3ac0dcb541fc1b13b13e82dbddfac3a35f96ed | /src/main/java/com/desarrollo/adminhoras/api/negocio/impl/CalculoHorasServiceImpl.java | cb2156b12cf20ed6125112b05e70b9ca44f76831 | [] | no_license | alejogomez17/AdminHorasRest | 223632f57284b610903d21895927251fb8856c40 | 76c9dad846d96c0688f459d59046f15597a4bfc0 | refs/heads/master | 2022-12-24T03:41:37.449733 | 2022-09-08T02:03:21 | 2022-09-08T02:03:21 | 181,820,135 | 0 | 0 | null | 2022-12-10T04:39:33 | 2019-04-17T05:00:56 | Java | UTF-8 | Java | false | false | 1,977 | java | package com.desarrollo.adminhoras.api.negocio.impl;
import com.desarrollo.adminhoras.api.datos.dao.AdminHorasDao;
import com.desarrollo.adminhoras.api.datos.dominio.AdhHore;
import com.desarrollo.adminhoras.api.datos.dominio.AdhRein;
import com.desarrollo.adminhoras.api.modelo.EstructuraFechaRegistro;
import com.desarrollo.adminhoras.api.negocio.control.CalculoHorasService;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import org.springframework.beans.factory.annotation.Autowired;
/**
*
* @author Alejo Gómez
*/
public class CalculoHorasServiceImpl implements CalculoHorasService {
@Autowired
private AdminHorasDao adminHorasDaoImpl;
@Override
public void realizarCalculoDeHoras(AdhRein ingresoDesde, AdhRein ingresoHasta) {
EstructuraFechaRegistro fechaDesde = new EstructuraFechaRegistro(ingresoDesde.getFechar());
EstructuraFechaRegistro fechaHasta = new EstructuraFechaRegistro(ingresoHasta.getFechar());
int diferencia = (int) ((fechaHasta.getFecha().getTime() - fechaDesde.getFecha().getTime()) / 1000);
int horas = (int) Math.floor(diferencia / 3600);
int extras = 0;
if (horas > 8) {
// más de 8 horas de un día
extras = horas - 8;
} else {
if (horas >= 24) {
// OJO pasó un día completo trabajando ?
}
}
AdhHore registroHoras = new AdhHore();
registroHoras.setIdempl(ingresoDesde.getIdempl());
registroHoras.setIdreid(ingresoDesde.getIdrein());
registroHoras.setIdreih(ingresoHasta.getIdrein());
registroHoras.setTothor(horas);
registroHoras.setHorext(extras);
adminHorasDaoImpl.insertarHorasRegistradas(registroHoras);
}
private Calendar crearCalendarioDeFecha(Date fecha) {
Calendar calendario = new GregorianCalendar();
calendario.setTime(fecha);
return calendario;
}
}
| [
"alego17@gmail.com"
] | alego17@gmail.com |
1ae3e46fd22bb1d8610ac8253c59fa4074a28755 | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/XRENDERING-422-11-21-PESA_II-WeightedSum:TestLen:CallDiversity/org/xwiki/rendering/wikimodel/impl/InternalWikiScannerContext_ESTest.java | ad54cbdf8b80165c3589fe7047e793c040e44fcd | [] | no_license | STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application | cf118b23ecb87a8bf59643e42f7556b521d1f754 | 3bb39683f9c343b8ec94890a00b8f260d158dfe3 | refs/heads/master | 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 593 | java | /*
* This file was automatically generated by EvoSuite
* Fri Apr 03 18:15:31 UTC 2020
*/
package org.xwiki.rendering.wikimodel.impl;
import org.junit.Test;
import static org.junit.Assert.*;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true)
public class InternalWikiScannerContext_ESTest extends InternalWikiScannerContext_ESTest_scaffolding {
@Test
public void notGeneratedAnyTest() {
// EvoSuite did not generate any tests
}
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
a23781fa659ed298a5c23bfc2cdb8f59e76621cb | f7e863f6e10e11f0fdc8faf6e89dd68d1e06915f | /RecursionPreTest/src/Main.java | f8059b2fdadc47a098a2bc209f5aa4af9c612531 | [] | no_license | bowser6791/Java | 4768ee99663ab1e8931573501102e930e45ecfb1 | 7b9c79a46f0e20d84ae110a1de18393ae1556152 | refs/heads/master | 2021-01-21T15:31:46.303847 | 2017-06-01T02:12:23 | 2017-06-01T02:12:23 | 91,849,368 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 598 | java |
public class Main {
public static void main(String[] args) {
int [] array = { 1, 4, 16, 256 };
System.out.println("funny = " + funny(array, array.length-1));
int [] array2 = { 4, 6, 8, 12, 16 };
int halfTotal = halfSum(array2, array2.length-1);
System.out.println("Half the Sum of the Elements = " + halfTotal);
}
public static int funny(int [] a, int i)
{
if (i == 0)
return a[0];
else
return a[i] / funny(a, i-1);
}
public static int halfSum(int [] a, int i)
{
if (i == 0)
return a[0] / 2;
else
return a[i-1]/2;
// TODO: Recursive Case
}
}
| [
"jeana@10.0.0.153"
] | jeana@10.0.0.153 |
5ae33a5ee8e1473d7a401ca7aea1d0127fdb8d8f | 3c1ca47e642add98d4157498d8e9f0bf70ff83b4 | /core/src/com/midfag/equip/energoshield/attr/ESAttributeCharge.java | 95207790402f8b0bb5645e7d5fedd8e20554cd2b | [] | no_license | NoSimpleWay/EdgeLands_common | 368ef1d3d7d1a2037a83355c51bab98d07108410 | 2f610e1268a1ba36b959598783c307909d328620 | refs/heads/master | 2021-07-14T22:23:02.487675 | 2018-12-02T13:41:14 | 2018-12-02T13:41:14 | 138,329,574 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,110 | java | package com.midfag.equip.energoshield.attr;
import com.badlogic.gdx.math.Vector2;
import com.midfag.entity.Entity;
import com.midfag.entity.missiles.MissileCharge;
import com.midfag.equip.energoshield.Energoshield;
import com.midfag.game.GScreen;
public class ESAttributeCharge extends ESAttribute {
public float charge_time;
public ESAttributeCharge()
{
name="charge";
cost=2;
max_level=100;
base=false;
}
@Override
public void calculate(Energoshield _e)
{
//_e.total_value=_e.base_value*(1f+level*0.1f);
}
@Override
public void update(float _d, Entity _e)
{
charge_time-=_d;
if (charge_time<=0)
{
charge_time+=5;
for (int i=0; i<12; i++)
{
GScreen.Missile_list.add(new MissileCharge(new Vector2(_e.pos.x,_e.pos.y), (float)(Math.random()*360.0f),(float) (1000.0f+Math.random()*277),_e.is_AI));
GScreen.Missile_list.get(GScreen.Missile_list.size()-1).damage=level*5;
GScreen.Missile_list.get(GScreen.Missile_list.size()-1).lifetime=(float)0.5f;
}
}
}
@Override
public String get_attr_value()
{
return ""+level*5.0f;
}
}
| [
"36441257+NoSimpleWay@users.noreply.github.com"
] | 36441257+NoSimpleWay@users.noreply.github.com |
2eced2e1562e32294bbc7990f1f0fdc36e57396e | d03c6a973eb01828db34d2c2d0c7c53a97483141 | /plugin/src/main/java/org/wildfly/plugins/bootablejar/maven/common/MavenRepositoriesEnricher.java | ce93da8ed5887b855909a81d0216a4d9fa38952c | [
"Apache-2.0"
] | permissive | wildfly-extras/wildfly-jar-maven-plugin | a4deed30473a52356720d2644b26646b91adf05d | 312e99184b89884680854e55be3c939a1e3d66e0 | refs/heads/main | 2023-07-27T10:54:53.623415 | 2023-07-20T17:23:57 | 2023-07-20T17:23:57 | 251,692,925 | 58 | 44 | Apache-2.0 | 2023-07-19T09:24:26 | 2020-03-31T18:18:06 | Java | UTF-8 | Java | false | false | 5,381 | java | /*
* Copyright 2020 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* 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.wildfly.plugins.bootablejar.maven.common;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Settings;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.repository.RepositoryPolicy;
/**
* Add required repositories if not present.
* @author jdenise
*/
public class MavenRepositoriesEnricher {
private static class RequiredRepository {
private final String id;
private final String type;
private final String url;
private final RepositoryPolicy releasePolicy;
private final RepositoryPolicy snapshotPolicy;
RequiredRepository(String id, String type, String url, RepositoryPolicy releasePolicy, RepositoryPolicy snapshotPolicy) {
this.id = id;
this.type = type;
this.url = url;
this.releasePolicy = releasePolicy;
this.snapshotPolicy = snapshotPolicy;
}
}
public static final String GA_REPO_URL = "https://maven.repository.redhat.com/ga/";
public static final String NEXUS_REPO_URL = "https://repository.jboss.org/nexus/content/groups/public/";
private static final String DEFAULT_REPOSITORY_TYPE = "default";
private static final Map<String, RequiredRepository> REQUIRED_REPOSITORIES = new HashMap<>();
static {
REQUIRED_REPOSITORIES.put(GA_REPO_URL, new RequiredRepository("jboss-ga-repository", DEFAULT_REPOSITORY_TYPE, GA_REPO_URL,
new RepositoryPolicy(true, RepositoryPolicy.UPDATE_POLICY_DAILY, RepositoryPolicy.CHECKSUM_POLICY_WARN),
new RepositoryPolicy(false, RepositoryPolicy.UPDATE_POLICY_NEVER, RepositoryPolicy.CHECKSUM_POLICY_FAIL)));
REQUIRED_REPOSITORIES.put(NEXUS_REPO_URL, new RequiredRepository("jboss-public-repository", DEFAULT_REPOSITORY_TYPE, NEXUS_REPO_URL,
new RepositoryPolicy(true, RepositoryPolicy.UPDATE_POLICY_DAILY, RepositoryPolicy.CHECKSUM_POLICY_WARN),
new RepositoryPolicy(false, RepositoryPolicy.UPDATE_POLICY_NEVER, RepositoryPolicy.CHECKSUM_POLICY_FAIL)));
}
public static void enrich(MavenSession session, MavenProject project, List<RemoteRepository> repositories) throws MojoExecutionException {
Set<String> configuredUrls = getUrls(repositories);
Settings settings = session.getSettings();
Proxy proxy = settings.getActiveProxy();
MavenProxySelector proxySelector = null;
if (proxy != null) {
MavenProxySelector.Builder selectorBuilder = new MavenProxySelector.Builder(proxy.getHost(), proxy.getPort(), proxy.getProtocol());
selectorBuilder.setPassword(proxy.getPassword());
selectorBuilder.setUserName(proxy.getUsername());
if (proxy.getNonProxyHosts() != null) {
String[] hosts = proxy.getNonProxyHosts().split("\\|");
selectorBuilder.addNonProxyHosts(Arrays.asList(hosts));
}
proxySelector = selectorBuilder.build();
}
for (Entry<String, RequiredRepository> entry : REQUIRED_REPOSITORIES.entrySet()) {
if (!configuredUrls.contains(entry.getKey())) {
RequiredRepository repo = entry.getValue();
RemoteRepository.Builder builder = new RemoteRepository.Builder(repo.id, repo.type, repo.url);
builder.setReleasePolicy(repo.releasePolicy);
builder.setSnapshotPolicy(repo.snapshotPolicy);
if (proxySelector != null) {
try {
org.eclipse.aether.repository.Proxy aetherProxy = proxySelector.getProxy(new URL(repo.url).getHost());
if (aetherProxy != null) {
builder.setProxy(aetherProxy);
}
} catch (MalformedURLException ex) {
throw new MojoExecutionException("Invalid repo url " + repo.url, ex);
}
}
repositories.add(builder.build());
}
}
}
private static Set<String> getUrls(List<RemoteRepository> repositories) {
Set<String> set = new HashSet<>();
for (RemoteRepository repo : repositories) {
set.add(repo.getUrl());
}
return set;
}
}
| [
"jdenise@redhat.com"
] | jdenise@redhat.com |
de6e05e3b404405c611becfbc02883a5c8bc3e4a | ac2333c21e020cf96e89d3b433cf42a78b24810e | /archive/src/main/java/org/yi/happy/archive/HelpMain.java | 37fd9e889d250967b0bec31b2a791c161ea5c2f2 | [
"Apache-2.0"
] | permissive | VijayEluri/happy-archive | 75e974951961661ae4ab6d4f85f8d0e77626e253 | 41dc7789d688366760dcbfb91733292baba9ba35 | refs/heads/master | 2020-05-20T10:59:41.888114 | 2016-02-02T05:19:15 | 2016-02-02T05:19:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 777 | java | package org.yi.happy.archive;
import java.io.PrintStream;
import java.util.Map;
/**
* A command to print out basic help.
*/
public class HelpMain implements MainCommand {
private final PrintStream out;
private final Map<String, Class<? extends MainCommand>> commands;
/**
* Set up to print out basic help.
*
* @param out
* the output stream.
* @param commands
* the command map.
*/
public HelpMain(PrintStream out,
Map<String, Class<? extends MainCommand>> commands) {
this.out = out;
this.commands = commands;
}
@Override
public void run() throws Exception {
for (String name : commands.keySet()) {
out.println(name);
}
}
}
| [
"sarah.a.happy@gmail.com"
] | sarah.a.happy@gmail.com |
307b32f4d52d2e287b90fcecd4fc26af899cd46d | 6d109557600329b936efe538957dfd0a707eeafb | /src/com/google/api/ads/dfp/v201306/RichMediaStudioCreativeFormat.java | 98b916dc2d1fa3b5e2ed7d6358d3406aeac16099 | [
"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 | 4,482 | java | /**
* RichMediaStudioCreativeFormat.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.v201306;
public class RichMediaStudioCreativeFormat implements java.io.Serializable {
private java.lang.String _value_;
private static java.util.HashMap _table_ = new java.util.HashMap();
// Constructor
protected RichMediaStudioCreativeFormat(java.lang.String value) {
_value_ = value;
_table_.put(_value_,this);
}
public static final java.lang.String _IN_PAGE = "IN_PAGE";
public static final java.lang.String _EXPANDING = "EXPANDING";
public static final java.lang.String _IM_EXPANDING = "IM_EXPANDING";
public static final java.lang.String _FLOATING = "FLOATING";
public static final java.lang.String _PEEL_DOWN = "PEEL_DOWN";
public static final java.lang.String _IN_PAGE_WITH_FLOATING = "IN_PAGE_WITH_FLOATING";
public static final java.lang.String _FLASH_IN_FLASH = "FLASH_IN_FLASH";
public static final java.lang.String _FLASH_IN_FLASH_EXPANDING = "FLASH_IN_FLASH_EXPANDING";
public static final java.lang.String _IN_APP = "IN_APP";
public static final java.lang.String _UNKNOWN = "UNKNOWN";
public static final RichMediaStudioCreativeFormat IN_PAGE = new RichMediaStudioCreativeFormat(_IN_PAGE);
public static final RichMediaStudioCreativeFormat EXPANDING = new RichMediaStudioCreativeFormat(_EXPANDING);
public static final RichMediaStudioCreativeFormat IM_EXPANDING = new RichMediaStudioCreativeFormat(_IM_EXPANDING);
public static final RichMediaStudioCreativeFormat FLOATING = new RichMediaStudioCreativeFormat(_FLOATING);
public static final RichMediaStudioCreativeFormat PEEL_DOWN = new RichMediaStudioCreativeFormat(_PEEL_DOWN);
public static final RichMediaStudioCreativeFormat IN_PAGE_WITH_FLOATING = new RichMediaStudioCreativeFormat(_IN_PAGE_WITH_FLOATING);
public static final RichMediaStudioCreativeFormat FLASH_IN_FLASH = new RichMediaStudioCreativeFormat(_FLASH_IN_FLASH);
public static final RichMediaStudioCreativeFormat FLASH_IN_FLASH_EXPANDING = new RichMediaStudioCreativeFormat(_FLASH_IN_FLASH_EXPANDING);
public static final RichMediaStudioCreativeFormat IN_APP = new RichMediaStudioCreativeFormat(_IN_APP);
public static final RichMediaStudioCreativeFormat UNKNOWN = new RichMediaStudioCreativeFormat(_UNKNOWN);
public java.lang.String getValue() { return _value_;}
public static RichMediaStudioCreativeFormat fromValue(java.lang.String value)
throws java.lang.IllegalArgumentException {
RichMediaStudioCreativeFormat enumeration = (RichMediaStudioCreativeFormat)
_table_.get(value);
if (enumeration==null) throw new java.lang.IllegalArgumentException();
return enumeration;
}
public static RichMediaStudioCreativeFormat 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(RichMediaStudioCreativeFormat.class);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v201306", "RichMediaStudioCreativeFormat"));
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
}
| [
"api.arogal@gmail.com@e5600b00-1bfd-11df-acd4-e1cde50d4098"
] | api.arogal@gmail.com@e5600b00-1bfd-11df-acd4-e1cde50d4098 |
1a4c0714af0f461e5ceca595a8c8740f82cead53 | 568e45be043bcdb3bcce2455e4528212eb9f4b08 | /FinancialApp3/src/main/java/b/dataTransferObjects/Vehicle.java | 0a79b036f7deb3ca7608fc691f80ebd7d9628244 | [] | no_license | crispinWeissfuss/FinancialServicesApp | 1d02d3599a688d90978ee91fd6a71dd9082366cd | d7183743e860f08ada7f52f7d32d079283fa3cb5 | refs/heads/master | 2020-06-02T00:53:57.008710 | 2015-07-23T13:45:13 | 2015-07-23T13:45:13 | 39,457,862 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 441 | java | package b.dataTransferObjects;
public class Vehicle {
private int vehicleId;
private String description;
public Vehicle() {
}
public int getVehicleId() {
return vehicleId;
}
public void setVehicleId(int vehicleId) {
this.vehicleId = vehicleId;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
| [
"crispin.weissfuss@gmx.de"
] | crispin.weissfuss@gmx.de |
9bbe1ebbabd084b3f0fdb0c833057988276f9344 | 20eb62855cb3962c2d36fda4377dfd47d82eb777 | /newEvaluatedBugs/Jsoup_8_buggy/mutated/589/Cleaner.java | 968870d9d2e86b6d4266ddd3f8a63967d2ab9c80 | [] | no_license | ozzydong/CapGen | 356746618848065cce4e253e5d3c381baa85044a | 0ba0321b6b1191443276021f1997833342f02515 | refs/heads/master | 2023-03-18T20:12:02.923428 | 2020-08-21T03:08:28 | 2020-08-21T03:08:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,647 | java | package org.jsoup.safety;
import org.jsoup.helper.Validate;
import org.jsoup.nodes.Attribute;
import org.jsoup.nodes.Attributes;
import org.jsoup.nodes.DataNode;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.nodes.Node;
import org.jsoup.nodes.TextNode;
import org.jsoup.parser.Tag;
import org.jsoup.select.NodeTraversor;
import org.jsoup.select.NodeVisitor;
import java.util.List;
/**
The whitelist based HTML cleaner. Use to ensure that end-user provided HTML contains only the elements and attributes
that you are expecting; no junk, and no cross-site scripting attacks!
<p>
The HTML cleaner parses the input as HTML and then runs it through a white-list, so the output HTML can only contain
HTML that is allowed by the whitelist.
</p>
<p>
It is assumed that the input HTML is a body fragment; the clean methods only pull from the source's body, and the
canned white-lists only allow body contained tags.
</p>
<p>
Rather than interacting directly with a Cleaner object, generally see the {@code clean} methods in {@link org.jsoup.Jsoup}.
</p>
*/
public class Cleaner {
private Whitelist whitelist;
/**
Create a new cleaner, that sanitizes documents using the supplied whitelist.
@param whitelist white-list to clean with
*/
public Cleaner(Whitelist whitelist) {
Validate.notNull(whitelist);
this.whitelist = whitelist;
}
/**
Creates a new, clean document, from the original dirty document, containing only elements allowed by the whitelist.
The original document is not modified. Only elements from the dirt document's <code>body</code> are used.
@param dirtyDocument Untrusted base document to clean.
@return cleaned document.
*/
public Document clean(Document dirtyDocument) {
Validate.notNull(dirtyDocument);
Document clean = Document.createShell(dirtyDocument.baseUri());
if (dirtyDocument.body() != null) // frameset documents won't have a body. the clean doc will have empty body.
copySafeNodes(dirtyDocument.body(), clean.body());
return clean;
}
/**
Determines if the input document <b>body</b>is valid, against the whitelist. It is considered valid if all the tags and attributes
in the input HTML are allowed by the whitelist, and that there is no content in the <code>head</code>.
<p>
This method can be used as a validator for user input. An invalid document will still be cleaned successfully
using the {@link #clean(Document)} document. If using as a validator, it is recommended to still clean the document
to ensure enforced attributes are set correctly, and that the output is tidied.
</p>
@param dirtyDocument document to test
@return true if no tags or attributes need to be removed; false if they do
*/
public boolean isValid(Document dirtyDocument) {
Validate.notNull(dirtyDocument);
Document clean = Document.createShell(dirtyDocument.baseUri());
int numDiscarded = copySafeNodes(dirtyDocument.body(), clean.body());
return numDiscarded == 0;
}
/**
Iterates the input and copies trusted nodes (tags, attributes, text) into the destination.
*/
private final class CleaningVisitor implements NodeVisitor {
private int numDiscarded = 0;
private final Element root;
private Element destination; // current element to append nodes to
private CleaningVisitor(Element root, Element destination) {
this.root = root;
this.destination = destination;
}
public void head(Node source, int depth) {
if (source instanceof Element) {
Element sourceEl = (Element) source;
if (whitelist.isSafeTag(sourceEl.tagName())) { // safe, clone and copy safe attrs
ElementMeta meta = createSafeElement(sourceEl);
Element destChild = meta.el;
if (source != (root)) { (numDiscarded)++;}
destination.appendChild(destChild);
numDiscarded += meta.numAttribsDiscarded;
destination = destChild;
} else if (source != root) { // not a safe tag, so don't add. don't count root against discarded.
numDiscarded++;
}
} else if (source instanceof TextNode) {
TextNode sourceText = (TextNode) source;
TextNode destText = new TextNode(sourceText.getWholeText(), source.baseUri());
destination.appendChild(destText);
} else if (source instanceof DataNode && whitelist.isSafeTag(source.parent().nodeName())) {
DataNode sourceData = (DataNode) source;
DataNode destData = new DataNode(sourceData.getWholeData(), source.baseUri());
destination.appendChild(destData);
} else { // else, we don't care about comments, xml proc instructions, etc
numDiscarded++;
}
}
public void tail(Node source, int depth) {
if (source instanceof Element && whitelist.isSafeTag(source.nodeName())) {
destination = destination.parent(); // would have descended, so pop destination stack
}
}
}
private int copySafeNodes(Element source, Element dest) {
CleaningVisitor cleaningVisitor = new CleaningVisitor(source, dest);
NodeTraversor traversor = new NodeTraversor(cleaningVisitor);
traversor.traverse(source);
return cleaningVisitor.numDiscarded;
}
private ElementMeta createSafeElement(Element sourceEl) {
String sourceTag = sourceEl.tagName();
Attributes destAttrs = new Attributes();
Element dest = new Element(Tag.valueOf(sourceTag), sourceEl.baseUri(), destAttrs);
int numDiscarded = 0;
Attributes sourceAttrs = sourceEl.attributes();
for (Attribute sourceAttr : sourceAttrs) {
if (whitelist.isSafeAttribute(sourceTag, sourceEl, sourceAttr))
destAttrs.put(sourceAttr);
else
numDiscarded++;
}
Attributes enforcedAttrs = whitelist.getEnforcedAttributes(sourceTag);
destAttrs.addAll(enforcedAttrs);
return new ElementMeta(dest, numDiscarded);
}
private static class ElementMeta {
Element el;
int numAttribsDiscarded;
ElementMeta(Element el, int numAttribsDiscarded) {
this.el = el;
this.numAttribsDiscarded = numAttribsDiscarded;
}
}
}
| [
"justinwm@163.com"
] | justinwm@163.com |
6b6c120c13da348d5bd79783eb30b44efb4ff2e5 | 27857d9282d7df68b976f4b3ac55cf7f7037b838 | /src/main/java/ru.job4j/tracker/Predator.java | dd0188e131ec355711aa61102f5ad47dcaf63daa | [] | no_license | mihanchik94/job4j_elementary | b8a475429f3a8fb7990d5c7002f58729f965c0c2 | 99eede4a36b3b20467e55e4543fd5b6fb6490b29 | refs/heads/master | 2023-03-04T00:17:33.998566 | 2021-02-12T17:23:46 | 2021-02-12T17:23:46 | 265,877,472 | 0 | 0 | null | 2020-05-21T15:00:39 | 2020-05-21T15:00:39 | null | UTF-8 | Java | false | false | 245 | java | package ru.job4j.tracker;
public class Predator extends Animal {
public Predator() {
super();
System.out.println("Predator");
}
public static void main(String[] args) {
Animal animal = new Animal();
}
}
| [
"mihanchik94@gmail.com"
] | mihanchik94@gmail.com |
01e82f20cbc8290a6a4dd6776077eaa584e24402 | 20c32c6f17702df4558c76fc2574e3717daf2a43 | /app/src/main/java/com/dreamsecurity/oauth/custom/common/Logger.java | efe565bce2b50f17b14a120778b1a06711e9207d | [] | no_license | akakim/OAuthCopy | 78dfe8a70f1de150f226cbbf637ee6d1fc79eb29 | c3eeafa8ab23080f99d262b260cfd8e26ebd4afc | refs/heads/master | 2020-06-19T03:38:28.722506 | 2019-07-30T04:50:52 | 2019-07-30T04:50:52 | 196,549,816 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,288 | java | package com.dreamsecurity.oauth.custom.common;
import android.content.Context;
/**
*
*/
public class Logger {
public interface ILoggerStrategy{
void setTagPrefix(String tagPrefix);
void i(String tag, String msg);
void w(String tag, String msg);
void e(String tag, String msg);
void d(String tag, String msg);
void v(String tag, String msg);
void write(int level, String tag, String msg);
}
private static ILoggerStrategy logger = LoggerStrategyLog.getInstance();
private static boolean realVersion = true;
private static String tagPrefix = "";
public static void setTagPrefix(String tagPrefix) {
Logger.tagPrefix = tagPrefix;
logger.setTagPrefix( tagPrefix );
}
public static boolean isRealVersion() {
return realVersion;
}
public static void setRealVersion(boolean realVersion) {
Logger.realVersion = realVersion;
}
public static void setLogger(ILoggerStrategy customLogger){
logger = customLogger;
}
public static void switchingToFile(Context context){
logger = LoggerStrategyFileLog.getInstance(context);
}
public static void switchingToLogcat(){
logger = LoggerStrategyLog.getInstance( tagPrefix );
}
public static void switchingToNoLogging(){
// logger = LoggerStrategyLog.getInstance()
}
public static void i(String tag, String msg) {
logger.i(tag,msg);
}
public static void w(String tag, String msg) {
logger.w( tag , msg);
}
public static void d(String tag, String msg) {
logger.d( tag, msg );
}
public static void v(String tag, String msg) {
logger.v(tag,msg);
}
public static void e(String tag, String msg) {
logger.e(tag,msg);
}
public static void write(int level, String tag, String msg) {
logger.write( level, tag, msg);
}
public static void write(Exception exception) {
if (exception == null) {
return;
}
e("Exception", exception.toString());
StackTraceElement[] elem = exception.getStackTrace();
for (int i = 0; i < elem.length; ++i) {
e("Exception", elem[i].toString());
}
}
}
| [
"daphne5009@gmail.com"
] | daphne5009@gmail.com |
7e14710d3ba7b0997759134dd78e9adaab5124cb | d1ceadffc48f64545598559447745ca116399166 | /src/main/java/com/partner/dorm/impl/IRoommateServiceImpl.java | dc950a772115b498647569ef0c5da91f797d9f3a | [] | no_license | kitttttty/dorm | 25f8977575daf89ea1a6305deb61db5082b44471 | 88bbcdcffe6bd8341392580cd0552162ffcb8ce5 | refs/heads/master | 2020-03-24T18:07:04.895024 | 2018-07-26T14:24:59 | 2018-07-26T14:24:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 519 | java | package com.partner.dorm.impl;
import com.partner.dorm.entity.Roommate;
import com.partner.dorm.mapper.RoommateMapper;
import com.partner.dorm.service.IRoommateService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 管理用户信息 服务实现类
* </p>
*
* @author chengliang.luo
* @since 2018-07-26
*/
@Service
public class IRoommateServiceImpl extends ServiceImpl<RoommateMapper, Roommate> implements IRoommateService {
}
| [
"836240007@qq.com"
] | 836240007@qq.com |
a411fbd09398285b863059236649a0b3bd093061 | 0863133d7365fc9f2a2e3e161c646bab63e2ee6e | /eclipse-workspace/LayoutWeightExample/gen/com/example/layoutweightexample/R.java | 5f46ff0756cb0f2497348281fc3a222e27f58c39 | [] | no_license | diptadas/android-projects | 4cdecac4a25903a2a4f4a2cd48cd5afab88b6f6b | dfd6d6d0523b66d9c892617282c0641781d55ee4 | refs/heads/master | 2021-09-01T10:58:20.246509 | 2017-04-03T18:00:00 | 2017-04-03T18:00:00 | 115,352,553 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,085 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.example.layoutweightexample;
public final class R {
public static final class attr {
}
public static final class color {
public static final int AliceBlue=0x7f04002c;
public static final int AntiqueWhite=0x7f040022;
public static final int Aqua=0x7f04007c;
public static final int Aquamarine=0x7f040061;
public static final int Azure=0x7f04002a;
public static final int Beige=0x7f040027;
public static final int Bisque=0x7f04000d;
public static final int Black=0x7f04008b;
public static final int BlanchedAlmond=0x7f04000b;
public static final int Blue=0x7f040087;
public static final int BlueViolet=0x7f04005a;
public static final int Brown=0x7f04004e;
public static final int BurlyWood=0x7f040034;
public static final int CadetBlue=0x7f04006c;
public static final int Chartreuse=0x7f040062;
public static final int Chocolate=0x7f04003e;
public static final int Coral=0x7f040017;
public static final int CornflowerBlue=0x7f04006b;
public static final int Cornsilk=0x7f040007;
public static final int Crimson=0x7f040037;
public static final int Cyan=0x7f04007d;
public static final int DarkBlue=0x7f040089;
public static final int DarkCyan=0x7f040083;
public static final int DarkGoldenrod=0x7f040046;
public static final int DarkGray=0x7f04004d;
public static final int DarkGreen=0x7f040086;
public static final int DarkKhaki=0x7f040043;
public static final int DarkMagenta=0x7f040058;
public static final int DarkOliveGreen=0x7f04006d;
public static final int DarkOrange=0x7f040016;
public static final int DarkOrchid=0x7f040051;
public static final int DarkRed=0x7f040059;
public static final int DarkSalmon=0x7f040031;
public static final int DarkSeaGreen=0x7f040056;
public static final int DarkSlateBlue=0x7f040070;
public static final int DarkSlateGray=0x7f040076;
public static final int DarkTurquoise=0x7f040081;
public static final int DarkViolet=0x7f040053;
public static final int DeepPink=0x7f04001b;
public static final int DeepSkyBlue=0x7f040082;
public static final int DimGray=0x7f040069;
public static final int DodgerBlue=0x7f04007a;
public static final int FireBrick=0x7f040047;
public static final int FloralWhite=0x7f040005;
public static final int ForestGreen=0x7f040078;
public static final int Fuchsia=0x7f04001c;
public static final int Gainsboro=0x7f040036;
public static final int GhostWhite=0x7f040024;
public static final int Gold=0x7f040011;
public static final int Goldenrod=0x7f040039;
public static final int Gray=0x7f04005d;
public static final int Green=0x7f040085;
public static final int GreenYellow=0x7f04004b;
public static final int Honeydew=0x7f04002b;
public static final int HotPink=0x7f040018;
public static final int IndianRed=0x7f040040;
public static final int Indigo=0x7f04006e;
public static final int Ivory=0x7f040001;
public static final int Khaki=0x7f04002d;
public static final int Lavender=0x7f040032;
public static final int LavenderBlush=0x7f040009;
public static final int LawnGreen=0x7f040063;
public static final int LemonChiffon=0x7f040006;
public static final int LightBlue=0x7f04004c;
public static final int LightCoral=0x7f04002e;
public static final int LightCyan=0x7f040033;
public static final int LightGoldenrodYellow=0x7f040020;
public static final int LightGreen=0x7f040055;
public static final int LightGrey=0x7f04003c;
public static final int LightPink=0x7f040013;
public static final int LightSalmon=0x7f040015;
public static final int LightSeaGreen=0x7f040079;
public static final int LightSkyBlue=0x7f04005b;
public static final int LightSlateGray=0x7f040065;
public static final int LightSteelBlue=0x7f040049;
public static final int LightYellow=0x7f040002;
public static final int Lime=0x7f04007f;
public static final int LimeGreen=0x7f040075;
public static final int Linen=0x7f040021;
public static final int Magenta=0x7f04001d;
public static final int Maroon=0x7f040060;
public static final int MediumAquamarine=0x7f04006a;
public static final int MediumBlue=0x7f040088;
public static final int MediumOrchid=0x7f040045;
public static final int MediumPurple=0x7f040054;
public static final int MediumSeaGreen=0x7f040074;
public static final int MediumSlateBlue=0x7f040064;
public static final int MediumSpringGreen=0x7f040080;
public static final int MediumTurquoise=0x7f04006f;
public static final int MediumVioletRed=0x7f040041;
public static final int MidnightBlue=0x7f04007b;
public static final int MintCream=0x7f040025;
public static final int MistyRose=0x7f04000c;
public static final int Moccasin=0x7f04000e;
public static final int NavajoWhite=0x7f04000f;
public static final int Navy=0x7f04008a;
public static final int OldLace=0x7f04001f;
public static final int Olive=0x7f04005e;
public static final int OliveDrab=0x7f040067;
public static final int Orange=0x7f040014;
public static final int OrangeRed=0x7f04001a;
public static final int Orchid=0x7f04003a;
public static final int PaleGoldenrod=0x7f04002f;
public static final int PaleGreen=0x7f040052;
public static final int PaleTurquoise=0x7f04004a;
public static final int PaleVioletRed=0x7f040038;
public static final int PapayaWhip=0x7f04000a;
public static final int PeachPuff=0x7f040010;
public static final int Peru=0x7f04003f;
public static final int Pink=0x7f040012;
public static final int Plum=0x7f040035;
public static final int PowderBlue=0x7f040048;
public static final int Purple=0x7f04005f;
public static final int Red=0x7f04001e;
public static final int RosyBrown=0x7f040044;
public static final int RoyalBlue=0x7f040072;
public static final int SaddleBrown=0x7f040057;
public static final int Salmon=0x7f040023;
public static final int SandyBrown=0x7f040029;
public static final int SeaGreen=0x7f040077;
public static final int Seashell=0x7f040008;
public static final int Sienna=0x7f04004f;
public static final int Silver=0x7f040042;
public static final int SkyBlue=0x7f04005c;
public static final int SlateBlue=0x7f040068;
public static final int SlateGray=0x7f040066;
public static final int Snow=0x7f040004;
public static final int SpringGreen=0x7f04007e;
public static final int SteelBlue=0x7f040071;
public static final int Tan=0x7f04003d;
public static final int Teal=0x7f040084;
public static final int Thistle=0x7f04003b;
public static final int Tomato=0x7f040019;
public static final int Turquoise=0x7f040073;
public static final int Violet=0x7f040030;
public static final int Wheat=0x7f040028;
public static final int White=0x7f040000;
public static final int WhiteSmoke=0x7f040026;
public static final int Yellow=0x7f040003;
public static final int YellowGreen=0x7f040050;
}
public static final class dimen {
/** Default screen margins, per the Android Design guidelines.
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
*/
public static final int activity_horizontal_margin=0x7f050000;
public static final int activity_vertical_margin=0x7f050001;
}
public static final class drawable {
public static final int ic_launcher=0x7f020000;
}
public static final class id {
public static final int LinearLayout1=0x7f090000;
public static final int action_settings=0x7f090001;
}
public static final class layout {
public static final int activity_main=0x7f030000;
}
public static final class menu {
public static final int main=0x7f080000;
}
public static final class string {
public static final int action_settings=0x7f060001;
public static final int app_name=0x7f060000;
public static final int hello_world=0x7f060002;
}
public static final class style {
/**
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
API 11 theme customizations can go here.
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
API 14 theme customizations can go here.
*/
public static final int AppBaseTheme=0x7f070000;
/** Application theme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f070001;
}
}
| [
"dipta670@gmail.com"
] | dipta670@gmail.com |
75bf47fe07bd2c4356f365f82213749fe4407b5c | 1d587dcb53c8d809ae54fce378bbbf63b3cc9f91 | /boying-security/src/main/java/com/tongji/boying/security/config/SecurityConfig.java | 72f0e3f624ff98c5721978c53ea983ecd4da6c80 | [
"MIT"
] | permissive | QingwenL/boying | 67c8471df735026b47085cac2ae9249c2e886dd1 | ee78cf822838260e6f9d8a1a5515ff32105fa2d8 | refs/heads/master | 2023-02-19T21:15:45.065184 | 2021-01-26T02:57:54 | 2021-01-26T02:57:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,029 | java | package com.tongji.boying.security.config;
import com.tongji.boying.security.component.*;
import com.tongji.boying.security.util.JwtTokenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.access.intercept.FilterSecurityInterceptor;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
/**
* 对SpringSecurity的配置的扩展,支持自定义白名单资源路径和查询用户逻辑
*/
public class SecurityConfig extends WebSecurityConfigurerAdapter
{
@Autowired(required = false)
private DynamicSecurityService dynamicSecurityService;
/**
* 用于配置需要拦截的url路径、jwt过滤器及出异常后的处理器;
* 安全拦截器
*
* @param httpSecurity
* @throws Exception
*/
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception
{
ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry = httpSecurity
.authorizeRequests();
//不需要保护的资源路径允许访问
for (String url : ignoreUrlsConfig().getUrls())
{
registry.antMatchers(url).permitAll();
}
//允许跨域请求的OPTIONS请求
registry.antMatchers(HttpMethod.OPTIONS)
.permitAll();
// 任何请求需要身份认证
registry.and()
.authorizeRequests()
.anyRequest()
.authenticated()
// 关闭跨站请求防护及不使用session
.and()
.csrf()
.disable()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
// 自定义权限拒绝处理类
.and()
.exceptionHandling()
.accessDeniedHandler(restfulAccessDeniedHandler())
.authenticationEntryPoint(restAuthenticationEntryPoint())
// 自定义权限拦截器JWT过滤器
.and()
.addFilterBefore(jwtAuthenticationTokenFilter(), UsernamePasswordAuthenticationFilter.class);
//有动态权限配置时添加动态权限校验过滤器
if (dynamicSecurityService != null)
{
registry.and().addFilterBefore(dynamicSecurityFilter(), FilterSecurityInterceptor.class);
}
}
/**
* 用于配置UserDetailsService及PasswordEncoder
*
* @param auth
* @throws Exception
*/
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception
{
auth.userDetailsService(userDetailsService())
.passwordEncoder(passwordEncoder());
}
/**
* SpringSecurity定义的用于对密码进行编码及比对的接口,目前使用的是BCryptPasswordEncoder
* 密码编码器
*
* @return
*/
@Bean
public PasswordEncoder passwordEncoder()
{
return new BCryptPasswordEncoder();
}
/**
* 在用户名和密码校验前添加的过滤器,如果有jwt的token,会自行根据token信息进行登录。
*
* @return
*/
@Bean
public JwtAuthenticationTokenFilter jwtAuthenticationTokenFilter()
{
return new JwtAuthenticationTokenFilter();
}
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception
{
return super.authenticationManagerBean();
}
/**
* 当用户没有访问权限时,将调用该方法。是没有访问权限时的处理器,用于返回JSON格式的处理结果
* RestfulAccessDeniedHandler自行定义
*
* @return
*/
@Bean
public RestfulAccessDeniedHandler restfulAccessDeniedHandler()
{
return new RestfulAccessDeniedHandler();
}
/**
* 当未登录或token失效时,返回JSON格式的结果
*
* @return
*/
@Bean
public RestAuthenticationEntryPoint restAuthenticationEntryPoint()
{
return new RestAuthenticationEntryPoint();
}
@Bean
public IgnoreUrlsConfig ignoreUrlsConfig()
{
return new IgnoreUrlsConfig();
}
@Bean
public JwtTokenUtil jwtTokenUtil()
{
return new JwtTokenUtil();
}
//使用了@ConditionalOnBean这个注解,当没有动态权限业务类时就不会创建动态权限相关对象,实现了有动态权限控制和没有这两种情况的兼容。
@ConditionalOnBean(name = "dynamicSecurityService")
@Bean
public DynamicAccessDecisionManager dynamicAccessDecisionManager()
{
return new DynamicAccessDecisionManager();
}
@ConditionalOnBean(name = "dynamicSecurityService")
@Bean
public DynamicSecurityFilter dynamicSecurityFilter()
{
return new DynamicSecurityFilter();
}
@ConditionalOnBean(name = "dynamicSecurityService")
@Bean
public DynamicSecurityMetadataSource dynamicSecurityMetadataSource()
{
return new DynamicSecurityMetadataSource();
}
}
| [
"1254931237@qq.com"
] | 1254931237@qq.com |
165b1c9d9e8487fdcf486c301b6e075e3c370765 | b76b8d481f05879dada0975f9fc239f608be91cf | /app/src/main/java/us/mifeng/bubaexaminationsystem/adapter/ZhuXingTuAdapterWeiJi.java | 8f3eb321067bf6ba7f36f470f4df8166102d542f | [] | no_license | guaju/Tss | f7eed57b6d13b6792ae10895ff107dfc2c48ea20 | da59bb794b9971e88dc53c24bd05868d760aafe1 | refs/heads/master | 2022-03-17T04:26:53.729374 | 2019-09-23T09:55:29 | 2019-09-23T09:55:29 | 107,622,350 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,728 | java | package us.mifeng.bubaexaminationsystem.adapter;
import java.util.ArrayList;
import java.util.List;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.BaseAdapter;
import android.widget.TextView;
import us.mifeng.bubaexaminationsystem.activity.R;
import us.mifeng.bubaexaminationsystem.bean.ZhouBanji;
public class ZhuXingTuAdapterWeiJi extends BaseAdapter{
private List<ZhouBanji> list;
private Context context;
private double chuqinlv;
private int MAXWIDTH;
private int count;
private ViewHolder viewHolder;
public ZhuXingTuAdapterWeiJi(List<ZhouBanji> list, Context context,double chuqinlv,int MAXWIDTH) {
super();
this.list=new ArrayList<ZhouBanji>();
this.list.addAll(list);
this.context = context;
this.chuqinlv = chuqinlv;
this.MAXWIDTH = MAXWIDTH;
for (ZhouBanji zhouBanji : list) {
System.out.println(zhouBanji.getDisciplinerate());
}
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return list.size();
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView==null) {
System.out.println("呵呵呵");
convertView = View.inflate(context, R.layout.zhuxingtuiweijitem, null);
viewHolder = new ViewHolder(convertView);
convertView.setTag(viewHolder);
}
viewHolder=(ViewHolder) convertView.getTag();
Animation animation = AnimationUtils.loadAnimation(context, R.anim.viewtranslate);
viewHolder.v.setAnimation(animation);
viewHolder.classes.setText(list.get(position).getName());
String current = list.get(position).getDisciplinerate().trim().replace("%", "");
viewHolder.grade.setText(current+"%");
//得到当前出勤率
double dcurrent = Double.parseDouble(current);
//当前出勤率按比例设置px值
double rate=dcurrent/chuqinlv;
double currentpx = rate*MAXWIDTH;
LayoutParams parmas = viewHolder.v.getLayoutParams();
parmas.width=(int) currentpx;
viewHolder.v.setLayoutParams(parmas);
return convertView;
}
static class ViewHolder{
public View v;
public TextView grade,classes;
public ViewHolder(View v){
this.v=v.findViewById(R.id.view);
grade=(TextView) v.findViewById(R.id.grade);
classes=(TextView) v.findViewById(R.id.classs);
}
}
}
| [
"guaju@126.com"
] | guaju@126.com |
44b83fc8e59a16a604b467e63060fc4631083312 | ea7218973bca2570bd60cf8ffa1c519c7b183bc9 | /app/src/main/java/xyxgame/gameplane/Base/BaseBackGround.java | 4a0163bfe322bb70dcd3639ca83adab2e70d33ca | [] | no_license | a316375/gameplane | d7132bb6ac2a4c3a13eb277ba767e9af8bb75fae | f3dcfc2c05cac7c78390da3939452a8977bb1b38 | refs/heads/master | 2021-06-25T13:25:18.647139 | 2021-03-22T04:24:13 | 2021-03-22T04:24:13 | 206,804,545 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,528 | java | package xyxgame.gameplane.Base;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import xyxgame.gameplane.R;
public class BaseBackGround {
private Bitmap bitmap;
private int y1,y2,screenSizeX,screenSizeY;
BaseActivity baseActivity;
public BaseBackGround(BaseActivity baseActivity, int draw ) {
this.baseActivity=baseActivity;
this. screenSizeX=baseActivity.point.x;
this. screenSizeY=baseActivity.point.y;
this.bitmap = BitmapUtils.decodeSampledBitmapFromResource(baseActivity.getResources(),draw,screenSizeX,screenSizeY);
bitmap=Bitmap.createScaledBitmap(bitmap,screenSizeX,screenSizeY+250,false);
y2 = y1 -bitmap.getHeight();
}
public void updataBG(int level){
//第二地图
if (level==2){
this.bitmap = BitmapUtils.decodeSampledBitmapFromResource(baseActivity.getResources(), R.drawable.bg3,screenSizeX,screenSizeY);
bitmap=Bitmap.createScaledBitmap(bitmap,screenSizeX,screenSizeY+250,false);
y2 = y1 -bitmap.getHeight();
}
}
public void drawCanvas(Canvas canvas){
canvas.drawBitmap(bitmap,0,y1,null);
canvas.drawBitmap(bitmap,0,y2,null);
updateXY();
}
public void updateXY(){
y1 +=2;
y2 +=2;
if(y1>screenSizeY+250){
y1 = y2 -bitmap.getHeight();
}
if (y2>screenSizeY+250){
y2 = y1 - bitmap.getHeight();
}
}
}
| [
"316375076@qq.com"
] | 316375076@qq.com |
32dd688fd01f3de942bb8815cf1c1562f1189c8e | ea6eb3c92f647cadb3e87be991fa156e1ff85e59 | /src/test/java/com/mashup/thing/user/GenderTest.java | a1c63f1fe1ba76b6f7c7d777289df4b7c7107a76 | [] | no_license | sujinee0010/Thing-BackEnd | df7ca97b1a7947c154c9a6fb15391eb229cfa3c1 | d2631749c6b261e11ab7ee5ffccaaaf724cc7e55 | refs/heads/master | 2020-06-12T17:51:52.342883 | 2019-06-17T09:18:14 | 2019-06-17T09:18:14 | 194,378,498 | 0 | 0 | null | 2019-06-29T07:39:31 | 2019-06-29T07:39:31 | null | UTF-8 | Java | false | false | 288 | java | package com.mashup.thing.user;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
public class GenderTest {
@Test
public void testValueOfGender() {
Gender gender = Gender.from(1);
assertThat(gender).isEqualTo(Gender.MAN);
}
}
| [
"korea8378@naver.com"
] | korea8378@naver.com |
9f5dd24bc9e80571e2d23c243881c1cc767fdb04 | a56fc4862086bf11aec988623e205cf5818baca6 | /generated/java/src/main/java/com/microsoft/azure/iiot/opc/registry/models/EndpointInfoApiModel.java | c9d7c32a18b9d8eb2a742f56777fe2940a3e55d4 | [
"MIT"
] | permissive | Azure/azure-iiot-services-api | 1d419513bd886dacb89474bcdd596c33a6b077a6 | 45fb250fe2f3f204106189d548156076c22230af | refs/heads/master | 2023-04-24T01:47:46.059961 | 2019-04-16T13:39:34 | 2019-04-16T13:39:34 | 138,268,917 | 3 | 3 | MIT | 2019-04-16T13:39:36 | 2018-06-22T07:16:44 | C# | UTF-8 | Java | false | false | 5,210 | java | /**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
package com.microsoft.azure.iiot.opc.registry.models;
import org.joda.time.DateTime;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Endpoint registration model.
*/
public class EndpointInfoApiModel {
/**
* Endpoint registration.
*/
@JsonProperty(value = "registration", required = true)
private EndpointRegistrationApiModel registration;
/**
* Application id endpoint is registered under.
*/
@JsonProperty(value = "applicationId", required = true)
private String applicationId;
/**
* Activation state of endpoint. Possible values include: 'Deactivated',
* 'Activated', 'ActivatedAndConnected'.
*/
@JsonProperty(value = "activationState")
private EndpointActivationState activationState;
/**
* Last state of the activated endpoint. Possible values include:
* 'Connecting', 'NotReachable', 'Busy', 'NoTrust', 'CertificateInvalid',
* 'Ready', 'Error'.
*/
@JsonProperty(value = "endpointState")
private EndpointConnectivityState endpointState;
/**
* Whether the registration is out of sync.
*/
@JsonProperty(value = "outOfSync")
private Boolean outOfSync;
/**
* Last time endpoint was seen.
*/
@JsonProperty(value = "notSeenSince")
private DateTime notSeenSince;
/**
* Get endpoint registration.
*
* @return the registration value
*/
public EndpointRegistrationApiModel registration() {
return this.registration;
}
/**
* Set endpoint registration.
*
* @param registration the registration value to set
* @return the EndpointInfoApiModel object itself.
*/
public EndpointInfoApiModel withRegistration(EndpointRegistrationApiModel registration) {
this.registration = registration;
return this;
}
/**
* Get application id endpoint is registered under.
*
* @return the applicationId value
*/
public String applicationId() {
return this.applicationId;
}
/**
* Set application id endpoint is registered under.
*
* @param applicationId the applicationId value to set
* @return the EndpointInfoApiModel object itself.
*/
public EndpointInfoApiModel withApplicationId(String applicationId) {
this.applicationId = applicationId;
return this;
}
/**
* Get activation state of endpoint. Possible values include: 'Deactivated', 'Activated', 'ActivatedAndConnected'.
*
* @return the activationState value
*/
public EndpointActivationState activationState() {
return this.activationState;
}
/**
* Set activation state of endpoint. Possible values include: 'Deactivated', 'Activated', 'ActivatedAndConnected'.
*
* @param activationState the activationState value to set
* @return the EndpointInfoApiModel object itself.
*/
public EndpointInfoApiModel withActivationState(EndpointActivationState activationState) {
this.activationState = activationState;
return this;
}
/**
* Get last state of the activated endpoint. Possible values include: 'Connecting', 'NotReachable', 'Busy', 'NoTrust', 'CertificateInvalid', 'Ready', 'Error'.
*
* @return the endpointState value
*/
public EndpointConnectivityState endpointState() {
return this.endpointState;
}
/**
* Set last state of the activated endpoint. Possible values include: 'Connecting', 'NotReachable', 'Busy', 'NoTrust', 'CertificateInvalid', 'Ready', 'Error'.
*
* @param endpointState the endpointState value to set
* @return the EndpointInfoApiModel object itself.
*/
public EndpointInfoApiModel withEndpointState(EndpointConnectivityState endpointState) {
this.endpointState = endpointState;
return this;
}
/**
* Get whether the registration is out of sync.
*
* @return the outOfSync value
*/
public Boolean outOfSync() {
return this.outOfSync;
}
/**
* Set whether the registration is out of sync.
*
* @param outOfSync the outOfSync value to set
* @return the EndpointInfoApiModel object itself.
*/
public EndpointInfoApiModel withOutOfSync(Boolean outOfSync) {
this.outOfSync = outOfSync;
return this;
}
/**
* Get last time endpoint was seen.
*
* @return the notSeenSince value
*/
public DateTime notSeenSince() {
return this.notSeenSince;
}
/**
* Set last time endpoint was seen.
*
* @param notSeenSince the notSeenSince value to set
* @return the EndpointInfoApiModel object itself.
*/
public EndpointInfoApiModel withNotSeenSince(DateTime notSeenSince) {
this.notSeenSince = notSeenSince;
return this;
}
}
| [
"marcschier@hotmail.com"
] | marcschier@hotmail.com |
15fc20e6482e27ff403070f4588aaa7777a50a51 | 5c559828b7cbfcc8c4ff69ac5bdd054dceccc2fa | /src/com/gilpratte/Main.java | 3b6952b7f7f615de9176d3b6c0e0e774863f45f8 | [] | no_license | gpratte/columbia | bc1276c4e2a4778392910ef8b05d09fd4c7448a9 | 32f20a2e3c872010efe79b680881deba36dec28e | refs/heads/master | 2021-02-28T09:34:55.110320 | 2020-03-07T18:12:22 | 2020-03-07T18:12:22 | 245,682,281 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,173 | java | package com.gilpratte;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.stream.Stream;
public class Main {
Map<String, List<Entry>> data = new HashMap<>();
Map<String, Double> fundTotal = new HashMap<>();
void process() {
try (Stream<String> stream = Files.lines(Paths.get("columbia.csv"))) {
stream.forEach(s -> {
addEntry(s);
});
//printData();
total();
printFundTotals();
} catch (IOException e) {
System.out.println("\nThere was a problem reading the columbia.csv file");
}
}
void addEntry(String csv) {
String[] columns = csv.split(",");
Entry entry = new Entry();
for (int i = 0; i < columns.length; i++) {
switch (i) {
case 0:
List<Entry> entries = data.get(columns[i]);
if (entries == null) {
entries = new LinkedList<>();
data.put(columns[i], entries);
}
entries.add(entry);
break;
case 1:
entry.date = LocalDate.parse(columns[i]);
break;
case 2:
entry.price = Double.parseDouble(columns[i]);
break;
case 3:
entry.shares = Double.parseDouble(columns[i]);
break;
}
}
}
void total() {
for (String key : data.keySet()) {
double total = 0;
List<Entry> entries = data.get(key);
for (Entry entry : entries) {
total += entry.price * entry.shares;
}
fundTotal.put(key, new Double(total));
}
}
void printData() {
for (String key : data.keySet()) {
System.out.println(key);
List<Entry> entries = data.get(key);
for (Entry entry : entries) {
System.out.println("\t" + entry);
}
}
}
void printFundTotals() {
System.out.println("Fund totals");
double allFundsTotal = 0;
for (String key : fundTotal.keySet()) {
String totalRounded = String.format("%.2f", fundTotal.get(key));
allFundsTotal += Double.parseDouble(totalRounded);
System.out.println("\t" + key + " $" + totalRounded);
}
System.out.println("All funds: " + allFundsTotal);
}
class Entry {
LocalDate date;
double price;
double shares;
@Override
public String toString() {
return "Entry{" +
"date=" + date +
", $price=" + price +
", shares=" + shares +
'}';
}
}
public static void main(String[] args) {
Main main = new Main();
main.process();
}
}
| [
"gilpratte@pingidentity.com"
] | gilpratte@pingidentity.com |
da35283f3b9cb7279cc603f324c3bcc6d00ad36b | 73583f79d896e2e1620a7719addfee2bc01deed3 | /src/MetadataObjects/Commit.java | 22e17071ea3fcba0a891385ef50f5da5913c1041 | [] | no_license | sinansen/Metadata-service | ba4ca009d71b824c7c52fe7c626b594a8920717b | 9e4d1e863fbaec3fc3c1a4eaa716a8b28fc8d805 | refs/heads/master | 2021-01-18T10:23:29.541488 | 2012-03-09T13:43:18 | 2012-03-09T13:43:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 932 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package MetadataObjects;
import MetadataCore.MetadataObject;
import java.util.Date;
/**
*
* @author ivano
*/
public class Commit extends MetadataObject {
// <editor-fold desc="Members">
public foaf_Person m_oHasAuthor;
public foaf_Person m_oHasCommitter;
public Repository m_oIsCommitOfRepository;
public Date m_dtmCommitDate;
public String m_sCommitMessage;
public String m_sRevisionTag;
public File[] m_oHasFile;
// </editor-fold>
// <editor-fold desc="Properties">
// </editor-fold>
// <editor-fold desc="Methods">
/**
* @summary Constructor
* @startRealisation Ivan Obradovic 23.08.2011.
* @finalModification Ivan Obradovic 23.08.2011.
*/
public Commit()
{
super();
}
// </editor-fold>
}
| [
"Dejan@DejanM.cimcollege.co.rs"
] | Dejan@DejanM.cimcollege.co.rs |
441562ca4f484bea4255f371137a27e273c026cd | 18b19260588cb347a6a99735e6688b3e9dbef98d | /EmployeeAttendanceTracker/src/main/java/com/revature/dao/Dao.java | b3520f341ab78295dc5a478948ec2fa52c7ce67c | [] | no_license | 1703Mar27Java/dynamic-duo | b16adeaaa75c2eda0780670a234af68c451df3b0 | 79fc0964476837e805db1a491034a961096f1031 | refs/heads/master | 2021-01-20T07:08:44.730691 | 2017-05-15T07:17:11 | 2017-05-15T07:17:11 | 89,967,110 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 621 | java | package com.revature.dao;
import java.util.List;
import org.hibernate.SessionFactory;
import com.revature.beans.*;
public interface Dao {
public List<UserRoleBean> getUserrole();
public void createUsers(UserBean user);
public void createUserRole(UserRoleBean userrole);
public void setSessionFactory(SessionFactory sessionFactory);
public UserBean retrieveUserByLoginInfo(String un, String pw);
public UserBean retrieveUserById(int userId);
public List<UserBean> retrieveAllUser();
public void updateUser(UserBean user);
public void deleteUser(int id);
public void createUserPS(UserBean user);
}
| [
"gabearon1987@gmail.com"
] | gabearon1987@gmail.com |
b19def44aa7cf9063acce60909ac262ba693af6a | 91b5a8e2a7da41fea81de3f01c9eb5c5faeca1da | /TabLayout/app/src/main/java/com/sheba/tablayout/ui/main/PlaceholderFragment.java | 9556db158cd29e6213dd819c8810d0ef4b450b73 | [] | no_license | Shahadat3031/Android-Example-Project-List-xyz | 80f4f8ced1b8f24d4b48f84774a180f8c49432fb | e15cba55d95384bdb66c48f7906aef472a0a8112 | refs/heads/master | 2020-12-28T18:27:05.251217 | 2020-02-25T07:54:41 | 2020-02-25T07:54:41 | 238,440,072 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,846 | java | package com.sheba.tablayout.ui.main;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import com.sheba.tablayout.R;
/**
* A placeholder fragment containing a simple view.
*/
public class PlaceholderFragment extends Fragment {
private static final String ARG_SECTION_NUMBER = "section_number";
private PageViewModel pageViewModel;
public static PlaceholderFragment newInstance(int index) {
PlaceholderFragment fragment = new PlaceholderFragment();
Bundle bundle = new Bundle();
bundle.putInt(ARG_SECTION_NUMBER, index);
fragment.setArguments(bundle);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
pageViewModel = ViewModelProviders.of(this).get(PageViewModel.class);
int index = 1;
if (getArguments() != null) {
index = getArguments().getInt(ARG_SECTION_NUMBER);
}
pageViewModel.setIndex(index);
}
@Override
public View onCreateView(
@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_main, container, false);
final TextView textView = root.findViewById(R.id.section_label);
pageViewModel.getText().observe(this, new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);
}
});
return root;
}
} | [
"shahadat@sheba.xyz"
] | shahadat@sheba.xyz |
f74658ea3e60e366d094d6357fe68de5ca6a976b | 17fdff72b0cbd7695900b1e359b9bdc4bb1d5971 | /src/interfazPersona/PanelContacts.java | ca45a705b6c7bd643330a3e55a3784cb5f120f93 | [] | no_license | DiegoAmezquita/ProgramaSAI | 5483f6ef5fcb3e96820272d571889c71c2119341 | c8e30062480dca132c25ce42163903f933bec906 | refs/heads/master | 2021-01-10T20:38:18.691504 | 2013-03-15T03:51:34 | 2013-03-15T03:51:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,240 | java | package interfazPersona;
import Codigo.Contacto;
import Codigo.Datos;
import Codigo.Detalle;
import Codigo.Persona;
import Codigo.Varios;
import DAO.DAOContacto;
import DAO.DAODetalle;
import DAO.DAOPersona;
import DAO.DAOUbicacion;
import DAO.DAOvarios;
import Interfaz.DatosCellRenderer;
import Interfaz.FrameMain;
import java.util.ArrayList;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
public class PanelContacts extends JPanel {
private JList listResultContact;
private JScrollPane scrollPaneResult;
private DefaultListModel modelListResult;
private JList listContact;
private JScrollPane scrollPaneContact;
private DefaultListModel modelListContact;
private JLabel labelDetail;
private JLabel labelPerson;
private JLabel labelTypeContact;
private JTextField textPerson;
private JComboBox comboTypeContact;
private JButton buttonSave;
private JButton buttonSearch;
private JButton buttonEdit;
private JButton buttonDelete;
private JButton buttonCancel;
private boolean newDetail = false;
private DAOContacto daoContacto;
private DAOvarios daoVarios;
private DAOPersona daoPersona;
private DAODetalle daoDetalle;
private int codContactLoad;
private int codPersonLoad;
private boolean edicion = false;
private JTextArea areaDetails;
private JScrollPane scrollPaneDetails;
public PanelContacts(FrameMain frameMain) {
setLayout(null);
JLabel labelTitulo = new JLabel("Contactos");
labelTitulo.setHorizontalAlignment((int) CENTER_ALIGNMENT);
labelTitulo.setBounds(20, 0, 350, 30);
add(labelTitulo);
modelListResult = new DefaultListModel();
listResultContact = new JList(modelListResult);
listResultContact.setName("listResultContact");
listResultContact.addListSelectionListener(frameMain);
listResultContact.setCellRenderer(new DatosCellRenderer());
scrollPaneResult = new JScrollPane(listResultContact);
scrollPaneResult.setBounds(700, 30, 250, 180);
add(scrollPaneResult);
scrollPaneResult.setVisible(false);
labelDetail = new JLabel("Detalles");
labelDetail.setBounds(20, 160, 350, 30);
add(labelDetail);
areaDetails = new JTextArea();
areaDetails.setEditable(false);
scrollPaneDetails = new JScrollPane(areaDetails);
scrollPaneDetails.setBounds(20, 190, 350, 100);
add(scrollPaneDetails);
buttonSearch = new JButton("Buscar");
buttonSearch.setBounds(400, 50, 230, 30);
buttonSearch.setActionCommand("BUSCARCONTACTO");
buttonSearch.addActionListener(frameMain);
add(buttonSearch);
labelPerson = new JLabel("Persona:");
labelPerson.setBounds(400, 100, 70, 30);
add(labelPerson);
textPerson = new JTextField();
textPerson.setBounds(470, 100, 200, 30);
add(textPerson);
labelTypeContact = new JLabel("Tipo:");
labelTypeContact.setBounds(400, 140, 70, 30);
add(labelTypeContact);
comboTypeContact = new JComboBox();
comboTypeContact.addItemListener(frameMain);
comboTypeContact.setBounds(470, 140, 200, 30);
comboTypeContact.setName("comboTypeContact");
add(comboTypeContact);
modelListContact = new DefaultListModel();
listContact = new JList(modelListContact);
listContact.setName("listContact");
listContact.addListSelectionListener(frameMain);
listContact.setCellRenderer(new DatosCellRenderer());
scrollPaneContact = new JScrollPane(listContact);
scrollPaneContact.setBounds(20, 30, 350, 130);
add(scrollPaneContact);
buttonEdit = new JButton("EDITAR");
buttonEdit.setBounds(400, 250, 100, 30);
buttonEdit.setActionCommand("EDITARCONTACTO");
buttonEdit.addActionListener(frameMain);
add(buttonEdit);
buttonDelete = new JButton("BORRAR");
buttonDelete.setBounds(520, 250, 100, 30);
buttonDelete.setActionCommand("BORRARCONTACTO");
buttonDelete.addActionListener(frameMain);
add(buttonDelete);
buttonSave = new JButton("GUARDAR");
buttonSave.setBounds(640, 250, 100, 30);
buttonSave.setActionCommand("GUARDARCONTACTO");
buttonSave.addActionListener(frameMain);
add(buttonSave);
buttonCancel = new JButton("CANCELAR");
buttonCancel.setBounds(760, 250, 100, 30);
buttonCancel.setActionCommand("CANCELARCONTACTO");
buttonCancel.addActionListener(frameMain);
add(buttonCancel);
daoContacto = new DAOContacto();
daoVarios = new DAOvarios();
daoPersona = new DAOPersona();
daoDetalle = new DAODetalle();
iniciarTipoContacto();
codPersonLoad = 0;
codContactLoad = 0;
bloquearElementos();
}
public void cargarDetallesContacto() {
ArrayList<Detalle> listDetails = daoDetalle.consultarDetalleCompleto(codContactLoad);
String detalles = "";
for (int i = 0; i < listDetails.size(); i++) {
detalles = detalles + listDetails.get(i).getTipo() + " " + listDetails.get(i).getDescripcion()
+ " " + listDetails.get(i).getNombre() + "\n";
}
areaDetails.setText(detalles);
}
public void crearNuevoTipoContacto() {
if (comboTypeContact.getSelectedItem().equals("--CREAR NUEVO--")) {
boolean seguir = true;
while (seguir) {
String nuevoTipo = JOptionPane.showInputDialog("Nombre del tipo de contacto:");
if (nuevoTipo == null) {
comboTypeContact.setSelectedIndex(0);
seguir = false;
} else if (!nuevoTipo.equals("")) {
System.out.println("VOY A CREAR ESTE:" + nuevoTipo + "-");
daoVarios.insert(nuevoTipo, "Tipo Contacto");
iniciarTipoContacto();
comboTypeContact.setSelectedItem(nuevoTipo);
seguir = false;
} else if (nuevoTipo.equals("")) {
JOptionPane.showMessageDialog(null, "El tipo de contacto no puede estar vacio");
}
}
}
}
public void bloquearElementos() {
buttonSearch.setEnabled(false);
buttonEdit.setEnabled(false);
buttonDelete.setEnabled(false);
buttonSave.setEnabled(false);
buttonCancel.setEnabled(false);
textPerson.setEditable(false);
comboTypeContact.setEnabled(false);
}
public void desbloquearElementos() {
buttonSearch.setEnabled(true);
buttonEdit.setEnabled(true);
buttonDelete.setEnabled(true);
buttonSave.setEnabled(true);
buttonCancel.setEnabled(true);
textPerson.setEditable(true);
comboTypeContact.setEnabled(true);
}
public void personaSeleccionada() {
buttonSearch.setEnabled(true);
}
public void desbloquearEdicion() {
buttonEdit.setEnabled(true);
buttonDelete.setEnabled(true);
}
public void bloquearEdicion() {
buttonEdit.setEnabled(false);
buttonDelete.setEnabled(false);
}
public void bloquearUso() {
buttonEdit.setEnabled(false);
buttonSearch.setEnabled(false);
buttonSave.setEnabled(true);
buttonCancel.setEnabled(true);
buttonDelete.setEnabled(false);
listContact.setEnabled(false);
listResultContact.setEnabled(false);
// textPerson.setEditable(true);
comboTypeContact.setEnabled(true);
}
public void desbloquearUso() {
buttonSearch.setEnabled(true);
listContact.setEnabled(true);
buttonSave.setEnabled(false);
buttonCancel.setEnabled(false);
buttonDelete.setEnabled(true);
listResultContact.setEnabled(true);
textPerson.setEditable(false);
comboTypeContact.setEnabled(false);
}
public void contactoSeleccionado() {
buttonSave.setEnabled(true);
comboTypeContact.setEnabled(true);
buttonCancel.setEnabled(true);
listContact.setEnabled(false);
buttonDelete.setEnabled(false);
buttonEdit.setEnabled(false);
}
public void reiniciarInfo() {
codContactLoad = 0;
listContact.setSelectedIndex(-1);
textPerson.setText("");
comboTypeContact.setSelectedIndex(0);
scrollPaneResult.setVisible(false);
buttonEdit.setEnabled(false);
buttonDelete.setEnabled(false);
}
public void cargarContactos() {
modelListContact.clear();
ArrayList<Contacto> listaContactos = daoContacto.retornarContactos(codPersonLoad);
for (int i = 0; i < listaContactos.size(); i++) {
Persona per = daoPersona.buscarPorCodigo(listaContactos.get(i).getCodContact());
modelListContact.addElement(new Datos(per.getCodigo(), per.getNombre() + " " + per.getApellido() + " " + listaContactos.get(i).getTipoContacto()));
}
}
public void cargarListaPersonas(String buscarPersona) {
ArrayList<Persona> listaPersonas = daoPersona.consultarOptimizado(buscarPersona);
modelListResult.clear();
for (int i = 0; i < listaPersonas.size(); i++) {
Persona per = daoPersona.buscarPorCodigo(listaPersonas.get(i).getCodigo());
modelListResult.addElement(new Datos(per.getCodigo(), per.getNombre() + " " + per.getApellido()));
}
scrollPaneResult.setVisible(true);
}
public void iniciarTipoContacto() {
ArrayList<Varios> listaVarios = daoVarios.consultarVariosPorCategoria("Tipo Contacto");
for (int i = 0; i < listaVarios.size(); i++) {
comboTypeContact.addItem(listaVarios.get(i).getnombreVario());
}
comboTypeContact.addItem("--CREAR NUEVO--");
}
public void cargarContactoEdicion() {
Persona personaResultado = daoPersona.consultar(codContactLoad);
getTextPerson().setText(personaResultado.getNombre() + " " + personaResultado.getApellido());
comboTypeContact.setSelectedItem(daoContacto.retornarTipoContacto(codContactLoad, codPersonLoad));
cargarDetallesContacto();
edicion = true;
}
public void cargarContactoNuevo() {
Persona personaResultado = daoPersona.consultar(codContactLoad);
getTextPerson().setText(personaResultado.getNombre() + " " + personaResultado.getApellido());
edicion = false;
}
public Contacto crearContacto() {
Contacto contactoTempo = new Contacto();
contactoTempo.setCodContact(codContactLoad);
contactoTempo.setCodPerson(codPersonLoad);
contactoTempo.setTipoContacto(daoVarios.buscarCodigoVario(comboTypeContact.getSelectedItem() + "") + "");
return contactoTempo;
}
public void reiniciarListaBusqueda() {
modelListResult.clear();
}
public JButton getButtonCancel() {
return buttonCancel;
}
public void setButtonCancel(JButton buttonCancel) {
this.buttonCancel = buttonCancel;
}
public JButton getButtonDelete() {
return buttonDelete;
}
public void setButtonDelete(JButton buttonDelete) {
this.buttonDelete = buttonDelete;
}
public JButton getButtonEdit() {
return buttonEdit;
}
public void setButtonEdit(JButton buttonEdit) {
this.buttonEdit = buttonEdit;
}
public JButton getButtonSave() {
return buttonSave;
}
public void setButtonSave(JButton buttonSave) {
this.buttonSave = buttonSave;
}
public JButton getButtonSearch() {
return buttonSearch;
}
public void setButtonSearch(JButton buttonSearch) {
this.buttonSearch = buttonSearch;
}
public JComboBox getComboTypePerson() {
return comboTypeContact;
}
public void setComboTypePerson(JComboBox comboTypePerson) {
this.comboTypeContact = comboTypePerson;
}
public DAOContacto getDaoContacto() {
return daoContacto;
}
public void setDaoContacto(DAOContacto daoContacto) {
this.daoContacto = daoContacto;
}
public JLabel getLabelDetail() {
return labelDetail;
}
public void setLabelDetail(JLabel labelDetail) {
this.labelDetail = labelDetail;
}
public JLabel getLabelPerson() {
return labelPerson;
}
public void setLabelPerson(JLabel labelPerson) {
this.labelPerson = labelPerson;
}
public JLabel getLabelTypeContact() {
return labelTypeContact;
}
public void setLabelTypeContact(JLabel labelTypeContact) {
this.labelTypeContact = labelTypeContact;
}
public JList getListContact() {
return listContact;
}
public void setListContact(JList listContact) {
this.listContact = listContact;
}
public JList getListResultContact() {
return listResultContact;
}
public void setListResultContact(JList listResultContact) {
this.listResultContact = listResultContact;
}
public DefaultListModel getModelListContact() {
return modelListContact;
}
public void setModelListContact(DefaultListModel modelListContact) {
this.modelListContact = modelListContact;
}
public DefaultListModel getModelListResult() {
return modelListResult;
}
public void setModelListResult(DefaultListModel modelListResult) {
this.modelListResult = modelListResult;
}
public boolean isNewDetail() {
return newDetail;
}
public void setNewDetail(boolean newDetail) {
this.newDetail = newDetail;
}
public JScrollPane getScrollPaneContact() {
return scrollPaneContact;
}
public void setScrollPaneContact(JScrollPane scrollPaneContact) {
this.scrollPaneContact = scrollPaneContact;
}
public JScrollPane getScrollPaneResult() {
return scrollPaneResult;
}
public void setScrollPaneResult(JScrollPane scrollPaneResult) {
this.scrollPaneResult = scrollPaneResult;
}
public JTextField getTextPerson() {
return textPerson;
}
public void setTextPerson(JTextField textPerson) {
this.textPerson = textPerson;
}
public int getCodPersonLoad() {
return codPersonLoad;
}
public void setCodPersonLoad(int codPersonLoad) {
this.codPersonLoad = codPersonLoad;
}
public boolean isEdicion() {
return edicion;
}
public void setEdicion(boolean edicion) {
this.edicion = edicion;
}
public int getCodContactLoad() {
return codContactLoad;
}
public void setCodContactLoad(int codContactLoad) {
this.codContactLoad = codContactLoad;
}
}
| [
"German@German-PC"
] | German@German-PC |
24fc91797127602cd51b9ee19169a245b8df9633 | b83c799bfcfbdc02867a04c3a66d2d676cbc75ff | /src/test/java/edu/knoldus/operation/OperationTest.java | 7484b066b4e36224359a34ee749883ce4fb2034d | [] | no_license | ThakurPriyanka/java-assignment3 | 1e693db505468d405a9e1ab945d75e812a7bd07d | 8a79d34e81a5b27da9802b625c7cac731815732b | refs/heads/master | 2021-04-03T09:51:33.568015 | 2018-03-13T05:57:54 | 2018-03-13T05:57:54 | 124,675,842 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,041 | java | package edu.knoldus.operation;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.time.*;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.*;
public class OperationTest {
Operation operationObj;
@Before
public void setUp() throws Exception {
operationObj = new Operation();
}
@After
public void tearDown() throws Exception {
}
@Test
public void getDayOfBirth() {
LocalDate birthDate = LocalDate.of(2017, 01,01);
List<DayOfWeek> yearList = operationObj.getDayOfBirth(birthDate);
List<DayOfWeek> expectedOutput = new ArrayList();
expectedOutput.add(DayOfWeek.SUNDAY);
expectedOutput.add(DayOfWeek.MONDAY);
assertEquals("Days of birthday does not match",expectedOutput,yearList);
}
// @Test
// public void getTimeOfZone() {
// LocalDateTime localtDateAndTime = LocalDateTime.now();
// ZoneId zone = ZoneId.of("America/New_York");
// ZonedDateTime actualOutput = operationObj.getTimeOfZone(zone);
// ZonedDateTime expectedOutput = ZonedDateTime.of(localtDateAndTime, zone);
// assertEquals("current time zone is not matching",expectedOutput,actualOutput);
// }
@Test
public void getLeapYear() {
LocalDate startYear = LocalDate.of(2016, 01,01);
List<Integer> actualOutput = operationObj.getLeapYear(startYear);
List<Integer> expectedOutput = new ArrayList<Integer>();
expectedOutput.add(2016);
assertEquals("List of lea year is not matching",expectedOutput,actualOutput);
}
@Test
public void getTimeLived() {
LocalDate gandhiDob = LocalDate.of(2014, 01, 01);
LocalDate gandhiDeath = LocalDate.of(2016, 01, 01);
Long actualOutput= operationObj.getTimeLived(gandhiDob, gandhiDeath);
Long expectedOutput = Duration.ofDays(1).getSeconds() * 365 * 2;
assertEquals("second passed is not matching",expectedOutput,actualOutput);
}
} | [
"aroma.priyanka@gmail.com"
] | aroma.priyanka@gmail.com |
4556803243ad1b78362eb7e0b52b675c97250b23 | 2beb8ebca25d7a539c2f8e4746fe1f6896ea97bb | /src/fr/taeron/shadow/packets/events/PacketUseEntityEvent.java | af6ea552fa6d79cb05fee75d41d52ea728f721e0 | [] | no_license | NIiZoW/Shadow | ad60ff2c089992ec7159c4914b9ac4cdd453ead3 | 03fcbd85a60a810e2a39ed1cc3dd7ac4d2b5e652 | refs/heads/master | 2020-03-24T05:53:29.275231 | 2018-07-28T16:21:44 | 2018-07-28T16:21:44 | 142,506,893 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,643 | java | /*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.comphenix.protocol.wrappers.EnumWrappers
* com.comphenix.protocol.wrappers.EnumWrappers$EntityUseAction
* org.bukkit.entity.Entity
* org.bukkit.entity.Player
* org.bukkit.event.Cancellable
* org.bukkit.event.Event
* org.bukkit.event.HandlerList
*/
package fr.taeron.shadow.packets.events;
import com.comphenix.protocol.wrappers.EnumWrappers;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class PacketUseEntityEvent
extends Event
implements Cancellable {
public EnumWrappers.EntityUseAction Action;
public Player Attacker;
public Entity Attacked;
private static final HandlerList handlers = new HandlerList();
private boolean cancelled;
public PacketUseEntityEvent(EnumWrappers.EntityUseAction Action2, Player Attacker, Entity Attacked) {
this.Action = Action2;
this.Attacker = Attacker;
this.Attacked = Attacked;
}
public EnumWrappers.EntityUseAction getAction() {
return this.Action;
}
public Player getAttacker() {
return this.Attacker;
}
public Entity getAttacked() {
return this.Attacked;
}
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
public boolean isCancelled() {
return this.cancelled;
}
public void setCancelled(boolean arg0) {
this.cancelled = arg0;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
038051ddb82559c065fd3a7a21f25ea10c03aa6a | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/LANG-37b-1-9-FEMO-WeightedSum:TestLen:CallDiversity/org/apache/commons/lang3/ArrayUtils_ESTest_scaffolding.java | 04ceb8df0ecb91a8779a8a0dd078e810185a75ec | [] | no_license | STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application | cf118b23ecb87a8bf59643e42f7556b521d1f754 | 3bb39683f9c343b8ec94890a00b8f260d158dfe3 | refs/heads/master | 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 439 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Sat Apr 04 07:25:00 UTC 2020
*/
package org.apache.commons.lang3;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class ArrayUtils_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
bf9d2035080284b20e2851c8b79bd8a7d100f37e | 748a1fc9d848773db713368d6f33e3bfba66ffe9 | /src/dpproblem/SnakeLadder.java | 9b0a8769964d3f183ddcd51c92a47de753720c8d | [] | no_license | akcsbtech/datastructure | b2df3fa7179dfeed980606cf0089e9e4a1be0d2b | 00851b178b58985060a3cd7331a4544c22867fc9 | refs/heads/master | 2021-04-13T10:14:07.164459 | 2020-12-14T16:52:04 | 2020-12-14T16:52:04 | 249,154,582 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,242 | java | /**
*
*/
package dpproblem;
import java.util.LinkedList;
import java.util.Queue;
/**
* @author akashgoyal
*
*/
public class SnakeLadder {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int N = 30;
int moves[] = new int[N];
for (int i = 0; i < N; i++)
moves[i] = -1;
// Ladders
moves[2] = 21;
moves[4] = 7;
moves[10] = 25;
moves[19] = 28;
// Snakes
moves[26] = 0;
moves[20] = 8;
moves[16] = 3;
moves[18] = 6;
System.out.println("Min Dice throws required is " + getMinDiceThrows(moves, N));
}
static class Qentry {
int v;
int dist;
}
static int getMinDiceThrows(int[] move, int n) {
int visited[] = new int[n];
Queue<Qentry> q = new LinkedList<Qentry>();
Qentry qe = new Qentry();
qe.v = 0;
qe.dist = 0;
visited[0] = 1;
q.add(qe);
while (!q.isEmpty()) {
qe = q.remove();
int v = qe.v;
if (v == n - 1) {
break;
}
for (int i = v + 1; i <= v + 6 && i < n; i++) {
if (visited[i] == 0) {
Qentry a = new Qentry();
a.dist = qe.dist + 1;
visited[i] = 1;
if (move[i] != -1)
a.v = move[i];
else
a.v = i;
q.add(a);
}
}
}
return qe.dist;
}
}
| [
"akashgoyal311@gmail.com"
] | akashgoyal311@gmail.com |
944dd33d2520682e66fa8d91fe62c19ad5cd8043 | dd624d0f66d552a26b5fc3200a9990f5ae3b0680 | /utils_library/src/main/java/com/utils/common/ThreadUtils.java | 64ae57607486f015f2023cc580c61c2cdf14c8ff | [] | no_license | androidKy/Tit_tok_tool | 6952a01f3bc305c9632f5a7663100567dce68e29 | 8068a076357991c319086ba893775616277eea72 | refs/heads/master | 2020-11-23T19:02:38.646702 | 2019-12-13T10:32:34 | 2019-12-13T10:32:34 | 227,781,085 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 50,725 | java | package com.utils.common;
import android.os.Handler;
import android.os.Looper;
import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
import android.util.Log;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
/**
* <pre>
* author: Blankj
* blog : http://blankj.com
* time : 2018/05/08
* desc : utils about thread
* </pre>
*/
public final class ThreadUtils {
private static final HashMap<Integer, Map<Integer, ExecutorService>> TYPE_PRIORITY_POOLS = new HashMap<>();
private static final Map<Task, ScheduledExecutorService> TASK_SCHEDULED = new HashMap<>();
private static final int CPU_COUNT = Runtime.getRuntime().availableProcessors();
private static final ScheduledExecutorService SCHEDULED = Executors.newScheduledThreadPool(CPU_COUNT, new UtilsThreadFactory("scheduled", Thread.MAX_PRIORITY));
private static final byte TYPE_SINGLE = -1;
private static final byte TYPE_CACHED = -2;
private static final byte TYPE_IO = -4;
private static final byte TYPE_CPU = -8;
private static Executor sDeliver;
/**
* Return whether the thread is the main thread.
*
* @return {@code true}: yes<br>{@code false}: no
*/
public static boolean isMainThread() {
return Looper.myLooper() == Looper.getMainLooper();
}
/**
* Return a thread pool that reuses a fixed number of threads
* operating off a shared unbounded queue, using the provided
* ThreadFactory to create new threads when needed.
*
* @param size The size of thread in the pool.
* @return a fixed thread pool
*/
public static ExecutorService getFixedPool(@IntRange(from = 1) final int size) {
return getPoolByTypeAndPriority(size);
}
/**
* Return a thread pool that reuses a fixed number of threads
* operating off a shared unbounded queue, using the provided
* ThreadFactory to create new threads when needed.
*
* @param size The size of thread in the pool.
* @param priority The priority of thread in the poll.
* @return a fixed thread pool
*/
public static ExecutorService getFixedPool(@IntRange(from = 1) final int size,
@IntRange(from = 1, to = 10) final int priority) {
return getPoolByTypeAndPriority(size, priority);
}
/**
* Return a thread pool that uses a single worker thread operating
* off an unbounded queue, and uses the provided ThreadFactory to
* create a new thread when needed.
*
* @return a single thread pool
*/
public static ExecutorService getSinglePool() {
return getPoolByTypeAndPriority(TYPE_SINGLE);
}
/**
* Return a thread pool that uses a single worker thread operating
* off an unbounded queue, and uses the provided ThreadFactory to
* create a new thread when needed.
*
* @param priority The priority of thread in the poll.
* @return a single thread pool
*/
public static ExecutorService getSinglePool(@IntRange(from = 1, to = 10) final int priority) {
return getPoolByTypeAndPriority(TYPE_SINGLE, priority);
}
/**
* Return a thread pool that creates new threads as needed, but
* will reuse previously constructed threads when they are
* available.
*
* @return a cached thread pool
*/
public static ExecutorService getCachedPool() {
return getPoolByTypeAndPriority(TYPE_CACHED);
}
/**
* Return a thread pool that creates new threads as needed, but
* will reuse previously constructed threads when they are
* available.
*
* @param priority The priority of thread in the poll.
* @return a cached thread pool
*/
public static ExecutorService getCachedPool(@IntRange(from = 1, to = 10) final int priority) {
return getPoolByTypeAndPriority(TYPE_CACHED, priority);
}
/**
* Return a thread pool that creates (2 * CPU_COUNT + 1) threads
* operating off a queue which size is 128.
*
* @return a IO thread pool
*/
public static ExecutorService getIoPool() {
return getPoolByTypeAndPriority(TYPE_IO);
}
/**
* Return a thread pool that creates (2 * CPU_COUNT + 1) threads
* operating off a queue which size is 128.
*
* @param priority The priority of thread in the poll.
* @return a IO thread pool
*/
public static ExecutorService getIoPool(@IntRange(from = 1, to = 10) final int priority) {
return getPoolByTypeAndPriority(TYPE_IO, priority);
}
/**
* Return a thread pool that creates (CPU_COUNT + 1) threads
* operating off a queue which size is 128 and the maximum
* number of threads equals (2 * CPU_COUNT + 1).
*
* @return a cpu thread pool for
*/
public static ExecutorService getCpuPool() {
return getPoolByTypeAndPriority(TYPE_CPU);
}
/**
* Return a thread pool that creates (CPU_COUNT + 1) threads
* operating off a queue which size is 128 and the maximum
* number of threads equals (2 * CPU_COUNT + 1).
*
* @param priority The priority of thread in the poll.
* @return a cpu thread pool for
*/
public static ExecutorService getCpuPool(@IntRange(from = 1, to = 10) final int priority) {
return getPoolByTypeAndPriority(TYPE_CPU, priority);
}
/**
* Executes the given task in a fixed thread pool.
*
* @param size The size of thread in the fixed thread pool.
* @param task The task to execute.
* @param <T> The type of the task's result.
*/
public static <T> void executeByFixed(@IntRange(from = 1) final int size, final Task<T> task) {
execute(getPoolByTypeAndPriority(size), task);
}
/**
* Executes the given task in a fixed thread pool.
*
* @param size The size of thread in the fixed thread pool.
* @param task The task to execute.
* @param priority The priority of thread in the poll.
* @param <T> The type of the task's result.
*/
public static <T> void executeByFixed(@IntRange(from = 1) final int size,
final Task<T> task,
@IntRange(from = 1, to = 10) final int priority) {
execute(getPoolByTypeAndPriority(size, priority), task);
}
/**
* Executes the given task in a fixed thread pool after the given delay.
*
* @param size The size of thread in the fixed thread pool.
* @param task The task to execute.
* @param delay The time from now to delay execution.
* @param unit The time unit of the delay parameter.
* @param <T> The type of the task's result.
*/
public static <T> void executeByFixedWithDelay(@IntRange(from = 1) final int size,
final Task<T> task,
final long delay,
final TimeUnit unit) {
executeWithDelay(getPoolByTypeAndPriority(size), task, delay, unit);
}
/**
* Executes the given task in a fixed thread pool after the given delay.
*
* @param size The size of thread in the fixed thread pool.
* @param task The task to execute.
* @param delay The time from now to delay execution.
* @param unit The time unit of the delay parameter.
* @param priority The priority of thread in the poll.
* @param <T> The type of the task's result.
*/
public static <T> void executeByFixedWithDelay(@IntRange(from = 1) final int size,
final Task<T> task,
final long delay,
final TimeUnit unit,
@IntRange(from = 1, to = 10) final int priority) {
executeWithDelay(getPoolByTypeAndPriority(size, priority), task, delay, unit);
}
/**
* Executes the given task in a fixed thread pool at fix rate.
*
* @param size The size of thread in the fixed thread pool.
* @param task The task to execute.
* @param period The period between successive executions.
* @param unit The time unit of the period parameter.
* @param <T> The type of the task's result.
*/
public static <T> void executeByFixedAtFixRate(@IntRange(from = 1) final int size,
final Task<T> task,
final long period,
final TimeUnit unit) {
executeAtFixedRate(getPoolByTypeAndPriority(size), task, 0, period, unit);
}
/**
* Executes the given task in a fixed thread pool at fix rate.
*
* @param size The size of thread in the fixed thread pool.
* @param task The task to execute.
* @param period The period between successive executions.
* @param unit The time unit of the period parameter.
* @param priority The priority of thread in the poll.
* @param <T> The type of the task's result.
*/
public static <T> void executeByFixedAtFixRate(@IntRange(from = 1) final int size,
final Task<T> task,
final long period,
final TimeUnit unit,
@IntRange(from = 1, to = 10) final int priority) {
executeAtFixedRate(getPoolByTypeAndPriority(size, priority), task, 0, period, unit);
}
/**
* Executes the given task in a fixed thread pool at fix rate.
*
* @param size The size of thread in the fixed thread pool.
* @param task The task to execute.
* @param initialDelay The time to delay first execution.
* @param period The period between successive executions.
* @param unit The time unit of the initialDelay and period parameters.
* @param <T> The type of the task's result.
*/
public static <T> void executeByFixedAtFixRate(@IntRange(from = 1) final int size,
final Task<T> task,
long initialDelay,
final long period,
final TimeUnit unit) {
executeAtFixedRate(getPoolByTypeAndPriority(size), task, initialDelay, period, unit);
}
/**
* Executes the given task in a fixed thread pool at fix rate.
*
* @param size The size of thread in the fixed thread pool.
* @param task The task to execute.
* @param initialDelay The time to delay first execution.
* @param period The period between successive executions.
* @param unit The time unit of the initialDelay and period parameters.
* @param priority The priority of thread in the poll.
* @param <T> The type of the task's result.
*/
public static <T> void executeByFixedAtFixRate(@IntRange(from = 1) final int size,
final Task<T> task,
long initialDelay,
final long period,
final TimeUnit unit,
@IntRange(from = 1, to = 10) final int priority) {
executeAtFixedRate(getPoolByTypeAndPriority(size, priority), task, initialDelay, period, unit);
}
/**
* Executes the given task in a single thread pool.
*
* @param task The task to execute.
* @param <T> The type of the task's result.
*/
public static <T> void executeBySingle(final Task<T> task) {
getScheduledByTask(task).execute(new Runnable() {
@Override
public void run() {
getPoolByTypeAndPriority(TYPE_SINGLE).execute(task);
}
});
// execute(getPoolByTypeAndPriority(TYPE_SINGLE), task);
}
/**
* Executes the given task in a single thread pool.
*
* @param task The task to execute.
* @param priority The priority of thread in the poll.
* @param <T> The type of the task's result.
*/
public static <T> void executeBySingle(final Task<T> task,
@IntRange(from = 1, to = 10) final int priority) {
execute(getPoolByTypeAndPriority(TYPE_SINGLE, priority), task);
}
/**
* Executes the given task in a single thread pool after the given delay.
*
* @param task The task to execute.
* @param delay The time from now to delay execution.
* @param unit The time unit of the delay parameter.
* @param <T> The type of the task's result.
*/
public static <T> void executeBySingleWithDelay(final Task<T> task,
final long delay,
final TimeUnit unit) {
executeWithDelay(getPoolByTypeAndPriority(TYPE_SINGLE), task, delay, unit);
}
/**
* Executes the given task in a single thread pool after the given delay.
*
* @param task The task to execute.
* @param delay The time from now to delay execution.
* @param unit The time unit of the delay parameter.
* @param priority The priority of thread in the poll.
* @param <T> The type of the task's result.
*/
public static <T> void executeBySingleWithDelay(final Task<T> task,
final long delay,
final TimeUnit unit,
@IntRange(from = 1, to = 10) final int priority) {
executeWithDelay(getPoolByTypeAndPriority(TYPE_SINGLE, priority), task, delay, unit);
}
/**
* Executes the given task in a single thread pool at fix rate.
*
* @param task The task to execute.
* @param period The period between successive executions.
* @param unit The time unit of the period parameter.
* @param <T> The type of the task's result.
*/
public static <T> void executeBySingleAtFixRate(final Task<T> task,
final long period,
final TimeUnit unit) {
executeAtFixedRate(getPoolByTypeAndPriority(TYPE_SINGLE), task, 0, period, unit);
}
/**
* Executes the given task in a single thread pool at fix rate.
*
* @param task The task to execute.
* @param period The period between successive executions.
* @param unit The time unit of the period parameter.
* @param priority The priority of thread in the poll.
* @param <T> The type of the task's result.
*/
public static <T> void executeBySingleAtFixRate(final Task<T> task,
final long period,
final TimeUnit unit,
@IntRange(from = 1, to = 10) final int priority) {
executeAtFixedRate(getPoolByTypeAndPriority(TYPE_SINGLE, priority), task, 0, period, unit);
}
/**
* Executes the given task in a single thread pool at fix rate.
*
* @param task The task to execute.
* @param initialDelay The time to delay first execution.
* @param period The period between successive executions.
* @param unit The time unit of the initialDelay and period parameters.
* @param <T> The type of the task's result.
*/
public static <T> void executeBySingleAtFixRate(final Task<T> task,
long initialDelay,
final long period,
final TimeUnit unit) {
executeAtFixedRate(getPoolByTypeAndPriority(TYPE_SINGLE), task, initialDelay, period, unit);
}
/**
* Executes the given task in a single thread pool at fix rate.
*
* @param task The task to execute.
* @param initialDelay The time to delay first execution.
* @param period The period between successive executions.
* @param unit The time unit of the initialDelay and period parameters.
* @param priority The priority of thread in the poll.
* @param <T> The type of the task's result.
*/
public static <T> void executeBySingleAtFixRate(final Task<T> task,
long initialDelay,
final long period,
final TimeUnit unit,
@IntRange(from = 1, to = 10) final int priority) {
executeAtFixedRate(
getPoolByTypeAndPriority(TYPE_SINGLE, priority), task, initialDelay, period, unit
);
}
/**
* Executes the given task in a cached thread pool.
*
* @param task The task to execute.
* @param <T> The type of the task's result.
*/
public static <T> void executeByCached(final Task<T> task) {
execute(getPoolByTypeAndPriority(TYPE_CACHED), task);
}
/**
* Executes the given task in a cached thread pool.
*
* @param task The task to execute.
* @param priority The priority of thread in the poll.
* @param <T> The type of the task's result.
*/
public static <T> void executeByCached(final Task<T> task,
@IntRange(from = 1, to = 10) final int priority) {
execute(getPoolByTypeAndPriority(TYPE_CACHED, priority), task);
}
/**
* Executes the given task in a cached thread pool after the given delay.
*
* @param task The task to execute.
* @param delay The time from now to delay execution.
* @param unit The time unit of the delay parameter.
* @param <T> The type of the task's result.
*/
public static <T> void executeByCachedWithDelay(final Task<T> task,
final long delay,
final TimeUnit unit) {
executeWithDelay(getPoolByTypeAndPriority(TYPE_CACHED), task, delay, unit);
}
/**
* Executes the given task in a cached thread pool after the given delay.
*
* @param task The task to execute.
* @param delay The time from now to delay execution.
* @param unit The time unit of the delay parameter.
* @param priority The priority of thread in the poll.
* @param <T> The type of the task's result.
*/
public static <T> void executeByCachedWithDelay(final Task<T> task,
final long delay,
final TimeUnit unit,
@IntRange(from = 1, to = 10) final int priority) {
executeWithDelay(getPoolByTypeAndPriority(TYPE_CACHED, priority), task, delay, unit);
}
/**
* Executes the given task in a cached thread pool at fix rate.
*
* @param task The task to execute.
* @param period The period between successive executions.
* @param unit The time unit of the period parameter.
* @param <T> The type of the task's result.
*/
public static <T> void executeByCachedAtFixRate(final Task<T> task,
final long period,
final TimeUnit unit) {
executeAtFixedRate(getPoolByTypeAndPriority(TYPE_CACHED), task, 0, period, unit);
}
/**
* Executes the given task in a cached thread pool at fix rate.
*
* @param task The task to execute.
* @param period The period between successive executions.
* @param unit The time unit of the period parameter.
* @param priority The priority of thread in the poll.
* @param <T> The type of the task's result.
*/
public static <T> void executeByCachedAtFixRate(final Task<T> task,
final long period,
final TimeUnit unit,
@IntRange(from = 1, to = 10) final int priority) {
executeAtFixedRate(getPoolByTypeAndPriority(TYPE_CACHED, priority), task, 0, period, unit);
}
/**
* Executes the given task in a cached thread pool at fix rate.
*
* @param task The task to execute.
* @param initialDelay The time to delay first execution.
* @param period The period between successive executions.
* @param unit The time unit of the initialDelay and period parameters.
* @param <T> The type of the task's result.
*/
public static <T> void executeByCachedAtFixRate(final Task<T> task,
long initialDelay,
final long period,
final TimeUnit unit) {
executeAtFixedRate(getPoolByTypeAndPriority(TYPE_CACHED), task, initialDelay, period, unit);
}
/**
* Executes the given task in a cached thread pool at fix rate.
*
* @param task The task to execute.
* @param initialDelay The time to delay first execution.
* @param period The period between successive executions.
* @param unit The time unit of the initialDelay and period parameters.
* @param priority The priority of thread in the poll.
* @param <T> The type of the task's result.
*/
public static <T> void executeByCachedAtFixRate(final Task<T> task,
long initialDelay,
final long period,
final TimeUnit unit,
@IntRange(from = 1, to = 10) final int priority) {
executeAtFixedRate(
getPoolByTypeAndPriority(TYPE_CACHED, priority), task, initialDelay, period, unit
);
}
/**
* Executes the given task in an IO thread pool.
*
* @param task The task to execute.
* @param <T> The type of the task's result.
*/
public static <T> void executeByIo(final Task<T> task) {
execute(getPoolByTypeAndPriority(TYPE_IO), task);
}
/**
* Executes the given task in an IO thread pool.
*
* @param task The task to execute.
* @param priority The priority of thread in the poll.
* @param <T> The type of the task's result.
*/
public static <T> void executeByIo(final Task<T> task,
@IntRange(from = 1, to = 10) final int priority) {
execute(getPoolByTypeAndPriority(TYPE_IO, priority), task);
}
/**
* Executes the given task in an IO thread pool after the given delay.
*
* @param task The task to execute.
* @param delay The time from now to delay execution.
* @param unit The time unit of the delay parameter.
* @param <T> The type of the task's result.
*/
public static <T> void executeByIoWithDelay(final Task<T> task,
final long delay,
final TimeUnit unit) {
executeWithDelay(getPoolByTypeAndPriority(TYPE_IO), task, delay, unit);
}
/**
* Executes the given task in an IO thread pool after the given delay.
*
* @param task The task to execute.
* @param delay The time from now to delay execution.
* @param unit The time unit of the delay parameter.
* @param priority The priority of thread in the poll.
* @param <T> The type of the task's result.
*/
public static <T> void executeByIoWithDelay(final Task<T> task,
final long delay,
final TimeUnit unit,
@IntRange(from = 1, to = 10) final int priority) {
executeWithDelay(getPoolByTypeAndPriority(TYPE_IO, priority), task, delay, unit);
}
/**
* Executes the given task in an IO thread pool at fix rate.
*
* @param task The task to execute.
* @param period The period between successive executions.
* @param unit The time unit of the period parameter.
* @param <T> The type of the task's result.
*/
public static <T> void executeByIoAtFixRate(final Task<T> task,
final long period,
final TimeUnit unit) {
executeAtFixedRate(getPoolByTypeAndPriority(TYPE_IO), task, 0, period, unit);
}
/**
* Executes the given task in an IO thread pool at fix rate.
*
* @param task The task to execute.
* @param period The period between successive executions.
* @param unit The time unit of the period parameter.
* @param priority The priority of thread in the poll.
* @param <T> The type of the task's result.
*/
public static <T> void executeByIoAtFixRate(final Task<T> task,
final long period,
final TimeUnit unit,
@IntRange(from = 1, to = 10) final int priority) {
executeAtFixedRate(getPoolByTypeAndPriority(TYPE_IO, priority), task, 0, period, unit);
}
/**
* Executes the given task in an IO thread pool at fix rate.
*
* @param task The task to execute.
* @param initialDelay The time to delay first execution.
* @param period The period between successive executions.
* @param unit The time unit of the initialDelay and period parameters.
* @param <T> The type of the task's result.
*/
public static <T> void executeByIoAtFixRate(final Task<T> task,
long initialDelay,
final long period,
final TimeUnit unit) {
executeAtFixedRate(getPoolByTypeAndPriority(TYPE_IO), task, initialDelay, period, unit);
}
/**
* Executes the given task in an IO thread pool at fix rate.
*
* @param task The task to execute.
* @param initialDelay The time to delay first execution.
* @param period The period between successive executions.
* @param unit The time unit of the initialDelay and period parameters.
* @param priority The priority of thread in the poll.
* @param <T> The type of the task's result.
*/
public static <T> void executeByIoAtFixRate(final Task<T> task,
long initialDelay,
final long period,
final TimeUnit unit,
@IntRange(from = 1, to = 10) final int priority) {
executeAtFixedRate(
getPoolByTypeAndPriority(TYPE_IO, priority), task, initialDelay, period, unit
);
}
/**
* Executes the given task in a cpu thread pool.
*
* @param task The task to execute.
* @param <T> The type of the task's result.
*/
public static <T> void executeByCpu(final Task<T> task) {
execute(getPoolByTypeAndPriority(TYPE_CPU), task);
}
/**
* Executes the given task in a cpu thread pool.
*
* @param task The task to execute.
* @param priority The priority of thread in the poll.
* @param <T> The type of the task's result.
*/
public static <T> void executeByCpu(final Task<T> task,
@IntRange(from = 1, to = 10) final int priority) {
execute(getPoolByTypeAndPriority(TYPE_CPU, priority), task);
}
/**
* Executes the given task in a cpu thread pool after the given delay.
*
* @param task The task to execute.
* @param delay The time from now to delay execution.
* @param unit The time unit of the delay parameter.
* @param <T> The type of the task's result.
*/
public static <T> void executeByCpuWithDelay(final Task<T> task,
final long delay,
final TimeUnit unit) {
executeWithDelay(getPoolByTypeAndPriority(TYPE_CPU), task, delay, unit);
}
/**
* Executes the given task in a cpu thread pool after the given delay.
*
* @param task The task to execute.
* @param delay The time from now to delay execution.
* @param unit The time unit of the delay parameter.
* @param priority The priority of thread in the poll.
* @param <T> The type of the task's result.
*/
public static <T> void executeByCpuWithDelay(final Task<T> task,
final long delay,
final TimeUnit unit,
@IntRange(from = 1, to = 10) final int priority) {
executeWithDelay(getPoolByTypeAndPriority(TYPE_CPU, priority), task, delay, unit);
}
/**
* Executes the given task in a cpu thread pool at fix rate.
*
* @param task The task to execute.
* @param period The period between successive executions.
* @param unit The time unit of the period parameter.
* @param <T> The type of the task's result.
*/
public static <T> void executeByCpuAtFixRate(final Task<T> task,
final long period,
final TimeUnit unit) {
executeAtFixedRate(getPoolByTypeAndPriority(TYPE_CPU), task, 0, period, unit);
}
/**
* Executes the given task in a cpu thread pool at fix rate.
*
* @param task The task to execute.
* @param period The period between successive executions.
* @param unit The time unit of the period parameter.
* @param priority The priority of thread in the poll.
* @param <T> The type of the task's result.
*/
public static <T> void executeByCpuAtFixRate(final Task<T> task,
final long period,
final TimeUnit unit,
@IntRange(from = 1, to = 10) final int priority) {
executeAtFixedRate(getPoolByTypeAndPriority(TYPE_CPU, priority), task, 0, period, unit);
}
/**
* Executes the given task in a cpu thread pool at fix rate.
*
* @param task The task to execute.
* @param initialDelay The time to delay first execution.
* @param period The period between successive executions.
* @param unit The time unit of the initialDelay and period parameters.
* @param <T> The type of the task's result.
*/
public static <T> void executeByCpuAtFixRate(final Task<T> task,
long initialDelay,
final long period,
final TimeUnit unit) {
executeAtFixedRate(getPoolByTypeAndPriority(TYPE_CPU), task, initialDelay, period, unit);
}
/**
* Executes the given task in a cpu thread pool at fix rate.
*
* @param task The task to execute.
* @param initialDelay The time to delay first execution.
* @param period The period between successive executions.
* @param unit The time unit of the initialDelay and period parameters.
* @param priority The priority of thread in the poll.
* @param <T> The type of the task's result.
*/
public static <T> void executeByCpuAtFixRate(final Task<T> task,
long initialDelay,
final long period,
final TimeUnit unit,
@IntRange(from = 1, to = 10) final int priority) {
executeAtFixedRate(
getPoolByTypeAndPriority(TYPE_CPU, priority), task, initialDelay, period, unit
);
}
/**
* Executes the given task in a custom thread pool.
*
* @param pool The custom thread pool.
* @param task The task to execute.
* @param <T> The type of the task's result.
*/
public static <T> void executeByCustom(final ExecutorService pool, final Task<T> task) {
execute(pool, task);
}
/**
* Executes the given task in a custom thread pool after the given delay.
*
* @param pool The custom thread pool.
* @param task The task to execute.
* @param delay The time from now to delay execution.
* @param unit The time unit of the delay parameter.
* @param <T> The type of the task's result.
*/
public static <T> void executeByCustomWithDelay(final ExecutorService pool,
final Task<T> task,
final long delay,
final TimeUnit unit) {
executeWithDelay(pool, task, delay, unit);
}
/**
* Executes the given task in a custom thread pool at fix rate.
*
* @param pool The custom thread pool.
* @param task The task to execute.
* @param period The period between successive executions.
* @param unit The time unit of the period parameter.
* @param <T> The type of the task's result.
*/
public static <T> void executeByCustomAtFixRate(final ExecutorService pool,
final Task<T> task,
final long period,
final TimeUnit unit) {
executeAtFixedRate(pool, task, 0, period, unit);
}
/**
* Executes the given task in a custom thread pool at fix rate.
*
* @param pool The custom thread pool.
* @param task The task to execute.
* @param initialDelay The time to delay first execution.
* @param period The period between successive executions.
* @param unit The time unit of the initialDelay and period parameters.
* @param <T> The type of the task's result.
*/
public static <T> void executeByCustomAtFixRate(final ExecutorService pool,
final Task<T> task,
long initialDelay,
final long period,
final TimeUnit unit) {
executeAtFixedRate(pool, task, initialDelay, period, unit);
}
/**
* Cancel the given task.
*
* @param task The task to cancel.
*/
public static void cancel(final Task task) {
if (task == null) return;
task.cancel();
}
/**
* Cancel the given tasks.
*
* @param tasks The tasks to cancel.
*/
public static void cancel(final Task... tasks) {
if (tasks == null || tasks.length == 0) return;
for (Task task : tasks) {
if (task == null) continue;
task.cancel();
}
}
/**
* Cancel the given tasks.
*
* @param tasks The tasks to cancel.
*/
public static void cancel(final List<Task> tasks) {
if (tasks == null || tasks.size() == 0) return;
for (Task task : tasks) {
if (task == null) continue;
task.cancel();
}
}
/**
* Set the deliver.
*
* @param deliver The deliver.
*/
public static void setDeliver(final Executor deliver) {
sDeliver = deliver;
}
private static <T> void execute(final ExecutorService pool, final Task<T> task) {
executeWithDelay(pool, task, 0, TimeUnit.MILLISECONDS);
}
private static <T> void executeWithDelay(final ExecutorService pool,
final Task<T> task,
final long delay,
final TimeUnit unit) {
if (delay <= 0) {
getScheduledByTask(task).execute(new Runnable() {
@Override
public void run() {
pool.execute(task);
}
});
} else {
getScheduledByTask(task).schedule(new Runnable() {
@Override
public void run() {
pool.execute(task);
}
}, delay, unit);
}
}
private static <T> void executeAtFixedRate(final ExecutorService pool,
final Task<T> task,
long initialDelay,
final long period,
final TimeUnit unit) {
task.setSchedule(true);
getScheduledByTask(task).scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
pool.execute(task);
}
}, initialDelay, period, unit);
}
private synchronized static ScheduledExecutorService getScheduledByTask(final Task task) {
ScheduledExecutorService scheduled = TASK_SCHEDULED.get(task);
if (scheduled == null) {
UtilsThreadFactory factory = new UtilsThreadFactory("scheduled", Thread.MAX_PRIORITY);
scheduled = Executors.newScheduledThreadPool(1, factory);
TASK_SCHEDULED.put(task, scheduled);
}
return scheduled;
}
private synchronized static void removeScheduleByTask(final Task task) {
ScheduledExecutorService scheduled = TASK_SCHEDULED.get(task);
if (scheduled != null) {
TASK_SCHEDULED.remove(task);
scheduled.shutdownNow();
}
}
private static ExecutorService getPoolByTypeAndPriority(final int type) {
return getPoolByTypeAndPriority(type, Thread.NORM_PRIORITY);
}
private synchronized static ExecutorService getPoolByTypeAndPriority(final int type, final int priority) {
ExecutorService pool;
Map<Integer, ExecutorService> priorityPools = TYPE_PRIORITY_POOLS.get(type);
if (priorityPools == null) {
priorityPools = new HashMap<>();
pool = createPoolByTypeAndPriority(type, priority);
priorityPools.put(priority, pool);
TYPE_PRIORITY_POOLS.put(type, priorityPools);
} else {
pool = priorityPools.get(priority);
if (pool == null) {
pool = createPoolByTypeAndPriority(type, priority);
priorityPools.put(priority, pool);
}
}
return pool;
}
private static ExecutorService createPoolByTypeAndPriority(final int type, final int priority) {
switch (type) {
case TYPE_SINGLE:
return new ThreadPoolExecutor(1, 1,
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>(),
new UtilsThreadFactory("single", priority, true));
case TYPE_CACHED:
return new ThreadPoolExecutor(1, Math.max(CPU_COUNT * 8, 64),
60L, TimeUnit.SECONDS,
new SynchronousQueue<Runnable>(),
new UtilsThreadFactory("cached", priority, false),
new ThreadPoolExecutor.CallerRunsPolicy());
case TYPE_IO:
return new ThreadPoolExecutor(2 * CPU_COUNT + 1, 2 * CPU_COUNT + 1,
30, TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>(128),
new UtilsThreadFactory("io", priority)
);
case TYPE_CPU:
return new ThreadPoolExecutor(CPU_COUNT + 1, 2 * CPU_COUNT + 1,
30, TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>(128),
new UtilsThreadFactory("cpu", priority)
);
default:
return new ThreadPoolExecutor(type, type,
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>(128),
new UtilsThreadFactory("fixed(" + type + ")", priority),
new
ThreadPoolExecutor.DiscardOldestPolicy()
);
}
}
private static Executor getDeliver() {
if (sDeliver == null) {
sDeliver = new Executor() {
private final Handler mHandler = new Handler(Looper.getMainLooper());
@Override
public void execute(@NonNull Runnable command) {
mHandler.post(command);
}
};
}
return sDeliver;
}
public abstract static class SimpleTask<T> extends Task<T> {
@Override
public void onCancel() {
Log.e("ThreadUtils", "onCancel: " + Thread.currentThread());
}
@Override
public void onFail(Throwable t) {
Log.e("ThreadUtils", "onFail: ", t);
}
}
// private static final class FutureTask4UtilCode<V> extends FutureTask<V> {
//
// private boolean isSchedule;
//
// public FutureTask4UtilCode(@NonNull Callable<V> callable) {
// super(callable);
// }
//
// @Override
// public void run() {
// super.runAndReset();
// }
//
// public void setSchedule(boolean schedule) {
// isSchedule = schedule;
// }
// }
//
// public abstract static class Task<T> implements Runnable {
//
// public abstract T doInBackground() throws Throwable;
//
// public abstract void onSuccess(T result);
//
// public abstract void onCancel();
//
// public abstract void onFail(Throwable t);
//
// private FutureTask4UtilCode<T> mFutureTask;
//
// public Task() {
// mFutureTask = new FutureTask4UtilCode<T>(new Callable<T>() {
// @Override
// public T call() {
// try {
// final T result = doInBackground();
// getDeliver().execute(new Runnable() {
// @Override
// public void run() {
// onSuccess(result);
// removeScheduleByTask(Task.this);
// }
// });
// } catch (final InterruptedException ignore) {
// System.out.println(ignore);
// } catch (final Throwable throwable) {
// getDeliver().execute(new Runnable() {
// @Override
// public void run() {
// onFail(throwable);
// removeScheduleByTask(Task.this);
// }
// });
// }
// return null;
// }
// });
// }
//
// @Override
// public void run() {
// mFutureTask.run();
// }
//
// public void cancel() {
// cancel(true);
// }
//
// public void cancel(boolean mayInterruptIfRunning) {
// mFutureTask.cancel(true);
// }
//
// public boolean isCanceled() {
// return mFutureTask.isCancelled();
// }
//
// public boolean isDone() {
// return mFutureTask.isDone();
// }
//
// private void setSchedule(boolean schedule) {
// mFutureTask.setSchedule(schedule);
// }
// }
public abstract static class Task<T> implements Runnable {
private static final int NEW = 0;
private static final int COMPLETING = 1;
private static final int CANCELLED = 2;
private static final int EXCEPTIONAL = 3;
private static final Object LOCK = "";
private volatile int state = NEW;
private volatile boolean isSchedule;
private volatile Thread runner;
public abstract T doInBackground() throws Throwable;
public abstract void onSuccess(T result);
public abstract void onCancel();
public abstract void onFail(Throwable t);
@Override
public void run() {
if (state != NEW) return;
synchronized (LOCK) {
runner = Thread.currentThread();
}
try {
final T result = doInBackground();
if (state != NEW) return;
if (isSchedule) {
getDeliver().execute(new Runnable() {
@Override
public void run() {
onSuccess(result);
}
});
} else {
state = COMPLETING;
getDeliver().execute(new Runnable() {
@Override
public void run() {
onSuccess(result);
removeScheduleByTask(Task.this);
}
});
}
} catch (InterruptedException ignore) {
System.out.println("InterruptedException");
} catch (final Throwable throwable) {
if (state != NEW) return;
state = EXCEPTIONAL;
getDeliver().execute(new Runnable() {
@Override
public void run() {
onFail(throwable);
removeScheduleByTask(Task.this);
}
});
}
}
public void cancel() {
cancel(true);
}
public void cancel(boolean mayInterruptIfRunning) {
if (state != NEW) return;
if (mayInterruptIfRunning) {
synchronized (LOCK) {
if (runner != null) {
runner.interrupt();
}
}
}
state = CANCELLED;
getDeliver().execute(new Runnable() {
@Override
public void run() {
onCancel();
removeScheduleByTask(Task.this);
}
});
}
public boolean isCanceled() {
return state == CANCELLED;
}
public boolean isDone() {
return state != NEW;
}
private void setSchedule(boolean isSchedule) {
this.isSchedule = isSchedule;
}
}
private static final class UtilsThreadFactory extends AtomicLong
implements ThreadFactory {
private static final AtomicInteger POOL_NUMBER = new AtomicInteger(1);
private static final long serialVersionUID = -9209200509960368598L;
private final String namePrefix;
private final int priority;
private final boolean isDaemon;
UtilsThreadFactory(String prefix, int priority) {
this(prefix, priority, false);
}
UtilsThreadFactory(String prefix, int priority, boolean isDaemon) {
namePrefix = prefix + "-pool-" +
POOL_NUMBER.getAndIncrement() +
"-thread-";
this.priority = priority;
this.isDaemon = isDaemon;
}
@Override
public Thread newThread(@NonNull Runnable r) {
Thread t = new Thread(r, namePrefix + getAndIncrement()) {
@Override
public void run() {
try {
super.run();
} catch (Throwable t) {
Log.e("ThreadUtils", "Request threw uncaught throwable", t);
}
}
};
t.setDaemon(isDaemon);
t.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread t, Throwable e) {
System.out.println(e);
}
});
t.setPriority(priority);
return t;
}
}
}
| [
"13286810620@163.com"
] | 13286810620@163.com |
539ebf7a74aa4f2e78f733274cd5f6940d255a1f | 24003ab2ef231c023e8d93c1040816527c52620f | /src/main/java/com/athome/webbookstore/services/AccountService.java | b5635313d8ead8a335a2e29abc869b8bc6ef162b | [] | no_license | GarryX/webbookstore | fad596e2dd1953b5ecb4fd8c2af0baf0a282a454 | 0aff36f3382111167ba9792aa34f6f26e6cc090a | refs/heads/master | 2020-12-24T21:00:28.552772 | 2016-05-07T15:02:19 | 2016-05-07T15:02:19 | 56,918,633 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 364 | java | package com.athome.webbookstore.services;
import com.athome.webbookstore.dao.impl.AccountDaoImpl;
import com.athome.webbookstore.entities.Account;
public class AccountService {
private AccountDaoImpl ad;
public void setAccountDaoImpl(AccountDaoImpl ad) {
this.ad = ad;
}
public Account getAccount(Integer accountid){
return ad.get(accountid);
}
}
| [
"402691569@qq.com"
] | 402691569@qq.com |
2c6a39c1d325ab04dff217463e10be04f2c63085 | 76d6266d058727bb863314065c5f87cd762fe6c1 | /src/com/betatest/canalkidsbeta/util/JSONParser.java | 53a13332d3d0bb318819c7a8372473ebfe872e0b | [] | no_license | ricardo-nakayama-movile/MeuRepo | 52a3a26cd2eef512d7443c316a9aedcb647e7e11 | bd2d0f914cd93fbac4fc1b934a8297d6090872f9 | refs/heads/master | 2020-12-24T14:53:10.225095 | 2013-02-22T14:51:54 | 2013-02-22T14:51:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,307 | java | package com.betatest.canalkidsbeta.util;
import java.io.IOException;
import android.util.Log;
import com.betatest.canalkidsbeta.bean.ChannelContentsResponseParcel;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
public class JSONParser {
/**
*
* Gets a content from a url
*
* @param url
*
* @return String
*
*/
public static String getUrlResponse(String url) {
String response = "";
try {
response = HttpUtil.doHttpGet(url);
} catch (Exception e) {
Log.e("INFO", "erro ao conectar com servidor");
e.printStackTrace();
}
return response;
}
/**
*
* Get a ChannelContentsResponse from the json
*
* @param json
*
* @return ChannelContentsResponseParcel
*
* @throws JsonParseException
* @throws JsonMappingException
* @throws IOException
*
*/
public static ChannelContentsResponseParcel getChannelContentsObjFromJson(
String json) throws JsonParseException, JsonMappingException,
IOException {
ObjectMapper objectMapper = new ObjectMapper();
return objectMapper.readValue(json,
new TypeReference<ChannelContentsResponseParcel>() {
});
}
} | [
"ricardonakayama@ricardonakayama-Vostro-3550.(none)"
] | ricardonakayama@ricardonakayama-Vostro-3550.(none) |
274148726ec4f58cc6195b91b8982a0d842af27b | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /single-large-project/src/test/java/org/gradle/test/performancenull_71/Testnull_7071.java | ca564eec9f6c82200122cd851c8ae0e10a94b1f3 | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 304 | java | package org.gradle.test.performancenull_71;
import static org.junit.Assert.*;
public class Testnull_7071 {
private final Productionnull_7071 production = new Productionnull_7071("value");
@org.junit.Test
public void test() {
assertEquals(production.getProperty(), "value");
}
} | [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
891834e85147d9c9b2229894639647b9d0cd64ef | abf7ba6e04da0f5e4ddcea88bd455e1f05582a74 | /app/src/main/java/uni/fmi/masters/fireorganizer/MainActivity.java | 4f4b2127090fd8a5489e57209715f40cfc544b21 | [] | no_license | MarioMollov/FireOrganizer | 10ec478b97989e81be45ccaf957e59be32aa4a3e | 48e999b870c73be55d32147964905fddbb210109 | refs/heads/master | 2023-05-06T13:01:31.386467 | 2021-06-03T19:37:04 | 2021-06-03T19:37:04 | 343,489,604 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,574 | java | package uni.fmi.masters.fireorganizer;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.Menu;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.material.navigation.NavigationView;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.firestore.DocumentReference;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.EventListener;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.FirebaseFirestoreException;
import com.squareup.picasso.Picasso;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.view.GravityCompat;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import uni.fmi.masters.fireorganizer.Authentication.LoginActivity;
import uni.fmi.masters.fireorganizer.Authentication.RegisterActivity;
import uni.fmi.masters.fireorganizer.ui.notes.AddNoteActivity;
import uni.fmi.masters.fireorganizer.ui.profile.ProfileFragment;
public class MainActivity extends AppCompatActivity {
private AppBarConfiguration mAppBarConfiguration;
public static Context contextOfApplication;
public static Context getContextOfApplication() {
return contextOfApplication;
}
public static boolean isLogged = true;
FirebaseAuth fAuth;
FirebaseFirestore db;
DocumentReference documentReference;
String userID;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawer = findViewById(R.id.drawer_layout);
NavigationView navigationView = findViewById(R.id.nav_view);
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
mAppBarConfiguration = new AppBarConfiguration.Builder(
R.id.nav_home, R.id.nav_gallery, R.id.nav_profile, R.id.nav_notes)
// .setDrawerLayout(drawer) this is deprecate and should use setOpenableLayout()
.setOpenableLayout(drawer)
.build();
final NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
NavigationUI.setupWithNavController(navigationView, navController);
navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
FirebaseAuth fAuth = FirebaseAuth.getInstance();
int id = item.getItemId();
if(id == R.id.nav_logout){
isLogged = false;
fAuth.signOut();
startActivity(new Intent(MainActivity.this, LoginActivity.class));
finish();
}else {
NavigationUI.onNavDestinationSelected(item,navController);
}
drawer.closeDrawer(GravityCompat.START);
return true;
}
});
fAuth = FirebaseAuth.getInstance();
db = FirebaseFirestore.getInstance();
userID = fAuth.getCurrentUser().getUid();
View headerView = navigationView.getHeaderView(0);
TextView headerUsername = headerView.findViewById(R.id.headerUsernameTextView);
TextView headerEmail = headerView.findViewById(R.id.headerEmailTextView);
ImageView headerAvatar = headerView.findViewById(R.id.headerImageView);
documentReference = db.collection(RegisterActivity.COLLECTION_USERS).document(userID);
documentReference.addSnapshotListener(new EventListener<DocumentSnapshot>() {
@Override
public void onEvent(@Nullable DocumentSnapshot value, @Nullable FirebaseFirestoreException error) {
if(isLogged){
String fname = value.getString(RegisterActivity.FIREBASE_FIRST_NAME);
String lname = value.getString(RegisterActivity.FIREBASE_LAST_NAME);
String username = fname + " " + lname;
String email = value.getString(RegisterActivity.FIREBASE_EMAIL);
String avatarUri = value.getString(RegisterActivity.FIREBASE_AVATAR_PATH);
headerUsername.setText(username);
headerEmail.setText(email);
Picasso.get().load(avatarUri).into(headerAvatar);
}
}
});
}
@Override
public boolean onSupportNavigateUp() {
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
return NavigationUI.navigateUp(navController, mAppBarConfiguration)
|| super.onSupportNavigateUp();
}
} | [
"mario030597@gmail.com"
] | mario030597@gmail.com |
4e615bddf5d804f7c7a8cf9971d55d86f91e7b64 | 16ea44347a89c08b193c5831e17396af78f93311 | /src/lab01/WordCount.java | 1afed7e5511f1e3bb67b3d8b391eb2f7a3aaedd6 | [] | no_license | HakCheon/BigDataProcessing | eea843465600c33c508cde63e252da00ef862503 | 591de91ab18b12f96feb6728b8c28131d52d0eb4 | refs/heads/master | 2021-01-10T17:46:06.455340 | 2015-11-29T10:29:33 | 2015-11-29T10:29:33 | 44,221,564 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,240 | java | package lab01;
import java.io.IOException;
import java.util.StringTokenizer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.GenericOptionsParser;
public class WordCount {
public static class TokenizerMapper
extends Mapper<Object, Text, Text, IntWritable>{
private final static IntWritable one = new IntWritable(1);
private Text word = new Text();
public void map(Object key, Text value, Context context
) throws IOException, InterruptedException {
StringTokenizer itr = new StringTokenizer(value.toString());
int i=0;
String bi1 = new String("");
String bi2 = new String("");
while (itr.hasMoreTokens()) {
bi1 = bi2;
bi2 = itr.nextToken();
if (i<1) i++;
else {
word.set(bi1+" "+bi2);
context.write(word, one);
}
}
}
}
public static class IntSumReducer
extends Reducer<Text,IntWritable,Text,IntWritable> {
private IntWritable result = new IntWritable();
public void reduce(Text key, Iterable<IntWritable> values,
Context context
) throws IOException, InterruptedException {
int sum = 0;
for (IntWritable val : values) {
sum += val.get();
}
result.set(sum);
context.write(key, result);
}
}
public static void main(String[] args) throws Exception {
Configuration conf = new Configuration(); // job 수행하기 위한 설정 초기화
String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();
if (otherArgs.length != 2) {
System.err.println("Usage: wordcount <in> <out>");
System.exit(2);
}
Job job = new Job(conf, "word count"); // job 작성, 따옴표안은 설명을 쓰면됨(상관없음)
job.setJarByClass(WordCount.class); // job을 수행할 class 선언, 파일명.class, 대소문자주의
job.setMapperClass(TokenizerMapper.class); // Map class 선언, 위에서 작성한 class명
job.setReducerClass(IntSumReducer.class); // Reduce class 선언
job.setOutputKeyClass(Text.class); // Output key type 선언
job.setOutputValueClass(IntWritable.class); // Output value type 선언
//job.setMapOutputKeyClass(Text.class); // Map은 Output key type이 다르다면 선언
//job.setMapOutputValueClass(IntWritable.class); // Map은 Output value type이 다르다면 선언
job.setNumReduceTasks(1); // 동시에 수행되는 reduce개수
FileInputFormat.addInputPath(job, new Path(otherArgs[0])); // 입력 데이터가 있는 path
FileOutputFormat.setOutputPath(job, new Path(otherArgs[1])); // 결과를 출력할 path
System.exit(job.waitForCompletion(true) ? 0 : 1); // 실행
}
} | [
"gkrcjs2@gmail.com"
] | gkrcjs2@gmail.com |
8235e6cda9a78d4d03a8cd6b972296a0ffc8e741 | e1cc334110074616104cda473caa349f454203c9 | /src/main/java/com/cjw/springbootstarter/service/impl/UserServiceImpl.java | 8026382c696c8f1f24ffafe02cda589aa11207c8 | [] | no_license | yao145/springboot-learning | 23112c6fcad177927ebb59eeef31d555e996103e | ec9b6c2baed31bf66b9fe2b13081d1868b7c4fd1 | refs/heads/master | 2022-06-11T05:50:36.974015 | 2019-02-14T09:43:26 | 2019-02-14T09:43:26 | 166,908,993 | 0 | 0 | null | 2022-05-20T20:55:15 | 2019-01-22T01:55:28 | Java | UTF-8 | Java | false | false | 2,942 | java | /**
* Copyright (C), 2015-2019, XXX有限公司
* FileName: UserServiceImpl
* Author: yao
* Date: 2019/1/23 15:29
* Description: 用户操作实现类
* History:
* <author> <time> <version> <desc>
* 作者姓名 修改时间 版本号 描述
*/
package com.cjw.springbootstarter.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cjw.springbootstarter.base.GlobeVarData;
import com.cjw.springbootstarter.domain.TSysPermissionRole;
import com.cjw.springbootstarter.domain.TSysPremission;
import com.cjw.springbootstarter.domain.TSysUser;
import com.cjw.springbootstarter.exception.MyException;
import com.cjw.springbootstarter.mapper.RoleUserMapper;
import com.cjw.springbootstarter.mapper.UserMapper;
import com.cjw.springbootstarter.service.UserService;
import com.cjw.springbootstarter.util.Log4JUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
* 〈一句话功能简述〉<br>
* 〈用户操作实现类〉
*
* @author yao
* @create 2019/1/23
* @since 1.0.0
*/
@Service
public class UserServiceImpl implements UserService {
@Autowired
private UserMapper userMapper;
@Autowired
private RoleUserMapper roleUserMapper;
@Override
public TSysUser findByUserName(String userName) {
List<TSysUser> userList = userMapper.selectList(new QueryWrapper<TSysUser>().eq("username", userName));
if (userList.size() > 1) {
Log4JUtils.getLogger().error("用户名重复,无法正常使用,用户名为-->【" + userName + "】");
throw new MyException("用户名存在重复,无法正常使用", -1);
} else if (userList.size() == 0) {
return null;
} else {
return userList.get(0);
}
}
@Override
public List<TSysPremission> GetPermissionByUserId(long userId) {
//通过用户id获取权限列表
//查询所有的role id,并去重复
List<Long> roleIdList = roleUserMapper.findRoleIdsByUserId(userId);
//查询全局变量获取权限id列表
List<Long> permissionIdList = GlobeVarData.premissionRoleList.stream().
filter(a -> roleIdList.contains(a.getRoleId())).
map(TSysPermissionRole::getPermissionId).collect(Collectors.toList());
//查询全局变量获取权限列表
List<TSysPremission> premissionList = GlobeVarData.premissionList.stream().
filter(a -> permissionIdList.contains(a.getId())).collect(Collectors.toList());
Log4JUtils.getLogger().info("用户【 id=" + userId + "】权限列表获取完成,共计:" + premissionList.size());
return premissionList;
}
}
| [
"292836274@qq.com"
] | 292836274@qq.com |
7cf39dab9079e8b3d30275a68e2d2d7fca4dd721 | c8b8d8e61b59b70b84e0d338c2c843e8683d7a1f | /app/src/main/java/com/hewei/mytransitiontest/SingleImageViewerActivity.java | 28e24c521128a2d5affd803787311526fa5f862f | [] | no_license | heweidev/transition_test | 708c34ee87dd0ec489b071262700bc2a085f6bee | 6024d608a6718967921847a3a80a2b35dd527ff1 | refs/heads/master | 2020-03-08T09:16:45.249295 | 2018-04-04T09:58:37 | 2018-04-04T09:58:37 | 128,043,243 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,637 | java | package com.hewei.mytransitiontest;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.view.ViewCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import com.squareup.picasso.Picasso;
public class SingleImageViewerActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_image_viewer);
ImageView imageView = findViewById(R.id.largeImage);
ViewCompat.setTransitionName(imageView, Constants.TRANSITION_NAME);
Picasso.with(this).load(Uri.parse(Constants.IMAGE_URL)).into(imageView);
}
private void changeNavBar() {
// 隐藏标题栏
supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
View root = LayoutInflater.from(this).inflate(R.layout.activity_image_viewer, null);
// 或者 在界面的根层加入 android:fitsSystemWindows=”true” 这个属性,这样就可以让内容界面从 状态栏 下方开始。
ViewCompat.setFitsSystemWindows(root, true);
setContentView(root);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// Android 5.0 以上 全透明
Window window = getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
// 状态栏(以上几行代码必须,参考setStatusBarColor|setNavigationBarColor方法源码)
window.setStatusBarColor(Color.TRANSPARENT);
// 虚拟导航键
window.setNavigationBarColor(Color.TRANSPARENT);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// Android 4.4 以上 半透明
Window window = getWindow();
// 状态栏
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
// 虚拟导航键
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
}
}
}
| [
"fengyp001@qianhai.com.cn"
] | fengyp001@qianhai.com.cn |
d8c8869658334efa0497ca1eeb3b5f679a8fe98d | be92f063b473de2c5a19a2f2eadf3061a3f02468 | /android/app/src/main/java/com/redux_react/MainApplication.java | 5e63a47a159c82444a2412e0d928a154aa83886a | [] | no_license | trancongdung12/Redux__React | 4589637c7717082039e4f56ff4a73cb80d146cb9 | f98c4020c96c27f43335cef4d2223eff481559f0 | refs/heads/master | 2023-02-18T17:19:15.482602 | 2021-01-14T09:35:38 | 2021-01-14T09:35:38 | 329,568,371 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,624 | java | package com.redux_react;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.reactnativenavigation.NavigationApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.reactnativenavigation.react.NavigationReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class MainApplication extends NavigationApplication {
private final ReactNativeHost mReactNativeHost =
new NavigationReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.redux_react.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
| [
"Administrator@PNVD203.pn.com.vn"
] | Administrator@PNVD203.pn.com.vn |
9d21a1ba8bac46b0e744283d0e4fdaecfbad1854 | b9138dad38fad83d9b38d57a74812b8f9dc98321 | /src/src/presentation/boundary/searchController/WorkerSearchController.java | 18e83a301a242a8a9a3eaa4b271eafe63a512459 | [] | no_license | reiniru/CarLoan | 1b1a4e268e9063be9af2ea22b8e5346e013e67ae | bc1ed268cfa04a3e645ce1434206d8a2fdd8d3cb | refs/heads/master | 2021-08-14T18:16:17.967968 | 2017-11-16T12:46:19 | 2017-11-16T12:46:19 | 110,967,022 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,070 | java | package presentation.boundary.searchController;
import java.net.URL;
import java.util.ResourceBundle;
import presentation.boundary.IBoundary;
import presentation.boundary.boundaryControllers.TabController;
import transferObject.CarLoanTO;
import transferObject.parameters.BoundaryParameters;
import transferObject.parameters.entityParameters.WorkerParameters;
import transferObject.parameters.entityParameters.WorkplaceParameters;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
public class WorkerSearchController implements Initializable, IBoundary
{
@FXML
private Button btReset;
@FXML
private Button btCerca;
@FXML
private TextField txCodiceFiscale;
@FXML
private TextField txCittaSede;
private TabController parentController;
@Override
public CarLoanTO getData() {
CarLoanTO searchData = new CarLoanTO();
searchData.put(WorkplaceParameters.CITY, txCittaSede.getText());
searchData.put(WorkerParameters.TAX_CODE, txCodiceFiscale.getText());
return searchData;
}
@Override
public void setData(CarLoanTO data) {}
@Override
public void setEditable(boolean value) {}
@Override
public void show() {}
@Override
public void hide() {}
@Override
public void Init(CarLoanTO data) {
// TODO Auto-generated method stub
parentController = (TabController)data.get(BoundaryParameters.CONTROLLER);
}
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
// TODO Auto-generated method stub
btCerca.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0)
{
parentController.filterTableView(getData());
}
});
btReset.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0)
{
parentController.filterTableView(null);
}
});
}
}
| [
"noreply@github.com"
] | noreply@github.com |
f83461990119b5945157527929e954384f22d045 | 35691f785ee0c2d07f6fa16b43cf32044ad2d568 | /app/src/main/java/com/example/charles/workingplace/Vue/Information.java | 2c7dd2d6e00f37a14143d2f29d1f6987553e5bdb | [] | no_license | CarlaRenaux/WorkingPlace2 | 0e32523e726d55e1b6a9a45eb843be188794dc79 | abdb634073650cf6984722aba918b31a21f831fd | refs/heads/master | 2020-03-19T22:25:46.140984 | 2018-06-11T19:09:02 | 2018-06-11T19:09:02 | 136,969,671 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,369 | java | package com.example.charles.workingplace.Vue;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import com.example.charles.workingplace.Controleur.Controleur;
import com.example.charles.workingplace.Modele.Etudiant;
import com.example.charles.workingplace.R;
public class Information extends AppCompatActivity {
private Controleur controleur = new Controleur();
private TextView infoPrenom;
private TextView infoNom;
private TextView infoAge;
private TextView infoEmail;
private TextView infoLieu;
private Button modifierMdp;
private TextView infoLieuReserve;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_information);
infoPrenom = (TextView) findViewById(R.id.infoPrenom);
infoNom= (TextView) findViewById(R.id.infoNom);
infoAge = (TextView) findViewById(R.id.infoAge);
infoEmail = (TextView) findViewById(R.id.infoEmail);
infoLieu = (TextView) findViewById(R.id.infoLieu);
modifierMdp = (Button) findViewById(R.id.modifierMdp);
infoLieuReserve = (TextView) findViewById(R.id.InfoLieuReserver);
infoPrenom.setText(controleur.getUtilisateurCourant().recupererPrenom());
infoNom.setText(controleur.getUtilisateurCourant().recupererNom());
infoAge.setText(Integer.toString(controleur.getUtilisateurCourant().recupererAge()));
infoEmail.setText(controleur.getUtilisateurCourant().getEmail());
if(controleur.getUtilisateurCourant() instanceof Etudiant){
infoLieuReserve.setText("Vos lieux réservés");
}
else{
infoLieuReserve.setText("Lieux ajouté(s)");
}
if(controleur.getUtilisateurCourant().getListeLieux().size() == 1){
infoLieu.setText("• " +
controleur.getUtilisateurCourant().getListeLieux().get(0).getAdresse() + " \n" + "Le "
+ controleur.getUtilisateurCourant().getListeLieux().get(0).getDate() + " De " +
controleur.getUtilisateurCourant().getListeLieux().get(0).getHeure() +
" à " + controleur.getUtilisateurCourant().getListeLieux().get(0).getHeureFin()
);
}
else if(controleur.getUtilisateurCourant().getListeLieux().size() == 2 ){
infoLieu.setText("• " +
controleur.getUtilisateurCourant().getListeLieux().get(0).getAdresse()+
"Le "
+ controleur.getUtilisateurCourant().getListeLieux().get(0).getDate() + " De " +
controleur.getUtilisateurCourant().getListeLieux().get(0).getHeure() +
" à " + controleur.getUtilisateurCourant().getListeLieux().get(0).getHeureFin() + " \n" +
controleur.getUtilisateurCourant().getListeLieux().get(1).getAdresse() +
" \n" + "Le "
+ controleur.getUtilisateurCourant().getListeLieux().get(1).getDate() + " De " +
controleur.getUtilisateurCourant().getListeLieux().get(1).getHeure() +
" à " + controleur.getUtilisateurCourant().getListeLieux().get(1).getHeureFin()
);
}
else if(controleur.getUtilisateurCourant().getListeLieux().size() >= 3 ){
infoLieu.setText("• " +
controleur.getUtilisateurCourant().getListeLieux().get(0).getAdresse()+ "Le "
+ controleur.getUtilisateurCourant().getListeLieux().get(0).getDate() + " De " +
controleur.getUtilisateurCourant().getListeLieux().get(0).getHeure() +
" à " + controleur.getUtilisateurCourant().getListeLieux().get(0).getHeureFin() + "\n" +
controleur.getUtilisateurCourant().getListeLieux().get(1).getAdresse()+
"\n• " + "Le "
+ controleur.getUtilisateurCourant().getListeLieux().get(1).getDate() + " De " +
controleur.getUtilisateurCourant().getListeLieux().get(1).getHeure() +
" à " + controleur.getUtilisateurCourant().getListeLieux().get(1).getHeureFin() + " \n" +
controleur.getUtilisateurCourant().getListeLieux().get(2).getAdresse() + "Le "
+ controleur.getUtilisateurCourant().getListeLieux().get(2).getDate() + " De " +
controleur.getUtilisateurCourant().getListeLieux().get(2).getHeure() +
" à " + controleur.getUtilisateurCourant().getListeLieux().get(2).getHeureFin()
);
}
else{
infoLieu.setText("Aucun lieu disponible.");
}
modifierMdp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ouvrirModifierMdp();
}
});
}
public void ouvrirModifierMdp(){
Intent page = new Intent(Information.this, ModifierMdp.class);
startActivity(page);
}
}
| [
"renaux@et.esiea.fr"
] | renaux@et.esiea.fr |
1d360eb24c6e0f7b495e42f4ba45c204a1756f7f | 04a076c6196a9e516a07159f1705ebc890ee9cf6 | /DateTimePicker/src/main/java/com/deange/datetimepicker/TouchExplorationHelper.java | 3afa9c8a487ce27a55991bfacc0348f9e8d440fe | [
"Apache-2.0"
] | permissive | FrankSun82/text-faker | f9758df856c8b6b96a569b9db74c60b02a7691c6 | 417e3a7fae77702bf513450d340e6315411ef547 | refs/heads/master | 2023-05-02T03:26:36.974594 | 2013-08-29T04:02:11 | 2013-08-29T04:02:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,114 | java | /*
* Copyright 2013 Christian De Angelis
*
* 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.deange.datetimepicker;
import android.content.Context;
import android.graphics.Rect;
import android.os.Bundle;
import android.support.v4.view.AccessibilityDelegateCompat;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
import android.support.v4.view.accessibility.AccessibilityNodeProviderCompat;
import android.support.v4.view.accessibility.AccessibilityRecordCompat;
import android.text.TextUtils;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import java.util.LinkedList;
import java.util.List;
public abstract class TouchExplorationHelper<T> extends AccessibilityNodeProviderCompat
implements View.OnHoverListener {
/**
* Virtual node identifier value for invalid nodes.
*/
public static final int INVALID_ID = Integer.MIN_VALUE;
private final Rect mTempScreenRect = new Rect();
private final Rect mTempParentRect = new Rect();
private final Rect mTempVisibleRect = new Rect();
private final int[] mTempGlobalRect = new int[2];
private final AccessibilityManager mManager;
private final AccessibilityDelegateCompat mDelegate = new AccessibilityDelegateCompat() {
@Override
public void onInitializeAccessibilityEvent(View view, AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(view, event);
event.setClassName(view.getClass().getName());
}
@Override
public void onInitializeAccessibilityNodeInfo(View view, AccessibilityNodeInfoCompat info) {
super.onInitializeAccessibilityNodeInfo(view, info);
info.setClassName(view.getClass().getName());
}
@Override
public AccessibilityNodeProviderCompat getAccessibilityNodeProvider(View host) {
return TouchExplorationHelper.this;
}
};
private View mParentView;
private int mFocusedItemId = INVALID_ID;
private T mCurrentItem = null;
/**
* Constructs a new touch exploration helper.
*
* @param context The parent context.
*/
public TouchExplorationHelper(Context context, View parentView) {
mManager = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);
mParentView = parentView;
}
/**
* @return The current accessibility focused item, or {@code null} if no
* item is focused.
*/
public T getFocusedItem() {
return getItemForId(mFocusedItemId);
}
/**
* Requests accessibility focus be placed on the specified item.
*
* @param item The item to place focus on.
*/
public void setFocusedItem(T item) {
final int itemId = getIdForItem(item);
if (itemId == INVALID_ID) {
return;
}
performAction(itemId, AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS, null);
}
/**
* Clears the current accessibility focused item.
*/
public void clearFocusedItem() {
final int itemId = mFocusedItemId;
if (itemId == INVALID_ID) {
return;
}
performAction(itemId, AccessibilityNodeInfoCompat.ACTION_CLEAR_ACCESSIBILITY_FOCUS, null);
}
/**
* Invalidates cached information about the parent view.
* <p>
* You <b>must</b> call this method after adding or removing items from the
* parent view.
* </p>
*/
public void invalidateParent() {
mParentView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
}
/**
* Invalidates cached information for a particular item.
* <p>
* You <b>must</b> call this method when any of the properties set in
* {@link #populateNodeForItem(Object, AccessibilityNodeInfoCompat)} have
* changed.
* </p>
*
* @param item
*/
public void invalidateItem(T item) {
sendEventForItem(item, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
}
/**
* Populates an event of the specified type with information about an item
* and attempts to send it up through the view hierarchy.
*
* @param item The item for which to send an event.
* @param eventType The type of event to send.
* @return {@code true} if the event was sent successfully.
*/
public boolean sendEventForItem(T item, int eventType) {
if (!mManager.isEnabled()) {
return false;
}
final AccessibilityEvent event = getEventForItem(item, eventType);
final ViewGroup group = (ViewGroup) mParentView.getParent();
return group.requestSendAccessibilityEvent(mParentView, event);
}
@Override
public AccessibilityNodeInfoCompat createAccessibilityNodeInfo(int virtualViewId) {
if (virtualViewId == View.NO_ID) {
return getNodeForParent();
}
final T item = getItemForId(virtualViewId);
if (item == null) {
return null;
}
final AccessibilityNodeInfoCompat node = AccessibilityNodeInfoCompat.obtain();
populateNodeForItemInternal(item, node);
return node;
}
@Override
public boolean performAction(int virtualViewId, int action, Bundle arguments) {
if (virtualViewId == View.NO_ID) {
return ViewCompat.performAccessibilityAction(mParentView, action, arguments);
}
final T item = getItemForId(virtualViewId);
if (item == null) {
return false;
}
boolean handled = false;
switch (action) {
case AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS:
if (mFocusedItemId != virtualViewId) {
mFocusedItemId = virtualViewId;
sendEventForItem(item, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED);
handled = true;
}
break;
case AccessibilityNodeInfoCompat.ACTION_CLEAR_ACCESSIBILITY_FOCUS:
if (mFocusedItemId == virtualViewId) {
mFocusedItemId = INVALID_ID;
sendEventForItem(item, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED);
handled = true;
}
break;
}
handled |= performActionForItem(item, action, arguments);
return handled;
}
@Override
public boolean onHover(View view, MotionEvent event) {
if (!mManager.isTouchExplorationEnabled()) {
return false;
}
switch (event.getAction()) {
case MotionEvent.ACTION_HOVER_ENTER:
case MotionEvent.ACTION_HOVER_MOVE:
final T item = getItemAt(event.getX(), event.getY());
setCurrentItem(item);
return true;
case MotionEvent.ACTION_HOVER_EXIT:
setCurrentItem(null);
return true;
}
return false;
}
private void setCurrentItem(T item) {
if (mCurrentItem == item) {
return;
}
if (mCurrentItem != null) {
sendEventForItem(mCurrentItem, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT);
}
mCurrentItem = item;
if (mCurrentItem != null) {
sendEventForItem(mCurrentItem, AccessibilityEvent.TYPE_VIEW_HOVER_ENTER);
}
}
private AccessibilityEvent getEventForItem(T item, int eventType) {
final AccessibilityEvent event = AccessibilityEvent.obtain(eventType);
final AccessibilityRecordCompat record = new AccessibilityRecordCompat(event);
final int virtualDescendantId = getIdForItem(item);
// Ensure the client has good defaults.
event.setEnabled(true);
// Allow the client to populate the event.
populateEventForItem(item, event);
if (event.getText().isEmpty() && TextUtils.isEmpty(event.getContentDescription())) {
throw new RuntimeException("You must add text or a content description in populateEventForItem()");
}
// Don't allow the client to override these properties.
event.setClassName(item.getClass().getName());
event.setPackageName(mParentView.getContext().getPackageName());
record.setSource(mParentView, virtualDescendantId);
return event;
}
private AccessibilityNodeInfoCompat getNodeForParent() {
final AccessibilityNodeInfoCompat info = AccessibilityNodeInfoCompat.obtain(mParentView);
ViewCompat.onInitializeAccessibilityNodeInfo(mParentView, info);
final LinkedList<T> items = new LinkedList<T>();
getVisibleItems(items);
for (T item : items) {
final int virtualDescendantId = getIdForItem(item);
info.addChild(mParentView, virtualDescendantId);
}
return info;
}
private AccessibilityNodeInfoCompat populateNodeForItemInternal(
T item, AccessibilityNodeInfoCompat node) {
final int virtualDescendantId = getIdForItem(item);
// Ensure the client has good defaults.
node.setEnabled(true);
// Allow the client to populate the node.
populateNodeForItem(item, node);
if (TextUtils.isEmpty(node.getText()) && TextUtils.isEmpty(node.getContentDescription())) {
throw new RuntimeException("You must add text or a content description in populateNodeForItem()");
}
// Don't allow the client to override these properties.
node.setPackageName(mParentView.getContext().getPackageName());
node.setClassName(item.getClass().getName());
node.setParent(mParentView);
node.setSource(mParentView, virtualDescendantId);
if (mFocusedItemId == virtualDescendantId) {
node.addAction(AccessibilityNodeInfoCompat.ACTION_CLEAR_ACCESSIBILITY_FOCUS);
} else {
node.addAction(AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS);
}
node.getBoundsInParent(mTempParentRect);
if (mTempParentRect.isEmpty()) {
throw new RuntimeException("You must set parent bounds in populateNodeForItem()");
}
// Set the visibility based on the parent bound.
if (intersectVisibleToUser(mTempParentRect)) {
node.setVisibleToUser(true);
node.setBoundsInParent(mTempParentRect);
}
// Calculate screen-relative bound.
mParentView.getLocationOnScreen(mTempGlobalRect);
final int offsetX = mTempGlobalRect[0];
final int offsetY = mTempGlobalRect[1];
mTempScreenRect.set(mTempParentRect);
mTempScreenRect.offset(offsetX, offsetY);
node.setBoundsInScreen(mTempScreenRect);
return node;
}
/**
* Computes whether the specified {@link android.graphics.Rect} intersects with the visible
* portion of its parent {@link android.view.View}. Modifies {@code localRect} to
* contain only the visible portion.
*
* @param localRect A rectangle in local (parent) coordinates.
* @return Whether the specified {@link android.graphics.Rect} is visible on the screen.
*/
private boolean intersectVisibleToUser(Rect localRect) {
// Missing or empty bounds mean this view is not visible.
if ((localRect == null) || localRect.isEmpty()) {
return false;
}
// Attached to invisible window means this view is not visible.
if (mParentView.getWindowVisibility() != View.VISIBLE) {
return false;
}
// An invisible predecessor or one with alpha zero means
// that this view is not visible to the user.
Object current = this;
while (current instanceof View) {
final View view = (View) current;
// We have attach info so this view is attached and there is no
// need to check whether we reach to ViewRootImpl on the way up.
if ((view.getAlpha() <= 0) || (view.getVisibility() != View.VISIBLE)) {
return false;
}
current = view.getParent();
}
// If no portion of the parent is visible, this view is not visible.
if (!mParentView.getLocalVisibleRect(mTempVisibleRect)) {
return false;
}
// Check if the view intersects the visible portion of the parent.
return localRect.intersect(mTempVisibleRect);
}
public AccessibilityDelegateCompat getAccessibilityDelegate() {
return mDelegate;
}
/**
* Performs an accessibility action on the specified item. See
* {@link AccessibilityNodeInfoCompat#performAction(int, android.os.Bundle)}.
* <p>
* The helper class automatically handles focus management resulting from
* {@link AccessibilityNodeInfoCompat#ACTION_ACCESSIBILITY_FOCUS} and
* {@link AccessibilityNodeInfoCompat#ACTION_CLEAR_ACCESSIBILITY_FOCUS}, so
* typically a developer only needs to handle actions added manually in the
* {{@link #populateNodeForItem(Object, AccessibilityNodeInfoCompat)}
* method.
* </p>
*
* @param item The item on which to perform the action.
* @param action The accessibility action to perform.
* @param arguments Arguments for the action, or optionally {@code null}.
* @return {@code true} if the action was performed successfully.
*/
protected abstract boolean performActionForItem(T item, int action, Bundle arguments);
/**
* Populates an event with information about the specified item.
* <p>
* At a minimum, a developer must populate the event text by doing one of
* the following:
* <ul>
* <li>appending text to {@link android.view.accessibility.AccessibilityEvent#getText()}</li>
* <li>populating a description with
* {@link android.view.accessibility.AccessibilityEvent#setContentDescription(CharSequence)}</li>
* </ul>
* </p>
*
* @param item The item for which to populate the event.
* @param event The event to populate.
*/
protected abstract void populateEventForItem(T item, AccessibilityEvent event);
/**
* Populates a node with information about the specified item.
* <p/>
* At a minimum, a developer must:
* <ul>
* <li>populate the event text using
* {@link AccessibilityNodeInfoCompat#setText(CharSequence)} or
* {@link AccessibilityNodeInfoCompat#setContentDescription(CharSequence)}
* </li>
* <li>set the item's parent-relative bounds using
* {@link AccessibilityNodeInfoCompat#setBoundsInParent(android.graphics.Rect)}
* </ul>
*
* @param item The item for which to populate the node.
* @param node The node to populate.
*/
protected abstract void populateNodeForItem(T item, AccessibilityNodeInfoCompat node);
/**
* Populates a list with the parent view's visible items.
* <p>
* The result of this method is cached until the developer calls
* {@link #invalidateParent()}.
* </p>
*
* @param items The list to populate with visible items.
*/
protected abstract void getVisibleItems(List<T> items);
/**
* Returns the item under the specified parent-relative coordinates.
*
* @param x The parent-relative x coordinate.
* @param y The parent-relative y coordinate.
* @return The item under coordinates (x,y).
*/
protected abstract T getItemAt(float x, float y);
/**
* Returns the unique identifier for an item. If the specified item does not
* exist, returns {@link #INVALID_ID}.
* <p>
* This result of this method must be consistent with
* {@link #getItemForId(int)}.
* </p>
*
* @param item The item whose identifier to return.
* @return A unique identifier, or {@link #INVALID_ID}.
*/
protected abstract int getIdForItem(T item);
/**
* Returns the item for a unique identifier. If the specified item does not
* exist, returns {@code null}.
*
* @param id The identifier for the item to return.
* @return An item, or {@code null}.
*/
protected abstract T getItemForId(int id);
}
| [
"christiand@carezone.com"
] | christiand@carezone.com |
6c693c4f45d1dc63519ce287e4c5a3f1084322fa | 6035e12d596a24f4241052f698fe7d0e0c67df4c | /library/src/main/java/droidkit/graphics/Bitmaps.java | cf029c31db1ec8a41fec48d6036aa32a031bfcb8 | [
"Apache-2.0"
] | permissive | DanielSerdyukov/droidkit-v4x | 7ad409f6744cf0a0c8447c7b6e1a90359ead437c | 076544edbfdd95ebd3c66cf479297424a5df7de9 | refs/heads/master | 2021-01-21T23:29:59.712791 | 2015-07-21T10:04:20 | 2015-07-21T10:04:20 | 25,683,102 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,007 | java | package droidkit.graphics;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader;
import android.media.ExifInterface;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import droidkit.io.IOUtils;
import droidkit.log.Logger;
/**
* @author Daniel Serdyukov
*/
public final class Bitmaps {
private static final int BITMAP_HEAD = 1024;
private static final double LN_2 = Math.log(2);
private Bitmaps() {
}
@NonNull
public static Bitmap scale(@NonNull Bitmap bitmap, int maxSize) {
final float factor = (float) maxSize / Math.max(bitmap.getWidth(), bitmap.getHeight());
final Matrix matrix = new Matrix();
matrix.postScale(factor, factor);
return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, false);
}
@NonNull
public static Bitmap scale(@NonNull Bitmap bitmap, int width, int height) {
return Bitmap.createScaledBitmap(bitmap, width, height, false);
}
@NonNull
public static Bitmap round(@NonNull Bitmap bitmap, float radius) {
final int width = bitmap.getWidth();
final int height = bitmap.getHeight();
final Bitmap output = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
final Canvas canvas = new Canvas(output);
final BitmapShader shader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
final Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setShader(shader);
final RectF rect = new RectF(0.0f, 0.0f, width, height);
canvas.drawRoundRect(rect, radius, radius, paint);
return output;
}
@NonNull
public static Bitmap circle(@NonNull Bitmap bitmap) {
final int size = Math.min(bitmap.getWidth(), bitmap.getHeight());
final Bitmap output = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
final Canvas canvas = new Canvas(output);
final int color = 0xff424242;
final Paint paint = new Paint();
final Rect rect = new Rect(0, 0, size, size);
paint.setAntiAlias(true);
canvas.drawARGB(0, 0, 0, 0);
paint.setColor(color);
final float bounds = (float) size / 2;
canvas.drawCircle(bounds, bounds, bounds, paint);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
canvas.drawBitmap(bitmap, rect, rect, paint);
return output;
}
@Nullable
public static Bitmap decodeFile(@NonNull String filePath, int hwSize) {
return decodeFile(filePath, hwSize, true);
}
@Nullable
public static Bitmap decodeFile(@NonNull String filePath, int hwSize, boolean exif) {
final Bitmap bitmap = decodeFileInternal(filePath, hwSize);
if (bitmap != null && exif) {
return applyExif(bitmap, filePath);
}
return bitmap;
}
@Nullable
public static Bitmap decodeStream(@NonNull InputStream stream, int hwSize) {
return decodeStream(stream, null, hwSize);
}
@Nullable
public static Bitmap decodeStream(@NonNull InputStream stream, Rect outPadding, int hwSize) {
if (hwSize > 0) {
final InputStream localIn = new BufferedInputStream(stream);
try {
final BitmapFactory.Options ops = new BitmapFactory.Options();
ops.inJustDecodeBounds = true;
localIn.mark(BITMAP_HEAD);
BitmapFactory.decodeStream(localIn, outPadding, ops);
ops.inSampleSize = calculateInSampleSize(ops, hwSize);
ops.inJustDecodeBounds = false;
localIn.reset();
return BitmapFactory.decodeStream(localIn, outPadding, ops);
} catch (IOException e) {
Logger.error(e);
} finally {
IOUtils.closeQuietly(localIn);
}
return null;
}
return BitmapFactory.decodeStream(stream);
}
public static int calculateInSampleSize(BitmapFactory.Options ops, int hwSize) {
final int outHeight = ops.outHeight;
final int outWidth = ops.outWidth;
if (outWidth > hwSize || outHeight > hwSize) {
final double ratio = Math.max(
Math.round((double) outWidth / (double) hwSize),
Math.round((double) outHeight / (double) hwSize)
);
return ratio > 0 ? (int) Math.pow(2, Math.floor(Math.log(ratio) / LN_2)) : 1;
}
return 1;
}
@Nullable
private static Bitmap decodeFileInternal(String filePath, int hwSize) {
if (hwSize > 0) {
final BitmapFactory.Options ops = new BitmapFactory.Options();
ops.inJustDecodeBounds = true;
BitmapFactory.decodeFile(filePath, ops);
ops.inSampleSize = calculateInSampleSize(ops, hwSize);
ops.inJustDecodeBounds = false;
return BitmapFactory.decodeFile(filePath, ops);
}
return BitmapFactory.decodeFile(filePath);
}
@Nullable
private static Bitmap applyExif(@NonNull Bitmap bitmap, String exifFilePath) {
final int orientation = getExifOrientation(exifFilePath);
if (orientation == ExifInterface.ORIENTATION_NORMAL
|| orientation == ExifInterface.ORIENTATION_UNDEFINED) {
return bitmap;
}
try {
return Bitmap.createBitmap(
bitmap, 0, 0,
bitmap.getWidth(), bitmap.getHeight(),
getExifMatrix(orientation), true
);
} finally {
bitmap.recycle();
}
}
private static int getExifOrientation(String filePath) {
try {
return new ExifInterface(filePath).getAttributeInt(
ExifInterface.TAG_ORIENTATION,
ExifInterface.ORIENTATION_NORMAL
);
} catch (IOException e) {
Logger.error(e);
}
return ExifInterface.ORIENTATION_UNDEFINED;
}
@NonNull
private static Matrix getExifMatrix(int orientation) {
final Matrix matrix = new Matrix();
if (orientation == ExifInterface.ORIENTATION_ROTATE_180) {
matrix.setRotate(180);
} else if (orientation == ExifInterface.ORIENTATION_ROTATE_90) {
matrix.setRotate(90);
} else if (orientation == ExifInterface.ORIENTATION_ROTATE_270) {
matrix.setRotate(-90);
}
return matrix;
}
}
| [
"dvp.troy@gmail.com"
] | dvp.troy@gmail.com |
c751c456e8615eaef3824bb68fc30f586584c4f8 | 5c87bdfaebf5c5d14c635fc5ec67560df15539fa | /src/controller/SuivreReclamationController.java | 343526300faef5e07c7b2305ad31be5812b52622 | [] | no_license | Dhekra-Ben-Sghaier/e-learning-DesktopVersion | 225ad155980e5f07ab96eda9a8e9e3a2dcb46d7b | be83f76758ee58085551a8533ae533fbc3ee1971 | refs/heads/master | 2023-05-04T15:23:48.977507 | 2021-05-18T22:30:58 | 2021-05-18T22:30:58 | 338,155,351 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,135 | 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 controller;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane;
import service.Operation;
/**
* FXML Controller class
*
* @author asus
*/
public class SuivreReclamationController implements Initializable {
@FXML
private BorderPane bord;
@FXML
private TextField meil;
@FXML
private Button vld;
@FXML
private Label labid;
private int id;
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
}
private void loadPage(String page){
Parent parent = null;
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource(page));
parent = (Parent)loader.load();
SuiviController cont = loader.<SuiviController>getController();
Operation oper=new Operation();
String emailuser=oper.recEmailUser(id);
cont.setEmail(emailuser);
cont.load(emailuser);
} catch (IOException ex) {
Logger.getLogger(SuivreReclamationController.class.getName()).log(Level.SEVERE, null,ex);
}
bord.setCenter(parent);
}
@FXML
private void afficher(ActionEvent event) {
loadPage("/view/suivi.fxml");
}
public void setId(int a){
this.id= a;
labid.setText(""+a);
}
public void setEmail(String a){
meil.setText(a);
}
}
| [
"mariem.benhassine@esprit.tn"
] | mariem.benhassine@esprit.tn |
2d5562db1edf7510626337fce704753b416d4dad | 29af94e28fac9756bd1b919052a3b985ab01a5f4 | /app/src/main/java/ir/aspacrm/my/app/mahanet/events/EventOnGetErrorAddTicket.java | c300bf48353ff70d54ca8eddab0283f76341eb24 | [] | no_license | bnjmr/mahan | ebc1a29c3d2dc7576039be4c29af3b28be3b596f | 57b6ac768c7fd6bde91905a5204776e36d48c3e3 | refs/heads/master | 2021-08-19T08:14:54.040574 | 2017-11-25T10:40:04 | 2017-11-25T10:40:04 | 111,995,353 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 176 | java | package ir.aspacrm.my.app.mahanet.events;
/**
* Created by Microsoft on 3/7/2016.
*/
public class EventOnGetErrorAddTicket {
public EventOnGetErrorAddTicket() {
}
}
| [
"mehrshad.jahanbin@gmail.com"
] | mehrshad.jahanbin@gmail.com |
b7e11034cde6010bcf3be28ab36fff0845412578 | 51552465f145a99aeb7bacfd7801e42ed670762a | /SecureHadoop/src/types/ElgamalCiphertext.java | e8de8956c4215aeb4da406a7c776638876aa8c3f | [] | no_license | ug93tad/secureHadoop | 1a455f04c953213cb1000f988557de79e655eea9 | f49cc02b66284bab1f1b16e5d88130a86dadfe77 | refs/heads/master | 2016-09-05T16:47:29.130318 | 2014-05-28T02:50:36 | 2014-05-28T02:50:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 213 | java | package types;
public class ElgamalCiphertext extends Ciphertext{
public static int ELGAMAL_LENGTH = 192;
public ElgamalCiphertext(){
super();
}
public ElgamalCiphertext(byte[] ct){
super(ct);
}
}
| [
"ug93tad@gmail.com"
] | ug93tad@gmail.com |
2530fd80e203a1ef08075a035361099d1d7bc958 | 529d19083566313188fa9d169383ffa27032bc92 | /BINGOapp/app/src/test/java/com/example/ashu/BINGO/ExampleUnitTest.java | aeb243d025f965153e39e9b73f7d79e3be99d3e2 | [] | no_license | haraprasad7/Bhopal | baa5fa5e9839b5d8866feddab43c2e0f1a9e2827 | f4690168d54a42e65f17a4676701a58ad0cbd76e | refs/heads/master | 2020-09-13T07:15:48.748249 | 2019-11-19T12:40:09 | 2019-11-19T12:40:09 | 222,691,944 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | package com.example.ashu.BINGO;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"noreply@github.com"
] | noreply@github.com |
81cfbb3598e8c3083a2535ddcf50f661f11e50fd | 70cac7e357e14c165d7a7cb03c49619d120f5e60 | /SpringMvcJavaConfig/src/main/java/ct/dc/pc/api/domain/login/HallLoginDomain.java | f59389bdc0ee339cfa4471957c9623d3e5e153d3 | [] | no_license | wahahasssss/SpringMvcTest | 7ba16dd89a596becf88b21a45e8aa87b87e471ab | 619d8cd09b0139ae06e38721682a8a0ae2899040 | refs/heads/master | 2021-08-31T03:37:57.194605 | 2017-12-20T08:26:47 | 2017-12-20T08:26:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,950 | java | package ct.dc.pc.api.domain.login;
import ct.dc.pc.api.dao.hall.interfaces.IHallLoginByDayDao;
import ct.dc.pc.api.dao.hall.interfaces.IHallLoginPerDayDao;
import ct.dc.pc.api.dao.halllogin.interfaces.IHallLoginDetailDao;
import ct.dc.pc.api.enums.StatTypeEnum;
import ct.dc.pc.api.model.domain.hall.HallLoginByDayDo;
import ct.dc.pc.api.model.domain.hall.HallLoginPerDayDo;
import ct.dc.pc.api.model.domain.hall.HallLoginUidTimesDo;
import ct.dc.pc.api.model.po.hall.HallLoginByDayPo;
import ct.dc.pc.api.model.po.hall.HallLoginPerDayPo;
import ct.dc.pc.api.model.po.hall.HallLoginUidTimesPo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;
/**
* Created by B41-80 on 2017/4/6.
*/
@Component
public class HallLoginDomain {
@Autowired
private IHallLoginByDayDao iHallLoginByDayDao;
@Autowired
private IHallLoginPerDayDao iHallLoginPerDayDao;
@Autowired
private IHallLoginDetailDao iHallLoginDetailDao;
/**
* 大厅多日登录信息
* @param group
* @param beginDate
* @param endDate
* @return
*/
public ArrayList<HallLoginByDayDo> listHallLoginByDayInfo(int group,int beginDate,int endDate){
ArrayList<HallLoginByDayDo> results = new ArrayList<HallLoginByDayDo>();
for (HallLoginByDayPo info:iHallLoginByDayDao.findByGroup(group, beginDate, endDate)){
HallLoginByDayDo account = new HallLoginByDayDo();
account.setDate(info.getDate());
account.setTimes(info.getTimes());
account.setType(StatTypeEnum.ACCOUNT.getValue());
account.setUsers1D1(info.getUsers1D1());
account.setUsers3D1(info.getUsers3D1());
account.setUsers7D1(info.getUsers7D1());
account.setUsers14D1(info.getUsers14D1());
account.setUsers30D1(info.getUsers30D1());
HallLoginByDayDo hard = new HallLoginByDayDo();
hard.setDate(info.getDate());
hard.setTimes(info.getTimes());
hard.setType(StatTypeEnum.HARD.getValue());
hard.setUsers1D1(info.getHards1D1());
hard.setUsers3D1(info.getHards3D1());
hard.setUsers7D1(info.getHards7D1());
hard.setUsers14D1(info.getHards14D1());
hard.setUsers30D1(info.getHards30D1());
results.add(account);
results.add(hard);
}
return results;
}
/**
* 大厅单日登录信息
* @param group
* @param date
* @return
*/
public ArrayList<HallLoginPerDayDo> listHallLoginPerDayInfo(int group,int date){
ArrayList<HallLoginPerDayDo> results = new ArrayList<HallLoginPerDayDo>();
for (HallLoginPerDayPo info:iHallLoginPerDayDao.findByGroup(group,date)){
HallLoginPerDayDo result = new HallLoginPerDayDo();
result.setTrange(info.getTrange());
result.setUsers(info.getUsers());
result.setHards(info.getHards());
result.setTimes(info.getTimes());
results.add(result);
}
return results;
}
/**
* 获取指定大厅达到指定最少次数的用户ID
* @param group
* @param date
* @param mingTimes
* @return
*/
public ArrayList<HallLoginUidTimesDo> listHallLoginTimes(int group,int date,int mingTimes){
ArrayList<HallLoginUidTimesDo> results= new ArrayList<HallLoginUidTimesDo>();
for (HallLoginUidTimesPo info:iHallLoginDetailDao.listLoginTimesInfo(date, group)){
if (info.getTimes()>mingTimes){
HallLoginUidTimesDo result = new HallLoginUidTimesDo();
result.setTimes(info.getTimes());
result.setUid(info.getUid());
results.add(result);
}
}
return results;
}
}
| [
"zhangzhengdi@foxmail.com"
] | zhangzhengdi@foxmail.com |
592dd6dfbd7af8392bdb945e4a0405ea113673a6 | 9369208a8217b614e3cc248378034a324d168920 | /minecraft_server/net/minecraft/world/WorldProviderHell.java | b039b66ce4380a73125e12a0a553eead6baf2601 | [] | no_license | cangyun/MCP | 6efc67cbf58784a9d8086dbfbcddaa185053288e | 566ca99173653f859f5e18744528282fac8b7b84 | refs/heads/master | 2020-06-11T14:49:51.529741 | 2019-06-27T01:42:25 | 2019-06-27T01:42:25 | 194,003,022 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,353 | java | package net.minecraft.world;
import net.minecraft.init.Biomes;
import net.minecraft.world.biome.BiomeProviderSingle;
import net.minecraft.world.border.WorldBorder;
import net.minecraft.world.gen.ChunkGeneratorHell;
import net.minecraft.world.gen.IChunkGenerator;
public class WorldProviderHell extends WorldProvider
{
/**
* creates a new world chunk manager for WorldProvider
*/
public void createBiomeProvider()
{
this.biomeProvider = new BiomeProviderSingle(Biomes.HELL);
this.isHellWorld = true;
this.hasNoSky = true;
}
/**
* Creates the light to brightness table
*/
protected void generateLightBrightnessTable()
{
float f = 0.1F;
for (int i = 0; i <= 15; ++i)
{
float f1 = 1.0F - (float)i / 15.0F;
this.lightBrightnessTable[i] = (1.0F - f1) / (f1 * 3.0F + 1.0F) * 0.9F + 0.1F;
}
}
public IChunkGenerator createChunkGenerator()
{
return new ChunkGeneratorHell(this.worldObj, this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.worldObj.getSeed());
}
/**
* Returns 'true' if in the "main surface world", but 'false' if in the Nether or End dimensions.
*/
public boolean isSurfaceWorld()
{
return false;
}
/**
* Will check if the x, z position specified is alright to be set as the map spawn point
*/
public boolean canCoordinateBeSpawn(int x, int z)
{
return false;
}
/**
* Calculates the angle of sun and moon in the sky relative to a specified time (usually worldTime)
*/
public float calculateCelestialAngle(long worldTime, float partialTicks)
{
return 0.5F;
}
/**
* True if the player can respawn in this dimension (true = overworld, false = nether).
*/
public boolean canRespawnHere()
{
return false;
}
public WorldBorder createWorldBorder()
{
return new WorldBorder()
{
public double getCenterX()
{
return super.getCenterX() / 8.0D;
}
public double getCenterZ()
{
return super.getCenterZ() / 8.0D;
}
};
}
public DimensionType getDimensionType()
{
return DimensionType.NETHER;
}
}
| [
"335967703@qq.com"
] | 335967703@qq.com |
1ea2080496f47f1be788ec7d7a3e8814d5388fba | 607688db68ccf1f06b52355b6157aa3b1cf9466b | /Spring/LoginSpingApp/src/com/zensar/login/LoginController.java | 858ab1338b65e61dfeca12f2377bcbc3b8001067 | [] | no_license | Vaidikk/Vadk | 7bdd1b65cf8df9ddfe8b2e1b7caffa00202f03be | d517e635df5ade215e3ed1d2174f743abf223bf7 | refs/heads/master | 2022-12-23T03:58:57.838425 | 2019-08-14T05:32:18 | 2019-08-14T05:32:18 | 202,281,175 | 0 | 0 | null | 2022-12-16T00:38:05 | 2019-08-14T05:31:13 | Java | UTF-8 | Java | false | false | 537 | java | package com.zensar.login;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PostMapping;
@Controller
public class LoginController {
@PostMapping("/valid")
public String validate(User user, ModelMap map) {
if(user.getUsername().equals("tiny") && user.getPassword().equals("chiggi")) {
map.addAttribute("user", user);
return "success";
}
else {
map.addAttribute("loginerror", "Invalid Credentials");
return "login";
}
}
}
| [
"vedik.khandelwal@gmail.com"
] | vedik.khandelwal@gmail.com |
69ca8d78653e8acc47342dc5ae225d06c8d63cf8 | 69de1eec7737eb0a963cc535c21759cf3d26bcdc | /Week_11/redis-lock/src/main/java/com/example/redis/demo/lock/RedisLock.java | 0f20ee57c490aa34515fa97f9d4aaa1abbca88e1 | [] | no_license | samami2015/JAVA-000 | 8284e3a7a471ac8bb62343bf445cfe273335abed | 95bd952b25990cc8419c2f9029fb11cc88e8f698 | refs/heads/main | 2023-03-03T19:43:06.294494 | 2021-02-06T15:22:41 | 2021-02-06T15:22:41 | 303,915,083 | 0 | 0 | null | 2021-02-02T14:24:12 | 2020-10-14T05:48:05 | Java | UTF-8 | Java | false | false | 2,279 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.redis.demo.lock;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import java.util.Collections;
/**
* Redis 分布式锁
*
* @author wangsen
*/
public class RedisLock {
private enum EnumSingleton {
/**
* 懒汉枚举单例
*/
INSTANCE;
private RedisLock instance;
EnumSingleton(){
instance = new RedisLock();
}
public RedisLock getSingleton(){
return instance;
}
}
public static RedisLock getInstance(){
return EnumSingleton.INSTANCE.getSingleton();
}
private JedisPool jedisPool = new JedisPool();
/**
* 进行加锁
* @param lockValue lock value
* @param seconds expire time
* @return get lock
*/
public boolean lock(String lockValue, int seconds) {
try(Jedis jedis = jedisPool.getResource()) {
return "OK".equals(jedis.set(lockValue, lockValue, "NX", "EX", seconds));
}
}
/**
* 释放锁
* @param lock lock value
* @return release lock
*/
public boolean release(String lock) {
String luaScript = "if redis.call('get',KEYS[1]) == ARGV[1] then " + "return redis.call('del',KEYS[1]) else return 0 end";
try(Jedis jedis = jedisPool.getResource()) {
return jedis.eval(luaScript, Collections.singletonList(lock), Collections.singletonList(lock)).equals(1L);
}
}
}
| [
"22232647@qq.com"
] | 22232647@qq.com |
46b99c9fe9e730746c7fa53eeaf3842d2156c83a | 80bc317fecfc1b8b0acd9b3e1c4b3329fa6741ac | /hr-api-gateway-zuul/src/main/java/br/net/mfs/hrapigatewayzuul/config/ResourceServerConfig.java | 3641b71946921f5b23425d5dc03d67ace3654d6a | [] | no_license | mfelicianosousa/ms-course | 9faa7eed5ee418635431f8a125c641b81689a7e9 | fac6a28571c2da40ad9a153e8e8642f65020b3f9 | refs/heads/main | 2023-03-25T02:20:07.894294 | 2021-03-18T00:21:01 | 2021-03-18T00:21:01 | 346,914,916 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,525 | java | package br.net.mfs.hrapigatewayzuul.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer;
import org.springframework.security.oauth2.provider.token.store.JwtTokenStore;
@Configuration
@EnableResourceServer
public class ResourceServerConfig extends ResourceServerConfigurerAdapter{
private static final String[] PUBLIC = {"/hr-oauth/oauth/token"} ;
private static final String[] OPERATOR = {"/hr-worker/**" } ;
private static final String[] ADMIN = {"/hr-worker/**","/hr-payroll/**","/hr=user/**"} ;
@Autowired
private JwtTokenStore tokenStore ;
@Override
public void configure(ResourceServerSecurityConfigurer resources) throws Exception {
resources.tokenStore( tokenStore );
}
@Override
public void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers(PUBLIC).permitAll()
.antMatchers( HttpMethod.GET , OPERATOR ).hasAnyRole("OPERATOR","ADMIN")
.antMatchers(ADMIN).hasRole("ADMIN")
.anyRequest().authenticated() ;
}
}
| [
"marcelino.feliciano@hotmail.com"
] | marcelino.feliciano@hotmail.com |
50302eaa94651bddeb7da993254f97d9dd17cae8 | 27f0472c4b53f83709153ada8bbf2f4039dd906a | /templates/android/app/src/main/java/in/srain/demos/iconfont/IconfyStyleActivity.java | a529acd3821f0558684b9fdba240108a8df77797 | [
"MIT"
] | permissive | lza93/icon-font-for-multiple-platforms | c69668f6cab944dbe7413469ad2d12a9f6eb39da | a955f66b8bd0396081798c949c3fc2780240c558 | refs/heads/master | 2021-01-19T00:21:34.985511 | 2017-04-04T08:05:04 | 2017-04-04T08:05:04 | 87,161,619 | 0 | 0 | null | 2017-04-04T08:00:35 | 2017-04-04T08:00:35 | null | UTF-8 | Java | false | false | 1,036 | java | package in.srain.demos.iconfont;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.widget.TextView;
import in.srain.demos.iconfont.iconfy.IconFontIcons;
import java.util.ArrayList;
import java.util.List;
public class IconfyStyleActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_iconfy_style);
setTitle(R.string.title_iconfy_style);
TextView iconTextView = (TextView) findViewById(R.id.text_view);
List<String> stringList = new ArrayList<>();
/* generated code begin */{% for glyph in glyphs %}
stringList.add(IconFontIcons.{{ glyph.name_no_dash }}.key());{% endfor %}
/* generated code end */
// $text will be like: {gems-logo} {android} {heart}
String text = "{" + TextUtils.join("} {", stringList) + "}";
iconTextView.setText(text);
}
}
| [
"liaohuqiu@gmail.com"
] | liaohuqiu@gmail.com |
1a1f5dbdc7187b87cbcca643d3ae49627354f52e | 065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be | /eclipseswt_cluster/18159/tar_0.java | 81f8a29034c6d0a4ed3eab71bf1374b3df820c75 | [] | no_license | martinezmatias/GenPat-data-C3 | 63cfe27efee2946831139747e6c20cf952f1d6f6 | b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4 | refs/heads/master | 2022-04-25T17:59:03.905613 | 2020-04-15T14:41:34 | 2020-04-15T14:41:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,478 | java | package org.eclipse.swt.widgets;
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved
*/
import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.photon.*;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
/**
* Instances of this class represent a non-selectable
* user interface object that displays a string or image.
* When SEPARATOR is specified, displays a single
* vertical or horizontal line.
* <dl>
* <dt><b>Styles:</b></dt>
* <dd>SEPARATOR, HORIZONTAL, SHADOW_IN, SHADOW_OUT, VERTICAL</dd>
* <dd>CENTER, LEFT, RIGHT, WRAP</dd>
* <dt><b>Events:</b></dt>
* <dd>(none)</dd>
* </dl>
* <p>
* IMPORTANT: This class is intended to be subclassed <em>only</em>
* within the SWT implementation.
* </p>
*/
public class Label extends Control {
String text = "";
Image image;
/**
* Constructs a new instance of this class given its parent
* and a style value describing its behavior and appearance.
* <p>
* The style value is either one of the style constants defined in
* class <code>SWT</code> which is applicable to instances of this
* class, or must be built by <em>bitwise OR</em>'ing together
* (that is, using the <code>int</code> "|" operator) two or more
* of those <code>SWT</code> style constants. The class description
* for all SWT widget classes should include a comment which
* describes the style constants which are applicable to the class.
* </p>
*
* @param parent a composite control which will be the parent of the new instance (cannot be null)
* @param style the style of control to construct
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
* <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
* </ul>
*
* @see SWT
* @see Widget#checkSubclass
* @see Widget#getStyle
*/
public Label (Composite parent, int style) {
super (parent, checkStyle (style));
}
static int checkStyle (int style) {
if ((style & SWT.SEPARATOR) != 0) return style;
return checkBits (style, SWT.LEFT, SWT.CENTER, SWT.RIGHT, 0, 0, 0);
}
public Point computeSize (int wHint, int hHint, boolean changed) {
checkWidget();
if ((style & SWT.SEPARATOR) != 0) {
int border = getBorderWidth ();
int width = border * 2, height = border * 2;
if ((style & SWT.HORIZONTAL) != 0) {
width += DEFAULT_WIDTH; height += 3;
} else {
width += 3; height += DEFAULT_HEIGHT;
}
if (wHint != SWT.DEFAULT) width = wHint + (border * 2);
if (hHint != SWT.DEFAULT) height = hHint + (border * 2);
return new Point (width, height);
}
if ((style & SWT.WRAP) != 0) {
int [] args = {
OS.Pt_ARG_LABEL_TYPE, 0, 0, // 1
OS.Pt_ARG_TEXT_FONT, 0, 0, // 4
OS.Pt_ARG_LINE_SPACING, 0, 0, // 7
OS.Pt_ARG_MARGIN_WIDTH, 0, 0, // 10
OS.Pt_ARG_MARGIN_HEIGHT, 0, 0, // 13
OS.Pt_ARG_MARGIN_LEFT, 0, 0, // 16
OS.Pt_ARG_MARGIN_RIGHT, 0, 0, // 19
OS.Pt_ARG_MARGIN_TOP, 0, 0, // 22
OS.Pt_ARG_MARGIN_BOTTOM, 0, 0, // 25
};
OS.PtGetResources (handle, args.length / 3, args);
/* If we are wrapping text, calculate the height based on wHint. */
if (args [1] == OS.Pt_Z_STRING) {
int length = OS.strlen (args [4]);
byte [] font = new byte [length + 1];
OS.memmove (font, args [4], length);
String string = text;
if (wHint != SWT.DEFAULT) {
Display display = getDisplay ();
string = display.wrapText (text, font, wHint);
}
int width = wHint, height = hHint;
if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) {
byte [] buffer = Converter.wcsToMbcs (null, string, false);
PhRect_t rect = new PhRect_t ();
OS.PgExtentMultiText (rect, null, font, buffer, buffer.length, args [7]);
if (wHint == SWT.DEFAULT) width = rect.lr_x - rect.ul_x + 1;
if (hHint == SWT.DEFAULT) height = rect.lr_y - rect.ul_y + 1;
}
PhArea_t area = new PhArea_t ();
PhRect_t rect = new PhRect_t ();
OS.PtSetAreaFromWidgetCanvas (handle, rect, area);
width += (area.size_w - 1) + (args [10] * 2) + args [16] + args [19];
height += (area.size_h - 1) + (args [13] * 2) + args [22] + args [25];
return new Point (width, height);
}
}
PhDim_t dim = new PhDim_t();
if (!OS.PtWidgetIsRealized (handle)) OS.PtExtentWidget (handle);
OS.PtWidgetPreferredSize(handle, dim);
int width = dim.w, height = dim.h;
if (wHint != SWT.DEFAULT || hHint != SWT.DEFAULT) {
int [] args = {
OS.Pt_ARG_MARGIN_WIDTH, 0, 0, // 1
OS.Pt_ARG_MARGIN_HEIGHT, 0, 0, // 4
OS.Pt_ARG_MARGIN_LEFT, 0, 0, // 7
OS.Pt_ARG_MARGIN_RIGHT, 0, 0, // 10
OS.Pt_ARG_MARGIN_TOP, 0, 0, // 13
OS.Pt_ARG_MARGIN_BOTTOM, 0, 0, // 16
};
OS.PtGetResources (handle, args.length / 3, args);
PhRect_t rect = new PhRect_t ();
PhArea_t area = new PhArea_t ();
rect.lr_x = (short) (wHint - 1);
rect.lr_y = (short) (hHint - 1);
OS.PtSetAreaFromWidgetCanvas (handle, rect, area);
if (wHint != SWT.DEFAULT) {
width = area.size_w + (args [1] * 2) + args [7] + args [10];
}
if (hHint != SWT.DEFAULT) {
height = area.size_h + (args [4] * 2) + args [13] + args [16];
}
}
return new Point (width, height);
}
void createHandle (int index) {
state |= HANDLE;
Display display = getDisplay ();
int parentHandle = parent.handle;
if ((style & SWT.SEPARATOR) != 0) {
int clazz = display.PtSeparator;
int orientation = (style & SWT.HORIZONTAL) != 0 ? OS.Pt_SEP_HORIZONTAL : OS.Pt_SEP_VERTICAL;
int type = OS.Pt_ETCHED_IN;
if ((style & (SWT.SHADOW_OUT)) != 0) type = OS.Pt_ETCHED_OUT;
int [] args = {
OS.Pt_ARG_SEP_FLAGS, orientation, OS.Pt_SEP_VERTICAL | OS.Pt_SEP_HORIZONTAL,
OS.Pt_ARG_SEP_TYPE, type, 0,
OS.Pt_ARG_FILL_COLOR, display.WIDGET_BACKGROUND, 0,
OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
};
handle = OS.PtCreateWidget (clazz, parentHandle, args.length / 3, args);
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
return;
}
int clazz = display.PtLabel;
int alignment = OS.Pt_LEFT;
if ((style & SWT.CENTER) != 0) alignment = OS.Pt_CENTER;
if ((style & SWT.RIGHT) != 0) alignment = OS.Pt_RIGHT;
int verticalAlign = (style & SWT.WRAP) != 0 ? OS.Pt_TOP : OS.Pt_CENTER;
boolean hasBorder = (style & SWT.BORDER) != 0;
int [] args = {
OS.Pt_ARG_FLAGS, hasBorder ? OS.Pt_HIGHLIGHTED : 0, OS.Pt_HIGHLIGHTED,
OS.Pt_ARG_HORIZONTAL_ALIGNMENT, alignment, 0,
OS.Pt_ARG_VERTICAL_ALIGNMENT, verticalAlign, 0,
OS.Pt_ARG_FILL_COLOR, display.WIDGET_BACKGROUND, 0,
OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
};
handle = OS.PtCreateWidget (clazz, parentHandle, args.length / 3, args);
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
}
/**
* Returns a value which describes the position of the
* text or image in the receiver. The value will be one of
* <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>
* unless the receiver is a <code>SEPARATOR</code> label, in
* which case, <code>NONE</code> is returned.
*
* @return the alignment
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int getAlignment () {
checkWidget();
if ((style & SWT.SEPARATOR) != 0) return 0;
if ((style & SWT.LEFT) != 0) return SWT.LEFT;
if ((style & SWT.CENTER) != 0) return SWT.CENTER;
if ((style & SWT.RIGHT) != 0) return SWT.RIGHT;
return SWT.LEFT;
}
/**
* Returns the receiver's image if it has one, or null
* if it does not.
*
* @return the receiver's image
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public Image getImage () {
checkWidget();
return image;
}
String getNameText () {
return getText ();
}
/**
* Returns the receiver's text, which will be an empty
* string if it has never been set or if the receiver is
* a <code>SEPARATOR</code> label.
*
* @return the receiver's text
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public String getText () {
checkWidget();
if ((style & SWT.SEPARATOR) != 0) return "";
return text;
}
int processPaint (int damage) {
int clazz = OS.PtLabel ();
if ((style & SWT.SEPARATOR) != 0) clazz = OS.PtSeparator ();
OS.PtSuperClassDraw (clazz, handle, damage);
return super.processPaint (damage);
}
int processActivate (int info) {
Composite control = this.parent;
while (control != null) {
Control [] children = control._getChildren ();
int index = 0;
while (index < children.length) {
if (children [index] == this) break;
index++;
}
index++;
if (index < children.length) {
if (children [index].setFocus ()) return OS.Pt_CONTINUE;
}
control = control.parent;
}
return OS.Pt_CONTINUE;
}
void releaseWidget () {
super.releaseWidget ();
image = null;
text = null;
}
/**
* Controls how text and images will be displayed in the receiver.
* The argument should be one of <code>LEFT</code>, <code>RIGHT</code>
* or <code>CENTER</code>. If the receiver is a <code>SEPARATOR</code>
* label, the argument is ignored and the alignment is not changed.
*
* @param alignment the new alignment
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setAlignment (int alignment) {
checkWidget();
if ((style & SWT.SEPARATOR) != 0) return;
if ((alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER)) == 0) return;
style &= ~(SWT.LEFT | SWT.RIGHT | SWT.CENTER);
style |= alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
int align = OS.Pt_LEFT;
if ((style & SWT.CENTER) != 0) align = OS.Pt_CENTER;
if ((style & SWT.RIGHT) != 0) align = OS.Pt_RIGHT;
OS.PtSetResource (handle, OS.Pt_ARG_HORIZONTAL_ALIGNMENT, align, 0);
}
boolean setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
boolean changed = super.setBounds (x, y, width, height, move, resize);
if (changed && resize && (style & SWT.WRAP) != 0) setText (text);
return changed;
}
public boolean setFocus () {
checkWidget();
return false;
}
public void setFont (Font font) {
super.setFont (font);
if ((style & SWT.WRAP) != 0) setText (text);
}
/**
* Sets the receiver's image to the argument, which may be
* null indicating that no image should be displayed.
*
* @param image the image to display on the receiver (may be null)
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setImage (Image image) {
checkWidget();
if ((style & SWT.SEPARATOR) != 0) return;
this.image = image;
int imageHandle = 0;
if (image != null) {
if (image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
imageHandle = copyPhImage (image.handle);
}
int [] args = {
OS.Pt_ARG_LABEL_IMAGE, imageHandle, 0,
OS.Pt_ARG_LABEL_TYPE, OS.Pt_IMAGE, 0
};
OS.PtSetResources (handle, args.length / 3, args);
if (imageHandle != 0) OS.free (imageHandle);
}
/**
* Sets the receiver's text.
* <p>
* This method sets the widget label. The label may include
* the mnemonic characters and line delimiters.
* </p>
*
* @param string the new text
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the text is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setText (String string) {
checkWidget();
if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
if ((style & SWT.SEPARATOR) != 0) return;
text = string;
char [] unicode = new char [string.length ()];
string.getChars (0, unicode.length, unicode, 0);
int i=0, j=0;
char mnemonic=0;
while (i < unicode.length) {
if ((unicode [j++] = unicode [i++]) == Mnemonic) {
if (i == unicode.length) {continue;}
if (unicode [i] == Mnemonic) {i++; continue;}
if (mnemonic == 0) mnemonic = unicode [i];
j--;
}
}
while (j < unicode.length) unicode [j++] = 0;
/* Wrap the text if necessary, and convert to mbcs. */
byte [] buffer;
if ((style & SWT.WRAP) != 0) {
int [] args = {
OS.Pt_ARG_TEXT_FONT, 0, 0, // 1
OS.Pt_ARG_WIDTH, 0, 0, // 4
OS.Pt_ARG_MARGIN_WIDTH, 0, 0, // 7
OS.Pt_ARG_MARGIN_LEFT, 0, 0, // 10
OS.Pt_ARG_MARGIN_RIGHT, 0, 0, // 13
};
OS.PtGetResources (handle, args.length / 3, args);
int length = OS.strlen (args [1]);
byte [] font = new byte [length + 1];
OS.memmove (font, args [1], length);
int border = 0;
if ((style & SWT.BORDER) != 0) border = 2;
int width = args [4];
width -= (args [7] * 2) + args [10] + args [13] + border * 2;
Display display = getDisplay ();
if (mnemonic != '\0') string = new String (unicode);
string = display.wrapText (string, font, width);
buffer = Converter.wcsToMbcs (null, string, true);
} else {
buffer = Converter.wcsToMbcs (null, unicode, true);
}
int ptr = OS.malloc (buffer.length);
OS.memmove (ptr, buffer, buffer.length);
int ptr2 = 0;
if (mnemonic != 0) {
byte [] buffer2 = Converter.wcsToMbcs (null, new char []{mnemonic}, true);
ptr2 = OS.malloc (buffer2.length);
OS.memmove (ptr2, buffer2, buffer2.length);
}
replaceMnemonic (mnemonic, true, true);
int [] args = {
OS.Pt_ARG_TEXT_STRING, ptr, 0,
OS.Pt_ARG_LABEL_TYPE, OS.Pt_Z_STRING, 0,
OS.Pt_ARG_ACCEL_KEY, ptr2, 0,
};
OS.PtSetResources (handle, args.length / 3, args);
OS.free (ptr);
OS.free (ptr2);
}
}
| [
"375833274@qq.com"
] | 375833274@qq.com |
9e4b4deff647bfec28c4e17a3d9c6bca5eb6dd31 | 78791f946ff6c208266d01bcbe36e83a0e14dad8 | /src/main/java/com/mimi/cgims/dao/hibernateImpl/RoleDao.java | f77e1227b918ca7c91714417e31698cd8a89e1ad | [] | no_license | npmcdn-to-unpkg-bot/cgims | 04b78c2fd56faefb9c50588c12e1d2bdff9c43ef | 2d1e10c9cb1f1c4df1a4c45d98b3eec8923b4551 | refs/heads/master | 2021-01-22T17:13:51.624217 | 2016-09-02T15:39:04 | 2016-09-02T15:39:04 | 67,387,907 | 0 | 0 | null | 2016-09-05T04:26:09 | 2016-09-05T04:26:09 | null | UTF-8 | Java | false | false | 3,300 | java | package com.mimi.cgims.dao.hibernateImpl;
import com.mimi.cgims.Constants;
import com.mimi.cgims.dao.IRoleDao;
import com.mimi.cgims.model.RoleModel;
import com.mimi.cgims.util.DaoUtil;
import org.apache.commons.lang.StringUtils;
import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.List;
@Repository
public class RoleDao extends BaseDao<RoleModel, String>
implements IRoleDao {
@Override
public List<RoleModel> list(String userId, String searchKeyword, int targetPage, int pageSize) {
Criteria criteria = getCriteria();
setParams(criteria, userId, searchKeyword);
List<RoleModel> roles = list(criteria, targetPage, pageSize);
DaoUtil.cleanLazyDataRoles(roles);
return roles;
}
@Override
public int count(String userId, String searchKeyword) {
Criteria criteria = getCriteria();
setParams(criteria, userId, searchKeyword);
return count(criteria);
}
@Override
public RoleModel getByName(String name) {
Criteria criteria = getCriteria();
criteria.add(Restrictions.eq("name",name));
criteria.setMaxResults(1);
List<RoleModel> list = criteria.list();
if(list==null || list.isEmpty()){
return null;
}
return list.get(0);
}
private void setParams(Criteria criteria, String userId, String searchKeyword) {
if (StringUtils.isNotBlank(userId)) {
criteria.createAlias("users", "u")
.add(Restrictions.eq("u.id", userId));
}
// if (StringUtils.isNotBlank(searchKeyword)) {
// criteria.add(Restrictions.like("name", "%" + searchKeyword + "%"));
// }
if (StringUtils.isNotBlank(searchKeyword)) {
String[] words = searchKeyword.split(Constants.SPLIT_STRING_KEYWORD);
for(String word:words){
if(StringUtils.isNotBlank(word)){
criteria.add(Restrictions.like("name", "%" + word.trim() + "%"));
}
}
// criteria.add(Restrictions.or(Restrictions.like("loginName", "%" + searchKeyword + "%"),Restrictions.like("name", "%" + searchKeyword + "%")));
}
}
// @Override
// public List<RoleModel> list(String searchKeyword, int targetPage, int pageSize) {
// String hql = HQL_LIST_ALL + appendSql(searchKeyword);
// return list(hql, targetPage, pageSize, buildParams(searchKeyword).toArray());
// }
//
// @Override
// public int count(String searchKeyword) {
// String hql = HQL_COUNT_ALL + appendSql(searchKeyword);
// return count(hql, buildParams(searchKeyword).toArray());
// }
//
// private String appendSql(String searchKeyword) {
// String sql = "";
// if (StringUtils.isNotBlank(searchKeyword)) {
// sql = appendSql(sql, "name", "like", "?");
// }
// return sql;
// }
//
// private List<Object> buildParams(String searchKeyword) {
// List<Object> list = new ArrayList<>();
// if (StringUtils.isNotBlank(searchKeyword)) {
// list.add("%"+searchKeyword+"%");
// }
// return list;
// }
}
| [
"252443043@qq.com"
] | 252443043@qq.com |
926698a8f431e885fdb4ba1eeee4ff385e57d15e | f1c52bbcaad8dffa02aa867653b82cad3657f430 | /src/java/org/apache/cassandra/tools/nodetool/GetDefaultKeyspaceRF.java | 0ba7d37874139355357ec509f270ebe235841064 | [
"Apache-2.0",
"MIT",
"CC0-1.0",
"BSD-3-Clause",
"LicenseRef-scancode-public-domain"
] | permissive | apache/cassandra | eb81e98f2d0db853abecdbfcd30750808dde80ad | b966f6af112331a4d01b6be2818e4e5b09245880 | refs/heads/trunk | 2023-09-05T11:57:07.865593 | 2023-09-04T14:59:50 | 2023-09-04T15:23:43 | 206,424 | 7,798 | 5,558 | Apache-2.0 | 2023-09-14T15:52:22 | 2009-05-21T02:10:09 | Java | UTF-8 | Java | false | false | 1,273 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.cassandra.tools.nodetool;
import io.airlift.airline.Command;
import org.apache.cassandra.tools.NodeProbe;
import org.apache.cassandra.tools.NodeTool;
@Command(name = "getdefaultrf", description = "Gets default keyspace replication factor.")
public class GetDefaultKeyspaceRF extends NodeTool.NodeToolCmd
{
protected void execute(NodeProbe probe)
{
probe.output().out.println(probe.getDefaultKeyspaceReplicationFactor());
}
}
| [
"smiklosovic@apache.org"
] | smiklosovic@apache.org |
a3d5bfc4281b7e507b29cc3f6cfdc250d9978b1b | f6899a2cf1c10a724632bbb2ccffb7283c77a5ff | /glassfish-3.0/common/amx-core/src/main/java/org/glassfish/admin/amx/util/FeatureAvailability.java | bf2b5536404a20ba473135bb8483ef3b8d684d89 | [] | no_license | Appdynamics/OSS | a8903058e29f4783e34119a4d87639f508a63692 | 1e112f8854a25b3ecf337cad6eccf7c85e732525 | refs/heads/master | 2023-07-22T03:34:54.770481 | 2021-10-28T07:01:57 | 2021-10-28T07:01:57 | 19,390,624 | 2 | 13 | null | 2023-07-08T02:26:33 | 2014-05-02T22:42:20 | null | UTF-8 | Java | false | false | 11,974 | java | /*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
* or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package org.glassfish.admin.amx.util;
import org.glassfish.admin.amx.util.ExceptionUtil;
import javax.management.MBeanServer;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
/**
Central registry of available features for fine-grained dependency enforcement in a
threaded environment.
<p>
Providers of features can register the availability (initializated and ready-to-use)
of a particular feature, upon which other code depends. See {@link #registerFeature}.
<p>
Code that requires an initialized and ready-to-use feature should call
{@link #waitForFeature}--the calling thread will block until that feature is available.
<p>
Feature names are arbitrary and *should not* be defined as 'public static final String' in this
class unless they are of general system interest. Features that are <i>not</i> of general interest
can and should still be registered through this mechanism,
but the names of those features and the associated data can be defined in a more appropriate place.
<p>
<b>Provider Example</b><br>
<pre>
...provider runs in its own thread...
FeatureAvailability.registerFeature( FeatureAvailability.MBEAN_SERVER_FEATURE, mbeanServer );
</pre><p>
<b>Client Example</b><br>
(arbitrary number of clients, multiple calls OK)</br>
<pre>
...client runs until feature is needed...
final MBeanServer mbeanServer = (MBeanServer)
FeatureAvailability.waitForFeature( FeatureAvailability.MBEAN_SERVER_FEATURE );
</pre>
<p>
To see how long client code is blocking, set the {@link #DEBUG_ENABLED} flag to true.
*/
public final class FeatureAvailability
{
static private final FeatureAvailability INSTANCE = new FeatureAvailability();
private final Map<String, Object> mFeatures;
private final Map<String, CountDownLatch> mLatches;
// private final AMXDebugHelper mDebug;
/** feature stating that the AdminContext is available. Result data is the AdminContext */
//public static final String ADMIN_CONTEXT_FEATURE = "AdminContext";
/** feature stating that the MBeanServer is available. Result data is the MBeanServer */
//public static final String MBEAN_SERVER_FEATURE = "MBeanServer";
/** feature stating that the SunoneInterceptor is active. Associated data should be ignored. */
//public static final String SUN_ONE_INTERCEPTOR_FEATURE = "SunoneInterceptor";
/** feature stating that the com.sun.appserv:category=config MBeans are available.
Result data should not be used */
//public static final String COM_SUN_APPSERV_CONFIG_MBEANS_FEATURE = "com.sun.appserv:category=config";
/** feature stating that the AMX MBean Loader is available (but not AMX). Data should not be used */
public static final String AMX_LOADER_FEATURE = "AMXLoader";
/** feature stating that the AMX BootUtil class is available. Data should not be used */
//public static final String AMX_BOOT_UTIL_FEATURE = "AMXBootUtil";
/** feature stating that the AMX core is ready for use after having been started. Data should not be used.
Other AMX subystems might still be in the process of initializing */
public static final String AMX_CORE_READY_FEATURE = "AMXCoreReady";
/** feature stating that the AMX and all its subsystems are ready for use. Data is the ObjectName of the DomainRoot */
public static final String AMX_READY_FEATURE = "AMXReady";
/** feature stating that the CallFlow feature is available. Data should not be used
Data is of type com.sun.enterprise.admin.monitor.callflow.Agent */
//public static final String CALL_FLOW_FEATURE = "CallFlow";
/** Feature stating that the server has started, meaning that the main initialization
code has been run; specific features could be initializing on separate threads, or
could be initialized lazily. No data is associated with this feature. */
//public static final String SERVER_STARTED_FEATURE = "ServerStarted";
private FeatureAvailability()
{
mFeatures = new HashMap<String, Object>();
mLatches = new HashMap<String, CountDownLatch>();
//mDebug = new AMXDebugHelper( "--FeatureAvailability--" );
//mDebug.setEchoToStdOut( true );
}
public static FeatureAvailability getInstance()
{
return INSTANCE;
}
private static final boolean DEBUG_ENABLED = false;
/**
Internal use, should be replaced with use of
com.sun.appserv.management.helper.AMXDebugHelper when build-order problems
are resolved. Set DEBUG_ENABLED to true to see output.
*/
private void debug(final Object... args)
{
if (DEBUG_ENABLED)
{
String msg = "";
for (int i = 0; i < args.length - 1; ++i)
{
msg = msg + args[i] + " ";
}
msg = msg + args[args.length - 1];
System.out.println(msg);
}
}
/**
MBeanServer is created very early and is available via this method exept for code
that executes prior to the JVM calling main(). As it is of interest in many areas,
an explicit method call is provided.
<p>
<b>NON-BLOCKING--returns current value, can be null</b>
@return the MBeanServer used by all AppServer MBeans
public MBeanServer
getMBeanServer()
{
return (MBeanServer)mFeatures.get( MBEAN_SERVER_FEATURE );
}
*/
/**
MBeanServer is created very early and is available via this method exept for code
that executes prior to the JVM calling main(). As it is of interest in many areas,
an explicit method call is provided.
<b>BLOCKING--returns onlyl when MBeansServer becomes available.</b>
@return the MBeanServer used by all AppServer MBeans
public MBeanServer
waitForMBeanServer()
{
MBeanServer server = getMBeanServer();
if ( server == null )
{
server = (MBeanServer)waitForFeature( MBEAN_SERVER_FEATURE,
"waitForMBeanServer from " + ExceptionUtil.getStackTrace() );
}
return server;
}
*/
/**
Register a named feature as being ready for use. The data value can be a
dummy value, or can be something useful to the caller of waitForFeature().
<p>
<b>Do not register a feature until its facilities are ready for use</b>.
<p>
Features should generally be fine-grained, not coarse. For example, the AdminService
is a coarsely-defined feature which initializes dozens of things; code that requires
the presence of one of those things should arrange for a name feature for that. Examples
of this include the MBeanServer, the AdminContext, com.sun.appserv:category=config MBeans,
etc.
@param featureName arbitrary name for the feature, to be used by clients in {@link #waitForFeature}
@param data arbitrary data of possible interest to clients
*/
public synchronized void registerFeature(final String featureName, final Object data)
{
//debug( "FeatureAvailability.registerFeature: " + featureName + " in instance " + this);
if (mFeatures.get(featureName) != null)
{
throw new IllegalStateException("FeatureAvailability.addFeature: already added: " + featureName);
}
if (data == null)
{
throw new IllegalArgumentException("FeatureAvailability.addFeature(): data is null for: " + featureName);
}
mFeatures.put(featureName, data);
//debug( "********** FeatureAvailability.addFeature: " + featureName + ", data = " + data + "**********");
if (mLatches.containsKey(featureName))
{
final CountDownLatch latch = mLatches.remove(featureName);
latch.countDown(); // let all blocked threads proceed
//debug( "addFeature: released latch for: " + featureName );
}
}
/**
Block until the specified feature is available.
@param featureName the name of the desired feature
@param callerInfo arbitrary caller info for debugging purposes
*/
public Object waitForFeature(final String featureName, final String callerInfo)
{
//debug( "FeatureAvailability.waitForFeature: " + featureName + " by " + callerInfo + " in instance " + this);
CountDownLatch latch = null;
Object data = null;
// working with mFeatures and mLatches together; must synchronize for this
synchronized (this)
{
data = mFeatures.get(featureName);
if (data == null)
{
// feature not yet available, calling thread will have to wait
latch = mLatches.get(featureName);
if (latch == null)
{
latch = new CountDownLatch(1);
mLatches.put(featureName, latch);
}
}
}
assert ((data == null && latch != null) || (data != null && latch == null));
// if we had to create a CountDownLatch, calling thread must now await()
if (latch != null)
{
final long start = System.currentTimeMillis();
try
{
//debug( "waitForFeature: \"" + featureName + "\" by " + callerInfo );
final long startNanos = System.nanoTime();
latch.await();
final long elapsedNanos = System.nanoTime() - startNanos;
if (elapsedNanos > 1000 * 1000) // 1 millisecond
{
debug("FeatureAvailability.waitForFeature: waited ",
"" + elapsedNanos,
" for feature \"", featureName, "\" by \"", callerInfo, "\"");
}
}
catch (java.lang.InterruptedException e)
{
debug("waitForFeature: ERROR: ", e);
throw new Error(e);
}
data = mFeatures.get(featureName);
}
return data;
}
}
| [
"ddimalanta@appdynamics.com"
] | ddimalanta@appdynamics.com |
635d24cf30a088566f1ff5afbb52619b9bef96a2 | 038c9564713053df0c2531d95c60e6f1760422bc | /Homework/Lesson6/Jira/testIssueSearch/src/loggedInPage.java | 539b4472e4fd1e2aff2c28ff46064d2570adffdc | [] | no_license | ipalis/MyTestProject | 4ecf8ee9d6ff1353096c0685a7289076841223e2 | 06b8262d546377b95cee5c16960fe63e3fa926b4 | refs/heads/master | 2020-04-06T07:01:44.612169 | 2016-08-30T21:09:52 | 2016-08-30T21:09:52 | 54,509,370 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 637 | java | import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.firefox.FirefoxDriver;
public class loggedInPage {
private final FirefoxDriver driver;
public loggedInPage(FirefoxDriver driver) {
this.driver = driver;
}
public searchResultPage searchIssue(String value){
driver.findElement(By.xpath(".//*[@id='quickSearchInput']")).click();
driver.findElement(By.xpath(".//*[@id='quickSearchInput']")).sendKeys(value);
driver.findElement(By.xpath(".//*[@id='quickSearchInput']")).sendKeys(Keys.ENTER);
return new searchResultPage(driver);
}
}
| [
"ivanpalis@gmail.com"
] | ivanpalis@gmail.com |
b895acd1f92003d5e0ec8d4ff6b5ea73df81791e | 5e0d30d940339d15135c7a68d6ec50c0b13dea58 | /trunk/PastenForget/src/download/Status.java | ae681d83d41a27bc874f4278e8561bb40cfae2ee | [] | no_license | BackupTheBerlios/pastenforget-svn | 589cb1f6ba757bdcd3c6ba2df4f6f8b3437db378 | 0997859cc6307df2976a0e161165ef0759adeab0 | refs/heads/master | 2021-01-06T20:45:51.574501 | 2010-10-11T14:52:54 | 2010-10-11T14:52:54 | 40,805,807 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,789 | java | package download;
import settings.Languages;
/**
* Diese Klasse liefert Standardstatusmeldungen.
*
* @author executor
*
*/
public class Status {
/**
* Status fuer gestarteten Download.
*
* @return String
*/
public static String getStarted() {
return Languages.getTranslation("DownloadStarted");
}
/**
* Status fuer aktiven Download.
*
* @return String
*/
public static String getActive() {
return Languages.getTranslation("Active");
}
/**
* Status fuer fertigen Download.
*
* @return String
*/
public static String getFinished() {
return Languages.getTranslation("DownloadFinished");
}
/**
* Status fuer wartenden Download.
*
* @return String
*/
public static String getWaiting() {
return Languages.getTranslation("Waiting");
}
/**
* Status fuer wartenden Download.
*
* @param sec
* in Sekunden
* @return String
*/
public static String getWaitSec(int sec) {
if (sec == 1) {
return Languages.getTranslation("Waiting") + " ("
+ new Integer(sec).toString() + " "
+ Languages.getTranslation("second") + ")";
}
return Languages.getTranslation("Waiting") + " ("
+ new Integer(sec).toString() + " "
+ Languages.getTranslation("seconds") + ")";
}
/**
* Status fuer wartenden Download.
*
* @param min
* in Minuten
* @return String
*/
public static String getWaitMin(int min) {
if (min == 1) {
return Languages.getTranslation("Waiting") + " ("
+ new Integer(min).toString() + " "
+ Languages.getTranslation("minute") + ")";
}
return Languages.getTranslation("Waiting") + " ("
+ new Integer(min).toString() + " "
+ Languages.getTranslation("minutes") + ")";
}
/**
* Status fuer Slot belegt.
*
* @param count
* Anzahl der Versuche.
* @return String
*/
public static String getNoSlot(int count) {
if (count == 1) {
return Languages.getTranslation("NoSlot") + " ("
+ new Integer(count).toString() + " "
+ Languages.getTranslation("try") + ")";
}
return Languages.getTranslation("NoSlot") + " ("
+ new Integer(count).toString() + " "
+ Languages.getTranslation("tries") + ")";
}
/**
* Status fuer besondere Fehlermeldungen.
*
* @param error
* Fehlermeldung
* @return String "Fehler: <error>"
*/
public static String getError(String error) {
return Languages.getTranslation("Error") + ": " + error;
}
/**
* Status fuer gestoppten Download.
*
* @return String
*/
public static String getStopped() {
return Languages.getTranslation("DownloadStopped");
}
/**
* Status fuer abgebrochenen Download.
*
* @return String
*/
public static String getCanceled() {
return Languages.getTranslation("DownloadCanceled");
}
}
| [
"executor@0a29e891-4257-0410-8226-f409e81291a3"
] | executor@0a29e891-4257-0410-8226-f409e81291a3 |
b04a7a16eb3651ea18fed8709ad6e6f23c470aa9 | b3accf7695f3b45d4133e20d22ef1ac33a32eb75 | /src/main/java/refinedstorage/apiimpl/autocrafting/CraftingPattern.java | 32e2042ba2ce2e88f1d371e34385cdc360df48de | [
"MIT"
] | permissive | msrEagle/refinedstorage | f435e10d2270ae2214d2924e0c8f6f508542e384 | 2b43611be885272b5b01e45672d8f7bd31564ae6 | refs/heads/mc1.10 | 2021-01-17T22:35:30.661591 | 2016-08-20T12:37:08 | 2016-08-20T12:37:08 | 62,800,350 | 0 | 0 | null | 2016-08-20T11:34:04 | 2016-07-07T11:01:34 | Java | UTF-8 | Java | false | false | 4,763 | java | package refinedstorage.apiimpl.autocrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
import refinedstorage.api.autocrafting.ICraftingPattern;
import refinedstorage.api.autocrafting.ICraftingPatternContainer;
import refinedstorage.item.ItemPattern;
import refinedstorage.tile.TileCrafter;
public class CraftingPattern implements ICraftingPattern {
public static final String NBT = "Pattern";
private static final String NBT_CRAFTER_X = "CrafterX";
private static final String NBT_CRAFTER_Y = "CrafterY";
private static final String NBT_CRAFTER_Z = "CrafterZ";
private BlockPos crafterPos;
private TileCrafter crafter;
private boolean processing;
private ItemStack[] inputs;
private ItemStack[] outputs;
private ItemStack[] byproducts;
public CraftingPattern(BlockPos crafterPos, boolean processing, ItemStack[] inputs, ItemStack[] outputs, ItemStack[] byproducts) {
this.crafterPos = crafterPos;
this.processing = processing;
this.inputs = inputs;
this.outputs = outputs;
this.byproducts = byproducts;
}
@Override
public ICraftingPatternContainer getContainer(World world) {
if (crafter == null) {
crafter = (TileCrafter) world.getTileEntity(crafterPos);
}
return crafter;
}
@Override
public BlockPos getContainerPosition() {
return crafterPos;
}
@Override
public boolean isProcessing() {
return processing;
}
@Override
public ItemStack[] getInputs() {
return inputs;
}
@Override
public ItemStack[] getOutputs() {
return outputs;
}
@Override
public ItemStack[] getByproducts() {
return byproducts;
}
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
tag.setBoolean(ItemPattern.NBT_PROCESSING, processing);
NBTTagList inputsTag = new NBTTagList();
for (ItemStack input : inputs) {
inputsTag.appendTag(input.serializeNBT());
}
tag.setTag(ItemPattern.NBT_INPUTS, inputsTag);
NBTTagList outputsTag = new NBTTagList();
for (ItemStack output : outputs) {
outputsTag.appendTag(output.serializeNBT());
}
tag.setTag(ItemPattern.NBT_OUTPUTS, outputsTag);
if (byproducts != null) {
NBTTagList byproductsTag = new NBTTagList();
for (ItemStack byproduct : byproducts) {
byproductsTag.appendTag(byproduct.serializeNBT());
}
tag.setTag(ItemPattern.NBT_BYPRODUCTS, byproductsTag);
}
tag.setInteger(NBT_CRAFTER_X, crafterPos.getX());
tag.setInteger(NBT_CRAFTER_Y, crafterPos.getY());
tag.setInteger(NBT_CRAFTER_Z, crafterPos.getZ());
return tag;
}
public static CraftingPattern readFromNBT(NBTTagCompound tag) {
BlockPos crafterPos = new BlockPos(tag.getInteger(NBT_CRAFTER_X), tag.getInteger(NBT_CRAFTER_Y), tag.getInteger(NBT_CRAFTER_Z));
boolean processing = tag.getBoolean(ItemPattern.NBT_PROCESSING);
NBTTagList inputsTag = tag.getTagList(ItemPattern.NBT_INPUTS, Constants.NBT.TAG_COMPOUND);
ItemStack inputs[] = new ItemStack[inputsTag.tagCount()];
for (int i = 0; i < inputsTag.tagCount(); ++i) {
inputs[i] = ItemStack.loadItemStackFromNBT(inputsTag.getCompoundTagAt(i));
if (inputs[i] == null) {
return null;
}
}
NBTTagList outputsTag = tag.getTagList(ItemPattern.NBT_OUTPUTS, Constants.NBT.TAG_COMPOUND);
ItemStack outputs[] = new ItemStack[outputsTag.tagCount()];
for (int i = 0; i < outputsTag.tagCount(); ++i) {
outputs[i] = ItemStack.loadItemStackFromNBT(outputsTag.getCompoundTagAt(i));
if (outputs[i] == null) {
return null;
}
}
ItemStack byproducts[] = new ItemStack[0];
if (tag.hasKey(ItemPattern.NBT_BYPRODUCTS)) {
NBTTagList byproductsTag = tag.getTagList(ItemPattern.NBT_BYPRODUCTS, Constants.NBT.TAG_COMPOUND);
byproducts = new ItemStack[byproductsTag.tagCount()];
for (int i = 0; i < byproductsTag.tagCount(); ++i) {
byproducts[i] = ItemStack.loadItemStackFromNBT(byproductsTag.getCompoundTagAt(i));
if (byproducts[i] == null) {
return null;
}
}
}
return new CraftingPattern(crafterPos, processing, inputs, outputs, byproducts);
}
}
| [
"raoulvdberge@gmail.com"
] | raoulvdberge@gmail.com |
4814cedc2653e146c1cdc42c11c225919322255b | 8397f568ec839882b32bbd7e7ae1887d32dab9c5 | /vfs/src/main/java/jetbrains/exodus/vfs/VfsSettings.java | 737200dc854809b2026f07b93247155e35632d9c | [
"Apache-2.0"
] | permissive | marcelmay/xodus | 7604e5600786c7a189d5a8cb11222cf6379f3388 | 0b0ec85f2202c5e6fbdf214004155782490696c7 | refs/heads/master | 2020-09-28T19:35:39.897524 | 2019-12-06T18:39:46 | 2019-12-06T18:39:46 | 226,847,554 | 0 | 0 | Apache-2.0 | 2019-12-09T10:42:50 | 2019-12-09T10:42:50 | null | UTF-8 | Java | false | false | 2,561 | java | /**
* Copyright 2010 - 2019 JetBrains s.r.o.
*
* 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 jetbrains.exodus.vfs;
import jetbrains.exodus.ArrayByteIterable;
import jetbrains.exodus.ByteIterable;
import jetbrains.exodus.bindings.StringBinding;
import jetbrains.exodus.env.Environment;
import jetbrains.exodus.env.Store;
import jetbrains.exodus.env.Transaction;
import jetbrains.exodus.env.TransactionalExecutable;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* VFS persistent settings
*/
class VfsSettings {
static final String NEXT_FREE_PATH_ID = "jetbrains.exodus.vfs.settings.nextFreePathId";
@NotNull
private final Environment env;
@NotNull
private final Store settingStore;
VfsSettings(@NotNull final Environment env, @NotNull final Store settingStore) {
this.env = env;
this.settingStore = settingStore;
}
ByteIterable get(@Nullable final Transaction txn, @NotNull final String settingName) {
final ArrayByteIterable key = StringBinding.stringToEntry(settingName);
if (txn != null) {
return settingStore.get(txn, key);
}
final ByteIterable[] result = new ByteIterable[1];
env.executeInTransaction(new TransactionalExecutable() {
@Override
public void execute(@NotNull final Transaction txn) {
result[0] = settingStore.get(txn, key);
}
});
return result[0];
}
void put(@Nullable final Transaction txn, @NotNull final String settingName, @NotNull final ByteIterable bi) {
final ArrayByteIterable key = StringBinding.stringToEntry(settingName);
if (txn != null) {
settingStore.put(txn, key, bi);
} else {
env.executeInTransaction(new TransactionalExecutable() {
@Override
public void execute(@NotNull final Transaction txn) {
settingStore.put(txn, key, bi);
}
});
}
}
}
| [
"lvo@intellij.net"
] | lvo@intellij.net |
8442a17183034614cea1b1e08d2a81fad20e5d4b | 6ee5d997d94072e48d5749942db1ca89fb731d07 | /app/src/main/java/com/cleanup/todoc/database/TodocDatabase.java | 4a0af79f41e8653aa51590b4b999de4169ca80f1 | [] | no_license | SnowBlack1/P5_Todoc | 6d4b4f89d2fad2df4d144c6edfb9d47b95b5aa45 | 07b1c57478879cd6c051b33ffb236547c6ab8d98 | refs/heads/master | 2022-12-17T00:18:47.115196 | 2020-09-01T16:00:08 | 2020-09-01T16:00:08 | 269,092,078 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,415 | java | package com.cleanup.todoc.database;
import androidx.sqlite.db.SupportSQLiteDatabase;
import androidx.room.Database;
import androidx.room.OnConflictStrategy;
import androidx.room.Room;
import androidx.room.RoomDatabase;
import android.content.ContentValues;
import android.content.Context;
import android.graphics.Color;
import androidx.annotation.NonNull;
import com.cleanup.todoc.database.dao.ProjectDao;
import com.cleanup.todoc.database.dao.TaskDao;
import com.cleanup.todoc.model.Project;
import com.cleanup.todoc.model.Task;
import java.util.Random;
@Database(entities = {Project.class, Task.class}, version = 1, exportSchema = false)
public abstract class TodocDatabase extends RoomDatabase {
//Singleton
private static volatile TodocDatabase INSTANCE;
//DAO
public abstract ProjectDao mProjectDao();
public abstract TaskDao mTaskDao();
public static TodocDatabase getInstance(Context context) {
if (INSTANCE == null) {
synchronized (TodocDatabase.class) {
if (INSTANCE == null) {
INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
TodocDatabase.class, "TodocDatabase.db")
.addCallback(prepopulateDatabase())
//.allowMainThreadQueries()
.build();
}
}
}
return INSTANCE;
}
private static void addRandomProject(SupportSQLiteDatabase db, int id, String tableName, String projectName) {
Random rnd = new Random();
int color = Color.argb(255, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256));
ContentValues project = new ContentValues();
project.put("id", id);
project.put("name", projectName);
project.put("color", color);
db.insert(tableName, OnConflictStrategy.IGNORE, project);
}
private static Callback prepopulateDatabase() { //creation project w/ color/id/name
return new Callback() {
@Override
public void onCreate(@NonNull SupportSQLiteDatabase db) {
super.onCreate(db);
addRandomProject(db, 1, "Project", "Projet Tartampion");
addRandomProject(db, 2, "Project", "Projet Lucidia");
addRandomProject(db, 3, "Project", "Projet Circus");
}
};
}
}
| [
"varvoux.aurelie@gmail.com"
] | varvoux.aurelie@gmail.com |
f89819f4c6dfde8e5b52d11f18ae3b7e960eee42 | ac5d68f2399a8924c80888414290c83116e46c67 | /src/dungeonmaps/JuliasPotatoTrapSquare.java | e8776157b6b439d30fe81e0a30f0030ae59d6a05 | [] | no_license | Saleh58/gg | 81778721ac62331bb14adfab4f6c3edf77b14472 | ac8150e7973a1ec292ffaeed0ebb1eaa0c263478 | refs/heads/master | 2022-12-07T18:18:12.443230 | 2020-09-03T18:33:55 | 2020-09-03T18:33:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 893 | 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 dungeonmaps;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
/**
*
* @author julia
*/
public class JuliasPotatoTrapSquare extends FloorTrapSquare{
//creates a potato trap with location; damage done is 3; throws exception
public JuliasPotatoTrapSquare(int r, int c) throws IOException {
super(3, 12, r, c);
//this message is displayed when the character is on this square
this.message = "\nA huge potato falls from the ceiling and hits you in the head... it hurts!";
//image of potato appears when tripped
trippedTrap = new ImageIcon(ImageIO.read(new File("img//potato.png")));
}
}
| [
"60588790+alsalama001@users.noreply.github.com"
] | 60588790+alsalama001@users.noreply.github.com |
4c0d74fa7b3f304787e344fda1cdb3fab6efc8dd | 180e78725121de49801e34de358c32cf7148b0a2 | /dataset/protocol1/mapstruct/learning/3374/package-info.java | 0072009777c1b3f6b870119b1e8b745b4c560cea | [] | no_license | ASSERT-KTH/synthetic-checkstyle-error-dataset | 40e8d1e0a7ebe7f7711def96a390891a6922f7bd | 40c057e1669584bfc6fecf789b5b2854660222f3 | refs/heads/master | 2023-03-18T12:50:55.410343 | 2019-01-25T09:54:39 | 2019-01-25T09:54:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 363 | java | /*
* Copyright MapStruct Authors.
*
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
/**
* <p>
* Meta-model of mapper types, their methods, mappings between properties etc. Model elements can serialize themselves
* using FreeMarker templates.
* </p>
*/
package org.mapstruct.ap.internal.model
;
| [
"bloriot97@gmail.com"
] | bloriot97@gmail.com |
3a7068708b2326769151710cfd6a1f59c275b4a2 | c893e4f191f02e853732cc8ea82d820b98234b5e | /ShellAddScriptTool/src/com/tomagoyaky/parsedex/struct/StringDataItem.java | 693b38dcedab79affa99fd75be6e25cb3957d558 | [] | no_license | tomagoyaky/tomagoyakyShell | 726e267fce82e56089c3b1011f1332852e3df80a | 6be018144fb943ae1ff86a8301ec2b047f7cff22 | refs/heads/master | 2021-01-10T02:39:04.223793 | 2016-03-12T09:54:49 | 2016-03-12T09:54:49 | 53,195,492 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 745 | java | package com.tomagoyaky.parsedex.struct;
import java.util.ArrayList;
import java.util.List;
public class StringDataItem {
/**
* struct string_data_item
{
uleb128 utf16_size;
ubyte data;
}
*/
/**
* �����������ᵽ�� LEB128 �� little endian base 128 ) ��ʽ ���ǻ��� 1 �� Byte ��һ�ֲ������ȵ�
���뷽ʽ ������һ�� Byte �����λΪ 1 �����ʾ����Ҫ��һ�� Byte ������ ��ֱ�����һ�� Byte �����
λΪ 0 ��ÿ�� Byte ������ Bit ������ʾ����
*/
public List<Byte> utf16_size = new ArrayList<Byte>();
public byte data;
}
| [
"765175458@qq.com"
] | 765175458@qq.com |
a6ce561e380577cbfe7c9fcfc21c3afa87d1f2c8 | 79d53ec575feb7367a24f2612f45806dbd14ef54 | /Brian-s running test version/Knight.java | d5a4f7ea01c62d4854d9ede14675367999c5afd4 | [] | no_license | katylikeskats/Old-Polytopia-Game | a4b221b01a7b2845dd7b0f3ed4c6241f6395566d | 25736ce9b6f4fe75a68c082aad3ae972c1b78a3c | refs/heads/master | 2020-03-18T20:07:00.630607 | 2018-06-14T19:27:14 | 2018-06-14T19:27:14 | 135,196,555 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 146 | java | public class Knight extends Unit {
Knight(int r, int c, int tribe, City city){
super(r, c, 6, 1, 15, 3, 1, tribe, city);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
db89865faf66e753894a4bf89ba5ff088098db5d | 39960e986c2af869e701681953917f3eac7770f6 | /impl/src/main/java/be/atbash/ee/security/octopus/nimbus/jose/JOSEObjectType.java | 94d36a598683731625c92c3baeecbfd03038a529 | [
"Apache-2.0"
] | permissive | atbashEE/octopus-jwt-support | c80ff2674db7da91275240ddc6dbb18010f8ee31 | 87a6eb6ead3134e1de06dbc6f163a93bd68c422a | refs/heads/master | 2022-12-28T11:50:40.708233 | 2022-12-10T16:36:42 | 2022-12-10T16:36:42 | 128,985,608 | 1 | 0 | Apache-2.0 | 2022-08-20T16:43:36 | 2018-04-10T19:35:27 | Java | UTF-8 | Java | false | false | 2,969 | java | /*
* Copyright 2017-2022 Rudy De Busscher (https://www.atbash.be)
*
* 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 be.atbash.ee.security.octopus.nimbus.jose;
/**
* JOSE object type, represents the {@code typ} header parameter in unsecured,
* JSON Web Signature (JWS) and JSON Web Encryption (JWE) objects. This class
* is immutable.
*
* <p>Includes constants for the following standard types:
*
* <ul>
* <li>{@link #JOSE}
* <li>{@link #JOSE_JSON JOSE+JSON}
* <li>{@link #JWT}
* </ul>
*
* <p>Additional types can be defined using the constructor.
* <p>
* Based on code by Vladimir Dzhuvinov
*/
public final class JOSEObjectType {
/**
* Compact encoded JOSE object type.
*/
public static final JOSEObjectType JOSE = new JOSEObjectType("JOSE");
/**
* JSON-encoded JOSE object type..
*/
public static final JOSEObjectType JOSE_JSON = new JOSEObjectType("JOSE+JSON");
/**
* JSON Web Token (JWT) object type.
*/
public static final JOSEObjectType JWT = new JOSEObjectType("JWT");
/**
* The object type.
*/
private final String type;
/**
* Creates a new JOSE object type.
*
* @param type The object type. Must not be {@code null}.
*/
public JOSEObjectType(String type) {
if (type == null) {
throw new IllegalArgumentException("The object type must not be null");
}
this.type = type;
}
/**
* Gets the JOSE object type.
*
* @return The JOSE object type.
*/
public String getType() {
return type;
}
/**
* Overrides {@code Object.hashCode()}.
*
* @return The object hash code.
*/
@Override
public int hashCode() {
return type.toLowerCase().hashCode();
}
/**
* Overrides {@code Object.equals()}.
*
* @param object The object to compare to.
* @return {@code true} if the objects have the same value, otherwise
* {@code false}.
*/
@Override
public boolean equals(Object object) {
return object instanceof JOSEObjectType &&
this.type.equalsIgnoreCase(((JOSEObjectType) object).type);
}
/**
* Returns the string representation of this JOSE object type.
*
* @return The string representation.
* @see #getType
*/
@Override
public String toString() {
return type;
}
}
| [
"rdebusscher@gmail.com"
] | rdebusscher@gmail.com |
92ea7d22d8806c5c85ddb8776a3574bcdcdf07be | 04d67f4acb1132264a834c69f79f6cade572c7e7 | /day3/src/org/advent/Main.java | 3781fe16ad5f5669831f80582a6fae1b46fbf7dc | [] | no_license | jpjocke/aoc2019 | f1a1be9d1dbf402d646561a9d575e046412ae9c1 | 86d5b17f82a4688f88649121a1c9744427436958 | refs/heads/master | 2020-11-29T21:53:25.231274 | 2019-12-26T08:13:08 | 2019-12-26T08:13:08 | 230,223,758 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,067 | java | package org.advent;
import java.util.List;
public class Main {
private static final String commandList1 = "R995,U982,R941,U681,L40,D390,R223,U84,L549,U568,R693,D410,R779,U33,L54,D18,L201,U616,R583,D502,R307,U46,L726,D355,L62,D973,R134,U619,L952,U669,L28,U729,L622,D821,R814,D149,L713,U380,R720,U438,L112,U587,R161,U789,R959,U254,R51,U648,R259,U555,R863,U610,L33,D97,L825,D489,R836,D626,L849,D262,L380,U831,R650,U832,R339,D538,L49,D808,L873,D33,L405,D655,R884,D630,R589,D291,L675,D210,L211,D325,L934,D515,R896,U97,L639,U654,L301,U507,L642,D416,L325,U696,L3,U999,R88,D376,L187,U107,R394,U273,R117,D872,R162,D496,L599,D855,L961,U830,L156,U999,L896,D380,L476,U100,R848,U547,L266,D490,L87,D376,L428,U265,R645,U584,L623,D658,L103,U946,R162,U678,R532,D761,L141,D48,L487,D246,L85,D680,R859,D345,L499,D194,L815,D742,R700,D141,L482,D442,L943,D110,L892,D486,L581,U733,L109,D807,L474,U866,R537,U217,R237,U915,R523,D394,L509,U333,R734,U511,R482,D921,R658,U860,R112,U527,L175,D619,R140,D402,L254,D956,L556,U447,L518,U60,L306,U88,R311,U654,L551,D38,R750,U835,L784,U648,L374,U211,L635,U429,R129,U849,R411,D135,L980,U40,R480,D91,R881,D292,R474,D956,L89,D640,L997,D397,L145,D126,R936,U135,L167,U289,R560,D745,L699,U978,L459,D947,L782,U427,L784,D561,R985,D395,L358,D928,R697,U561,L432,U790,R112,D474,R852,U862,R721,D337,L355,U598,L94,D951,L903,D175,R981,D444,L690,D729,L537,D458,R883,U152,R125,D363,L90,U260,R410,D858,L825,U185,R502,D648,R793,D600,L589,U931,L772,D498,L871,U326,L587,D789,L934,D889,R621,U689,R454,U475,L166,U85,R749,D253,R234,D96,R367,D33,R831,D783,R577,U402,R482,D741,R737,D474,L666";
private static final String commandList2 ="L996,D167,R633,D49,L319,D985,L504,U273,L330,U904,R741,U886,L719,D73,L570,U982,R121,U878,R36,U1,R459,D368,R229,D219,R191,U731,R493,U529,R53,D613,R690,U856,L470,D722,R464,D378,L187,U540,R990,U942,R574,D991,R29,D973,R905,D63,R745,D444,L546,U939,L848,U860,R877,D181,L392,D798,R564,D189,R14,U120,R118,D350,R798,U462,R335,D497,R916,D722,R398,U91,L284,U660,R759,U676,L270,U69,L774,D850,R440,D669,L994,U187,R698,U864,R362,U523,L128,U89,R272,D40,L134,U571,L594,D737,L830,D956,L213,D97,R833,U454,R319,U809,L506,D792,R746,U283,R858,D743,R107,U499,R102,D71,R822,U9,L547,D915,L717,D783,L53,U871,R920,U284,R378,U312,R970,D316,R243,D512,R439,U530,R246,D824,R294,D726,R541,D250,R859,D134,R893,U631,L288,D151,L796,D759,R17,D656,L562,U136,R861,U42,L66,U552,R240,D121,L966,U288,L810,D104,R332,U667,L63,D463,R527,D27,R238,D401,L397,D888,R168,U808,L976,D462,R299,U385,L183,U303,L121,U385,R260,U80,R420,D532,R725,U500,L376,U852,R98,D597,L10,D441,L510,D592,L652,D230,L290,U41,R521,U726,R444,U440,L192,D255,R690,U141,R21,U942,L31,U894,L994,U472,L460,D357,R150,D721,R125,D929,R473,U707,R670,D118,R255,U287,R290,D374,R223,U489,R533,U49,L833,D805,L549,D291,R288,D664,R639,U866,R205,D746,L832,U864,L774,U610,R186,D56,R517,U294,L935,D304,L581,U899,R749,U741,R569,U282,R460,D925,L431,D168,R506,D949,L39,D472,R379,D125,R243,U335,L310,D762,R412,U426,L584,D981,L971,U575,L129,U885,L946,D221,L779,U902,R251,U75,L729,D956,L211,D130,R7,U664,L915,D928,L613,U740,R572,U733,R277,U7,R953,D962,L635,U641,L199";
public static void main(String[] args) {
List<Command> w1Commands = CommandParser.parseList(commandList1);
List<Command> w2Commands = CommandParser.parseList(commandList2);
Board board = new Board(30000, 2);
w1Commands.stream()
.forEach(command -> board.runLength(command, 0));
w2Commands.stream()
.forEach(command -> board.runLength(command, 1));
List<IntPoint> intersections = board.getIntersections();
IntPoint start = board.getStart();
intersections.stream().forEach(point -> {
System.out.println(point);
System.out.println(point.manhattanDistance(start));
});
int smallest = ManhattanComparer.getSmallest(intersections, start);
System.out.println(smallest);
int smallestSteps = StepFinder.getShortestSteps(board, w1Commands, w2Commands);
System.out.println(smallestSteps);
}
}
| [
"joakim.palmkvist@seal-software.com"
] | joakim.palmkvist@seal-software.com |
b7f9fb09f8a2a363d55a8ab372ed5d74e04521f2 | 8a6dd3d81b1cfa0ad75860f5cfcb4ee14f722e2a | /seera-yancheng-webapp/src/main/java/com/sunesoft/seera/yc/webapp/interceptor/CommonInterceptor.java | 78ecb6b005da23c588057b30febdfcff689cee94 | [] | no_license | heySeattleW/yancheng | e6c9e3b769d16c467262706b7fdd3a9698c4f14e | 4bf9c3014a3e4cea19a9da048054e025d3c809a1 | refs/heads/master | 2020-04-27T06:44:27.531428 | 2017-04-26T10:41:34 | 2017-04-26T10:41:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,067 | java | package com.sunesoft.seera.yc.webapp.interceptor;
import com.sunesoft.seera.yc.core.uAuth.application.dtos.UserSessionDto;
import com.sunesoft.seera.yc.webapp.function.UserSession;
import com.sunesoft.seera.yc.webapp.utils.Helper;
import com.sunesoft.seera.yc.webapp.utils.URI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Created by zhouz on 2016/5/13.
*/
public class CommonInterceptor implements HandlerInterceptor {
private static final String[] IGNORE_URI = {"/login"};
/**
* 3
* 在DispatcherServlet完全处理完请求后被调用
* 当有拦截器抛出异常时,会从当前拦截器往回执行所有的拦截器的afterCompletion()
*/
@Override
public void afterCompletion(HttpServletRequest arg0,
HttpServletResponse arg1, Object arg2, Exception arg3)
throws Exception {
// TODO Auto-generated method stub
}
/**
* 2
* 在业务处理器处理请求执行完成后,生成视图之前执行的动作
*/
@Override
public void postHandle(HttpServletRequest arg0, HttpServletResponse arg1,
Object arg2, ModelAndView arg3) throws Exception {
// TODO Auto-generated method stub
}
@Autowired
UserSession us;
/**
* 1
* 在业务处理器处理请求之前被调用
* 如果返回false
* 从当前的拦截器往回执行所有拦截器的afterCompletion(),再退出拦截器链
*
* 如果返回true
* 执行下一个拦截器,直到所有的拦截器都执行完毕
* 再执行被拦截的Controller
* 然后进入拦截器链,
* 从最后一个拦截器往回执行所有的postHandle()
* 接着再从最后一个拦截器往回执行所有的afterCompletion()
*/
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
Object obj) throws Exception {
String uid = us.getUserIdFromCookie(request);
if(uid != null) us.updateUserSession(request,response,uid);
String xRequestedWith = request.getHeader("X-Requested-With");
UserSessionDto user = us.getCurrentUser(request);
if(xRequestedWith != null && xRequestedWith.equals("XMLHttpRequest")){
if(user == null){
response.setContentType("application/text");
try {
us.removeUserCookie(request, response);
response.getWriter().write("notlogin");
} catch (IOException e) {
e.printStackTrace();
}
return false;
}
}
if(uid == null){
String currentRequestUrl = Helper.getCurrentRequestUrl(request);
for (String s : IGNORE_URI) {
if (currentRequestUrl.contains(s)) {
return false;
}
}
response.sendRedirect("/login?rurl=" + URI.enURI(currentRequestUrl));
return false;
}
return true;
}
}
| [
"1366812446@qq.com"
] | 1366812446@qq.com |
bd8b5d94f53b1d9baa83cb12c9d4dd233bbf4e93 | 8e5059abd568ccf016b9a31d585c010792f1036d | /opencmis/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/AbstractCmisHttpServlet.java | 0370ce26c353e7dccdaec9c969654517971c46e0 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | hgregoire/cmis-couchbase | ec0545e8fe4662c90b9be6a03267bc8e63f23f16 | c58f34aeaae22a4fced5a58c05ce554ed2e9da75 | refs/heads/master | 2020-04-08T04:00:58.574601 | 2016-01-13T14:17:25 | 2016-01-13T14:17:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,654 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.chemistry.opencmis.server.shared;
import java.util.Map;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
import org.apache.chemistry.opencmis.commons.impl.ClassLoaderUtil;
import org.apache.chemistry.opencmis.commons.impl.Constants;
import org.apache.chemistry.opencmis.commons.server.CallContext;
import org.apache.chemistry.opencmis.commons.server.CmisServiceFactory;
import org.apache.chemistry.opencmis.server.impl.CallContextImpl;
import org.apache.chemistry.opencmis.server.impl.CmisRepositoryContextListener;
import org.apache.chemistry.opencmis.server.impl.browser.BrowserCallContextImpl;
public abstract class AbstractCmisHttpServlet extends HttpServlet {
public static final String PARAM_CALL_CONTEXT_HANDLER = "callContextHandler";
public static final String PARAM_CMIS_VERSION = "cmisVersion";
private static final long serialVersionUID = 1L;
private CmisServiceFactory factory;
private String binding;
private CmisVersion cmisVersion;
private CallContextHandler callContextHandler;
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
// initialize the call context handler
callContextHandler = null;
String callContextHandlerClass = config.getInitParameter(PARAM_CALL_CONTEXT_HANDLER);
if (callContextHandlerClass != null) {
try {
callContextHandler = (CallContextHandler) ClassLoaderUtil.loadClass(callContextHandlerClass)
.newInstance();
} catch (Exception e) {
throw new ServletException("Could not load call context handler: " + e, e);
}
}
// get service factory
factory = (CmisServiceFactory) config.getServletContext().getAttribute(
CmisRepositoryContextListener.SERVICES_FACTORY);
if (factory == null) {
throw new ServletException("Service factory not available! Configuration problem?");
}
}
/**
* Sets the binding.
*/
protected void setBinding(String binding) {
this.binding = binding;
}
/**
* Returns the CMIS version configured for this servlet.
*/
protected CmisVersion getCmisVersion() {
return cmisVersion;
}
protected void setCmisVersion(CmisVersion cmisVersion) {
this.cmisVersion = cmisVersion;
}
/**
* Returns the {@link CmisServiceFactory}.
*/
protected CmisServiceFactory getServiceFactory() {
return factory;
}
/**
* Return the {@link CallContextHandler}
*/
protected CallContextHandler getCallContextHandler() {
return callContextHandler;
}
/**
* Creates a {@link CallContext} object from a servlet request.
*/
protected CallContext createContext(ServletContext servletContext, HttpServletRequest request,
HttpServletResponse response, TempStoreOutputStreamFactory streamFactory) {
String[] pathFragments = HttpUtils.splitPath(request);
String repositoryId = null;
if (pathFragments.length > 0) {
repositoryId = pathFragments[0];
}
if (repositoryId == null && CallContext.BINDING_ATOMPUB.equals(binding)) {
// it's a getRepositories or getRepositoryInfo call
// getRepositoryInfo has the repository ID in the query parameters
repositoryId = HttpUtils.getStringParameter(request, Constants.PARAM_REPOSITORY_ID);
}
CallContextImpl context = null;
if (CallContext.BINDING_BROWSER.equals(binding)) {
context = new BrowserCallContextImpl(binding, cmisVersion, repositoryId, servletContext, request, response,
factory, streamFactory);
} else {
context = new CallContextImpl(binding, cmisVersion, repositoryId, servletContext, request, response,
factory, streamFactory);
}
// decode range
context.setRange(request.getHeader("Range"));
// get locale
context.setAcceptLanguage(request.getHeader("Accept-Language"));
// call call context handler
if (callContextHandler != null) {
Map<String, String> callContextMap = callContextHandler.getCallContextMap(request);
if (callContextMap != null) {
for (Map.Entry<String, String> e : callContextMap.entrySet()) {
context.put(e.getKey(), e.getValue());
}
}
}
return context;
}
}
| [
"$clebzh35$"
] | $clebzh35$ |
448c4f09d0b7d16527b68188e902cafd88121e0f | 9e50d3e4b3ac25340064d02cb9b13d864f38a97f | /src/main/java/ua/com/vetal/controller/NumberBaseDirectoryController.java | dddc78e5438ce579aaac308aeee2a6564d37e782 | [] | no_license | AnGo84/Vetal | 1e9a14058125cc38bc56e8d6757f03c3ffee066b | 058ab65bbf58ab48df59f7aaf2ed727d5a8a557f | refs/heads/master | 2022-10-04T13:09:49.893740 | 2021-10-13T21:27:57 | 2021-10-13T21:27:57 | 142,024,419 | 2 | 0 | null | 2022-09-01T23:24:41 | 2018-07-23T14:17:45 | Java | UTF-8 | Java | false | false | 754 | java | package ua.com.vetal.controller;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import ua.com.vetal.controller.common.AbstractDirectoryController;
import ua.com.vetal.controller.common.ControllerType;
import ua.com.vetal.entity.NumberBaseDirectory;
import ua.com.vetal.service.NumberBaseDirectoryServiceImpl;
@Controller
@RequestMapping("/numberBases")
@Slf4j
public class NumberBaseDirectoryController extends AbstractDirectoryController<NumberBaseDirectory, NumberBaseDirectoryServiceImpl> {
public NumberBaseDirectoryController(NumberBaseDirectoryServiceImpl service) {
super(NumberBaseDirectory.class, ControllerType.NUMBER_BASE, service);
}
} | [
"ango1984@gmail.com"
] | ango1984@gmail.com |
ff820086ed19ff05aeba39573decfd5b3cd8bc4b | 1e8c6d96b6e7526adcbc0a435208f46e07b96de0 | /app/src/main/java/com/huanxin/oa/form/FormRefreshActivity.java | f3b7896fe8cf64f70b64004d632d054f740282ad | [] | no_license | yzb199211/oa | b0bf3a5280f489a5e090e12b5c388ad110ddd565 | 1d1a7f662073568c7b4d8b886a8d104859b475bf | refs/heads/master | 2020-07-15T20:33:16.075270 | 2020-04-22T01:03:32 | 2020-04-22T01:03:32 | 205,535,489 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,451 | java | package com.huanxin.oa.form;
import android.content.Intent;
import android.graphics.Paint;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import com.bin.david.form.core.SmartTable;
import com.bin.david.form.data.CellInfo;
import com.bin.david.form.data.column.Column;
import com.bin.david.form.data.format.bg.BaseBackgroundFormat;
import com.bin.david.form.data.format.bg.BaseCellBackgroundFormat;
import com.bin.david.form.data.style.FontStyle;
import com.bin.david.form.data.table.MapTableData;
import com.google.gson.Gson;
import com.huanxin.oa.BaseActivity;
import com.huanxin.oa.R;
import com.huanxin.oa.dialog.LoadingDialog;
import com.huanxin.oa.form.model.FormBean;
import com.huanxin.oa.form.model.FormConditionBean;
import com.huanxin.oa.form.utils.JsonHelper;
import com.huanxin.oa.interfaces.ResponseListener;
import com.huanxin.oa.main.interfaces.OnItemClickListener;
import com.huanxin.oa.utils.SharedPreferencesHelper;
import com.huanxin.oa.utils.StringUtil;
import com.huanxin.oa.utils.Toasts;
import com.huanxin.oa.utils.net.NetConfig;
import com.huanxin.oa.utils.net.NetParams;
import com.huanxin.oa.utils.net.NetUtil;
import com.huanxin.oa.view.tab.TabView;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class FormRefreshActivity extends BaseActivity {
private final static String TAG = "FormNewActivity";
private final static int CONDIRION_CODE = 500;
@BindView(R.id.iv_back)
ImageView ivBack;
@BindView(R.id.tv_title)
TextView tvTitle;
@BindView(R.id.table)
SmartTable table;
@BindView(R.id.tv_page)
TextView tvPage;
@BindView(R.id.tv_right)
TextView tvRight;
@BindView(R.id.ll_tab)
LinearLayout llTab;
SharedPreferencesHelper preferencesHelper;
int pagerIndex = 1;
int isInterval = 1;//各行变色
private String menuId;
private String userId;
private String filter = "";
private String fixfilter = "";
private String title;
private String address;
private String url;
private List<FormConditionBean> fixconditions;
private List<FormBean.ReportConditionBean> conditions;
private List<Integer> columnsFix;
private List<Column> columns;
TabView currentView;
int currenViewPos = -1;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_form_refresh);
ButterKnife.bind(this);
preferencesHelper = new SharedPreferencesHelper(this, getString(R.string.preferenceCache));
init();
getData();
}
private void init() {
initData();
initList();
initIntent();
initView();
}
private void initIntent() {
Intent intent = getIntent();
menuId = intent.getStringExtra("menuid");
title = intent.getStringExtra("title");
}
private void initData() {
address = (String) preferencesHelper.getSharedPreference("address", "");
userId = (String) preferencesHelper.getSharedPreference("userid", "");
url = address + NetConfig.server + NetConfig.Form_Method;
}
private void initList() {
fixconditions = new ArrayList<>();
conditions = new ArrayList<>();
columns = new ArrayList<>();
columnsFix = new ArrayList<>();
}
private void initView() {
ivBack.setVisibility(View.VISIBLE);
tvTitle.setText(title);
}
/*获取初始数据*/
private void getData() {
LoadingDialog.showDialogForLoading(this);
new NetUtil(getDataParams(), url, new ResponseListener() {
@Override
public void onSuccess(String string) {
try {
JSONObject data = new JSONObject(string);
boolean isSucess = data.optBoolean("success");
if (isSucess) {
String formData = data.optString("data");
String formInfo = data.getString("info");
initData(formData, formInfo);
// Log.e("formData", formData);
// Log.e("formData", formInfo);
loadFail("");
} else {
loadFail(data.optString("messages"));
}
} catch (JSONException e) {
loadFail("json数据解析错误");
e.printStackTrace();
} catch (Exception e) {
loadFail("数据解析错误");
e.printStackTrace();
}
}
@Override
public void onFail(IOException e) {
e.printStackTrace();
loadFail("未获取到数据");
}
});
}
/*获取初始数据参数*/
private List<NetParams> getDataParams() {
List<NetParams> params = new ArrayList<>();
params.add(new NetParams("otype", "GetReportInfo"));
params.add(new NetParams("iMenuID", menuId));
params.add(new NetParams("userid", userId));
params.add(new NetParams("pageNo", pagerIndex + ""));
Log.e("menuid", menuId);
return params;
}
/*初始化数据*/
private void initData(String formData, String formInfo) throws Exception {
Gson gson = new Gson();
FormBean formBean = gson.fromJson(formInfo, FormBean.class);
List<FormBean.ReportInfoBean> reportInfoBeans = formBean.getReportInfo();
List<FormBean.ReportConditionBean> reportConditionBeans = formBean.getReportCondition();
List<FormBean.ReportColumnsBean> reportColumnsBeans = formBean.getReportColumns();
Log.e("conditions", new Gson().toJson(reportInfoBeans));
if (reportInfoBeans.size() > 0) {
initInfo(reportInfoBeans);
}
if (reportConditionBeans.size() > 0) {
intiCondition(reportConditionBeans);
}
for (int i = 0; i < reportColumnsBeans.size(); i++) {
formData.replaceAll(reportColumnsBeans.get(i).getSFieldsName(), reportColumnsBeans.get(i).getSFieldsdisplayName());
}
if (StringUtil.isNotEmpty(formData)) {
runOnUiThread(new Runnable() {
@Override
public void run() {
setGsonData(formData);
if (fixconditions.size() > 0) {
setTab();
}
}
});
}
}
private void initInfo(List<FormBean.ReportInfoBean> reportInfoBeans) {
initInterval(reportInfoBeans);
initFixcondition(reportInfoBeans);
}
private void initInterval(List<FormBean.ReportInfoBean> reportInfoBeans) {
isInterval = reportInfoBeans.get(0).getiRowAlternation();
}
private void initFixcondition(List<FormBean.ReportInfoBean> reportInfoBeans) {
FormBean.ReportInfoBean fixcondition = reportInfoBeans.get(0);
if (StringUtil.isNotEmpty(fixcondition.getSAppFiltersName1())) {
fixconditions.add(new FormConditionBean(fixcondition.getSAppFiltersName1(), TextUtils.isEmpty(fixcondition.getSAppFilters1()) ? "" : fixcondition.getSAppFilters1()));
}
if (StringUtil.isNotEmpty(fixcondition.getSAppFiltersName2())) {
fixconditions.add(new FormConditionBean(fixcondition.getSAppFiltersName2(), TextUtils.isEmpty(fixcondition.getSAppFilters2()) ? "" : fixcondition.getSAppFilters2()));
}
if (StringUtil.isNotEmpty(fixcondition.getSAppFiltersName3())) {
fixconditions.add(new FormConditionBean(fixcondition.getSAppFiltersName3(), TextUtils.isEmpty(fixcondition.getSAppFilters3()) ? "" : fixcondition.getSAppFilters3()));
}
if (StringUtil.isNotEmpty(fixcondition.getSAppFiltersName4())) {
fixconditions.add(new FormConditionBean(fixcondition.getSAppFiltersName4(), TextUtils.isEmpty(fixcondition.getSAppFilters4()) ? "" : fixcondition.getSAppFilters4()));
}
}
private void intiCondition(List<FormBean.ReportConditionBean> reportConditionBeans) {
conditions.addAll(reportConditionBeans);
runOnUiThread(new Runnable() {
@Override
public void run() {
tvRight.setVisibility(View.VISIBLE);
}
});
}
// private TableParser parser;
//传入json直接形成表单
private void setGsonData(String data) {
setTableStyle();
setTableData(data);
setTableFix();
}
private void setTableStyle() {
table.getConfig().setContentCellBackgroundFormat(new BaseCellBackgroundFormat<CellInfo>() {
@Override
public int getBackGroundColor(CellInfo cellInfo) {
if (isInterval == 1) {
if (cellInfo.row % 2 == 1) {
return ContextCompat.getColor(FormRefreshActivity.this, R.color.blue1);
}
return ContextCompat.getColor(FormRefreshActivity.this, R.color.white);
} else {
return ContextCompat.getColor(FormRefreshActivity.this, R.color.white);
}
// return TableConfig.INVALID_COLOR;
}
});
table.getConfig().setShowTableTitle(false);
table.getConfig().setColumnTitleBackground(new BaseBackgroundFormat(getResources().getColor(R.color.blue)));
table.getConfig().setColumnTitleStyle(new FontStyle(this, 15, getResources().getColor(R.color.white)).setAlign(Paint.Align.CENTER));
// table.getConfig().setColumnTitleBackground(new BaseBackgroundFormat(getResources().getColor(R.color.blue)));
table.getConfig().setVerticalPadding(30);
// table.getConfig().setHorizontalPadding(30);
table.getConfig().setColumnTitleVerticalPadding(30);
}
/*传入table数据*/
private void setTableData(String data) {
MapTableData tableData = MapTableData.create("", JsonHelper.jsonToMapList(data));
table.setTableData(tableData);
}
/*设置固定筛选项*/
private void setTab() {
llTab.setVisibility(View.VISIBLE);
for (int i = 0; i < fixconditions.size(); i++) {
TabView tab = new TabView(this);
tab.setText(fixconditions.get(i).getName());
tab.setPosition(i);
if (i == 0) {
currenViewPos = i;
currentView = tab;
}
tab.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(View view, int position) {
// Log.e("position", "position:" + position);
// if (currentView == null) {
// currenViewPos = position;
// currentView = (TabView) view;
// filter = fixconditions.get(position).getFilters();`
// getFormData(1);
// } else if (currenViewPos == position) {
// currenViewPos = -1;
// currentView = null;
// filter = "";
// getFormData(1);
// } else {
// currenViewPos = position;
// currentView.setChecked(false);
// currentView = (TabView) view;
// filter = fixconditions.get(position).getFilters();
// getFormData(1);
// }
if (currenViewPos != position) {
currenViewPos = position;
currentView.setChecked(false);
currentView = (TabView) view;
currentView.setChecked(true);
fixfilter = fixconditions.get(position).getFilters();
getFormData(1);
}
}
});
llTab.addView(tab);
}
currentView.setChecked(true);
}
/*设置固定列*/
private void setTableFix() {
columns = table.getTableData().getColumns();
if (columns != null && columns.size() > 0) {
for (int i = 0; i < columnsFix.size(); i++) {
columns.get(i).setFixed(true);
}
}
}
private void getFormData(int pagerIndex) {
LoadingDialog.showDialogForLoading(this);
new NetUtil(getFormParams(pagerIndex), url, new ResponseListener() {
@Override
public void onSuccess(String string) {
try {
JSONObject jsonObject = new JSONObject(string);
boolean isSuccess = jsonObject.optBoolean("success");
if (isSuccess) {
runOnUiThread(new Runnable() {
@Override
public void run() {
// Log.e("jsonObject.opt(\"data\")", jsonObject.opt("data") + "1");
if (jsonObject.optString("data").equals("[]")) {
loadFail("无数据");
} else {
setGsonData(jsonObject.optString("data"));
FormRefreshActivity.this.pagerIndex = pagerIndex;
tvPage.setText(pagerIndex + "");
}
loadFail("");
}
});
} else {
loadFail(jsonObject.getString("message"));
}
} catch (JSONException e) {
loadFail("json解析错误");
e.printStackTrace();
} catch (Exception e) {
loadFail("数据解析错误");
e.printStackTrace();
}
}
@Override
public void onFail(IOException e) {
e.printStackTrace();
loadFail("未获取到数据");
}
});
}
private List<NetParams> getFormParams(int pagerIndex) {
List<NetParams> params = new ArrayList<>();
params.add(new NetParams("otype", "getReportData"));
params.add(new NetParams("userid", userId));
params.add(new NetParams("iFormID", menuId));
params.add(new NetParams("pageNo", pagerIndex + ""));
if (StringUtil.isNotEmpty(fixfilter) && StringUtil.isNotEmpty(filter)) {
params.add(new NetParams("filters", filter + " and " + fixfilter));
} else {
params.add(new NetParams("filters", filter + fixfilter));
}
params.add(new NetParams("sort", ""));
params.add(new NetParams("order", "asc"));
return params;
}
@OnClick({R.id.iv_back, R.id.tv_right, R.id.tv_up, R.id.tv_down})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.iv_back:
finish();
break;
case R.id.tv_right:
goCondition();
break;
case R.id.tv_up:
if (pagerIndex == 1) {
loadFail("已经是第一页");
} else
getFormData(pagerIndex - 1);
break;
case R.id.tv_down:
getFormData(pagerIndex + 1);
break;
default:
break;
}
}
private void goCondition() {
Intent intent = new Intent();
intent.setClass(this, FormConditionActivity.class);
intent.putExtra("data", new Gson().toJson(conditions));
intent.putExtra("code", CONDIRION_CODE);
startActivityForResult(intent, CONDIRION_CODE);
}
/*请求关闭LoadingDialog和弹出提示*/
private void loadFail(String message) {
runOnUiThread(new Runnable() {
@Override
public void run() {
LoadingDialog.cancelDialogForLoading();
if (StringUtil.isNotEmpty(message))
Toasts.showShort(FormRefreshActivity.this, message);
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (data != null) {
if (resultCode == CONDIRION_CODE) {
filter = data.getStringExtra("data");
// if (currentView != null) {
// currenViewPos = -1;
// currentView.setChecked(false);
// currentView = null;
// }
// Log.e("filter", filter);
getFormData(1);
}
}
}
}
| [
"948335818@qq.com"
] | 948335818@qq.com |
6242555ebee2ccf838040cf9be3ee22d88a79e1d | 590cebae4483121569983808da1f91563254efed | /Router/schemas-src/eps-fts-schemas/src/main/java/ru/acs/fts/schemas/album/legalentityinfo/LegalEntityFormationType.java | 9e3cee68d86c4889f940d35c0240fccfe47ee539 | [] | no_license | ke-kontur/eps | 8b00f9c7a5f92edeaac2f04146bf0676a3a78e27 | 7f0580cd82022d36d99fb846c4025e5950b0c103 | refs/heads/master | 2020-05-16T23:53:03.163443 | 2014-11-26T07:00:34 | 2014-11-26T07:01:51 | null | 0 | 0 | null | null | null | null | WINDOWS-1251 | Java | false | false | 2,381 | java |
package ru.acs.fts.schemas.album.legalentityinfo;
import org.joda.time.LocalDate;
/**
* Сведения об образовании юридического лица
*/
public class LegalEntityFormationType extends ReferenceInfoType
{
private LocalDate regDate;
private String regNum;
private RecordDataType recordData;
private RegOrganType regOrgan;
/**
* Get the 'RegDate' element value. Дата регистрации юридического лица при образовании
*
* @return value
*/
public LocalDate getRegDate() {
return regDate;
}
/**
* Set the 'RegDate' element value. Дата регистрации юридического лица при образовании
*
* @param regDate
*/
public void setRegDate(LocalDate regDate) {
this.regDate = regDate;
}
/**
* Get the 'RegNum' element value. Регистрационный номер, присвоенный юридическому лицу при образовании
*
* @return value
*/
public String getRegNum() {
return regNum;
}
/**
* Set the 'RegNum' element value. Регистрационный номер, присвоенный юридическому лицу при образовании
*
* @param regNum
*/
public void setRegNum(String regNum) {
this.regNum = regNum;
}
/**
* Get the 'RecordData' element value. Сведения о записи
*
* @return value
*/
public RecordDataType getRecordData() {
return recordData;
}
/**
* Set the 'RecordData' element value. Сведения о записи
*
* @param recordData
*/
public void setRecordData(RecordDataType recordData) {
this.recordData = recordData;
}
/**
* Get the 'RegOrgan' element value. Орган, зарегистрировавший создание ЮЛ
*
* @return value
*/
public RegOrganType getRegOrgan() {
return regOrgan;
}
/**
* Set the 'RegOrgan' element value. Орган, зарегистрировавший создание ЮЛ
*
* @param regOrgan
*/
public void setRegOrgan(RegOrganType regOrgan) {
this.regOrgan = regOrgan;
}
}
| [
"m@brel.me"
] | m@brel.me |
325af0cf2192ab035544cf1d4082a95f68376d83 | 655e04ca7c837e34e7edc3a8f8ca9afeddbeec99 | /app/src/main/java/com/bartech/crm/sa/ui/main/rating/RatingDialogMvpView.java | 91d94f0867a0611c749a0cfd691c184d7f184ae9 | [
"Apache-2.0"
] | permissive | AhmedSwilam/CRM | 5d6326d264f4ead5be653a161e3d1aa934839635 | f44b2c9efd85d364120b51b6edc3c73171490525 | refs/heads/master | 2020-04-11T15:48:38.289494 | 2018-12-15T12:48:01 | 2018-12-15T12:48:01 | 161,903,722 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,015 | java | /*
* Copyright (C) 2017 MINDORKS NEXTGEN PRIVATE LIMITED
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://mindorks.com/license/apache-v2
*
* 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.bartech.crm.sa.ui.main.rating;
import com.bartech.crm.sa.ui.base.DialogMvpView;
/**
* Created by janisharali on 24/05/17.
*/
public interface RatingDialogMvpView extends DialogMvpView {
void openPlayStoreForRating();
void showPlayStoreRatingView();
void showRatingMessageView();
void hideSubmitButton();
void disableRatingStars();
void dismissDialog();
}
| [
"ahmedswilam21@gmail.com"
] | ahmedswilam21@gmail.com |
0baa5736baf9ab1a3d835e1e76a385d637c4a6a1 | 7bb254171d0f28a65f7ff143dd2ec47da3dd970d | /src/learning/Interface2.java | 057e623cefd80ee5a5293c4a2bdeb61e4b873b10 | [] | no_license | MilindAmrutkarCSS/LeetCodePrograms | c1896e1f14652bbb7453a085928dc005dba7535a | 722e17a555347fd1764f24eeeee9fc861dd6644e | refs/heads/master | 2020-05-18T18:35:26.406644 | 2019-05-02T14:02:49 | 2019-05-02T14:02:49 | 184,590,697 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 163 | java | package learning;
public interface Interface2 {
void method2();
default void log(String str) {
System.out.println("I2 logging: " + str);
}
}
| [
"cssindiamilind@gmail.com"
] | cssindiamilind@gmail.com |
84784fbdf298c4a3d7f8ed684363119306689679 | 2c140a0632890ce2a28a9025b493cbc67fab3bd5 | /src/main/java/org/hl7/v3/EntityDeterminer.java | cd060412e93f1ae4b1e8a573fc1d7e023ab49c7f | [] | no_license | darkxi/hl7-Edition2012 | cf5d475e06464c776b8b39676953835aae1fb3f5 | add3330c499fd0491fd18a2f71be04a3c1efb391 | refs/heads/master | 2020-06-07T01:21:19.768327 | 2017-07-18T03:23:43 | 2017-08-18T09:03:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,151 | java | //
// 此文件是由 JavaTM Architecture for XML Binding (JAXB) 引用实现 v2.2.7 生成的
// 请访问 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// 在重新编译源模式时, 对此文件的所有修改都将丢失。
// 生成时间: 2017.08.10 时间 10:45:02 AM CST
//
package org.hl7.v3;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlType;
/**
* <p>EntityDeterminer的 Java 类。
*
* <p>以下模式片段指定包含在此类中的预期内容。
* <p>
* <pre>
* <simpleType name="EntityDeterminer">
* <restriction base="{urn:hl7-org:v3}cs">
* <enumeration value="INSTANCE"/>
* <enumeration value="KIND"/>
* <enumeration value="QUANTIFIED_KIND"/>
* </restriction>
* </simpleType>
* </pre>
*
*/
@XmlType(name = "EntityDeterminer")
@XmlEnum
public enum EntityDeterminer {
INSTANCE,
KIND,
QUANTIFIED_KIND;
public String value() {
return name();
}
public static EntityDeterminer fromValue(String v) {
return valueOf(v);
}
}
| [
"2319457455@qq.com"
] | 2319457455@qq.com |
3d4eaefc1179d0d1767043e337d5a44f816f8e28 | 5c2911730c0abdeff9406ac08c239eda54d07aaa | /src/main/java/ua/mycompany/xtasks/post/Post.java | fd29848dbea46f03932edafc6718934fd064bcc9 | [] | no_license | ZaichenkoVasia/HomeTaskJava | 8d465c7e7d75610ed06bd4f3a71d4823c8a93b66 | bb8d75b608ac2fc060124dcf9bbb6720df876efe | refs/heads/master | 2021-07-13T09:48:14.328033 | 2020-01-21T20:47:43 | 2020-01-21T20:47:43 | 208,034,748 | 0 | 0 | null | 2020-10-13T16:02:59 | 2019-09-12T11:24:54 | Java | UTF-8 | Java | false | false | 3,812 | java | package ua.mycompany.xtasks.post;
import java.util.Arrays;
public class Post {
private int storageCapacity = 10;
private int letterCount = 0;
private Letter[] letters = new Letter[storageCapacity];
public int getLetterCount() {
return letterCount;
}
public int getStorageCapacity() {
return storageCapacity;
}
public Letter[] getLetters() {
return letters;
}
public void sendLetter(Letter letter) {
if (letterCount == storageCapacity) {
letters = Arrays.copyOf(letters, storageCapacity += 5);
}
letters[letterCount++] = letter;
}
public Letter[] takeLettersByReceiver(Person person) {
Letter[] personLetters = new Letter[10];
int personCount = 0;
for (int i = 0; i < letterCount; i++) {
if (person == letters[i].getReceiver()) {
if (personCount == personLetters.length) {
personLetters = Arrays.copyOf(personLetters, personLetters.length + 5);
}
personLetters[personCount++] = letters[i];
letters[i].setDelivered(true);
}
}
return Arrays.copyOf(personLetters, personCount);
}
public Letter[] takeLettersBySender(Person person) {
Letter[] personLetters = new Letter[10];
int personCount = 0;
for (int i = 0; i < letterCount; i++) {
if (person == letters[i].getSender()) {
if (personCount == personLetters.length) {
personLetters = Arrays.copyOf(personLetters, personLetters.length + 5);
}
personLetters[personCount++] = letters[i];
letters[i].setDelivered(true);
}
}
return Arrays.copyOf(personLetters, personCount);
}
public Letter[] takeLettersBySenderAndReceiver(Person sender, Person receiver) {
Letter[] personLetters = new Letter[10];
int personCount = 0;
for (int i = 0; i < letterCount; i++) {
if (sender == letters[i].getSender() && receiver == letters[i].getReceiver()) {
if (personCount == personLetters.length) {
personLetters = Arrays.copyOf(personLetters, personLetters.length + 5);
}
personLetters[personCount++] = letters[i];
letters[i].setDelivered(true);
}
}
return Arrays.copyOf(personLetters, personCount);
}
public int getNumberOflettersSentByPerson(Person person) {
int personCount = 0;
for (int i = 0; i < letterCount; i++) {
if (person == letters[i].getSender()) {
personCount++;
}
}
return personCount;
}
public Letter[] getUndeliveredLetters()
{
Letter[] letters = new Letter[10];
int letterCount = 0;
for (int i = 0; i < this.letterCount; i++) {
if (!this.letters[i].isDelivered()) {
if (letterCount == letters.length) {
letters = Arrays.copyOf(letters, letters.length + 5);
}
letters[letterCount++] = this.letters[i];
}
}
return Arrays.copyOf(letters, letterCount);
}
public Letter[] getDeliveredLetters()
{
Letter[] letters = new Letter[10];
int letterCount = 0;
for (int i = 0; i < this.letterCount; i++) {
if (this.letters[i].isDelivered()) {
if (letterCount == letters.length) {
letters = Arrays.copyOf(letters, letters.length + 5);
}
letters[letterCount++] = this.letters[i];
}
}
return Arrays.copyOf(letters, letterCount);
}
}
| [
"zaichenko.vasyl@gmail.com"
] | zaichenko.vasyl@gmail.com |
8c58dd7a974f6d8a7501f67b72c3d2a13f081a73 | e8fffe840bf26a96336e91a25440bb1cb94d80cb | /Settings.java | 6f9295a549b96203ea73d1306906dd09a6c6430d | [] | no_license | Exonto/Artificial-Intelligence-Testing | 82a8959b98aac2517bbb1ac22b287af3c33780eb | e95d77d9bd5312612f19e3bf1b38568181df9c1f | refs/heads/master | 2021-01-01T03:40:18.502602 | 2016-05-16T06:15:27 | 2016-05-16T06:15:27 | 58,906,777 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 178 | java | package com.gmail.username.tylersyme.survivor;
/**
* Stores in game settings staticly
*/
public class Settings {
public static final int defaultTileSize = 32;
}
| [
"tylersyme@gmail.com"
] | tylersyme@gmail.com |
ab3c18f631a990ea8b2fbf6f882f01508090598c | 94691c2d1c80d2bd88b91fbf3c51c131b7a703e0 | /boardgame-auth/src/main/java/com/lxiaocode/boardgame/auth/rbac/domain/PermissionDetails.java | 8b42316099095ef8327719675411ba74949558cd | [] | no_license | lxiaocode11/boardgame-store | 52da35d2435c891ac1a8c0ef8b649ac2a7762ce9 | a9ea699fba7bdda2d4b175d445a27899c0e7d087 | refs/heads/master | 2023-01-28T10:00:33.896434 | 2020-12-14T15:54:43 | 2020-12-14T15:54:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 793 | java | package com.lxiaocode.boardgame.auth.rbac.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.lxiaocode.boardgame.auth.rbac.PermissionEnum;
import com.lxiaocode.boardgame.common.domain.BaseEntity;
import lombok.Data;
import java.util.List;
/**
* @author lixiaofeng
* @date 2020/12/4 上午11:13
* @blog http://www.lxiaocode.com/
*/
@Data
@TableName("manager_permission")
public class PermissionDetails extends BaseEntity implements IPermissionDetails {
private static final long serialVersionUID = 135744156432112782L;
private String resourceId;
private PermissionEnum type;
@TableField(exist = false)
private String url;
@TableField(exist = false)
private List<IRole> roles;
}
| [
"lxiaofeng101@gmail.com"
] | lxiaofeng101@gmail.com |
5e17547fa389fe3d0134b8ba5d9ab9a67dfa2d1f | 7b31eb168e0feca4630729d296b4704ee2b86329 | /src/geviuc/LineUC.java | bbdc3f173ebf93ef7c1a12366a646cd39a571570 | [] | no_license | cabenavi/GEVIUC-Academic-beta | 69667469497470c4e2460d823a72ee2eca95d8c2 | 149b18cc99a35c3962ca75dd271f9d18ee5edd49 | refs/heads/master | 2021-01-10T12:56:46.191530 | 2016-01-12T03:52:11 | 2016-01-12T03:52:11 | 49,472,533 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,563 | java | import ilog.concert.*;
import ilog.cplex.*;
public class LineUC{
/****************************** VARIABLES PROBLEMA OPTIMIZACION *************************************************************************/
//varibles continuas
IloNumVar[] F; //F[t] //Flujo por la linea
IloNumVar[][] Fp; //Fp[s][t] //Flujo por la linea linealizado por tramo
IloNumVar[][] Fn; //Fn[s][t] //Flujo por la linea linealizado por tramo
/******************************* FIN VARIABLES PROBLEMA OPTIMIZACION ********************************************************************************/
//Atributos: todos variables en el tiempo
int[] ID;
String[] Nombre;
int[] BusIni;
int[] BusFin;
double[] Resistencia;
double[] Reactancia;
double[] Largo;
double[] Voltaje;
double[] Fmax;
double[] Fmin;
String[] Propietario;
double[][] matriz_alpha;
int [] tramos_maximo; //tramos maximos para linealizar perdidas
String[] Opera; //si la linea opera o no opera
double Sbase;
//Atributos auxiliares
double UnitT;
//contructor
public LineUC(){
}
public void InitUC(int[] ID, String[] Nombre, int[] BusIni, int[] BusFin, double[] Resistencia, double[] Reactancia, double[] Largo, double[] Voltaje, double[] Fmin, double[] Fmax, String[] Propietario, double[][] matriz_alpha,int[] tramos_maximo,String[] Opera) {
this.ID = ID;
this.Nombre = Nombre;
this.BusIni = BusIni;
this.BusFin = BusFin;
this.Resistencia = Resistencia;
this.Reactancia = Reactancia;
this.Largo = Largo;
this.Voltaje = Voltaje;
this.Fmax = Fmax;
this.Fmin = Fmin;
this.Propietario = Propietario;
this.matriz_alpha = matriz_alpha;
this.Sbase = 100;
this.tramos_maximo = tramos_maximo; //tramos maximos para linealizar perdidas
this.Opera = Opera; //si la linea opera o no opera
}
//se cargan datos auxiliares
public void InitDataUC( double UnitT){
this.UnitT =UnitT;
}
//Inicializacion de variables
public void InitVariables(int[] H,int lp, IloCplex cplex){
int T= H.length;
//nombre variables
String[] nombreF = new String[T];
String[][] nombreFp = new String[matriz_alpha.length][T];
String[][] nombreFn = new String[matriz_alpha.length][T];
for(int t=0;t<T;t++){
nombreF[t]="F" +"("+ID[t] +","+(t+1)+")";
}
for(int t=0;t<T;t++){
for (int s=0; s<matriz_alpha.length;s++){
nombreFp[s][t]="Fp" +"("+ID[t] + ","+(s+1) +","+(t+1)+")";
nombreFn[s][t]="Fn" +"("+ID[t] + ","+(s+1) +","+(t+1)+")";
}
}
//variables continuas
F = new IloNumVar[T];
Fp = new IloNumVar[matriz_alpha.length][T];
Fn = new IloNumVar[matriz_alpha.length][T];
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
try{
if(lp==1){
for(int t=0;t<T;t++){
F[t]=cplex.numVar(Fmin[t],Fmax[t],nombreF[t]);
}
for(int t=0;t<T;t++){
for (int s=0; s<matriz_alpha.length;s++){
Fp[s][t]=cplex.numVar(0,Fmax[t]/matriz_alpha.length,nombreFp[s][t]);
Fn[s][t]=cplex.numVar(0,Fmax[t]/matriz_alpha.length,nombreFn[s][t]);
}
}
}
}
catch (IloException e) {
System.err.println("Concert Definicion de variables '" + e + "' caught");
}
}
///////////////////////////////////Restricciones/////////////////////////////////////////////////////////////////////////////
// Sin restricciones individuales
}
| [
"cabenavi@cabenavi-pc"
] | cabenavi@cabenavi-pc |
39d184a08ef719b882b46645b1cadec0bf4f630b | ba04e6696369d2d0d66d10a87fa052c25f18adfa | /linklisttest/src/test/java/TestSingleLinkedList.java | a5024d328f534f4de10f7136b2bee63ec925c2c6 | [] | no_license | trungptdhcn/TDD-Trainning | e43e07a11e42487528d2d428d55f31c852585300 | 49b3a38d6e048d6a37096fd62b72e35abb60e43a | refs/heads/master | 2021-01-20T02:47:48.809950 | 2013-07-29T07:05:04 | 2013-07-29T07:05:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,238 | java | import junit.framework.TestCase;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
/**
* User: trungpt
* Date: 7/23/13
* Time: 1:37 PM
*/
public class TestSingleLinkedList extends TestCase
{
@Test
public void testInitializationLinkListEmpty()
{
SingleLinkedList linkList= new SingleLinkedList();
assertEquals(null,linkList.getLinkList());
}
@Test
public void testInitializationLinkListFromArrayObject()
{
List<Integer> integerList = new ArrayList<Integer>();
integerList.add(2);
integerList.add(3);
SingleLinkedList linkedList = new SingleLinkedList(integerList);
}
@Test
public void testGetSizeLinkList()
{
List<Integer> integerList = new ArrayList<Integer>();
integerList.add(2);
integerList.add(3);
SingleLinkedList linkedList = new SingleLinkedList(integerList);
assertEquals(2,linkedList.size());
}
@Test
public void testInsertAfter()
{
List<Integer> integerList = new ArrayList<Integer>();
integerList.add(2);
integerList.add(3);
SingleLinkedList linkedList = new SingleLinkedList(integerList);
linkedList.insertAfter(2,5);
assertEquals((Object) 5,linkedList.getLinkList().get(2));
}
@Test
public void testDelete()
{
List<Integer> integerList = new ArrayList<Integer>();
integerList.add(2);
integerList.add(3);
SingleLinkedList linkedList = new SingleLinkedList(integerList);
assertEquals((Object) 3,linkedList.delete(1));
assertEquals(1,linkedList.size());
}
@Test
public void testGetFirst()
{
List<Integer> integerList = new ArrayList<Integer>();
integerList.add(2);
integerList.add(3);
SingleLinkedList linkedList = new SingleLinkedList(integerList);
assertEquals(2,linkedList.first());
}
@Test
public void testGetLast()
{
List<Integer> integerList = new ArrayList<Integer>();
integerList.add(2);
integerList.add(3);
SingleLinkedList linkedList = new SingleLinkedList(integerList);
assertEquals(3,linkedList.last());
}
}
| [
"trungptdhcn@gmail.com"
] | trungptdhcn@gmail.com |
70b8564d9784aa752683c8927c71fb1f58a56791 | 250bf3031bb67d4409bea884952d2a837583ef81 | /app/src/main/java/skyray/waol2000/datamodel/HeightType.java | 1b2e1de8592e8a179e645bca5a62868c60bffdc2 | [] | no_license | linyuan620/WAOL2000_acquaintance | c04a5b79ff7922b6c4875be324afd83369aab9bb | 327d2dda49d90d63db65fa80fd296be844681e2b | refs/heads/master | 2021-05-15T23:32:44.999135 | 2017-10-27T02:05:45 | 2017-10-27T02:05:45 | 106,912,236 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 605 | java | package skyray.waol2000.datamodel;
/**
* Created by PengJianbo on 2017/9/4.
*/
/**
* 设置取液高度
*/
public enum HeightType {
low(0), high(1), full(2);
private int _value;
private HeightType(int value) {
_value = value;
}
public int value() {
return _value;
}
public static HeightType valueOf(int value) {
switch (value) {
case 0:
return low;
case 1:
return high;
case 2:
return full;
default:
return null;
}
}
}
| [
"linyuan@skyray-instrument.com"
] | linyuan@skyray-instrument.com |
22bc345ee22d0ae7703dd1cee60e6a6d1ca43b6c | d7af2699196aae47226ce728910e6616543f432a | /app/src/test/java/com/ennjapps/sqlitedatabasedemo/ExampleUnitTest.java | 4a500668acdf99bf76aa67d9094af45f4b8ff74e | [] | no_license | mdhaider/SQLiteDatabaseDemo | 6b732ebd9083170e510fde0db193ce253c9f07c7 | a341ffbf1de7b4f9b70f4b089096d1715de1a350 | refs/heads/master | 2021-01-10T07:26:32.459112 | 2016-03-26T11:06:46 | 2016-03-26T11:06:46 | 54,775,326 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 324 | java | package com.ennjapps.sqlitedatabasedemo;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"nehal.hdr@gmail.com"
] | nehal.hdr@gmail.com |
7da654dd9f2a168161dcb6f82bb68bb9ff7e6b4e | 3cee619f9d555e75625bfff889ae5c1394fd057a | /app/src/main/java/org/tensorflow/lite/examples/imagesegmentation/p073b/p085h/p087b/p088a/p090b/p117g/C2368c.java | 61f4734e4acb986f4a26e78fbea8d279223aad2b | [] | no_license | randauto/imageerrortest | 6fe12d92279e315e32409e292c61b5dc418f8c2b | 06969c68b9d82ed1c366d8b425c87c61db933f15 | refs/heads/master | 2022-04-21T18:21:56.836502 | 2020-04-23T16:18:49 | 2020-04-23T16:18:49 | 258,261,084 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,536 | java | package p073b.p085h.p087b.p088a.p090b.p117g;
import java.util.NoSuchElementException;
import p073b.p085h.p087b.p088a.p090b.p117g.C2371d.C2372a;
/* renamed from: b.h.b.a.b.g.c */
/* compiled from: BoundedByteString */
class C2368c extends C2403p {
/* renamed from: d */
private final int f7248d;
/* renamed from: e */
private final int f7249e;
/* renamed from: b.h.b.a.b.g.c$a */
/* compiled from: BoundedByteString */
private class C2370a implements C2372a {
/* renamed from: b */
private int f7251b;
/* renamed from: c */
private final int f7252c;
private C2370a() {
this.f7251b = C2368c.this.mo9066b();
this.f7252c = this.f7251b + C2368c.this.mo9064a();
}
public boolean hasNext() {
return this.f7251b < this.f7252c;
}
/* renamed from: a */
public Byte next() {
return Byte.valueOf(mo9070b());
}
/* renamed from: b */
public byte mo9070b() {
if (this.f7251b < this.f7252c) {
byte[] bArr = C2368c.this.f7323c;
int i = this.f7251b;
this.f7251b = i + 1;
return bArr[i];
}
throw new NoSuchElementException();
}
public void remove() {
throw new UnsupportedOperationException();
}
}
C2368c(byte[] bArr, int i, int i2) {
super(bArr);
if (i < 0) {
StringBuilder sb = new StringBuilder(29);
sb.append("Offset too small: ");
sb.append(i);
throw new IllegalArgumentException(sb.toString());
} else if (i2 < 0) {
StringBuilder sb2 = new StringBuilder(29);
sb2.append("Length too small: ");
sb2.append(i);
throw new IllegalArgumentException(sb2.toString());
} else if (((long) i) + ((long) i2) <= ((long) bArr.length)) {
this.f7248d = i;
this.f7249e = i2;
} else {
StringBuilder sb3 = new StringBuilder(48);
sb3.append("Offset+Length too large: ");
sb3.append(i);
sb3.append("+");
sb3.append(i2);
throw new IllegalArgumentException(sb3.toString());
}
}
/* renamed from: a */
public byte mo9063a(int i) {
if (i < 0) {
StringBuilder sb = new StringBuilder(28);
sb.append("Index too small: ");
sb.append(i);
throw new ArrayIndexOutOfBoundsException(sb.toString());
} else if (i < mo9064a()) {
return this.f7323c[this.f7248d + i];
} else {
int a = mo9064a();
StringBuilder sb2 = new StringBuilder(41);
sb2.append("Index too large: ");
sb2.append(i);
sb2.append(", ");
sb2.append(a);
throw new ArrayIndexOutOfBoundsException(sb2.toString());
}
}
/* renamed from: a */
public int mo9064a() {
return this.f7249e;
}
/* access modifiers changed from: protected */
/* renamed from: b */
public int mo9066b() {
return this.f7248d;
}
/* access modifiers changed from: protected */
/* renamed from: a */
public void mo9065a(byte[] bArr, int i, int i2, int i3) {
System.arraycopy(this.f7323c, mo9066b() + i, bArr, i2, i3);
}
/* renamed from: c */
public C2372a iterator() {
return new C2370a();
}
}
| [
"tuanlq@funtap.vn"
] | tuanlq@funtap.vn |
95907b560b9c8f25827585c26b9606c1d9418aaf | 9ca0c2ed89da63d07c4092259b7144839434ef83 | /mall-api/src/main/java/com/mall/api/user/mapper/UserMapper.java | d2321c82299cad48437de4ffd038f56fa69cd04b | [] | no_license | mouxiao/mall-cloud | 6d68612f2bb410f3451d3fd24efb4db971522a1c | f810e380738c82b97914f041cfc0933dfdb7bda0 | refs/heads/master | 2020-04-10T12:44:14.274260 | 2018-12-19T14:56:37 | 2018-12-19T14:56:37 | 161,031,016 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 581 | java | package com.mall.api.user.mapper;
import com.mall.commons.entity.User;
import org.apache.ibatis.annotations.*;
/**
* @author mouxiao
* @remark
* @date 2018/12/19 0019 22:01
*/
@Mapper
public interface UserMapper {
@Results(id = "userResult", value = {
@Result(property = "id", column = "ID", id = true),
@Result(property = "username", column = "USER_NAME"),
@Result(property = "password", column = "PASSWORD")
})
@Select("select * from user where id = #{id} ")
public User getUserById(@Param(value = "id") Integer id);
}
| [
"mouxiao1014@gmail.com"
] | mouxiao1014@gmail.com |
c6574a94987367ee480f99ec4fda9f1fb2c2bf91 | d67d29e3df07b2b46292c4b0083d77caf4f29a24 | /src/com/miracle/astree/visitor/ScopeBuilder.java | dbb2c72530315b498dcd8041e40c3c25cbb64457 | [] | no_license | Kipsora/x86-64-Java-Miracle-Compiler | 896ef5beb26086c06b96831292d81d7f66e2739c | 14345c21c2b5ebbd8e57d6b77bb1c40be6720262 | refs/heads/master | 2021-01-23T02:06:00.403594 | 2017-06-21T15:49:07 | 2017-06-21T15:49:07 | 85,963,743 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,746 | java | package com.miracle.astree.visitor;
import com.miracle.astree.ASTree;
import com.miracle.astree.base.TypeNode;
import com.miracle.astree.statement.*;
import com.miracle.astree.statement.declaration.ClassDeclaration;
import com.miracle.astree.statement.declaration.FunctionDeclaration;
import com.miracle.astree.statement.declaration.VariableDeclaration;
import com.miracle.astree.statement.expression.*;
import com.miracle.astree.statement.expression.constant.BooleanConstant;
import com.miracle.astree.statement.expression.constant.IntegerConstant;
import com.miracle.astree.statement.expression.constant.NullConstant;
import com.miracle.astree.statement.expression.constant.StringConstant;
import com.miracle.symbol.SymbolTable;
public class ScopeBuilder implements ASTreeVisitor {
private SymbolTable scope;
@Override
public void visit(FunctionDeclaration functionDeclaration) {
functionDeclaration.setScope(scope);
if (functionDeclaration.returnType != null) {
functionDeclaration.returnType.accept(this);
}
scope = new SymbolTable(scope);
functionDeclaration.parameters.forEach(element -> element.accept(this));
functionDeclaration.body.forEach(element -> element.accept(this));
scope = scope.getParentSymbolTable();
}
@Override
public void visit(ClassDeclaration classDeclaration) {
classDeclaration.setScope(scope);
scope = new SymbolTable(scope);
classDeclaration.functionDeclarations.forEach(element -> element.accept(this));
classDeclaration.variableDeclarations.forEach(element -> element.accept(this));
if (classDeclaration.constructorDeclaration != null) {
classDeclaration.constructorDeclaration.accept(this);
}
scope = scope.getParentSymbolTable();
}
@Override
public void visit(ASTree astree) {
astree.setScope(scope = new SymbolTable(null));
astree.declarations.forEach(element -> element.accept(this));
}
@Override
public void visit(VariableDeclaration variableDeclaration) {
variableDeclaration.setScope(scope);
variableDeclaration.typenode.accept(this);
if (variableDeclaration.expression != null) {
variableDeclaration.expression.accept(this);
}
}
@Override
public void visit(Block block) {
block.setScope(scope);
scope = new SymbolTable(scope);
block.statements.forEach(element -> element.accept(this));
scope = scope.getParentSymbolTable();
}
@Override
public void visit(Selection selection) {
selection.setScope(scope);
selection.expression.accept(this);
if (selection.branchTrue != null) {
if (selection.branchTrue instanceof Block) {
selection.branchTrue.accept(this);
} else {
scope = new SymbolTable(scope);
selection.branchTrue.accept(this);
scope = scope.getParentSymbolTable();
}
}
if (selection.branchFalse != null) {
if (selection.branchFalse instanceof Block) {
selection.branchFalse.accept(this);
} else {
scope = new SymbolTable(scope);
selection.branchFalse.accept(this);
scope = scope.getParentSymbolTable();
}
}
}
@Override
public void visit(Iteration iteration) {
iteration.setScope(scope);
if (iteration.initializeExpression != null) {
iteration.initializeExpression.accept(this);
}
if (iteration.conditionExpression != null) {
iteration.conditionExpression.accept(this);
}
if (iteration.incrementExpression != null) {
iteration.incrementExpression.accept(this);
}
if (iteration.body != null) {
if (iteration.body instanceof Block) {
iteration.body.accept(this);
} else {
scope = new SymbolTable(scope);
iteration.body.accept(this);
scope = scope.getParentSymbolTable();
}
}
}
@Override
public void visit(Break breakLiteral) {
breakLiteral.setScope(scope);
}
@Override
public void visit(Continue continueLiteral) {
continueLiteral.setScope(scope);
}
@Override
public void visit(ReturnStatement returnLiteral) {
returnLiteral.setScope(scope);
if (returnLiteral.expression != null) {
returnLiteral.expression.accept(this);
}
}
@Override
public void visit(Variable variable) {
variable.setScope(scope);
}
@Override
public void visit(CallExpression callExpression) {
callExpression.setScope(scope);
callExpression.function.accept(this);
callExpression.parameters.forEach(element -> element.accept(this));
}
@Override
public void visit(Subscript subscript) {
subscript.setScope(scope);
subscript.base.accept(this);
subscript.coordinate.accept(this);
}
@Override
public void visit(BinaryExpression binaryExpression) {
binaryExpression.setScope(scope);
binaryExpression.left.accept(this);
binaryExpression.right.accept(this);
}
@Override
public void visit(PrefixExpression prefixExpression) {
prefixExpression.setScope(scope);
prefixExpression.expression.accept(this);
}
@Override
public void visit(SuffixExpression suffixExpression) {
suffixExpression.setScope(scope);
suffixExpression.expression.accept(this);
}
@Override
public void visit(New newNode) {
newNode.setScope(scope);
newNode.variableType.accept(this);
newNode.expressions.forEach(element -> {
if (element != null) element.accept(this);
});
}
@Override
public void visit(StringConstant stringConstant) {
stringConstant.setScope(scope);
}
@Override
public void visit(IntegerConstant integerConstant) {
integerConstant.setScope(scope);
}
@Override
public void visit(BooleanConstant booleanConstant) {
booleanConstant.setScope(scope);
}
@Override
public void visit(NullConstant nullConstant) {
nullConstant.setScope(scope);
}
@Override
public void visit(This thisNode) {
thisNode.setScope(scope);
}
@Override
public void visit(Field field) {
field.setScope(scope);
field.expression.accept(this);
}
@Override
public void visit(TypeNode typeNode) {
typeNode.setScope(scope);
}
}
| [
"kipsora@gmail.com"
] | kipsora@gmail.com |
b5a94e11ed31bccaa33d7f86536108b66d5aed60 | b1ab5e287b21c7223f647d7c2b02a19a42fbd285 | /src/test/java/com/recruitsmart/web/rest/JobOrderInternalCommentResourceIntTest.java | 5136bec35a8b314a365c1caf9af7f581d9a304f5 | [] | no_license | Theozmcgee/mysoftwareapp | cdbd69993a541bbd8cb3c72465b3dd26333153ed | 934180622a6e2bf945d3732ba909fe711fbd4e68 | refs/heads/master | 2020-04-08T09:39:16.108705 | 2018-11-20T17:35:17 | 2018-11-20T17:35:17 | 159,233,498 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,985 | java | package com.recruitsmart.web.rest;
import com.recruitsmart.RecruitsmartApp;
import com.recruitsmart.domain.JobOrderInternalComment;
import com.recruitsmart.repository.JobOrderInternalCommentRepository;
import com.recruitsmart.repository.search.JobOrderInternalCommentSearchRepository;
import com.recruitsmart.web.rest.errors.ExceptionTranslator;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.MockitoAnnotations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityManager;
import java.util.List;
import static com.recruitsmart.web.rest.TestUtil.createFormattingConversionService;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
/**
* Test class for the JobOrderInternalCommentResource REST controller.
*
* @see JobOrderInternalCommentResource
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = RecruitsmartApp.class)
public class JobOrderInternalCommentResourceIntTest {
private static final String DEFAULT_NAME = "AAAAAAAAAA";
private static final String UPDATED_NAME = "BBBBBBBBBB";
private static final String DEFAULT_DESCRIPTION = "AAAAAAAAAA";
private static final String UPDATED_DESCRIPTION = "BBBBBBBBBB";
@Autowired
private JobOrderInternalCommentRepository jobOrderInternalCommentRepository;
@Autowired
private JobOrderInternalCommentSearchRepository jobOrderInternalCommentSearchRepository;
@Autowired
private MappingJackson2HttpMessageConverter jacksonMessageConverter;
@Autowired
private PageableHandlerMethodArgumentResolver pageableArgumentResolver;
@Autowired
private ExceptionTranslator exceptionTranslator;
@Autowired
private EntityManager em;
private MockMvc restJobOrderInternalCommentMockMvc;
private JobOrderInternalComment jobOrderInternalComment;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
final JobOrderInternalCommentResource jobOrderInternalCommentResource = new JobOrderInternalCommentResource(jobOrderInternalCommentRepository, jobOrderInternalCommentSearchRepository);
this.restJobOrderInternalCommentMockMvc = MockMvcBuilders.standaloneSetup(jobOrderInternalCommentResource)
.setCustomArgumentResolvers(pageableArgumentResolver)
.setControllerAdvice(exceptionTranslator)
.setConversionService(createFormattingConversionService())
.setMessageConverters(jacksonMessageConverter).build();
}
/**
* Create an entity for this test.
*
* This is a static method, as tests for other entities might also need it,
* if they test an entity which requires the current entity.
*/
public static JobOrderInternalComment createEntity(EntityManager em) {
JobOrderInternalComment jobOrderInternalComment = new JobOrderInternalComment();
jobOrderInternalComment.setName(DEFAULT_NAME);
jobOrderInternalComment.setDescription(DEFAULT_DESCRIPTION);
return jobOrderInternalComment;
}
@Before
public void initTest() {
jobOrderInternalCommentSearchRepository.deleteAll();
jobOrderInternalComment = createEntity(em);
}
@Test
@Transactional
public void createJobOrderInternalComment() throws Exception {
int databaseSizeBeforeCreate = jobOrderInternalCommentRepository.findAll().size();
// Create the JobOrderInternalComment
restJobOrderInternalCommentMockMvc.perform(post("/api/job-order-internal-comments")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(jobOrderInternalComment)))
.andExpect(status().isCreated());
// Validate the JobOrderInternalComment in the database
List<JobOrderInternalComment> jobOrderInternalCommentList = jobOrderInternalCommentRepository.findAll();
assertThat(jobOrderInternalCommentList).hasSize(databaseSizeBeforeCreate + 1);
JobOrderInternalComment testJobOrderInternalComment = jobOrderInternalCommentList.get(jobOrderInternalCommentList.size() - 1);
assertThat(testJobOrderInternalComment.getName()).isEqualTo(DEFAULT_NAME);
assertThat(testJobOrderInternalComment.getDescription()).isEqualTo(DEFAULT_DESCRIPTION);
// Validate the JobOrderInternalComment in Elasticsearch
JobOrderInternalComment jobOrderInternalCommentEs = jobOrderInternalCommentSearchRepository.findOne(testJobOrderInternalComment.getId());
assertThat(jobOrderInternalCommentEs).isEqualToIgnoringGivenFields(testJobOrderInternalComment);
}
@Test
@Transactional
public void createJobOrderInternalCommentWithExistingId() throws Exception {
int databaseSizeBeforeCreate = jobOrderInternalCommentRepository.findAll().size();
// Create the JobOrderInternalComment with an existing ID
jobOrderInternalComment.setId(1L);
// An entity with an existing ID cannot be created, so this API call must fail
restJobOrderInternalCommentMockMvc.perform(post("/api/job-order-internal-comments")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(jobOrderInternalComment)))
.andExpect(status().isBadRequest());
// Validate the JobOrderInternalComment in the database
List<JobOrderInternalComment> jobOrderInternalCommentList = jobOrderInternalCommentRepository.findAll();
assertThat(jobOrderInternalCommentList).hasSize(databaseSizeBeforeCreate);
}
@Test
@Transactional
public void getAllJobOrderInternalComments() throws Exception {
// Initialize the database
jobOrderInternalCommentRepository.saveAndFlush(jobOrderInternalComment);
// Get all the jobOrderInternalCommentList
restJobOrderInternalCommentMockMvc.perform(get("/api/job-order-internal-comments?sort=id,desc"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(jobOrderInternalComment.getId().intValue())))
.andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME.toString())))
.andExpect(jsonPath("$.[*].description").value(hasItem(DEFAULT_DESCRIPTION.toString())));
}
@Test
@Transactional
public void getJobOrderInternalComment() throws Exception {
// Initialize the database
jobOrderInternalCommentRepository.saveAndFlush(jobOrderInternalComment);
// Get the jobOrderInternalComment
restJobOrderInternalCommentMockMvc.perform(get("/api/job-order-internal-comments/{id}", jobOrderInternalComment.getId()))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.id").value(jobOrderInternalComment.getId().intValue()))
.andExpect(jsonPath("$.name").value(DEFAULT_NAME.toString()))
.andExpect(jsonPath("$.description").value(DEFAULT_DESCRIPTION.toString()));
}
@Test
@Transactional
public void getNonExistingJobOrderInternalComment() throws Exception {
// Get the jobOrderInternalComment
restJobOrderInternalCommentMockMvc.perform(get("/api/job-order-internal-comments/{id}", Long.MAX_VALUE))
.andExpect(status().isNotFound());
}
@Test
@Transactional
public void updateJobOrderInternalComment() throws Exception {
// Initialize the database
jobOrderInternalCommentRepository.saveAndFlush(jobOrderInternalComment);
jobOrderInternalCommentSearchRepository.save(jobOrderInternalComment);
int databaseSizeBeforeUpdate = jobOrderInternalCommentRepository.findAll().size();
// Update the jobOrderInternalComment
JobOrderInternalComment updatedJobOrderInternalComment = jobOrderInternalCommentRepository.findOne(jobOrderInternalComment.getId());
// Disconnect from session so that the updates on updatedJobOrderInternalComment are not directly saved in db
em.detach(updatedJobOrderInternalComment);
updatedJobOrderInternalComment.setName(UPDATED_NAME);
updatedJobOrderInternalComment.setDescription(UPDATED_DESCRIPTION);
restJobOrderInternalCommentMockMvc.perform(put("/api/job-order-internal-comments")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(updatedJobOrderInternalComment)))
.andExpect(status().isOk());
// Validate the JobOrderInternalComment in the database
List<JobOrderInternalComment> jobOrderInternalCommentList = jobOrderInternalCommentRepository.findAll();
assertThat(jobOrderInternalCommentList).hasSize(databaseSizeBeforeUpdate);
JobOrderInternalComment testJobOrderInternalComment = jobOrderInternalCommentList.get(jobOrderInternalCommentList.size() - 1);
assertThat(testJobOrderInternalComment.getName()).isEqualTo(UPDATED_NAME);
assertThat(testJobOrderInternalComment.getDescription()).isEqualTo(UPDATED_DESCRIPTION);
// Validate the JobOrderInternalComment in Elasticsearch
JobOrderInternalComment jobOrderInternalCommentEs = jobOrderInternalCommentSearchRepository.findOne(testJobOrderInternalComment.getId());
assertThat(jobOrderInternalCommentEs).isEqualToIgnoringGivenFields(testJobOrderInternalComment);
}
@Test
@Transactional
public void updateNonExistingJobOrderInternalComment() throws Exception {
int databaseSizeBeforeUpdate = jobOrderInternalCommentRepository.findAll().size();
// Create the JobOrderInternalComment
// If the entity doesn't have an ID, it will be created instead of just being updated
restJobOrderInternalCommentMockMvc.perform(put("/api/job-order-internal-comments")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(jobOrderInternalComment)))
.andExpect(status().isCreated());
// Validate the JobOrderInternalComment in the database
List<JobOrderInternalComment> jobOrderInternalCommentList = jobOrderInternalCommentRepository.findAll();
assertThat(jobOrderInternalCommentList).hasSize(databaseSizeBeforeUpdate + 1);
}
@Test
@Transactional
public void deleteJobOrderInternalComment() throws Exception {
// Initialize the database
jobOrderInternalCommentRepository.saveAndFlush(jobOrderInternalComment);
jobOrderInternalCommentSearchRepository.save(jobOrderInternalComment);
int databaseSizeBeforeDelete = jobOrderInternalCommentRepository.findAll().size();
// Get the jobOrderInternalComment
restJobOrderInternalCommentMockMvc.perform(delete("/api/job-order-internal-comments/{id}", jobOrderInternalComment.getId())
.accept(TestUtil.APPLICATION_JSON_UTF8))
.andExpect(status().isOk());
// Validate Elasticsearch is empty
boolean jobOrderInternalCommentExistsInEs = jobOrderInternalCommentSearchRepository.exists(jobOrderInternalComment.getId());
assertThat(jobOrderInternalCommentExistsInEs).isFalse();
// Validate the database is empty
List<JobOrderInternalComment> jobOrderInternalCommentList = jobOrderInternalCommentRepository.findAll();
assertThat(jobOrderInternalCommentList).hasSize(databaseSizeBeforeDelete - 1);
}
@Test
@Transactional
public void searchJobOrderInternalComment() throws Exception {
// Initialize the database
jobOrderInternalCommentRepository.saveAndFlush(jobOrderInternalComment);
jobOrderInternalCommentSearchRepository.save(jobOrderInternalComment);
// Search the jobOrderInternalComment
restJobOrderInternalCommentMockMvc.perform(get("/api/_search/job-order-internal-comments?query=id:" + jobOrderInternalComment.getId()))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(jobOrderInternalComment.getId().intValue())))
.andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME.toString())))
.andExpect(jsonPath("$.[*].description").value(hasItem(DEFAULT_DESCRIPTION.toString())));
}
@Test
@Transactional
public void equalsVerifier() throws Exception {
TestUtil.equalsVerifier(JobOrderInternalComment.class);
JobOrderInternalComment jobOrderInternalComment1 = new JobOrderInternalComment();
jobOrderInternalComment1.setId(1L);
JobOrderInternalComment jobOrderInternalComment2 = new JobOrderInternalComment();
jobOrderInternalComment2.setId(jobOrderInternalComment1.getId());
assertThat(jobOrderInternalComment1).isEqualTo(jobOrderInternalComment2);
jobOrderInternalComment2.setId(2L);
assertThat(jobOrderInternalComment1).isNotEqualTo(jobOrderInternalComment2);
jobOrderInternalComment1.setId(null);
assertThat(jobOrderInternalComment1).isNotEqualTo(jobOrderInternalComment2);
}
}
| [
"lucivar.gamer@gmail.com"
] | lucivar.gamer@gmail.com |
1f275ebdf24a50ef64f1210549f796c3366c15c3 | 81666b73aa216614dd1cea0ff645dfab57849428 | /src/character/EnemySelect.java | 52958cad05a607c6b3a5cc64552603be45679ad1 | [] | no_license | kobayashish/webjava_2 | c8199136f3d54d98c554b01163d0336531f0f196 | 67b3ade747a99d2148632d7b5e7fab07696cc47f | refs/heads/master | 2021-04-28T20:20:55.787673 | 2018-03-10T14:10:20 | 2018-03-10T14:10:20 | 121,922,281 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,196 | java | package character;
public class EnemySelect extends EnemyBase {
// private String name;
// private int hitPoint;
// private int attack;
// private int magic;
// private int defense;
private int reward;
/**
@Override
public void setName(String name) {
this.name = name;
}
@Override
public void setHitPoint(int hitPoint) {
this.hitPoint = hitPoint;
}
@Override
public void setAttack(int attack) {
this.attack = attack;
}
@Override
public void setMagic(int magic) {
this.magic = magic;
}
@Override
public void setDefense(int defense) {
this.defense = defense;
}
*/
@Override
public void setReward(int reward) {
this.reward = reward;
}
/**
@Override
public String getName() {
return this.name;
}
@Override
public int getHitPoint() {
return this.hitPoint;
}
@Override
public int getAttack() {
return this.attack;
}
@Override
public int getMagic() {
return this.magic;
}
@Override
public int getDefense() {
return this.defense;
}
*/
@Override
public int getReward() {
return this.reward;
}
}
| [
"kobayashish@systena.co.jp"
] | kobayashish@systena.co.jp |
361d87d4d55fedad19b7f95542343bbeffd6271c | 383ca63fab65e460a0ee5edb84baadddc6253e26 | /ups.edu.ec.est/src/main/java/Objeto/CarreraOn.java | 4a07a4cc919a489991e706031012ea9832914b65 | [] | no_license | jonathanMorochoYu/ExaMorochoJontahan | 142aeee383a486a73b29030855107b36f91679b5 | 124d0a42667094a0c286bdfc29d353774aeb0fb1 | refs/heads/main | 2023-06-26T18:21:53.093466 | 2021-07-29T20:08:37 | 2021-07-29T20:08:37 | 390,799,538 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 754 | java | package Objeto;
import java.util.List;
import javax.inject.Inject;
import Dato.CarreraDao;
import Modelo.Carrera;
public class CarreraOn {
@Inject
private CarreraDao daoCarrera;
public void insertCarrera(Carrera carrera) throws Exception {
daoCarrera.insert(carrera);
}
public void updateCarrera(Carrera carrera) throws Exception {
daoCarrera.update(carrera);
}
public void deleteCarrera(Carrera carrera) throws Exception {
String com = String.valueOf(carrera.getCodigo());
daoCarrera.delete(com);
}
public List<Carrera> getCarreras() {
return daoCarrera.getCarreras("%");
}
public Carrera getCarrera(String car) {
Carrera p = daoCarrera.read(car);
return p;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
5c71f848f964fe9a950168db2f978e7a3766d010 | aed257ec5dc9dc206d60c31d60ce5904abcafadd | /support/camera/camera-camera2/src/main/java/androidx/camera/camera2/impl/CameraEventCallbacks.java | 8427a1045107401b845c0e29f4ad215226697a21 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | imambudi808/jetpack | 5b79de7dd593ba945eb1249bd7de105dd587071c | 5737d512d717883d5c074c0bc6c21671e3950172 | refs/heads/master | 2022-04-22T21:52:05.529056 | 2019-10-21T10:14:42 | 2019-10-21T10:14:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,632 | java | /*
* Copyright 2019 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 androidx.camera.camera2.impl;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import androidx.camera.core.CaptureConfig;
import androidx.camera.core.MultiValueSet;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
/**
* Different implementations of {@link CameraEventCallback}.
*
* @hide
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public final class CameraEventCallbacks extends MultiValueSet<CameraEventCallback> {
public CameraEventCallbacks(CameraEventCallback ... callbacks) {
addAll(Arrays.asList(callbacks));
}
/** Returns a camera event callback which calls a list of other callbacks. */
@NonNull
public ComboCameraEventCallback createComboCallback() {
return new ComboCameraEventCallback(getAllItems());
}
/** Returns a camera event callback which does nothing. */
@NonNull
public static CameraEventCallbacks createEmptyCallback() {
return new CameraEventCallbacks();
}
@NonNull
@Override
public MultiValueSet<CameraEventCallback> clone() {
CameraEventCallbacks ret = createEmptyCallback();
ret.addAll(getAllItems());
return ret;
}
/**
* A CameraEventCallback which contains a list of CameraEventCallback and will
* propagate received callback to the list.
*/
public static final class ComboCameraEventCallback {
private final List<CameraEventCallback> mCallbacks = new ArrayList<>();
ComboCameraEventCallback(List<CameraEventCallback> callbacks) {
for (CameraEventCallback callback : callbacks) {
mCallbacks.add(callback);
}
}
/**
* To Invoke {@link CameraEventCallback#onPresetSession()} on the set of list and
* aggregated the results to a set list.
*
* @return List<CaptureConfig> The request information to customize the session.
*/
public List<CaptureConfig> onPresetSession() {
// TODO(b/141959507): Suppressed during upgrade to AGP 3.6.
@SuppressWarnings("JdkObsolete")
List<CaptureConfig> ret = new LinkedList<>();
for (CameraEventCallback callback : mCallbacks) {
CaptureConfig presetCaptureStage = callback.onPresetSession();
if (presetCaptureStage != null) {
ret.add(presetCaptureStage);
}
}
return ret;
}
/**
* To Invoke {@link CameraEventCallback#onEnableSession()} on the set of list and
* aggregated the results to a set list.
*
* @return List<CaptureConfig> The request information to customize the session.
*/
@SuppressWarnings("JdkObsolete") // TODO(b/141959507): Suppressed during upgrade to AGP 3.6.
public List<CaptureConfig> onEnableSession() {
List<CaptureConfig> ret = new LinkedList<>();
for (CameraEventCallback callback : mCallbacks) {
CaptureConfig enableCaptureStage = callback.onEnableSession();
if (enableCaptureStage != null) {
ret.add(enableCaptureStage);
}
}
return ret;
}
/**
* To Invoke {@link CameraEventCallback#onRepeating()} on the set of list and
* aggregated the results to a set list.
*
* @return List<CaptureConfig> The request information to customize the session.
*/
@SuppressWarnings("JdkObsolete") // TODO(b/141959507): Suppressed during upgrade to AGP 3.6.
public List<CaptureConfig> onRepeating() {
List<CaptureConfig> ret = new LinkedList<>();
for (CameraEventCallback callback : mCallbacks) {
CaptureConfig repeatingCaptureStage = callback.onRepeating();
if (repeatingCaptureStage != null) {
ret.add(repeatingCaptureStage);
}
}
return ret;
}
/**
* To Invoke {@link CameraEventCallback#onDisableSession()} on the set of list and
* aggregated the results to a set list.
*
* @return List<CaptureConfig> The request information to customize the session.
*/
@SuppressWarnings("JdkObsolete") // TODO(b/141959507): Suppressed during upgrade to AGP 3.6.
public List<CaptureConfig> onDisableSession() {
List<CaptureConfig> ret = new LinkedList<>();
for (CameraEventCallback callback : mCallbacks) {
CaptureConfig disableCaptureStage = callback.onDisableSession();
if (disableCaptureStage != null) {
ret.add(disableCaptureStage);
}
}
return ret;
}
@NonNull
public List<CameraEventCallback> getCallbacks() {
return mCallbacks;
}
}
}
| [
"iammini5@gmail.com"
] | iammini5@gmail.com |
f339caa68614d9a3aef2481cecd87c5cd9b538d3 | ea09b11b660fe656070af74b7d3f4fe5a1646dd5 | /cloud-sandbox-service/src/main/java/cn/edu/pku/controller/DynamicDeploymentController.java | ca59a907fd877583daf515c889b1494371cf179e | [] | no_license | M000M/AttackDetection | 85755c406528d85f98756ea3e73161e170c81175 | 3588b68f43992bb7e7234497578bdd16a7e10f2e | refs/heads/master | 2023-06-01T14:49:31.042068 | 2021-06-17T15:26:05 | 2021-06-17T15:26:05 | 325,189,211 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,506 | java | package cn.edu.pku.controller;
import cn.edu.pku.entities.CommonResult;
import cn.edu.pku.service.DynamicDeploymentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@RestController
@Slf4j
@CrossOrigin
@RequestMapping(value = "/dynamic")
public class DynamicDeploymentController {
@Resource
private DynamicDeploymentService dynamicDeploymentService;
@RequestMapping(value = "/getCountByImageName", method = RequestMethod.GET)
public CommonResult<Integer> getRunningContainerCountByImageName(@RequestParam("imageName") String imageName) {
CommonResult<Integer> result = new CommonResult<>();
try {
int res = dynamicDeploymentService.getRunningContainerCountByImageName(imageName);
result.setData(res);
result.setMsg("根据镜像名获取运行容器数量成功");
} catch (Exception e) {
e.printStackTrace();
result.setStatus(false);
result.setMsg("根据镜像名获取运行容器数量异常");
}
return result;
}
@RequestMapping(value = "/getRecentAttackCount", method = RequestMethod.GET)
public CommonResult<Integer> getRecentAttackCount(@RequestParam("key") String key) {
CommonResult<Integer> result = new CommonResult<>();
try {
int res = dynamicDeploymentService.getRecentAttackCount(key);
result.setData(res);
result.setMsg("获取最近攻击次数成功");
} catch (Exception e) {
e.printStackTrace();
result.setStatus(false);
result.setMsg("获取最近攻击次数异常");
}
return result;
}
@RequestMapping(value = "/setAttackCountRateByType", method = RequestMethod.GET)
public CommonResult<Boolean> setAttackCountRateByType(@RequestParam("type") String type, @RequestParam("maxRate") Integer maxRate) {
CommonResult<Boolean> result = new CommonResult<>();
try {
boolean res = dynamicDeploymentService.setAttackCountRateByType(type, maxRate);
result.setData(res);
result.setMsg(type + " 类型的攻击/数量比值设置为了 " + maxRate);
} catch (Exception e) {
e.printStackTrace();
result.setStatus(false);
result.setData(false);
result.setMsg("设置新的攻击/数量比值异常");
}
return result;
}
}
| [
"itancong@163.com"
] | itancong@163.com |
fc1e2332bd24297ccc6296143772bdcbf46c055e | 94a28563f217b2688936794c824626a324686cf2 | /src/test/java/testcases/TC004_BuyProduct.java | c2e4b93677535d9f374b8b145f90ad134ca23700 | [] | no_license | mary0316/automationg-testing-demo | 9c2756a62c9182a8a9528bc32d203a5abfd8aadd | ab299ca3bc554f34019d413cbbbb139cda666011 | refs/heads/master | 2022-12-17T08:57:38.191021 | 2020-09-17T21:52:15 | 2020-09-17T21:52:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,198 | java | package testcases;
import org.openqa.selenium.JavascriptExecutor;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import com.relevantcodes.extentreports.ExtentReports;
import com.relevantcodes.extentreports.ExtentTest;
import com.relevantcodes.extentreports.LogStatus;
import base.BaseClass;
import pages.ShoppingCartPage;
import pages.LandingPage;
import pages.LoginPage;
import pages.MyAccountPage;
import pages.ProductDetailsPage;
import pages.PaymentPage;
import utilities.ExtentManager;
public class TC004_BuyProduct extends BaseClass {
LandingPage landP;
LoginPage logP;
MyAccountPage myacc;
ProductDetailsPage dprodP;
ShoppingCartPage cp;
PaymentPage payP;
String actual, expected;
JavascriptExecutor jse;
ExtentReports report;
ExtentManager extentmanager;
ExtentTest test;
@BeforeTest
public void setup() {
report = new ExtentReports(
"C:\\eclipse-workspace\\qaProject1\\resources\\reports\\TC004_BuyProduct.html");
test = report.startTest("Buy Products");
}
@Test(priority = 0)
public void login() {
test.log(LogStatus.INFO, "TC004_BuyProduct");
landP = new LandingPage(driver);
test.log(LogStatus.INFO, "Landing at Home!!!");
landP.doClick();
test.log(LogStatus.INFO, "Clicked Signin button");
// log.info("Clicked Signin");
logP = new LoginPage(driver);
test.log(LogStatus.INFO, "At Login Page");
logP.doLogin("a11@a11.com", "12345");
test.log(LogStatus.INFO, "Entered Email and Password");
// log.info("Enter Email and submit to register");
}
@Test(priority = 3)
public void buyProducts() {
myacc = new MyAccountPage(driver);
test.log(LogStatus.INFO, "Yeah! I came into My Account page");
myacc.gohome();
test.log(LogStatus.INFO, "Welcome Home!!");
jse = (JavascriptExecutor) driver;
jse.executeScript("window.scrollBy(250,550)");
test.log(LogStatus.INFO, "Let's scroll down a little bit");
// log.info("Scroll down");
//landP.pause(3000);
landP.bestSeller();
test.log(LogStatus.INFO, "tried to find BestSeller items");
// log.info("Click BestSeller Tab");
//landP.pause(1000);
landP.pickProd();
test.log(LogStatus.INFO, "I wanted this because she said PICK ME UP");
// log.info("Select a product");
dprodP = new ProductDetailsPage(driver);
test.log(LogStatus.INFO, "I jumped into Product Details Page");
jse.executeScript("window.scrollBy(250,550)");
test.log(LogStatus.INFO, "A little bit go down");
//landP.pause(2000);
dprodP.selectSize();
test.log(LogStatus.INFO, "I need a midium size");
// log.info("Select size M");
//landP.pause(2000);
dprodP.color();
test.log(LogStatus.INFO, "Love White Color!!");
// log.info("Select White color");
//landP.pause(2000);
dprodP.addCart();
test.log(LogStatus.INFO, "The item has been added in the shopping cart");
// log.info("Added the item in the shopping cart");
dprodP.checkout();
test.log(LogStatus.INFO, "try to check out");
// log.info("Checkout");
//landP.pause(2000);
cp = new ShoppingCartPage(driver);
test.log(LogStatus.INFO, "Go Go Sing Shopping Cart!!");
jse.executeScript("window.scrollBy(250,550)");
test.log(LogStatus.INFO, "down down");
// log.info("Scroll down");
cp.increaseQty();
test.log(LogStatus.INFO, "I need one more because of my sister");
// log.info("Added one more quantity");
cp.checkout();
test.log(LogStatus.INFO, "Checkout shopping cart");
// log.info("Checkout the shopping cart");
payP = new PaymentPage(driver);
test.log(LogStatus.INFO, "Wow, finally Payment Page");
// Address section
payP.txtBox();
test.log(LogStatus.INFO, "I wrote a specific request");
// log.info("Write a specific request");
payP.btnAddCheckout();
test.log(LogStatus.INFO, "passed Address section");
// log.info("Done Address setting");
// Shipping section
jse.executeScript("window.scrollBy(250,450)");
// log.info("Scroll down");
payP.checkbox();
test.log(LogStatus.INFO, "Ticked the checkbox");
// log.info("Checked Terms of Service agreement");
payP.btnshippingCheckout();
test.log(LogStatus.INFO, "passed Shipping section");
// log.info("Proceed ckeckout");
// Payment section
jse.executeScript("window.scrollBy(250,450)");
test.log(LogStatus.INFO, "down a little bit");
// log.info("Scroll down");
payP.payment();
test.log(LogStatus.INFO, "Selected the Payment Option");
// log.info("Selected Payment option");
// Order Confirm Section
jse.executeScript("window.scrollBy(250,450)");
test.log(LogStatus.INFO, "a little bit down");
// log.info("Scroll down");
test.log(LogStatus.INFO, "Pay the Order");
// log.info("Pay the order");
payP.btnConfirm();
landP.pause(2000);
actual = driver.getTitle();
expected = "Order confirmation - My Store";
Assert.assertEquals(actual, expected);
test.log(LogStatus.INFO, "TC004_BuyProduct: completed and passed!!!");
// log.info("Verified TC004");
}
@AfterTest
public void tearDown() {
// log.info("Close browser");
driver.quit();
// log.info("Post-condition ");
report.endTest(test);
// log.info("erase the previous data on the report");
report.flush();
}
}
| [
"69160325+coolirene@users.noreply.github.com"
] | 69160325+coolirene@users.noreply.github.com |
ed29b548972324f9472f7f0ce80ebc614275835a | ba55269057e8dc503355a26cfab3c969ad7eb278 | /ReportingService/src/com/nirvanaxp/services/jaxrs/packets/FloorSummaryDashboard.java | 21d88d6bd13df807d19ee3c55c9c0c4ccdc4cc57 | [
"Apache-2.0"
] | permissive | apoorva223054/SF3 | b9db0c86963e549498f38f7e27f65c45438b2a71 | 4dab425963cf35481d2a386782484b769df32986 | refs/heads/master | 2022-03-07T17:13:38.709002 | 2020-01-29T05:19:06 | 2020-01-29T05:19:06 | 236,907,773 | 0 | 0 | Apache-2.0 | 2022-02-09T22:46:01 | 2020-01-29T05:10:51 | Java | UTF-8 | Java | false | false | 2,046 | java | /**
* Copyright (c) 2012 - 2017 by NirvanaXP, LLC. All Rights reserved. Express
* written consent required to use, copy, share, alter, distribute or transmit
* this source code in part or whole through any means physical or electronic.
**/
package com.nirvanaxp.services.jaxrs.packets;
public class FloorSummaryDashboard
{
private int totalCover;
private int totalReservation;
private int waitListCount;
private int seatedCount;
private int walkinCount;
private double spaceUtilization;
private int approxWaitTime;
private int availableTables;
private int currentSeatedCount;
public int getTotalCover()
{
return totalCover;
}
public void setTotalCover(int totalCover)
{
this.totalCover = totalCover;
}
public int getTotalReservation()
{
return totalReservation;
}
public void setTotalReservation(int totalReservation)
{
this.totalReservation = totalReservation;
}
public int getWaitListCount()
{
return waitListCount;
}
public void setWaitListCount(int waitListCount)
{
this.waitListCount = waitListCount;
}
public int getSeatedCount()
{
return seatedCount;
}
public void setSeatedCount(int seatedCount)
{
this.seatedCount = seatedCount;
}
public int getWalkinCount()
{
return walkinCount;
}
public void setWalkinCount(int walkinCount)
{
this.walkinCount = walkinCount;
}
public double getSpaceUtilization()
{
return spaceUtilization;
}
public void setSpaceUtilization(double spaceUtilization)
{
this.spaceUtilization = spaceUtilization;
}
public int getApproxWaitTime()
{
return approxWaitTime;
}
public void setApproxWaitTime(int approxWaitTime)
{
this.approxWaitTime = approxWaitTime;
}
public int getAvailableTables()
{
return availableTables;
}
public void setAvailableTables(int availableTables)
{
this.availableTables = availableTables;
}
public int getCurrentSeatedCount()
{
return currentSeatedCount;
}
public void setCurrentSeatedCount(int currentSeatedCount)
{
this.currentSeatedCount = currentSeatedCount;
}
}
| [
"naman223054@gmail.com"
] | naman223054@gmail.com |
e78aeb71dd0f595fcc39610ef205cb118e5e849e | dbbfd2d8c7704ebd5a3d9a83fd67b0ad04e73584 | /src/main/java/fr/awazek/command/RandomTPCommand.java | 506b1db16a6cde1df013e38a43711ddee047f62b | [] | no_license | AwaZeKMC/RandomTP | 4731362861388a08390203d4e48499dbf4b46d9d | 71e29396a5b70bfbe3c647b556d8cea1c7263079 | refs/heads/master | 2023-04-23T05:12:24.357766 | 2021-05-10T20:33:03 | 2021-05-10T20:33:03 | 314,871,915 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,742 | java | package fr.awazek.command;
import fr.awazek.RTPLocation;
import fr.awazek.RandomTP;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
public class RandomTPCommand implements CommandExecutor {
RandomTP main;
public RandomTPCommand(RandomTP main) {
this.main = main;
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (sender instanceof Player) {
if (label.equalsIgnoreCase("rtp") || label.equalsIgnoreCase("randomtp")) {
Player player = (Player) sender;
RTPLocation surfaceLocation = newLocation(player.getWorld());
while (!surfaceLocation.isSafe()) {
surfaceLocation = newLocation(player.getWorld());
}
SimpleDateFormat formatter = new SimpleDateFormat("MM-dd-yyyy / HH:mm:ss");
Date dateNow = new Date();
Date dateAfter = new Date();
dateAfter.setHours(dateAfter.getHours() + main.getTextConfig().getInt("time-between.rtp"));
String dateN = formatter.format(dateAfter);
String dateSaved;
if (main.getConfig().contains(String.valueOf(player.getUniqueId()))) {
dateSaved = main.getConfig().getString(String.valueOf(player.getUniqueId()));
} else {
dateSaved = "";
}
Date dateSave = null;
try {
if (!(dateSaved.equalsIgnoreCase(""))) {
dateSave = formatter.parse(dateSaved);
}
} catch (ParseException e) {
}
if (dateSaved.equalsIgnoreCase("") || dateNow.after(dateSave)) {
player.teleport(surfaceLocation);
main.getConfig().createSection(String.valueOf(player.getUniqueId()));
main.getConfig().set(String.valueOf(player.getUniqueId()), dateN);
main.saveConfig();
} else {
long difference_In_Time
= dateSave.getTime() - dateNow.getTime();
long difference_In_Minutes = (difference_In_Time / (1000 * 60)) % 60;
long difference_In_Hours = (difference_In_Time / (1000 * 60 * 60)) % 24;
long difference_In_Seconds = (difference_In_Time / 1000) % 60;
if (difference_In_Hours > 0) {
player.sendMessage(ChatColor.translateAlternateColorCodes('&', main.getTextConfig().getString("remaining-time.hours").replace("%hours%", difference_In_Hours + "").replace("%minutes%", difference_In_Minutes + "")));
}
if (difference_In_Hours == 0) {
player.sendMessage(ChatColor.translateAlternateColorCodes('&', main.getTextConfig().getString("remaining-time.minutes").replace("%minutes%", difference_In_Minutes + ""))); //"il vous reste " + difference_In_Minutes + "minutes"
}
if (difference_In_Minutes <= 0 && difference_In_Hours <= 0) {
player.sendMessage(ChatColor.translateAlternateColorCodes('&', main.getTextConfig().getString("remaining-time.seconds").replace("%seconds%", difference_In_Seconds + "")));
}
if (difference_In_Hours == 0 && difference_In_Minutes == 0) {
player.sendMessage((ChatColor.translateAlternateColorCodes('&', main.getTextConfig().getString("remaining-time.available"))));
}
}
}
}
return false;
}
public RTPLocation newLocation(World world){
Random random = new Random();
int X;
int Y;
int Z;
int len = 0;
while (len < main.getTextConfig().getInt("rtp.min") || len > main.getTextConfig().getInt("rtp.max")){
X = random.nextInt(main.getTextConfig().getInt("rtp.max"));
Y = 250;
Z = random.nextInt(main.getTextConfig().getInt("rtp.max"));
len = (int) Math.sqrt((X*X) + (Z*Z));
if (len > main.getTextConfig().getInt("rtp.min") && len < main.getTextConfig().getInt("rtp.max")){
return new RTPLocation(world , X, Y , Z);
}
}
return null;
}
}
| [
"siliciacorp@gmail.com"
] | siliciacorp@gmail.com |
bdd0815578b5a639302cdf1312da4c8d9a91c583 | fc8a78eb29caeca78d818f1c13704eb371c4875a | /app/src/test/java/com/calculator/intz/calculator/ExampleUnitTest.java | d78f09f2ab3b8a71960d3ebcb9f12a8e2b4f02f2 | [] | no_license | inurja/android_calc | 31648a5e6fa3b84c0013112df6d157cf9f3e554b | bb719c86c344fcb1f648e1eb438e6ec1159660f3 | refs/heads/master | 2021-01-10T09:45:57.172209 | 2016-03-11T08:44:37 | 2016-03-11T08:44:37 | 53,279,132 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 323 | java | package com.calculator.intz.calculator;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"intz111@gmail.com"
] | intz111@gmail.com |
f2c3a72a808afa8731c464358ed9aba6be449230 | 600ba53cdf5d4cae0ff1468b0b0cd1e7b89f5123 | /Generic/src/main/java/common/Helper.java | dc135afa025342d18d8a13803b0b1f6a83c84b62 | [] | no_license | nasershaon/Boot-camp-Team1 | 2c250d11712d0720243d9c809f563c0610119e06 | c2b26f063bbc88f054f7f2709de6e32b27214c17 | refs/heads/master | 2022-07-07T16:12:19.713046 | 2020-02-27T03:30:50 | 2020-02-27T03:30:50 | 242,493,958 | 0 | 0 | null | 2022-06-29T17:59:08 | 2020-02-23T10:03:12 | Java | UTF-8 | Java | false | false | 42 | java | package common;
public class Helper {
}
| [
"bbshaon@gmail.com"
] | bbshaon@gmail.com |
52989901e85247c2368e48331fee9f21e711fd19 | 9eb3427c82e7ba9b9131aaa9ef330a4775dba112 | /cometd/modules/src/main/java/org/atmosphere/cometd/WebSocketTransport.java | 04422bf1a42d7ac2d3e8d7725ae5671a94f926d0 | [] | no_license | xuerbin/atmosphere-extensions | 3ea3aa75fae3ea79c59cb845910c7b0a910d6acc | 2d19264de35fbce822dffd79e30f782da2187593 | refs/heads/master | 2021-06-27T04:31:51.975744 | 2017-09-19T13:39:46 | 2017-09-19T13:39:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,662 | java | /*
* Copyright 2017 Async-IO.org
*
* 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 class was hightly inspired by its Cometd implementation
/*
* Copyright (c) 2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.atmosphere.cometd;
import org.atmosphere.cpr.HeaderConfig;
import org.cometd.bayeux.Channel;
import org.cometd.bayeux.Message;
import org.cometd.bayeux.server.ServerMessage;
import org.cometd.server.AbstractServerTransport;
import org.cometd.server.BayeuxServerImpl;
import org.cometd.server.ServerSessionImpl;
import org.cometd.server.transport.LongPollingTransport;
import org.eclipse.jetty.continuation.Continuation;
import org.eclipse.jetty.continuation.ContinuationListener;
import org.eclipse.jetty.continuation.ContinuationSupport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
public class WebSocketTransport extends LongPollingTransport {
private final Logger logger = LoggerFactory.getLogger(getClass());
public final static String PREFIX = "long-polling.ws";
public final static String NAME = "websocket";
public final static String MIME_TYPE_OPTION = "mimeType";
public final static String CALLBACK_PARAMETER_OPTION = "callbackParameter";
private String _mimeType = "text/javascript;charset=UTF-8";
private String _callbackParam = "jsonp";
private boolean _autoBatch = true;
private boolean _allowMultiSessionsNoBrowser = false;
private long _multiSessionInterval = 2000;
public WebSocketTransport(BayeuxServerImpl bayeux) {
super(bayeux, NAME);
setOptionPrefix(PREFIX);
}
/**
* @see org.cometd.server.transport.LongPollingTransport#isAlwaysFlushingAfterHandle()
*/
@Override
protected boolean isAlwaysFlushingAfterHandle() {
return true;
}
/**
* @see org.cometd.server.transport.JSONTransport#init()
*/
@Override
protected void init() {
super.init();
_callbackParam = getOption(CALLBACK_PARAMETER_OPTION, _callbackParam);
_mimeType = getOption(MIME_TYPE_OPTION, _mimeType);
}
@Override
public boolean accept(HttpServletRequest request) {
return request.getHeader(HeaderConfig.X_ATMOSPHERE_TRANSPORT) == HeaderConfig.WEBSOCKET_TRANSPORT;
}
@Override
public void handle(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
// Is this a resumed connect?
LongPollScheduler scheduler = (LongPollScheduler) request.getAttribute(LongPollScheduler.ATTRIBUTE);
if (scheduler == null) {
// No - process messages
// Remember if we start a batch
boolean batch = false;
// Don't know the session until first message or handshake response.
ServerSessionImpl session = null;
boolean connect = false;
try {
ServerMessage.Mutable[] messages = parseMessages(request);
if (messages == null)
return;
PrintWriter writer = null;
for (ServerMessage.Mutable message : messages) {
// Is this a connect?
connect = Channel.META_CONNECT.equals(message.getChannel());
// Get the session from the message
String client_id = message.getClientId();
if (session == null || client_id != null && !client_id.equals(session.getId())) {
session = (ServerSessionImpl) getBayeux().getSession(client_id);
if (_autoBatch && !batch && session != null && !connect && !message.isMeta()) {
// start a batch to group all resulting messages into a single response.
batch = true;
session.startBatch();
}
} else if (!session.isHandshook()) {
batch = false;
session = null;
}
if (connect && session != null) {
// cancel previous scheduler to cancel any prior waiting long poll
// this should also dec the browser ID
session.setScheduler(null);
}
boolean wasConnected = session != null && session.isConnected();
// Forward handling of the message.
// The actual reply is return from the call, but other messages may
// also be queued on the session.
ServerMessage.Mutable reply = bayeuxServerHandle(session, message);
// Do we have a reply ?
if (reply != null) {
if (session == null) {
// This must be a handshake, extract a session from the reply
session = (ServerSessionImpl) getBayeux().getSession(reply.getClientId());
// Get the user agent while we are at it, and add the browser ID cookie
if (session != null) {
String userAgent = request.getHeader("User-Agent");
session.setUserAgent(userAgent);
String browserId = findBrowserId(request);
if (browserId == null)
setBrowserId(request, response);
}
} else {
// Special handling for connect
if (connect) {
try {
writer = sendQueue(request, response, session, writer);
// If the writer is non null, we have already started sending a response, so we should not suspend
if (writer == null && reply.isSuccessful() && session.isQueueEmpty()) {
// Detect if we have multiple sessions from the same browser
// Note that CORS requests do not send cookies, so we need to handle them specially
// CORS requests always have the Origin header
String browserId = findBrowserId(request);
boolean allowSuspendConnect;
if (browserId != null)
allowSuspendConnect = incBrowserId(browserId);
else
allowSuspendConnect = _allowMultiSessionsNoBrowser;
if (allowSuspendConnect) {
long timeout = session.calculateTimeout(getTimeout());
// Support old clients that do not send advice:{timeout:0} on the first connect
if (timeout > 0 && wasConnected && session.isConnected()) {
// Suspend and wait for messages
Continuation continuation = ContinuationSupport.getContinuation(request);
continuation.setTimeout(timeout);
continuation.suspend(response);
scheduler = new LongPollScheduler(session, continuation, reply, browserId);
session.setScheduler(scheduler);
request.setAttribute(LongPollScheduler.ATTRIBUTE, scheduler);
reply = null;
metaConnectSuspended(request, session, timeout);
} else {
decBrowserId(browserId);
}
} else {
// There are multiple sessions from the same browser
Map<String, Object> advice = reply.getAdvice(true);
if (browserId != null)
advice.put("multiple-clients", true);
if (_multiSessionInterval > 0) {
advice.put(Message.RECONNECT_FIELD, Message.RECONNECT_RETRY_VALUE);
advice.put(Message.INTERVAL_FIELD, _multiSessionInterval);
} else {
advice.put(Message.RECONNECT_FIELD, Message.RECONNECT_NONE_VALUE);
reply.setSuccessful(false);
}
session.reAdvise();
}
}
} finally {
if (reply != null && session.isConnected())
session.startIntervalTimeout(getInterval());
}
} else {
if (!isMetaConnectDeliveryOnly() && !session.isMetaConnectDeliveryOnly()) {
writer = sendQueue(request, response, session, writer);
}
}
}
// If the reply has not been otherwise handled, send it
if (reply != null) {
if (connect && session != null && !session.isConnected())
reply.getAdvice(true).put(Message.RECONNECT_FIELD, Message.RECONNECT_NONE_VALUE);
reply = getBayeux().extendReply(session, session, reply);
if (reply != null) {
getBayeux().freeze(reply);
writer = send(request, response, writer, reply);
}
}
}
// Disassociate the reply
message.setAssociated(null);
}
if (writer != null)
complete(writer);
} catch (ParseException x) {
handleJSONParseException(request, response, x.getMessage(), x.getCause());
} finally {
// If we started a batch, end it now
if (batch) {
boolean ended = session.endBatch();
// Flush session if not done by the batch, since some browser order <script> requests
if (!ended && isAlwaysFlushingAfterHandle())
session.flush();
} else if (session != null && !connect && isAlwaysFlushingAfterHandle()) {
session.flush();
}
}
} else {
// Get the resumed session
ServerSessionImpl session = scheduler.getSession();
metaConnectResumed(request, session);
PrintWriter writer;
try {
// Send the message queue
writer = sendQueue(request, response, session, null);
} finally {
// We need to start the interval timeout before the connect reply
// otherwise we open up a race condition where the client receives
// the connect reply and sends a new connect request before we start
// the interval timeout, which will be wrong.
// We need to put this into a finally block in case sending the queue
// throws an exception (for example because the client is gone), so that
// we start the interval timeout that is important to sweep the session
if (session.isConnected())
session.startIntervalTimeout(getInterval());
}
// Send the connect reply
ServerMessage.Mutable reply = scheduler.getReply();
if (!session.isConnected())
reply.getAdvice(true).put(Message.RECONNECT_FIELD, Message.RECONNECT_NONE_VALUE);
reply = getBayeux().extendReply(session, session, reply);
if (reply != null) {
getBayeux().freeze(reply);
writer = send(request, response, writer, reply);
}
complete(writer);
}
}
private PrintWriter sendQueue(HttpServletRequest request, HttpServletResponse response, ServerSessionImpl session, PrintWriter writer)
throws IOException {
final List<ServerMessage> queue = session.takeQueue();
for (ServerMessage m : queue)
writer = send(request, response, writer, m);
return writer;
}
@Override
protected ServerMessage.Mutable[] parseMessages(HttpServletRequest request) throws IOException, ParseException {
return super.parseMessages(request.getReader(), true);
}
@Override
protected PrintWriter send(HttpServletRequest request, HttpServletResponse response, PrintWriter writer, ServerMessage message) throws IOException {
StringBuilder builder = new StringBuilder(message.size() * 32);
if (writer == null) {
response.setContentType(_mimeType);
writer = response.getWriter();
}
builder.append("[").append(message.getJSON()).append("]");
writer.append(builder.toString());
return writer;
}
@Override
protected void complete(PrintWriter writer) throws IOException {
}
private class LongPollScheduler implements AbstractServerTransport.OneTimeScheduler, ContinuationListener {
private static final String ATTRIBUTE = "org.cometd.scheduler";
private final ServerSessionImpl _session;
private final Continuation _continuation;
private final ServerMessage.Mutable _reply;
private String _browserId;
public LongPollScheduler(ServerSessionImpl session, Continuation continuation, ServerMessage.Mutable reply, String browserId) {
_session = session;
_continuation = continuation;
_continuation.addContinuationListener(this);
_reply = reply;
_browserId = browserId;
}
public void cancel() {
if (_continuation != null && _continuation.isSuspended() && !_continuation.isExpired()) {
try {
decBrowserId();
((HttpServletResponse) _continuation.getServletResponse()).sendError(HttpServletResponse.SC_REQUEST_TIMEOUT);
} catch (IOException x) {
logger.trace("", x);
}
try {
_continuation.complete();
} catch (Exception x) {
logger.trace("", x);
}
}
}
public void schedule() {
decBrowserId();
_continuation.resume();
}
public ServerSessionImpl getSession() {
return _session;
}
public ServerMessage.Mutable getReply() {
Map<String, Object> advice = _session.takeAdvice();
if (advice != null)
_reply.put(Message.ADVICE_FIELD, advice);
return _reply;
}
public void onComplete(Continuation continuation) {
decBrowserId();
}
public void onTimeout(Continuation continuation) {
_session.setScheduler(null);
}
private void decBrowserId() {
WebSocketTransport.this.decBrowserId(_browserId);
_browserId = null;
}
}
}
| [
"jfarcand@apache.org"
] | jfarcand@apache.org |
4257ad923ce09ad82d521fe935e6054ba4ffc232 | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/neo4j--neo4j/4d104048dc5f6233f7d1b11b3e2cb34baae5fa6f/after/HeartbeatState.java | 6e44bc2a16868b324d5b0b78bc1fac1cd75eeb50 | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,083 | java | /**
* Copyright (c) 2002-2013 "Neo Technology,"
* Network Engine for Objects in Lund AB [http://neotechnology.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.cluster.protocol.heartbeat;
import static org.neo4j.cluster.com.message.Message.internal;
import static org.neo4j.cluster.com.message.Message.timeout;
import static org.neo4j.cluster.com.message.Message.to;
import java.net.URI;
import org.neo4j.cluster.InstanceId;
import org.neo4j.cluster.com.message.Message;
import org.neo4j.cluster.com.message.MessageHolder;
import org.neo4j.cluster.protocol.atomicbroadcast.multipaxos.LearnerMessage;
import org.neo4j.cluster.statemachine.State;
/**
* State machine that implements the {@link Heartbeat} API
*/
public enum HeartbeatState
implements State<HeartbeatContext, HeartbeatMessage>
{
start
{
@Override
public HeartbeatState handle( HeartbeatContext context,
Message<HeartbeatMessage> message,
MessageHolder outgoing
)
throws Throwable
{
switch ( message.getMessageType() )
{
case addHeartbeatListener:
{
context.addHeartbeatListener( (HeartbeatListener) message.getPayload() );
break;
}
case removeHeartbeatListener:
{
context.removeHeartbeatListener( (HeartbeatListener) message.getPayload() );
break;
}
case join:
{
for ( InstanceId instanceId : context.getOtherInstances() )
{
// Setup heartbeat timeouts for the other instance
context.setTimeout(
HeartbeatMessage.i_am_alive + "-" + instanceId,
timeout( HeartbeatMessage.timed_out, message, instanceId ) );
// Send first heartbeat immediately
outgoing.offer( timeout( HeartbeatMessage.sendHeartbeat, message, instanceId) );
}
return heartbeat;
}
}
return this;
}
},
heartbeat
{
@Override
public HeartbeatState handle( HeartbeatContext context,
Message<HeartbeatMessage> message,
MessageHolder outgoing
)
throws Throwable
{
switch ( message.getMessageType() )
{
case i_am_alive:
{
HeartbeatMessage.IAmAliveState state = message.getPayload();
if (context.isMe( state.getServer() ) )
{
break;
}
context.getLogger( HeartbeatState.class ).debug( "Received " + state );
if ( state.getServer() == null )
{
break;
}
if ( context.alive( state.getServer() ) )
{
// Send suspicions messages to all non-failed servers
for ( InstanceId aliveServer : context.getAlive() )
{
if ( !aliveServer.equals( context.getMyId() ) )
{
URI aliveServerUri =
context.getUriForId( aliveServer );
outgoing.offer( Message.to( HeartbeatMessage.suspicions, aliveServerUri,
new HeartbeatMessage.SuspicionsState( context.getSuspicionsFor( context.getMyId() ) ) ) );
}
}
}
context.cancelTimeout( HeartbeatMessage.i_am_alive + "-" +
state.getServer() );
context.setTimeout( HeartbeatMessage.i_am_alive + "-" +
state.getServer(), timeout( HeartbeatMessage.timed_out, message, state
.getServer() ) );
// Check if this server knows something that we don't
if ( message.hasHeader( "last-learned" ) )
{
long lastLearned = Long.parseLong( message.getHeader( "last-learned" ) );
if ( lastLearned > context.getLastKnownLearnedInstanceInCluster() )
{
outgoing.offer( internal( LearnerMessage.catchUp, lastLearned ) );
}
}
break;
}
case timed_out:
{
InstanceId server = message.getPayload();
context.getLogger( HeartbeatState.class )
.debug( "Received timed out for server " + server );
// Check if this node is no longer a part of the cluster
if ( context.getMembers().containsKey( server ) )
{
context.suspect( server );
context.setTimeout( HeartbeatMessage.i_am_alive + "-" +
server, timeout( HeartbeatMessage.timed_out, message, server ) );
// Send suspicions messages to all non-failed servers
for ( InstanceId aliveServer : context.getAlive() )
{
if ( !aliveServer.equals( context.getMyId() ) )
{
URI sendTo = context.getUriForId(
aliveServer );
outgoing.offer( Message.to( HeartbeatMessage.suspicions, sendTo,
new HeartbeatMessage.SuspicionsState( context.getSuspicionsFor( context.getMyId() ) ) ) );
}
}
}
else
{
// If no longer part of cluster, then don't bother
context.serverLeftCluster( server );
}
break;
}
case sendHeartbeat:
{
InstanceId to = message.getPayload();
if (!context.isMe( to ) )
{
// Check if this node is no longer a part of the cluster
if ( context.getMembers().containsKey( to ) )
{
URI toSendTo = context.getUriForId( to );
// Send heartbeat message to given server
outgoing.offer( to( HeartbeatMessage.i_am_alive, toSendTo,
new HeartbeatMessage.IAmAliveState(
context.getMyId() ) )
.setHeader( "last-learned",
context.getLastLearnedInstanceId() + "" ) );
// Set new timeout to send heartbeat to this host
context.setTimeout(
HeartbeatMessage.sendHeartbeat + "-" + to,
timeout( HeartbeatMessage.sendHeartbeat, message, to ) );
}
}
break;
}
case reset_send_heartbeat:
{
InstanceId to = message.getPayload();
if ( !context.isMe( to ) )
{
String timeoutName = HeartbeatMessage.sendHeartbeat + "-" + to;
context.cancelTimeout( timeoutName );
context.setTimeout( timeoutName, Message.timeout(
HeartbeatMessage.sendHeartbeat, message, to ) );
}
break;
}
case suspicions:
{
HeartbeatMessage.SuspicionsState suspicions = message.getPayload();
context.getLogger( HeartbeatState.class )
.debug( "Received suspicions as " + suspicions );
URI from = new URI( message.getHeader( Message.FROM ) );
InstanceId fromId = context.getIdForUri( from );
/*
* Remove ourselves from the suspicions received - we just received a message,
* it's not normal to be considered failed. Whatever it was, it was transient and now it has
* passed.
*/
suspicions.getSuspicions().remove( context.getMyId() );
context.suspicions( fromId, suspicions.getSuspicions() );
break;
}
case leave:
{
context.getLogger( HeartbeatState.class ).debug( "Received leave" );
return start;
}
case addHeartbeatListener:
{
context.addHeartbeatListener( (HeartbeatListener) message.getPayload() );
break;
}
case removeHeartbeatListener:
{
context.removeHeartbeatListener( (HeartbeatListener) message.getPayload() );
break;
}
}
return this;
}
}
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
0ea658092aba0f1140fbcc5e9d46977c526b14b3 | 5192e8fdc130369f0cd18333056230c0f7f537c3 | /src/main/java/inacap/webcomponent/rentacar/controller/CombustibleController.java | c40ed734fef61eec95455edcea6007a09c63fcea | [] | no_license | CarlosANSF/rentacar | 9b06a611e08dd5429c201d6f6c9e915d7094cdca | b4738e1d7f8c573a0490c1a8c26ba2e065c51eb2 | refs/heads/master | 2020-03-20T22:02:13.873788 | 2018-06-28T15:42:42 | 2018-06-28T15:42:42 | 137,775,579 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,054 | 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 inacap.webcomponent.rentacar.controller;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import inacap.webcomponent.rentacar.model.Combustible;
import org.springframework.http.HttpStatus;
import inacap.webcomponent.rentacar.repository.CombustibleRepository;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
@RestController
@RequestMapping("/combustible")
public class CombustibleController {
@Autowired
private CombustibleRepository combustibleRepository;
@GetMapping()
public Iterable<Combustible> list() {
return combustibleRepository.findAll();
}
@GetMapping("/{id}")
public ResponseEntity<Combustible> get(@PathVariable String id) {
Optional<Combustible> aOptional = combustibleRepository.findById(Integer.parseInt(id));
if (aOptional.isPresent()) {
Combustible combustibleEncontrado = aOptional.get();
return new ResponseEntity<>(combustibleEncontrado, HttpStatus.FOUND);
}else{
return new ResponseEntity<>(null, HttpStatus.NOT_FOUND);
}
}
@PutMapping("/{id}")
public ResponseEntity<Combustible> put(@PathVariable String id, @RequestBody Combustible combustibleEditar) {
Optional<Combustible> aOptional = combustibleRepository.findById(Integer.parseInt(id));
if (aOptional.isPresent()) {
Combustible combustibleEncontrado = aOptional.get();
combustibleEditar.setIdCombustible(combustibleEncontrado.getIdCombustible());
combustibleRepository.save(combustibleEditar);
return new ResponseEntity<>(combustibleEditar, HttpStatus.OK);
}else{
return new ResponseEntity<>(null, HttpStatus.NOT_FOUND);
}
}
@PostMapping
public ResponseEntity<?> post(@RequestBody Combustible nuevoCombustible) {
nuevoCombustible = combustibleRepository.save(nuevoCombustible);
Optional<Combustible> aOptional = combustibleRepository.findById(nuevoCombustible.getIdCombustible());
if (aOptional.isPresent()) {
Combustible combustibleEncontrado = aOptional.get();
return new ResponseEntity<>(combustibleEncontrado, HttpStatus.CREATED);
}else{
return new ResponseEntity<>(null, HttpStatus.NOT_ACCEPTABLE);
}
}
@DeleteMapping("/{id}")
public ResponseEntity<?> delete(@PathVariable String id) {
Optional<Combustible> aOptional = combustibleRepository.findById(Integer.parseInt(id));
if (aOptional.isPresent()) {
Combustible combustibleEncontrado = aOptional.get();
combustibleRepository.deleteById(combustibleEncontrado.getIdCombustible());
return new ResponseEntity<>(combustibleEncontrado, HttpStatus.OK);
}else{
return new ResponseEntity<>(null, HttpStatus.NOT_FOUND);
}
}
}
| [
"19168534-2@chi_lab0408.inacap.cl"
] | 19168534-2@chi_lab0408.inacap.cl |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.