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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
75cfe6ff47078cd26aae1d49f0a708b1e54ceb72 | a34e27929947e7051150a5169d1694daea4cf33a | /src/br/integrado/jnpereira/nutrimix/modelo/Funcionario.java | f4b76ad7b6e3be6f4e939866374aa7782a43a529 | []
| no_license | joseviniciusnunes/sisgecom | d7021ddc1356bb5529545b9782cd670a32b62c3a | 17c7d4f63779dcb20610ae8c8ba944a6a5495c7f | refs/heads/master | 2022-08-18T23:17:11.725325 | 2017-12-06T22:55:57 | 2017-12-06T22:55:57 | 102,540,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,143 | java | package br.integrado.jnpereira.nutrimix.modelo;
import br.integrado.jnpereira.nutrimix.dao.AutoIncrement;
import br.integrado.jnpereira.nutrimix.dao.Coluna;
import br.integrado.jnpereira.nutrimix.dao.Id;
import br.integrado.jnpereira.nutrimix.dao.Tabela;
import java.util.Date;
@Tabela(nome = "funcionario")
public class Funcionario {
@Id
@AutoIncrement
@Coluna(nome = "cd_funcionario")
private Integer cdFuncionario;
@Coluna(nome = "cd_pessoa")
private Integer cdPessoa;
@Coluna(nome = "dt_admissao")
private Date dtAdmissao;
@Coluna(nome = "dt_demissao")
private Date dtDemissao;
@Coluna(nome = "nr_pis")
private String nrPis;
@Coluna(nome = "ds_cargo")
private String dsCargo;
@Coluna(nome = "cd_usercad")
private Integer cdUserCad;
@Coluna(nome = "dt_cadastro")
private Date dtCadastro;
public Integer getCdFuncionario() {
return cdFuncionario;
}
public void setCdFuncionario(Integer cdFuncionario) {
this.cdFuncionario = cdFuncionario;
}
public Integer getCdPessoa() {
return cdPessoa;
}
public void setCdPessoa(Integer cdPessoa) {
this.cdPessoa = cdPessoa;
}
public Date getDtAdmissao() {
return dtAdmissao;
}
public void setDtAdmissao(Date dtAdmissao) {
this.dtAdmissao = dtAdmissao;
}
public Date getDtDemissao() {
return dtDemissao;
}
public void setDtDemissao(Date dtDemissao) {
this.dtDemissao = dtDemissao;
}
public String getNrPis() {
return nrPis;
}
public void setNrPis(String nrPis) {
this.nrPis = nrPis;
}
public String getDsCargo() {
return dsCargo;
}
public void setDsCargo(String dsCargo) {
this.dsCargo = dsCargo;
}
public Integer getCdUserCad() {
return cdUserCad;
}
public void setCdUserCad(Integer cdUserCad) {
this.cdUserCad = cdUserCad;
}
public Date getDtCadastro() {
return dtCadastro;
}
public void setDtCadastro(Date dtCadastro) {
this.dtCadastro = dtCadastro;
}
}
| [
"[email protected]"
]
| |
cbfeed7d8021d09110e5169e9393c2485201e068 | 6e83d4f8962f5e0d2ea5b7d189b2781728b00de9 | /spring-web-boot-demo2/src/main/java/com/wellsfargo/fsd/swbd/SpringWebBootDemo2Application.java | 25d0310b4e2df84c4285fecf34fe65cea55435a0 | []
| no_license | Amir-Git7861/hibernate1 | 77c91925d2e5c8be75a485400e492e80fab6b576 | 811b3a397b80efbeef8ba2f0bdff05d40b1ccf29 | refs/heads/main | 2023-02-05T13:09:56.705740 | 2020-12-27T12:20:34 | 2020-12-27T12:20:34 | 324,750,593 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 340 | java | package com.wellsfargo.fsd.swbd;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringWebBootDemo2Application {
public static void main(String[] args) {
SpringApplication.run(SpringWebBootDemo2Application.class, args);
}
}
| [
"[email protected]"
]
| |
42d7145d101f995be4d44fec13818262237782f2 | da889968b2cc15fc27f974e30254c7103dc4c67e | /Optimization Algorithm_GUI/src/Algorithm_Carpool/NSDE_POP/U_Individual.java | 95bc2c3f699370988616c953472e0a5269aeb9ff | []
| no_license | say88888/My_Project_thesis | fcd4d96b34de8627fa054146eb6164b7c3636344 | 04908ea3ed6b7a9c1939a5d8e16dfc65d66437f4 | refs/heads/master | 2020-04-10T08:32:37.106239 | 2018-12-08T05:52:44 | 2018-12-08T05:52:44 | 160,908,221 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,000 | java | package Algorithm_Carpool.NSDE_POP;
import java.util.Random;
public class U_Individual extends NSDE_POP{
static int defaultGeneLengthX = Xsize;
private double[] Ux = new double[defaultGeneLengthX];
private int[] binaryUx = new int[defaultGeneLengthX];
static int defaultGeneLengthY = Ysize;
private double[] Uy = new double[defaultGeneLengthY];
private int[] binaryUy = new int[defaultGeneLengthY];
// Cache
private double fitness = 0;
private double fitness1 = 0;
Random ran = new Random();
public void XglobalIndividual() {
defaultGeneLengthX = Xsize;
Ux = new double[defaultGeneLengthX];
binaryUx = new int[defaultGeneLengthX];
for (int i = 0; i < Uxsize(); i++) {
Ux[i] = DE_Read_Write_txt.random_generate_or_read4(Execution_Mode);
double rsid = DE_Read_Write_txt
.random_generate_or_read1(Execution_Mode);
if (rsid < 1 / (1 + Math.exp(-lamda * Ux[i]))) {
binaryUx[i] = 1;
} else {
binaryUx[i] = 0;
}
}
}
public void YglobalIndividual() {
defaultGeneLengthY = Ysize;
Uy = new double[defaultGeneLengthY];
binaryUy = new int[defaultGeneLengthY];
for (int i = 0; i < Uysize(); i++) {
Uy[i] = DE_Read_Write_txt.random_generate_or_read4(Execution_Mode);
double rsid = DE_Read_Write_txt
.random_generate_or_read1(Execution_Mode);
if (rsid < 1 / (1 + Math.exp(-lamda * Uy[i]))) {
binaryUy[i] = 1;
} else {
binaryUy[i] = 0;
}
}
}
/* Getters and setters */
// Use this if you want to create individuals with different gene lengths
// 如果你想創建具有不同基因的長度個體使用本
public static void setDefaultGeneLengthX(int length) {
defaultGeneLengthX = length;
}
public static void setDefaultGeneLengthY(int length) {
defaultGeneLengthY = length;
}
public double getUx(int index) {
return Ux[index];
}
public double getUy(int index) {
return Uy[index];
}
public void setUx(int index, double value) {
Ux[index] = value;
fitness = 0;
fitness1 = 0;
}
public void setUy(int index, double value) {
Uy[index] = value;
fitness = 0;
fitness1 = 0;
}
public int getbinaryUx(int index) {
return binaryUx[index];
}
public int getbinaryUy(int index) {
return binaryUy[index];
}
public void setbinaryUx(int index, int value) {
binaryUx[index] = value;
fitness = 0;
fitness1 = 0;
}
public void setbinaryUy(int index, int value) {
binaryUy[index] = value;
fitness = 0;
fitness1 = 0;
}
/* Public methods */
public int Uxsize() {
return Ux.length;
}
public int Uysize() {
return Uy.length;
}
public double getFitness1() {
if (fitness == 0) {
fitness = FitnessCalc.getUFitness(this);
}
return fitness;
}
public void setfitness() {
fitness = 0;
}
// Cache
@Override
public String toString() {
String geneString = "";
for (int i = 0; i < Uysize(); i++) {
geneString += getUy(i);
}
geneString += ",";
for (int i = 0; i < Uxsize(); i++) {
geneString += getUx(i);
}
return geneString;
}
} | [
"[email protected]"
]
| |
baa02150726c57418e0c739824ca1a31bfccd2d3 | 90c75b85f009793bcaeae6e30cbc93f435702a95 | /InetAddressTest.java | 5db611c5e00ab2903037a656b7256c64aec3d704 | []
| no_license | Sivakrishna-22/java-Programs | 9a3cf2d12ee8e250a7e7c826b599f70088e2d918 | bdb2f7edc0b0558d8d9b15c5d6f2ca91739db063 | refs/heads/master | 2022-12-17T12:05:50.799024 | 2020-09-25T16:15:00 | 2020-09-25T16:15:00 | 295,463,029 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 621 | java | import java.net.*;
class InetAddressTest
{
public static void main(String args[])throws Exception
{
InetAddress address=InetAddress.getLocalHost();
System.out.println(address.getHostAddress());
System.out.println(address.getHostName());
System.out.println(address.hashCode());
System.out.println(address.isMulticastAddress());
System.out.println(address.toString());
address=InetAddress.getByName("suryasiva");
System.out.println("Address:2 is "+address);
System.out.println(address.toString());
boolean x=false;
x=address.equals(address);
System.out.println(x);
}
} | [
"[email protected]"
]
| |
8e6978c99efbdd9f33d2ea77d3f477bef1cfb093 | 56fc2a51a5f3d0e79fefedb665ea32416b0fab01 | /app/src/main/java/max/jy/hzl/newgeeknews/mokuai/wechat/serchfragment/SearchM.java | ce262c5966fbe112b60769f75ba35f344521ded1 | []
| no_license | HaoZhiLin/NewGeekNews | f52a609965b2525028c9def3cfa60eea475c321c | def2c56a654aca4f92dec8f858a0bafdb7463d58 | refs/heads/master | 2020-06-07T21:35:56.127211 | 2019-06-21T12:54:51 | 2019-06-21T12:54:51 | 193,097,904 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,421 | java | package max.jy.hzl.newgeeknews.mokuai.wechat.serchfragment;
import io.reactivex.Observable;
import io.reactivex.disposables.Disposable;
import max.jy.hzl.newgeeknews.api.ApiService;
import max.jy.hzl.newgeeknews.base.BaseCallback;
import max.jy.hzl.newgeeknews.base.BaseModel;
import max.jy.hzl.newgeeknews.net.BaseObserver;
import max.jy.hzl.newgeeknews.net.HttpUtils;
import max.jy.hzl.newgeeknews.net.RxUtils;
public class SearchM extends BaseModel {
public void getData(String data, final BaseCallback<SearchBean> searchBeanBaseCallback) {
Observable<SearchBean> searchData = HttpUtils.getInstance().getData(ApiService.searchUrl, ApiService.class)
.getSearchData(data);
searchData.compose(RxUtils.<SearchBean>rxObserableSchedulerHelper())
.subscribe(new BaseObserver<SearchBean>() {
@Override
public void onSubscribe(Disposable d) {
compositeDisposable.add(d);
}
@Override
public void onNext(SearchBean searchBean) {
if(searchBean!=null){
searchBeanBaseCallback.getSuccessData(searchBean);
}else {
searchBeanBaseCallback.getFailedData("请求失败!");
}
}
});
}
}
| [
"[email protected]"
]
| |
9adc48d9203bf09309f8dfbabfb368e4a0791d30 | 5a532918fc9662f44e4bf44d66b77e650685ecd5 | /src/shaders/StaticShader.java | 2a22b6984cd75810dd22f6d7dfb3122cacc84569 | []
| no_license | ransomx/LTE_LWJGL | c1088b4758831936d303856fa6596e3a4f782884 | d7c5f123b8c82e871ddd33a9e0f1606e4e513554 | refs/heads/master | 2021-01-23T03:59:46.364530 | 2015-05-03T13:18:49 | 2015-05-03T13:18:49 | 34,984,945 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,251 | 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 shaders;
import Entities.Camera;
import Entities.Light;
import java.util.List;
import org.lwjgl.util.vector.Matrix4f;
import org.lwjgl.util.vector.Vector3f;
import toolBox.Maths;
/**
*
* @author Dominik
*/
public class StaticShader extends ShaderProgram {
private static final int MAX_LIGHTS = 10;
private static final String VERTEX_FILE = "src/shaders/vertexShader.txt";
private static final String FRAGMENT_FILE = "src/shaders/fragmentShader.txt";
private int location_transformationMatrix;
private int location_projectionMatrix;
private int location_viewMatrix;
private int location_ambient;
private int location_diffuseSwitch;
private int location_ambientSwitch;
private int location_specularSwitch;
private int location_diffuseMultiplier;
private int location_specularMultiplier;
private int location_lightPosition[];
private int location_lightColour[];
private int location_attenuation[];
private int location_shineDamper;
private int location_reflectivity;
public StaticShader() {
super(VERTEX_FILE, FRAGMENT_FILE);
}
/**
* Determines how is our shader file structured and linked to VAO,
* tells the shader that position 0 contains position data (in shader variable), etc.
*/
@Override
protected void bindAttributes() {
super.bindAttribute(0, "position");
super.bindAttribute(1, "textureCoords");
super.bindAttribute(2, "normal");
}
@Override
protected void getAllUniformLocations() {
location_transformationMatrix = super.getUniformLocation("transformationMatrix");
location_projectionMatrix = super.getUniformLocation("projectionMatrix");
location_viewMatrix = super.getUniformLocation("viewMatrix");
location_shineDamper = super.getUniformLocation("shineDamper");
location_reflectivity = super.getUniformLocation("reflectivity");
location_diffuseSwitch = super.getUniformLocation("diffuseSwitch");
location_specularSwitch = super.getUniformLocation("specularSwitch");
location_ambientSwitch = super.getUniformLocation("ambientSwitch");
location_ambient = super.getUniformLocation("ambientLight");
location_diffuseMultiplier = super.getUniformLocation("diffuseMultiplier");
location_specularMultiplier = super.getUniformLocation("specularMultiplier");
location_lightPosition = new int[MAX_LIGHTS];
location_lightColour = new int[MAX_LIGHTS];
location_attenuation = new int[MAX_LIGHTS];
for (int i = 0; i < MAX_LIGHTS; i++) {
location_lightPosition[i] = super.getUniformLocation("lightPosition[" + i + "]");
location_lightColour[i] = super.getUniformLocation("lightColour[" + i + "]");
location_attenuation[i] = super.getUniformLocation("attenuation[" + i + "]");
}
}
public void loadShineVariables(float damper, float reflectivity) {
super.loadFloat(location_shineDamper, damper);
super.loadFloat(location_reflectivity, reflectivity);
}
public void loadLights(List<Light> lights) {
for (int i = 0; i < MAX_LIGHTS; i++) {
if (i < lights.size()) {
super.loadVector(location_lightPosition[i], lights.get(i).getPosition());
super.loadVector(location_lightColour[i], lights.get(i).getColour());
super.loadVector(location_attenuation[i], lights.get(i).getAttenuation());
} else {
super.loadVector(location_lightPosition[i], new Vector3f(0, 0, 0));
super.loadVector(location_lightColour[i], new Vector3f(0, 0, 0));
super.loadVector(location_attenuation[i], new Vector3f(1, 0, 0)); //divide by zero in shader if 0,0,0
}
}
}
public void loadDiffuseSwitch() {
super.loadBoolean(location_diffuseSwitch, ShaderVariables.diffuseSwitch);
}
public void loadSpecularSwitch() {
super.loadBoolean(location_specularSwitch, ShaderVariables.specularSwitch);
}
public void loadAmbientSwitch() {
super.loadBoolean(location_ambientSwitch, ShaderVariables.ambientSwitch);
}
public void loadDiffuseMultiplier() {
super.loadFloat(location_diffuseMultiplier, ShaderVariables.diffuseModifier);
}
public void loadSpecularMultiplier() {
super.loadFloat(location_specularMultiplier, ShaderVariables.specularModifier);
}
public void loadAmbientLight() {
super.loadFloat(location_ambient, ShaderVariables.ambientModifier);
}
public void loadTransformationMatrix(Matrix4f matrix) {
super.loadMatrix(location_transformationMatrix, matrix);
}
public void loadProjectionMatrix(Matrix4f projection) {
super.loadMatrix(location_projectionMatrix, projection);
}
public void loadViewMatrix(Camera camera) {
Matrix4f viewMatrix = Maths.createViewMatrix(camera);
super.loadMatrix(location_viewMatrix, viewMatrix);
}
}
| [
"[email protected]"
]
| |
4f3744ea17c96d2ee36e22605c72e5c6875e751c | 4bae3208f7365cea15acf3fb359207226d1f64bb | /modeshape-jcr/src/main/java/org/modeshape/jcr/TimeoutException.java | de22467975203c83648587cec78e2135cef03f7c | [
"Apache-2.0"
]
| permissive | teiid/teiid-modeshape | ad4c7622d4c7f8297684600177334ef8af66c397 | 8dffe84d2cc7d8b7e48f84efc49a1b0a5e46faa6 | refs/heads/master | 2023-09-01T07:34:07.609074 | 2019-07-26T16:57:25 | 2019-07-26T16:57:25 | 114,037,491 | 0 | 6 | Apache-2.0 | 2022-06-21T01:23:43 | 2017-12-12T20:46:38 | Java | UTF-8 | Java | false | false | 1,550 | java | /*
* ModeShape (http://www.modeshape.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.modeshape.jcr;
/**
* An exception that signals a timeout has occurred.
*/
public class TimeoutException extends RuntimeException {
private static final long serialVersionUID = 1L;
/**
* Create a new timeout exception with the specified message and cause.
*
* @param message the message
* @param rootCause the cause
*/
public TimeoutException( String message,
Throwable rootCause ) {
super(message, rootCause);
}
/**
* Create a new timeout exception with the specified message and cause.
*
* @param message the message
*/
public TimeoutException( String message ) {
super(message);
}
/**
* Create a new timeout exception with the specified message and cause.
*
* @param rootCause the cause
*/
public TimeoutException( Throwable rootCause ) {
super(rootCause);
}
}
| [
"[email protected]"
]
| |
84be20dfe74424722e964deacf479c424178e4fd | ce49ecc2ce97f25466bb203c8918d042459904ef | /app/src/main/java/com/example/tb/xiaomiweather/Weather.java | a32686dcaa430d49795e85614a45b44041778f18 | []
| no_license | binbinqq86/XiaoMiWeather | d38a54e4effa62f0f55255f1f230ad0483aad2a3 | 92c2d6a88c2278df4a161834f09710293bba44d4 | refs/heads/master | 2021-01-21T18:34:34.242838 | 2017-05-25T09:00:29 | 2017-05-25T09:00:29 | 92,063,086 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,103 | java | package com.example.tb.xiaomiweather;
/**
* Created by tb on 2017/5/22.
*/
public class Weather {
/**
* 周几
*/
private String week;
/**
* 日期
*/
private String date;
/**
* 白天天气
*/
private String weatherDay;
/**
* 晚上天气
*/
private String weatherNight;
/**
* 风向
*/
private String wind;
/**
* 风力
*/
private String windLevel;
/**
* 最高温度
*/
private int highTemperature;
/**
* 最低温度
*/
private int lowTemperature;
/**
* 空气质量
*/
private String airQuality;
public String getWeek() {
return week;
}
public void setWeek(String week) {
this.week = week;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getWeatherDay() {
return weatherDay;
}
public void setWeatherDay(String weatherDay) {
this.weatherDay = weatherDay;
}
public String getWeatherNight() {
return weatherNight;
}
public void setWeatherNight(String weatherNight) {
this.weatherNight = weatherNight;
}
public String getWind() {
return wind;
}
public void setWind(String wind) {
this.wind = wind;
}
public String getWindLevel() {
return windLevel;
}
public void setWindLevel(String windLevel) {
this.windLevel = windLevel;
}
public int getHighTemperature() {
return highTemperature;
}
public void setHighTemperature(int highTemperature) {
this.highTemperature = highTemperature;
}
public int getLowTemperature() {
return lowTemperature;
}
public void setLowTemperature(int lowTemperature) {
this.lowTemperature = lowTemperature;
}
public String getAirQuality() {
return airQuality;
}
public void setAirQuality(String airQuality) {
this.airQuality = airQuality;
}
}
| [
"[email protected]"
]
| |
ecf520d57d60087ece36e0905051bb6db78db35b | 76c528c7ee1f094a032dd474fbdb6f7fb29a0b3a | /src/main/java/jpabook/jpashop/domain/item/Album.java | 75a380acbbef46819c5eede59c2c50533e704029 | []
| no_license | wxxsoo/jpashop | bb3a5f386a3d0f8e621045af391e78b3b247f541 | 8274246f16504696d906029c87b662ee1cd02498 | refs/heads/master | 2021-04-04T08:27:44.598438 | 2020-03-19T07:48:11 | 2020-03-19T07:48:11 | 248,440,990 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 351 | java | package jpabook.jpashop.domain.item;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
/**
* Created by wansoo.
* User: accomplishlee
*/
@Entity
@DiscriminatorValue("A")
@Getter
@Setter
public class Album extends Item {
private String artist;
private String etc;
}
| [
"[email protected]"
]
| |
d3b90e940d1e32c72837e400337590bc63aa6474 | 0a1d0458c115376de64eaac567699c48e67d21de | /src/java/controllers/VentaControllers.java | 98ade1cb4240d71f7def4ac0fa364b82a3b2b9b1 | []
| no_license | JDTORRES11/SampleSpringApplication | 935a213d0a8ddf0a78db8dc930b346d030dfafe2 | 2bbd2ec03af3894bf12a6aa122c96d034450349e | refs/heads/master | 2020-04-27T19:37:01.450555 | 2019-04-20T22:53:17 | 2019-04-20T22:53:17 | 174,626,327 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,187 | 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 controllers;
/**
*
* @author NixonD
*/
import co.edu.uniminuto.pa.DAOs.VentaDAO;
import co.edu.uniminuto.pa.DTOs.Venta;
import co.edu.uniminuto.pa.bds.MySqlDataSource;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.support.SessionStatus;
@Controller
@RequestMapping("/")
public class VentaControllers {
/*
@RequestMapping(method = RequestMethod.GET)
public String helloWorld(ModelMap modelMap) {
System.out.println("ventaCrear");
modelMap.put("mensajeVenta", "Pase por el controller de Venta");
return "venta_crear";
}
*/
@RequestMapping(method = RequestMethod.GET, value = "ventaCrear.htm")
public String processSubmit(HttpServletRequest req, SessionStatus status,ModelMap model)
{
System.out.println("ventaCrear");
model.put("mensajeVenta", "Pase por el controller de Venta:::"+req.getParameter("nombre"));
return "venta_crear";
}
@RequestMapping(method = RequestMethod.POST, value = "ventaRegistrar.htm")
public String processSubmit1(HttpServletRequest req, SessionStatus status,ModelMap model)
{
VentaDAO vDao = new VentaDAO();
Logger.getLogger(VentaControllers.class.getName()).log(Level.INFO, "Ejecutando processSubmit1...");
int id = vDao.obtenerId(MySqlDataSource.getConexionBD());
String num = req.getParameter("numeroV");
String preciot = req.getParameter("preciot");
String cliente = req.getParameter("cliente");
String vehiculo = req.getParameter("vehiculo");
String descripcion = req.getParameter("descripcion");
String fecha = req.getParameter("fecha");
String tipog = req.getParameter("tipog");
Venta v = new Venta();
v.setId(id);
v.setNumero(num);
v.setPrecio_total(preciot);
v.setId_persona(cliente);
v.setId_vehiculo(vehiculo);
v.setDescripcion(descripcion);
v.setFecha(fecha);
v.setId_garantia(tipog);
boolean insert = vDao.crearVenta(v, MySqlDataSource.getConexionBD());
Logger.getLogger(VentaControllers.class.getName()).log(Level.SEVERE, null, "Registrar + " + num + "-" + insert);
if (insert)
model.put("mensaje", "El registro fue creado satisfactoriamente!!!");
else
model.put("mensaje", "El registro NO fue creado, consulte con el administrador...");
return "venta_crear";
}
@RequestMapping(method = RequestMethod.GET, value = "ventaConsultar.htm")
public String processSubmit2(HttpServletRequest req, SessionStatus status,ModelMap model)
{
Logger.getLogger(VentaControllers.class.getName()).log(Level.INFO, "Ejecutando processSubmit2...");
return "venta_consultar";
}
@RequestMapping(method = RequestMethod.POST, value = "ventaConsultarForm.htm")
public String processSubmit3(HttpServletRequest req, SessionStatus status,ModelMap model)
{
VentaDAO vDao = new VentaDAO();
Logger.getLogger(VentaDAO.class.getName()).log(Level.INFO, "Ejecutando processSubmit3...");
int id = vDao.obtenerId(MySqlDataSource.getConexionBD());
String num = req.getParameter("numeroV");
Venta v = new Venta();
v.setId(id);
v.setNumero(num);
List<Venta> datos = vDao.consultarVenta(v, MySqlDataSource.getConexionBD());
Logger.getLogger(VentaControllers.class.getName()).log(Level.SEVERE, null, "Consultar + " + num + "-" + datos.size());
model.put("listaVentas", datos);
if (datos.size() > 0)
model.put("mensaje", "La consulta se realizo satisfactoriamente!!!" + datos.size());
else
model.put("mensaje", "La consulta NO tiene resultados...");
return "venta_consultar";
}
@RequestMapping(method = RequestMethod.GET, value = "ventaEditar.htm")
public String processSubmit4(HttpServletRequest req, SessionStatus status,ModelMap model)
{
Logger.getLogger(VentaControllers.class.getName()).log(Level.INFO, "Ejecutando processSubmit4...");
return "venta_editar";
}
@RequestMapping(method = RequestMethod.POST, value = "ventaEditarForm1.htm")
public String processSubmit5(HttpServletRequest req, SessionStatus status,ModelMap model)
{
VentaDAO vDao = new VentaDAO();
Logger.getLogger(VentaDAO.class.getName()).log(Level.INFO, "Ejecutando processSubmit5...");
int id = vDao.obtenerId(MySqlDataSource.getConexionBD());
String num = req.getParameter("numeroV");
Venta v = new Venta();
v.setId(id);
v.setNumero(num);
List<Venta> datos = vDao.consultarVenta(v, MySqlDataSource.getConexionBD());
Logger.getLogger(VentaControllers.class.getName()).log(Level.SEVERE, null, "Consultar + " + num + "-" + datos.size());
model.put("listaVentas", datos);
return "venta_editar";
}
@RequestMapping(method = RequestMethod.POST, value = "ventaEditarForm2.htm")
public String processSubmit6(HttpServletRequest req, SessionStatus status,ModelMap model)
{
VentaDAO vDao = new VentaDAO();
Logger.getLogger(VentaDAO.class.getName()).log(Level.INFO, "Ejecutando processSubmit6...");
int id = Integer.parseInt(req.getParameter("id"));
String num = req.getParameter("numeroV");
String preciot = req.getParameter("preciot");
String cliente = req.getParameter("cliente");
String vehiculo = req.getParameter("vehiculo");
String descripcion = req.getParameter("descripcion");
String fecha = req.getParameter("fecha");
String tipog = req.getParameter("tipog");
Logger.getLogger(VentaDAO.class.getName()).log(Level.INFO, "Id venta: " + id);
Venta v = new Venta();
v.setId(id);
v.setNumero(num);
v.setPrecio_total(preciot);
v.setId_persona(cliente);
v.setId_vehiculo(vehiculo);
v.setDescripcion(descripcion);
v.setFecha(fecha);
v.setId_garantia(tipog);
boolean res = vDao.editarVenta(v, MySqlDataSource.getConexionBD());
if (res)
model.put("mensaje", "Se edito satisfactoriamente!!!");
else
model.put("mensaje", "NO se guardaron los cambios...");
return "venta_editar";
}
} | [
"[email protected]"
]
| |
c137cbac553614f8bea78bb342ae0ade46f73323 | ba41d10e1478c91285ddfd968066d3ab2da4c09e | /app/src/main/java/tech/diggle/apps/bible/bhaibheridzvenemuchishona/home/devotional/Devotional.java | d064e2d7342975e315abd52fd9a275be9c89ecd3 | []
| no_license | Digolodollarz/android-bible | 302571cdc9c9a344525e02c7db19d1fb57fc64d9 | caf550bbcd07d5028926073c6d6e20a1454702c5 | refs/heads/master | 2021-04-09T15:46:09.234663 | 2018-03-17T18:19:14 | 2018-03-17T18:19:14 | 125,657,078 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 206 | java | package tech.diggle.apps.bible.bhaibheridzvenemuchishona.home.devotional;
/**
* Created by Diggle E. Gonese on 12/3/2018.
*/
public class Devotional {
public String title;
public String body;
}
| [
"[email protected]"
]
| |
f430698280f73b8e073f639c0ddf2e2e5b1e2ad7 | 2e7e27b6bfad4abda62ea7f7b1fffa764723ec0e | /src/be/intecbrussel/nature/plants/Plant.java | 0034b5e257ee0b4702b1d264d18d35509f8c1f69 | []
| no_license | aliGanuz/FundamentalsTest | 340a6a15b17f01e50968bcc5751b74b97b73c74a | 3d608aa8d47545d880b586f8cb69101ad39298a0 | refs/heads/master | 2023-02-14T13:37:23.567993 | 2021-01-04T15:12:13 | 2021-01-04T15:12:13 | 326,721,725 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 491 | java | package be.intecbrussel.nature.plants;
public class Plant {
private String name;
private double height;
public Plant(String name) {
this.name = name;
}
public Plant(String name, double height) {
this.name = name;
this.height = height;
}
public String getName() {
return name;
}
public double getHeight() {
return height;
}
public void setHeight(double height) {
this.height = height;
}
}
| [
"[email protected]"
]
| |
e1344cff78c843a2f3b675d06d4080aff887317a | 4ff22fdea05541fc6500a07b3d8e7ead85757526 | /Aulas Loiane/src/exeraula56/Teste.java | e8d3f7506f3726befa14f0dbf60bb330c37ad355 | []
| no_license | Tester1313/Java | 7708232b05150873aa92549885e605d539c5e166 | a31dfbbe82574dd137c58ecfc47a7f329cc4f8d4 | refs/heads/master | 2021-01-21T14:58:03.689972 | 2018-03-04T15:20:17 | 2018-03-04T15:20:17 | 95,366,105 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 448 | java | package exeraula56;
public class Teste {
public static void main(String[] args) {
System.out.println("Calculadora");
double x = 2.0;
double y = 3.0;
//Operacoes.values retorna todas as operações dentro do enumerador
for (Operacoes op: Operacoes.values()) {
System.out.print(x + " ");
System.out.print(op.toString() + " ");
System.out.print(y + " = ");
System.out.println(op.executarOperacao(x, y));
}
}
}
| [
"[email protected]"
]
| |
566f36ced0272a62ed929300c9d1aca9027be39e | 0cd1c40780ad98442422e40afe3030fe049660f9 | /app/src/main/java/com/vij/devicectrl/Ui/LoginPage.java | 106258cbfe9b3d151bde05a8471e7bb5ae7e0c96 | []
| no_license | vijayarajsekar/DeviceCtrlPubDemo | 4863337ab89a7b94ac0043ab8419c6b26d9c16f9 | 40283d761c7920eeba16b08b624d20df0155dfa9 | refs/heads/master | 2021-01-01T05:10:38.412183 | 2016-11-18T11:32:34 | 2016-11-18T11:32:34 | 57,272,975 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,158 | java | package com.vij.devicectrl.Ui;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import com.vij.devicectrl.R;
public class LoginPage extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login_page);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_login_page, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"[email protected]"
]
| |
088c158ff8778f5629023e7a419530c8766b1dbc | 2dd4e24c2aad045b1fba2772a570e30235cc0ba4 | /environment/src/main/java/org/jpwh/env/DatabaseProduct.java | 7a91d935c35a1fbece152371eb9239081bf03080 | []
| no_license | press0/hibernate-examples | fc39bafa3e5815afff25b94a150d9f3b4a4e4b73 | 9ff1a103cc9ff752d44eabea3800516c1bdf0202 | refs/heads/master | 2022-07-15T07:03:20.399246 | 2022-06-21T04:35:52 | 2022-06-21T04:35:52 | 33,089,205 | 4 | 3 | null | 2022-06-21T04:35:53 | 2015-03-29T21:01:52 | Java | UTF-8 | Java | false | false | 4,318 | java | package org.jpwh.env;
import bitronix.tm.resource.jdbc.PoolingDataSource;
import java.util.Properties;
public enum DatabaseProduct {
H2(
new DataSourceConfiguration() {
@Override
public void configure(PoolingDataSource ds, String connectionURL) {
ds.setClassName("org.h2.jdbcx.JdbcDataSource");
// External instance: jdbc:h2:tcp://localhost/mem:test;USER=sa
ds.getDriverProperties().put(
"URL",
connectionURL != null
? connectionURL :
"jdbc:h2:mem:test"
);
// TODO: http://code.google.com/p/h2database/issues/detail?id=502
ds.getDriverProperties().put("user", "sa");
// TODO: Don't trace log values larger than X bytes (especially useful for
// debugging LOBs, which are accessed in toString()!)
// System.setProperty("h2.maxTraceDataLength", "256"); 256 bytes, default is 64 kilobytes
}
},
org.jpwh.shared.ImprovedH2Dialect.class.getName()
),
ORACLE(
new DataSourceConfiguration() {
@Override
public void configure(PoolingDataSource ds, String connectionURL) {
ds.setClassName("oracle.jdbc.xa.client.OracleXADataSource");
ds.getDriverProperties().put(
"URL",
connectionURL != null
? connectionURL :
"jdbc:oracle:thin:test/[email protected]:1521:xe"
);
// Required for reading VARBINARY/LONG RAW columns easily, see
// http://stackoverflow.com/questions/10174951
Properties connectionProperties = new Properties();
connectionProperties.put("useFetchSizeWithLongColumn", "true");
ds.getDriverProperties().put("connectionProperties", connectionProperties);
}
},
org.hibernate.dialect.Oracle10gDialect.class.getName()
),
POSTGRESQL(
new DataSourceConfiguration() {
@Override
public void configure(PoolingDataSource ds, String connectionURL) {
ds.setClassName("org.postgresql.xa.PGXADataSource");
if (connectionURL != null) {
throw new IllegalArgumentException(
"PostgreSQL XADataSource doesn't support connection URLs"
);
}
ds.getDriverProperties().put("serverName", "10.0.0.2");
ds.getDriverProperties().put("databaseName", "test");
ds.getDriverProperties().put("user", "test");
ds.getDriverProperties().put("password", "test");
}
},
org.hibernate.dialect.PostgreSQL82Dialect.class.getName()
),
MYSQL(
new DataSourceConfiguration() {
@Override
public void configure(PoolingDataSource ds, String connectionURL) {
// TODO: MySQL XA support is completely broken, we use the BTM XA wrapper
//ds.setClassName("com.mysql.jdbc.jdbc2.optional.MysqlXADataSource");
ds.setClassName("bitronix.tm.resource.jdbc.lrc.LrcXADataSource");
ds.getDriverProperties().put(
"url",
connectionURL != null
? connectionURL :
"jdbc:mysql://localhost/test?sessionVariables=sql_mode='PIPES_AS_CONCAT'"
);
ds.getDriverProperties().put("driverClassName", "com.mysql.jdbc.Driver");
}
},
// Yes, this should work with 5.6, no idea why Gail named it 5.7
org.hibernate.dialect.MySQL57InnoDBDialect.class.getName()
);
public DataSourceConfiguration configuration;
public String hibernateDialect;
private DatabaseProduct(DataSourceConfiguration configuration,
String hibernateDialect) {
this.configuration = configuration;
this.hibernateDialect = hibernateDialect;
}
public interface DataSourceConfiguration {
void configure(PoolingDataSource ds, String connectionURL);
}
}
| [
"[email protected]"
]
| |
521d9e5ef80cab051748d888d89b52ada487adab | 03600b4ca86f491279465c02a8c1077abfe70809 | /src/entities/Jogador.java | ced5070f4185305cbc68a2decb090c51be9d472d | []
| no_license | MatheusTrinca/campeonato | e0a448283430a943454f6716bf242ae1b9c22ed1 | b0f4c2b1e5422d55ca0f2a5561874b502be4909e | refs/heads/master | 2022-10-10T01:09:17.193398 | 2020-06-05T01:02:54 | 2020-06-05T01:02:54 | 269,498,136 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 397 | java | package entities;
import java.util.Date;
public class Jogador {
private String nome;
private Date nascimento;
private char genero;
private Double altura;
public Jogador() {
}
public String getNome() {
return nome;
}
public Date getNascimento() {
return nascimento;
}
public char getGenero() {
return genero;
}
public Double getAltura() {
return altura;
}
}
| [
"[email protected]"
]
| |
47c7d2dfd43509de0d37780db2a91e08b4617fc7 | 8d189e38290edb1f818d8083a7127441d92f1a9e | /serratec.desenvolvimentoAPI-Restful/workspaceDesenvolvimentoApiRestful/biblioteca/src/main/java/com/residencia/biblioteca/biblioteca/services/LivrosService.java | 4b61767d396885fa053b01564589fb9cc2eff192 | []
| no_license | marcosbarker/serratec.residencia | 4b52fb9c74a7583340c6716415c4154b1b45ca54 | 5a513b19e04e793656ce5baf2f5b615e296b95a7 | refs/heads/main | 2023-07-04T21:57:28.852631 | 2021-08-15T15:04:19 | 2021-08-15T15:04:19 | 358,917,430 | 4 | 0 | null | 2021-06-22T04:25:32 | 2021-04-17T15:40:52 | PLpgSQL | UTF-8 | Java | false | false | 1,179 | java | package com.residencia.biblioteca.biblioteca.services;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.residencia.biblioteca.biblioteca.entities.Livros;
import com.residencia.biblioteca.biblioteca.repositories.LivrosRepository;
@Service
public class LivrosService {
@Autowired
public LivrosRepository livrosRepository;
public Livros getByID(Integer id) {
return livrosRepository.findById(id).get();
}
public List<Livros> getAll(){
return livrosRepository.findAll();
}
public Long count() {
return livrosRepository.count();
}
public Livros save(Livros livro) {
Livros novoLivro = livrosRepository.save(livro);
if(livrosRepository.existsById(novoLivro.getCodigoLivro())) {
return novoLivro;
}
else {
return null;
}
}
public Livros update(Livros livro, Integer id) {
livro.setCodigoLivro(id);
return livrosRepository.save(livro);
}
public Livros update(Livros livro) {
return livrosRepository.save(livro);
}
public void delete(Integer id) {
livrosRepository.deleteById(id);
}
}
| [
"[email protected]"
]
| |
ebad62cc5715d7eae73ffea7c2d65015af702f9f | e4d6733730cf2cef7a9efb413d981417b0997b3d | /SE/BF/src/rmi/RemoteHelper.java | 9a7f5b101e6fb80fdf9c826558e247beb2b498ec | []
| no_license | Pypy233/IDE-Brainfuck-master | 66a9aec3dff359709f20cabe086db26bcb49636a | 64bba11e7bb7c8960f56e6657192bdefd283e536 | refs/heads/master | 2020-06-01T02:03:13.324041 | 2017-06-29T00:56:19 | 2017-06-29T00:56:19 | 94,058,698 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 638 | java | package rmi;
import java.rmi.Remote;
import service.IOService;
import service.UserService;
import service.ExecuteService;
public class RemoteHelper {
private Remote remote;
private static RemoteHelper remoteHelper = new RemoteHelper();
public static RemoteHelper getInstance(){
return remoteHelper;
}
private RemoteHelper() {
}
public void setRemote(Remote remote){
this.remote = remote;
}
public IOService getIOService(){
return (IOService)remote;
}
public UserService getUserService(){
return (UserService)remote;
}
public ExecuteService getExecuteService() {
return (ExecuteService)remote;
}
}
| [
"[email protected]"
]
| |
330ba2c0c9d1e6d389cba1b154483d0c5337c931 | 9c2fe46e8b0d80f7105ab07eddabe72e2972cd69 | /app/src/main/java/com/kpdigital/mywallpaper/ImageModel.java | c5b6e6e2ec789485ec2abcfe73e85359bc991315 | []
| no_license | Purav22/wallpaper | 8dda4f83e9c2bf0a82fdfd156cab278675027eda | dd9a6d44ccaa5a5f08dc50daa3ebcdd84d78135f | refs/heads/master | 2023-08-11T21:51:20.598013 | 2021-09-22T12:25:09 | 2021-09-22T12:25:09 | 404,036,994 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 502 | java | package com.kpdigital.mywallpaper;
public class ImageModel {
private URLModel urls;
private userModel user;
public ImageModel(URLModel urls, userModel user) {
this.urls = urls;
this.user = user;
}
public userModel getUser() {
return user;
}
public void setUser(userModel user) {
this.user = user;
}
public URLModel getSrc() {
return urls;
}
public void setSrc(URLModel src) {
this.urls = src;
}
}
| [
"[email protected]"
]
| |
4ccd51335d8c6ff40b3ec5ce17d72992231363d5 | ca3843d5328e7601038fb290a0c6b4cd7c81aa7c | /src/main/java/com/codeclan/example/CourseBooking/repositories/Courserepositories/CourseRepositoryImpl.java | 836c9d9e87ea02026979c0cf50f72eab51bed7d2 | []
| no_license | MrNobad/CourseBookingAppJava | bbe9fdaafda8951fd666e02146398d082780695b | 3c25750f5d236e63dd4004de6dc08a2399e7d0dc | refs/heads/master | 2020-09-26T01:04:24.714100 | 2019-12-05T14:37:43 | 2019-12-05T14:37:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 115 | java | package com.codeclan.example.CourseBooking.repositories.Courserepositories;
public class CourseRepositoryImpl {
}
| [
"[email protected]"
]
| |
36bc3659d920309c3b47fce0f8a50a1a13b3137c | 81941ad872aa450aaa0d9e5cec5b84bafa931129 | /lib_utils/src/main/java/com/mb/android/utils/NetworkHelper.java | 9a86a411629da4aa31144d71c70d8d4a3aaad528 | []
| no_license | cgy529387306/AiShangYi | b6fc5c1c62e89813916399fdffa5aeaeb11a35be | 6363540293b67b84f640698a51196d899b9cc1e0 | refs/heads/master | 2020-04-26T03:17:06.607710 | 2019-04-01T11:21:24 | 2019-04-01T11:21:24 | 173,262,143 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,173 | java | package com.mb.android.utils;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.provider.Settings;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
public class NetworkHelper {
private static final String TAG = NetworkHelper.class.getSimpleName();
/**
* KEY:网络传输用,user-agent1
*/
public static final String NETWORK_KEY_USER_AGENT1 = "User-Agent1";
public static final short TYPE_IP_V4 = 4;
public static final short TYPE_IP_V6 = 6;
/**
* 检查网络连接是否可用
*
* @param context
* 上下文
*
* @return
*/
public static boolean isNetworkAvailable(Context context) {
ConnectivityManager cm = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
if (cm == null) {
return false;
}
NetworkInfo[] netinfo = cm.getAllNetworkInfo();
if (netinfo == null) {
return false;
}
for (int i = 0; i < netinfo.length; i++) {
if (netinfo[i].isConnected()) {
return true;
}
}
return false;
}
/**
* 判断是否是wifi连接
*/
public static boolean isWifi(Context context)
{
ConnectivityManager cm = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
if (cm == null)
return false;
return cm.getActiveNetworkInfo().getType() == ConnectivityManager.TYPE_WIFI;
}
/**
* 打开网络设置界面
*/
public static void openSetting(Activity activity)
{
Intent intent = null;
if (Build.VERSION.SDK_INT>10){
intent = new Intent(Settings.ACTION_WIRELESS_SETTINGS);
}else{
intent = new Intent();
ComponentName cm = new ComponentName("com.android.settings",
"com.android.settings.WirelessSettings");
intent.setComponent(cm);
intent.setAction("android.intent.action.VIEW");
}
activity.startActivity(intent);
}
/**
* 获取当前ip
* @param ipType ipv4或者ipv6,请使用{@link #TYPE_IP_V4}或者{@link #TYPE_IP_V6}
* @return 当前ip
*/
public static String getLocalIpAddress(short ipType) {
try {
for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces();
en.hasMoreElements();) {
NetworkInterface intf = en.nextElement();
for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses();
enumIpAddr.hasMoreElements();) {
InetAddress inetAddress = enumIpAddr.nextElement();
if (!inetAddress.isLoopbackAddress()) {
switch (ipType) {
case TYPE_IP_V4:
if (inetAddress instanceof Inet4Address) {
return inetAddress.getHostAddress().toString();
}
break;
case TYPE_IP_V6:
if (inetAddress instanceof Inet6Address) {
return inetAddress.getHostAddress().toString();
}
break;
default:
break;
}
}
}
}
} catch (SocketException ex) {
ex.printStackTrace();
}
return null;
}
}
| [
"[email protected]"
]
| |
958c3bf14b43b2b8c1f680adb0917b3bb86741e9 | 360d05beaa7fb747393b5f061bee2078b6158864 | /Java/AgArayuzu.java | acba5cf04d06b43f4f74a90cfade2f295a914879 | []
| no_license | YasinUnall/SmartDeviceControlSimilator | a0dad5a6f5afa6d72bab9c47f0c4e4b5de81becf | c8ebdaf6a9021a86c93e1a90764e4bdaeb9cbe4b | refs/heads/master | 2023-08-11T12:12:44.465455 | 2021-09-24T15:07:42 | 2021-09-24T15:07:42 | 262,411,750 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,362 | java | package com.basepckg;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.SimpleTimeZone;
public class AgArayuzu implements IAgArayuzu{
enum Islemler {SOGUTUCU_AC, SOGUTUCU_KAPAT, ALGILAMA_BASLA, DURUM_GORUNTULE, CIKIS, ALGILAMA_BITIR}
private static IAnaAgSistemi anaAgSistemi;
private static IMerkeziIslemBirimi merkeziIslemBirimi;
public AgArayuzu(IAnaAgSistemi anaAgSistemi){
this.anaAgSistemi = anaAgSistemi;
this.anaAgSistemi.setAgArayuzu(this);
}
public void ilkDurumAl()
{
merkeziIslemBirimi.ilkDurumAl();
}
public void islemAl(Islemler islem)
{
merkeziIslemBirimi.islemAl(islem);
}
public void sicaklikGonder(float sicaklik){
anaAgSistemi.sicaklikGuncelle(sicaklik);
}
public void setMerkeziIslemBirimi(IMerkeziIslemBirimi merkeziIslemBirimi) {
this.merkeziIslemBirimi = merkeziIslemBirimi;
}
public Durum.YoneticiDurumlar dbDurumAl() { return anaAgSistemi.dbDurumAl(); }
public void durumGuncelle(Durum.YoneticiDurumlar durum)
{
anaAgSistemi.durumGuncelle(durum);
}
public void kullaniciDurumGonder(Durum.KullaniciDurumlar durum)
{
anaAgSistemi.kullaniciDurumAl(durum);
}
public void mesajGonder(String mesaj)
{
anaAgSistemi.mesajGonder(mesaj);
}
}
| [
"[email protected]"
]
| |
3b2ff1aed89d2c40210a16f452bc67d79e656fcf | fa05bb85eddf05d592dd6636e7e7dfc5217135bd | /src/main/java/controller/ProductController.java | ad9873aa7bc2fe544c5eec05a532e626ff9cb92a | []
| no_license | MTLDDB/springmvc | e301256595501ede94eb263bccfc12deb83a9d48 | adecd022be2cb5f710c1251da5ef6138a4e01deb | refs/heads/master | 2022-12-22T18:42:38.684010 | 2019-08-23T08:39:32 | 2019-08-23T08:39:32 | 203,083,426 | 0 | 0 | null | 2022-11-24T07:19:38 | 2019-08-19T02:24:03 | Java | UTF-8 | Java | false | false | 489 | java | package controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import pojo.Product;
@Controller
public class ProductController {
@RequestMapping("/addProduct")
public ModelAndView add(Product product) throws Exception {
System.out.println(product.getName());
ModelAndView mav = new ModelAndView("showProduct");
return mav;
}
}
| [
"[email protected]"
]
| |
8ff42c1a3e5136db72b82bc5229a9969064438c6 | 2c62f329512d3185a1989458cd5912ded131d8dc | /WebServer/src/main/java/com/oss/service/ForeCastService.java | 019b80b67889b266132b2e048c2a2bbf0f351c7d | [
"Apache-2.0"
]
| permissive | kimkc/SmartHomeNotification | 51df3108057c07759b2bc0342e5081c10aa25db2 | 73a4075838f5355315d3e9073b7700e2ab4bc91c | refs/heads/master | 2022-12-26T01:15:09.822384 | 2020-12-12T10:46:23 | 2020-12-12T10:46:23 | 268,669,558 | 1 | 0 | Apache-2.0 | 2022-12-16T00:43:35 | 2020-06-02T01:13:19 | Java | UTF-8 | Java | false | false | 5,139 | java | package com.oss.service;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.HttpClientBuilder;
import org.springframework.stereotype.Service;
import lombok.extern.log4j.Log4j;
@Service
@Log4j
public class ForeCastService {
public String post() {
try {
HttpClient client = HttpClientBuilder.create().build(); // HttpClient ����
SimpleDateFormat forecastDatefmt = new SimpleDateFormat ( "yyyyMMdd");
SimpleDateFormat forecastTime = new SimpleDateFormat ("HH");
Calendar time = Calendar.getInstance();
String forecastToday = forecastDatefmt.format(time.getTime());
String strbaseTime = forecastTime.format(time.getTime());
int basetime=Integer.parseInt(strbaseTime);
if( basetime >= 0 && basetime < 2){
strbaseTime = "2300";
}else if( basetime >= 2 && basetime < 5){
strbaseTime = "0200";
}else if( basetime >= 5 && basetime < 8){
strbaseTime = "0500";
}else if( basetime >= 8 && basetime < 11) {
strbaseTime = "0800";
}else if( basetime >= 11 && basetime < 14) {
strbaseTime = "1100";
}else if( basetime >= 14 && basetime < 17) {
strbaseTime = "1400";
}else if( basetime >= 17 && basetime < 20) {
strbaseTime = "1700";
}else if( basetime >= 20 && basetime < 23) {
strbaseTime = "2000";
}else if( basetime >= 23) {
strbaseTime = "2300";
}
HttpGet postRequest = new HttpGet("http://newsky2.kma.go.kr/service/SecndSrtpdFrcstInfoService2/ForecastSpaceData?ServiceKey=4d6GyBtQk8gbfA1JcWcIgSnu1gsNntespsPOAqRlv3l%2B9kp2HVnIsnDpLeFIXPVbwFC6%2BxdKBnX1YMSEi%2BUVoQ%3D%3D&base_date="+forecastToday+"&base_time="+strbaseTime+"&nx=62&ny=110&_type=json"); //POST �ҵ� URL ����
HttpResponse response = client.execute(postRequest);
if (response.getStatusLine().getStatusCode() == 200) {
ResponseHandler<String> handler = new BasicResponseHandler();
String body = handler.handleResponse(response);
int itemStart = body.indexOf("[");
int itemEnd = body.indexOf("]");
body = body.substring(itemStart+1,itemEnd);
HashMap<String, Float> map = new HashMap<String, Float>();
String[] items = body.split("},");
for (int k = 0; k < items.length; k++) {
String[] item = items[k].split(",");
String category = item[2].substring(12,15);
float fcstVal = Float.parseFloat(item[5].substring(12));
map.put(category,fcstVal);
}
String forecast="오늘의 아침 날씨는";
String foreJson ="/";
if(map.containsKey("PTY")) {
if( map.get("PTY") == 1) {
forecast= forecast+"비가오니 우산을 챙겨주세요.";
foreJson += "pty,1,";
}else if( map.get("PTY") == 2 ) {
forecast= forecast+"비와 눈이 오니 우산을 챙겨주세요.";
foreJson += "pty,2,";
}else if( map.get("PTY") == 3 ) {
forecast= forecast+"눈이 오니 우산을 챙겨주세요.";
foreJson += "pty,3,";
}else{
forecast= forecast+"소나기가 오니 우산을 챙겨주세요.";
foreJson += "pty,4,";
}
}
if(map.containsKey("SKY")) {
if( map.get("SKY") == 1) {
forecast= forecast+" 하늘의 상태는 맑고";
foreJson += "sky,1,";
}else if( map.get("SKY") == 3 ) {
forecast= forecast+" 하늘의 상태는 구름이 많고";
foreJson += "sky,3,";
}else{
forecast= forecast+" 하늘의 상태는 흐리고";
foreJson += "sky,5,";
}
}
if(map.containsKey("WSD")) {
if( map.get("WSD") < 4) {
forecast= forecast+" 바람은 약하겠습니다.";
foreJson += "wsd,1,";
}else if( map.get("WSD") >=4 || map.get("WSD") <9 ) {
forecast= forecast+" 바람은 감촉이 느껴질 정도입니다.";
foreJson += "wsd,2,";
}else if( map.get("WSD") >=9 || map.get("WSD") <14 ) {
forecast= forecast+" 바람은 나뭇가지와 깃발이 흔들릴 정도로 약간 강하겠습니다.";
foreJson += "wsd,3,";
}else{
forecast= forecast+" 바람은 매우 강하게 불 예정이니 이점 유의하여 주세요.";
foreJson += "wsd,4,";
}
}
if(map.containsKey("T3H")) {
forecast += " 앞으로 3시간의 기온은 "+map.get("T3H")+"도 이고 ";
foreJson += "t3h,"+map.get("T3H")+",";
}
if(map.containsKey("REH")) {
forecast += "습도는 "+map.get("REH")+"퍼센트 입니다.";
foreJson += "reh,"+map.get("REH");
}
return forecast+"/"+strbaseTime+foreJson;
} else {
System.out.println("response is error : " + response.getStatusLine().getStatusCode());
return "response is error : " +response.getStatusLine().getStatusCode();
}
} catch (Exception e){
System.err.println(e.toString());
return "Exception!: "+e.toString();
}
}
}
| [
"[email protected]"
]
| |
2ff94a98c0b646bf24eddcd2ead6b0a79077e5b0 | 2df4b6d634e785d0fc79b8f9e5e4fa7d511a5078 | /stu-spring-boot-rabbitmq/stu-spring-boot-rabbitmq-publisher/src/main/java/org/stu/spring/boot/rabbitmq/publisher/AmqpConfiguration.java | 026729cc3bc891c301c6fb89516cb26fdce77638 | []
| no_license | ksyingcos/stu | da7e39346e7f10143f2bd600c7d11721542388e5 | 53e3545b195aae814d3423d65650297e0c27429c | refs/heads/master | 2022-12-21T04:44:21.388529 | 2019-07-31T02:14:39 | 2019-07-31T02:14:39 | 88,019,868 | 0 | 0 | null | 2022-12-16T07:34:01 | 2017-04-12T06:55:54 | Java | UTF-8 | Java | false | false | 2,189 | java | package org.stu.spring.boot.rabbitmq.publisher;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
@Configuration
public class AmqpConfiguration {
public static final String DEFAULT_DIRECT_EXCHANGE = "stu.default.direct.exchange";
public static final String DEFAULT_TOPIC_EXCHANGE = "stu.default.topic.exchange";
@Value("${spring.rabbitmq.host}")
private String host;
@Value("${spring.rabbitmq.port}")
private int port;
@Value("${spring.rabbitmq.username}")
private String username;
@Value("${spring.rabbitmq.password}")
private String password;
@Value("${spring.rabbitmq.virtualHost}")
private String virtualHost;
@Value("${spring.rabbitmq.publisher-confirms}")
private Boolean publisherConfirms;
@Bean
public ConnectionFactory amqpConnectionFactory() {
CachingConnectionFactory connectionFactory = new CachingConnectionFactory();
connectionFactory.setHost(host);
connectionFactory.setPort(port);
connectionFactory.setUsername(username);
connectionFactory.setPassword(password);
connectionFactory.setVirtualHost(virtualHost);
connectionFactory.setPublisherConfirms(publisherConfirms);
return connectionFactory;
}
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public RabbitTemplate rabbitTemplate() {
RabbitTemplate template = new RabbitTemplate(amqpConnectionFactory());
return template;
}
@Bean
public DirectExchange defaultDirectExchange() {
return new DirectExchange(DEFAULT_DIRECT_EXCHANGE);
}
@Bean
public TopicExchange defaultTopicExchange() {
return new TopicExchange(DEFAULT_TOPIC_EXCHANGE);
}
}
| [
"[email protected]"
]
| |
47aac5cc91a18547f1439e2a6a63bd21d46609d2 | 729cd77044bd95bd0a2957c07d2224cacd2bd53b | /src/main/java/com/example/petclinicsf5/model/PetType.java | d6d93410b83e2d5eb237d65538da0b9cffb43835 | []
| no_license | FilipJ89/pet-clinic-sf5 | c5bc5f9c0481fd382f15ac1967f26c28ae5329c3 | 13bef57a9437d0600b73f95c50f5559382a6740d | refs/heads/master | 2021-11-22T19:07:14.245384 | 2021-10-16T17:57:47 | 2021-10-16T17:57:47 | 222,251,480 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 530 | java | package com.example.petclinicsf5.model;
import lombok.*;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Entity
@Table(name = "types")
public class PetType extends BaseEntity{
@Builder
public PetType(Long id, String name) {
super(id);
this.name = name;
}
@Column(name = "name")
private String name;
@Override
public String toString() {
return name;
}
}
| [
"[email protected]"
]
| |
c49f329a954f81a2808d0a66ea902dbb251e009f | 4ccf1aaa7438fb4c5ac74562315267f050e9e579 | /src/main/java/com/techgarden/tasks/tree/model/elements/Leaf.java | e3d5e899ffcb83ae6878701c1cddc2eb778542bc | []
| no_license | mmaszkie/techgarden | e106241e42475043b5fe90f54f16f6c8c11c1d2f | 4d70f99839adb3b5855d7a19b103e73732da59bc | refs/heads/master | 2021-01-25T00:57:34.665427 | 2017-06-25T22:19:59 | 2017-06-25T22:19:59 | 94,710,737 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 274 | java | package com.techgarden.tasks.tree.model.elements;
import com.techgarden.tasks.tree.model.actions.Grow;
public abstract class Leaf<Type> implements Grow {
public enum Color {
GREEN,
BROWN
}
public Color color;
public double diameter;
} | [
"[email protected]"
]
| |
161a01a2da07c969393ea403e841e73de5ffbae0 | 3845f55559aae3d29308367ef6c57a2c03083d88 | /src/ro/siit/algorithm/SmallestNumber.java | 46fdb77f425f5a46c3c48a41a891143f3f56b23c | []
| no_license | andreeas89/SIIT | 86d55cf6bf38ffcfd4a38949609771255fbd1158 | c71481d8a2c69eb97409ffa173bee5c6607ae9ac | refs/heads/master | 2021-05-04T21:05:41.085294 | 2018-03-02T20:40:57 | 2018-03-02T20:40:57 | 119,886,343 | 0 | 0 | null | 2018-02-02T12:13:53 | 2018-02-01T19:58:35 | Java | UTF-8 | Java | false | false | 657 | java | /*Homework week 1
*
* display the smallest number from an array of numbers
*
* @author Andreea Sinca
*/
package Algorithms;
public class SmallestNumber {
public static int smallNumber(int a[]) {
int min = a[0];// consider the first value like the smallest number for begining
for (int i = 1; i < a.length; i++) {
if (a[i] < min) {
min = a[i];
}
}
return min;// return the small number
}
public int bigNumber(int a[]) {
int max = a[0];// consider the first value like the big number for begining
for (int i = 1; i < a.length; i++) {
if (a[i] > max) {
max = a[i];
}
}
return max;// return the big number
}
} | [
"[email protected]"
]
| |
bfa5de4baaa22b97566271b3210da3682b9d09a6 | 66bdd1151c3c70ccc49d64b25a699cf1943ab3ed | /job-scheduler-common/src/test/java/com/jd/framework/job/event/rdb/RdbJobEventStorageTest.java | 441b0991da11b4c42d53e9524546f7f7e78a754e | []
| no_license | NYACC/job-scheduler | 222e1f569ef0ec8239e3d1ff0bc6ab16bf9b5ba8 | fa74bfeb044b8cd781e21d319a1ca95c76796712 | refs/heads/master | 2020-05-07T17:36:44.004447 | 2018-10-09T03:11:29 | 2018-10-09T03:11:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,554 | java | /*
* Copyright (c) 2010-2020 Founder Ltd. All Rights Reserved.
*
* This software is the confidential and proprietary information of
* Founder. You shall not disclose such Confidential Information
* and shall use it only in accordance with the terms of the agreements
* you entered into with Founder.
*
*/
package com.jd.framework.job.event.rdb;
import static junit.framework.TestCase.assertFalse;
import static junit.framework.TestCase.assertTrue;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.startsWith;
import static org.junit.Assert.assertThat;
import java.sql.SQLException;
import java.util.List;
import org.apache.commons.dbcp.BasicDataSource;
import org.junit.Before;
import org.junit.Test;
import com.jd.framework.job.constant.job.ExecutionType;
import com.jd.framework.job.event.type.JobExecutionEvent;
import com.jd.framework.job.event.type.JobExecutionEvent.ExecutionSource;
import com.jd.framework.job.event.type.JobStatusTraceEvent;
import com.jd.framework.job.event.type.JobStatusTraceEvent.Source;
import com.jd.framework.job.event.type.JobStatusTraceEvent.State;
public class RdbJobEventStorageTest {
private RdbJobEventStorage storage;
@Before
public void setup() throws SQLException {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(org.h2.Driver.class.getName());
dataSource.setUrl("jdbc:h2:mem:job_event_storage");
dataSource.setUsername("sa");
dataSource.setPassword("");
storage = new RdbJobEventStorage(dataSource);
}
@Test
public void assertAddJobExecutionEvent() throws SQLException {
assertTrue(storage.addJobExecutionEvent(new JobExecutionEvent("fake_task_id", "test_job",
ExecutionSource.NORMAL_TRIGGER, 0)));
}
@Test
public void assertAddJobStatusTraceEvent() throws SQLException {
assertTrue(storage.addJobStatusTraceEvent(new JobStatusTraceEvent("test_job", "fake_task_id", "fake_slave_id",
Source.FACT_EXECUTOR, ExecutionType.READY, "0", State.TASK_RUNNING, "message is empty.")));
}
@Test
public void assertAddJobStatusTraceEventWhenFailoverWithTaskStagingState() throws SQLException {
JobStatusTraceEvent jobStatusTraceEvent = new JobStatusTraceEvent("test_job", "fake_failover_task_id",
"fake_slave_id", Source.FACT_EXECUTOR, ExecutionType.FAILOVER, "0", State.TASK_STAGING,
"message is empty.");
jobStatusTraceEvent.setOriginalTaskId("original_fake_failover_task_id");
assertThat(storage.getJobStatusTraceEvents("fake_failover_task_id").size(), is(0));
storage.addJobStatusTraceEvent(jobStatusTraceEvent);
assertThat(storage.getJobStatusTraceEvents("fake_failover_task_id").size(), is(1));
}
@Test
public void assertAddJobStatusTraceEventWhenFailoverWithTaskFailedState() throws SQLException {
JobStatusTraceEvent stagingJobStatusTraceEvent = new JobStatusTraceEvent("test_job",
"fake_failed_failover_task_id", "fake_slave_id", Source.FACT_EXECUTOR, ExecutionType.FAILOVER, "0",
State.TASK_STAGING, "message is empty.");
stagingJobStatusTraceEvent.setOriginalTaskId("original_fake_failed_failover_task_id");
storage.addJobStatusTraceEvent(stagingJobStatusTraceEvent);
JobStatusTraceEvent failedJobStatusTraceEvent = new JobStatusTraceEvent("test_job",
"fake_failed_failover_task_id", "fake_slave_id", Source.FACT_EXECUTOR, ExecutionType.FAILOVER, "0",
State.TASK_FAILED, "message is empty.");
storage.addJobStatusTraceEvent(failedJobStatusTraceEvent);
List<JobStatusTraceEvent> jobStatusTraceEvents = storage
.getJobStatusTraceEvents("fake_failed_failover_task_id");
assertThat(jobStatusTraceEvents.size(), is(2));
for (JobStatusTraceEvent jobStatusTraceEvent : jobStatusTraceEvents) {
assertThat(jobStatusTraceEvent.getOriginalTaskId(), is("original_fake_failed_failover_task_id"));
}
}
@Test
public void assertUpdateJobExecutionEventWhenSuccess() throws SQLException {
JobExecutionEvent startEvent = new JobExecutionEvent("fake_task_id", "test_job",
ExecutionSource.NORMAL_TRIGGER, 0);
assertTrue(storage.addJobExecutionEvent(startEvent));
JobExecutionEvent successEvent = startEvent.executionSuccess();
assertTrue(storage.addJobExecutionEvent(successEvent));
}
@Test
public void assertUpdateJobExecutionEventWhenFailure() throws SQLException {
JobExecutionEvent startEvent = new JobExecutionEvent("fake_task_id", "test_job",
ExecutionSource.NORMAL_TRIGGER, 0);
assertTrue(storage.addJobExecutionEvent(startEvent));
JobExecutionEvent failureEvent = startEvent.executionFailure(new RuntimeException("failure"));
assertTrue(storage.addJobExecutionEvent(failureEvent));
assertThat(failureEvent.getFailureCause(), startsWith("java.lang.RuntimeException: failure"));
}
@Test
public void assertUpdateJobExecutionEventWhenSuccessAndConflict() throws SQLException {
JobExecutionEvent startEvent = new JobExecutionEvent("fake_task_id", "test_job",
ExecutionSource.NORMAL_TRIGGER, 0);
JobExecutionEvent successEvent = startEvent.executionSuccess();
assertTrue(storage.addJobExecutionEvent(successEvent));
assertFalse(storage.addJobExecutionEvent(startEvent));
}
@Test
public void assertUpdateJobExecutionEventWhenFailureAndConflict() throws SQLException {
JobExecutionEvent startEvent = new JobExecutionEvent("fake_task_id", "test_job",
ExecutionSource.NORMAL_TRIGGER, 0);
JobExecutionEvent failureEvent = startEvent.executionFailure(new RuntimeException("failure"));
assertTrue(storage.addJobExecutionEvent(failureEvent));
assertThat(failureEvent.getFailureCause(), startsWith("java.lang.RuntimeException: failure"));
assertFalse(storage.addJobExecutionEvent(startEvent));
}
@Test
public void assertUpdateJobExecutionEventWhenFailureAndMessageExceed() throws SQLException {
JobExecutionEvent startEvent = new JobExecutionEvent("fake_task_id", "test_job",
ExecutionSource.NORMAL_TRIGGER, 0);
assertTrue(storage.addJobExecutionEvent(startEvent));
StringBuilder failureMsg = new StringBuilder();
for (int i = 0; i < 600; i++) {
failureMsg.append(i);
}
JobExecutionEvent failEvent = startEvent.executionFailure(new RuntimeException("failure"
+ failureMsg.toString()));
assertTrue(storage.addJobExecutionEvent(failEvent));
assertThat(failEvent.getFailureCause(), startsWith("java.lang.RuntimeException: failure"));
}
@Test
public void assertFindJobExecutionEvent() throws SQLException {
storage.addJobExecutionEvent(new JobExecutionEvent("fake_task_id", "test_job", ExecutionSource.NORMAL_TRIGGER,
0));
}
}
| [
"[email protected]"
]
| |
b3d7663c9eb9d2a7261aca6b165b1ec8556803c0 | dc1071c0e8b3f4cdd02eb2fd440844429f9f530b | /appLian/src/main/java/com/skynet/lian/models/NotificationFCM.java | baf554c63c33fa2fbd655d27a8d49666792e88d8 | []
| no_license | duongnv1996/lian-chat-implement | d6f5f4e658f5f18c46dac6760dd13d647cb5c607 | 62f915a242b82aed6877681240be9f9892fda1d9 | refs/heads/master | 2020-04-29T12:20:30.103539 | 2019-04-08T07:19:15 | 2019-04-08T07:19:15 | 176,133,283 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,766 | java | package com.skynet.lian.models;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class NotificationFCM {
@Expose
@SerializedName("type_noti")
private int type;
@Expose
@SerializedName("object")
private Message object;
@Expose
@SerializedName("content")
private String content;
@Expose
@SerializedName("title")
private String title;
@SerializedName("room_id")
String roomID;
@SerializedName("user_id")
String idUserRequestFriend;
@SerializedName("user_name")
String nameUserRequestFriend;
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getIdUserRequestFriend() {
return idUserRequestFriend;
}
public void setIdUserRequestFriend(String idUserRequestFriend) {
this.idUserRequestFriend = idUserRequestFriend;
}
public String getNameUserRequestFriend() {
return nameUserRequestFriend;
}
public void setNameUserRequestFriend(String nameUserRequestFriend) {
this.nameUserRequestFriend = nameUserRequestFriend;
}
public String getRoomID() {
return roomID;
}
public void setRoomID(String roomID) {
this.roomID = roomID;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getTitle() {
return title;
}
public Message getObject() {
return object;
}
public void setObject(Message object) {
this.object = object;
}
public void setTitle(String title) {
this.title = title;
}
}
| [
"[email protected]"
]
| |
73d85e9e91f8ab123b0c3c4bed453e85e2edfbda | bb3d91db173e9c01aa59b7eefff2579831e8127e | /backends/pelioncloud_devicemanagement/src/test/java/com/arm/mbed/cloud/sdk/lowlevel/pelionclouddevicemanagement/api/TenantAccountsUsersApiTest.java | 2904ee18914a29e53ce6dbbf327d5a8919a3cc57 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
]
| permissive | acabarbaye/mbed-cloud-sdk-java | 0bc6c9fffdbcec22bb1c95f35a9d769ef1c931bb | 598effac2454ddf91334dc0c4f63f0835500c1f6 | refs/heads/master | 2020-08-26T14:42:18.709671 | 2019-10-03T18:33:55 | 2019-10-03T18:33:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,792 | java | package com.arm.mbed.cloud.sdk.lowlevel.pelionclouddevicemanagement.api;
import com.arm.mbed.cloud.sdk.lowlevel.pelionclouddevicemanagement.ApiClient;
import com.arm.mbed.cloud.sdk.lowlevel.pelionclouddevicemanagement.model.UserInfoReq;
import com.arm.mbed.cloud.sdk.lowlevel.pelionclouddevicemanagement.model.UserUpdateReq;
import org.junit.Before;
import org.junit.Test;
import java.util.List;
/**
* API tests for TenantAccountsUsersApi
*/
public class TenantAccountsUsersApiTest {
private TenantAccountsUsersApi api;
@Before
public void setup() {
api = new ApiClient().createService(TenantAccountsUsersApi.class);
}
/**
* Add user to a list of groups.
*
* Add user to groups. **Example:** ``` curl -X POST
* https://api.us-east-1.mbedcloud.com/v3/accounts/{account_id}/users/{user_id}/groups \\ -H 'Authorization:
* Bearer <api_key>' \\ -H 'content-type: application/json' \\ -d
* '[\"0162056a9a1586f30242590700000000\",\"0117056a9a1586f30242590700000000\"]'
* ```
*/
@Test
public void addAccountUserToGroupsTest() {
String accountId = null;
String userId = null;
List<String> body = null;
// UpdatedResponse response = api.addAccountUserToGroups(accountId, userId, body);
// TODO: test validations
}
/**
* Create a new user.
*
* Create or invite a new user to the account. Only email address is used; other attributes are set in the second
* step. **Example:** ``` curl -X POST
* https://api.us-east-1.mbedcloud.com/v3/accounts/{account_id}/users \\ -H 'Authorization: Bearer
* <api_key>' \\ -H 'content-type: application/json' \\ -d {\"email\":
* \"[email protected]\"} ```
*/
@Test
public void createAccountUserTest() {
String accountId = null;
UserInfoReq body = null;
String action = null;
// UserInfoResp response = api.createAccountUser(accountId, body, action);
// TODO: test validations
}
/**
* Delete a user.
*
* Delete a user. **Example:** ``` curl -X DELETE
* https://api.us-east-1.mbedcloud.com/v3/accounts/{account_id}/users/{user_id} \\ -H 'Authorization: Bearer
* <api_key>' ```
*/
@Test
public void deleteAccountUserTest() {
String accountId = null;
String userId = null;
// Void response = api.deleteAccountUser(accountId, userId);
// TODO: test validations
}
/**
* Details of the user.
*
* Retrieve user details. **Example:** ``` curl -X GET
* https://api.us-east-1.mbedcloud.com/v3/accounts/{account_id}/users/{user_id} \\ -H 'Authorization: Bearer
* <api_key>' ```
*/
@Test
public void getAccountUserTest() {
String accountId = null;
String userId = null;
// UserInfoResp response = api.getAccountUser(accountId, userId);
// TODO: test validations
}
/**
* Get the details of all users.
*
* Retrieve details of all users. **Example:** ``` curl -X GET
* https://api.us-east-1.mbedcloud.com/v3/accounts/{account_id}/users \\ -H 'Authorization: Bearer
* <api_key>' ```
*/
@Test
public void getAllAccountUsersTest() {
String accountId = null;
Integer limit = null;
String after = null;
String order = null;
String include = null;
String emailEq = null;
String statusEq = null;
String statusIn = null;
String statusNin = null;
String loginProfilesEq = null;
// UserInfoRespList response = api.getAllAccountUsers(accountId, limit, after, order, include, emailEq,
// statusEq, statusIn, statusNin, loginProfilesEq);
// TODO: test validations
}
/**
* Get user's groups.
*
* Retrieve user's groups. **Example:** ``` curl -X GET
* https://api.us-east-1.mbedcloud.com/v3/accounts/{account_id}/users/{user_id}/groups \\ -H 'Authorization:
* Bearer <api_key>' ```
*/
@Test
public void getGroupsOfAccountUserTest() {
String accountId = null;
String userId = null;
Integer limit = null;
String after = null;
String order = null;
String include = null;
// GroupSummaryList response = api.getGroupsOfAccountUser(accountId, userId, limit, after, order, include);
// TODO: test validations
}
/**
* Remove user from groups.
*
* Remove user from groups. **Example:** ``` curl -X DELETE
* https://api.us-east-1.mbedcloud.com/v3/accounts/{account_id}/users/{user_id}/groups \\ -H 'Authorization:
* Bearer <api_key>' \\ -H 'content-type: application/json' \\ -d
* '[\"0162056a9a1586f30242590700000000\",\"0117056a9a1586f30242590700000000\"]'
* ```
*/
@Test
public void removeAccountUserFromGroupsTest() {
String accountId = null;
String userId = null;
List<String> body = null;
// UpdatedResponse response = api.removeAccountUserFromGroups(accountId, userId, body);
// TODO: test validations
}
/**
* Update user details.
*
* Update user details. **Example:** ``` curl -X PUT
* https://api.us-east-1.mbedcloud.com/v3/accounts/{account_id}/users/{user_id} \\ -H 'Authorization: Bearer
* <api_key>' \\ -H 'content-type: application/json' \\ -d '{\"username\":
* \"myusername\"}' ```
*/
@Test
public void updateAccountUserTest() {
String accountId = null;
String userId = null;
UserUpdateReq body = null;
// UserInfoResp response = api.updateAccountUser(accountId, userId, body);
// TODO: test validations
}
/**
* Validate the user email.
*
* Validate user email. **Example:** ``` curl -X POST
* https://api.us-east-1.mbedcloud.com/v3/accounts/{account_id}/users/{user_id}/validate-email \\ -H
* 'Authorization: Bearer <api_key>' ```
*/
@Test
public void validateAccountUserEmailTest() {
String accountId = null;
String userId = null;
// Void response = api.validateAccountUserEmail(accountId, userId);
// TODO: test validations
}
}
| [
"[email protected]"
]
| |
6bad389233a522f4d52b957e1ece24623ebf592e | 139960e2d7d55e71c15e6a63acb6609e142a2ace | /mobile_app1/module1063/src/main/java/module1063packageJava0/Foo4.java | 16a9f8d5c1d9488e3cd8af807b9ddfb56d16d38f | [
"Apache-2.0"
]
| permissive | uber-common/android-build-eval | 448bfe141b6911ad8a99268378c75217d431766f | 7723bfd0b9b1056892cef1fef02314b435b086f2 | refs/heads/master | 2023-02-18T22:25:15.121902 | 2023-02-06T19:35:34 | 2023-02-06T19:35:34 | 294,831,672 | 83 | 7 | Apache-2.0 | 2021-09-24T08:55:30 | 2020-09-11T23:27:37 | Java | UTF-8 | Java | false | false | 549 | java | package module1063packageJava0;
import java.lang.Integer;
public class Foo4 {
Integer int0;
Integer int1;
public void foo0() {
new module1063packageJava0.Foo3().foo9();
}
public void foo1() {
foo0();
}
public void foo2() {
foo1();
}
public void foo3() {
foo2();
}
public void foo4() {
foo3();
}
public void foo5() {
foo4();
}
public void foo6() {
foo5();
}
public void foo7() {
foo6();
}
public void foo8() {
foo7();
}
public void foo9() {
foo8();
}
}
| [
"[email protected]"
]
| |
f9ee0e6798dca3839114283f95b283e0f0b37c1d | a24ebf6e2f750266ed16203be384d105c11fcf3c | /gori-sys/src/main/java/cn/gori/service/impl/SysRoleMenuServiceImpl.java | b1f6d34037d5108faacadd39b24f633871e447e1 | []
| no_license | chuckma/gori | b548a5acde419b501940aaf92a76124fda4b20f3 | 0f8277f54dbc0a62c52052948d8eaef690cfdf2f | refs/heads/master | 2020-04-13T10:40:50.445613 | 2018-12-26T09:15:35 | 2018-12-26T09:15:35 | 163,148,954 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 481 | java | package cn.gori.service.impl;
import cn.gori.entity.SysRoleMenu;
import cn.gori.mapper.SysRoleMenuMapper;
import cn.gori.service.ISysRoleMenuService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author Ma
* @since 2018-12-26
*/
@Service
public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRoleMenu> implements ISysRoleMenuService {
}
| [
"[email protected]"
]
| |
c7f2212f1a2d0949d7602553c463587387c6ab8d | 590b75b4fcaabef602d39f43daa11a3d79474548 | /Rock-Paper-Scissor/src/main/java/com/chris/interview/client/ropasci/factories/PlayerFactory.java | d14c58b2cbb428075ff0f8dd1c049c29727900d4 | []
| no_license | Christian-Achilli/ropasci | 812bf94f8a415c0fc79114946aa5a02fb9123d40 | 2d82f6dde748ae77869ad3031dcd378584b7276e | refs/heads/master | 2021-01-21T12:39:30.780835 | 2013-01-31T02:27:00 | 2013-01-31T02:27:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 608 | java | package com.chris.interview.client.ropasci.factories;
import java.util.ArrayList;
import java.util.List;
import com.chris.interview.client.ropasci.entities.Player;
import com.chris.interview.client.ropasci.exceptions.PlayerNameAlreadyInUse;
public class PlayerFactory {
private List<String> activePlayerNames;
public PlayerFactory() {
activePlayerNames = new ArrayList<String>();
}
public Player createPlayer(String playerName) throws PlayerNameAlreadyInUse {
if (activePlayerNames.contains(playerName.toLowerCase()))
throw new PlayerNameAlreadyInUse();
return new Player(playerName);
}
}
| [
"[email protected]"
]
| |
cd8f6cbd3e7df1940e4f05319a26e16e00e2858b | 8d983a7bbdaaabe7617c6cd4604916d6ee2598e4 | /genome-weaver/src/main/java/org/utgenome/weaver/cui/Copy.java | 2d2bfbb65b68692110d7194367253de9a0b838a4 | [
"Apache-2.0"
]
| permissive | xerial/utgb | e8582cf0c2d6c72d9d0fd068dc0a32970de7106d | da55ba7629e44ce329b5ec11e209e448ecb41eac | refs/heads/master | 2023-06-25T19:13:52.058940 | 2012-12-11T06:48:55 | 2012-12-11T06:48:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,628 | java | /*--------------------------------------------------------------------------
* Copyright 2009 Taro L. Saito
*
* 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.
*--------------------------------------------------------------------------*/
//--------------------------------------
// Xerial Silk Weaver Project
//
// Copy.java
// Since: 2009/07/22 16:33:09
//
// $URL$
// $Author$
//--------------------------------------
package org.utgenome.weaver.cui;
import java.io.File;
import org.utgenome.weaver.util.FileCopy;
import org.utgenome.weaver.util.FileCopy.Config;
import org.xerial.util.StopWatch;
import org.xerial.util.log.Logger;
import org.xerial.util.opt.Argument;
import org.xerial.util.opt.Option;
/**
* File copy command
*
* @author leo
*
*/
public class Copy implements WeaverCommand {
private static Logger _logger = Logger.getLogger(Copy.class);
@Argument(index = 0, name = "src")
private String src;
@Argument(index = 1, name = "dest")
private String dest;
@Option(symbol = "b", longName = "buffersize", varName = "KB", description = "buffer size in KB (default = 64KB)")
private int bufferSizeInKB = 64;
public void execute(WeaverModule module, String[] unusedArgs) throws Exception {
StopWatch timer = new StopWatch();
timer.reset();
_logger.debug(String.format("copy from %s to %s", src, dest));
_logger.debug(String.format("buffer size = %d KB", bufferSizeInKB));
File s = new File(src);
File t = new File(dest);
Config config = new Config();
config.BLOCK_SIZE = bufferSizeInKB * 1024;
FileCopy.copy(s, t, config);
double time = timer.getElapsedTime();
double mbPerSec = (s.length() / (double) (1024 * 1024)) / time;
_logger.debug(String.format("elapsed time: %.2f sec. %.2f MB/sec", time, mbPerSec));
}
public String getCommandName() {
return "cp";
}
public String getOneLineDescription() {
return "fast file copy utility";
}
}
| [
"[email protected]"
]
| |
be53922a136cb679412d2105a565af96b88c86d2 | a78ebe7e2fd192f2ec265e7239a4bcd3db8295fe | /lab03/3001 Lab 3 code skeleton/TSP.java | faa5faa531506dea5ada370cd99f040e209f2699 | []
| no_license | jonathan9697/cits3001 | b6f39f9f1e21cfe068df6ec830e5554435cee7d0 | 68f4c63f4171e988451b1527f06b4c5c46d4699a | refs/heads/master | 2022-11-30T06:41:20.879115 | 2020-08-14T12:25:34 | 2020-08-14T12:25:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,214 | java | /**
* Implements various TSP algorithms for the given problem instance.
*/
import java.util.*;
public class TSP
{
// file containing this problem instance
private String filename;
// number of cities in this instance
private int n;
// coordinates of the cities
private double[][] cities;
// table of distances between cities
private double[][] table;
/**
* Reads in the city locations from filename, one per line.
* Sets up n and cities, and calculates all inter-city distances for table.
*/
public TSP(String filename)
{
this.filename = filename;
FileIO f = new FileIO(this.filename);
n = f.getLines().size();
cities = new double[n][2];
for (int k = 0; k < n; k++)
{
String[] xs = f.getLines().get(k).split(" ");
cities[k][0] = Double.parseDouble(xs[0]);
cities[k][1] = Double.parseDouble(xs[1]);
}
table = new double[n][n];
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
table[i][j] = cost(cities[i][0], cities[i][1], cities[j][0], cities[j][1]);
}
/**
* Returns the shortest tour found using the NN algorithm, or an error indication.
*/
public int[] tspnn()
{
// sends the table to to the nearest neighbour tspnn
// that is the table?
int[] cs = NearestNeighbour.tspnn(table); // cs = shortest tour
// sends cs to validate method
double s = validate(cs); // does checks and returns total cost of method
if (s <= 0) return new int[] {(int) s}; // error check s?
else return cs; // returns shortest tour
}
/**
* Returns the tour derived by applying 2-OPT to cs repeatedly in greedy fashion,
* or an error indication.
*/
public int[] tsp2opt(int[] cs)
{
cs = NearestNeighbour.tsp2opt(cs, table);
double s = validate(cs); //does checks and returns total cost of method
if (s <= 0) return new int[] {(int) s};
else return cs;
}
/**
* Checks if cs is a valid tour and returns either its cost or an error indication.
*/
public double validate(int[] cs)
{
if (cs.length != n) return 0;
for (int c = 0; c < n; c++)
//ison checks cs contains c
if (!ison(c, cs)) return -c;
// roundtrip calculates the total cost of the tour
return roundtrip(cs);
}
/**
* Returns true iff c is on cs.
*/
private boolean ison(int c, int[] cs)
{
for (int k = 0; k < n; k++)
if (cs[k] == c) return true;
return false;
}
/**
* Returns the total cost for the circular tour cs.
*/
private double roundtrip(int[] cs)
{
double z = table[cs[0]][cs[n-1]];
for (int k = 0; k < n-1; k++) z += table[cs[k]][cs[k+1]];
return z;
}
/**
* Returns the cost of travel between x1,y1 and x2,y2.
*/
private static double cost(double x1, double y1, double x2, double y2)
{
return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
}
}
| [
"[email protected]"
]
| |
341cdefdc7252cbb2b2970d002396a9c8fccdb53 | 8d8f96bbbdd946a2b0889046d5dfd8630facb70b | /src/main/java/com/springsecurity/jwt/config/SpringSecurityConfig.java | 4ec144eac3f7da7b07ac08cc35620bc05ad4de00 | []
| no_license | ramesh96420/springsecurity-jwt-h2db | 5c762c3e98a57b69d4df45a8dbb69cc14e0b3337 | b71e688f0959a9d4413b3a772d0c761e553a02b7 | refs/heads/master | 2020-12-20T03:23:00.416721 | 2020-01-24T05:36:56 | 2020-01-24T05:36:56 | 235,946,203 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,269 | java | package com.springsecurity.jwt.config;
import com.springsecurity.jwt.filter.JwtFilter;
import com.springsecurity.jwt.service.CustomUserDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.BeanIds;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.password.NoOpPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
@Configuration
@EnableWebSecurity
public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private CustomUserDetailsService userDetailsService;
@Autowired
private JwtFilter jwtFilter;
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService);
}
@Bean
public PasswordEncoder passwordEncoder(){
return NoOpPasswordEncoder.getInstance();
}
@Bean(name = BeanIds.AUTHENTICATION_MANAGER)
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable().authorizeRequests().antMatchers("/authenticate").permitAll().anyRequest().authenticated()
.and().exceptionHandling().and().sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS);
http.addFilterBefore(jwtFilter, UsernamePasswordAuthenticationFilter.class);;
}
}
| [
"[email protected]"
]
| |
77630c7fbc480faa0d154da9ab9419040fa7f6e1 | 26d43598ccbba6840a53cc069615edd7dcdf0ba3 | /Forelesning11/PlayingWithSQLiteLecture/app/src/main/java/com/example/perev/playingwithsqlitelecture/database/EpisodeTable.java | 573e10d70a8d9af3b6c5e331379d8378fe63bc3b | []
| no_license | perev/android_programmering_2016 | 7191ef9fa3f453c747fa29101d5f42fbeb0c9ee8 | e688a079c7257deed925e5d244b12746777c6175 | refs/heads/master | 2016-08-09T13:57:52.120552 | 2016-02-24T12:09:57 | 2016-02-24T12:09:57 | 49,580,249 | 1 | 5 | null | null | null | null | UTF-8 | Java | false | false | 1,376 | java | package com.example.perev.playingwithsqlitelecture.database;
import android.database.sqlite.SQLiteDatabase;
/**
* Created by perev on 17/02/2016.
*/
public class EpisodeTable {
public static final String TABLE_EPISODE = "episode";
public static final String COLUMN_ID = "_id";
public static final String COLUMN_SHOW_ID = "show_id";
public static final String COLUMN_TITLE = "name";
public static final String COLUMN_EPISODE = "episode";
public static final String COLUMN_SEASON = "season";
public static final String COLUMN_OVERVIEW = "overview";
public static final String DATABASE_CREATE_EPISODE =
"create table " + TABLE_EPISODE + "(" +
COLUMN_ID + " integer primary key autoincrement, " +
COLUMN_SHOW_ID + " integer not null, " +
COLUMN_TITLE + " text not null, " +
COLUMN_EPISODE + " integer not null, " +
COLUMN_SEASON + " integer not null, " +
COLUMN_OVERVIEW + " text" + ");";
public static void onCreate(SQLiteDatabase database){
database.execSQL(DATABASE_CREATE_EPISODE);
}
public static void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion){
database.execSQL("DROP TABLE IF EXISTS " + TABLE_EPISODE);
onCreate(database);
}
}
| [
"[email protected]"
]
| |
dd9d42eaa4cd5a25b56199554872d8b2e7b20d32 | 5c29d6f509ef0f87f288afeb312cd1f126277457 | /src/java/nio/channels/spi/AbstractSelectionKey.java | 3cc7ee016a69319d64ac1e6d0553a2565df93d26 | [
"Apache-2.0"
]
| permissive | Golde-nchow/jdk-1.7-annotated | d1c30cebbc0b968873b60e0a9cca3e1e85d17d42 | 726f675973e8498ea4afca13393f692e95255b94 | refs/heads/master | 2021-07-14T15:25:05.610358 | 2020-11-02T16:03:08 | 2020-11-02T16:03:08 | 221,722,100 | 0 | 0 | Apache-2.0 | 2019-11-14T14:53:58 | 2019-11-14T14:53:55 | null | UTF-8 | Java | false | false | 1,515 | java | /*
* Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package java.nio.channels.spi;
import java.nio.channels.*;
/**
* Base implementation class for selection keys.
*
* <p> This class tracks the validity of the key and implements cancellation.
*
* @author Mark Reinhold
* @author JSR-51 Expert Group
* @since 1.4
*/
public abstract class AbstractSelectionKey
extends SelectionKey
{
/**
* Initializes a new instance of this class. </p>
*/
protected AbstractSelectionKey() { }
private volatile boolean valid = true;
public final boolean isValid() {
return valid;
}
void invalidate() { // package-private
valid = false;
}
/**
* Cancels this key.
*
* <p> If this key has not yet been cancelled then it is added to its
* selector's cancelled-key set while synchronized on that set. </p>
*/
public final void cancel() {
// Synchronizing "this" to prevent this key from getting canceled
// multiple times by different threads, which might cause race
// condition between selector's select() and channel's close().
synchronized (this) {
if (valid) {
valid = false;
((AbstractSelector)selector()).cancel(this);
}
}
}
}
| [
"[email protected]"
]
| |
3bb6620ac00a64026ac558eab6574801192d4c5a | d5264d69be648c5ed478a4d11c75c3862ddb8728 | /code_rhapsody/AppCitoyente/DefaultComponent/DefaultConfig/MainDefaultComponent.java | 7b31d533b844419e49b9a453f9b86ccaf902b20f | [
"MIT"
]
| permissive | alwikah/nuitdelinfo | 17ae28dba27bc13f751eebc376e9dd38e43b28e1 | a859ee156f8b8fe0563d5f2da57aa8b911f746da | refs/heads/master | 2020-12-11T05:54:05.412236 | 2016-01-28T13:30:12 | 2016-01-28T13:30:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,424 | java | /*********************************************************************
Rhapsody : 8.1.1
Login : marckan
Component : DefaultComponent
Configuration : DefaultConfig
Model Element : DefaultConfig
//! Generated Date : Fri, 4, Dec 2015
File Path : DefaultComponent/DefaultConfig/MainDefaultComponent.java
*********************************************************************/
//## auto_generated
import Default.*;
//## auto_generated
import com.ibm.rational.rhapsody.oxf.*;
//## auto_generated
import com.ibm.rational.rhapsody.animcom.*;
//----------------------------------------------------------------------------
// MainDefaultComponent.java
//----------------------------------------------------------------------------
//## ignore
public class MainDefaultComponent {
//#[ ignore
// link with events in order to register them in the animation browser
static {
// Setting Animation Default Port
AnimTcpIpConnection.setDefaultPort(6423);
// Registering Events
try {
Class.forName("Default.EnvoieDonnees");
Class.forName("Default.EventAnalyseDonnees");
Class.forName("Default.EventAnalyseSituation");
Class.forName("Default.EventEnAttente");
Class.forName("Default.EventEnvoieDonneesToCentre");
Class.forName("Default.EventEnvoieDonneesToServer");
Class.forName("Default.EventEnvoieRequeteToUser");
Class.forName("Default.EventEtatNormal");
Class.forName("Default.EventFaitRequeeServeur");
Class.forName("Default.EventFaitRequeteServeur");
Class.forName("Default.EventFaitRequteServeur");
Class.forName("Default.EventRecoieRequeteFromServer");
Class.forName("Default.EventRecoitDonneesFromUser");
Class.forName("Default.EventRecoitRequete");
Class.forName("Default.EventRecoitRequeteFromCentre");
Class.forName("Default.EventRecolteRenseignements");
Class.forName("Default.EventRegroupeInformations");
Class.forName("Default.EventRequeteAttente");
Class.forName("Default.EventRequeteBDD");
Class.forName("Default.EventRequeteExecute");
Class.forName("Default.EventRetourNormalServer");
Class.forName("Default.EventRetourNormalUser");
Class.forName("Default.EventVoitIncident");
Class.forName("Default.RecoitRequeteServeur");
// Registering Static Classes
}
catch(Exception e) {
java.lang.System.err.println(e.toString());
e.printStackTrace(java.lang.System.err);
}
}
//#]
private Default_pkgClass initializer_Default = new Default_pkgClass(RiJMainThread.instance());
//## configuration DefaultComponent::DefaultConfig
public static void main(String[] args) {
RiJOXF.Init(null, 0, 0, true, args);
MainDefaultComponent initializer_DefaultComponent = new MainDefaultComponent();
//#[ configuration DefaultComponent::DefaultConfig
//#]
RiJOXF.Start();
}
}
/*********************************************************************
File Path : DefaultComponent/DefaultConfig/MainDefaultComponent.java
*********************************************************************/
| [
"[email protected]"
]
| |
24d667981412bd2eb362dc7a2d19078925be6572 | 0d4cb6b0110173d7d6a9aec6d29917e86d7dea16 | /VektorelErsan/src/com/iterator2/Lokanta.java | dac77ef7bc5571f9791af1b6da6f7b868619f5ff | []
| no_license | ersanoturakci/vektorelkodlar | 07b7dd14ab4a9fe1e30ff3a1113055349b519546 | 7cc265206b9402b450e7e39d5d4532e204a61c96 | refs/heads/master | 2021-01-19T17:41:25.147846 | 2017-04-29T10:13:33 | 2017-04-29T10:13:33 | 88,339,462 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 286 | java | package com.iterator2;
public class Lokanta {
String name;
String adres;
public Lokanta(String name, String adres) {
this.name=name;
this.adres=adres;
}
public String getAdres() {
return adres;
}
public String getName() {
return name;
}
}
| [
"vektorel@lab4-10"
]
| vektorel@lab4-10 |
438a282fc697ab9b82b3fbda42b46f9d00f30a6d | d5f09c7b0e954cd20dd613af600afd91b039c48a | /sources/kotlin/jvm/internal/ArrayIteratorKt.java | 3ac49f0f7c76facff193304be7d7ba8f7a936712 | []
| no_license | t0HiiBwn/CoolapkRelease | af5e00c701bf82c4e90b1033f5c5f9dc8526f4b3 | a6a2b03e32cde0e5163016e0078391271a8d33ab | refs/heads/main | 2022-07-29T23:28:35.867734 | 2021-03-26T11:41:18 | 2021-03-26T11:41:18 | 345,290,891 | 5 | 2 | null | null | null | null | UTF-8 | Java | false | false | 767 | java | package kotlin.jvm.internal;
import java.util.Iterator;
import kotlin.Metadata;
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u0012\n\u0000\n\u0002\u0010(\n\u0002\b\u0002\n\u0002\u0010\u0011\n\u0002\b\u0002\u001a%\u0010\u0000\u001a\b\u0012\u0004\u0012\u0002H\u00020\u0001\"\u0004\b\u0000\u0010\u00022\f\u0010\u0003\u001a\b\u0012\u0004\u0012\u0002H\u00020\u0004¢\u0006\u0002\u0010\u0005¨\u0006\u0006"}, d2 = {"iterator", "", "T", "array", "", "([Ljava/lang/Object;)Ljava/util/Iterator;", "kotlin-stdlib"}, k = 2, mv = {1, 4, 1})
/* compiled from: ArrayIterator.kt */
public final class ArrayIteratorKt {
public static final <T> Iterator<T> iterator(T[] tArr) {
Intrinsics.checkNotNullParameter(tArr, "array");
return new ArrayIterator(tArr);
}
}
| [
"[email protected]"
]
| |
2948b3b2c30f4eeed8e7fc2abd2c48eb83fda979 | b1960228690b60ce4a9681b7ea5a56507ad6fa56 | /src/me/chan/thread/multithread/CountDownLatchTest.java | acba698924604b05097023afb08a81f58e68f58d | []
| no_license | JanGin/MultiThreadDemo | b6d00c20ac7ca1fc45555bf70f5384f5d98c263d | 37aaf7052e53dd240f5e4d17d38f4f2178a72edf | refs/heads/master | 2020-05-20T11:45:37.209629 | 2019-05-24T08:58:19 | 2019-05-24T08:58:19 | 185,556,694 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 736 | java | package me.chan.thread.multithread;
import java.util.concurrent.CountDownLatch;
public class CountDownLatchTest {
private static CountDownLatch cdl = new CountDownLatch(10);
public static void main(String[] args) {
for (int i=0; i<10; i++) {
Thread testThread = new Thread(new TestThread(), "Thread-"+i);
testThread.start();
}
try {
cdl.await();
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
System.out.println("人到齐了!!");
}
}
static class TestThread implements Runnable {
@Override
public void run() {
System.out.println(Thread.currentThread().getName()+"到了!");
cdl.countDown();
}
}
}
| [
"[email protected]"
]
| |
be317354913ccfa948b64edb2998ec3e1f116941 | a6ecc37acbc458d521087c9bd8a46d9977beb970 | /core/java/android/content/AbstractTableMerger.java | e1a484e3363dae82ab8e6e15f533bbfcd99cddd0 | [
"Apache-2.0"
]
| permissive | jsherman/platform_frameworks_base | 46f4336a8f774299f6520d9a481184331758062d | 9bdf576615231e4b9693f08bfe3dc886c2edf49e | refs/heads/master | 2021-01-18T09:21:28.294775 | 2009-01-02T23:55:15 | 2009-01-02T23:55:15 | 101,820 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 24,665 | java | /*
* Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.content;
import android.database.Cursor;
import android.database.DatabaseUtils;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import android.os.Debug;
import static android.provider.SyncConstValue._SYNC_ACCOUNT;
import static android.provider.SyncConstValue._SYNC_DIRTY;
import static android.provider.SyncConstValue._SYNC_ID;
import static android.provider.SyncConstValue._SYNC_LOCAL_ID;
import static android.provider.SyncConstValue._SYNC_MARK;
import static android.provider.SyncConstValue._SYNC_VERSION;
import android.text.TextUtils;
import android.util.Log;
/**
* @hide
*/
public abstract class AbstractTableMerger
{
private ContentValues mValues;
protected SQLiteDatabase mDb;
protected String mTable;
protected Uri mTableURL;
protected String mDeletedTable;
protected Uri mDeletedTableURL;
static protected ContentValues mSyncMarkValues;
static private boolean TRACE;
static {
mSyncMarkValues = new ContentValues();
mSyncMarkValues.put(_SYNC_MARK, 1);
TRACE = false;
}
private static final String TAG = "AbstractTableMerger";
private static final String[] syncDirtyProjection =
new String[] {_SYNC_DIRTY, "_id", _SYNC_ID, _SYNC_VERSION};
private static final String[] syncIdAndVersionProjection =
new String[] {_SYNC_ID, _SYNC_VERSION};
private volatile boolean mIsMergeCancelled;
private static final String SELECT_MARKED = _SYNC_MARK + "> 0 and " + _SYNC_ACCOUNT + "=?";
private static final String SELECT_BY_ID_AND_ACCOUNT =
_SYNC_ID +"=? and " + _SYNC_ACCOUNT + "=?";
private static final String SELECT_UNSYNCED = ""
+ _SYNC_DIRTY + " > 0 and (" + _SYNC_ACCOUNT + "=? or " + _SYNC_ACCOUNT + " is null)";
public AbstractTableMerger(SQLiteDatabase database,
String table, Uri tableURL, String deletedTable,
Uri deletedTableURL)
{
mDb = database;
mTable = table;
mTableURL = tableURL;
mDeletedTable = deletedTable;
mDeletedTableURL = deletedTableURL;
mValues = new ContentValues();
}
public abstract void insertRow(ContentProvider diffs,
Cursor diffsCursor);
public abstract void updateRow(long localPersonID,
ContentProvider diffs, Cursor diffsCursor);
public abstract void resolveRow(long localPersonID,
String syncID, ContentProvider diffs, Cursor diffsCursor);
/**
* This is called when it is determined that a row should be deleted from the
* ContentProvider. The localCursor is on a table from the local ContentProvider
* and its current position is of the row that should be deleted. The localCursor
* contains the complete projection of the table.
* <p>
* It is the responsibility of the implementation of this method to ensure that the cursor
* points to the next row when this method returns, either by calling Cursor.deleteRow() or
* Cursor.next().
*
* @param localCursor The Cursor into the local table, which points to the row that
* is to be deleted.
*/
public void deleteRow(Cursor localCursor) {
localCursor.deleteRow();
}
/**
* After {@link #merge} has completed, this method is called to send
* notifications to {@link android.database.ContentObserver}s of changes
* to the containing {@link ContentProvider}. These notifications likely
* do not want to request a sync back to the network.
*/
protected abstract void notifyChanges();
private static boolean findInCursor(Cursor cursor, int column, String id) {
while (!cursor.isAfterLast() && !cursor.isNull(column)) {
int comp = id.compareTo(cursor.getString(column));
if (comp > 0) {
cursor.moveToNext();
continue;
}
return comp == 0;
}
return false;
}
public void onMergeCancelled() {
mIsMergeCancelled = true;
}
/**
* Carry out a merge of the given diffs, and add the results to
* the given MergeResult. If we are the first merge to find
* client-side diffs, we'll use the given ContentProvider to
* construct a temporary instance to hold them.
*/
public void merge(final SyncContext context,
final String account,
final SyncableContentProvider serverDiffs,
TempProviderSyncResult result,
SyncResult syncResult, SyncableContentProvider temporaryInstanceFactory) {
mIsMergeCancelled = false;
if (serverDiffs != null) {
if (!mDb.isDbLockedByCurrentThread()) {
throw new IllegalStateException("this must be called from within a DB transaction");
}
mergeServerDiffs(context, account, serverDiffs, syncResult);
notifyChanges();
}
if (result != null) {
findLocalChanges(result, temporaryInstanceFactory, account, syncResult);
}
if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "merge complete");
}
private void mergeServerDiffs(SyncContext context,
String account, SyncableContentProvider serverDiffs, SyncResult syncResult) {
boolean diffsArePartial = serverDiffs.getContainsDiffs();
// mark the current rows so that we can distinguish these from new
// inserts that occur during the merge
mDb.update(mTable, mSyncMarkValues, null, null);
if (mDeletedTable != null) {
mDb.update(mDeletedTable, mSyncMarkValues, null, null);
}
// load the local database entries, so we can merge them with the server
final String[] accountSelectionArgs = new String[]{account};
Cursor localCursor = mDb.query(mTable, syncDirtyProjection,
SELECT_MARKED, accountSelectionArgs, null, null,
mTable + "." + _SYNC_ID);
Cursor deletedCursor;
if (mDeletedTable != null) {
deletedCursor = mDb.query(mDeletedTable, syncIdAndVersionProjection,
SELECT_MARKED, accountSelectionArgs, null, null,
mDeletedTable + "." + _SYNC_ID);
} else {
deletedCursor =
mDb.rawQuery("select 'a' as _sync_id, 'b' as _sync_version limit 0", null);
}
// Apply updates and insertions from the server
Cursor diffsCursor = serverDiffs.query(mTableURL,
null, null, null, mTable + "." + _SYNC_ID);
int deletedSyncIDColumn = deletedCursor.getColumnIndexOrThrow(_SYNC_ID);
int deletedSyncVersionColumn = deletedCursor.getColumnIndexOrThrow(_SYNC_VERSION);
int serverSyncIDColumn = diffsCursor.getColumnIndexOrThrow(_SYNC_ID);
int serverSyncVersionColumn = diffsCursor.getColumnIndexOrThrow(_SYNC_VERSION);
int serverSyncLocalIdColumn = diffsCursor.getColumnIndexOrThrow(_SYNC_LOCAL_ID);
String lastSyncId = null;
int diffsCount = 0;
int localCount = 0;
localCursor.moveToFirst();
deletedCursor.moveToFirst();
while (diffsCursor.moveToNext()) {
if (mIsMergeCancelled) {
localCursor.close();
deletedCursor.close();
diffsCursor.close();
return;
}
mDb.yieldIfContended();
String serverSyncId = diffsCursor.getString(serverSyncIDColumn);
String serverSyncVersion = diffsCursor.getString(serverSyncVersionColumn);
long localPersonID = 0;
String localSyncVersion = null;
diffsCount++;
context.setStatusText("Processing " + diffsCount + "/"
+ diffsCursor.getCount());
if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "processing server entry " +
diffsCount + ", " + serverSyncId);
if (TRACE) {
if (diffsCount == 10) {
Debug.startMethodTracing("atmtrace");
}
if (diffsCount == 20) {
Debug.stopMethodTracing();
}
}
boolean conflict = false;
boolean update = false;
boolean insert = false;
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "found event with serverSyncID " + serverSyncId);
}
if (TextUtils.isEmpty(serverSyncId)) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.e(TAG, "server entry doesn't have a serverSyncID");
}
continue;
}
// It is possible that the sync adapter wrote the same record multiple times,
// e.g. if the same record came via multiple feeds. If this happens just ignore
// the duplicate records.
if (serverSyncId.equals(lastSyncId)) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "skipping record with duplicate remote server id " + lastSyncId);
}
continue;
}
lastSyncId = serverSyncId;
String localSyncID = null;
boolean localSyncDirty = false;
while (!localCursor.isAfterLast()) {
if (mIsMergeCancelled) {
localCursor.deactivate();
deletedCursor.deactivate();
diffsCursor.deactivate();
return;
}
localCount++;
localSyncID = localCursor.getString(2);
// If the local record doesn't have a _sync_id then
// it is new. Ignore it for now, we will send an insert
// the the server later.
if (TextUtils.isEmpty(localSyncID)) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "local record " +
localCursor.getLong(1) +
" has no _sync_id, ignoring");
}
localCursor.moveToNext();
localSyncID = null;
continue;
}
int comp = serverSyncId.compareTo(localSyncID);
// the local DB has a record that the server doesn't have
if (comp > 0) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "local record " +
localCursor.getLong(1) +
" has _sync_id " + localSyncID +
" that is < server _sync_id " + serverSyncId);
}
if (diffsArePartial) {
localCursor.moveToNext();
} else {
deleteRow(localCursor);
if (mDeletedTable != null) {
mDb.delete(mDeletedTable, _SYNC_ID +"=?", new String[] {localSyncID});
}
syncResult.stats.numDeletes++;
mDb.yieldIfContended();
}
localSyncID = null;
continue;
}
// the server has a record that the local DB doesn't have
if (comp < 0) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "local record " +
localCursor.getLong(1) +
" has _sync_id " + localSyncID +
" that is > server _sync_id " + serverSyncId);
}
localSyncID = null;
}
// the server and the local DB both have this record
if (comp == 0) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "local record " +
localCursor.getLong(1) +
" has _sync_id " + localSyncID +
" that matches the server _sync_id");
}
localSyncDirty = localCursor.getInt(0) != 0;
localPersonID = localCursor.getLong(1);
localSyncVersion = localCursor.getString(3);
localCursor.moveToNext();
}
break;
}
// If this record is in the deleted table then update the server version
// in the deleted table, if necessary, and then ignore it here.
// We will send a deletion indication to the server down a
// little further.
if (findInCursor(deletedCursor, deletedSyncIDColumn, serverSyncId)) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "remote record " + serverSyncId + " is in the deleted table");
}
final String deletedSyncVersion = deletedCursor.getString(deletedSyncVersionColumn);
if (!TextUtils.equals(deletedSyncVersion, serverSyncVersion)) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "setting version of deleted record " + serverSyncId + " to "
+ serverSyncVersion);
}
ContentValues values = new ContentValues();
values.put(_SYNC_VERSION, serverSyncVersion);
mDb.update(mDeletedTable, values, "_sync_id=?", new String[]{serverSyncId});
}
continue;
}
// If the _sync_local_id is set and > -1 in the diffsCursor
// then this record corresponds to a local record that was just
// inserted into the server and the _sync_local_id is the row id
// of the local record. Set these fields so that the next check
// treats this record as an update, which will allow the
// merger to update the record with the server's sync id
long serverLocalSyncId =
diffsCursor.isNull(serverSyncLocalIdColumn)
? -1
: diffsCursor.getLong(serverSyncLocalIdColumn);
if (serverLocalSyncId > -1) {
if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "the remote record with sync id "
+ serverSyncId + " has a local sync id, "
+ serverLocalSyncId);
localSyncID = serverSyncId;
localSyncDirty = false;
localPersonID = serverLocalSyncId;
localSyncVersion = null;
}
if (!TextUtils.isEmpty(localSyncID)) {
// An existing server item has changed
boolean recordChanged = (localSyncVersion == null) ||
!serverSyncVersion.equals(localSyncVersion);
if (recordChanged) {
if (localSyncDirty) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG,
"remote record " +
serverSyncId +
" conflicts with local _sync_id " +
localSyncID + ", local _id " +
localPersonID);
}
conflict = true;
} else {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG,
"remote record " +
serverSyncId +
" updates local _sync_id " +
localSyncID + ", local _id " +
localPersonID);
}
update = true;
}
}
} else {
// the local db doesn't know about this record so add it
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "remote record "
+ serverSyncId + " is new, inserting");
}
insert = true;
}
if (update) {
updateRow(localPersonID, serverDiffs, diffsCursor);
syncResult.stats.numUpdates++;
} else if (conflict) {
resolveRow(localPersonID, serverSyncId, serverDiffs,
diffsCursor);
syncResult.stats.numUpdates++;
} else if (insert) {
insertRow(serverDiffs, diffsCursor);
syncResult.stats.numInserts++;
}
}
if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "processed " + diffsCount +
" server entries");
// If tombstones aren't in use delete any remaining local rows that
// don't have corresponding server rows. Keep the rows that don't
// have a sync id since those were created locally and haven't been
// synced to the server yet.
if (!diffsArePartial) {
while (!localCursor.isAfterLast() &&
!TextUtils.isEmpty(localCursor.getString(2))) {
if (mIsMergeCancelled) {
localCursor.deactivate();
deletedCursor.deactivate();
diffsCursor.deactivate();
return;
}
localCount++;
final String localSyncId = localCursor.getString(2);
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG,
"deleting local record " +
localCursor.getLong(1) +
" _sync_id " + localSyncId);
}
deleteRow(localCursor);
if (mDeletedTable != null) {
mDb.delete(mDeletedTable, _SYNC_ID + "=?", new String[] {localSyncId});
}
syncResult.stats.numDeletes++;
mDb.yieldIfContended();
}
}
if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "checked " + localCount +
" local entries");
diffsCursor.deactivate();
localCursor.deactivate();
deletedCursor.deactivate();
if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "applying deletions from the server");
// Apply deletions from the server
if (mDeletedTableURL != null) {
diffsCursor = serverDiffs.query(mDeletedTableURL, null, null, null, null);
serverSyncIDColumn = diffsCursor.getColumnIndexOrThrow(_SYNC_ID);
while (diffsCursor.moveToNext()) {
if (mIsMergeCancelled) {
diffsCursor.deactivate();
return;
}
// delete all rows that match each element in the diffsCursor
fullyDeleteRowsWithSyncId(diffsCursor.getString(serverSyncIDColumn), account,
syncResult);
mDb.yieldIfContended();
}
diffsCursor.deactivate();
}
}
private void fullyDeleteRowsWithSyncId(String syncId, String account, SyncResult syncResult) {
final String[] selectionArgs = new String[]{syncId, account};
// delete the rows explicitly so that the delete operation can be overridden
Cursor c = mDb.query(mTable, new String[]{"_id"}, SELECT_BY_ID_AND_ACCOUNT,
selectionArgs, null, null, null);
try {
c.moveToFirst();
while (!c.isAfterLast()) {
deleteRow(c); // advances the cursor
syncResult.stats.numDeletes++;
}
} finally {
c.deactivate();
}
if (mDeletedTable != null) {
mDb.delete(mDeletedTable, SELECT_BY_ID_AND_ACCOUNT, selectionArgs);
}
}
/**
* Converts cursor into a Map, using the correct types for the values.
*/
protected void cursorRowToContentValues(Cursor cursor, ContentValues map) {
DatabaseUtils.cursorRowToContentValues(cursor, map);
}
/**
* Finds local changes, placing the results in the given result object.
* @param temporaryInstanceFactory As an optimization for the case
* where there are no client-side diffs, mergeResult may initially
* have no {@link android.content.TempProviderSyncResult#tempContentProvider}. If this is
* the first in the sequence of AbstractTableMergers to find
* client-side diffs, it will use the given ContentProvider to
* create a temporary instance and store its {@link
* ContentProvider} in the mergeResult.
* @param account
* @param syncResult
*/
private void findLocalChanges(TempProviderSyncResult mergeResult,
SyncableContentProvider temporaryInstanceFactory, String account,
SyncResult syncResult) {
SyncableContentProvider clientDiffs = mergeResult.tempContentProvider;
if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "generating client updates");
final String[] accountSelectionArgs = new String[]{account};
// Generate the client updates and insertions
// Create a cursor for dirty records
Cursor localChangesCursor = mDb.query(mTable, null, SELECT_UNSYNCED, accountSelectionArgs,
null, null, null);
long numInsertsOrUpdates = localChangesCursor.getCount();
while (localChangesCursor.moveToNext()) {
if (mIsMergeCancelled) {
localChangesCursor.close();
return;
}
if (clientDiffs == null) {
clientDiffs = temporaryInstanceFactory.getTemporaryInstance();
}
mValues.clear();
cursorRowToContentValues(localChangesCursor, mValues);
mValues.remove("_id");
DatabaseUtils.cursorLongToContentValues(localChangesCursor, "_id", mValues,
_SYNC_LOCAL_ID);
clientDiffs.insert(mTableURL, mValues);
}
localChangesCursor.close();
// Generate the client deletions
if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "generating client deletions");
long numEntries = DatabaseUtils.queryNumEntries(mDb, mTable);
long numDeletedEntries = 0;
if (mDeletedTable != null) {
Cursor deletedCursor = mDb.query(mDeletedTable,
syncIdAndVersionProjection,
_SYNC_ACCOUNT + "=? AND " + _SYNC_ID + " IS NOT NULL", accountSelectionArgs,
null, null, mDeletedTable + "." + _SYNC_ID);
numDeletedEntries = deletedCursor.getCount();
while (deletedCursor.moveToNext()) {
if (mIsMergeCancelled) {
deletedCursor.close();
return;
}
if (clientDiffs == null) {
clientDiffs = temporaryInstanceFactory.getTemporaryInstance();
}
mValues.clear();
DatabaseUtils.cursorRowToContentValues(deletedCursor, mValues);
clientDiffs.insert(mDeletedTableURL, mValues);
}
deletedCursor.close();
}
if (clientDiffs != null) {
mergeResult.tempContentProvider = clientDiffs;
}
syncResult.stats.numDeletes += numDeletedEntries;
syncResult.stats.numUpdates += numInsertsOrUpdates;
syncResult.stats.numEntries += numEntries;
}
}
| [
"[email protected]"
]
| |
aacdd98994ce5542934e9863c3b31edc03be8221 | d4dda3bec7d925ba0999113d05fd2a8348980d06 | /MindControllerView/src/main/java/com/alchemy/wjk/mind/widget/WavechartView.java | b7f595b1958b3e1f708a5a735665ef8157801205 | []
| no_license | zhongkai886/Interactive_learning_technology_APP | dc48341e5d13ce3cfb2ba0b71938af2bb4435bfd | 4e3e13805d59ba22d74643a385238e6582e1f031 | refs/heads/master | 2021-05-18T10:43:08.130155 | 2020-10-06T09:07:36 | 2020-10-06T09:07:36 | 251,214,677 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,237 | java | package com.alchemy.wjk.mind.widget;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Align;
import android.graphics.Paint.Cap;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Xfermode;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
public class WavechartView extends View {
int rangeHeight, rangeWidth;
int frameRate = 60;
int frameSpeed = 1000 / frameRate;
int gridlineX = 3;
int gridColor = 0xff000000;
int textColor = 0xff000000;
int paintSize = 2;
int textSize = 12;
float density = 1.0f, scaled = 1.0f;
Paint pointPaint, arrowPaint, pathPaint, gridPaint, textPaint;
WavechartHandle lines;
boolean DRAW_ANIMA = false, DRAW_POINT = true, DRAW_LINE = false, DRAW_GRIDLINE = true,
DRAW_ANIMATAIL = true;
boolean ON_ANIMATOR = false;
private Runnable animator = new Runnable() {
@Override
public void run() {
if (lines.allMove()) postDelayed(this, frameSpeed);
else ON_ANIMATOR = false;
invalidate();
}
};
public WavechartView(Context context) {
this(context, null);
}
public WavechartView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public WavechartView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
density = context.getResources().getDisplayMetrics().density;
scaled = context.getResources().getDisplayMetrics().scaledDensity;
// Xfermode xfermode = new PorterDuffXfermode(PorterDuff.Mode.DARKEN);
pointPaint = new Paint();
pointPaint.setStrokeWidth(paintSize * 4 * density);
// pointPaint.setXfermode(xfermode);
arrowPaint = new Paint();
arrowPaint.setStrokeWidth(paintSize * 4 * density);
arrowPaint.setStrokeCap(Cap.ROUND);
// arrowPaint.setXfermode(xfermode);
pathPaint = new Paint();
pathPaint.setStrokeWidth(paintSize * density);
pathPaint.setStrokeCap(Cap.ROUND);
// pathPaint.setXfermode(xfermode);
gridPaint = new Paint();
gridPaint.setColor(gridColor);
gridPaint.setStrokeWidth(2);
textPaint = new Paint();
textPaint.setColor(textColor);
textPaint.setTextSize(textSize * scaled);
textPaint.setTextAlign(Align.LEFT);
ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
setLayoutParams(lp);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (lines == null) return;
float vh = getHeight();
float vw = getWidth();
int rangeC = rangeWidth - 1;
float gaugeH = -vh / rangeHeight;
float gaugeW = vw / rangeC;
float basePointX = vh;
for (WavechartHandle line : lines.getLines()) {
if (DRAW_POINT) {
pointPaint.setColor(line.pointColor);
for (int i = 0; i < rangeWidth; i++) {
float pointY = gaugeH * line.getData(i - rangeWidth) + basePointX;
float pointX = gaugeW * (i - line.moveScroll);
canvas.drawPoint(pointX, pointY, pointPaint);
}
}
if (DRAW_LINE) {
pathPaint.setColor(line.lineColor);
for (int i = 0; i < rangeWidth; i++) {
int indexY = i - line.moveScroll;
float pointY1 = gaugeH * line.getData(i - rangeWidth) + basePointX;
float pointX1 = gaugeW * indexY;
float pointY2 = gaugeH * line.getData(i - rangeWidth + 1) + basePointX;
float pointX2 = gaugeW * (indexY + 1);
canvas.drawLine(pointX1, pointY1, pointX2, pointY2, pathPaint);
}
}
if (DRAW_ANIMA) {
pathPaint.setColor(line.lineColor);
arrowPaint.setColor(line.arrowColor);
float coordX = line.getProgress();
if (coordX > rangeC) coordX = rangeC;
float pointY4 = gaugeH * line.getMovePoint() + basePointX;
float pointX4 = DRAW_ANIMATAIL ? vw : gaugeW * line.getMoveProgress();
if (pointX4 > vw) pointX4 = vw;
float pointY3 = gaugeH * line.getData(line.getMovePositionOffset() - 1) + basePointX;
float pointX3 = pointX4 + -gaugeW * line.getProgress();
int lineSize = (line.movePosition < rangeC && DRAW_ANIMATAIL) ? line.movePosition : rangeC;
for (int i = 0, j = line.getMovePositionOffset() - 1, s = lineSize
; i <= s; i++, j--) {
float pointY1 = gaugeH * line.getData(j) + basePointX;
float pointX1 = pointX3 - gaugeW * (i);
float pointY2 = gaugeH * line.getData(j - 1) + basePointX;
float pointX2 = pointX3 - gaugeW * (i + 1);
canvas.drawLine(pointX1, pointY1, pointX2, pointY2, pathPaint);
}
canvas.drawLine(pointX3, pointY3, pointX4, pointY4, pathPaint);
canvas.drawPoint(pointX4, pointY4, arrowPaint);
}
}
if (DRAW_GRIDLINE) {
float gridsizeX = 8 * density;
float gridsizeX2 = 4 * density;
float vh2 = vh / 2;
for (int i = 0; i < rangeWidth; i++) {
float lineX = gaugeW * i;
canvas.drawLine(lineX, 0, lineX, gridsizeX, gridPaint);
canvas.drawLine(lineX, vh2 - gridsizeX2, lineX, vh2 + gridsizeX2, gridPaint);
canvas.drawLine(lineX, vh - gridsizeX, lineX, vh, gridPaint);
// if(i!=0 && i!=rangeWidth-1)canvas.drawText(""+(i+1), lineX, vh, textPaint);
}
for (int i = 0; i < gridlineX; i++) {
float lineY = vh * i / (gridlineX - 1);
canvas.drawLine(0, lineY, vw, lineY, gridPaint);
}
float textBottom = textPaint.getFontMetrics().bottom;
for (int i = 0, s = 11; i < s; i++) {
float lineY = vh * i / (s - 1);
int range = rangeHeight * (s - i - 1) / (s - 1);
if (i != 0 && i != s - 1 && i != 5)
canvas.drawText("" + range, 0, lineY + textBottom, textPaint);
}
}
}
public void setPaintSizePX(int size) {
pointPaint.setStrokeWidth(size * 4);
arrowPaint.setStrokeWidth(size * 4);
pathPaint.setStrokeWidth(size);
}
public void setRangeHeight(int height) {
rangeHeight = height;
}
public void setRangeWidth(int width) {
rangeWidth = width;
}
public void setGridColor(int color) {
gridColor = color;
gridPaint.setColor(gridColor);
}
public void setTextColor(int color) {
textColor = color;
textPaint.setColor(textColor);
}
public void setTextSize(int sp) {
textPaint.setTextSize(sp * scaled);
}
public void setHandle(WavechartHandle handle) {
lines = handle;
}
public void enableLine(boolean enable) {
DRAW_LINE = enable;
}
public void enablePoint(boolean enable) {
DRAW_POINT = enable;
}
public void enableAnima(boolean enable) {
DRAW_ANIMA = enable;
}
public void enableAnimaTail(boolean enable) {
DRAW_ANIMATAIL = enable;
}
public void enableGridline(boolean enable) {
DRAW_GRIDLINE = enable;
}
public boolean isAnima() {
return ON_ANIMATOR;
}
public void startAnima() {
startAnima(0);
}
public void startAnima(int delay) {
if (!DRAW_ANIMA) return;
ON_ANIMATOR = true;
lines.allsetFrame(frameRate);
removeCallbacks(animator);
if (delay == 0) post(animator);
else postDelayed(animator, delay);
}
}
| [
"[email protected]"
]
| |
e2a7344e5eb9fb3e00b759272afcdeecf1c84efc | 5780ac85aec36c25b0a6db8f921107efdf9f3d06 | /pattern/src/main/java/cn/readsense/pattern/p2factory/method/LargeTruck.java | ba424588ce107dd2ef9d769ba1a6c156e73ec4af | []
| no_license | littledou/patterns | c00309659d8fe0a406e99c41c21e0db4a5dde03d | 59ed5c64c43427f8a6e3d105ef4b419206452881 | refs/heads/master | 2020-06-05T14:19:40.395187 | 2020-05-12T06:25:06 | 2020-05-12T06:25:06 | 192,457,852 | 1 | 0 | null | 2019-10-18T09:35:38 | 2019-06-18T03:23:08 | Java | UTF-8 | Java | false | false | 333 | java | package cn.readsense.pattern.p2factory.method;
import cn.readsense.pattern.p2factory.Vehicle;
public class LargeTruck extends Vehicle {
@Override
public Vehicle getInstance() {
return null;
}
@Override
public void testVehicle() {
}
@Override
public void setColor(String color) {
}
}
| [
"[email protected]"
]
| |
2e8300c46b7a0e349b1caf0f3bb459e8a82409df | df1f980603fece6e8553261ba1d15cafbc39aff9 | /ndtp-user/src/main/java/ndtp/support/URLSupport.java | f477d63afa800eaef7406414f046b4009d0b24d0 | []
| no_license | chasimyeong/ndtp | 045e18f91bb2825e0a5d2293c224de34733c1e9d | afffc01b1e02f072982056a97083f05330dfa887 | refs/heads/master | 2021-04-10T19:00:37.131554 | 2020-02-04T08:42:52 | 2020-02-04T08:42:52 | 248,956,330 | 1 | 0 | null | 2020-03-21T10:50:02 | 2020-03-21T10:50:02 | null | UTF-8 | Java | false | false | 960 | java | package ndtp.support;
public class URLSupport {
public static final String SIGNIN_URL = "/sign/signin";
public static final String POPUP_SIGNIN_URL = "/sign/popup-signin";
public static final String POPUP_URL = "popup";
// login 의 경우 통과
public static final String[] EXCEPTION_URI = { "error", "sign", "/api/", "swagger" };
public static final String[] USER_STATUS_EXCEPTION_URI = { "/sign/signin", "/sign/process-signin", "/user/modify-password", "/user/update-password"};
// 로그 예외 URL, 사용이력, 이중화, 메인 위젯(main, ajax, widget 이건 너무 많아서 키워드로 Filter)
public static final String[] LOG_EXCEPTION_URI = { "error", "access/list", "accesses" };
// 파일 업로딩 URL
public static final String[] MULTIPART_REQUEST_URI = { "/layers/" };
// public static final Pattern STATIC_RESOURCES = Pattern.compile("(^/js/.*)|(^/css/.*)|(^/images/.*)|(^/externlib/.*)|(/favicon.ico)");
}
| [
"[email protected]"
]
| |
f5073d79e4780cdd8fdb495fdc9e7da841f7ec6e | d767f88d21f4ae72dc6fac1ca8811107bbae7b63 | /src/main/java/ru/kpfu/itis/pita/entity/Event.java | 109402a679c1c0647d5ca5dd952f42ce3b0940bd | []
| no_license | aekrylov/itis-pita | ece8685d775a5077f401be9ee35fd50c00f7ffbb | 069fbb580d9febdf724e4bf1d4c36877960b6e51 | refs/heads/master | 2021-01-21T10:41:52.868753 | 2017-05-13T10:02:37 | 2017-05-13T10:02:37 | 91,704,414 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,103 | java | package ru.kpfu.itis.pita.entity;
import javax.persistence.*;
import java.util.Collection;
import java.util.Date;
/**
* By Anton Krylov ([email protected])
* Date: 3/29/17 11:04 AM
*/
@Entity
@Table(name = "events")
@PrimaryKeyJoinColumn(name = "id")
public class Event extends Community {
@ManyToMany
@JoinTable(name = "events_interests", joinColumns = {
@JoinColumn(name = "event_id", referencedColumnName = "id")
}, inverseJoinColumns = {
@JoinColumn(name = "interest_id", referencedColumnName = "id")
})
private Collection<Interest> interests;
@Column(name = "place", nullable = false)
private String place;
@Column(name = "date", nullable = false)
private Date date;
@Column(name = "max_members")
private int maxMembers = -1;
public Event() {
super(CommunityType.EVENT);
setType(CommunityType.EVENT);
}
public Event(String name, String description, User creator, Collection<Interest> interests, String place, Date date) {
super(CommunityType.EVENT, name, description, creator);
setType(CommunityType.EVENT);
this.interests = interests;
this.place = place;
this.date = date;
}
public Event(String name, String description, User creator, Collection<Interest> interests, String place, Date date, int maxMembers) {
this(name, description, creator, interests, place, date);
this.maxMembers = maxMembers;
}
public String getPlace() {
return place;
}
public void setPlace(String place) {
this.place = place;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public int getMaxMembers() {
return maxMembers;
}
public void setMaxMembers(int maxMembers) {
this.maxMembers = maxMembers;
}
public Collection<Interest> getInterests() {
return interests;
}
public void setInterests(Collection<Interest> interests) {
this.interests = interests;
}
}
| [
"[email protected]"
]
| |
ea183e3489c84a08c4c0dd81b2a63787f19e9326 | 551fb905f53ea32909cadafad81e46ec1c87bc89 | /app/src/main/java/details/hotel/app/fitiam/UI/Fragments/UpcomingBookingFragment.java | 8b50ae8ec7e48f14f4ba1e6acf031943a04be1c3 | []
| no_license | nisharzingo/Gyms | f254724c7838b5190f302d47cbe137a199d6b1f7 | ff89e868406b685a7daf4017042e1a02e127be45 | refs/heads/master | 2020-05-29T13:19:29.469216 | 2019-05-29T07:13:49 | 2019-05-29T07:13:49 | 189,157,222 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,618 | java | package details.hotel.app.fitiam.UI.Fragments;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import details.hotel.app.fitiam.Adapter.BookingRecyclerViewAdapter;
import details.hotel.app.fitiam.Model.RoomBookings;
import details.hotel.app.fitiam.Model.Traveller;
import details.hotel.app.fitiam.R;
import details.hotel.app.fitiam.Utils.PreferenceHandler;
import details.hotel.app.fitiam.Utils.ThreadExecuter;
import details.hotel.app.fitiam.Utils.Util;
import details.hotel.app.fitiam.WebAPI.RoomBookingAPI;
import details.hotel.app.fitiam.WebAPI.TravellerAPI;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class UpcomingBookingFragment extends Fragment {
RecyclerView recyclerView;
View empty;
ArrayList<Traveller> travellerArrayList;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
//return inflater.inflate(R.layout.fragment_upcoming_booking, container, false);
try {
View view = inflater.inflate(R.layout.fragment_upcoming_booking, container, false);
recyclerView = (RecyclerView) view.findViewById(R.id.upcoming_bookings_list);
empty = (View)view.findViewById(R.id.empty);
getBookings();
return view;
}catch (Exception e){
e.printStackTrace();
Toast.makeText(getActivity(), "UI not Supporting", Toast.LENGTH_SHORT).show();
return null;
}
}
private void getBookings() {
final ProgressDialog dialog = new ProgressDialog(getActivity());
dialog.setTitle(R.string.loader_message);
dialog.setCancelable(false);
dialog.show();
new ThreadExecuter().execute(new Runnable() {
@Override
public void run() {
RoomBookingAPI bookingApi = Util.getClient().create(RoomBookingAPI.class);
String authenticationString = Util.getToken(getActivity());
final Call<ArrayList<RoomBookings>> getAllBookings = bookingApi.getBookingsByProfileId(authenticationString, PreferenceHandler.getInstance(getActivity()).getTravellerId());
getAllBookings.enqueue(new Callback<ArrayList<RoomBookings>>() {
@Override
public void onResponse(Call<ArrayList<RoomBookings>> call, Response<ArrayList<RoomBookings>> response) {
if(dialog != null)
{
dialog.dismiss();
}
if(response.code() == 200)
{
if(response.body() != null)
{
ArrayList<RoomBookings> bookings1ArrayList = response.body();
ArrayList<RoomBookings> arrayList = new ArrayList<>();
for (int i=0;i<bookings1ArrayList.size();i++)
{
if(bookings1ArrayList.get(i).getBookingStatus() != null &&
bookings1ArrayList.get(i).getBookingStatus().equals("Quick"))
{
RoomBookings bookings1 = bookings1ArrayList.get(i);
arrayList.add(bookings1);
}
}
if(arrayList.size() != 0)
{
Collections.sort(bookings1ArrayList, new Comparator<RoomBookings>() {
@Override
public int compare(RoomBookings o1, RoomBookings o2) {
return o2.getCheckInDate().compareTo(o1.getCheckInDate());
}
});
getTravellers(arrayList);
}
else
{
empty.setVisibility(View.VISIBLE);
}
}else{
empty.setVisibility(View.VISIBLE);
}
}else{
empty.setVisibility(View.VISIBLE);
}
}
@Override
public void onFailure(Call<ArrayList<RoomBookings>> call, Throwable t) {
if(dialog != null)
{
dialog.dismiss();
}
empty.setVisibility(View.VISIBLE);
}
});
}
});
}
private void getTravellers(final ArrayList<RoomBookings> body) {
travellerArrayList = new ArrayList<>();
if(body.size() != 0)
{
final ProgressDialog dialog = new ProgressDialog(getActivity());
dialog.setTitle(R.string.loader_message);
dialog.setCancelable(false);
dialog.show();
for (int i = 0;i<body.size();i++)
{
String auth_string = Util.getToken(getActivity());//"Basic " + Base64.encodeToString(authentication.getBytes(), Base64.NO_WRAP);
TravellerAPI travellerApi = Util.getClient().create(TravellerAPI.class);
Call<Traveller> getTraveller = travellerApi.getTravellerDetails(auth_string,body.get(i).getTravellerId());
getTraveller.enqueue(new Callback<Traveller>() {
@Override
public void onResponse(Call<Traveller> call, Response<Traveller> response) {
if(response.code() == 200)
{
if(response.body() != null)
{
travellerArrayList.add(response.body());
if(body.size() == travellerArrayList.size())
{
empty.setVisibility(View.GONE);
BookingRecyclerViewAdapter bookingRecyclerViewAdapter = new BookingRecyclerViewAdapter(getActivity(),body,travellerArrayList);
recyclerView.setAdapter(bookingRecyclerViewAdapter);
}
}
}
else
{
Toast.makeText(getActivity(),"Please try after some time",Toast.LENGTH_SHORT).show();
}
}
@Override
public void onFailure(Call<Traveller> call, Throwable t) {
}
});
}
if(dialog != null)
{
dialog.dismiss();
}
}
else
{
}
}
}
| [
"[email protected]"
]
| |
2950a3be162ede4942c9894289c76708210d2839 | c4bbb10ba8cc6dbc6e45f87b11840bd7621a5e76 | /Algorithm/src/com/jcip/examples/ProducerConsumer.java | 011fa1c40125727f197b772d383b7a9151ada09b | []
| no_license | Asbaharoon/Algorithm | dd69b28eb6235fb44edf1e2e36c5a627d6920e1b | 1cbfdd1ca6687c64825cfd85cebd1f76980fd00f | refs/heads/master | 2023-04-11T03:20:56.122959 | 2018-03-26T06:46:32 | 2018-03-26T06:46:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,742 | java | package com.jcip.examples;
import java.io.File;
import java.io.FileFilter;
import java.util.concurrent.*;
/**
* ProducerConsumer
* <p/>
* Producer and consumer tasks in a desktop search application
*
* @author Brian Goetz and Tim Peierls
*/
public class ProducerConsumer {
static class FileCrawler implements Runnable {
private final BlockingQueue<File> fileQueue;
private final FileFilter fileFilter;
private final File root;
public FileCrawler(BlockingQueue<File> fileQueue,
final FileFilter fileFilter,
File root) {
this.fileQueue = fileQueue;
this.root = root;
this.fileFilter = new FileFilter() {
public boolean accept(File f) {
return f.isDirectory() || fileFilter.accept(f);
}
};
}
private boolean alreadyIndexed(File f) {
return false;
}
public void run() {
try {
crawl(root);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
private void crawl(File root) throws InterruptedException {
File[] entries = root.listFiles(fileFilter);
if (entries != null) {
for (File entry : entries)
if (entry.isDirectory())
crawl(entry);
else if (!alreadyIndexed(entry))
fileQueue.put(entry);
}
}
}
static class Indexer implements Runnable {
private final BlockingQueue<File> queue;
public Indexer(BlockingQueue<File> queue) {
this.queue = queue;
}
public void run() {
try {
while (true)
indexFile(queue.take());
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
public void indexFile(File file) {
// Index the file...
};
}
private static final int BOUND = 10;
private static final int N_CONSUMERS = Runtime.getRuntime().availableProcessors();
public static void startIndexing(File[] roots) {
BlockingQueue<File> queue = new LinkedBlockingQueue<File>(BOUND);
FileFilter filter = new FileFilter() {
public boolean accept(File file) {
return true;
}
};
for (File root : roots)
new Thread(new FileCrawler(queue, filter, root)).start();
for (int i = 0; i < N_CONSUMERS; i++)
new Thread(new Indexer(queue)).start();
}
}
| [
"[email protected]"
]
| |
51a5ae52e8fdd7269673125c9c3ce519e5e4ae2a | f617d36dac6574029a52f2759fcdfea7f1621493 | /ogq-backgrounds-client/src/main/java/com/ogqcorp/bgh/fragment/explore/MainFragment.java | 57accbd452148e7cea810a6d89c0ac10bf7b4e2f | []
| no_license | vtt3-research/ogq | cb7b3e18cf7012222b06a3cba17b5487a4bdfe79 | 8ccdf1fc20264f956fc14354053737fba4f2f236 | refs/heads/master | 2022-12-20T13:22:07.735835 | 2019-12-18T22:46:20 | 2019-12-18T22:46:20 | 123,057,808 | 6 | 5 | null | 2022-12-16T09:00:56 | 2018-02-27T02:00:29 | JavaScript | UTF-8 | Java | false | false | 19,198 | java | package com.ogqcorp.bgh.fragment.explore;
import rx.Subscription;
import rx.functions.Action1;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import com.google.android.material.bottomnavigation.BottomNavigationItemView;
import com.google.android.material.bottomnavigation.BottomNavigationMenuView;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.AnticipateInterpolator;
import android.view.animation.Interpolator;
import android.view.animation.OvershootInterpolator;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import com.ogqcorp.bgh.R;
import com.ogqcorp.bgh.activity.AbsMainActivity;
import com.ogqcorp.bgh.activity.AuthLoginMainActivity;
import com.ogqcorp.bgh.chat.BusChatEvent;
import com.ogqcorp.bgh.fragment.base.BaseActionBarFragment;
import com.ogqcorp.bgh.fragment.base.BaseFragment;
import com.ogqcorp.bgh.gcm.BusGcm;
import com.ogqcorp.bgh.spirit.auth.UserManager;
import com.ogqcorp.bgh.spirit.data.User;
import com.ogqcorp.bgh.spirit.preference.PreferencesManager;
import com.ogqcorp.bgh.system.FragmentFactory;
import com.ogqcorp.bgh.system.IntentLauncher;
import com.ogqcorp.bgh.system.RxBus;
import com.ogqcorp.bgh.view.ScrollableViewPager;
public final class MainFragment extends BaseActionBarFragment
{
//=========================================================================
// Constructors
//=========================================================================
@Deprecated
public MainFragment()
{
// Nothing
}
//=========================================================================
// Override Methods
//=========================================================================
@Override
public void onCreate(@Nullable Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
{
return inflater.inflate(R.layout.fragment_main, container, false);
}
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
public void onViewCreated(View view, final Bundle savedInstanceState)
{
super.onViewCreated(view, savedInstanceState);
m_unbinder = ButterKnife.bind(this, view);
if (savedInstanceState != null)
{
m_fragmentInfos = savedInstanceState.getSparseParcelableArray(KEY_FRAGMENT_INFOS);
}
if (UserManager.getInstance().isGuest() == false)
{
registerListeners();
}
m_tabsAdapter = new TabsAdapter(getChildFragmentManager());
m_viewPager.setCanScroll(false);
m_viewPager.setAdapter(m_tabsAdapter);
m_viewPager.setCurrentItem(TAB_EXPLORE, false);
m_navigationView.setSelectedItemId(R.id.action_explore);
m_navigationView.setOnNavigationItemSelectedListener(m_navigationItemSelectedListener);
m_navigationView.setOnNavigationItemReselectedListener(m_onNavigationItemReselectedListener);
int viewCount = PreferencesManager.getInstance().getBackgroundPageViewCount(getContext());
boolean isShow = PreferencesManager.getInstance().isShowVideoUploadGuide(getContext());
if (isShow == true && viewCount >= 3)
{
final Animation anim = AnimationUtils.loadAnimation(getContext(), R.anim.move_up_down);
m_tooltip.setVisibility(View.VISIBLE);
m_tooltip.postDelayed(new Runnable()
{
@Override
public void run()
{
if (m_tooltip != null)
{
m_tooltip.startAnimation(anim);
}
}
}, 2000);
m_tooltip.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
if (m_tooltip != null)
{
m_tooltip.setVisibility(View.GONE);
m_tooltip.clearAnimation();
PreferencesManager.getInstance().setShowVideoUploadGuide(getContext(), false);
if (getActivity() instanceof AbsMainActivity)
{
((AbsMainActivity) getActivity()).onClickUpload();
}
}
}
});
}
initBadgeView();
}
@Override
public void onDestroyView()
{
super.onDestroyView();
m_unbinder.unbind();
if (UserManager.getInstance().isGuest() == false)
{
unregisterListeners();
}
if (m_tooltip != null)
{
m_tooltip.clearAnimation();
}
m_userInfoListener = null;
}
@Override
public void onSaveInstanceState(Bundle outState)
{
super.onSaveInstanceState(outState);
outState.putSparseParcelableArray(KEY_FRAGMENT_INFOS, m_fragmentInfos);
outState.putString(KEY_NOTI_COUNT_ACTIVITIES, getBadgeCount(TAB_ACTIVITIES));
outState.putString(KEY_NOTI_COUNT_MY_PROFILE, getBadgeCount(TAB_MY_PROFILE));
}
@Override
public void onResume()
{
super.onResume();
if (m_viewPager.getCurrentItem() == TAB_MY_PROFILE)
{
//Used to update notification count!
UserManager.getInstance().updateUserSelfInfo();
}
}
@Override
public void onRelease()
{
try
{
for (int index = 0; index < m_fragmentInfos.size(); index++)
{
final FragmentInfo fragmentInfo = m_fragmentInfos.valueAt(index);
final BaseFragment fragment = (BaseFragment) getFragment(fragmentInfo);
fragment.onRelease();
}
}
catch (Exception e)
{
// Nothing
}
}
//=========================================================================
// Public Methods
//=========================================================================
@SuppressWarnings("deprecation")
public static Fragment newInstance()
{
return new MainFragment();
}
public void setCurrentItem(int position)
{
switch (position)
{
case TAB_UPLOAD:
m_navigationView.setSelectedItemId(R.id.action_upload);
break;
case TAB_ACTIVITIES:
m_navigationView.setSelectedItemId(R.id.action_notification);
break;
case TAB_MY_PROFILE:
m_navigationView.setSelectedItemId(R.id.action_profile);
break;
}
}
public int getCurrentItem()
{
switch (m_navigationView.getSelectedItemId())
{
case R.id.action_feed:
return TAB_USER_FEEDS;
case R.id.action_explore:
return TAB_EXPLORE;
case R.id.action_upload:
return TAB_UPLOAD;
case R.id.action_notification:
return TAB_ACTIVITIES;
case R.id.action_profile:
return TAB_MY_PROFILE;
default:
return -1;
}
}
public boolean moveLandingScreen()
{
boolean isMoved = false;
if (getCurrentItem() != TAB_EXPLORE)
{
isMoved = true;
m_navigationView.setSelectedItemId(R.id.action_explore);
}
final Fragment fragment = m_tabsAdapter.getRegisteredFragment(TAB_EXPLORE);
if (fragment != null && fragment instanceof ExploreFragment)
{
boolean result = ((ExploreFragment) fragment).moveLandingScreen();
return isMoved ? true : result;
}
return isMoved;
}
public void initBadgeView()
{
BottomNavigationMenuView menuView = (BottomNavigationMenuView) m_navigationView.getChildAt(0);
BottomNavigationItemView actView = (BottomNavigationItemView) menuView.getChildAt(3);
BottomNavigationItemView msgView = (BottomNavigationItemView) menuView.getChildAt(4);
m_actNotiView = LayoutInflater.from(getContext()).inflate(R.layout.item_noti_badge, menuView, false);
actView.addView(m_actNotiView);
m_msgNotiView = LayoutInflater.from(getContext()).inflate(R.layout.item_noti_badge, menuView, false);
msgView.addView(m_msgNotiView);
}
public String getBadgeCount(int position)
{
try
{
TextView badge = null;
switch (position)
{
case TAB_ACTIVITIES:
badge = m_actNotiView.findViewById(R.id.badge);
break;
case TAB_MY_PROFILE:
badge = m_msgNotiView.findViewById(R.id.badge);
break;
}
return badge != null ? badge.getText().toString() : "0";
}
catch (Exception e)
{
return "0";
}
}
public void setBadgeCount(int count, int position)
{
setBadgeCount(count, position, false);
}
public void setBadgeCount(final int count, int position, boolean animation)
{
TextView view = null;
switch (position)
{
case TAB_ACTIVITIES:
view = m_actNotiView.findViewById(R.id.badge);
break;
case TAB_MY_PROFILE:
view = m_msgNotiView.findViewById(R.id.badge);
break;
default:
return;
}
if (view == null) throw new AssertionError();
User user = UserManager.getInstance().getUser();
final TextView badge = view;
final String prettyCount = user.getPrettyUnreadCount(count);
if (count > 0)
{
final Runnable startAction = new Runnable()
{
@Override
public void run()
{
badge.setText(prettyCount);
badge.setVisibility(View.VISIBLE);
badge.setScaleX(0);
badge.setScaleY(0);
}
};
if (animation == true)
{
badge.animate()
.scaleX(1)
.scaleY(1)
.setDuration(ANIMATION_DURATION)
.setInterpolator(OVERSHOOT_INTERPOLATOR)
.withStartAction(startAction)
.start();
} else
{
startAction.run();
}
} else
{
final Runnable endAction = new Runnable()
{
@Override
public void run()
{
badge.setText("0");
badge.setVisibility(View.GONE);
}
};
if (animation == true)
{
badge.animate()
.scaleX(0)
.scaleY(0)
.setDuration(ANIMATION_DURATION)
.setInterpolator(ANTICIPATE_INTERPOLATOR)
.withEndAction(endAction)
.start();
} else
{
endAction.run();
}
}
}
//=========================================================================
// Private Methods
//=========================================================================
private Fragment getFragment(int position, FragmentCallback callback)
{
final FragmentInfo fragmentInfo = m_fragmentInfos.get(position);
if (fragmentInfo == null)
{
final Fragment fragment = callback.createFragment(position);
m_fragmentInfos.put(position, new FragmentInfo(fragment));
return fragment;
}
return getFragment(fragmentInfo);
}
private Fragment getFragment(FragmentInfo fragmentInfo)
{
return Fragment.instantiate(getActivity(), fragmentInfo.clazz, fragmentInfo.argument);
}
private void showUnreadCount()
{
User user = UserManager.getInstance().getUser();
int messageCount = user.getUnreadMessageCount();
int activityCount = user.getUnreadActivityCount();
setBadgeCount(messageCount, TAB_MY_PROFILE, true);
setBadgeCount(activityCount, TAB_ACTIVITIES, true);
}
private void registerListeners()
{
if (UserManager.getInstance().isGuest() == false)
{
UserManager.getInstance().registerUpdateUserInfoListener(m_userInfoListener);
m_subscription = RxBus.getInstance().registerListenerMainThread(BusGcm.class, new Action1<BusGcm>()
{
@Override
public void call(BusGcm busGcm)
{
showUnreadCount();
}
});
m_subscriptionChatEvent = RxBus.getInstance().registerListenerMainThread(BusChatEvent.class, new Action1<BusChatEvent>()
{
@Override
public void call(BusChatEvent busChat)
{
switch (busChat.getEventType())
{
case BusChatEvent.EVENT_TYPE_COMPLETE_ALERT_CHECK:
setBadgeCount(0, TAB_MY_PROFILE, true);
break;
default:
break;
}
}
});
}
}
private void unregisterListeners()
{
UserManager.getInstance().unregisterUpdateUserInfoListener(m_userInfoListener);
if (m_subscription != null)
{
m_subscription.unsubscribe();
}
if (m_subscriptionChatEvent != null)
{
m_subscriptionChatEvent.unsubscribe();
}
}
//=========================================================================
// TabsAdapter
//=========================================================================
private class TabsAdapter extends FragmentStatePagerAdapter
{
SparseArray<Fragment> registeredFragments = new SparseArray<Fragment>();
TabsAdapter(FragmentManager fm)
{
super(fm);
}
@Override
public int getCount()
{
return TAB_TOTAL_COUNT;
}
@Override
public Fragment getItem(int position)
{
return getFragment(position, new FragmentCallback()
{
@Override
public Fragment createFragment(int position)
{
switch (position)
{
case TAB_USER_FEEDS:
return FragmentFactory.createHomeFragment();
case TAB_EXPLORE:
return FragmentFactory.createExploreFragment();
case TAB_UPLOAD:
return FragmentFactory.createUploadContentsFragment();
case TAB_ACTIVITIES:
return FragmentFactory.createActivitiesFragment(UserManager.getInstance().getUser());
case TAB_MY_PROFILE:
return FragmentFactory.createMyInfoFragment();
}
return null;
}
});
}
@Override
public Object instantiateItem(ViewGroup container, int position)
{
Fragment fragment = (Fragment) super.instantiateItem(container, position);
registeredFragments.put(position, fragment);
return fragment;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object)
{
registeredFragments.remove(position);
super.destroyItem(container, position, object);
}
public Fragment getRegisteredFragment(int position)
{
return registeredFragments.get(position);
}
}
//=========================================================================
// FragmentCallback
//=========================================================================
interface FragmentCallback
{
Fragment createFragment(int position);
}
//=========================================================================
// FragmentInfo
//=========================================================================
private static class FragmentInfo implements Parcelable
{
public FragmentInfo(Fragment fragment)
{
clazz = fragment.getClass().getName();
argument = fragment.getArguments();
}
@SuppressWarnings("unchecked")
private FragmentInfo(Parcel in)
{
clazz = in.readString();
argument = in.readBundle();
}
@Override
public int describeContents()
{
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags)
{
dest.writeString(clazz);
dest.writeBundle(argument);
}
public static final Creator<FragmentInfo> CREATOR = new Creator<MainFragment.FragmentInfo>()
{
public MainFragment.FragmentInfo createFromParcel(Parcel in)
{
return new MainFragment.FragmentInfo(in);
}
public MainFragment.FragmentInfo[] newArray(int size)
{
return new MainFragment.FragmentInfo[size];
}
};
private String clazz;
private Bundle argument;
}
//========================================================================
// Listeners
//========================================================================
BottomNavigationView.OnNavigationItemSelectedListener m_navigationItemSelectedListener = new BottomNavigationView.OnNavigationItemSelectedListener()
{
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item)
{
boolean isGuest = UserManager.getInstance().isGuest();
switch (item.getItemId())
{
case R.id.action_feed:
{
if (isGuest == true)
{
IntentLauncher.startAuthLogInMainActivity(getActivity(), AuthLoginMainActivity.TAB_INDEX_FEED);
return false;
} else
{
setActionBarAlpha(255);
m_viewPager.setCurrentItem(TAB_USER_FEEDS, false);
return true;
}
}
case R.id.action_explore:
{
setActionBarAlpha(255);
m_viewPager.setCurrentItem(TAB_EXPLORE, false);
return true;
}
case R.id.action_upload:
{
if (isGuest == true)
{
IntentLauncher.startAuthLogInMainActivity(getActivity(), AuthLoginMainActivity.TAB_INDEX_UPLOAD);
return false;
} else
{
setActionBarAlpha(255);
m_viewPager.setCurrentItem(TAB_UPLOAD, false);
return true;
}
}
case R.id.action_notification:
{
if (isGuest == true)
{
IntentLauncher.startAuthLogInMainActivity(getActivity(), AuthLoginMainActivity.TAB_INDEX_ACTIVITY);
return false;
} else
{
setActionBarAlpha(255);
m_viewPager.setCurrentItem(TAB_ACTIVITIES, false);
setBadgeCount(0, TAB_ACTIVITIES);
UserManager.getInstance().getUser().setUnreadActivityCount(0);
return true;
}
}
case R.id.action_profile:
{
if (isGuest == true)
{
IntentLauncher.startAuthLogInMainActivity(getActivity(), AuthLoginMainActivity.TAB_INDEX_PROFILE);
return false;
} else
{
m_viewPager.setCurrentItem(TAB_MY_PROFILE, false);
return true;
}
}
}
return false;
}
};
BottomNavigationView.OnNavigationItemReselectedListener m_onNavigationItemReselectedListener = new BottomNavigationView.OnNavigationItemReselectedListener()
{
@Override
public void onNavigationItemReselected(@NonNull MenuItem item)
{
BaseFragment fragment = (BaseFragment) m_viewPager.getAdapter().instantiateItem(m_viewPager, m_viewPager.getCurrentItem());
fragment.onScrollTop();
}
};
private UserManager.UpdateUserInfoListener m_userInfoListener = new UserManager.UpdateUserInfoListener()
{
@Override
public void onSuccess(User user)
{
showUnreadCount();
}
@Override
public void onFail(Exception e)
{
// Nothing
}
};
//=========================================================================
// Constants
//=========================================================================
private static final String KEY_FRAGMENT_INFOS = "KEY_FRAGMENT_INFOS";
private static final String KEY_NOTI_COUNT_ACTIVITIES = "KEY_NOTI_COUNT_ACTIVITIES";
private static final String KEY_NOTI_COUNT_MY_PROFILE = "KEY_NOTI_COUNT_MY_PROFILE";
public static final int TAB_USER_FEEDS = 0;
public static final int TAB_EXPLORE = 1;
public static final int TAB_UPLOAD = 2;
public static final int TAB_ACTIVITIES = 3;
public static final int TAB_MY_PROFILE = 4;
private static final int TAB_TOTAL_COUNT = 5;
private static int ANIMATION_DURATION = 300;
private static Interpolator OVERSHOOT_INTERPOLATOR = new OvershootInterpolator();
private static Interpolator ANTICIPATE_INTERPOLATOR = new AnticipateInterpolator();
//=========================================================================
// Variables
//=========================================================================
@BindView(R.id.view_pager) ScrollableViewPager m_viewPager;
@BindView(R.id.tooltip) TextView m_tooltip;
@BindView(R.id.bottom_navigation) BottomNavigationView m_navigationView;
private View m_actNotiView;
private View m_msgNotiView;
private Subscription m_subscription;
private Subscription m_subscriptionChatEvent;
private Unbinder m_unbinder;
private TabsAdapter m_tabsAdapter;
private SparseArray<FragmentInfo> m_fragmentInfos = new SparseArray<FragmentInfo>();
} | [
"[email protected]"
]
| |
b62f608007ac6839a90faec79fa97fbc9a2c6754 | 5a8939b126f3436027ec17c81c121f9d68bd01bf | /projetDoki/src/test/java/formation/sopra/bu/projetDoki/ProjetDokiApplicationTests.java | 39b84fcb4c371f6152435128149db7fb3e6c8bc8 | []
| no_license | Eugirdory/projetFinal | 861de9d7c1d42c0a550bffa453383a2e0f942e75 | bac479bcb189d5238cb2ecc027b0a7431a3a704a | refs/heads/master | 2023-01-15T12:08:59.272399 | 2019-07-12T13:37:54 | 2019-07-12T13:37:54 | 195,799,866 | 0 | 0 | null | 2023-01-07T07:37:32 | 2019-07-08T11:37:34 | Java | UTF-8 | Java | false | false | 350 | java | package formation.sopra.bu.projetDoki;
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 ProjetDokiApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"[email protected]"
]
| |
ece6c30cc12ffcc9833ffa50b7946bdc4b4c52b4 | bd61f679b114c128f8b7c12d1e72f4f38d92c71e | /src/main/java/io/ebean/typequery/PFloat.java | 29f41a32e36f8c6d0c91ab14051a6eda55751220 | [
"Apache-2.0"
]
| permissive | tobias-/ebean-querybean | 6e626e19576be1252ad98a1272d442d87ae4f176 | 2e12ff95a6259daa20c527f033d503aca19c6d2d | refs/heads/master | 2022-12-25T05:46:02.113122 | 2020-09-17T12:12:15 | 2020-09-17T12:12:15 | 301,950,023 | 0 | 0 | Apache-2.0 | 2020-10-07T12:21:59 | 2020-10-07T06:45:53 | null | UTF-8 | Java | false | false | 517 | java | package io.ebean.typequery;
/**
* Float property.
*
* @param <R> the root query bean type
*/
public class PFloat<R> extends PBaseNumber<R,Float> {
/**
* Construct with a property name and root instance.
*
* @param name property name
* @param root the root query bean instance
*/
public PFloat(String name, R root) {
super(name, root);
}
/**
* Construct with additional path prefix.
*/
public PFloat(String name, R root, String prefix) {
super(name, root, prefix);
}
}
| [
"[email protected]"
]
| |
c6287030ef3056c2f400fbf1a7442bfcbfa71f29 | 13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3 | /crash-reproduction-new-fitness/results/MATH-40b-5-29-Single_Objective_GGA-IntegrationSingleObjective-BasicBlockCoverage/org/apache/commons/math/analysis/solvers/BracketingNthOrderBrentSolver_ESTest.java | b869e30cea5307a6c135a8ae6a9aafd7f477adf6 | [
"MIT",
"CC-BY-4.0"
]
| permissive | STAMP-project/Botsing-basic-block-coverage-application | 6c1095c6be945adc0be2b63bbec44f0014972793 | 80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da | refs/heads/master | 2022-07-28T23:05:55.253779 | 2022-04-20T13:54:11 | 2022-04-20T13:54:11 | 285,771,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,699 | java | /*
* This file was automatically generated by EvoSuite
* Mon May 18 02:36:31 UTC 2020
*/
package org.apache.commons.math.analysis.solvers;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.shaded.org.mockito.Mockito.*;
import static org.evosuite.runtime.EvoAssertions.*;
import org.apache.commons.math.analysis.SinFunction;
import org.apache.commons.math.analysis.UnivariateFunction;
import org.apache.commons.math.analysis.solvers.AllowedSolution;
import org.apache.commons.math.analysis.solvers.BracketingNthOrderBrentSolver;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.evosuite.runtime.ViolatedAssumptionAnswer;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true)
public class BracketingNthOrderBrentSolver_ESTest extends BracketingNthOrderBrentSolver_ESTest_scaffolding {
@Test(timeout = 4000)
public void test0() throws Throwable {
BracketingNthOrderBrentSolver bracketingNthOrderBrentSolver0 = new BracketingNthOrderBrentSolver();
UnivariateFunction univariateFunction0 = mock(UnivariateFunction.class, new ViolatedAssumptionAnswer());
doReturn(0.0).when(univariateFunction0).value(anyDouble());
AllowedSolution allowedSolution0 = AllowedSolution.ANY_SIDE;
bracketingNthOrderBrentSolver0.solve(4, univariateFunction0, 0.0, 2978.3892590729897, 1.0, allowedSolution0);
SinFunction sinFunction0 = new SinFunction();
// Undeclared exception!
bracketingNthOrderBrentSolver0.solve(4, (UnivariateFunction) sinFunction0, (-2420.00283869027), 2978.3892590729897, 1.0, allowedSolution0);
}
}
| [
"[email protected]"
]
| |
a1f1dc6370eabf09fb7987eb2a7a619d008961c8 | 6b2932d57204e5a8ce5430049e7f2df2f68f6039 | /mzdb-access/src/main/java/fr/profi/mzdb/db/table/SoftwareTable.java | b6f75dc4a3d33ff338bb8c76693a3f50becaf9a7 | []
| no_license | profiproteomics/mzdb | 3c0cbddfb92591d9dd4a70c44d10a4d976ac0c61 | 70126b347f9938f23132bdfed88d10ba83d5d464 | refs/heads/master | 2023-04-22T18:50:32.176604 | 2022-10-21T08:48:38 | 2022-10-21T08:48:38 | 222,645,480 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 434 | java | package fr.profi.mzdb.db.table;
public enum SoftwareTable {
ID("id"),
NAME("name"),
VERSION("version"),
PARAM_TREE("param_tree"),
SHARED_PARAM_TREE("shared_param_tree_id");
public static String tableName = "software";
private final String columnName;
private SoftwareTable(String colName) {
this.columnName = colName;
}
public String getValue() {
return columnName;
}
}
| [
"[email protected]"
]
| |
4a0455d9fdb0fd4d66a9e6d145a2d21f48a09354 | 2898a9804db1c717a75f13252ed53421bb2d5c79 | /src/main/java/com/projects/breakingbook/persistence/repository/UserRepository.java | 508368dbe32e0270a64ad1d287e26658ef121b5e | []
| no_license | GwenRspl/breaking-book | 5073d4b4b4a77181d22f9c018b65155da381c4c7 | 31215b846c0a8f38866b83d8c818366aefaa0276 | refs/heads/master | 2023-01-07T18:54:52.621325 | 2019-09-25T16:26:43 | 2019-09-25T16:26:43 | 171,013,152 | 0 | 1 | null | 2023-01-07T10:04:57 | 2019-02-16T14:34:18 | Java | UTF-8 | Java | false | false | 574 | java | package com.projects.breakingbook.persistence.repository;
import com.projects.breakingbook.business.entity.User;
import java.util.List;
import java.util.Optional;
public interface UserRepository {
List<User> findAllUsers();
boolean createUser(User user);
Optional<User> findUserByUsername(String username);
Optional<User> findUserById(Long id);
boolean deleteUserById(Long id);
boolean deleteAllUsers();
boolean updateUser(Long id, User user);
Boolean existsByUsername(String username);
Boolean existsByEmail(String email);
}
| [
"[email protected]"
]
| |
cd273a0c50f07ca71aaa06b0c218c79a3392212e | 84606d0fcd3c0b1114e0aa8797d3e5155de7ec9d | /src/me/minetime/MTS/exception/VerwendungsException.java | d6fa686075d849e905a14e15bd1ca9b9633ef658 | []
| no_license | Certox/MTS | f701803a166b5fc7b596f830fd0bc7466cfdbcd8 | 5683e083066ae638baeae6119eb3f01411803177 | refs/heads/master | 2020-05-30T16:05:39.256441 | 2013-02-18T19:06:07 | 2013-02-18T19:06:07 | 8,275,020 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 231 | java | package me.minetime.MTS.exception;
public class VerwendungsException extends Exception {
private static final long serialVersionUID = 5613051267449761984L;
public VerwendungsException(String msg) {
super(msg);
}
}
| [
"[email protected]"
]
| |
829586d1d66d635ef8df3e0a6842230a03f78360 | 9fc96b05390f7dad188e368e85744c1e2d8d711d | /src/main/java/com/aurospaces/neighbourhood/bean/StateBean.java | 01589a2691ea89bd4fce0c7bc400b7e990f56ca7 | []
| no_license | Sheikhsoft/Matrimony-1 | 3719e22f3ab617099420d6b4c82e2ba5006214b0 | c61cf5a4fec312bcb60d520748d23a102a61b0fd | refs/heads/master | 2021-08-30T06:21:29.865910 | 2017-12-16T12:49:17 | 2017-12-16T12:49:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 880 | java | package com.aurospaces.neighbourhood.bean;
import java.util.Date;
import org.hibernate.validator.constraints.NotEmpty;
public class StateBean {
private int id=0;
protected Date createdTime ;
protected Date updatedTime ;
@NotEmpty
private String name;
private String status;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
public Date getUpdatedTime() {
return updatedTime;
}
public void setUpdatedTime(Date updatedTime) {
this.updatedTime = updatedTime;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}
| [
"[email protected]"
]
| |
fbe5334f375488432b732dd6dc64b1fa39e65efa | 0a0cbe30a545ab35e2e0bf30f017cca02b222e20 | /src/main/java/com/bishe/bbs/pojo/TypeExample.java | 215a0e65ffd61ac1487b16dc263ad7cbaf10fdb8 | []
| no_license | 1579106394/ghl_bbs | 2caf25c24a06580e634cad206aea05fb7f2ce995 | 47acaecfa6bf0b5fd0bc65814038af3a39486384 | refs/heads/master | 2022-12-27T03:09:33.118962 | 2020-01-20T12:39:36 | 2020-01-20T12:39:36 | 235,098,414 | 0 | 0 | null | 2022-12-16T09:44:20 | 2020-01-20T12:39:24 | JavaScript | UTF-8 | Java | false | false | 13,759 | java | package com.bishe.bbs.pojo;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public class TypeExample implements Serializable {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public TypeExample() {
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 andTypeIdIsNull() {
addCriterion("type_id is null");
return (Criteria) this;
}
public Criteria andTypeIdIsNotNull() {
addCriterion("type_id is not null");
return (Criteria) this;
}
public Criteria andTypeIdEqualTo(Long value) {
addCriterion("type_id =", value, "typeId");
return (Criteria) this;
}
public Criteria andTypeIdNotEqualTo(Long value) {
addCriterion("type_id <>", value, "typeId");
return (Criteria) this;
}
public Criteria andTypeIdGreaterThan(Long value) {
addCriterion("type_id >", value, "typeId");
return (Criteria) this;
}
public Criteria andTypeIdGreaterThanOrEqualTo(Long value) {
addCriterion("type_id >=", value, "typeId");
return (Criteria) this;
}
public Criteria andTypeIdLessThan(Long value) {
addCriterion("type_id <", value, "typeId");
return (Criteria) this;
}
public Criteria andTypeIdLessThanOrEqualTo(Long value) {
addCriterion("type_id <=", value, "typeId");
return (Criteria) this;
}
public Criteria andTypeIdIn(List<Long> values) {
addCriterion("type_id in", values, "typeId");
return (Criteria) this;
}
public Criteria andTypeIdNotIn(List<Long> values) {
addCriterion("type_id not in", values, "typeId");
return (Criteria) this;
}
public Criteria andTypeIdBetween(Long value1, Long value2) {
addCriterion("type_id between", value1, value2, "typeId");
return (Criteria) this;
}
public Criteria andTypeIdNotBetween(Long value1, Long value2) {
addCriterion("type_id not between", value1, value2, "typeId");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("name is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("name is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("name >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("name <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("name <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("name like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("name not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("name in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("name not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("name between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("name not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andUrlIsNull() {
addCriterion("url is null");
return (Criteria) this;
}
public Criteria andUrlIsNotNull() {
addCriterion("url is not null");
return (Criteria) this;
}
public Criteria andUrlEqualTo(String value) {
addCriterion("url =", value, "url");
return (Criteria) this;
}
public Criteria andUrlNotEqualTo(String value) {
addCriterion("url <>", value, "url");
return (Criteria) this;
}
public Criteria andUrlGreaterThan(String value) {
addCriterion("url >", value, "url");
return (Criteria) this;
}
public Criteria andUrlGreaterThanOrEqualTo(String value) {
addCriterion("url >=", value, "url");
return (Criteria) this;
}
public Criteria andUrlLessThan(String value) {
addCriterion("url <", value, "url");
return (Criteria) this;
}
public Criteria andUrlLessThanOrEqualTo(String value) {
addCriterion("url <=", value, "url");
return (Criteria) this;
}
public Criteria andUrlLike(String value) {
addCriterion("url like", value, "url");
return (Criteria) this;
}
public Criteria andUrlNotLike(String value) {
addCriterion("url not like", value, "url");
return (Criteria) this;
}
public Criteria andUrlIn(List<String> values) {
addCriterion("url in", values, "url");
return (Criteria) this;
}
public Criteria andUrlNotIn(List<String> values) {
addCriterion("url not in", values, "url");
return (Criteria) this;
}
public Criteria andUrlBetween(String value1, String value2) {
addCriterion("url between", value1, value2, "url");
return (Criteria) this;
}
public Criteria andUrlNotBetween(String value1, String value2) {
addCriterion("url not between", value1, value2, "url");
return (Criteria) this;
}
public Criteria andPathIsNull() {
addCriterion("path is null");
return (Criteria) this;
}
public Criteria andPathIsNotNull() {
addCriterion("path is not null");
return (Criteria) this;
}
public Criteria andPathEqualTo(String value) {
addCriterion("path =", value, "path");
return (Criteria) this;
}
public Criteria andPathNotEqualTo(String value) {
addCriterion("path <>", value, "path");
return (Criteria) this;
}
public Criteria andPathGreaterThan(String value) {
addCriterion("path >", value, "path");
return (Criteria) this;
}
public Criteria andPathGreaterThanOrEqualTo(String value) {
addCriterion("path >=", value, "path");
return (Criteria) this;
}
public Criteria andPathLessThan(String value) {
addCriterion("path <", value, "path");
return (Criteria) this;
}
public Criteria andPathLessThanOrEqualTo(String value) {
addCriterion("path <=", value, "path");
return (Criteria) this;
}
public Criteria andPathLike(String value) {
addCriterion("path like", value, "path");
return (Criteria) this;
}
public Criteria andPathNotLike(String value) {
addCriterion("path not like", value, "path");
return (Criteria) this;
}
public Criteria andPathIn(List<String> values) {
addCriterion("path in", values, "path");
return (Criteria) this;
}
public Criteria andPathNotIn(List<String> values) {
addCriterion("path not in", values, "path");
return (Criteria) this;
}
public Criteria andPathBetween(String value1, String value2) {
addCriterion("path between", value1, value2, "path");
return (Criteria) this;
}
public Criteria andPathNotBetween(String value1, String value2) {
addCriterion("path not between", value1, value2, "path");
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);
}
}
} | [
"[email protected]"
]
| |
82de3b57b703b7f7dafc8af82089c24f521af4e4 | f20a338b4eb35f7351545198300424e8973f740f | /src/main/java/com/timer/ISpokesmanOfGod.java | 90dbfbd3302a3d4c3ee1f56e44008f84b3163790 | []
| no_license | Ariescat/common-timer | 09ba68092e93dc3f190815088f0b994633942a63 | 1f31f1145e573236cc464e37c9d9afe65ee465e7 | refs/heads/master | 2023-06-19T06:48:27.952226 | 2021-07-18T13:50:08 | 2021-07-18T13:50:08 | 219,464,195 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 511 | java | /*****************************
* Copyright 2018 360游戏艺术*
* **************************/
package com.timer;
/***
* 神的代言人,我是来接受上帝的委托,执行任务的
*
*/
public interface ISpokesmanOfGod extends Runnable {
/** 停止运行 */
public void stop();
/** 是否还在运行 */
public boolean isRunning();
/** 是否是常驻服务 */
public boolean isService();
/** 服务名字 */
public String getName();
/** 执行前的初始化 */
public void init();
}
| [
"[email protected]"
]
| |
09b281c5a3f79b3aa9c4c99fac8f3ae6f60f799f | 04a64b581dde7501a38e01628cf51d6005fa7134 | /Question1.java | 2745a6585224f0492c89836bda0f3b0aa9cdc636 | []
| no_license | NelsonKadama/inheritance_and_polymorphism | 52c431e999d4669e5eaac423b7e0e5818d520d9f | b18dec65d225c6e19d311d7041d12b6bcaf15e29 | refs/heads/master | 2021-01-11T01:30:26.595734 | 2016-10-12T16:42:33 | 2016-10-12T16:42:33 | 70,697,974 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,461 | java | /**
* Driver class for question 1 provided to students
*
* created 10 August, 2013
* Last edited
**/
import java.util.*;
class Question1
{
public static void main ( String args [] )
{
Scanner input = new Scanner(System.in);
String owner; //name of the vehicle owner
String make; //make of the vehicle or manufacurer
int cylinders; //number of cylinders in the engine
int capacity; //car's seating capacity
double weight; //weight of the car
System.out.println("Enter the vehicle manufacturer:");
make = input.nextLine();
System.out.println("Enter the name of the vehicle owner:");
owner = input.nextLine();
System.out.println("Enter the number of cylinders in the engine:");
cylinders = input.nextInt();
System.out.println (new Vehicle (cylinders, make, owner)); //create Vehicle object
input.nextLine(); //clear the \n
System.out.println("\nEnter the Car manufacturer:");
make = input.nextLine();
System.out.println("Enter the name of the car owner:");
owner = input.nextLine();
System.out.println("Enter the number of cylinders in the engine:");
cylinders = input.nextInt();
System.out.println("Enter the car sitting capacity:");
capacity = input.nextInt();
System.out.println("Enter the weight of the car:");
weight = input.nextDouble();
System.out.println (new Car (cylinders, make, owner, capacity, weight)); //create car object
}
}
| [
"[email protected]"
]
| |
25d14e67910f536bcc294f26d4af07ed1fbd8243 | d31fa7c14d898a590f364ef56fead01a6c4c1a66 | /src/main/java/Log.java | 6d84413b4301fd6739ad5f7ab67671ddf6513e27 | []
| no_license | nemosharma6/distributed-bellman-ford | 2f613b06c0703c5544c60e87bfb99c10e79dad1c | cb3b4804fb22f135e2b9d70630c9a7ddd7c7b375 | refs/heads/master | 2020-05-05T09:23:25.341700 | 2019-04-07T01:11:23 | 2019-04-07T01:11:23 | 179,902,334 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 908 | java | import java.io.FileWriter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
class Log {
public static String logFile;
public static FileWriter fileWriter;
private static DateFormat dateTimeFormat = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss.SSS");
private static String time() {
Date d = new Date();
return dateTimeFormat.format(d);
}
static void init(String logFile) {
Log.logFile = logFile;
try {
fileWriter = new FileWriter(logFile);
} catch (Exception e){
System.out.println(e.getMessage());
}
}
static void write(String node, String msg){
try {
fileWriter.write(time() + " - " + node + " : " + msg + "\n");
fileWriter.flush();
} catch (Exception e){
System.out.println(e.getMessage());
}
}
}
| [
"[email protected]"
]
| |
f2fa563a24ecbbe7229b547a3707070b0a932b6e | 862fd55fdf6da7a73c1f4d01af1ed55e00914799 | /src/main/java/com/joe007/practice/CombinationSum.java | e6e43d91ba6f859060382fe4eb61f7366ef26327 | []
| no_license | shuhuai007/leetcoder-pratice | 33511d87476e2ad40fff1bb2cb47f104541b506b | e5757ba199f22644196f6de81fa2660bcd4453e7 | refs/heads/master | 2020-04-16T01:18:34.878427 | 2016-09-05T15:23:06 | 2016-09-05T15:23:06 | 13,087,233 | 3 | 2 | null | null | null | null | UTF-8 | Java | false | false | 4,305 | java | package com.joe007.practice;
import java.util.ArrayList;
import java.util.Collections;
/**
* Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.
The same repeated number may be chosen from C unlimited number of times.
Note:
All numbers (including target) will be positive integers.
Elements in a combination (a1, a2, … , ak) must be in non-descending order. (ie, a1 ≤ a2 ≤ … ≤ ak).
The solution set must not contain duplicate combinations.
For example, given candidate set 2,3,6,7 and target 7,
A solution set is:
[7]
[2, 2, 3]
* @author zhoujie
* Start Time : 2013/10/30 : 13:10
* End Time : 2013/10/30 : 14:21
*
*/
public class CombinationSum {
public ArrayList<ArrayList<Integer>> combinationSum(int[] candidates, int target) {
ArrayList<ArrayList<Integer>> resultList = new ArrayList<ArrayList<Integer>> ();
if(candidates == null | candidates.length == 0){
return resultList;
}
combinationSum(candidates, target, resultList, candidates.length);
return resultList;
}
private void combinationSum(int[] candidates, int target, ArrayList<ArrayList<Integer>> resultList, int length) {
// System.out.println("length:" + length);
if(length == 0){
return;
}
if(length == 1){
int value = candidates[0];
if(value > target){
return;
} else {
// value <= target
int repeatedTimes = 1;
int repeatedValue = value;
while(repeatedValue <= target){
if(repeatedValue == target){
ArrayList<Integer> tempList = new ArrayList<Integer>();
for(int i = 0; i < repeatedTimes; i++){
tempList.add(value);
}
if(!resultList.contains(tempList)){
resultList.add(tempList);
}
}
repeatedTimes++;
repeatedValue = value * repeatedTimes;
}
}
return;
}
//
combinationSum(candidates, target, resultList, length - 1);
int lastValue = candidates[length - 1];
// System.out.println("lastValue: " + lastValue);
if(lastValue > target){
return;
} else {
// lastValue <= target
int repeatedTimes = 1;
int repeatedValue = lastValue;
while(repeatedValue <= target){
// System.out.println("repeatedTimes:" + repeatedTimes);
if(repeatedValue == target){
ArrayList<Integer> tempList = new ArrayList<Integer>();
for(int i = 0; i < repeatedTimes; i++){
tempList.add(lastValue);
}
if(!resultList.contains(tempList)){
resultList.add(tempList);
}
} else {
ArrayList<ArrayList<Integer>> resultListTemp = new ArrayList<ArrayList<Integer>>();
combinationSum(candidates, target - repeatedValue, resultListTemp, length - 1);
for(ArrayList<Integer> tempListOriginal : resultListTemp){
ArrayList<Integer> tempList = new ArrayList<Integer>(tempListOriginal);
for(int i = 0; i < repeatedTimes; i++){
tempList.add(lastValue);
}
Collections.sort(tempList);
if(!resultList.contains(tempList)){
resultList.add(tempList);
}
}
}
repeatedTimes++;
repeatedValue = lastValue * repeatedTimes;
}
}
}
public static void main(String[] args) {
CombinationSum instance = new CombinationSum();
int[] candidates = {2,3,6,7};
int target = 7;
System.out.println(instance.combinationSum(candidates , target));
}
}
| [
"[email protected]"
]
| |
2d3c5ebefee11e004ed53aa16dbebfb3508006f0 | 6fa701cdaa0d83caa0d3cbffe39b40e54bf3d386 | /google/cloud/datalabeling/v1beta1/google-cloud-datalabeling-v1beta1-java/proto-google-cloud-datalabeling-v1beta1-java/src/main/java/com/google/cloud/datalabeling/v1beta1/GcsFolderDestinationOrBuilder.java | a959b823ac352125bc37166cb853129553cbe095 | [
"Apache-2.0"
]
| permissive | oltoco/googleapis-gen | bf40cfad61b4217aca07068bd4922a86e3bbd2d5 | 00ca50bdde80906d6f62314ef4f7630b8cdb6e15 | refs/heads/master | 2023-07-17T22:11:47.848185 | 2021-08-29T20:39:47 | 2021-08-29T20:39:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | true | 852 | java | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/cloud/datalabeling/v1beta1/dataset.proto
package com.google.cloud.datalabeling.v1beta1;
public interface GcsFolderDestinationOrBuilder extends
// @@protoc_insertion_point(interface_extends:google.cloud.datalabeling.v1beta1.GcsFolderDestination)
com.google.protobuf.MessageOrBuilder {
/**
* <pre>
* Required. Cloud Storage directory to export data to.
* </pre>
*
* <code>string output_folder_uri = 1;</code>
* @return The outputFolderUri.
*/
java.lang.String getOutputFolderUri();
/**
* <pre>
* Required. Cloud Storage directory to export data to.
* </pre>
*
* <code>string output_folder_uri = 1;</code>
* @return The bytes for outputFolderUri.
*/
com.google.protobuf.ByteString
getOutputFolderUriBytes();
}
| [
"bazel-bot-development[bot]@users.noreply.github.com"
]
| bazel-bot-development[bot]@users.noreply.github.com |
8601ad417a2d901fadf401dad2dfa36c8e57ee72 | d4830ed12eb5503303e432dc7cb871c05a1a042c | /Vtcyoutube/src/com/vtc/vtctube/FragmentNewfeed.java | a62f1a4b825de868d72f0efda93cd50eac803c2e | []
| no_license | chovaodi/vtctube-dev | 930a9096b3630cc5dab6af76afd38e3b1ba59224 | 4eb21cf7ee7d6b2a1ed48d3adea557d0ff61e66f | refs/heads/master | 2021-01-19T05:46:29.104141 | 2015-02-10T10:27:49 | 2015-02-10T10:27:49 | 32,126,208 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,726 | java | package com.vtc.vtctube;
import org.json.JSONObject;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.JsResult;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.widget.ProgressBar;
import com.vtc.vtctube.model.ItemPost;
import com.vtc.vtctube.services.AysnRequestHttp;
import com.vtc.vtctube.utils.IResult;
import com.vtc.vtctube.utils.Utils;
public class FragmentNewfeed extends Fragment {
private static FragmentNewfeed frament = null;
private WebView webview_fbview;
private ProgressBar progressBar1;
public static FragmentNewfeed newInstance() {
frament = new FragmentNewfeed();
return frament;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.newfeed, container, false);
webview_fbview = (WebView) view.findViewById(R.id.contentView);
progressBar1 = (ProgressBar) view.findViewById(R.id.progressBar1);
settingWebview(webview_fbview);
ResultCallBack callBack = new ResultCallBack();
MainActivity.smooth.setVisibility(View.VISIBLE);
new AysnRequestHttp((ViewGroup) view, Utils.LOAD_FIRST_DATA, null,
callBack)
.execute("http://vtctube.vn/api/get_page?slug=thong-bao");
return view;
}
private void settingWebview(WebView webview_fbview) {
webview_fbview.getSettings().setJavaScriptEnabled(true);
webview_fbview.setLongClickable(false);
webview_fbview.getSettings().setLoadWithOverviewMode(true);
webview_fbview.getSettings().setJavaScriptCanOpenWindowsAutomatically(
true);
webview_fbview.getSettings().setUseWideViewPort(true);
webview_fbview.requestFocus(View.FOCUS_DOWN);
webview_fbview.setPadding(0, 0, 0, 0);
webview_fbview.setWebChromeClient(new webChromeClient());
webview_fbview.setInitialScale(100);
webview_fbview.clearCache(true);
webview_fbview.clearHistory();
webview_fbview.getSettings().setDefaultFontSize(18);
webview_fbview.addJavascriptInterface(new JavaScriptInterface(
getActivity()), "Android");
webview_fbview.setVisibility(View.VISIBLE);
webview_fbview.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress) {
if (progress < 100 && progressBar1.getVisibility() == View.GONE) {
progressBar1.setVisibility(View.VISIBLE);
}
if (progress == 100) {
progressBar1.setVisibility(View.GONE);
}
}
});
}
private class webChromeClient extends WebChromeClient {
// display alert message in Web View
@Override
public boolean onJsAlert(WebView view, String url, String message,
JsResult result) {
new android.app.AlertDialog.Builder(view.getContext())
.setMessage(message).setCancelable(true).show();
result.confirm();
return true;
}
}
public class JavaScriptInterface {
Context mContext;
// Instantiate the interface and set the context
JavaScriptInterface(Context c) {
mContext = c;
}
// using Javascript to call the finish activity
public void closeMyActivity() {
// finish();
}
}
private String getHtmlLink(String content) {
String linkhtml = "<html>"
+ "<meta name='viewport',content=\"width=device-width, initial-scale=1.0\">"
+ "<head>"
+ "<style type='text/css'>"
+ "p { text-align: left; width: auto; }"
+ "@font-face {"
+ "font-family: MyFont;"
+ "src: url('file:///android_asset/fonts/Roboto-Light.ttf')}"
+ " </style>"
+ "</head>"
+ "<body style=\"margin:0; padding: 0; font-size:18px; font-family: MyFont!important;\">"
+ "<div style='padding: 10px;'>" + content + "</div>"
+ "</body></html>";
return linkhtml;
}
public class ResultCallBack implements IResult {
@Override
public void getResult(int type, String result) {
MainActivity.smooth.setVisibility(View.GONE);
try {
JSONObject jsonObject = new JSONObject(result);
String msg = jsonObject.getJSONObject("page").getString(
"content");
webview_fbview.loadDataWithBaseURL("http://www.wc.vtc.vn/",
getHtmlLink(msg), "text/html", "utf-8", null);
} catch (Exception e) {
MainActivity.lblError.setVisibility(View.VISIBLE);
}
}
@Override
public void pushResutClickItem(int type, int postion, boolean isLike) {
// TODO Auto-generated method stub
}
@Override
public void onCLickView(ItemPost item) {
// TODO Auto-generated method stub
}
}
}
| [
"[email protected]@1cc92bd5-39f6-e89d-d04f-bb92b908f1ea"
]
| [email protected]@1cc92bd5-39f6-e89d-d04f-bb92b908f1ea |
0c6a5b9bb7a5524812cd126ca9bc32e59ae13032 | be2880dc353bb3cd3426cf057583dbac8f6728b7 | /org.nullbool.osgi.shell.api/src/main/java/org/nullbool/osgi/shell/api/ICommandHandler.java | 9f4c726b9a202978385dbc2338f7c0717b7201b4 | []
| no_license | t81lal/pi-rs-osgi | db9c412732cc57b07150ced1d1da16f3568d9775 | 1b68cca1aab10406e05fee494e2c497be4ac7904 | refs/heads/master | 2020-11-27T13:51:44.390125 | 2015-08-09T13:15:55 | 2015-08-09T13:15:55 | 229,470,161 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,806 | java | /************************************************************************************
* pi rs - a generic framework for loading Java Applets in a contained environment. *
* Copyright (C) 2015 NullBool *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
************************************************************************************/
package org.nullbool.osgi.shell.api;
import java.io.InputStream;
import java.io.PrintStream;
/**
* @author Bibl (don't ban me pls)
* @created 14 Jun 2015 00:01:26
*/
public abstract interface ICommandHandler {
public abstract void execute(Shell shell, String args, InputStream in, PrintStream out, PrintStream err) throws Throwable;
}
| [
"[email protected]"
]
| |
7f6dc28bb052736f96b47158a93d99e315372c3e | 7ec96d49158d6741dc30187eb28d0a554eaa9c3b | /src/main/java/com/docker/demo/web/controller/DockerDemoController.java | e20adeb83b00824fcb4f8e4d4864cedd457e05e2 | []
| no_license | duchong001/docker-demo | aa8d5042ba007ef18323a3033e5abb0b268088ca | a2a444dc1a6fe43dfc009c6d5f3e1cb77ca5d523 | refs/heads/master | 2022-12-13T18:14:47.497932 | 2020-09-02T15:41:36 | 2020-09-02T15:41:36 | 288,395,545 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 474 | java | package com.docker.demo.web.controller;
import lombok.extern.slf4j.Slf4j;
import lombok.extern.slf4j.XSlf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* demo Controller
*
* @author DUCHONG
* @since 2020-08-18 14:53
**/
@Slf4j
@RestController
public class DockerDemoController {
@GetMapping("helloDocker")
public String helloDocker(){
return "Hello Docker";
}
}
| [
"[email protected]"
]
| |
f3793c1dc9fb4b57a8658647290998a6d9abddcf | 0579649dd15c99472685b1e9b22c24742b85525c | /app/src/main/java/com/example/oud/user/fragments/premium/DownloadService.java | aca524449194fed3c3e054f9c7e8b8fdcf3438a2 | [
"MIT"
]
| permissive | youssefEdrees/Oud-1 | 62445fe7475af009424078bcc06ffdff28bae8bf | fc013e81a16f140b90ca6d7a00f7174328223ac9 | refs/heads/master | 2023-06-26T02:57:18.686423 | 2021-07-31T16:36:09 | 2021-07-31T16:36:09 | 272,238,327 | 0 | 0 | MIT | 2021-07-31T16:36:10 | 2020-06-14T16:15:22 | Java | UTF-8 | Java | false | false | 13,249 | java | package com.example.oud.user.fragments.premium;
import android.app.DownloadManager;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.database.Cursor;
import android.net.Uri;
import android.os.Binder;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.util.Log;
import com.example.oud.Constants;
import com.example.oud.OudUtils;
import com.example.oud.api.OudApi;
import java.io.File;
import java.util.LinkedList;
import androidx.annotation.NonNull;
public class DownloadService extends Service {
private static final String TAG = DownloadService.class.getSimpleName();
public static final int PROGRESS_UPDATE_DELAY = 200; //ms
private String token;
private BroadcastReceiver mDownloadCompleteReceiver;
private LinkedList<TrackDownloadInfo> mTrackDownloadInfoList;
private Handler mHandler;
private LinkedList<DownloadListener> downloadListeners;
private final IBinder mBinder = new DownloadServiceBinder();
public DownloadService() {
}
@Override
public void onCreate() {
super.onCreate();
initializeDownloadCompleteReceiver();
registerReceiver(mDownloadCompleteReceiver,
new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
token = OudUtils.getToken(this);
mHandler = new Handler();
mHandler.post(progressRunnable);
}
@Override
public IBinder onBind(Intent intent) {
// TODO: Return the communication channel to the service.
return mBinder;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (intent != null) {
TrackDownloadInfo trackDownloadInfo = constructTrackDownloadInfo(intent);
if (mTrackDownloadInfoList == null)
mTrackDownloadInfoList = new LinkedList<>();
mTrackDownloadInfoList.add(trackDownloadInfo);
DownloadManager.Request request = constructDownloadRequest(trackDownloadInfo);
trackDownloadInfo.downloadId =
((DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE)).enqueue(request);
}
return super.onStartCommand(intent, flags, startId);
}
public static void enqueueDownload(@NonNull Context context,
@NonNull String url,
@NonNull String userId,
@NonNull String trackId,
@NonNull String trackImage,
@NonNull String trackName) {
Intent downloadIntent = new Intent(context, DownloadService.class);
downloadIntent.putExtra(Constants.URL_KEY, url);
downloadIntent.putExtra(Constants.USER_ID_KEY, userId);
downloadIntent.putExtra(Constants.TRACK_ID_KEY, trackId);
downloadIntent.putExtra(Constants.TRACK_IMAGE_KEY, trackImage);
downloadIntent.putExtra(Constants.TRACK_NAME_KEY, trackName);
context.startService(downloadIntent);
}
@Override
public void onTaskRemoved(Intent rootIntent) {
super.onTaskRemoved(rootIntent);
Log.d(TAG, "onTaskRemoved: called.");
unregisterReceiver(mDownloadCompleteReceiver);
stopSelf();
}
@Override
public void onDestroy() {
super.onDestroy();
unregisterReceiver(mDownloadCompleteReceiver);
stopSelf();
}
private Runnable progressRunnable = new Runnable() {
@Override
public void run() {
// Log.d(TAG, "progressRunnable: ");
if (mTrackDownloadInfoList != null) {
for (TrackDownloadInfo trackDownloadInfo : mTrackDownloadInfoList) {
if (trackDownloadInfo.downloadStatus != DownloadManager.STATUS_FAILED &
trackDownloadInfo.downloadStatus != DownloadManager.STATUS_SUCCESSFUL) {
DownloadManager.Query query = new DownloadManager.Query();
query.setFilterById(trackDownloadInfo.downloadId);
DownloadManager dm =
((DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE));
Cursor c = dm.query(query);
if (c.moveToFirst()) {
int sizeIndex = c.getColumnIndex(DownloadManager.COLUMN_TOTAL_SIZE_BYTES);
int downloadedIndex = c.getColumnIndex(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR);
long size = c.getInt(sizeIndex);
long downloaded = c.getInt(downloadedIndex);
int progress = 0;
if (size != -1) {
progress = (int) (downloaded * 100.0f / size);
for (DownloadListener downloadListener : downloadListeners) {
downloadListener.onProgress(trackDownloadInfo, progress);
}
} else {
int statusIndex = c.getColumnIndex(DownloadManager.COLUMN_STATUS);
trackDownloadInfo.downloadStatus = c.getInt(statusIndex);
}
}
}
}
}
mHandler.postDelayed(this, PROGRESS_UPDATE_DELAY);
}
};
public void addDownloadListener(DownloadListener downloadListener) {
if (downloadListeners == null)
downloadListeners = new LinkedList<>();
downloadListeners.add(downloadListener);
}
public void removeDownloadListener(DownloadListener downloadListener) {
if (downloadListeners == null)
downloadListeners = new LinkedList<>();
downloadListeners.remove(downloadListener);
}
private TrackDownloadInfo constructTrackDownloadInfo(Intent downloadIntent) {
Bundle intentBundle = downloadIntent.getExtras();
TrackDownloadInfo trackDownloadInfo = new TrackDownloadInfo();
trackDownloadInfo.url = intentBundle.getString(Constants.URL_KEY);
trackDownloadInfo.userId = intentBundle.getString(Constants.USER_ID_KEY);
trackDownloadInfo.trackId = intentBundle.getString(Constants.TRACK_ID_KEY);
trackDownloadInfo.trackImage = intentBundle.getString(Constants.TRACK_IMAGE_KEY);
trackDownloadInfo.trackName = intentBundle.getString(Constants.TRACK_NAME_KEY);
return trackDownloadInfo;
}
private DownloadManager.Request constructDownloadRequest(TrackDownloadInfo trackDownloadInfo) {
Uri downloadUri = Uri.parse(trackDownloadInfo.url);
DownloadManager.Request request = new DownloadManager.Request(downloadUri);
request.addRequestHeader(OudApi.AUTHORIZATION_HEADER, token);
request.setTitle("Downloading " + trackDownloadInfo.trackName);
String fileName = trackDownloadInfo.trackId + Constants.OFFLINE_TRACKS_EXTENSION;
trackDownloadInfo.fileName = fileName;
File file = new File(getExternalFilesDir(Constants.OFFLINE_TRACKS_DIR_NAME).getAbsolutePath() + File.separator + fileName);
Uri destinationUri = Uri.fromFile(file);
request.setDestinationUri(destinationUri);
return request;
}
private void initializeDownloadCompleteReceiver() {
mDownloadCompleteReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) {
long downloadId = intent.getLongExtra(
DownloadManager.EXTRA_DOWNLOAD_ID, 0);
TrackDownloadInfo trackDownloadInfo = getTrackDownloadInfoWithDownloadId(downloadId);
DownloadManager.Query query = new DownloadManager.Query();
query.setFilterById(downloadId);
DownloadManager dm =
((DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE));
Cursor c = dm.query(query);
if (c.moveToFirst()) {
int columnIndex = c
.getColumnIndex(DownloadManager.COLUMN_STATUS);
if (DownloadManager.STATUS_SUCCESSFUL == c
.getInt(columnIndex)) {
trackDownloadInfo.downloadStatus = DownloadManager.STATUS_SUCCESSFUL;
for (DownloadListener downloadListener : downloadListeners) {
downloadListener.onSuccess(trackDownloadInfo);
}
} else if (DownloadManager.STATUS_FAILED == c
.getInt(columnIndex)) {
trackDownloadInfo.downloadStatus = DownloadManager.STATUS_FAILED;
int columnReason = c.getColumnIndex(DownloadManager.COLUMN_REASON);
int reason = c.getInt(columnReason);
String failedReason = "";
switch(reason){
case DownloadManager.ERROR_CANNOT_RESUME:
failedReason = "ERROR_CANNOT_RESUME";
break;
case DownloadManager.ERROR_DEVICE_NOT_FOUND:
failedReason = "ERROR_DEVICE_NOT_FOUND";
break;
case DownloadManager.ERROR_FILE_ALREADY_EXISTS:
failedReason = "ERROR_FILE_ALREADY_EXISTS";
break;
case DownloadManager.ERROR_FILE_ERROR:
failedReason = "ERROR_FILE_ERROR";
break;
case DownloadManager.ERROR_HTTP_DATA_ERROR:
failedReason = "ERROR_HTTP_DATA_ERROR";
break;
case DownloadManager.ERROR_INSUFFICIENT_SPACE:
failedReason = "ERROR_INSUFFICIENT_SPACE";
break;
case DownloadManager.ERROR_TOO_MANY_REDIRECTS:
failedReason = "ERROR_TOO_MANY_REDIRECTS";
break;
case DownloadManager.ERROR_UNHANDLED_HTTP_CODE:
failedReason = "ERROR_UNHANDLED_HTTP_CODE";
break;
case DownloadManager.ERROR_UNKNOWN:
failedReason = "ERROR_UNKNOWN";
break;
}
Log.d(TAG, "onReceive: Failure reason: " + reason + ", " + failedReason);
for (DownloadListener downloadListener : downloadListeners) {
downloadListener.onFailure(trackDownloadInfo, reason);
}
}
}
}
}
};
}
private TrackDownloadInfo getTrackDownloadInfoWithDownloadId(long downloadId) {
TrackDownloadInfo trackDownloadInfo = null;
for (TrackDownloadInfo current : mTrackDownloadInfoList) {
if (current.downloadId == downloadId) {
trackDownloadInfo = current;
break;
}
}
return trackDownloadInfo;
}
public class DownloadServiceBinder extends Binder {
public DownloadService getDownloadService(){
return DownloadService.this;
}
}
public static final class TrackDownloadInfo {
private int downloadStatus = 0;
private long downloadId;
private String url;
private String userId;
private String trackId;
private String trackImage;
private String trackName;
private String fileName;
public String getUserId() {
return userId;
}
public String getTrackId() {
return trackId;
}
public String getTrackImage() {
return trackImage;
}
public String getTrackName() {
return trackName;
}
public String getFileName() {
return fileName;
}
}
public interface DownloadListener {
void onSuccess(TrackDownloadInfo trackDownloadInfo);
void onProgress(TrackDownloadInfo trackDownloadInfo, int progress);
void onFailure(TrackDownloadInfo trackDownloadInfo, int reason);
}
}
| [
"[email protected]"
]
| |
5712f3f641328c011fafca77c03dbd344228d6c8 | e9045e5fa2457a301fa0401d040b0aafb218f9ad | /src/edu/stanford/smi/protegex/owl/model/event/ProtegeClsListener.java | 17a268761b8fd7fe804c7c9bb9c4b8bd468c5897 | []
| no_license | ubbdst/protege-owl-plugin | 8441c5b3c04b37d6e76227c206a4ce9953d65992 | 55bf58bbeea18349581aae8883da25587b0adb6a | refs/heads/master | 2021-06-05T11:38:14.123125 | 2019-04-03T10:59:21 | 2019-04-03T10:59:21 | 83,047,190 | 1 | 0 | null | 2019-04-03T10:47:48 | 2017-02-24T14:04:41 | Java | UTF-8 | Java | false | false | 2,990 | java | /*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
*
* The Original Code is Protege-2000.
*
* The Initial Developer of the Original Code is Stanford University. Portions
* created by Stanford University are Copyright (C) 2007. All Rights Reserved.
*
* Protege was developed by Stanford Medical Informatics
* (http://www.smi.stanford.edu) at the Stanford University School of Medicine
* with support from the National Library of Medicine, the National Science
* Foundation, and the Defense Advanced Research Projects Agency. Current
* information about Protege can be obtained at http://protege.stanford.edu.
*
*/
package edu.stanford.smi.protegex.owl.model.event;
import edu.stanford.smi.protege.event.ClsEvent;
import edu.stanford.smi.protege.event.ClsListener;
/**
* @author Holger Knublauch <[email protected]>
*/
public interface ProtegeClsListener extends ClsListener {
/**
* @see ClassListener#instanceAdded
* @deprecated
*/
void directInstanceAdded(ClsEvent event);
/**
* @see ClassListener#instanceRemoved
* @deprecated
*/
void directInstanceRemoved(ClsEvent event);
/**
* @see ClassListener#subclassAdded
* @deprecated
*/
void directSubclassAdded(ClsEvent event);
/**
* @deprecated not supported by OWL
*/
void directSubclassMoved(ClsEvent event);
/**
* @see ClassListener#subclassRemoved
* @deprecated
*/
void directSubclassRemoved(ClsEvent event);
/**
* @see ClassListener#superclassAdded
* @deprecated
*/
void directSuperclassAdded(ClsEvent event);
/**
* @see ClassListener#subclassRemoved
* @deprecated
*/
void directSuperclassRemoved(ClsEvent event);
/**
* @deprecated no OWL equivalent
*/
void templateFacetAdded(ClsEvent event);
/**
* @deprecated no OWL equivalent
*/
void templateFacetRemoved(ClsEvent event);
/**
* @deprecated no OWL equivalent
*/
void templateFacetValueChanged(ClsEvent event);
/**
* @see ClassListener#addedToUnionDomainOf
* @deprecated
*/
void templateSlotAdded(ClsEvent event);
/**
* @see ClassListener#removedFromUnionDomainOf
* @deprecated
*/
void templateSlotRemoved(ClsEvent event);
/**
* @deprecated no OWL equivalent
*/
void templateSlotValueChanged(ClsEvent event);
}
| [
"[email protected]"
]
| |
3d4296a90ce4aa6724ae978ca3d0e90c781cc337 | 6fe3adc31e1c4e506fc51efe57cb6907f893df18 | /src/main/java/com/fiveone/edm/service/impl/SendEmailServiceImpl.java | 215e5109ea72fa11ed5655ea18d8618a1c21b132 | []
| no_license | imoosen/edmclient | 12ad995508154d77e8ac816be61362f14aa6d7b1 | 90e7ff4b210bd8b1dfd1b726aa0be36cd48633e0 | refs/heads/master | 2021-01-01T04:32:00.189817 | 2017-07-14T03:43:48 | 2017-07-14T03:43:48 | 97,189,427 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,714 | java | package com.fiveone.edm.service.impl;
import java.util.List;
import java.util.Random;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import com.fiveone.edm.database.entity.EmailProject;
import com.fiveone.edm.email.SendEmail;
import com.fiveone.edm.service.ISendEmailService;
/**
* 发送邮件服务层实现类
* @company: 51jrq
* @author: lhw
* @time: 2017年1月3日 下午7:04:07
* @version: 1.0
* @since: JDK1.7
*/
@Service
@Repository("sendEmailService")
public class SendEmailServiceImpl implements ISendEmailService {
private static final Logger log = Logger.getLogger(SendEmailServiceImpl.class);
/**
* 单个发邮件
* @param recipient
* @param emailProject
* @param stmp
* @param content
* @throws Exception
*/
@Override
public void sendEmail(String recipient, EmailProject emailProject,String stmp, String content,String subject) throws Exception {
/**
* 初始化
* 通过邮箱项目来决定谁来发送
* 验证用户名和密码
*/
SendEmail sendEmail = new SendEmail(emailProject.getEmailSender().getEmailSenderAddress(), emailProject.getEmailSender().getPassword(),stmp);
//通过邮箱项目计划来决定发送什么主题和内容
// String subject = emailProject.getEmailContent().getEmailTitle();
// String[] str = subject.split(",");
// if (str.length > 1) {
// Random ran = new Random();
// //随机去一个邮件标题
// subject = str[ran.nextInt(str.length)];
// }else {
// subject = str[0];
// }
sendEmail.sendEmail(recipient, subject, content);
}
/**
* 群发邮件
* @param recipients
* @param emailProject
* @throws Exception
*/
@Override
public void sendEmail(List<String> recipients, EmailProject emailProject) throws Exception {
/**
* 初始化
* 通过邮箱项目来决定谁来发送
* 验证用户名和密码
*/
SendEmail sendEmail = new SendEmail(emailProject.getEmailSender().getEmailSenderAddress(), emailProject.getEmailSender().getPassword(),"");
//通过邮箱项目计划来决定发送什么主题和内容
String subject = emailProject.getEmailContent().getEmailTitle();
String[] str = subject.split(",");
if (str.length > 1) {
Random ran = new Random();
//随机去一个邮件标题
subject = str[ran.nextInt(ran.nextInt(str.length))];
}else {
subject = str[0];
}
String content = emailProject.getEmailContent().getContent();
sendEmail.sendEmail(recipients, subject, content);
}
/* public static void main(String[] args) {
Random ran = new Random();
for (int i = 0; i < 10; i++) {
System.out.println(ran.nextInt(5));
}
}
*/
}
| [
"[email protected]"
]
| |
d2e5aad5b84f18f929e3e5683963a704aa2155b2 | ddc252a2277c299b1bf88b7e2336f1b43206b977 | /HLSchool/src/main/java/com/hl/web/rest/LessonResource.java | bf782c5187a8e8d3528e145cf3c971352576439d | []
| no_license | BulkSecurityGeneratorProject/HLSchool | a41ead9682fc3b638bfbe677a6f7c9cb70921023 | 6e1672802408c77ea0a675f941bf4b69379825ac | refs/heads/master | 2022-12-16T16:07:28.774814 | 2018-03-05T00:43:37 | 2018-03-05T00:43:37 | 296,613,450 | 0 | 0 | null | 2020-09-18T12:21:39 | 2020-09-18T12:21:39 | null | UTF-8 | Java | false | false | 6,395 | java | package com.hl.web.rest;
import com.codahale.metrics.annotation.Timed;
import com.hl.service.LessonService;
import com.hl.web.rest.errors.BadRequestAlertException;
import com.hl.web.rest.util.HeaderUtil;
import com.hl.web.rest.util.PaginationUtil;
import com.hl.service.dto.LessonDTO;
import io.github.jhipster.web.util.ResponseUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.net.URI;
import java.net.URISyntaxException;
import java.time.ZonedDateTime;
import java.util.List;
import java.util.Optional;
import java.util.stream.StreamSupport;
import static org.elasticsearch.index.query.QueryBuilders.*;
/**
* REST controller for managing Lesson.
*/
@RestController
@RequestMapping("/api")
public class LessonResource {
private final Logger log = LoggerFactory.getLogger(LessonResource.class);
private static final String ENTITY_NAME = "lesson";
private final LessonService lessonService;
public LessonResource(LessonService lessonService) {
this.lessonService = lessonService;
}
/**
* POST /lessons : Create a new lesson.
*
* @param lessonDTO the lessonDTO to create
* @return the ResponseEntity with status 201 (Created) and with body the new lessonDTO, or with status 400 (Bad Request) if the lesson has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/lessons")
@Timed
public ResponseEntity<LessonDTO> createLesson(@Valid @RequestBody LessonDTO lessonDTO) throws URISyntaxException {
log.debug("REST request to save Lesson : {}", lessonDTO);
if (lessonDTO.getId() != null) {
throw new BadRequestAlertException("A new lesson cannot already have an ID", ENTITY_NAME, "idexists");
}
lessonDTO.setCreateDate(ZonedDateTime.now());
LessonDTO result = lessonService.save(lessonDTO);
return ResponseEntity.created(new URI("/api/lessons/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* PUT /lessons : Updates an existing lesson.
*
* @param lessonDTO the lessonDTO to update
* @return the ResponseEntity with status 200 (OK) and with body the updated lessonDTO,
* or with status 400 (Bad Request) if the lessonDTO is not valid,
* or with status 500 (Internal Server Error) if the lessonDTO couldn't be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("/lessons")
@Timed
public ResponseEntity<LessonDTO> updateLesson(@Valid @RequestBody LessonDTO lessonDTO) throws URISyntaxException {
log.debug("REST request to update Lesson : {}", lessonDTO);
if (lessonDTO.getId() == null) {
return createLesson(lessonDTO);
}
LessonDTO result = lessonService.save(lessonDTO);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, lessonDTO.getId().toString()))
.body(result);
}
/**
* GET /lessons : get all the lessons.
*
* @param pageable the pagination information
* @return the ResponseEntity with status 200 (OK) and the list of lessons in body
*/
@GetMapping("/lessons")
@Timed
public ResponseEntity<List<LessonDTO>> getAllLessons(Pageable pageable) {
log.debug("REST request to get a page of Lessons");
Page<LessonDTO> page = lessonService.findAll(pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/lessons");
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
@GetMapping("/lessonsByCourseId/{id}")
@Timed
public ResponseEntity<List<LessonDTO>> getLessonsByCourseId(@PathVariable Long id, Pageable pageable) {
log.debug("REST request to get a page of Lessons");
Page<LessonDTO> page = lessonService.findLessonsByCourseId(id, pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/lessons");
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
/**
* GET /lessons/:id : get the "id" lesson.
*
* @param id the id of the lessonDTO to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the lessonDTO, or with status 404 (Not Found)
*/
@GetMapping("/lessons/{id}")
@Timed
public ResponseEntity<LessonDTO> getLesson(@PathVariable Long id) {
log.debug("REST request to get Lesson : {}", id);
LessonDTO lessonDTO = lessonService.findOne(id);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(lessonDTO));
}
/**
* DELETE /lessons/:id : delete the "id" lesson.
*
* @param id the id of the lessonDTO to delete
* @return the ResponseEntity with status 200 (OK)
*/
@DeleteMapping("/lessons/{id}")
@Timed
public ResponseEntity<Void> deleteLesson(@PathVariable Long id) {
log.debug("REST request to delete Lesson : {}", id);
lessonService.delete(id);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
}
/**
* SEARCH /_search/lessons?query=:query : search for the lesson corresponding
* to the query.
*
* @param query the query of the lesson search
* @param pageable the pagination information
* @return the result of the search
*/
@GetMapping("/_search/lessons")
@Timed
public ResponseEntity<List<LessonDTO>> searchLessons(@RequestParam String query, Pageable pageable) {
log.debug("REST request to search for a page of Lessons for query {}", query);
Page<LessonDTO> page = lessonService.search(query, pageable);
HttpHeaders headers = PaginationUtil.generateSearchPaginationHttpHeaders(query, page, "/api/_search/lessons");
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
}
| [
"[email protected]"
]
| |
595e7a191f0eb8948234f45e0056c5e50c7f940e | 358764409f1761f5516ffb313d151da080554a40 | /src/feedbackmaintainer2/login.java | 8409a22393d48df9fc2070c6c067fb8cc0564e7d | []
| no_license | chinmay367/feedback-maintainer | 0010dcc18bf0684fa5b5f83f23403c7aca92e152 | de659e6de63b25239a752c6355492214d2216af4 | refs/heads/master | 2020-03-16T04:30:45.477983 | 2019-11-27T06:42:10 | 2019-11-27T06:42:10 | 132,512,803 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,615 | 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 feedbackmaintainer2;
import java.sql.Connection;
import java.awt.Color;
import java.awt.Toolkit;
import java.sql.*;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
/**
*
* @author CS
*/
public class login extends javax.swing.JFrame {
/**
* Creates new form adminlogin
*/
public login() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jButton1 = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jTextField2 = new javax.swing.JTextField();
jPasswordField1 = new javax.swing.JPasswordField();
jLabel3 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(null);
jButton1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jButton1.setForeground(new java.awt.Color(102, 0, 0));
jButton1.setText("LOGIN");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
getContentPane().add(jButton1);
jButton1.setBounds(230, 280, 80, 30);
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel1.setForeground(new java.awt.Color(102, 0, 0));
jLabel1.setText("Password");
getContentPane().add(jLabel1);
jLabel1.setBounds(150, 210, 110, 30);
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel2.setForeground(new java.awt.Color(102, 0, 0));
jLabel2.setText("Name");
getContentPane().add(jLabel2);
jLabel2.setBounds(150, 170, 110, 30);
jTextField2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jTextField2.setForeground(new java.awt.Color(102, 0, 0));
getContentPane().add(jTextField2);
jTextField2.setBounds(300, 170, 140, 30);
jPasswordField1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jPasswordField1.setForeground(new java.awt.Color(102, 0, 0));
getContentPane().add(jPasswordField1);
jPasswordField1.setBounds(300, 210, 140, 30);
jLabel3.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
jLabel3.setText("ADMIN LOGIN FORM");
getContentPane().add(jLabel3);
jLabel3.setBounds(150, 50, 400, 140);
setBounds(0, 0, 646, 538);
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
String url="jdbc:mysql://localhost/feedback";
try
{
Connection conn=DriverManager.getConnection(url, "root", "");
try
{
String q="select * from admin where name=? and password=?";
PreparedStatement state=conn.prepareStatement(q);
state.setString(1,jTextField2.getText());
state.setString(2,jPasswordField1.getText());
ResultSet set=state.executeQuery();
if(set.next())
{
new admininterface().setVisible(true);
this.dispose();
}
else
{
JOptionPane.showMessageDialog(rootPane,"Invalid Admin");
this.dispose();
}
}
catch(SQLException e)
{
JOptionPane.showMessageDialog(rootPane,"error in query"+" "+e.getMessage());
}
finally
{
conn.close();
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(rootPane, "error in connection"+" "+e.getMessage());
}
}//GEN-LAST:event_jButton1ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new login().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPasswordField jPasswordField1;
private javax.swing.JTextField jTextField2;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
]
| |
e47d5b0adcea8377483c1b80e60a8e9bf809bfa0 | 91527f254152c405dea126c6d75b9538a3cdc9e6 | /strive-api/src/main/java/com/jacky/strive/api/controller/KeyValueController.java | 062d18ef3ae2320137d1d7923bf0aeb6541ffc1f | []
| no_license | jackyhuangc/instructure | c87e91efa02aa0894e5e244aec7206d0437bdac5 | d5f40b223b1ffcd8f28bd6d7de85d0d945f8b154 | refs/heads/master | 2022-12-20T23:19:18.637310 | 2019-05-28T14:43:06 | 2019-05-28T14:43:06 | 188,202,006 | 0 | 0 | null | 2022-12-10T05:39:35 | 2019-05-23T09:21:25 | Java | UTF-8 | Java | false | false | 1,950 | java | package com.jacky.strive.api.controller;
import com.github.pagehelper.PageInfo;
import com.jacky.common.util.AssertUtil;
import com.jacky.common.entity.result.ResResult;
import com.jacky.strive.dao.model.KeyValue;
import com.jacky.strive.service.KeyValueService;
import com.jacky.strive.service.dto.KeyValueQueryDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.jacky.common.*;
/**
* @author huangchao
* @create 2018/6/6 下午1:55
* @desc
**/
@RestController
@RequestMapping("/keyValue")
public class KeyValueController {
@Autowired
KeyValueService keyValueService;
@GetMapping("/{key}")
public ResResult get(@PathVariable("key") String key) {
KeyValue m = keyValueService.findByKey(key);
AssertUtil.notNull(m, "产品不存在");
return ResResult.success("", m);
}
@PostMapping("/create")
public ResResult create(@RequestBody KeyValue keyValue) {
KeyValue m = keyValueService.add(keyValue);
AssertUtil.notNull(m, "添加失败");
return ResResult.success("", m);
}
@PostMapping("/modify/{key}")
public ResResult modify(@PathVariable("key") String key, @RequestBody KeyValue keyValue) {
keyValue.setKeyvalueKey(key);
KeyValue m = keyValueService.modify(keyValue);
AssertUtil.notNull(m, "修改失败");
return ResResult.success("", m);
}
@PostMapping("/delete/{key}")
public ResResult delete(@PathVariable("key") String key) {
boolean ret = keyValueService.delete(key);
AssertUtil.isTrue(ret, "删除失败");
return ResResult.success("", ret);
}
@PostMapping("/query")
public ResResult query(@RequestBody KeyValueQueryDto queryDto) {
PageInfo<KeyValue> keyValueList = keyValueService.findKeyValueList(queryDto);
return ResResult.success("", keyValueList);
}
} | [
"[email protected]"
]
| |
39f77685e5c90aa7ffa799b5ebd4556491c0c46f | 5f9f33b8dcd327e9eb67e40c680fdb10eb61e14d | /1.JavaSyntax/src/com/javarush/task/task09/task0919/Solution.java | f5b305abcf3983cf0516cb0db2064bbcbc5f3a26 | []
| no_license | radiohate/JavaRushTasks | f6bf44939595936f7c24c9294b8a93459eeade82 | bab5ba239ffd5b4226c7f868bdbf34b4435db233 | refs/heads/master | 2023-05-17T03:15:22.467460 | 2021-06-12T11:57:16 | 2021-06-12T11:57:16 | 376,276,814 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 435 | java | package com.javarush.task.task09.task0919;
/*
Деление на ноль
*/
public class Solution {
public static void main(String[] args) {
try {
divideByZero();
} catch (Exception e){
//System.out.println();
e.printStackTrace();
}
}
public static void divideByZero() throws ArithmeticException{
int i = 5/0;
System.out.println(i);
}
}
| [
"[email protected]"
]
| |
b0512b99b33c84fd3f5b728e4b1105ba06d3c3b3 | 88100154aa5a96fbcbda30f6b1c58018d76675de | /sectest/src/test/java/project/tests/Admin/Test19/Test19FromAdminMain7.java | 7aec92d760eff0314c095c9a70892d6c5d13c165 | []
| no_license | dexter0195/JWebUnit-Taint-Analisys | 54905d7e379ea37b010c87dc8d3d8a76e947acfa | 44a9f1ee5a9b9296a936f66a64f56d16d125c85b | refs/heads/master | 2020-04-10T12:33:34.392918 | 2019-07-13T09:34:48 | 2019-07-13T09:34:48 | 161,026,196 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,028 | java |
package project.tests.Admin.Test19;
import org.junit.*;
import static org.junit.Assert.*;
import project.tests.Admin.AdminBaseTest;
public class Test19FromAdminMain7 extends AdminBaseTest {
@Test
public void test() {
String taintedVar = "page2";
String targetForm = "addterm";
//login
goToLoginPage();
assertTrue("ERROR: cannot go to log in page", isLoginPage());
login(getUsername(),getPassword());
assertTrue("ERROR: cannot login", isLoggedIn());
//create the custom form with navigation to target page
utils.createMyForm();
utils.addFieldToMyFormWithValue("page","1");
utils.addFieldToMyFormWithValue("page2","8");
//ATTACK
utils.injectVarMyForm(taintedVar);
assertTrue("ERROR: Title doesn't match",utils.isTitleEqualsTo(addTermTitle));
assertFalse("ERROR: Malicious link found",utils.isMaliciousLinkPresentInForm(targetForm));
}
}
| [
"[email protected]"
]
| |
a044303deb3a3bf68bb38c6466c026e5d84beedc | 2f70b681486b6b2ed0d7651b35dca7d94f67eb46 | /src/Oefen/oefen1.java | e336a1ea327d2fa919309dbadde816880abb29d4 | []
| no_license | D-Hildebrand/blok5_afvink | 6aab4b617be18ac224b29e738b270a21dcaff2ba | 44f0386fd4f438dcf4a5d18efa3653d0ff9664df | refs/heads/master | 2023-01-06T14:06:30.905234 | 2020-11-06T23:35:29 | 2020-11-06T23:35:29 | 297,341,523 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 508 | java | package Oefen;
public class oefen1 {
public static void main(String[] args) {
System.out.println("Hello");
int i;
i = 7;
System.out.println(i);
long y;
y = 78945318L;
int b;
double getal;
getal = 7.981756;
System.out.println(getal);
float f;
f = 7.78945F;
}
//
// private static int i (){
// return 7;
//
// System.out.println(i);
// }
// dit is een return iets, super strict.
}
| [
"[email protected]"
]
| |
d014baada89e9f79d857fdc3cca4ea48bfc29497 | 9df7d1248130883d9cec2d535871534f342827d7 | /src/main/java/com/saresh/bionic/dao/impl/CustomerDaoImpl.java | a0896813e73aaed156a26590223914f8b71985d9 | []
| no_license | saresh/FishTradeCompany | a70bb5b9fe2e43d2d98c94b61fa86f2250fc9622 | 4d07058d40ce07ee326ae7e9815235fad8116956 | refs/heads/master | 2016-09-06T11:12:13.999628 | 2015-09-02T11:42:23 | 2015-09-02T11:42:23 | 41,797,672 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,459 | java | package com.saresh.bionic.dao.impl;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;
import org.springframework.stereotype.Repository;
import com.saresh.bionic.dao.CustomerDao;
import com.saresh.bionic.entity.Customer;
import com.saresh.bionic.entity.User;
@Repository
public class CustomerDaoImpl implements CustomerDao{
@PersistenceContext
private EntityManager em;
@Override
public Customer findById(int id) {
Customer customer = null;
customer = em.find(Customer.class, id);
return customer;
}
@Override
public void save(Customer customer) {
if(customer.getId() == 0){
em.persist(customer);
} else {
em.merge(customer);
}
}
@Override
public void setPrepaymentType(int id, int percent) {
Customer customer = null;
customer = em.find(Customer.class, id);
customer.setPrepaymentPercent(percent);
em.persist(customer);
}
@Override
public Customer findByUser(User user) {
TypedQuery<Customer> query = em.createQuery("SELECT c FROM Customer c "
+ "WHERE c.user = :user", Customer.class);
query.setParameter("user", user);
return query.getSingleResult();
}
@Override
public List<Customer> findAll() {
TypedQuery<Customer> query = em.createQuery("SELECT c FROM Customer c", Customer.class);
return query.getResultList();
}
}
| [
"[email protected]"
]
| |
77d7fcb0eb5f0709fe79377ff79dc68566e15b65 | 278a1c7d307f0a00f5b4f6f0f03efbb73bcd1380 | /breeze-core/src/test/java/com/weibo/breeze/BreezeRWTest.java | 4f9f8a524131ac64516e65745466c1215d0f286d | [
"Apache-2.0"
]
| permissive | weibreeze/breeze | 8518a9ff898aed2eaacca3fcb0fec17678450909 | cf574e370c6d8c1994baf76c0511d96ec1972a3b | refs/heads/master | 2022-12-21T06:46:21.184389 | 2021-06-29T10:23:34 | 2021-06-29T10:23:34 | 179,437,672 | 4 | 1 | NOASSERTION | 2022-12-16T04:47:56 | 2019-04-04T06:43:30 | Java | UTF-8 | Java | false | false | 10,276 | java | package com.weibo.breeze;
import com.weibo.breeze.message.GenericMessage;
import com.weibo.breeze.message.Schema;
import com.weibo.breeze.serializer.CommonSerializer;
import com.weibo.breeze.serializer.Serializer;
import com.weibo.breeze.test.message.MyEnum;
import com.weibo.breeze.test.message.TestMsg;
import com.weibo.breeze.test.message.TestSubMsg;
import com.weibo.breeze.test.obj.TestEnum;
import com.weibo.breeze.test.obj.TestObj;
import com.weibo.breeze.test.obj.TestSubObj;
import com.weibo.breeze.test.serializer.TestObjSerializer;
import com.weibo.breeze.test.serializer.TestSubObjSerializer;
import com.weibo.breeze.type.Types;
import org.junit.Test;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.*;
/**
* Created by zhanglei28 on 2019/3/29.
*/
@SuppressWarnings("all")
public class BreezeRWTest {
protected static <T> T testSerialize(Object object, Class<T> clz) throws BreezeException {
BreezeBuffer buffer = new BreezeBuffer(256);
BreezeWriter.writeObject(buffer, object);
buffer.flip();
byte[] result = buffer.getBytes();
BreezeBuffer newBuffer = new BreezeBuffer(result);
return (T) BreezeReader.readObject(newBuffer, clz);
}
public static TestMsg getDefaultTestMsg() {
TestMsg testMsg = new TestMsg();
testMsg.setMyString("testmmm");
testMsg.setMyInt(3);
Map<String, TestSubMsg> map = new HashMap<>();
TestSubMsg testSubMsg = new TestSubMsg();
testSubMsg.setMyInt(11);
testSubMsg.setMyString("tsmmmmm");
testSubMsg.setMyBool(true);
testSubMsg.setMyByte(Types.MESSAGE);
testSubMsg.setMyFloat64(23.456d);
testSubMsg.setMyFloat32(3.1415f);
testSubMsg.setMyBytes("xxxx".getBytes());
testSubMsg.setMyInt64(33l);
List<Integer> list = new ArrayList<>();
list.add(23);
list.add(56);
testSubMsg.setMyArray(list);
Map<String, byte[]> submap = new HashMap<>();
submap.put("k1", "vv".getBytes());
submap.put("k2", "vvvv".getBytes());
testSubMsg.setMyMap1(submap);
Map<Integer, List<Integer>> map2 = new HashMap<>();
List<Integer> listx = new ArrayList();
listx.add(234);
listx.add(567);
listx.add(789);
map2.put(6, listx);
testSubMsg.setMyMap2(map2);
TestSubMsg testSubMsg2 = new TestSubMsg();
testSubMsg2.setMyArray(new ArrayList<>());
TestSubMsg testSubMsg3 = new TestSubMsg();
testSubMsg3.setMyInt(234);
map.put("1", testSubMsg);
map.put("2", testSubMsg2);
testMsg.setMyMap(map);
testMsg.setSubMsg(testSubMsg3);
testMsg.setMyEnum(MyEnum.E2);
List<MyEnum> myEnums = new ArrayList<>();
myEnums.add(MyEnum.E3);
myEnums.add(MyEnum.E2);
myEnums.add(MyEnum.E1);
testMsg.setEnumArray(myEnums);
return testMsg;
}
public static TestObj getDefaultTestObj() {
TestObj testObj = new TestObj();
testObj.setString("mytest");
testObj.setInteger(40);
TestSubObj tso1 = new TestSubObj();
tso1.setAnInt(38);
tso1.setString("subtest message");
Map<String, String> map = new HashMap<>();
map.put("tk1", "tv1");
map.put("tk2", "tv2");
tso1.setMap(map);
TestSubObj tso2 = new TestSubObj();
tso2.setAnInt(39);
tso2.setString("subtest message--2");
Map<String, String> map2 = new HashMap<>();
map2.put("tk3", "tv3");
map2.put("tk4", "tv4");
tso2.setMap(map2);
List<TestSubObj> list = new ArrayList<>();
list.add(tso1);
list.add(tso2);
testObj.setList(list);
return testObj;
}
@Test
public void testBase() throws Exception {
Object[][] objects = new Object[][]{
new Object[]{true, false, false, true},
new Object[]{"jklejroie", "873420983", "oiueeeeeeeeeeeeejjjjjjjjjjjjio2e3nlkjiofjeoiwuoejroiweurwoeijrwoeiruwejrwoierjoweroiwu389f"},
new Object[]{(short) 12, (short) -17, Short.MAX_VALUE, Short.MIN_VALUE},
new Object[]{1223, -3467, 12, -15, -16, 46, Integer.MAX_VALUE, Integer.MIN_VALUE},
new Object[]{122343l, -7898l, -7l, -8l, 14l, 15l, Long.MAX_VALUE, Long.MIN_VALUE},
new Object[]{122.343f, -78.98f, Float.MAX_VALUE, Float.MIN_VALUE},
new Object[]{12342.343d, -34578.98d, Double.MAX_VALUE, Double.MIN_VALUE},
new Object[]{(byte) 'x', (byte) 28, Byte.MAX_VALUE, Byte.MIN_VALUE},
new Object[]{'x', 'd'},
new Object[]{"x89798df".getBytes(), "usiodjfe".getBytes()},
new Object[]{new String[]{"sdjfkljf", "n,mnzcv", "erueoiwr"}, new Integer[]{12, -13, 45, 7654, 5675}, new long[]{234l, -8l, 15l, 564l, 546435l}},
};
for (Object[] obj : objects) {
testBase(obj);
}
}
@Test
public void testMessage() throws Exception {
TestMsg testMsg = getDefaultTestMsg();
TestMsg testMsg1 = testSerialize(testMsg, TestMsg.class);
assertTrue(testMsg.equals(testMsg1));
assertArrayEquals(testMsg.getMyMap().get("1").getMyMap1().get("k2"), testMsg.getMyMap().get("1").getMyMap1().get("k2"));
// generic message
GenericMessage genericMessage = new GenericMessage();
genericMessage.putFields(1, "sjdjfierf");
genericMessage.putFields(2, 234);
genericMessage.putFields(6, true);
List<String> list = new ArrayList<>();
list.add("sdjfk");
list.add("ueiruw");
genericMessage.putFields(9, list);
Map<Integer, Float> map = new HashMap<>();
map.put(445, 6734.6456f);
map.put(2133, 89453.445f);
genericMessage.putFields(334344, map);
GenericMessage genericMessage2 = (GenericMessage) testSerialize(genericMessage, Object.class);
assertEquals(genericMessage.getFields(), genericMessage2.getFields());
}
@Test
public void testSerializer() throws Exception {
Breeze.getSerializerFactory().removeSerializer(TestObj.class.getName());
//test commonserializer
assertNull(Breeze.getSerializer(TestObj.class.getName()));
TestObj testObj = getDefaultTestObj();
TestObj testObj2 = testSerialize(testObj, TestObj.class);
assertEquals(testObj, testObj2);
assertNotNull(Breeze.getSerializer(TestObj.class.getName()));
Serializer serializer = Breeze.getSerializer(TestObj.class.getName());
assertTrue(serializer instanceof CommonSerializer);
//test enum serializer
assertNull(Breeze.getSerializer(TestEnum.class.getName()));
TestEnum testEnum = testSerialize(TestEnum.THREE, TestEnum.class);
assertEquals(testEnum.THREE, testEnum);
assertNotNull(Breeze.getSerializer(TestEnum.class.getName()));
// test custom serializer
Breeze.registerSerializer(new TestObjSerializer());
Breeze.registerSerializer(new TestSubObjSerializer());
serializer = Breeze.getSerializer(TestObj.class.getName());
assertTrue(serializer instanceof TestObjSerializer);
testObj2 = testSerialize(testObj, TestObj.class);
assertEquals(testObj, testObj2);
}
@Test
public void testRegisterSchema() throws BreezeException {
Schema testObjSchema = Schema.newSchema(TestObj.class.getName())
.putField(1, "subObj")
.putField(2, "integer")
.putField(3, "string")
.putField(4, "list");
CommonSerializer commonSerializer = new CommonSerializer(testObjSchema);
Breeze.registerSerializer(commonSerializer);
Schema testSubObjSchema = Schema.newSchema(TestSubObj.class.getName())
.putField(1, "anInt")
.putField(2, "string")
.putField(3, "map");
Breeze.registerSerializer(new CommonSerializer(testSubObjSchema));
assertNotNull(Breeze.getSerializer(TestObj.class.getName()));
assertTrue(commonSerializer == Breeze.getSerializer(TestObj.class.getName()));
TestObj testObj = getDefaultTestObj();
TestObj testObj2 = testSerialize(testObj, TestObj.class);
assertEquals(testObj, testObj2);
}
@Test(expected = BreezeException.class)
public void testCircularReference() throws BreezeException {
Map map = new HashMap<>();
List list = new ArrayList();
list.add(map);
map.put("1", list);
Breeze.setMaxWriteCount(0);
assertEquals(0, Breeze.getMaxWriteCount());
Breeze.setMaxWriteCount(3);
assertEquals(3, Breeze.getMaxWriteCount());
BreezeBuffer buf = new BreezeBuffer(128);
BreezeWriter.writeObject(buf, map);
throw new RuntimeException("should not here");
}
private void testBase(Object[] expects) throws BreezeException {
BreezeBuffer buf = new BreezeBuffer(64);
for (Object o : expects) {
BreezeWriter.writeObject(buf, o);
}
buf.flip();
BreezeBuffer newBuf = new BreezeBuffer(buf.getBytes());
for (Object o : expects) {
if (o.getClass() == byte[].class) {
byte[] bytes1 = (byte[]) o;
byte[] bytes2 = (byte[]) BreezeReader.readObject(newBuf, byte[].class);
assertArrayEquals(bytes1, bytes2);
} else if (o.getClass().isArray()) {
if (o.getClass().getComponentType().isPrimitive()) {
Object ro = BreezeReader.readObject(newBuf, o.getClass());
for (int i = 0; i < Array.getLength(o); i++) {
assertEquals(Array.get(o, i), Array.get(ro, i));
}
} else {
assertArrayEquals((Object[]) o, (Object[]) BreezeReader.readObject(newBuf, o.getClass()));
}
} else {
assertEquals(o, BreezeReader.readObject(newBuf, o.getClass()));
}
}
}
} | [
"[email protected]"
]
| |
f0bf4796fd55e4f973554f22e4254a5774dd73ad | 69edc451cdb4bf23de322c9d8335af39d583cc82 | /UVa/010925.java | e812baf60b01d5a7a6e4bbfe6066e80f2334c05d | []
| no_license | jesusmoraleda/competitive-programming | cbd90384641565b651ac2694f98f5d10870b83a9 | 97511d4fd00e90fe6676bfd134c0eb56be3c7580 | refs/heads/master | 2020-09-04T17:09:37.607768 | 2017-08-13T10:06:04 | 2017-08-13T10:06:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 661 | java | import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = 1;
while (true) {
int N = sc.nextInt();
BigInteger F = sc.nextBigInteger();
if (N == 0 && BigInteger.ZERO.equals(F)) break;
BigInteger S = BigInteger.ZERO;
for (int n = 0; n < N; n++)
S = S.add(sc.nextBigInteger());
System.out.println("Bill #" + t + " costs " + S + ": each friend should pay " + S.divide(F));
System.out.println();
t++;
}
}
}
| [
"[email protected]"
]
| |
cc40facaab4e93ea999e1c4c8b90cf8b20e1cfc4 | 822647817ef254115b65678f0d6aabbaa7235055 | /demos/flamingo-demo/src/main/java/org/pushingpixels/demo/flamingo/svg/filetypes/transcoded/ext_key.java | 3fe9581b7bc7210a2a5267d9c7d800c2ec8e4210 | [
"BSD-3-Clause"
]
| permissive | dyorgio/radiance | 3117646c4630046ee7ceac5374f8c67b769bbe3b | 6a525917ba37cb137afa06ca827675a8b01e0852 | refs/heads/master | 2020-04-27T09:18:08.465188 | 2019-03-11T13:13:39 | 2019-03-11T13:13:39 | 174,209,062 | 0 | 0 | BSD-3-Clause | 2019-03-06T19:40:49 | 2019-03-06T19:40:49 | null | UTF-8 | Java | false | false | 13,830 | java | package org.pushingpixels.demo.flamingo.svg.filetypes.transcoded;
import java.awt.*;
import java.awt.geom.*;
import javax.swing.plaf.UIResource;
import org.pushingpixels.neon.icon.ResizableIcon;
import org.pushingpixels.neon.icon.ResizableIconUIResource;
/**
* This class has been automatically generated using <a
* href="https://github.com/kirill-grouchnikov/radiance">Photon SVG transcoder</a>.
*/
public class ext_key implements ResizableIcon {
@SuppressWarnings("unused")
private void innerPaint(Graphics2D g) {
Shape shape = null;
Paint paint = null;
Stroke stroke = null;
float origAlpha = 1.0f;
Composite origComposite = g.getComposite();
if (origComposite instanceof AlphaComposite) {
AlphaComposite origAlphaComposite =
(AlphaComposite)origComposite;
if (origAlphaComposite.getRule() == AlphaComposite.SRC_OVER) {
origAlpha = origAlphaComposite.getAlpha();
}
}
AffineTransform defaultTransform_ = g.getTransform();
//
g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha));
AffineTransform defaultTransform__0 = g.getTransform();
g.transform(new AffineTransform(0.009999999776482582f, 0.0f, 0.0f, 0.009999999776482582f, 0.13999999687075615f, -0.0f));
// _0
g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha));
AffineTransform defaultTransform__0_0 = g.getTransform();
g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f));
// _0_0
paint = new LinearGradientPaint(new Point2D.Double(36.0, 97.0), new Point2D.Double(36.0, -1.0), new float[] {0.0f,0.139f,0.359f,0.617f,1.0f}, new Color[] {new Color(200, 212, 219, 255),new Color(216, 225, 230, 255),new Color(235, 240, 243, 255),new Color(249, 250, 251, 255),new Color(255, 255, 255, 255)}, MultipleGradientPaint.CycleMethod.NO_CYCLE, MultipleGradientPaint.ColorSpaceType.SRGB, new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 2.0f));
shape = new GeneralPath();
((GeneralPath)shape).moveTo(45.0, 1.0);
((GeneralPath)shape).lineTo(72.0, 27.7);
((GeneralPath)shape).lineTo(72.0, 99.0);
((GeneralPath)shape).lineTo(0.0, 99.0);
((GeneralPath)shape).lineTo(0.0, 1.0);
((GeneralPath)shape).lineTo(45.0, 1.0);
((GeneralPath)shape).closePath();
g.setPaint(paint);
g.fill(shape);
g.setTransform(defaultTransform__0_0);
g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha));
AffineTransform defaultTransform__0_1 = g.getTransform();
g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f));
// _0_1
paint = new Color(0, 0, 0, 0);
shape = new GeneralPath();
((GeneralPath)shape).moveTo(45.0, 1.0);
((GeneralPath)shape).lineTo(72.0, 27.7);
((GeneralPath)shape).lineTo(72.0, 99.0);
((GeneralPath)shape).lineTo(0.0, 99.0);
((GeneralPath)shape).lineTo(0.0, 1.0);
((GeneralPath)shape).lineTo(45.0, 1.0);
((GeneralPath)shape).closePath();
g.setPaint(paint);
g.fill(shape);
paint = new Color(113, 145, 161, 255);
stroke = new BasicStroke(2.0f,0,0,4.0f,null,0.0f);
shape = new GeneralPath();
((GeneralPath)shape).moveTo(45.0, 1.0);
((GeneralPath)shape).lineTo(72.0, 27.7);
((GeneralPath)shape).lineTo(72.0, 99.0);
((GeneralPath)shape).lineTo(0.0, 99.0);
((GeneralPath)shape).lineTo(0.0, 1.0);
((GeneralPath)shape).lineTo(45.0, 1.0);
((GeneralPath)shape).closePath();
g.setPaint(paint);
g.setStroke(stroke);
g.draw(shape);
g.setTransform(defaultTransform__0_1);
g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha));
AffineTransform defaultTransform__0_2 = g.getTransform();
g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f));
// _0_2
paint = new LinearGradientPaint(new Point2D.Double(45.0369987487793, 25.812999725341797), new Point2D.Double(58.5369987487793, 12.312999725341797), new float[] {0.0f,0.35f,0.532f,0.675f,0.799f,0.908f,1.0f}, new Color[] {new Color(255, 255, 255, 255),new Color(250, 251, 251, 255),new Color(237, 241, 244, 255),new Color(221, 229, 233, 255),new Color(199, 211, 218, 255),new Color(173, 189, 199, 255),new Color(146, 165, 176, 255)}, MultipleGradientPaint.CycleMethod.NO_CYCLE, MultipleGradientPaint.ColorSpaceType.SRGB, new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 2.0f));
shape = new GeneralPath();
((GeneralPath)shape).moveTo(45.0, 1.0);
((GeneralPath)shape).lineTo(72.0, 27.7);
((GeneralPath)shape).lineTo(45.0, 27.7);
((GeneralPath)shape).lineTo(45.0, 1.0);
((GeneralPath)shape).closePath();
g.setPaint(paint);
g.fill(shape);
g.setTransform(defaultTransform__0_2);
g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha));
AffineTransform defaultTransform__0_3 = g.getTransform();
g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f));
// _0_3
paint = new Color(0, 0, 0, 0);
shape = new GeneralPath();
((GeneralPath)shape).moveTo(45.0, 1.0);
((GeneralPath)shape).lineTo(72.0, 27.7);
((GeneralPath)shape).lineTo(45.0, 27.7);
((GeneralPath)shape).lineTo(45.0, 1.0);
((GeneralPath)shape).closePath();
g.setPaint(paint);
g.fill(shape);
paint = new Color(113, 145, 161, 255);
stroke = new BasicStroke(2.0f,0,2,4.0f,null,0.0f);
shape = new GeneralPath();
((GeneralPath)shape).moveTo(45.0, 1.0);
((GeneralPath)shape).lineTo(72.0, 27.7);
((GeneralPath)shape).lineTo(45.0, 27.7);
((GeneralPath)shape).lineTo(45.0, 1.0);
((GeneralPath)shape).closePath();
g.setPaint(paint);
g.setStroke(stroke);
g.draw(shape);
g.setTransform(defaultTransform__0_3);
g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha));
AffineTransform defaultTransform__0_4 = g.getTransform();
g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f));
// _0_4
paint = new Color(76, 108, 123, 255);
shape = new GeneralPath();
((GeneralPath)shape).moveTo(9.8, 91.9);
((GeneralPath)shape).lineTo(9.8, 71.9);
((GeneralPath)shape).lineTo(13.8, 71.9);
((GeneralPath)shape).lineTo(13.8, 80.8);
((GeneralPath)shape).lineTo(22.0, 71.9);
((GeneralPath)shape).lineTo(27.4, 71.9);
((GeneralPath)shape).lineTo(19.9, 79.700005);
((GeneralPath)shape).lineTo(27.9, 91.9);
((GeneralPath)shape).lineTo(22.7, 91.9);
((GeneralPath)shape).lineTo(17.2, 82.5);
((GeneralPath)shape).lineTo(13.900001, 85.8);
((GeneralPath)shape).lineTo(13.900001, 91.9);
((GeneralPath)shape).lineTo(9.8, 91.9);
((GeneralPath)shape).closePath();
((GeneralPath)shape).moveTo(30.0, 91.9);
((GeneralPath)shape).lineTo(30.0, 71.9);
((GeneralPath)shape).lineTo(44.9, 71.9);
((GeneralPath)shape).lineTo(44.9, 75.3);
((GeneralPath)shape).lineTo(34.0, 75.3);
((GeneralPath)shape).lineTo(34.0, 79.700005);
((GeneralPath)shape).lineTo(44.1, 79.700005);
((GeneralPath)shape).lineTo(44.1, 83.100006);
((GeneralPath)shape).lineTo(34.0, 83.100006);
((GeneralPath)shape).lineTo(34.0, 88.600006);
((GeneralPath)shape).lineTo(45.2, 88.600006);
((GeneralPath)shape).lineTo(45.2, 92.0);
((GeneralPath)shape).lineTo(30.0, 92.0);
((GeneralPath)shape).closePath();
((GeneralPath)shape).moveTo(53.9, 91.9);
((GeneralPath)shape).lineTo(53.9, 83.5);
((GeneralPath)shape).lineTo(46.600002, 71.9);
((GeneralPath)shape).lineTo(51.300003, 71.9);
((GeneralPath)shape).lineTo(56.000004, 79.8);
((GeneralPath)shape).lineTo(60.600002, 71.9);
((GeneralPath)shape).lineTo(65.3, 71.9);
((GeneralPath)shape).lineTo(57.9, 83.5);
((GeneralPath)shape).lineTo(57.9, 91.9);
((GeneralPath)shape).lineTo(53.9, 91.9);
((GeneralPath)shape).closePath();
g.setPaint(paint);
g.fill(shape);
g.setTransform(defaultTransform__0_4);
g.setComposite(AlphaComposite.getInstance(3, 0.9f * origAlpha));
AffineTransform defaultTransform__0_5 = g.getTransform();
g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, -952.3619995117188f));
// _0_5
g.setComposite(AlphaComposite.getInstance(3, 1.0f * origAlpha));
AffineTransform defaultTransform__0_5_0 = g.getTransform();
g.transform(new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f));
// _0_5_0
paint = new LinearGradientPaint(new Point2D.Double(35.444000244140625, 1014.3270263671875), new Point2D.Double(35.444000244140625, 975.551025390625), new float[] {0.0f,1.0f}, new Color[] {new Color(173, 204, 220, 255),new Color(76, 108, 123, 255)}, MultipleGradientPaint.CycleMethod.NO_CYCLE, MultipleGradientPaint.ColorSpaceType.SRGB, new AffineTransform(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f));
shape = new GeneralPath();
((GeneralPath)shape).moveTo(35.4, 978.9);
((GeneralPath)shape).curveTo(38.5, 982.0, 39.5, 986.4, 38.300003, 990.4);
((GeneralPath)shape).lineTo(54.800003, 1006.9);
((GeneralPath)shape).lineTo(55.200005, 1014.30005);
((GeneralPath)shape).lineTo(45.900005, 1013.50006);
((GeneralPath)shape).lineTo(45.900005, 1008.80005);
((GeneralPath)shape).lineTo(41.200005, 1008.80005);
((GeneralPath)shape).lineTo(41.200005, 1004.10004);
((GeneralPath)shape).lineTo(36.500004, 1004.10004);
((GeneralPath)shape).lineTo(30.500004, 998.10004);
((GeneralPath)shape).curveTo(26.600004, 999.30005, 22.100004, 998.30005, 19.000004, 995.2);
((GeneralPath)shape).curveTo(14.500004, 990.7, 14.500004, 983.4, 19.000004, 978.9);
((GeneralPath)shape).curveTo(23.600004, 974.4, 30.900003, 974.4, 35.4, 978.9);
((GeneralPath)shape).closePath();
((GeneralPath)shape).moveTo(26.800001, 982.0);
((GeneralPath)shape).curveTo(26.177185, 981.3759, 25.3317, 981.0252, 24.45, 981.0252);
((GeneralPath)shape).curveTo(23.568304, 981.0252, 22.722818, 981.3759, 22.100002, 982.0);
((GeneralPath)shape).curveTo(21.475904, 982.6228, 21.125183, 983.4683, 21.125183, 984.35);
((GeneralPath)shape).curveTo(21.125183, 985.2317, 21.475904, 986.0772, 22.100002, 986.7);
((GeneralPath)shape).curveTo(23.400002, 988.0, 25.500002, 988.0, 26.800003, 986.7);
((GeneralPath)shape).curveTo(28.100002, 985.4, 28.100002, 983.3, 26.800003, 982.0);
((GeneralPath)shape).closePath();
g.setPaint(paint);
g.fill(shape);
g.setTransform(defaultTransform__0_5_0);
g.setTransform(defaultTransform__0_5);
g.setTransform(defaultTransform__0);
g.setTransform(defaultTransform_);
}
/**
* Returns the X of the bounding box of the original SVG image.
*
* @return The X of the bounding box of the original SVG image.
*/
public static double getOrigX() {
return 0.12999999523162842;
}
/**
* Returns the Y of the bounding box of the original SVG image.
*
* @return The Y of the bounding box of the original SVG image.
*/
public static double getOrigY() {
return 0.0;
}
/**
* Returns the width of the bounding box of the original SVG image.
*
* @return The width of the bounding box of the original SVG image.
*/
public static double getOrigWidth() {
return 0.7400000095367432;
}
/**
* Returns the height of the bounding box of the original SVG image.
*
* @return The height of the bounding box of the original SVG image.
*/
public static double getOrigHeight() {
return 1.0;
}
/** The current width of this resizable icon. */
private int width;
/** The current height of this resizable icon. */
private int height;
/**
* Creates a new transcoded SVG image. This is marked as private to indicate that app
* code should be using the {@link #of(int, int)} method to obtain a pre-configured instance.
*/
private ext_key() {
this.width = (int) getOrigWidth();
this.height = (int) getOrigHeight();
}
@Override
public int getIconHeight() {
return height;
}
@Override
public int getIconWidth() {
return width;
}
@Override
public void setDimension(Dimension newDimension) {
this.width = newDimension.width;
this.height = newDimension.height;
}
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
Graphics2D g2d = (Graphics2D) g.create();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
g2d.translate(x, y);
double coef1 = (double) this.width / getOrigWidth();
double coef2 = (double) this.height / getOrigHeight();
double coef = Math.min(coef1, coef2);
g2d.clipRect(0, 0, this.width, this.height);
g2d.scale(coef, coef);
g2d.translate(-getOrigX(), -getOrigY());
if (coef1 != coef2) {
if (coef1 < coef2) {
int extraDy = (int) ((getOrigWidth() - getOrigHeight()) / 2.0);
g2d.translate(0, extraDy);
} else {
int extraDx = (int) ((getOrigHeight() - getOrigWidth()) / 2.0);
g2d.translate(extraDx, 0);
}
}
Graphics2D g2ForInner = (Graphics2D) g2d.create();
innerPaint(g2ForInner);
g2ForInner.dispose();
g2d.dispose();
}
/**
* Returns a new instance of this icon with specified dimensions.
*
* @param width Required width of the icon
* @param height Required height of the icon
* @return A new instance of this icon with specified dimensions.
*/
public static ResizableIcon of(int width, int height) {
ext_key base = new ext_key();
base.width = width;
base.height = height;
return base;
}
/**
* Returns a new {@link UIResource} instance of this icon with specified dimensions.
*
* @param width Required width of the icon
* @param height Required height of the icon
* @return A new {@link UIResource} instance of this icon with specified dimensions.
*/
public static ResizableIconUIResource uiResourceOf(int width, int height) {
ext_key base = new ext_key();
base.width = width;
base.height = height;
return new ResizableIconUIResource(base);
}
/**
* Returns a factory that returns instances of this icon on demand.
*
* @return Factory that returns instances of this icon on demand.
*/
public static Factory factory() {
return () -> new ext_key();
}
}
| [
"[email protected]"
]
| |
fe24d497b9cfbf64b4de7643252bab66ad96e3ac | 8621f87ca5b77c164cf5bcf78aa049b55f988b7e | /src/test/java/com/spring/city/connected/unit/CityConnectedTest.java | 42ec6d575ac559e2d70475688b1006a75de93bce | []
| no_license | palakjadav/SpringBoot_CityConnected | fe4d729aa3c0b0ff10d99ad12b7e1469642c4b74 | c96df35444ddbaf663aecc63e715ececf77a6632 | refs/heads/master | 2020-03-26T21:57:34.366392 | 2018-08-22T02:16:57 | 2018-08-22T02:16:57 | 145,421,132 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,429 | java | package com.spring.city.connected.unit;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import static org.junit.Assert.assertTrue;
import com.spring.city.connected.service.CityConnectedService;
public class CityConnectedTest {
@Autowired
CityConnectedService cityConnectedService;
@Test
public void connectedTrueTest(){
assertTrue("Yes".equals(cityConnectedService.connected("Boston", "Newark")));
assertTrue("Yes".equals(cityConnectedService.connected("Newark", "Boston")));
assertTrue("Yes".equals(cityConnectedService.connected("Boston", "Philadelphia")));
assertTrue("Yes".equals(cityConnectedService.connected("Philadelphia", "Boston")));
assertTrue("Yes".equals(cityConnectedService.connected("New York", "Newark")));
assertTrue("Yes".equals(cityConnectedService.connected("Newark", "New York")));
assertTrue("Yes".equals(cityConnectedService.connected("Boston", "New York")));
assertTrue("Yes".equals(cityConnectedService.connected("New York", "Boston")));
assertTrue("Yes".equals(cityConnectedService.connected("Newark", "Philadelphia")));
assertTrue("Yes".equals(cityConnectedService.connected("Philadelphia", "Newark")));
assertTrue("No".equals(cityConnectedService.connected("Philadelphia", "Albany")));
assertTrue("Yes".equals(cityConnectedService.connected("Albany", "Philadelphia")));
}
}
| [
"[email protected]"
]
| |
e55d8596996c29c9279595b5ba3a0fa873a79ce6 | b6e1e8d4c054d210ad40bf82c433c3a6bd174a49 | /src/main/java/kr/or/ddit/board/model/ComVo.java | ffd26c8107d825c31e1043f320f66b255d38ae6f | []
| no_license | jy2058/board | fe259442c5e38636f109a0ea6e3223508f710267 | 914ee19cf49693485435b152dc7b475b4002acd2 | refs/heads/master | 2020-04-23T00:24:21.220160 | 2019-02-28T09:41:51 | 2019-02-28T09:41:51 | 170,675,852 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,416 | java | package kr.or.ddit.board.model;
import java.util.Date;
public class ComVo {
private String com_num ; //댓글번호
private Date com_date ; //댓글작성일시
private String userId ; //댓글작성자
private String postNum ; //게시글번호
private String com_delinfo ; //삭제여부
private String com_contents; // 댓글내용
public String getCom_num() {
return com_num;
}
public void setCom_num(String com_num) {
this.com_num = com_num;
}
public Date getCom_date() {
return com_date;
}
public void setCom_date(Date com_date) {
this.com_date = com_date;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getPostNum() {
return postNum;
}
public void setPostNum(String postNum) {
this.postNum = postNum;
}
public String getCom_delinfo() {
return com_delinfo;
}
public void setCom_delinfo(String com_delinfo) {
this.com_delinfo = com_delinfo;
}
public String getCom_contents() {
return com_contents;
}
public void setCom_contents(String com_contents) {
this.com_contents = com_contents;
}
@Override
public String toString() {
return "ComVo [com_num=" + com_num + ", userId=" + userId
+ ", postNum=" + postNum + ", com_delinfo=" + com_delinfo
+ ", com_contents=" + com_contents + "]";
}
}
| [
"[email protected]"
]
| |
744f5f1ede7e42fd56bc1a1485ed48dd2a270f92 | 322eb034a673acde816dfc3d6cf6226bf1277ebc | /src/main/java/com/tumbleweed/test/base/iso8583/mac/ConvHelper.java | ecc81008a92dd080d256422123893a74898bebe0 | []
| no_license | wjp236/tumbleweed-test | 9ab9c24cf55ce12477f9f5b6d5a6daccbfe5d714 | 6a2d309998e522190d58a196b17e443c337fa7df | refs/heads/master | 2021-01-17T03:14:37.823359 | 2018-01-26T03:28:29 | 2018-01-26T03:28:29 | 50,014,433 | 1 | 2 | null | 2016-12-22T07:13:12 | 2016-01-20T08:01:05 | Java | UTF-8 | Java | false | false | 17,170 | java | package com.tumbleweed.test.base.iso8583.mac;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.lang3.StringUtils;
import java.io.UnsupportedEncodingException;
import java.security.InvalidParameterException;
/**
* Copyright (C),1998 -- 2006 Hisuntech Co..Ld
*
* HiConvHelper.java 2006-10-20
*
*/
public class ConvHelper {
private final static char[] mChars = "0123456789ABCDEF".toCharArray();
/**
* 把二进制格式转为十进制整数
*
* @param bin
* 二进制形式的字符串,eg: "10101010"
* @return 十进制整数
*/
public static int binary2Int(String bin) {
return Integer.valueOf(bin, 2).intValue();
}
/**
* 把十进制整数转化为二进制格式
*
* @param val
* @return 二进制形式的字符串,eg: "10101010"
*/
public static String int2Binary(int val) {
return Integer.toBinaryString(val);
}
/**
* 把十六进制整数转化为二进制格式
*
* @param val
* @return 二进制形式的字符串,eg: "10101010"
*/
public static String hex2Binary(String val) throws Exception {
StringBuffer ret = new StringBuffer();
for (int i = 0; i < val.length(); i++) {
ret.append(hex2binary(val.charAt(i)));
}
return ret.toString();
}
public static String hex2binary(char hex) throws Exception {
switch (hex) {
case '0':
return "0000";
case '1':
return "0001";
case '2':
return "0010";
case '3':
return "0011";
case '4':
return "0100";
case '5':
return "0101";
case '6':
return "0110";
case '7':
return "0111";
case '8':
return "1000";
case '9':
return "1001";
case 'a':
case 'A':
return "1010";
case 'b':
case 'B':
return "1011";
case 'c':
case 'C':
return "1100";
case 'd':
case 'D':
return "1101";
case 'e':
case 'E':
return "1110";
case 'f':
case 'F':
return "1111";
default:
throw new Exception("非法字符");
}
}
/**
* 将一串二进制转为十六进制
*
* @param binary
* @return
*/
public static String binary2hex(String binary) {
String hexString = "";
int binLen = binary.length();
if (binLen % 4 != 0) {
binary = StringUtils.repeat("0", 4 - binLen % 4) + binary;
binLen = binary.length();
}
for (int i = 0; i < binLen; i = i + 4) {
hexString += Integer.toHexString(Integer.valueOf(
binary.substring(i, i + 4), 2).intValue());
}
return hexString;
}
public static String byte2String(byte val) throws Exception {
byte[] arrVal = { val };
return byte2String(arrVal, "ISO-8859-1");
}
public static String byte2String(byte[] val, String charset)
throws Exception {
return new String(val, charset);
}
/**
* bin转为对应的Ascii 形式.
*
* @param binStr
* @return
*/
public static String binToAscStr(String binStr) throws Exception {
/**
* byte[] chrBytes = binStr.getBytes(); return
* String.valueOf(byte2uint(chrBytes, 0));
*/
return binToAscStr(binStr.getBytes());
}
/**
* bin转为对应的Ascii 形式.
*
* @param binBuf
* @return
*/
public static String binToAscStr(byte[] binBuf) {
long ascVal = 0;
for (int i = 0; i < binBuf.length; i++) {
ascVal = (ascVal << 8) + (long) (binBuf[i] & 0xff);
}
return String.valueOf(ascVal);
}
/**
* 将一个ASCII值转为对应的字符
*
* @param strAsc
* ASCII值
* @return 字符
*/
public static String asc2bin(String strAsc) throws Exception {
Integer deliInt = Integer.valueOf(strAsc);
byte[] asc = { deliInt.byteValue() };
return new String(asc, "ISO-8859-1");
}
/**
* public static byte asc2bin(String strAsc) throws BaseException { try {
* return Integer.valueOf(strAsc).byteValue(); } catch(NumberFormatException
* e) { // TODO log asc error throw new
* BaseException("","asc2bin执行出错, 一个ASCII值 + [" + strAsc+
* "],转为对应的字符时失败.",e); } }
*/
public static String asc2bin(int intAsc) throws Exception {
byte[] aryAsc = new byte[4];
int2byte(aryAsc, 0, intAsc);
/**
* String retStr = ""; boolean start = true; for (int i = 0; i < 4; i++)
* { if (aryAsc[i] == 0x00 && start) { continue; } start = false; retStr
* += (char)aryAsc[i]; }
**/
// return new String(aryAsc);
return byte2String(aryAsc, "ISO-8859-1");
}
/**
* 将ascii串转为对应的bin; binLen限制转换后的宽度, 若binLen为0,则不限制宽度;若超过,则抛异常,否则前置加0x00
*
* @param intAsc
* @param binLen
* @return
*/
public static String asc2bin(int intAsc, int binLen) throws Exception {
byte[] aryAsc = new byte[4];
int2byte(aryAsc, 0, intAsc);
String retStr = "";
boolean start = true;
for (int i = 0; i < 4; i++) {
if (aryAsc[i] == 0x00 && start) {
continue;
}
start = false;
retStr += (char) aryAsc[i];
}
if (retStr.length() < binLen) {
char fill_asc = (byte) 0x00;
String fill_str = String.valueOf(fill_asc);
retStr = StringUtils.repeat(fill_str, binLen - retStr.length())
+ retStr;
} else if (retStr.length() > binLen) {
throw new Exception("error");
}
return retStr;
}
// --------------------------------------------------------------------
// bcd ascii convHelper
public static String bcd2AscStr(byte[] bytes) {
return ascii2Str(bcd2Ascii(bytes));
}
public static byte[] ascStr2Bcd(String s) {
return ascii2Bcd(str2Ascii(s));
}
final static char[] ascii = "0123456789ABCDEF".toCharArray();
public static byte[] bcd2Ascii(byte[] bytes) {
byte[] temp = new byte[bytes.length * 2];
for (int i = 0; i < bytes.length; i++) {
temp[i * 2] = (byte) ((bytes[i] >> 4) & 0x0f);
temp[i * 2 + 1] = (byte) (bytes[i] & 0x0f);
}
return temp;
}
public static byte[] str2Ascii(String s) {
byte[] str = s.toUpperCase().getBytes();
byte[] ascii = new byte[str.length];
for (int i = 0; i < ascii.length; i++) {
ascii[i] = (byte) asciiValue(str[i]);
}
return ascii;
}
public static String ascii2Str(byte[] ascii) {
StringBuffer res = new StringBuffer();
for (int i = 0; i < ascii.length; i++) {
res.append(strValue(ascii[i]));
}
return res.toString();
}
private static char strValue(byte asc) {
if (asc < 0 || asc > 15)
throw new InvalidParameterException();
return ascii[asc];
}
public static byte[] ascii2Bcd(byte[] asc) {
int len = asc.length / 2;
byte[] bcd = new byte[len];
for (int i = 0; i < len; i++) {
bcd[i] = (byte) ((asc[2 * i] << 4) | asc[2 * i + 1]);
}
return bcd;
}
private static int asciiValue(byte b) {
if ((b >= '0') && (b <= '9')) {
return (b - '0');
}
if ((b >= 'a') && (b <= 'f')) {
return (b - 'a') + 0x0a;
}
if ((b >= 'A') && (b <= 'F')) {
return (b - 'A') + 0x0a;
}
throw new InvalidParameterException();
}
public static void printByte(byte[] b) {
for (int i = 0; i < b.length; i++) {
System.out.print(b[i] + " ");
}
System.out.println();
}
// ---------------------------------------------------------------------
/**
* Converts two bytes into a short.
*
* Note: 字节数组bp,长度必须不能大于index+2
*
* The short should be interpreted as an unsigned short and if you want to
* add it to an int then do something like the code fragment below.
*
* <PRE>
* int sum = 0;
* sum += byte2short(buf, index) & 0xffff;
* </PRE>
*/
public static short byte2short(byte[] bp, int index) {
return (short) (((bp[index] & 0xff) << 8) + (bp[index + 1] & 0xff));
}
/**
* Converts four bytes into an int.
*
* Note: 字节数组bp的长度必须不能大于index+4
*/
public static int byte2int(byte[] bp, int index) {
return (int) (((bp[index] & 0xff) << 24)
+ ((bp[index + 1] & 0xff) << 16)
+ ((bp[index + 2] & 0xff) << 8) + ((bp[index + 3] & 0xff)));
}
/**
* Convert short into two bytes in buffer.
**/
public static void short2byte(byte[] bp, int index, short value) {
bp[index] = (byte) ((value >> 8) & 0xff);
bp[index + 1] = (byte) (value & 0xff);
}
/**
* Convert int into four bytes in buffer.
**/
public static void int2byte(byte[] bp, int index, int value) {
bp[index] = (byte) ((value >> 24) & 0xff);
bp[index + 1] = (byte) ((value >> 16) & 0xff);
bp[index + 2] = (byte) ((value >> 8) & 0xff);
bp[index + 3] = (byte) (value & 0xff);
}
/**
* Convert an integer to an unsigned integer, represented by a long type.
**/
public static long int2uint(int x) {
return ((((long) x) << 32) >>> 32);
}
/**
* Convert an integer to an unsigned integer, represented by a long type.
**/
public static long byte2uint(byte[] x, int offs) {
long z = 0;
for (int i = 0; i < 4; i++) {
z = (z << 8) + (long) (x[offs + i] & 0xff);
}
return z;
}
/**
* Convert an array of two long integers to an byte array
**/
public static byte[] uint2byte(long[] x) {
byte[] res = new byte[8];
int2byte(res, 0, (int) (x[0]));
int2byte(res, 4, (int) (x[1]));
return res;
}
/**
* Convert an array of a long integer to an byte array
**/
public static byte[] long2byte(long x) {
byte[] res = new byte[8];
int2byte(res, 0, (int) ((x >> 32) & 0xffffffff));
int2byte(res, 4, (int) (x & 0xffffffff));
return res;
}
public static long byte2long(byte[] msg, int offs) {
long high = byte2uint(msg, offs);
offs += 4;
long low = byte2uint(msg, offs);
offs += 4;
long ans = (high << 32) + low;
return ans;
}
/*
* Make printable form for boolean array
*/
public static String boolean2String(boolean[] ba) {
StringBuffer strb = new StringBuffer();
int cnt = 0;
if (ba == null || ba.length == 0) {
return "(none)";
}
for (int i = 0; i < ba.length; i++) {
if (ba[i]) {
if (cnt++ != 0) {
strb.append("+");
}
strb.append(i);
}
}
return strb.toString();
}
public static String convFlags(String equiv, byte flags) {
char chs[] = new char[8];
StringBuffer strb = new StringBuffer(" ");
int bit, i;
if (equiv.length() > 8) {
return (">8?");
}
equiv.getChars(0, equiv.length(), chs, 0);
for (bit = 0x80, i = 0; bit != 0; bit >>= 1, i++) {
if ((flags & bit) != 0) {
strb.setCharAt(0, '*');
strb.append(chs[i]);
}
}
return strb.toString();
}
public static String timer2string(long time) {
String timeString = null;
long msec = time % 1000;
String ms = String.valueOf(msec);
ms = fill(ms, 3, "0");
long rem = time / 1000; // in seconds
int xsec = (int) (rem % 60);
rem = (int) ((rem - xsec) / 60); // in minutes
int xmin = (int) (rem % 60);
rem = (int) ((rem - xmin) / 60); // in hours
int xhour = (int) (rem % 24);
int xday = (int) ((rem - xhour) / 24);
String sday = String.valueOf(xday);
String shour = String.valueOf(xhour);
shour = fill(shour, 2, "0");
String smin = String.valueOf(xmin);
smin = fill(smin, 2, "0");
String ssec = String.valueOf(xsec);
ssec = fill(ssec, 2, "0");
timeString = sday + " days, " + shour + ":" + smin + ":" + ssec + "."
+ ms;
return timeString;
}
private static String fill(String str, int sz, String cfill) {
while (str.length() < sz) {
str = cfill + str;
}
return str;
}
/**
* decode Asc to bcd
*
* @param bytes
* @return
*/
public static byte[] ascByte2Bcd(byte[] bytes) throws Exception {
Hex hex = new Hex();
try {
bytes = hex.decode(bytes);
hex = null;
} catch (DecoderException e) {
}
return bytes;
}
/**
* encode bcd to Asc
*
* @param bytes
* @return
*/
public static byte[] bcd2AscByte(byte[] bytes) {
Hex hex = new Hex();
bytes = hex.encode(bytes);
hex = null;
return bytes;
}
// ---------------------------------------------------------------------
/**
* Converte uma string preenchida com dgitos hexadecimais em um array de
* bytes. Cada byte do array corresponder a dois dgitos da String, desta
* forma, a String dever conter um nmero par de dgitos. Exemplo: a String
* "FFA3" ser convertida no array de bytes { 0xFF, 0xA3 }.
*
* @param hexa
* a string com os dgitos hexadecimais.
*
* @return O array de bytes correspondente aos dgitos na string.
*
*/
public static byte[] hexToByteArray(String hexa) {
if (hexa == null) {
return null;
}
if ((hexa.length() % 2) != 0) {
return null;
}
int tamArray = hexa.length() / 2;
byte[] retorno = new byte[tamArray];
for (int i = 0; i < tamArray; i++) {
retorno[i] = hexToByte(hexa.substring(i * 2, i * 2 + 2));
}
return retorno;
}
/**
* Converte uma string preenchida com dgitos hexadecimais em um array de
* bytes. Cada byte do array corresponder a dois dgitos da String, desta
* forma, a String dever conter um nmero par de dgitos. Exemplo: a String
* "FFA3" ser convertida no array de bytes { 0xFF, 0xA3 }.
*
* @param hexa
* a string com os dgitos hexadecimais.
*
* @return O array de bytes correspondente aos dgitos na string.
*/
public static byte hexToByte(String hexa) {
if (hexa == null) {
return 0;
}
if (hexa.length() != 2) {
return 0;
}
byte[] b = hexa.getBytes();
byte valor = (byte) (hexDigitValue((char) b[0]) * 16 + hexDigitValue((char) b[1]));
return valor;
}
/**
* Retorna o valor decimal de um dgito hexadecimal.
*
* @param c
* o dgito hexadecimal ('0'-'9', 'a'-'f' ou 'A'-'F').
*
* @return o valor do dgito hexadecimal.
*
*/
private static int hexDigitValue(char c) {
int retorno = 0;
if (c >= '0' && c <= '9') {
retorno = (int) (((byte) c) - 48);
} else if (c >= 'A' && c <= 'F') {
retorno = (int) (((byte) c) - 55);
} else if (c >= 'a' && c <= 'f') {
retorno = (int) (((byte) c) - 87);
} else {
return 0;
}
return retorno;
}
public static String show(byte[] b) {
char[] ch = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A',
'B', 'C', 'D', 'E', 'F' };
java.io.StringWriter stream = new java.io.StringWriter();
int len = b.length;
for (int i = 0; i < len; i++) {
byte c = (byte) ((b[i] & 0xf0) >> 4);
stream.write(ch[c]);
c = (byte) (b[i] & 0x0f);
stream.write(ch[c]);
}
return stream.toString();
}
/**
* @Description: 将byte数组转为String
* @param: @param bytes
* @param: @return
* @return: String
* @throws
*/
public static String byteArrayToHex(byte[] bytes) {
String retorno = "";
if (bytes == null || bytes.length == 0) {
return retorno;
}
for (int i = 0; i < bytes.length; i++) {
byte valor = bytes[i];
int d1 = valor & 0xF;
d1 += (d1 < 10) ? 48 : 55;
int d2 = (valor & 0xF0) >> 4;
d2 += (d2 < 10) ? 48 : 55;
retorno = retorno + (char) d2 + (char) d1;
}
return retorno;
}
/**
* @函数功能: BCD码串转化为字符串
* @输入参数: BCD码
* @输出结果: 10进制串
*/
public static String bcd2Str(byte[] bytes) {
char temp[] = new char[bytes.length * 2], val;
for (int i = 0; i < bytes.length; i++) {
val = (char) (((bytes[i] & 0xf0) >> 4) & 0x0f);
temp[i * 2] = (char) (val > 9 ? val + 'A' - 10 : val + '0');
val = (char) (bytes[i] & 0x0f);
temp[i * 2 + 1] = (char) (val > 9 ? val + 'A' - 10 : val + '0');
}
return new String(temp);
}
/**
* 左补零
*
* @param source 源字符串
* @param width 补位长度
*
* @return 补位后字符串
* */
public static String AddLetfZero(String source, int width) {
if (source.length() >= width) {
return source;
}
char[] zero = new char[width - source.length()];
for (int i = 0; i < zero.length; ++i) {
zero[i] = '0';
}
String stemp = new String(zero) + source;
return stemp;
}
/**
* 右补空格
*
* @param source 源字符串
* @param width 补位长度
*
* @return 补位后字符串
* */
public static String AddRightBlank(String source, int width) {
if (source.length() == width)
return source;
if (source.length() > width)
return source.substring(source.length() - width);
char[] blank = new char[width - source.length()];
for (int i = 0; i < blank.length; i++) {
blank[i] = (char) 0x20;
}
String stemp = source + new String(blank);
return stemp;
}
/**
* str to hex
*
* @param str
* @return
* @throws UnsupportedEncodingException
*/
public static String str2HexStr(String str) {
StringBuilder sb = new StringBuilder();
byte[] bs = str.getBytes();
for (int i = 0; i < bs.length; i++) {
sb.append(mChars[(bs[i] & 0xFF) >> 4]);
sb.append(mChars[bs[i] & 0x0F]);
}
return sb.toString().trim();
}
/**
* byte to hex
*
* @param bs
* @return
* @throws UnsupportedEncodingException
*/
public static String str2HexStr(byte[] bs) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < bs.length; i++) {
sb.append(mChars[(bs[i] & 0xFF) >> 4]);
sb.append(mChars[bs[i] & 0x0F]);
}
return sb.toString().trim();
}
public static String HEX2STR(String args) {
try {
args = new String(Hex.decodeHex(args.toCharArray()));
} catch (DecoderException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return args;
}
}
| [
"[email protected]"
]
| |
2c2b59eece657171d5bcb810b4bdec6fb2bf7ab9 | 23d7aecb8f2ce8055e73187801b8a19fd5500595 | /src/com/company/lab24/Client.java | 81e05d66802bba2f8994522193e3a35c2655a54c | []
| no_license | xenoxenia/java-patterns | 38022c683b36f4d6eb107f88075ae3f6be87e487 | eccaf6baae5cafcc8630611296ba99eadf751ff5 | refs/heads/master | 2023-04-20T07:36:35.821555 | 2021-05-07T22:39:58 | 2021-05-07T22:39:58 | 340,058,621 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 239 | java | package com.company.lab24;
public class Client {
private Chair chair;
public void sit() {
System.out.println("Сидит на " + chair);
}
public void setChair(Chair chair) {
this.chair = chair;
}
}
| [
"[email protected]"
]
| |
735a80cc967ca341ffb40cbf6d840c72d89da2c0 | 5ee5f8df8b1ef1b06957db7850c53e2bbdd832e2 | /app/src/main/java/com/example/plpp/SharedPrefManager1.java | c19e1a25ff280bcfccfe288055b15248956ba900 | []
| no_license | aishiteru98/febri | 99e878523c822a86dd183a3b1b3b9b8304c31711 | eef87ed1b05093ca0688d114219e3ee9b33004cc | refs/heads/master | 2023-03-10T08:59:43.305591 | 2021-02-19T07:42:22 | 2021-02-19T07:42:22 | 340,289,638 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,542 | java | package com.example.plpp;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
public class SharedPrefManager1 {
private static final String TAG_TOKEN = "tagtoken";
private static SharedPrefManager1 mInstance;
private static Context mCtx;
private static final String SHARED_PREF_NAME1 = "darmajayaa";
private static final String KEY_Nama = "keyusername";
private static final String KEY_npm = "keynpm";
private static final String KEY_ID = "keyid";
private static final String KEY_token = "keytoken";
private static final String KEY_PW = "keyPassword";
private SharedPrefManager1(Context context) {
mCtx = context;
}
public static synchronized SharedPrefManager1 getInstance(Context context) {
if (mInstance == null) {
mInstance = new SharedPrefManager1(context);
}
return mInstance;
}
//this method will save the device token to shared preferences
public void userLogin1(user2 User1) {
SharedPreferences sharedPreferences = mCtx.getSharedPreferences(SHARED_PREF_NAME1, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putInt(KEY_ID, User1.getId());
editor.putString(KEY_Nama, User1.getNama());
editor.putString(KEY_npm, User1.getnpm());
editor.apply();
}
//this method will checker whether user is already logged in or not
public boolean isLoggedIn() {
SharedPreferences sharedPreferences = mCtx.getSharedPreferences(SHARED_PREF_NAME1, Context.MODE_PRIVATE);
return sharedPreferences.getString(KEY_Nama, null) != null;
}
//this method will give the logged in user
public user2 getUser1() {
SharedPreferences sharedPreferences = mCtx.getSharedPreferences(SHARED_PREF_NAME1, Context.MODE_PRIVATE);
return new user2(
sharedPreferences.getInt(KEY_ID, 1),
sharedPreferences.getString(KEY_Nama, null),
sharedPreferences.getString(KEY_npm, null),
sharedPreferences.getString(KEY_PW, null)
);
}
//this method will logout the user
public void logout() {
SharedPreferences sharedPreferences = mCtx.getSharedPreferences(SHARED_PREF_NAME1, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.clear();
editor.apply();
mCtx.startActivity(new Intent(mCtx, awal.class));
}
}
| [
"[email protected]"
]
| |
313cc09c008aad165d5b543471dd5b534022124e | 6bd3dd58d70b76e415ca53ee91d28abd6fd10884 | /myordy-service/src/main/java/jrange/myordy/entity/OrdyStatus.java | 48eec854984cf59a458a9e9705bd9a299d84245c | []
| no_license | myordy/myordy | 65057e62114c45365c23537089998bc97153a768 | 1c5c317c71717751fdce760da89a795da043bc5c | refs/heads/master | 2021-07-21T11:58:53.214740 | 2017-11-01T08:27:56 | 2017-11-01T08:27:56 | 108,109,629 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 154 | java | package jrange.myordy.entity;
public enum OrdyStatus {
DRAFT, NEWORDY, CONFIRMED, IN_PROGRESS, READY_FOR_DELIVERY, PICKED_UP_FOR_DELIVERY, DELIVERED
}
| [
"[email protected]"
]
| |
35ba5949aaeb0bc9a703f95ceae8a5f464689b39 | 6cd22ce8aadd4d58af83db29c15946baf1ffebf8 | /src/main/java/com/shubham/algorithms/problems/ExpressionAddOperators.java | c155f2bf1b162d5ae3ad8590ab34e4b58ae684b4 | []
| no_license | shubhm-agrwl/dataStructures-algorithms | b095ab3a297f565c27fdb12af5d8c468384ef09d | 726631159746d79a54e72a19c8cccd49e64fc821 | refs/heads/master | 2021-06-23T09:28:51.828025 | 2021-06-15T23:04:53 | 2021-06-15T23:04:53 | 225,211,919 | 1 | 0 | null | 2020-10-13T17:53:17 | 2019-12-01T18:53:23 | Java | UTF-8 | Java | false | false | 2,349 | java | package com.shubham.algorithms.problems;
import java.util.ArrayList;
import java.util.List;
public class ExpressionAddOperators {
public ArrayList<String> answer;
public String digits;
public long target;
public void recurse(
int index, long previousOperand, long currentOperand, long value, ArrayList<String> ops) {
String nums = this.digits;
// Done processing all the digits in num
if (index == nums.length()) {
// If the final value == target expected AND
// no operand is left unprocessed
if (value == this.target && currentOperand == 0) {
StringBuilder sb = new StringBuilder();
ops.subList(1, ops.size()).forEach(v -> sb.append(v));
this.answer.add(sb.toString());
}
return;
}
// Extending the current operand by one digit
currentOperand = currentOperand * 10 + Character.getNumericValue(nums.charAt(index));
String current_val_rep = Long.toString(currentOperand);
int length = nums.length();
// To avoid cases where we have 1 + 05 or 1 * 05 since 05 won't be a
// valid operand. Hence this check
if (currentOperand > 0) {
// NO OP recursion
recurse(index + 1, previousOperand, currentOperand, value, ops);
}
// ADDITION
ops.add("+");
ops.add(current_val_rep);
recurse(index + 1, currentOperand, 0, value + currentOperand, ops);
ops.remove(ops.size() - 1);
ops.remove(ops.size() - 1);
if (ops.size() > 0) {
// SUBTRACTION
ops.add("-");
ops.add(current_val_rep);
recurse(index + 1, -currentOperand, 0, value - currentOperand, ops);
ops.remove(ops.size() - 1);
ops.remove(ops.size() - 1);
// MULTIPLICATION
ops.add("*");
ops.add(current_val_rep);
recurse(
index + 1,
currentOperand * previousOperand,
0,
value - previousOperand + (currentOperand * previousOperand),
ops);
ops.remove(ops.size() - 1);
ops.remove(ops.size() - 1);
}
}
public List<String> addOperators(String num, int target) {
if (num.length() == 0) {
return new ArrayList<String>();
}
this.target = target;
this.digits = num;
this.answer = new ArrayList<String>();
this.recurse(0, 0, 0, 0, new ArrayList<String>());
return this.answer;
}
}
| [
"[email protected]"
]
| |
08f257a75348caf4118a8e1f365899cf6395412d | 7ade5ea1c9d7c49c518cfc0e045bfd50a383f026 | /src/test/java/ProverTests.java | bb0571c5f51ab05f77d46cfc946ed32817fb7b78 | []
| no_license | stan-roelofs/masterproject | 8eb1b73c7f6770068f920fbeb4377b28077e731b | e1dc923bd9010144ddc4797b61de002df903d7ab | refs/heads/master | 2020-04-21T12:28:20.379889 | 2019-10-07T13:35:09 | 2019-10-07T13:35:09 | 169,563,226 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,938 | java | import core.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class ProverTests {
public void testInduction() {
Sort nat = new Sort("nat");
Function zero = new Function(nat, "0");
List<Sort> inputs = new ArrayList<>();
inputs.add(nat);
Function successor = new Function(nat, inputs, "s");
Set<Function> C = new HashSet<>();
C.add(zero);
C.add(successor);
Set<Function> Sigma = new HashSet<>(C);
inputs.add(nat);
Function plus = new Function(nat, inputs, "+");
Sigma.add(plus);
List<Term> subterms = new ArrayList<>();
subterms.add(new FunctionTerm(zero));
Variable var = new Variable(nat, "x");
subterms.add(var);
FunctionTerm left = new FunctionTerm(plus, subterms);
Equation eq1 = new Equation(left, var);
subterms.clear();
subterms.add(var);
Term t = new FunctionTerm(successor, subterms);
subterms.clear();
subterms.add(t);
Variable var2 = new Variable(nat, "y");
subterms.add(var2);
FunctionTerm l = new FunctionTerm(plus, subterms);
subterms.clear();
subterms.add(var);
subterms.add(var2);
Term tt = new FunctionTerm(plus, subterms);
subterms.clear();
subterms.add(tt);
FunctionTerm r = new FunctionTerm(successor, subterms);
Equation eq2 = new Equation(l, r);
Set<Equation> eqs = new HashSet<>();
eqs.add(eq1);
eqs.add(eq2);
subterms.clear();
subterms.add(var);
subterms.add(new FunctionTerm(zero));
FunctionTerm hoi = new FunctionTerm(plus, subterms);
Equation goal = new Equation(hoi, var);
EquationSystem lol = new EquationSystem(eqs, Sigma, C, goal);
//core.Prover.induction(lol, writer);
}
}
| [
"[email protected]"
]
| |
3183e009edc1f56dda35838d6150ed0040ee3d4c | f2f0c6e0a24f41c9a891b3c9c0efc57e8f09b687 | /eboleta2/src/main/java/com/workants/eboleta2/ui/view/ViewRegistroCuit/ViewRegistroCuitCuerpo.java | 9a3a138f57de37f9bd14598c86c74f7b00ec8402 | []
| no_license | crddigital/eboleta2 | 31dbd2464bbf66b0103faeb71df371f333ad7dbb | 13a6a7047bc73102c3c96010a12ae2647be7cf7c | refs/heads/master | 2021-06-29T15:41:15.399189 | 2019-10-30T13:14:54 | 2019-10-30T13:14:54 | 218,530,094 | 0 | 0 | null | 2021-04-19T14:52:42 | 2019-10-30T13:09:17 | Java | UTF-8 | Java | false | false | 322 | java | package com.workants.eboleta2.ui.view.ViewRegistroCuit;
import com.vaadin.ui.VerticalLayout;
public class ViewRegistroCuitCuerpo extends VerticalLayout{
/**
*
*/
private static final long serialVersionUID = 1L;
public ViewRegistroCuitCuerpo() {
// TODO Auto-generated constructor stub
}
}
| [
"[email protected]"
]
| |
da6106768bf8eddf114a3c6159deeeb73ea4703a | 0d64f4b938ae9d8460f928e59274313faa861607 | /src/main/java/com/co2nsensus/co2mission/model/response/earnings/MonthlyEarningsModel.java | 3babc1b542146ef8f297de709d45535e92ff0cbc | [
"MIT"
]
| permissive | Tuyji/co2misson-api | 6b3c3aea2bff3f9d4eec1eac26adbdd807945205 | 2fe2c16dbc5900b7cd5a0faa35b22aa5aa246ddf | refs/heads/main | 2023-08-22T11:42:57.342732 | 2021-10-07T22:39:09 | 2021-10-07T22:39:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 502 | java | package com.co2nsensus.co2mission.model.response.earnings;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import com.co2nsensus.co2mission.model.response.MonthlyStatusModel;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class MonthlyEarningsModel {
private MonthlyStatusModel status;
private BigDecimal totalSales;
private BigDecimal earnings;
private String month;
private int year;
}
| [
"[email protected]"
]
| |
e1bb4abd337c3370a58415bbd3c67fcc90759c47 | 98613747055b7259b10396db5598886f4b643697 | /org/bouncycastle/asn1/BERTags.java | 6ecc3a6c569a6a94d69e56a1d864a7dd425f9f8c | []
| no_license | welljsjs/jap_source | 951104e2de49498cecf3029066e139658647a7b4 | 502ace868c62ed0ead9fd798f1bfe7bbdcdfeb82 | refs/heads/master | 2023-03-20T21:46:03.715948 | 2021-03-12T11:04:30 | 2021-03-12T11:13:52 | 347,038,436 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,372 | java | /*
* Decompiled with CFR 0.150.
*/
package org.bouncycastle.asn1;
public interface BERTags {
public static final int BOOLEAN = 1;
public static final int INTEGER = 2;
public static final int BIT_STRING = 3;
public static final int OCTET_STRING = 4;
public static final int NULL = 5;
public static final int OBJECT_IDENTIFIER = 6;
public static final int EXTERNAL = 8;
public static final int ENUMERATED = 10;
public static final int SEQUENCE = 16;
public static final int SEQUENCE_OF = 16;
public static final int SET = 17;
public static final int SET_OF = 17;
public static final int NUMERIC_STRING = 18;
public static final int PRINTABLE_STRING = 19;
public static final int T61_STRING = 20;
public static final int VIDEOTEX_STRING = 21;
public static final int IA5_STRING = 22;
public static final int UTC_TIME = 23;
public static final int GENERALIZED_TIME = 24;
public static final int GRAPHIC_STRING = 25;
public static final int VISIBLE_STRING = 26;
public static final int GENERAL_STRING = 27;
public static final int UNIVERSAL_STRING = 28;
public static final int BMP_STRING = 30;
public static final int UTF8_STRING = 12;
public static final int CONSTRUCTED = 32;
public static final int APPLICATION = 64;
public static final int TAGGED = 128;
}
| [
"[email protected]"
]
| |
b2d680902d980f7c06580188e13c1358b3651370 | 487836cc286b2ff064d498e7af3ec6a99fddcd58 | /src/main/java/com/skysoft/services/IEquipoService.java | 3568504998ed9deb211435d2366b81af0aceee49 | []
| no_license | gplnet/suminstrosBackend | 553513bfb3320c09c5ed417e7c4eeb4b8bba4853 | 04ab19d2ca244268c4bf9cf56e45b675b0eb7b5a | refs/heads/master | 2020-12-31T11:08:04.428090 | 2020-03-04T03:31:17 | 2020-03-04T03:31:17 | 239,012,601 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 422 | java | package com.skysoft.services;
import java.util.List;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import com.skysoft.model.Equipo;
public interface IEquipoService {
int registrar(Equipo equipo);
int modificar(Equipo equipo);
void eliminar(Integer Eqp_Ide);
Equipo listarId(int Eqp_Ide);
List<Equipo>listar();
Page<Equipo> listAllByPage(Pageable pageable);
}
| [
"[email protected]"
]
| |
67aa7daec9ab65ba310f5c2735e57c8d173f0d19 | 64f0a73f1f35078d94b1bc229c1ce6e6de565a5f | /dataset/OS Java Files/substratum-sasmjpsc-Systems.java | 5fe41396325669a03754bb747f421828ae38c62c | [
"MIT"
]
| permissive | S2-group/mobilesoft-2020-iam-replication-package | 40d466184b995d7d0a9ae6e238f35ecfb249ccf0 | 600d790aaea7f1ca663d9c187df3c8760c63eacd | refs/heads/master | 2021-02-15T21:04:20.350121 | 2020-10-05T12:48:52 | 2020-10-05T12:48:52 | 244,930,541 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 30,089 | java | /*
* Copyright (c) 2016-2019 Projekt Substratum
* This file is part of Substratum.
*
* SPDX-License-Identifier: GPL-3.0-Or-Later
*/
package projekt.substratum.common;
import android.annotation.SuppressLint;
import android.app.AppOpsManager;
import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.om.IOverlayManager;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.provider.Settings;
import android.util.Log;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import projekt.substratum.BuildConfig;
import projekt.substratum.Substratum;
import projekt.substratum.common.platform.SubstratumService;
import projekt.substratum.util.helpers.FileDownloader;
import projekt.substratum.util.helpers.Root;
import projekt.substratum.util.readers.ReadSupportedROMsFile;
import static projekt.substratum.common.References.ANDROMEDA_PACKAGE;
import static projekt.substratum.common.References.BYPASS_SYSTEM_VERSION_CHECK;
import static projekt.substratum.common.References.INTERFACER_PACKAGE;
import static projekt.substratum.common.References.NO_THEME_ENGINE;
import static projekt.substratum.common.References.OVERLAY_MANAGER_SERVICE_INTERFACER;
import static projekt.substratum.common.References.OVERLAY_MANAGER_SERVICE_ANDROMEDA;
import static projekt.substratum.common.References.OVERLAY_MANAGER_SERVICE_O_ROOTED;
import static projekt.substratum.common.References.OVERLAY_MANAGER_SERVICE_P_ROOTED;
import static projekt.substratum.common.References.OVERLAY_MANAGER_SERVICE_SYSSERV;
import static projekt.substratum.common.References.PLAY_STORE_PACKAGE_NAME;
import static projekt.substratum.common.References.RUNTIME_RESOURCE_OVERLAY_N_ROOTED;
import static projekt.substratum.common.References.SAMSUNG_THEME_ENGINE_N;
import static projekt.substratum.common.References.SST_ADDON_PACKAGE;
import static projekt.substratum.common.References.SUBSTRATUM_LOG;
import static projekt.substratum.common.References.SUBSTRATUM_THEME;
import static projekt.substratum.common.References.hashPassthrough;
import static projekt.substratum.common.References.isNetworkAvailable;
import static projekt.substratum.common.References.isServiceRunning;
public class Systems {
public static final boolean IS_PIE = Build.VERSION.SDK_INT == Build.VERSION_CODES.P;
public static final boolean IS_OREO = Build.VERSION.SDK_INT == Build.VERSION_CODES.O ||
Build.VERSION.SDK_INT == Build.VERSION_CODES.O_MR1;
private static final boolean IS_NOUGAT = Build.VERSION.SDK_INT == Build.VERSION_CODES.N ||
Build.VERSION.SDK_INT == Build.VERSION_CODES.N_MR1;
private static Boolean checkPackageSupported;
private static SharedPreferences prefs = Substratum.getPreferences();
/**
* Cached boolean to find if system
* passes all cases of Samsung checks
*/
private static Boolean isSamsungDevice = null;
/**
* This method is used to determine whether there the system is initiated with OMS
*
* @param context Self explanatory, sir
*/
public static Boolean checkOMS(Context context) {
if (context == null) return true; // Safe to assume that window refreshes only on OMS
if (!BYPASS_SYSTEM_VERSION_CHECK) {
if (!prefs.contains("oms_state")) {
setAndCheckOMS(context);
}
return prefs.getBoolean("oms_state", false);
} else {
return false;
}
}
/**
* Checks the backend system (SysServ or Interfacer) whether it is authorized to be used
*
* @param context Context!
* @return True, if the current theming system is authorized
*/
public static Boolean authorizedToUseBackend(Context context) {
return !BuildConfig.DEBUG || getForceAuthorizationSetting(context).equals("1");
}
/**
* Obtain the system setting's authorization setting for Interfacer/SysServ
*
* @param context Context!
* @return A string object of the obtained setting
*/
private static String getForceAuthorizationSetting(Context context) {
String forceAuthorize = Settings.Secure.getString(context.getContentResolver(),
"force_authorize_substratum_packages");
return forceAuthorize == null ? "0" : forceAuthorize;
}
/**
* Check what theme system is being used on the device
*
* @param context Self explanatory...
* @return Returns the theme mode
*/
public static int checkThemeSystemModule(Context context) {
return checkThemeSystemModule(context, false);
}
/**
* Brain matter of {@link #checkThemeSystemModule(Context)}
*
* @param context Self explantory, sur..,,
* @param firstLaunch Whether it is the first start of the app
* @return Returns the theme mode
*/
public static int checkThemeSystemModule(Context context,
boolean firstLaunch) {
if (context != null) {
if (!firstLaunch &&
prefs.contains("current_theme_mode") &&
prefs.getInt("current_theme_mode", NO_THEME_ENGINE) != NO_THEME_ENGINE) {
return prefs.getInt("current_theme_mode", NO_THEME_ENGINE);
}
if (IS_PIE) {
if (isNewSamsungDevice() && isAndromeda(context)) {
// Andromeda mode
prefs.edit().putInt(
"current_theme_mode",
OVERLAY_MANAGER_SERVICE_ANDROMEDA
).apply();
return OVERLAY_MANAGER_SERVICE_ANDROMEDA;
} else if (isSubstratumService(context)) {
// SS mode
prefs.edit().putInt(
"current_theme_mode",
OVERLAY_MANAGER_SERVICE_SYSSERV
).apply();
return OVERLAY_MANAGER_SERVICE_SYSSERV;
} else if (Root.checkRootAccess()) {
prefs.edit().putInt(
"current_theme_mode",
OVERLAY_MANAGER_SERVICE_P_ROOTED
).apply();
}
} else if (IS_OREO) {
if (isAndromeda(context)) {
// Andromeda mode
prefs.edit().putInt(
"current_theme_mode",
OVERLAY_MANAGER_SERVICE_ANDROMEDA
).apply();
return OVERLAY_MANAGER_SERVICE_ANDROMEDA;
} else if (isSubstratumService(context)) {
// SS mode
prefs.edit().putInt(
"current_theme_mode",
OVERLAY_MANAGER_SERVICE_SYSSERV
).apply();
return OVERLAY_MANAGER_SERVICE_SYSSERV;
} else if (Root.checkRootAccess()) {
// Rooted mode
prefs.edit().putInt(
"current_theme_mode",
OVERLAY_MANAGER_SERVICE_O_ROOTED
).apply();
return OVERLAY_MANAGER_SERVICE_O_ROOTED;
}
} else if (IS_NOUGAT) {
if (isBinderInterfacer(context)) {
// Interfacer mode
prefs.edit().putInt(
"current_theme_mode",
OVERLAY_MANAGER_SERVICE_INTERFACER
).apply();
return OVERLAY_MANAGER_SERVICE_INTERFACER;
} else if (isSamsungDevice(context)) {
// Sungstratum mode
prefs.edit().putInt(
"current_theme_mode",
SAMSUNG_THEME_ENGINE_N
).apply();
return SAMSUNG_THEME_ENGINE_N;
} else if (Root.checkRootAccess()) {
// Rooted mode
prefs.edit().putInt(
"current_theme_mode",
RUNTIME_RESOURCE_OVERLAY_N_ROOTED
).apply();
return RUNTIME_RESOURCE_OVERLAY_N_ROOTED;
}
}
}
return NO_THEME_ENGINE;
}
/**
* Set a retained property to refer to rather than constantly calling the OMS state
*
* @param context If you haven't gotten this by now, better start reading Android docs
*/
public static void setAndCheckOMS(Context context) {
prefs.edit().remove("oms_state").apply();
try {
boolean foundOms = false;
if (!isSamsungDevice(context)) {
String sonyCheck = getProp("ro.sony.fota.encrypteddata");
if (checkThemeInterfacer(context) || isSubstratumService(context)) {
foundOms = true;
} else if (sonyCheck == null || sonyCheck.length() == 0) {
boolean isOMSRunning = isServiceRunning(IOverlayManager.class,
context.getApplicationContext());
if (isOMSRunning || IS_OREO || IS_PIE) {
Substratum.log(SUBSTRATUM_LOG,
"This device fully supports the Overlay Manager Service...");
foundOms = true;
} else {
String out = Root.runCommand("cmd overlay").split("\n")[0];
if ("The overlay manager has already been initialized.".equals(out) ||
"Overlay manager (overlay) commands:".equals(out)) {
Substratum.log(SUBSTRATUM_LOG,
"This device fully supports the Overlay Manager Service...");
foundOms = true;
}
}
} else {
Substratum.log(SUBSTRATUM_LOG, "Sony Mobile Overlay Manager Service found, " +
"falling back to RRO2 for vendor bypass...");
}
}
if (foundOms && !isSamsungDevice(context)) {
prefs.edit().putBoolean("oms_state", true).apply();
Substratum.log(SUBSTRATUM_LOG, "Initializing Substratum with Dynamic Overlay / " +
"Overlay Manager Service support!");
} else {
prefs.edit().putBoolean("oms_state", false).apply();
Substratum.log(SUBSTRATUM_LOG,
"Initializing Substratum with Runtime Resource Overlay support!");
}
} catch (Exception e) {
prefs.edit().putBoolean("oms_state", false).apply();
Substratum.log(SUBSTRATUM_LOG, "Initializing Substratum with Runtime Resource Overlay support!");
}
}
/**
* Check if it is using the Theme Interfacer backend
*
* @param context Just, no
* @return True, if using Theme Interfacer
*/
public static boolean checkThemeInterfacer(Context context) {
return checkThemeSystemModule(context) == OVERLAY_MANAGER_SERVICE_INTERFACER;
}
/**
* Set a retained property to refer to rather than constantly calling the SS state
*/
public static void setAndCheckSubstratumService() {
StringBuilder check = References.runShellCommand("cmd -l");
boolean present = check != null && check.toString().contains("substratum");
prefs.edit().putBoolean("substratum_service_present", false).apply();
if (present) {
prefs.edit().putBoolean("substratum_service_present", true).apply();
}
}
private static boolean isSubstratumService(Context context) {
if (context == null) return true; // Safe to assume that window refreshes only on OMS
if (!prefs.contains("substratum_service_present")) {
setAndCheckSubstratumService();
}
return prefs.getBoolean("substratum_service_present", false);
}
/**
* Determine whether the device supports the new Substratum service
*
* @return True, if Substratum service
*/
public static boolean checkSubstratumService(Context context) {
return checkThemeSystemModule(context) == OVERLAY_MANAGER_SERVICE_SYSSERV;
}
public static boolean checkSubstratumServiceApi(Context context) {
return !checkSubstratumService(context) || SubstratumService.checkApi();
}
/**
* Check if it is using the Andromeda backend
*
* @param context You know it, right?
* @return True, if using Andromeda
*/
public static boolean isAndromedaDevice(Context context) {
return checkThemeSystemModule(context) == OVERLAY_MANAGER_SERVICE_ANDROMEDA;
}
private static boolean isAndromeda(Context context) {
if (context == null) {
Log.e(SUBSTRATUM_LOG,
"activity has been destroyed, cannot check if andromeda is used");
return false;
}
boolean isEnabled = Packages.isAvailablePackage(context, References.ANDROMEDA_PACKAGE);
PackageInfo packageInfo = getAndromedaPackage(context);
return (packageInfo != null) && isEnabled;
}
/**
* Check if it is using the latest Theme Interfacer backend
*
* @param context Context!
* @return True, if using Theme Interfacer
*/
private static boolean isBinderInterfacer(Context context) {
boolean isEnabled = Packages.isAvailablePackage(context, References
.INTERFACER_PACKAGE);
PackageInfo packageInfo = getThemeInterfacerPackage(context);
return (packageInfo != null) && (packageInfo.versionCode >= 60) && isEnabled;
}
/**
* Checks if the device is running a Samsung system software
*
* @param context Context?
* @return True, if Samsung
*/
public static boolean isSamsung(Context context) {
if (!isSamsungDevice(context)) return false;
if (isNewSamsungDeviceAndromeda(context)) return true;
String liveInstaller = Packages.getInstallerId(context, SST_ADDON_PACKAGE);
return Packages.isPackageInstalled(context, SST_ADDON_PACKAGE) &&
((liveInstaller != null) &&
liveInstaller.equals(PLAY_STORE_PACKAGE_NAME));
}
public static boolean isSamsungDevice(Context context) {
if (isNewSamsungDeviceAndromeda(context)) return true;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) return false;
if (isSamsungDevice != null) return isSamsungDevice;
if (context != null) {
List<String> listOfFeatures =
Arrays.asList(context.getPackageManager().getSystemSharedLibraryNames());
isSamsungDevice = listOfFeatures.contains("touchwiz");
return isSamsungDevice;
} else {
return false;
}
}
/**
* Checks if it passes all cases of new Samsung Oreo checks
*
* @return True, if it passes all Samsung tests
*/
public static boolean isNewSamsungDevice() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
new File("/system/etc/permissions/com.samsung.device.xml").exists();
}
/**
* Checks if the system supports sungstromeda mode
*
* @param context Context
* @return True, if the device can utilize both sungstratum + andromeda mode on Oreo onwards
*/
public static boolean isNewSamsungDeviceAndromeda(Context context) {
boolean sungstromeda = prefs.getBoolean("sungstromeda_mode", true);
return sungstromeda && isNewSamsungDevice() && isAndromedaDevice(context);
}
/**
* Checks if the device is a Xiaomi device
*
* @return True, if it passes all Xiaomi tests
*/
public static boolean isXiaomiDevice() {
return new File("/system/etc/permissions/platform-miui.xml").exists();
}
/**
* Obtains the Andromeda Package
*
* @param context Context...
* @return True, if it is enabled and installed
*/
private static PackageInfo getAndromedaPackage(Context context) {
try {
return context.getPackageManager().getPackageInfo(ANDROMEDA_PACKAGE, 0);
} catch (Exception ignored) {
}
return null;
}
/**
* Obtains the Theme Interfacer Package
*
* @param context CoNtExT
* @return True, if it is enabled and installed
*/
public static PackageInfo getThemeInterfacerPackage(Context context) {
try {
return context.getPackageManager().getPackageInfo(INTERFACER_PACKAGE, 0);
} catch (Exception ignored) {
}
return null;
}
/**
* Obtains the device encryption status
* <p>
* 0: ENCRYPTION_STATUS_UNSUPPORTED
* 1: ENCRYPTION_STATUS_INACTIVE
* 2: ENCRYPTION_STATUS_ACTIVATING
* 3: ENCRYPTION_STATUS_ACTIVE_DEFAULT_KEY
* 4: ENCRYPTION_STATUS_ACTIVE
* 5: ENCRYPTION_STATUS_ACTIVE_PER_USER
*
* @param context The context bud, THE CONTEXT!
* @return Returns the system's encryption status
*/
public static int getDeviceEncryptionStatus(Context context) {
int status = DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED;
DevicePolicyManager dpm = (DevicePolicyManager)
context.getSystemService(Context.DEVICE_POLICY_SERVICE);
if (dpm != null) status = dpm.getStorageEncryptionStatus();
return status;
}
/**
* Checks whether the projekt.substratum.THEME permission is found on a custom ROM
*
* @param context The context.
* @return True, if found
*/
public static boolean checkSubstratumFeature(Context context) {
// Using lowercase because that's how we defined it in our permissions xml
return context.getPackageManager()
.hasSystemFeature(SUBSTRATUM_THEME.toLowerCase(Locale.US));
}
/**
* Compare a target date with the system security patch
*
* @param comparePatch Target date
* @return True, if system security patch is greater than target date
*/
public static boolean isSystemSecurityPatchNewer(String comparePatch) {
try {
if (comparePatch.length() != 10) throw new Exception("Incorrect string input!");
String systemSecurityPatch = Build.VERSION.SECURITY_PATCH;
Date systemPatchDate =
new SimpleDateFormat("yyyy-MM-dd", Locale.US).parse(systemSecurityPatch);
Date comparisonPatchDate =
new SimpleDateFormat("yyyy-MM-dd", Locale.US).parse(comparePatch);
return systemPatchDate.after(comparisonPatchDate);
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
/**
* Determine whether the device was dirty/clean flashed
*
* @param context Context!
* @return True, if clean
*/
public static Boolean checkROMVersion(Context context) {
if (!prefs.contains("rom_build_date")) {
setROMVersion(false);
}
if ((isSamsungDevice(context) || isNewSamsungDevice()) &&
!prefs.contains("samsung_migration_key")) {
prefs.edit().putInt("samsung_migration_key", Build.VERSION.SDK_INT).apply();
}
String prop = getProp("ro.build.date.utc");
return prefs.getInt("rom_build_date", 0) ==
(((prop != null) && !prop.isEmpty()) ? Integer.parseInt(prop) : 0);
}
/**
* Retain the ROM version in the Shared Preferences of the app
*
* @param force Do not dynamically set it, instead, force!
*/
public static void setROMVersion(boolean force) {
if (!prefs.contains("rom_build_date") || force) {
String prop = getProp("ro.build.date.utc");
prefs.edit().putInt("rom_build_date",
((prop != null) && !prop.isEmpty()) ? Integer.parseInt(prop) : 0)
.apply();
}
}
/**
* Obtain the device ID of the device
*
* @param context Context...
* @return Returns a string of the device's ID
*/
@SuppressLint("HardwareIds")
public static String getDeviceID(Context context) {
return Settings.Secure.getString(context.getContentResolver(),
Settings.Secure.ANDROID_ID);
}
/**
* Build.prop scavenger
*
* @param propName Desired prop to find
* @return String of the prop value's output
*/
public static String getProp(String propName) {
Process p = null;
String result = "";
try {
p = new ProcessBuilder("/system/bin/getprop", propName)
.redirectErrorStream(true).start();
try (BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())
)) {
String line;
while ((line = br.readLine()) != null) {
result = line;
}
} catch (IOException e) {
e.printStackTrace();
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (p != null) {
p.destroy();
}
}
return result;
}
/**
* Denied packages on the device
* <p>
* This will never be always up to date, so we end up using our main checker!
*
* @param context Self explanatory...what?
* @return True if blacklisted packages found
*/
public static boolean checkPackageSupport(Context context, Boolean override) {
if (checkPackageSupported == null || override) {
String[] blacklistedPackages = {
"com.android.vending.billing.InAppBillingService.",
"uret.jasi2169.",
"com.dimonvideo.",
"com.chelpus.",
"com.forpda.",
"zone.jasi2169."
};
checkPackageSupported = checkPackageRegex(context, blacklistedPackages) || hashPassthrough(context) == 0;
}
return checkPackageSupported;
}
/**
* Helper function of checkPackageSupport {@link #checkPackageSupport(Context, Boolean)}
*
* @param context Self explanatory...what?
* @param stringArray List of packages to check
* @return True if blacklisted packages found
*/
private static Boolean checkPackageRegex(Context context,
String[] stringArray) {
if (stringArray.length == 0) return true;
final PackageManager pm = context.getPackageManager();
List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);
List<String> listOfInstalled = new ArrayList<>();
for (ApplicationInfo packageInfo : packages) {
listOfInstalled.add(packageInfo.packageName);
}
String invocation = listOfInstalled.toString();
for (String packageName : stringArray) {
if (invocation.contains(packageName))
return true;
}
return false;
}
/**
* Firmware analyzer
*
* @param context Context!!!???
* @param url Source of where to check the main repository of supported devices
* @param fileName Filename of the file to read
* @return Return string of the supported ROM
*/
public static String checkFirmwareSupport(
Context context,
String url,
String fileName) {
String supportedRom = "";
try {
if (isNetworkAvailable(context)) {
FileDownloader.init(context, url, "", fileName);
} else {
File check = new File(
context.getCacheDir().getAbsolutePath() + '/' + fileName);
if (!check.exists()) return "";
}
Map<String, String> listOfRoms =
ReadSupportedROMsFile.read(context.getCacheDir() + "/" + fileName);
boolean supported = false;
// First check if it is a valid prop
for (Object o : listOfRoms.entrySet()) {
Map.Entry pair = (Map.Entry) o;
String key = (String) pair.getKey();
String value = (String) pair.getValue();
Process process = Runtime.getRuntime().exec("getprop " + key);
process.waitFor();
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(process.getInputStream()))) {
String line = reader.readLine();
if ((line != null) && !line.isEmpty()) {
if ((value == null) || value.isEmpty()) {
String current = key;
if (current.contains(".")) {
current = current.split("\\.")[1];
}
Substratum.log(SUBSTRATUM_LOG, "Supported ROM: " + current);
supportedRom = current;
supported = true;
} else {
Substratum.log(SUBSTRATUM_LOG, "Supported ROM: " + value);
supportedRom = value;
supported = true;
}
break;
}
}
}
// Then check ro.product.flavor
if (!supported) {
Iterator it = listOfRoms.entrySet().iterator();
Process process = Runtime.getRuntime().exec("getprop ro.build.flavor");
process.waitFor();
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(process.getInputStream()))) {
String line;
while ((line = reader.readLine()) != null) {
while (it.hasNext()) {
Map.Entry pair = (Map.Entry) it.next();
String key = (String) pair.getKey();
String value = (String) pair.getValue();
if (line.toLowerCase(Locale.US)
.contains(key.toLowerCase(
Locale.US))) {
if ((value == null) || value.isEmpty()) {
String current = key;
if (current.contains(".")) {
current = current.split("\\.")[1];
}
Substratum.log(SUBSTRATUM_LOG,
"Supported ROM (1): " + current);
supportedRom = current;
supported = true;
} else {
Substratum.log(SUBSTRATUM_LOG,
"Supported ROM (1): " + value);
supportedRom = value;
supported = true;
}
break;
}
}
if (supported) break;
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return supportedRom;
}
/**
* Check whether usage permissions are granted to the app
*
* @param context My god, this context thing is really annoying!
* @return True, if granted.
*/
public static boolean checkUsagePermissions(Context context) {
try {
PackageManager packageManager = context.getPackageManager();
ApplicationInfo applicationInfo =
packageManager.getApplicationInfo(context.getPackageName(), 0);
AppOpsManager appOpsManager = (AppOpsManager)
context.getSystemService(Context.APP_OPS_SERVICE);
assert appOpsManager != null;
int mode = appOpsManager.checkOpNoThrow(
AppOpsManager.OPSTR_GET_USAGE_STATS,
applicationInfo.uid,
applicationInfo.packageName);
return mode == AppOpsManager.MODE_ALLOWED;
} catch (PackageManager.NameNotFoundException e) {
return false;
}
}
/**
* Checks whether there is root access on the device
*
* @return True, if root is granted
*/
public static boolean checkRootAccess() {
if (!prefs.contains("root_access")) {
setAndCheckRootAccess();
}
return prefs.getBoolean("root_access", false);
}
/**
* Set a retained property to refer to rather than constantly calling the requestRootAccess method
*/
private static void setAndCheckRootAccess() {
boolean access = Root.requestRootAccess();
prefs.edit().putBoolean("root_access", false).apply();
if (access) {
prefs.edit().putBoolean("root_access", true).apply();
}
}
} | [
"[email protected]"
]
| |
95cfe9be1a247db17a7091df90387049558fbc20 | 32244f6ff27b517f4fa42727a40496f2f15ea9bf | /src/main/java/com/example/demo/repository/BrandRepository.java | c650f91dc5a2d82433ce4c9e0f8b5e2773307d13 | []
| no_license | Grzybek-Pomarancza/Car-Rental | c0d18ffd3a02b2a3f34567d62698a0cf052f2c4c | b0a25929f3d5e30ac2f8cefd3aa56b8408b9ae50 | refs/heads/master | 2021-05-25T13:54:07.532955 | 2020-06-10T16:53:22 | 2020-06-10T16:53:22 | 253,779,343 | 0 | 0 | null | 2020-06-08T19:31:59 | 2020-04-07T11:58:02 | Java | UTF-8 | Java | false | false | 434 | java | package com.example.demo.repository;
import com.example.demo.model.Brand;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
@Repository
public interface BrandRepository extends JpaRepository<Brand, Long> {
Optional<Brand> findByName(String name);
Optional<Brand> findById(Long id);
List<Brand> findAll();
} | [
"[email protected]"
]
| |
3c65200c444a8467fe23ac09304fb14c38b124e2 | 9144d176a3dbf57b88ece663a5afdf04f9a86f1e | /util/util/src/main/java/com/lippo/cms/util/Calculations.java | 752ebedc29a99b0464290843537ac2174ee3c960 | []
| no_license | chaturangalagama/clinic-cutomized-bussines-microservice | fdb7475473a4f7d6b9ec8f0036a6075bc90a0ef9 | 7077bc0e9b932ea3cded00d7de9cfa83b61fe066 | refs/heads/main | 2023-06-15T22:47:21.754037 | 2021-07-14T16:36:41 | 2021-07-14T16:36:41 | 384,223,490 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 884 | java | package com.lippo.cms.util;
import java.math.BigDecimal;
import java.math.RoundingMode;
public class Calculations {
public static final int SCALE = 2;
public static final BigDecimal DIVISOR = new BigDecimal(100.0f);
public static final RoundingMode ROUNDING_MODE = RoundingMode.HALF_UP;
public static int calculatePercentage(int value, int percentage) {
return new BigDecimal(value).multiply(new BigDecimal(percentage))
.divide(DIVISOR, ROUNDING_MODE)
.setScale(SCALE, ROUNDING_MODE).intValue();
}
public static void main(String[] args) {
int percentage = calculatePercentage(350, 7);
System.out.println(percentage);
System.out.println((350 * 7) / 100.0f);
}
public static int multiplyWithHalfRoundUp(int leftValue, int rightValue) {
return leftValue * rightValue;
}
}
| [
"[email protected]"
]
| |
e27a013828f5137f6eec9921318e6742f990e471 | 1f6005ea4629810ae1da30e39f1f23034f58a9f9 | /02_adapter/2/PrintBanner.java | db669787f75e5380c495b38adc029194ae1d978d | []
| no_license | KimiyukiYamauchi/DesignPattern.2018 | 78aefb509f2241b3c422515579b570258f42b5a6 | 7a68534f505edbf3f21b2c43cef346043bbb66bb | refs/heads/master | 2020-04-01T20:32:37.878687 | 2019-07-17T08:13:42 | 2019-07-17T08:13:42 | 153,608,593 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 323 | java | public class PrintBanner extends Print{
private Banner banner;
public PrintBanner(String string) {
this.banner = new Banner(string);
}
@Override
public void printWeak() {
banner.showWithParen();
}
@Override
public void printStrong() {
banner.showWithAster();
}
}
| [
"[email protected]"
]
| |
2b0a474d3200f314019e1621ce217ed517aadd63 | 28f1dedfa55de3381f0e2124c7c819f582767e2a | /unmaintained/extras/avalanche/AvalancheCore/src/org/smartfrog/avalanche/client/sf/apps/gt4/build/GT4Constants.java | 76ae78f41d161dffeea0ec8a3f7087e91d483039 | []
| no_license | rhusar/smartfrog | 3bd0032888c03a8a04036945c2d857f72a89dba6 | 0b4db766fb1ec1e1c2e48cbf5f7bf6bfd2df4e89 | refs/heads/master | 2021-01-10T05:07:39.218946 | 2014-11-28T08:52:32 | 2014-11-28T08:52:32 | 47,347,494 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,845 | java | /**
(C) Copyright 1998-2007 Hewlett-Packard Development Company, LP
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
For more information: www.smartfrog.org
*/
/*
* Created on Dec 13, 2005
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package org.smartfrog.avalanche.client.sf.apps.gt4.build;
import java.util.ArrayList;
/**
* @author sandya
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class GT4Constants {
private static String pathSep = System.getProperty("path.separator");
public static String pathEnv = "/usr/bin" + pathSep + "/bin" + pathSep +
"/usr/local/bin" + pathSep + "/usr/sbin" + pathSep + "/sbin";
public static int defaultPathLen = pathEnv.length();
public static ArrayList envp = new ArrayList();
public GT4Constants() {
}
public static void setPath(String path) {
pathEnv += pathSep + path;
}
public static String getPath() {
return pathEnv;
}
public static void setEnvp(String env) {
envp.add(env);
}
}
| [
"sfrits@9868f95a-be1e-0410-b3e3-a02e98b909e6"
]
| sfrits@9868f95a-be1e-0410-b3e3-a02e98b909e6 |
b19ba36df7bf9bcdfd8aa57b16b17fb33da81fff | 23d114389ed0e3d0b9f1dec7e61c8a745e744e5b | /jwr/src/com/wr4/service/IPnApplyAccepService.java | 9a723b66075d1f42e38cd12422a162b379a6619e | []
| no_license | shanghaif/jwr | 3c6c7b01e7a1ab56129055735aba6e8ac9811138 | 355db3d25e15a17606842221fa67bdd1471b21cc | refs/heads/master | 2023-03-16T01:36:24.243834 | 2019-05-26T10:00:51 | 2019-05-26T10:00:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 366 | java | package com.wr4.service;
import java.util.List;
import java.util.Map;
public interface IPnApplyAccepService {
public abstract List pnApplyAccept(String sqlId, Map map) throws Exception;
public List pnApplyAccept(String sqlId,Map map,int offset,int limit) throws Exception;
public abstract List applyAcceptGetTrain(String string, Map map) throws Exception;
}
| [
"[email protected]"
]
| |
62634b98e09de8564475f281165101b84d34d27a | 61496dfa15778cb8a3485b03413332137d1409fb | /src/API/Forecast/Date.java | 87c1effe938b9eccc1718ab1087e95e925132028 | []
| no_license | dimitrtrifonov/MyWeatherApp | cf3fc931e4ccd1cf50ac693dd8acb1591989be83 | 36146cc7ac358632d1b5497fbe4e75edb997e957 | refs/heads/master | 2016-09-05T15:15:01.409229 | 2015-06-23T13:56:44 | 2015-06-23T13:56:44 | 37,921,615 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 155 | java | package API.Forecast;
import com.google.gson.annotations.SerializedName;
public class Date {
@SerializedName("pretty")
public String pretty;
}
| [
"[email protected]"
]
| |
8d6863932134a05cc28649890a1abb99737413b3 | 29557237820597767397542f818742dff1f43f54 | /shop/branches/auction/shop-app/src/main/java/com/dtlonline/shop/controller/personal/auction/AuctionTradeController.java | 7fd0064d3b9cd948f0d645f5690c083487c2cdfd | []
| no_license | 18665698681/demo | e37e0f85c406e49278f531ef2e5fbd09590e6b6a | 137ce59888d1a91c87e36e11a31546b479a83e9e | refs/heads/master | 2022-07-29T17:20:00.485568 | 2019-07-06T02:47:12 | 2019-07-06T02:47:12 | 195,488,174 | 0 | 0 | null | 2022-07-07T23:17:48 | 2019-07-06T02:23:14 | Java | UTF-8 | Java | false | false | 824 | java | package com.dtlonline.shop.controller.personal.auction;
import com.dtlonline.api.shop.command.AuctionApply;
import com.dtlonline.api.shop.command.CheckInfoDTO;
import com.dtlonline.api.shop.command.ProductDTO;
import com.dtlonline.shop.service.auction.AuctionTradeService;
import io.alpha.core.base.BaseController;
import io.alpha.core.service.JWTService;
import io.alpha.core.util.JsonUtils;
import io.alpha.core.view.RestResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
@RestController("personalAuctionTradeController")
@RequestMapping("/personal")
public class AuctionTradeController extends BaseController {
@Autowired
JWTService jwtService;
@Autowired
AuctionTradeService auctionTradeService;
}
| [
"[email protected]"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.