blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 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 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
540e023d13dc6fbd98f283eac75c69b1e261d8cb | 76f3f2186f38eca3d56233301d35cc5e40239acc | /marvin-dm-core/src/main/java/com/github/theborakompanioni/marvin/model/DefaultSummaryInvocationResult.java | e0daf77d4a00316df1f1dd8693cdd09e3e5e8465 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | theborakompanioni/marvin-dm | bb04ef55f1feb8c3242ce3bc0b1775a4deebe898 | a9cc3b36fd67599e41b23cdbab0c1e67d5e59140 | refs/heads/master | 2020-07-03T19:53:50.716288 | 2016-11-20T21:50:45 | 2016-11-20T21:50:45 | 74,233,481 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 348 | java | package com.github.theborakompanioni.marvin.model;
import lombok.Builder;
import lombok.Value;
import org.apache.maven.shared.invoker.InvocationResult;
import java.util.List;
@Value
@Builder
public class DefaultSummaryInvocationResult implements SummaryInvocationResult {
InvocationResult invocationResult;
List<String> outputLines;
}
| [
"theborakompanioni+github@gmail.com"
] | theborakompanioni+github@gmail.com |
0bcc8a58b51cd5da15043c7a44a55ff3be6b2e1c | b4cef6505fa451445e42da0c1a03fe4cba7ad10e | /src/main/java/scopes/ConfigurationModule.java | 78998e735fcf38e5b87d5ea0af84467aa0e9d0a4 | [] | no_license | david-gang/understanding-dagger | 9ef854c21603715e12c93fc2e4f6088036bdfea4 | fd820cd5bfb1e1c921300c29ae69a15f0f7f8989 | refs/heads/master | 2022-04-27T01:33:59.517385 | 2020-02-12T11:27:20 | 2020-02-12T11:27:20 | 237,235,484 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 332 | java | package scopes;
import dagger.Module;
import dagger.Provides;
import javax.inject.Singleton;
@Module
public class ConfigurationModule {
@Singleton
@Provides
ConnectionPool provideConfiguration() {
return new ConnectionPool("server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;");
}
}
| [
"dgang@lightricks.com"
] | dgang@lightricks.com |
4afd4a54e00dd10c9e155a40801fe9d1fed63270 | 31f0704d2bba8b58400df601b7a69211a7e04be7 | /FreeCol-master/src/net/sf/freecol/client/gui/option/StringOptionUI.java | 733ff8df61b648822e06a041c88d92ac67fd5566 | [] | no_license | Sou7hp4w/cosc442sp18DaySmith-finalproject | 745e1fd0d3859b73c88bde0257fc33a870e12579 | cdca3322a8ae74994daadebfc86ac127c0165d95 | refs/heads/master | 2020-03-06T18:27:26.874003 | 2018-05-18T19:31:07 | 2018-05-18T19:31:07 | 127,007,231 | 1 | 0 | null | 2018-05-18T19:31:08 | 2018-03-27T15:23:49 | Java | UTF-8 | Java | false | false | 2,420 | java | /**
* Copyright (C) 2002-2015 The FreeCol Team
*
* This file is part of FreeCol.
*
* FreeCol is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* FreeCol is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with FreeCol. If not, see <http://www.gnu.org/licenses/>.
*/
package net.sf.freecol.client.gui.option;
import java.util.List;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import net.sf.freecol.client.gui.plaf.FreeColComboBoxRenderer;
import net.sf.freecol.common.option.StringOption;
/**
* This class provides visualization for a
* {@link net.sf.freecol.common.option.StringOption} in order to enable
* values to be both seen and changed.
*/
public final class StringOptionUI extends OptionUI<StringOption> {
private final JComboBox<String> box = new JComboBox<>();
/**
* Creates a new <code>StringOptionUI</code> for the given
* <code>StringOption</code>.
*
* @param option The <code>StringOption</code> to make a user
* interface for.
* @param editable Whether user can modify the setting.
*/
public StringOptionUI(final StringOption option, boolean editable) {
super(option, editable);
List<String> choices = option.getChoices();
box.setModel(new DefaultComboBoxModel<>(choices
.toArray(new String[choices.size()])));
box.setSelectedItem(option.getValue());
box.setRenderer(new FreeColComboBoxRenderer<String>("", true));
initialize();
}
// Implement OptionUI
/**
* {@inheritDoc}
*/
@Override
public JComboBox<String> getComponent() {
return box;
}
/**
* {@inheritDoc}
*/
@Override
public void updateOption() {
getOption().setValue((String)box.getSelectedItem());
}
/**
* {@inheritDoc}
*/
@Override
public void reset() {
box.setSelectedItem(getOption().getValue());
}
}
| [
"sheltielover432@gmail.com"
] | sheltielover432@gmail.com |
f5dd38edd34261e873518790e8a631059f3c425d | 77f1b4b27f6a8e0d5c0a683903ee989fae353656 | /src/main/java/ch4_1/Ch4_1Test.java | dd3ff963a4c1fe2ab9bd9a9cde7d83a2dc123bf8 | [] | no_license | william830724/first_hand_rxJava | 975bb8b6000e608edf596b3dbaf5d18adbbe25c2 | b7e6940847a3f77ea9a2c90f83c612682bd9e352 | refs/heads/master | 2023-06-16T09:09:08.145972 | 2021-07-01T10:17:21 | 2021-07-01T10:17:21 | 379,791,438 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 44 | java | package ch4_1;
public class Ch4_1Test {
}
| [
"william16544@gmail.com"
] | william16544@gmail.com |
e08ac1a40f3011b7550e02d06d9ca5871f77d8b7 | 3c54dfad975808d67e2916c5306330c6186cdc8b | /Tarea1/ejercico 17/src/ejercico/pkg17/Ejercico17.java | ac2f20c96d8fa7124ca1489cae690e5052679928 | [] | no_license | javierestrada26/Trabajos | 42824c9c0afc32fa7212446b6a81d10e11ff5fed | 4a314c49277aae905afe32ab5a75a2a74a95d0bf | refs/heads/master | 2021-01-19T14:29:12.675866 | 2017-06-16T04:18:09 | 2017-06-16T04:18:09 | 88,167,042 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,012 | java |
package ejercico.pkg17;
import java.util.Scanner;
public class Ejercico17 {
public static void main(String[] args) {
Scanner entrada = new Scanner (System.in);
//Declarar variables
double tangente,cotangente,secante,cosecante,angulo;
//Pedir variable
System.out.println("Ingrese el tamaño de ángulos en radianes");
angulo = entrada.nextDouble();
//Transformar
angulo = Math.toRadians(angulo);
//Operaciones
tangente = Math.sin(angulo)/Math.cos(angulo);
cotangente = Math.cos(angulo)/Math.sin(angulo);
secante = 1/Math.cos(angulo);
cosecante=1/Math.sin(angulo);
//Resultados
System.out.println("La transformación a tangente es " +tangente);
System.out.println("La transformación a cotangente es " +cotangente);
System.out.println("La transformación a secante es " +secante);
System.out.println("La transformación a cosecante es " +cosecante);
}
}
| [
"javiestrada14@hotmail.com"
] | javiestrada14@hotmail.com |
d11d82c7bcdbf87cc4a9784800e975bd87fc232a | 2e39d5523e81cc7ec3f0d5b101e73e243e275888 | /references/old-proiect/URIJudgeOnlime/src/tests/math/nbtheory/Fibo.java | 44bc59a5fea3b255151025d83f6525007d39f04b | [] | no_license | chrislucas/competitive-programming | 9c85aaa54199c114cc455992c4722a228dcdc891 | 3ad9a2ceb69afdea151f66243ef86582361b57ff | refs/heads/master | 2023-07-29T19:02:56.353807 | 2023-07-17T13:57:00 | 2023-07-17T13:57:00 | 25,211,939 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,100 | java | package tests.math.nbtheory;
public class Fibo {
static int acc = 0;
static int fibo(int n) {
if(n == 0 || n == 1)
return 1;// n;
acc++;
int a = fibo(n-1);
acc++;
int b = fibo(n-2);
return a + b;
}
static int fiboMat(int n) {
int m [] = {0, 1};
int i;
for(i=0; i<n; i++) {
m[i%2] = m[0] + m[1];
}
return m[i%2 == 0 ? 1 : 0];
}
static int fiboMat2(int n) {
int m [] = new int[n+2];
m[0] = 0;
m[1] = 1;
for(int i=2; i<n+2; i++) {
m[i] = m[i-1] + m[i-2];
}
return m[n+2-1];
}
// R(1) = R(2) = 0 R(n)=2+R(n-1)+R(n-2)
// http://delab.csd.auth.gr/papers/SBI05m.pdf
// http://www.inpe.br/pos_graduacao/cursos/cap/arquivos/prova_ingresso_2013_respostas.pdf
// http://www.cs.columbia.edu/~cs4205/files/CM2.pdf
public static int countRecCalls(int n) {
int r[] = new int[n];
r[0] = r[1] = 0;
for(int i=2; i<n; i++) {
r[i] = 2 + r[i-1] + r[i-2];
}
return r[n-1];
}
public static void main(String[] args) {
//System.out.printf("%d %d %d %d", fibo(8), acc, fiboMat(8), fiboMat2(8));
System.out.println(countRecCalls(8));
}
}
| [
"christoffer.luccas@gmail.com"
] | christoffer.luccas@gmail.com |
ffdca19910c417d52feb1eae4d10385c03077f14 | 9fa3a23a75357752df9648f1794f0dcadb64bf86 | /app/src/main/java/com/aigo/router/bussiness/bean/NetBehaviour.java | 0b72188fcf81070f897dde9e5c824e985b55962f | [] | no_license | 425296516/IntelligentKey | 34e17b3c6c056b70779fcb3b6d51c22ef5872325 | 4c3f63b21f54553f341d302c03f74ca9b66805cd | refs/heads/master | 2021-01-11T15:36:52.549347 | 2017-02-17T11:01:52 | 2017-02-17T11:01:52 | 79,896,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,847 | java | package com.aigo.router.bussiness.bean;
import java.io.Serializable;
import java.util.List;
/**
* Created by zhangcirui on 2017/1/12.
*/
public class NetBehaviour implements Serializable{
/**
* result : {"result":true}
* behaviourList : [{"behaviourId":"5","deviceTypeId":"3","behaviourType":"2","behaviourName":"发送短信","action":"ff","behaviourIcon":null}]
*/
private ResultBean result;
private List<BehaviourListBean> behaviourList;
public ResultBean getResult() {
return result;
}
public void setResult(ResultBean result) {
this.result = result;
}
public List<BehaviourListBean> getBehaviourList() {
return behaviourList;
}
public void setBehaviourList(List<BehaviourListBean> behaviourList) {
this.behaviourList = behaviourList;
}
public static class ResultBean implements Serializable{
/**
* result : true
*/
private boolean result;
public boolean isResult() {
return result;
}
public void setResult(boolean result) {
this.result = result;
}
}
public static class BehaviourListBean implements Serializable{
/**
* behaviourId : 5
* deviceTypeId : 3
* behaviourType : 2
* behaviourName : 发送短信
* action : ff
* behaviourIcon : null
*/
private String behaviourId;
private String deviceTypeId;
private String behaviourType;
private String behaviourName;
private String action;
private Object behaviourIcon;
public String getBehaviourId() {
return behaviourId;
}
public void setBehaviourId(String behaviourId) {
this.behaviourId = behaviourId;
}
public String getDeviceTypeId() {
return deviceTypeId;
}
public void setDeviceTypeId(String deviceTypeId) {
this.deviceTypeId = deviceTypeId;
}
public String getBehaviourType() {
return behaviourType;
}
public void setBehaviourType(String behaviourType) {
this.behaviourType = behaviourType;
}
public String getBehaviourName() {
return behaviourName;
}
public void setBehaviourName(String behaviourName) {
this.behaviourName = behaviourName;
}
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public Object getBehaviourIcon() {
return behaviourIcon;
}
public void setBehaviourIcon(Object behaviourIcon) {
this.behaviourIcon = behaviourIcon;
}
}
}
| [
"425296516@qq.com"
] | 425296516@qq.com |
5dfb723f8cac9bb8e0b5f4dabcdf3aa6859c3342 | 9264677fc5049c1043f75623c5a36c8291222996 | /latte-core/src/main/java/com/examples/joshuayingwhat/latte/utils/callback/CallBackType.java | 8d5620abafb43963f049ba80e80a373fa7caf3d2 | [] | no_license | joshuayingwhat/FastEc | e79862e67356fbbcba82e890027797f6360802fe | a91ad9461d27ade34787a2e17b011225c7ac5276 | refs/heads/master | 2023-04-06T21:12:25.238493 | 2019-10-27T09:24:22 | 2019-10-27T09:24:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 152 | java | package com.examples.joshuayingwhat.latte.utils.callback;
public enum CallBackType {
ON_CROP,
TAG_OPEN_PUSH,
TAG_CLOSE_PUSH,
ON_SCAN
}
| [
"17721354011@163.com"
] | 17721354011@163.com |
fdb105507a0a8c4cdb7776667c56d9fc10436b99 | 4e9cc5d6eb8ec75e717404c7d65ab07e8f749c83 | /sdk-hook/src/main/java/com/dingtalk/api/response/OapiAtsEvaluateJobmatchFinishResponse.java | e096c35d20a3822a8f0f8bf29a67672fc4f53392 | [] | no_license | cvdnn/ZtoneNetwork | 38878e5d21a17d6fe69a107cfc901d310418e230 | 2b985cc83eb56d690ec3b7964301aeb4fda7b817 | refs/heads/master | 2023-05-03T16:41:01.132198 | 2021-05-19T07:35:58 | 2021-05-19T07:35:58 | 92,125,735 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,104 | java | package com.dingtalk.api.response;
import com.taobao.api.internal.mapping.ApiField;
import com.taobao.api.TaobaoResponse;
/**
* TOP DingTalk-API: dingtalk.oapi.ats.evaluate.jobmatch.finish response.
*
* @author top auto create
* @since 1.0, null
*/
public class OapiAtsEvaluateJobmatchFinishResponse extends TaobaoResponse {
private static final long serialVersionUID = 5116178732293157199L;
/**
* 错误码
*/
@ApiField("errcode")
private Long errcode;
/**
* 错误信息
*/
@ApiField("errmsg")
private String errmsg;
/**
* 操作成功
*/
@ApiField("result")
private Boolean result;
public void setErrcode(Long errcode) {
this.errcode = errcode;
}
public Long getErrcode( ) {
return this.errcode;
}
public void setErrmsg(String errmsg) {
this.errmsg = errmsg;
}
public String getErrmsg( ) {
return this.errmsg;
}
public void setResult(Boolean result) {
this.result = result;
}
public Boolean getResult( ) {
return this.result;
}
public boolean isSuccess() {
return getErrcode() == null || getErrcode().equals(0L);
}
}
| [
"cvvdnn@gmail.com"
] | cvvdnn@gmail.com |
f145d220f416b81db360f10dee57b3c20471fe04 | 27835b326965575e47e91e7089b918b642a91247 | /src/by/it/akhmelev/project06/java/beans/User.java | 27e64f11b8afa3165a59fc5050b5b7fff6a7554a | [] | no_license | s-karpovich/JD2018-11-13 | c3bc03dc6268d52fd8372641b12c341aa3a3e11f | 5f5be48cb1619810950a629c47e46d186bf1ad93 | refs/heads/master | 2020-04-07T19:54:15.964875 | 2019-04-01T00:37:29 | 2019-04-01T00:37:29 | 158,667,895 | 2 | 0 | null | 2018-11-22T08:40:16 | 2018-11-22T08:40:16 | null | UTF-8 | Java | false | false | 1,466 | java | package by.it.akhmelev.project06.java.beans;
public class User {
private long id;
private String login;
private String password;
private String email;
private long roles_Id;
public User() {
}
public User(long id, String login, String password, String email, long roles_Id) {
this.id = id;
this.login = login;
this.password = password;
this.email = email;
this.roles_Id = roles_Id;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public long getRoles_Id() {
return roles_Id;
}
public void setRoles_Id(long roles_Id) {
this.roles_Id = roles_Id;
}
@Override
public String toString() {
return "User{" +
"id=" + id +
", login='" + login + '\'' +
", password='" + password + '\'' +
", email='" + email + '\'' +
", roles_Id=" + roles_Id +
'}';
}
}
| [
"375336849110@tut.by"
] | 375336849110@tut.by |
efb4e01a8ff47bf7b50a20f7dabf9fe8a8fb19a7 | 998a534d4bcf3b50ddc1bfc32158ec6854312fe8 | /spring-boot/src/test/java/org/springframework/boot/context/properties/source/PropertySourceConfigurationPropertySourceTests.java | 13a43baa37e73360d67feff8c2608703ac53e60e | [
"Apache-2.0"
] | permissive | enterstudio/spring-boot | a281cfff7ce6069377fe5046cdc95fe906b98d34 | 1ee9653f7c6c79056a0228fb24ffdb85e14ccfa4 | refs/heads/master | 2023-08-31T03:39:40.786648 | 2017-04-28T16:36:41 | 2017-04-28T16:40:05 | 89,726,917 | 1 | 0 | Apache-2.0 | 2023-09-14T07:19:30 | 2017-04-28T16:58:56 | Java | UTF-8 | Java | false | false | 9,825 | java | /*
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.context.properties.source;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.springframework.boot.origin.Origin;
import org.springframework.boot.origin.OriginLookup;
import org.springframework.core.env.EnumerablePropertySource;
import org.springframework.core.env.MapPropertySource;
import org.springframework.core.env.PropertySource;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
/**
* Tests for {@link PropertySourceConfigurationPropertySource}.
*
* @author Phillip Webb
* @author Madhura Bhave
*/
public class PropertySourceConfigurationPropertySourceTests {
@Rule
public ExpectedException thrown = ExpectedException.none();
@Test
public void createWhenPropertySourceIsNullShouldThrowException() throws Exception {
this.thrown.expect(IllegalArgumentException.class);
this.thrown.expectMessage("PropertySource must not be null");
new PropertySourceConfigurationPropertySource(null, mock(PropertyMapper.class));
}
@Test
public void createWhenMapperIsNullShouldThrowException() throws Exception {
this.thrown.expect(IllegalArgumentException.class);
this.thrown.expectMessage("Mapper must not be null");
new PropertySourceConfigurationPropertySource(mock(PropertySource.class), null);
}
@Test
public void iteratorWhenNonEnumerbleShouldReturnEmptyIterator() throws Exception {
Map<String, Object> source = new LinkedHashMap<>();
PropertySource<?> propertySource = new NonEnumerablePropertySource<>(
new MapPropertySource("test", source));
TestPropertyMapper mapper = new TestPropertyMapper();
PropertySourceConfigurationPropertySource adapter = new PropertySourceConfigurationPropertySource(
propertySource, mapper);
assertThat(adapter.iterator()).isEmpty();
}
@Test
public void iteratorShouldAdaptNames() throws Exception {
Map<String, Object> source = new LinkedHashMap<>();
source.put("key1", "value1");
source.put("key2", "value2");
source.put("key3", "value3");
source.put("key4", "value4");
PropertySource<?> propertySource = new MapPropertySource("test", source);
TestPropertyMapper mapper = new TestPropertyMapper();
mapper.addFromProperySource("key1", "my.key1");
mapper.addFromProperySource("key2", "my.key2a", "my.key2b");
mapper.addFromProperySource("key4", "my.key4");
PropertySourceConfigurationPropertySource adapter = new PropertySourceConfigurationPropertySource(
propertySource, mapper);
assertThat(adapter.iterator()).extracting(Object::toString)
.containsExactly("my.key1", "my.key2a", "my.key2b", "my.key4");
}
@Test
public void getValueShouldUseDirectMapping() throws Exception {
Map<String, Object> source = new LinkedHashMap<>();
source.put("key1", "value1");
source.put("key2", "value2");
source.put("key3", "value3");
PropertySource<?> propertySource = new NonEnumerablePropertySource<>(
new MapPropertySource("test", source));
TestPropertyMapper mapper = new TestPropertyMapper();
ConfigurationPropertyName name = ConfigurationPropertyName.of("my.key");
mapper.addFromConfigurationProperty(name, "key2");
PropertySourceConfigurationPropertySource adapter = new PropertySourceConfigurationPropertySource(
propertySource, mapper);
assertThat(adapter.getConfigurationProperty(name).getValue()).isEqualTo("value2");
}
@Test
public void getValueShouldFallbackToEnumerableMapping() throws Exception {
Map<String, Object> source = new LinkedHashMap<>();
source.put("key1", "value1");
source.put("key2", "value2");
source.put("key3", "value3");
PropertySource<?> propertySource = new MapPropertySource("test", source);
TestPropertyMapper mapper = new TestPropertyMapper();
mapper.addFromProperySource("key1", "my.missing");
mapper.addFromProperySource("key2", "my.k-e-y");
PropertySourceConfigurationPropertySource adapter = new PropertySourceConfigurationPropertySource(
propertySource, mapper);
ConfigurationPropertyName name = ConfigurationPropertyName.of("my.key");
assertThat(adapter.getConfigurationProperty(name).getValue()).isEqualTo("value2");
}
@Test
public void getValueShouldUseExtractor() throws Exception {
Map<String, Object> source = new LinkedHashMap<>();
source.put("key", "value");
PropertySource<?> propertySource = new NonEnumerablePropertySource<>(
new MapPropertySource("test", source));
TestPropertyMapper mapper = new TestPropertyMapper();
ConfigurationPropertyName name = ConfigurationPropertyName.of("my.key");
mapper.addFromConfigurationProperty(name, "key",
(value) -> value.toString().replace("ue", "let"));
PropertySourceConfigurationPropertySource adapter = new PropertySourceConfigurationPropertySource(
propertySource, mapper);
assertThat(adapter.getConfigurationProperty(name).getValue()).isEqualTo("vallet");
}
@Test
public void getValueOrigin() throws Exception {
Map<String, Object> source = new LinkedHashMap<>();
source.put("key", "value");
PropertySource<?> propertySource = new MapPropertySource("test", source);
TestPropertyMapper mapper = new TestPropertyMapper();
ConfigurationPropertyName name = ConfigurationPropertyName.of("my.key");
mapper.addFromConfigurationProperty(name, "key");
PropertySourceConfigurationPropertySource adapter = new PropertySourceConfigurationPropertySource(
propertySource, mapper);
assertThat(adapter.getConfigurationProperty(name).getOrigin().toString())
.isEqualTo("\"key\" from property source \"test\"");
}
@Test
public void getValueWhenOriginCapableShouldIncludeSourceOrigin() throws Exception {
Map<String, Object> source = new LinkedHashMap<>();
source.put("key", "value");
PropertySource<?> propertySource = new OriginCapablePropertySource<>(
new MapPropertySource("test", source));
TestPropertyMapper mapper = new TestPropertyMapper();
ConfigurationPropertyName name = ConfigurationPropertyName.of("my.key");
mapper.addFromConfigurationProperty(name, "key");
PropertySourceConfigurationPropertySource adapter = new PropertySourceConfigurationPropertySource(
propertySource, mapper);
assertThat(adapter.getConfigurationProperty(name).getOrigin().toString())
.isEqualTo("TestOrigin key");
}
/**
* Test {@link PropertySource} that doesn't extend {@link EnumerablePropertySource}.
*/
private static class NonEnumerablePropertySource<T> extends PropertySource<T> {
private final PropertySource<T> propertySource;
NonEnumerablePropertySource(PropertySource<T> propertySource) {
super(propertySource.getName(), propertySource.getSource());
this.propertySource = propertySource;
}
@Override
public Object getProperty(String name) {
return this.propertySource.getProperty(name);
}
}
/**
* Test {@link PropertySource} that's also a {@link OriginLookup}.
*/
private static class OriginCapablePropertySource<T> extends PropertySource<T>
implements OriginLookup<String> {
private final PropertySource<T> propertySource;
OriginCapablePropertySource(PropertySource<T> propertySource) {
super(propertySource.getName(), propertySource.getSource());
this.propertySource = propertySource;
}
@Override
public Object getProperty(String name) {
return this.propertySource.getProperty(name);
}
@Override
public Origin getOrigin(String name) {
return new Origin() {
@Override
public String toString() {
return "TestOrigin " + name;
}
};
}
}
/**
* Test {@link PropertyMapper} implementation.
*/
private static class TestPropertyMapper implements PropertyMapper {
private MultiValueMap<String, PropertyMapping> fromSource = new LinkedMultiValueMap<>();
private MultiValueMap<ConfigurationPropertyName, PropertyMapping> fromConfig = new LinkedMultiValueMap<>();
public void addFromProperySource(String from, String... to) {
for (String configurationPropertyName : to) {
this.fromSource.add(from, new PropertyMapping(from,
ConfigurationPropertyName.of(configurationPropertyName)));
}
}
public void addFromConfigurationProperty(ConfigurationPropertyName from,
String... to) {
for (String propertySourceName : to) {
this.fromConfig.add(from, new PropertyMapping(propertySourceName, from));
}
}
public void addFromConfigurationProperty(ConfigurationPropertyName from,
String to, Function<Object, Object> extractor) {
this.fromConfig.add(from, new PropertyMapping(to, from, extractor));
}
@Override
public List<PropertyMapping> map(PropertySource<?> propertySource,
String propertySourceName) {
return this.fromSource.getOrDefault(propertySourceName,
Collections.emptyList());
}
@Override
public List<PropertyMapping> map(PropertySource<?> propertySource,
ConfigurationPropertyName configurationPropertyName) {
return this.fromConfig.getOrDefault(configurationPropertyName,
Collections.emptyList());
}
}
}
| [
"pwebb@pivotal.io"
] | pwebb@pivotal.io |
ea48fa5d600608768804e454152febd8f65a13ea | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Math/79/org/apache/commons/math/linear/Array2DRowRealMatrix_subtract_211.java | c237665c810c6f0e8ca1a67b64f6b84f5adc27fa | [] | 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,554 | java |
org apach common math linear
implement real matrix realmatrix arrai store entri
href http www math gatech bourbaki math2601 web note 2num pdf
decomposit support linear system
solut invers
decomposit perform need support oper
solv
singular issingular
determin getdetermin
invers
strong usag note strong
decomposit cach reus subsequ call
data modifi refer underli arrai obtain
code data ref getdataref code store decomposit
discard explicitli invok
code decompos ludecompos code recomput decomposit
method
link real matrix realmatrix matrix element index
base code entri getentri code
return element row column matrix
version revis date
array2 row real matrix array2drowrealmatrix abstract real matrix abstractrealmatrix serializ
inherit doc inheritdoc
overrid
real matrix realmatrix subtract real matrix realmatrix
illeg argument except illegalargumentexcept
subtract array2 row real matrix array2drowrealmatrix
class cast except classcastexcept cce
subtract
| [
"hvdthong@gmail.com"
] | hvdthong@gmail.com |
d1bdcc8afbfab5a888585b5ffdc9ed7b2ca8dab9 | 25250abfada5941cc1502346dfa59ff2a41ba419 | /engine/src/main/java/org/andresoviedo/android_3d_model_engine/services/gltf/jgltf_model/impl/DefaultTextureModel.java | 62d91fb9d3b72738cf927035b16c588e0ccd09b2 | [] | no_license | i-mighty/AirNative | 8d0b4e1961131c66bf49bbef1c6ac6b5ac6a74b4 | d3b3eaf790ef60b95bd17d746d4f8e1fcf66900e | refs/heads/master | 2023-07-17T11:35:18.469104 | 2021-01-18T08:14:42 | 2021-01-18T08:14:42 | 290,626,265 | 1 | 1 | null | 2021-01-22T10:47:44 | 2020-08-26T23:27:04 | Java | UTF-8 | Java | false | false | 3,144 | java | /*
* www.javagl.de - JglTF
*
* Copyright 2015-2017 Marco Hutter - http://www.javagl.de
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
package org.andresoviedo.android_3d_model_engine.services.gltf.jgltf_model.impl;
import org.andresoviedo.android_3d_model_engine.services.gltf.jgltf_model.ImageModel;
import org.andresoviedo.android_3d_model_engine.services.gltf.jgltf_model.TextureModel;
/**
* Implementation of a {@link TextureModel}
*/
public final class DefaultTextureModel extends AbstractNamedModelElement
implements TextureModel {
/**
* The magnification filter constant
*/
private final Integer magFilter;
/**
* The minification filter constant
*/
private final Integer minFilter;
/**
* The wrapping constant for the S-direction
*/
private final int wrapS;
/**
* The wrapping constant for the T-direction
*/
private final int wrapT;
/**
* The {@link ImageModel}
*/
private ImageModel imageModel;
/**
* Creates a new instance
*
* @param magFilter The optional magnification filter
* @param minFilter The optional minification filter
* @param wrapS The S-wrapping
* @param wrapT The T-wrapping
*/
public DefaultTextureModel(
Integer magFilter, Integer minFilter, int wrapS, int wrapT) {
this.magFilter = magFilter;
this.minFilter = minFilter;
this.wrapS = wrapS;
this.wrapT = wrapT;
}
@Override
public Integer getMagFilter() {
return magFilter;
}
@Override
public Integer getMinFilter() {
return minFilter;
}
@Override
public int getWrapS() {
return wrapS;
}
@Override
public int getWrapT() {
return wrapT;
}
@Override
public ImageModel getImageModel() {
return imageModel;
}
/**
* Set the {@link ImageModel}
*
* @param imageModel The {@link ImageModel}
*/
public void setImageModel(ImageModel imageModel) {
this.imageModel = imageModel;
}
}
| [
"desmondmuqsit@yahoo.com"
] | desmondmuqsit@yahoo.com |
2fee2580c2c2e5aac5ebd524d7e76186d941bc74 | 3a2daa98e8ca9292340a55d61fdd1bb18dc6bf3f | /welcome-android/src/main/java/com/stephentuso/welcome/ui/OnWelcomeScreenPageChangeListener.java | dfc95f1ffa8a191f188329a1f4c9e7b057418c79 | [
"MIT"
] | permissive | Rohaid-Bhatti/Muezzin-master | b778b0e0f4adff4daec96ce71c411ea7b7ebe71b | c1b376183deb5e3bf1765dfe8858fd704db3d79f | refs/heads/master | 2023-07-09T05:05:14.063645 | 2021-08-04T20:16:31 | 2021-08-04T20:16:31 | 392,814,253 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 340 | java | package com.stephentuso.welcome.ui;
import androidx.viewpager.widget.ViewPager;
import com.stephentuso.welcome.util.WelcomeScreenConfiguration;
/**
* Created by stephentuso on 11/16/15.
*/
public interface OnWelcomeScreenPageChangeListener extends ViewPager.OnPageChangeListener {
void setup(WelcomeScreenConfiguration config);
}
| [
"rohaidBhatti.zamstudios@gmail.com"
] | rohaidBhatti.zamstudios@gmail.com |
780f4bcacb70fc59a4c0b20bab84344d3d1e0cf6 | 53073fca0fcbd81d9cd6622f9a43bf2d481db069 | /src/test/java/martin/site/service/AuditEventServiceIT.java | 9c809aa540684697ca79b063373fb8901b6b5ed9 | [] | no_license | marvicgit/PuntosSalud | 7f3aa246591f60d1c353bc1b48b3e82c8c4792e8 | d10ec5d0bbc033e12f0c70e993c32c267147b0ec | refs/heads/main | 2023-03-01T19:35:53.539397 | 2021-02-06T19:06:00 | 2021-02-06T19:06:00 | 336,621,420 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,956 | java | package martin.site.service;
import martin.site.domain.PersistentAuditEvent;
import martin.site.repository.PersistenceAuditEventRepository;
import martin.site.TwentyOnePointsApp;
import io.github.jhipster.config.JHipsterProperties;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.transaction.annotation.Transactional;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Integration tests for {@link AuditEventService}.
*/
@SpringBootTest(classes = TwentyOnePointsApp.class)
@Transactional
public class AuditEventServiceIT {
@Autowired
private AuditEventService auditEventService;
@Autowired
private PersistenceAuditEventRepository persistenceAuditEventRepository;
@Autowired
private JHipsterProperties jHipsterProperties;
private PersistentAuditEvent auditEventOld;
private PersistentAuditEvent auditEventWithinRetention;
private PersistentAuditEvent auditEventNew;
@BeforeEach
public void init() {
auditEventOld = new PersistentAuditEvent();
auditEventOld.setAuditEventDate(Instant.now().minus(jHipsterProperties.getAuditEvents().getRetentionPeriod() + 1, ChronoUnit.DAYS));
auditEventOld.setPrincipal("test-user-old");
auditEventOld.setAuditEventType("test-type");
auditEventWithinRetention = new PersistentAuditEvent();
auditEventWithinRetention.setAuditEventDate(Instant.now().minus(jHipsterProperties.getAuditEvents().getRetentionPeriod() - 1, ChronoUnit.DAYS));
auditEventWithinRetention.setPrincipal("test-user-retention");
auditEventWithinRetention.setAuditEventType("test-type");
auditEventNew = new PersistentAuditEvent();
auditEventNew.setAuditEventDate(Instant.now());
auditEventNew.setPrincipal("test-user-new");
auditEventNew.setAuditEventType("test-type");
}
@Test
@Transactional
public void verifyOldAuditEventsAreDeleted() {
persistenceAuditEventRepository.deleteAll();
persistenceAuditEventRepository.save(auditEventOld);
persistenceAuditEventRepository.save(auditEventWithinRetention);
persistenceAuditEventRepository.save(auditEventNew);
persistenceAuditEventRepository.flush();
auditEventService.removeOldAuditEvents();
persistenceAuditEventRepository.flush();
assertThat(persistenceAuditEventRepository.findAll().size()).isEqualTo(2);
assertThat(persistenceAuditEventRepository.findByPrincipal("test-user-old")).isEmpty();
assertThat(persistenceAuditEventRepository.findByPrincipal("test-user-retention")).isNotEmpty();
assertThat(persistenceAuditEventRepository.findByPrincipal("test-user-new")).isNotEmpty();
}
}
| [
"martinhuacho@hotmail.com"
] | martinhuacho@hotmail.com |
de0090d80a3b07ecc0211e270d706d511f46ad51 | 54246082e28c3d3296729ffc76630244a4ac66a7 | /src/test/java/se/ecutb/cai/SpringMVCExercisesThymeleaf/SpringMvcExercisesThymeleafApplicationTests.java | 684841cb41f06dcfa94bf6cefba5e8e88f11be5e | [] | no_license | Dknwhe/SpringThymeleafAssignment | 4335c67379de4c1ff92bf435d27297e61c602912 | 3389f49766af7f8e7027c76c332767f277505085 | refs/heads/master | 2021-04-15T02:18:01.161001 | 2020-03-23T00:45:32 | 2020-03-23T00:45:32 | 249,286,500 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 253 | java | package se.ecutb.cai.SpringMVCExercisesThymeleaf;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class SpringMvcExercisesThymeleafApplicationTests {
@Test
void contextLoads() {
}
}
| [
"cai.mac@hotmail.com"
] | cai.mac@hotmail.com |
92692f02b901ee30c6ba4821834aa70d487566bf | 5a80031761f99947f4f9e9b7fa2baf5172ea5d2d | /Group1/src/lesson140428/variable/Examples.java | 16dc22b6ac8a53f1881a79cc6d7fa3509b383d44 | [] | no_license | serg77777/class1 | 8e369b58184e30c101dc05340273ba603fbae214 | 15841528bd5e1879c48d23f83ae5556c716b656b | refs/heads/master | 2020-05-23T13:48:44.558276 | 2014-07-21T17:04:46 | 2014-07-21T17:04:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 741 | java | package lesson140428.variable;
public class Examples {
public static void main(String[] args) {
int i = sum (1,2);
System.out.println(i);
int j = sum2 (1,2, 3);
System.out.println(j);
int k = sum ();
System.out.println(k);
}
private static int sum(int ... numbers) {
System.out.println(numbers.length);
int sum = 0;
for (int k : numbers) {
sum += k;
}
return sum;
}
private static int sum2(int fisrt, int ... numbers) {
System.out.println(numbers.length);
int sum = fisrt;
for (int k : numbers) {
sum += k;
}
return sum;
}
private static void wrong(int ... numbers, int j) {
}
private static void wrong2(int ... numbers, int ... j) {
}
}
| [
"zaal@itcwin.com"
] | zaal@itcwin.com |
0e20614856de0f04622382a0be3b22ac16bb0ca4 | 4adf4b100ef6af46121fa0d03230248adaf8f651 | /src/main/java/com/tsvlad/barber_project/rest/errors/exceptions/DbDataNotFoundException.java | b5e6f2bea20ea6ba92ae7b6fc2b77f305550691a | [] | no_license | TSVlad/barbershop_project | 3064b97ce31c92477c534db337906ff8f4a6b1f5 | 618c003cee9f310064e13c9512440bb78978fda7 | refs/heads/master | 2023-03-25T09:41:16.643278 | 2021-03-19T09:48:38 | 2021-03-19T09:48:38 | 331,059,313 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 462 | java | package com.tsvlad.barber_project.rest.errors.exceptions;
public class DbDataNotFoundException extends RuntimeException {
public DbDataNotFoundException() {
super();
}
public DbDataNotFoundException(String message) {
super(message);
}
public DbDataNotFoundException(String message, Throwable cause) {
super(message, cause);
}
public DbDataNotFoundException(Throwable cause) {
super(cause);
}
}
| [
"vladislav.kolmykov@yandex.ru"
] | vladislav.kolmykov@yandex.ru |
583b5017e9e6cf28f949a4392f112f34a5c59e80 | 832c756923d48ace3f338b27ae9dc8327058d088 | /src/contest/usaco/USACO_2015_Cow_Hopscotch_Gold_2.java | fd060e3f8a5c2a7656cc1cc047463d937acbf87f | [
"Apache-2.0",
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | luchy0120/competitive-programming | 1331bd53698c4b05b57a31d90eecc31c167019bd | d0dfc8f3f3a74219ecf16520d6021de04a2bc9f6 | refs/heads/master | 2020-05-04T15:18:06.150736 | 2018-11-07T04:15:26 | 2018-11-07T04:15:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,109 | java | package contest.usaco;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.StringTokenizer;
public class USACO_2015_Cow_Hopscotch_Gold_2 {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static PrintWriter ps = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
static StringTokenizer st;
static final int MOD = 1000000007;
static int r, c, k;
static int[][] g;
@SuppressWarnings("unchecked")
public static void main (String[] args) throws IOException {
r = readInt();
c = readInt();
k = readInt();
int[][] g = new int[r + 1][c + 1];
HashMap<Integer, Integer>[] toCy = new HashMap[k];
int[][] prefix = new int[r + 1][c + 1];
prefix[1][1] = 1;
for (int i = 0; i < k; i++)
toCy[i] = new HashMap<Integer, Integer>();
for (int i = 1; i <= r; i++)
for (int j = 1; j <= c; j++)
g[i][j] = readInt() - 1;
for (int j = 1; j <= c; j++) {
for (int i = 1; i <= r; i++) {
int a = g[i][j];
if (!toCy[a].containsKey(j)) {
toCy[a].put(j, toCy[a].size() + 1);
}
}
}
int[][] bit = new int[k][];
for (int x = 0; x < k; x++)
bit[x] = new int[toCy[x].size() + 1];
int sum = 0;
for (int i = 1; i <= r - 1; i++) {
for (int j = c; j >= 1; j--) {
if (i == 1 && j == 1) {
update(1, bit[g[1][1]], 1);
continue;
}
sum = 0;
int id = g[i][j];
int x = toCy[id].get(j);
sum = (prefix[i - 1][j - 1] - query(x - 1, bit[id])) % MOD;
prefix[i][j] += sum;
update(x, bit[id], sum);
}
for (int j = 1; j <= c; j++)
prefix[i][j] = (((prefix[i][j] + prefix[i - 1][j]) % MOD + prefix[i][j - 1]) % MOD - prefix[i - 1][j - 1]) % MOD;
}
sum = (prefix[r - 1][c - 1] - query(toCy[g[r][c]].get(c) - 1, bit[g[r][c]])) % MOD;
if (sum < 0)
System.out.println(sum + MOD);
else
System.out.println(sum % MOD);
}
private static void update (int x, int[] tree, int v) {
for (int idx = x; idx < tree.length; idx += (idx & -idx)) {
tree[idx] = (tree[idx] + v) % MOD;
}
}
private static int query (int x, int[] tree) {
int sum = 0;
if (x == 0)
return 0;
for (int idx = x; idx > 0; idx -= (idx & -idx)) {
sum = (sum + tree[idx]) % MOD;
}
return sum;
}
static String next () throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine().trim());
return st.nextToken();
}
static long readLong () throws IOException {
return Long.parseLong(next());
}
static int readInt () throws IOException {
return Integer.parseInt(next());
}
static double readDouble () throws IOException {
return Double.parseDouble(next());
}
static String readLine () throws IOException {
return br.readLine().trim();
}
} | [
"jeffrey.xiao1998@gmail.com"
] | jeffrey.xiao1998@gmail.com |
652238f47d0154548792c8cf6d0aa13572103d34 | 8a306cd81431acf267f84fcf4c16082843993fa8 | /demos/src/main/java/cn/touch/studio/hook/ShutdownHook.java | c72a2b8c43d669183d1f5db267ebfde1fc3093ff | [] | no_license | touchnan/demo | 2da47d170b241d9333c2cddce41c270685b97c6d | ff4ff386c137d549477e138eb6f711a2c2495eb5 | refs/heads/master | 2022-12-21T10:57:29.876511 | 2022-11-29T09:53:38 | 2022-11-29T09:53:38 | 115,397,602 | 0 | 0 | null | 2022-12-16T06:39:50 | 2017-12-26T07:27:11 | Java | UTF-8 | Java | false | false | 2,687 | java | /**
*
*/
package cn.touch.studio.hook;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.util.concurrent.CountDownLatch;
/**
* Created by <a href="mailto:88052350@qq.com">chengqiang.han</a> on Dec 26, 2017.
*
*/
/*-
* http://blog.csdn.net/u013256816/article/details/50394923
*
* JDK提供了Java.Runtime.addShutdownHook(Thread hook)方法,可以注册一个JVM关闭的钩子,这个钩子可以在一下几种场景中被调用:
程序正常退出
使用System.exit()
终端使用Ctrl+C触发的中断
系统关闭
OutOfMemory宕机
使用Kill pid命令干掉进程(注:在使用kill -9 pid时,是不会被调用的)
widnows下强制kill也不会被调用: taskkill /f /pid pid
*/
public class ShutdownHook {
/**
* @param args
*/
public static void main(String[] args) {
final CountDownLatch latch = new CountDownLatch(1);
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
System.out.println("invoke shutdown hook!");
latch.countDown();
}
});
System.out.println(" current process id : "+getPid());
try {
System.out.println("before to await");
// TimeUnit.SECONDS.sleep(2);
// new Thread(()-> latch.countDown()).start();
latch.await();
System.out.println("after to await");
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("exit");
System.exit(0);
}
/*-
查看Java API
java.lang.management
提供管理接口,用于监视和管理Java虚拟机以及Java虚拟机在其上运行的操作系统。
接口摘要
ClassLoadingMXBean
用于Java虚拟机的类加载系统的管理接口。
CompilationMXBean
用于Java虚拟机的编译系统的管理接口。
GarbageCollectorMXBean
用于Java虚拟机的垃圾回收的管理接口。
MemoryManagerMXBean
内存管理器的管理接口。
MemoryMXBean
Java虚拟机内存系统的管理接口。
MemoryPoolMXBean
内存池的管理接口。
OperatingSystemMXBean
用于操作系统的管理接口,Java虚拟机在此操作系统上运行。
RuntimeMXBean
Java虚拟机的运行时系统的管理接口。
ThreadMXBean
Java虚拟机线程系统的管理接口。
*/
private static long getPid() {
RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();
String name = runtimeMXBean.getName();
System.out.println("name = " + name);
return Integer.valueOf(name.split("@")[0]);
}
private static void printAllPid() {
}
}
| [
"88052350@qq.com"
] | 88052350@qq.com |
3c1815a9a7991e7058d5d044de1742328d913dc0 | 75b8de6fab624323a8b0504a721839b7f1401997 | /src/main/java/com/github/davidmoten/rtreemulti/Visualizer.java | cc8902be5c93585fc2acddd96b7b68ea86fc6250 | [
"Apache-2.0"
] | permissive | davidmoten/rtree-multi | 4188416351e4ae947c5aec7d3dc4fbe25e4c86e3 | 7f577baa09cba68a7a63746bbb622328e767a2fb | refs/heads/master | 2023-08-28T03:37:28.602347 | 2023-08-04T01:57:52 | 2023-08-04T01:58:07 | 199,580,340 | 42 | 10 | Apache-2.0 | 2023-08-04T01:58:07 | 2019-07-30T05:23:44 | Java | UTF-8 | Java | false | false | 4,807 | java | package com.github.davidmoten.rtreemulti;
import java.awt.AlphaComposite;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import com.github.davidmoten.guavamini.Preconditions;
import com.github.davidmoten.rtreemulti.geometry.Geometry;
import com.github.davidmoten.rtreemulti.geometry.Rectangle;
public final class Visualizer {
private final RTree<?, Geometry> tree;
private final int width;
private final int height;
private final Rectangle view;
private final int maxDepth;
Visualizer(RTree<?, Geometry> tree, int width, int height, Rectangle view) {
Preconditions.checkArgument(tree.dimensions() == 2, "visualizer only supported for 2 dimensions");
this.tree = tree;
this.width = width;
this.height = height;
this.view = view;
this.maxDepth = calculateMaxDepth(tree.root());
}
private static <R, S extends Geometry> int calculateMaxDepth(
Optional<? extends Node<R, S>> root) {
if (!root.isPresent())
return 0;
else
return calculateDepth(root.get(), 0);
}
private static <R, S extends Geometry> int calculateDepth(Node<R, S> node, int depth) {
if (node.isLeaf())
return depth + 1;
else
return calculateDepth(((NonLeaf<R, S>) node).child(0), depth + 1);
}
public BufferedImage createImage() {
final BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
final Graphics2D g = (Graphics2D) image.getGraphics();
g.setBackground(Color.white);
g.clearRect(0, 0, width, height);
g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.75f));
if (tree.root().isPresent()) {
final List<RectangleDepth> nodeDepths = getNodeDepthsSortedByDepth(tree.root().get());
drawNode(g, nodeDepths);
}
return image;
}
private <T, S extends Geometry> List<RectangleDepth> getNodeDepthsSortedByDepth(
Node<T, S> root) {
final List<RectangleDepth> list = getRectangleDepths(root, 0);
Collections.sort(list, new Comparator<RectangleDepth>() {
@Override
public int compare(RectangleDepth n1, RectangleDepth n2) {
return ((Integer) n1.getDepth()).compareTo(n2.getDepth());
}
});
return list;
}
private <T, S extends Geometry> List<RectangleDepth> getRectangleDepths(Node<T, S> node,
int depth) {
final List<RectangleDepth> list = new ArrayList<RectangleDepth>();
list.add(new RectangleDepth(node.geometry().mbr(), depth));
if (node.isLeaf()) {
final Leaf<T, S> leaf = (Leaf<T, S>) node;
for (final Entry<T, S> entry : leaf.entries()) {
list.add(new RectangleDepth(entry.geometry().mbr(), depth + 2));
}
} else {
final NonLeaf<T, S> n = (NonLeaf<T, S>) node;
for (int i = 0; i < n.count(); i++) {
list.addAll(getRectangleDepths(n.child(i), depth + 1));
}
}
return list;
}
private void drawNode(Graphics2D g, List<RectangleDepth> nodes) {
for (final RectangleDepth node : nodes) {
final Color color = Color.getHSBColor(node.getDepth() / (maxDepth + 1f), 1f, 1f);
g.setStroke(new BasicStroke(Math.max(0.5f, maxDepth - node.getDepth() + 1 - 1)));
g.setColor(color);
final Rectangle r = node.getRectangle();
drawRectangle(g, r);
}
}
private void drawRectangle(Graphics2D g, Rectangle r) {
// x1 == x(0), x2 = y(0), y1 = x(1), y2 = y(1)
final double x1 = (r.min(0) - view.min(0)) / (view.max(0) - view.min(0)) * width;
final double y1 = (r.min(1) - view.min(1)) / (view.max(1) - view.min(1)) * height;
final double x2 = (r.max(0) - view.min(0)) / (view.max(0) - view.min(0)) * width;
final double y2 = (r.max(1) - view.min(1)) / (view.max(1) - view.min(1)) * height;
g.drawRect(rnd(x1), rnd(y1), Math.max(rnd(x2 - x1), 1), Math.max(rnd(y2 - y1), 1));
}
private static int rnd(double d) {
return (int) Math.round(d);
}
public void save(File file, String imageFormat) {
ImageSaver.save(createImage(), file, imageFormat);
}
public void save(String filename, String imageFormat) {
save(new File(filename), imageFormat);
}
public void save(String filename) {
save(new File(filename), "PNG");
}
}
| [
"davidmoten@gmail.com"
] | davidmoten@gmail.com |
4ae6e686c298dc24057edbe17364451318455769 | d250057f6fae1ebf46a21380fc8b16809d2492f2 | /LeetCode/20210721LC/src/JZ33.java | 4ba47d6f01dbf483c7ae9655a5c2e47f24b93b09 | [] | no_license | BJT55/Code | 19a4c810fbe45d5140fcaf025f1c4bcbb335f90b | 2b26f8d825f8df129403e11c31f0da32d22c911b | refs/heads/master | 2023-08-22T21:29:49.665445 | 2021-10-13T15:12:20 | 2021-10-13T15:12:20 | 316,652,235 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 541 | java | public class JZ33 {
public boolean verifyPostorder(int[] postorder) {
return recur(postorder,0,postorder.length-1);
}
private boolean recur(int[] postorder, int i, int j) {
if (i >= j){
return true;
}
int p = i;
while (postorder[p] < postorder[j]){
p++;
}
int m = p;
while (postorder[p] > postorder[j]){
p++;
}
return p == j && recur(postorder, i, m-1) && recur(postorder, m, j-1);
}
}
| [
"noreply@github.com"
] | BJT55.noreply@github.com |
26956f34d94addf4a33f09c96984b6b9bdbc0729 | 78429ec288c84898f82713cba3cb87a43ce6740a | /LinkedList/LinkedListNode.java | 92ecb8d2a01dbc415ebc27ba18a9d56449f9a187 | [] | no_license | achin1tya/DataStructure | 38c9c05df1dcc9b2ce4fea6a1743ea52163812ab | 58ab12939b2eda91bee8e96232021ed796ca0bd1 | refs/heads/master | 2020-03-09T18:38:13.856678 | 2018-04-18T16:09:42 | 2018-04-18T16:09:42 | 128,937,362 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 223 | java | package l12;
public class LinkedListNode<T> {
public T data;
public LinkedListNode<T> next;
public LinkedListNode()
{
this.next=null;
}
public LinkedListNode(T data2) {
this.data=data2;
this.next=null;
}
}
| [
"achin1tya@gmail.com"
] | achin1tya@gmail.com |
885eaad306f246921a316022af81947e042fb84f | a1c0c5ba5c8ef9f6958531a3e5e32fefc71c0358 | /src/LeetCode/ReverseLinkedList2.java | b1da52a3517b2c3c8b33f8d78ea9ad08e144bea2 | [
"MIT"
] | permissive | dingxwsimon/codingquestions | 0779e581af8621ca1727203adb2342bdf867c0df | d2d74354edbb7fd553889fddb00e8fe520e468e2 | refs/heads/master | 2021-06-26T21:00:09.982628 | 2017-01-14T21:43:13 | 2017-01-14T21:43:16 | 32,652,320 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,330 | java | package LeetCode;
import LeetCode.AddLinkList.ListNode;
public class ReverseLinkedList2 {
// less number of extra nodes similar to reversNodeinK
public ListNode reverseBetween1(ListNode head, int m, int n) {
// Start typing your Java solution below
// DO NOT write main() function
int count = 1;
ListNode prev = new ListNode(0);
prev.next = head;
ListNode cur = prev.next;
ListNode h = prev;
while (true) {
if (count >= m && count < n) {
ListNode temp = cur.next;
cur.next = temp.next;
temp.next = prev.next;
prev.next = temp;
} else if (count < m) {
prev = cur;
cur = cur.next;
} else if (count == n) {
break;
}
count++;
}
return h.next;
}
// pass both
public ListNode reverseBetween(ListNode head, int m, int n) {
// Start typing your Java solution below
// DO NOT write main() function
int count = 1;
ListNode g = new ListNode(0);
g.next = head;
ListNode end = head;
ListNode prev = head, cur = head.next, next = null, x = g;
// this has less link manipulation
while (true) {
if (count >= m && count < n) {
next = cur.next;
cur.next = prev;
prev = cur;
cur = next;
} else if (count < m) {
x = prev;
prev = cur;
cur = cur.next;
} else if (count == n) {
x.next.next = cur;
x.next = prev;
break;
}
count++;
}
return g.next;
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
ListNode a = new ListNode(1);
a.next = new ListNode(2);
a.next.next = new ListNode(3);
a.next.next.next = new ListNode(4);
ReverseLinkedList2 r = new ReverseLinkedList2();
r.reverseBetween1(a, 2, 4);
// a.next.next.next.next = new ListNode(8);
}
}
| [
"dingxwsimon@gmail.com"
] | dingxwsimon@gmail.com |
e80943040b2816701c1152a3f8ff979591cb1e77 | 376e80e27a09871e85acc490ea2dfa206c43e5e1 | /app/src/main/java/com/example/dashboard/DashBoard.java | 31390a4d5c1b070cdc84af65b44259d4694c6263 | [] | no_license | Maruthi04/Caduceus-Agora | fee2225f60d405e7d64ff8f32cceeda672cdf225 | 3567bd6643daaa6230ab1acdf347eed2d3046ba1 | refs/heads/master | 2021-01-01T12:44:27.471564 | 2020-02-09T10:25:49 | 2020-02-09T10:25:49 | 239,284,512 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 880 | java | package com.example.dashboard;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import com.google.firebase.auth.FirebaseAuth;
public class DashBoard extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dash_board);
}
public void chtbotpage(View v)
{
Intent in=new Intent(this,chatbot.class);
startActivity(in);
}
public void expericne(View v)
{
Intent in=new Intent(this,exploreactivity.class);
startActivity(in);
}
public void logout(View v)
{
Intent in =new Intent(DashBoard.this,LoginActivity.class);
startActivity(in);
FirebaseAuth.getInstance().signOut();
}
}
| [
"smaruthisrinivas420@gmail.com"
] | smaruthisrinivas420@gmail.com |
9ae17f16633b733d0f8a4023d62079ec4d889926 | c8b4e168f3dd5e21888fb3076f83018d49cbdc39 | /pattern24.java | f31056bb839c4beb43e85df53b2748405f9355e2 | [] | no_license | jitendermittal8697/patterns_practice | bcedf1ef484f7218cc39194d2f59ece37c7dda05 | b6786c5b91751dcb9dcf9f13a1e9c4bb989005e9 | refs/heads/master | 2020-04-13T07:00:21.490987 | 2018-12-25T02:17:20 | 2018-12-25T02:17:20 | 163,037,079 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 394 | java | /*
1 2 3 4 5
2 3 4 5
3 4 5
4 5
5
4 5
3 4 5
2 3 4 5
1 2 3 4 5
*/
class pattern24
{
public static void main(String... args)
{
int n=4;
for(int i = -n ; i <= n ; i++)
{
for(int j = n - Math.abs(i) + 1 ; j <= n + 1 ; j++)
{
System.out.print(j + " ");
}
System.out.println();
}
}
} | [
"jitendermittal8697@gmail.com"
] | jitendermittal8697@gmail.com |
56d8bd938e82a42dbbde67cb8d7eaf6654f0036c | 94a8ee6453f9c05a1a1e9aa09117c083ca783ae6 | /Exercise27/src/Exericse27/MichaelBarr/View.java | 8921195d5e321e41c35e9f2f8b4b8ad7cb86230d | [] | no_license | MichaelDB1/EclipseExercises | 2a508c1a36a48d89943ab1990f2f3e9765076d07 | 6e13b17cbf0eb7aff55b13a50a0f4281b4df5b49 | refs/heads/master | 2020-04-11T06:48:24.729388 | 2016-09-13T18:39:20 | 2016-09-13T18:39:20 | 68,135,640 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 217 | java | package Exericse27.MichaelBarr;
import java.io.IOException;
public interface View {
public String get();
public <T> void say(T message);
public void start();
public void stop() throws IOException;
}
| [
"michaelbarr@hotmail.co.nz"
] | michaelbarr@hotmail.co.nz |
cc7d9a61c28aa641d4813d961ffa51a45e6b312d | c38eaa20465e3b6f825cc241a281dd5973936ba1 | /018-UserDefinedExceptions/src/com/infy/userdefinedexception/VehicleException.java | 28974020d22eb676e3f6a87dd6b4a1627f7703d6 | [] | no_license | sajalsinghal7/Recruitment | 9fe2a51e76f0813f03dd03b22e2867daf50bdb8c | e7aedd9219059a4ed8b5d36bef9574fe72e56ee0 | refs/heads/master | 2020-12-02T06:43:24.311030 | 2017-12-30T11:37:08 | 2017-12-30T11:37:08 | 96,887,191 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 228 | java | package com.infy.userdefinedexception;
// Creates user defined exception
@SuppressWarnings("serial")
public class VehicleException extends Exception{
public VehicleException(String message)
{
super(message);
}
}
| [
"noreply@github.com"
] | sajalsinghal7.noreply@github.com |
2a93b025c71fed148c7698012fead038faf89946 | 1ec2e11f7d7976557b747cbc2322709ba8b49fd8 | /noodlecommon-trace/src/main/java/org/fl/noodle/common/trace/operation/method/TraceParamToString.java | c07b08e27aacca5032fd6e1eb770a43033144b40 | [] | no_license | fenglingguitar/noodlecommon | 67a42af9b430fa4304663e8a57df49c2d0c47c01 | 186b670f0c0a5e01d343b6d5b7812c6ee2d2b7d0 | refs/heads/master | 2022-12-27T08:40:27.422739 | 2017-07-07T04:46:34 | 2017-07-07T04:46:34 | 32,382,195 | 5 | 2 | null | 2022-12-16T05:35:36 | 2015-03-17T09:00:58 | Java | UTF-8 | Java | false | false | 94 | java | package org.fl.noodle.common.trace.operation.method;
public interface TraceParamToString {
}
| [
"fenglingguitar@163.com"
] | fenglingguitar@163.com |
8c8bbca778c6abdf1b878f7f5583f20da9bd1c37 | ed3cb95dcc590e98d09117ea0b4768df18e8f99e | /project_1_3/src/b/a/f/i/Calc_1_3_10584.java | 9d56470a99618bfae0e7741c6711e7acbfa99cf2 | [] | 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.a.f.i;
public class Calc_1_3_10584 {
/** @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 |
9b7379d9acf86c5cf8577b6899009178c39c35b3 | 6b4b6666e39f6d003c6c96d849946a456e47cdef | /Core/src/main/java/com/atypon/service/ContentLicenceService.java | 9b6177a62ee90ee16719131212e7c4b0216919e5 | [] | no_license | Nasserahmed36/PublishingSystem | 24ff7c653d11f8842d106e8875f2a1ea3e03805e | 3c6ccc4a3dd99b5a9a09d87b94705125e3f1f0d3 | refs/heads/master | 2021-10-16T19:37:54.218649 | 2018-12-31T14:50:00 | 2018-12-31T14:50:00 | 157,762,837 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 302 | java | package com.atypon.service;
import com.atypon.domain.ContentLicence;
import java.util.List;
public interface ContentLicenceService {
boolean create(ContentLicence contentLicence);
boolean delete(int id);
List<ContentLicence> get(String contentId);
List<ContentLicence> getAll();
}
| [
"Nasser727086&"
] | Nasser727086& |
15da3123491a9ac0ca765caf0261c690a4613e8a | 7bfade0dee7e22c02e3d9f76f18244fd5f65aac5 | /utilities-core/src/main/java/org/utilities/core/util/pair/PairImpl.java | 8fa51398218ecf51030f67fb4d094384eed94be6 | [] | no_license | icabrejas/utilities | 85ec0fba172e8fbe377e706d2e9daa27424eb304 | bbc6fe99311a0481f3c128ae06400c78c54ae072 | refs/heads/master | 2022-12-04T07:44:01.652683 | 2020-05-15T10:31:49 | 2020-05-15T10:31:49 | 95,196,566 | 0 | 0 | null | 2022-11-24T07:26:55 | 2017-06-23T07:47:42 | Java | UTF-8 | Java | false | false | 289 | java | package org.utilities.core.util.pair;
public class PairImpl<X, Y> implements Pair<X, Y> {
private final X x;
private final Y y;
public PairImpl(X x, Y y) {
this.x = x;
this.y = y;
}
@Override
public X getX() {
return x;
}
@Override
public Y getY() {
return y;
}
}
| [
"icabrejasdiez@gmail.com"
] | icabrejasdiez@gmail.com |
2e4beae72183666c9bc3cc6ac0e86086d54ed709 | 7aad2ede574503e8c76c02d9c077a140cfe7db79 | /src/main/java/hashwork/client/sidebar/trees/AccountTree.java | f53738ec8a5e62ba5541baa730f505c0dbf6ecd7 | [] | no_license | KurtPanz/hashwork | 1a4728bc5591237b580205c4a36e5cb4220b04b7 | 9c82f8ae414875af5e3c7715266f934497ef771f | refs/heads/master | 2020-12-03T05:14:29.622360 | 2015-10-13T20:45:46 | 2015-10-13T20:45:46 | 40,195,797 | 0 | 1 | null | 2015-08-04T16:27:33 | 2015-08-04T16:27:33 | null | UTF-8 | Java | false | false | 593 | java | package hashwork.client.sidebar.trees;
import com.vaadin.event.ItemClickEvent;
import com.vaadin.ui.Tree;
import hashwork.client.content.MainLayout;
/**
* Created by hashcode on 2015/08/17.
*/
public class AccountTree extends Tree implements ItemClickEvent.ItemClickListener {
private final MainLayout main;
private static final String LANDING_TAB = "LANDING";
public AccountTree(MainLayout main) {
this.main = main;
}
@Override
public void itemClick(ItemClickEvent event) {
throw new UnsupportedOperationException("Not supported yet.");
}
}
| [
"boniface@hashcode.zm"
] | boniface@hashcode.zm |
ecc798651040e94b29d4df62b32a11b58502700f | 74ecd03a64d353ad00840fa48a968e9c1afa3d62 | /src/main/java/pw/jgo/curriculumweb/service/util/RandomUtil.java | dcc1badb10133d403369f8a56e2bd66167905ba4 | [] | no_license | jasongonin/curriweb | 574fb0521a186e14bb027148838936c6e0dbb454 | 96d26858c6594d9829ae2096bc2c5e69d5f73c2c | refs/heads/master | 2020-04-14T05:06:57.408030 | 2018-12-31T12:03:22 | 2018-12-31T12:03:22 | 163,652,984 | 0 | 0 | null | 2018-12-31T12:03:23 | 2018-12-31T08:36:46 | Java | UTF-8 | Java | false | false | 1,465 | java | package pw.jgo.curriculumweb.service.util;
import org.apache.commons.lang3.RandomStringUtils;
/**
* Utility class for generating random Strings.
*/
public final class RandomUtil {
private static final int DEF_COUNT = 20;
private RandomUtil() {
}
/**
* Generate a password.
*
* @return the generated password
*/
public static String generatePassword() {
return RandomStringUtils.randomAlphanumeric(DEF_COUNT);
}
/**
* Generate an activation key.
*
* @return the generated activation key
*/
public static String generateActivationKey() {
return RandomStringUtils.randomNumeric(DEF_COUNT);
}
/**
* Generate a reset key.
*
* @return the generated reset key
*/
public static String generateResetKey() {
return RandomStringUtils.randomNumeric(DEF_COUNT);
}
/**
* Generate a unique series to validate a persistent token, used in the
* authentication remember-me mechanism.
*
* @return the generated series data
*/
public static String generateSeriesData() {
return RandomStringUtils.randomAlphanumeric(DEF_COUNT);
}
/**
* Generate a persistent token, used in the authentication remember-me mechanism.
*
* @return the generated token data
*/
public static String generateTokenData() {
return RandomStringUtils.randomAlphanumeric(DEF_COUNT);
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
27c3fee008c7e9bc3e97b3cb408f9945e29e9621 | 766f025825648fc1753a99f62b38071e049fa0cf | /src/main/java/cn/bs/service/EngineerService.java | 4d1aef849581203ccbf5f210438215d218df8cea | [] | no_license | zzxw/520 | 391479fbb636a91bab21e3dc5ca0d87011ec6c19 | 8ca9986a9f7bacbd3a6014eea228208560393432 | refs/heads/master | 2020-03-18T01:46:11.717017 | 2018-06-13T13:45:12 | 2018-06-13T13:45:12 | 134,158,869 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 62 | java | package cn.bs.service;
public interface EngineerService {
}
| [
"hunk@chinasystems.com"
] | hunk@chinasystems.com |
c82178d3b62aca42632a92451b0fe11b1b10a802 | be36d65b73174cf64ae4521fe950d23cdbeffd0e | /src/main/java/com/ariatemplates/seleniumjavarobot/SeleniumJavaRobot.java | 3f02465759158d0c4282edb50fc16c979abfc36d | [
"Apache-2.0"
] | permissive | attester/selenium-java-robot | ba6fd97bde537ddc09598221193ea3d34f7b0355 | 57e02ef016e9818abd38daec72d76615c681f0a5 | refs/heads/master | 2023-06-22T20:18:12.017752 | 2020-12-14T15:05:28 | 2020-12-14T15:05:28 | 23,584,692 | 0 | 5 | Apache-2.0 | 2023-06-13T22:52:07 | 2014-09-02T15:42:15 | Java | UTF-8 | Java | false | false | 4,409 | java | /*
* Copyright 2014 Amadeus s.a.s.
* 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.ariatemplates.seleniumjavarobot;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.Point;
import com.ariatemplates.seleniumjavarobot.calibrator.Calibrator;
import com.ariatemplates.seleniumjavarobot.executor.Executor;
public class SeleniumJavaRobot {
// Public options (not supposed to be changed after calling start):
public String url;
public boolean autoRestart;
public IRobotizedBrowserFactory robotizedBrowserFactory;
// Private fields:
private final Thread mainThread = createMainThread();
private final ExecutorService quitExecutor = Executors.newSingleThreadExecutor();
private final Object lock = new Object();
// The previous lock object is a lock for the following 2 fields:
private RobotizedBrowser robotizedBrowser;
private boolean stopped = false;
public void start() {
mainThread.start();
}
public void stop() throws InterruptedException {
synchronized (lock) {
if (!stopped && mainThread.isAlive()) {
log("Closing ...");
}
stopped = true;
if (robotizedBrowser != null) {
robotizedBrowser.stop();
}
}
mainThread.join();
}
private Thread createMainThread() {
Thread result = new Thread(new Runnable() {
public void run() {
do {
RobotizedBrowser robotizedBrowser = null;
try {
synchronized (lock) {
if (stopped) {
break;
}
robotizedBrowser = robotizedBrowserFactory.createRobotizedBrowser();
SeleniumJavaRobot.this.robotizedBrowser = robotizedBrowser;
}
startDriver(robotizedBrowser, url);
} catch (RuntimeException e) {
e.printStackTrace();
} catch (InterruptedException e) {
break;
} finally {
if (robotizedBrowser != null) {
stopBrowserLater(robotizedBrowser);
}
}
} while (autoRestart);
quitExecutor.shutdown();
try {
quitExecutor.awaitTermination(1, TimeUnit.MINUTES);
} catch (InterruptedException e) {
}
SeleniumJavaRobot.log("End");
}
});
result.setDaemon(false);
return result;
}
private void stopBrowserLater(final RobotizedBrowser robotizedBrowser) {
quitExecutor.execute(new Runnable() {
public void run() {
// Makes sure the driver is closed. This is done
// asynchronously so that we don't loose too
// much time when --auto-restart is used,
// because the quit method can take a long time
// to finish in case the browser crashed or was
// terminated forcefully.
robotizedBrowser.stop();
}
});
}
public static void startDriver(RobotizedBrowser robotizedBrowser, String url) throws InterruptedException {
Point offset = Calibrator.calibrate(robotizedBrowser);
log("Computed offset: " + offset);
robotizedBrowser.browser.get(url);
Executor executor = new Executor(robotizedBrowser, offset);
executor.run();
}
public static void log(String log) {
System.out.println("[Selenium Java Robot] " + log);
}
}
| [
"david-emmanuel.divernois@amadeus.com"
] | david-emmanuel.divernois@amadeus.com |
8d972bd5cd6ea121442f5c2a799764c586ffbec6 | a4577efc9b052c91a16ec5097b3bf6b7ce3d9974 | /src/main/java/br/com/alura/forum/repository/TopicoRepository.java | 4450e5e0c27f36c8eae9cef427a363f0ea5e16ab | [] | no_license | LuisCGS/estudo-forum | e6435921c749c7925e0ef895932f9cfb9159f3e9 | 2cd78f5e2b2792c828e7be0a7a0a08b5dc35c699 | refs/heads/master | 2022-12-27T19:09:04.978734 | 2020-10-07T20:13:36 | 2020-10-07T20:13:36 | 297,990,850 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 953 | java | package br.com.alura.forum.repository;
import br.com.alura.forum.model.Topico;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
public interface TopicoRepository extends JpaRepository<Topico, Long/* tipo do id da classe topico*/> {
//List<Topico> findByTitulo(String nomeCurso);
Page<Topico> findByCurso_Nome(String nomeCurso, Pageable paginacao);//curso é o relacionamento e nome é o atributo de curso
// Quando o atributo da classe conflitar com um relacionamento e atributo utilizar o _ pra mostrar que sera de uma classe o relacionamento
@Query("SELECT t FROM Topico t WHERE t.curso.nome = : nomeCurso")
List<Topico> carregarPorNomeDoCurso(@Param("nomeCurso") String nomeCurso);
}
| [
"luis.cgs.fatec@gmail.com"
] | luis.cgs.fatec@gmail.com |
03d944d9a688bd267e875f017f1431de9b638d2f | 3fc10c69f123bfaf831cc0883008060e43bed946 | /src/PetStore/Cao.java | 050e2fefb6a0eeded369b250cc13569a290815ec | [] | no_license | ff0rever/ATP-Java | 7bad18aa539f4fe6e6b6716ea077e89c2d8419b7 | f87cb7f45f726798bf43487b02bd6e84e627ac2a | refs/heads/master | 2023-06-07T02:11:44.484610 | 2021-06-28T22:09:12 | 2021-06-28T22:09:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 304 | java | package PetStore;
public class Cao extends Mamifero {
private static final long serialVersionUID = 1L;
public String soar() {
return "Faz latidos";
}
public Cao(String nome, int idade, String dono) {
super(nome, idade, dono);
this.especie = "Cachorro";
}
}
| [
"fpadillamiranda@gmail.com"
] | fpadillamiranda@gmail.com |
7196b4693f7e70a1d6902c4c405e911df8745964 | d8a0c0414d4a182026ea4e38492c3ceadc477a04 | /array/SingleDimensionArray.java | 9c825c1fcaa2edb406a1ed7119a07ea8b17d869d | [] | no_license | samaythakkar/DataStructuresWithJava | 568f20e5696d9b5756db4facb8331f5bcbd0680f | bfae74c7b23a0151d7141f3b24ee0ec5bfd40643 | refs/heads/master | 2022-11-28T00:06:48.641533 | 2020-08-14T23:09:32 | 2020-08-14T23:09:32 | 287,640,196 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,810 | java | package array;
public class SingleDimensionArray{
int arr[] = null;
public SingleDimensionArray(int size){
arr = new int[size];
for(int i = 0 ; i < size ; i++){
arr[i] = Integer.MIN_VALUE;
}
}
public void traverseArray(){
try{
for (int i = 0 ; i < arr.length ; i++){
System.out.println(arr[i]);
}
}catch(Exception e){
System.out.println("Execption while traversing the array : " + e);
}
}
public void insertValue(int location , int value){
try{
if (arr[location] == Integer.MIN_VALUE){
arr[location] = value;
}else{
System.out.println("Value at that point is already defined");
}
}catch(Exception e){
System.out.println("Error while inserting the value at location ");
}
}
public void accessCellAtLocation(int location){
try{
System.out.println("Value of cell at location " +location+ " is " +arr[location]);
}catch(Exception e){
System.out.println("Exception while acessing cell : " + e);
}
}
public void searchInArray(int value){
try{
for(int i = 0 ; i < arr.length ; i++){
if(arr[i] == value){
System.out.println("Value found at index :"+i);
}
}
}catch(Exception e){
System.out.println(("Error found whle searching value in an array"));
}
}
public void deleteValueFromArray(int location){
try{
arr[location] = Integer.MIN_VALUE;
}catch(Exception e){
System.out.println("Error while deleteing the value :"+ e);
}
}
}
| [
"samaythakkar007@yahoo.com"
] | samaythakkar007@yahoo.com |
750a5d2111ffd1d7f9ae8888806e91a59fbbc491 | 79122f1e7c83e085b2fb4042b6f69abdcf6be451 | /syncer-transmission/src/main/java/syncer/transmission/client/sentinel/RedisSentinel.java | 654b621672a6d790edbfc80b715dbd93cbf00b4c | [
"MIT",
"Apache-2.0"
] | permissive | TraceNature/redissyncer-server | 3e3cca17b62ac49a9f2f69d963983b3d9045437c | c9927901478a809cf81ef3cf8ce4b7e669b36045 | refs/heads/main | 2023-07-31T13:26:43.378856 | 2023-07-12T08:38:53 | 2023-07-12T08:38:53 | 259,215,402 | 664 | 100 | Apache-2.0 | 2023-06-14T22:31:59 | 2020-04-27T05:34:50 | Java | UTF-8 | Java | false | false | 4,830 | java | package syncer.transmission.client.sentinel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.StringUtils;
import syncer.common.config.BreakPointConfig;
import syncer.common.constant.BreakpointContinuationType;
import syncer.jedis.HostAndPort;
import syncer.jedis.Jedis;
import syncer.jedis.JedisPubSub;
import syncer.jedis.exceptions.JedisException;
import syncer.replica.sentinel.Sentinel;
import syncer.replica.sentinel.SentinelListener;
import syncer.replica.sentinel.SyncerRedisSentinel;
import syncer.replica.util.strings.Strings;
import syncer.transmission.client.RedisClient;
import syncer.transmission.client.impl.JedisMultiExecPipeLineClient;
import syncer.transmission.client.impl.JedisPipeLineClient;
import java.io.IOException;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.atomic.AtomicInteger;
import static java.lang.Integer.parseInt;
import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
/**
* 哨兵监听
*/
@Slf4j
public class RedisSentinel {
protected final String masterName;
protected final List<HostAndPort> hosts;
protected final String channel = "+switch-master";
protected final ScheduledExecutorService schedule = newSingleThreadScheduledExecutor();
protected final AtomicInteger hostsPulseSize = new AtomicInteger(0);
protected String user=null;
protected String password=null;
protected String sentinelPassword=null;
private Sentinel sentinel;
private RedisClient client;
//批次数
protected Integer count = 1000;
//错误次数
private long errorCount = 1;
/**
* 用于计算检查点的名字
*/
private String sourceHost;
private Integer sourcePort;
private String taskId;
private BreakpointContinuationType breakpointContinuationType;
public RedisSentinel(String masterName, List<HostAndPort> hosts) {
this.masterName = masterName;
this.hosts = hosts;
}
public void open() throws IOException {
this.sentinel.open();
}
public void close() throws IOException {
this.sentinel.close();
}
protected class PubSub extends JedisPubSub {
@Override
public void onMessage(String channel, String response) {
try {
final String[] messages = response.split(" ");
if (messages.length <= 3) {
log.error("failed to handle, response: {}", response);
return;
}
String prev = masterName, next = messages[0];
if (!Strings.isEquals(prev, next)) {
log.error("failed to match master, prev: {}, next: {}", prev, next);
return;
}
final String host = messages[3];
final int port = parseInt(messages[4]);
doSwitchListener(new HostAndPort(host, port));
} catch (Exception e) {
log.error("failed to subscribe: {}, cause: {}", response, e.getMessage());
}
}
}
void doSwitchListener(HostAndPort host) {
if(Objects.nonNull(client)){
}
if(BreakpointContinuationType.v1.equals(breakpointContinuationType)){
client = new JedisPipeLineClient(host.getHost(),host.getPort(),user,password,count,errorCount,taskId);
}else {
client = new JedisMultiExecPipeLineClient(host.getHost(),host.getPort(),user,password,sourceHost,sourcePort,count,errorCount,taskId);
}
}
protected void pulse() {
for (HostAndPort sentinel : hosts) {
try {
final Jedis jedis = new Jedis(sentinel);
if (!StringUtils.isEmpty(sentinelPassword)) {
jedis.auth(sentinelPassword);
}
List<String> list = jedis.sentinelGetMasterAddrByName(masterName);
if (list == null || list.size() != 2) {
int num = hostsPulseSize.incrementAndGet();
log.error("[hosts not find] 请检查[sentinel matser name ]");
close();
throw new JedisException("host: " + list);
}
String host = list.get(0);
int port = Integer.parseInt(list.get(1));
doSwitchListener(new HostAndPort(host, port));
log.info("subscribe sentinel {}", sentinel);
jedis.subscribe(new PubSub(), this.channel);
} catch (Exception e) {
e.printStackTrace();
log.warn("suspend sentinel {}, cause: {}", sentinel, e.getCause());
}
}
}
}
| [
"35362437+pingxingshikong@users.noreply.github.com"
] | 35362437+pingxingshikong@users.noreply.github.com |
76a9af9374f8c1de04c1da80541126310ab6b672 | 0d8732ab432b599045876d5ef0c5eb02406faa73 | /src/main/java/courses/formatter/lexer/stateMachine/LexerCommandsTransition.java | 5743c3ffd5ea83e92231b47b1624e8ceb720cab5 | [] | no_license | YurriSergeev/formatter | b501b35af441253afee467814daf192d1662ea71 | d16b39d2f623283b685c31daeff34959c1293a82 | refs/heads/master | 2021-08-31T04:46:00.887852 | 2017-12-20T12:08:16 | 2017-12-20T12:08:16 | 108,796,377 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 457 | java | package courses.formatter.lexer.stateMachine;
import courses.formatter.lexer.stateMachine.interfaces.ICommand;
import courses.formatter.statePackage.IState;
/**
*
*/
public class LexerCommandsTransition {
/**
*
* @param state current state;
* @param c char;
* @return command;
*/
public static ICommand getCommand(final IState state, final char c) {
return (new LexerCommandsMap()).getCommand(state, c);
}
}
| [
"yurri.sergeev@gmail.com"
] | yurri.sergeev@gmail.com |
8d431a162b65436345fc87dde68740cac9d4e1f8 | 6baf1fe00541560788e78de5244ae17a7a2b375a | /hollywood/com.oculus.environment.prod.bubbles-EnvironmentBubbles/sources/android/support/v4/app/ShareCompat.java | e27dd73fb41e61a61e45b32106af84aa632b5420 | [] | no_license | phwd/quest-tracker | 286e605644fc05f00f4904e51f73d77444a78003 | 3d46fbb467ba11bee5827f7cae7dfeabeb1fd2ba | refs/heads/main | 2023-03-29T20:33:10.959529 | 2021-04-10T22:14:11 | 2021-04-10T22:14:11 | 357,185,040 | 4 | 2 | null | 2021-04-12T12:28:09 | 2021-04-12T12:28:08 | null | UTF-8 | Java | false | false | 19,183 | java | package android.support.v4.app;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.support.annotation.StringRes;
import android.support.v4.content.IntentCompat;
import android.text.Html;
import android.text.Spanned;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import java.util.ArrayList;
public final class ShareCompat {
public static final String EXTRA_CALLING_ACTIVITY = "android.support.v4.app.EXTRA_CALLING_ACTIVITY";
public static final String EXTRA_CALLING_PACKAGE = "android.support.v4.app.EXTRA_CALLING_PACKAGE";
static ShareCompatImpl IMPL;
/* access modifiers changed from: package-private */
public interface ShareCompatImpl {
void configureMenuItem(MenuItem menuItem, IntentBuilder intentBuilder);
String escapeHtml(CharSequence charSequence);
}
static class ShareCompatImplBase implements ShareCompatImpl {
ShareCompatImplBase() {
}
@Override // android.support.v4.app.ShareCompat.ShareCompatImpl
public void configureMenuItem(MenuItem menuItem, IntentBuilder intentBuilder) {
menuItem.setIntent(intentBuilder.createChooserIntent());
}
@Override // android.support.v4.app.ShareCompat.ShareCompatImpl
public String escapeHtml(CharSequence charSequence) {
StringBuilder sb = new StringBuilder();
withinStyle(sb, charSequence, 0, charSequence.length());
return sb.toString();
}
private static void withinStyle(StringBuilder sb, CharSequence charSequence, int i, int i2) {
while (i < i2) {
char charAt = charSequence.charAt(i);
if (charAt == '<') {
sb.append("<");
} else if (charAt == '>') {
sb.append(">");
} else if (charAt == '&') {
sb.append("&");
} else if (charAt > '~' || charAt < ' ') {
sb.append("&#" + ((int) charAt) + ";");
} else if (charAt == ' ') {
while (true) {
int i3 = i + 1;
if (i3 >= i2 || charSequence.charAt(i3) != ' ') {
sb.append(' ');
} else {
sb.append(" ");
i = i3;
}
}
sb.append(' ');
} else {
sb.append(charAt);
}
i++;
}
}
}
static class ShareCompatImplICS extends ShareCompatImplBase {
ShareCompatImplICS() {
}
@Override // android.support.v4.app.ShareCompat.ShareCompatImpl, android.support.v4.app.ShareCompat.ShareCompatImplBase
public void configureMenuItem(MenuItem menuItem, IntentBuilder intentBuilder) {
ShareCompatICS.configureMenuItem(menuItem, intentBuilder.getActivity(), intentBuilder.getIntent());
if (shouldAddChooserIntent(menuItem)) {
menuItem.setIntent(intentBuilder.createChooserIntent());
}
}
/* access modifiers changed from: package-private */
public boolean shouldAddChooserIntent(MenuItem menuItem) {
return !menuItem.hasSubMenu();
}
}
static class ShareCompatImplJB extends ShareCompatImplICS {
/* access modifiers changed from: package-private */
@Override // android.support.v4.app.ShareCompat.ShareCompatImplICS
public boolean shouldAddChooserIntent(MenuItem menuItem) {
return false;
}
ShareCompatImplJB() {
}
@Override // android.support.v4.app.ShareCompat.ShareCompatImpl, android.support.v4.app.ShareCompat.ShareCompatImplBase
public String escapeHtml(CharSequence charSequence) {
return ShareCompatJB.escapeHtml(charSequence);
}
}
static {
if (Build.VERSION.SDK_INT >= 16) {
IMPL = new ShareCompatImplJB();
} else if (Build.VERSION.SDK_INT >= 14) {
IMPL = new ShareCompatImplICS();
} else {
IMPL = new ShareCompatImplBase();
}
}
private ShareCompat() {
}
public static String getCallingPackage(Activity activity) {
String callingPackage = activity.getCallingPackage();
return callingPackage == null ? activity.getIntent().getStringExtra(EXTRA_CALLING_PACKAGE) : callingPackage;
}
public static ComponentName getCallingActivity(Activity activity) {
ComponentName callingActivity = activity.getCallingActivity();
return callingActivity == null ? (ComponentName) activity.getIntent().getParcelableExtra(EXTRA_CALLING_ACTIVITY) : callingActivity;
}
public static void configureMenuItem(MenuItem menuItem, IntentBuilder intentBuilder) {
IMPL.configureMenuItem(menuItem, intentBuilder);
}
public static void configureMenuItem(Menu menu, int i, IntentBuilder intentBuilder) {
MenuItem findItem = menu.findItem(i);
if (findItem != null) {
configureMenuItem(findItem, intentBuilder);
return;
}
throw new IllegalArgumentException("Could not find menu item with id " + i + " in the supplied menu");
}
public static class IntentBuilder {
private Activity mActivity;
private ArrayList<String> mBccAddresses;
private ArrayList<String> mCcAddresses;
private CharSequence mChooserTitle;
private Intent mIntent = new Intent().setAction("android.intent.action.SEND");
private ArrayList<Uri> mStreams;
private ArrayList<String> mToAddresses;
public static IntentBuilder from(Activity activity) {
return new IntentBuilder(activity);
}
private IntentBuilder(Activity activity) {
this.mActivity = activity;
this.mIntent.putExtra(ShareCompat.EXTRA_CALLING_PACKAGE, activity.getPackageName());
this.mIntent.putExtra(ShareCompat.EXTRA_CALLING_ACTIVITY, activity.getComponentName());
this.mIntent.addFlags(524288);
}
public Intent getIntent() {
ArrayList<String> arrayList = this.mToAddresses;
if (arrayList != null) {
combineArrayExtra("android.intent.extra.EMAIL", arrayList);
this.mToAddresses = null;
}
ArrayList<String> arrayList2 = this.mCcAddresses;
if (arrayList2 != null) {
combineArrayExtra("android.intent.extra.CC", arrayList2);
this.mCcAddresses = null;
}
ArrayList<String> arrayList3 = this.mBccAddresses;
if (arrayList3 != null) {
combineArrayExtra("android.intent.extra.BCC", arrayList3);
this.mBccAddresses = null;
}
ArrayList<Uri> arrayList4 = this.mStreams;
boolean z = true;
if (arrayList4 == null || arrayList4.size() <= 1) {
z = false;
}
boolean equals = this.mIntent.getAction().equals("android.intent.action.SEND_MULTIPLE");
if (!z && equals) {
this.mIntent.setAction("android.intent.action.SEND");
ArrayList<Uri> arrayList5 = this.mStreams;
if (arrayList5 == null || arrayList5.isEmpty()) {
this.mIntent.removeExtra("android.intent.extra.STREAM");
} else {
this.mIntent.putExtra("android.intent.extra.STREAM", this.mStreams.get(0));
}
this.mStreams = null;
}
if (z && !equals) {
this.mIntent.setAction("android.intent.action.SEND_MULTIPLE");
ArrayList<Uri> arrayList6 = this.mStreams;
if (arrayList6 == null || arrayList6.isEmpty()) {
this.mIntent.removeExtra("android.intent.extra.STREAM");
} else {
this.mIntent.putParcelableArrayListExtra("android.intent.extra.STREAM", this.mStreams);
}
}
return this.mIntent;
}
/* access modifiers changed from: package-private */
public Activity getActivity() {
return this.mActivity;
}
private void combineArrayExtra(String str, ArrayList<String> arrayList) {
String[] stringArrayExtra = this.mIntent.getStringArrayExtra(str);
int length = stringArrayExtra != null ? stringArrayExtra.length : 0;
String[] strArr = new String[(arrayList.size() + length)];
arrayList.toArray(strArr);
if (stringArrayExtra != null) {
System.arraycopy(stringArrayExtra, 0, strArr, arrayList.size(), length);
}
this.mIntent.putExtra(str, strArr);
}
private void combineArrayExtra(String str, String[] strArr) {
Intent intent = getIntent();
String[] stringArrayExtra = intent.getStringArrayExtra(str);
int length = stringArrayExtra != null ? stringArrayExtra.length : 0;
String[] strArr2 = new String[(strArr.length + length)];
if (stringArrayExtra != null) {
System.arraycopy(stringArrayExtra, 0, strArr2, 0, length);
}
System.arraycopy(strArr, 0, strArr2, length, strArr.length);
intent.putExtra(str, strArr2);
}
public Intent createChooserIntent() {
return Intent.createChooser(getIntent(), this.mChooserTitle);
}
public void startChooser() {
this.mActivity.startActivity(createChooserIntent());
}
public IntentBuilder setChooserTitle(CharSequence charSequence) {
this.mChooserTitle = charSequence;
return this;
}
public IntentBuilder setChooserTitle(@StringRes int i) {
return setChooserTitle(this.mActivity.getText(i));
}
public IntentBuilder setType(String str) {
this.mIntent.setType(str);
return this;
}
public IntentBuilder setText(CharSequence charSequence) {
this.mIntent.putExtra("android.intent.extra.TEXT", charSequence);
return this;
}
public IntentBuilder setHtmlText(String str) {
this.mIntent.putExtra(IntentCompat.EXTRA_HTML_TEXT, str);
if (!this.mIntent.hasExtra("android.intent.extra.TEXT")) {
setText(Html.fromHtml(str));
}
return this;
}
public IntentBuilder setStream(Uri uri) {
if (!this.mIntent.getAction().equals("android.intent.action.SEND")) {
this.mIntent.setAction("android.intent.action.SEND");
}
this.mStreams = null;
this.mIntent.putExtra("android.intent.extra.STREAM", uri);
return this;
}
public IntentBuilder addStream(Uri uri) {
Uri uri2 = (Uri) this.mIntent.getParcelableExtra("android.intent.extra.STREAM");
if (this.mStreams == null && uri2 == null) {
return setStream(uri);
}
if (this.mStreams == null) {
this.mStreams = new ArrayList<>();
}
if (uri2 != null) {
this.mIntent.removeExtra("android.intent.extra.STREAM");
this.mStreams.add(uri2);
}
this.mStreams.add(uri);
return this;
}
public IntentBuilder setEmailTo(String[] strArr) {
if (this.mToAddresses != null) {
this.mToAddresses = null;
}
this.mIntent.putExtra("android.intent.extra.EMAIL", strArr);
return this;
}
public IntentBuilder addEmailTo(String str) {
if (this.mToAddresses == null) {
this.mToAddresses = new ArrayList<>();
}
this.mToAddresses.add(str);
return this;
}
public IntentBuilder addEmailTo(String[] strArr) {
combineArrayExtra("android.intent.extra.EMAIL", strArr);
return this;
}
public IntentBuilder setEmailCc(String[] strArr) {
this.mIntent.putExtra("android.intent.extra.CC", strArr);
return this;
}
public IntentBuilder addEmailCc(String str) {
if (this.mCcAddresses == null) {
this.mCcAddresses = new ArrayList<>();
}
this.mCcAddresses.add(str);
return this;
}
public IntentBuilder addEmailCc(String[] strArr) {
combineArrayExtra("android.intent.extra.CC", strArr);
return this;
}
public IntentBuilder setEmailBcc(String[] strArr) {
this.mIntent.putExtra("android.intent.extra.BCC", strArr);
return this;
}
public IntentBuilder addEmailBcc(String str) {
if (this.mBccAddresses == null) {
this.mBccAddresses = new ArrayList<>();
}
this.mBccAddresses.add(str);
return this;
}
public IntentBuilder addEmailBcc(String[] strArr) {
combineArrayExtra("android.intent.extra.BCC", strArr);
return this;
}
public IntentBuilder setSubject(String str) {
this.mIntent.putExtra("android.intent.extra.SUBJECT", str);
return this;
}
}
public static class IntentReader {
private static final String TAG = "IntentReader";
private Activity mActivity;
private ComponentName mCallingActivity;
private String mCallingPackage;
private Intent mIntent;
private ArrayList<Uri> mStreams;
public static IntentReader from(Activity activity) {
return new IntentReader(activity);
}
private IntentReader(Activity activity) {
this.mActivity = activity;
this.mIntent = activity.getIntent();
this.mCallingPackage = ShareCompat.getCallingPackage(activity);
this.mCallingActivity = ShareCompat.getCallingActivity(activity);
}
public boolean isShareIntent() {
String action = this.mIntent.getAction();
return "android.intent.action.SEND".equals(action) || "android.intent.action.SEND_MULTIPLE".equals(action);
}
public boolean isSingleShare() {
return "android.intent.action.SEND".equals(this.mIntent.getAction());
}
public boolean isMultipleShare() {
return "android.intent.action.SEND_MULTIPLE".equals(this.mIntent.getAction());
}
public String getType() {
return this.mIntent.getType();
}
public CharSequence getText() {
return this.mIntent.getCharSequenceExtra("android.intent.extra.TEXT");
}
public String getHtmlText() {
String stringExtra = this.mIntent.getStringExtra(IntentCompat.EXTRA_HTML_TEXT);
if (stringExtra != null) {
return stringExtra;
}
CharSequence text = getText();
if (text instanceof Spanned) {
return Html.toHtml((Spanned) text);
}
return text != null ? ShareCompat.IMPL.escapeHtml(text) : stringExtra;
}
public Uri getStream() {
return (Uri) this.mIntent.getParcelableExtra("android.intent.extra.STREAM");
}
public Uri getStream(int i) {
if (this.mStreams == null && isMultipleShare()) {
this.mStreams = this.mIntent.getParcelableArrayListExtra("android.intent.extra.STREAM");
}
ArrayList<Uri> arrayList = this.mStreams;
if (arrayList != null) {
return arrayList.get(i);
}
if (i == 0) {
return (Uri) this.mIntent.getParcelableExtra("android.intent.extra.STREAM");
}
throw new IndexOutOfBoundsException("Stream items available: " + getStreamCount() + " index requested: " + i);
}
public int getStreamCount() {
if (this.mStreams == null && isMultipleShare()) {
this.mStreams = this.mIntent.getParcelableArrayListExtra("android.intent.extra.STREAM");
}
ArrayList<Uri> arrayList = this.mStreams;
if (arrayList != null) {
return arrayList.size();
}
return this.mIntent.hasExtra("android.intent.extra.STREAM") ? 1 : 0;
}
public String[] getEmailTo() {
return this.mIntent.getStringArrayExtra("android.intent.extra.EMAIL");
}
public String[] getEmailCc() {
return this.mIntent.getStringArrayExtra("android.intent.extra.CC");
}
public String[] getEmailBcc() {
return this.mIntent.getStringArrayExtra("android.intent.extra.BCC");
}
public String getSubject() {
return this.mIntent.getStringExtra("android.intent.extra.SUBJECT");
}
public String getCallingPackage() {
return this.mCallingPackage;
}
public ComponentName getCallingActivity() {
return this.mCallingActivity;
}
public Drawable getCallingActivityIcon() {
if (this.mCallingActivity == null) {
return null;
}
try {
return this.mActivity.getPackageManager().getActivityIcon(this.mCallingActivity);
} catch (PackageManager.NameNotFoundException e) {
Log.e(TAG, "Could not retrieve icon for calling activity", e);
return null;
}
}
public Drawable getCallingApplicationIcon() {
if (this.mCallingPackage == null) {
return null;
}
try {
return this.mActivity.getPackageManager().getApplicationIcon(this.mCallingPackage);
} catch (PackageManager.NameNotFoundException e) {
Log.e(TAG, "Could not retrieve icon for calling application", e);
return null;
}
}
public CharSequence getCallingApplicationLabel() {
if (this.mCallingPackage == null) {
return null;
}
PackageManager packageManager = this.mActivity.getPackageManager();
try {
return packageManager.getApplicationLabel(packageManager.getApplicationInfo(this.mCallingPackage, 0));
} catch (PackageManager.NameNotFoundException e) {
Log.e(TAG, "Could not retrieve label for calling application", e);
return null;
}
}
}
}
| [
"cyuubiapps@gmail.com"
] | cyuubiapps@gmail.com |
580650f82dfc3efc4a5d30328ffbd3214eb8c21d | 275c5bda1294283cb7c007fea0b6d1a43761e2bb | /raven-compiler/src/main/java/org/raven/antlr/ast/Defer.java | e0319ba0ed8bf56c2624596d989ab22d7752a9f6 | [
"MIT"
] | permissive | BradleyWood/Raven-Lang | 5956bd480bc14d4481969dfec79312a66576855e | 8ad3bf166a33b71975f2b87ba8ec67245289fad3 | refs/heads/master | 2021-07-10T22:03:25.246892 | 2019-01-06T10:24:12 | 2019-01-06T10:24:12 | 102,515,994 | 2 | 0 | MIT | 2018-07-03T17:56:53 | 2017-09-05T18:27:34 | Java | UTF-8 | Java | false | false | 759 | java | package org.raven.antlr.ast;
import java.util.Objects;
public class Defer extends Statement {
private Call call;
public Defer(final Call call) {
this.call = call;
}
public Call getCall() {
return call;
}
public void setCall(final Call call) {
this.call = call;
}
@Override
public void accept(final TreeVisitor visitor) {
visitor.visitDefer(this);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Defer defer = (Defer) o;
return Objects.equals(call, defer.call);
}
@Override
public int hashCode() {
return Objects.hash(call);
}
}
| [
"bradley.wood@uoit.net"
] | bradley.wood@uoit.net |
2b59c9bf8983fa79cc83309a4a55284307e64edf | 049a1726513ae29104ca3b8a1c6db1b6b3c764c0 | /src/com/heatclub/moro/MainActivity.java | 4b005924573421dbdcf355b225695c3599dea0ec | [
"Apache-2.0"
] | permissive | heatmax/moro | a913059b2b28274967459f97eec2a814236940eb | e1769bc8356a47c88143577e6d7952dd5c3c706c | refs/heads/master | 2021-01-20T11:31:44.736130 | 2014-08-21T02:09:19 | 2014-08-21T02:09:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,878 | java | package com.heatclub.moro;
import com.heatclub.moro.util.AppProtection;
import com.heatclub.moro.cmd.CommandGenerator;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.Toast;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.TabHost;
import android.text.method.ScrollingMovementMethod;
import android.telephony.TelephonyManager;
import android.widget.CompoundButton;
import android.widget.ToggleButton;
import android.view.Menu;
import android.view.MenuItem;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
//import junit.framework.*;
import android.app.ActionBar;
import java.text.SimpleDateFormat;
import android.content.ServiceConnection;
import android.content.ComponentName;
import android.os.IBinder;
import org.xml.sax.*;
public class MainActivity extends Activity implements View.OnClickListener
{
/* private static String ACTION = "com.lim.frauder.RUN";
private static final String TYPE = "type";
private static final int ID_ACTION_AUTOCALL_START = 0;
private static final int ID_ACTION_AUTOCALL_STOP = 1;
private static final int ID_ACTION_AUTOANSWER_START = 2;
private static final int ID_ACTION_AUTOANSWER_STOP = 3;
private static final int ID_ACTION_BROADCAST_STOP = 4;
private static final int ID_ACTION_BROADCAST_START = 5;
private static final int ID_ACTION_SERVICE_STOP = 6;
private static final int ID_ACTION_SERVICE_START = 7;
*/
private static final int ID_MENU_PREF = 100;
private static final int ID_MENU_EXIT = 101;
private static final int ID_MENU_AUTOCALL = 102;
private static final int ID_MENU_AUTOANSWER = 103;
private static final int ID_NS_MANUAL = 1;
private static final int ID_NS_FILE = 2;
private static final int ID_NS_DB = 3;
private TextView logView;
private TextView info;
private ProgressBar pbCall;
private ActionBar actionBar;
private SharedPreferences prefs;
private AppProtection protect;
private static boolean isAutoCall;
private static boolean isAutoAnswer;
private boolean bound;
private ServiceConnection sConn;
private String delayAutoAnswer;
private String delay;
private String callDuration;
private String prefix;
private String isRepeatNumber;
private String isRandomNumber;
private int numberSource;
private CommandGenerator cmd;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
prefs = PreferenceManager.getDefaultSharedPreferences(this);
actionBar = this.getActionBar();
// actionBar.setNavigationMode(3);
// actionBar.setDisplayShowTitleEnabled(false);
// actionBar.setSelectedNavigationItem(1);
//Проверить активацию приложения
protect = new AppProtection(this);
protect.checkActivation(true);
//Запустить службу XMPP
cmd = new CommandGenerator();
if(!cmd.isCommandIntent(getIntent())){
cmd.setAuthor("local");
cmd.setFrom("MainActivity");
cmd.setTo("xmpp");
cmd.setCommandName("start");
sendBroadcast(cmd.getCommandIntent());
}
else{
// processCommand(getIntent());
}
//Запустить службу приложения
// Intent intent2 = new Intent(ACTION);
// intent.putExtra(TYPE, ID_ACTION_SERVICE_START);
// sendBroadcast(intent);
setContentView(R.layout.main);
TabHost tabs=(TabHost)findViewById(android.R.id.tabhost);
tabs.setup();
TabHost.TabSpec spec = tabs.newTabSpec("tag1");
spec.setContent(R.id.tab1);
spec.setIndicator("Главный");
tabs.addTab(spec);
spec = tabs.newTabSpec("tag2");
spec.setContent(R.id.tab2);
spec.setIndicator("Журнал");
tabs.addTab(spec);
/*
spec = tabs.newTabSpec("tag3");
spec.setContent(R.id.tabPage3);
spec.setIndicator("Document 3");
tabs.addTab(spec);
*/
tabs.setCurrentTab(0);
logView = (TextView)findViewById(R.id.logView);
logView.setMovementMethod(new ScrollingMovementMethod());
info = (TextView)findViewById(R.id.info);
info.setMovementMethod(new ScrollingMovementMethod());
pbCall = (ProgressBar) findViewById(R.id.pbCall);
if (prefs.getBoolean("isAutoAnswerStart", true)){
autoAnswerStart();
}
sConn = new ServiceConnection() {
public void onServiceConnected(ComponentName name, IBinder binder) {
addToLog("Приложение подключено к сервису \n");
bound = true;
}
public void onServiceDisconnected(ComponentName name) {
addToLog("Приложение отключено от сервиса \n");
bound = false;
}
};
// if (prefs.getBoolean("isAutoCallStart", false))
// bAutoCall.setChecked(true);
}
@Override
public void onDestroy(){
super.onDestroy();
cmd.setTo("tel");
cmd.setCommandName("stop");
sendBroadcast(cmd.getCommandIntent());
cmd.setTo("xmpp");
cmd.setCommandName("stop");
sendBroadcast(cmd.getCommandIntent());
// Intent intent = new Intent(ACTION);
// intent.putExtra(TYPE, ID_ACTION_BROADCAST_STOP);
// sendBroadcast(intent);
}
//сохранить состояние приложения
@Override
protected void onSaveInstanceState(Bundle outState) {/*
outState.putString("logCall", logCall.getText().toString());
*/
}
//Загрузить состояние приложения
protected void onLoadInstanceState(Bundle inState) {/*
if (inState != null) {
logCall.setText(inState.getString("logCall"));
}*/
}
@Override
public void onClick(View v) {
switch (v.getId()) {
}
}
//запустить цикл автодозвона
private void autoCallStart(){
if(protect.checkActivation(true)) {
if(!isAutoCall){
// CommandGenerator command = CommandGenerator.getTelCommand();
// command.setCommand();
String args[] = new String[6];
args[0] = "start";
args[1] = prefix;
args[2] = delay;
args[3] = callDuration;
args[4] = isRandomNumber;
args[5] = isRepeatNumber;
cmd.setTo("tel");
cmd.setCommandName("autocall");
cmd.setArgs(args);
sendBroadcast(cmd.getCommandIntent());
addToLog("Дозвон запущен...\n");
isAutoCall = true;
}
}
else
Toast.makeText(getApplicationContext(),
"Нужно активировать приложение", Toast.LENGTH_SHORT).show();
}
//остановить выполнение цикла автодозвона
private void autoCallStop(){
if(isAutoCall){
String[] args = new String[1];
args[0] = "stop";
cmd.setTo("tel");
cmd.setCommandName("autocall");
cmd.setArgs(args);
sendBroadcast(cmd.getCommandIntent());
addToLog("Дозвон остановлен...\n");
isAutoCall = false;
}
}
//Включить выполнение автоприема вызова
private void autoAnswerStart(){
if(!isAutoAnswer){
String[] args = new String[1];
args[0] = "on";
cmd.setTo("tel");
cmd.setCommandName("autoanswer");
cmd.setArgs(args);
sendBroadcast(cmd.getCommandIntent());
addToLog("Автоответчик активирован...\n");
isAutoAnswer = true;
}
}
//остановить выполнение автоответчика
private void autoAnswerStop(){
if(isAutoAnswer){
String[] args = new String[1];
args[0] = "off";
cmd.setTo("tel");
cmd.setCommandName("autoanswer");
cmd.setArgs(args);
sendBroadcast(cmd.getCommandIntent());
addToLog("Автоответчик деактивирован...\n");
isAutoAnswer = false;
}
}
//============
@Override
public void onResume() {
super.onResume();
StringBuilder sb = new StringBuilder();
//info.setTextColor(9);
String EOL = "\n";
//String msgNS = "неизвестен";
//Получить данные из настроек пользователя
//Время задержки между вызовами
delay =prefs.getString(getString(R.string.defaultDelayAutoCall), "9");
//Длительность вызова
callDuration = prefs.getString(getString(R.string.defaultCallTime), "13");
//Массив номеров дозвона
prefix = prefs.getString(getString(R.string.defaultPrefix), "+38067xxxxxxx");
// prefix = nums.split("\n");
//Задержка перед автоподьемом
delayAutoAnswer = prefs.getString(getString(R.string.defaultDelayAutoAnswer), "0");
//String listValue = prefs.getString("list", "не выбрано");
switch(Integer.parseInt(prefs.getString("listMethod", "0"))){
case ID_NS_MANUAL:
numberSource = ID_NS_MANUAL;
if (prefs.getBoolean(getString(R.string.isRandomManualNumber), true))
isRandomNumber="true";
else
isRandomNumber="false";
if(prefs.getBoolean(getString(R.string.isRepeatManualNumber), true))
isRepeatNumber="true";
else
isRepeatNumber="false";
sb.append("Повторять: "+isRepeatNumber).append(EOL);
sb.append("Случайно: "+isRandomNumber).append(EOL);
sb.append("Источник номеров: Ручной ввод").append(EOL);
break;
case ID_NS_FILE:
sb.append("Источник номеров: Из файла (не реализован)").append(EOL);
break;
case ID_NS_DB:
sb.append("Источник номеров: Из БД (не реализован)").append(EOL);
break;
}
/* isRandomManualNumber = Boolean.parseBoolean(
prefs.getString(getString(R.string), "9"));
*/
sb.append("Повтор дозвона через: ").append(delay).append(" с.").append(EOL);
sb.append("Длительность вызова: ").append(callDuration).append(" с.").append(EOL);
sb.append("Поднимать трубку через: ").append(delayAutoAnswer).append(" с.").append(EOL);
if (prefs.getBoolean("isAutoAnswerStart", true)){
autoAnswerStart();
sb.append("Автоответчик: Активирован").append(EOL);
}
else{
autoAnswerStop();
sb.append("Автоответчик: Деактивирован").append(EOL);
}
//infoMsg+="Источник номеров: "+msgNS+"\n";
sb.append("Номера дозвона:").append(EOL+EOL).append(prefix).append(EOL);
info.setText(sb);
/*info.append("Текущий интервал дозвона: "+delay+"\n");
info.append("Текущий код оператора: "+prefix+"\n");
info.append("Текущий интервал сброса: "+callDuration+"\n");
info.append("Текущий интервал автоприема: "+delayAutoAnswer+"\n");
*/
/*
if(bAutoCall.isChecked()){
autoCallStop();
autoCallStart();
}
*/
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
String acMsg = getString(R.string.infoAutoCallOff);
int acIcon = R.drawable.ic_menu_autocall_off;
if(isAutoCall){
acMsg = getString(R.string.infoAutoCallOn);
acIcon = R.drawable.ic_menu_autocall_on;
}
menu.add(Menu.NONE, ID_MENU_AUTOCALL, 1, acMsg)
.setIcon(acIcon)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM |
MenuItem.SHOW_AS_ACTION_WITH_TEXT);
menu.add(Menu.NONE, ID_MENU_PREF, 3, "Параметры")
.setIcon(R.drawable.ic_menu_preferences)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM |
MenuItem.SHOW_AS_ACTION_WITH_TEXT);
menu.add(Menu.NONE, ID_MENU_EXIT, 4, "Выход")
.setIcon(R.drawable.ic_menu_exit)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM |
MenuItem.SHOW_AS_ACTION_WITH_TEXT);
return(super.onCreateOptionsMenu(menu));
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
/* case IDM_OPEN:
openFile(FILENAME);
break;
case IDM_SAVE:
saveFile(FILENAME);
break;*/
case ID_MENU_AUTOCALL:
if(isAutoCall){
item.setTitle(getString(R.string.infoAutoCallOff));
item.setIcon(R.drawable.ic_menu_autocall_off);
autoCallStop();
}
else{
item.setTitle(getString(R.string.infoAutoCallOn));
item.setIcon(R.drawable.ic_menu_autocall_on);
autoCallStart();
}
break;
case ID_MENU_PREF:
Intent i = new Intent();
i.setClass(this, PreferencesActivity.class);
startActivity(i);
break;
case ID_MENU_EXIT:
appExit();
break;
default:
return false;
}
return true;
}
public void addToLog(String msg){
long curTime = System.currentTimeMillis();
String curStringDate = new SimpleDateFormat("dd.MM HH:mm:ss").format(curTime);
logView.append(curStringDate+" >>> "+msg);
}
public void appExit(){
autoCallStop();
autoAnswerStop();
finish();
}
/*
private void openFile(String fileName) {
try {
InputStream inStream = openFileInput(FILENAME);
if (inStream != null) {
InputStreamReader tmp =
new InputStreamReader(inStream);
BufferedReader reader = new BufferedReader(tmp);
String str;
StringBuffer buffer = new StringBuffer();
while ((str = reader.readLine()) != null) {
buffer.append(str + "\n");
}
inStream.close();
edit.setText(buffer.toString());
}
}
catch (Throwable t) {
Toast.makeText(getApplicationContext(),
"Exception: " + t.toString(), Toast.LENGTH_LONG)
.show();
}
}
private void saveFile(String FileName) {
try {
OutputStreamWriter outStream =
new OutputStreamWriter(openFileOutput(FILENAME, 0));
outStream.write(edit.getText().toString());
outStream.close();
}
catch (Throwable t) {
Toast.makeText(getApplicationContext(),
"Exception: " + t.toString(), Toast.LENGTH_LONG)
.show();
}
}
class FloatKeyListener extends NumberKeyListener {
private static final String CHARS="0123456789-.";
protected char[] getAcceptedChars() {
return(CHARS.toCharArray());
}
@Override
public int getInputType() {
// TODO Auto-generated method stub
return 0;
}
}*/
}
| [
"heatmax@mail.ru"
] | heatmax@mail.ru |
3c29856340356dae63935e98893c66ef3e27fec4 | 36b795e3a22845bdb3e2fa2eb98572455e1d595b | /restservices/src/main/java/com/osi/urm/service/mapper/OsiUserFuncExclMapper.java | 4265d4d8a8b803160ba807dd0da8626d950836e7 | [] | no_license | rdonepudi/poc | f679a5d98b81475603e5473ef780313d1272328f | 79dc3f83c9c4e9766324cd814d2b8f8036cbc9d2 | refs/heads/master | 2020-06-14T10:48:54.562259 | 2016-12-20T13:25:25 | 2016-12-20T13:25:25 | 75,195,211 | 0 | 0 | null | 2016-12-20T14:09:18 | 2016-11-30T14:35:07 | JavaScript | UTF-8 | Java | false | false | 752 | java | package com.osi.urm.service.mapper;
import java.util.List;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
import com.osi.urm.domain.OsiUserFuncExcl;
import com.osi.urm.service.dto.OsiUserFuncExclDTO;
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE, uses = { CentralConfigMapper.class,
OsiFunctionsMapper.class, OsiUserMapper.class })
public interface OsiUserFuncExclMapper {
OsiUserFuncExclDTO osiUserToOsiUserDTO(OsiUserFuncExcl osiUser);
List<OsiUserFuncExclDTO> osiUserListToOsiUserDTOList(List<OsiUserFuncExcl> osiUsers);
OsiUserFuncExcl osiUserDTOToOsiUser(OsiUserFuncExclDTO osiUserDTO);
List<OsiUserFuncExcl> osiUserDTOListToOsiUserList(List<OsiUserFuncExclDTO> osiUserDTO);
}
| [
"prawate@nisum.com"
] | prawate@nisum.com |
f62df52a09799373d297662c2be8427b2f332af7 | 7df62a93d307a01b1a42bb858d6b06d65b92b33b | /src/com/gatherResulttosql/NetDatatempfanRtosql.java | 4f5b7a5f456a112bf956e20193f5ea4e5f4993a7 | [] | no_license | wu6660563/afunms_fd | 79ebef9e8bca4399be338d1504faf9630c42a6e1 | 3fae79abad4f3eb107f1558199eab04e5e38569a | refs/heads/master | 2021-01-10T01:54:38.934469 | 2016-01-05T09:16:38 | 2016-01-05T09:16:38 | 48,276,889 | 0 | 1 | null | null | null | null | GB18030 | Java | false | false | 4,386 | java | package com.gatherResulttosql;
import java.sql.PreparedStatement;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Hashtable;
import java.util.Vector;
import com.afunms.indicators.model.NodeDTO;
import com.afunms.indicators.util.NodeUtil;
import com.afunms.polling.PollingEngine;
import com.afunms.polling.node.Host;
import com.afunms.polling.om.Interfacecollectdata;
import com.database.DBManager;
import com.gatherdb.DBAttribute;
import com.gatherdb.GathersqlListManager;
import com.gatherdb.ResultToDB;
import com.gatherdb.ResultTosql;
public class NetDatatempfanRtosql implements ResultTosql {
private static SimpleDateFormat sdf = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss");
/**
* 把结果生成sql
*
* @param dataresult
* 采集结果
* @param node
* 网元节点
*/
public void CreateResultTosql(Hashtable dataresult, Host node) {
DBAttribute attribute = new DBAttribute();
attribute.setAttribute("dataresult", dataresult);
attribute.setAttribute("node", node);
ResultToDB resultToDB = new ResultToDB();
resultToDB.setResultTosql(this);
resultToDB.setAttribute(attribute);
GathersqlListManager.getInstance().addToQueue(resultToDB);
}
public void executeResultToDB(DBAttribute attribute) {
Hashtable dataresult = (Hashtable) attribute.getAttribute("dataresult");
Host node = (Host) attribute.getAttribute("node");
// 处理风扇信息入库
if (dataresult != null && dataresult.size() > 0) {
Vector fanVector = (Vector) dataresult.get("fan");
if (fanVector != null && fanVector.size() > 0) {
NodeUtil nodeUtil = new NodeUtil();
NodeDTO nodeDTO = nodeUtil.creatNodeDTOByNode(node);
String deleteSql = "delete from nms_envir_data_temp where nodeid='"
+ node.getId() + "' and entity='fan'";
execute(deleteSql);
Calendar tempCal = Calendar.getInstance();
Date cc = tempCal.getTime();
String time = sdf.format(cc);
String sql = "insert into nms_envir_data_temp (nodeid,ip,`type`,subtype,entity,subentity,sindex,thevalue,chname,restype,collecttime,unit,bak)"
+ " values(?,?,?,?,?,?,?,?,?,?,?,?,?)";
DBManager manager = new DBManager();
try {
PreparedStatement preparedStatement = manager
.prepareStatement(sql);
for (int i = 0; i < fanVector.size(); i++) {
Interfacecollectdata vo = (Interfacecollectdata) fanVector.elementAt(i);
preparedStatement.setString(1, String.valueOf(node.getId()));
preparedStatement.setString(2, node.getIpAddress());
preparedStatement.setString(3, nodeDTO.getType());
preparedStatement.setString(4, nodeDTO.getSubtype());
preparedStatement.setString(5, vo.getCategory());
preparedStatement.setString(6, vo.getEntity());
preparedStatement.setString(7, vo.getSubentity());
preparedStatement.setString(8, vo.getThevalue());
preparedStatement.setString(9, vo.getChname());
preparedStatement.setString(10, vo.getRestype());
preparedStatement.setString(11, time);
preparedStatement.setString(12, vo.getUnit());
preparedStatement.setString(13, vo.getBak());
preparedStatement.addBatch();
}
preparedStatement.executeBatch();
} catch (Exception e) {
e.printStackTrace();
} finally {
manager.close();
}
}
}
}
public void execute(String sql) {
DBManager manager = new DBManager();// 数据库管理对象
try {
manager.executeUpdate(sql);
} catch (RuntimeException e) {
e.printStackTrace();
} finally {
manager.close();
}
}
}
| [
"nick@comprame.com"
] | nick@comprame.com |
176653719f33217d9de8167b0f9ac73fce2fea6e | 630cc941e667b98f78e9c09c9c51065d573d6217 | /app/src/main/java/com/liyaqing/lovegossip/net/Remote/RemoteDataImpl.java | b243bfccd7524ad220be76b11efc194166896a8a | [] | no_license | isqing/LoveGossip | d7e009e46566c3258b8c51eeef6fb05fad35d89e | 641040ba9669a9e28cfa45724529b6b8c720a501 | refs/heads/master | 2020-05-20T22:27:32.291246 | 2017-03-10T09:03:03 | 2017-03-10T09:03:03 | 84,536,300 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 918 | java | package com.liyaqing.lovegossip.net.Remote;
import com.liyaqing.lovegossip.entity.MyResponse;
import com.liyaqing.lovegossip.entity.News;
import com.liyaqing.lovegossip.entity.ResultBean;
import com.liyaqing.lovegossip.net.AndroidHttp;
import com.liyaqing.lovegossip.net.MyTestApi;
import rx.Observable;
/**
* Created by liyaqing on 2017/3/9.
*/
public class RemoteDataImpl implements RemoteData{
private MyTestApi myTestApi;
private static RemoteData remoteData;
public RemoteDataImpl() {
myTestApi= AndroidHttp.getInstance().juheRetrofit(MyTestApi.BASE_URL).create(MyTestApi.class);
}
public static RemoteData Instance() {
if (remoteData==null){
remoteData=new RemoteDataImpl();
}
return remoteData;
}
@Override
public Observable<MyResponse<ResultBean<News>>> getNews(String type) {
return myTestApi.getNews(type);
}
}
| [
"liyaqing@wondersgroup.com"
] | liyaqing@wondersgroup.com |
db82321ed27ca64fdac8177e16d9b2c0dbf99968 | 91deab336d5ceef2f757ee37948edb86c4c3c16d | /LocoBotAppActivity/src/bot/location/locobotapp/Geocoder.java | d47b71d3dad32eb5b1ea95c446e033addf778003 | [] | no_license | motsneha/locobot | 5f9038a50ef381a221a40abff728034816f1c760 | 66c6250bf44c369443e093a5100c918d9bffd398 | refs/heads/master | 2021-01-13T01:45:24.343652 | 2015-03-06T12:42:03 | 2015-03-06T12:42:03 | 31,767,610 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,356 | java | package bot.location.locobotapp;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.location.Location;
import android.util.Log;
public class Geocoder
{
private static String localityName = "";
public static String Address;
public double GeoLattitude;
public double GeoLongitude;
public String server_result;
public static void reverseGeocode(Location loc)
{
HttpURLConnection connection = null;
URL serverAddress = null;
try
{
serverAddress = new URL("http://maps.googleapis.com/maps/api/geocode/json?latlng="+Double.toString(loc.getLatitude())+","+Double.toString(loc.getLongitude())+"&sensor=true");
connection = null;
connection = (HttpURLConnection)serverAddress.openConnection();
connection.setRequestMethod("GET");
connection.setDoOutput(true);
connection.setReadTimeout(10000);
connection.connect();
try
{
InputStreamReader isr = new InputStreamReader(connection.getInputStream());
BufferedReader reader = new BufferedReader(isr);
StringBuilder builder = new StringBuilder();
for (String line = null; (line = reader.readLine()) != null;)
{
builder.append(line).append("\n");
}
localityName = builder.toString();
Log.d("Geocoder reverse geocode server result",localityName );
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
JSONObject object;
if(localityName!=null)
{
try
{
object = new JSONObject(localityName);
JSONArray jArray = object.getJSONArray("results");
for (int i=0; i < jArray.length(); i++)
{
JSONObject oneObject = jArray.getJSONObject(i);
Address = oneObject.getString("formatted_address");
Log.d("Geocoder reverse geocode JSON parsing",Address );
}
}
catch (JSONException e)
{
e.printStackTrace();
}
}
else
{
localityName="Failed to get location details from google";
}
}
public void forwardGeocode(String locaddress)
{
String s[];
String url="";
s= locaddress.split(" ");
int i,array_size;
array_size=s.length;
Log.d("Geocoder",locaddress);
for(i=0; i<array_size; i++)
{
Log.d("Geocoder Address array elements",s[i] );
}
switch(array_size)
{
case 1:
url="http://maps.googleapis.com/maps/api/geocode/json?address="+s[0]+"&sensor=false";
break;
case 2:
url="http://maps.googleapis.com/maps/api/geocode/json?address="+s[0]+s[1]+"&sensor=false";
break;
case 3:
url="http://maps.googleapis.com/maps/api/geocode/json?address="+s[0]+s[1]+s[2]+"&sensor=false";
break;
case 4:
url="http://maps.googleapis.com/maps/api/geocode/json?address="+s[0]+s[1]+s[2]+s[3]+"&sensor=false";
break;
case 5:
url="http://maps.googleapis.com/maps/api/geocode/json?address="+s[0]+s[1]+s[2]+s[3]+s[4]+"&sensor=false";
break;
case 6:
url="http://maps.googleapis.com/maps/api/geocode/json?address="+s[0]+s[1]+s[2]+s[3]+s[4]+s[5]+"&sensor=false";
break;
}
HttpURLConnection connection = null;
URL serverAddress = null;
Log.d("Geocoder SEnding url to google",url);
try
{
serverAddress = new URL(url);
connection = null;
connection = (HttpURLConnection)serverAddress.openConnection();
connection.setRequestMethod("GET");
connection.setDoOutput(true);
connection.setReadTimeout(10000);
connection.connect();
try
{
InputStreamReader isr1 = new InputStreamReader(connection.getInputStream());
BufferedReader reader1 = new BufferedReader(isr1);
StringBuilder builder = new StringBuilder();
for (String line = null; (line = reader1.readLine()) != null;)
{
builder.append(line).append("\n");
}
server_result = builder.toString();
Log.d("Geocoder forward geocode results",server_result);
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
JSONObject object;
if(server_result!=null)
{
try
{
object = new JSONObject(server_result);
JSONArray jArray = object.getJSONArray("results");
for (int j=0; j < jArray.length(); j++)
{
JSONObject temp = jArray.optJSONObject(j);
JSONObject loc = temp.optJSONObject("geometry").optJSONObject("location");
GeoLattitude = loc.getDouble("lat"); //Double.valueOf(loc.getString("lat"));
GeoLongitude = loc.getDouble("lng");// Double.valueOf(loc.getString("lng"));
Log.d("Geocoder forward geocode JSON parsing", String.valueOf(GeoLattitude));
Log.d("Geocoder forward geocode JSON parsing", String.valueOf(GeoLongitude));
}
}
catch (JSONException e)
{
e.printStackTrace();
}
}
else
{
GeoLattitude=0.0;
GeoLongitude=0.0;
}
}
}
| [
"motsneha@gmail.com"
] | motsneha@gmail.com |
d2b1921cd2ac835e8105a5797b9d37f4bcd97d42 | 184eaf164d998b196931cea405999366fc602de9 | /app/src/main/java/com/home/englishnote/receivers/DailyVocabularyBroadcastReceiver.java | a463f530e93655612565b17be530f6a93aff2f02 | [] | no_license | Wally5077/Vocab-Notes-APP | df7912de2cde5b60538597d509f39663be080a54 | 10e675488b664d79069f9fe882612d7b7ff0fbeb | refs/heads/master | 2022-06-11T10:37:33.806881 | 2020-05-12T06:03:58 | 2020-05-12T06:03:58 | 241,817,972 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,671 | java | package com.home.englishnote.receivers;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Build;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.model.GlideUrl;
import com.home.englishnote.R;
import com.home.englishnote.models.entities.Word;
import com.home.englishnote.models.entities.WordGroup;
import com.home.englishnote.models.repositories.WordGroupRepository;
import com.home.englishnote.utils.Global;
import com.home.englishnote.utils.VocabularyNoteKeyword;
import java.util.List;
import java.util.Random;
import java.util.concurrent.ExecutionException;
public class DailyVocabularyBroadcastReceiver extends BroadcastReceiver {
// Todo
private WordGroupRepository wordGroupRepository;
private SharedPreferences sp;
private Random random;
private Context context;
@Override
public void onReceive(Context context, Intent intent) {
init(context);
downloadVocab(intent);
}
private void init(Context context) {
this.context = context;
sp = context.getSharedPreferences(
VocabularyNoteKeyword.SP_NAME, Context.MODE_PRIVATE);
wordGroupRepository = Global.wordGroupRepository();
random = new Random();
}
private void downloadVocab(final Intent intent) {
Global.threadExecutor().execute(() -> {
int dictionaryId = sp.getInt(VocabularyNoteKeyword.DICTIONARY_ID, 1);
int offset = sp.getInt(VocabularyNoteKeyword.OFFSET, 0);
int limit = VocabularyNoteKeyword.READ_DICTIONARY_LIMIT;
List<WordGroup> wordGroupList = wordGroupRepository
.getWordGroupsFromPublicDictionary(dictionaryId, offset, limit);
setVocabToLocalVocabStorage(dictionaryId, wordGroupList);
createNotificationChannel();
sendDailyVocabularyNotification(intent);
});
}
private void set(String spKeyword, int spValue, List vocabList) {
int currentVocabIndex = sp.getInt(spKeyword, 0);
int vocabListEnd = vocabList.size();
if (currentVocabIndex < vocabListEnd) {
Editor editor = sp.edit();
Object object = vocabList.get(currentVocabIndex);
if (object instanceof List) {
}
currentVocabIndex++;
if (currentVocabIndex == vocabListEnd) {
} else {
}
}
}
private void setVocabToLocalVocabStorage(int dictionaryId, List<WordGroup> wordGroupList) {
int currentWordGroupIndex = sp.getInt(VocabularyNoteKeyword.CURRENT_WORD_GROUP, 0);
int wordGroupListEnd = wordGroupList.size();
if (currentWordGroupIndex < wordGroupListEnd) {
Editor editor = sp.edit();
WordGroup wordGroup = wordGroupList.get(currentWordGroupIndex);
List<Word> wordList = wordGroup.getWords();
int currentWordIndex = sp.getInt(VocabularyNoteKeyword.CURRENT_WORD, 0);
int wordListEnd = wordList.size();
if (currentWordIndex < wordListEnd) {
Word word = wordList.get(currentWordIndex);
// String wordJson = new Gson().toJson(word);
currentWordIndex++;
if (currentWordIndex == wordListEnd) {
editor.putInt(VocabularyNoteKeyword.CURRENT_WORD, 0);
currentWordGroupIndex++;
if (currentWordGroupIndex == wordGroupListEnd) {
dictionaryId++;
editor.putInt(VocabularyNoteKeyword.DICTIONARY_ID, dictionaryId)
.putInt(VocabularyNoteKeyword.CURRENT_WORD_GROUP, 0);
} else {
editor.putInt(VocabularyNoteKeyword.CURRENT_WORD_GROUP, currentWordGroupIndex);
}
} else {
editor.putInt(VocabularyNoteKeyword.CURRENT_WORD, currentWordIndex);
}
}
editor.apply();
}
}
private void createNotificationChannel() {
// Create the NotificationChannel, but only on API 26+ because
// the NotificationChannel class is new and not in the support library
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
CharSequence name = context.getString(R.string.channel_name);
String description = context.getString(R.string.channel_description);
int importance = NotificationManager.IMPORTANCE_DEFAULT;
NotificationChannel channel = new NotificationChannel(
context.getString(R.string.CHANNEL_ID), name, importance);
channel.setDescription(description);
// Register the channel with the system; you can't change the importance
// or other notification behaviors after this
NotificationManager notificationManager = context.getSystemService(NotificationManager.class);
if (notificationManager != null) {
notificationManager.createNotificationChannel(channel);
}
}
}
private void sendDailyVocabularyNotification(Intent intent) {
try {
NotificationCompat.Builder builder = new NotificationCompat
.Builder(context, context.getString(R.string.CHANNEL_ID))
.setSmallIcon(R.drawable.logo)
.setContentTitle(intent.getStringExtra("vocab"))
.setStyle(new NotificationCompat.BigTextStyle()
.bigText(intent.getStringExtra("vocabDescription")))
.setLargeIcon(Glide
.with(context)
.asBitmap()
.load(new GlideUrl(intent.getStringExtra("VocabImageURL")))
.error(R.drawable.person_holding_orange_pen_1925536)
.fitCenter()
.submit()
.get());
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
notificationManager.notify(1, builder.build());
} catch (ExecutionException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
| [
"wally55077@gmail.com"
] | wally55077@gmail.com |
9b0bce213e92f384d5cf54923cb6289242b0713b | f09882c03a932cb5eb0f2e59cd8f3259565e3536 | /AuthAadhaar/src/main/java/com/auth/util/IpassCustomBase64.java | ebca0adae8f5dbf046757e41af8b8b6dcc1254e9 | [] | no_license | sanjunegi001/AuthAadhaarApi | 27d7eacf705c443baa14208e2fd93a2099b97828 | 25c749ae6b6fcbaa480ed4fcaa9b4d98f683e5a7 | refs/heads/master | 2020-03-18T16:03:23.851768 | 2018-05-26T08:39:51 | 2018-05-26T08:39:51 | 134,943,915 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 543 | java | package com.auth.util;
import java.io.IOException;
import sun.misc.BASE64Decoder;
public class IpassCustomBase64 {
public String decode(String base64String) {
String encodedString = "";
BASE64Decoder decoder = new BASE64Decoder();
byte[] ipassdata;
try {
ipassdata = decoder.decodeBuffer(base64String.trim());
encodedString = new String(ipassdata, "UTF-8");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return encodedString;
}
}
| [
"sanjay.negi@authbridge.com"
] | sanjay.negi@authbridge.com |
91985d63175e04c5f4f6416fd9ebee77292c0e2d | ec47645815f339d5707b653343082af0a486fe06 | /src/test/java/com/placideh/hibernatea14/AppTest.java | 1e9b0c63891fb695e22d16ec0848fcd444a05f75 | [] | no_license | Placideh/hibernate-14 | 188714b1039b0f1d0b4b826d2ed441fb5a5909a0 | a849b493e52981fc66849e3a3b868e9b4db42477 | refs/heads/main | 2023-01-11T00:04:00.039719 | 2020-11-11T12:04:39 | 2020-11-11T12:04:39 | 311,958,286 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 653 | java | package com.placideh.hibernatea14;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
| [
"h.uwizeyeplacide@gmail.com"
] | h.uwizeyeplacide@gmail.com |
e956e5101dc088def33a4c423922876c58d0f324 | 98c8b53512114390dfd6d1a694b5f387ffa0a505 | /src/com/wh/vertica/core/VerticaSchemaFinder.java | 0cd627b0946092cdbea5af7274896f987ccd65af | [] | no_license | adlakhavaibhav/HKVerticaWH | 6dc24416c1f0b706b274522a4953bc434c7e673c | a4d7af51efa3c93555ed62ab84ca43cf9675bdd0 | refs/heads/master | 2020-05-17T00:32:12.169648 | 2013-07-06T12:28:21 | 2013-07-06T12:28:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,475 | java | package com.wh.vertica.core;
import com.wh.common.util.RowProcessor;
import com.wh.vertica.schema.VerticaBaseTable;
import com.wh.vertica.schema.VerticaSchema;
import com.wh.vertica.schema.VerticaDimTable;
import com.wh.vertica.schema.VerticaFactTable;
import com.wh.vertica.util.VerticaDataSourceType;
import com.wh.vertica.util.VerticaDbConnectionUtil;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashSet;
import java.util.Set;
/**
* Created by IntelliJ IDEA.
* User: admin
* Date: Jul 5, 2013
* Time: 10:43:39 PM
*/
public class VerticaSchemaFinder {
private boolean isFactTable(String tableName) {
return tableName.startsWith("ft_");
}
private boolean isDimTable(String tableName) {
return tableName.startsWith("dim_");
}
public VerticaSchema getVerticaSchema(String schemaName) {
VerticaSchema verticaSchema = new VerticaSchema();
verticaSchema.setSchemaName(schemaName);
final Set<String> tablesNamesForSchema = new HashSet<String>();
VerticaDbConnectionUtil.query("select table_name from v_catalog.tables where table_schema = ?", new RowProcessor() {
@Override
public void process(ResultSet rs) throws SQLException {
tablesNamesForSchema.add(rs.getString(1));
}
}, VerticaDataSourceType.VerticaDS, schemaName);
for (String tableName : tablesNamesForSchema) {
if (isDimTable(tableName)) {
VerticaDimTable verticaDimTable = new VerticaDimTable();
buildVerticaBaseTable(schemaName, tableName, verticaDimTable);
verticaSchema.getDimTables().add(verticaDimTable);
}
if (isFactTable(tableName)) {
VerticaFactTable verticaFactTable = new VerticaFactTable();
buildVerticaBaseTable(schemaName, tableName, verticaFactTable);
verticaSchema.getFactTables().add(verticaFactTable);
}
}
return verticaSchema;
}
public void buildVerticaBaseTable(String schemaName, String tableName, final VerticaBaseTable verticaBaseTable) {
verticaBaseTable.setSchemaName(schemaName);
verticaBaseTable.setTableName(tableName);
VerticaDbConnectionUtil.query("select column_name from v_catalog.columns where table_name = ? and table_schema = ?", new RowProcessor() {
@Override
public void process(ResultSet rs) throws SQLException {
verticaBaseTable.addTableColumn(rs.getString(1));
}
}, VerticaDataSourceType.VerticaDS, tableName, schemaName);
}
}
| [
"vaibhav.adlakha@healthkart.com"
] | vaibhav.adlakha@healthkart.com |
47d5537903ce04a1ba8885313658beec4b1db26d | af9838e0bfdab320480241ff5cbf4843fdb0381d | /src/main/java/br/com/alessanderleite/todo/controller/LogoutController.java | 62db198716a3b347ea4f548f9dfd8377f81d62e1 | [] | no_license | alessanderleite/spring-boot-todo | 67ef6601719b2ab307d9c118e47fcf27b80e4054 | 88028a178f57acc7b10ddf83575e8e58299a0fd3 | refs/heads/master | 2020-06-19T09:31:51.913270 | 2019-07-14T22:59:31 | 2019-07-14T22:59:31 | 196,663,092 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 976 | java | package br.com.alessanderleite.todo.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class LogoutController {
@RequestMapping(value = "/logout", method = RequestMethod.GET)
public String logout(HttpServletRequest request, HttpServletResponse response) {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication != null) {
new SecurityContextLogoutHandler().logout(request, response, authentication);
}
return "redirect:/";
}
}
| [
"alessander.logistica@gmail.com"
] | alessander.logistica@gmail.com |
4bbf247426ecfab49d56db05368f745a68f2b7bb | 4465d5350076f5bd263dba38feedb69a628b4934 | /GPUImageLibrary/gen/com/example/gpuimagelibrary/R.java | ee85f1e8954f1f2d36c3df6a848cc8b66c63c9ee | [] | no_license | chenyuda/MyProsrc | 8c38274657b160a4a9e0d7af516d6023935301f5 | c30c07ba9bd437dd409cbc14a4727113f33f631d | refs/heads/master | 2021-01-13T16:17:58.942159 | 2017-02-08T08:37:54 | 2017-02-08T08:37:54 | 81,304,235 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 965 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.example.gpuimagelibrary;
public final class R {
public static final class attr {
}
public static final class dimen {
/** Default screen margins, per the Android Design guidelines.
*/
public static int activity_horizontal_margin=0x7f040000;
public static int activity_vertical_margin=0x7f040001;
}
public static final class drawable {
public static int ic_launcher=0x7f020000;
}
public static final class layout {
public static int activity_main=0x7f030000;
}
public static final class string {
public static int action_settings=0x7f050002;
public static int app_name=0x7f050000;
public static int hello_world=0x7f050001;
}
}
| [
"cyd@woso.cn"
] | cyd@woso.cn |
74d6f7d6140c2537b65306ddaa25cfac94405ae9 | 10635e6d5b3c3aa7ea0b19d2f4d88779668f794b | /src/com/example/basic/ScrabCount.java | dad936150ab15d0da4536157e5fc3da4b247227f | [] | no_license | feefles/scrabblecounter | 029aa33df9332616deea993fe43a49fdbc59a3ed | 04b474117c7e07afb1735d09ac2e5235ba8fa5d4 | refs/heads/master | 2021-01-20T08:44:07.332788 | 2013-01-19T23:32:57 | 2013-01-19T23:32:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,957 | java | package com.example.basic;
public class ScrabCount {
private static String keyboard = "AEIOULNRSTDGBCMPFHVWYKJXQZ";
private static int[] LetterValue = {1, 2, 3, 4, 5, 8, 10};
private static char[] vowels = {'A', 'E', 'I', 'O', 'U', 'Y'};
public static boolean isValid(String input) {
boolean containsVowel = false;
for (int i = 0; i < input.length(); i++) {
for (int j = 0; j < vowels.length; j++) {
if (input.charAt(i) == vowels[j]) containsVowel = true;
}
}
if (containsVowel) return true;
return false;
}
public static int indexOfLetter(char z) {
int keyboardIndex = 0;
for (int i = 0; i < keyboard.length(); i++) {
if (z == keyboard.charAt(i))
keyboardIndex = i;
}
return keyboardIndex;
}
public static String getVal(String input) {
int value = 0;
if (!isValid(input)) return "'" + input + "'" + " IS NOT A WORD";
for (int i = 0; i < input.length(); i++) {
char z = input.charAt(i);
int j = indexOfLetter(z);
if (j <= 9) value = value + LetterValue[0];
else if (j <= 11) value = value + LetterValue[1];
else if (j <= 15) value = value + LetterValue[2];
else if (j <= 20) value = value + LetterValue[3];
else if (j <= 21) value = value + LetterValue[4];
else if (j <= 23) value = value + LetterValue[5];
else if (j <= 25) value = value + LetterValue[6];
}
/*
if (doub) value = value * 2;
if (trip) value = value * 3;
*/
return Integer.toString(value);
}
public static String getVal(String input1, String input2) {
int value1 = 0;
int value2 = 0;
int largerVal;
String largerStr;
if (!isValid(input1) && !isValid(input2))
return "'" + input1 + "'" + "'" + input2 + "'" + " ARE NOT WORDS";
for (int i = 0; i < input1.length(); i++) {
char z = input1.charAt(i);
int j = indexOfLetter(z);
if (j <= 9) value1 = value1 + LetterValue[0];
else if (j <= 11) value1 = value1 + LetterValue[1];
else if (j <= 15) value1 = value1 + LetterValue[2];
else if (j <= 20) value1 = value1 + LetterValue[3];
else if (j <= 21) value1 = value1 + LetterValue[4];
else if (j <= 23) value1 = value1 + LetterValue[5];
else if (j <= 25) value1 = value1 + LetterValue[6];
}
for (int n = 0; n < input2.length(); n++) {
char x = input2.charAt(n);
int k = indexOfLetter(x);
if (k <= 9) value1 = value1 + LetterValue[0];
else if (k <= 11) value2 = value2 + LetterValue[1];
else if (k <= 15) value2 = value2 + LetterValue[2];
else if (k <= 20) value2 = value2 + LetterValue[3];
else if (k <= 21) value2 = value2 + LetterValue[4];
else if (k <= 23) value2 = value2 + LetterValue[5];
else if (k <= 25) value2 = value2 + LetterValue[6];
}
if (value1 >= value2) largerVal = value1;
else largerVal = value2;
if (value1 >= value2) largerStr = input1;
else largerStr = input2;
if (!isValid(input1) && isValid(input2)) {
largerVal = value2;
largerStr = input2;
}
if (isValid(input1) && !isValid(input2)) {
largerVal = value1;
largerStr = input1;
}
return ("Most points: " + largerStr + " -> " +
Integer.toString(largerVal) + " points");
}
public static void main(String[] args) {
String val = getVal(args[0], args[1]);
System.out.println(val);
}
}
| [
"eyeung@seas.upenn.edu"
] | eyeung@seas.upenn.edu |
8ae8ec8725b577a8d0953ca6dcc70c24544e295c | 4a52046294a8ef344b5d6ce995e2c1821d574fdb | /Java/com/lefu/es/system/AutoBTActivity.java | 2742a7c961f6a5f3ae8ed56e4d66665208c95f7a | [] | no_license | Anjlo/Cloned | fc323753f1873a8fe887b9b78f5d42673c4aef49 | cae2693f0f385d39dddd6f8b8f2fa3540773439a | refs/heads/master | 2020-04-09T10:37:32.088207 | 2016-09-12T16:05:01 | 2016-09-12T16:05:01 | 68,024,514 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,309 | java | package com.lefu.es.system;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
import com.lefu.es.constant.AppData;
import com.lefu.es.constant.BluetoolUtil;
import com.lefu.es.constant.UtilConstants;
import com.lefu.es.progressbar.NumberProgressBar;
import com.lefu.es.service.BluetoothChatService;
import com.lefu.es.service.ExitApplication;
import com.lefu.es.service.TimeService;
import com.lefu.es.util.SharedPreferencesUtil;
import java.io.PrintStream;
@SuppressLint({"HandlerLeak"})
public class AutoBTActivity
extends Activity
{
private static int checkTime = 30000;
private static boolean isOnlySupprotBT = false;
private static boolean isRegisterReceiver = false;
View.OnClickListener OnClickListener = new View.OnClickListener()
{
public void onClick(View paramAnonymousView)
{
if (paramAnonymousView.getId() == 2131165194) {
AutoBTActivity.this.backToUserEdit();
}
}
};
private Runnable ScanRunnable = new Runnable()
{
public void run()
{
AutoBTActivity.this.startDiscovery();
AutoBTActivity.this.handler.postDelayed(this, 7000L);
}
};
private Runnable TimeoutRunnable = new Runnable()
{
public void run()
{
if (!AutoBTActivity.this.isBack)
{
if (TimeService.scaleType != null) {
break label103;
}
if (System.currentTimeMillis() - AutoBTActivity.this.startTime <= AutoBTActivity.checkTime) {
break label54;
}
if (!AppData.hasCheckData) {
AutoBTActivity.this.handler.sendEmptyMessage(2);
}
}
return;
label54:
if (!AppData.hasCheckData) {
AutoBTActivity.this.handler.sendEmptyMessage(4);
}
for (;;)
{
AutoBTActivity.this.handler.postDelayed(this, 1000L);
return;
AutoBTActivity.this.bnp.setProgress(100);
}
label103:
AutoBTActivity.this.handler.sendEmptyMessage(3);
}
};
private Button backButton;
private NumberProgressBar bnp;
private BluetoothDevice connectdevice;
Handler handler = new Handler()
{
public void handleMessage(Message paramAnonymousMessage)
{
super.handleMessage(paramAnonymousMessage);
switch (paramAnonymousMessage.what)
{
default:
return;
case 2:
if (UtilConstants.checkScaleTimes == 0)
{
Toast.makeText(AutoBTActivity.this, AutoBTActivity.this.getString(2131361906), 1).show();
UtilConstants.checkScaleTimes = 1 + UtilConstants.checkScaleTimes;
AutoBTActivity.this.startActivity(new Intent(AutoBTActivity.this, AutoBLEActivity.class));
AutoBTActivity.this.finish();
return;
}
Toast.makeText(AutoBTActivity.this, AutoBTActivity.this.getString(2131361907), 1).show();
return;
case 3:
AutoBTActivity.this.handler.removeCallbacks(AutoBTActivity.this.TimeoutRunnable);
UtilConstants.serveIntent = null;
Intent localIntent = new Intent();
localIntent.setClass(AutoBTActivity.this, LoadingActivity.class);
ExitApplication.getInstance().exit(AutoBTActivity.this);
AutoBTActivity.this.startActivity(localIntent);
return;
}
if (AutoBTActivity.this.keepScaleWorking) {
Toast.makeText(AutoBTActivity.this, AutoBTActivity.this.getString(2131361911), 0).show();
}
for (AutoBTActivity.this.keepScaleWorking = false; AutoBTActivity.isOnlySupprotBT; AutoBTActivity.this.keepScaleWorking = true)
{
AutoBTActivity.this.bnp.incrementProgressBy(4);
return;
}
AutoBTActivity.this.bnp.incrementProgressBy(2);
}
};
private boolean isBack = false;
private boolean keepScaleWorking = true;
private BluetoothAdapter mBtAdapter;
private final BroadcastReceiver mReceiver = new BroadcastReceiver()
{
public void onReceive(Context paramAnonymousContext, Intent paramAnonymousIntent)
{
String str1 = paramAnonymousIntent.getAction();
if ("android.bluetooth.device.action.FOUND".equals(str1))
{
localBluetoothDevice = (BluetoothDevice)paramAnonymousIntent.getParcelableExtra("android.bluetooth.device.extra.DEVICE");
if (localBluetoothDevice != null)
{
str2 = localBluetoothDevice.getName();
System.out.println(str2 + "=" + localBluetoothDevice.getAddress());
if ((str2 != null) && (str2.equalsIgnoreCase("Electronic Scale")) && (AutoBTActivity.this.connectdevice == null))
{
AutoBTActivity.this.connectdevice = localBluetoothDevice;
BluetoolUtil.mChatService.connect(localBluetoothDevice, true);
AutoBTActivity.this.stopDiscovery();
}
}
}
while (!"android.bluetooth.adapter.action.DISCOVERY_FINISHED".equals(str1))
{
BluetoothDevice localBluetoothDevice;
String str2;
return;
}
AutoBTActivity.this.stopDiscovery();
}
};
private SearchDevicesView search_device_view;
private long startTime = System.currentTimeMillis();
private void backToUserEdit()
{
boolean bool = true;
this.isBack = bool;
Boolean localBoolean = (Boolean)UtilConstants.su.readbackUp("lefuconfig", "reCheck", Boolean.valueOf(false));
ExitApplication.getInstance().exit(this);
if (localBoolean != null) {}
while ((bool & localBoolean.booleanValue()))
{
startActivity(new Intent(this, LoadingActivity.class));
return;
bool = false;
}
startActivity(new Intent(this, UserEditActivity.class));
}
protected void onCreate(Bundle paramBundle)
{
super.onCreate(paramBundle);
setContentView(2130903040);
this.backButton = ((Button)findViewById(2131165194));
this.backButton.setOnClickListener(this.OnClickListener);
ExitApplication.getInstance().addActivity(this);
UtilConstants.su = new SharedPreferencesUtil(this);
if (BluetoolUtil.mBluetoothAdapter == null) {
BluetoolUtil.mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
}
if ((BluetoolUtil.mBluetoothAdapter != null) && (!BluetoolUtil.mBluetoothAdapter.isEnabled())) {
startActivityForResult(new Intent("android.bluetooth.adapter.action.REQUEST_ENABLE"), 3);
}
if (UtilConstants.serveIntent == null)
{
UtilConstants.serveIntent = new Intent(this, TimeService.class);
startService(UtilConstants.serveIntent);
}
new Thread(this.ScanRunnable).start();
new Thread(this.TimeoutRunnable).start();
this.search_device_view = ((SearchDevicesView)findViewById(2131165196));
this.search_device_view.setWillNotDraw(false);
this.search_device_view.setSearching(true);
this.bnp = ((NumberProgressBar)findViewById(2131165197));
if (Build.VERSION.SDK_INT < 18) {
isOnlySupprotBT = true;
}
if (isOnlySupprotBT)
{
checkTime = 25000;
this.bnp.setProgress(0);
}
for (;;)
{
AppData.isCheckScale = true;
return;
this.bnp.setProgress(40);
}
}
protected void onDestroy()
{
isRegisterReceiver = false;
if (UtilConstants.serveIntent != null) {
stopService(UtilConstants.serveIntent);
}
if (this.mBtAdapter != null) {
this.mBtAdapter.cancelDiscovery();
}
this.handler.removeCallbacks(this.ScanRunnable);
super.onDestroy();
}
public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
{
if (paramInt == 4)
{
backToUserEdit();
return true;
}
if ((paramInt == 3) && (UtilConstants.serveIntent != null)) {
stopService(UtilConstants.serveIntent);
}
return super.onKeyDown(paramInt, paramKeyEvent);
}
protected void onPause()
{
super.onPause();
}
protected void onResume()
{
super.onResume();
}
protected void onStart()
{
super.onStart();
}
public void startDiscovery()
{
IntentFilter localIntentFilter1 = new IntentFilter("android.bluetooth.device.action.FOUND");
registerReceiver(this.mReceiver, localIntentFilter1);
IntentFilter localIntentFilter2 = new IntentFilter("android.bluetooth.adapter.action.DISCOVERY_FINISHED");
registerReceiver(this.mReceiver, localIntentFilter2);
isRegisterReceiver = true;
this.mBtAdapter = BluetoothAdapter.getDefaultAdapter();
this.mBtAdapter.startDiscovery();
}
public void stopDiscovery()
{
this.mBtAdapter.cancelDiscovery();
if (isRegisterReceiver)
{
unregisterReceiver(this.mReceiver);
isRegisterReceiver = false;
}
}
}
/* Location: C:\Users\Anj\Desktop\Clone Test\dex2jar-0.0.9.15\classes_dex2jar.jar!\com\lefu\es\system\AutoBTActivity.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"anjvillarruz@gmail.com"
] | anjvillarruz@gmail.com |
d2126969ab8319bea876e1148a12c87c09290986 | b07d65b13a61e1da8c91f2f99b3e7b215c141ae2 | /src/main/java/com/nowcoder/community/dao/LoginTicketMapper.java | 4a2ae8836f8f4e6fc485ecbfef68c6c42eb63170 | [] | no_license | Tristan-y/FirstCommunity | 1793dc9058124f622e6a3c69e40f52d3af5edd4e | bce94ca0385243f11a9ac9f280cec77b86b4b584 | refs/heads/main | 2023-02-18T23:17:35.026764 | 2021-01-19T09:28:49 | 2021-01-19T09:28:49 | 321,312,205 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 975 | java | package com.nowcoder.community.dao;
import com.nowcoder.community.entity.LoginTicket;
import org.apache.ibatis.annotations.*;
@Mapper
// 声明这个组件不推荐使用了
@Deprecated
public interface LoginTicketMapper {
@Insert({
"insert into login_ticket(user_id, ticket, status, expired) ",
"values(#{userId}, #{ticket}, #{status}, #{expired})"
})
@Options(useGeneratedKeys = true, keyProperty = "id")
int insertLoginTicket(LoginTicket loginTicket);
@Select({
"select id, user_id, ticket, status, expired ",
"from login_ticket where ticket = #{ticket}"
})
LoginTicket selectByTicket(String ticket);
@Update({
"<script>",
"update login_ticket set status=#{status} where ticket=#{ticket} ",
"<if test=\"ticket!=null\">",
"and 1 = 1 ",
"</if>",
"</script>"
})
int updateStatus(String ticket, int status);
}
| [
"huohangyu0214@163.com"
] | huohangyu0214@163.com |
f2ae4019a2f23e1051e80af79db0c77f589b697f | c82bcc1e0c0c25210ba95435a4f42b31b6748f2f | /src/main/java/com/ssp/uirefresh_pages/UIRef_PolicyRenewal.java | 227777838419c576b6a92c36dac0a5abc334a87a | [] | no_license | pnp2fBD/Renewal | 2a42e07156ca7b213f4200522c7a682f65885152 | 3ed3418082566ba4fc6cf6eaff908851a232f5cc | refs/heads/master | 2020-05-09T23:06:09.725175 | 2019-04-15T13:29:28 | 2019-04-15T13:29:28 | 181,492,452 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,902 | java | package com.ssp.uirefresh_pages;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.LoadableComponent;
import org.testng.Assert;
import com.relevantcodes.extentreports.ExtentTest;
import com.ssp.support.Log;
import com.ssp.utils.ElementLayer;
import com.ssp.utils.WaitUtils;
public class UIRef_PolicyRenewal extends LoadableComponent<UIRef_PolicyRenewal>{
private final WebDriver driver ;
private ExtentTest extentedReport;
private boolean isPageLoaded;
public ElementLayer uielement;
@FindBy(xpath = "//a[@title='Continue']//span[text()='Continue']")
WebElement renewalContinueBtn;
public UIRef_PolicyRenewal(WebDriver driver, ExtentTest report) {
this.driver = driver;
this.extentedReport = report;
PageFactory.initElements(driver, this);
}
@Override
protected void load() {
WaitUtils.waitForPageLoad(driver);
if (!isPageLoaded) {
Assert.fail();
}
}
@Override
protected void isLoaded() throws Error {
isPageLoaded = true;
WaitUtils.waitForPageLoad(driver);
}
public void ClickRenewalContinueBtn(WebDriver driver, ExtentTest report) throws Exception{
try{
WaitUtils.waitForElement(driver, renewalContinueBtn);
renewalContinueBtn.click();
Log.message("Clicked the Continue Button for Renewal", driver, extentedReport);
}catch(Exception e){
throw new Exception("Error while Click of the Continue Button for Renewal" + e );
}
}
public UIRef_PolicyReviewPremium NavigateToReviewPremium(WebDriver driver, ExtentTest report) throws Exception{
try{
Log.message("NavigateToReviewPremium", driver, extentedReport);
return new UIRef_PolicyReviewPremium(driver, report);
}catch(Exception e){
throw new Exception("Error while NavigateToReviewPremium" + e );
}
}
}
| [
"sunil.juneja@ssp-worldwide.com"
] | sunil.juneja@ssp-worldwide.com |
96307b30ae4ddb46f57598e675adb09c60afaa73 | b371b3fe706a01a9d489778abbae1699394a5af3 | /app/src/main/java/com/example/signinteacher1/MainActivity.java | d962162092de5ba332e344ea81cbeedcae5318e9 | [] | no_license | Rick1kk/SigninTeacher1 | 381eabbcf35ed21f3a9886b7c1815abd93f9662e | ed8ab5c8f5cb7bb6c7174e29ec109a2320b7bdd3 | refs/heads/master | 2022-09-10T08:16:23.724310 | 2020-05-30T11:36:04 | 2020-05-30T11:36:04 | 268,067,164 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,162 | java | package com.example.signinteacher1;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Bundle;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
private RecyclerView mRecyclerView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mRecyclerView = findViewById(R.id.recyclerView);
List<Course> courseList = new ArrayList<>();
Course course1 = new Course("软件理论与工程","周二/1234");
Course course2 = new Course("大数据","周三/345");
courseList.add(course1);
courseList.add(course2);
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
//layoutManager.setOrientation(RecyclerView.HORIZONTAL);
mRecyclerView.setLayoutManager(layoutManager);
CourseAdapter myAdapter = new CourseAdapter(courseList);
mRecyclerView.setAdapter(myAdapter);
}
}
| [
"1450231835@qq.com"
] | 1450231835@qq.com |
e0e05f7bc38a99ff76ec4dad824b2ff5398189b2 | d5b3d787fdd604976bb28e33aea370806040015b | /src/tk/solaapps/ohtune/service/IOhtuneService.java | 74c7fc91083f1046ac8db370e3a2eaa0fbfb7780 | [] | no_license | ivanagxu/solaapps | f01b74f99c81a6320469e37cb6a1e7bf93c6c3b0 | 3dac137130abb3d3613f788513c5248c88dfbf91 | refs/heads/master | 2020-06-04T06:55:55.077111 | 2012-06-22T02:13:09 | 2012-06-22T02:13:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,392 | java | package tk.solaapps.ohtune.service;
import java.util.List;
import tk.solaapps.ohtune.model.Job;
import tk.solaapps.ohtune.model.JobType;
import tk.solaapps.ohtune.model.OhtuneDocument;
import tk.solaapps.ohtune.model.Order;
import tk.solaapps.ohtune.model.Product;
import tk.solaapps.ohtune.model.ProductRate;
import tk.solaapps.ohtune.model.ProductionLog;
import tk.solaapps.ohtune.model.UserAC;
import tk.solaapps.ohtune.pattern.JsonResponse;
import tk.solaapps.ohtune.pattern.SystemConfig;
import com.google.gson.Gson;
public interface IOhtuneService extends IOhtuneDA{
boolean test(UserAC userac) throws Exception;
SystemConfig getSystemConfig();
void setSystemConfig(SystemConfig config);
//Business Functions
UserAC login(String login_id, String password);
Gson getGson();
JsonResponse genJsonResponse(boolean success, String msg, Object Data);
boolean createUser(UserAC user, UserAC operator);
boolean deleteUser(UserAC user, UserAC operator);
boolean createOrder(Order order, List<Job> jobs, UserAC operator);
boolean approveOrder(Order order, List<Job> jobs, UserAC operator);
boolean updateOrder(Order order, Product product, List<Job> newJobs, List<Job> deleteJobs, UserAC operator);
boolean pauseOrder(Order order, UserAC operator);
boolean cancelOrder(Order order, UserAC operator);
boolean resumeOrder(Order order, UserAC operator);
boolean deleteJobByOrder(Order order, UserAC operator);
List<Job> getMyJobList(UserAC user);
boolean completeJob(Job job, UserAC assignedTo, String jobType, int complete_count, int iDisuse_count, boolean isCompleted, boolean isRejected, String remark, UserAC operator);
boolean addJobToOrder(Order order,JobType jobType, int iQuantity, UserAC assignedTo, UserAC operator);
boolean completeOrder(Order order, UserAC operator);
//Document fucntions
List<OhtuneDocument> getAllDocument(UserAC operator);
boolean deleteDocument(String name, UserAC operator);
//Report Functions
List<ProductRate> generateProductRateByProduct(Product product, UserAC operator);
List<ProductionLog> generateProductLogByDateAndSection(String sDate, String sEndDate, String sJobType, UserAC operator);
} | [
"ivanagxu@gmail.com"
] | ivanagxu@gmail.com |
ebe0545ab7bdb20be342c07ae6a3baf75b1cf2cf | d72b975b1e899f4d8d67dff637474a147a251a10 | /message/src/main/java/com/lmy/message/model/ResultDTO.java | c4bb27a7189000ae8553a30735f201cc1fe7ebeb | [] | no_license | limingyang11/rabbitMQ | 0cece4a4ae3b0f76e5663d4e3742d22a442fbcb1 | 3d6edd8baebd4694b3edcf986322988bd1b650b8 | refs/heads/master | 2023-07-10T21:04:00.297091 | 2021-08-16T16:29:31 | 2021-08-16T16:29:31 | 392,943,765 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 769 | java | package com.lmy.message.model;
public class ResultDTO<T> {
private int code;
private String msg;
private T data;
public ResultDTO() {
}
public ResultDTO(int code, String msg) {
this.code = code;
this.msg = msg;
}
public ResultDTO(int code, String msg, T data) {
this.code = code;
this.msg = msg;
this.data = data;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
}
| [
"limingyang@htyunwang.com"
] | limingyang@htyunwang.com |
7241989b2356befd89dd2b63e5f62542d4a400b0 | ba71c903104449757230d2292b6c4a10af46cdff | /math.java | 9b34f6e6f74fe35d01fc8fcb0cb2756ffc7f8584 | [] | no_license | jashshah127/Java | 37cf290f60a95f3e68f513a76595e918269b425e | 8c1c29a88365cc4161f5729e6676f237aeb36c56 | refs/heads/master | 2020-04-26T19:20:11.269498 | 2020-01-08T10:10:32 | 2020-01-08T10:10:32 | 173,771,413 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 560 | java | class Math{
private int no; //instance varible
public Math() //constructor
{
no=5;
}
public Math(int no)
{
this.no=no;
}
public int power(int a,int b)
{
int prod=1;
for(int i=0;i<b;i++)
prod*=a;
return prod;
}
public void set(int x)
{
no=x;
}
public int get()
{
return no;
}
}
class Main{
public static void main(String[] args) {
Math x=new Math(10);
Math y=new Math();
y.set(567);
System.out.print(x.power(2,10) +" "+ y.get());
}
}
| [
"noreply@github.com"
] | jashshah127.noreply@github.com |
892c23916d416785ad090ea6302e6feacd7d4258 | 89310d5eaaf500c4fbe5f10a7f664716fcb33dd7 | /src/test/java/com/app/filetracker/web/rest/AccountResourceIntTest.java | 80091479389984adf85518d7963eea362b159fe0 | [] | no_license | rkshnikhil/skilltracker | 7cdbc2a934d01009c429bdf1da315f6eed74b7bd | 8283aaa2f8340d8d91b6c4735cd3794912f54e98 | refs/heads/master | 2020-03-17T17:53:35.384241 | 2018-05-17T11:56:40 | 2018-05-17T11:56:40 | 133,806,356 | 0 | 0 | null | 2018-05-17T11:56:41 | 2018-05-17T11:53:40 | Java | UTF-8 | Java | false | false | 30,963 | java | package com.app.filetracker.web.rest;
import com.app.filetracker.config.Constants;
import com.app.filetracker.SkilltrackerApp;
import com.app.filetracker.domain.Authority;
import com.app.filetracker.domain.User;
import com.app.filetracker.repository.AuthorityRepository;
import com.app.filetracker.repository.UserRepository;
import com.app.filetracker.security.AuthoritiesConstants;
import com.app.filetracker.service.MailService;
import com.app.filetracker.service.dto.UserDTO;
import com.app.filetracker.web.rest.errors.ExceptionTranslator;
import com.app.filetracker.web.rest.vm.KeyAndPasswordVM;
import com.app.filetracker.web.rest.vm.ManagedUserVM;
import com.app.filetracker.service.UserService;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import java.time.Instant;
import java.time.LocalDate;
import java.util.*;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.mockito.Matchers.anyObject;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
/**
* Test class for the AccountResource REST controller.
*
* @see AccountResource
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SkilltrackerApp.class)
public class AccountResourceIntTest {
@Autowired
private UserRepository userRepository;
@Autowired
private AuthorityRepository authorityRepository;
@Autowired
private UserService userService;
@Autowired
private PasswordEncoder passwordEncoder;
@Autowired
private HttpMessageConverter[] httpMessageConverters;
@Autowired
private ExceptionTranslator exceptionTranslator;
@Mock
private UserService mockUserService;
@Mock
private MailService mockMailService;
private MockMvc restMvc;
private MockMvc restUserMockMvc;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
doNothing().when(mockMailService).sendActivationEmail(anyObject());
AccountResource accountResource =
new AccountResource(userRepository, userService, mockMailService);
AccountResource accountUserMockResource =
new AccountResource(userRepository, mockUserService, mockMailService);
this.restMvc = MockMvcBuilders.standaloneSetup(accountResource)
.setMessageConverters(httpMessageConverters)
.setControllerAdvice(exceptionTranslator)
.build();
this.restUserMockMvc = MockMvcBuilders.standaloneSetup(accountUserMockResource)
.setControllerAdvice(exceptionTranslator)
.build();
}
@Test
public void testNonAuthenticatedUser() throws Exception {
restUserMockMvc.perform(get("/api/authenticate")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().string(""));
}
@Test
public void testAuthenticatedUser() throws Exception {
restUserMockMvc.perform(get("/api/authenticate")
.with(request -> {
request.setRemoteUser("test");
return request;
})
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().string("test"));
}
@Test
public void testGetExistingAccount() throws Exception {
Set<Authority> authorities = new HashSet<>();
Authority authority = new Authority();
authority.setName(AuthoritiesConstants.ADMIN);
authorities.add(authority);
User user = new User();
user.setLogin("test");
user.setFirstName("john");
user.setLastName("doe");
user.setEmail("john.doe@jhipster.com");
user.setImageUrl("http://placehold.it/50x50");
user.setLangKey("en");
user.setAuthorities(authorities);
when(mockUserService.getUserWithAuthorities()).thenReturn(Optional.of(user));
restUserMockMvc.perform(get("/api/account")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.login").value("test"))
.andExpect(jsonPath("$.firstName").value("john"))
.andExpect(jsonPath("$.lastName").value("doe"))
.andExpect(jsonPath("$.email").value("john.doe@jhipster.com"))
.andExpect(jsonPath("$.imageUrl").value("http://placehold.it/50x50"))
.andExpect(jsonPath("$.langKey").value("en"))
.andExpect(jsonPath("$.authorities").value(AuthoritiesConstants.ADMIN));
}
@Test
public void testGetUnknownAccount() throws Exception {
when(mockUserService.getUserWithAuthorities()).thenReturn(Optional.empty());
restUserMockMvc.perform(get("/api/account")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isInternalServerError());
}
@Test
public void testRegisterValid() throws Exception {
ManagedUserVM validUser = new ManagedUserVM();
validUser.setLogin("joe");
validUser.setPassword("password");
validUser.setFirstName("Joe");
validUser.setLastName("Shmoe");
validUser.setEmail("joe@example.com");
validUser.setActivated(true);
validUser.setImageUrl("http://placehold.it/50x50");
validUser.setLangKey(Constants.DEFAULT_LANGUAGE);
validUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
assertThat(userRepository.findOneByLogin("joe").isPresent()).isFalse();
restMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(validUser)))
.andExpect(status().isCreated());
assertThat(userRepository.findOneByLogin("joe").isPresent()).isTrue();
}
@Test
public void testRegisterInvalidLogin() throws Exception {
ManagedUserVM invalidUser = new ManagedUserVM();
invalidUser.setLogin("funky-log!n");// <-- invalid
invalidUser.setPassword("password");
invalidUser.setFirstName("Funky");
invalidUser.setLastName("One");
invalidUser.setEmail("funky@example.com");
invalidUser.setActivated(true);
invalidUser.setImageUrl("http://placehold.it/50x50");
invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE);
invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restUserMockMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(invalidUser)))
.andExpect(status().isBadRequest());
Optional<User> user = userRepository.findOneByEmailIgnoreCase("funky@example.com");
assertThat(user.isPresent()).isFalse();
}
@Test
public void testRegisterInvalidEmail() throws Exception {
ManagedUserVM invalidUser = new ManagedUserVM();
invalidUser.setLogin("bob");
invalidUser.setPassword("password");
invalidUser.setFirstName("Bob");
invalidUser.setLastName("Green");
invalidUser.setEmail("invalid");// <-- invalid
invalidUser.setActivated(true);
invalidUser.setImageUrl("http://placehold.it/50x50");
invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE);
invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restUserMockMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(invalidUser)))
.andExpect(status().isBadRequest());
Optional<User> user = userRepository.findOneByLogin("bob");
assertThat(user.isPresent()).isFalse();
}
@Test
public void testRegisterInvalidPassword() throws Exception {
ManagedUserVM invalidUser = new ManagedUserVM();
invalidUser.setLogin("bob");
invalidUser.setPassword("123");// password with only 3 digits
invalidUser.setFirstName("Bob");
invalidUser.setLastName("Green");
invalidUser.setEmail("bob@example.com");
invalidUser.setActivated(true);
invalidUser.setImageUrl("http://placehold.it/50x50");
invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE);
invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restUserMockMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(invalidUser)))
.andExpect(status().isBadRequest());
Optional<User> user = userRepository.findOneByLogin("bob");
assertThat(user.isPresent()).isFalse();
}
@Test
public void testRegisterNullPassword() throws Exception {
ManagedUserVM invalidUser = new ManagedUserVM();
invalidUser.setLogin("bob");
invalidUser.setPassword(null);// invalid null password
invalidUser.setFirstName("Bob");
invalidUser.setLastName("Green");
invalidUser.setEmail("bob@example.com");
invalidUser.setActivated(true);
invalidUser.setImageUrl("http://placehold.it/50x50");
invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE);
invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restUserMockMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(invalidUser)))
.andExpect(status().isBadRequest());
Optional<User> user = userRepository.findOneByLogin("bob");
assertThat(user.isPresent()).isFalse();
}
@Test
public void testRegisterDuplicateLogin() throws Exception {
// Good
ManagedUserVM validUser = new ManagedUserVM();
validUser.setLogin("alice");
validUser.setPassword("password");
validUser.setFirstName("Alice");
validUser.setLastName("Something");
validUser.setEmail("alice@example.com");
validUser.setActivated(true);
validUser.setImageUrl("http://placehold.it/50x50");
validUser.setLangKey(Constants.DEFAULT_LANGUAGE);
validUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
// Duplicate login, different email
ManagedUserVM duplicatedUser = new ManagedUserVM();
duplicatedUser.setLogin(validUser.getLogin());
duplicatedUser.setPassword(validUser.getPassword());
duplicatedUser.setFirstName(validUser.getFirstName());
duplicatedUser.setLastName(validUser.getLastName());
duplicatedUser.setEmail("alicejr@example.com");
duplicatedUser.setActivated(validUser.isActivated());
duplicatedUser.setImageUrl(validUser.getImageUrl());
duplicatedUser.setLangKey(validUser.getLangKey());
duplicatedUser.setCreatedBy(validUser.getCreatedBy());
duplicatedUser.setCreatedDate(validUser.getCreatedDate());
duplicatedUser.setLastModifiedBy(validUser.getLastModifiedBy());
duplicatedUser.setLastModifiedDate(validUser.getLastModifiedDate());
duplicatedUser.setAuthorities(new HashSet<>(validUser.getAuthorities()));
// Good user
restMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(validUser)))
.andExpect(status().isCreated());
// Duplicate login
restMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(duplicatedUser)))
.andExpect(status().is4xxClientError());
Optional<User> userDup = userRepository.findOneByEmailIgnoreCase("alicejr@example.com");
assertThat(userDup.isPresent()).isFalse();
}
@Test
public void testRegisterDuplicateEmail() throws Exception {
// Good
ManagedUserVM validUser = new ManagedUserVM();
validUser.setLogin("john");
validUser.setPassword("password");
validUser.setFirstName("John");
validUser.setLastName("Doe");
validUser.setEmail("john@example.com");
validUser.setActivated(true);
validUser.setImageUrl("http://placehold.it/50x50");
validUser.setLangKey(Constants.DEFAULT_LANGUAGE);
validUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
// Duplicate email, different login
ManagedUserVM duplicatedUser = new ManagedUserVM();
duplicatedUser.setLogin("johnjr");
duplicatedUser.setPassword(validUser.getPassword());
duplicatedUser.setFirstName(validUser.getFirstName());
duplicatedUser.setLastName(validUser.getLastName());
duplicatedUser.setEmail(validUser.getEmail());
duplicatedUser.setActivated(validUser.isActivated());
duplicatedUser.setImageUrl(validUser.getImageUrl());
duplicatedUser.setLangKey(validUser.getLangKey());
duplicatedUser.setCreatedBy(validUser.getCreatedBy());
duplicatedUser.setCreatedDate(validUser.getCreatedDate());
duplicatedUser.setLastModifiedBy(validUser.getLastModifiedBy());
duplicatedUser.setLastModifiedDate(validUser.getLastModifiedDate());
duplicatedUser.setAuthorities(new HashSet<>(validUser.getAuthorities()));
// Good user
restMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(validUser)))
.andExpect(status().isCreated());
// Duplicate email
restMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(duplicatedUser)))
.andExpect(status().is4xxClientError());
// Duplicate email - with uppercase email address
ManagedUserVM userWithUpperCaseEmail = new ManagedUserVM();
userWithUpperCaseEmail.setId(validUser.getId());
userWithUpperCaseEmail.setLogin("johnjr");
userWithUpperCaseEmail.setPassword(validUser.getPassword());
userWithUpperCaseEmail.setFirstName(validUser.getFirstName());
userWithUpperCaseEmail.setLastName(validUser.getLastName());
userWithUpperCaseEmail.setEmail(validUser.getEmail().toUpperCase());
userWithUpperCaseEmail.setActivated(validUser.isActivated());
userWithUpperCaseEmail.setImageUrl(validUser.getImageUrl());
userWithUpperCaseEmail.setLangKey(validUser.getLangKey());
userWithUpperCaseEmail.setCreatedBy(validUser.getCreatedBy());
userWithUpperCaseEmail.setCreatedDate(validUser.getCreatedDate());
userWithUpperCaseEmail.setLastModifiedBy(validUser.getLastModifiedBy());
userWithUpperCaseEmail.setLastModifiedDate(validUser.getLastModifiedDate());
userWithUpperCaseEmail.setAuthorities(new HashSet<>(validUser.getAuthorities()));
restMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(userWithUpperCaseEmail)))
.andExpect(status().is4xxClientError());
Optional<User> userDup = userRepository.findOneByLogin("johnjr");
assertThat(userDup.isPresent()).isFalse();
}
@Test
public void testRegisterAdminIsIgnored() throws Exception {
ManagedUserVM validUser = new ManagedUserVM();
validUser.setLogin("badguy");
validUser.setPassword("password");
validUser.setFirstName("Bad");
validUser.setLastName("Guy");
validUser.setEmail("badguy@example.com");
validUser.setActivated(true);
validUser.setImageUrl("http://placehold.it/50x50");
validUser.setLangKey(Constants.DEFAULT_LANGUAGE);
validUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(validUser)))
.andExpect(status().isCreated());
Optional<User> userDup = userRepository.findOneByLogin("badguy");
assertThat(userDup.isPresent()).isTrue();
assertThat(userDup.get().getAuthorities()).hasSize(1)
.containsExactly(authorityRepository.findOne(AuthoritiesConstants.USER));
}
@Test
public void testActivateAccount() throws Exception {
final String activationKey = "some activation key";
User user = new User();
user.setLogin("activate-account");
user.setEmail("activate-account@example.com");
user.setPassword(RandomStringUtils.random(60));
user.setActivated(false);
user.setActivationKey(activationKey);
userRepository.save(user);
restMvc.perform(get("/api/activate?key={activationKey}", activationKey))
.andExpect(status().isOk());
user = userRepository.findOneByLogin(user.getLogin()).orElse(null);
assertThat(user.getActivated()).isTrue();
}
@Test
public void testActivateAccountWithWrongKey() throws Exception {
restMvc.perform(get("/api/activate?key=wrongActivationKey"))
.andExpect(status().isInternalServerError());
}
@Test
@WithMockUser("save-account")
public void testSaveAccount() throws Exception {
User user = new User();
user.setLogin("save-account");
user.setEmail("save-account@example.com");
user.setPassword(RandomStringUtils.random(60));
user.setActivated(true);
userRepository.save(user);
UserDTO userDTO = new UserDTO();
userDTO.setLogin("not-used");
userDTO.setFirstName("firstname");
userDTO.setLastName("lastname");
userDTO.setEmail("save-account@example.com");
userDTO.setActivated(false);
userDTO.setImageUrl("http://placehold.it/50x50");
userDTO.setLangKey(Constants.DEFAULT_LANGUAGE);
userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN));
restMvc.perform(
post("/api/account")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(userDTO)))
.andExpect(status().isOk());
User updatedUser = userRepository.findOneByLogin(user.getLogin()).orElse(null);
assertThat(updatedUser.getFirstName()).isEqualTo(userDTO.getFirstName());
assertThat(updatedUser.getLastName()).isEqualTo(userDTO.getLastName());
assertThat(updatedUser.getEmail()).isEqualTo(userDTO.getEmail());
assertThat(updatedUser.getLangKey()).isEqualTo(userDTO.getLangKey());
assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword());
assertThat(updatedUser.getImageUrl()).isEqualTo(userDTO.getImageUrl());
assertThat(updatedUser.getActivated()).isEqualTo(true);
assertThat(updatedUser.getAuthorities()).isEmpty();
}
@Test
@WithMockUser("save-invalid-email")
public void testSaveInvalidEmail() throws Exception {
User user = new User();
user.setLogin("save-invalid-email");
user.setEmail("save-invalid-email@example.com");
user.setPassword(RandomStringUtils.random(60));
user.setActivated(true);
userRepository.save(user);
UserDTO userDTO = new UserDTO();
userDTO.setLogin("not-used");
userDTO.setFirstName("firstname");
userDTO.setLastName("lastname");
userDTO.setEmail("invalid email");
userDTO.setActivated(false);
userDTO.setImageUrl("http://placehold.it/50x50");
userDTO.setLangKey(Constants.DEFAULT_LANGUAGE);
userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN));
restMvc.perform(
post("/api/account")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(userDTO)))
.andExpect(status().isBadRequest());
assertThat(userRepository.findOneByEmailIgnoreCase("invalid email")).isNotPresent();
}
@Test
@WithMockUser("save-existing-email")
public void testSaveExistingEmail() throws Exception {
User user = new User();
user.setLogin("save-existing-email");
user.setEmail("save-existing-email@example.com");
user.setPassword(RandomStringUtils.random(60));
user.setActivated(true);
userRepository.save(user);
User anotherUser = new User();
anotherUser.setLogin("save-existing-email2");
anotherUser.setEmail("save-existing-email2@example.com");
anotherUser.setPassword(RandomStringUtils.random(60));
anotherUser.setActivated(true);
userRepository.save(anotherUser);
UserDTO userDTO = new UserDTO();
userDTO.setLogin("not-used");
userDTO.setFirstName("firstname");
userDTO.setLastName("lastname");
userDTO.setEmail("save-existing-email2@example.com");
userDTO.setActivated(false);
userDTO.setImageUrl("http://placehold.it/50x50");
userDTO.setLangKey(Constants.DEFAULT_LANGUAGE);
userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN));
restMvc.perform(
post("/api/account")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(userDTO)))
.andExpect(status().isBadRequest());
User updatedUser = userRepository.findOneByLogin("save-existing-email").orElse(null);
assertThat(updatedUser.getEmail()).isEqualTo("save-existing-email@example.com");
}
@Test
@WithMockUser("save-existing-email-and-login")
public void testSaveExistingEmailAndLogin() throws Exception {
User user = new User();
user.setLogin("save-existing-email-and-login");
user.setEmail("save-existing-email-and-login@example.com");
user.setPassword(RandomStringUtils.random(60));
user.setActivated(true);
userRepository.save(user);
UserDTO userDTO = new UserDTO();
userDTO.setLogin("not-used");
userDTO.setFirstName("firstname");
userDTO.setLastName("lastname");
userDTO.setEmail("save-existing-email-and-login@example.com");
userDTO.setActivated(false);
userDTO.setImageUrl("http://placehold.it/50x50");
userDTO.setLangKey(Constants.DEFAULT_LANGUAGE);
userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN));
restMvc.perform(
post("/api/account")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(userDTO)))
.andExpect(status().isOk());
User updatedUser = userRepository.findOneByLogin("save-existing-email-and-login").orElse(null);
assertThat(updatedUser.getEmail()).isEqualTo("save-existing-email-and-login@example.com");
}
@Test
@WithMockUser("change-password")
public void testChangePassword() throws Exception {
User user = new User();
user.setPassword(RandomStringUtils.random(60));
user.setLogin("change-password");
user.setEmail("change-password@example.com");
userRepository.save(user);
restMvc.perform(post("/api/account/change-password").content("new password"))
.andExpect(status().isOk());
User updatedUser = userRepository.findOneByLogin("change-password").orElse(null);
assertThat(passwordEncoder.matches("new password", updatedUser.getPassword())).isTrue();
}
@Test
@WithMockUser("change-password-too-small")
public void testChangePasswordTooSmall() throws Exception {
User user = new User();
user.setPassword(RandomStringUtils.random(60));
user.setLogin("change-password-too-small");
user.setEmail("change-password-too-small@example.com");
userRepository.save(user);
restMvc.perform(post("/api/account/change-password").content("new"))
.andExpect(status().isBadRequest());
User updatedUser = userRepository.findOneByLogin("change-password-too-small").orElse(null);
assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword());
}
@Test
@WithMockUser("change-password-too-long")
public void testChangePasswordTooLong() throws Exception {
User user = new User();
user.setPassword(RandomStringUtils.random(60));
user.setLogin("change-password-too-long");
user.setEmail("change-password-too-long@example.com");
userRepository.save(user);
restMvc.perform(post("/api/account/change-password").content(RandomStringUtils.random(101)))
.andExpect(status().isBadRequest());
User updatedUser = userRepository.findOneByLogin("change-password-too-long").orElse(null);
assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword());
}
@Test
@WithMockUser("change-password-empty")
public void testChangePasswordEmpty() throws Exception {
User user = new User();
user.setPassword(RandomStringUtils.random(60));
user.setLogin("change-password-empty");
user.setEmail("change-password-empty@example.com");
userRepository.save(user);
restMvc.perform(post("/api/account/change-password").content(RandomStringUtils.random(0)))
.andExpect(status().isBadRequest());
User updatedUser = userRepository.findOneByLogin("change-password-empty").orElse(null);
assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword());
}
@Test
public void testRequestPasswordReset() throws Exception {
User user = new User();
user.setPassword(RandomStringUtils.random(60));
user.setActivated(true);
user.setLogin("password-reset");
user.setEmail("password-reset@example.com");
userRepository.save(user);
restMvc.perform(post("/api/account/reset-password/init")
.content("password-reset@example.com"))
.andExpect(status().isOk());
}
@Test
public void testRequestPasswordResetUpperCaseEmail() throws Exception {
User user = new User();
user.setPassword(RandomStringUtils.random(60));
user.setActivated(true);
user.setLogin("password-reset");
user.setEmail("password-reset@example.com");
userRepository.save(user);
restMvc.perform(post("/api/account/reset-password/init")
.content("password-reset@EXAMPLE.COM"))
.andExpect(status().isOk());
}
@Test
public void testRequestPasswordResetWrongEmail() throws Exception {
restMvc.perform(
post("/api/account/reset-password/init")
.content("password-reset-wrong-email@example.com"))
.andExpect(status().isBadRequest());
}
@Test
public void testFinishPasswordReset() throws Exception {
User user = new User();
user.setPassword(RandomStringUtils.random(60));
user.setLogin("finish-password-reset");
user.setEmail("finish-password-reset@example.com");
user.setResetDate(Instant.now().plusSeconds(60));
user.setResetKey("reset key");
userRepository.save(user);
KeyAndPasswordVM keyAndPassword = new KeyAndPasswordVM();
keyAndPassword.setKey(user.getResetKey());
keyAndPassword.setNewPassword("new password");
restMvc.perform(
post("/api/account/reset-password/finish")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(keyAndPassword)))
.andExpect(status().isOk());
User updatedUser = userRepository.findOneByLogin(user.getLogin()).orElse(null);
assertThat(passwordEncoder.matches(keyAndPassword.getNewPassword(), updatedUser.getPassword())).isTrue();
}
@Test
public void testFinishPasswordResetTooSmall() throws Exception {
User user = new User();
user.setPassword(RandomStringUtils.random(60));
user.setLogin("finish-password-reset-too-small");
user.setEmail("finish-password-reset-too-small@example.com");
user.setResetDate(Instant.now().plusSeconds(60));
user.setResetKey("reset key too small");
userRepository.save(user);
KeyAndPasswordVM keyAndPassword = new KeyAndPasswordVM();
keyAndPassword.setKey(user.getResetKey());
keyAndPassword.setNewPassword("foo");
restMvc.perform(
post("/api/account/reset-password/finish")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(keyAndPassword)))
.andExpect(status().isBadRequest());
User updatedUser = userRepository.findOneByLogin(user.getLogin()).orElse(null);
assertThat(passwordEncoder.matches(keyAndPassword.getNewPassword(), updatedUser.getPassword())).isFalse();
}
@Test
public void testFinishPasswordResetWrongKey() throws Exception {
KeyAndPasswordVM keyAndPassword = new KeyAndPasswordVM();
keyAndPassword.setKey("wrong reset key");
keyAndPassword.setNewPassword("new password");
restMvc.perform(
post("/api/account/reset-password/finish")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(keyAndPassword)))
.andExpect(status().isInternalServerError());
}
}
| [
"jhipster-bot@users.noreply.github.com"
] | jhipster-bot@users.noreply.github.com |
bb7f069650d5f3f0a737899c11d212e59fcb7216 | c7e000e5c6549e095a8ffd032d33e0ca449c7ffd | /bin/platform/bootstrap/gensrc/de/hybris/platform/core/model/c2l/RegionModel.java | ba3b0b681d586db159e9e590dedefdf75fff0614 | [] | no_license | J3ys/million | e80ff953e228e4bc43a1108a1c117ddf11cc4644 | a97974b68b4adaf820f9024aa5181de635c60b4f | refs/heads/master | 2021-03-09T22:59:35.115273 | 2015-05-19T02:47:29 | 2015-05-19T02:47:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,091 | java | /*
* ----------------------------------------------------------------
* --- WARNING: THIS FILE IS GENERATED AND WILL BE OVERWRITTEN! ---
* --- Generated at 2015/05/18 13:25:55 ---
* ----------------------------------------------------------------
*
* [y] hybris Platform
*
* Copyright (c) 2000-2011 hybris AG
* All rights reserved.
*
* This software is the confidential and proprietary information of hybris
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with hybris.
*
*/
package de.hybris.platform.core.model.c2l;
import de.hybris.platform.core.model.ItemModel;
import de.hybris.platform.core.model.c2l.C2LItemModel;
import de.hybris.platform.core.model.c2l.CountryModel;
import de.hybris.platform.servicelayer.model.ItemModelContext;
/**
* Generated model class for type Region first defined at extension core.
*/
@SuppressWarnings("all")
public class RegionModel extends C2LItemModel
{
/**<i>Generated model type code constant.</i>*/
public final static String _TYPECODE = "Region";
/**<i>Generated relation code constant for relation <code>Country2RegionRelation</code> defining source attribute <code>country</code> in extension <code>core</code>.</i>*/
public final static String _COUNTRY2REGIONRELATION = "Country2RegionRelation";
/** <i>Generated constant</i> - Attribute key of <code>Region.country</code> attribute defined at extension <code>core</code>. */
public static final String COUNTRY = "country";
/** <i>Generated constant</i> - Attribute key of <code>Region.isocodeShort</code> attribute defined at extension <code>commerceservices</code>. */
public static final String ISOCODESHORT = "isocodeShort";
/** <i>Generated variable</i> - Variable of <code>Region.country</code> attribute defined at extension <code>core</code>. */
private CountryModel _country;
/** <i>Generated variable</i> - Variable of <code>Region.isocodeShort</code> attribute defined at extension <code>commerceservices</code>. */
private String _isocodeShort;
/**
* <i>Generated constructor</i> - Default constructor for generic creation.
*/
public RegionModel()
{
super();
}
/**
* <i>Generated constructor</i> - Default constructor for creation with existing context
* @param ctx the model context to be injected, must not be null
*/
public RegionModel(final ItemModelContext ctx)
{
super(ctx);
}
/**
* <i>Generated constructor</i> - Constructor with all mandatory attributes.
* @deprecated Since 4.1.1 Please use the default constructor without parameters
* @param _country initial attribute declared by type <code>Region</code> at extension <code>core</code>
* @param _isocode initial attribute declared by type <code>Region</code> at extension <code>core</code>
*/
@Deprecated
public RegionModel(final CountryModel _country, final String _isocode)
{
super();
setCountry(_country);
setIsocode(_isocode);
}
/**
* <i>Generated constructor</i> - for all mandatory and initial attributes.
* @deprecated Since 4.1.1 Please use the default constructor without parameters
* @param _country initial attribute declared by type <code>Region</code> at extension <code>core</code>
* @param _isocode initial attribute declared by type <code>Region</code> at extension <code>core</code>
* @param _owner initial attribute declared by type <code>Item</code> at extension <code>core</code>
*/
@Deprecated
public RegionModel(final CountryModel _country, final String _isocode, final ItemModel _owner)
{
super();
setCountry(_country);
setIsocode(_isocode);
setOwner(_owner);
}
/**
* <i>Generated method</i> - Getter of the <code>Region.country</code> attribute defined at extension <code>core</code>.
* @return the country
*/
public CountryModel getCountry()
{
if (this._country!=null)
{
return _country;
}
return _country = getPersistenceContext().getValue(COUNTRY, _country);
}
/**
* <i>Generated method</i> - Getter of the <code>Region.isocodeShort</code> attribute defined at extension <code>commerceservices</code>.
* @return the isocodeShort - 2 character isocode
*/
public String getIsocodeShort()
{
if (this._isocodeShort!=null)
{
return _isocodeShort;
}
return _isocodeShort = getPersistenceContext().getValue(ISOCODESHORT, _isocodeShort);
}
/**
* <i>Generated method</i> - Setter of <code>Region.country</code> attribute defined at extension <code>core</code>.
*
* @param value the country
*/
public void setCountry(final CountryModel value)
{
_country = getPersistenceContext().setValue(COUNTRY, value);
}
/**
* <i>Generated method</i> - Setter of <code>Region.isocodeShort</code> attribute defined at extension <code>commerceservices</code>.
*
* @param value the isocodeShort - 2 character isocode
*/
public void setIsocodeShort(final String value)
{
_isocodeShort = getPersistenceContext().setValue(ISOCODESHORT, value);
}
}
| [
"yanagisawa@gotandadenshi.jp"
] | yanagisawa@gotandadenshi.jp |
1d9968787dbd49b89ba0956633fc3a9623c7a7a6 | bc614ca789e3b06674c853dcdbe67cf07c53b4fe | /MyBatisPlugin/src/com/mybatis/plugin/main/MainTest.java | 748841eda1ec5a267f97bdb5deebaac29d70f490 | [] | no_license | reyhoo/web | 53aca6b263781b6abd1e0a4bf44d867fd35945f0 | f610a7cc410862387b3ac406883118fdb7df3f71 | refs/heads/master | 2021-01-25T08:01:08.790373 | 2019-05-04T03:06:17 | 2019-05-04T03:06:17 | 93,699,418 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 6,706 | java | package com.mybatis.plugin.main;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.security.MessageDigest;
import java.util.Iterator;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import javax.imageio.ImageIO;
import javax.imageio.ImageReader;
import javax.imageio.stream.ImageInputStream;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.ibatis.session.SqlSession;
import com.mybatis.plugin.mapper.UserMapper;
import com.mybatis.plugin.pojo.SexEnum;
import com.mybatis.plugin.pojo.User;
import com.mybatis.plugin.utils.SqlSessionFactoryUtils;
public class MainTest {
public static void main(String[] args) {
// SqlSession session = SqlSessionFactoryUtils.openSession();
// UserMapper userMapper = session.getMapper(UserMapper.class);
// PageParam pageParam = new PageParam();
// List<User> list = userMapper.findAll(pageParam);
// System.out.println(list.size());
// SqlSession session = SqlSessionFactoryUtils.openSession();
// UserMapper userMapper = session.getMapper(UserMapper.class);
// PageParams pageParam = new PageParams();
// pageParam.setPage(1);
// pageParam.setPageSize(5);
// pageParam.setCleanOrderBy(true);
// List<User> list = userMapper.findWithCondition(200l, 1l, pageParam);
// System.out.println(list.size());
// System.out.println(list);
// System.out.println(pageParam.getTotalPage());
Base64 base64 = new Base64();
String encode = base64.encodeToString("中华人民共和国".getBytes());
System.out.println(encode);
System.out.println(Base64.encodeBase64String("中华人民共和国".getBytes()));
byte[] data = Base64.decodeBase64(encode);
System.out.println(new String(base64.decode(encode)));
System.out.println(new String(data));
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(
new FileInputStream("hello")));
String line = reader.readLine();
System.out.println("--------------------------");
byte[] bytes = Base64.decodeBase64("MTIzNDU2Nzg5");
// FileOutputStream out = new FileOutputStream("hello1");
// out.write(bytes);
System.out.println(encodeSha512(bytes));
System.out.println("--------------------------");
String link = "appCustomerId=002&appId=662C9F07E8256DBEE053F0FE83908A24&pic=9nKmRbUhEK3C3bHfmHD04ZyWtMfBBeJR2q0xYo8BlYLAbwqt+6zHef6+nGvvGCrmXFj3bUeV11wLI7FUiCjpnQ==&token=bindFace-d6177f0a2550405a8fc2a6b234470979-20180308141725";
System.out.println(hmacSHA256(link.getBytes("UTF-8"), "662C9F07E8246DBEE053F0FE83908A24"));
System.out.println("--------------------------");
System.out.println(DigestUtils.md5Hex(new FileInputStream("1.png")));
System.out.println(DigestUtils.md5Hex(new FileInputStream("2.png")));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
panduan();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String s = "appId=662C9F07E8256DBEE053F0FE83908A24&appCustomerId=003&token=bindFace-662C9F07E8256DBEE053F0FE83908A24-003-c03987ba20284b69-20180309150358&pic=123";
System.out.println(s);
try {
System.out.println(hmacSHA256(s,"662C9F07E8256DBEE053F0FE83908A24"));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(Base64.encodeBase64String("com.mysql.jdbc.Driver".getBytes()));
System.out.println(Base64.encodeBase64String("jdbc:mysql://localhost:3306/ssm?useUnicode=true&characterEncoding=utf8".getBytes()));
System.out.println(Base64.encodeBase64String("root".getBytes()));
System.out.println(Base64.encodeBase64String("123456".getBytes()));
}
public static String hmacSHA256(String str, String key) throws Exception {
return hmacSHA256(str.getBytes("utf-8"), key);
}
// public static String hmacSHA256(byte[] data, String key) throws Exception {
// String algorithm = "HmacSHA256";
// Mac mac = Mac.getInstance(algorithm);
// mac.init(new SecretKeySpec(key.getBytes("UTF-8"), algorithm));
// return new String(new Base64().encode(mac.doFinal(data)));
// }
public static String hmacSHA256(byte[] data, String key) throws Exception {
String algorithm = "HmacSHA256";
Mac mac = Mac.getInstance(algorithm);
mac.init(new SecretKeySpec(key.getBytes("UTF-8"), algorithm));
return new Base64().encodeToString(mac.doFinal(data));
}
public static void panduan() throws Exception {
// get image format in a file
File file = new File("0_");
// create an image input stream from the specified file
ImageInputStream iis = ImageIO.createImageInputStream(file);
// get all currently registered readers that recognize the image format
Iterator<ImageReader> iter = ImageIO.getImageReaders(iis);
if (!iter.hasNext()) {
throw new RuntimeException("No readers found!");
}
// get the first reader
ImageReader reader = iter.next();
System.out.println("Format: " + reader.getFormatName());
// close stream
iis.close();
}
public static String encodeSha512(byte[] data) throws Exception {
String algorithm = "SHA-512";
MessageDigest messgeDigest = MessageDigest.getInstance(algorithm);
return new Base64().encodeToString(messgeDigest.digest(data));
}
private String MD5(String s) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] bytes = md.digest(s.getBytes("utf-8"));
return toHex(bytes);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
private static String toHex(byte[] bytes) {
final char[] HEX_DIGITS = "0123456789ABCDEF".toCharArray();
StringBuilder ret = new StringBuilder(bytes.length * 2);
for (int i = 0; i < bytes.length; i++) {
ret.append(HEX_DIGITS[(bytes[i] >> 4) & 0x0f]);
ret.append(HEX_DIGITS[bytes[i] & 0x0f]);
}
return ret.toString();
}
static void insertData() {
SqlSession session = SqlSessionFactoryUtils.openSession();
UserMapper userMapper = session.getMapper(UserMapper.class);
try {
for (int i = 0; i < 1000; i++) {
User user = new User();
user.setEmail("user" + (i + 1) + "@163.com");
user.setMobile("151" + (i + 1));
user.setNote("user" + (i + 1) + "notenotenote");
user.setRealName("user" + (i + 1) + ".yao");
SexEnum sex = i % 2 == 0 ? SexEnum.FEMALE : SexEnum.MALE;
user.setSex(sex);
user.setUserName("user" + (i + 1));
userMapper.addUser(user);
}
session.commit();
} catch (Exception e) {
e.printStackTrace();
session.rollback();
} finally {
session.close();
}
}
}
| [
"373561022@qq.com"
] | 373561022@qq.com |
b41f4dce14544aeb1b846154e9eb54cb5f06eb92 | 6062e3bbcd3f8928cb6fc5f24239d30f0fa951c5 | /mall-mbg/src/main/java/com/shawn/mall/model/UmsRolePermissionRelationExample.java | 89c602dd82298e84b0d32cf868a8b88d04edc901 | [] | no_license | xuehao712/Mall | bb8874f398c9ac430ec542af283817fb8b5c030c | 53be590b5efcf2bb91210303c3d3648020c53c90 | refs/heads/master | 2023-01-30T23:00:29.612630 | 2020-12-11T14:56:17 | 2020-12-11T14:56:17 | 301,602,914 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,102 | java | package com.shawn.mall.model;
import java.util.ArrayList;
import java.util.List;
public class UmsRolePermissionRelationExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public UmsRolePermissionRelationExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andRoleIdIsNull() {
addCriterion("role_id is null");
return (Criteria) this;
}
public Criteria andRoleIdIsNotNull() {
addCriterion("role_id is not null");
return (Criteria) this;
}
public Criteria andRoleIdEqualTo(Long value) {
addCriterion("role_id =", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotEqualTo(Long value) {
addCriterion("role_id <>", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdGreaterThan(Long value) {
addCriterion("role_id >", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdGreaterThanOrEqualTo(Long value) {
addCriterion("role_id >=", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdLessThan(Long value) {
addCriterion("role_id <", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdLessThanOrEqualTo(Long value) {
addCriterion("role_id <=", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdIn(List<Long> values) {
addCriterion("role_id in", values, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotIn(List<Long> values) {
addCriterion("role_id not in", values, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdBetween(Long value1, Long value2) {
addCriterion("role_id between", value1, value2, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotBetween(Long value1, Long value2) {
addCriterion("role_id not between", value1, value2, "roleId");
return (Criteria) this;
}
public Criteria andPermissionIdIsNull() {
addCriterion("permission_id is null");
return (Criteria) this;
}
public Criteria andPermissionIdIsNotNull() {
addCriterion("permission_id is not null");
return (Criteria) this;
}
public Criteria andPermissionIdEqualTo(Long value) {
addCriterion("permission_id =", value, "permissionId");
return (Criteria) this;
}
public Criteria andPermissionIdNotEqualTo(Long value) {
addCriterion("permission_id <>", value, "permissionId");
return (Criteria) this;
}
public Criteria andPermissionIdGreaterThan(Long value) {
addCriterion("permission_id >", value, "permissionId");
return (Criteria) this;
}
public Criteria andPermissionIdGreaterThanOrEqualTo(Long value) {
addCriterion("permission_id >=", value, "permissionId");
return (Criteria) this;
}
public Criteria andPermissionIdLessThan(Long value) {
addCriterion("permission_id <", value, "permissionId");
return (Criteria) this;
}
public Criteria andPermissionIdLessThanOrEqualTo(Long value) {
addCriterion("permission_id <=", value, "permissionId");
return (Criteria) this;
}
public Criteria andPermissionIdIn(List<Long> values) {
addCriterion("permission_id in", values, "permissionId");
return (Criteria) this;
}
public Criteria andPermissionIdNotIn(List<Long> values) {
addCriterion("permission_id not in", values, "permissionId");
return (Criteria) this;
}
public Criteria andPermissionIdBetween(Long value1, Long value2) {
addCriterion("permission_id between", value1, value2, "permissionId");
return (Criteria) this;
}
public Criteria andPermissionIdNotBetween(Long value1, Long value2) {
addCriterion("permission_id not between", value1, value2, "permissionId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"xuehao712@gmail.com"
] | xuehao712@gmail.com |
61bdd413883577a6bacd396e737385d16d3b2f68 | 0de6f632287047a940259d6ea6c3e3d64191fcf6 | /src/Login.java | bb62c53b2bf15c9ceec3676a42a4d5b154eeeb19 | [] | no_license | YunlinXie/TerminalApp_MImicsOnlineStore | 57c3ec3182bbc429fddb54e8f39f205cf3246122 | 9f6eff29bc2cfc2721a3f7209e31311a27b13580 | refs/heads/main | 2023-02-24T04:17:04.453258 | 2021-01-28T00:01:21 | 2021-01-28T00:01:21 | 333,591,878 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,762 | java | /**
* Project Name: College Supplies
*
* Group Members:
* Sarthak Agarwal
* Bhargavi Kumar Sundaresan
* Le Minh Long Nguyen
* Yunlin Xie
* Xin Xin
*
* Defines Login.java
* @author Sarthak Agarwal
*/
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Login {
private static String EmailCus;
public String getEmail() {
return EmailCus;
}
public static void main(String[] args) throws IOException {
Store store = new Store();
Scanner input = new Scanner(System.in);
int choice_1;
int choice_2;
System.out.println("Are you a :\n");
System.out.println("1) Employee");
System.out.println("2) Customer");
System.out.println("3) Leave the App!");
System.out.print("Please choose the index for the preferred options:");
choice_1 = input.nextInt();
input.nextLine();
System.out.println();
switch (choice_1) {
case 1:
System.out.println("Hello Employee,\n");
employeeLogIn(input);
break;
case 2:
System.out.println("Hello Customer,");
System.out.println("Are you a :");
System.out.println("1)New Customer");
System.out.println("2)Existing Customer");
System.out.println("3)Guest");
System.out.println("4)Back to main menu");
System.out.print("Please choose the index for the preferred options:");
choice_2 = input.nextInt();
input.nextLine();
switch (choice_2) {
case 1:
System.out.println("************* Welcome to College Supplies *************");
registerNewUser(input);
System.out.println("Redirecting to main menu:");
main(args);
break;
case 2:
System.out.println("************* Welcome back to College Supplies *************!\n");
customerLogIn(input);
break;
case 3:
System.out.println("************* Welcome to College Supplies *************\n");
store.view(3);
case 4:
main(args);
break;
}
break;
case 3:
System.out.println("Thanks for visiting us!\n");
System.exit(0);
default:
System.out.println("\nPlease enter a valid option\n");
break;
}
}
private static void employeeLogIn(Scanner input) {
boolean foundUser = false;
boolean foundPass = false;
String record = null;
String record2 = null;
FileReader in = null;
System.out.print("Please Enter User Name:");
String e_Uname = input.next();
System.out.print("Please Enter Password:");
String e_Pass = input.next();
try {
in = new FileReader("employee.txt");
BufferedReader bin = new BufferedReader(in);
record = new String();
while ((record = bin.readLine()) != null && (record2 = bin.readLine()) != null) {
if (e_Uname.contentEquals(record)) {
foundUser = true;
if (e_Pass.contentEquals(record2)) {
foundPass = true;
if (foundPass) {
System.out.println("Welcome " + record + "\n");
store.view(2);
break;
}
} else {
System.out.println("Information Mismatch");
System.out.println("Please Enter Information Again");
employeeLogIn(input);
}
}
if (foundPass) {
break;
}
record = bin.readLine();
}
if (!foundUser) {
System.out.println("Information Mismatch");
System.out.println("Please Enter Information Again");
employeeLogIn(input);
}
bin.close();
bin = null;
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
public static void customerLogIn(Scanner input) {
boolean foundUser = false;
boolean foundPass = false;
String record = null;
String record2 = null;
FileReader in = null;
System.out.print("Please Enter User Name:");
String e_Uname = input.next();
System.out.print("Please Enter Password:");
String e_Pass = input.next();
try {
in = new FileReader("customer.txt");
BufferedReader bin = new BufferedReader(in);
record = new String();
boolean ok = true;
while (ok) {
for (int i = 0; i < 7; i++) {
record = bin.readLine();
}
record = null;
if ((record = bin.readLine()) == null || (record2 = bin.readLine()) == null) {
}
if (e_Uname.contentEquals(record)) {
foundUser = true;
if (e_Pass.contentEquals(record2)) {
foundPass = true;
if (foundPass) {
System.out.println("Welcome " + record + "\n");
Store store= new Store();
store.setEmail(e_Uname);
store.view(1);
break;
}
} else {
System.out.println("Information Mismatch");
System.out.println("Please Enter Information Again");
customerLogIn(input);
}
}
if (foundPass) {
break;
}
record = bin.readLine();
record = null;
Store store= new Store();
store.view(1);
}
if (!foundUser) {
System.out.println("Information Mismatch");
System.out.println("Please Enter Information Again");
customerLogIn(input);
}
bin.close();
bin = null;
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
public static void registerNewUser(Scanner input) throws IOException {
FileWriter fw = null;
BufferedWriter bw = null;
PrintWriter pw = null;
System.out.println("Please enter the following Information to register");
System.out.print("Please enter your first name:");
String fName = input.nextLine();
boolean check1 = fName instanceof String;
while(!check1) {
System.out.println("Invalid Input Type!");
System.out.println("First Name should be a word");
System.out.println("Please enter your first name again");
fName = input.nextLine();
check1 = fName instanceof String;
}
System.out.print("Please enter your last name:");
String lName = input.nextLine();
boolean check2 = lName instanceof String;
while(!check2) {
System.out.println("Invalid Input Type");
System.out.println("Last Name should be a word");
System.out.println("Please enter your first name again");
lName = input.nextLine();
}
System.out.print("Please enter your Street Address:");
String address = input.nextLine();
System.out.print("Please enter your City:");
String city = input.nextLine();
boolean checkCity = city instanceof String;
while(!checkCity) {
System.out.println("Invalid Input Type");
System.out.println("City should be a word");
System.out.println("Please enter your city again");
city = input.nextLine();
}
System.out.print("Please enter your State:");
String state = input.nextLine();
boolean checkState = state instanceof String;
while(!checkState) {
System.out.println("Invalid Input Type");
System.out.println("State should be a word");
System.out.println("Please enter your state again");
state = input.nextLine();
}
System.out.print("Please enter your ZIP code:");
String zip = input.nextLine();
System.out.println("Please enter your Phone Number");
System.out.print("(Phone Number must be in the form XXX-XXXXXXX):");
String phNumber = input.nextLine();
Pattern pattern = Pattern.compile("\\d{3}-\\d{7}");
Matcher matcher = pattern.matcher(phNumber);
boolean checkPhNumber = matcher.matches();
while(!checkPhNumber){
System.out.println("Invalid Input ");
System.out.println("Please enter Valid Phone Number:");
System.out.println("Phone Number must be in the form XXX-XXXXXXX");
phNumber = input.nextLine();
matcher = pattern.matcher(phNumber);
checkPhNumber = matcher.matches();
}
System.out.println("Please enter your email id:");
System.out.print("(THIS WILL ALSO BE YOUR ID:)");
String id = input.nextLine();
boolean check3 = id.contains("@");
while(!check3){
System.out.println("Invalid Input ");
System.out.println("Please enter Valid email with (Should contain : @ ):");
id = input.nextLine();
check3 = id.contains("@");
}
System.out.print("Please enter your password:");
String password = input.nextLine();
System.out.print("Please re-enter your password:");
String password2 = input.nextLine();
boolean check4 = password.equals(password2);
while (!check4) {
System.out.println("Passwords don't match!\nPlease Enter password again");
System.out.print("Please enter your password:");
password = input.nextLine();
System.out.print("Please re-enter your password:");
password2 = input.nextLine();
check4 = password.equals(password2);
}
try {
fw = new FileWriter("customer.txt", true);
bw = new BufferedWriter(fw);
pw = new PrintWriter(bw);
pw.println(fName);
pw.println(lName);
pw.println(address);
pw.println(city);
pw.println(state);
pw.println(zip);
pw.println(phNumber);
pw.println(id);
pw.println(password);
pw.println();
System.out.println("Data Successfully added to database");
pw.flush();
} finally {
try {
pw.close();
bw.close();
fw.close();
} catch (IOException io) {// can't do anything }
}
}
}
} | [
"xieyunlin11@gmail.com"
] | xieyunlin11@gmail.com |
84654da585c7d6486f174b5870a4170971d2696d | dac7a429028904e6608cff49c2fb5542772943fe | /src/main/java/com/yu/hang/shiro/FormAuthenticationCaptchaFilter.java | a8bf8fc0383db8663025d995313820656ce9d8e8 | [] | no_license | yuhang123wo/website | e4aee1f19c9579fec50d7dd0e63010f46baea727 | 9a384933000b59bc8c2d587d8b4876a4088f7d3a | refs/heads/master | 2021-01-25T06:45:53.740843 | 2017-09-22T03:11:33 | 2017-09-22T03:11:33 | 93,613,325 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,343 | java | package com.yu.hang.shiro;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;
import org.apache.shiro.web.util.WebUtils;
/**
*
* @author yuhang
* @Date 2017年6月30日
* @desc
*/
public class FormAuthenticationCaptchaFilter extends FormAuthenticationFilter {
public static final String DEFAULT_CAPTCHA_PARAM = "captcha";
private String loginPrefix;
private String fail;
protected boolean executeLogin(ServletRequest request, ServletResponse response)
throws Exception {
AuthenticationToken token = createToken(request, response);
if (token == null) {
throw new IllegalStateException("create AuthenticationToken error");
}
try {
Subject subject = getSubject(request, response);
subject.login(token);
return super.onLoginSuccess(token, subject, request, response);
} catch (AuthenticationException e) {
return onLoginFailure(token, getFail(), e, request, response);
}
}
protected AuthenticationToken createToken(
ServletRequest request, ServletResponse response) {
String username = getUsername(request);
String password = getPassword(request);
String captcha = getCaptcha(request);
return new UsernamePasswordCaptchaToken(username, password.toCharArray(), captcha);
}
protected String getCaptcha(ServletRequest request) {
return WebUtils.getCleanParam(request, DEFAULT_CAPTCHA_PARAM);
}
protected void issueSuccessRedirect(ServletRequest request, ServletResponse response)
throws Exception {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse res = (HttpServletResponse) response;
String successUrl = req.getParameter("");
if (StringUtils.isBlank(successUrl)) {
if (req.getRequestURI().startsWith(req.getContextPath() + "")) {
// 后台直接返回首页
successUrl = getLoginPrefix();
// 清除SavedRequest
WebUtils.getAndClearSavedRequest(request);
WebUtils.issueRedirect(request, response, successUrl, null, true);
return;
} else {
successUrl = getSuccessUrl();
}
}
WebUtils.redirectToSavedRequest(req, res, successUrl);
}
/**
* 登录失败
*/
private boolean onLoginFailure(AuthenticationToken token, String failureUrl,
AuthenticationException e, ServletRequest request, ServletResponse response) {
String className = e.getClass().getName();
request.setAttribute(getFailureKeyAttribute(), className);
if (failureUrl != null || StringUtils.isNotBlank(failureUrl)) {
try {
request.getRequestDispatcher(failureUrl).forward(request, response);
} catch (Exception e1) {
e1.printStackTrace();
}
}
return true;
}
public String getLoginPrefix() {
return loginPrefix;
}
public void setLoginPrefix(String loginPrefix) {
this.loginPrefix = loginPrefix;
}
public String getFail() {
return fail;
}
public void setFail(String fail) {
this.fail = fail;
}
}
| [
"yuhang@stargoto.com"
] | yuhang@stargoto.com |
39ef3be6e5b508ca6739583761c80bd89a66de67 | bcdafb6017f0ef456a1a45f3319a31b99bf12252 | /src/main/java/com/peploleum/insight/repository/NetLinkRepository.java | 92f356c1ec29685b50370c50d05794928a4644d3 | [] | no_license | mikrobe/insight | 9831eabd4a1460e6ead50409ba50a5e3653bc70a | eedf7354950adff734d1cc910021a728f65a4177 | refs/heads/master | 2020-07-06T19:59:23.630738 | 2019-02-12T10:10:35 | 2019-02-12T10:10:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 401 | java | package com.peploleum.insight.repository;
import com.peploleum.insight.domain.NetLink;
import org.springframework.data.jpa.repository.*;
import org.springframework.stereotype.Repository;
/**
* Spring Data repository for the NetLink entity.
*/
@SuppressWarnings("unused")
@Repository
public interface NetLinkRepository extends JpaRepository<NetLink, Long>, JpaSpecificationExecutor<NetLink> {
}
| [
"thevinc@gmx.fr"
] | thevinc@gmx.fr |
693bad942803537584ee462954c98e283d246ca7 | f7a2f4fa4cd801e47ab7e711de170056131162c8 | /src/main/java/ru/shift/chat/repository/ConnectionRepository.java | 0473f33d4408cd80aadc2439355c89c43704c95b | [] | no_license | EnKarin/Chat | 4345799bd830989e6417b452015f18a43d843476 | a88f673c76406bdc59905c7106461389b12d51f8 | refs/heads/master | 2023-08-25T02:04:49.714181 | 2021-07-14T08:04:15 | 2021-07-14T08:04:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 565 | java | package ru.shift.chat.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import ru.shift.chat.model.Connection;
import java.util.List;
public interface ConnectionRepository extends CrudRepository<Connection, Integer>, JpaRepository<Connection, Integer> {
@Query(value = "select id from connection where user_id = ?1 and chat_id = ?2", nativeQuery = true)
List<Integer> findByUserIdAndChatId(int userId, int chatId);
}
| [
"aleksey.k2000@mail.ru"
] | aleksey.k2000@mail.ru |
e55a57ce6a467f28f51a08c4fb502d1218cc1acd | 2ed4f0c594480784f972374ded6ec8bb217a0981 | /app/src/main/java/khoapham/ptp/phamtanphat/listviewnangcao/MonanAdapter.java | 73717282f7b3559218c71bd1c3174bcc080f149b | [] | no_license | phamtanphat/ListViewNangCao2802 | 34775de91a875046ee2bc5cd1cb7e31e4c744353 | 57bdba1155d61e122d85c95f118b7e60a395908a | refs/heads/master | 2020-05-04T09:27:49.045167 | 2019-04-06T10:44:18 | 2019-04-06T10:44:18 | 179,068,556 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,345 | java | package khoapham.ptp.phamtanphat.listviewnangcao;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.List;
public class MonanAdapter extends ArrayAdapter<Monan> {
public MonanAdapter( @NonNull Context context, int resource,@NonNull List<Monan> objects) {
super(context, resource, objects);
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
LayoutInflater layoutInflater = LayoutInflater.from(getContext());
convertView = layoutInflater.inflate(R.layout.dong_monan_item,null);
TextView txtTenmonan = convertView.findViewById(R.id.textviewTenmonan);
TextView txtGiamonan = convertView.findViewById(R.id.textviewGiamonan);
ImageView imgMonan = convertView.findViewById(R.id.imageviewMonan);
Monan monan = getItem(position);
txtTenmonan.setText(monan.getTen());
txtGiamonan.setText(monan.getGiatien() + " Đồng ");
imgMonan.setImageResource(monan.getHinhanh());
return convertView;
}
}
| [
"phatdroid94@gmail.com"
] | phatdroid94@gmail.com |
ad42e0120885cf18ca7bf36488a6cb1532a59d52 | 833af4b04505f03553eedd0796898fe3825f2852 | /NhryService/src/main/java/com/nhry/common/exception/MessageCode.java | 4848378ea1e1601326b77136c2fdc05509da8424 | [] | no_license | gongnol/nhry-platform | a9613a34d91db950cd958ae7d3ba923ecf22dc71 | 204bdbc94bc187e0aecd87dcd5fba0e5e04130c3 | refs/heads/master | 2021-01-21T16:15:29.538474 | 2017-08-05T07:19:47 | 2017-08-05T07:19:47 | 95,402,706 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 392 | java | package com.nhry.common.exception;
public class MessageCode {
public final static String REQUEST_NOT_FOUND="404";
public final static String SERVER_ERROR="serverError";
public final static String LOGIC_ERROR="logicError";
public final static String UNAUTHORIZED="unauthorized";
public final static String SESSION_EXPIRE="session_expire";
public final static String NORMAL="success";
}
| [
"979164557@qq.com"
] | 979164557@qq.com |
3a8a4a6b8e52c392471c2e981d090ea66b06ec0c | 753a8bb7c4e58f6f0f53f311cf42975f2aca5c05 | /code/2.3-execution/org.gemoc.sample.legacyfsm.xsfsm/src-gen/org/gemoc/sample/legacyfsm/xsfsm/xsfsm/adapters/fsmmt/fsm/LessThanNumberGuardAdapter.java | 4eb3cb1885988bf44584a05a9780c065f9df2796 | [] | no_license | Faezeh-Kh/ICSA2017Tutorial | 5823fc8d9028854a43958227401f94f5421afdda | 59138207643734bb20c6d44ee4e866529502f81a | refs/heads/master | 2021-06-17T11:57:05.942104 | 2017-06-08T12:25:50 | 2017-06-08T12:25:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,539 | java | package org.gemoc.sample.legacyfsm.xsfsm.xsfsm.adapters.fsmmt.fsm;
import fr.inria.diverse.melange.adapters.EObjectAdapter;
import org.eclipse.emf.ecore.EClass;
import org.gemoc.sample.legacyfsm.fsm.NumberVariable;
import org.gemoc.sample.legacyfsm.xsfsm.xsfsm.adapters.fsmmt.FSMMTAdaptersFactory;
import org.gemoc.sample.legacyfsm.xsfsm.xsfsm.fsm.LessThanNumberGuard;
@SuppressWarnings("all")
public class LessThanNumberGuardAdapter extends EObjectAdapter<LessThanNumberGuard> implements org.gemoc.sample.legacyfsm.fsm.LessThanNumberGuard {
private FSMMTAdaptersFactory adaptersFactory;
public LessThanNumberGuardAdapter() {
super(org.gemoc.sample.legacyfsm.xsfsm.xsfsm.adapters.fsmmt.FSMMTAdaptersFactory.getInstance());
adaptersFactory = org.gemoc.sample.legacyfsm.xsfsm.xsfsm.adapters.fsmmt.FSMMTAdaptersFactory.getInstance();
}
@Override
public boolean isNot() {
return adaptee.isNot();
}
@Override
public void setNot(final boolean o) {
adaptee.setNot(o);
}
@Override
public int getValue() {
return adaptee.getValue();
}
@Override
public void setValue(final int o) {
adaptee.setValue(o);
}
@Override
public NumberVariable getSource() {
return (NumberVariable) adaptersFactory.createAdapter(adaptee.getSource(), eResource);
}
@Override
public void setSource(final NumberVariable o) {
if (o != null)
adaptee.setSource(((org.gemoc.sample.legacyfsm.xsfsm.xsfsm.adapters.fsmmt.fsm.NumberVariableAdapter) o).getAdaptee());
else adaptee.setSource(null);
}
protected final static boolean NOT_EDEFAULT = false;
protected final static int VALUE_EDEFAULT = -1;
@Override
public EClass eClass() {
return org.gemoc.sample.legacyfsm.fsm.FsmPackage.eINSTANCE.getLessThanNumberGuard();
}
@Override
public Object eGet(final int featureID, final boolean resolve, final boolean coreType) {
switch (featureID) {
case org.gemoc.sample.legacyfsm.fsm.FsmPackage.LESS_THAN_NUMBER_GUARD__NOT:
return isNot() ? Boolean.TRUE : Boolean.FALSE;
case org.gemoc.sample.legacyfsm.fsm.FsmPackage.LESS_THAN_NUMBER_GUARD__VALUE:
return new java.lang.Integer(getValue());
case org.gemoc.sample.legacyfsm.fsm.FsmPackage.LESS_THAN_NUMBER_GUARD__SOURCE:
return getSource();
}
return super.eGet(featureID, resolve, coreType);
}
@Override
public boolean eIsSet(final int featureID) {
switch (featureID) {
case org.gemoc.sample.legacyfsm.fsm.FsmPackage.LESS_THAN_NUMBER_GUARD__NOT:
return isNot() != NOT_EDEFAULT;
case org.gemoc.sample.legacyfsm.fsm.FsmPackage.LESS_THAN_NUMBER_GUARD__VALUE:
return getValue() != VALUE_EDEFAULT;
case org.gemoc.sample.legacyfsm.fsm.FsmPackage.LESS_THAN_NUMBER_GUARD__SOURCE:
return getSource() != null;
}
return super.eIsSet(featureID);
}
@Override
public void eSet(final int featureID, final Object newValue) {
switch (featureID) {
case org.gemoc.sample.legacyfsm.fsm.FsmPackage.LESS_THAN_NUMBER_GUARD__NOT:
setNot(((java.lang.Boolean) newValue).booleanValue());
return;
case org.gemoc.sample.legacyfsm.fsm.FsmPackage.LESS_THAN_NUMBER_GUARD__VALUE:
setValue(((java.lang.Integer) newValue).intValue());
return;
case org.gemoc.sample.legacyfsm.fsm.FsmPackage.LESS_THAN_NUMBER_GUARD__SOURCE:
setSource(
(org.gemoc.sample.legacyfsm.fsm.NumberVariable)
newValue);
return;
}
super.eSet(featureID, newValue);
}
}
| [
"wortmann@se-rwth.de"
] | wortmann@se-rwth.de |
8d00dabfc985165b7646b87ea326671f2f755e3e | d4e6909d5b3408ed2032a1b6960cb7ace7a91bf1 | /oratech-web/src/test/java/testeCalculo.java | 67c1ce354ecaaf58bd3e36546a4816d2a2fc4329 | [] | no_license | lucaovk/oractech | 4ed3e8e568426f3b662bf798153aec7ab25ee3ad | 846045a7cb9827bd9b74db65bb4f14f7d2e59a0e | refs/heads/master | 2020-12-24T13:16:07.083404 | 2016-03-20T17:12:19 | 2016-03-20T17:12:19 | 39,710,347 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 370 | java | import br.com.oratech.controller.LoginController;
import junit.framework.TestCase;
public class testeCalculo extends TestCase {
public void testeCalculoSomar(){
float fator1 = 1.5f;
float fator2 = 2.5f;
float esperado = 4.1f;//fator1 + fator2;
float teste = LoginController.calculo(fator1, fator2);
assertEquals(esperado, teste, 0);
}
}
| [
"lucas.guimaraes.figueiredo"
] | lucas.guimaraes.figueiredo |
c3852e8f56d2d44b2b5f5e91a70ce52137827629 | 994f10840066c1da42a25958fdf1b0f1dd9e76f6 | /src/test/java/com/pluralsight/fundamentals/TzaControllerUnitTest.java | 03c573e7ec848cddeead58b5affa2633f6682eec | [] | no_license | biancagogiltan/pluralsight-springboot-fundamentals | c3d631db90294265cc50b632301c21e90ff984a8 | 50d7eeab82252fdfffdb14713d96ff1318718b94 | refs/heads/master | 2020-07-13T15:51:27.179179 | 2019-10-17T13:18:49 | 2019-10-17T13:18:49 | 205,109,534 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,069 | java | package com.pluralsight.fundamentals;
import com.pluralsight.fundamentals.springrest.service.ApplicationService;
import com.pluralsight.fundamentals.springrest.service.TicketService;
import com.pluralsight.fundamentals.springrest.web.TzaController;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import java.util.ArrayList;
import static org.mockito.Mockito.verify;
import static org.mockito.internal.verification.VerificationModeFactory.times;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@RunWith(SpringRunner.class)
@WebMvcTest(TzaController.class)
public class TzaControllerUnitTest {
@Autowired
private MockMvc mockMvc;
@MockBean
ApplicationService applicationService;
@MockBean
TicketService ticketService;
@Test
public void getAllApplications() throws Exception {
mockMvc.perform(get("/tza/tickets"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(content().json("[]"));
verify(applicationService, times(1)).listApplications();
}
ArrayList arr = new ArrayList();
@Test
public void getAllTickets() throws Exception {
mockMvc.perform(get("/tza/tickets"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(content().json("[]"));
verify(ticketService, times(1)).listTickets();
}
}
| [
"bgogiltan@robgogiltan01m.atrema.deloitte.com"
] | bgogiltan@robgogiltan01m.atrema.deloitte.com |
6a135a2fc3907550362d2213f721f7f96f2561d3 | c95b3b66fa32ef2a8748e7abbb1d3a61a3b8ef2d | /src/main/java/com/tactfactory/tp2tdd/Moteur.java | f7a246701b10ee104e059c40005b51a1baa4e3c8 | [] | no_license | Yorik56/quality-tdd | 0b237dc7f9bce7507a84c25fc8b96e5eb3c0ea4d | 4eb1b46d5e94f793ea595709c1a7415b84ec8ff7 | refs/heads/main | 2023-03-08T13:24:29.927218 | 2021-02-23T12:33:50 | 2021-02-23T12:33:50 | 341,549,106 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 78 | java | package com.tactfactory.tp2tdd;
public class Moteur extends Compartiment{
}
| [
"yorikmoreau@gmail.com"
] | yorikmoreau@gmail.com |
ca02e1a7fd272d12281894ef95d93b44b9286b5f | f2a03468e886e59eea958e89a41d806466ed7c20 | /anasys/src/main/java/com/taobao/finance/util/CheckUtil.java | 25d87d795cd4ffaabb137b27aa529c5b334ac2dc | [] | no_license | songqingchu/anasys | 8d7d7c4e5355f49c52c7a1b19a0b49b06075bd30 | 04acae1b1ddae46bc6e45e194359f082c152be4f | refs/heads/master | 2021-01-01T18:55:02.613274 | 2015-01-21T09:20:30 | 2015-01-22T01:37:35 | 29,581,492 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 37,063 | java | package com.taobao.finance.util;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.taobao.finance.base.Hisdata_Base;
import com.taobao.finance.dataobject.Stock;
import com.taobao.finance.util.FetchUtil;
/**
* ������۹�ϵ��K����̬
*
* @author Administrator
*
*/
public class CheckUtil {
/**
* ����Ƿ�һ��ƽ̨
*
* @param l
* @return
*/
public static boolean checkIsPlatform(List<Stock> l) {
if (l == null) {
return false;
}
if (l.size() < 6) {
return false;
}
Long maxV = 0l;
boolean success = true;
Float high = 0.0F;
Float low = 1000.0F;
for (Stock s : l) {
Float p = Float.parseFloat(s.getEndPrice());
if (s.getTradeNum() > maxV) {
maxV = s.getTradeNum();
}
if (p > high) {
high = p;
}
if (p < low) {
low = p;
}
}
if (high / low > 1.1) {
return false;
}
return true;
}
/**
* ���������
*
* @param l
* @return
*/
public static List<Date> checkContinueLittleSun(List<Stock> l) {
List<Date> d = new ArrayList<Date>();
List<Date> d3 = check3ContinueLittleSun(l);
List<Date> d2 = check2ContinueLittleSun(l);
d.addAll(d3);
d.addAll(d2);
return d;
}
public static List<Date> checkContinueLittleSun2(List<Stock> l) {
List<Date> d = new ArrayList<Date>();
List<Date> d3 = check3ContinueLittleSun(l);
l.remove(0);
List<Date> d2 = check2ContinueLittleSun(l);
d.addAll(d3);
d.addAll(d2);
return d;
}
/**
* ���������
*
* @param l
* @return
*/
public static List<Date> check3ContinueLittleSun(List<Stock> l) {
List<Date> d = new ArrayList<Date>();
if (l.size() < 8) {
return d;
}
for (int i = 1; i < l.size() - 6; i++) {
Stock yesterday = l.get(l.size() - i - 3);
Stock today = l.get(l.size() - i - 2);
Stock tomorrow = l.get(l.size() - i - 1);
Stock tomorrow2 = l.get(l.size() - i);
Float t0Begin = Float.parseFloat(yesterday.getStartPrice());
Float t0End = Float.parseFloat(yesterday.getEndPrice());
Float t1Begin = Float.parseFloat(today.getStartPrice());
Float t1End = Float.parseFloat(today.getEndPrice());
Float t2Begin = Float.parseFloat(tomorrow.getStartPrice());
Float t2End = Float.parseFloat(tomorrow.getEndPrice());
Float t3Begin = Float.parseFloat(tomorrow2.getStartPrice());
Float t3End = Float.parseFloat(tomorrow2.getEndPrice());
Long total = 0L;
for (int j = l.size() - i - 3; j > l.size() - i - 8; j--) {
total = total + l.get(j).getTradeNum();
}
Long v1 = today.getTradeNum();
Long v2 = tomorrow.getTradeNum();
Long v3 = tomorrow2.getTradeNum();
/**
* ������
*/
if ((v1 + v2 + v3) / 3 >= total * 1.5 / 5) {
if (t3End > t3Begin && t2End > t2Begin && t1End > t1Begin) {
if (t3End > t2End && t2End > t1End) {
if (v1 < v2 && v1 < v3) {
if (t3End / t1End > 1.04 && t3End / t1End < 1.09) {
d.add(l.get(l.size() - i - 2).getDate());
}
}
}
}
}
}
return d;
}
/**
* ���������
*
* @param l
* @return
*/
public static List<Date> check2ContinueLittleSun(List<Stock> l) {
List<Date> d = new ArrayList<Date>();
if (l.size() < 7) {
return d;
}
for (int i = 1; i < l.size() - 6; i++) {
Stock yesterday = l.get(l.size() - i - 2);
Stock today = l.get(l.size() - i - 1);
Stock tomorrow = l.get(l.size() - i);
Float t0Begin = Float.parseFloat(yesterday.getStartPrice());
Float t0End = Float.parseFloat(yesterday.getEndPrice());
Float t1Begin = Float.parseFloat(today.getStartPrice());
Float t1End = Float.parseFloat(today.getEndPrice());
Float t2Begin = Float.parseFloat(tomorrow.getStartPrice());
Float t2End = Float.parseFloat(tomorrow.getEndPrice());
Long total = 0l;
for (int j = l.size() - i - 2; j > l.size() - i - 7; j--) {
total = total + l.get(j).getTradeNum();
}
Long v1 = today.getTradeNum();
Long v2 = tomorrow.getTradeNum();
/**
* ������
*/
if ((v1 + v2) / 2 >= total * 1.5 / 5) {
if (t2End > t2Begin && t1End > t1Begin) {
if (t2End > t1End) {
if (v1 < v2) {
if (t2End / t0End < 1.07) {
d.add(l.get(l.size() - i - 1).getDate());
}
}
}
}
}
}
return d;
}
/**
* ���CLY�
*
* @param l
* @return
*/
public static boolean checkCLY(List<Stock> l) {
if (l.size() < 8) {
return false;
}
if (l.get(0).getCode().equals("000519")) {
l.size();
}
Stock yesterday = l.get(l.size() - 4);
Stock today = l.get(l.size() - 3);
Stock tomorrow = l.get(l.size() - 2);
Stock tomorrow2 = l.get(l.size() - 1);
Float t0Begin = Float.parseFloat(yesterday.getStartPrice());
Float t0End = Float.parseFloat(yesterday.getEndPrice());
Float t1Begin = Float.parseFloat(today.getStartPrice());
Float t1End = Float.parseFloat(today.getEndPrice());
Float t2Begin = Float.parseFloat(tomorrow.getStartPrice());
Float t2End = Float.parseFloat(tomorrow.getEndPrice());
Float t3Begin = Float.parseFloat(tomorrow2.getStartPrice());
Float t3End = Float.parseFloat(tomorrow2.getEndPrice());
Long v1 = today.getTradeNum();
Long v2 = tomorrow.getTradeNum();
Long v3 = tomorrow2.getTradeNum();
/**
* ������
*/
if (t3End > t3Begin && t2End > t2Begin && t1End > t1Begin) {
if (t3End > t2End && t2End > t1End) {
if (v1 < v2 && v1 < v3) {
if (t3End / t1Begin > 1.03 && t3End / t1Begin < 1.09) {
/**
* ����ģ�Ͳ������ɽ���
*/
/*
* Integer total=0; for(int i=4;i<10;i++){
* total=total+l.get(l.size()-i).getTradeNum(); }
*/
// if((v1+v2+v3)/3>total*1.4/5){
Float rrr1 = t1End / t0End;
Float rrr2 = t2End / t1End;
Float rrr3 = t3End / t2End;
/**
* �����Ƿ���-2.5~2.5 �����Ƿ���0~3 �����Ƿ���0~5
*/
if (rrr1 < 1.025 && rrr1 > 0.975) {
if (rrr2 < 1.03 && rrr2 > 1.00) {
if (rrr3 < 1.05 && rrr3 > 1.00) {
return true;
}
}
// }
}
}
}
}
}
/**
* ������
*/
if (t3End > t3Begin && t2End > t2Begin) {
if (t3End > t2End) {
if (v1 < v2 && v2 < v3) {
if (t3End / t1End > 1.03 && t3End / t1End < 1.09) {
Long total = 0l;
for (int i = 3; i < 9; i++) {
total = total + l.get(l.size() - i).getTradeNum();
}
if (today.getCode().equals("000756")) {
today.get_10changes();
}
Float rrr1 = t1End / t0End;
Float rrr2 = t2End / t1End;
/**
* �����Ƿ���-2.5~2.5 �����Ƿ���1~5
*/
if (rrr1 < 1.03 && rrr1 > 0.975) {
if (rrr2 < 1.05 && rrr2 > 1.01) {
return true;
}
}
}
}
}
}
return false;
}
public static boolean checkCB(List<Stock> l) {
if (l.size() < 80) {
return false;
}
int size = l.size();
boolean has = false;
for (int i = 1; i < size - 3; i++) {
int ctn = 0;
Stock today = l.get(size - i - 1);
if (today.getCode().equals("002190")) {
today.get_10changes();
}
Stock tomorrow = l.get(size - i);
Float t1End = Float.parseFloat(today.getEndPrice());
Float t2End = Float.parseFloat(tomorrow.getEndPrice());
if (t2End / t1End > 1.097) {
for (int j = i; j < size; j++) {
today = l.get(size - j - 1);
tomorrow = l.get(size - j);
t1End = Float.parseFloat(today.getEndPrice());
t2End = Float.parseFloat(tomorrow.getEndPrice());
if (t2End / t1End > 1.097) {
ctn++;
} else {
break;
}
}
}
if (ctn < 4) {
ctn = 0;
} else {
if (i < 90) {
return true;
} else {
ctn = 0;
}
}
}
return false;
}
/**
* ��鱶��ģ��
*
* @param today
* @param tomorow
* @return
*/
public static boolean checkBV(Stock today, Stock tomorow) {
Float t1End = Float.parseFloat(today.getEndPrice());
Float t2End = Float.parseFloat(tomorow.getEndPrice());
Long v1 = today.getTradeNum();
Long v2 = tomorow.getTradeNum();
Float r = t2End / t1End;
/**
* �Ƿ�����2.5������������ѡ��������
*/
if (r < 1.03) {
return false;
}
/**
* 1.6������
*/
Float vrate = r * v2.floatValue() / v1.floatValue();
tomorow.setVrate(vrate);
if (v1 * 2 < v2) {
return true;
}
return false;
}
public static boolean checkChannel(List<Stock> his) {
if (his.size() < 60) {
return false;
}
Map<Integer, Float> map = new HashMap<Integer, Float>();
List<A> l = new ArrayList<A>();
for (int i = 5; i < his.size(); i++) {
Float end = Float.parseFloat(his.get(i).getEndPrice());
l.add(new A(end, i));
map.put(i, end);
}
Collections.sort(l);
Float max = l.get(0).price;
int maxIndex = l.get(0).index;
Float sMax = 0F;
int sMaxIndex = 0;
for (int i = 1; i < l.size(); i++) {
A a = l.get(i);
if (maxIndex - a.index > 6) {
sMax = a.price;
sMaxIndex = a.index;
break;
}
}
Float nowPrice = (max - sMax) * (his.size() - maxIndex)
/ (maxIndex - sMaxIndex) + max;
Float today = Float.parseFloat(his.get(his.size() - 1).getEndPrice());
Float n = today / nowPrice;
if (n > 0.99F & n < 1.07F) {
return true;
}
return false;
}
static class A implements Comparable {
Float price;
int index;
public A(Float price, int index) {
this.price = price;
this.index = index;
}
public int compareTo(Object o) {
A a = (A) o;
if (this.price - a.price > 0)
return -1;
else
return 1;
}
}
public static boolean checkPT(List<Stock> l) {
if (l.size() < 10) {
return false;
}
if (l.get(0).getCode().equals("600298")) {
l.size();
}
int size = l.size();
for (int i = size - 1; i > size - 3; i--) {
if (checkPlatform(l, i - 1)) {
if (checkValidPT(l, i - 1)) {
return true;
}
}
}
return false;
}
public static boolean checkP_Buy(List<Stock> l) {
if (l.size() < 10) {
return false;
}
if (l.get(0).getCode().equals("300051")) {
l.size();
}
Stock s1 = l.get(l.size() - 1);
Stock s0 = l.get(l.size() - 2);
Float b1 = Float.parseFloat(s1.getStartPrice());
Float e1 = Float.parseFloat(s1.getEndPrice());
Float h1 = Float.parseFloat(s1.getHighPrice());
Float e0 = Float.parseFloat(s0.getEndPrice());
if (e1 / e0 < 1.03) {
return false;
}
if ((h1 - e1) / e0 < 0.03) {
return false;
}
if (checkPlatform(l, l.size() - 2)) {
return true;
}
return false;
}
public static boolean checkP(List<Stock> l) {
if (l.size() < 10) {
return false;
}
int size = l.size();
if (l.get(0).getCode().equals("300026")) {
l.size();
}
if (checkPlatform2(l, size - 1)) {
return true;
}
return false;
}
/**
* �����߲���
*
* @param l
* @return
*/
public static boolean checkAve(List<Stock> l) {
if (l.size() < 20) {
return false;
}
Float today5 = getAve(l, 5);
Float today10 = getAve(l, 10);
Float today20 = getAve(l, 20);
Float y2 = Float.parseFloat(l.get(l.size() - 5).getEndPrice());
Float yesterday = Float.parseFloat(l.get(l.size() - 2).getEndPrice());
Float today = Float.parseFloat(l.get(l.size() - 1).getEndPrice());
if (l.get(0).getCode().equals("002673")) {
today.getClass();
}
if (today / yesterday < 1F) {
return false;
}
if (yesterday / y2 < 0.99F) {
return false;
}
Float tt = today5 - today10;
if (today10 > today20) {
if (tt < 0.005 && tt > -0.01) {
return true;
}
}
return false;
}
public static boolean checkAV20(List<Stock> l, Float rate, int time,
int av10t, int av20t) {
if (l.size() < 50) {
return false;
}
Float end1 = Float.parseFloat(l.get(l.size() - 1).getEndPrice());
Float end20 = Float.parseFloat(l.get(l.size() - time).getEndPrice());
if (end1 / end20 > rate) {
return false;
}
List<Float> av5 = new ArrayList<Float>();
List<Float> av10 = new ArrayList<Float>();
List<Float> av20 = new ArrayList<Float>();
for (int i = 1; i < time + 1; i++) {
Float today5 = getAve(l, 5, l.size() - i);
Float today10 = getAve(l, 10, l.size() - i);
Float today20 = getAve(l, 20, l.size() - i);
av5.add(today5);
av10.add(today10);
av20.add(today20);
}
if (end1 > av5.get(0) * 1.01F) {
return false;
}
int count20 = 0;
int count10 = 0;
for (int i = 0; i < time - 1; i++) {
if (av20.get(i) >= av20.get(i + 1)) {
count20++;
}
if (av10.get(i) >= av10.get(i + 1)) {
count10++;
}
}
if (count20 < av20t) {
return false;
}
if (count10 < av10t) {
return false;
}
Float avv5 = av5.get(0);
Float avv10 = av10.get(0);
Float end = Float.parseFloat(l.get(l.size() - 1).getEndPrice());
if (avv5 / avv10 < 0.005 * end && avv5 / avv10 > 0.995 * end) {
return true;
}
return true;
}
public static boolean checkAV20XRate(List<Stock> l) {
if (l.size() < 60) {
return false;
}
List<Float> av20 = new ArrayList<Float>();
for (int i = 1; i < 26; i++) {
Float today20 = getAve(l, 20, l.size() - i);
av20.add(today20);
}
Float r = (av20.get(0) - av20.get(20)) / 20;
int count20 = 0;
int angerCount20 = 0;
for (int i = 0; i < 20; i++) {
if (av20.get(i) + 0.01 >= av20.get(i + 1)) {
count20++;
}
}
if (count20 < 16) {
return false;
}
for (int i = 0; i < 20; i++) {
Float r2 = (av20.get(i) - av20.get(i + 5)) / 5;
Float p = r2 / r;
if (p > 1.35F || p < 0.65F) {
angerCount20++;
}
}
if (angerCount20 > 4) {
return false;
}
Float av10 = getAve(l, 10, l.size() - 1);
Float today = Float.parseFloat(l.get(l.size() - 1).getLowPrice());
// Float yesterday = Float.parseFloat(l.get(l.size() -
// 2).getLowPrice());
if (today < av10) {
return true;
}
return false;
}
public static boolean checkPF(List<Stock> l) {
if (l.size() < 60) {
return false;
}
List<Float> av20 = new ArrayList<Float>();
for (int i = 1; i < 26; i++) {
Float today20 = getAve(l, 20, l.size() - i);
av20.add(today20);
}
Float r = (av20.get(0) - av20.get(20)) / 20;
int count20 = 0;
int angerCount20 = 0;
for (int i = 0; i < 20; i++) {
if (av20.get(i) + 0.01 >= av20.get(i + 1)) {
count20++;
}
}
if (count20 < 16) {
return false;
}
return checkPlatform(l, l.size() - 2);
}
public static boolean checkAV60XRate(List<Stock> l) {
if (l.size() < 100) {
return false;
}
List<Float> av60 = new ArrayList<Float>();
List<Float> av20 = new ArrayList<Float>();
List<Float> av10 = new ArrayList<Float>();
List<Float> av5 = new ArrayList<Float>();
for (int i = 1; i < 32; i++) {
Float today60 = getAve(l, 60, l.size() - i);
av60.add(today60);
Float today20 = getAve(l, 20, l.size() - i);
av20.add(today20);
if (i < 5) {
Float today10 = getAve(l, 10, l.size() - i);
av10.add(today10);
Float today5 = getAve(l, 5, l.size() - i);
av5.add(today5);
}
}
Float r = (av60.get(0) - av60.get(20)) / 20;
int count60 = 0;
int count20 = 0;
int angerCount20 = 0;
for (int i = 0; i < 30; i++) {
if (av60.get(i) + 0.01 >= av60.get(i + 1)) {
count60++;
}
if (av20.get(i) + 0.01 >= av20.get(i + 1)) {
count20++;
}
}
if (count60 < 29) {
return false;
}
if (count20 < 25) {
return false;
}
if (av60.get(0) / av60.get(29) < 1.15F) {
return false;
}
for (int i = 0; i < 20; i++) {
Float r2 = (av60.get(i) - av60.get(i + 5)) / 5;
Float p = r2 / r;
if (p > 1.35F || p < 0.65F) {
angerCount20++;
}
}
/*
* if (angerCount20>8) { return false; }
*/
Float today = Float.parseFloat(l.get(l.size() - 1).getEndPrice());
Float yesterdayLow = Float
.parseFloat(l.get(l.size() - 2).getLowPrice());
Float bigYesterdayLow = Float.parseFloat(l.get(l.size() - 3)
.getLowPrice());
Float superBigYesterdayLow = Float.parseFloat(l.get(l.size() - 4)
.getLowPrice());
if (yesterdayLow < av5.get(1) && yesterdayLow < av10.get(1)
&& yesterdayLow < av20.get(1)) {
if (today > av5.get(0) && today > av10.get(0)
&& today > av20.get(0)) {
return true;
}
}
if (bigYesterdayLow < av5.get(2) && bigYesterdayLow < av10.get(2)
&& bigYesterdayLow < av20.get(2)) {
if (today > av5.get(0) && today > av10.get(0)
&& today > av20.get(0)) {
return true;
}
}
if (superBigYesterdayLow < av5.get(3)
&& superBigYesterdayLow < av10.get(3)
&& superBigYesterdayLow < av20.get(3)) {
if (today > av5.get(0) && today > av10.get(0)
&& today > av20.get(0)) {
return true;
}
}
return false;
}
/**
* 超级趋势
* @param l
* @return
*/
public static boolean checkBigTrend(List<Stock> l) {
if (l.size() < 100) {
return false;
}
List<Float> av60 = new ArrayList<Float>();
List<Float> av20 = new ArrayList<Float>();
List<Float> av10 = new ArrayList<Float>();
List<Float> av5 = new ArrayList<Float>();
for (int i = 1; i < 32; i++) {
Float today60 = getAve(l, 60, l.size() - i);
Float today20 = getAve(l, 20, l.size() - i);
Float today10 = getAve(l, 10, l.size() - i);
Float today5 = getAve(l, 5, l.size() - i);
av60.add(today60);
av20.add(today20);
av10.add(today10);
av5.add(today5);
}
Float r = (av10.get(0) - av10.get(30)) / 30;
int count60 = 0;
int count20 = 0;
int count10=0;
int cross=0;
for (int i = 0; i < 30; i++) {
if (av60.get(i)> av60.get(i + 1)) {
count60++;
}
if (av20.get(i)> av20.get(i + 1)) {
count20++;
}
if (av10.get(i)> av10.get(i + 1)) {
count10++;
}
if(l.get(l.size()-i-1).getEndPriceFloat()<av10.get(i)){
cross++;
}
}
if (cross >5) {
return false;
}
if (count60 < 21) {
return false;
}
if (count20 < 25) {
return false;
}
if (count10 < 27) {
return false;
}
if (av10.get(0) / av10.get(10) < 1.1F) {
return false;
}
int angerCount10=0;
for (int i = 0; i < 15; i++) {
Float r2 = (av10.get(i) - av10.get(i + 5)) / 5;
Float p = r2 / r;
if (p < 0.15F) {
angerCount10++;
}
}
if (angerCount10>1) {
return false;
}
return true;
}
/**
* ten day ave check
* @param l
* @return
*/
public static boolean checkAV10XRate(List<Stock> l) {
if (l.size() < 80) {
return false;
}
List<Float> av10 = new ArrayList<Float>();
for (int i = 1; i < 37; i++) {
Float today10 = getAve(l, 10, l.size() - i);
av10.add(today10);
}
Float r = (av10.get(0) - av10.get(20)) / 20;
int continueCount10 = 0;
int angerCount10 = 0;
for (int i = 0; i < 20; i++) {
if (av10.get(i) + 0.01 >= av10.get(i + 1)) {
continueCount10++;
}
}
//10日线朝上天数
if (continueCount10 < 16) {
return false;
}
//10线不要陡增陡降
for (int i = 0; i < 20; i++) {
Float r2 = (av10.get(i) - av10.get(i + 5)) / 5;
Float p = r2 / r;
if (p > 1.4F || p < 0.6F) {
angerCount10++;
}
}
if (angerCount10 > 4) {
return false;
}
/*Float todayAv10 = getAve(l, 10, l.size() - 1);
Float today = Float.parseFloat(l.get(l.size() - 1).getLowPrice());
// Float yesterday = Float.parseFloat(l.get(l.size() -
// 2).getLowPrice());
if (today < todayAv10) {
return true;
}*/
return true;
}
public static boolean checkTP(List<Stock> l) {
if (l.size() < 70) {
return false;
}
String s = l.get(l.size() - 1).toString();
int maxIndex = -1;
Float max = 0F;
Float min = 200F;
for (int i = 5; i < 70; i++) {
Float t = Float.parseFloat(l.get(l.size() - i - 1).getEndPrice());
if (t > max) {
max = t;
maxIndex = l.size() - i - 1;
}
if (t > max * 0.98F && t < max) {
if (maxIndex - (l.size() - i - 1) > 5) {
max = t;
maxIndex = l.size() - i - 1;
}
}
}
for (int i = 5; i < 70; i++) {
Float t = Float.parseFloat(l.get(l.size() - i - 1).getEndPrice());
if (t < min && (l.size() - i - 1) > maxIndex) {
min = t;
}
}
if (l.size() - maxIndex < 20) {
return false;
}
if (max / min < 1.04F) {
return false;
}
for (int i = 0; i < 1; i++) {
Float t = Float.parseFloat(l.get(l.size() - i - 1).getEndPrice());
if (t / max < 1.09F && t / max > 0.98F) {
return true;
}
}
return false;
}
public static boolean checkAV20Trend(List<Stock> l, Float rate, int day,int av5t, int av10t, int av20t) {
if (l.size() < 50) {
return false;
}
Float end1 = Float.parseFloat(l.get(l.size() - 1).getEndPrice());
Float end20 = Float.parseFloat(l.get(l.size() - 20).getEndPrice());
if (end1 / end20 > rate) {
return false;
}
List<Float> av5 = new ArrayList<Float>();
List<Float> av10 = new ArrayList<Float>();
List<Float> av20 = new ArrayList<Float>();
Float max = 0F;
Float min = 10000F;
int maxIndex = 0;
int minIndex = 0;
for (int i = 1; i < day + 1; i++) {
Float today5 = getAve(l, 5, l.size() - i);
Float today10 = getAve(l, 10, l.size() - i);
Float today20 = getAve(l, 20, l.size() - i);
Float p = Float.parseFloat(l.get(l.size() - i).getEndPrice());
Float p2 = Float.parseFloat(l.get(l.size() - i - 1).getEndPrice());
if (p / p2 < 0.96F) {
return false;
}
if (p / p2 > 1.06F) {
return false;
}
if (p > max) {
max = p;
maxIndex = i;
}
if (p < min) {
min = p;
minIndex = i;
}
av5.add(today5);
av10.add(today10);
av20.add(today20);
}
if (end1 / min < 1.05F) {
return false;
}
if (maxIndex == 2 || maxIndex == 3) {
if (end1 / max < 0.98F) {
return false;
}
}
if (maxIndex > 3) {
if (end1 / max < 1F) {
return false;
}
}
if (max / min > rate) {
return false;
}
int count20 = 0;
int count10 = 0;
int continueCount5 = 0;
int j = -1;
for (int i = 0; i < day - 1; i++) {
if (av20.get(i) >= av20.get(i + 1)) {
count20++;
}
if (av10.get(i) >= av10.get(i + 1)) {
count10++;
}
Float p = Float.parseFloat(l.get(l.size() - i - 1).getEndPrice());
if (p - av5.get(i) >= 0.005 * (0 - p)) {
continueCount5++;
}
}
if (count20 < av20t) {
return false;
}
if (count10 < av10t) {
return false;
}
if (continueCount5 <= av5t) {
return false;
}
return true;
}
public static boolean checkWave(List<Stock> l, Float rate, int av10t,
int av20t) {
if (l.size() < 50) {
return false;
}
Float end1 = Float.parseFloat(l.get(l.size() - 1).getEndPrice());
Float end20 = Float.parseFloat(l.get(l.size() - 20).getEndPrice());
if (end1 / end20 > rate) {
return false;
}
List<Float> av5 = new ArrayList<Float>();
List<Float> av10 = new ArrayList<Float>();
List<Float> av20 = new ArrayList<Float>();
for (int i = 1; i < 21; i++) {
Float today5 = getAve(l, 5, l.size() - i);
Float today10 = getAve(l, 10, l.size() - i);
Float today20 = getAve(l, 20, l.size() - i);
av5.add(today5);
av10.add(today10);
av20.add(today20);
}
int count20 = 0;
int count10 = 0;
int continueCount5 = 0;
int j = -1;
boolean match = false;
for (int i = 0; i < 19; i++) {
if (av20.get(i) >= av20.get(i + 1)) {
count20++;
}
if (av10.get(i) >= av10.get(i + 1)) {
count10++;
}
if (av5.get(i) < av5.get(i + 1)) {
if (j == i - 1 || j == -1) {
continueCount5++;
} else {
continueCount5 = 1;
}
j = i;
if (continueCount5 >= 4 && j <= 4) {
match = true;
}
}
}
if (count20 < av20t) {
return false;
}
if (count10 < av10t) {
return false;
}
if (match && continueCount5 < 6) {
return true;
} else {
return false;
}
}
/**
*
* @param l
* @return
*/
public static boolean checkAVCU(List<Stock> l) {
if (l.size() < 26) {
return false;
}
Float p10 = Float.parseFloat(l.get(l.size() - 15).getEndPrice());
Float e = Float.parseFloat(l.get(l.size() - 1).getEndPrice());
Float e2 = Float.parseFloat(l.get(l.size() - 2).getEndPrice());
Float e4 = Float.parseFloat(l.get(l.size() - 4).getEndPrice());
if (e / p10 > 1.15F) {
return false;
}
if (e2 > e) {
return false;
}
if (e4 > e) {
return false;
}
List<Float> av5 = new ArrayList<Float>();
List<Float> av10 = new ArrayList<Float>();
Float begin = 0F;
Float end = 0F;
int count = 0;
int count2 = 0;
for (int i = 5; i > 1; i--) {
Float today = Float.parseFloat(l.get(l.size() - i).getEndPrice());
Float tomorrow = Float.parseFloat(l.get(l.size() - i + 1)
.getEndPrice());
if (i == 4) {
begin = today;
}
if (i == 1) {
end = tomorrow;
}
Float r = tomorrow / today;
if (r > 1.05F) {
return false;
}
if (r > 1F) {
count2++;
}
if (r < 1F && r >= 0.98F) {
count++;
}
if (r < 0.98F) {
return false;
}
}
if (count > 1) {
return false;
}
if (count2 < 3) {
return false;
}
if (end / begin > 1.07F) {
return false;
}
boolean match = true;
for (int i = 0; i < 15; i++) {
Float today5 = getAve(l, 5);
Float today10 = getAve(l, 10);
av5.add(today5);
av10.add(today10);
l.remove(l.size() - 1);
}
Collections.reverse(av5);
Collections.reverse(av10);
int count5d = 0;
int last = -1;
for (int i = 6; i < 14; i++) {
if (av5.get(i) > av5.get(i + 1)) {
if (last == -1 || last == i - 1) {
count5d++;
last = i;
} else {
count5d = 1;
last = i;
}
}
}
if (count5d > 3) {
return false;
}
int count5 = 0;
int count10 = 0;
int count5BigCount10 = 0;
for (int i = 7; i < 14; i++) {
Float today5 = av5.get(i);
Float tomorrow5 = av5.get(i + 1);
Float today10 = av10.get(i);
Float tomorrow10 = av10.get(i + 1);
if (today5 > tomorrow5) {
count5++;
}
if (today10 > tomorrow10) {
count10++;
}
if (today10 > tomorrow5) {
count5BigCount10++;
}
if (!match) {
return false;
}
}
if (count5 + count10 >= 4) {
return false;
}
if (count5BigCount10 >= 4) {
return false;
}
return match;
}
public static Float getAve(List<Stock> l, int day) {
Float ave = 0F;
Float total = 0F;
for (int i = l.size() - 1; i > l.size() - day - 1; i--) {
total = total + Float.parseFloat(l.get(i).getEndPrice());
}
ave = total / day;
return ave;
}
public static Float getAve(List<Stock> l, int day, int start) {
Float ave = 0F;
Float total = 0F;
for (int i = start; i >= start - day + 1; i--) {
Float s=Float.parseFloat(l.get(i).getEndPrice());
total = total + s;
}
ave = total / day;
return ave;
}
public static boolean checkValidPT(List<Stock> l, int index) {
Long maxV = 0l;
Float high = 0.0F;
Float low = 1000.0F;
Float total = 0F;
for (int i = index; i >= index - 5; i--) {
Stock s = l.get(i);
Float p = Float.parseFloat(s.getEndPrice());
if (s.getTradeNum() > maxV) {
maxV = s.getTradeNum();
}
if (p > high) {
high = p;
}
}
for (int i = l.size() - 1; i > index; i--) {
Stock s = l.get(i);
Float p = Float.parseFloat(s.getEndPrice());
total = total + p;
}
Float av = total / (l.size() - 1 - index);
if (av / high > 1.04) {
return true;
}
return false;
}
public static boolean checkValidPT2(List<Stock> l, int index) {
Float total = 0F;
Float total2 = 0F;
for (int i = l.size() - index; i >= l.size() - index - 3; i--) {
Stock s = l.get(i);
Float p = Float.parseFloat(s.getEndPrice());
total2 = total2 + p;
}
for (int i = l.size() - 1; i > l.size() - index; i--) {
Stock s = l.get(i);
Float p = Float.parseFloat(s.getEndPrice());
total = total + p;
}
Float av = total / (l.size() - 1 - index);
if (av / total2 * 4 > 1.04) {
return true;
}
return false;
}
public static boolean checkPlatform(List<Stock> l, int index) {
if (l.get(0).getCode().equals("002450")) {
l.size();
}
if (index < 5) {
return false;
}
Long maxV = 0l;
Float high = 0.0F;
Float low = 1000.0F;
int maxindex = -1;
int minindex = -1;
int cnt = 0;
int flag = 0;
boolean shun = false;
int idx = 0;
Float total1 = 0F;
for (int i = index; i >= index - 6; i--) {
idx = i;
Stock s = l.get(i);
Float p = Float.parseFloat(s.getEndPrice());
if (p > Float.parseFloat(l.get(i - 1).getEndPrice())) {
if (cnt == -1) {
flag = 0;
}
cnt = 1;
if (cnt == 1) {
flag++;
}
if (flag >= 3) {
shun = true;
}
} else {
if (cnt == 1) {
flag = 0;
}
cnt = -1;
if (cnt == -1) {
flag--;
}
if (flag <= -3) {
shun = true;
}
}
if (s.getTradeNum() > maxV) {
maxV = s.getTradeNum();
}
if (p > high) {
high = p;
maxindex = i;
}
if (p < low) {
low = p;
minindex = i;
}
}
if (high / low > 1.05) {
return false;
}
/*
* if (shun) { return false; }
*/
/*
* if (maxindex - minindex >= 3 || minindex - maxindex >= 3) { return
* false; }
*/
Float today = l.get(l.size() - 1).getEndPriceFloat();
if (today > ((high + low) / 2) * 1.03) {
return true;
}
return false;
}
public static boolean checkPlatform2(List<Stock> l, int index) {
if (l.get(0).getCode().equals("002533")) {
l.size();
}
if (index < 5) {
return false;
}
Long maxV = 0l;
Float high = 0.0F;
Float low = 1000.0F;
int maxindex = -1;
int minindex = -1;
int cnt = 0;
int flag = 0;
boolean shun = false;
int idx = 0;
Float total1 = 0F;
for (int i = index; i >= 0; i--) {
if (i < 1) {
return false;
}
idx = i;
Stock s = l.get(i);
Float p = Float.parseFloat(s.getEndPrice());
if (p > Float.parseFloat(l.get(i - 1).getEndPrice())) {
if (cnt == -1) {
flag = 0;
}
cnt = 1;
if (cnt == 1) {
flag++;
}
if (flag >= 3) {
shun = true;
}
} else {
if (cnt == 1) {
flag = 0;
}
cnt = -1;
if (cnt == -1) {
flag--;
}
if (flag <= -3) {
shun = true;
}
}
if (s.getTradeNum() > maxV) {
maxV = s.getTradeNum();
}
if (p > high) {
high = p;
maxindex = i;
}
if (p < low) {
low = p;
minindex = i;
}
if (high / low > 1.05) {
break;
} else {
total1 = total1 + p;
}
}
if (index - idx < 5) {
return false;
}
/*
* if(shun){ return false; }
*/
if (maxindex - minindex >= 3 || minindex - maxindex >= 3) {
return false;
}
Float total = 0F;
for (int i = idx - 1; i > idx - 5; i--) {
total = total + Float.parseFloat(l.get(i).getEndPrice());
}
Float av1 = total / 4;
Float av2 = total1 / (index - idx);
if (av1 / av2 < 0.95) {
return true;
}
return false;
}
public static boolean checkPlatformTanLan(List<Stock> l, int index,
int length) {
if (l.get(0).getCode().equals("002450")) {
l.size();
}
if (index < 5) {
return false;
}
Long maxV = 0l;
Float high = 0.0F;
Float low = 1000.0F;
int maxindex = -1;
int minindex = -1;
int cnt = 0;
int flag = 0;
boolean shun = false;
for (int i = index; i >= index - length; i--) {
Stock s = l.get(i);
Float p = Float.parseFloat(s.getEndPrice());
if (p > Float.parseFloat(l.get(i - 1).getEndPrice())) {
if (cnt == -1) {
flag = 0;
}
cnt = 1;
if (cnt == 1) {
flag++;
}
if (flag >= 3) {
shun = true;
}
} else {
if (cnt == 1) {
flag = 0;
}
cnt = -1;
if (cnt == -1) {
flag--;
}
if (flag <= -3) {
shun = true;
}
}
if (s.getTradeNum() > maxV) {
maxV = s.getTradeNum();
}
if (p > high) {
high = p;
maxindex = i;
}
if (p < low) {
low = p;
minindex = i;
}
}
if (high / low > 1.05) {
return false;
}
if (shun) {
return false;
}
if (maxindex - minindex >= 4 || minindex - maxindex >= 4) {
return false;
}
return true;
}
/**
* ���ƽ���
*
* @param l
* @return
*/
public static boolean checkGoldenV(List<Stock> l) {
List<Date> l2 = new ArrayList<Date>();
if (l == null) {
return false;
}
if (l.size() < 13) {
return false;
}
if (l.get(0).getCode().equals("000519")) {
l.size();
}
Stock yesterday = l.get(l.size() - 4);
Stock today = l.get(l.size() - 3);
Stock tomorow = l.get(l.size() - 2);
Stock tomorow2 = l.get(l.size() - 1);
Long v1 = today.getTradeNum();
Long v2 = tomorow.getTradeNum();
Long v3 = tomorow2.getTradeNum();
Float t0End = Float.parseFloat(yesterday.getEndPrice());
Float t1End = Float.parseFloat(today.getEndPrice());
Float t2End = Float.parseFloat(tomorow.getEndPrice());
Float t3End = Float.parseFloat(tomorow2.getEndPrice());
Float t0Begin = Float.parseFloat(yesterday.getStartPrice());
Float t1Begin = Float.parseFloat(today.getStartPrice());
Float t2Begin = Float.parseFloat(tomorow.getStartPrice());
Float t3Begin = Float.parseFloat(tomorow2.getStartPrice());
Float r1 = t1End / t0End;
Float r2 = t2End / t1End;
Float r3 = t3End / t2End;
if (!(r3 < r1 && r2 < r1)) {
return false;
}
if (t1End - t1Begin < 0) {
return false;
}
if (t2End - t2Begin < 0) {
return false;
}
if (t3End - t3Begin < 0) {
return false;
}
if (!(t3End > t2End && t2End > t1End)) {
return false;
}
/**
* ����
*/
if (!(v1 > v2 && v1 > v3)) {
return false;
}
Float rr1 = v1.floatValue() / v2.floatValue();
Float rr2 = v1.floatValue() / v3.floatValue();
/**
* ������������3
*/
if (r1 < 1.05) {
return false;
}
if (!(t1End <= t2End && t2End <= t3End)) {
return false;
}
if (rr1 * rr2 < 2) {
return false;
}
return true;
}
/**
* �����������
*
* @param l
* @return
*/
public static boolean checkPDVD(List<Stock> l) {
if (l == null) {
return false;
}
if (l.size() < 13) {
return false;
}
Stock yesterday = l.get(l.size() - 4);
Stock today = l.get(l.size() - 3);
Stock tomorow = l.get(l.size() - 2);
Stock tomorow2 = l.get(l.size() - 1);
Long v1 = today.getTradeNum();
Long v2 = tomorow.getTradeNum();
Long v3 = tomorow2.getTradeNum();
Float t1End = Float.parseFloat(today.getEndPrice());
Float t2End = Float.parseFloat(tomorow.getEndPrice());
Float t3End = Float.parseFloat(tomorow2.getEndPrice());
Float t1Begin = Float.parseFloat(today.getStartPrice());
Float t2Begin = Float.parseFloat(tomorow.getStartPrice());
Float t3Begin = Float.parseFloat(tomorow2.getStartPrice());
if (today.getCode().equals("002488")) {
today.get_10changes();
}
if (checkBV(yesterday, today)) {
if (t2End < t1End && t3End < t1End && t3End > t1Begin) {
if (v3 < v2 && v2 < v1) {
return true;
}
}
}
if (checkBV(today, tomorow)) {
if (t3End < t2End && t3End > t2Begin) {
if (v3 < v2) {
return true;
}
}
}
return false;
}
public static void main(String args[]) {
List<Stock> l = Hisdata_Base.readHisData("sh600967", null);
List<Date> d = checkContinueLittleSun(l);
if (d.size() > 0) {
for (Date da : d) {
System.out.println(FetchUtil.FILE_FORMAT.format(da));
}
}
}
}
| [
"422895120@qq.com"
] | 422895120@qq.com |
a0db4a04611b10fcba37f589c3254e0174a2a497 | c2f684988e9e1ddce5f1e693e366a196325cfb87 | /airhockeyProject/app/src/main/java/com/iqiyi/yangdaokuan/opengl/program/TextureShaderProgram.java | a4fb6f7e861a5f683f4a4e9a1e68600b621b494a | [] | no_license | gebibaiyang/StudyOpenGLES | da14750244c18a59030856560f68558b0c757d95 | a7c57b989e1ecbc0f3481c335ae31558feefcd93 | refs/heads/master | 2020-04-07T12:21:21.331606 | 2018-12-28T08:55:24 | 2018-12-28T08:55:24 | 158,364,296 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,695 | java | package com.iqiyi.yangdaokuan.opengl.program;
import android.content.Context;
import com.iqiyi.yangdaokuan.opengl.R;
import static android.opengl.GLES20.GL_TEXTURE0;
import static android.opengl.GLES20.GL_TEXTURE_2D;
import static android.opengl.GLES20.glActiveTexture;
import static android.opengl.GLES20.glBindTexture;
import static android.opengl.GLES20.glGetAttribLocation;
import static android.opengl.GLES20.glGetUniformLocation;
import static android.opengl.GLES20.glUniform1i;
import static android.opengl.GLES20.glUniformMatrix4fv;
public class TextureShaderProgram extends ShaderProgram {
private final int uMatrixLocation;
private final int uTextureUnitLocation;
private final int aPositionLocation;
private final int aTextureCoordinatesLocation;
public TextureShaderProgram(Context context) {
super(context, R.raw.texture_vertex_shader, R.raw.texture_fragment_shader);
uMatrixLocation = glGetUniformLocation(program, U_MATRIX);
uTextureUnitLocation = glGetUniformLocation(program, U_TEXTURE_UNIT);
aPositionLocation = glGetAttribLocation(program, A_POSITION);
aTextureCoordinatesLocation = glGetAttribLocation(program, A_TEXTURE_COORDINATES);
}
public void setUniforms(float[] matrix, int textureId) {
glUniformMatrix4fv(uMatrixLocation, 1, false, matrix, 0);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, textureId);
glUniform1i(uTextureUnitLocation, 0);
}
public int getPositionAttributeLocation() {
return aPositionLocation;
}
public int getTextureCoordinatesAttributeLocation() {
return aTextureCoordinatesLocation;
}
}
| [
"yangdaokuan@qiyi.com"
] | yangdaokuan@qiyi.com |
14b05d51f68a658eabc7f941aea2bae7f88d288f | d1ed928ea5bd9fdd1a1f34251a816ba0bf24bee8 | /common/servicemix-components/src/test/java/org/apache/servicemix/components/pojo/PojoTest.java | 5422af377448480003bcb41a298a14974807d99c | [
"Apache-2.0",
"BSD-2-Clause",
"BSD-3-Clause-No-Nuclear-License",
"MPL-1.0",
"CDDL-1.0",
"MIT",
"LicenseRef-scancode-jdom",
"MPL-1.1",
"CPL-1.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-mx4j",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-unknown"
] | permissive | apache/servicemix3 | 6214621a56612f779a1b87e7f8d737f813228eb0 | a4ce3148916c940fa204b713795bb21e8d0cd42e | refs/heads/trunk | 2023-09-04T06:30:30.826271 | 2012-08-19T12:40:02 | 2012-08-19T12:40:02 | 225,208 | 6 | 14 | Apache-2.0 | 2023-09-12T13:54:17 | 2009-06-12T08:04:00 | Java | UTF-8 | Java | false | false | 2,430 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.servicemix.components.pojo;
import org.apache.servicemix.tck.SpringTestSupport;
import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.AbstractXmlApplicationContext;
/**
* @version $Revision$
*/
public class PojoTest extends SpringTestSupport {
private static transient Logger logger = LoggerFactory.getLogger(PojoTest.class);
public void testSendAndReceiveOfMessages() throws Exception {
MySender sender = (MySender) getBean("sender");
sender.sendMessages(messageCount);
MyReceiver receiver = (MyReceiver) getBean("receiver");
assertMessagesReceived(receiver.getMessageList(), messageCount);
}
public void testPerfSendAndReceiveOfMessages() throws Exception {
MySender sender = (MySender) getBean("sender");
MyReceiver receiver = (MyReceiver) getBean("receiver");
sender.sendMessages(100);
assertMessagesReceived(receiver.getMessageList(), 100);
receiver.getMessageList().flushMessages();
int messageCount = 500;
long start = System.currentTimeMillis();
sender.sendMessages(messageCount);
assertMessagesReceived(receiver.getMessageList(), messageCount);
long end = System.currentTimeMillis();
logger.info("{} ms", (end - start));
logger.info("{} messages sent", messageCount);
}
protected AbstractXmlApplicationContext createBeanFactory() {
return new ClassPathXmlApplicationContext("org/apache/servicemix/components/pojo/example.xml");
}
}
| [
"jbonofre@apache.org"
] | jbonofre@apache.org |
f9ec3dfd14e82fddd04f58f1ac5cc0e70af0df31 | 2fffe7fd716a7b1c0ffc89ecf20c492d479fb1a0 | /src/com/bingye/同步synchronized.java | 0273cf89235ff0453451e6430c3260c119111178 | [] | no_license | Bingye/java-thread | d015b4455a8b3e27d2b593fda09d2884bd89767b | 386c52f199eb5d53a596429b9ead8081bdb018fc | refs/heads/master | 2023-05-25T16:57:46.779209 | 2021-06-06T10:41:46 | 2021-06-06T10:41:46 | 374,332,210 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 935 | java | /*
* Copyright @ 2020 com.iflytek.sgy
* java-thread 下午2:05:05
* All right reserved.
*
*/
package com.bingye;
import java.util.Arrays;
import java.util.concurrent.CountDownLatch;
/**
* @desc:
* @author: bingye
* @createTime: 2020年12月14日 下午2:05:05
* @history:
* @version: v1.0
*/
public class 同步synchronized {
private static int m = 0;
public static void main(String[] args) throws InterruptedException {
Thread[] threads = new Thread[100];
//门栓
CountDownLatch latch = new CountDownLatch(threads.length);
for(int i=0 ; i<threads.length ; i++) {
threads[i] = new Thread(()-> {
for(int j=0 ; j<10000 ; j++) {
m++;
}
//这里面采用了自旋锁(轻量级锁来解决CAS)
latch.countDown();
});
}
//Unsafe
//ThreadLocal
Arrays.stream(threads).forEach((t)->t.start());
//等到count=0 才继续执行。
latch.await();
System.out.println(m);
}
}
| [
"bingye_glb@iflytek.com"
] | bingye_glb@iflytek.com |
a8b428f21767b5b199ce94d1d5bd32e54684662c | 27692aabcdda9be8c77617d637b651bc9dd759df | /src/main/java/se/leafcoders/rosette/core/service/MailSenderService.java | 051cb76b115d8d950b00eb72130c2ae7ac71c74b | [] | no_license | LeafCoders/rosette | 80f096740199cb7cc2a47ca7b360dbfa9c97df7b | 95085648e17a9e6c6e1712336d38f34405ac9852 | refs/heads/master | 2021-06-20T05:09:30.198014 | 2021-02-22T19:15:24 | 2021-02-22T19:15:24 | 4,078,986 | 3 | 1 | null | 2019-09-24T20:34:07 | 2012-04-19T18:54:41 | Java | UTF-8 | Java | false | false | 2,187 | java | package se.leafcoders.rosette.core.service;
import java.text.MessageFormat;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.mail.MailException;
import org.springframework.mail.MailSendException;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Service;
import lombok.RequiredArgsConstructor;
import se.leafcoders.rosette.RosetteSettings;
@RequiredArgsConstructor
@Service
public class MailSenderService {
private static final Logger logger = LoggerFactory.getLogger(MailSenderService.class);
private final JavaMailSender javaMailSender;
private final RosetteSettings rosetteSettings;
public void sendToAdmin(String subject, String body) {
send(rosetteSettings.getAdminMailTo(), subject, body);
}
public void send(String to, String subject, String body) {
String from = rosetteSettings.getDefaultMailFrom();
MimeMessage message = javaMailSender.createMimeMessage();
try {
MimeMessageHelper helper = new MimeMessageHelper(message, true, "UTF-8");
helper.setFrom(from);
helper.setTo(to);
helper.setSubject(subject);
helper.setText(body, true);
} catch (MessagingException exception) {
logError(subject, from, to, exception);
return;
} catch (MailSendException exception) {
logError(subject, from, to, exception);
return;
}
try {
javaMailSender.send(message);
logger.info(MessageFormat.format("Send \"{0}\" mail from \"{1}\" to \"{2}\".", subject, from, to));
} catch (MailException exception) {
logError(subject, from, to, exception);
return;
}
}
private void logError(String type, String from, String to, Exception e) {
logger.error(MessageFormat.format("Failed to send \"{0}\" mail from \"{1}\" to \"{2}\". Reason: {3}", type,
from, to, e.getMessage()), e);
}
}
| [
"oskar@ebilen.se"
] | oskar@ebilen.se |
45832b6039c88540fd971d79366084bf1bdc2654 | 8a301a0796b4a8714581f20027ec67dadc565549 | /src/test/java/no/hamre/sykkel/HomeControllerTest.java | ed46b156ff74a8f6ca278cf7b635825887dd216b | [] | no_license | super-t/Sykkel | 605df7e6161744058be3a835a74879ae8a9eeb4b | 6330e5aeb3d286883f7561bf596643bdc8ebc761 | refs/heads/master | 2021-01-15T21:19:26.895497 | 2011-07-01T19:55:18 | 2011-07-01T19:55:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 567 | java | package no.hamre.sykkel;
import junit.framework.Assert;
import org.junit.Test;
import org.springframework.ui.ExtendedModelMap;
import org.springframework.ui.Model;
public class HomeControllerTest {
@Test
public void testController() {
HomeController controller = new HomeController();
Model model = new ExtendedModelMap();
Assert.assertEquals("nyPerson",controller.showHomePage(model));
Object message = model.asMap().get("controllerMessage");
//Assert.assertEquals("This is the message from the controller!",message);
}
}
| [
"javaguruen@gmail.com"
] | javaguruen@gmail.com |
1ca2a8ee973b0304a5ae219a4a6c32cb935a6c7c | 9a9ae3f36cc775ab7ffe04a67944dff7fc3fd024 | /Skyblock/src/main/java/org/skysurge/skyblock/listeners/PlayerQuit.java | 87bf4004e9ec32200fd71f9d9c4b1f4f45066d6a | [] | no_license | chriistojp/Skyblock | 19e378f0d895786118fddc9446fe4d2511074f9c | 1fce8c01a74c62d913d8501f1c1f87caf019bd1a | refs/heads/master | 2022-11-29T03:19:44.259971 | 2020-08-04T05:20:34 | 2020-08-04T05:20:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 607 | java | package org.skysurge.skyblock.listeners;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import org.skysurge.skyblock.island.IslandManager;
/**
* Copy Right ©
* This code is private
* Owner: Christo
* From: 10/22/19-2023
* Any attempts to use these program(s) may result in a penalty of up to $1,000 USD
**/
public class PlayerQuit implements Listener {
@EventHandler
public void onPlayerQuit(PlayerQuitEvent e) {
IslandManager.getIslandManager().unloadPlayer(e.getPlayer());
}
}
| [
"noreply@github.com"
] | chriistojp.noreply@github.com |
5e8c95b062ed4dc8bfbc0c9b4fa183a31f947530 | 120d6e9673e9a471188d2cec83f76511b7bb274c | /com/android/gallery3d/exif/ExifTag.java | 42fc94edac680d33c6e68d6acabd177ecece6462 | [] | no_license | wsguyue/MiuiCamera | 7b8f04677e4c987173bc9f2ea7fb6762515adf41 | 1bd20c836a6ac2ca6fd43985683dfefd91bdeea3 | refs/heads/master | 2020-03-11T03:09:52.015774 | 2017-08-13T09:11:09 | 2017-08-13T09:11:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,005 | java | package com.android.gallery3d.exif;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Locale;
public class ExifTag {
private static final SimpleDateFormat TIME_FORMAT = new SimpleDateFormat("yyyy:MM:dd kk:mm:ss");
private static final int[] TYPE_TO_SIZE_MAP = new int[11];
private static Charset US_ASCII = Charset.forName("US-ASCII");
private int mComponentCountActual;
private final short mDataType;
private boolean mHasDefinedDefaultComponentCount;
private int mIfd;
private int mOffset;
private final short mTagId;
private Object mValue = null;
static {
TYPE_TO_SIZE_MAP[1] = 1;
TYPE_TO_SIZE_MAP[2] = 1;
TYPE_TO_SIZE_MAP[3] = 2;
TYPE_TO_SIZE_MAP[4] = 4;
TYPE_TO_SIZE_MAP[5] = 8;
TYPE_TO_SIZE_MAP[7] = 1;
TYPE_TO_SIZE_MAP[9] = 4;
TYPE_TO_SIZE_MAP[10] = 8;
}
public static boolean isValidIfd(int ifdId) {
if (ifdId == 0 || ifdId == 1 || ifdId == 2 || ifdId == 3 || ifdId == 4) {
return true;
}
return false;
}
public static boolean isValidType(short type) {
if (type == (short) 1 || type == (short) 2 || type == (short) 3 || type == (short) 4 || type == (short) 5 || type == (short) 7 || type == (short) 9 || type == (short) 10) {
return true;
}
return false;
}
ExifTag(short tagId, short type, int componentCount, int ifd, boolean hasDefinedComponentCount) {
this.mTagId = tagId;
this.mDataType = type;
this.mComponentCountActual = componentCount;
this.mHasDefinedDefaultComponentCount = hasDefinedComponentCount;
this.mIfd = ifd;
}
public static int getElementSize(short type) {
return TYPE_TO_SIZE_MAP[type];
}
public int getIfd() {
return this.mIfd;
}
protected void setIfd(int ifdId) {
this.mIfd = ifdId;
}
public short getTagId() {
return this.mTagId;
}
public short getDataType() {
return this.mDataType;
}
public int getDataSize() {
return getComponentCount() * getElementSize(getDataType());
}
public int getComponentCount() {
return this.mComponentCountActual;
}
protected void forceSetComponentCount(int count) {
this.mComponentCountActual = count;
}
public boolean hasValue() {
return this.mValue != null;
}
public boolean setValue(int[] value) {
if (checkBadComponentCount(value.length)) {
return false;
}
if (this.mDataType != (short) 3 && this.mDataType != (short) 9 && this.mDataType != (short) 4) {
return false;
}
if (this.mDataType == (short) 3 && checkOverflowForUnsignedShort(value)) {
return false;
}
if (this.mDataType == (short) 4 && checkOverflowForUnsignedLong(value)) {
return false;
}
long[] data = new long[value.length];
for (int i = 0; i < value.length; i++) {
data[i] = (long) value[i];
}
this.mValue = data;
this.mComponentCountActual = value.length;
return true;
}
public boolean setValue(int value) {
return setValue(new int[]{value});
}
/* JADX WARNING: inconsistent code. */
/* Code decompiled incorrectly, please refer to instructions dump. */
public boolean setValue(long[] r4) {
/*
r3 = this;
r2 = 0;
r0 = r4.length;
r0 = r3.checkBadComponentCount(r0);
if (r0 != 0) goto L_0x000d;
L_0x0008:
r0 = r3.mDataType;
r1 = 4;
if (r0 == r1) goto L_0x000e;
L_0x000d:
return r2;
L_0x000e:
r0 = r3.checkOverflowForUnsignedLong(r4);
if (r0 == 0) goto L_0x0015;
L_0x0014:
return r2;
L_0x0015:
r3.mValue = r4;
r0 = r4.length;
r3.mComponentCountActual = r0;
r0 = 1;
return r0;
*/
throw new UnsupportedOperationException("Method not decompiled: com.android.gallery3d.exif.ExifTag.setValue(long[]):boolean");
}
public boolean setValue(String value) {
if (this.mDataType != (short) 2 && this.mDataType != (short) 7) {
return false;
}
byte[] buf = value.getBytes(US_ASCII);
byte[] finalBuf = buf;
if (buf.length > 0) {
finalBuf = (buf[buf.length + -1] == (byte) 0 || this.mDataType == (short) 7) ? buf : Arrays.copyOf(buf, buf.length + 1);
if (!(buf[buf.length - 1] == (byte) 0 || this.mDataType == (short) 7)) {
this.mComponentCountActual++;
}
} else if (this.mDataType == (short) 2 && this.mComponentCountActual == 1) {
finalBuf = new byte[]{(byte) 0};
}
int count = finalBuf.length;
if (checkBadComponentCount(count)) {
return false;
}
this.mComponentCountActual = count;
this.mValue = finalBuf;
return true;
}
public boolean setValue(Rational[] value) {
if (checkBadComponentCount(value.length)) {
return false;
}
if (this.mDataType != (short) 5 && this.mDataType != (short) 10) {
return false;
}
if (this.mDataType == (short) 5 && checkOverflowForUnsignedRational(value)) {
return false;
}
if (this.mDataType == (short) 10 && checkOverflowForRational(value)) {
return false;
}
this.mValue = value;
this.mComponentCountActual = value.length;
return true;
}
public boolean setValue(byte[] value, int offset, int length) {
if (checkBadComponentCount(length)) {
return false;
}
if (this.mDataType != (short) 1 && this.mDataType != (short) 7) {
return false;
}
this.mValue = new byte[length];
System.arraycopy(value, offset, this.mValue, 0, length);
this.mComponentCountActual = length;
return true;
}
public boolean setValue(byte[] value) {
return setValue(value, 0, value.length);
}
public Object getValue() {
return this.mValue;
}
public String forceGetValueAsString() {
if (this.mValue == null) {
return "";
}
if (this.mValue instanceof byte[]) {
if (this.mDataType == (short) 2) {
return new String((byte[]) this.mValue, US_ASCII);
}
return Arrays.toString((byte[]) this.mValue);
} else if (this.mValue instanceof long[]) {
if (((long[]) this.mValue).length == 1) {
return String.valueOf(((long[]) this.mValue)[0]);
}
return Arrays.toString((long[]) this.mValue);
} else if (!(this.mValue instanceof Object[])) {
return this.mValue.toString();
} else {
if (((Object[]) this.mValue).length != 1) {
return Arrays.toString((Object[]) this.mValue);
}
Object val = ((Object[]) this.mValue)[0];
if (val == null) {
return "";
}
return val.toString();
}
}
protected long getValueAt(int index) {
if (this.mValue instanceof long[]) {
return ((long[]) this.mValue)[index];
}
if (this.mValue instanceof byte[]) {
return (long) ((byte[]) this.mValue)[index];
}
throw new IllegalArgumentException("Cannot get integer value from " + convertTypeToString(this.mDataType));
}
protected byte[] getStringByte() {
return (byte[]) this.mValue;
}
protected Rational getRational(int index) {
if (this.mDataType == (short) 10 || this.mDataType == (short) 5) {
return ((Rational[]) this.mValue)[index];
}
throw new IllegalArgumentException("Cannot get RATIONAL value from " + convertTypeToString(this.mDataType));
}
protected void getBytes(byte[] buf) {
getBytes(buf, 0, buf.length);
}
protected void getBytes(byte[] buf, int offset, int length) {
if (this.mDataType == (short) 7 || this.mDataType == (short) 1) {
Object obj = this.mValue;
if (length > this.mComponentCountActual) {
length = this.mComponentCountActual;
}
System.arraycopy(obj, 0, buf, offset, length);
return;
}
throw new IllegalArgumentException("Cannot get BYTE value from " + convertTypeToString(this.mDataType));
}
protected int getOffset() {
return this.mOffset;
}
protected void setOffset(int offset) {
this.mOffset = offset;
}
protected void setHasDefinedCount(boolean d) {
this.mHasDefinedDefaultComponentCount = d;
}
protected boolean hasDefinedCount() {
return this.mHasDefinedDefaultComponentCount;
}
private boolean checkBadComponentCount(int count) {
if (!this.mHasDefinedDefaultComponentCount || this.mComponentCountActual == count) {
return false;
}
return true;
}
private static String convertTypeToString(short type) {
switch (type) {
case (short) 1:
return "UNSIGNED_BYTE";
case (short) 2:
return "ASCII";
case (short) 3:
return "UNSIGNED_SHORT";
case (short) 4:
return "UNSIGNED_LONG";
case (short) 5:
return "UNSIGNED_RATIONAL";
case (short) 7:
return "UNDEFINED";
case (short) 9:
return "LONG";
case (short) 10:
return "RATIONAL";
default:
return "";
}
}
private boolean checkOverflowForUnsignedShort(int[] value) {
for (int v : value) {
if (v > 65535 || v < 0) {
return true;
}
}
return false;
}
private boolean checkOverflowForUnsignedLong(long[] value) {
for (long v : value) {
if (v < 0 || v > 4294967295L) {
return true;
}
}
return false;
}
private boolean checkOverflowForUnsignedLong(int[] value) {
for (int v : value) {
if (v < 0) {
return true;
}
}
return false;
}
private boolean checkOverflowForUnsignedRational(Rational[] value) {
for (Rational v : value) {
if (v.getNumerator() < 0 || v.getDenominator() < 0 || v.getNumerator() > 4294967295L || v.getDenominator() > 4294967295L) {
return true;
}
}
return false;
}
private boolean checkOverflowForRational(Rational[] value) {
for (Rational v : value) {
if (v.getNumerator() < -2147483648L || v.getDenominator() < -2147483648L || v.getNumerator() > 2147483647L || v.getDenominator() > 2147483647L) {
return true;
}
}
return false;
}
public boolean equals(Object obj) {
boolean z = false;
if (obj == null || !(obj instanceof ExifTag)) {
return false;
}
ExifTag tag = (ExifTag) obj;
if (tag.mTagId != this.mTagId || tag.mComponentCountActual != this.mComponentCountActual || tag.mDataType != this.mDataType) {
return false;
}
if (this.mValue == null) {
if (tag.mValue == null) {
z = true;
}
return z;
} else if (tag.mValue == null) {
return false;
} else {
if (this.mValue instanceof long[]) {
if (tag.mValue instanceof long[]) {
return Arrays.equals((long[]) this.mValue, (long[]) tag.mValue);
}
return false;
} else if (this.mValue instanceof Rational[]) {
if (tag.mValue instanceof Rational[]) {
return Arrays.equals((Rational[]) this.mValue, (Rational[]) tag.mValue);
}
return false;
} else if (!(this.mValue instanceof byte[])) {
return this.mValue.equals(tag.mValue);
} else {
if (tag.mValue instanceof byte[]) {
return Arrays.equals((byte[]) this.mValue, (byte[]) tag.mValue);
}
return false;
}
}
}
public String toString() {
return String.format(Locale.ENGLISH, "tag id: %04X\n", new Object[]{Short.valueOf(this.mTagId)}) + "ifd id: " + this.mIfd + "\ntype: " + convertTypeToString(this.mDataType) + "\ncount: " + this.mComponentCountActual + "\noffset: " + this.mOffset + "\nvalue: " + forceGetValueAsString() + "\n";
}
}
| [
"bhatiaparth07@gmail.com"
] | bhatiaparth07@gmail.com |
644d5157eae4c09bc07cf1bfd22ebd938a7fb967 | f20af063f99487a25b7c70134378c1b3201964bf | /appengine/src/main/java/com/dereekb/gae/web/api/server/hook/WebHookApiScheduleTaskControllerEntry.java | 348f24b403b27a64f642568a2f86212ae7630c3c | [] | no_license | dereekb/appengine | d45ad5c81c77cf3fcca57af1aac91bc73106ccbb | d0869fca8925193d5a9adafd267987b3edbf2048 | refs/heads/master | 2022-12-19T22:59:13.980905 | 2020-01-26T20:10:15 | 2020-01-26T20:10:15 | 165,971,613 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,741 | java | package com.dereekb.gae.web.api.server.hook;
import java.io.IOException;
import com.dereekb.gae.server.datastore.models.keys.ModelKey;
import com.dereekb.gae.server.taskqueue.scheduler.TaskRequest;
import com.dereekb.gae.server.taskqueue.scheduler.impl.TaskRequestImpl;
import com.dereekb.gae.utilities.data.impl.ObjectMapperUtilityBuilderImpl;
import com.dereekb.gae.web.api.server.schedule.ApiScheduleTaskControllerEntry;
import com.dereekb.gae.web.api.server.schedule.ApiScheduleTaskRequest;
import com.dereekb.gae.web.api.server.schedule.impl.AbstractSingleTaskApiScheduleTaskControllerEntry;
import com.dereekb.gae.web.api.util.attribute.exception.KeyedInvalidAttributeException;
import com.dereekb.gae.web.api.util.attribute.exception.MultiKeyedInvalidAttributeException;
import com.dereekb.gae.web.taskqueue.server.webhook.TaskQueueWebHookController;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
/**
* {@link ApiScheduleTaskControllerEntry} for receiving web hook events and
* building a task for the {@link TaskQueueWebHookController}.
*
* @author dereekbs
*
*/
public class WebHookApiScheduleTaskControllerEntry extends AbstractSingleTaskApiScheduleTaskControllerEntry {
/**
* Key used by this entry.
*/
public static final String SCHEDULE_TASK_ENTRY_KEY = "webhook";
private ObjectMapper mapper = ObjectMapperUtilityBuilderImpl.MAPPER;
public ObjectMapper getMapper() {
return this.mapper;
}
public void setMapper(ObjectMapper mapper) {
if (mapper == null) {
throw new IllegalArgumentException("mapper cannot be null.");
}
this.mapper = mapper;
}
// MARK: AbstractSingleTaskApiScheduleTaskControllerEntry
@Override
public TaskRequest makeTaskRequest(ApiScheduleTaskRequest request)
throws MultiKeyedInvalidAttributeException,
KeyedInvalidAttributeException,
IllegalArgumentException {
JsonNode requestData = request.getData();
if (requestData == null) {
throw new KeyedInvalidAttributeException(ModelKey.nullKey(), "data", null, "Request data was not present.");
}
// TODO: Consider validating the events before passing them on.
try {
TaskRequestImpl taskRequest = new TaskRequestImpl(TaskQueueWebHookController.WEBHOOK_EVENT_PATH);
String jsonEventData = this.mapper.writeValueAsString(requestData);
taskRequest.setRequestData(jsonEventData);
return taskRequest;
} catch (IOException e) {
throw new KeyedInvalidAttributeException(ModelKey.nullKey(), "data", requestData.toString(),
"Request data failed to be serialized.");
}
}
@Override
public String toString() {
return "HookApiScheduleTaskControllerEntry [mapper=" + this.mapper + "]";
}
}
| [
"dereekb@gmail.com"
] | dereekb@gmail.com |
ba493eddf1a026bc387e00ea625828bb1eeeae52 | 35eb1d5624a13a45b3d790348affaf8bb999b700 | /src/bd/InicioSesion.java | cd2af131437a3a1e4e86a0b50cff08edac7e9114 | [] | no_license | Chimbox/basededatos | f208b3de998f968e5d8866f66067e698b2738c9c | 90d0713d387e4da2854f9feb0fe02d9187d2c8f9 | refs/heads/master | 2020-06-17T00:32:47.225275 | 2019-07-11T07:08:02 | 2019-07-11T07:08:02 | 195,744,621 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,191 | 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 bd;
import java.awt.Color;
public class InicioSesion extends javax.swing.JDialog {
/**
* Creates new form InicioSesion
*/
public InicioSesion(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
// this.setResizable(false);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel2 = new javax.swing.JPanel();
jPanel4 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
usuario = new javax.swing.JTextField();
pass = new javax.swing.JPasswordField();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setBackground(new java.awt.Color(186, 212, 239));
addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentResized(java.awt.event.ComponentEvent evt) {
formComponentResized(evt);
}
});
jPanel2.setBackground(new java.awt.Color(186, 212, 239));
jPanel4.setBackground(new java.awt.Color(255, 255, 255));
jLabel1.setFont(new java.awt.Font("Perpetua", 0, 36)); // NOI18N
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel1.setText("Inicia Sesión");
usuario.setColumns(15);
usuario.setText("ID Usuario");
pass.setColumns(15);
pass.setForeground(new java.awt.Color(0, 0, 51));
pass.setText("contraseña");
pass.setToolTipText("");
jButton1.setForeground(new java.awt.Color(102, 102, 102));
jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bd/img/back.png"))); // NOI18N
jButton1.setText("Regresar");
jButton2.setForeground(new java.awt.Color(102, 102, 102));
jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bd/img/login.png"))); // NOI18N
jButton2.setText("Aceptar");
jLabel2.setFont(new java.awt.Font("Verdana", 0, 48)); // NOI18N
jLabel2.setForeground(new java.awt.Color(153, 153, 153));
jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bd/img/user.png"))); // NOI18N
jLabel3.setFont(new java.awt.Font("Verdana", 0, 48)); // NOI18N
jLabel3.setForeground(new java.awt.Color(153, 153, 153));
jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bd/img/password.png"))); // NOI18N
jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bd/img/logo.png"))); // NOI18N
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(115, 115, 115)
.addComponent(jLabel4)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(22, 22, 22)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(jLabel3))
.addGap(18, 18, 18)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(usuario)
.addComponent(pass, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(jButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 32, Short.MAX_VALUE)
.addComponent(jButton2)
.addGap(22, 22, 22))))
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addGap(18, 18, 18)
.addComponent(jLabel4)
.addGap(18, 18, 18)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2)
.addComponent(usuario, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel3)
.addComponent(pass, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
.addContainerGap(35, Short.MAX_VALUE))
);
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(23, 23, 23)
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(26, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(19, 19, 19)
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(30, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void formComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentResized
// TODO add your handling code here:
}//GEN-LAST:event_formComponentResized
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(InicioSesion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(InicioSesion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(InicioSesion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(InicioSesion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
InicioSesion dialog = new InicioSesion(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel4;
private javax.swing.JPasswordField pass;
private javax.swing.JTextField usuario;
// End of variables declaration//GEN-END:variables
}
| [
"chimboxsoftgve@gmail.com"
] | chimboxsoftgve@gmail.com |
62453602bfa2d9cded74f1a16b3f9b88e7d1dea8 | 9ec6b560a16ab6020add5320ae8fe2c10493d92c | /FactoryProject/src/test/java/LRNNN/finalProject/FactoryProject/FactoryProjectApplicationTests.java | cfd3ca35ab05e05d1b63312d94037de87cb5f486 | [] | no_license | NellyPrager/FinalProject-LRNNN | c26889682b077b31f5cb84bc4821dbb87bb7ca06 | b67709c679bd0dcbdafc69ff1a53b91f40e39089 | refs/heads/master | 2020-04-20T21:01:23.656723 | 2019-02-08T12:56:12 | 2019-02-08T12:56:12 | 169,095,136 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 359 | java | package LRNNN.finalProject.FactoryProject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class FactoryProjectApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"nelly.prager@gmail.com"
] | nelly.prager@gmail.com |
5f1d9e72a5abed977f586d63a9b65d1a017130cc | dd80a584130ef1a0333429ba76c1cee0eb40df73 | /external/nist-sip/java/gov/nist/javax/sip/parser/ReplyToParser.java | 356ca26ad534f1616d001436d9a27e812d23aca9 | [
"MIT",
"NIST-PD"
] | permissive | karunmatharu/Android-4.4-Pay-by-Data | 466f4e169ede13c5835424c78e8c30ce58f885c1 | fcb778e92d4aad525ef7a995660580f948d40bc9 | refs/heads/master | 2021-03-24T13:33:01.721868 | 2017-02-18T17:48:49 | 2017-02-18T17:48:49 | 81,847,777 | 0 | 2 | MIT | 2020-03-09T00:02:12 | 2017-02-13T16:47:00 | null | UTF-8 | Java | false | false | 5,417 | java | /*
* Conditions Of Use
*
* This software was developed by employees of the National Institute of
* Standards and Technology (NIST), an agency of the Federal Government.
* Pursuant to title 15 Untied States Code Section 105, works of NIST
* employees are not subject to copyright protection in the United States
* and are considered to be in the public domain. As a result, a formal
* license is not needed to use the software.
*
* This software is provided by NIST as a service and is expressly
* provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT
* AND DATA ACCURACY. NIST does not warrant or make any representations
* regarding the use of the software or the results thereof, including but
* not limited to the correctness, accuracy, reliability or usefulness of
* the software.
*
* Permission to use this software is contingent upon your acceptance
* of the terms of this agreement
*
* .
*
*/
package gov.nist.javax.sip.parser;
import java.text.ParseException;
import gov.nist.javax.sip.header.*;
/**
* Parser for a list of RelpyTo headers.
*
* @version 1.2 $Revision: 1.7 $ $Date: 2009/07/17 18:58:03 $
*
* @author Olivier Deruelle <br/>
* @author M. Ranganathan <br/>
*
*/
public class ReplyToParser extends AddressParametersParser {
/**
* Creates a new instance of ReplyToParser
* @param replyTo the header to parse
*/
public ReplyToParser(String replyTo) {
super(replyTo);
}
/**
* Cosntructor
* param lexer the lexer to use to parse the header
*/
protected ReplyToParser(Lexer lexer) {
super(lexer);
}
/**
* parse the String message and generate the ReplyTo List Object
* @return SIPHeader the ReplyTo List object
* @throws SIPParseException if errors occur during the parsing
*/
public SIPHeader parse() throws ParseException {
ReplyTo replyTo = new ReplyTo();
if (debug)
dbg_enter("ReplyTo.parse");
try {
headerName(TokenTypes.REPLY_TO);
replyTo.setHeaderName(SIPHeaderNames.REPLY_TO);
super.parse(replyTo);
return replyTo;
} finally {
if (debug)
dbg_leave("ReplyTo.parse");
}
}
/**
public static void main(String args[]) throws ParseException {
String r[] = {
"Reply-To: Bob <sip:bob@biloxi.com>\n"
};
for (int i = 0; i < r.length; i++ ) {
ReplyToParser rt =
new ReplyToParser(r[i]);
ReplyTo re = (ReplyTo) rt.parse();
System.out.println("encoded = " +re.encode());
}
}
*/
}
/*
* $Log: ReplyToParser.java,v $
* Revision 1.7 2009/07/17 18:58:03 emcho
* Converts indentation tabs to spaces so that we have a uniform indentation policy in the whole project.
*
* Revision 1.6 2006/07/13 09:02:16 mranga
* Issue number:
* Obtained from:
* Submitted by: jeroen van bemmel
* Reviewed by: mranga
* Moved some changes from jain-sip-1.2 to java.net
*
* CVS: ----------------------------------------------------------------------
* CVS: Issue number:
* CVS: If this change addresses one or more issues,
* CVS: then enter the issue number(s) here.
* CVS: Obtained from:
* CVS: If this change has been taken from another system,
* CVS: then name the system in this line, otherwise delete it.
* CVS: Submitted by:
* CVS: If this code has been contributed to the project by someone else; i.e.,
* CVS: they sent us a patch or a set of diffs, then include their name/email
* CVS: address here. If this is your work then delete this line.
* CVS: Reviewed by:
* CVS: If we are doing pre-commit code reviews and someone else has
* CVS: reviewed your changes, include their name(s) here.
* CVS: If you have not had it reviewed then delete this line.
*
* Revision 1.3 2006/06/19 06:47:27 mranga
* javadoc fixups
*
* Revision 1.2 2006/06/16 15:26:28 mranga
* Added NIST disclaimer to all public domain files. Clean up some javadoc. Fixed a leak
*
* Revision 1.1.1.1 2005/10/04 17:12:35 mranga
*
* Import
*
*
* Revision 1.4 2004/01/22 13:26:31 sverker
* Issue number:
* Obtained from:
* Submitted by: sverker
* Reviewed by: mranga
*
* Major reformat of code to conform with style guide. Resolved compiler and javadoc warnings. Added CVS tags.
*
* CVS: ----------------------------------------------------------------------
* CVS: Issue number:
* CVS: If this change addresses one or more issues,
* CVS: then enter the issue number(s) here.
* CVS: Obtained from:
* CVS: If this change has been taken from another system,
* CVS: then name the system in this line, otherwise delete it.
* CVS: Submitted by:
* CVS: If this code has been contributed to the project by someone else; i.e.,
* CVS: they sent us a patch or a set of diffs, then include their name/email
* CVS: address here. If this is your work then delete this line.
* CVS: Reviewed by:
* CVS: If we are doing pre-commit code reviews and someone else has
* CVS: reviewed your changes, include their name(s) here.
* CVS: If you have not had it reviewed then delete this line.
*
*/
| [
"karun.matharu@gmail.com"
] | karun.matharu@gmail.com |
41aa4cca83153cbfc6f7e42ca7fc2cd342927c80 | ea629b7166fe8c08c05a7344bc04b0aa39f9dbdb | /src/test/java/NationalInsuranceContributionShould.java | 9cc6be286d479f5e3d951cc06faa7ad184b9e965 | [] | no_license | damianpumar/SalarySlipKata | 5d646bc7d17a64df89f2a30f75a7fc8cd900a559 | 0b76c6b66d60b3de8c13b2792111a857237138fa | refs/heads/master | 2020-06-13T10:22:41.126123 | 2019-06-28T09:54:12 | 2019-06-28T09:54:12 | 194,626,039 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,286 | java | import org.junit.Test;
import static org.assertj.core.api.Java6Assertions.assertThat;
public class NationalInsuranceContributionShould {
@Test
public void be_zero_percent_when_annual_salary_slip_is_below_8060() {
NationalInsuranceContribution nationalInsuranceContribution = new NationalInsuranceContribution(8059);
assertThat(nationalInsuranceContribution.contribution()).isEqualTo(0);
}
@Test
public void be_zero_percent_when_annual_salary_slip_is_equal_8060() {
NationalInsuranceContribution nationalInsuranceContribution = new NationalInsuranceContribution(8060);
assertThat(nationalInsuranceContribution.contribution()).isEqualTo(0);
}
@Test
public void be_twelve_percent_when_annual_salary_slip_is_equal_43000() {
NationalInsuranceContribution nationalInsuranceContribution = new NationalInsuranceContribution(43000);
assertThat(nationalInsuranceContribution.contribution()).isEqualTo(349.40);
}
@Test
public void be_twelve_percent_when_annual_salary_slip_is_above_43000() {
NationalInsuranceContribution nationalInsuranceContribution = new NationalInsuranceContribution(45000);
assertThat(nationalInsuranceContribution.contribution()).isEqualTo(372.73);
}
}
| [
"damianpumar@gmail.com"
] | damianpumar@gmail.com |
bdd02a271094a6f4414c4ad838cd7369238f414d | 75c854bdb561ac4da224f3f29bf75bc80d218c2f | /discovery-client/src/main/java/com/comcast/tvx/cloud/Constants.java | 96da53f500a61b6c7eb91190bdd8524fc2ff31e4 | [
"Apache-2.0"
] | permissive | maduhu/discovery | d55564374d64c951f9d97db3950a5b506e35d24b | b5548ec000a650a65a5a53968737a2fd3a456c93 | refs/heads/master | 2020-03-27T16:34:04.342505 | 2014-07-26T00:06:05 | 2014-07-26T00:06:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 859 | java | /*
* Copyright 2014 Comcast Corporation
*
* 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.comcast.tvx.cloud;
/**
* Package constants.
*
*/
public interface Constants {
public static final String DEFAULT_REGISTRATION_ROOT = "/services";
public static final String PATH_QUEUE = DEFAULT_REGISTRATION_ROOT + "/path_events";
}
| [
"jc_chan@cable.comcast.com"
] | jc_chan@cable.comcast.com |
668cbd3db395b0aeb292a5d5c8e5a6c7c04efda1 | 5b052d2ee75dd1906874cd32c7599201ecbad83c | /src/main/java/cy/alavrov/jminerguide/monitor/MiningTask.java | bae1cd269582467ef60aab5ea063132c362849d2 | [
"BSD-2-Clause",
"CC-BY-3.0"
] | permissive | rk1-rk1/JMinerGuide2 | c6817d67526054ae5ddd19054e97bdfd8324fdf4 | 55aa3faecb74595c906fbd79e3e5c04554fa1106 | refs/heads/master | 2023-01-30T16:40:12.139633 | 2015-05-04T20:14:26 | 2015-05-04T20:14:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,830 | java | /*
* Copyright (c) 2015, Andrey Lavrov <lavroff@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * 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 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 HOLDER 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 cy.alavrov.jminerguide.monitor;
import cy.alavrov.jminerguide.forms.JAsteroidMonitorForm;
import cy.alavrov.jminerguide.log.JMGLogger;
import java.io.BufferedInputStream;
import java.io.InputStream;
import java.util.List;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.LineEvent;
import javax.sound.sampled.LineListener;
/**
* A task to do mining every second.
* Also checks timers.
* @author Andrey Lavrov <lavroff@gmail.com>
*/
public class MiningTask implements Runnable{
private final MiningSessionMonitor msMonitor;
private final JAsteroidMonitorForm form;
private volatile MiningSession lastCurrentSession;
public MiningTask(MiningSessionMonitor msMonitor, JAsteroidMonitorForm form) {
this.msMonitor = msMonitor;
this.form = form;
}
@Override
public void run() {
try {
MiningSession curSession = msMonitor.getCurrentSession();
if (curSession != null) lastCurrentSession = curSession;
final AsteroidMonitorSettings settings = form.getSettings();
List<MiningSession> sessions = msMonitor.getSessions();
for (final MiningSession session : sessions) {
try {
session.doMining();
} catch (AsteroidMinedException | FullOreHoldException e) {
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run(){
ISessionCharacter chr = session.getSessionCharacter();
if (chr != null && !chr.getCoreCharacter().isMonitorIgnore()) {
if (settings.isPopupOnAlert()) {
msMonitor.restoreMonitorWindow();
form.setAlwaysOnTop(true);
}
if (settings.isSoundOnAlert()) {
playSound();
}
}
if (settings.isAsteroidAutoCleanup()) {
session.cleanupRoids();
}
}
});
}
MiningTimer timer = session.getTimer();
if (timer != null && timer.isFinished()) {
if (!timer.wasAlarm()) {
timer.markAlarm();
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run(){
if (settings.isPopupOnAlert()) {
msMonitor.restoreMonitorWindow();
form.setAlwaysOnTop(true);
}
if (settings.isSoundOnAlert()) {
playSound();
}
}
});
}
if ( // either we switched off from right window to the monitor
((session.equals(lastCurrentSession) && msMonitor.isMonitorOrSystemWindow()) ||
// or we in the right window.
(session.equals(curSession)))
&& timer.isOkToClear()) {
session.stopTimer();
}
}
}
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run(){
form.notifyTableUpdate();
form.updateCurrentCharacterStats();
form.updateSessionButtons();
form.updateTimerLabel();
form.pack();
}
});
} catch (Exception e) {
JMGLogger.logSevere("Unable to mine", e);
}
}
private void playSound() {
try {
InputStream resourceStream = getClass().getClassLoader().getResourceAsStream("ting.wav");
InputStream bufferedStream = new BufferedInputStream(resourceStream);
AudioInputStream aStream = AudioSystem.getAudioInputStream(bufferedStream);
AudioFormat audioFormat = aStream.getFormat();
DataLine.Info dataLineInfo = new DataLine.Info(Clip.class, audioFormat);
final Clip clip = (Clip) AudioSystem.getLine(dataLineInfo);
clip.addLineListener(new LineListener(){
@Override
public void update(LineEvent event){
if(event.getType() == LineEvent.Type.STOP){
event.getLine().close();
clip.close();
}
}
});
clip.open(aStream);
clip.start();
} catch (Exception e) {
JMGLogger.logSevere("Unable to play sound", e);
}
}
}
| [
"lavroff@gmail.com"
] | lavroff@gmail.com |
9018d52ae52c9142e7a529bcf0ee4c2711ad59c5 | 21d0c4d1d2c9e6e9d13211d386b932b8c2d55cff | /Tp1/fraction/src/Main.java | 7fd07765270db83a29b04cb5d13974bf2d4dee58 | [] | no_license | MOUBARAKI/JavaGI1 | 542181a61bbf2bb0f31a953bc2c582dc2dbafe3c | f62f6b6588bede0cd6f95e356f734c6696ffc418 | refs/heads/master | 2021-03-16T07:52:51.471394 | 2018-03-18T23:14:18 | 2018-03-18T23:14:18 | 121,979,253 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 281 | java | import java.math.BigInteger;
public class Main {
public static void main(String[] args) {
Fraction a=new Fraction(2,4);
Fraction b=new Fraction(3,4);
System.out.println((a.mult(b)).toString());
System.out.println(a.doubleValue1());
}
}
| [
"aminemoubaraki.3@gmail.com"
] | aminemoubaraki.3@gmail.com |
cf8be5b1e93a1405ad2849b07c0a7877b6c00cb4 | 2c643fe7174d0700a44eda5c7d27da7850561acf | /Problems/Bus tour/src/Main.java | 44af67df6b289c3c5e8c2f632ec1d04564dafb77 | [] | no_license | denibrain/blockchain | a03d8e4c7fdecf4dfdb343c6dac6d6f54e21cb29 | f90172fe7b3eb6b10f6fd7deaa137b6f1969c0a0 | refs/heads/master | 2022-12-13T11:38:18.778135 | 2020-08-26T18:07:46 | 2020-08-26T18:07:46 | 290,569,651 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 538 | java | import java.util.*;
public class Main {
public static void main(String[] args) {
// write your code here
Scanner scanner = new Scanner(System.in);
int height = scanner.nextInt();
int n = scanner.nextInt();
int bridgeNo = 0;
for(int i = 0; i < n; i++) {
if (height >= scanner.nextInt()) {
bridgeNo = i + 1;
break;
}
}
System.out.print(bridgeNo == 0 ? "Will not crash" : "Will crash on bridge " + bridgeNo);
}
} | [
"rudev2@mxbud.com"
] | rudev2@mxbud.com |
34ca59ac53455e5530f1c739a58705976d8f0b4f | a3df789ce5e66610eee20af8627a79fd6bb191e9 | /src/main/utily/JsonUtily.java | 0962d268458ffdf1b7e94625e896e443d22f2160 | [] | no_license | evalle-mx/demo-varios | d5701fe2bfc8d0481ea3c505f8b24d5c16c52aba | d4cc083af5057a511b354e1a7cf13ce257397510 | refs/heads/master | 2022-10-22T09:08:41.895259 | 2020-06-17T00:47:00 | 2020-06-17T00:47:00 | 272,843,433 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,089 | java | package utily;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
public class JsonUtily {
// private final static String JSONFILESDIR = "C:/WspaceLab/JsonFiles/";
protected static final String CHARSET = "UTF-8";
/**
* inicializa un objeto JSON (Object/Array) a partir de un archivo en la ruta recibida
* @param jsInstance
* @param jsonPath
*/
public static Object getJson(String jsonPath){
//JSONArray jsInstance=null;
Object jsInstance = null;
try {
BufferedReader infile = new BufferedReader(
new InputStreamReader(
new FileInputStream(jsonPath), CHARSET ));
String strLine;
StringBuilder sb = new StringBuilder();
while ((strLine = infile.readLine()) != null)
{
sb.append(strLine);
}
infile.close();
if(sb.toString().trim().startsWith("[")){
jsInstance = new JSONArray( sb.toString() );
}else{
jsInstance = new JSONObject( sb.toString() );
}
} catch (Exception e) {
//log4j.fatal("Excepción al generar Json ", e);
e.printStackTrace();
}
return jsInstance;
}
/**
* Obtiene el json contenido en un archivo plano .json desde el directorio designado
* @param jsonFileName [i.e. read-1.json]
* @param jsonDir [i.e. /home/user/dir/]
* @return
*/
public static String getJsonFile(String jsonFileName, String jsonDir) {
String jsonPath = null;
jsonPath = jsonDir.concat(jsonFileName);
// log4j.debug("path de busqueda: [".concat(jsonPath).concat("]"));
String jsonFile = "[]";
try {
jsonFile = StringUtily.getBuilderNoTabsFile(jsonPath, CHARSET).toString();
} catch (IOException e) {
System.err.println("Excepción al generar Json desde archivo: [" + jsonPath + "]: ");
jsonFile = "[]";
}
return jsonFile;
}
@SuppressWarnings("rawtypes")
public static void jsonFromMap(Map mapa){
System.out.println("jsonFromMap");
if(mapa!=null){
System.out.println("Mapa(".concat(String.valueOf(mapa.size())).concat(")").concat(mapa.toString()) );
//imprimeMapa(mapa);
System.out.println();
JSONObject jsono = new JSONObject(mapa);//al crear, se pierde cualquier orden
System.out.println("jsono:");
System.out.println(jsono.toString());
}
}
/**
* Convierte un JSONObject a un java.util.Map, con esto se evita excepcion
* al buscar un objeto que no exista en el Json
* @param json
* @return
*/
public static Map<String, Object> mapFromJson(JSONObject json){
String[] nombres = JSONObject.getNames(json);
// System.out.println("total de valores en el Json:" + nombres.length + "\n");
Map<String, Object> mapa = new TreeMap<String, Object>();
for(String key : nombres){
try {
Object value = json.get(key);
mapa.put(key, value);
// System.out.println(key + ": "+value);
} catch (JSONException e) {
// System.err.println("error al obtener:".concat(key));
e.printStackTrace();
}
}
return mapa;
}
/**
* Obtiene Cadena dentro de un Json, debe recibir un json con estructura {"key":valor, "key2":valor2}
* <ul>
* <li>En caso de no existir la llave, regresa null</li>
* <li>En caso de recibir un arreglo o tener algun error,
* reporta en log la excepcion interna y regresa null</li>
* <li>En caso de que el objeto sea encontrado, pero no sea convertible a cadena, reporta en log y regresa null</li>
* </ul>
* @param jsonString
* @param key
* @return
*/
public static String getStringInJson(String jsonString, String key){
String cadena = null;
Object objeto = getObjInJson(jsonString, key);
if(objeto!=null){
try{
cadena = String.valueOf(objeto);
}catch (Exception e) {
System.err.println("Se obtuvo Objeto, pero este no se puede convertir en cadena");
e.printStackTrace();
}
}
return cadena;
}
/**
* Obtiene Objeto (Object) dentro de un Json, debe recibir un Json con estructura {"key":valor, "key2":valor2}
* <ul><li>En caso de no existir la llave, regresa null</li>
* <li>En caso de recibir un arreglo o tener algun error,
* reporta en log la excepcion interna y regresa null</li></ul>
* @param jsonString
* @param key
* @return
*/
public static Object getObjInJson(String jsonString, String key){
Object objeto = null;
if(null!=jsonString && null!=key){
try {
JSONObject json = new JSONObject(jsonString);
objeto = json.get(key);
} catch (JSONException e) {
// System.err.println("Error al Convertir datos en Json");
// e.printStackTrace();
}
}
return objeto;
}
// /**
// * Obtiene el json contenido en un archivo plano .json desde el directorio default
// * @param jsonFileName
// * @return
// */
// public static String getJsonStringFromFile(String jsonFileName) {
// String jsonPath = JSONFILESDIR.concat(jsonFileName).concat(".json");
// System.out.println("path de busqueda: ".concat(jsonPath));
// String jsonFile = FileUtily.getBuilderNoTabsFile(jsonPath, null).toString();
//
// return jsonFile;
// }
public static Object getJsonObjFromString(String json){
Object jsonObject = null;
if(null !=json && !json.trim().equals("")){
System.out.println("json: ".concat(json));
try {
if(json.startsWith("{")){
System.out.println("es JSONObject");
JSONObject jsObj = new JSONObject(json);
return jsObj;
}else if(json.startsWith("[")){
System.out.println("es JSONArray");
JSONArray jsArr = new JSONArray(json);
return jsArr;
}
} catch (JSONException e) {
e.printStackTrace();
}
}
return jsonObject;
}
public static void main(String[] args) {
// //test_jsonFromMap
//test_mapFromJson();
//test_getObjInJson();
/*
String jsFile = "Tce/experienciasLaborales"; //"Tce/experiencia-41"; //"phoneJson/sanyo-zio";
String json = getJsonStringFromFile(jsFile); //sanyo-zio");
Object obj = getJsonObjFromString(json);
System.out.println("\n\n objeto json: \n");
System.out.println(obj); //*/
test_ResponseArea();
}
protected static void test_getObjInJson(){
String jsonStOk = "{\"code\":\"005\",\"type\":\"I\",\"message\":\"Fue modificado satisfactoriamente \"}";
String jsonStFail = "{\"code\":\"002\",\"type\":\"F\",\"message\":\"La construcci�n del message no es correcta, favor de verificar la especificaci�n correspondiente\"}";
String jsonStDetail = "[ {\"email\":\"mimail@pati@to.com\",\"code\":\"006\",\"type\":\"E\",\"message\":\" Pattern(email)\"}, {\"anioNacimiento\":\"dhhdfhdfhfdhdf\",\"code\":\"006\",\"type\":\"E\",\"message\":\"Range [1927,1995]\"}, {\"sexo\":\"5\",\"code\":\"006\",\"type\":\"E\",\"message\":\"ValueSet(0,1)\"}, {\"numeroDependientesEconomicos\":\"holatyuu\",\"code\":\"006\",\"type\":\"E\",\"message\":\" Restriction(numbers)\"} ]";
//1.jsonStOk debe mostrar I (type = I)
String type = getStringInJson(jsonStOk, "type"); //(String) getObjInJson(jsonStOk, "type");
System.out.println("jsonStOk: " + (type!=null?type:"type es null") );
//2.jsonStFail debe mostrar F (type = F)
type = (String) getObjInJson(jsonStFail, "type");
System.out.println("jsonStFail: " + (type!=null?type:"type es null") );
//2.jsonStFail debe mostrar null, porque genera excepcion al intentar convertir arreglo en Json (type = null)
type = getStringInJson(jsonStDetail, "type");
System.out.println("jsonStFail: " + (type!=null?type:"type es null") );
}
/**
* Muestra como obtener un Mapa a partir de un Json, el cual se genera y demuestra tambien que
* los valores que sean null no son almacenados en el JSONObject
*
*/
@SuppressWarnings("rawtypes")
protected static void test_mapFromJson(){
//el siguiente objeto se declara como null o con valor para probar que no se agrega al json siendo null
String nuleable = "noNUll";
try{
JSONObject json = new JSONObject();
json.put("idPersona", "147");
json.put("nombre", "paquito");
json.put("apellidoPaterno", "Perez");
json.put("apellidoMaterno", "Gomez");
json.put("correo", "PerezG@mail.com");
json.put("sexo", new Long(0));
json.put("fechaNacimiento", "01/02/03");
json.put("idEstatusInscripcion", "1");
json.put("urlImgPerfil", "http://localhost/imagen/uno.jpg");
json.put("idContenidoImgPerfil", "987");
json.put("nuleable", nuleable);
json.put("nuleable2", nuleable);
Map mapa = mapFromJson(json);
System.out.println("\n>>Tama�o del mapa: "+mapa.size());
System.out.println(mapa.toString());
}catch (Exception e) {
e.printStackTrace();
}
}
protected static void test_jsonFromMap(){
//Map<String, Object> mapaObj = new java.util.HashMap<String, Object>();
Map<String, Object> mapaObj = new java.util.TreeMap<String, Object>();
mapaObj.put("Cadena", "Aania");
mapaObj.put("Long", new Long(5));
mapaObj.put("Cadena2", "Acathan");
mapaObj.put("Booleano", false);
mapaObj.put("Fecha", new java.util.Date());
jsonFromMap(mapaObj);
}
protected static void test_ResponseArea(){
JSONArray jarrResponse = new JSONArray();
try{
for(int p=0;p<5;p++){
JSONObject joPadre = new JSONObject();
joPadre.put("id", (p+1) );
joPadre.put("nombre", "padre-"+(p+1) );
JSONArray jarrHijos = new JSONArray();
for(int h=0;h<2;h++){
JSONObject joHijo = new JSONObject();
joHijo.put("id", (p+1)+""+(h+1) );
joHijo.put("nombre", "hijo-"+(p+1)+(h+1) );
jarrHijos.put(joHijo);
}
System.out.println("hijos?"+jarrHijos.length());
joPadre.put("hijos", jarrHijos);
jarrResponse.put(joPadre);
}
}catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(jarrResponse);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
protected static void imprimeMapa(Map mapa){
Iterator<Map.Entry> i = mapa.entrySet().iterator();
while(i.hasNext()){
String key = (String)i.next().getKey();
System.out.println(key+", "+mapa.get(key));
}
}
/**
* Realiza un formateo para identar una Cadena Json
* @param jsonString
* @return
*/
public static String formatJson(String jsonString){
JsonParser parser = new JsonParser();
JsonElement el = parser.parse(jsonString);
Gson gson = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create();
jsonString = gson.toJson(el);
return jsonString;
}
}
| [
"netto.speed@gmail.com"
] | netto.speed@gmail.com |
7a817827cb3a42f182969cf779d97b99caabc66e | 53957fc3d0d42a39d92f2b352859a619f76693e5 | /app/src/main/java/com/example/textapp/utils/NumberUtils.java | eec6b83f6042394845aa7f558b55ace08d8859d1 | [] | no_license | vinicius-domiciano/Calculadora-android | 72a2b7fb93f30a120263ce166dc1637ac88f94f0 | 4d04997e1e5bb835c716d76ecfcc5b5e0101006d | refs/heads/main | 2023-06-08T18:36:52.702385 | 2021-06-25T00:17:33 | 2021-06-25T00:17:33 | 380,080,623 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,003 | java | package com.example.textapp.utils;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.text.DecimalFormat;
public class NumberUtils {
private static final String FORMAT_PATTERN_BR = "0.###";
private NumberUtils() {
}
public static Boolean isNumber(Object value) {
if (value instanceof Integer || value instanceof Long || value instanceof Double || value instanceof Float || value instanceof BigDecimal || value instanceof BigInteger)
return Boolean.TRUE;
return Boolean.FALSE;
}
public static String formatNumberBR(Object value) {
if (Boolean.FALSE.equals(NumberUtils.isNumber(value)))
throw new RuntimeException("O valor deve ser um numero");
BigDecimal bigDecimal = new BigDecimal(value.toString());
DecimalFormat df = new DecimalFormat(FORMAT_PATTERN_BR);
df.setMinimumFractionDigits(0);
df.setMaximumFractionDigits(24);
return df.format(bigDecimal);
}
}
| [
"viniciusalexdomiciano@gmail.com"
] | viniciusalexdomiciano@gmail.com |
2edd9e77d5ca3e415cfc3ff386958f8c99490a40 | 2da96bc097dbd3b592c3f167b978e6547e5685e0 | /org.eclipse.gmt.modisco.java.edit/src/org/eclipse/gmt/modisco/java/emf/provider/AbstractVariablesContainerItemProvider.java | 260d3de0850698f9d1f9d16c692d792ee4534c99 | [] | no_license | Kenpachi90/SoMoX | 72aa736cc379b92e84319e8582328a07a0ecb43e | 5c6cc6d4cdee42c890a2785b1c0e296aae63e861 | refs/heads/master | 2021-01-10T16:49:17.135635 | 2015-11-12T10:54:48 | 2015-11-12T10:54:48 | 45,184,788 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,820 | java | /**
* *******************************************************************************
* Copyright (c) 2009 Mia-Software.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Sebastien Minguet (Mia-Software) - initial API and implementation
* Frederic Madiot (Mia-Software) - initial API and implementation
* Fabien Giquel (Mia-Software) - initial API and implementation
* Gabriel Barbier (Mia-Software) - initial API and implementation
* Erwan Breton (Sodifrance) - initial API and implementation
* Romain Dervaux (Mia-Software) - initial API and implementation
* *******************************************************************************
*/
package org.eclipse.gmt.modisco.java.emf.provider;
import java.util.Collection;
import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import org.eclipse.emf.edit.provider.ViewerNotification;
import org.eclipse.gmt.modisco.java.AbstractVariablesContainer;
import org.eclipse.gmt.modisco.java.emf.JavaFactory;
import org.eclipse.gmt.modisco.java.emf.JavaPackage;
/**
* This is the item provider adapter for a {@link org.eclipse.gmt.modisco.java.AbstractVariablesContainer} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class AbstractVariablesContainerItemProvider
extends ASTNodeItemProvider
implements
IEditingDomainItemProvider,
IStructuredItemContentProvider,
ITreeItemContentProvider,
IItemLabelProvider,
IItemPropertySource {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public AbstractVariablesContainerItemProvider(AdapterFactory adapterFactory) {
super(adapterFactory);
}
/**
* This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
}
return itemPropertyDescriptors;
}
/**
* This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
* {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
* {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
if (childrenFeatures == null) {
super.getChildrenFeatures(object);
childrenFeatures.add(JavaPackage.eINSTANCE.getAbstractVariablesContainer_Type());
childrenFeatures.add(JavaPackage.eINSTANCE.getAbstractVariablesContainer_Fragments());
}
return childrenFeatures;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EStructuralFeature getChildFeature(Object object, Object child) {
// Check the type of the specified child object and return the proper feature to use for
// adding (see {@link AddCommand}) it as a child.
return super.getChildFeature(object, child);
}
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
return getString("_UI_AbstractVariablesContainer_type");
}
/**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(AbstractVariablesContainer.class)) {
case JavaPackage.ABSTRACT_VARIABLES_CONTAINER__TYPE:
case JavaPackage.ABSTRACT_VARIABLES_CONTAINER__FRAGMENTS:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
return;
}
super.notifyChanged(notification);
}
/**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
newChildDescriptors.add
(createChildParameter
(JavaPackage.eINSTANCE.getAbstractVariablesContainer_Type(),
JavaFactory.eINSTANCE.createTypeAccess()));
newChildDescriptors.add
(createChildParameter
(JavaPackage.eINSTANCE.getAbstractVariablesContainer_Fragments(),
JavaFactory.eINSTANCE.createVariableDeclarationFragment()));
newChildDescriptors.add
(createChildParameter
(JavaPackage.eINSTANCE.getAbstractVariablesContainer_Fragments(),
JavaFactory.eINSTANCE.createUnresolvedVariableDeclarationFragment()));
}
}
| [
"Tabea Sims"
] | Tabea Sims |
eb8bb7c95c913f5fd866475cb4586ddc2a276fbe | e2b11aff7abcc16f84d3f51cf45c984ef917d409 | /src/main/java/cubex2/cs3/ingame/gui/control/PlayerInventoryArea.java | 91dd091806a53747a8222300550b3749a51c93d7 | [] | no_license | Lollipop-Studio/CustomStuff3 | 45221ecafbb0f3bd20f3b7cf0499e0f6e434e172 | 0cdba13acf5bdace1e2a582f75797c65f31aeb6a | refs/heads/1710 | 2023-03-26T02:32:17.085531 | 2021-03-20T03:29:13 | 2021-03-20T03:29:13 | 342,443,904 | 0 | 0 | null | 2021-03-20T03:29:13 | 2021-02-26T02:49:24 | null | UTF-8 | Java | false | false | 989 | java | package cubex2.cs3.ingame.gui.control;
import cubex2.cs3.util.GuiHelper;
public class PlayerInventoryArea extends Control
{
public PlayerInventoryArea(Anchor anchor, int offsetX, int offsetY, Control parent)
{
super(9 * 18, 76, anchor, offsetX, offsetY, parent);
}
@Override
public void draw(int mouseX, int mouseY, float renderTick)
{
if (rootControl.drawSlots)
{
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 9; j++)
{
int x = getX() + 1 + j * 18;
int y = getY() + 1 + i * 18;
GuiHelper.drawRect(x, y, x + 16, y + 16, 0x770000dd);
}
}
for (int i = 0; i < 9; i++)
{
int x = getX() + 1 + i * 18;
int y = getY() + getHeight() - 17;
GuiHelper.drawRect(x, y, x + 16, y + 16, 0x770000dd);
}
}
}
}
| [
"beanflame@163.com"
] | beanflame@163.com |
a8fc732a6926bfd9a8b0ee936208e47f6143a767 | bdada8dd2fee5ed621fb4663adf2ae91edf7f390 | /xc-rep/src/main/java/com/xzsoft/xsr/core/mapper/FjCellFormulaMapper.java | 2aaf2afdc67ede051f1960f470d576e1973c5d35 | [] | no_license | yl23250/xc | abaf7dbbdf1ec3b32abe16a1aeca19ee29568387 | 47877dc79e8ea8947f526bb21a1242cae5d70dd8 | refs/heads/master | 2020-09-16T20:49:54.040706 | 2018-06-23T13:25:56 | 2018-06-23T13:25:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,124 | java | package com.xzsoft.xsr.core.mapper;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.xzsoft.xsr.core.modal.CellData;
import com.xzsoft.xsr.core.modal.CellFormula;
import com.xzsoft.xsr.core.modal.DataDTO;
public interface FjCellFormulaMapper {
/**
* 批量插入采集公式
* @param formatCells
* @throws Exception
*/
public void insertBatchCellFormat(@Param(value="formatCells") List<CellFormula> formatCells) throws Exception;
/**
* 根据行列指标删除采集公式
* @param rowitemId
* @param colitemId
* @throws Exception
*/
public void deleteByRC(String rowitemId,String colitemId,String entity,String suit_id)throws Exception;
/**
* 根据行列指标查找采集公式是否存在
* @param rowitemId
* @param colitemId
* @throws Exception
*/
public int isExistByRC(String rowitemId,String colitemId,String entity,String suit_id)throws Exception;
/**
* 根据行列指标查公式ID
* @param rowitemId
* @param colitemId
* @throws Exception
*/
public String selectIdByRC(String rowitemId,String colitemId,String entity,String suit_id)throws Exception;
/**
* 根据行列指标更新公式
* @param rowitemId
* @param colitemId
* @throws Exception
*/
public void updateByID(CellFormula cellFormula)throws Exception;
/**
* 根据MSFORMAT_ID加载数据单元格
* @param msFormatId
* @return
* @throws Exception
*/
public List<CellData> loadValue(String msFormatId,String entity_id,String suitId) throws Exception;
/**
* 查询字典表中的期间信息
* @return
* @throws Exception
*/
public List<DataDTO> getDictPeriod() throws Exception;
/**
* 查询期间信息
* @param ls
* @return
*/
public DataDTO getPeriodByCode(String suit_id,String code)throws Exception;
/**
* 查询公司信息
* @param ls
* @return
*/
public DataDTO getEntityByCode(String suit_id,String code)throws Exception;
/**
* 查询行指标信息
* @param ls
* @return
*/
public DataDTO getRowByCode(String suit_id,String code)throws Exception;
/**
* 查询列指标信息
* @param ls
* @return
*/
public DataDTO getColByCode(String suit_id,String code)throws Exception;
/**
* 查询行指标name
* @param ls
* @return
*/
public String getRowNameById(String suit_id,String id)throws Exception;
/**
* 查询列指标name
* @param ls
* @return
*/
public String getColNameById(String suit_id,String id)throws Exception;
/**
* 查询币种信息
* @param ls
* @return
*/
public DataDTO getCnyByCode(String suit_id,String code)throws Exception;
/**
* 查询指标公式值
* @param ls
* @return
*/
public String getRepValue(Map map)throws Exception;
/**
* 查询FUN_DB_SUB
* @param ls
* @return
*/
public String getFUN_DB_SUB(String FUN_CODE)throws Exception;
/**
* 调用测试存储过程
* @param ls
* @return
*/
public String testByProc(Map map)throws Exception;
/**
* 通过模板ID查询出该模板的公共级公式, 如果isOnlyImpRepFormula=‘true’,只导出REP类型公式
* @param modalsheetId
* @param suitId
* @param isOnlyImpRepFormula
* @return
* @throws Exception
*/
public List<CellFormula> getRepFormulaList(HashMap<String, String> params) throws Exception;
/**
* 通过模板ID查询出该模板的固定公式,单位级公式优先,供报表生成/数据采集调用, 如果fType=‘true’,只查询REP类型公式
* by songyh 2016-01-27
* @param modalsheetId
* @param suitId
* @param isOnlyImpRepFormula
* @return
* @throws Exception
*/
public List<CellFormula> getCalFormulaList(HashMap<String, String> params) throws Exception;
/**
* 通过模板id,删除该模板上的公共级采集公式
* @param modalsheetId
* @param suitId
* @throws Exception
*/
public void deleteCalFormula(HashMap<String, String> params) throws Exception;
}
| [
"381666890@qq.com"
] | 381666890@qq.com |
ecb675d8ac8057d44a506d5dff1d17caeec20332 | 549889c63bc2a8f9296c270c5c019c5e09c5e534 | /01Search_Android/src/android/activity/ProjetoActivity.java | 8e8eb8a7ca6e7fc3099011169c36d473ecac88ab | [] | no_license | fvasc/APP_01Search | 73e6b4403b056e25e822382532ca369d4c16688e | f2b7de080b6e2adbfd37575dc6a63d287523cc0a | refs/heads/master | 2021-01-10T11:06:42.670209 | 2016-03-27T22:40:04 | 2016-03-27T22:40:04 | 54,850,212 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,437 | java | package android.activity;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.RelativeLayout;
import android.widget.TabHost;
import android.widget.TabHost.OnTabChangeListener;
public class ProjetoActivity extends TabActivity {
/** Called when the activity is first created. */
private TabHost tabHost;
private RelativeLayout menu;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
menu = (RelativeLayout) findViewById(R.id.relativeLayout_main);
Resources res = getResources(); // Resource object to get Drawables
tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Resusable TabSpec for each tab
Intent intent; // Reusable Intent for each tab
intent = new Intent().setClass(this, NovidadesActivity.class);
spec = tabHost.newTabSpec("0").setIndicator("Novidades", res.getDrawable(R.drawable.novo)).setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, DepartamentosActivity.class);
spec = tabHost.newTabSpec("1").setIndicator("Categorias", res.getDrawable(R.drawable.categorias)).setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, BuscaActivity.class);
spec = tabHost.newTabSpec("2").setIndicator("Buscar", res.getDrawable(R.drawable.lupa)).setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, ListaActivity.class);
spec = tabHost.newTabSpec("3").setIndicator("Listas", res.getDrawable(R.drawable.cart)).setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, MaisActivity.class);
spec = tabHost.newTabSpec("4").setIndicator("Mais", res.getDrawable(R.drawable.mnmais)).setContent(intent);
tabHost.addTab(spec);
tabHost.setCurrentTab(0);
limparBarra();
}
private void limparBarra() {
tabHost.setOnTabChangedListener(new OnTabChangeListener(){
public void onTabChanged(String tabId) {
if(tabId.equals("3")){
menu.setVisibility(menu.GONE);
}else{
menu.setVisibility(menu.VISIBLE);
}
}});
}
}
| [
"felipe_vasconcelos@outlook.com"
] | felipe_vasconcelos@outlook.com |
ea1530d52a93427312fb7adcd20afbeadbf4ff13 | c6dd2c5401a79713c0e0be9682e94fcf2cc25660 | /tapestry-framework/src/org/apache/tapestry/components/Foreach.java | e43ef9db0a52a4aac24e780c6ac85acf3bc19c42 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | JLLeitschuh/tapestry3 | ea494ea6e8b341d05c575536aac7fe4ac6cc073e | c4ab183a5e85f66f1611248b35acae8e6990c4cc | refs/heads/trunk | 2021-01-02T12:58:44.835155 | 2008-07-31T22:04:05 | 2008-07-31T22:04:05 | 239,634,215 | 0 | 0 | Apache-2.0 | 2020-11-17T04:38:44 | 2020-02-10T23:21:08 | null | UTF-8 | Java | false | false | 4,675 | java | // Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.apache.tapestry.components;
import java.util.Iterator;
import org.apache.tapestry.AbstractComponent;
import org.apache.tapestry.IBinding;
import org.apache.tapestry.IMarkupWriter;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.Tapestry;
/**
* Repeatedly renders its wrapped contents while iterating through
* a list of values.
*
* [<a href="../../../../../ComponentReference/Foreach.html">Component Reference</a>]
*
* <p>
* While the component is rendering, the property
* {@link #getValue() value} (accessed as
* <code>components.<i>foreach</i>.value</code>
* is set to each successive value from the source,
* and the property
* {@link #getIndex() index} is set to each successive index
* into the source (starting with zero).
*
* @author Howard Lewis Ship
* @version $Id$
*
**/
public abstract class Foreach extends AbstractComponent
{
private Object _value;
private int _index;
private boolean _rendering;
public abstract IBinding getIndexBinding();
/**
* Gets the source binding and returns an {@link Iterator}
* representing
* the values identified by the source. Returns an empty {@link Iterator}
* if the binding, or the binding value, is null.
*
* <p>Invokes {@link Tapestry#coerceToIterator(Object)} to perform
* the actual conversion.
*
**/
protected Iterator getSourceData()
{
Object source = getSource();
if (source == null)
return null;
return Tapestry.coerceToIterator(source);
}
public abstract IBinding getValueBinding();
/**
* Gets the source binding and iterates through
* its values. For each, it updates the value binding and render's its wrapped elements.
*
**/
protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
{
Iterator dataSource = getSourceData();
// The dataSource was either not convertable, or was empty.
if (dataSource == null)
return;
try
{
_rendering = true;
_value = null;
_index = 0;
IBinding indexBinding = getIndexBinding();
IBinding valueBinding = getValueBinding();
String element = getElement();
boolean hasNext = dataSource.hasNext();
while (hasNext)
{
_value = dataSource.next();
hasNext = dataSource.hasNext();
if (indexBinding != null)
indexBinding.setInt(_index);
if (valueBinding != null)
valueBinding.setObject(_value);
if (element != null)
{
writer.begin(element);
renderInformalParameters(writer, cycle);
}
renderBody(writer, cycle);
if (element != null)
writer.end();
_index++;
}
}
finally
{
_value = null;
_rendering = false;
}
}
/**
* Returns the most recent value extracted from the source parameter.
*
* @throws org.apache.tapestry.ApplicationRuntimeException if the Foreach is not currently rendering.
*
**/
public Object getValue()
{
if (!_rendering)
throw Tapestry.createRenderOnlyPropertyException(this, "value");
return _value;
}
public abstract String getElement();
public abstract Object getSource();
/**
* The index number, within the {@link #getSource() source}, of the
* the current value.
*
* @throws org.apache.tapestry.ApplicationRuntimeException if the Foreach is not currently rendering.
*
* @since 2.2
*
**/
public int getIndex()
{
if (!_rendering)
throw Tapestry.createRenderOnlyPropertyException(this, "index");
return _index;
}
} | [
"jkuhnert@apache.org"
] | jkuhnert@apache.org |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.