blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
41efb2cb7cddece7c1b6f18a8ac5ec34145b5928 | b7ff0ea1bb896d3c3d5bfff594c94c608bb18e14 | /LearningMachine/app/src/main/java/com/learningmachine/android/app/data/url/SplashUrlDecoder.java | eba291c4b8cc40972075cfbf4434fda3c66fde79 | [
"MIT",
"EPL-1.0",
"Apache-2.0",
"LicenseRef-scancode-protobuf"
] | permissive | blockchain-certificates/wallet-android | 32c17f6b1e5107817a79771df9a78375c9a69a66 | a007b3295892777a800750b9f51d6446ea833da8 | refs/heads/master | 2023-08-08T19:23:57.432836 | 2023-07-25T12:53:44 | 2023-07-25T12:53:44 | 93,951,167 | 40 | 56 | MIT | 2023-07-25T12:53:46 | 2017-06-10T16:19:19 | Java | UTF-8 | Java | false | false | 2,754 | java | package com.learningmachine.android.app.data.url;
import com.learningmachine.android.app.util.StringUtils;
import java.io.IOException;
import java.net.URLDecoder;
import timber.log.Timber;
import static com.learningmachine.android.app.data.url.LaunchType.ADD_CERTIFICATE;
import static com.learningmachine.android.app.data.url.LaunchType.ADD_ISSUER;
public class SplashUrlDecoder {
private static final String ADD_ISSUER_PATH = "introduce-recipient/";
private static final String ADD_CERT_PATH = "import-certificate/";
public static LaunchData getLaunchType(String launchUri) {
if (launchUri == null) {
launchUri = "";
}
LaunchData data;
if (launchUri.contains(ADD_ISSUER_PATH)) {
data = handleAddIssuerUri(launchUri);
if (data != null) {
return data;
}
} else if (launchUri.contains(ADD_CERT_PATH)) {
data = handleAddCertificateUri(launchUri);
if (data != null) {
return data;
}
}
return new LaunchData(LaunchType.ONBOARDING);
}
private static LaunchData handleAddIssuerUri(String uriString) {
String pathSuffix = getPathSuffix(uriString, ADD_ISSUER_PATH);
if (StringUtils.isEmpty(pathSuffix)) {
Timber.e("Launch uri missing the issuer path suffix");
return null;
}
String[] issuerParts = pathSuffix.split("/");
if (issuerParts.length < 2) {
Timber.e("Launch uri missing issuer path parts");
return null;
}
try {
String introUrl = URLDecoder.decode(issuerParts[0], "UTF-8");
String nonce = URLDecoder.decode(issuerParts[1], "UTF-8");
return new LaunchData(ADD_ISSUER, introUrl, nonce);
} catch (IOException e) {
Timber.e(e, "Unable to decode Urls.");
}
return null;
}
private static LaunchData handleAddCertificateUri(String uriString) {
String pathSuffix = getPathSuffix(uriString, ADD_CERT_PATH);
if (StringUtils.isEmpty(pathSuffix)) {
Timber.e("Launch uri missing the cert path suffix");
return null;
}
try {
String certUrl = URLDecoder.decode(pathSuffix, "UTF-8");
return new LaunchData(ADD_CERTIFICATE, certUrl);
} catch (IOException e) {
Timber.e(e, "Unable to decode Urls.");
}
return null;
}
private static String getPathSuffix(String uriString, String delimiter) {
String[] uriSplit = uriString.split(delimiter);
if (uriSplit.length < 2) {
return null;
}
return uriSplit[1];
}
}
| [
"cstew415@gmail.com"
] | cstew415@gmail.com |
8b44958a9b5f159506a5d610fb6034436ef2f823 | 8cc1bbe55fb795b75c5e455d4bd26d0e51321575 | /src/test/java/org/apache/ibatis/submitted/inheritance/InheritanceTest.java | 83da9e92cdaa8e9468d5a6764dd3e278bf43fbc9 | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | liupjie/mybatis | e74e034cb051144a4a57e276496147c5b09d1986 | ba863886c3ee8b7ece58b1debb16def8e2473f27 | refs/heads/master | 2023-07-19T13:10:53.520255 | 2021-09-15T03:18:30 | 2021-09-15T03:18:30 | 392,498,207 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,039 | java | /**
* Copyright ${license.git.copyrightYears} the original author or authors.
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.ibatis.submitted.inheritance;
import java.io.Reader;
import org.apache.ibatis.BaseDataTest;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
// see issue #289
class InheritanceTest {
private static SqlSessionFactory sqlSessionFactory;
@BeforeAll
static void setUp() throws Exception {
// create a SqlSessionFactory
try (Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/inheritance/mybatis-config.xml")) {
sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
}
// populate in-memory database
BaseDataTest.runScript(sqlSessionFactory.getConfiguration().getEnvironment().getDataSource(),
"org/apache/ibatis/submitted/inheritance/CreateDB.sql");
}
@Test
void shouldGetAUser() {
try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
UserProfileMapper mapper = sqlSession.getMapper(UserProfileMapper.class);
UserProfile user = mapper.retrieveById(1);
Assertions.assertEquals("Profile1", user.getName());
}
}
}
| [
"374299590@qq.com"
] | 374299590@qq.com |
e139d6649b07e95b970153e6b255337b1d6a336a | 161500b3ecde07ddfd31fe7785e6fc95e43fec5c | /src/main/java/ie/cit/adf/muss/repositories/ReviewRepository.java | 688fa07fa3b8c5f8ed41da342d88a77264c5b708 | [] | no_license | reneses/muss | 4218d4cce166451568041648ed8bc9bcf4d2a10c | 3915809561ce8cde4e75e652ad7edda73fef55ac | refs/heads/master | 2021-01-10T05:06:02.679733 | 2016-12-18T13:07:51 | 2016-12-18T13:07:51 | 48,266,499 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 217 | java | package ie.cit.adf.muss.repositories;
import org.springframework.data.repository.CrudRepository;
import ie.cit.adf.muss.domain.Review;
public interface ReviewRepository extends CrudRepository<Review, Integer> {
}
| [
"rsd_raul@yahoo.es"
] | rsd_raul@yahoo.es |
e26695430b3638b6e99653d00338a9041d506804 | bd23887e97b6602529d19d07af71cdfb31a3299a | /Selinium/src/Testaccount.java | 3d873bee5581ce5fd9f9db10fc9323efb8194573 | [] | no_license | Karthikeya189/Java-projects | 2bc2693e1b2450cb5c14e3b87fa4c3693b85b961 | e1529e7278086f84132e1089b9ee58056b1a87bd | refs/heads/master | 2020-03-27T16:12:55.385697 | 2018-08-30T15:05:22 | 2018-08-30T15:05:22 | 146,766,692 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 628 | java | import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class Testaccount {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver","C:\\Users\\KARTHIKEYA\\Desktop\\selenium\\chromedriver_win32\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.get("https://accounts.google.com/signin/v2/identifier?continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&service=mail&sacu=1&rip=1&flowName=GlifWebSignIn&flowEntry=ServiceLogin");
driver.findElement(By.xpath("//*[@id="identifierId"]"))
}
} | [
"KARTHIKEYA@KARTHIKEYA.fios-router.home"
] | KARTHIKEYA@KARTHIKEYA.fios-router.home |
1d37b6edf377e6c7372c546afa18581850be4e8d | 906e06b9a7d3f9de381b85cad1e85d3177ad241e | /src/io/sr7/tutorial/structural/bridge/storage/BaseEntiy.java | 60e89e2f7899d968c08aa3334578f091ed3bfbb8 | [] | no_license | ssr7/design-pattern | a67726e7ddb56718b16591b81a6a25fa5589fb04 | b80f673fb619ee1f6709f16e3b393491bfb8acdf | refs/heads/master | 2023-02-03T14:30:45.103642 | 2023-01-20T13:25:35 | 2023-01-20T13:25:35 | 302,674,041 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 219 | java | package io.sr7.tutorial.structural.bridge.storage;
public class BaseEntiy {
private Long id;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
} | [
"pasbag.p30@gmail.com"
] | pasbag.p30@gmail.com |
c68ae33eb9afcc0e7037319a0261db837597b631 | 81c5f0701c891148851ba6e3b949c9bb064dc33d | /easydoc/easydoc-servico/src/main/java/davidsolutions/easydoc/servico/entidade/Arquivo.java | c6bf7f63cee256531dc45940e52c74ef9eff3786 | [] | no_license | eduardopappalardo/easydoc | 2953e766f92379ea880d4c0edad79a3a5ba2b9a6 | 8bb2d5b5925a7a566f966042576f02a0a67bf5fe | refs/heads/master | 2021-01-01T19:00:02.173065 | 2018-11-22T13:19:04 | 2018-11-22T13:19:04 | 88,545,276 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,167 | java | package davidsolutions.easydoc.servico.entidade;
import java.io.InputStream;
public class Arquivo {
private Integer codigoArquivo;
private Documento documento;
private String nomeOriginal;
private String caminho;
private String descricao;
private InputStream conteudo;
public Integer getCodigoArquivo() {
return this.codigoArquivo;
}
public void setCodigoArquivo(Integer codigoArquivo) {
this.codigoArquivo = codigoArquivo;
}
public Documento getDocumento() {
return this.documento;
}
public void setDocumento(Documento documento) {
this.documento = documento;
}
public String getNomeOriginal() {
return this.nomeOriginal;
}
public void setNomeOriginal(String nomeOriginal) {
this.nomeOriginal = nomeOriginal;
}
public String getCaminho() {
return this.caminho;
}
public void setCaminho(String caminho) {
this.caminho = caminho;
}
public String getDescricao() {
return this.descricao;
}
public void setDescricao(String descricao) {
this.descricao = descricao;
}
public InputStream getConteudo() {
return this.conteudo;
}
public void setConteudo(InputStream conteudo) {
this.conteudo = conteudo;
}
} | [
"eduardopappalardo@yahoo.com.br"
] | eduardopappalardo@yahoo.com.br |
3bb7c382941960dcb15b144eee1c587744e361a0 | c04e969b084487faf72c78a2e9f5dd96731c032d | /gamll-mbg/src/main/java/com/lq/gmall/sms/mapper/CouponProductCategoryRelationMapper.java | a517e0e68417a6ab44662f8ec81537c52e29d11f | [] | no_license | tianmeng-pool/gmall | af3a1ed0d5eb05b4d6b7317f92d14f54a542d1ee | fbb92b6686bbbe6730d17450eaaf03daebd496b3 | refs/heads/master | 2022-07-11T20:27:06.047152 | 2020-03-28T10:30:01 | 2020-03-28T10:30:01 | 239,452,024 | 1 | 0 | null | 2022-06-21T02:46:51 | 2020-02-10T07:26:16 | Java | UTF-8 | Java | false | false | 373 | java | package com.lq.gmall.sms.mapper;
import com.lq.gmall.sms.entity.CouponProductCategoryRelation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 优惠券和产品分类关系表 Mapper 接口
* </p>
*
* @author lq
* @since 2020-02-10
*/
public interface CouponProductCategoryRelationMapper extends BaseMapper<CouponProductCategoryRelation> {
}
| [
"abilifox@foxmail"
] | abilifox@foxmail |
370a3fe1e598d5a2dfb80a0a2100af8f0a54c743 | 808b985690efbca4cd4db5b135bb377fe9c65b88 | /tbs_core_45016_20191122114850_nolog_fs_obfs/assets/webkit/unZipCode/tbs_sdk_extension.src/com/tencent/smtt/jscore/X5JsVirtualMachine.java | 5a099ec0236924d4ec050cb120604c332b851430 | [] | no_license | polarrwl/WebviewCoreAnalysis | 183e12b76df3920c5afc65255fd30128bb96246b | e21a294bf640578e973b3fac604b56e017a94060 | refs/heads/master | 2022-03-16T17:34:15.625623 | 2019-12-17T03:16:51 | 2019-12-17T03:16:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,375 | java | package com.tencent.smtt.jscore;
import android.content.Context;
import android.os.Looper;
import com.tencent.smtt.export.external.jscore.interfaces.IX5JsContext;
import com.tencent.smtt.export.external.jscore.interfaces.IX5JsVirtualMachine;
import org.chromium.base.annotations.UsedByReflection;
public class X5JsVirtualMachine
implements IX5JsVirtualMachine
{
private static final String CLAZZ_NAME = "X5JsVirtualMachine";
private final X5JsVirtualMachineImpl mJsVirtualMachine;
@UsedByReflection("WebCoreProxy.java")
public X5JsVirtualMachine(Context paramContext, Looper paramLooper)
{
this.mJsVirtualMachine = X5JsCoreFactory.createJsVirtualMachine(paramContext, paramLooper);
}
public IX5JsContext createJsContext()
{
return new X5JsContext(this, this.mJsVirtualMachine.createJsContext());
}
public void destroy()
{
this.mJsVirtualMachine.destroy();
}
public Looper getLooper()
{
return this.mJsVirtualMachine.getLooper();
}
public void onPause()
{
this.mJsVirtualMachine.onPause();
}
public void onResume()
{
this.mJsVirtualMachine.onResume();
}
}
/* Location: C:\Users\Administrator\Desktop\学习资料\dex2jar\dex2jar-2.0\classes-dex2jar.jar!\com\tencent\smtt\jscore\X5JsVirtualMachine.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"1542951820@qq.com"
] | 1542951820@qq.com |
7f522e3463772cea21f48222cbd52dc38cccf30c | b05778598110b025605fd7c36a80676f77fc3adc | /src/Agent/InfluenceMap/InfluenceNode.java | 65613592dd4f0ffce551b90880cccccee46d18b4 | [] | no_license | milanw/MAS | 204017c42f5b7335f65ca974c911d0686d4d4ed3 | acd137a77e3dcbbb0d38c44405871c5ad96be870 | refs/heads/master | 2021-01-23T05:36:13.319845 | 2015-06-22T13:50:18 | 2015-06-22T13:50:18 | 30,302,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 498 | java | package Agent.InfluenceMap;
public class InfluenceNode {
public int x;
public int y;
public int distance; //distance from source
public double value;
public InfluenceNode(int x, int y) {
this.x = x;
this.y = y;
}
public InfluenceNode(int x, int y, double value) {
this.x = x;
this.y = y;
this.value = value;
}
public boolean equals(InfluenceNode node){
return x == node.x && y == node.y;
}
public String toString() {
return "(" + x + ", " + y + ")";
}
}
| [
"mar.co@online.de"
] | mar.co@online.de |
88b104bfb1e738430ffe02c51337ac29dcfce9ad | f766baf255197dd4c1561ae6858a67ad23dcda68 | /app/src/main/java/com/tencent/mm/plugin/appbrand/appcache/u.java | 26743fea3fb84315f76784632fb9f6515c57b2ed | [] | no_license | jianghan200/wxsrc6.6.7 | d83f3fbbb77235c7f2c8bc945fa3f09d9bac3849 | eb6c56587cfca596f8c7095b0854cbbc78254178 | refs/heads/master | 2020-03-19T23:40:49.532494 | 2018-06-12T06:00:50 | 2018-06-12T06:00:50 | 137,015,278 | 4 | 2 | null | null | null | null | UTF-8 | Java | false | false | 740 | java | package com.tencent.mm.plugin.appbrand.appcache;
import com.tencent.mm.sdk.e.e;
import com.tencent.mm.sdk.e.i;
public final class u
extends i<t>
{
public static final String[] dzV = { i.a(t.fgt, "PkgUpdateStats") };
public u(e parame)
{
super(parame, t.fgt, "PkgUpdateStats", t.ciG);
}
final boolean af(String paramString, int paramInt)
{
t localt = new t();
localt.field_key = paramString;
localt.field_version = paramInt;
return super.a(localt, t.fgs);
}
}
/* Location: /Users/Han/Desktop/wxall/微信反编译/反编译 6.6.7/dex2jar-2.0/classes5-dex2jar.jar!/com/tencent/mm/plugin/appbrand/appcache/u.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"526687570@qq.com"
] | 526687570@qq.com |
988b8a210c0dbc4a74ce6a44401ca3f4f4d74a98 | 6e68be66bd1767fc3ef1f18011503e2cac33ea7a | /noiz2/src/jp/gr/java_conf/abagames/bulletml/Accel.java | 04fc6bee6be19fde87dc112b0c9ad43ee95863e4 | [
"BSD-3-Clause",
"Apache-2.0",
"BSD-2-Clause"
] | permissive | alistairrutherford/noiz2-droid | 82f0dae17c53d355c0db0300d8e78d4cf5747226 | 766848d72f65bcceef7fd82f5fdce9b819d10833 | refs/heads/master | 2020-07-05T07:36:41.946700 | 2015-03-17T17:11:38 | 2015-03-17T17:11:38 | 32,238,331 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,071 | java | /**
* Copyright 2002 Kenta Cho. All rights reserved.
* Original
* Copyright (C) 2009 Alistair Rutherford, Glasgow, Scotland, UK, www.netthreads.co.uk
* Various modifications.
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted provided that
* the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package jp.gr.java_conf.abagames.bulletml;
import java.io.IOException;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
/**
* Accel xml data.
*
*/
public class Accel implements IChoice
{
private Horizontal horizontal = null;
private Vertical vertical = null;
private String term = "";
private boolean inTerm = false;
XmlPullParser parser = null;
public Accel(XmlPullParser parser) throws IOException, XmlPullParserException
{
this.parser = parser;
boolean done = false;
do
{
int type = parser.nextToken();
if (type == XmlPullParser.TEXT)
{
String text = parser.getText();
if (text != null)
{
processText(text);
}
}
else
if (type == XmlPullParser.END_TAG)
{
String endTag = parser.getName();
if (endTag != null)
{
done = processEndTag(endTag, Bulletml.TAG_ACCEL);
}
}
else
if (type == XmlPullParser.START_TAG)
{
String startTag = parser.getName();
if (startTag != null)
{
processStartTag(parser, startTag);
}
}
else
if (type == XmlPullParser.END_DOCUMENT)
{
done = true;
}
}
while (!done);
}
/**
* Process Start tag.
*
* @param tag
* @throws IOException
* @throws XmlPullParserException
*/
private void processStartTag(XmlPullParser parser, String tag) throws IOException, XmlPullParserException
{
if (tag.equals(Bulletml.TAG_HORIZONTAL))
{
horizontal = new Horizontal(parser);
}
else
if (tag.equals(Bulletml.TAG_VERTICAL))
{
vertical = new Vertical(parser);
}
else
if (tag.equals(Bulletml.TAG_TERM))
{
inTerm = true;
}
}
/**
* Process text.
*
* @param text
*/
private void processText(String text)
{
if (inTerm)
{
term = parser.getText();
}
}
/**
* Process end tag.
*
* @param tag
*
* @return True indicates end processing.
*/
private boolean processEndTag(String tag, String endTag)
{
boolean status = false;
if (tag.equals(endTag))
{
status = true;
}
else
if (tag.equals(Bulletml.TAG_TERM))
{
inTerm = false;
}
return status;
}
public final Horizontal getHorizontal()
{
return horizontal;
}
public final Vertical getVertical()
{
return vertical;
}
public final String getTerm()
{
return term;
}
}
| [
"alistair.rutherford@82622db7-244d-66e2-13ee-0fb2bfebd48d"
] | alistair.rutherford@82622db7-244d-66e2-13ee-0fb2bfebd48d |
21cb240c2a1ec599b3212f30f2ad110ed9d95c42 | cf46c7d45c17e45bb5042bdb7497951f49b02ae6 | /core/src/com/almaslamanigdx/game/CanyonBunnyMain.java | 1824f084938be137c56348ac5c4c8dfda61e36dc | [] | no_license | malmaslamani/CSC493_Almaslamani_Mohammed | 08b411974d6aa9e22efd8e75d8561ccd5926c88a | 423f153732135e21462d8318dd084d196f137398 | refs/heads/master | 2020-12-25T14:23:00.130482 | 2016-11-15T22:59:10 | 2016-11-15T22:59:10 | 67,036,485 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 844 | java | package com.almaslamanigdx.game;
import com.badlogic.gdx.Application;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.assets.AssetManager;
import screens.MenuScreen;
import util.AudioManager;
import util.GamePreferences;
import com.almaslamanigdx.game.Assets;
public class CanyonBunnyMain extends Game
{
//setting the log level and loading our assets,
//and then start with the menu screen.
@Override
public void create ()
{
// Set Libgdx log level
Gdx.app.setLogLevel(Application.LOG_DEBUG);
// Load assets
Assets.instance.init(new AssetManager());
// Load preferences for audio settings and start playing music
GamePreferences.instance.load();
AudioManager.instance.play(Assets.instance.music.song01);
// Start game at menu screen
setScreen(new MenuScreen(this));
}
}
| [
"malmaslamani@hotmail.com"
] | malmaslamani@hotmail.com |
d1f2302b739cd8a7e342fa24343ca5ff909b9e41 | 6b3c97edb0264999205a31f3c4e738f02a01df16 | /feria/src/com/intime/feria/dao/PointsDAOImpl.java | 96919c376fbbf4ca69999d2ce70fae36981ac59a | [] | no_license | iamhoonpark/project-team-feria | 4f3a1d7ac9f59ae4601e45d2723dfae17c7526ef | a510765d9d6f1936d161688e02e50f69c5dedb47 | refs/heads/main | 2023-09-02T05:44:33.684707 | 2021-11-06T13:59:48 | 2021-11-06T13:59:48 | 421,747,314 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 307 | java | package com.intime.feria.dao;
import org.apache.ibatis.session.SqlSession;
public class PointsDAOImpl implements PointsDAO {
/* 2020-08-07 장유정(기본세팅) */
// 멤버필드
private SqlSession session;
// setter
public void setSession(SqlSession session) {
this.session = session;
}
}
| [
"psh995666@gmail.com"
] | psh995666@gmail.com |
412bb9062210923738e56e0a71bcf6b0e821390f | 53b84642998df3fe10426b6df96406b1e9556f3b | /src/main/java/pe/edu/dps/annotations/Estudiante.java | 5c5cb2c02e5de3f09b48c21bcf36aab689752e70 | [] | no_license | upc-is-si720/dps-patterns-gof | 045df2b4957c68eaf89a886d8ba9ab32b7cdc89b | a46aafab3549b50bc5f34deae1560b9d4c8237b8 | refs/heads/master | 2023-03-16T23:30:54.743791 | 2020-10-14T13:31:43 | 2020-10-14T13:31:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 441 | java | package pe.edu.dps.annotations;
public class Estudiante extends Persona {
@Override
public void saludar() {
super.saludar();
System.out.println("mas saludo");
}
@Override
@SuppressWarnings("deprecation")
public void caminar() {
System.out.println("Sigo caminando");
super.salirCalle();
}
@MiAnotacion
public void estudiar() {
Padre padre = new Padre();
}
}
| [
"ajaflorez.upc@gmail.com"
] | ajaflorez.upc@gmail.com |
eb57afcb5dee960e76eef73ae8f12e62b0d3d8ee | 03421c15dda8e197a2e45ea637da4241593ba8bd | /app/src/androidTest/java/cous/courseclass/ExampleInstrumentedTest.java | 8868aa4f58275e56c5eef8b349407a816a398467 | [] | no_license | nomi008/Courseclass | 9eb22a13c18374806a01ada543f432a0d8a52cae | 1fa82db6442071fcdffcdee862b42748bd576c6b | refs/heads/master | 2020-03-23T02:20:08.523880 | 2018-07-14T18:34:24 | 2018-07-14T18:34:24 | 140,969,237 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 716 | java | package cous.courseclass;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("cous.courseclass", appContext.getPackageName());
}
}
| [
"32256412+nomi008@users.noreply.github.com"
] | 32256412+nomi008@users.noreply.github.com |
6dda50b98c63963f075aba5cfa12be19da335d00 | d57b5fadfa4ef9286c0e320a5442cb9a9d6528c0 | /JSONApp/src/jsonapp/posicionGlobal/view/PrestamosView.java | 6d31eb89d4f8c4049a6ce74b6577bd4a9b1be0bf | [] | no_license | cperezh/JsonBuilder | 25a677effba2f74a843c3cc0926f73afad07f8de | afe10120f8436789adfc262d1c5a898c75fc2ba8 | refs/heads/master | 2021-01-19T05:29:50.061684 | 2014-02-07T08:02:28 | 2014-02-07T08:02:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,267 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package jsonapp.posicionGlobal.view;
import java.io.Serializable;
import jsonapp.views.utils.CodigoProductoView;
import jsonapp.views.utils.ImporteMonetarioView;
import org.codehaus.jackson.annotate.JsonIgnore;
/**
*
* @author carlos.perez
*/
public class PrestamosView implements Serializable {
String numeroPrestamo;
String alias;
ImporteMonetarioView capitalConcedido;
ImporteMonetarioView deudaPendiente;
Boolean saldoInformado;
CodigoProductoView codigoProductoComercial;
String nombreProductoComercial;
String codigoProductoUrsus;
String codigoProductoCPP;
public PrestamosView() {
numeroPrestamo = "01000088833";
alias = "Préstamo coche";
capitalConcedido = new ImporteMonetarioView();
deudaPendiente = new ImporteMonetarioView();
saldoInformado = true;
codigoProductoComercial = new CodigoProductoView();
nombreProductoComercial = "Préstamos Bankia";
codigoProductoUrsus = "0000";
codigoProductoCPP = "1111";
}
public String getNumeroPrestamo() {
return numeroPrestamo;
}
public void setNumeroPrestamo(String numeroPrestamo) {
this.numeroPrestamo = numeroPrestamo;
}
public String getAlias() {
return alias;
}
public void setAlias(String alias) {
this.alias = alias;
}
public ImporteMonetarioView getCapitalConcedido() {
return capitalConcedido;
}
public void setCapitalConcedido(ImporteMonetarioView capitalConcedido) {
this.capitalConcedido = capitalConcedido;
}
public ImporteMonetarioView getDeudaPendiente() {
return deudaPendiente;
}
public void setDeudaPendiente(ImporteMonetarioView deudaPendiente) {
this.deudaPendiente = deudaPendiente;
}
public Boolean isSaldoInformado() {
return saldoInformado;
}
public void setSaldoInformado(Boolean saldoInformado) {
this.saldoInformado = saldoInformado;
}
@JsonIgnore
public CodigoProductoView getCodigoProductoComercial() {
return codigoProductoComercial;
}
public void setCodigoProductoComercial(CodigoProductoView codigoProductoComercial) {
this.codigoProductoComercial = codigoProductoComercial;
}
public String getNombreProductoComercial() {
return nombreProductoComercial;
}
public void setNombreProductoComercial(String nombreProductoComercial) {
this.nombreProductoComercial = nombreProductoComercial;
}
public String getCodigoProductoUrsus() {
return codigoProductoUrsus;
}
public void setCodigoProductoUrsus(String codigoProductoUrsus) {
this.codigoProductoUrsus = codigoProductoUrsus;
}
public String getCodigoProductoCPP() {
return codigoProductoCPP;
}
public void setCodigoProductoCPP(String codigoProductoCPP) {
this.codigoProductoCPP = codigoProductoCPP;
}
}
| [
"carlos.perez@DBE-CARLOSP.adesis.biz"
] | carlos.perez@DBE-CARLOSP.adesis.biz |
35bb6ca7fdbd43859f4358882d7e2c1f28fcc5ba | 6bac048b5eb66d641cdfa7ca7ed776fba38728d7 | /src/main/java/com/achievo/hadoop/hbase/filter/FirstKeyOnlyFilterTest.java | 09c3adacad2add6785899e73349a7b68221b6a2b | [] | no_license | GalenZhang/mahoutSample | 8a39cc4a384b7daf66c5fa9ddf964e1da7746a87 | 7d5e5f10c6203b4a8a0f86734d24f42f21e3407f | refs/heads/master | 2022-11-16T15:36:18.216678 | 2016-01-11T10:51:05 | 2016-01-11T10:51:05 | 38,345,638 | 1 | 0 | null | 2022-11-04T22:44:40 | 2015-07-01T02:49:51 | Java | UTF-8 | Java | false | false | 4,046 | java | package com.achievo.hadoop.hbase.filter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.filter.Filter;
import org.apache.hadoop.hbase.filter.FirstKeyOnlyFilter;
import org.apache.hadoop.hbase.util.Bytes;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
* <pre>
*
* Accela Automation
* File: HbaseFilter.java
*
* Accela, Inc.
* Copyright (C): 2015
*
* Description:
* http://coriger.com/article/html/88
*
* Notes:
* $Id: HbaseFilter.java 72642 2009-01-01 20:01:57Z ACHIEVO\galen.zhang $
*
* Revision History
* <Date>, <Who>, <What>
* Sep 21, 2015 galen.zhang Initial.
*
* </pre>
*/
public class FirstKeyOnlyFilterTest
{
private Configuration conf;
private Admin admin;
private Table table;
private TableName tn;
private String tableName = "t_article";
private String columnFamily1 = "info";
private String columnFamily2 = "comment";
private Connection conn;
@Before
public void init()
{
conf = HBaseConfiguration.create();
try
{
conn = ConnectionFactory.createConnection(conf);
admin = conn.getAdmin();
tn = TableName.valueOf(tableName);
table = conn.getTable(tn);
initData();
}
catch (Exception e)
{
e.printStackTrace();
}
}
/**
* 初始化数据
*/
public void initData()
{
try
{
if (admin.tableExists(tn))
{
System.out.println(tableName + " exists !");
}
else
{
HTableDescriptor desc = new HTableDescriptor(tn);
desc.addFamily(new HColumnDescriptor(columnFamily1));
desc.addFamily(new HColumnDescriptor(columnFamily2));
admin.createTable(desc);
System.out.println("create " + tableName + " success !");
addData();
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
public void addData() throws IOException
{
List<Put> list = new ArrayList<Put>();
Put put1 = new Put(("row1").getBytes());
put1.addColumn(columnFamily1.getBytes(), "title".getBytes(), "hadoop".getBytes());
put1.addColumn(columnFamily1.getBytes(), "content".getBytes(), "hadoop is easy".getBytes());
list.add(put1);
Put put2 = new Put(("row2").getBytes());
put2.addColumn(columnFamily2.getBytes(), "user".getBytes(), "ljt".getBytes());
put2.addColumn(columnFamily2.getBytes(), "time".getBytes(), "20150902".getBytes());
list.add(put2);
table.put(list);
System.out.println("data add success!");
}
/**
* 过滤行键
*
* @throws IOException
*/
@Test
public void filterValue() throws IOException
{
Scan scan = new Scan();
Filter filter = new FirstKeyOnlyFilter();
scan.setFilter(filter);
ResultScanner rs1 = table.getScanner(scan);
for (Result result : rs1)
{
for (Cell cell : result.rawCells())
{
System.out.println("row: " + Bytes.toString(CellUtil.cloneRow(cell)) + ";"
+ Bytes.toString(CellUtil.cloneQualifier(cell)) + ":"
+ Bytes.toString(CellUtil.cloneValue(cell)));
}
}
rs1.close();
}
@After
public void close() throws IOException
{
deleteTable();
admin.close();
conn.close();
}
private void deleteTable() throws IOException
{
admin.disableTable(tn);
admin.deleteTable(tn);
if (!admin.tableExists(tn))
{
System.out.println(tableName + " is delete !");
}
}
}
/*
* $Log: av-env.bat,v $
*/ | [
"galen.zhang@beyondsoft.com"
] | galen.zhang@beyondsoft.com |
ac4dd22ec77b95e5f7df2c159fb4394f523c174d | e2881ebb0d9ed346093d6e4d944ae1ecc52a6d75 | /payroll-spring-mvc/src/main/java/com/georgiev/services/AddTimeCardService.java | cac357790f190432353c3f4ea11cdb57a6f782db | [] | no_license | adafdmei/payroll | a6428816f2c0e2d8bd4164ffa33c65eb230243aa | e790d535b6b9a4ba0b9fa0057e44c2231c649720 | refs/heads/master | 2021-05-31T21:51:49.721737 | 2016-04-18T19:08:10 | 2016-04-18T19:08:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 226 | java | package com.georgiev.services;
import com.georgiev.payroll.db.PayrollDatabase;
import java.util.Map;
public interface AddTimeCardService {
String addTimeCard(Map<String, Object> data, PayrollDatabase payrollDatabase);
}
| [
"Kristo Georgiev"
] | Kristo Georgiev |
6fa036dcfe5c95671410e8376603043dec6ae6bb | f5e3deab09e83e3df49f6b17d3519e742c926513 | /src/com/val/vk/exceptions/EmptyParamException.java | 6efbf3941344b91886d95c012f3cc5bde7f36cba | [] | no_license | DiaperHater/VK_sample | 1c0aba3da0a20965fc7cb02c366a3ecf9bb6d402 | ec8b05c9527fc8a11a519c3c1d32f6389b620aa4 | refs/heads/master | 2021-04-06T00:18:08.477482 | 2018-06-21T21:53:38 | 2018-06-21T21:53:38 | 124,777,897 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 154 | java | package com.val.vk.exceptions;
public class EmptyParamException extends Exception {
public EmptyParamException(String s) {
super(s);
}
}
| [
"princess@vlr.com"
] | princess@vlr.com |
f357a3bf41c9719b99cee266bc583b774fd7acab | c00e1fa9c363bbf514cf73d77a8804a0a9516103 | /Summer Java/s170095/CS620C/Day 7/MethodSimple3.java | 3b73c024ad30495baeeaab8af015bffb976e4f57 | [] | no_license | J-Basquill/college | 1860d238ca653b27f07432469d2d25b2727c022b | 3a2dba13c25b356788287bf0e9ff5c34a879532f | refs/heads/master | 2020-03-08T22:11:59.052383 | 2018-05-29T12:31:19 | 2018-05-29T12:31:19 | 128,424,514 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,259 | java | /**
* This program illustrates the essential aspects of declaring a method
* and using this method in the main method of the application.
*
* @author Joe Duffin
* @version 4/09/2013
*/
public class MethodSimple3
{
public static void main(String args[])
{
int num1 = 5;
int num2 = 6;
int num3 =0;
// This is a method call or a method invocation.
// Notice that this method is designed to take two int parameters
// and also to return and int value (send back to where it was called)
num3 = addNumbers(num1, num2); // this is a method call or a method invocation.
System.out.println("The sum of " + num1 + " and " + num2 + " is : " + num3);
}
/**
* This method takes two integers, adds them together and
* prints the result to the screen
*/
// The first line below is the method signature.
// the key word int before the method name means that it returns a value of type int.
// Notice also that the method is designed to take two parameters a and b
public static int addNumbers(int a, int b)
{
int result = a + b
return result; // if the method has a return type then it must have the word return in it.
}
}
| [
"james.basquill@gmail.com"
] | james.basquill@gmail.com |
c3311357c0e1f56f648cdd58f436407b2f2369ac | 0f6c535c16fe0b1c20cdc9a4a88fc0b76ff16846 | /WEB-INF/src/com/ss/tp/dto/SuMenuVO.java | f7dff5047df4b4b379c0caf621cf448ab713db59 | [] | no_license | monsantoshi/Wages | c92aabdea1ccbf42401525e8b68d16fbeb2dc060 | d08fdcbfad15facb62002722fd3aee0917f751ca | refs/heads/master | 2022-10-22T00:06:27.259749 | 2020-06-13T09:55:31 | 2020-06-13T09:55:31 | 271,980,568 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,480 | java | /*
* Created on 9 ?.?. 2549
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.ss.tp.dto;
import java.io.Serializable;
/**
* @author Kiet
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class SuMenuVO implements Serializable {
private String menuId;
private String menuName;
private String mainMenu;
private String linkName;
/**
* @return Returns the linkName.
*/
public String getLinkName() {
return linkName;
}
/**
* @param linkName
* The linkName to set.
*/
public void setLinkName(String linkName) {
this.linkName = linkName;
}
/**
* @return Returns the mainMenu.
*/
public String getMainMenu() {
return mainMenu;
}
/**
* @param mainMenu
* The mainMenu to set.
*/
public void setMainMenu(String mainMenu) {
this.mainMenu = mainMenu;
}
/**
* @return Returns the menuId.
*/
public String getMenuId() {
return menuId;
}
/**
* @param menuId
* The menuId to set.
*/
public void setMenuId(String menuId) {
this.menuId = menuId;
}
/**
* @return Returns the menuName.
*/
public String getMenuName() {
return menuName;
}
/**
* @param menuName
* The menuName to set.
*/
public void setMenuName(String menuName) {
this.menuName = menuName;
}
}
| [
"monsan@gmail.com"
] | monsan@gmail.com |
2be34d010848cfca4122ef3410613f26a910f829 | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Math/59/org/apache/commons/math/stat/ranking/NaturalRanking_NaturalRanking_141.java | 7ffda599338ad0abb67b75eeb8e77cfdc8345a51 | [] | no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 1,510 | java |
org apach common math stat rank
rank base natur order doubl
nan treat configur link strategi nanstrategi ti
handl select link ti strategi tiesstrategi
configur set suppli option constructor argument
default link strategi nanstrategi maxim link ti strategi tiesstrategi averag
link ti strategi tiesstrategi random
link random gener randomgener suppli constructor argument
exampl
tabl border cellpad
colspan
input data doubl nan doubl neg infin
strategi nanstrategi ti strategi tiesstrategi
code rank data code
nan maxim
ti averag
nan maxim
minimum
minim
ti averag
remov
sequenti
minim
maximum
tabl
version revis date
natur rank naturalrank rank algorithm rankingalgorithm
creat natur rank naturalrank ti strategi tiesstrategi random
random gener randomgener sourc random data
param random gener randomgener sourc random data
natur rank naturalrank random gener randomgener random gener randomgener
ti strategi tiesstrategi ti strategi tiesstrategi random
nan strategi nanstrategi default nan strategi
random data randomdata random data impl randomdataimpl random gener randomgener
| [
"hvdthong@gmail.com"
] | hvdthong@gmail.com |
c48047d3b471de462e106724fe233800bf45839a | 3d7524556c148ef5c027e8f9b29cf0cede3464d7 | /xsqUtil/src/main/java/com/xsq/common/app/customzx/encode/ContactEncoder.java | 6598a6f01eb6cce38df996c6031325e80e4f6296 | [] | no_license | ZSQ970509/2 | fe40da292e886fbbbcbba89b85e4de2feacb18a3 | e4f4925050ed86c65d878c7e20e6659134ae54d1 | refs/heads/master | 2021-05-14T03:45:13.162327 | 2018-02-07T06:00:21 | 2018-02-07T06:00:21 | 116,624,566 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,241 | java | /*
* Copyright (C) 2011 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xsq.common.app.customzx.encode;
import java.util.Collection;
import java.util.HashSet;
/**
* Implementations encode according to some scheme for encoding contact information, like VCard or
* MECARD.
*
* @author Sean Owen
*/
abstract class ContactEncoder {
/**
* @return first, the best effort encoding of all data in the appropriate format; second, a
* display-appropriate version of the contact information
*/
abstract String[] encode(Iterable<String> names,
String organization,
Iterable<String> addresses,
Iterable<String> phones,
Iterable<String> emails,
Iterable<String> urls,
String note);
/**
* @return null if s is null or empty, or result of s.trim() otherwise
*/
static String trim(String s) {
if (s == null) {
return null;
}
String result = s.trim();
return result.isEmpty() ? null : result;
}
static void doAppend(StringBuilder newContents,
StringBuilder newDisplayContents,
String prefix,
String value,
Formatter fieldFormatter,
char terminator) {
String trimmed = trim(value);
if (trimmed != null) {
newContents.append(prefix).append(':').append(fieldFormatter.format(trimmed)).append(terminator);
newDisplayContents.append(trimmed).append('\n');
}
}
static void doAppendUpToUnique(StringBuilder newContents,
StringBuilder newDisplayContents,
String prefix,
Iterable<String> values,
int max,
Formatter formatter,
Formatter fieldFormatter,
char terminator) {
if (values == null) {
return;
}
int count = 0;
Collection<String> uniques = new HashSet<String>(2);
for (String value : values) {
String trimmed = trim(value);
if (trimmed != null && !trimmed.isEmpty() && !uniques.contains(trimmed)) {
newContents.append(prefix).append(':').append(fieldFormatter.format(trimmed)).append(terminator);
String display = formatter == null ? trimmed : formatter.format(trimmed);
newDisplayContents.append(display).append('\n');
if (++count == max) {
break;
}
uniques.add(trimmed);
}
}
}
}
| [
"1037557632@qq.com"
] | 1037557632@qq.com |
bdfec5cdb8e441405c51c85ed78704b6e50ab1f1 | 6e966225b3b05b07dc6208abc2cf27c4041db38a | /src/main/java/me/vilsol/nmswrapper/wraps/unparsed/NMSEnchantmentDepthStrider.java | 697ae9c7463fce063ea1a0224cf91e28c2a15242 | [
"Apache-2.0"
] | permissive | Vilsol/NMSWrapper | a73a2c88fe43384139fefe4ce2b0586ac6421539 | 4736cca94f5a668e219a78ef9ae4746137358e6e | refs/heads/master | 2021-01-10T14:34:41.673024 | 2016-04-11T13:02:21 | 2016-04-11T13:02:22 | 51,975,408 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,386 | java | package me.vilsol.nmswrapper.wraps.unparsed;
import me.vilsol.nmswrapper.*;
import me.vilsol.nmswrapper.reflections.*;
import me.vilsol.nmswrapper.wraps.*;
@ReflectiveClass(name = "EnchantmentDepthStrider")
public class NMSEnchantmentDepthStrider extends NMSEnchantment {
public NMSEnchantmentDepthStrider(Object nmsObject){
super(nmsObject);
}
public NMSEnchantmentDepthStrider(int i, NMSMinecraftKey minecraftKey, int i1){
super("EnchantmentDepthStrider", new Object[]{int.class, NMSMinecraftKey.class, int.class}, new Object[]{i, minecraftKey, i1});
}
/**
* TODO Find correct name
* @see net.minecraft.server.v1_9_R1.EnchantmentDepthStrider#a(int)
*/
@ReflectiveMethod(name = "a", types = {int.class})
public int a(int i){
return (int) NMSWrapper.getInstance().exec(nmsObject, i);
}
/**
* TODO Find correct name
* @see net.minecraft.server.v1_9_R1.EnchantmentDepthStrider#b(int)
*/
@ReflectiveMethod(name = "b", types = {int.class})
public int b(int i){
return (int) NMSWrapper.getInstance().exec(nmsObject, i);
}
/**
* @see net.minecraft.server.v1_9_R1.EnchantmentDepthStrider#getMaxLevel()
*/
@ReflectiveMethod(name = "getMaxLevel", types = {})
public int getMaxLevel(){
return (int) NMSWrapper.getInstance().exec(nmsObject);
}
} | [
"vilsol2000@gmail.com"
] | vilsol2000@gmail.com |
f44afc012e29540c2cb4e152b52d138b21c9201f | a84b237a64b15fcb3b9d7d26d698dc358f121d10 | /app/src/main/java/com/example/assignmenteight/ObstBomb.java | 571b4888fb0e78f032e625aeff47b3d84ab8410e | [] | no_license | andrei-msd/Yinjandrei | e8dcc01391a009919316369383e00251b4f30dd9 | 89b0417f84469c0fe6663b2d1db3c31247c1500a | refs/heads/master | 2022-12-08T19:42:09.674323 | 2020-09-01T17:34:19 | 2020-09-01T17:34:19 | 292,064,416 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,536 | java | package com.example.assignmenteight;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.DisplayMetrics;
import java.util.Random;
public class ObstBomb extends Sprite implements Obstacle {
float x;
float y;
public float xSpeed = 0;
public float ySpeed = 10;
int radius;
int maxTime = 1000;
boolean hittable;
final static int Y_OFFSET = 150;
// final static int X_OFFSET = 21;
Paint paint;
int width;
int height;
int startingX;
boolean hit;
// int bitX = 40;
// int bitY=100;
// int startingY;
static int SCREEN_OFFSET = 400;
int color;
//int targetxStart;
Target targetz;
Random rnd = new Random();
Bitmap dagger;
Bitmap resizedBitmap;
public ObstBomb(Target target, Context context) {
hit = false;
// color = Color.rgb(200, 0, 0);
DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
width = metrics.widthPixels;
height = metrics.heightPixels;
x = (target.getX() - Y_OFFSET);
xSpeed = ((-10 +rnd.nextInt(20)) );
hittable = false;
// y = (target.getY() + target.radius);
y =(target.getY());
radius = 150;
targetz =target;
paint = new Paint();
paint.setColor(color);
dagger = BitmapFactory.decodeResource(context.getResources(),R.drawable.enemystar);
resizedBitmap = Bitmap.createScaledBitmap(
dagger, radius, radius, false);
}
public void Move() {
// ySpeed = 10;
x += xSpeed;
y += ySpeed;
}
public void onDraw(Canvas canvas) {
if(drawable()){
// x = targetz.getX();
// canvas.drawCircle(x, y, radius, paint);
canvas.drawBitmap(resizedBitmap,x,y,null);
Move();
// targetz.refresh();
}
}
private boolean drawable(){
if(targetz.getX() <= targetz.getBombX() -Y_OFFSET ) {
return true;
}
else {
return false;
}
}
public boolean onScreen(Canvas canvas) {
width = canvas.getWidth();
height = canvas.getHeight();
if ((x - radius <= -SCREEN_OFFSET) || x + radius >= width + SCREEN_OFFSET || (y - radius <= -SCREEN_OFFSET) || y + radius >= height + SCREEN_OFFSET) {
return false;
} else {
return true;
}
}
@Override
public void ballCollision(Ball ball) {
ball.setYSpeed(30);
ball.setBombHit(true);
}
public void playerCollision(Player player) {
player.setBombHit(true);
}
public boolean offScreen(Canvas canvas){
height = canvas.getHeight();
if(y >= height+SCREEN_OFFSET)
return true;
else {
return false;
}
}
public void setX(float i) {
this.x = i;
}
public void setXSpeed(float i) {
this.xSpeed = i;
}
public void setYSpeed(float i) {
this.ySpeed = i;
}
public float getX() {
return this.x;
}
public float getY() {
return this.y;
}
public int getRadius() {
return this.radius;
}
public boolean isHit() {
return this.hit;
}
public void setHit(boolean i) {
this.hit = i;
}
}
| [
"andreidalusong@gmail.com"
] | andreidalusong@gmail.com |
21d76bfb0f09ef22ede9ca60f8b9209fe22108c7 | b153b7ba58d4804a3991a6d3e9583cbf663bd0a0 | /app/src/main/java/com/flocktamer/interfaces/TwitterItemClickListener.java | 4da357ddc311279ab1d6a8a8539577340562fa52 | [] | no_license | mohit3bisht/FlockTamer | 29d1ece2f634164b9fc034cefe137b8618159a7f | 750b60a9dc306250453d8d1cef00394ff77f220b | refs/heads/master | 2021-09-04T11:51:47.994376 | 2018-01-18T13:10:29 | 2018-01-18T13:10:29 | 109,817,339 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 368 | java | package com.flocktamer.interfaces;
import com.flocktamer.model.childmodel.Feed;
/**
* Created by amandeepsingh on 2/9/16.
*/
public interface TwitterItemClickListener {
void onFavoriteClick(Feed feed);
void onReplyClick(Feed feed);
void onRetweetClick(Feed feed);
void onProfileClick(String screenName);
void onEmailClick(Feed tweetid);
}
| [
"hooman.hamzeh@gmail.com"
] | hooman.hamzeh@gmail.com |
acba39c63fdca7b3348c24607b9dfdbab9665f46 | 0e87d775ce8674e11b48313448ca5a2bca9e7be3 | /Quickstep/src/main/java/com/nature/quickstep/pageobjects/PageObject.java | 4b318c377df9860ee5810c9a96cc2ba64d9e2055 | [] | no_license | ravinder1414/Quicksteps | 9f828b37e76af8714a5195c9e9f5c3518647c480 | f4143425d9df5f3548a51c550301e02652867ba8 | refs/heads/master | 2021-01-01T05:20:13.944907 | 2016-05-11T14:45:57 | 2016-05-11T14:45:57 | 58,553,459 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,418 | java | package com.nature.quickstep.pageobjects;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import com.nature.quickstep.util.QuickstepContext;
import com.nature.quickstep.util.SeleniumWaitBuilder.WaitBuilder;
import com.nature.quickstep.util.SeleniumWaitBuilder.WaitCondition;
import com.nature.quickstep.util.SeleniumWaitBuilder.WaitInit;
import com.nature.quickstep.util.WebDriverUtils;
/**
* This abstract class provides core functionality for all page objects and also
* specifies a number of methods which should be implemented by each page
* object. All page objects should be subclasses of this class.
*
* @author mark.micallef
*
*/
public abstract class PageObject {
/**
* Cached value violates lifacycle of WebDriver instance
* This value is going to be removed in Quickstep 1.2
*
* Use browser() instead of accessing this field directly
*
*/
@Deprecated
protected WebDriver browser;
/**
* Use context() instead of accessing this field directly
*/
@Deprecated
protected QuickstepContext context = QuickstepContext.getInstance();
/**
* Instantiates the page object given a reference to a WebDriver.
*
* @param browser
*/
public PageObject(WebDriver browser) {
if (browser == null) {
this.browser = WebDriverUtils.getBrowser();
} else {
this.browser = browser;
}
}
/**
* Instantiates the page object using a default web browser.
*/
public PageObject() {
this(null);
}
/**
* @return WebDriver instance
*/
protected WebDriver browser() {
return WebDriverUtils.getBrowser();
}
/**
* @return QuickstepContext instance
*/
protected QuickstepContext context() {
return QuickstepContext.getInstance();
}
/**
* Navigates to the page being represented, ideally using the same method
* that a user would. <BR>
* <BR>
* <b>Note:</b>Should be implemented by every page object.
*
*/
public abstract void navigateTo();
/**
* Checks whether the page or object represented by the page object is
* currently present in the browser.
*
* @return <code>true</code> if present, <code>false</code> if not
*/
public abstract boolean isPresent();
/**
* Conditional wait after click
*/
protected WaitInit click(By locator) {
WebElement element = browser().findElement(locator);
return click(element);
}
/**
* Conditional wait after click
*/
protected WaitInit click(WebElement element) {
element.click();
return ensure();
}
/**
* Conditional wait after navigation
* Depends on correct navigateTo() and isPresent() implementation
*/
public void navigateTo(int seconds) {
this.navigateTo();
ensure().page(this).seconds(seconds);
}
public WaitBuilder ensure() {
return new WaitBuilder(browser());
}
public WaitCondition refuse() {
return new WaitBuilder(browser()).refuse();
}
/**
* Navigate with optional waiting
*
* XXX Probably should not be here...
*/
public WaitInit goTo(String url) {
browser().navigate().to(url);
return ensure();
}
}
| [
"kumarravinder4141@gmail.com"
] | kumarravinder4141@gmail.com |
705b82eaaf5e3c23cb69e19af86988cbfbabfc7a | 20c6edfc6036280f4ea36f72174671e5864c6b48 | /Test01.java | 7b5c7a06f89bff44e147011987fb2ae95df5c505 | [] | no_license | BoQiao687/687 | a8a6ce8895f643ccae15727a016bac5c647a6666 | 48c69496df202fa1e0f0e1d20d149f3bc3580e4c | refs/heads/master | 2023-03-22T14:51:52.380207 | 2021-03-17T02:00:59 | 2021-03-17T02:00:59 | 347,322,468 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 463 | java | package day03;
import java.net.CacheRequest;
import java.util.Calendar;
import java.util.Date;
/**
*使用Date输出当前系统时间,以及3天后这一刻的时间
*
*/
public class Test01 {
public static void main(String[] args) {
Date date = new Date();
System.out.println(date);
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE,3);
date = cal.getTime();
System.out.println(date);
}
}
| [
"https://github.com/BoQiao687/687.git"
] | https://github.com/BoQiao687/687.git |
bf0f3d31d827d66cada52213229d0d3ad46a1e6c | 573b9c497f644aeefd5c05def17315f497bd9536 | /src/main/java/com/alipay/api/domain/ZhimaCreditEpSceneFulfillmentlistSyncModel.java | 3e6c135c050e029be9395e1790b55f2c826ebc84 | [
"Apache-2.0"
] | permissive | zzzyw-work/alipay-sdk-java-all | 44d72874f95cd70ca42083b927a31a277694b672 | 294cc314cd40f5446a0f7f10acbb5e9740c9cce4 | refs/heads/master | 2022-04-15T21:17:33.204840 | 2020-04-14T12:17:20 | 2020-04-14T12:17:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,238 | java | package com.alipay.api.domain;
import java.util.List;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.internal.mapping.ApiListField;
/**
* 信用服务履约同步(批量)
*
* @author auto create
* @since 1.0, 2019-05-22 14:42:21
*/
public class ZhimaCreditEpSceneFulfillmentlistSyncModel extends AlipayObject {
private static final long serialVersionUID = 6679695676367464265L;
/**
* 信用订单号,即调用zhima.credit.ep.scene.agreement.use返回的信用订单号。
*/
@ApiField("credit_order_no")
private String creditOrderNo;
/**
* 履约信息列表,最大不超过200项
*/
@ApiListField("fulfillment_info_list")
@ApiField("fulfillment_info")
private List<FulfillmentInfo> fulfillmentInfoList;
public String getCreditOrderNo() {
return this.creditOrderNo;
}
public void setCreditOrderNo(String creditOrderNo) {
this.creditOrderNo = creditOrderNo;
}
public List<FulfillmentInfo> getFulfillmentInfoList() {
return this.fulfillmentInfoList;
}
public void setFulfillmentInfoList(List<FulfillmentInfo> fulfillmentInfoList) {
this.fulfillmentInfoList = fulfillmentInfoList;
}
}
| [
"ben.zy@antfin.com"
] | ben.zy@antfin.com |
d5622fc5ca93d370302a4a8a55743ac12f916938 | ac7c0f451cd5b311c6e1211642e9da0960f3dcd7 | /1.SocketIO_01/src/main/java/com/liuxun/bio/Server.java | bc84f39ee618f9013bb3ff8551f9e5087051979a | [] | no_license | LX1993728/network-programming | 8c4532add55bb8d1e90dad7456489c7e1bc2e2da | 6d57c59b2044f39296be637672912778d5ac4233 | refs/heads/master | 2020-03-28T00:42:36.706038 | 2018-10-16T04:46:28 | 2018-10-16T04:46:28 | 147,442,738 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 952 | java | package com.liuxun.bio;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
/**
* @author liuxun
* bio 在这里表示是Blocking IO阻塞的IO
*/
public class Server {
final static int PORT = 8765;
public static void main(String[] args){
ServerSocket server = null;
try {
server = new ServerSocket(PORT);
System.out.println(" server start ...");
// 进行阻塞
Socket socket = server.accept();
// 新建一个线程执行客户端的任务
new Thread(new ServerHandler(socket)).start();
}catch (Exception e){
e.printStackTrace();
}finally {
if (server != null){
try {
server.close();
}catch (IOException e){
e.printStackTrace();
}
}
server = null;
}
}
}
| [
"2652790899@qq.com"
] | 2652790899@qq.com |
28c33d2301ef45a296493dc4227fdce1f092d851 | ae3ed2967f1c61d7cc6ffe4ebefe19092e97126b | /swc-engine/src/main/java/org/sweble/wikitext/engine/ExpansionFrame.java | b404644c6663f7dab3417b570cc10f70e43654ad | [
"Apache-2.0",
"CC-BY-SA-3.0"
] | permissive | h4ck3rm1k3/sweble-wikitext | 45d0f77e2637eb41ddeccce9295a6dc1c457e315 | 8ee1dc3d6c747f4d77ed7c3f07892ab9ea944b51 | refs/heads/master | 2023-04-27T16:54:18.226276 | 2011-05-18T04:31:31 | 2011-05-18T04:31:31 | 1,717,941 | 0 | 0 | Apache-2.0 | 2023-04-14T18:16:48 | 2011-05-08T06:59:55 | Java | UTF-8 | Java | false | false | 17,404 | java | /**
* Copyright 2011 The Open Source Research Group,
* University of Erlangen-Nürnberg
*
* 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.sweble.wikitext.engine;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.sweble.wikitext.engine.config.Namespace;
import org.sweble.wikitext.engine.config.WikiConfigurationInterface;
import org.sweble.wikitext.engine.log.IllegalNameException;
import org.sweble.wikitext.engine.log.ParseException;
import org.sweble.wikitext.engine.log.ResolveRedirectLog;
import org.sweble.wikitext.engine.log.ResolveTransclusionLog;
import org.sweble.wikitext.engine.log.UnhandledException;
import org.sweble.wikitext.lazy.AstNodeTypes;
import org.sweble.wikitext.lazy.LinkTargetException;
import org.sweble.wikitext.lazy.preprocessor.Redirect;
import org.sweble.wikitext.lazy.preprocessor.TagExtension;
import org.sweble.wikitext.lazy.preprocessor.Template;
import org.sweble.wikitext.lazy.preprocessor.TemplateArgument;
import org.sweble.wikitext.lazy.preprocessor.TemplateParameter;
import org.sweble.wikitext.lazy.utils.StringConversionException;
import org.sweble.wikitext.lazy.utils.StringConverter;
import org.sweble.wikitext.lazy.utils.XmlAttribute;
import de.fau.cs.osr.ptk.common.EntityMap;
import de.fau.cs.osr.ptk.common.Warning;
import de.fau.cs.osr.ptk.common.ast.AstNode;
import de.fau.cs.osr.ptk.common.ast.ContentNode;
import de.fau.cs.osr.ptk.common.ast.NodeList;
import de.fau.cs.osr.ptk.common.ast.Text;
import de.fau.cs.osr.utils.StopWatch;
public class ExpansionFrame
{
private final Compiler compiler;
private final ExpansionFrame rootFrame;
private final ExpansionFrame parentFrame;
private final PageTitle title;
private final Map<String, AstNode> arguments;
private final boolean forInclusion;
private final ContentNode frameLog;
private final ExpansionCallback callback;
private final List<Warning> warnings;
private final EntityMap entityMap;
// =========================================================================
public ExpansionFrame(
Compiler compiler,
ExpansionCallback callback,
PageTitle title,
EntityMap entityMap,
List<Warning> warnings,
ContentNode frameLog)
{
this.compiler = compiler;
this.callback = callback;
this.title = title;
this.entityMap = entityMap;
this.arguments = new HashMap<String, AstNode>();
this.forInclusion = false;
this.warnings = warnings;
this.frameLog = frameLog;
this.rootFrame = this;
this.parentFrame = null;
}
public ExpansionFrame(
Compiler compiler,
ExpansionCallback callback,
PageTitle title,
EntityMap entityMap,
Map<String, AstNode> arguments,
boolean forInclusion,
ExpansionFrame rootFrame,
ExpansionFrame parentFrame,
List<Warning> warnings,
ContentNode frameLog)
{
this.compiler = compiler;
this.callback = callback;
this.title = title;
this.entityMap = entityMap;
this.arguments = arguments;
this.forInclusion = forInclusion;
this.warnings = warnings;
this.frameLog = frameLog;
this.rootFrame = rootFrame;
this.parentFrame = parentFrame;
}
// =========================================================================
public Compiler getCompiler()
{
return compiler;
}
public ExpansionFrame getRootFrame()
{
return rootFrame;
}
public ExpansionFrame getParentFrame()
{
return parentFrame;
}
public PageTitle getTitle()
{
return title;
}
public Map<String, AstNode> getArguments()
{
return arguments;
}
public boolean isForInclusion()
{
return forInclusion;
}
public ContentNode getFrameLog()
{
return frameLog;
}
public WikiConfigurationInterface getWikiConfig()
{
return compiler.getWikiConfig();
}
public void fileWarning(Warning warning)
{
warnings.add(warning);
}
private void addAllWarnings(Collection<Warning> warnings)
{
this.warnings.addAll(warnings);
}
public List<Warning> getWarnings()
{
return warnings;
}
// =========================================================================
public AstNode expand(AstNode ppAst)
{
return (AstNode) new ExpansionVisitor(this).go(ppAst);
}
// =========================================================================
protected AstNode resolveRedirect(Redirect n, String target)
{
ResolveRedirectLog log = new ResolveRedirectLog(target, false);
frameLog.getContent().add(log);
StopWatch stopWatch = new StopWatch();
stopWatch.start();
try
{
// FIXME: What if we don't want to redirect, but view the redirect
// page itself? Then we probably don't want to return the
// contents...
return redirectTo(n, target, log);
}
catch (LinkTargetException e)
{
// FIXME: Should we rather file a warning? Or additionally file a warning?
log.getContent().add(new ParseException(e.getMessage()));
return n;
}
catch (Throwable e)
{
StringWriter w = new StringWriter();
e.printStackTrace(new PrintWriter(w));
log.getContent().add(new UnhandledException(e, w.toString()));
return n;
}
finally
{
stopWatch.stop();
log.setTimeNeeded(stopWatch.getElapsedTime());
}
}
protected AstNode resolveParserFunction(
Template n,
String target,
List<TemplateArgument> arguments)
{
ResolveTransclusionLog log = new ResolveTransclusionLog(target, false);
frameLog.getContent().add(log);
StopWatch stopWatch = new StopWatch();
stopWatch.start();
try
{
ParserFunctionBase pfn = getWikiConfig().getParserFunction(target);
if (pfn == null)
{
// FIXME: File warning that we couldn't find the parser function?
return null;
}
return invokeParserFunction(n, pfn, arguments, log);
}
catch (Throwable e)
{
StringWriter w = new StringWriter();
e.printStackTrace(new PrintWriter(w));
log.getContent().add(new UnhandledException(e, w.toString()));
return n;
}
finally
{
stopWatch.stop();
log.setTimeNeeded(stopWatch.getElapsedTime());
}
}
protected AstNode resolveTransclusionOrMagicWord(
Template n,
String target,
List<TemplateArgument> arguments)
{
ResolveTransclusionLog log = new ResolveTransclusionLog(target, false);
frameLog.getContent().add(log);
StopWatch stopWatch = new StopWatch();
stopWatch.start();
try
{
if (arguments.isEmpty())
{
ParserFunctionBase pfn = getWikiConfig().getParserFunction(target);
if (pfn != null)
return invokeParserFunction(n, pfn, arguments, log);
}
return transcludePage(n, target, arguments, log);
}
catch (LinkTargetException e)
{
// FIXME: Should we rather file a warning? Or additionally file a warning?
log.getContent().add(new ParseException(e.getMessage()));
return n;
}
catch (Throwable e)
{
StringWriter w = new StringWriter();
e.printStackTrace(new PrintWriter(w));
log.getContent().add(new UnhandledException(e, w.toString()));
return n;
}
finally
{
stopWatch.stop();
log.setTimeNeeded(stopWatch.getElapsedTime());
}
}
protected AstNode resolveParameter(TemplateParameter n, String name)
{
return arguments.get(name);
}
protected AstNode resolveTagExtension(
TagExtension n,
String name,
NodeList attributes,
String body)
{
ResolveTransclusionLog log = new ResolveTransclusionLog(name, false);
frameLog.getContent().add(log);
StopWatch stopWatch = new StopWatch();
stopWatch.start();
try
{
TagExtensionBase te = getWikiConfig().getTagExtension(name);
if (te == null)
{
// FIXME: File warning that we couldn't find the tag extension?
return n;
}
return invokeTagExtension(n, attributes, body, te);
}
catch (Throwable e)
{
StringWriter w = new StringWriter();
e.printStackTrace(new PrintWriter(w));
log.getContent().add(new UnhandledException(e, w.toString()));
return n;
}
finally
{
stopWatch.stop();
log.setTimeNeeded(stopWatch.getElapsedTime());
}
}
private AstNode invokeTagExtension(
TagExtension tagExtension,
NodeList attributes,
String body,
TagExtensionBase te)
{
HashMap<String, NodeList> attrs = new HashMap<String, NodeList>();
for (AstNode attr : attributes)
{
if (attr.isNodeType(AstNodeTypes.NT_XML_ATTRIBUTE))
{
XmlAttribute a = (XmlAttribute) attr;
attrs.put(a.getName(), a.getValue());
}
}
return te.invoke(this, tagExtension, attrs, body);
}
protected void illegalTemplateName(StringConversionException e, NodeList name)
{
frameLog.getContent().add(new IllegalNameException(
name,
"Cannot resolve target of transclusion to a simple name."));
}
protected void illegalParameterName(StringConversionException e, NodeList name)
{
frameLog.getContent().add(new IllegalNameException(
name,
"Cannot resolve name of parameter to a simple name."));
}
// =========================================================================
/* FIXME: These don't work! You would have to clone a cached page first,
* before you can perform any kind of template expansion!
*
private AstNode redirectTo(
Redirect n,
String target,
ResolveRedirectLog log)
throws ArticleTitleException, CompilerException, UnsupportedEncodingException
{
PageTitle title = new PageTitle(getWikiConfig(), target);
log.setCanonical(title.getFullTitle());
FullPreprocessedPage fpPage =
callback.retrievePreprocessedPage(this, title, forInclusion);
if (fpPage == null)
{
FullPage page = getWikitext(title, log);
if (page == null)
{
return n;
}
else
{
CompiledPage ppPage = this.compiler.preprocess(
page.getId(),
page.getText(),
forInclusion,
null);
fpPage = new FullPreprocessedPage(
page.getId(),
forInclusion,
ppPage);
callback.cachePreprocessedPage(this, fpPage);
LazyPreprocessedPage lppPage =
(LazyPreprocessedPage) ppPage.getPage();
CompiledPage compiledPage = this.compiler.expand(
callback,
page.getId(),
lppPage,
forInclusion,
arguments,
rootFrame,
this);
log.setSuccess(true);
log.getContent().append(compiledPage.getLog());
return ((LazyPreprocessedPage) compiledPage.getPage()).getContent();
}
}
else
{
LazyPreprocessedPage lppPage =
(LazyPreprocessedPage) fpPage.getPage().getPage();
CompiledPage compiledPage = this.compiler.expand(
callback,
fpPage.getId(),
lppPage,
forInclusion,
arguments,
rootFrame,
this);
log.setSuccess(true);
log.getContent().append(compiledPage.getLog());
return ((LazyPreprocessedPage) compiledPage.getPage()).getContent();
}
}
private AstNode transcludePage(
Template n,
String target,
List<TemplateArgument> arguments,
ResolveTransclusionLog log)
throws ArticleTitleException, CompilerException, UnsupportedEncodingException
{
Namespace tmplNs = getWikiConfig().getTemplateNamespace();
PageTitle title = new PageTitle(getWikiConfig(), target, tmplNs);
log.setCanonical(title.getFullTitle());
FullPreprocessedPage fpPage =
callback.retrievePreprocessedPage(this, title, true);
if (fpPage == null)
{
FullPage page = getWikitext(title, log);
if (page == null)
{
return null;
}
else
{
Map<String, AstNode> args =
prepareTransclusionArguments(arguments);
CompiledPage ppPage = this.compiler.preprocess(
page.getId(),
page.getText(),
true,
null);
fpPage = new FullPreprocessedPage(
page.getId(),
true,
ppPage);
callback.cachePreprocessedPage(this, fpPage);
LazyPreprocessedPage lppPage =
(LazyPreprocessedPage) ppPage.getPage();
CompiledPage compiledPage = this.compiler.expand(
callback,
page.getId(),
lppPage,
true,
args,
rootFrame,
this);
log.setSuccess(true);
log.getContent().append(compiledPage.getLog());
return ((LazyPreprocessedPage) compiledPage.getPage()).getContent();
}
}
else
{
Map<String, AstNode> args =
prepareTransclusionArguments(arguments);
LazyPreprocessedPage lppPage =
(LazyPreprocessedPage) fpPage.getPage().getPage();
CompiledPage compiledPage = this.compiler.expand(
callback,
fpPage.getId(),
lppPage,
true,
args,
rootFrame,
this);
log.setSuccess(true);
log.getContent().append(compiledPage.getLog());
return ((LazyPreprocessedPage) compiledPage.getPage()).getContent();
}
}
*/
// =====================================================================
private AstNode redirectTo(
Redirect n,
String target,
ResolveRedirectLog log) throws LinkTargetException, CompilerException
{
PageTitle title = PageTitle.make(getWikiConfig(), target);
log.setCanonical(title.getFullTitle());
FullPage page = getWikitext(title, log);
if (page == null)
{
// FIXME: File warning that we couldn't find the page?
return n;
}
else
{
CompiledPage compiledPage = this.compiler.preprocessAndExpand(
callback,
page.getId(),
page.getText(),
forInclusion,
entityMap,
arguments,
rootFrame,
this);
log.setSuccess(true);
log.getContent().add(compiledPage.getLog());
addAllWarnings(compiledPage.getWarnings());
return compiledPage.getPage().getContent();
}
}
private AstNode transcludePage(
Template n,
String target,
List<TemplateArgument> arguments,
ResolveTransclusionLog log) throws LinkTargetException, CompilerException
{
Namespace tmplNs = getWikiConfig().getTemplateNamespace();
PageTitle title = PageTitle.make(getWikiConfig(), target, tmplNs);
log.setCanonical(title.getFullTitle());
FullPage page = getWikitext(title, log);
if (page == null)
{
// FIXME: File warning that we couldn't find the page?
return null;
}
else
{
Map<String, AstNode> args =
prepareTransclusionArguments(arguments);
CompiledPage compiledPage = this.compiler.preprocessAndExpand(
callback,
page.getId(),
page.getText(),
true,
entityMap,
args,
rootFrame,
this);
log.setSuccess(true);
log.getContent().add(compiledPage.getLog());
addAllWarnings(compiledPage.getWarnings());
return compiledPage.getPage().getContent();
}
}
private Map<String, AstNode> prepareTransclusionArguments(List<TemplateArgument> arguments)
{
HashMap<String, AstNode> args = new HashMap<String, AstNode>();
for (TemplateArgument arg : arguments)
{
String id = String.valueOf(args.size());
args.put(id, arg.getValue());
if (arg.getHasName())
{
try
{
String name = StringConverter.convert(arg.getName());
name = name.trim();
if (!name.isEmpty() && !name.equals(id))
args.put(name, arg.getValue());
}
catch (StringConversionException e)
{
illegalParameterName(e, arg.getName());
}
}
}
return args;
}
private AstNode invokeParserFunction(Template template, ParserFunctionBase pfn, List<TemplateArgument> arguments, ResolveTransclusionLog log)
{
LinkedList<AstNode> args = new LinkedList<AstNode>();
for (TemplateArgument arg : arguments)
{
if (arg.getHasName())
{
args.add(new NodeList(
arg.getName(),
new Text("="),
arg.getValue()));
}
else
{
args.add(arg.getValue());
}
}
AstNode result = pfn.invoke(template, this, args);
log.setSuccess(true);
return result;
}
private FullPage getWikitext(PageTitle title, ContentNode log)
{
try
{
return callback.retrieveWikitext(this, title);
}
catch (Exception e)
{
StringWriter w = new StringWriter();
e.printStackTrace(new PrintWriter(w));
log.getContent().add(new UnhandledException(e, w.toString()));
return null;
}
}
}
| [
"hannes@tigerclaw.de"
] | hannes@tigerclaw.de |
9f5fa8a5f4771fed6323b3e382ab341fb95f315e | ccdbc8345410ff4082139869ca1cd17f923baaae | /common/trmk/src/test/java/org/jclouds/trmk/vcloud_0_8/compute/strategy/CleanupOrphanKeysTest.java | 01d2e9d3fc6e98f26beaa50acd6d0a1b9bc1bd2f | [
"Apache-2.0"
] | permissive | novel/jclouds | 678ff8e92a09a6c78da9ee2c9854eeb1474659a5 | ff2982c747b47e067f06badc73587bfe103ca37d | refs/heads/master | 2021-01-20T22:58:44.675667 | 2012-03-25T17:04:05 | 2012-03-25T17:04:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,316 | java | /**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.trmk.vcloud_0_8.compute.strategy;
import static org.easymock.EasyMock.expect;
import static org.easymock.classextension.EasyMock.createMock;
import static org.easymock.classextension.EasyMock.replay;
import static org.easymock.classextension.EasyMock.verify;
import static org.jclouds.compute.predicates.NodePredicates.parentLocationId;
import java.net.URI;
import java.util.Map;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.NodeState;
import org.jclouds.compute.strategy.ListNodesStrategy;
import org.jclouds.domain.Credentials;
import org.jclouds.trmk.vcloud_0_8.compute.domain.OrgAndName;
import org.jclouds.trmk.vcloud_0_8.compute.functions.NodeMetadataToOrgAndName;
import org.jclouds.trmk.vcloud_0_8.compute.strategy.CleanupOrphanKeys;
import org.jclouds.trmk.vcloud_0_8.compute.strategy.DeleteKeyPair;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
/**
* @author Adrian Cole
*/
@Test(groups = "unit")
public class CleanupOrphanKeysTest {
public void testWhenNoDeletedNodes() {
Iterable<? extends NodeMetadata> deadOnes = ImmutableSet.<NodeMetadata> of();
// create mocks
CleanupOrphanKeys strategy = setupStrategy();
// setup expectations
// replay mocks
replayStrategy(strategy);
// run
strategy.execute(deadOnes);
// verify mocks
verifyStrategy(strategy);
}
public void testWhenDeletedNodesHaveNoTag() {
// create mocks
CleanupOrphanKeys strategy = setupStrategy();
NodeMetadata nodeMetadata = createMock(NodeMetadata.class);
Iterable<? extends NodeMetadata> deadOnes = ImmutableSet.<NodeMetadata> of(nodeMetadata);
// setup expectations
expect(strategy.nodeToOrgAndName.apply(nodeMetadata)).andReturn(null).atLeastOnce();
expectCleanupCredentialStore(strategy, nodeMetadata);
// replay mocks
replay(nodeMetadata);
replayStrategy(strategy);
// run
strategy.execute(deadOnes);
// verify mocks
verify(nodeMetadata);
verifyStrategy(strategy);
}
public void testWhenStillRunningWithTag() {
// create mocks
CleanupOrphanKeys strategy = setupStrategy();
NodeMetadata nodeMetadata = createMock(NodeMetadata.class);
Iterable<? extends NodeMetadata> deadOnes = ImmutableSet.<NodeMetadata> of(nodeMetadata);
OrgAndName orgTag = new OrgAndName(URI.create("location"), "group");
// setup expectations
expect(strategy.nodeToOrgAndName.apply(nodeMetadata)).andReturn(orgTag).atLeastOnce();
expect((Object) strategy.listNodes.listDetailsOnNodesMatching(parentLocationId(orgTag.getOrg().toASCIIString())))
.andReturn(ImmutableSet.of(nodeMetadata));
expect(nodeMetadata.getGroup()).andReturn(orgTag.getName()).atLeastOnce();
expect(nodeMetadata.getState()).andReturn(NodeState.RUNNING).atLeastOnce();
expectCleanupCredentialStore(strategy, nodeMetadata);
// replay mocks
replay(nodeMetadata);
replayStrategy(strategy);
// run
strategy.execute(deadOnes);
// verify mocks
verify(nodeMetadata);
verifyStrategy(strategy);
}
public void testWhenTerminatedWithTag() {
// create mocks
CleanupOrphanKeys strategy = setupStrategy();
NodeMetadata nodeMetadata = createMock(NodeMetadata.class);
Iterable<? extends NodeMetadata> deadOnes = ImmutableSet.<NodeMetadata> of(nodeMetadata);
OrgAndName orgTag = new OrgAndName(URI.create("location"), "group");
// setup expectations
expect(strategy.nodeToOrgAndName.apply(nodeMetadata)).andReturn(orgTag).atLeastOnce();
expect((Object) strategy.listNodes.listDetailsOnNodesMatching(parentLocationId(orgTag.getOrg().toASCIIString())))
.andReturn(ImmutableSet.of(nodeMetadata));
expect(nodeMetadata.getGroup()).andReturn(orgTag.getName()).atLeastOnce();
expect(nodeMetadata.getState()).andReturn(NodeState.TERMINATED).atLeastOnce();
strategy.deleteKeyPair.execute(orgTag);
expectCleanupCredentialStore(strategy, nodeMetadata);
// replay mocks
replay(nodeMetadata);
replayStrategy(strategy);
// run
strategy.execute(deadOnes);
// verify mocks
verify(nodeMetadata);
verifyStrategy(strategy);
}
private void expectCleanupCredentialStore(CleanupOrphanKeys strategy, NodeMetadata nodeMetadata) {
expect("node#" + nodeMetadata.getId()).andReturn("1");
expect(strategy.credentialStore.remove("node#1")).andReturn(null);
}
public void testWhenNoneLeftWithTag() {
// create mocks
CleanupOrphanKeys strategy = setupStrategy();
NodeMetadata nodeMetadata = createMock(NodeMetadata.class);
Iterable<? extends NodeMetadata> deadOnes = ImmutableSet.<NodeMetadata> of(nodeMetadata);
OrgAndName orgTag = new OrgAndName(URI.create("location"), "group");
// setup expectations
expect(strategy.nodeToOrgAndName.apply(nodeMetadata)).andReturn(orgTag).atLeastOnce();
expect((Object) strategy.listNodes.listDetailsOnNodesMatching(parentLocationId(orgTag.getOrg().toASCIIString())))
.andReturn(ImmutableSet.of());
strategy.deleteKeyPair.execute(orgTag);
expectCleanupCredentialStore(strategy, nodeMetadata);
// replay mocks
replay(nodeMetadata);
replayStrategy(strategy);
// run
strategy.execute(deadOnes);
// verify mocks
verify(nodeMetadata);
verifyStrategy(strategy);
}
private void verifyStrategy(CleanupOrphanKeys strategy) {
verify(strategy.nodeToOrgAndName);
verify(strategy.deleteKeyPair);
verify(strategy.listNodes);
verify(strategy.credentialStore);
}
private CleanupOrphanKeys setupStrategy() {
NodeMetadataToOrgAndName nodeToOrgAndName = createMock(NodeMetadataToOrgAndName.class);
DeleteKeyPair deleteKeyPair = createMock(DeleteKeyPair.class);
ListNodesStrategy listNodes = createMock(ListNodesStrategy.class);
@SuppressWarnings("unchecked")
Map<String, Credentials> credentialStore = createMock(Map.class);
return new CleanupOrphanKeys(nodeToOrgAndName, deleteKeyPair, credentialStore, listNodes);
}
private void replayStrategy(CleanupOrphanKeys strategy) {
replay(strategy.nodeToOrgAndName);
replay(strategy.deleteKeyPair);
replay(strategy.listNodes);
replay(strategy.credentialStore);
}
}
| [
"adrian@jclouds.org"
] | adrian@jclouds.org |
dd846b7aeb1f959f584cd2a756ac136ab7634f27 | edd48b650e95b79f3023e8941e8a8d9808280bc9 | /modules/jooby-spymemcached/src/main/java/org/jooby/memcached/SpySessionStore.java | ffebd5364cab4afdb5e796cf21b984cf48f9221a | [
"Apache-2.0"
] | permissive | auxiliaire/jooby | 579f59153baebbf460c221072c24777dd97a1667 | 49c0a1dbd30b2b17717192a5e3410486f33e67de | refs/heads/master | 2021-04-27T10:39:38.210065 | 2018-02-22T14:50:46 | 2018-02-22T14:50:46 | 122,543,603 | 0 | 0 | Apache-2.0 | 2018-02-22T22:35:47 | 2018-02-22T22:35:46 | null | UTF-8 | Java | false | false | 15,900 | java | /**
* Apache License
* Version 2.0, January 2004
* http://www.apache.org/licenses/
*
* TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
*
* 1. Definitions.
*
* "License" shall mean the terms and conditions for use, reproduction,
* and distribution as defined by Sections 1 through 9 of this document.
*
* "Licensor" shall mean the copyright owner or entity authorized by
* the copyright owner that is granting the License.
*
* "Legal Entity" shall mean the union of the acting entity and all
* other entities that control, are controlled by, or are under common
* control with that entity. For the purposes of this definition,
* "control" means (i) the power, direct or indirect, to cause the
* direction or management of such entity, whether by contract or
* otherwise, or (ii) ownership of fifty percent (50%) or more of the
* outstanding shares, or (iii) beneficial ownership of such entity.
*
* "You" (or "Your") shall mean an individual or Legal Entity
* exercising permissions granted by this License.
*
* "Source" form shall mean the preferred form for making modifications,
* including but not limited to software source code, documentation
* source, and configuration files.
*
* "Object" form shall mean any form resulting from mechanical
* transformation or translation of a Source form, including but
* not limited to compiled object code, generated documentation,
* and conversions to other media types.
*
* "Work" shall mean the work of authorship, whether in Source or
* Object form, made available under the License, as indicated by a
* copyright notice that is included in or attached to the work
* (an example is provided in the Appendix below).
*
* "Derivative Works" shall mean any work, whether in Source or Object
* form, that is based on (or derived from) the Work and for which the
* editorial revisions, annotations, elaborations, or other modifications
* represent, as a whole, an original work of authorship. For the purposes
* of this License, Derivative Works shall not include works that remain
* separable from, or merely link (or bind by name) to the interfaces of,
* the Work and Derivative Works thereof.
*
* "Contribution" shall mean any work of authorship, including
* the original version of the Work and any modifications or additions
* to that Work or Derivative Works thereof, that is intentionally
* submitted to Licensor for inclusion in the Work by the copyright owner
* or by an individual or Legal Entity authorized to submit on behalf of
* the copyright owner. For the purposes of this definition, "submitted"
* means any form of electronic, verbal, or written communication sent
* to the Licensor or its representatives, including but not limited to
* communication on electronic mailing lists, source code control systems,
* and issue tracking systems that are managed by, or on behalf of, the
* Licensor for the purpose of discussing and improving the Work, but
* excluding communication that is conspicuously marked or otherwise
* designated in writing by the copyright owner as "Not a Contribution."
*
* "Contributor" shall mean Licensor and any individual or Legal Entity
* on behalf of whom a Contribution has been received by Licensor and
* subsequently incorporated within the Work.
*
* 2. Grant of Copyright License. Subject to the terms and conditions of
* this License, each Contributor hereby grants to You a perpetual,
* worldwide, non-exclusive, no-charge, royalty-free, irrevocable
* copyright license to reproduce, prepare Derivative Works of,
* publicly display, publicly perform, sublicense, and distribute the
* Work and such Derivative Works in Source or Object form.
*
* 3. Grant of Patent License. Subject to the terms and conditions of
* this License, each Contributor hereby grants to You a perpetual,
* worldwide, non-exclusive, no-charge, royalty-free, irrevocable
* (except as stated in this section) patent license to make, have made,
* use, offer to sell, sell, import, and otherwise transfer the Work,
* where such license applies only to those patent claims licensable
* by such Contributor that are necessarily infringed by their
* Contribution(s) alone or by combination of their Contribution(s)
* with the Work to which such Contribution(s) was submitted. If You
* institute patent litigation against any entity (including a
* cross-claim or counterclaim in a lawsuit) alleging that the Work
* or a Contribution incorporated within the Work constitutes direct
* or contributory patent infringement, then any patent licenses
* granted to You under this License for that Work shall terminate
* as of the date such litigation is filed.
*
* 4. Redistribution. You may reproduce and distribute copies of the
* Work or Derivative Works thereof in any medium, with or without
* modifications, and in Source or Object form, provided that You
* meet the following conditions:
*
* (a) You must give any other recipients of the Work or
* Derivative Works a copy of this License; and
*
* (b) You must cause any modified files to carry prominent notices
* stating that You changed the files; and
*
* (c) You must retain, in the Source form of any Derivative Works
* that You distribute, all copyright, patent, trademark, and
* attribution notices from the Source form of the Work,
* excluding those notices that do not pertain to any part of
* the Derivative Works; and
*
* (d) If the Work includes a "NOTICE" text file as part of its
* distribution, then any Derivative Works that You distribute must
* include a readable copy of the attribution notices contained
* within such NOTICE file, excluding those notices that do not
* pertain to any part of the Derivative Works, in at least one
* of the following places: within a NOTICE text file distributed
* as part of the Derivative Works; within the Source form or
* documentation, if provided along with the Derivative Works; or,
* within a display generated by the Derivative Works, if and
* wherever such third-party notices normally appear. The contents
* of the NOTICE file are for informational purposes only and
* do not modify the License. You may add Your own attribution
* notices within Derivative Works that You distribute, alongside
* or as an addendum to the NOTICE text from the Work, provided
* that such additional attribution notices cannot be construed
* as modifying the License.
*
* You may add Your own copyright statement to Your modifications and
* may provide additional or different license terms and conditions
* for use, reproduction, or distribution of Your modifications, or
* for any such Derivative Works as a whole, provided Your use,
* reproduction, and distribution of the Work otherwise complies with
* the conditions stated in this License.
*
* 5. Submission of Contributions. Unless You explicitly state otherwise,
* any Contribution intentionally submitted for inclusion in the Work
* by You to the Licensor shall be under the terms and conditions of
* this License, without any additional terms or conditions.
* Notwithstanding the above, nothing herein shall supersede or modify
* the terms of any separate license agreement you may have executed
* with Licensor regarding such Contributions.
*
* 6. Trademarks. This License does not grant permission to use the trade
* names, trademarks, service marks, or product names of the Licensor,
* except as required for reasonable and customary use in describing the
* origin of the Work and reproducing the content of the NOTICE file.
*
* 7. Disclaimer of Warranty. Unless required by applicable law or
* agreed to in writing, Licensor provides the Work (and each
* Contributor provides its Contributions) on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied, including, without limitation, any warranties or conditions
* of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
* PARTICULAR PURPOSE. You are solely responsible for determining the
* appropriateness of using or redistributing the Work and assume any
* risks associated with Your exercise of permissions under this License.
*
* 8. Limitation of Liability. In no event and under no legal theory,
* whether in tort (including negligence), contract, or otherwise,
* unless required by applicable law (such as deliberate and grossly
* negligent acts) or agreed to in writing, shall any Contributor be
* liable to You for damages, including any direct, indirect, special,
* incidental, or consequential damages of any character arising as a
* result of this License or out of the use or inability to use the
* Work (including but not limited to damages for loss of goodwill,
* work stoppage, computer failure or malfunction, or any and all
* other commercial damages or losses), even if such Contributor
* has been advised of the possibility of such damages.
*
* 9. Accepting Warranty or Additional Liability. While redistributing
* the Work or Derivative Works thereof, You may choose to offer,
* and charge a fee for, acceptance of support, warranty, indemnity,
* or other liability obligations and/or rights consistent with this
* License. However, in accepting such obligations, You may act only
* on Your own behalf and on Your sole responsibility, not on behalf
* of any other Contributor, and only if You agree to indemnify,
* defend, and hold each Contributor harmless for any liability
* incurred by, or claims asserted against, such Contributor by reason
* of your accepting any such warranty or additional liability.
*
* END OF TERMS AND CONDITIONS
*
* APPENDIX: How to apply the Apache License to your work.
*
* To apply the Apache License to your work, attach the following
* boilerplate notice, with the fields enclosed by brackets "{}"
* replaced with your own identifying information. (Don't include
* the brackets!) The text should be enclosed in the appropriate
* comment syntax for the file format. We also recommend that a
* file or class name and description of purpose be included on the
* same "printed page" as the copyright notice for easier
* identification within third-party archives.
*
* Copyright 2014 Edgar Espina
*
* 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.jooby.memcached;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
import javax.inject.Named;
import net.spy.memcached.MemcachedClient;
import net.spy.memcached.transcoders.Transcoder;
import org.jooby.Session;
import org.jooby.Session.Builder;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import com.typesafe.config.ConfigValueFactory;
/**
* A {@link Session.Store} powered by <a
* href="https://github.com/dustin/java-memcached-client">SpyMemcached</a>
*
* <h2>usage</h2>
*
* <pre>
* {
* use(new SpyMemcached());
*
* session(SpySessionStore.class);
*
* get("/", req {@literal ->} {
* req.session().set("name", "jooby");
* });
* }
* </pre>
*
* The <code>name</code> attribute and value will be stored in a
* <a href="http://memcached.org//">Memcached</a> db.
*
* Session are persisted using the default {@link Transcoder}.
*
* <h2>options</h2>
*
* <h3>timeout</h3>
* <p>
* By default, a memcache session will expire after <code>30 minutes</code>. Changing the default
* timeout is as simple as:
* </p>
*
* <pre>
* # 8 hours
* session.timeout = 8h
*
* # 15 seconds
* session.timeout = 15
*
* # 120 minutes
* session.timeout = 120m
*
* # no timeout
* session.timeout = -1
* </pre>
*
* <h3>key prefix</h3>
* <p>
* Default memcached key prefix is <code>sessions:</code>. Sessions in memcached will look like:
* <code>sessions:ID</code>
*
* <p>
* It's possible to change the default key setting the <code>memcached.sesssion.prefix</code>
* property.
* </p>
*
* @author edgar
* @since 0.7.0
*/
public class SpySessionStore implements Session.Store {
private MemcachedClient memcached;
private String prefix;
private int timeout;
public SpySessionStore(final MemcachedClient memcached,
final String prefix, final int timeoutInSeconds) {
this.memcached = memcached;
this.prefix = prefix;
this.timeout = timeoutInSeconds;
}
@Inject
public SpySessionStore(final MemcachedClient memcached,
final @Named("memcached.session.prefix") String prefix,
@Named("memcached.session.timeout") final String timeout) {
this(memcached, prefix, seconds(timeout));
}
@SuppressWarnings("unchecked")
@Override
public Session get(final Builder builder) {
String key = key(builder.sessionId());
Map<String, String> attrs = (Map<String, String>) memcached.get(key);
if (attrs == null || attrs.size() == 0) {
// expired
return null;
}
// touch session
memcached.touch(key, timeout);
return builder
.accessedAt(Long.parseLong(attrs.remove("_accessedAt")))
.createdAt(Long.parseLong(attrs.remove("_createdAt")))
.savedAt(Long.parseLong(attrs.remove("_savedAt")))
.set(attrs)
.build();
}
@Override
public void save(final Session session) {
String key = key(session);
Map<String, String> attrs = new HashMap<>(session.attributes());
attrs.put("_createdAt", Long.toString(session.createdAt()));
attrs.put("_accessedAt", Long.toString(session.accessedAt()));
attrs.put("_savedAt", Long.toString(session.savedAt()));
memcached.set(key, timeout, attrs);
}
@Override
public void create(final Session session) {
save(session);
}
@Override
public void delete(final String id) {
String key = key(id);
memcached.replace(key, 1, new HashMap<>());
}
private String key(final String id) {
return prefix + id;
}
private String key(final Session session) {
return key(session.id());
}
private static int seconds(final String value) {
try {
return Integer.parseInt(value);
} catch (NumberFormatException ex) {
Config config = ConfigFactory.empty()
.withValue("timeout", ConfigValueFactory.fromAnyRef(value));
return (int) config.getDuration("timeout", TimeUnit.SECONDS);
}
}
}
| [
"espina.edgar@gmail.com"
] | espina.edgar@gmail.com |
d8d4a89bab5e931cbc627ef0b1c0eef33bee720f | 8d18055a2a0c7cb19dbaf4b26d288f275aba013a | /src/_03_array_method/thuc_hanh/Max.java | 106fbffc951b4ace99615b380225a3276f32e1c8 | [] | no_license | huyvmdn/C1220G2_NguyenHuy_Module2 | 4bbc5cb987d56cd3d65bd57bde1d8d3a04b6bc17 | 5d83e70eb111630e9cb1ef48990eba61e15fae9b | refs/heads/master | 2023-04-11T05:50:43.364489 | 2021-04-29T03:40:27 | 2021-04-29T03:40:27 | 334,825,994 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,174 | java | package _03_array_method.thuc_hanh;
import java.util.Scanner;
public class Max {
public static void main(String[] args) {
int size;
int[] array;
Scanner scanner = new Scanner(System.in);
do {
System.out.print("Enter a size:");
size = scanner.nextInt();
if (size > 20)
System.out.println("Size should not exceed 20");
} while (size > 20);
array = new int[size];
int i = 0;
while (i < array.length) {
System.out.print("Enter element" + (i + 1) + " : ");
array[i] = scanner.nextInt();
i++;
}
System.out.print("Property list: ");
for (int j = 0; j < array.length; j++) {
System.out.print(array[j] + "\t");
}
int max = array[0];
int index = 1;
for (int j = 0; j < array.length; j++) {
if (array[j] > max) {
max = array[j];
index = j + 1;
}
}
System.out.println("");
System.out.println("The largest property value in the list is " + max + " ,at position " + index);
}
}
| [
"huyvm.dn@gmail.com"
] | huyvm.dn@gmail.com |
b340c50c00cc23aee889f863b6c567d997a39f88 | 2cd44309ae3d46f4890b810200fbe184a406d533 | /sslr/oracle-jdk-1.7.0.3/com/sun/corba/se/spi/activation/ORBPortInfo.java | b66e6e3d3d61dd646ec806938107080f7dff5eb4 | [] | no_license | wtweeker/ruling_java | b47ddfb082d45e52af967353ceb406a18a6e00a8 | 1d67d1557d98c88a7f92e6c25cdc3cf3f8fd9ef7 | refs/heads/master | 2020-03-31T15:39:07.416440 | 2015-07-09T12:13:24 | 2015-07-09T12:26:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 606 | java | package com.sun.corba.se.spi.activation;
/**
* com/sun/corba/se/spi/activation/ORBPortInfo.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from ../../../../src/share/classes/com/sun/corba/se/spi/activation/activation.idl
* Friday, January 20, 2012 10:02:29 AM GMT-08:00
*/
public final class ORBPortInfo implements org.omg.CORBA.portable.IDLEntity
{
public String orbId = null;
public int port = (int)0;
public ORBPortInfo ()
{
} // ctor
public ORBPortInfo (String _orbId, int _port)
{
orbId = _orbId;
port = _port;
} // ctor
} // class ORBPortInfo
| [
"nicolas.peru@sonarsource.com"
] | nicolas.peru@sonarsource.com |
7cda2908ebcdd20f5bc4dd7a20680f769121b4da | c1234f3fa33d15c6cff5a39f64298e7920da6634 | /src/util/Modulo.java | 98ffa927872e902a52dfa1ab49e9b47f75c12459 | [] | no_license | darkreaperto/RP_SAIAES | f0d8641b7f43b9d94502fe7bca81c7e8c3d93939 | 967bd7280f69eaa4d29dad630b154a896642c792 | refs/heads/master | 2020-03-25T21:56:56.184335 | 2019-10-30T22:47:12 | 2019-10-30T22:47:12 | 144,196,748 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 434 | 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 util;
/**
*
* @author dark-reaper
*/
public enum Modulo {
MODULO_ACCESO,
MODULO_CLIENTES,
MODULO_CONSULTAS,
MODULO_FACTURACION,
MODULO_INVENTARIO,
MODULO_MAQUINARIA,
MODULO_PROVEEDORES,
MODULO_USUARIOS,
}
| [
"rodrigocedenocedeno@gmail.com"
] | rodrigocedenocedeno@gmail.com |
ad645e6bf5832d21c4786f78926666e1fc87847e | a80e2454b28592e12b2c68cc66047fd267b4ed50 | /UserCenter/src/com/usercenter/handler/StopHandler.java | 7b61989181566ca4fac8f2ad6707e5df90415ae7 | [] | no_license | xsharh/GameServer_Java | e649e3eeab3d3d1fa24f0d4b63995e9135b5c5f6 | d4ac655ec72129cb7ce5d7b174afa8f81a96ba5e | refs/heads/master | 2023-05-10T06:55:42.270693 | 2021-06-07T10:33:55 | 2021-06-07T10:33:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,513 | java | package com.usercenter.handler;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.handler.AbstractHandler;
import com.alibaba.fastjson.JSONObject;
import com.usercenter.mgr.UserCenterMgr;
import com.utils.Log;
import com.utils.StringUtils;
public class StopHandler extends AbstractHandler {
/** 成功的状态码 **/
public static int SUCCESS = 200;
/** 一天的秒数 **/
public static final int DAY_SEC = 604800;
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
if (!"/center/stop".equals(target)) {
return;
}
Log.info("用户中心收得到停服请求,信息:" + request);
JSONObject jsObject = new JSONObject();
try {
response.setHeader("Content-Type", "text/html;charset=utf-8");
response.setContentType("application/json");
response.setCharacterEncoding("utf-8");
if (request.getMethod().equals("GET")) {
if (request.getParameterMap() == null || request.getParameterMap().isEmpty()) {
Log.error("参数为null!");
return;
}
String key = request.getParameter("key");
//校验是否为null
if (StringUtils.isEmpty(key)) {
response.setStatus(500);
jsObject.put("err_mess", "key param not find!");
jsObject.put("status", "fail!");
response.getOutputStream().write(jsObject.toJSONString().getBytes());
Log.error("game_id param not find!");
return;
}
//校验参数值
if(!key.equals("stop_and_save")) {
response.setStatus(500);
jsObject.put("err_mess", "key's value is error!");
jsObject.put("status", "fail!");
response.getOutputStream().write(jsObject.toJSONString().getBytes());
Log.error("game_id param not find!");
return;
}
//异步持久化userinfo
UserCenterMgr.stop();
}
jsObject.put("status", "OK");
response.setStatus(SUCCESS);
response.setHeader("Content-Type", "text/html;charset=utf-8");
response.setContentType("application/json");
response.setCharacterEncoding("utf-8");
response.getOutputStream().write(jsObject.toJSONString().getBytes());
} catch (Exception e) {
Log.error(e.getMessage());
} finally {
request.getInputStream().close();
response.getOutputStream().close();
System.exit(0);
}
}
}
| [
"tangjian@tangjiandeiMac.local"
] | tangjian@tangjiandeiMac.local |
d429d349eae59b09ecc47132f94bb8eaa5de432f | 910e4fc512524172740361cdddbca0fc74438be3 | /springboot-shiro1/src/main/java/com/example/controller/UserController.java | cafbc6989f09b0813b4f8f045f1ee4e2e327a6f2 | [] | no_license | Kahen/Spring-Boot | 5347b5b96f9a6e987059eefd3363b0fd57e0de94 | 98a38258e52f53217a1cc39d19bc462779f0b07a | refs/heads/master | 2023-08-05T05:37:23.028319 | 2022-02-24T06:05:32 | 2022-02-24T06:05:32 | 235,023,678 | 1 | 0 | null | 2023-07-23T03:16:20 | 2020-01-20T05:12:42 | HTML | UTF-8 | Java | false | false | 307 | java | package com.example.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("user")
public class UserController {
@RequestMapping("toUserManager")
public String toUserManager() {
return "list";
}
}
| [
"kahenlee@163.com"
] | kahenlee@163.com |
e1e3987676380eea2bf19688249eb8bc4d51bae2 | 8f42408fda583ebf1b34b1c4f68c936a7292e493 | /src/main/java/cz/active24/client/fred/data/sendauthinfo/nsset/NssetSendAuthInfoRequest.java | 23d36920b1f0cc03e3e3708e1e52923b5aee7159 | [
"Apache-2.0"
] | permissive | novotnyradek/fred-client | 57b17651795ecb346826acb70581920396154296 | bdd97d2b8522b4c708685792c3d8e3f1a5e8a7e6 | refs/heads/master | 2023-05-03T10:27:24.756416 | 2023-04-21T10:55:10 | 2023-04-21T10:55:10 | 145,895,847 | 14 | 0 | Apache-2.0 | 2022-08-11T10:30:51 | 2018-08-23T19:04:41 | Java | UTF-8 | Java | false | false | 1,339 | java | package cz.active24.client.fred.data.sendauthinfo.nsset;
import cz.active24.client.fred.data.EppRequest;
import cz.active24.client.fred.eppclient.objectstrategy.ServerObjectType;
import cz.active24.client.fred.data.sendauthinfo.SendAuthInfoRequest;
import java.io.Serializable;
/**
* A nsset sendAuthInfo command is used to provide the transfer password of an nsset to the technical contacts of the nsset.
*
* <ul>
* <li>
* {@link NssetSendAuthInfoRequest#nssetId} - an nsset handle
* </li>
* </ul>
*
* @see <a href="https://fred.nic.cz/documentation/html/EPPReference/CommandStructure/SendAuthInfo/SendAuthInfoNsset.html">FRED documentation</a>
*/
public class NssetSendAuthInfoRequest extends EppRequest implements Serializable, SendAuthInfoRequest {
private String nssetId;
public NssetSendAuthInfoRequest(String nssetId) {
setServerObjectType(ServerObjectType.NSSET);
this.nssetId = nssetId;
}
public String getNssetId() {
return nssetId;
}
protected void setNssetId(String nssetId) {
this.nssetId = nssetId;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("NssetSendAuthInfoRequest{");
sb.append("nssetId='").append(nssetId).append('\'');
sb.append('}');
return sb.toString();
}
} | [
"novotny.radek@active24.cz"
] | novotny.radek@active24.cz |
a371dc335a2ad8224df881dece0d76c3ac330ab9 | bdc243d9c66006d24b0b03a7462bb2dae9bde7b9 | /src/main/java/com/qianliu/demo/service/GoodsService.java | 16c16dd00718d92afd1324ae87d601f37e0c73a6 | [] | no_license | LUK-qianliu/miaosha | 051444defd686ac152b851df5e1415d987596e19 | c3d4fbbc092ee92959cce8f16a33d797d58417aa | refs/heads/master | 2022-06-23T22:31:06.431816 | 2019-09-03T10:07:39 | 2019-09-03T10:07:39 | 205,791,744 | 1 | 2 | null | 2022-06-17T02:27:36 | 2019-09-02T06:34:08 | Java | UTF-8 | Java | false | false | 957 | java | package com.qianliu.demo.service;
import com.qianliu.demo.dao.GoodsDAO;
import com.qianliu.demo.domain.MiaoshaGoods;
import com.qianliu.demo.vo.GoodsVo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class GoodsService {
@Resource
GoodsDAO goodsDAO;
/**
* 查询goods和miaosha_goods
* @return
*/
public List<GoodsVo> listGoodsVo(){
return goodsDAO.listGoodsVo();
}
/**
* 通过id查询goodsVo
* @param goodsId
* @return
*/
public GoodsVo getGoodsVoByGoodsId(long goodsId) {
return goodsDAO.getGoodsVo(goodsId);
}
/**
* 减少库存
* @param goods
*/
public Boolean reduceStock(GoodsVo goods) {
MiaoshaGoods g = new MiaoshaGoods();
g.setGoodsId(goods.getId());
int stock = goodsDAO.reduceStock(g);
return stock>0;//库存大于0
}
}
| [
"532433365@qq.com"
] | 532433365@qq.com |
f058269e7c0b0f49f0b3ab714a91b814f6026793 | c1beeb1cce6d12cd8b6713c586e912d9aae522ea | /src/com/programs/basicprograms/OddOrEvenNumber.java | cffacb31391c26ce898ff57d1a246c68728257db | [] | no_license | wadwat/Java-Programms | 58d03d45f337f0596cb1c4e8242ccfa7b6c4f26a | f12c248c5b796d4d347ae4d5ca38b1292bb1226d | refs/heads/main | 2023-05-12T00:06:12.804579 | 2021-06-05T07:33:20 | 2021-06-05T07:33:20 | 374,050,171 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 621 | java | package com.programs.basicprograms;
import java.util.Scanner;
public class OddOrEvenNumber {
public static void main(String[] args) {
int i = 0;
Scanner sc = new Scanner(System.in);
System.out.println("Enter the number :");
int number = sc.nextInt();
for (i = 2; i < number; i++) {
if (number % i == 0) {
continue;
}
}
System.out.println("It is a Odd Number:"+number);
/*
int number = 5;
for (int i = 0; i <=number; i++) {
if(number%2==0) {
System.out.println("It is not a Odd Number:"+number);
}else {
System.out.println("It is a Odd Number:"+number);
}
}*/
}
}
| [
"chandrakantwadwat@gmail.com"
] | chandrakantwadwat@gmail.com |
a4cc0af36c6005f09f5abcd500b21b30beccb28f | 4ed8a261dc1d7a053557c9c0bcec759978559dbd | /cnd/cnd.script/src/org/netbeans/modules/cnd/api/makefile/MakefileInclude.java | a7248c02f59f05581f27161067dbc8aac3386ff2 | [
"Apache-2.0"
] | permissive | kaveman-/netbeans | 0197762d834aa497ad17dccd08a65c69576aceb4 | 814ad30e2d0a094f4aa3813bcbb5323a95a0b1d6 | refs/heads/master | 2021-01-04T06:49:41.139015 | 2020-02-06T15:13:37 | 2020-02-06T15:13:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,968 | java | /*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2010 Oracle and/or its affiliates. All rights reserved.
*
* Oracle and Java are registered trademarks of Oracle and/or its affiliates.
* Other names may be trademarks of their respective owners.
*
* 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
* http://www.netbeans.org/cddl-gplv2.html
* or nbbuild/licenses/CDDL-GPL-2-CP. 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
* nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle 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]"
*
* 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 do not 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.
*
* Contributor(s):
*
* Portions Copyrighted 2010 Sun Microsystems, Inc.
*/
package org.netbeans.modules.cnd.api.makefile;
import java.util.Collections;
import java.util.List;
import org.openide.filesystems.FileObject;
/**
*/
public final class MakefileInclude extends MakefileElement {
private final List<String> fileNames;
/*package*/ MakefileInclude(
FileObject fileObject, int startOffset, int endOffset,
List<String> fileNames) {
super(Kind.INCLUDE, fileObject, startOffset, endOffset);
this.fileNames = Collections.unmodifiableList(fileNames);
}
public List<String> getFileNames() {
return fileNames;
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder("INCLUDE"); // NOI18N
for (String file : fileNames) {
buf.append(' ').append(file);
}
return buf.toString();
}
}
| [
"geertjan@apache.org"
] | geertjan@apache.org |
179b84aa8e492f33f3245d68ae2974f5183253ea | abd539ff3400490da5150c70d6f14f6430c06347 | /src/main/java/io/vertx/ext/json/schema/SchemaParserOptions.java | e79a412b751450856d5cd2c341a9ccfe9e597263 | [
"MIT"
] | permissive | slinkydeveloper/vertx-json-validator | 574f9f9d962434bfd672bf26d44452cdccc1ccfa | ead7006e077c954d0bd5576d9076923f79925d4b | refs/heads/master | 2021-06-25T14:41:39.127370 | 2019-03-21T08:02:21 | 2019-03-21T08:02:21 | 145,209,739 | 0 | 0 | MIT | 2020-10-13T06:48:57 | 2018-08-18T10:09:53 | Java | UTF-8 | Java | false | false | 1,506 | java | package io.vertx.ext.json.schema;
import io.vertx.codegen.annotations.DataObject;
import io.vertx.codegen.annotations.Fluent;
import io.vertx.codegen.annotations.VertxGen;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Predicate;
@VertxGen
@DataObject
public class SchemaParserOptions {
private List<ValidatorFactory> additionalValidatorFactories;
private Map<String, Predicate<String>> additionalStringFormatValidators;
public SchemaParserOptions() {
this.additionalValidatorFactories = new ArrayList<>();
this.additionalStringFormatValidators = new HashMap<>();
}
public List<ValidatorFactory> getAdditionalValidatorFactories() {
return additionalValidatorFactories;
}
public Map<String, Predicate<String>> getAdditionalStringFormatValidators() {
return additionalStringFormatValidators;
}
/**
* Add a validator factory that will be applied to {@link SchemaParser}
*
* @return
*/
@Fluent
public SchemaParserOptions putAdditionalValidatorFactory(ValidatorFactory factory) {
this.additionalValidatorFactories.add(factory);
return this;
}
/**
* Add a format validator that will be applied to {@link SchemaParser}
*
* @return
*/
@Fluent
public SchemaParserOptions putAdditionalStringFormatValidator(String formatName, Predicate<String> predicate) {
this.additionalStringFormatValidators.put(formatName, predicate);
return this;
}
}
| [
"francescoguard@gmail.com"
] | francescoguard@gmail.com |
94e3358c889eb2363d4536c0c25db3858fde27aa | a31fbecea79c8ab63956debfcc9c7f3a6f34f36c | /src/org/objectweb/asm/tree/analysis/BasicVerifier.java | d796fd1a479373a5bcc7e9b04bbf73492c714291 | [
"BSD-3-Clause",
"SMLNJ"
] | permissive | kongposh/RoadRunner | e8b1dd19b3de2bbea941f4bc99a9ca851ec30c35 | ad22e7a7f381b1ee840085e172a6a06de43f9d80 | refs/heads/master | 2020-05-30T21:38:17.972378 | 2014-01-05T19:10:50 | 2014-01-05T19:10:50 | 44,423,617 | 0 | 0 | null | 2015-10-17T04:11:35 | 2015-10-17T04:11:35 | null | UTF-8 | Java | false | false | 15,712 | java | /***
* ASM: a very small and fast Java bytecode manipulation framework
* Copyright (c) 2000-2005 INRIA, France Telecom
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.objectweb.asm.tree.analysis;
import java.util.List;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.AbstractInsnNode;
import org.objectweb.asm.tree.FieldInsnNode;
import org.objectweb.asm.tree.MethodInsnNode;
/**
* An extended {@link ArrayShadowInterpreter} that checks that bytecode instructions
* are correctly used.
*
* @author Eric Bruneton
* @author Bing Ran
*/
public class BasicVerifier extends BasicInterpreter {
public Value copyOperation(final AbstractInsnNode insn, final Value value)
throws AnalyzerException
{
Value expected;
switch (insn.getOpcode()) {
case ILOAD:
case ISTORE:
expected = BasicValue.INT_VALUE;
break;
case FLOAD:
case FSTORE:
expected = BasicValue.FLOAT_VALUE;
break;
case LLOAD:
case LSTORE:
expected = BasicValue.LONG_VALUE;
break;
case DLOAD:
case DSTORE:
expected = BasicValue.DOUBLE_VALUE;
break;
case ALOAD:
if (!((BasicValue) value).isReference()) {
throw new AnalyzerException(null,
"an object reference",
value);
}
return value;
case ASTORE:
if (!((BasicValue) value).isReference()
&& value != BasicValue.RETURNADDRESS_VALUE)
{
throw new AnalyzerException(null,
"an object reference or a return address",
value);
}
return value;
default:
return value;
}
// type is necessarily a primitive type here,
// so value must be == to expected value
if (value != expected) {
throw new AnalyzerException(null, expected, value);
}
return value;
}
public Value unaryOperation(final AbstractInsnNode insn, final Value value)
throws AnalyzerException
{
Value expected;
switch (insn.getOpcode()) {
case INEG:
case IINC:
case I2F:
case I2L:
case I2D:
case I2B:
case I2C:
case I2S:
case IFEQ:
case IFNE:
case IFLT:
case IFGE:
case IFGT:
case IFLE:
case TABLESWITCH:
case LOOKUPSWITCH:
case IRETURN:
case NEWARRAY:
case ANEWARRAY:
expected = BasicValue.INT_VALUE;
break;
case FNEG:
case F2I:
case F2L:
case F2D:
case FRETURN:
expected = BasicValue.FLOAT_VALUE;
break;
case LNEG:
case L2I:
case L2F:
case L2D:
case LRETURN:
expected = BasicValue.LONG_VALUE;
break;
case DNEG:
case D2I:
case D2F:
case D2L:
case DRETURN:
expected = BasicValue.DOUBLE_VALUE;
break;
case GETFIELD:
expected = newValue(Type.getObjectType(((FieldInsnNode) insn).owner));
break;
case CHECKCAST:
if (!((BasicValue) value).isReference()) {
throw new AnalyzerException(null,
"an object reference",
value);
}
return super.unaryOperation(insn, value);
case ARRAYLENGTH:
if (!isArrayValue(value)) {
throw new AnalyzerException(null,
"an target reference",
value);
}
return super.unaryOperation(insn, value);
case ARETURN:
case ATHROW:
case INSTANCEOF:
case MONITORENTER:
case MONITOREXIT:
case IFNULL:
case IFNONNULL:
if (!((BasicValue) value).isReference()) {
throw new AnalyzerException(null,
"an object reference",
value);
}
return super.unaryOperation(insn, value);
case PUTSTATIC:
expected = newValue(Type.getType(((FieldInsnNode) insn).desc));
break;
default:
throw new Error("Internal error.");
}
if (!isSubTypeOf(value, expected)) {
throw new AnalyzerException(null, expected, value);
}
return super.unaryOperation(insn, value);
}
public Value binaryOperation(
final AbstractInsnNode insn,
final Value value1,
final Value value2) throws AnalyzerException
{
Value expected1;
Value expected2;
switch (insn.getOpcode()) {
case IALOAD:
expected1 = newValue(Type.getType("[I"));
expected2 = BasicValue.INT_VALUE;
break;
case BALOAD:
if (!isSubTypeOf(value1, newValue(Type.getType("[Z")))) {
expected1 = newValue(Type.getType("[B"));
} else {
expected1 = newValue(Type.getType("[Z"));
}
expected2 = BasicValue.INT_VALUE;
break;
case CALOAD:
expected1 = newValue(Type.getType("[C"));
expected2 = BasicValue.INT_VALUE;
break;
case SALOAD:
expected1 = newValue(Type.getType("[S"));
expected2 = BasicValue.INT_VALUE;
break;
case LALOAD:
expected1 = newValue(Type.getType("[J"));
expected2 = BasicValue.INT_VALUE;
break;
case FALOAD:
expected1 = newValue(Type.getType("[F"));
expected2 = BasicValue.INT_VALUE;
break;
case DALOAD:
expected1 = newValue(Type.getType("[D"));
expected2 = BasicValue.INT_VALUE;
break;
case AALOAD:
expected1 = newValue(Type.getType("[Ljava/lang/Object;"));
expected2 = BasicValue.INT_VALUE;
break;
case IADD:
case ISUB:
case IMUL:
case IDIV:
case IREM:
case ISHL:
case ISHR:
case IUSHR:
case IAND:
case IOR:
case IXOR:
case IF_ICMPEQ:
case IF_ICMPNE:
case IF_ICMPLT:
case IF_ICMPGE:
case IF_ICMPGT:
case IF_ICMPLE:
expected1 = BasicValue.INT_VALUE;
expected2 = BasicValue.INT_VALUE;
break;
case FADD:
case FSUB:
case FMUL:
case FDIV:
case FREM:
case FCMPL:
case FCMPG:
expected1 = BasicValue.FLOAT_VALUE;
expected2 = BasicValue.FLOAT_VALUE;
break;
case LADD:
case LSUB:
case LMUL:
case LDIV:
case LREM:
case LAND:
case LOR:
case LXOR:
case LCMP:
expected1 = BasicValue.LONG_VALUE;
expected2 = BasicValue.LONG_VALUE;
break;
case LSHL:
case LSHR:
case LUSHR:
expected1 = BasicValue.LONG_VALUE;
expected2 = BasicValue.INT_VALUE;
break;
case DADD:
case DSUB:
case DMUL:
case DDIV:
case DREM:
case DCMPL:
case DCMPG:
expected1 = BasicValue.DOUBLE_VALUE;
expected2 = BasicValue.DOUBLE_VALUE;
break;
case IF_ACMPEQ:
case IF_ACMPNE:
expected1 = BasicValue.REFERENCE_VALUE;
expected2 = BasicValue.REFERENCE_VALUE;
break;
case PUTFIELD:
FieldInsnNode fin = (FieldInsnNode) insn;
expected1 = newValue(Type.getObjectType(fin.owner));
expected2 = newValue(Type.getType(fin.desc));
break;
default:
throw new Error("Internal error.");
}
if (!isSubTypeOf(value1, expected1)) {
throw new AnalyzerException("First argument", expected1, value1);
} else if (!isSubTypeOf(value2, expected2)) {
throw new AnalyzerException("Second argument", expected2, value2);
}
if (insn.getOpcode() == AALOAD) {
return getElementValue(value1);
} else {
return super.binaryOperation(insn, value1, value2);
}
}
public Value ternaryOperation(
final AbstractInsnNode insn,
final Value value1,
final Value value2,
final Value value3) throws AnalyzerException
{
Value expected1;
Value expected3;
switch (insn.getOpcode()) {
case IASTORE:
expected1 = newValue(Type.getType("[I"));
expected3 = BasicValue.INT_VALUE;
break;
case BASTORE:
if (!isSubTypeOf(value1, newValue(Type.getType("[Z")))) {
expected1 = newValue(Type.getType("[B"));
} else {
expected1 = newValue(Type.getType("[Z"));
}
expected3 = BasicValue.INT_VALUE;
break;
case CASTORE:
expected1 = newValue(Type.getType("[C"));
expected3 = BasicValue.INT_VALUE;
break;
case SASTORE:
expected1 = newValue(Type.getType("[S"));
expected3 = BasicValue.INT_VALUE;
break;
case LASTORE:
expected1 = newValue(Type.getType("[J"));
expected3 = BasicValue.LONG_VALUE;
break;
case FASTORE:
expected1 = newValue(Type.getType("[F"));
expected3 = BasicValue.FLOAT_VALUE;
break;
case DASTORE:
expected1 = newValue(Type.getType("[D"));
expected3 = BasicValue.DOUBLE_VALUE;
break;
case AASTORE:
expected1 = value1;
expected3 = BasicValue.REFERENCE_VALUE;
break;
default:
throw new Error("Internal error.");
}
if (!isSubTypeOf(value1, expected1)) {
throw new AnalyzerException("First argument", "a " + expected1
+ " target reference", value1);
} else if (value2 != BasicValue.INT_VALUE) {
throw new AnalyzerException("Second argument",
BasicValue.INT_VALUE,
value2);
} else if (!isSubTypeOf(value3, expected3)) {
throw new AnalyzerException("Third argument", expected3, value3);
}
return null;
}
public Value naryOperation(final AbstractInsnNode insn, final List values)
throws AnalyzerException
{
int opcode = insn.getOpcode();
if (opcode == MULTIANEWARRAY) {
for (int i = 0; i < values.size(); ++i) {
if (values.get(i) != BasicValue.INT_VALUE) {
throw new AnalyzerException(null,
BasicValue.INT_VALUE,
(Value) values.get(i));
}
}
} else {
int i = 0;
int j = 0;
if (opcode != INVOKESTATIC) {
String own = ((MethodInsnNode) insn).owner;
if (own.charAt(0) != '[') { // can happen with JDK1.5 clone()
own = "L" + own + ";";
}
Type owner = Type.getType(own);
if (!isSubTypeOf((Value) values.get(i++), newValue(owner))) {
throw new AnalyzerException("Method owner",
newValue(owner),
(Value) values.get(0));
}
}
Type[] args = Type.getArgumentTypes(((MethodInsnNode) insn).desc);
while (i < values.size()) {
Value expected = newValue(args[j++]);
Value encountered = (Value) values.get(i++);
if (!isSubTypeOf(encountered, expected)) {
throw new AnalyzerException("Argument " + j,
expected,
encountered);
}
}
}
return super.naryOperation(insn, values);
}
protected boolean isArrayValue(final Value value) {
return ((BasicValue) value).isReference();
}
protected Value getElementValue(final Value objectArrayValue)
throws AnalyzerException
{
return BasicValue.REFERENCE_VALUE;
}
protected boolean isSubTypeOf(final Value value, final Value expected) {
return value == expected;
}
}
| [
"freund@cs.williams.edu"
] | freund@cs.williams.edu |
05058fe74e37c51e98abda8e0f060034d018dedf | a172a7fa25fd6335f4bebde8b83cf8ba4e34f466 | /src/main/java/br/edu/utfpr/model/Aluno.java | 3f6b3828188f886d3f626a4871eed3c35140cd7d | [] | no_license | utfpr-gp/sistema-biblioteca-tcc | fdc3d7b97886c5cbab5e3ee4d1bab67e28ec0ed0 | 07959316c2e980ce4cd13229894a77939c56eddf | refs/heads/master | 2020-03-27T19:47:09.679314 | 2018-09-01T17:37:29 | 2018-09-01T17:37:29 | 147,011,188 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,190 | 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 br.edu.utfpr.model;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
/**
*
* @author Lucas
*/
@Entity
public class Aluno implements Serializable{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
//@NotEmpty
//@Size(min = 2, max = 255)
private String nome;
//@NotEmpty
//@Pattern(regexp = ".+@.+\\.[a-z]+")
//@Size(min = 2, max = 255)
private String email;
//@NotEmpty
//Dificil criar uma expressao de validacao
//pois alguns numeros tem esse formato (2)(4)-(4) e outros (2)(5)-(4)
private String celular;
//@NotEmpty
//@Size(min = 2, max = 255)
private String mae;
//@NotEmpty
//@Size(min = 2, max = 255)
private String pai;
@ManyToOne
private Turma turma;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getCelular() {
return celular;
}
public void setCelular(String celular) {
this.celular = celular;
}
public String getMae() {
return mae;
}
public void setMae(String mae) {
this.mae = mae;
}
public String getPai() {
return pai;
}
public void setPai(String pai) {
this.pai = pai;
}
public Turma getTurma() {
return turma;
}
public void setTurma(Turma turma) {
this.turma = turma;
}
}
| [
"roni.banaszewski@gmail.com"
] | roni.banaszewski@gmail.com |
705fb60b462f93a76df920284f4018001dc9af9b | 18c10aa1261bea4ae02fa79598446df714519c6f | /70_spring/24_SpringMVC_Annotation_String/src/main/java/com/spring/biz/view/User/UserController.java | 344d1ebd0022ef6e1487bb44106e057effe74763 | [] | no_license | giveseul-23/give_Today_I_Learn | 3077efbcb11ae4632f68dfa3f9285d2c2ad27359 | f5599f0573fbf0ffdfbcc9c79b468e3c76303dd4 | refs/heads/master | 2023-05-06T08:13:49.845436 | 2021-05-25T04:33:20 | 2021-05-25T04:33:20 | 330,189,867 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,449 | java | package com.spring.biz.view.User;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.spring.biz.user.UserVO;
import com.spring.biz.user.impl.UserDAO;
@Controller
public class UserController {
/*
@RequestMapping : 요청과 처리(Controller) 연결(HandlerMapping 역할 대체)
command 객체 사용 : 파라미터로 전달되는 값을 Command 객체에 설정
스프링프레임워크에서 객체에 생성하고 파라미터 값을 설정해서 전달해줌
1. UserVO 타입의 객체 생성
2. UserVO 타입의 객체에 전달받은 파라미터 값을 설정(이름 일치하는 경우)
3. UserVO 타입의 객체를 메소드의 파라미터(인수) 값으로 전달
*/
@RequestMapping("/login.do")
public String login(UserVO vo, UserDAO userDAO) {
System.out.println(">>> 로그인 처리 - login()");
System.out.println("> 전달받은 vo : " + vo);
UserVO user = userDAO.getUser(vo);
if(user != null) {
return "getBoardList.do";
}else {
return "login.jsp";
}
}
@RequestMapping("/logout.do")
public String logout(HttpSession session) {
System.out.println(">>> 로그인아웃 처리 - logout()");
//1. 세션 초기화(세션 객체 종료)
session.invalidate();
//2. 화면 네비게이션(로그인페이지)
return "login.jsp";
}
}
| [
"joodasel@icloud.com"
] | joodasel@icloud.com |
b5a8a5f8924100bf82249b59df160a7c1336b4a8 | 6d2ade1c229eb80219529a76c9fc24c0b50b6ec5 | /src/main/java/com/eversec/zhangpan/jdkproxy/MyInterceptor.java | 11377ee0bace4f55bbb4b914afaeef5e2823865e | [] | no_license | zhangpan1/struts2 | 3d8e19c54c7145ef8dd7b119d71ca145ebdbb162 | d01559147bfd2ff1e74db16b362777f1821040b7 | refs/heads/master | 2021-01-20T20:03:54.717585 | 2016-07-05T10:07:49 | 2016-07-05T10:07:49 | 61,198,896 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,094 | java | package com.eversec.zhangpan.jdkproxy;
//动态代理,要实现拦截器接口
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
/**
* 拦截器
* 作用一:目标类导入进来
* 作用二:事务导入进来
* 作用三:invoke完成
* 1、开启事务
* 2、调用目标对象的方法
* 3、事务的提交
* @author zhangp
*
*/
public class MyInterceptor implements InvocationHandler{
private Object target;//目标类
private Transaction transaction;
public MyInterceptor(Object target,Transaction transaction){
super();
this.target = target;
this.transaction = transaction;
}
@Override
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
String methodName = method.getName();
if ("savePerson".equals(methodName) || "updatePerson".equals(methodName)||
"deletePerson".equals(methodName)){//开启事务
method.invoke(target);//调用目标方法
this.transaction.commit();//事务的提交
}else {
method.invoke(target);
}
return null;
}
}
| [
"852857754@qq.com"
] | 852857754@qq.com |
86ee3d919f9897179bcda88497901ab527a4b721 | 815905708dcd0647e671c711a41193cbc7b59f96 | /src/model/Computer.java | a8e4b42539950e5fec2e377b745c3a87e283d9f3 | [] | no_license | namluty/Module02-CaseStudy | d039a677d9902f3ab705c3553de88f1bd04482aa | dab664db8bc23c5589643986964b7160f034dec2 | refs/heads/master | 2023-07-07T03:35:13.672012 | 2021-08-06T13:34:11 | 2021-08-06T13:34:11 | 393,386,682 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,267 | java | package model;
import java.io.Serializable;
public class Computer implements Serializable {
private String name;
private int id;
private String description;
private String status;
public Computer() {
}
public Computer(String name, int id, String description, String status) {
this.name = name;
this.id = id;
this.description = description;
this.status = status;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
@Override
public String toString() {
return "Computer{" +
"name='" + name + '\'' +
", id=" + id +
", description='" + description + '\'' +
", status='" + status + '\'' +
'}';
}
} | [
"dhnam.2020@gmail.com"
] | dhnam.2020@gmail.com |
5a855624636649b6b9df04d17d940f0c18daadb8 | 18b20a45faa4cf43242077e9554c0d7d42667fc2 | /HelicoBacterMod/build/tmp/expandedArchives/forge-1.14.4-28.1.0_mapped_snapshot_20190719-1.14.3-sources.jar_db075387fe30fb93ccdc311746149f9d/net/minecraft/network/play/client/CConfirmTransactionPacket.java | abd0cf99b5b3b80ca9e618d12c9242a10a88099e | [] | no_license | qrhlhplhp/HelicoBacterMod | 2cbe1f0c055fd5fdf97dad484393bf8be32204ae | 0452eb9610cd70f942162d5b23141b6bf524b285 | refs/heads/master | 2022-07-28T16:06:03.183484 | 2021-03-20T11:01:38 | 2021-03-20T11:01:38 | 347,618,857 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,525 | java | package net.minecraft.network.play.client;
import java.io.IOException;
import net.minecraft.network.IPacket;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.IServerPlayNetHandler;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class CConfirmTransactionPacket implements IPacket<IServerPlayNetHandler> {
private int windowId;
private short uid;
private boolean accepted;
public CConfirmTransactionPacket() {
}
@OnlyIn(Dist.CLIENT)
public CConfirmTransactionPacket(int windowIdIn, short uidIn, boolean acceptedIn) {
this.windowId = windowIdIn;
this.uid = uidIn;
this.accepted = acceptedIn;
}
public void processPacket(IServerPlayNetHandler handler) {
handler.processConfirmTransaction(this);
}
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException {
this.windowId = buf.readByte();
this.uid = buf.readShort();
this.accepted = buf.readByte() != 0;
}
/**
* Writes the raw packet data to the data stream.
*/
public void writePacketData(PacketBuffer buf) throws IOException {
buf.writeByte(this.windowId);
buf.writeShort(this.uid);
buf.writeByte(this.accepted ? 1 : 0);
}
public int getWindowId() {
return this.windowId;
}
public short getUid() {
return this.uid;
}
}
| [
"rubickraft169@gmail.com"
] | rubickraft169@gmail.com |
aaa3c459e71249f8ff98bac1a92f7fe08a3bd63f | 33dedce1d71092d7526d26a115ac9b4f735510cd | /src/main/java/jdonee/mybatis/springboot/conf/MyBatisMapperScannerConfig.java | 7fd1434402d4710145c8494e5813ed2deee7ef0f | [] | no_license | jdonee/MyBatis-Spring-Boot | 0ab04a0572dcf9f1fdf37688ca3d66183dd7a264 | 670455dd0bcb8e57b51f63346a9178ffa10a03b5 | refs/heads/master | 2020-04-19T10:12:47.581267 | 2016-09-05T04:07:29 | 2016-09-05T04:07:29 | 67,201,512 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,446 | java |
package jdonee.mybatis.springboot.conf;
import java.util.Properties;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import jdonee.mybatis.springboot.util.MyMapper;
import tk.mybatis.spring.mapper.MapperScannerConfigurer;
/**
* MyBatis扫描接口,使用的tk.mybatis.spring.mapper.MapperScannerConfigurer <br/>
* 如果你不使用通用Mapper,可以改为org.xxx...
*
*/
@Configuration
// TODO 注意,由于MapperScannerConfigurer执行的比较早,所以必须有下面的注解
@AutoConfigureAfter(MybatisAutoConfiguration.class)
public class MyBatisMapperScannerConfig {
@Bean
public MapperScannerConfigurer mapperScannerConfigurer() {
MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer();
mapperScannerConfigurer.setSqlSessionFactoryBeanName("sqlSessionFactory");
mapperScannerConfigurer.setBasePackage("jdonee.mybatis.springboot.mapper");
Properties properties = new Properties();
// 这里要特别注意,不要把MyMapper放到 basePackage 中,也就是不能同其他Mapper一样被扫描到。
properties.setProperty("mappers", MyMapper.class.getName());
properties.setProperty("notEmpty", "false");
properties.setProperty("IDENTITY", "MYSQL");
mapperScannerConfigurer.setProperties(properties);
return mapperScannerConfigurer;
}
} | [
"jdonee.zeng@gmail.com"
] | jdonee.zeng@gmail.com |
c6f53ddcbd3ffc2ca945f3c427cbb358e7777c08 | db4385e116cd30f7690cce398dba622563cda153 | /homes-order-mobile-android-vendor-work-copy/app/src/main/java/com/homesordervendor/product/addproduct/model/DeliveryArea.java | 09dcdaab48e37d8aa99eee39b821712ae6aaa660 | [] | no_license | karthikeyan1495/homesordervendor | 3cc1b1b155ff343cf58aedeeb7741be0ba1ca701 | d385c7c9e4484503c34deedabfde5ec868ef8804 | refs/heads/master | 2020-04-08T15:55:32.502226 | 2018-12-01T11:17:50 | 2018-12-01T11:17:50 | 159,497,448 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 640 | java | package com.homesordervendor.product.addproduct.model;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
/**
* Created by innoppl on 27/04/18.
*/
public class DeliveryArea {
@SerializedName("areaID")
@Expose
private String areaID;
@SerializedName("price")
@Expose
private String price;
public String getAreaID() {
return areaID;
}
public void setAreaID(String areaID) {
this.areaID = areaID;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
}
| [
"you@example.com"
] | you@example.com |
487dcadf2a6f2ae86479d89f92fbc57d57347a25 | f8c8c4a69c094db0e57005b911dc956df61d0b43 | /src/main/java/com/crud/tasks/domain/Task.java | 43927b82fb677661b5dc35f83cffabb03059c74d | [] | no_license | mattpolski/kodilla-tasks | 8f08d65622dc807a7c15114e8bfa74dee851c6c0 | 5264ec6188081b22494b55cd23dd906d3475e285 | refs/heads/master | 2020-03-19T01:47:40.789021 | 2018-08-08T17:32:04 | 2018-08-08T17:32:04 | 135,572,779 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 481 | java | package com.crud.tasks.domain;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import javax.swing.text.StringContent;
@AllArgsConstructor
@NoArgsConstructor
@Getter
@Entity(name = "tasks")
public class Task {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column(name = "name")
private String title;
@Column(name = "description")
private String content;
}
| [
"mattpolski@gmail.com"
] | mattpolski@gmail.com |
a36d03814f8dcda0d6b5e88ab787b6b52f08799d | 2ee08a59da3f2fbf093577b168f9f858a80a79b5 | /5/src/tp/pr5/gui/InfoPanel.java | 05f98059159ac2d674208a5d477cebbdb1b1d494 | [] | no_license | AdrianVader/Practicas-tecnologia-de-la-programacion | ca57867769f1501c7af604cd64e5d4cb3c6b57be | 7aec1e32f22236fea8a843da57a02f46d2cc3ef5 | refs/heads/master | 2020-04-17T21:50:01.634116 | 2016-08-31T16:35:43 | 2016-08-31T16:35:43 | 67,055,050 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,493 | java | package tp.pr5.gui;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import tp.pr5.Directions;
import tp.pr5.GameObserver;
import tp.pr5.MapObserver;
import tp.pr5.PlayerObserver;
import tp.pr5.RoomInfo;
import tp.pr5.items.Item;
public class InfoPanel extends javax.swing.JPanel implements GameObserver, MapObserver, PlayerObserver{
private static final long serialVersionUID = 1L;
private JLabel label;
public InfoPanel(){
this.setBorder(BorderFactory.createTitledBorder("Info"));
this.label = new JLabel();
this.add(this.label);
}
@Override
//Notifies that the player inventory has changed
public void inventoryUpdate(List<Item> inventory) {
if(inventory.size() == 1)
this.label.setText("Your inventory now contains " + inventory.size() + " item.");
else if(inventory.size() == 0)
this.label.setText("Your inventory is now empty");
else
this.label.setText("Your inventory now contains " + inventory.size() + " items.");
}
@Override
//Notifies that an item is empty
public void itemEmpty(String itemName) {
this.label.setText("Your " + itemName + " is empty.");
}
@Override
//Notifies that the player wants to examine an item
public void itemLooked(String description) {
this.label.setText("Looking at an item.");
}
@Override
//Notifies that an item has been used
public void itemUsed(String itemName) {
this.label.setText("You have used " + itemName + ".");
}
@Override
//Notifies the player's death
public void playerDead() {
this.label.setText("You are dead...");
}
@Override
//Notifies that the player looked the inventory
public void playerLookedInventory(List<Item> inventory) {
this.label.setText("Looking at the inventory.");
}
@Override
//Notifies that the player attributes (health and score) have changed
public void playerUpdate(int newHealth, int newScore) {
this.label.setText("Your attributes have been updated: (" + newHealth + ", " + newScore + ")");
}
@Override
//Notifies that the player examined a room
public void playerHasExaminedRoom(RoomInfo r) {
this.label.setText("You have examined the " + r.getName() + ".");
}
@Override
//Notifies that the player entered a room coming from a given direction
public void roomEntered(Directions direction, RoomInfo targetRoom) {
this.label.setText("You have entererd the " + targetRoom.getName() + " from the " + direction.opposite(direction).toString() + ".");
}
@Override
//Notifies that the game cannot execute a command
public void gameError(String msg) {
this.label.setText(msg);
}
@Override
//Notifies that the player requests help information
public void gameHelp() {
this.label.setText("Help requested.");
}
@Override
//Notifies that the game is finished and whether the player wins or is death
public void gameOver(boolean win) {
if(win)
this.label.setText("GAME OVER." + '\n' + "You win.");
else
this.label.setText("GAME OVER." + '\n' + "You lose.");
}
@Override
//Notifies that the player requests to quit the game.
public void gameQuit() {
this.label.setText("Quit.");
}
@Override
//Notifies that the game starts.
public void gameStart(RoomInfo initialRoom, int playerPoints, int playerHealth) {
this.label.setText("Game starts.");
}
@Override
public void updateRoomInventory(RoomInfo room) {
}
@Override
public void forgetRoom() {}
@Override
public void changeRoom(Directions direction, RoomInfo targetRoom) {}
}
| [
"adri.rabadan@gmail.com"
] | adri.rabadan@gmail.com |
0aadeee1a79a14894877c336e49d60844fa8c75a | 1e78e44fb54d31f58b23b56387dc802623c4f732 | /app/src/main/java/com/yangyuan/wififileshareNio/Trans/ClientGetFileListHandler.java | 6e2d80de343c73c47d20b74bbaa37cb748800d38 | [
"Apache-2.0"
] | permissive | zhulvlong/WiFiFileShareNetty | ee3997f0482f02d665e1ec95aad3ebf1aec454b8 | c1b093678c7d849af5a913d9f4879ee9b4ba6963 | refs/heads/master | 2023-03-21T21:08:54.125840 | 2019-06-23T14:52:20 | 2019-06-23T14:52:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,194 | java | package com.yangyuan.wififileshareNio.Trans;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import com.yangyuan.wififileshareNio.BaseApplication;
import com.yangyuan.wififileshareNio.Utils.FileUtil;
import com.yangyuan.wififileshareNio.bean.FileType;
import com.yangyuan.wififileshareNio.bean.SendStatus;
import com.yangyuan.wififileshareNio.bean.ServiceFileInfo;
import com.yangyuan.wififileshareNio.sendReciver.SendStateChangedReciver;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.ArrayList;
/**
* Created by yangy on 2017/3/7.
*/
public class ClientGetFileListHandler extends Thread {
private Socket socket;
private BufferedOutputStream bufferedOutputStream;
private PrintWriter printWriter;
private String ip;
private ArrayList<ServiceFileInfo> fileInfos;
private final int bufferSize=16000;
private Handler uiHandler;
private final int SUCCESS=5;
private final int AllFINISH=6;
private final int ONEFINISH=1;
private boolean cancel=false;
private Message receiveMsg= Message.obtain();
public ClientGetFileListHandler(String ip, ArrayList<ServiceFileInfo> fileInfos, Handler uiHandler){
this.ip=ip;
this.fileInfos=fileInfos;
this.uiHandler=uiHandler;
}
@Override
public void run() {
try {
socket=new Socket(ip,60666);
printWriter=new PrintWriter(socket.getOutputStream());
DataInputStream dataInputStream=new DataInputStream(new BufferedInputStream(socket.getInputStream(),bufferSize));
String fileIdList="GetFileList";
String baseDir = Environment.getExternalStorageDirectory().getPath() + "/WifiSharingSaveDir/";
FileUtil.CreateDirAndFile(baseDir);
for (ServiceFileInfo serviceFileInfo:fileInfos){
fileIdList=fileIdList+"###"+serviceFileInfo.getUuid();
}
printWriter.println(fileIdList);
printWriter.flush();
byte[] buf = new byte[bufferSize];
for (int i=0;i<fileInfos.size();i++){
if (cancel){
printWriter.println("close");
printWriter.close();
socket.close();
dataInputStream.close();
return;
}
String fileInfoString = dataInputStream.readUTF();
String[] fileInfoStrings = fileInfoString.split("###");
long filelength = Long.parseLong(fileInfoStrings[0]);
long overplusFilelength=filelength;
String fileNameString = fileInfoStrings[1];
String filePath = baseDir+fileNameString;
if(fileInfos.get(i).getFileType()== FileType.app){
filePath = baseDir+fileInfos.get(i).getFileName()+".apk";
}
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream(filePath),bufferSize);//共耗时:1025毫秒
long start = System.currentTimeMillis();
int transCount=0;
while (true) {
if (overplusFilelength >= bufferSize) {
dataInputStream.readFully(buf);
bufferedOutputStream.write(buf, 0, bufferSize);
} else {
byte[] smallBuf = new byte[(int) overplusFilelength];
dataInputStream.readFully(smallBuf);
bufferedOutputStream.write(smallBuf);
break;
}
if (cancel){
printWriter.println("close");
bufferedOutputStream.close();
printWriter.close();
socket.close();
dataInputStream.close();
bufferedOutputStream.close();
return;
}
overplusFilelength -= bufferSize;
transCount++;
/* receiveMsg=Message.obtain();
receiveMsg.what=SUCCESS;
receiveMsg.obj = fileInfos.get(i).getUuid();
receiveMsg.arg1=(int)(100-overplusFilelength*100/filelength);
receiveMsg.arg2=(int)(filelength-overplusFilelength);
uiHandler.sendMessage(receiveMsg);*/
if(transCount==6){
receiveMsg=Message.obtain();
receiveMsg.what=SUCCESS;
receiveMsg.obj = fileInfos.get(i).getUuid();
receiveMsg.arg1=(int)(100-overplusFilelength*100/filelength);
receiveMsg.arg2=(int)(filelength-overplusFilelength);
uiHandler.sendMessage(receiveMsg);
transCount=0;
}
}
bufferedOutputStream.close();
receiveMsg=Message.obtain();
receiveMsg.what=ONEFINISH;
receiveMsg.obj = fileInfos.get(i).getUuid();
receiveMsg.arg1=100;
receiveMsg.arg2=(int)filelength;
uiHandler.sendMessage(receiveMsg);
long end = System.currentTimeMillis();
String msg1=bufferSize+" :"+"共用时"+(end-start)/1000.000000+"s";
BaseApplication.showToast(msg1);
}
receiveMsg=Message.obtain();
receiveMsg.what=AllFINISH;
receiveMsg.obj = 100;
uiHandler.sendMessage(receiveMsg);
SendStateChangedReciver.sendStatuChangedBroadcast("", SendStatus.AllFinish, 1);
printWriter.close();
dataInputStream.close();
socket.close();
}catch (Exception e){
e.printStackTrace();
}
}
public void setCancel(boolean cancel) {
this.cancel = cancel;
}
}
| [
"yangyuan@imudges.com"
] | yangyuan@imudges.com |
6ec852f46ceb6935738475e3dfbf2437fa94ba98 | 0e1b877da7aef93bce53a183afeb27ebafd68dd1 | /app/src/main/java/com/kprod/hearme/ui/recyclerview_binding/adapter/BindingRecyclerViewAdapter.java | 43504f32af794ba2fbd6e0418a8cc2ab9a67bc93 | [] | no_license | kujbol/HearMeClient | 2e24ed9d696d8c013b5586995dcf1fada6056c86 | 7aef1f3c9852406231113c27c94e6dc629d22a96 | refs/heads/master | 2021-06-02T09:34:35.802059 | 2016-06-22T07:28:37 | 2016-06-22T07:28:37 | 55,315,775 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,557 | java | package com.kprod.hearme.ui.recyclerview_binding.adapter;
import android.databinding.DataBindingUtil;
import android.databinding.ObservableArrayList;
import android.databinding.ObservableList;
import android.databinding.ViewDataBinding;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.kprod.hearme.ui.recyclerview_binding.adapter.binder.ItemBinder;
import java.lang.ref.WeakReference;
import java.util.Collection;
public class BindingRecyclerViewAdapter<T> extends RecyclerView.Adapter<BindingRecyclerViewAdapter.ViewHolder> implements View.OnClickListener, View.OnLongClickListener
{
private static final int ITEM_MODEL = -124;
private final WeakReferenceOnListChangedCallback onListChangedCallback;
private final ItemBinder<T> itemBinder;
private ObservableList<T> items;
private LayoutInflater inflater;
private ClickHandler<T> clickHandler;
private LongClickHandler<T> longClickHandler;
public BindingRecyclerViewAdapter(ItemBinder<T> itemBinder, @Nullable Collection<T> items)
{
this.itemBinder = itemBinder;
this.onListChangedCallback = new WeakReferenceOnListChangedCallback<>(this);
setItems(items);
}
public ObservableList<T> getItems()
{
return items;
}
public void setItems(@Nullable Collection<T> items)
{
if (this.items == items)
{
return;
}
if (this.items != null)
{
this.items.removeOnListChangedCallback(onListChangedCallback);
notifyItemRangeRemoved(0, this.items.size());
}
if (items instanceof ObservableList)
{
this.items = (ObservableList<T>) items;
notifyItemRangeInserted(0, this.items.size());
this.items.addOnListChangedCallback(onListChangedCallback);
}
else if (items != null)
{
this.items = new ObservableArrayList<>();
this.items.addOnListChangedCallback(onListChangedCallback);
this.items.addAll(items);
}
else
{
this.items = null;
}
}
@Override
public void onDetachedFromRecyclerView(RecyclerView recyclerView)
{
if (items != null)
{
items.removeOnListChangedCallback(onListChangedCallback);
}
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int layoutId)
{
if (inflater == null)
{
inflater = LayoutInflater.from(viewGroup.getContext());
}
ViewDataBinding binding = DataBindingUtil.inflate(inflater, layoutId, viewGroup, false);
return new ViewHolder(binding);
}
@Override
public void onBindViewHolder(ViewHolder viewHolder, int position)
{
final T item = items.get(position);
viewHolder.binding.setVariable(itemBinder.getBindingVariable(item), item);
viewHolder.binding.getRoot().setTag(ITEM_MODEL, item);
viewHolder.binding.getRoot().setOnClickListener(this);
viewHolder.binding.getRoot().setOnLongClickListener(this);
viewHolder.binding.executePendingBindings();
}
@Override
public int getItemViewType(int position)
{
return itemBinder.getLayoutRes(items.get(position));
}
@Override
public int getItemCount()
{
return items == null ? 0 : items.size();
}
@Override
public void onClick(View v)
{
if (clickHandler != null)
{
T item = (T) v.getTag(ITEM_MODEL);
clickHandler.onClick(item);
}
}
@Override
public boolean onLongClick(View v)
{
if (longClickHandler != null)
{
T item = (T) v.getTag(ITEM_MODEL);
longClickHandler.onLongClick(item);
return true;
}
return false;
}
public static class ViewHolder extends RecyclerView.ViewHolder
{
final ViewDataBinding binding;
ViewHolder(ViewDataBinding binding)
{
super(binding.getRoot());
this.binding = binding;
}
}
private static class WeakReferenceOnListChangedCallback<T> extends ObservableList.OnListChangedCallback
{
private final WeakReference<BindingRecyclerViewAdapter<T>> adapterReference;
public WeakReferenceOnListChangedCallback(BindingRecyclerViewAdapter<T> bindingRecyclerViewAdapter)
{
this.adapterReference = new WeakReference<>(bindingRecyclerViewAdapter);
}
@Override
public void onChanged(ObservableList sender)
{
RecyclerView.Adapter adapter = adapterReference.get();
if (adapter != null)
{
adapter.notifyDataSetChanged();
}
}
@Override
public void onItemRangeChanged(ObservableList sender, int positionStart, int itemCount)
{
RecyclerView.Adapter adapter = adapterReference.get();
if (adapter != null)
{
adapter.notifyItemRangeChanged(positionStart, itemCount);
}
}
@Override
public void onItemRangeInserted(ObservableList sender, int positionStart, int itemCount)
{
RecyclerView.Adapter adapter = adapterReference.get();
if (adapter != null)
{
adapter.notifyItemRangeInserted(positionStart, itemCount);
}
}
@Override
public void onItemRangeMoved(ObservableList sender, int fromPosition, int toPosition, int itemCount)
{
RecyclerView.Adapter adapter = adapterReference.get();
if (adapter != null)
{
adapter.notifyItemMoved(fromPosition, toPosition);
}
}
@Override
public void onItemRangeRemoved(ObservableList sender, int positionStart, int itemCount)
{
RecyclerView.Adapter adapter = adapterReference.get();
if (adapter != null)
{
adapter.notifyItemRangeRemoved(positionStart, itemCount);
}
}
}
public void setClickHandler(ClickHandler<T> clickHandler)
{
this.clickHandler = clickHandler;
}
public void setLongClickHandler(LongClickHandler<T> clickHandler)
{
this.longClickHandler = clickHandler;
}
} | [
"gontarczykw@student.mini.pw.edu.pl"
] | gontarczykw@student.mini.pw.edu.pl |
dfb30ed01f665dd6360cf153e1b3ec9246b1ac4c | db91f32714bbd703729db0a833b4af9a5789ade2 | /test/src/main/java/com/springmvc/pojo/User.java | e289a6724a8ce7037c11c943494242a7d19d20a1 | [] | no_license | twh930110/baogeSSM | bdfaab2ab0e2846ddefcc49a3e371f54ed908006 | 1da9901225672bf740b079266830269c69778471 | refs/heads/master | 2020-04-25T22:36:51.179162 | 2019-02-28T14:19:35 | 2019-02-28T14:19:35 | 173,117,188 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,631 | java | package com.springmvc.pojo;
import java.math.BigDecimal;
public class User {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column USERS.ID
*
* @mbggenerated Mon Jun 04 18:19:48 CST 2018
*/
private BigDecimal id;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column USERS.USERNAME
*
* @mbggenerated Mon Jun 04 18:19:48 CST 2018
*/
private String username;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column USERS.PASSWORD
*
* @mbggenerated Mon Jun 04 18:19:48 CST 2018
*/
private String password;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column USERS.AGE
*
* @mbggenerated Mon Jun 04 18:19:48 CST 2018
*/
private BigDecimal age;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column USERS.GENDER
*
* @mbggenerated Mon Jun 04 18:19:48 CST 2018
*/
private BigDecimal gender;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column USERS.ID
*
* @return the value of USERS.ID
*
* @mbggenerated Mon Jun 04 18:19:48 CST 2018
*/
public BigDecimal getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column USERS.ID
*
* @param id the value for USERS.ID
*
* @mbggenerated Mon Jun 04 18:19:48 CST 2018
*/
public void setId(BigDecimal id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column USERS.USERNAME
*
* @return the value of USERS.USERNAME
*
* @mbggenerated Mon Jun 04 18:19:48 CST 2018
*/
public String getUsername() {
return username;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column USERS.USERNAME
*
* @param username the value for USERS.USERNAME
*
* @mbggenerated Mon Jun 04 18:19:48 CST 2018
*/
public void setUsername(String username) {
this.username = username == null ? null : username.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column USERS.PASSWORD
*
* @return the value of USERS.PASSWORD
*
* @mbggenerated Mon Jun 04 18:19:48 CST 2018
*/
public String getPassword() {
return password;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column USERS.PASSWORD
*
* @param password the value for USERS.PASSWORD
*
* @mbggenerated Mon Jun 04 18:19:48 CST 2018
*/
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column USERS.AGE
*
* @return the value of USERS.AGE
*
* @mbggenerated Mon Jun 04 18:19:48 CST 2018
*/
public BigDecimal getAge() {
return age;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column USERS.AGE
*
* @param age the value for USERS.AGE
*
* @mbggenerated Mon Jun 04 18:19:48 CST 2018
*/
public void setAge(BigDecimal age) {
this.age = age;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column USERS.GENDER
*
* @return the value of USERS.GENDER
*
* @mbggenerated Mon Jun 04 18:19:48 CST 2018
*/
public BigDecimal getGender() {
return gender;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column USERS.GENDER
*
* @param gender the value for USERS.GENDER
*
* @mbggenerated Mon Jun 04 18:19:48 CST 2018
*/
public void setGender(BigDecimal gender) {
this.gender = gender;
}
} | [
"305868746@qq.com"
] | 305868746@qq.com |
d5c4d40a9a54bb3e6898d9567d0152680a2c2bd0 | 9a198ca675de0b2a581b3aee5eaa3e3f20a11c12 | /coursera/parallel/miniproject_1/src/main/java/edu/coursera/parallel/ReciprocalArraySum.java | 178f425fbd02da8fa9009e224d1bd430483033ad | [] | no_license | sandmannn/sandbox | e4d01c82633e7072b5ffb29975ba56add9e24e39 | 569ead27cbfb46af96766f1945e8cda900c329d6 | refs/heads/master | 2023-01-22T03:21:44.334295 | 2020-01-25T23:07:42 | 2020-01-25T23:07:42 | 179,581,076 | 0 | 0 | null | 2023-01-03T19:38:48 | 2019-04-04T21:38:49 | JavaScript | UTF-8 | Java | false | false | 6,918 | java | package edu.coursera.parallel;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.RecursiveAction;
/**
* Class wrapping methods for implementing reciprocal array sum in parallel.
*/
public final class ReciprocalArraySum {
/**
* Default constructor.
*/
private ReciprocalArraySum() {
}
/**
* Sequentially compute the sum of the reciprocal values for a given array.
*
* @param input Input array
* @return The sum of the reciprocals of the array input
*/
protected static double seqArraySum(final double[] input) {
double sum = 0;
// Compute sum of reciprocals of array elements
for (int i = 0; i < input.length; i++) {
sum += 1 / input[i];
}
return sum;
}
/**
* Computes the size of each chunk, given the number of chunks to create
* across a given number of elements.
*
* @param nChunks The number of chunks to create
* @param nElements The number of elements to chunk across
* @return The default chunk size
*/
private static int getChunkSize(final int nChunks, final int nElements) {
// Integer ceil
return (nElements + nChunks - 1) / nChunks;
}
/**
* Computes the inclusive element index that the provided chunk starts at,
* given there are a certain number of chunks.
*
* @param chunk The chunk to compute the start of
* @param nChunks The number of chunks created
* @param nElements The number of elements to chunk across
* @return The inclusive index that this chunk starts at in the set of
* nElements
*/
private static int getChunkStartInclusive(final int chunk,
final int nChunks, final int nElements) {
final int chunkSize = getChunkSize(nChunks, nElements);
return chunk * chunkSize;
}
/**
* Computes the exclusive element index that the provided chunk ends at,
* given there are a certain number of chunks.
*
* @param chunk The chunk to compute the end of
* @param nChunks The number of chunks created
* @param nElements The number of elements to chunk across
* @return The exclusive end index for this chunk
*/
private static int getChunkEndExclusive(final int chunk, final int nChunks,
final int nElements) {
final int chunkSize = getChunkSize(nChunks, nElements);
final int end = (chunk + 1) * chunkSize;
if (end > nElements) {
return nElements;
} else {
return end;
}
}
/**
* This class stub can be filled in to implement the body of each task
* created to perform reciprocal array sum in parallel.
*/
private static class ReciprocalArraySumTask extends RecursiveAction {
/**
* Starting index for traversal done by this task.
*/
private final int startIndexInclusive;
/**
* Ending index for traversal done by this task.
*/
private final int endIndexExclusive;
/**
* Input array to reciprocal sum.
*/
private final double[] input;
/**
* Intermediate value produced by this task.
*/
private double value;
/**
* Constructor.
* @param setStartIndexInclusive Set the starting index to begin
* parallel traversal at.
* @param setEndIndexExclusive Set ending index for parallel traversal.
* @param setInput Input values
*/
ReciprocalArraySumTask(final int setStartIndexInclusive,
final int setEndIndexExclusive, final double[] setInput) {
this.startIndexInclusive = setStartIndexInclusive;
this.endIndexExclusive = setEndIndexExclusive;
this.input = setInput;
}
/**
* Getter for the value produced by this task.
* @return Value produced by this task
*/
public double getValue() {
return value;
}
@Override
protected void compute() {
if (endIndexExclusive - startIndexInclusive < 400){
for (int i = startIndexInclusive; i< endIndexExclusive;i++)
value += 1/input[i];
return;
}
int m = (startIndexInclusive + endIndexExclusive)/2;
ReciprocalArraySumTask t1 = new ReciprocalArraySumTask(startIndexInclusive, m, input);
ReciprocalArraySumTask t2 = new ReciprocalArraySumTask(m, endIndexExclusive, input);
t1.fork();
// t2.fork();
t2.compute();
t1.join();
value = t1.value + t2.value;
// value = 50;
// TODO
}
}
/**
* TODO: Modify this method to compute the same reciprocal sum as
* seqArraySum, but use two tasks running in parallel under the Java Fork
* Join framework. You may assume that the length of the input array is
* evenly divisible by 2.
*
* @param input Input array
* @return The sum of the reciprocals of the array input
*/
protected static double parArraySum(final double[] input) {
assert input.length % 2 == 0;
ReciprocalArraySumTask t = new ReciprocalArraySumTask(0, input.length, input);
ForkJoinPool.commonPool().execute(t);
t.join();
return t.value;
}
/**
* TODO: Extend the work you did to implement parArraySum to use a set
* number of tasks to compute the reciprocal array sum. You may find the
* above utilities getChunkStartInclusive and getChunkEndExclusive helpful
* in computing the range of element indices that belong to each chunk.
*
* @param input Input array
* @param numTasks The number of tasks to create
* @return The sum of the reciprocals of the array input
*/
protected static double parManyTaskArraySum(final double[] input,
final int numTasks) {
double sum = 0;
int n = input.length;
ForkJoinPool pool = new ForkJoinPool(4);
// ForkJoinPool.commonPool().invoke(t);
ArrayList<ReciprocalArraySumTask> a = new ArrayList<>();
for (int i = 0;i<numTasks;i++) {
int start = i*(n/numTasks);
int end = (i+1) * (n/numTasks);
if (i == numTasks-1) end = n;
ReciprocalArraySumTask t = new ReciprocalArraySumTask(start,
end, input);
// ForkJoinPool.commonPool().invoke(t);
// pool.invoke(t);
pool.execute(t);
a.add(t);
}
double res = 0;
for (ReciprocalArraySumTask t: a) {
t.join();
res += t.value;
}
return res;
}
}
| [
"bohdanpukalskyi@gmail.com"
] | bohdanpukalskyi@gmail.com |
c1d4d3cfceac2d222d00f5b2396a0c74c4b1ce8e | 9e36760441301b9eead3e571d82fbcc53cfe768c | /eshop/src/test/java/cz/tnpwteam/DaoTest.java | c3871087c644faf4541da4fc5b48db9ec4f660ad | [] | no_license | zoubass/TNPW | 53c66b59c3422954c3a030ae540d60066b1a805d | b45a864f82ecd56282dcf5ad25f7778919c73b44 | refs/heads/master | 2021-01-21T14:43:43.001826 | 2017-03-14T18:51:15 | 2017-03-14T18:51:15 | 56,624,713 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 948 | java | package cz.tnpwteam;
import com.google.common.collect.Lists;
import cz.tnpwteam.dao.UserRepository;
import cz.tnpwteam.model.User;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;
/**
* Created by Admin on 12.4.2016.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:META-INF/spring/application-context.xml")
public class DaoTest {
@Autowired
private UserRepository userRepo;
@Test
public void testConnection() {
Assert.assertNotNull(userRepo);
Iterable<User> users = userRepo.findAll();
List<User> userList = Lists.newArrayList(users);
Assert.assertTrue(userList.size() > 0);
}
} | [
"zoubas@seznam.cz"
] | zoubas@seznam.cz |
3839a8f54d46f17384da1d6d8211f63eeaa47a23 | 8ae1d0202278eb17ca6fca7f8cf36fd56aabbc88 | /concurrent/src/main/java/zj/lock/readwrite/PriceInfo.java | 48e4f03185d8cc5cf37bbb2139d7c11dbd9101d9 | [
"Apache-2.0"
] | permissive | hqq2023623/notes | d077628dbe90ccb064e8df2efb9ddf13a1bad7d8 | 490f09f19d25af313409ad6524c4a621beddbfbe | refs/heads/master | 2021-01-18T23:55:22.881340 | 2017-11-02T23:06:52 | 2017-11-02T23:06:52 | 47,523,491 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,112 | java | package zj.lock.readwrite;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
/**
* @author Lzj Created on 2016/3/17.
*/
public class PriceInfo {
private double price1;
private double price2;
//读写锁
private ReadWriteLock lock;
public PriceInfo() {
price1 = 1.0;
price2 = 2.0;
lock = new ReentrantReadWriteLock();
}
//获取price1
public double getPrice1() {
//读锁
lock.readLock().lock();
double value = price1;
//记得释放锁
lock.readLock().unlock();
return value;
}
//获取price2
public double getPrice2() {
//读锁
lock.readLock().lock();
double value = price2;
//记得释放锁
lock.readLock().unlock();
return value;
}
public void setPrices(double price1, double price2) {
//写锁
lock.writeLock().lock();
this.price1 = price1;
this.price2 = price2;
//记得释放锁
lock.writeLock().unlock();
}
}
| [
"371209704@qq.com"
] | 371209704@qq.com |
069e6c6ca7948fcd938be7afa82ef2549702e01d | ec201761fa0e144844fae66f521bc5f7962b72f2 | /app/src/main/java/com/example/han/referralproject/activity/AlertHeightActivity.java | c7d5a2bb5c78d72c705797572080787cf6b82c11 | [] | no_license | dcy000/ML-Xien | d5a33fa2bd120edd4293e9db2a7390ba0f5512e8 | ed149f396f96892e2d8713bc9a0cc9b80e142124 | refs/heads/master | 2020-04-16T01:53:46.044860 | 2019-06-24T10:32:23 | 2019-06-24T10:32:23 | 165,189,688 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,836 | java | package com.example.han.referralproject.activity;
import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;
import com.example.han.referralproject.R;
import com.example.han.referralproject.application.MyApplication;
import com.example.han.referralproject.network.NetworkApi;
import com.example.han.referralproject.network.NetworkManager;
import com.example.han.referralproject.util.LocalShared;
import com.example.han.referralproject.util.ToastTool;
import com.gzq.lib_core.bean.UserInfoBean;
import com.medlink.danbogh.register.SelectAdapter;
import com.medlink.danbogh.utils.T;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import github.hellocsl.layoutmanager.gallery.GalleryLayoutManager;
public class AlertHeightActivity extends BaseActivity {
@BindView(R.id.tv_sign_up_height)
TextView tvSignUpHeight;
@BindView(R.id.rv_sign_up_content)
RecyclerView rvSignUpContent;
@BindView(R.id.tv_sign_up_unit)
TextView tvSignUpUnit;
@BindView(R.id.tv_sign_up_go_back)
TextView tvSignUpGoBack;
@BindView(R.id.tv_sign_up_go_forward)
TextView tvSignUpGoForward;
protected int selectedPosition = 1;
protected SelectAdapter adapter;
protected ArrayList<String> mStrings;
protected UserInfoBean data;
protected String eat = "", smoke = "", drink = "", exercise = "";
protected StringBuffer buffer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_alert_height);
ButterKnife.bind(this);
mToolbar.setVisibility(View.VISIBLE);
mTitleText.setText("修改身高");
tvSignUpGoBack.setText("取消");
tvSignUpGoForward.setText("确定");
data = (UserInfoBean) getIntent().getSerializableExtra("data");
buffer = new StringBuffer();
if (data != null) {
initView();
}
}
protected void initView() {
if (data==null){
return;
}
if (!TextUtils.isEmpty(data.eatingHabits)) {
switch (data.eatingHabits) {
case "荤素搭配":
eat = "1";
break;
case "偏好吃荤":
eat = "2";
break;
case "偏好吃素":
eat = "3";
break;
case "偏好吃咸":
break;
case "偏好油腻":
break;
case "偏好甜食":
break;
}
}
if (!TextUtils.isEmpty(data.smoke)) {
switch (data.smoke) {
case "经常抽烟":
smoke = "1";
break;
case "偶尔抽烟":
smoke = "2";
break;
case "从不抽烟":
smoke = "3";
break;
}
}
if (!TextUtils.isEmpty(data.drink)) {
switch (data.drink) {
case "经常喝酒":
smoke = "1";
break;
case "偶尔喝酒":
smoke = "2";
break;
case "从不喝酒":
smoke = "3";
break;
}
}
if (!TextUtils.isEmpty(data.exerciseHabits)) {
switch (data.exerciseHabits) {
case "每天一次":
exercise = "1";
break;
case "每周几次":
exercise = "2";
break;
case "偶尔运动":
exercise = "3";
break;
case "从不运动":
exercise = "4";
break;
}
}
if ("尚未填写".equals(data.mh)) {
buffer = null;
} else {
String[] mhs = data.mh.split("\\s+");
for (int i = 0; i <mhs.length; i++) {
if (mhs[i].equals("高血压"))
buffer.append(1 + ",");
else if (mhs[i].equals("糖尿病"))
buffer.append(2 + ",");
else if (mhs[i].equals("冠心病"))
buffer.append(3 + ",");
else if (mhs[i].equals("慢阻肺"))
buffer.append(4 + ",");
else if (mhs[i].equals("孕产妇"))
buffer.append(5 + ",");
else if (mhs[i].equals("痛风"))
buffer.append(6 + ",");
else if (mhs[i].equals("甲亢"))
buffer.append(7 + ",");
else if (mhs[i].equals("高血脂"))
buffer.append(8 + ",");
else if (mhs[i].equals("其他"))
buffer.append(9 + ",");
}
}
tvSignUpUnit.setText("cm");
GalleryLayoutManager layoutManager = new GalleryLayoutManager(GalleryLayoutManager.VERTICAL);
layoutManager.attach(rvSignUpContent, selectedPosition);
layoutManager.setCallbackInFling(true);
layoutManager.setOnItemSelectedListener(new GalleryLayoutManager.OnItemSelectedListener() {
@Override
public void onItemSelected(RecyclerView recyclerView, View item, int position) {
selectedPosition = position;
select(mStrings == null ? String.valueOf(position) : mStrings.get(position));
}
});
adapter = new SelectAdapter();
adapter.setStrings(getStrings());
adapter.setOnItemClickListener(new SelectAdapter.OnItemClickListener() {
@Override
public void onItemClick(View view, int position) {
rvSignUpContent.smoothScrollToPosition(position);
}
});
rvSignUpContent.setAdapter(adapter);
}
protected List<String> getStrings() {
mStrings = new ArrayList<>();
for (int i = 150; i < 200; i++) {
mStrings.add(String.valueOf(i));
}
return mStrings;
}
private void select(String text) {
T.show(text);
}
protected int geTip() {
return R.string.sign_up_height_tip;
}
@OnClick(R.id.tv_sign_up_go_back)
public void onTvGoBackClicked() {
finish();
}
@OnClick(R.id.tv_sign_up_go_forward)
public void onTvGoForwardClicked() {
final String height = mStrings.get(selectedPosition);
NetworkApi.alertBasedata(MyApplication.getInstance().userId, height, data.weight, eat, smoke, drink, exercise,
buffer == null ? "" : buffer.substring(0, buffer.length() - 1), data.dz, new NetworkManager.SuccessCallback<Object>() {
@Override
public void onSuccess(Object response) {
LocalShared.getInstance(AlertHeightActivity.this).setUserHeight(height);
ToastTool.showShort("修改成功");
speak("您好,您的身高已经修改为" + height + "厘米");
}
}, new NetworkManager.FailedCallback() {
@Override
public void onFailed(String message) {
// ToastTool.showShort(message);
// speak("您好,出了一些小问题,未修改成功");
}
});
}
@Override
protected void onActivitySpeakFinish() {
finish();
}
}
| [
"774550196@qq.com"
] | 774550196@qq.com |
d8a1a59de82fdc6d2f1dde8169bfb4bfffc0f846 | e380f8ba62adba89f864bf4a22e5c35e89947e6d | /webmanager/src/main/java/pl/pawc/webmanager/dao/password/PasswordDAO.java | afbd51199e3bc33a29a28a153f62d8c9663f7b39 | [] | no_license | pingwin89/WebManager | c300bbb352a3831fa9ee539948fc2f41e4a7b2b7 | ca02c172ff16b15ec52d407f15ff5fab82cb6a2a | refs/heads/master | 2021-06-20T21:17:13.390445 | 2017-07-29T14:13:18 | 2017-07-29T14:13:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 322 | java | package pl.pawc.webmanager.dao.password;
import java.util.Set;
import pl.pawc.security.model.Password;
public interface PasswordDAO {
public Password getPassword(String login);
public int insertPassword(Password password);
public int updatePassword(String login);
public int deletePassword(Set<String> logins);
} | [
"pswid89@gmail.com"
] | pswid89@gmail.com |
8986b266a9b3e38b3a4c691fdee76588637b1d5a | 0f5bed776a77919953b159f89522b3e3513d7419 | /src/main/java/com/springboot/Cd8Controller.java | b60bb19d396f18e27a4edfbe48d8f9283d358583 | [] | no_license | spring-team/cd8 | 6012cb503c8419ca5abcb9827973724931253eaf | 810f5b98adb54e411f6661352dc2852f8566a2c2 | refs/heads/master | 2021-04-09T14:53:45.436025 | 2018-03-24T04:18:51 | 2018-03-24T04:18:51 | 125,762,759 | 0 | 0 | null | 2018-04-05T01:10:07 | 2018-03-18T20:01:41 | Shell | UTF-8 | Java | false | false | 631 | java | package com.springboot;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
@RestController
class Cd8Controller {
@RequestMapping(method = GET, path = "/")
public String root() {
return "App running: Served from " + getClass().getName();
}
@RequestMapping(method = GET, path = "hello/{name}")
public String person(@PathVariable String name) {
return "Hello " + name + "!";
}
}
| [
"cd@atomist.com"
] | cd@atomist.com |
45212c62701fc82edd896c28cb259a27d8764487 | 2f1f883b88c35fbdd7bcdad42b364df465f61279 | /ses-app/ses-mobile-rps/src/main/java/com/redescooter/ses/mobile/rps/service/base/impl/OpeInWhouseOrderServiceImpl.java | 362ca94abfa78385cce1a90fbfdd997e97117c85 | [
"MIT"
] | permissive | RedElect/ses-server | bd4a6c6091d063217655ab573422f4cf37c8dcbf | 653cda02110cb31a36d8435cc4c72e792467d134 | refs/heads/master | 2023-06-19T16:16:53.418793 | 2021-07-19T09:19:25 | 2021-07-19T09:19:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,281 | java | package com.redescooter.ses.mobile.rps.service.base.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.redescooter.ses.mobile.rps.dao.base.OpeInWhouseOrderMapper;
import com.redescooter.ses.mobile.rps.dm.OpeInWhouseOrder;
import org.springframework.stereotype.Service;
import com.redescooter.ses.mobile.rps.service.base.OpeInWhouseOrderService;
import java.util.List;
/**
* @author assert
* @date 2021/1/18 10:46
*/
@Service
public class OpeInWhouseOrderServiceImpl extends ServiceImpl<OpeInWhouseOrderMapper, OpeInWhouseOrder>
implements OpeInWhouseOrderService {
@Override
public int updateBatch(List<OpeInWhouseOrder> list) {
return baseMapper.updateBatch(list);
}
@Override
public int updateBatchSelective(List<OpeInWhouseOrder> list) {
return baseMapper.updateBatchSelective(list);
}
@Override
public int batchInsert(List<OpeInWhouseOrder> list) {
return baseMapper.batchInsert(list);
}
@Override
public int insertOrUpdate(OpeInWhouseOrder record) {
return baseMapper.insertOrUpdate(record);
}
@Override
public int insertOrUpdateSelective(OpeInWhouseOrder record) {
return baseMapper.insertOrUpdateSelective(record);
}
}
| [
"assert@redescooter.com"
] | assert@redescooter.com |
57c4af4173e77d11cce2ee8b976f21228f114d99 | 87439eca78b8237ffb8d0c7012ecf5d12e30d5e9 | /src/main/java/com/bz/controller/TestController.java | d7d778c48a25425b7bea8a7d0f236925e5a77ee7 | [] | no_license | liusong-cn/smart-building | c2e7667961bf84859f89498d68130f49ed74010d | 7e99197ae27f4c5684475aa0e9531967c26892ec | refs/heads/master | 2023-02-04T07:47:13.004935 | 2020-10-07T03:17:07 | 2020-10-07T03:17:07 | 298,986,181 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,780 | java | package com.bz.controller;
import cn.hutool.json.JSONObject;
import com.bz.common.entity.R;
import com.bz.common.entity.Result;
import com.bz.common.entity.SimpleObj1;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
/**
* @author:ls
* @date: 2020/9/24 17:27
**/
@RestController
@Slf4j
public class TestController {
@GetMapping("/hello")
public String hello(){
log.info("你好");
log.warn("warn");
log.error("error");
return "hello, world";
}
@GetMapping("/path")
public JSONObject path(HttpServletRequest req){
String contextPath = req.getContextPath();
String servletPath = req.getServletPath();
String pathInfo = req.getPathInfo();
JSONObject jsonObject = new JSONObject();
jsonObject.put("contextPath",contextPath);
jsonObject.put("servletPath",servletPath);
jsonObject.put("pathInfo",pathInfo);
return jsonObject;
}
//测试以string形式返回
@GetMapping("/res")
public Result<String> responseTest(){
//成功返回带数据
Result<String> r = new Result<>(R.SUCCESS,"good",1);
return r;
}
//测试返回list
@GetMapping("/list")
public Result<List> responseWithList(){
List<SimpleObj1> simpleObj1s = new ArrayList<>();
simpleObj1s.add(new SimpleObj1(13,"zhangsan","114@qq.com","13158392932"));
simpleObj1s.add(new SimpleObj1(14,"lisi","114@qq.com","13158392932"));
Result<List> r1 = new Result<>(R.SUCCESS, simpleObj1s,2);
return r1;
}
}
| [
"1141185877@qq.com"
] | 1141185877@qq.com |
aadb4a38d7f7c8607bd774d5fc3a78c3f273d07c | c2a3e628c12cdb8bd5c989ff061395af8af93af7 | /app/src/main/java/com/example/android/creationsmp/pieces/PieceEditDetailActivity.java | e6439940d804962eace50141a2118a13c723eddf | [] | no_license | sylvain-gdk/projet-Bracelet | 306d2e2cf07b21d0232ade76a585421700e9e6ef | 974e34e012d235fc34a762e380fbc7065b353fa9 | refs/heads/master | 2020-12-02T19:32:23.421356 | 2018-07-14T20:39:36 | 2018-07-14T20:39:36 | 96,356,424 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,442 | java | package com.example.android.creationsmp.pieces;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.design.widget.Snackbar;
import android.support.v4.content.FileProvider;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;
import com.example.android.creationsmp.R;
import org.greenrobot.eventbus.EventBus;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import static com.example.android.creationsmp.R.id.codePiece_text;
/**
* Created by sylvain on 2017-04-10.
* This class is where the objects Pieces are created/modified
*/
public class PieceEditDetailActivity extends AppCompatActivity {
// The request code for the picture of the object Pieces
static final int REQUEST_TAKE_PHOTO = 5;
// Accesses the GestionPieces class
private GestionPieces mGestionPieces;
// Accesses the GestionTypePieces class
private GestionTypePieces mGestionTypePieces;
// Accesses the Pieces class
private Pieces mPiece;
// The object's position in the collection
private int mPositionClicked;
// The picture of an object Pieces
private File mPhotoPiece = null;
private EditText mNomPiece, mDescriptionPiece, mDimensionPiece, mPrixCoutantPiece, mQtyPiece;
private TextView mCodePiece;
private Spinner mTypePieceSpinner, mCategorieSpinner;
private TypePieces mTypePiece;
private Categories mCategorie;
// The position in the spinners
private int mTypePiecePos;
private int mCatPiecePos;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_piece_edit);
// Sets the details of the object Pieces
mCodePiece = (TextView) findViewById(codePiece_text);
mNomPiece = (EditText) findViewById(R.id.nomPiece_edit);
mDescriptionPiece = (EditText) findViewById(R.id.descriptionPiece_edit);
mDimensionPiece = (EditText) findViewById(R.id.dimensionPiece_edit);
mPrixCoutantPiece = (EditText) findViewById(R.id.prixCoutantPiece_edit);
mQtyPiece = (EditText) findViewById(R.id.qtyPiece_edit);
mTypePieceSpinner = (Spinner) findViewById(R.id.typePiece_edit);
mCategorieSpinner = (Spinner) findViewById(R.id.categoriePiece_edit);
// Gets the collection and object's position from an intent
Intent intent = getIntent();
mPositionClicked = intent.getIntExtra("position", -1);
mGestionPieces = (GestionPieces) intent.getSerializableExtra("mGestionPieces");
mGestionTypePieces = (GestionTypePieces) intent.getSerializableExtra("mGestionTypePieces");
// Sets text on EditText fields from an intent (PieceViewDetailFragment)
mPiece = mGestionPieces.getInventairePieces().get(mPositionClicked);
mTypePiece = mPiece.getTypePiece();
mCategorie = mPiece.getCategoriePiece();
mCodePiece.setText(String.valueOf("#" + mPiece.getCodePiece()));
mNomPiece.setText(mPiece.getNomPiece(), TextView.BufferType.EDITABLE);
mDescriptionPiece.setText(mPiece.getDescriptionPiece(), TextView.BufferType.EDITABLE);
mDimensionPiece.setText(String.valueOf(mPiece.getDimensionPiece()), TextView.BufferType.EDITABLE);
mPrixCoutantPiece.setText(String.valueOf(String.valueOf(mPiece.getPrixCoutantPiece())), TextView.BufferType.EDITABLE);
mQtyPiece.setText(String.valueOf(mPiece.getQtyPiece()), TextView.BufferType.EDITABLE);
mPhotoPiece = mPiece.getPhotoPiece();
if(mPhotoPiece != null){
onActivityResult(REQUEST_TAKE_PHOTO, RESULT_OK, intent);
}
addItemsToTypeSpinner();
addListenerToTypeSpinner();
}
/**
* Adds items to the TypePieceSpinner
*/
private void addItemsToTypeSpinner() {
ArrayAdapter<TypePieces> typeSpinnerAdapter =
new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, mGestionTypePieces.getCollectionTypePieces());
typeSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mTypePieceSpinner.setAdapter(typeSpinnerAdapter);
mTypePieceSpinner.setSelection(mGestionTypePieces.getCollectionTypePieces().indexOf(mPiece.getTypePiece()));
}
/**
* Adds a listener to the TypePieceSpinner
*/
private void addListenerToTypeSpinner() {
// Sets the TypePieces on item selection
mTypePieceSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int pos, long l) {
mTypePiece = (TypePieces) adapterView.getItemAtPosition(pos);
addItemsToCategorieSpinner();
addListenerToCategorieSpinner();
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
mTypePiece = null;
}
});
}
/**
* Adds items to the CategorieSpinner
*/
private void addItemsToCategorieSpinner() {
ArrayAdapter<Categories> categorieSpinnerAdapter =
new ArrayAdapter<>(this, android.R.layout.simple_spinner_item,
mGestionTypePieces.getCollectionTypePieces().get(mGestionTypePieces.getCollectionTypePieces().indexOf(mTypePiece)).getCollectionCategories());
categorieSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mCategorieSpinner.setAdapter(categorieSpinnerAdapter);
mCategorieSpinner.setSelection(mGestionTypePieces.getCollectionCategories().indexOf(mPiece.getTypePiece().getCollectionCategories().indexOf(mPiece.getCategoriePiece())));
}
/**
* Adds a listener to the CategorieSpinner
*/
private void addListenerToCategorieSpinner() {
// Sets the Categorie on item selection
mCategorieSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int pos, long l) {
mCategorie = (Categories) adapterView.getItemAtPosition(pos);
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
mCategorie = null;
}
});
}
/**
* Creates the intent of taking a picture
*/
private void takePictureIntent(){
Intent photoIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
// Ensure that there's a camera activity to handle the intent
if (photoIntent.resolveActivity(getPackageManager()) != null) {
File photoFile = null;
try {
mPhotoPiece = createImageFile();
} catch (IOException ex) {
Log.v("Error taking picture", String.valueOf(ex));
}
// Continue only if the File was successfully created
if (mPhotoPiece != null) {
Uri photoUri = FileProvider.getUriForFile(this, "com.example.android.fileprovider", mPhotoPiece);
photoIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);
startActivityForResult(photoIntent, REQUEST_TAKE_PHOTO);
}
}
}
/**
* Formats the image taken by the camera
* @return the image taken by the camera
* @throws IOException
*/
private File createImageFile() throws IOException {
// The path to store pictures taken from the camera
String photoPath;
// Create an image file name
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_";
File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);
File image = File.createTempFile(
imageFileName, /* prefix */
".jpg", /* suffix */
storageDir /* directory */
);
// Saves a file: path for use with ACTION_VIEW intents
photoPath = image.getAbsolutePath();
return image;
}
/**
* Button to take a picture
* @param view the view
*/
public void prendrePhotoListener(View view){
takePictureIntent();
}
/**
* Creates a scaled down version of the picture
* @param mCurrentPhotoPath the path of the picture
* @param mImageView the ImageView to place the picture
* @return scaled down version of the picture
*/
private Bitmap setResizedPhotoPiece(String mCurrentPhotoPath, ImageView mImageView) {
// Get the dimensions of the bitmap
BitmapFactory.Options bmOptions = new BitmapFactory.Options();
bmOptions.inJustDecodeBounds = true;
// Determine how much to scale down the image
int scaleFactor = 16;
// Decode the image file into a Bitmap sized to fill the View
bmOptions.inJustDecodeBounds = false;
bmOptions.inSampleSize = scaleFactor;
bmOptions.inPurgeable = true;
Bitmap bitmap = BitmapFactory.decodeFile(mCurrentPhotoPath, bmOptions);
mImageView.setImageBitmap(bitmap);
return bitmap;
}
/**
* Sets a thumbnail of the picture taken by the camera from an intent
* @param requestCode the requested code
* @param resultCode the result code
* @param data the intent
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
ImageView photoPieceThumb = (ImageView) this.findViewById(R.id.cameraIcon);
if (requestCode == REQUEST_TAKE_PHOTO && resultCode == RESULT_OK) {
setResizedPhotoPiece(mPhotoPiece.getAbsolutePath(), photoPieceThumb);
}
}
/**
* Button to add the new object Pieces to the collection
* tests if each entries are valid
* @param view the view
*/
public void modifierPieceListener(View view) {
Pieces piece = new Pieces();
// Field validation
try {
if (!piece.setNomPiece(mNomPiece.getText().toString())) {
showErrorHighlightField("La nom est trop long (max 20 char.)", mNomPiece);
} else if (!piece.setDescriptionPiece(mDescriptionPiece.getText().toString())) {
showErrorHighlightField("La description est trop longue (max 64 char.)", mDescriptionPiece);
} else if (!piece.setDimensionPiece(Integer.parseInt(mDimensionPiece.getText().toString()))) {
showErrorHighlightField("La dimension doit être entre 4 et 15 mm", mDimensionPiece);
} else if (!piece.setPrixCoutantPiece(Double.parseDouble(mPrixCoutantPiece.getText().toString()))) {
showErrorHighlightField("Le prix ne peut être 0 et doit être au format 0.00", mPrixCoutantPiece);
} else{
piece.setCodePiece(this.mPiece.getCodePiece());
piece.setQtyPiece(Integer.parseInt(mQtyPiece.getText().toString()));
piece.setTypePiece(mTypePiece);
piece.setCategoriePiece(mCategorie);
if (mPhotoPiece != null)
piece.setPhotoPiece(mPhotoPiece);
Intent intent = new Intent();
intent.putExtra("requestCode", EventManager.REQUEST_MODIFY_PIECE);
intent.putExtra("resultCode", RESULT_OK);
intent.putExtra("piece", piece);
intent.putExtra("position", mPositionClicked);
intent.putExtra("mGestionPieces", mGestionPieces);
EventBus.getDefault().post(new EventManager.EventIntentController(intent));
finish();
}
} catch (NumberFormatException | StringIndexOutOfBoundsException e) {
// Shows the error on screen with Snackbar
Snackbar.make(view, "Vous devez remplir tous les champs", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
}
/**
* Selects the field where an error happened and makes the keyboard visible
* @param error the error that was triggered
* @param textField the field where the error happened
*/
private void showErrorHighlightField(String error, EditText textField){
textField.requestFocus();
textField.setError(error);
InputMethodManager im = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE);
if (im != null) {
// Will only trigger if no physical keyboard is open
im.showSoftInput(textField, 0);
}
}
/**
* Button to cancel
* Returns to the main activity on cancel
* @param view the view
*/
public void annulerAjouterPieceListener(View view) {
finish();
}
} | [
"sgoedike@videotron.ca"
] | sgoedike@videotron.ca |
0a840b9df151ffed4418d1cd8a850d2ea972455b | a0cda95f27e0d8ea781e0663cf10f11afa39f405 | /src/main/java/pl/Korty/Korty/model/responses/AddressRestModel.java | 2da24cda6ea3dbb230aa381bd093a81d9e2977db | [] | no_license | grzesti868/Court-Reservation-Java-Spring | 57c705329e0bfda82fda95c133fd7fb49f1f2690 | 547b6e4b42a98444d706c12a34842bbad0fb0354 | refs/heads/master | 2022-12-18T23:35:05.687653 | 2020-10-02T19:04:47 | 2020-10-02T19:04:47 | 293,565,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,193 | java | package pl.Korty.Korty.model.responses;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;
import pl.Korty.Korty.model.entities.AddressesEntity;
@Getter
@ToString
@EqualsAndHashCode
@NoArgsConstructor
public class AddressRestModel {
private String street;
private Integer building_num;
private Integer apartment_num;
private String city;
private String postal_code;
private String country;
public AddressRestModel(String street, Integer building_num, Integer apartment_num, String city, String postal_code, String country) {
this.street = street;
this.building_num = building_num;
this.apartment_num = apartment_num;
this.city = city;
this.postal_code = postal_code;
this.country = country;
}
public AddressRestModel(final AddressesEntity entity) {
this.street = entity.getStreet();
this.building_num = entity.getBuilding_num();
this.apartment_num = entity.getApartment_num();
this.city = entity.getCity();
this.postal_code = entity.getPostal_code();
this.country = entity.getCountry();
}
}
| [
"gregustich@gmail.com"
] | gregustich@gmail.com |
7e9e34d7e16a7ee64dfbc2faf62a1bb4404a4fab | f491c9f7fe2a68567b5cdfdae9d23cac3be73db6 | /src/main/java/warehouse/repositories/GoodsReminderRepository.java | e475e6ea2e01adb39a2e5bc4c41ed273b302c192 | [] | no_license | klyuchevsky/warehouse | 6aae269f1391b18df49b185a7033e53d57624ed5 | 63a547f8a3eea055cc9add03911b110e609172e6 | refs/heads/master | 2021-01-01T17:48:20.296713 | 2017-07-24T06:53:48 | 2017-07-24T06:53:48 | 98,158,168 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 407 | java | package warehouse.repositories;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import warehouse.domain.Goods;
import warehouse.domain.GoodsReminder;
import java.util.Optional;
@Repository
public interface GoodsReminderRepository extends CrudRepository<GoodsReminder, Long> {
Optional<GoodsReminder> getByGoodsArticle(String article);
}
| [
"klyuchevsky@brooma.ru"
] | klyuchevsky@brooma.ru |
ff9fe66f4de42afc6468be152e2a4382787e4e0c | 57189aa5fc26be8cf42bfe15c60e6bcb0406120c | /app/src/main/java/com/example/tourguide/FragmentAdapter.java | 1ab20563e7c47e511376e61bab16343f35fcf070 | [] | no_license | ritik-keshri/Tour-Guide | e34c909ff1d029dbdc2b052e2e3273a56293b5cd | 53e10b143b71d04055db9f54fdbee0154bf56f2a | refs/heads/master | 2023-05-09T01:16:32.769101 | 2021-06-02T13:55:06 | 2021-06-02T13:55:06 | 372,919,235 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,367 | java | package com.example.tourguide;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
public class FragmentAdapter extends FragmentPagerAdapter {
private Context context;
public FragmentAdapter(Context context, @NonNull FragmentManager fm) {
super(fm);
this.context = context;
}
@NonNull
@Override
public Fragment getItem(int position) {
if (position == 0)
return new PlaceFragment();
else if (position == 1)
return new RestaurantFragment();
else if (position == 2)
return new FoodFragment();
else
return new ShoppingFragment();
}
@Override
public int getCount() {
return 4;
}
@Nullable
@Override
public CharSequence getPageTitle(int position) {
if (position == 0)
return context.getString(R.string.place_category);
else if (position == 1)
return context.getString(R.string.restaurant_category);
else if (position == 2)
return context.getString(R.string.food_category);
else
return context.getString(R.string.shopping_category);
}
}
| [
"ritikkeshri@gmail.com"
] | ritikkeshri@gmail.com |
509e81bf0a72ee9f5f02f0688568ee9211cad4ed | 44541ffb528133f0ef04352992315faf55fb0b25 | /RecruitmentAdmin/src/main/java/com/macauslot/recruitmentadmin/dto/UserPO.java | d974d6aaa68c6121c2affb0a69207037ff0ede3d | [] | no_license | JohnnyMacau/SPRING | 57cba27b61fe1828a64c54b66920beef2e6d95d1 | 41bfaa14675edb00d6b539152f7bb5c0f4eb9293 | refs/heads/main | 2023-07-09T03:06:41.017449 | 2021-08-12T14:51:35 | 2021-08-12T14:51:35 | 394,017,643 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,140 | java | package com.macauslot.recruitmentadmin.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/*
* SELECT
* CASE
* WHEN PASSWORD_MODIFY_DATE IS NULL
* OR UNIX_TIMESTAMP(PASSWORD_MODIFY_DATE) + 90 * 60 * 60 * 24 < UNIX_TIMESTAMP(CURRENT_TIMESTAMP) THEN
* 1
* ELSE
* 0
* END EXPIRED,
* IFNULL(email, '') email,
* STATUS,
* ec. NAME,
* ec.phone,
* ec.relation_ship
* FROM
* USER
* LEFT JOIN EMERGENCY_CONTACT ec ON USER .id = ec.user_id
* WHERE
* USER_NAME = 80653
* AND PASSWORD = 'e99a18c428cb38d5f260853678922e03'
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserPO implements Converter<UserPO> {
private Object expired;
private String email;
private Character status;
private String employeeId;
private String deptCode;
private String name;
private String relativeName;
private String phone;
private String relationShip;
private String remark;
@Override
public UserPO convertToVO() {
this.setRelativeName(null);
this.setRelationShip(null);
this.setPhone(null);
return this;
}
}
| [
"23758436@qq.com"
] | 23758436@qq.com |
258870f3923cb46aef4d66a61a7160d20fcc8726 | 9cb4b22d00ea89b5f98a44cfa711ddb8f8e57837 | /Homework_Assignment_7/src/userinterface/AdministrativeRole/AdminWorkAreaJPanel.java | 7e9d4dc86c0bc0a55e640db0f274b4f025206149 | [] | no_license | vikram911/AED-Assignments | 234e6a2dfb7ecd983b0bd3c568a24dc23a418102 | 0e5565910ec33fb373931c844a7aa0e99594bdf3 | refs/heads/master | 2020-03-18T10:41:33.977553 | 2018-05-23T21:41:46 | 2018-05-23T21:41:46 | 134,608,621 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,436 | java | /*
* AdminWorkAreaJPanel.java
*
* Created on October 10, 2008, 8:50 AM
*/
package UserInterface.AdministrativeRole;
import Business.Enterprise.Enterprise;
import Business.Network.Network;
import java.awt.CardLayout;
import javax.swing.JPanel;
/**
*
* @author raunak
*/
public class AdminWorkAreaJPanel extends javax.swing.JPanel {
JPanel userProcessContainer;
Enterprise enterprise;
Network network;
/** Creates new form AdminWorkAreaJPanel */
public AdminWorkAreaJPanel(JPanel userProcessContainer, Enterprise enterprise,Network network) {
initComponents();
this.userProcessContainer = userProcessContainer;
this.enterprise = enterprise;
this.network = network;
valueLabel.setText(enterprise.getName());
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
userJButton = new javax.swing.JButton();
manageEmployeeJButton = new javax.swing.JButton();
manageOrganizationJButton = new javax.swing.JButton();
enterpriseLabel = new javax.swing.JLabel();
valueLabel = new javax.swing.JLabel();
setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
jLabel1.setText("My Work Area -Aminstrative Role");
add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 40, -1, -1));
userJButton.setText("Manage User");
userJButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
userJButtonActionPerformed(evt);
}
});
add(userJButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 230, 150, -1));
manageEmployeeJButton.setText("Manage Employee");
manageEmployeeJButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
manageEmployeeJButtonActionPerformed(evt);
}
});
add(manageEmployeeJButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 180, 150, -1));
manageOrganizationJButton.setText("Manage Organization");
manageOrganizationJButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
manageOrganizationJButtonActionPerformed(evt);
}
});
add(manageOrganizationJButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 130, 150, -1));
enterpriseLabel.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
enterpriseLabel.setText("EnterPrise :");
add(enterpriseLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 90, 120, 30));
valueLabel.setText("<value>");
add(valueLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 100, 130, -1));
}// </editor-fold>//GEN-END:initComponents
private void userJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_userJButtonActionPerformed
// TODO add your handling code here:
ManageUserAccountJPanel muajp = new ManageUserAccountJPanel(userProcessContainer, enterprise,network);
userProcessContainer.add("ManageUserAccountJPanel", muajp);
CardLayout layout = (CardLayout) userProcessContainer.getLayout();
layout.next(userProcessContainer);
}//GEN-LAST:event_userJButtonActionPerformed
private void manageEmployeeJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_manageEmployeeJButtonActionPerformed
ManageEmployeeJPanel manageEmployeeJPanel = new ManageEmployeeJPanel(userProcessContainer, enterprise.getOrganizationDirectory(),network);
userProcessContainer.add("manageEmployeeJPanel", manageEmployeeJPanel);
CardLayout layout = (CardLayout) userProcessContainer.getLayout();
layout.next(userProcessContainer);
}//GEN-LAST:event_manageEmployeeJButtonActionPerformed
private void manageOrganizationJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_manageOrganizationJButtonActionPerformed
ManageOrganizationJPanel manageOrganizationJPanel = new ManageOrganizationJPanel(userProcessContainer, enterprise.getOrganizationDirectory(),network);
userProcessContainer.add("manageOrganizationJPanel", manageOrganizationJPanel);
CardLayout layout = (CardLayout) userProcessContainer.getLayout();
layout.next(userProcessContainer);
}//GEN-LAST:event_manageOrganizationJButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel enterpriseLabel;
private javax.swing.JLabel jLabel1;
private javax.swing.JButton manageEmployeeJButton;
private javax.swing.JButton manageOrganizationJButton;
private javax.swing.JButton userJButton;
private javax.swing.JLabel valueLabel;
// End of variables declaration//GEN-END:variables
}
| [
"ramesh.vik@husky.neu.edu"
] | ramesh.vik@husky.neu.edu |
955abb8666a6d889f5915cd6805b50a6a3934d76 | ed3cb95dcc590e98d09117ea0b4768df18e8f99e | /project_1_2/src/b/e/a/d/Calc_1_2_14030.java | 8dbc5b080042305843a7ea97fca31c97570ccad4 | [] | no_license | chalstrick/bigRepo1 | ac7fd5785d475b3c38f1328e370ba9a85a751cff | dad1852eef66fcec200df10083959c674fdcc55d | refs/heads/master | 2016-08-11T17:59:16.079541 | 2015-12-18T14:26:49 | 2015-12-18T14:26:49 | 48,244,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 134 | java | package b.e.a.d;
public class Calc_1_2_14030 {
/** @return the sum of a and b */
public int add(int a, int b) {
return a+b;
}
}
| [
"christian.halstrick@sap.com"
] | christian.halstrick@sap.com |
20a4ea803cc370dbec714262c1b93171c03aeff6 | b96e5cccd945313493ac2b95670b6b24c2c28562 | /src/main/java/com/projectRecipe/model/RecipeIngredient.java | d8041ec6a4ccd0655e4fff3b6b16aff62bd520db | [] | no_license | dlisbona/recipe-rest | 20c8af71f4324625d2a42ea4e9a7253f750a65c0 | 6d3fc0aa106b5332cb0c3f46fda5994b68a81413 | refs/heads/master | 2020-09-14T04:57:54.069921 | 2019-11-20T20:48:09 | 2019-11-20T20:48:09 | 223,024,334 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,427 | java | package com.projectRecipe.model;
import java.util.Objects;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.apache.commons.lang3.builder.ToStringBuilder;
@Entity
@Table(name = "recipe_ingredient")
public class RecipeIngredient {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "recipe_ingredient_id")
private Long id;
// cardinality n to 1, loaded immmediately, propage all operations
@ManyToOne(fetch = FetchType.EAGER, cascade = {CascadeType.ALL})
private Ingredient ingredient;
@Column(name = "quantity")
private Long quantity;
@Column(name = "unit")
private String unit;
public RecipeIngredient() {}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Ingredient getIngredient() {
return ingredient;
}
public void setIngredient(Ingredient ingredient) {
this.ingredient = ingredient;
}
public Long getQuantity() {
return quantity;
}
public void setQuantity(Long quantity) {
this.quantity = quantity;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o
.getClass()) return false;
RecipeIngredient that = (RecipeIngredient) o;
return Objects
.equals(id, that.id)
&& Objects
.equals(ingredient, that.ingredient)
&& Objects
.equals(quantity, that.quantity)
&& Objects
.equals(unit, that.unit);
}
@Override
public int hashCode() {
return Objects
.hash(id, ingredient, quantity, unit);
}
@Override
public String toString() {
return ToStringBuilder
.reflectionToString(this);
}
}
| [
"dlisbona@excilys.com"
] | dlisbona@excilys.com |
69f94722ce827eb2b22d19b2327663ef1517397e | a426e96735d04610e78e88306cd0b9e905da2bb4 | /src/main/java/wec/validators/TitleWithDateInfoboxValidator.java | 4cbd14696a1958790db4cd724ce7811a8cd53542 | [
"Apache-2.0"
] | permissive | VincentWei2021/extract-wec | cedbbce4773bd119c85a9f0171a676bd0d5cc7b7 | 21ad9d6d56c1654da7194419664d96a0af031fae | refs/heads/master | 2023-08-22T14:44:21.675494 | 2021-10-04T11:05:15 | 2021-10-04T11:05:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 880 | java | package wec.validators;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class TitleWithDateInfoboxValidator extends DefaultInfoboxValidator {
public TitleWithDateInfoboxValidator(String corefType, Pattern pattern) {
super(corefType, pattern);
}
@Override
public String validateMatchedInfobox(String infobox, String title) {
String extract = super.validateMatchedInfobox(infobox, title);
boolean titleMatch = this.titleNumberMatch(title);
if(titleMatch) {
return extract;
}
return DefaultInfoboxValidator.NA;
}
private boolean titleNumberMatch(String title) {
Pattern titlePattern = Pattern.compile("\\s?\\d\\d?th\\s|[12][90][0-9][0-9]|\\b[MDCLXVI]+\\b");
Matcher titleMatcher = titlePattern.matcher(title);
return titleMatcher.find();
}
}
| [
"alon.eirew@intel.com"
] | alon.eirew@intel.com |
2dc0d5d32e25c8c0764e2d85439d508d9cb3666c | cc6b7e334ab057d630d3bb52a2c9bf9747622d24 | /bankapplication_rest_51830094/src/main/java/com/bankapp/model/service/AccountService.java | 49cb35d6052f818b3c5dfd90751fc538412d4f40 | [] | no_license | logasweetha/project_mode1and2_51830094 | a0bbbfbfee5712ddc17dca8aec99f55b98fd9569 | 0278d9c136585cc30777c393a59620cf91806a34 | refs/heads/master | 2020-09-21T12:18:59.685227 | 2019-11-29T05:57:30 | 2019-11-29T05:57:30 | 224,786,457 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 661 | java | package com.bankapp.model.service;
import java.util.List;
import java.util.Optional;
import com.bankapp.model.entities.Account;
import com.bankapp.model.entities.Customer;
public interface AccountService {
public List<Account> getAllAccount();
void blockAccount(Long accountNumber);
Account createAccount(Account account );
void deposit(Long accountNumber, double amount);
void withdraw(Long accountNumber, double amount);
void transfer(Long fromAccNumber, Long toAccNumber, double amount);
public Account addAccount(Account acc);
Customer getCustomerById(Long accountNumber);
Account getAccountById(Long accountNumber);
}
| [
"logasweethaevsrl@gmail.com"
] | logasweethaevsrl@gmail.com |
0b729eb00af80f51c07d491eaf3bc02f52a6bb1d | 85900a94be3ea1ff2b041628febffb9dae3c69dc | /wxconsole/src/main/java/com/jiuyv/common/lang/date/DateUtils.java | 584b9d47121b56c02da69c7c61c821366763cf74 | [] | no_license | q260996583/wxconsole | e22b33276cadddde4269883f509a1355c3bd8b9f | 2347add0468976dda41f52d76520a997752376df | refs/heads/master | 2020-03-30T07:32:44.289189 | 2018-09-30T08:31:43 | 2018-09-30T08:31:43 | 150,947,684 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,421 | java | package com.jiuyv.common.lang.date;
import java.text.SimpleDateFormat;
import java.util.Calendar;
public class DateUtils
{
public static String getCurDate()
{
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
return format.format(Calendar.getInstance().getTime());
}
public static String getCurDateTime()
{
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
return format.format(Calendar.getInstance().getTime());
}
public static String getCurDay()
{
SimpleDateFormat format = new SimpleDateFormat("dd");
return format.format(Calendar.getInstance().getTime());
}
public static String getCurMonth()
{
SimpleDateFormat format = new SimpleDateFormat("MM");
return format.format(Calendar.getInstance().getTime());
}
public static String getCurTime()
{
SimpleDateFormat format = new SimpleDateFormat("HHmmss");
return format.format(Calendar.getInstance().getTime());
}
public static String getCurYear()
{
SimpleDateFormat format = new SimpleDateFormat("yyyy");
return format.format(Calendar.getInstance().getTime());
}
public static String getDate(int offset)
{
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
Calendar calendar = Calendar.getInstance();
calendar.add(5, offset);
return format.format(calendar.getTime());
}
} | [
"lixiaolong@sh-lixl-01.lcb.com"
] | lixiaolong@sh-lixl-01.lcb.com |
f6d22e5d8b96a16bd02845a483bdcf1ede911313 | b865c84f38760a28bbde3375d065012b6e28ee0d | /webWorkspace/web25_Ajax_idList/src/servlet/controller/Controller.java | 5042c1269f4014fcd28a54016c90ef00d6f5c5af | [] | no_license | lily2138/lily_work | ab46f599030dc172350adf5e14b8880577cd8f78 | a1d141920dbe36291fa73b533648799c0a598974 | refs/heads/master | 2022-12-08T22:53:21.255297 | 2020-08-27T08:44:48 | 2020-08-27T08:44:48 | 290,669,590 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 265 | java | package servlet.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public interface Controller {
public ModelAndView handle(HttpServletRequest request, HttpServletResponse response) throws Exception;
}
| [
"hakyoung880@gmail.com"
] | hakyoung880@gmail.com |
987e47e0d2647aa40ae1d279da25b5398ae3edbb | 6d48a4b4b3c958e200af84782db7920b546bc54d | /Android/AndroidPrograms/Authentication_Using_Firebase/app/src/main/java/com/usmanisolutions/authentication_using_firebase/ui/tools/ToolsViewModel.java | 7d5109a1118283f50570125e866eeab45c565c70 | [] | no_license | RehanDragon/Android_Dump | 3b38752392c287b10f51ce1856b13694df7b0cca | d3927053626c511957bbd696f0d12ca3936c1e84 | refs/heads/main | 2023-03-03T15:55:25.358903 | 2021-01-12T10:28:17 | 2021-01-12T10:28:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 479 | java | package com.usmanisolutions.authentication_using_firebase.ui.tools;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
public class ToolsViewModel extends ViewModel {
private MutableLiveData<String> mText;
public ToolsViewModel() {
mText = new MutableLiveData<>();
// mText.setValue("This is tools fragment");
}
public LiveData<String> getText() {
return mText;
}
} | [
"33097646+ShadowArtist@users.noreply.github.com"
] | 33097646+ShadowArtist@users.noreply.github.com |
1b32b44024f36da74897f8502c1f7d6042dd0f85 | 6de2635cd09dcc5b06050c65182b65ba91a112f9 | /src/main/java/de/perdian/ant/webstart/elements/ConfigurationHelper.java | dcdb27e26454ad5864f4248df79f7c995e135cb7 | [
"Apache-2.0"
] | permissive | perdian/ant-webstart | 5cde0435a996e3e4235553267c663b35c9eabf9e | 8de209f7e3256c771e9b0571595e827ad1ff04f0 | refs/heads/master | 2020-05-18T13:35:15.698567 | 2017-10-09T07:19:15 | 2017-10-09T07:19:15 | 7,820,020 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,466 | java | /*
* Copyright 2013 Christian Robert
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.perdian.ant.webstart.elements;
import java.util.Collection;
import org.w3c.dom.Element;
import de.perdian.ant.webstart.JnlpTask;
public class ConfigurationHelper {
public static void appendElement(JnlpTask task, Element parentElement, ConfigurationElement configurationElement) {
if(configurationElement != null) {
configurationElement.appendXml(task, parentElement);
}
}
public static Element appendElement(Element parentElement, String childElementName) {
return ConfigurationHelper.appendElement(parentElement, childElementName, null);
}
public static Element appendElement(Element parentElement, String childElementName, Object childElementContent) {
Element childElement = parentElement.getOwnerDocument().createElement(childElementName);
if(childElementContent != null) {
childElement.appendChild(parentElement.getOwnerDocument().createTextNode(childElementContent.toString()));
}
parentElement.appendChild(childElement);
return childElement;
}
public static Element appendElementIfNotNull(Element parentElement, String childElementName, Object childElementContent) {
if(childElementContent == null) {
return null;
} else {
return ConfigurationHelper.appendElement(parentElement, childElementName, childElementContent);
}
}
public static void appendElements(JnlpTask task, Element parentElement, Collection<? extends ConfigurationElement> elements) {
if(elements != null && !elements.isEmpty()) {
for(ConfigurationElement element : elements) {
element.appendXml(task, parentElement);
}
}
}
public static void appendAttributeIfNotNull(Element parentElement, String attributeName, Object attributeValue) {
if(attributeValue != null) {
parentElement.setAttribute(attributeName, attributeValue.toString());
}
}
} | [
"dev@perdian.de"
] | dev@perdian.de |
0c8d6366eadcf6ff9c10d8063cc0e1173f641b14 | d82acd125fb7d6570e58a522ed1b8f28af11123a | /ui/data/RD findbugs/model/src/edu/umd/cs/findbugs/gui2/MainFrame.java | 8965dd14dc0550d03383ae37c181f8bf189825ed | [
"Apache-2.0"
] | permissive | fetteradler/Getaviz | dba3323060d3bca81d2d93a2c1a19444ca406e16 | 9e80d842312f55b798044c069a1ef297e64da86f | refs/heads/master | 2020-03-22T11:34:46.963754 | 2018-08-29T14:19:09 | 2018-08-29T14:19:09 | 139,980,787 | 0 | 0 | Apache-2.0 | 2018-07-06T12:16:17 | 2018-07-06T12:16:17 | null | UTF-8 | Java | false | false | 38,762 | java | /*
* FindBugs - Find Bugs in Java programs
* Copyright (C) 2006, University of Maryland
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307, USA
*/
package edu.umd.cs.findbugs.gui2;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.TreeSet;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JEditorPane;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTextField;
import javax.swing.JTree;
import javax.swing.SwingUtilities;
import edu.umd.cs.findbugs.BugAnnotation;
import edu.umd.cs.findbugs.BugCollection;
import edu.umd.cs.findbugs.BugInstance;
import edu.umd.cs.findbugs.BugPattern;
import edu.umd.cs.findbugs.DetectorFactoryCollection;
import edu.umd.cs.findbugs.FindBugs;
import edu.umd.cs.findbugs.FindBugsDisplayFeatures;
import edu.umd.cs.findbugs.IGuiCallback;
import edu.umd.cs.findbugs.L10N;
import edu.umd.cs.findbugs.Project;
import edu.umd.cs.findbugs.ProjectPackagePrefixes;
import edu.umd.cs.findbugs.SortedBugCollection;
import edu.umd.cs.findbugs.SystemProperties;
import edu.umd.cs.findbugs.cloud.Cloud;
import edu.umd.cs.findbugs.cloud.Cloud.CloudListener;
import edu.umd.cs.findbugs.cloud.Cloud.SigninState;
import edu.umd.cs.findbugs.filter.Filter;
import edu.umd.cs.findbugs.log.ConsoleLogger;
import edu.umd.cs.findbugs.log.LogSync;
import edu.umd.cs.findbugs.log.Logger;
import edu.umd.cs.findbugs.sourceViewer.NavigableTextPane;
import edu.umd.cs.findbugs.util.Multiset;
@SuppressWarnings("serial")
/*
* This is where it all happens... seriously... all of it... All the menus are
* set up, all the listeners, all the frames, dockable window functionality
* There is no one style used, no one naming convention, its all just kinda
* here. This is another one of those classes where no one knows quite why it
* works. <p> The MainFrame is just that, the main application window where just
* about everything happens.
*/
public class MainFrame extends FBFrame implements LogSync {
public static final boolean GUI2_DEBUG = SystemProperties.getBoolean("gui2.debug");
public static final boolean MAC_OS_X = SystemProperties.getProperty("os.name").toLowerCase().startsWith("mac os x");
private static final int SEARCH_TEXT_FIELD_SIZE = 32;
public static final String TITLE_START_TXT = "FindBugs";
private final static String WINDOW_MODIFIED = "windowModified";
public static final boolean USE_WINDOWS_LAF = false;
private static MainFrame instance;
private final MyGuiCallback guiCallback = new MyGuiCallback();
private BugCollection bugCollection;
private BugAspects currentSelectedBugAspects;
private Project curProject = new Project();
private boolean newProject = false;
private final ProjectPackagePrefixes projectPackagePrefixes = new ProjectPackagePrefixes();
private Logger logger = new ConsoleLogger(this);
@CheckForNull
private File saveFile = null;
private CloudListener userAnnotationListener = new MyCloudListener();
private Cloud.CloudStatusListener cloudStatusListener = new MyCloudStatusListener();
private ExecutorService backgroundExecutor = Executors.newCachedThreadPool();
private final CountDownLatch mainFrameInitialized = new CountDownLatch(1);
private int waitCount = 0;
private final Object waitLock = new Object();
private final Runnable updateStatusBarRunner = new StatusBarUpdater();
private volatile String errorMsg = "";
/*
* To change this value must use setProjectChanged(boolean b). This is
* because saveProjectItemMenu is dependent on it for when
* saveProjectMenuItem should be enabled.
*/
private boolean projectChanged = false;
private final FindBugsLayoutManager guiLayout;
private final CommentsArea comments;
private JLabel statusBarLabel = new JLabel();
private JTextField sourceSearchTextField = new JTextField(SEARCH_TEXT_FIELD_SIZE);
private JButton findButton = MainFrameHelper.newButton("button.find", "First");
private JButton findNextButton = MainFrameHelper.newButton("button.findNext", "Next");
private JButton findPreviousButton = MainFrameHelper.newButton("button.findPrev", "Previous");
private NavigableTextPane sourceCodeTextPane = new NavigableTextPane();
private JPanel summaryTopPanel;
JEditorPane summaryHtmlArea = new JEditorPane();
private JScrollPane summaryHtmlScrollPane = new JScrollPane(summaryHtmlArea);
private SourceCodeDisplay displayer = new SourceCodeDisplay(this);
private ViewFilter viewFilter = new ViewFilter(this);
private SaveType saveType = SaveType.NOT_KNOWN;
private MainFrameLoadSaveHelper mainFrameLoadSaveHelper = new MainFrameLoadSaveHelper(this);
final MainFrameTree mainFrameTree = new MainFrameTree(this);
final MainFrameMenu mainFrameMenu = new MainFrameMenu(this);
private final MainFrameComponentFactory mainFrameComponentFactory = new MainFrameComponentFactory(this);
private final PluginUpdateDialog pluginUpdateDialog = new PluginUpdateDialog();
public static void makeInstance(FindBugsLayoutManagerFactory factory) {
if (instance != null)
throw new IllegalStateException();
instance = new MainFrame(factory);
instance.initializeGUI();
}
public static MainFrame getInstance() {
if (instance == null)
throw new IllegalStateException();
return instance;
}
private MainFrame(FindBugsLayoutManagerFactory factory) {
guiLayout = factory.getInstance(this);
comments = new CommentsArea(this);
FindBugsDisplayFeatures.setAbridgedMessages(true);
DetectorFactoryCollection.instance().addPluginUpdateListener(pluginUpdateDialog.createListener());
}
public void showMessageDialog(String message) {
guiCallback.showMessageDialog(message);
}
public int showConfirmDialog(String message, String title, String ok, String cancel) {
return guiCallback.showConfirmDialog(message, title, ok, cancel);
}
public IGuiCallback getGuiCallback() {
return guiCallback;
}
public void acquireDisplayWait() {
synchronized (waitLock) {
waitCount++;
if (GUI2_DEBUG) {
System.err.println("acquiring display wait, count " + waitCount);
Thread.dumpStack();
}
if (waitCount == 1)
mainFrameTree.showCard(BugCard.WAITCARD, new Cursor(Cursor.WAIT_CURSOR), this);
}
}
volatile Exception previousDecrementToZero;
public void releaseDisplayWait() {
synchronized (waitLock) {
if (waitCount <= 0) {
if (previousDecrementToZero != null)
throw new IllegalStateException("Can't decrease wait count; already zero", previousDecrementToZero);
else
throw new IllegalStateException("Can't decrease wait count; never incremented");
}
waitCount--;
if (GUI2_DEBUG) {
System.err.println("releasing display wait, count " + waitCount);
Thread.dumpStack();
}
if (waitCount == 0) {
mainFrameTree.showCard(BugCard.TREECARD, new Cursor(Cursor.DEFAULT_CURSOR), this);
previousDecrementToZero = new Exception("Previously decremented at");
}
}
}
public void waitUntilReady() throws InterruptedException {
mainFrameInitialized.await();
}
public JTree getTree() {
return mainFrameTree.getTree();
}
public BugTreeModel getBugTreeModel() {
return mainFrameTree.getBugTreeModel();
}
public synchronized @Nonnull Project getProject() {
if (curProject == null) {
curProject = new Project();
}
return curProject;
}
public synchronized void setProject(Project p) {
curProject = p;
}
/**
* Called when something in the project is changed and the change needs to
* be saved. This method should be called instead of using projectChanged =
* b.
*/
public void setProjectChanged(boolean b) {
if (curProject == null)
return;
if (projectChanged == b)
return;
projectChanged = b;
mainFrameMenu.setSaveMenu(this);
getRootPane().putClientProperty(WINDOW_MODIFIED, b);
}
/**
* Show an error dialog.
*/
public void error(String message) {
JOptionPane.showMessageDialog(this, message, "Error", JOptionPane.ERROR_MESSAGE);
}
/**
* Write a message to stdout.
*/
public void writeToLog(String message) {
if (GUI2_DEBUG)
System.out.println(message);
}
public int showConfirmDialog(String message, String title, int optionType) {
return JOptionPane.showConfirmDialog(this, message, title, optionType);
}
public Sortables[] getAvailableSortables() {
return mainFrameTree.getAvailableSortables();
}
// ============================== listeners ============================
/*
* This is overridden for changing the font size
*/
@Override
public void addNotify() {
super.addNotify();
float size = Driver.getFontSize();
JMenuBar menubar = getJMenuBar();
if (menubar != null) {
menubar.setFont(menubar.getFont().deriveFont(size));
for (int i = 0; i < menubar.getMenuCount(); i++) {
for (int j = 0; j < menubar.getMenu(i).getMenuComponentCount(); j++) {
Component temp = menubar.getMenu(i).getMenuComponent(j);
temp.setFont(temp.getFont().deriveFont(size));
}
}
mainFrameTree.updateFonts(size);
}
}
@SwingThread
void updateStatusBar() {
int countFilteredBugs = BugSet.countFilteredBugs();
String msg = "";
if (countFilteredBugs == 1) {
msg = " 1 " + edu.umd.cs.findbugs.L10N.getLocalString("statusbar.bug_hidden", "bug hidden (see view menu)");
} else if (countFilteredBugs > 1) {
msg = " " + countFilteredBugs + " "
+ edu.umd.cs.findbugs.L10N.getLocalString("statusbar.bugs_hidden", "bugs hidden (see view menu)");
}
msg = updateCloudSigninStatus(msg);
if (errorMsg != null && errorMsg.length() > 0)
msg = join(msg, errorMsg);
mainFrameTree.setWaitStatusLabelText(msg); // should not be the URL
if (msg.length() == 0)
msg = "http://findbugs.sourceforge.net";
statusBarLabel.setText(msg);
}
private String updateCloudSigninStatus(String msg) {
if (getBugCollection() != null) {
Cloud cloud = getBugCollection().getCloud();
if (cloud != null) {
String pluginMsg = cloud.getStatusMsg();
if (pluginMsg != null && pluginMsg.length() > 1)
msg = join(msg, pluginMsg);
}
}
return msg;
}
/**
* This method is called when the application is closing. This is either by
* the exit menuItem or by clicking on the window's system menu.
*/
void callOnClose() {
if (!canNavigateAway())
return;
if (projectChanged && !SystemProperties.getBoolean("findbugs.skipSaveChangesWarning")) {
Object[] options = {
L10N.getLocalString("dlg.save_btn", "Save"),
L10N.getLocalString("dlg.dontsave_btn", "Don't Save"),
L10N.getLocalString("dlg.cancel_btn", "Cancel"),
};
int value = JOptionPane.showOptionDialog(this, getActionWithoutSavingMsg("closing"),
edu.umd.cs.findbugs.L10N.getLocalString("msg.confirm_save_txt", "Do you want to save?"),
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
if (value == 2 || value == JOptionPane.CLOSED_OPTION)
return;
else if (value == 0) {
if (saveFile == null) {
if (!mainFrameLoadSaveHelper.saveAs())
return;
} else
mainFrameLoadSaveHelper.save();
}
}
GUISaveState guiSaveState = GUISaveState.getInstance();
guiLayout.saveState();
guiSaveState.setFrameBounds(getBounds());
guiSaveState.setExtendedWindowState(getExtendedState());
guiSaveState.save();
if (this.bugCollection != null) {
Cloud cloud = this.bugCollection.getCloud();
if (cloud != null)
cloud.shutdown();
}
System.exit(0);
}
// ========================== misc junk ====================================
JMenuItem createRecentItem(final File f, final SaveType localSaveType) {
return mainFrameMenu.createRecentItem(f, localSaveType);
}
/**
* Opens the analysis. Also clears the source and summary panes. Makes
* comments enabled false. Sets the saveType and adds the file to the recent
* menu.
*
* @param f
* @return whether the operation was successful
*/
public boolean openAnalysis(File f, SaveType saveType) {
if (!f.exists() || !f.canRead()) {
throw new IllegalArgumentException("Can't read " + f.getPath());
}
mainFrameLoadSaveHelper.prepareForFileLoad(f, saveType);
mainFrameLoadSaveHelper.loadAnalysis(f);
return true;
}
public void openBugCollection(SortedBugCollection bugs) {
acquireDisplayWait();
try {
mainFrameLoadSaveHelper.prepareForFileLoad(null, null);
Project project = bugs.getProject();
project.setGuiCallback(guiCallback);
BugLoader.addDeadBugMatcher(bugs);
setProjectAndBugCollectionInSwingThread(project, bugs);
} finally {
releaseDisplayWait();
}
}
void clearBugCollection() {
setSaveFile(null);
setProjectAndBugCollection(null, null);
}
@SwingThread
void setBugCollection(BugCollection bugCollection) {
setProjectAndBugCollection(bugCollection.getProject(), bugCollection);
}
void setProjectAndBugCollectionInSwingThread(final Project project, final BugCollection bc) {
setProjectAndBugCollection(project, bc);
}
@SwingThread
private void setProjectAndBugCollection(@CheckForNull Project project, @CheckForNull BugCollection bugCollection) {
if (GUI2_DEBUG) {
if (bugCollection == null)
System.out.println("Setting bug collection to null");
else
System.out.println("Setting bug collection; contains " + bugCollection.getCollection().size() + " bugs");
}
if (bugCollection != null && bugCollection.getProject() != project)
throw new IllegalArgumentException("project and bug collection don't match");
acquireDisplayWait();
try {
if (this.bugCollection != bugCollection && this.bugCollection != null) {
Cloud plugin = this.bugCollection.getCloud();
if (plugin != null) {
plugin.removeListener(userAnnotationListener);
plugin.removeStatusListener(cloudStatusListener);
plugin.shutdown();
}
}
// setRebuilding(false);
setProject(project);
this.bugCollection = bugCollection;
BugLoader.addDeadBugMatcher(bugCollection);
comments.updateBugCollection();
displayer.clearCache();
if (bugCollection != null) {
Cloud plugin = bugCollection.getCloud();
if (plugin != null) {
plugin.addListener(userAnnotationListener);
plugin.addStatusListener(cloudStatusListener);
}
}
mainFrameTree.updateBugTree();
setProjectChanged(false);
Runnable runnable = new Runnable() {
public void run() {
PreferencesFrame.getInstance().updateFilterPanel();
mainFrameMenu.getReconfigMenuItem().setEnabled(true);
comments.refresh();
mainFrameMenu.setViewMenu();
newProject();
clearSourcePane();
clearSummaryTab();
/*
* This is here due to a threading issue. It can only be
* called after curProject has been changed. Since this
* method is called by both open methods it is put here.
*/
updateTitle();
}
};
if (SwingUtilities.isEventDispatchThread())
runnable.run();
else
SwingUtilities.invokeLater(runnable);
} finally {
releaseDisplayWait();
}
}
void updateProjectAndBugCollection(BugCollection bugCollection) {
if (bugCollection != null) {
displayer.clearCache();
BugSet bs = new BugSet(bugCollection);
// Dont clear data, the data's correct, just get the tree off the
// listener lists.
BugTreeModel model = (BugTreeModel) mainFrameTree.getTree().getModel();
model.getOffListenerList();
model.changeSet(bs);
// curProject=BugLoader.getLoadedProject();
comments.updateBugCollection();
setProjectChanged(true);
}
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
@SuppressWarnings({ "SimplifiableIfStatement" })
boolean shouldDisplayIssue(BugInstance b) {
Project project = getProject();
Filter suppressionFilter = project.getSuppressionFilter();
if (null == getBugCollection() || suppressionFilter.match(b))
return false;
return viewFilter.show(b);
}
// ============================= menu actions
// ===============================
public void createNewProjectFromMenuItem() {
if (!canNavigateAway())
return;
new NewProjectWizard();
newProject = true;
}
void newProject() {
clearSourcePane();
if (!FindBugs.noAnalysis) {
mainFrameMenu.enableOrDisableItems(curProject, bugCollection);
}
if (newProject) {
setProjectChanged(true);
// setTitle(TITLE_START_TXT + Project.UNNAMED_PROJECT);
saveFile = null;
mainFrameMenu.getSaveMenuItem().setEnabled(false);
mainFrameMenu.getReconfigMenuItem().setEnabled(true);
newProject = false;
}
}
void about() {
AboutDialog dialog = new AboutDialog(this, logger, true);
dialog.setSize(600, 554);
dialog.setLocationRelativeTo(this);
dialog.setVisible(true);
}
void preferences() {
if (!canNavigateAway())
return;
PreferencesFrame.getInstance().setLocationRelativeTo(this);
PreferencesFrame.getInstance().setVisible(true);
}
public void displayCloudReport() {
Cloud cloud = this.bugCollection.getCloud();
if (cloud == null) {
JOptionPane.showMessageDialog(this, "There is no cloud");
return;
}
cloud.waitUntilIssueDataDownloaded();
StringWriter stringWriter = new StringWriter();
PrintWriter writer = new PrintWriter(stringWriter);
cloud.printCloudSummary(writer, getDisplayedBugs(), viewFilter.getPackagePrefixes());
writer.close();
String report = stringWriter.toString();
DisplayNonmodelMessage.displayNonmodelMessage("Cloud summary", report, this, false);
}
void redoAnalysis() {
if (!canNavigateAway())
return;
acquireDisplayWait();
edu.umd.cs.findbugs.util.Util.runInDameonThread(
new Runnable() {
public void run() {
try {
updateDesignationDisplay();
BugCollection bc = BugLoader.redoAnalysisKeepComments(getProject());
updateProjectAndBugCollection(bc);
} finally {
releaseDisplayWait();
}
}
});
}
// ================================== misc junk 2
// ==============================
void syncBugInformation() {
boolean prevProjectChanged = projectChanged;
if (mainFrameTree.getCurrentSelectedBugLeaf() != null) {
BugInstance bug = mainFrameTree.getCurrentSelectedBugLeaf().getBug();
displayer.displaySource(bug, bug.getPrimarySourceLineAnnotation());
updateDesignationDisplay();
comments.updateCommentsFromLeafInformation(mainFrameTree.getCurrentSelectedBugLeaf());
updateSummaryTab(mainFrameTree.getCurrentSelectedBugLeaf());
} else if (currentSelectedBugAspects != null) {
updateDesignationDisplay();
comments.updateCommentsFromNonLeafInformation(currentSelectedBugAspects);
displayer.displaySource(null, null);
clearSummaryTab();
} else {
displayer.displaySource(null, null);
clearSummaryTab();
}
setProjectChanged(prevProjectChanged);
}
void clearSourcePane() {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
mainFrameComponentFactory.setSourceTab("", null);
sourceCodeTextPane.setDocument(SourceCodeDisplay.SOURCE_NOT_RELEVANT);
}
});
}
// =============================== component creation
// ==================================
private void initializeGUI() {
mainFrameComponentFactory.initializeGUI();
}
JPanel statusBar() {
return mainFrameComponentFactory.statusBar();
}
JSplitPane summaryTab() {
return mainFrameComponentFactory.summaryTab();
}
JPanel createCommentsInputPanel() {
return mainFrameComponentFactory.createCommentsInputPanel();
}
JPanel createSourceCodePanel() {
return mainFrameComponentFactory.createSourceCodePanel();
}
JPanel createSourceSearchPanel() {
return mainFrameComponentFactory.createSourceSearchPanel();
}
/**
* Sets the title of the source tabs for either docking or non-docking
* versions.
*/
void setSourceTab(String title, @CheckForNull BugInstance bug) {
mainFrameComponentFactory.setSourceTab(title, bug);
}
SorterTableColumnModel getSorter() {
return mainFrameTree.getSorter();
}
void updateDesignationDisplay() {
comments.refresh();
}
private String getActionWithoutSavingMsg(String action) {
String msg = edu.umd.cs.findbugs.L10N.getLocalString("msg.you_are_" + action + "_without_saving_txt", null);
if (msg != null)
return msg;
return edu.umd.cs.findbugs.L10N.getLocalString("msg.you_are_" + action + "_txt", "You are " + action) + " "
+ edu.umd.cs.findbugs.L10N.getLocalString("msg.without_saving_txt", "without saving. Do you want to save?");
}
public void updateBugTree() {
mainFrameTree.updateBugTree();
comments.refresh();
}
public void resetViewCache() {
((BugTreeModel) mainFrameTree.getTree().getModel()).clearViewCache();
}
/**
* Changes the title based on curProject and saveFile.
*/
public void updateTitle() {
Project project = getProject();
String name = project == null ? null : project.getProjectName();
if ((name == null || name.trim().equals("")) && saveFile != null)
name = saveFile.getAbsolutePath();
if (name == null)
name = "";//Project.UNNAMED_PROJECT;
String oldTitle = this.getTitle();
String newTitle = TITLE_START_TXT + (name.trim().equals("") ? "" : " - " + name);
if (oldTitle.equals(newTitle))
return;
this.setTitle(newTitle);
}
@SuppressWarnings({ "SimplifiableIfStatement" })
private boolean shouldDisplayIssueIgnoringPackagePrefixes(BugInstance b) {
Project project = getProject();
Filter suppressionFilter = project.getSuppressionFilter();
if (null == getBugCollection() || suppressionFilter.match(b))
return false;
return viewFilter.showIgnoringPackagePrefixes(b);
}
public void selectPackagePrefixByProject() {
TreeSet<String> projects = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
Multiset<String> count = new Multiset<String>();
int total = 0;
for (BugInstance b : getBugCollection().getCollection())
if (shouldDisplayIssueIgnoringPackagePrefixes(b)) {
TreeSet<String> projectsForThisBug = projectPackagePrefixes.getProjects(b.getPrimaryClass().getClassName());
projects.addAll(projectsForThisBug);
count.addAll(projectsForThisBug);
total++;
}
if (projects.size() == 0) {
JOptionPane.showMessageDialog(this, "No issues in current view");
return;
}
ArrayList<ProjectSelector> selectors = new ArrayList<ProjectSelector>(projects.size() + 1);
ProjectSelector everything = new ProjectSelector("all projects", "", total);
selectors.add(everything);
for (String projectName : projects) {
ProjectPackagePrefixes.PrefixFilter filter = projectPackagePrefixes.getFilter(projectName);
selectors.add(new ProjectSelector(projectName, filter.toString(), count.getCount(projectName)));
}
ProjectSelector choice = (ProjectSelector) JOptionPane.showInputDialog(null,
"Choose a project to set appropriate package prefix(es)", "Select package prefixes by package",
JOptionPane.QUESTION_MESSAGE, null, selectors.toArray(), everything);
if (choice == null)
return;
mainFrameTree.setFieldForPackagesToDisplayText(choice.filter);
viewFilter.setPackagesToDisplay(choice.filter);
resetViewCache();
}
private static String join(String s1, String s2) {
if (s1 == null || s1.length() == 0)
return s2;
if (s2 == null || s2.length() == 0)
return s1;
return s1 + "; " + s2;
}
private void updateSummaryTab(BugLeafNode node) {
final BugInstance bug = node.getBug();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
summaryTopPanel.removeAll();
summaryTopPanel.add(mainFrameComponentFactory.bugSummaryComponent(bug.getAbridgedMessage(), bug));
for (BugAnnotation b : bug.getAnnotationsForMessage(true))
summaryTopPanel.add(mainFrameComponentFactory.bugSummaryComponent(b, bug));
BugPattern bugPattern = bug.getBugPattern();
String detailText =
bugPattern.getDetailText()
+"<br><p> <b>Bug kind and pattern: " +
bugPattern.getAbbrev() + " - " + bugPattern.getType();
String txt = bugPattern.getDetailHTML(detailText);
summaryHtmlArea.setText(txt);
summaryTopPanel.add(Box.createVerticalGlue());
summaryTopPanel.revalidate();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
summaryHtmlScrollPane.getVerticalScrollBar().setValue(
summaryHtmlScrollPane.getVerticalScrollBar().getMinimum());
}
});
}
});
}
public void clearSummaryTab() {
summaryHtmlArea.setText("");
summaryTopPanel.removeAll();
summaryTopPanel.revalidate();
}
public void searchSource(int type) {
int targetLineNum = -1;
String targetString = sourceSearchTextField.getText();
switch (type) {
case 0:
targetLineNum = displayer.find(targetString);
break;
case 1:
targetLineNum = displayer.findNext(targetString);
break;
case 2:
targetLineNum = displayer.findPrevious(targetString);
break;
}
if (targetLineNum != -1)
displayer.foundItem(targetLineNum);
}
public boolean canNavigateAway() {
return comments.canNavigateAway();
}
@SuppressWarnings({ "deprecation" })
public void createProjectSettings() {
ProjectSettings.newInstance();
}
/*
* If the file already existed, its already in the preferences, as well as
* the recent projects menu items, only add it if they change the name,
* otherwise everything we're storing is still accurate since all we're
* storing is the location of the file.
*/
public void addFileToRecent(File xmlFile) {
mainFrameMenu.addFileToRecent(xmlFile);
}
public void setSaveType(SaveType saveType) {
if (GUI2_DEBUG && this.saveType != saveType)
System.out.println("Changing save type from " + this.saveType + " to " + saveType);
this.saveType = saveType;
}
public SaveType getSaveType() {
return saveType;
}
private Iterable<BugInstance> getDisplayedBugs() {
return new Iterable<BugInstance>() {
public Iterator<BugInstance> iterator() {
return new ShownBugsIterator();
}
};
}
// =================================== misc accessors for helpers
// ==========================
public BugLeafNode getCurrentSelectedBugLeaf() {
return mainFrameTree.getCurrentSelectedBugLeaf();
}
public BugAspects getCurrentSelectedBugAspects() {
return currentSelectedBugAspects;
}
public NavigableTextPane getSourceCodeTextPane() {
return sourceCodeTextPane;
}
public BugCollection getBugCollection() {
return bugCollection;
}
public boolean isProjectChanged() {
return projectChanged;
}
public File getSaveFile() {
return saveFile;
}
public Project getCurrentProject() {
return curProject;
}
public JMenuItem getSaveMenuItem() {
return mainFrameMenu.getSaveMenuItem();
}
public void setSaveFile(File saveFile) {
this.saveFile = saveFile;
}
public ExecutorService getBackgroundExecutor() {
return backgroundExecutor;
}
public CommentsArea getComments() {
return comments;
}
public JMenuItem getReconfigMenuItem() {
return mainFrameMenu.getReconfigMenuItem();
}
public SourceCodeDisplay getSourceCodeDisplayer() {
return displayer;
}
public ProjectPackagePrefixes getProjectPackagePrefixes() {
return projectPackagePrefixes;
}
public void enableRecentMenu(boolean enable) {
mainFrameMenu.enableRecentMenu(enable);
}
public void setCurrentSelectedBugAspects(BugAspects currentSelectedBugAspects) {
this.currentSelectedBugAspects = currentSelectedBugAspects;
}
public ViewFilter getViewFilter() {
return viewFilter;
}
public Project getCurProject() {
return curProject;
}
public MainFrameLoadSaveHelper getMainFrameLoadSaveHelper() {
return mainFrameLoadSaveHelper;
}
public FindBugsLayoutManager getGuiLayout() {
return guiLayout;
}
public MainFrameTree getMainFrameTree() {
return mainFrameTree;
}
public boolean projectChanged() {
return projectChanged;
}
public MainFrameMenu getMainFrameMenu() {
return mainFrameMenu;
}
public JEditorPane getSummaryHtmlArea() {
return summaryHtmlArea;
}
public JLabel getStatusBarLabel() {
return statusBarLabel;
}
public JButton getFindNextButton() {
return findNextButton;
}
public JScrollPane getSummaryHtmlScrollPane() {
return summaryHtmlScrollPane;
}
public JButton getFindPreviousButton() {
return findPreviousButton;
}
public JTextField getSourceSearchTextField() {
return sourceSearchTextField;
}
public JButton getFindButton() {
return findButton;
}
public JPanel getSummaryTopPanel() {
return summaryTopPanel;
}
public void setSummaryTopPanel(JPanel summaryTopPanel) {
this.summaryTopPanel = summaryTopPanel;
}
void waitForMainFrameInitialized() {
mainFrameInitialized.countDown();
}
public void addDesignationItem(JMenu menu, final String key, final String text, int keyEvent) {
JMenuItem toggleItem = new JMenuItem(text);
toggleItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
comments.setDesignation(key);
}
});
MainFrameHelper.attachAcceleratorKey(toggleItem, keyEvent);
menu.add(toggleItem);
}
enum BugCard {
TREECARD, WAITCARD
}
private static class ProjectSelector {
public ProjectSelector(String projectName, String filter, int count) {
this.projectName = projectName;
this.filter = filter;
this.count = count;
}
final String projectName;
final String filter;
final int count;
@Override
public String toString() {
return String.format("%s -- [%d issues]", projectName, count);
}
}
private class ShownBugsIterator implements Iterator<BugInstance> {
Iterator<BugInstance> base = getBugCollection().getCollection().iterator();
boolean nextKnown;
BugInstance next;
public boolean hasNext() {
if (!nextKnown) {
nextKnown = true;
while (base.hasNext()) {
next = base.next();
if (shouldDisplayIssue(next))
return true;
}
next = null;
return false;
}
return next != null;
}
public BugInstance next() {
if (!hasNext())
throw new NoSuchElementException();
BugInstance result = next;
next = null;
nextKnown = false;
return result;
}
public void remove() {
throw new UnsupportedOperationException();
}
}
private class MyGuiCallback extends AbstractSwingGuiCallback {
private MyGuiCallback() {
super(MainFrame.this);
}
public void registerCloud(Project project, BugCollection collection, Cloud plugin) {
// assert collection.getCloud() == plugin
// : collection.getCloud().getCloudName() + " vs " + plugin.getCloudName();
if (MainFrame.this.bugCollection == collection) {
plugin.addListener(userAnnotationListener);
plugin.addStatusListener(cloudStatusListener);
}
}
public void unregisterCloud(Project project, BugCollection collection, Cloud plugin) {
assert collection.getCloud() == plugin;
if (MainFrame.this.bugCollection == collection) {
plugin.removeListener(userAnnotationListener);
plugin.removeStatusListener(cloudStatusListener);
}
}
public void setErrorMessage(String errorMsg) {
MainFrame.this.errorMsg = errorMsg;
SwingUtilities.invokeLater(new Runnable() {
public void run() {
updateStatusBar();
}
});
}
}
private class MyCloudListener implements CloudListener {
public void issueUpdated(BugInstance bug) {
if (mainFrameTree.getCurrentSelectedBugLeaf() != null && mainFrameTree.getCurrentSelectedBugLeaf().getBug() == bug)
comments.updateCommentsFromLeafInformation(mainFrameTree.getCurrentSelectedBugLeaf());
}
public void statusUpdated() {
SwingUtilities.invokeLater(updateStatusBarRunner);
}
public void taskStarted(Cloud.CloudTask task) {
}
}
private class MyCloudStatusListener implements Cloud.CloudStatusListener {
public void handleIssueDataDownloadedEvent() {
mainFrameTree.rebuildBugTreeIfSortablesDependOnCloud();
}
public void handleStateChange(SigninState oldState, SigninState state) {
mainFrameTree.rebuildBugTreeIfSortablesDependOnCloud();
}
}
private class StatusBarUpdater implements Runnable {
public void run() {
updateStatusBar();
}
}
}
| [
"david.baum@uni-leipzig.de"
] | david.baum@uni-leipzig.de |
fe1442a810f7e32552b6b567b678e9480d940e30 | 3a59bd4f3c7841a60444bb5af6c859dd2fe7b355 | /sources/kotlin/reflect/jvm/internal/impl/util/OperatorChecks$checks$1.java | 1bf076dc366e99e8eeaf4665931934846ddd88f8 | [] | no_license | sengeiou/KnowAndGo-android-thunkable | 65ac6882af9b52aac4f5a4999e095eaae4da3c7f | 39e809d0bbbe9a743253bed99b8209679ad449c9 | refs/heads/master | 2023-01-01T02:20:01.680570 | 2020-10-22T04:35:27 | 2020-10-22T04:35:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,803 | java | package kotlin.reflect.jvm.internal.impl.util;
import java.util.List;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Lambda;
import kotlin.reflect.jvm.internal.impl.descriptors.FunctionDescriptor;
import kotlin.reflect.jvm.internal.impl.descriptors.ValueParameterDescriptor;
import kotlin.reflect.jvm.internal.impl.resolve.descriptorUtil.DescriptorUtilsKt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/* compiled from: modifierChecks.kt */
final class OperatorChecks$checks$1 extends Lambda implements Function1<FunctionDescriptor, String> {
public static final OperatorChecks$checks$1 INSTANCE = new OperatorChecks$checks$1();
OperatorChecks$checks$1() {
super(1);
}
@Nullable
public final String invoke(@NotNull FunctionDescriptor functionDescriptor) {
Intrinsics.checkParameterIsNotNull(functionDescriptor, "$receiver");
List<ValueParameterDescriptor> valueParameters = functionDescriptor.getValueParameters();
Intrinsics.checkExpressionValueIsNotNull(valueParameters, "valueParameters");
ValueParameterDescriptor valueParameterDescriptor = (ValueParameterDescriptor) CollectionsKt.lastOrNull(valueParameters);
boolean z = false;
if (valueParameterDescriptor != null) {
if (!DescriptorUtilsKt.declaresOrInheritsDefaultValue(valueParameterDescriptor) && valueParameterDescriptor.getVarargElementType() == null) {
z = true;
}
}
OperatorChecks operatorChecks = OperatorChecks.INSTANCE;
if (!z) {
return "last parameter should not have a default value or be a vararg";
}
return null;
}
}
| [
"joshuahj.tsao@gmail.com"
] | joshuahj.tsao@gmail.com |
a99e6a0a3d10f6aa020fc3b429b90043d3cd9fbd | d27af5bfeb1a0b187321b52dd70ccb9e72e39904 | /JUnitMockito/test/chapter06/expectedexceptions/ExpectedExceptionMessageTryCatchTest.java | f127ec27e57d029384f2d4b4d1eedcc557b78fa0 | [] | no_license | KurtJennen/Testing | 8c08285d05c4f8e1cdcbe3482d2e18b86ca167bc | d8434fce2776b91bb3e4d2d494ac129733063466 | refs/heads/master | 2023-02-10T07:08:44.123488 | 2021-01-09T15:08:18 | 2021-01-09T15:08:18 | 328,181,225 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 761 | java | package chapter06.expectedexceptions;
import static org.junit.Assert.*;
import org.junit.Test;
public class ExpectedExceptionMessageTryCatchTest {
Phone phone = new Phone();
@Test
public void shouldThrowIAEForEmptyNumber() {
try {
phone.setNumber(null);
fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
assertEquals("number can not be null or empty", iae.getMessage());
}
}
@Test
public void shouldThrowIAEForPlusPrefixedNumber() {
try {
phone.setNumber("+123");
fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
assertEquals("plus sign prefix no allowed, number: [+123]", iae.getMessage());
}
}
}
| [
"kurt.jennen@skynet.be"
] | kurt.jennen@skynet.be |
12c08476298112c74fc5a0e7bf977a6df31681df | fa1408365e2e3f372aa61e7d1e5ea5afcd652199 | /src/testcases/CWE190_Integer_Overflow/s02/CWE190_Integer_Overflow__int_getCookies_Servlet_square_81_base.java | d2e3b5239d526c4ff9337dd0979ca078b23f4955 | [] | no_license | bqcuong/Juliet-Test-Case | 31e9c89c27bf54a07b7ba547eddd029287b2e191 | e770f1c3969be76fdba5d7760e036f9ba060957d | refs/heads/master | 2020-07-17T14:51:49.610703 | 2019-09-03T16:22:58 | 2019-09-03T16:22:58 | 206,039,578 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,000 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE190_Integer_Overflow__int_getCookies_Servlet_square_81_base.java
Label Definition File: CWE190_Integer_Overflow__int.label.xml
Template File: sources-sinks-81_base.tmpl.java
*/
/*
* @description
* CWE: 190 Integer Overflow
* BadSource: getCookies_Servlet Read data from the first cookie using getCookies()
* GoodSource: A hardcoded non-zero, non-min, non-max, even number
* Sinks: square
* GoodSink: Ensure there will not be an overflow before squaring data
* BadSink : Square data, which can lead to overflow
* Flow Variant: 81 Data flow: data passed in a parameter to an abstract method
*
* */
package testcases.CWE190_Integer_Overflow.s02;
import testcasesupport.*;
import javax.servlet.http.*;
public abstract class CWE190_Integer_Overflow__int_getCookies_Servlet_square_81_base
{
public abstract void action(int data , HttpServletRequest request, HttpServletResponse response) throws Throwable;
}
| [
"bqcuong2212@gmail.com"
] | bqcuong2212@gmail.com |
006c79079deb9414d08b96265b3fcb135e9888cb | 02882cfc8f7abb29f82ad71fefe25a6e38836e06 | /app/src/main/java/br/com/packapps/librarypackappsombr/models/Address.java | 0f30738e7de91aa994080581d3d612788d0ab8d2 | [] | no_license | PauloLinhares09/LibrarySupermercado | 2b42a9540edb4bce782ca65c9cb211b8463e003f | c6ce3aeb6f3bbb41123de11df8737bd89372612b | refs/heads/master | 2021-01-22T04:10:32.470724 | 2017-06-07T19:52:47 | 2017-06-07T19:52:47 | 92,439,388 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,889 | java | package br.com.packapps.librarypackappsombr.models;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
/**
* Created by vaibhav on 12/21/15.
*/
public class Address implements Serializable {
private static final long serialVersionUID = 1L;
@SerializedName("id")
@Expose
private Integer id;
@SerializedName("firstname")
@Expose
private String firstName;
@SerializedName("lastname")
@Expose
private String lastName;
@SerializedName("address1")
@Expose
private String addressLine1;
@SerializedName("address2")
@Expose
private String addressLine2;
@SerializedName("city")
@Expose
private String city;
@SerializedName("phone")
@Expose
private String phone;
@SerializedName("zipcode")
@Expose
private String zipcode;
@SerializedName("state_name")
@Expose
private String stateName;
@SerializedName("alternative_phone")
@Expose
private String alternativePhone;
@SerializedName("company")
@Expose
private String company;
@SerializedName("state_id")
@Expose
private Integer stateId;
@SerializedName("country_id")
@Expose
private Integer countryId;
private boolean isSelected = false;
public Address() {
//countryId = Constants.COUNTRY_ID;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getAddressLine1() {
return addressLine1;
}
public void setAddressLine1(String addressLine1) {
this.addressLine1 = addressLine1;
}
public String getAddressLine2() {
return addressLine2;
}
public void setAddressLine2(String addressLine2) {
this.addressLine2 = addressLine2;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getZipcode() {
return zipcode;
}
public void setZipcode(String zipcode) {
this.zipcode = zipcode;
}
/*
public String getStateName() {
if (stateId!=null) {
for (State state :
SharedPreferencesHelper.getCache().getStatesList()) {
if (state.getId().equals(stateId)) return state.getName();
}
}
return stateName==null?"":stateName;
}*/
public void setStateName(String stateName) {
this.stateName = stateName;
}
public String getAlternativePhone() {
return alternativePhone;
}
public void setAlternativePhone(String alternativePhone) {
this.alternativePhone = alternativePhone;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getCompany() {
return company;
}
public void setCompany(String company) {
this.company = company;
}
public Integer getStateId() {
return stateId;
}
public void setStateId(Integer stateId) {
this.stateId = stateId;
}
/*
public Integer getCountryId() {
return Constants.COUNTRY_ID;
}
public void setCountryId(Integer countryId) {
this.countryId = Constants.COUNTRY_ID;
}
*/
public boolean isSelected() {
return isSelected;
}
public void setIsSelected(boolean isSelected) {
this.isSelected = isSelected;
}
}
| [
"paulo.linhares@yetgo.com.br"
] | paulo.linhares@yetgo.com.br |
a8a6caae12dd2939e10d96dd785d0a827b3260c3 | 8d813538bcd1c0b1e24573cb269fb3ba0ef35239 | /hw/extendedFib.java | 3464cc8f5499da0a3ece10b21d978cab9336c352 | [] | no_license | andrewdibs/Algorithms | edf833e9eb88cf131b89b82d2cbc6476be840eca | 8d6d3b42bc410c06124640f43786eba8c1e085a1 | refs/heads/master | 2021-07-03T20:23:20.204632 | 2021-05-24T01:06:01 | 2021-05-24T01:06:01 | 239,630,260 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 213 | java |
class extendedFib{
public static int fib(int n){
if (n <4 ) return 1;
else return fib(n-1) + fib(n-2) + fib(n-3);
}
public static void main(String [] args ){
System.out.println(fib(-5));
}
}
| [
"andrew.dibella1@marist.edu"
] | andrew.dibella1@marist.edu |
284594c94884f16f9314590f486366c07b70eda5 | 2ceae35a5e32149ad30c085c7d1006711bda33a8 | /src/com/itranswarp/compiler/test/on/the/fly/BeanProxy.java | 9398099f863ca6804759cda182e754d5ed66f502 | [
"MIT"
] | permissive | toohamster/samdyn | fd0916e705aacb8e741ce204d248b9226d3f95e2 | d05b4249ed1df42189315547917ceb04e3a841a4 | refs/heads/master | 2021-01-17T12:26:29.505538 | 2017-03-06T13:22:02 | 2017-03-06T13:22:02 | 84,066,875 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 187 | java | package com.itranswarp.compiler.test.on.the.fly;
/**
* Sample interface.
*
* @author michael
*/
public interface BeanProxy {
void setDirty(boolean dirty);
boolean isDirty();
}
| [
"449211678@qq.com"
] | 449211678@qq.com |
b2bfe6765a2b14936de804c658abfb729effd448 | e84b490e198f5ca864b7c2857f3a48bce260e3ac | /app/src/main/java/com/bnn/MainActivity.java | 89d7177194cc80716515fbe04df0c62f1dc1a1bd | [] | no_license | adityarachmat1/BNN | b9ed60ff65ef40bb40bc96dba29aa87c4220c999 | e7f0f8ab2fd820361a9aa5886eecbecddbded881 | refs/heads/master | 2020-04-22T03:00:03.841384 | 2019-02-11T05:58:15 | 2019-02-11T05:58:15 | 170,070,406 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 320 | java | package com.bnn;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"aditrachmat1@gmail.com"
] | aditrachmat1@gmail.com |
dde6e57c95919c9cde8976092fc69a3649d828b4 | 01ebbc94cd4d2c63501c2ebd64b8f757ac4b9544 | /backend/gxqpt-pt/gxqpt-mt-api/src/main/java/com/hengyunsoft/platform/mt/api/help/dto/UseTheHelpUpdateDTO.java | 0f6b264f4edf662e4ea7b0407943aff4a561cf9e | [] | no_license | KevinAnYuan/gxq | 60529e527eadbbe63a8ecbbad6aaa0dea5a61168 | 9b59f4e82597332a70576f43e3f365c41d5cfbee | refs/heads/main | 2023-01-04T19:35:18.615146 | 2020-10-27T06:24:37 | 2020-10-27T06:24:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 768 | java | package com.hengyunsoft.platform.mt.api.help.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
public class UseTheHelpUpdateDTO extends BaseUseTheHelpDTO implements Serializable{
/**
* 标题
*
* @mbggenerated
*/
@ApiModelProperty(value = "标题")
private String title;
/**
* 内容
*
* @mbggenerated
*/
@ApiModelProperty(value = "内容")
private String content;
/**
* 审核意见
*
* @mbggenerated
*/
@ApiModelProperty(value = "审核意见")
private String auditOpinion;
/**
* 模块id
*
* @mbggenerated
*/
@ApiModelProperty(value = "模块id")
private Long modularId;
}
| [
"470382668@qq.com"
] | 470382668@qq.com |
309f49acc97f1baa219f2ec5d08de99c0c8411e3 | 98d0614b993995c52366dd323999aee0a8f91921 | /src/com/company/OOP/Week2_homework/student/CreateStudent.java | 941415d14a90558f7085d3a5ae234b374582a5cd | [] | no_license | MaksimSokur/ACO8 | 1bce32e2413b7eafd0d8d168eb63b04da01dfd31 | b5d4d4896a5cc9e7d52eb4da3630691dab8dd8e9 | refs/heads/master | 2021-01-02T09:33:01.619102 | 2015-10-24T14:19:21 | 2015-10-24T14:19:21 | 42,784,007 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,084 | java | package com.company.OOP.Week2_homework.student;
/**
* Created by User on 29.09.2015.
*/
public class CreateStudent{
private int maxObjects = 0;
private String name;
private String addres;
private Object[] objects = new Object[10];
public CreateStudent(String name, String addres) {
this.name = name;
this.addres = addres;
}
public CreateStudent(Object[] objects, String addres, String name) {
this.objects = objects;
this.addres = addres;
this.name = name;
}
public void learn(Object object){
int hours = 0;
while (object.getHoursWorksWithStudent() < object.getHoursInSemestr()) {
System.out.println("Go to school!!");
hours = object.getHoursWorksWithStudent();
hours++;
}
}
public boolean addObject(Object object){
if(maxObjects >= objects.length){
return false;
}
objects[maxObjects] = object;
maxObjects++;
return true;
}
public Object deleteLastObject(){
if(maxObjects == 0){
return null;
}
maxObjects--;
Object finishedObject = objects[maxObjects];
objects[maxObjects] = null;
return finishedObject;
}
public void showAllObjects(){
for (int i = 0; i < maxObjects; i++){
Object curent = objects[i];
curent.showInformationAboutObject();
}
}
public boolean toPassAnExam (){
for(int i = 0; i < objects.length; i++) {
if (objects[i].getDegreeStudent()< 64) {
return false;
}
}
return true;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddres() {
return addres;
}
public void setAddres(String addres) {
this.addres = addres;
}
public String showStudent(){
return String.format("Name: %s, Adress: %s", name, addres);
}
}
| [
"maksim.sokur90@gmail.com"
] | maksim.sokur90@gmail.com |
ee5c9719cdada3bbb20f742dbb7b2d412fd180de | 81b3984cce8eab7e04a5b0b6bcef593bc0181e5a | /android/CarLife/app/src/main/java/com/baidu/carlife/p059c/C1149g.java | dc1e76eb479ada85bbf12dceb57a070bc94b79d8 | [] | no_license | ausdruck/Demo | 20ee124734d3a56b99b8a8e38466f2adc28024d6 | e11f8844f4852cec901ba784ce93fcbb4200edc6 | refs/heads/master | 2020-04-10T03:49:24.198527 | 2018-07-27T10:14:56 | 2018-07-27T10:14:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,037 | java | package com.baidu.carlife.p059c;
import android.os.Handler;
import android.os.Looper;
import com.baidu.carlife.p059c.C1105d.C1091a;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/* compiled from: TaskScheduler */
/* renamed from: com.baidu.carlife.c.g */
public class C1149g {
/* renamed from: a */
private static final int f2945a = 5;
/* renamed from: b */
private static final int f2946b = 10;
/* renamed from: c */
private static final int f2947c = 60;
/* renamed from: d */
private Handler f2948d = new Handler(Looper.getMainLooper());
/* renamed from: e */
private ThreadPoolExecutor f2949e = new ThreadPoolExecutor(5, 10, 60, TimeUnit.SECONDS, new LinkedBlockingQueue(5));
/* renamed from: a */
public static C1149g m3852a() {
return new C1149g();
}
private C1149g() {
}
/* renamed from: a */
public <R> void m3854a(final R output, final C1091a<R> taskCallback) {
this.f2948d.post(new Runnable(this) {
/* renamed from: c */
final /* synthetic */ C1149g f2935c;
public void run() {
taskCallback.mo1409a(output);
}
});
}
/* renamed from: a */
public <R> void m3853a(final C1091a<R> taskCallback) {
this.f2948d.post(new Runnable(this) {
/* renamed from: b */
final /* synthetic */ C1149g f2937b;
public void run() {
taskCallback.mo1408a();
}
});
}
/* renamed from: b */
public <R> void m3856b(final C1091a<R> taskCallback) {
this.f2948d.post(new Runnable(this) {
/* renamed from: b */
final /* synthetic */ C1149g f2939b;
public void run() {
taskCallback.mo1410b();
}
});
}
/* renamed from: a */
public void m3855a(Runnable runnable) {
this.f2949e.submit(runnable);
}
}
| [
"objectyan@gmail.com"
] | objectyan@gmail.com |
1bd969a09c27b745f347b94e83331cff77e5f17b | ea7fc0009c9caf0e2bebd7a3ee54e7ecd23f2c5d | /mmstudio/src/org/micromanager/conf2/PeripheralSetupDlg.java | 9ec74952c4657509cd540770a640d6f8f2ce4f22 | [
"BSD-3-Clause"
] | permissive | stilllfox/Eva-ImageJ | 4fbefaeb99f473fd2adc0e19f23277c364ce64c5 | a50d35ea598aae07455ca7457f2b9846bf0fc874 | refs/heads/master | 2020-04-01T08:19:10.966540 | 2014-07-24T17:47:21 | 2014-07-24T17:47:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,710 | java | package org.micromanager.conf2;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Vector;
import i18n.JButton;
import i18n.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.border.EmptyBorder;
import javax.swing.table.AbstractTableModel;
import mmcorej.CMMCore;
import mmcorej.MMCoreJ;
import org.micromanager.utils.MMDialog;
public class PeripheralSetupDlg extends MMDialog {
private static final long serialVersionUID = 1L;
private static final int NAMECOLUMN = 0;
private static final int ADAPTERCOLUMN = 1;
private static final int DESCRIPTIONCOLUMN = 2;
private static final int SELECTIONCOLUMN = 3;
private class DeviceTable_TableModel extends AbstractTableModel {
private static final long serialVersionUID = 1L;
public final String[] COLUMN_NAMES = new String[]{
"Name",
"Adapter/Library",
"Description",
"Selected"
};
Vector<Boolean> selected_;
public DeviceTable_TableModel() {
selected_ = new Vector<Boolean>();
for (int i=0; i<peripherals_.size(); i++) {
selected_.add(false);
}
}
public int getRowCount() {
return peripherals_.size();
}
public int getColumnCount() {
return COLUMN_NAMES.length;
}
@Override
public String getColumnName(int columnIndex) {
return COLUMN_NAMES[columnIndex];
}
@Override
public Class getColumnClass(int c) {
Class ret = String.class;
if (SELECTIONCOLUMN == c) {
ret = Boolean.class;
}
return ret;
}
public Object getValueAt(int rowIndex, int columnIndex) {
if (columnIndex == NAMECOLUMN) {
return peripherals_.get(rowIndex).getName();
} else if (columnIndex == ADAPTERCOLUMN) {
return new String(peripherals_.get(rowIndex).getAdapterName() + "/" + peripherals_.get(rowIndex).getLibrary());
} else if (columnIndex == DESCRIPTIONCOLUMN) {
return peripherals_.get(rowIndex).getDescription();
} else if (SELECTIONCOLUMN == columnIndex) {
return selected_.get(rowIndex);
} else {
return null;
}
}
@Override
public void setValueAt(Object value, int row, int col) {
switch (col) {
case NAMECOLUMN: {
String n = (String) value;
String o = peripherals_.get(row).getName();
peripherals_.get(row).setName(n);
try {
//model_.changeDeviceName(o, n);
fireTableCellUpdated(row, col);
} catch (Exception e) {
handleError(e.getMessage());
}
}
break;
case ADAPTERCOLUMN:
break;
case DESCRIPTIONCOLUMN:
break;
case SELECTIONCOLUMN:
selected_.set(row, (Boolean) value);
break;
}
}
@Override
public boolean isCellEditable(int nRow, int nCol) {
boolean ret = false;
switch (nCol) {
case NAMECOLUMN:
ret = true;
break;
case ADAPTERCOLUMN:
break;
case DESCRIPTIONCOLUMN:
break;
case SELECTIONCOLUMN:
ret = true;
break;
}
return ret;
}
public void refresh() {
this.fireTableDataChanged();
}
Vector<Boolean> getSelected() {
return selected_;
}
}
private JTable deviceTable_;
private JScrollPane scrollPane_;
private MicroscopeModel model_;
private String hub_;
private final JPanel contentPanel = new JPanel();
private Vector<Device> peripherals_;
public PeripheralSetupDlg(MicroscopeModel mod, CMMCore c, String hub, Vector<Device> per) {
setTitle("Peripheral Devices Setup");
setBounds(100, 100, 479, 353);
loadPosition(100, 100);
//setModalityType(ModalityType.APPLICATION_MODAL);
setModal(true);
setResizable(false);
hub_ = hub;
model_ = mod;
peripherals_ = per;
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
contentPanel.setLayout(null);
scrollPane_ = new JScrollPane();
scrollPane_.setBounds(10, 36, 453, 236);
contentPanel.add(scrollPane_);
deviceTable_ = new JTable();
deviceTable_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
scrollPane_.setViewportView(deviceTable_);
JLabel lblNewLabel = new JLabel("HUB (parent device):");
lblNewLabel.setBounds(10, 11, 111, 14);
contentPanel.add(lblNewLabel);
JLabel lblParentDev = new JLabel(hub_);
lblParentDev.setBounds(131, 11, 332, 14);
contentPanel.add(lblParentDev);
{
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
{
JButton okButton = new JButton("OK");
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
onOK();
}
});
okButton.setActionCommand("OK");
buttonPane.add(okButton);
getRootPane().setDefaultButton(okButton);
}
{
JButton cancelButton = new JButton("Cancel");
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
onCancel();
}
});
cancelButton.setActionCommand("Cancel");
buttonPane.add(cancelButton);
}
}
addWindowListener(new WindowAdapter() {
public void windowClosing(final WindowEvent e) {
savePosition();
}
});
rebuildTable();
}
public void handleError(String message) {
JOptionPane.showMessageDialog(this, message);
}
protected void removeDevice() {
int sel = deviceTable_.getSelectedRow();
if (sel < 0) {
return;
}
String devName = (String) deviceTable_.getValueAt(sel, 0);
if (devName.contentEquals(new StringBuffer().append(MMCoreJ.getG_Keyword_CoreDevice()))) {
handleError(MMCoreJ.getG_Keyword_CoreDevice() + " device can't be removed!");
return;
}
model_.removeDevice(devName);
rebuildTable();
}
public void rebuildTable() {
DeviceTable_TableModel tmd = new DeviceTable_TableModel();
deviceTable_.setModel(tmd);
tmd.fireTableStructureChanged();
tmd.fireTableDataChanged();
}
public void refresh() {
rebuildTable();
}
public void onOK() {
// try {
// DeviceTable_TableModel tmd = (DeviceTable_TableModel) deviceTable_.getModel();
//
// Vector<String> hubs = new Vector<String>();
// for (int i=0; i < peripherals_.size(); i++) {
// hubs.add(new String(hub_));
// }
// Vector<Boolean> sel = tmd.getSelected();
// model_.AddSelectedPeripherals(core_, peripherals_, hubs, sel);
// model_.loadDeviceDataFromHardware(core_);
// } catch (Exception e) {
// handleError(e.getMessage());
// } finally {
// dispose();
// }
savePosition();
dispose();
}
public void onCancel() {
savePosition();
dispose();
}
public Device[] getSelectedPeripherals() {
DeviceTable_TableModel tmd = (DeviceTable_TableModel) deviceTable_.getModel();
Vector<Device> sel = new Vector<Device>();
Vector<Boolean> selFlags = tmd.getSelected();
for (int i=0; i<peripherals_.size(); i++) {
if (selFlags.get(i))
sel.add(peripherals_.get(i));
}
return sel.toArray(new Device[sel.size()]);
}
}
| [
"oeway007@gmail.com"
] | oeway007@gmail.com |
d57221b4f71294659745dc68b4d4fed787969f6e | 2d2033bcc41179f63a8f5e5ff05e99b0e25509e6 | /Desarrollo/ejercicioItehl/src/main/java/prueba/cursos/itehl/controller/CursoController.java | 1cf6af66013cbd078de973df2436be533d7ef03c | [] | no_license | jcth1979/JuanCarlosTrejosHernandezPruebaJavaItehlDigital | 826844164c808109482be12fdb795e24c894920d | 940bac96e875bd80905fbc3701b9412afb56a0ae | refs/heads/main | 2023-07-23T20:59:07.707438 | 2021-09-07T21:04:27 | 2021-09-07T21:04:27 | 400,360,420 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,857 | java | /**
*
*/
package prueba.cursos.itehl.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import prueba.cursos.itehl.dto.CursoDTO;
import prueba.cursos.itehl.dto.DescuentoDTO;
import prueba.cursos.itehl.dto.ModalidadDTO;
import prueba.cursos.itehl.model.Curso;
import prueba.cursos.itehl.model.Descuento;
import prueba.cursos.itehl.model.Modalidad;
import prueba.cursos.itehl.service.CursoService;
import prueba.cursos.itehl.service.DescuentoService;
import prueba.cursos.itehl.service.ModalidadService;
import prueba.cursos.itehl.util.MapperUtil;
/**
* @author Juan Carlos Trejos
*
*/
@RestController
@RequestMapping("/cursos")
public class CursoController {
@Autowired
private CursoService cursoService;
@Autowired
private ModalidadService modalidadService;
@Autowired
private DescuentoService descuentoService;
@GetMapping(value = "/porModalidad")
public ResponseEntity<List<CursoDTO>> getCursosByModalidad(@RequestBody final ModalidadDTO modalidadDto) {
return new ResponseEntity<>(
MapperUtil.mapAll(cursoService.findCursosByModalidad(MapperUtil.map(modalidadDto, Modalidad.class)),
CursoDTO.class),
HttpStatus.OK);
}
@GetMapping(value = "/descuentos")
public ResponseEntity<List<DescuentoDTO>> getDescuentos() {
return new ResponseEntity<>(MapperUtil.mapAll(descuentoService.findDescuentosAll(), DescuentoDTO.class), HttpStatus.OK);
}
@GetMapping(value = "/")
public ResponseEntity<List<CursoDTO>> getCursosAll() {
return new ResponseEntity<>(MapperUtil.mapAll(cursoService.findCursosAll(), CursoDTO.class), HttpStatus.OK);
}
@PostMapping(value = "/crear/curso")
public ResponseEntity<?> crearCurso(@RequestBody final CursoDTO cursoDTO) {
cursoService.guardarCurso(MapperUtil.map(cursoDTO, Curso.class));
return new ResponseEntity<>("Curso Creado!!", HttpStatus.OK);
}
@PostMapping(value = "/crear/modalidad")
public ResponseEntity<?> crearModalidad(@RequestBody final ModalidadDTO modalidadDTO) {
modalidadService.guardarModalidad(MapperUtil.map(modalidadDTO, Modalidad.class));
return new ResponseEntity<>("Modalidad Creada!!", HttpStatus.OK);
}
@PostMapping(value = "/crear/descuento")
public ResponseEntity<?> crearDescuento(@RequestBody final DescuentoDTO descuentoDTO) {
descuentoService.guardarDescuento(MapperUtil.map(descuentoDTO, Descuento.class));
return new ResponseEntity<>("Descuento Creado!!", HttpStatus.OK);
}
}
| [
"jcth1979@gmail.com"
] | jcth1979@gmail.com |
af61687356beaa3163ef99ecaa90a464b6156126 | 2f1585c6987edd3050aafa15199935301c8dc44a | /Sample/src/rensyu/tokuren102.java | 5c4c5ecf795ede7c63c5685e4ff7ca1b9e9953eb | [] | no_license | hikyoumono/test | 98ef539015cc0dafbcb816639f97a13ab28c241f | 76cda0a459f6ccea401ac7ddf5a6b35eb68e7c4a | refs/heads/master | 2020-03-28T10:08:46.598745 | 2019-02-09T13:15:10 | 2019-02-09T13:15:10 | 148,086,166 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,009 | java | package rensyu;
import java.io.File;
import java.awt.image.BufferedImage;
import java.awt.*;
import java.awt.event.KeyEvent;
import javax.imageio.ImageIO;
import java.io.IOException;
public class tokuren102{
static BufferedImage buff1;
static int x,y;
public tokuren102(){
}
public tokuren102(int x, int y, BufferedImage buff1){
this.x=x;
this.y=y;
this.buff1=buff1;
}
public tokuren102(File file, int x, int y)throws IOException{
BufferedImage buff1= ImageIO.read(file);
buff1= buff1.getSubimage(100,100,x,y);
}
protected static void move(KeyEvent e){
if(e.getID() == KeyEvent.KEY_PRESSED){
// int code = e.getKeyCode();
wmKeyDown(e.getKeyCode(), e);
//System.out.println("キー" + code + "が押されています");
}
}
public static void wmKeyDown(int code, KeyEvent e){
if(e.getKeyCode() == KeyEvent.VK_RIGHT){
x +=30;
}else if(e.getKeyCode() == KeyEvent.VK_LEFT){
x -=30;
}else if(e.getKeyCode() == KeyEvent.VK_DOWN){
y +=30;
}else if(e.getKeyCode() == KeyEvent.VK_UP){
y -=30;
}
}
} | [
"desmondgrou404@gmail.com"
] | desmondgrou404@gmail.com |
3e9073c2c2bdf20891cf136e6a9bdbf4cf3d5938 | 4f3d9369abc2a9d9360fa8f4f3b9e9f965534405 | /p4p-android/src/p4p/android/Activities/WelcomeActivity.java | d14f28b9c94231a5d777ff30392e59d2f50d4e72 | [] | no_license | heiruwu/p4p-android | d2745d0af2b988aced1217b3d44db7c35a2e4437 | efe578b4a86b84f5ce43318e52609db4fdcd76b4 | refs/heads/master | 2023-02-17T11:13:28.406836 | 2014-05-25T04:12:34 | 2014-05-25T04:12:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,750 | java | package p4p.android.Activities;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import net.yscs.android.square_progressbar.SquareProgressBar;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONArray;
import org.json.JSONException;
import info.androidhive.slidingmenu.R;
import info.androidhive.slidingmenu.R.color;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.widget.Toast;
import java.util.List;
import java.util.ArrayList;
import java.util.Timer;
import java.util.TimerTask;
public class WelcomeActivity extends Activity {
Bundle bundle;
HttpClient httpclient;
HttpGet getmethod;
String Depturl = "http://api.prof4prof.info/depts?school=國立臺灣大學";
HttpResponse response;
String[] prodept;
Thread getDepts;
ArrayList<String> id;
SquareProgressBar squareProgressBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);
squareProgressBar = (SquareProgressBar) findViewById(R.id.subi);
squareProgressBar.setImage(R.drawable.ic_launcher);
squareProgressBar.setColorRGB(100, 150, 200);
squareProgressBar.setProgress(16);
squareProgressBar.setWidth(4);
squareProgressBar.setOpacity(false);
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
squareProgressBar.setProgress(32);
}
}, 1000);
handler.postDelayed(new Runnable() {
public void run() {
squareProgressBar.setProgress(37);
}
}, 1100);
handler.postDelayed(new Runnable() {
public void run() {
squareProgressBar.setProgress(40);
}
}, 1200);
handler.postDelayed(new Runnable() {
public void run() {
squareProgressBar.setProgress(43);
}
}, 1350);
handler.postDelayed(new Runnable() {
public void run() {
squareProgressBar.setProgress(48);
}
}, 1500);
handler.postDelayed(new Runnable() {
public void run() {
squareProgressBar.setProgress(54);
}
}, 1600);
handler.postDelayed(new Runnable() {
public void run() {
squareProgressBar.setProgress(60);
}
}, 1800);
handler.postDelayed(new Runnable() {
public void run() {
squareProgressBar.setProgress(64);
}
}, 2000);
handler.postDelayed(new Runnable() {
public void run() {
squareProgressBar.setProgress(70);
}
}, 2200);
handler.postDelayed(new Runnable() {
public void run() {
squareProgressBar.setProgress(82);
}
}, 2500);
handler.postDelayed(new Runnable() {
public void run() {
squareProgressBar.setProgress(100);
}
}, 3000);
id = new ArrayList<String>();
getDepts = new Thread(getDeptsR);
getDepts.start();
Timer timer = new Timer(true);
timer.schedule(new timerTask(), 3000, 2000);
}
void putstringarray(Bundle bundle, String[] str) {
for (int i = 0; i < str.length; i++) {
bundle.putString("pro" + String.valueOf(i), str[i]);
Log.w("put", str[i]);
}
}
void putarraystringarray(Bundle bundle, ArrayList<String> str) {
for (int i = 0; i < str.size(); i++) {
bundle.putString("id" + String.valueOf(i), str.get(i));
Log.w("put", str.get(i));
}
}
Runnable getDeptsR = new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
httpclient = new DefaultHttpClient();
getmethod = new HttpGet(Depturl);
try {
response = httpclient.execute(getmethod);
Log.w("Welcome", "Get Request");
BufferedReader reader = new BufferedReader(
new InputStreamReader(
response.getEntity().getContent(), "UTF-8"));
String json = reader.readLine();
JSONArray jarray = new JSONArray(json);
prodept = new String[jarray.length()];
for (int i = 0; i < jarray.length(); i++) {
prodept[i] = jarray.getJSONObject(i).getString("name");
id.add(jarray.getJSONObject(i).getString("id"));
Log.w("string", prodept[i]);
Log.w("id", id.get(i));
}
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
runOnUiThread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
Toast.makeText(getApplication(),
"ClientProtocol error", Toast.LENGTH_SHORT)
.show();
}
});
e.printStackTrace();
} catch (IOException e) {
runOnUiThread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
Toast.makeText(getApplication(), "IO error",
Toast.LENGTH_SHORT).show();
}
});
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JSONException e) {
runOnUiThread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
Toast.makeText(getApplication(), "JSON error",
Toast.LENGTH_SHORT).show();
}
});
// TODO Auto-generated catch block
e.printStackTrace();
}
}
};
public class timerTask extends TimerTask {
public void run() {
if (prodept != null) {
Intent it = new Intent();
bundle = new Bundle();
int length = prodept.length;
bundle.putInt("length", length);
putstringarray(bundle, prodept);
putarraystringarray(bundle, id);
it.setClass(WelcomeActivity.this, MainActivity.class);
it.putExtras(bundle);
startActivity(it);
this.cancel();// Fuck u timertask
WelcomeActivity.this.finish();
}
}
}
}
| [
"wuheiru.5203@gmail.com"
] | wuheiru.5203@gmail.com |
61743086531bbcbf2fd1a400778add6f6847bb5c | 478fa555113ba6d5235aca2d3a9ccc6e109a5c70 | /CS2012/src/comparableSquare/Shape.java | b318196d6f584bd72c07ad39c19ced2f526d03d7 | [] | no_license | PannuMuthu/Java | d72e8307a94ffdff3302d6eb20db9de637ff23c8 | f183b8ce8136c6516578dccee2f551fcb115de01 | refs/heads/master | 2022-12-04T02:47:37.888553 | 2020-08-26T02:01:07 | 2020-08-26T02:01:07 | 271,699,597 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 525 | java | package comparableSquare;
public abstract class Shape {
private double area;
private double measurement;
private String color = "";
public Shape(double measurement, String color) {
this.measurement = measurement;
this.color = color;
}
public double getArea() {
return this.area;
}
public void setArea(double area) {
this.area = area;
}
public String getColor() {
return this.color;
}
public double getMeasurement() {
return this.measurement;
}
public abstract double computeArea();
}
| [
"pannumuthu@gmail.com"
] | pannumuthu@gmail.com |
b69a97efde41aca37c9f8f6ee3b72c205c31c2c2 | 4ffd9633d6b464c61f25608f0426dc87144b7921 | /src/main/java/com/zarko/TrackZilla/service/TicketService.java | 572360ec882d13f04dd429262ef3a3c25795fbee | [] | no_license | OlegZarevych/TrackZilla | 05670acb59c7b23a15811ea134d31e7c623604ea | 6af56bf751428055895fb8197a85001570a4f5ab | refs/heads/master | 2022-10-26T13:49:29.998333 | 2020-04-25T23:12:57 | 2020-04-25T23:12:57 | 258,807,517 | 0 | 0 | null | 2022-09-16T21:08:52 | 2020-04-25T15:20:24 | Java | UTF-8 | Java | false | false | 154 | java | package com.zarko.TrackZilla.service;
import com.zarko.TrackZilla.entity.Ticket;
public interface TicketService {
Iterable<Ticket> listTickets();
}
| [
"Oleg.Zarevych@gmail.com"
] | Oleg.Zarevych@gmail.com |
374e9e9714c326995f84028b842b68b80bc7048e | efda779906f7e6740aebef2dae99e375c99d49c3 | /src/com/leetcode/easy/Problem575.java | 7e93ee797883c741b910deb0d67e41226a71822d | [] | no_license | mohyehia/LeetCode | 8edf5b6195df3e56218dc10e83e93ec500622738 | 7475b2671466226dde80ce985c1babf3495a1069 | refs/heads/master | 2020-04-27T20:52:09.866551 | 2020-03-15T21:19:22 | 2020-03-15T21:19:22 | 84,017,002 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 312 | java | package com.leetcode.easy;
import java.util.HashSet;
import java.util.Set;
public class Problem575 {
public int distributeCandies(int[] candies) {
Set<Integer> set = new HashSet<>();
for(int i : candies)
set.add(i);
return Math.min(set.size(), candies.length / 2);
}
}
| [
"mohammedyehia99@gmail.com"
] | mohammedyehia99@gmail.com |
0657879556502734824fee2831bed83be453f733 | 68dc2f17228efb206b8d2eec0b8a1783dc8cf2d9 | /src/main/java/todomvc/TodoRepository.java | eead4ce2c67c7481e145cddd4a6b972dd1571aba | [] | no_license | camilovarela/rest-service | 0a068c892e33af3254bd5ff4da87622f51206835 | faf40091dc0be08cc3a109b6ac22bfdcad81ca36 | refs/heads/master | 2021-01-10T13:27:39.825593 | 2016-03-14T04:47:10 | 2016-03-14T04:47:10 | 53,827,274 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 245 | java | package todomvc;
import java.util.List;
import org.springframework.data.mongodb.repository.MongoRepository;
public interface TodoRepository extends MongoRepository<Todo, String> {
public List<Todo> findByCompleted(boolean completed);
}
| [
"ing.camilovarela@gmail.com"
] | ing.camilovarela@gmail.com |
c301dc92142c4d0583388e8dc00bb9bfdb67577c | 76070170eb7e332bb2a4655da97bc400b9fdbb5a | /app/src/main/java/com/housekeeper/activity/view/PacificView.java | 89176de3dc637943eec878a3b66567a5f1f52ea9 | [] | no_license | suntinghui/Housekeeper4Android_tenant | a50733d3ff2595e3912fb06945ec8c16df031c7c | 989fbeb857c31c87d11048ca18f5aae58e1111d8 | refs/heads/master | 2021-01-15T09:43:38.692883 | 2016-12-23T09:04:27 | 2016-12-23T09:04:27 | 47,904,526 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,639 | java | package com.housekeeper.activity.view;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.Environment;
import android.provider.MediaStore;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Base64;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.ares.house.dto.app.ImageAppDto;
import com.housekeeper.activity.BaseActivity;
import com.housekeeper.activity.CropImageActivity;
import com.housekeeper.utils.AdapterUtil;
import com.wufriends.housekeeper.R;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.util.Date;
import java.util.List;
/**
* Created by sth on 9/28/15.
*/
public class PacificView extends LinearLayout implements View.OnClickListener {
private BaseActivity context;
private LinearLayout contentLayout = null;
private LinearLayout uploadLayout = null;
private int tag = 0;
public static int CURRENT_TAG = 0; // 当前操作的控件
public static final String TYPE_GETIMG_API = "TYPE_GETIMG_API"; // 需要通过接口来获利图片流,默认值
public static final String TYPE_GETIMG_ADDRESS = "TYPE_GETIMG_ADDRESS"; // 直接通过地址获取图片
public String getImageType = TYPE_GETIMG_API;
/* 头像上传相关 */
private static String localTempImageFileName = "";
private static final int FLAG_CHOOSE_IMG = 0x100;// 相册选择
private static final int FLAG_CHOOSE_PHONE = 0x101;// 拍照
private static final int FLAG_MODIFY_FINISH = 0x102;
public static final File FILE_SDCARD = Environment.getExternalStorageDirectory();
public static final String IMAGE_PATH = "housekeeper";
public static final File FILE_LOCAL = new File(FILE_SDCARD, IMAGE_PATH);
public static final File FILE_PIC_SCREENSHOT = new File(FILE_LOCAL, "images/screenshots");
private String headerImageStr = "";
private PacificListener listener = null;
private boolean editable = true;
public PacificView(Context context) {
super(context);
this.initView(context);
}
public PacificView(Context context, AttributeSet attrs) {
super(context, attrs);
this.initView(context);
}
private void initView(Context context) {
this.context = (BaseActivity) context;
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.layout_pacific, this);
contentLayout = (LinearLayout) this.findViewById(R.id.contentLayout);
uploadLayout = (LinearLayout) this.findViewById(R.id.uploadLayout);
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, (int) (((BaseActivity) context).getWindowManager().getDefaultDisplay().getWidth() / 1.7));
params.setMargins(0, AdapterUtil.dip2px(context, 20), 0, 0);
uploadLayout.setLayoutParams(params);
uploadLayout.setOnClickListener(this);
uploadLayout.setVisibility(View.GONE);
}
public void setEditable(boolean editable) {
this.editable = editable;
}
public void setTag(int tag) {
this.tag = tag;
}
public void setGetImageType(String getType) {
this.getImageType = getType;
}
public void responseDownloadImageList(int maxCount, List<ImageAppDto> imageList) {
if (editable && maxCount > imageList.size()) {
uploadLayout.setVisibility(View.VISIBLE);
} else {
uploadLayout.setVisibility(View.GONE);
}
contentLayout.removeAllViews();
for (ImageAppDto imageDto : imageList) {
DiaoyuView deleteView = new DiaoyuView(this.context);
deleteView.setValue(this, imageDto, this.getImageType, editable);
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, (int) (((BaseActivity) context).getWindowManager().getDefaultDisplay().getWidth() / 1.7));
params.setMargins(0, AdapterUtil.dip2px(this.context, 20), 0, 0);
contentLayout.addView(deleteView, params);
}
}
public void responseUploadImage() {
if (this.listener != null) {
this.listener.downloadImageList();
}
}
public void responseDeleteImage() {
if (this.listener != null) {
this.listener.downloadImageList();
}
}
public void setPacificListener(PacificListener listener) {
this.listener = listener;
this.listener.downloadImageList();
}
public PacificListener getPacificListener() {
return this.listener;
}
public interface PacificListener {
public void downloadImageList();
public void uploadImage(String imageBase64);
public void deleteImage(String imageId);
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.uploadLayout:
CURRENT_TAG = this.tag;
uploadImage();
break;
}
}
private void uploadImage() {
CropImageView.CROP_TYPE = CropImageView.CROP_TYPE_HEADER;
choosePic();
}
public void activityResult(int requestCode, int resultCode, Intent data) {
// 判断是否操作的当前的控件,如果不是直接返回。
if (this.tag != CURRENT_TAG)
return;
if (requestCode == FLAG_CHOOSE_IMG && resultCode == Activity.RESULT_OK) { // 选择图片
if (data != null) {
Uri uri = data.getData();
if (!TextUtils.isEmpty(uri.getAuthority())) {
Cursor cursor = context.getContentResolver().query(uri, new String[]{MediaStore.Images.Media.DATA}, null, null, null);
if (null == cursor) {
Toast.makeText(context, "图片没找到", Toast.LENGTH_SHORT).show();
return;
}
cursor.moveToFirst();
String path = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DATA));
cursor.close();
Log.i("===", "path=" + path);
Intent intent = new Intent(context, CropImageActivity.class);
intent.putExtra("path", path);
context.startActivityForResult(intent, FLAG_MODIFY_FINISH);
} else {
Log.i("===", "path=" + uri.getPath());
Intent intent = new Intent(context, CropImageActivity.class);
intent.putExtra("path", uri.getPath());
context.startActivityForResult(intent, FLAG_MODIFY_FINISH);
}
}
} else if (requestCode == FLAG_CHOOSE_PHONE && resultCode == Activity.RESULT_OK) {// 拍照
File f = new File(FILE_PIC_SCREENSHOT, localTempImageFileName);
Intent intent = new Intent(context, CropImageActivity.class);
intent.putExtra("path", f.getAbsolutePath());
context.startActivityForResult(intent, FLAG_MODIFY_FINISH);
} else if (requestCode == FLAG_MODIFY_FINISH && resultCode == Activity.RESULT_OK) {
if (data != null) {
final String path = data.getStringExtra("path");
Log.i("===", "截取到的图片路径是 = " + path);
Bitmap b = BitmapFactory.decodeFile(path);
headerImageStr = bitmap2Base64(b);
if (this.listener != null) {
this.listener.uploadImage(headerImageStr);
}
}
}
}
private String bitmap2Base64(Bitmap bitmap) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
byte[] b = baos.toByteArray();
return Base64.encodeToString(b, Base64.DEFAULT);
}
/**
* 下面是选择照片
*/
private void choosePic() {
try {
final PopupWindow pop = new PopupWindow(this);
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.popup_pick_photo, null);
final LinearLayout ll_popup = (LinearLayout) view.findViewById(R.id.popupLayout);
pop.setWidth(LayoutParams.MATCH_PARENT);
pop.setHeight(LayoutParams.WRAP_CONTENT);
pop.setBackgroundDrawable(new BitmapDrawable());
pop.setFocusable(true);
pop.setOutsideTouchable(true);
pop.setContentView(view);
pop.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
backgroundRecovery();
}
});
RelativeLayout rootLayout = (RelativeLayout) view.findViewById(R.id.parentLayout);
TextView cameraTextView = (TextView) view.findViewById(R.id.cameraTextView);
TextView PhotoTextView = (TextView) view.findViewById(R.id.PhotoTextView);
TextView cancelTextView = (TextView) view.findViewById(R.id.cancelTextView);
rootLayout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
pop.dismiss();
ll_popup.clearAnimation();
}
});
cameraTextView.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
pop.dismiss();
ll_popup.clearAnimation();
takePhoto();
}
});
PhotoTextView.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
pop.dismiss();
ll_popup.clearAnimation();
Intent intent = new Intent();
intent.setAction(Intent.ACTION_PICK);
intent.setType("image/*");
context.startActivityForResult(intent, FLAG_CHOOSE_IMG);
}
});
cancelTextView.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
pop.dismiss();
ll_popup.clearAnimation();
}
});
pop.showAtLocation(findViewById(R.id.rootLayout), Gravity.BOTTOM, 0, 0);
backgroundDarken();
} catch (Exception e) {
e.printStackTrace();
}
}
private void backgroundDarken() {
// 设置背景颜色变暗
WindowManager.LayoutParams lp = context.getWindow().getAttributes();
lp.alpha = 0.6f;
context.getWindow().setAttributes(lp);
}
private void backgroundRecovery() {
WindowManager.LayoutParams lp = context.getWindow().getAttributes();
lp.alpha = 1.0f;
context.getWindow().setAttributes(lp);
}
public void takePhoto() {
String status = Environment.getExternalStorageState();
if (status.equals(Environment.MEDIA_MOUNTED)) {
try {
localTempImageFileName = "";
localTempImageFileName = String.valueOf((new Date()).getTime()) + ".png";
File filePath = FILE_PIC_SCREENSHOT;
if (!filePath.exists()) {
filePath.mkdirs();
}
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File f = new File(filePath, localTempImageFileName);
// localTempImgDir和localTempImageFileName是自己定义的名字
Uri u = Uri.fromFile(f);
intent.putExtra(MediaStore.Images.Media.ORIENTATION, 0);
intent.putExtra(MediaStore.EXTRA_OUTPUT, u);
context.startActivityForResult(intent, FLAG_CHOOSE_PHONE);
} catch (ActivityNotFoundException e) {
e.printStackTrace();
}
}
}
}
| [
"tinghuisun@163.com"
] | tinghuisun@163.com |
6f1eddeca29caff2b832440c7265f1027b8c61e6 | 098096abdea604d60ec5c993f22c9bf6e4c0d651 | /src/main/java/com/example/userservice/error/FeignErrorDecoder.java | c1dd704f71cf50fa4bf9d8ff9639cc9d4b554ccb | [] | no_license | moon-th/user-service_2 | b40ad3b356f99fbcefb3f3c9446684ba770446c9 | d9ad3553a28d78ad2041a90c1f1595a49e6ed9d6 | refs/heads/master | 2023-06-24T19:08:31.806002 | 2021-07-19T13:28:47 | 2021-07-19T13:28:47 | 387,473,627 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,198 | java | package com.example.userservice.error;
import feign.Response;
import feign.codec.ErrorDecoder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ResponseStatusException;
/**
* Feign Client 의 예외 처리를 하기 위한 클래스
*/
@Component
public class FeignErrorDecoder implements ErrorDecoder {
Environment env;
@Autowired
public FeignErrorDecoder(Environment env) {
this.env = env;
}
@Override
public Exception decode(String methodKey, Response response) {
switch (response.status()){
case 400:
break;
case 404:
if (methodKey.contains("getOrders")) {
return new ResponseStatusException(HttpStatus.valueOf(response.status()),
env.getProperty("order_service.exception.order_is_empty"));
}
break;
default:
return new Exception(response.reason());
}
return null;
}
}
| [
"ansxoghks88@gmail.com"
] | ansxoghks88@gmail.com |
7e3d94bbcd2dc1e0a37d30c658a8f5853a39cca2 | 8811f7be7029dc39b26b3b82802650d2bb7b44a3 | /XposedMoudle/app/src/androidTest/java/com/example/a32960/xposedmoudle/ExampleInstrumentedTest.java | c483c34505c0f6b067f7931738fc2d4a211b5288 | [] | no_license | knightcore/ObtainWxBillInfo | 10669a34bdd616dcfd56822e74e13d5e5e34e626 | 4f8f6c7f35c6c81cac0abbb1d62beb0a95bbd373 | refs/heads/master | 2020-09-12T07:01:41.233497 | 2019-04-13T11:10:50 | 2019-04-13T11:10:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 746 | java | package com.example.a32960.xposedmoudle;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.a32960.xposedmoudle", appContext.getPackageName());
}
}
| [
"329605337@qq.com"
] | 329605337@qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.