blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
706a14992584c3f9c866806b3eb05875fe102005 | 3826f283b8a75db5c1fca09accab4059cba184ee | /app/src/main/java/com/example/paul/test3_terminal3/tampilansate.java | 30295e05d1e43e9d848e702a2412db8036f05cd6 | [] | no_license | elroynatanael/test3_Terminal3 | 617bb3a6cb54f453f83c8da7d327fe0b26310720 | b431ec2013af56287a3e17d636768248a0cc3d16 | refs/heads/master | 2020-06-13T12:50:21.259480 | 2019-07-16T12:17:07 | 2019-07-16T12:17:07 | 194,660,438 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 804 | java | package com.example.paul.test3_terminal3;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class tampilansate extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tampilansate);
}
public void open (View view){
Intent i;
String addressString ="Sate Khas Senayan Terminal 3 Tangerang, Pajang, Benda, Kota Tangerang, Banten 15126";
Uri geoLocation = Uri.parse("geo:-6.118556, 106.665198?q=" + addressString);
i = new Intent(Intent.ACTION_VIEW);
i.setData(geoLocation);
startActivity(i);
}
} | [
"elroipaulus5@gmail.com"
] | elroipaulus5@gmail.com |
e94494f4dd906c69a30036a6261388ff18aa83c4 | 05cd155c24df937cad8121236a99dceeeab05dba | /src/main/java/com/ceit/service/UrlMatcher.java | 9f138dc714928c3be5f2b7686f867fadc8ef1346 | [] | no_license | ceitteam/Security | 4c405665e7f732944a34434552edd2e0df0ba5fc | 968287a51cbfe965936fdb0f6b79c8a5b084f008 | refs/heads/master | 2016-09-06T04:56:10.734069 | 2013-09-13T15:05:23 | 2013-09-13T15:05:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 588 | java | package com.ceit.service;
/**
* Strategy for deciding whether configured path matches a submitted candidate URL.
*
* @author Luke Taylor
* @since 2.0
*/
public interface UrlMatcher {
Object compile(String urlPattern);
boolean pathMatchesUrl(Object compiledUrlPattern, String url);
/** Returns the path which matches every URL */
String getUniversalMatchPattern();
/**
* Returns true if the matcher expects the URL to be converted to lower case before
* calling {@link #pathMatchesUrl(Object, String)}.
*/
boolean requiresLowerCaseUrl();
}
| [
"542467660@qq.com"
] | 542467660@qq.com |
76c6f5d29cbc94a3f8aa8afc9c570346788c7615 | e4c7305a6d01c3902ebfd71e45f84af9c47dbdeb | /ordenacao/src/ordenacao/RandomList.java | c35e3b58742dfcbb46581e92182b6778e53c9dee | [] | no_license | Paulo-Cristhian/Code-organizer | 8bda8939a6fc33e68cdae2b1457e720d7fa677ab | 8d2ce64338969ac655f41e748ae7797934cc0510 | refs/heads/main | 2023-04-28T15:49:10.939845 | 2021-05-24T19:34:08 | 2021-05-24T19:34:08 | 300,779,795 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,851 | java | package ordenacao;
public class RandomList extends algoritmoOrdenacao{
public static int tam; // [10 || 50 || 100 || 500 || 1000] * 1000
public int[] vetorUnico;
public int[] vetorInverso = ;
public void settam(int param) {
this.tam = param;
this.vetorUnico = geraArray(param*1000);
ordena(vetorUnico);
}
// Atribui vari�vel de vetor unica para todas as compara��es seguintes
public int[] geraArray(int tam) {
int arr[] = new int[tam];
for (int i = 0; i<tam; i++ ) {
int generate = (int)((Math.random()*tam));
arr[i] = generate;
}
return arr;
}
public void ordena(int[] vetorUnico) {
String algoritmo[] = {"BubbleSort", "InsertSort", "SelectSort", "QuickSort"};
algoritmoOrdenacao sort = new algoritmoOrdenacao();
for(int etapa=0; etapa<algoritmo.length; etapa++) {
long tempoInicial = System.currentTimeMillis();
int[] vetorClone = vetorUnico.clone();
System.out.println("\nVetor inicializado... ");
mostraVetor(vetorClone);
System.out.println("\nOrdenando em "+algoritmo[etapa]+" ...");
switch (etapa) {
case 0:
sort.bubbleSort(vetorClone);
break;
case 1:
sort.insertionSort(vetorClone);
break;
case 2:
sort.selectionSort(vetorClone);
break;
case 3:
sort.quickSort(vetorClone,0,vetorClone.length-1);
break;
}
long tempoFinal = System.currentTimeMillis();
System.out.println("No sistema de ordena��o "+ algoritmo[etapa] + " o vetor final foi: ");
mostraVetor(vetorClone);
vetorClone = new int[0];
System.out.println("\nExecutado em = " + (tempoFinal - tempoInicial) + " ms");
}
}
public static void mostraVetor(int vetor[]) {
System.out.println("Mostrando o Vetor: ");
for(int i = 0; i < 10; i++) {
System.out.print(vetor[i]+", ");
}
}
} | [
"ale.f.moura@hotmail.com"
] | ale.f.moura@hotmail.com |
810d3368a8ef932e1b4610d469713917b6cb52e0 | d074dfa862d9c8b63e7b9a2fde1c576041b0deae | /CodeFights/Arcade Tasks/boxBlur.java | bb228b01bff1a704768dfe900c9c2fa93aa7ca00 | [] | no_license | suryann/Interview-Preparation | d55866ba6c7a2650c78561f967ea0d9bc586d926 | f52f1dc65c8bfdafa3d5c5bfe76ff6d60ede1571 | refs/heads/master | 2023-03-16T17:08:37.642631 | 2018-05-07T00:32:52 | 2018-05-07T00:32:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 493 | java | int[][] boxBlur(int[][] image) {
int[][] answer = new int[image.length - 2][image[0].length - 2];
for (int x = 1; x < image.length - 1; x++) {
for (int y = 1; y < image[0].length - 1; y++) {
int sum = 0;
for (int dx = -1; dx <= 1; dx++) {
for (int dy = -1; dy <= 1; dy++) {
sum += image[x + dx][y + dy];
}
}
answer[x - 1][y - 1] = sum / 9;
}
}
return answer;
}
| [
"mohamed2006fs@gmail.com"
] | mohamed2006fs@gmail.com |
e344a2f303d8c280d12f76d30ea2a52d0cab7ea5 | fb08a642c4b65b002c5a364d4f50d95da6a4b2cf | /Problems/Two numbers never occur to each other/src/Main.java | 543f6beeb77d7205fecef2ca5294f647f1a73135 | [] | no_license | Bearzerk1488/Coffee_Machine | 7231793274ed51eb6f08a088ebf2d1356169b466 | 9a9b6cd4dbbe19fd7e321f21f90fec91a63a9c49 | refs/heads/master | 2022-05-21T08:42:08.073439 | 2020-05-16T13:08:00 | 2020-05-16T13:08:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 702 | java | import java.util.Scanner;
class Main {
public static void main(String[] args) {
// put your code here
Scanner scanner = new Scanner(System.in);
int length = scanner.nextInt();
int[] arr = new int[length];
for (int i = 0; i < arr.length; i++) {
arr[i] = scanner.nextInt();
}
int n = scanner.nextInt();
int m = scanner.nextInt();
boolean isPresent = true;
for (int i = 1; i < arr.length; i++) {
if (arr[i] == n && arr[i - 1] == m || arr[i] == m && arr[i - 1] == n) {
isPresent = false;
break;
}
}
System.out.println(isPresent);
}
} | [
"bearzerk@gmail.com"
] | bearzerk@gmail.com |
e20a19a85557143327683142578a4929cd0cf968 | ff9691afece1b062e293180408e5eceeb2a818f9 | /src/maxvalue.java | 8128d1da48001bac5c96cda05cc84a42725595b2 | [] | no_license | T941/GTLNmang-2-chieu | 6dab46167c61662ee714ec811db9cf774e085e39 | 22b55c599051b742ea04b9c6646fc2177b19566b | refs/heads/master | 2020-06-29T07:56:43.895084 | 2019-08-04T10:55:50 | 2019-08-04T10:55:50 | 200,479,856 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 951 | java | import java.util.Scanner;
public class maxvalue {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double[][]matrix;
matrix= new double[3][3];
System.out.println("Bat Dau Nhap mang 2 chieu!");
for (int i = 0; i < matrix.length;i++){
for (int j = 0; j<matrix[i].length;j++){
System.out.print("matrix["+i+"]["+j+"]= ");
matrix[i][j] = scanner.nextDouble();
}
}
double max = matrix[0][0];
String position = "("+0+","+0+")";
for(int i = 0; i<matrix.length;i++){
for(int j = 1; j<matrix[i].length;j++){
if(max<matrix[i][j]){
max = matrix[i][j];
position = "("+i+","+j+")";
}
}
}
System.out.println("phan tu nam o vi tri: "+position+" co gia tri "+ max+" la lon nhat");
}
}
| [
"tranquocsang19977@gmail.com"
] | tranquocsang19977@gmail.com |
a431a96581ee86adeb3b3ffc2f014352768befcf | f76b28a0ab4d7a900536a4decbdbd88b6e9b6a64 | /Legends_Prev_Code/src/Armor.java | 7436c469d4f4863e7e7f673b31841380da27b988 | [] | no_license | yuxinli429/611_LegendsValors | 4b8801d3c2b740898a6886514253ccde91ab826e | 5631b5cce7b82925fc816cc848496045b9150b6f | refs/heads/main | 2023-09-06T07:13:40.731697 | 2021-11-22T04:21:14 | 2021-11-22T04:21:14 | 426,364,215 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,256 | java | import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
//Armor class has mapper function to create armor object called from armors class. Implements the use, sell, buy and displayaslist details methods
public class Armor extends MarketInventory implements isUsable{
private int damageProtection;
public int getDamageProtection() {
return damageProtection;
}
public void setDamageProtection(int damageProtection) {
this.damageProtection = damageProtection;
}
@Override
public void use(Hero hero) {
// TODO Auto-generated method stub
hero.setDamageReduction(this.getDamageProtection());
}
//Object mapper used to create object instance using a list prepared from file
public void mapObject(ArrayList<String> armorDetails) {
// TODO Auto-generated method stub
this.setName(armorDetails.get(0));
this.setCost(Float.parseFloat(armorDetails.get(1)));
this.setRequiredLevel(Integer.parseInt(armorDetails.get(2)));
this.setDamageProtection(Integer.parseInt(armorDetails.get(3)));
this.setInventoryType(MarketInventoryType.ARMOR);
}
//interface methods implemented to buy
@Override
public boolean buy(Hero hero) {
// TODO Auto-generated method stub
if(hero.getMoney()>this.getCost() && hero.getGameLevel()>=this.getRequiredLevel()) {
hero.getHeroInventory().getArmorsList().add(this);
float money = hero.getMoney() - this.getCost();
hero.setMoney(money);
return true;
}
else
return false;
}
//interface method implemented to sell
@Override
public boolean sell(Hero hero, int selection) {
// TODO Auto-generated method stub
float money = hero.getMoney() + (this.getCost()/2);
hero.setMoney(money);
System.out.println("You sold a "+hero.getHeroInventory().getArmorsList().get(selection).getName());
return true;
}
//gives the details of armor object as a list
public ArrayList<String> getDetails(){
ArrayList<String> details = new ArrayList<String>();
details.add(this.getName());
DecimalFormat df = new DecimalFormat("#.##");
df.format(this.getCost());
details.add(String.valueOf(this.getCost()));
details.add(String.valueOf(this.getRequiredLevel()));
details.add(String.valueOf(this.getDamageProtection()));
return details;
}
}
| [
"gupsb@nat-wireless-guest-reg-153-50.bu.edu"
] | gupsb@nat-wireless-guest-reg-153-50.bu.edu |
3400744e6b84546e0b243b7913672caa225fec50 | 5dfbf925f6be38533119852f766cf6ef6b4d30bf | /parentproject/module2/src/main/java/jar/HelloController.java | a9bb67e1b98241051a2555e56198c5faccac90b5 | [] | no_license | peddababu/test2 | da0fcbbbd751a4f416224f73ef3bd5b56567f2a2 | 075bc474278ef3b80930ce42ca4bcd1fcc424788 | refs/heads/master | 2021-01-22T00:09:30.469784 | 2018-07-15T05:10:04 | 2018-07-15T05:10:04 | 102,185,282 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,020 | java | package jar;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import org.apache.commons.lang.StringUtils;
public class HelloController
{
@FXML private TextField firstNameField;
@FXML private TextField lastNameField;
@FXML private Label messageLabel;
public void sayHello() {
String firstName = firstNameField.getText();
String lastName = lastNameField.getText();
StringBuilder builder = new StringBuilder();
if (!StringUtils.isEmpty(firstName)) {
builder.append(firstName);
}
if (!StringUtils.isEmpty(lastName)) {
if (builder.length() > 0) {
builder.append(" ");
}
builder.append(lastName);
}
if (builder.length() > 0) {
String name = builder.toString();
messageLabel.setText("Hello " + name);
} else {
messageLabel.setText("Hello mysterious person");
}
}
}
| [
"narrasubbarao413@gmail.com"
] | narrasubbarao413@gmail.com |
7f02afca05d12b6b7e99e99016f3d3e8f1ce2f3e | 24bc4990e9d0bef6a42a6f86dc783785b10dbd42 | /chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/OmniboxPedalDelegate.java | 470b2356e989162bcf310459bd9a89a3202220cc | [
"BSD-3-Clause"
] | permissive | nwjs/chromium.src | 7736ce86a9a0b810449a3b80a4af15de9ef9115d | 454f26d09b2f6204c096b47f778705eab1e3ba46 | refs/heads/nw75 | 2023-08-31T08:01:39.796085 | 2023-04-19T17:25:53 | 2023-04-19T17:25:53 | 50,512,158 | 161 | 201 | BSD-3-Clause | 2023-05-08T03:19:09 | 2016-01-27T14:17:03 | null | UTF-8 | Java | false | false | 970 | java | // Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.omnibox.suggestions;
import androidx.annotation.NonNull;
import org.chromium.chrome.browser.omnibox.suggestions.pedal.PedalViewProperties.PedalIcon;
import org.chromium.components.omnibox.action.OmniboxPedal;
/**
* An interface for handling interactions for Omnibox Pedals and actions.
*/
public interface OmniboxPedalDelegate {
/**
* Call this method when the pedal is clicked.
*
* @param omniboxPedal the {@link OmniboxPedal} whose action we want to execute.
*/
void execute(OmniboxPedal omniboxPedal);
/**
* Call this method to request the pedal's icon.
*
* @param omniboxPedal the {@link OmniboxPedal} whose icon we want.
* @return The icon's information.
*/
@NonNull
PedalIcon getIcon(OmniboxPedal omniboxPedal);
} | [
"roger@nwjs.io"
] | roger@nwjs.io |
c1b6dbea611d075ef698a7bd692dec0c3b11467e | 9fb52e42b200ebb15303ab97c8f14c14869e7302 | /auth-server/src/main/java/com/koehler/authserver/security/SecurityConfig.java | 4f220626caa4655259602f7f7dc8dc2942d27871 | [] | no_license | fabiokoehler/ecommerce-dropshipping | ddc32a3230508db753b3daf94bdb313a85e0a4cf | f07e51aad86877272b27097dc501e35fb4cd8f14 | refs/heads/master | 2020-03-27T19:34:25.940640 | 2018-10-24T01:24:40 | 2018-10-24T01:24:40 | 146,997,981 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,231 | java | package com.koehler.authserver.security;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
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.web.authentication.UsernamePasswordAuthenticationFilter;
import javax.servlet.http.HttpServletResponse;
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private JwtAuthenticationConfig config;
@Bean
public JwtAuthenticationConfig jwtConfig() {
return new JwtAuthenticationConfig();
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication()
.withUser("admin").password("admin").roles("ADMIN", "USER").and()
.withUser("user").password("password").roles("USER");
}
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity
.csrf().disable()
.logout().disable()
.formLogin().disable()
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.anonymous()
.and()
.exceptionHandling().authenticationEntryPoint(
(req, rsp, e) -> rsp.sendError(HttpServletResponse.SC_UNAUTHORIZED))
.and()
.addFilterAfter(new JwtUsernamePasswordAuthenticationFilter(config, authenticationManager()),
UsernamePasswordAuthenticationFilter.class)
.authorizeRequests()
.antMatchers(config.getUrl()).permitAll()
.anyRequest().authenticated();
}
}
| [
"fabiokoehler@gmail.com"
] | fabiokoehler@gmail.com |
209bc9ccc013663c0677ca736b73d0342eaf56f6 | 59ca721ca1b2904fbdee2350cd002e1e5f17bd54 | /aliyun-java-sdk-airec/src/main/java/com/aliyuncs/airec/model/v20181012/DescribeDataSetReportResponse.java | 7a74e763bf19f0a783e93295f48f18eef323cf24 | [
"Apache-2.0"
] | permissive | longtx/aliyun-openapi-java-sdk | 8fadfd08fbcf00c4c5c1d9067cfad20a14e42c9c | 7a9ab9eb99566b9e335465a3358553869563e161 | refs/heads/master | 2020-04-26T02:00:35.360905 | 2019-02-28T13:47:08 | 2019-02-28T13:47:08 | 173,221,745 | 2 | 0 | NOASSERTION | 2019-03-01T02:33:35 | 2019-03-01T02:33:35 | null | UTF-8 | Java | false | false | 6,713 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.aliyuncs.airec.model.v20181012;
import java.util.List;
import java.util.Map;
import com.aliyuncs.AcsResponse;
import com.aliyuncs.airec.transform.v20181012.DescribeDataSetReportResponseUnmarshaller;
import com.aliyuncs.transform.UnmarshallerContext;
/**
* @author auto create
* @version
*/
public class DescribeDataSetReportResponse extends AcsResponse {
private String requestId;
private String code;
private String message;
private Result result;
public String getRequestId() {
return this.requestId;
}
public void setRequestId(String requestId) {
this.requestId = requestId;
}
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
public String getMessage() {
return this.message;
}
public void setMessage(String message) {
this.message = message;
}
public Result getResult() {
return this.result;
}
public void setResult(Result result) {
this.result = result;
}
public static class Result {
private List<DetailItem> detail;
private Overall overall;
public List<DetailItem> getDetail() {
return this.detail;
}
public void setDetail(List<DetailItem> detail) {
this.detail = detail;
}
public Overall getOverall() {
return this.overall;
}
public void setOverall(Overall overall) {
this.overall = overall;
}
public static class DetailItem {
private Long bizDate;
private Long pv;
private Long uv;
private Long click;
private Float ctr;
private Float uvCtr;
private Float perUvBhv;
private Float perUvClick;
private Long clickUser;
private Long activeItem;
public Long getBizDate() {
return this.bizDate;
}
public void setBizDate(Long bizDate) {
this.bizDate = bizDate;
}
public Long getPv() {
return this.pv;
}
public void setPv(Long pv) {
this.pv = pv;
}
public Long getUv() {
return this.uv;
}
public void setUv(Long uv) {
this.uv = uv;
}
public Long getClick() {
return this.click;
}
public void setClick(Long click) {
this.click = click;
}
public Float getCtr() {
return this.ctr;
}
public void setCtr(Float ctr) {
this.ctr = ctr;
}
public Float getUvCtr() {
return this.uvCtr;
}
public void setUvCtr(Float uvCtr) {
this.uvCtr = uvCtr;
}
public Float getPerUvBhv() {
return this.perUvBhv;
}
public void setPerUvBhv(Float perUvBhv) {
this.perUvBhv = perUvBhv;
}
public Float getPerUvClick() {
return this.perUvClick;
}
public void setPerUvClick(Float perUvClick) {
this.perUvClick = perUvClick;
}
public Long getClickUser() {
return this.clickUser;
}
public void setClickUser(Long clickUser) {
this.clickUser = clickUser;
}
public Long getActiveItem() {
return this.activeItem;
}
public void setActiveItem(Long activeItem) {
this.activeItem = activeItem;
}
}
public static class Overall {
private Integer bhvCount;
private Integer itemItemCount;
private Integer userUserCount;
private Float itemRepetitiveRate;
private Float userRepetitiveRate;
private Float userLegalRate;
private Float itemLegalRate;
private Float bhvLegalRate;
private Float userCompleteRate;
private Float itemCompleteRate;
private Float userLoginRate;
private Float itemLoginRate;
public Integer getBhvCount() {
return this.bhvCount;
}
public void setBhvCount(Integer bhvCount) {
this.bhvCount = bhvCount;
}
public Integer getItemItemCount() {
return this.itemItemCount;
}
public void setItemItemCount(Integer itemItemCount) {
this.itemItemCount = itemItemCount;
}
public Integer getUserUserCount() {
return this.userUserCount;
}
public void setUserUserCount(Integer userUserCount) {
this.userUserCount = userUserCount;
}
public Float getItemRepetitiveRate() {
return this.itemRepetitiveRate;
}
public void setItemRepetitiveRate(Float itemRepetitiveRate) {
this.itemRepetitiveRate = itemRepetitiveRate;
}
public Float getUserRepetitiveRate() {
return this.userRepetitiveRate;
}
public void setUserRepetitiveRate(Float userRepetitiveRate) {
this.userRepetitiveRate = userRepetitiveRate;
}
public Float getUserLegalRate() {
return this.userLegalRate;
}
public void setUserLegalRate(Float userLegalRate) {
this.userLegalRate = userLegalRate;
}
public Float getItemLegalRate() {
return this.itemLegalRate;
}
public void setItemLegalRate(Float itemLegalRate) {
this.itemLegalRate = itemLegalRate;
}
public Float getBhvLegalRate() {
return this.bhvLegalRate;
}
public void setBhvLegalRate(Float bhvLegalRate) {
this.bhvLegalRate = bhvLegalRate;
}
public Float getUserCompleteRate() {
return this.userCompleteRate;
}
public void setUserCompleteRate(Float userCompleteRate) {
this.userCompleteRate = userCompleteRate;
}
public Float getItemCompleteRate() {
return this.itemCompleteRate;
}
public void setItemCompleteRate(Float itemCompleteRate) {
this.itemCompleteRate = itemCompleteRate;
}
public Float getUserLoginRate() {
return this.userLoginRate;
}
public void setUserLoginRate(Float userLoginRate) {
this.userLoginRate = userLoginRate;
}
public Float getItemLoginRate() {
return this.itemLoginRate;
}
public void setItemLoginRate(Float itemLoginRate) {
this.itemLoginRate = itemLoginRate;
}
}
}
@Override
public DescribeDataSetReportResponse getInstance(UnmarshallerContext context) {
return DescribeDataSetReportResponseUnmarshaller.unmarshall(this, context);
}
@Override
public boolean checkShowJsonItemName() {
return false;
}
}
| [
"yixiong.jxy@alibaba-inc.com"
] | yixiong.jxy@alibaba-inc.com |
b5ba96aee996013e115e2e61a1154845ac7dd29c | 3c4e6bdb33d54812c27800d805c8cbefb45518d7 | /src/modelo/dto/RecibosDTO.java | 41e88fe0f4353bd5dc06ffea3b9ba08f90cbd6a9 | [] | no_license | marcioalico/JavaMVC | 6314917299335884e27b4e151b5dc101f80af325 | b3cfe79621904f1fc9a47725e2f5af64079922c5 | refs/heads/master | 2020-12-02T07:35:21.211264 | 2019-12-30T15:12:00 | 2019-12-30T15:12:00 | 230,935,853 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 998 | 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 modelo.dto;
/**
*
* @author malico
*/
public class RecibosDTO {
private Long id_documento;
private String medio_de_pago;
private String informacion_adicional;
public RecibosDTO() {
}
public Long getId_documento() {
return id_documento;
}
public String getMedio_de_pago() {
return medio_de_pago;
}
public String getInformacion_adicional() {
return informacion_adicional;
}
public void setId_documento(Long id_documento) {
this.id_documento = id_documento;
}
public void setMedio_de_pago(String medio_de_pago) {
this.medio_de_pago = medio_de_pago;
}
public void setInformacion_adicional(String informacion_adicional) {
this.informacion_adicional = informacion_adicional;
}
}
| [
"marcioalico@gmail.com"
] | marcioalico@gmail.com |
4a82bac2e8a2992d574b7441ef00f42c53c0d734 | 3cc83f15170fc10f6f6b4c7480075f4868de22c1 | /src/main/java/decipher/IllegalNetAddrException.java | a37d63efab0e1f78fb8f26cc08059b0da5e5aed1 | [
"Apache-2.0"
] | permissive | ggupta2005/DecipherNetAddr | 45ce4c10cfebcfe846ebdcc244ba9aebf56c3e9f | 3be259a12fe80e201fed097faf1f7e96efe028cf | refs/heads/master | 2021-05-07T16:52:34.029476 | 2017-10-30T05:16:24 | 2017-10-30T05:16:24 | 108,685,077 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 194 | java | package decipher;
public class IllegalNetAddrException extends Exception
{
IllegalNetAddrException ()
{
//Log a statement saying got a illegal network address from user
}
}
| [
"ggupta2005@gmail.com"
] | ggupta2005@gmail.com |
511e655d50fd83a80b25d2968763f6841fec5ffe | 6666d5d62f2bcdd1caf0b80c875e5f1084a4ff13 | /COUNTS_Phase_III/Server/src/main/java/com/fx/model/CaptionClassificationResult.java | f66066173aa99d3cf7bf1330af55963a26793288 | [] | no_license | BryceTsui/CrowdSourcingPlatform | b2866518a486859392d56120713b77cfa3060ab3 | d516281a8c3a84be4723d09b182d0eef1785dfad | refs/heads/master | 2022-05-26T21:06:06.386588 | 2019-08-27T00:56:27 | 2019-08-27T00:56:27 | 204,538,928 | 2 | 0 | null | 2022-01-15T05:18:35 | 2019-08-26T18:42:33 | Vue | UTF-8 | Java | false | false | 864 | java | package com.fx.model;
import java.util.HashMap;
/**
* Description:
* Created by Hanxinhu at 16:30 2018/5/29/029
*/
public class CaptionClassificationResult {
/**
* 结果对应的文件名
*/
public String filename;
/**
* 关键字+频率
*/
public HashMap<String,Double> result;
public CaptionClassificationResult() {
}
public CaptionClassificationResult(String filename, HashMap<String, Double> result) {
this.filename = filename;
this.result = result;
}
public String getFilename() {
return filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
public HashMap<String, Double> getResult() {
return result;
}
public void setResult(HashMap<String, Double> result) {
this.result = result;
}
}
| [
"1275022549@qq.com"
] | 1275022549@qq.com |
220f0afd9c5e4a9001bfc9437bd4ad6a38a6f63c | 0456545ba66381a0e85915a2e0b939e95dbf99fe | /src/main/java/com/dencode/web/servlet/pages/DateServlet.java | a70a0d16bbd7a16e23bf37b644ce42f12e637995 | [
"Apache-2.0"
] | permissive | amitkr/dencode-web | 75f5fdfc87523e8dce340d49d9182fdf163d6db4 | c3094d483c92e8a7549470d67340a044467bb561 | refs/heads/master | 2020-06-23T20:54:38.815649 | 2019-04-07T05:45:14 | 2019-04-07T05:45:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,402 | java | /*!
* dencode-web
* Copyright 2016 Mozq
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.dencode.web.servlet.pages;
import javax.servlet.annotation.WebServlet;
import com.dencode.web.servlet.AbstractDencodeHttpServlet;
@WebServlet("/date")
public class DateServlet extends AbstractDencodeHttpServlet {
private static final long serialVersionUID = 1L;
@Override
protected void doGet() throws Exception {
reqres().setAttribute("type", "date");
reqres().setAttribute("method", "date.all");
reqres().setAttribute("useOe", false);
reqres().setAttribute("useNl", false);
reqres().setAttribute("useTz", true);
reqres().setAttribute("hasEncoded", true);
reqres().setAttribute("hasDecoded", false);
if (reqres().attribute("currentPath") == null) {
reqres().setAttribute("currentPath", getRequestSubPath(reqres()));
}
forward("/index");
}
}
| [
"git@mozq.net"
] | git@mozq.net |
372518284b0a51cc69e50d99caf14437045d733b | 195a729da089f4c2db088c58bf6fbd0980ae4b73 | /src/com/duiyi/domain/Order.java | c29a640659bd332d481128213139f5de17b50f22 | [
"Apache-2.0"
] | permissive | que2017/Estore | 73e227b6cee6dccb8892c711426cb3ee28948f00 | 4bfa163fb93b3eeb9d65d97028e8743a6a180a9c | refs/heads/master | 2021-05-19T09:54:03.662297 | 2020-05-02T08:33:56 | 2020-05-02T08:33:56 | 251,639,473 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,704 | java | package com.duiyi.domain;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List;
import java.util.Map;
import com.duiyi.utils.JSONUtil;
public class Order implements Serializable {
private String id;
private double money;
private String receiverinfo;
private int paystate;
private Timestamp ordertime;
private int user_id;
private List<OrderItem> list;
private Map<Product, Integer> map;
@Override
public String toString() {
return "\'id\':\'" + id
+ "\',\'money\':\'" + money
+ "\',\'receiverinfo\':\'" + receiverinfo
+ "\',\'paystate\':\'" + paystate
+ "\',\'ordertime\':\'" + ordertime + "\'," + JSONUtil.getCartMapJsonString(map);
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public double getMoney() {
return money;
}
public void setMoney(double money) {
this.money = money;
}
public String getReceiverinfo() {
return receiverinfo;
}
public void setReceiverinfo(String receiverinfo) {
this.receiverinfo = receiverinfo;
}
public int getPaystate() {
return paystate;
}
public void setPaystate(int paystate) {
this.paystate = paystate;
}
public Timestamp getOrdertime() {
return ordertime;
}
public void setOrdertime(Timestamp ordertime) {
this.ordertime = ordertime;
}
public int getUser_id() {
return user_id;
}
public void setUser_id(int user_id) {
this.user_id = user_id;
}
public List<OrderItem> getList() {
return list;
}
public void setList(List<OrderItem> list) {
this.list = list;
}
public Map<Product, Integer> getMap() {
return map;
}
public void setMap(Map<Product, Integer> map) {
this.map = map;
}
}
| [
"1563645183@qq.com"
] | 1563645183@qq.com |
242063df80296645f9542ba6a3b0f1efb3308069 | 10d7a7bd65d1c24da1d309ac503a3da2fb579865 | /src/main/java/org/bedrockmc/api/mod/java/JavaMod.java | b940aad269a757a8acc1802df01dbe10266408e3 | [] | no_license | lukalt/BedrockAPI | 95ae5362f0c92e4a3a78fb15673a6b36de9ca1f8 | d1eb5b83eefa60778ee8c811d52ca0e145f4bdd4 | refs/heads/master | 2021-05-29T21:35:15.594526 | 2015-10-05T12:08:47 | 2015-10-05T12:08:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,190 | java | package org.bedrockmc.api.mod.java;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.bedrockmc.api.Client;
import org.bedrockmc.api.config.Config;
import org.bedrockmc.api.config.PropertiesConfig;
import org.bedrockmc.api.mod.Mod;
import org.bedrockmc.api.mod.ModDescriptionFile;
import org.bedrockmc.api.mod.ModIcon;
import org.bedrockmc.api.overlay.Overlay;
public abstract class JavaMod implements Mod {
private boolean enabled = false;
private Client client;
private ModDescriptionFile modDescriptionFile;
private File file;
private List<Overlay> overlays = new ArrayList<Overlay>();
private ModIcon icon;
private File dataFolder;
private Config config;
public JavaMod(Client client, ModDescriptionFile modDescriptionFile) {
super();
this.client = client;
this.modDescriptionFile = modDescriptionFile;
this.dataFolder = new File("bedrock-mods", this.modDescriptionFile.getName());
if(!this.dataFolder.exists()) {
this.dataFolder.mkdir();
}
File configFile = new File(this.dataFolder, "config.properties");
if(configFile.exists()) {
try {
this.config = PropertiesConfig.loadFromFile(configFile);
}catch(IOException ex) {
System.out.println("Could not load config of mod " + this.modDescriptionFile.getName());
ex.printStackTrace();
}
}else {
try {
configFile.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
}
@Override
public ModIcon getIcon() {
return this.icon;
}
void setModIcon(ModIcon icon) {
this.icon = icon;
}
@Override
public void onLoad() {
System.out.println("[" + getDescription().getName()
+ "] Loading version " + getDescription().getVersion() + " by "
+ getDescription().getAuthor());
}
@Override
public String getName() {
return this.getDescription().getName();
}
@Override
public void onDisable() {
System.out.println("[" + getDescription().getName() + "] Disabling...");
}
@Override
public void onEnable() {
System.out.println("[" + getDescription().getName()
+ "] Enabling version " + getDescription().getVersion()
+ " by " + getDescription().getAuthor());
}
public File getFile() {
return this.file;
}
@Override
public ModDescriptionFile getDescription() {
return this.modDescriptionFile;
}
@Override
public boolean isEnabled() {
return this.enabled;
}
@Override
public Client getClient() {
return client;
}
protected void setEnabled(boolean flag) {
this.enabled = flag;
}
void setFile(File file) {
this.file = file;
}
@Override
public List<Overlay> getOverlays() {
return this.overlays;
}
public void addOverlay(Overlay o) {
overlays.add(o);
}
public void removeOverlay(Overlay o) {
overlays.remove(o);
}
@Override
public Config getConfig() {
return this.config;
}
@Override
public void saveConfig() throws IOException {
this.config.save(new File(this.dataFolder, "config.properties"));
}
@Override
public void reloadConfig() throws IOException {
throw new IllegalStateException("Not implemented yet.");
}
@Override
public File getDataFolder() {
return this.dataFolder;
}
}
| [
"lukas81298@gmail.com"
] | lukas81298@gmail.com |
8754eac77910a0aa02ef09767817e4b4b79eee2b | e3162d976b3a665717b9a75c503281e501ec1b1a | /src/main/java/com/alipay/api/domain/AlipayCommerceIotDapplyOrderdeviceQueryModel.java | 1cc71cf7ae7dec6a97fdee5b72c96aab6ca83cd9 | [
"Apache-2.0"
] | permissive | sunandy3/alipay-sdk-java-all | 16b14f3729864d74846585796a28d858c40decf8 | 30e6af80cffc0d2392133457925dc5e9ee44cbac | refs/heads/master | 2020-07-30T14:07:34.040692 | 2019-09-20T09:35:20 | 2019-09-20T09:35:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 672 | java | package com.alipay.api.domain;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
/**
* 蚂蚁iot进件申请单关联设备查询接口
*
* @author auto create
* @since 1.0, 2019-08-21 12:16:29
*/
public class AlipayCommerceIotDapplyOrderdeviceQueryModel extends AlipayObject {
private static final long serialVersionUID = 5145226783848493515L;
/**
* 进件申请单号
*/
@ApiField("apply_order_id")
private String applyOrderId;
public String getApplyOrderId() {
return this.applyOrderId;
}
public void setApplyOrderId(String applyOrderId) {
this.applyOrderId = applyOrderId;
}
}
| [
"ben.zy@antfin.com"
] | ben.zy@antfin.com |
5547d4817a19fa822e3f4c6621b89b5d7ec4db2d | e21efb5e6b4b8e5ade3c6b916570f7927b40e620 | /app/src/main/java/com/wichacks2020/onehunt/view/LoginActivity.java | 493b12094289437017e63068a2e4720fb270c1f1 | [] | no_license | carolina-brager/OneHunt | e8ed5999592cecdd8d59960aa010c89c7b64d1c3 | 6ed18a2db5c7f7166d30b37b50c9e5a082dfd823 | refs/heads/master | 2021-02-07T15:58:18.715776 | 2020-02-29T21:59:13 | 2020-02-29T21:59:13 | 244,047,678 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,747 | java | package com.wichacks2020.onehunt.view;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.wichacks2020.onehunt.R;
public class LoginActivity extends AppCompatActivity {
EditText mUsername, mPassword;
Button btnLogin;
TextView tvRegister;
FirebaseAuth mFireBaseAuth;
private FirebaseAuth.AuthStateListener mAuthStateListener;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
mFireBaseAuth = FirebaseAuth.getInstance();
mUsername = findViewById(R.id.username);
mPassword = findViewById(R.id.password);
btnLogin = findViewById(R.id.login);
tvRegister = findViewById(R.id.register);
mAuthStateListener = new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
FirebaseUser mFirebaseUser = mFireBaseAuth.getCurrentUser();
if(mFirebaseUser != null){
Toast.makeText(LoginActivity.this, "You are logged in", Toast.LENGTH_SHORT).show();
Intent i = new Intent(LoginActivity.this, MainActivity.class);
startActivity(i);
}
else{
Toast.makeText(LoginActivity.this, "Please log in", Toast.LENGTH_SHORT).show();
}
}
};
btnLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String username = mUsername.getText().toString();
String password = mPassword.getText().toString();
if(username.isEmpty()){
mUsername.setError("Please enter your username");
mUsername.requestFocus();
}
else if(password.isEmpty()){
mPassword.setError("Please enter your password");
mPassword.requestFocus();
}
else{
mFireBaseAuth.signInWithEmailAndPassword(username, password).addOnCompleteListener(LoginActivity.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if(!task.isSuccessful()){
Toast.makeText(LoginActivity.this, "Login unsuccessful, try again", Toast.LENGTH_SHORT).show();
}
else{
startActivity(new Intent(LoginActivity.this, MainActivity.class));
}
}
});
}
}
});
tvRegister.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(LoginActivity.this, SignUpActivity.class));
}
});
}
@Override
protected void onStart() {
super.onStart();
mFireBaseAuth.addAuthStateListener(mAuthStateListener);
}
}
| [
"carolina.brager@gmail.com"
] | carolina.brager@gmail.com |
827e499354af8854c853621b8289f6511f7c4a2d | b2a7b3018daa5265766071b7175f7f2828be645e | /baseLib/src/main/java/midian/baselib/tooglebutton/ToggleButton.java | 2ce4deb426d8baf8601af2361173c6faa196437d | [] | no_license | StormFeng/moma | 447a827534c1b61a738a586a435b28049de6c6a5 | 999415d31b15f4473779df3dad98e5d240279992 | refs/heads/master | 2020-06-14T15:57:18.910915 | 2016-12-12T03:57:11 | 2016-12-12T03:57:11 | 75,162,987 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,068 | java | package midian.baselib.tooglebutton;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Cap;
import android.graphics.Paint.Style;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;
import com.midian.baselib.R;
/**
* @author ThinkPad
*
*/
public class ToggleButton extends View {
private SpringSystem springSystem;
private Spring spring;
/** */
private float radius;
/** 开启颜色 */
private int onColor = Color.parseColor("#4CD864");
/** 关闭颜色 */
private int offBorderColor = Color.parseColor("#dadbda");
/** 灰色带颜色 */
private int offColor = Color.parseColor("#ffffff");
/** 手柄颜色 */
private int spotColor = Color.parseColor("#ffffff");
/** 边框颜色 */
private int borderColor = offBorderColor;
/** 画笔 */
private Paint paint;
/** 开关状态 */
private boolean toggleOn = false;
/** 边框大小 */
private int borderWidth = 2;
/** 垂直中心 */
private float centerY;
/** 按钮的开始和结束位置 */
private float startX, endX;
/** 手柄X位置的最小和最大值 */
private float spotMinX, spotMaxX;
/** 手柄大小 */
private int spotSize;
/** 手柄X位置 */
private float spotX;
/** 关闭时内部灰色带高度 */
private float offLineWidth;
/** */
private RectF rect = new RectF();
private OnToggleChanged listener;
private ToggleButton(Context context) {
super(context);
}
public ToggleButton(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
setup(attrs);
}
public ToggleButton(Context context, AttributeSet attrs) {
super(context, attrs);
setup(attrs);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
spring.removeListener(springListener);
}
public void onAttachedToWindow() {
super.onAttachedToWindow();
spring.addListener(springListener);
}
public void setup(AttributeSet attrs) {
paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setStyle(Style.FILL);
paint.setStrokeCap(Cap.ROUND);
springSystem = SpringSystem.create();
spring = springSystem.createSpring();
spring.setSpringConfig(SpringConfig.fromOrigamiTensionAndFriction(50, 7));
this.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
toggle();
}
});
TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.ToggleButton);
offBorderColor = typedArray.getColor(R.styleable.ToggleButton_offBorderColor, offBorderColor);
onColor = typedArray.getColor(R.styleable.ToggleButton_onColor, onColor);
spotColor = typedArray.getColor(R.styleable.ToggleButton_spotColor, spotColor);
offColor = typedArray.getColor(R.styleable.ToggleButton_offColor, offColor);
borderWidth = typedArray.getDimensionPixelSize(R.styleable.ToggleButton_bordersWidth, borderWidth);
typedArray.recycle();
}
public void toggle() {
toggleOn = !toggleOn;
spring.setEndValue(toggleOn ? 1 : 0);
if (listener != null) {
listener.onToggle(toggleOn);
}
}
public void toggleOn() {
setToggleOn();
if (listener != null) {
listener.onToggle(toggleOn);
}
}
public void toggleOff() {
setToggleOff();
if (listener != null) {
listener.onToggle(toggleOn);
}
}
/**
* 设置显示成打开样式,不会触发toggle事件
*/
public void setToggleOn() {
toggleOn = true;
spring.setEndValue(toggleOn ? 1 : 0);
}
/**
* 设置显示成关闭样式,不会触发toggle事件
*/
public void setToggleOff() {
toggleOn = false;
spring.setEndValue(toggleOn ? 1 : 0);
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
final int width = getWidth();
final int height = getHeight();
radius = Math.min(width, height) * 0.5f;
centerY = radius;
startX = radius;
endX = width - radius;
spotMinX = startX + borderWidth;
spotMaxX = endX - borderWidth;
spotSize = height - 4 * borderWidth;
spotX = spotMinX;
offLineWidth = 0;
}
SimpleSpringListener springListener = new SimpleSpringListener() {
@Override
public void onSpringUpdate(Spring spring) {
final double value = spring.getCurrentValue();
final float mapToggleX = (float) SpringUtil.mapValueFromRangeToRange(value, 0, 1, spotMinX, spotMaxX);
spotX = mapToggleX;
float mapOffLineWidth = (float) SpringUtil.mapValueFromRangeToRange(1 - value, 0, 1, 10, spotSize);
offLineWidth = mapOffLineWidth;
final int fb = Color.blue(onColor);
final int fr = Color.red(onColor);
final int fg = Color.green(onColor);
final int tb = Color.blue(offBorderColor);
final int tr = Color.red(offBorderColor);
final int tg = Color.green(offBorderColor);
int sb = (int) SpringUtil.mapValueFromRangeToRange(1 - value, 0, 1, fb, tb);
int sr = (int) SpringUtil.mapValueFromRangeToRange(1 - value, 0, 1, fr, tr);
int sg = (int) SpringUtil.mapValueFromRangeToRange(1 - value, 0, 1, fg, tg);
sb = SpringUtil.clamp(sb, 0, 255);
sr = SpringUtil.clamp(sr, 0, 255);
sg = SpringUtil.clamp(sg, 0, 255);
borderColor = Color.rgb(sr, sg, sb);
postInvalidate();
}
};
@Override
public void draw(Canvas canvas) {
/*
* final int height = getHeight(); //绘制背景(边框)
* paint.setStrokeWidth(height); paint.setColor(borderColor);
* canvas.drawLine(startX, centerY, endX, centerY, paint); //绘制灰色带
* if(offLineWidth > 0){ paint.setStrokeWidth(offLineWidth);
* paint.setColor(offColor); canvas.drawLine(spotX, centerY, endX,
* centerY, paint); } //spot的边框 paint.setStrokeWidth(height);
* paint.setColor(borderColor); canvas.drawLine(spotX - 1, centerY,
* spotX + 1.1f, centerY, paint); //spot paint.setStrokeWidth(spotSize);
* paint.setColor(spotColor); canvas.drawLine(spotX, centerY, spotX +
* 0.1f, centerY, paint);
*/
//
rect.set(0, 0, getWidth(), getHeight());
paint.setColor(borderColor);
canvas.drawRoundRect(rect, radius, radius, paint);
if (offLineWidth > 0) {
final float cy = offLineWidth * 0.5f;
rect.set(spotX - cy, centerY - cy, endX + cy, centerY + cy);
paint.setColor(offColor);
canvas.drawRoundRect(rect, cy, cy, paint);
}
rect.set(spotX - 1 - radius, centerY - radius, spotX + 1.1f + radius, centerY + radius);
paint.setColor(borderColor);
canvas.drawRoundRect(rect, radius, radius, paint);
final float spotR = spotSize * 0.5f;
rect.set(spotX - spotR, centerY - spotR, spotX + spotR, centerY + spotR);
paint.setColor(spotColor);
canvas.drawRoundRect(rect, spotR, spotR, paint);
}
/**
* @author ThinkPad
*
*/
public interface OnToggleChanged {
/**
* @param on
*/
public void onToggle(boolean on);
}
public void setOnToggleChanged(OnToggleChanged onToggleChanged) {
listener = onToggleChanged;
}
public boolean isToggleOn() {
return toggleOn;
}
}
| [
"1170017470@qq.com"
] | 1170017470@qq.com |
b8dfc31d901995b811a9253f7e915fe823569412 | 6839e7abfa2e354becd034ea46f14db3cbcc7488 | /src/com/sinosoft/schema/ZDBranchSet.java | 812725504b64bfbbabb82e6d9f59f4bfbca321b9 | [] | no_license | trigrass2/wj | aa2d310baa876f9e32a65238bcd36e7a2440b8c6 | 0d4da9d033c6fa2edb014e3a80715c9751a93cd5 | refs/heads/master | 2021-04-19T11:03:25.609807 | 2018-01-12T09:26:11 | 2018-01-12T09:26:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,291 | java | package com.sinosoft.schema;
import com.sinosoft.schema.ZDBranchSchema;
import com.sinosoft.framework.orm.SchemaSet;
public class ZDBranchSet extends SchemaSet {
public ZDBranchSet() {
this(10,0);
}
public ZDBranchSet(int initialCapacity) {
this(initialCapacity,0);
}
public ZDBranchSet(int initialCapacity,int capacityIncrement) {
super(initialCapacity,capacityIncrement);
TableCode = ZDBranchSchema._TableCode;
Columns = ZDBranchSchema._Columns;
NameSpace = ZDBranchSchema._NameSpace;
InsertAllSQL = ZDBranchSchema._InsertAllSQL;
UpdateAllSQL = ZDBranchSchema._UpdateAllSQL;
FillAllSQL = ZDBranchSchema._FillAllSQL;
DeleteSQL = ZDBranchSchema._DeleteSQL;
}
protected SchemaSet newInstance(){
return new ZDBranchSet();
}
public boolean add(ZDBranchSchema aSchema) {
return super.add(aSchema);
}
public boolean add(ZDBranchSet aSet) {
return super.add(aSet);
}
public boolean remove(ZDBranchSchema aSchema) {
return super.remove(aSchema);
}
public ZDBranchSchema get(int index) {
ZDBranchSchema tSchema = (ZDBranchSchema) super.getObject(index);
return tSchema;
}
public boolean set(int index, ZDBranchSchema aSchema) {
return super.set(index, aSchema);
}
public boolean set(ZDBranchSet aSet) {
return super.set(aSet);
}
}
| [
"liyinfeng0520@163.com"
] | liyinfeng0520@163.com |
1cd71ce1aadb6eacbf6767bf32e1125ec868082d | 80dd48bfb2c7e5552530ac0fe20f2d15a60a1c0b | /kostenstellen/model/visitor/TransFacdeCommandReturnVisitor.java | fb0cf71aa13c7664d7dda5f9af8fb76fc5692e58 | [] | no_license | AlineLa/kostenstellen | 7d8353d7c4f5241ec5239b878dac6637f65a5c74 | 128d8abb1648829f2588afb254f9f59e79bad697 | refs/heads/master | 2021-01-24T22:52:07.969724 | 2014-11-11T11:40:44 | 2014-11-11T11:40:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 250 | java |
package model.visitor;
import persistence.*;
public interface TransFacdeCommandReturnVisitor<R> {
public R handleErzeugeTransaktionCommand(PersistentErzeugeTransaktionCommand erzeugeTransaktionCommand) throws PersistenceException;
}
| [
"zappdidappdi+4@gmail.com"
] | zappdidappdi+4@gmail.com |
3a4e9d24fe1cd52e4f424f722ecfa8488a501958 | 0bc110449e22677fa4b02928c9d0f03feae6ed51 | /todolist/student/java/todolist-server/src/main/java/com/drewmorrison/todolist/dao/JdbcTaskDao.java | 8b29b9bc482560754f93bcdde5df3dda227cdda2 | [] | no_license | drewdmorrison/todo-list | 13bd806c8fd5b162b5861ac3118af0ebeee8026e | 7db29ce59708749b9b35bccf31b11defe060208f | refs/heads/main | 2023-07-13T05:12:15.296773 | 2021-09-01T20:48:42 | 2021-09-01T20:48:42 | 400,636,234 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,200 | java | package com.drewmorrison.todolist.dao;
import com.drewmorrison.todolist.model.Account;
import com.drewmorrison.todolist.model.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.support.rowset.SqlRowSet;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Component
public class JdbcTaskDao implements TaskDao {
@Autowired
private JdbcTemplate jdbcTemplate;
@Autowired
private UserDao userDao;
@Autowired
private TaskDao taskDao;
@Override
public int getTasksLeft(int userId) {
int tasksLeft = 0;
String sql = "SELECT task_count FROM accounts WHERE user_id = ?;";
SqlRowSet results = jdbcTemplate.queryForRowSet(sql, userId);
if (results.next()) {
tasksLeft = results.getInt("task_count");
}
return tasksLeft;
}
@Override
public List<Task> getAllTasks(int userId) {
List<Task> tasks = new ArrayList<>();
String sql = "SELECT * FROM tasks " +
"JOIN accounts ON tasks.account_id = accounts.account_id " +
"JOIN users u ON accounts.user_id = u.user_id " +
"WHERE u.user_id = ?;";
SqlRowSet results = jdbcTemplate.queryForRowSet(sql, userId);
while (results.next()) {
Task task = mapRowToTask(results);
tasks.add(task);
}
return tasks;
}
@Override
public Task getTaskById(int taskId) {
Task task = new Task();
String sql = "SELECT t.*, ts.task_status_desc " +
"FROM tasks t " +
"JOIN accounts a ON t.account_id = a.account_id " +
"JOIN task_statuses ts ON t.task_status_id = ts.task_status_id " +
"WHERE t.task_id = ?;";
SqlRowSet results = jdbcTemplate.queryForRowSet(sql, taskId);
if (results.next()) {
task = mapRowToTask(results);
}
return task;
}
@Override
public String addTask(String taskName, String taskDescription, Date dueDate, int userId) {
int accountId = getAccountByUserId(userId).getAccountId();
try {
String sql = "INSERT INTO tasks(task_name, task_desc, due_date, task_status_id, account_id) " +
"VALUES(?, ?, ?, 1, ?);";
jdbcTemplate.update(sql, taskName, taskDescription, dueDate, accountId);
} catch (Exception ex) {
return "**** Error. Failed to add task. ****";
}
addToTasksRemaining(userId);
return "Task Added";
}
@Override
public String updateTask(Task task, int taskStatusId) {
if (taskStatusId == 2) {
String sql = "UPDATE tasks SET task_status_id = ? WHERE task_id = ?;";
jdbcTemplate.update(sql, taskStatusId, task.getTaskId());
return "Task Updated";
} else {
return "Task Failed to Update";
}
}
@Override
public Account getAccountByUserId (int userId) {
Account account = null;
String sql = "SELECT * from accounts WHERE user_id = ?;";
SqlRowSet results = jdbcTemplate.queryForRowSet(sql, userId);
if (results.next()) {
account = mapRowToAccount(results);
}
return account;
}
@Override
public int addToTasksRemaining(int userId) {
Account account = getAccountByUserId(userId);
int updatedTasksRemaining = account.getTaskCount() + 1;
String sql = "UPDATE accounts SET task_count = ? WHERE account_id = ?;";
jdbcTemplate.update(sql, updatedTasksRemaining, account.getAccountId());
return account.getTaskCount();
}
@Override
public int removeFromTasksRemaining(int userId) {
Account account = getAccountByUserId(userId);
int updatedTasksRemaining = account.getTaskCount() - 1;
String sql = "UPDATE accounts SET task_count = ? WHERE account_id = ?;";
jdbcTemplate.update(sql, updatedTasksRemaining, account.getAccountId());
return account.getTaskCount();
}
public Task mapRowToTask(SqlRowSet results) {
Task task = new Task();
task.setTaskId(results.getInt("task_id"));
task.setTaskName(results.getString("task_name"));
task.setTaskDescription(results.getString("task_desc"));
task.setDueDate(results.getDate("due_date"));
task.setTaskStatusId(results.getInt("task_status_id"));
task.setAccountId(results.getInt("account_id"));
try {
task.setTaskStatusDesc(results.getString("task_status_desc"));
} catch (Exception ex) {}
return task;
}
private Account mapRowToAccount(SqlRowSet results) {
Account account = new Account();
account.setAccountId(results.getInt("account_id"));
account.setUserId(results.getInt("user_id"));
account.setTaskCount(results.getInt("task_count"));
return account;
}
}
| [
"drewdmorrison@gmail.com"
] | drewdmorrison@gmail.com |
956b478b7376dd3f5381f70c2ff868a2b656a699 | 19f7e40c448029530d191a262e5215571382bf9f | /decompiled/instagram/sources/p000X/C019200e.java | b7e887ee5a08b16a2f1a65baca1a11f80e0c87f1 | [] | no_license | stanvanrooy/decompiled-instagram | c1fb553c52e98fd82784a3a8a17abab43b0f52eb | 3091a40af7accf6c0a80b9dda608471d503c4d78 | refs/heads/master | 2022-12-07T22:31:43.155086 | 2020-08-26T03:42:04 | 2020-08-26T03:42:04 | 283,347,288 | 18 | 1 | null | null | null | null | UTF-8 | Java | false | false | 480 | java | package p000X;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.fragment.app.FragmentManagerState;
/* renamed from: X.00e reason: invalid class name and case insensitive filesystem */
public final class C019200e implements Parcelable.Creator {
public final Object createFromParcel(Parcel parcel) {
return new FragmentManagerState(parcel);
}
public final Object[] newArray(int i) {
return new FragmentManagerState[i];
}
}
| [
"stan@rooy.works"
] | stan@rooy.works |
019417d1989c4ce8ee987fc0ee21358b5eabe7e2 | ad030d2c8d6cd3763c0746cab08d7a5f0edc37bc | /src/main/java/com/reporthelper/bo/pair/IdNamePair.java | 6d4003c485d422d8c6ba5b0411a834e915f3ac90 | [] | no_license | fucora/report-helper | 217e6e0b754c7abbac371a3f5bbeac5324e836a2 | 113e304850343129d6e046eaaabcb0c065f44bbc | refs/heads/master | 2021-04-04T13:12:01.705298 | 2019-12-19T08:53:09 | 2019-12-19T08:53:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 843 | java | package com.reporthelper.bo.pair;
/**
* @author tomdeng
*/
public class IdNamePair {
private String id;
private String name;
private boolean selected;
public IdNamePair() {
}
public IdNamePair(String id, String name) {
this.id = id;
this.name = name;
}
public IdNamePair(String id, String name, boolean selected) {
this(id, name);
this.selected = selected;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public boolean isSelected() {
return this.selected;
}
public void setSelected(boolean selected) {
this.selected = selected;
}
}
| [
"1184010176@qq.com"
] | 1184010176@qq.com |
864e1743959fb401b9f771ddab84bf121ac648ba | 1ce520272ff3a4da79573b9a7fbb629ef38aa714 | /BillerWeb/src/com/dtac/billerweb/form/BW2130Form.java | e0dff717fc1b23623cd3ff37d81b5e0cfcc4524a | [] | no_license | pannisai/Menh | c8db84313a0d049e66ca232cfe66b925c518940c | 14d63aeead0c2aba3bea0b10674a47d09a1ee324 | refs/heads/master | 2021-01-21T13:33:59.530798 | 2016-05-25T08:44:53 | 2016-05-25T08:44:53 | 53,564,056 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,466 | java | package com.dtac.billerweb.form;
import java.util.Date;
import mfs.biller.persistence.bean.OBJGW_INBOUND;
import mfs.biller.persistence.bean.ObjMapGWxml;
import com.dtac.billerweb.common.BaseForm;
public class BW2130Form extends BaseForm{
/**
*
*/
private static final long serialVersionUID = 9182339891433019777L;
private Integer mapId;
private String mapName;
private String mapDesc;
private String mapXmlData;
public ObjMapGWxml toMapGWXml() {
ObjMapGWxml mapGwXml = new ObjMapGWxml();
mapGwXml.setDATA_MAP_ID(this.mapId);
mapGwXml.setXML_DATA_TYPE(this.mapName);
mapGwXml.setXML_DATA_DESC(this.mapDesc);
mapGwXml.setXML_DATA_SRC(this.mapXmlData);
return mapGwXml;
}
public BW2130Form toBW2130Form(ObjMapGWxml mapGwXml) {
this.mapId = mapGwXml.getDATA_MAP_ID();
this.mapName = mapGwXml.getXML_DATA_TYPE();
this.mapDesc = mapGwXml.getXML_DATA_DESC();
this.mapXmlData = mapGwXml.getXML_DATA_SRC();
return this;
}
public Integer getMapId() {
return mapId;
}
public void setMapId(Integer mapId) {
this.mapId = mapId;
}
public String getMapName() {
return mapName;
}
public void setMapName(String mapName) {
this.mapName = mapName;
}
public String getMapDesc() {
return mapDesc;
}
public void setMapDesc(String mapDesc) {
this.mapDesc = mapDesc;
}
public String getMapXmlData() {
return mapXmlData;
}
public void setMapXmlData(String mapXmlData) {
this.mapXmlData = mapXmlData;
}
}
| [
"Supakorn@chain"
] | Supakorn@chain |
eecdbb9a90e99ec40857d0967a7bcdd3929c053b | 2fcc8e199dc2212c45fedb8134b29285a3333e39 | /swf-debugger/src/main/java/com/nextgenactionscript/vscode/CustomRuntimeLauncher.java | 84110b3a795b1d21f226e908a59fe1f0a890efaf | [
"MIT",
"Apache-2.0"
] | permissive | touchX/vscode-nextgenas | 0200cbd6e5aec8ec26a7a3f5d53de6102fb917ac | 4e85ee75e405257a0637f1c11a4d5d733f91c0ee | refs/heads/master | 2021-01-20T22:22:23.824300 | 2017-08-29T22:45:29 | 2017-08-29T22:45:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,466 | java | /*
Copyright 2016-2017 Bowler Hat LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package com.nextgenactionscript.vscode;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import flash.tools.debugger.ILauncher;
/**
* If the "launch" command includes runtimeExecutable and (optionally)
* runtimeArgs fields, we need to launch the SWF runtime manually instead of
* letting the debugger do it automatically.
*/
public class CustomRuntimeLauncher implements ILauncher
{
private static final String EXTENSION_APP = ".app";
private String runtimeExecutable;
private String[] runtimeArgs;
public boolean isAIR = false;
public CustomRuntimeLauncher(String runtimeExecutablePath)
{
this(runtimeExecutablePath, null);
}
public CustomRuntimeLauncher(String runtimeExecutable, String[] runtimeArgs)
{
if (runtimeExecutable.endsWith(EXTENSION_APP))
{
//for convenience, we'll automatically dig into .app packages on
//macOS to find the real executable. easier than documenting the
//whole "Show Package Contents" thing in Finder.
Path directoryPath = Paths.get(runtimeExecutable).resolve("./Contents/MacOS");
File directory = directoryPath.toFile();
if (directory.exists() && directory.isDirectory())
{
File[] files = directory.listFiles();
if (files.length > 0)
{
runtimeExecutable = files[0].getAbsolutePath();
}
}
}
this.runtimeExecutable = runtimeExecutable;
this.runtimeArgs = runtimeArgs;
}
public Process launch(String[] cmd) throws IOException
{
int baseCount = cmd.length;
if (!isAIR)
{
//for some reason, the debugger always includes the path to ADL in
//the launch arguments for a custom launcher, but not to Flash
//Player. we need to account for this difference in length.
baseCount++;
}
int extraCount = 0;
if (runtimeArgs != null)
{
extraCount = runtimeArgs.length;
}
String[] finalArgs = new String[baseCount + extraCount];
finalArgs[0] = runtimeExecutable;
if (isAIR)
{
//as noted above, we ignore the debugger's incorrect path to ADL
//and start copying from index 1 instead of 0.
System.arraycopy(cmd, 1, finalArgs, 1, cmd.length - 1);
}
else
{
System.arraycopy(cmd, 0, finalArgs, 1, cmd.length);
}
if (runtimeArgs != null)
{
System.arraycopy(runtimeArgs, 0, finalArgs, baseCount, runtimeArgs.length);
}
return Runtime.getRuntime().exec(finalArgs);
}
public void terminate(Process process) throws IOException
{
process.destroy();
}
}
| [
"joshtynjala@gmail.com"
] | joshtynjala@gmail.com |
4cfd9d5d12a2dd33ee8dea2962935913c7755e60 | 45c1a2cbe370abf262967a5db6bb603035b2e681 | /src/Note/iosystem/CopyFileByChar.java | d29d876d1dad826ac8366ab6de078e658bb9124f | [] | no_license | 520MianXiangDuiXiang520/JAVA | 7a57e7afd1f2e37abab45fc2d52f085ceb0e74fa | 8d5fa160a54b209111765130c5c4889308899d7a | refs/heads/master | 2020-08-06T19:41:14.076096 | 2020-04-13T09:16:30 | 2020-04-13T09:16:30 | 213,127,859 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,053 | java | package Note.iosystem;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class CopyFileByChar {
private String sourcePath, targetPath;
CopyFileByChar (String source, String target) {
sourcePath = source;
targetPath = target;
}
public void copy() throws IOException {
FileReader fr = new FileReader(this.sourcePath);
FileWriter fw = new FileWriter(this.targetPath, true);
int readResult = 0;
char [] chars = new char[1024];
while(readResult >= 0) {
readResult = fr.read(chars);
if(readResult > 0){
fw.write(chars, 0, readResult);
}
}
fr.close();
fw.close();
}
public static void main(String[] args) throws IOException {
CopyFileByChar copyFileByChar = new CopyFileByChar("./src/Note/iosystem/DirList.java",
"./src/Note/iosystem/DirListCopyByChar.txt");
copyFileByChar.copy();
}
}
| [
"15364968962@163.com"
] | 15364968962@163.com |
fcd73879455b8bd4887f36e33ebf1258207d2af0 | 6b3a781d420c88a3a5129638073be7d71d100106 | /AdProxyPersist/src/main/java/com/ocean/persist/app/dis/yrcpd/pkgsearch/YouranPkgSearchApp.java | 8edd432946784e553c668ec94abfc6e6fb1defa5 | [] | no_license | Arthas-sketch/FrexMonitor | 02302e8f7be1a68895b9179fb3b30537a6d663bd | 125f61fcc92f20ce948057a9345432a85fe2b15b | refs/heads/master | 2021-10-26T15:05:59.996640 | 2019-04-13T07:52:57 | 2019-04-13T07:52:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,243 | java | package com.ocean.persist.app.dis.yrcpd.pkgsearch;
import com.ocean.persist.app.dis.yrcpd.YouranAppInfo;
public class YouranPkgSearchApp extends YouranAppInfo{
private String channel ;//渠道号 上报时将该参数带上
//packageName 应用包名
private String downloadUrl ;//下载地址
private String price ;//价格
//private String title;// 应用的名称
private String tagline ;//应用的副标题
private String icons ;//应用的图标
private String installedCount;// 安装量
private String installedCountStr;// 安装量的文字表示
private String downloadCount ;//下载量
private String downloadCountStr;//;// 下载量的文字表示
private String categories ;//应用所属的分类
private String tags;// 应用的标签
private String screenshots ;//应用的截图
private String description ;//应用的描述信息
private String changelog ;//应用版本更新日志
private String developer ;//开发者信息
private String likesRate ;//好评率
private String bytes ;//文件大小
//versionCode 版本号
//versionName 版本名称
private String signatrue ;//该APK包的签名
//md5 APK的MD5校验值
private String pubKeySignature ;//RSA签名中公钥的md5值
private String minSdkVersion ;//支持的最小版本的android api level
private String adsType ;//有无广告
private String paidType ;//有无付费
private String permissions ;//该APK需要的权限
private String securityStatus ;//有无病毒
private String official ;//是否是官方应用
private String language ;//语言
private String publishDate ;//发布日志
private String creation;// 创建时间,即最新的APK的发布时间
private String sequence ;//序列号,请求返回的唯一标识 上报时将该参数带上
private String appId ;//应用ID
private String apkId ;//应用安装包ID
public String getChannel() {
return channel;
}
public void setChannel(String channel) {
this.channel = channel;
}
public String getDownloadUrl() {
return downloadUrl;
}
public void setDownloadUrl(String downloadUrl) {
this.downloadUrl = downloadUrl;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
public String getTagline() {
return tagline;
}
public void setTagline(String tagline) {
this.tagline = tagline;
}
public String getIcons() {
return icons;
}
public void setIcons(String icons) {
this.icons = icons;
}
public String getInstalledCount() {
return installedCount;
}
public void setInstalledCount(String installedCount) {
this.installedCount = installedCount;
}
public String getInstalledCountStr() {
return installedCountStr;
}
public void setInstalledCountStr(String installedCountStr) {
this.installedCountStr = installedCountStr;
}
public String getDownloadCount() {
return downloadCount;
}
public void setDownloadCount(String downloadCount) {
this.downloadCount = downloadCount;
}
public String getDownloadCountStr() {
return downloadCountStr;
}
public void setDownloadCountStr(String downloadCountStr) {
this.downloadCountStr = downloadCountStr;
}
public String getCategories() {
return categories;
}
public void setCategories(String categories) {
this.categories = categories;
}
public String getTags() {
return tags;
}
public void setTags(String tags) {
this.tags = tags;
}
public String getScreenshots() {
return screenshots;
}
public void setScreenshots(String screenshots) {
this.screenshots = screenshots;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getChangelog() {
return changelog;
}
public void setChangelog(String changelog) {
this.changelog = changelog;
}
public String getDeveloper() {
return developer;
}
public void setDeveloper(String developer) {
this.developer = developer;
}
public String getLikesRate() {
return likesRate;
}
public void setLikesRate(String likesRate) {
this.likesRate = likesRate;
}
public String getBytes() {
return bytes;
}
public void setBytes(String bytes) {
this.bytes = bytes;
}
public String getSignatrue() {
return signatrue;
}
public void setSignatrue(String signatrue) {
this.signatrue = signatrue;
}
public String getPubKeySignature() {
return pubKeySignature;
}
public void setPubKeySignature(String pubKeySignature) {
this.pubKeySignature = pubKeySignature;
}
public String getMinSdkVersion() {
return minSdkVersion;
}
public void setMinSdkVersion(String minSdkVersion) {
this.minSdkVersion = minSdkVersion;
}
public String getAdsType() {
return adsType;
}
public void setAdsType(String adsType) {
this.adsType = adsType;
}
public String getPaidType() {
return paidType;
}
public void setPaidType(String paidType) {
this.paidType = paidType;
}
public String getPermissions() {
return permissions;
}
public void setPermissions(String permissions) {
this.permissions = permissions;
}
public String getSecurityStatus() {
return securityStatus;
}
public void setSecurityStatus(String securityStatus) {
this.securityStatus = securityStatus;
}
public String getOfficial() {
return official;
}
public void setOfficial(String official) {
this.official = official;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public String getPublishDate() {
return publishDate;
}
public void setPublishDate(String publishDate) {
this.publishDate = publishDate;
}
public String getCreation() {
return creation;
}
public void setCreation(String creation) {
this.creation = creation;
}
public String getSequence() {
return sequence;
}
public void setSequence(String sequence) {
this.sequence = sequence;
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public String getApkId() {
return apkId;
}
public void setApkId(String apkId) {
this.apkId = apkId;
}
}
| [
"569246607@qq.com"
] | 569246607@qq.com |
cc20844c78e526b69984338c157d836bb90086dd | 1f2e023df9e665fa092ac53bf5dbabcb52d386a5 | /mathiProductWithMultiTenant/src/main/java/com/mathi/entity/RolesPermission.java | e1179ca643ee6f787cdcab78d8a79f6acaa34137 | [] | no_license | knavaneethan/mathiMultiTenant | 965fdc84694f334b968287cde9ba0b0695f0aa04 | 0c345fc9468c9ba9065795a2d436d3e92504ca92 | refs/heads/master | 2021-07-14T05:57:42.416515 | 2017-10-17T09:14:20 | 2017-10-17T09:14:20 | 107,062,925 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 962 | java | package com.mathi.entity;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name="rolespermission")
public class RolesPermission implements Serializable {
/**
*
*/
private static final long serialVersionUID = -2070357513686679164L;
@Id
@GeneratedValue
private Integer id;
@Column
private String permission;
@Column(name="rolename")
private String roleName;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getPermission() {
return permission;
}
public void setPermission(String permission) {
this.permission = permission;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
} | [
"knava@NavPC"
] | knava@NavPC |
04f0b0d3b384fd63e1f546cb42b8199ff4f06952 | 707b6dae4692fdee92f8fc8e7a00bd6b3528bf78 | /org.tesoriero.cauce.task.diagram/src/tamm/diagram/edit/helpers/InputConditionToJoinTaskEditHelper.java | 49c0a081b6e52df5d77dbd12e36cd6ceb08b3995 | [] | no_license | tesorieror/cauce | ec2c05b5b6911824bdf27f5bd64c678fd49037c3 | ef859fe6e81650a6671e6ad773115e5bc86d54ea | refs/heads/master | 2020-05-14T13:07:54.152875 | 2015-03-19T12:20:27 | 2015-03-19T12:20:27 | 32,517,519 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 137 | java | package tamm.diagram.edit.helpers;
/**
* @generated
*/
public class InputConditionToJoinTaskEditHelper extends TaskBaseEditHelper {
}
| [
"tesorieror@gmail.com"
] | tesorieror@gmail.com |
cc5e5fcabed3b221f8d18e761ccb4e1fa870a5e9 | 2216c642fe363c87e32ddd4ec4574b469a471ec4 | /MyAccounts/src/org/amphiprion/myaccount/adapter/ReportPeriodTypeAdapter.java | 5c1695cec7c09de67d2a700dc7d7591057f50d69 | [] | no_license | dineshmetkari/my-accounts | 580747a7530b92f713b97399a2342b33adcd32f4 | 6d07fae1337dcc9cd5553569df89e0dad5372b21 | refs/heads/master | 2021-01-10T02:41:01.686445 | 2012-10-08T20:18:48 | 2012-10-08T20:18:48 | 38,678,417 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,695 | java | /*
* @copyright 2010 Gerald Jacobson
* @license GNU General Public License
*
* This file is part of My Accounts.
*
* My Accounts 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.
*
* My Accounts 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 My Accounts. If not, see <http://www.gnu.org/licenses/>.
*/
package org.amphiprion.myaccount.adapter;
import org.amphiprion.myaccount.ApplicationConstants;
import org.amphiprion.myaccount.database.entity.Report.PeriodType;
import android.content.Context;
import android.content.res.Resources;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
/**
* This is the adapter for the File driver date format chooser.
*
* @author amphiprion
*
*/
public class ReportPeriodTypeAdapter extends ArrayAdapter<PeriodType> {
/**
* Default constructor.
*/
public ReportPeriodTypeAdapter(Context context) {
super(context, android.R.layout.simple_spinner_item, PeriodType.values());
setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
}
/**
* {@inheritDoc}
*
* @see android.widget.ArrayAdapter#getView(int, android.view.View,
* android.view.ViewGroup)
*/
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = super.getView(position, convertView, parent);
Resources res = getContext().getResources();
((TextView) view).setText(res.getString(res.getIdentifier("report_period_type_"
+ PeriodType.values()[position].getDbValue(), "string", ApplicationConstants.PACKAGE)));
return view;
}
/**
* {@inheritDoc}
*
* @see android.widget.ArrayAdapter#getDropDownView(int, android.view.View,
* android.view.ViewGroup)
*/
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
View view = super.getDropDownView(position, convertView, parent);
Resources res = getContext().getResources();
((TextView) view).setText(res.getString(res.getIdentifier("report_period_type_"
+ PeriodType.values()[position].getDbValue(), "string", ApplicationConstants.PACKAGE)));
return view;
}
}
| [
"amphiprions@b2eb863e-d0bb-63bf-bba6-652af697ead3"
] | amphiprions@b2eb863e-d0bb-63bf-bba6-652af697ead3 |
60e330433b5adff6bc003d131d93205ddf181a6b | 6a4f58cc6228231afc4bc6323949ddce6106d1c8 | /src/com/luv2code/hibernate/demo/CreateStudentDemo.java | 81bb314dc2116f2cc1d1632693cd9306d1df2e83 | [] | no_license | Duong-dev/one-to-one | 30f60403aa247994dc3833f2290e79e1ef25e7c7 | 0b7fca338d4694a1a90c8fe728ada92e0d7e0ba3 | refs/heads/master | 2021-01-13T23:04:59.516878 | 2020-02-23T13:32:11 | 2020-02-23T13:32:11 | 242,522,279 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,146 | java | package com.luv2code.hibernate.demo;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import com.luv2code.hibernate.demo.entity.Student;
public class CreateStudentDemo {
public static void main(String[] args) {
// create session factory
SessionFactory sessionFactory = new Configuration()
.configure("hibernate.cfg.xml")
.addAnnotatedClass(Student.class)
.buildSessionFactory();
// create session
Session session = sessionFactory.getCurrentSession();
try {
// create a student object
Student tempStudent = new Student("Ku", "Le", "kule@gmail.com");
Student tempStudent2 = new Student("As", "Gy", "Asgy@gmail.com");
Student tempStudent3 = new Student("Fu", "Ya", "fuya@gmail.com");
// start a transaction
session.beginTransaction();
// save the student object
session.save(tempStudent);
session.save(tempStudent2);
session.save(tempStudent3);
// commit transaction
session.getTransaction().commit();
} catch (Exception e) {
e.printStackTrace();
} finally {
session.close();
}
}
}
| [
"hjackbye1@gmail.com"
] | hjackbye1@gmail.com |
82cf712b0bbe5fba64f6a5d212abef2f159e4b9e | f019b3e56276140da7087df8a426c8ff45b6e5de | /src/java/dataaccess/RoleDB.java | 8b3f0f43f3aac2170393dd550c24e1cec4f93253 | [] | no_license | glaucoboarettolabone/Week9Lab | a3443cef0bced23c7490c320b8e9eb50f5d797cc | 67b7505e2769400757ddc50594f58f5f96525d91 | refs/heads/master | 2023-01-06T21:47:08.895279 | 2020-11-05T04:29:04 | 2020-11-05T04:29:04 | 310,112,786 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 770 | java | package dataaccess;
import java.util.List;
import javax.persistence.EntityManager;
import models.Role;
public class RoleDB {
public List<Role> getAll() throws Exception {
EntityManager em = DBUtil.getEntityManagerFactory().createEntityManager();
try {
List<Role> roles = em.createNamedQuery("Role.findAll", Role.class).getResultList();
return roles;
} finally {
em.close();
}
}
public Role get(int roleId) {
EntityManager em = DBUtil.getEntityManagerFactory().createEntityManager();
try {
Role role = em.find(Role.class, roleId);
return role;
} finally {
em.close();
}
}
}
| [
"815000@SAIT224318IT.mshome.net"
] | 815000@SAIT224318IT.mshome.net |
8723f5ce4c0537718c292dbc5d7bc6548d602f3a | c518b03ef4b02d3c07d7f970910d611749051b9d | /src/main/java/io/sisa/demo/api/v1/dto/CityDTO.java | 6129cfa64880296230f1aebc1c7c82a6cfb099d6 | [] | no_license | sisa/spring-rest-h2-swagger | ff9fb4b8443ce848943998f1fd7a1bd6571231fa | 563e99ddbae72f884b4d2b04938c5c44bb063be4 | refs/heads/master | 2021-04-12T08:34:32.056504 | 2019-07-09T06:56:52 | 2019-07-09T06:56:52 | 126,471,724 | 0 | 0 | null | 2020-10-12T23:20:00 | 2018-03-23T10:45:04 | Java | UTF-8 | Java | false | false | 846 | java | package io.sisa.demo.api.v1.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import java.time.LocalDateTime;
/**
* Created on Mart, 2018
*
* @author sisa
*/
@Data
@NoArgsConstructor
public class CityDTO extends BaseDTO {
private int cityCode;
@NotBlank(message = "demo.validation.NotNull.city.name")
private String cityName;
private String country;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
private LocalDateTime validityEndDate;
public CityDTO(Long id, int cityCode, String cityName, String country, LocalDateTime validityEndDate) {
super(id);
this.cityCode = cityCode;
this.cityName = cityName;
this.country = country;
this.validityEndDate = validityEndDate;
}
}
| [
"isaozturk@gmail.com"
] | isaozturk@gmail.com |
c269be9a66ef97b7dfa16f3e34b98d76fc8a8587 | 34f51439803a5c17c2164a2089d588f1399f07a3 | /app/src/main/java/inc/talentedinc/listener/OnUnRegisterResult.java | d9afef60e315505d7572ed62b58af79ad5ce8827 | [] | no_license | ShimaaSamirAdly/TalentedInc | e6df85779af81bca6398129bc280b9015ed8c7ce | 6dc13d449940dd5f4ef2a460a66ebe18a96115cc | refs/heads/master | 2020-03-18T01:32:51.383891 | 2018-06-26T13:20:53 | 2018-06-26T13:20:53 | 134,146,851 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 151 | java | package inc.talentedinc.listener;
/**
* Created by asmaa on 06/18/2018.
*/
public interface OnUnRegisterResult {
void onUnRegisterResult();
}
| [
"asmaahassenibrahem@gmail.com"
] | asmaahassenibrahem@gmail.com |
28ead9b37745bf8028fe7b3c75e05768cd5ba948 | e6a0b377e4b1079361fa0f8f855dae5c59d068aa | /src/main/java/com/gabryelmacedo/scrapingbrasileiraoapi/respository/PartidaRepository.java | 5c70cebe3aaab40ef08fc2df272b09be3fecd45b | [] | no_license | Garroti/API-web-scraping-java | f98a8583d3db0bfe2a376d79bad1c7de591b7c45 | 770235c22640ed496951ce5d34628cb72a0d834c | refs/heads/master | 2023-03-08T18:20:40.335670 | 2021-02-26T03:30:59 | 2021-02-26T03:30:59 | 337,607,027 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,061 | java | package com.gabryelmacedo.scrapingbrasileiraoapi.respository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import com.gabryelmacedo.scrapingbrasileiraoapi.entity.Partida;
@Repository
public interface PartidaRepository extends JpaRepository<Partida, Long> {
@Query(name = "buscar_quantidade_partidas_periodo",
value = "select count(*) from partida as p where p.data_hora_partida " +
"between dateadd(hour, -3, current_timestamp) and current_timestamp " +
"and ifnull(p.tempo_partida, 'Vazio') != 'Encerrado' ",
nativeQuery = true)
public Integer buscarQuantidadePartidasPeriodo();
@Query(name = "listar",
value = "select * from partida as p where p.data_hora_partida " +
"between dateadd(hour, -3, current_timestamp) and current_timestamp " +
"and ifnull(p.tempo_partida, 'Vazio') != 'Encerrado' ",
nativeQuery = true)
public List<Partida> listarPartidasPorPeriodo();
} | [
"gabryelmacedo0@gmail.com"
] | gabryelmacedo0@gmail.com |
ef17e2d41965d4fb4b08dc808cad197cd1aa50dc | e755b86308c1ddd2a98a235be6349f0dc47ed6b5 | /web-server/sharecommon/src/main/java/com/xuanwu/msggate/common/core/Ticker.java | e63f1aff7ca9d9c8d61ea3d875ce9c9a2f44b464 | [] | no_license | druidJane/Druid3.0.3 | 37466528b9d0356c0ccb4a933a047e522af431f4 | 595d831ed8c81d142d4c7a82de3f953859ddc8fc | refs/heads/master | 2021-05-08T07:33:21.202595 | 2017-11-09T10:36:50 | 2017-11-09T10:36:51 | 106,767,170 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,740 | java | /*
* Copyright (C) 2011 The Guava Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xuanwu.msggate.common.core;
/**
* A time source; returns a time value representing the number of nanoseconds elapsed since some
* fixed but arbitrary point in time. Note that most users should use {@link Stopwatch} instead of
* interacting with this class directly.
*
* <p><b>Warning:</b> this interface can only be used to measure elapsed time, not wall time.
*
* @author Kevin Bourrillion
* @since 10.0
* (<a href="http://code.google.com/p/guava-libraries/wiki/Compatibility"
* >mostly source-compatible</a> since 9.0)
*/
public abstract class Ticker {
/**
* Constructor for use by subclasses.
*/
protected Ticker() {}
/**
* Returns the number of nanoseconds elapsed since this ticker's fixed
* point of reference.
*/
public abstract long read();
/**
* A ticker that reads the current time using {@link System#nanoTime}.
*
* @since 10.0
*/
public static Ticker systemTicker() {
return SYSTEM_TICKER;
}
private static final Ticker SYSTEM_TICKER = new Ticker() {
@Override
public long read() {
return Platform.systemNanoTime();
}
};
}
| [
"413429011@qq.com"
] | 413429011@qq.com |
e6acf81c028b7874173a6b43734b70c6ff3593eb | 1f544ced67ae6e4205e412ecf38661863cffe15c | /app/src/main/java/project/tddd80/keval992/liu/ida/se/navigationbase/main/AddressArrayAdapter.java | 2f90d10431589bc174f98c7d476004861e32b993 | [] | no_license | Adzox/MusicSquare | c52d2753fa16187962d0f6c2b8e4cd817c5b4a07 | 92bba0994ae93039b28477698a03b4ab2563ba1b | refs/heads/master | 2020-04-05T12:47:14.262833 | 2015-08-28T10:00:06 | 2015-08-28T10:00:06 | 40,309,678 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 956 | java | package project.tddd80.keval992.liu.ida.se.navigationbase.main;
import android.content.Context;
import android.location.Address;
import android.widget.ArrayAdapter;
import java.util.List;
/**
* Custom ArrayAdapter for populating a location AutoCompleteTextView with suggestions.
* <p/>
* Created by kevin on 2015-08-25.
*/
public class AddressArrayAdapter extends ArrayAdapter<String> {
public AddressArrayAdapter(Context context, int resource, int textViewResourceId, List<String> objects) {
super(context, resource, textViewResourceId, objects);
}
public final void setItems(List<Address> addresses) {
clear();
for (Address address : addresses) {
String fullAddress = "";
for (int n = 0; n < address.getMaxAddressLineIndex(); n++) {
fullAddress += address.getAddressLine(n);
}
add(fullAddress);
}
notifyDataSetChanged();
}
}
| [
"somjai.kevin@gmail.com"
] | somjai.kevin@gmail.com |
d8d601377bd33d90eecbf6d8eab1fd999f4c13bb | 352eabc8b0213363e4be3c78117fbe90b2d01c16 | /src/main/ui/recruiterpage/RecruiterPageController.java | 74c66e7fc03ff2146fbefb4090b06ecae6b745bf | [] | no_license | yajasmalhotra/Solari-HackOR | 4411c425828c2765c98016c29593fec641e34424 | 4fd9bfc931c7770e79666317091ae7467152d0f3 | refs/heads/main | 2023-05-14T12:11:23.438851 | 2021-06-07T13:05:55 | 2021-06-07T13:05:55 | 374,668,367 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,334 | java | package ui.recruiterpage;
import SQL.DBConnection;
import SQL.PopulateDatabase;
import javafx.event.ActionEvent;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import ui.recruiterpage.recruiterpageone.RecruiterPageOneController;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
public class RecruiterPageController {
public TextField name;
public TextField companyname;
public Button conti;
public Button back;
Connection myConnection = DBConnection.connect();
public void buttonClick(ActionEvent event) throws IOException {
if (event.getSource() == back) {
backButtonClicked(event);
} else if (event.getSource() == conti) {
try {
PopulateDatabase.PopulateRecruiter(myConnection, name.getText(), companyname.getText());
} catch (SQLException throwables) {
throwables.printStackTrace();
}
// System.out.println(name.getText());
// System.out.println(companyname.getText());
moveToPageOne(event);
}
}
public void backButtonClicked(ActionEvent event) throws IOException {
Parent parent = FXMLLoader.load(getClass().getResource("/ui/homepage/homepage.fxml"));
Scene scene = new Scene(parent);
Stage window = (Stage) ((Node) event.getSource()).getScene().getWindow();
window.setScene(scene);
window.show();
DBConnection.disconnect(myConnection);
}
public void moveToPageOne(ActionEvent event) throws IOException {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/ui/recruiterpage/recruiterpageone/recruiterpageone.fxml"));
Parent courseParent = loader.load();
RecruiterPageOneController controller = (RecruiterPageOneController)loader.getController();
controller.setTopLabel(companyname.getText());
Scene scene = new Scene(courseParent);
Stage window = (Stage) ((Node) event.getSource()).getScene().getWindow();
window.setScene(scene);
window.show();
// TODO
DBConnection.disconnect(myConnection);
}
}
| [
"malhotra.yajas@gmail.com"
] | malhotra.yajas@gmail.com |
3a5d5a704a002dae396bc3ff69226fefec4bc335 | fdf81f8e6c054ec5ff1678c735e1e748e38c31e2 | /src/Media.java | 584e48604488365f508e3d5a483b462aaf5ef78a | [] | no_license | Bbereket1/Day08AssigmentLopps_Classes | d234830674114d35c20af7df9930327ea36905cd | 61388f1ce172bfd6afeb90be34543eb1bef585bd | refs/heads/master | 2022-12-24T04:51:19.548693 | 2020-09-19T22:26:23 | 2020-09-19T22:26:23 | 295,938,155 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 935 | java | import java.util.Arrays;
public class Media {
public String title;
public int lengthInMinuets;
public String[] actors;
public Media(String title, int lengthInMinuets, String[] actors) {
this.title = title;
this.lengthInMinuets = lengthInMinuets;
this.actors = actors;
}
public String getTitle () {
return title;
}
public void setTitle (String title){
this.title = title;
}
public double getLengthInMinuets () {
return lengthInMinuets;
}
public void setLengthInMinuets ( int lengthInMinuets){
this.lengthInMinuets = lengthInMinuets;
}
public String[] getActors () {
String output = Arrays.toString(actors);
return actors;
}
public void setActors (String[]actors){
this.actors = actors;
}
}
| [
"berekettsegaye13@gmail.com"
] | berekettsegaye13@gmail.com |
a45b2960ad11b5be0b701d081644056b57a19ddf | 1585d61018e64fb5e72202a783b6ff9036a847df | /app/src/main/java/com/sinocall/phonerecordera/ui/activity/AboutUsActivity.java | 1dc7f2f29bce0b20ad92db5d4c6685ab1ad6f0fa | [] | no_license | Wadeqing/phoneRecording | 06402f6017ba46ed8dbc906e11ebe5d397095f0c | 832e8fc25fa826227a4348757856b9381c7ab635 | refs/heads/master | 2020-04-08T08:49:44.190267 | 2018-11-26T16:17:37 | 2018-11-26T16:17:37 | 159,195,531 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,177 | java | package com.sinocall.phonerecordera.ui.activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.DownloadListener;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.sinocall.phonerecordera.R;
import com.sinocall.phonerecordera.util.StatusColorUtils;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
/**
* Created by qingchao on 2017/11/25.
*/
public class AboutUsActivity extends BaseActivity {
@BindView(R.id.imageview_title_left)
ImageView imageviewTitleLeft;
@BindView(R.id.textview_title_left)
TextView textviewTitleLeft;
@BindView(R.id.linearlayout_view_title_back)
LinearLayout linearlayoutViewTitleBack;
@BindView(R.id.textview_title)
TextView textviewTitle;
@BindView(R.id.imageview_title_right)
ImageView imageviewTitleRight;
@BindView(R.id.textview_title_right)
TextView textviewTitleRight;
@BindView(R.id.linearlayout_view_title_setting)
LinearLayout linearlayoutViewTitleSetting;
@BindView(R.id.imageview_small_red)
ImageView imageviewSmallRed;
@BindView(R.id.framelayout_view_title)
FrameLayout framelayoutViewTitle;
@BindView(R.id.framelayout_activity_about)
FrameLayout frameLayoutActivityAbout;
private String aboutUs;
private WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
StatusColorUtils.setStatusColor(getWindow());
setContentView(R.layout.activity_about_us);
ButterKnife.bind(this);
textviewTitle.setText(getResources().getString(R.string.about_us));
aboutUs = getIntent().getStringExtra("aboutUs");
imageviewTitleLeft.setVisibility(View.VISIBLE);
linearlayoutViewTitleBack.setVisibility(View.VISIBLE);
webView = new WebView(this.getApplicationContext());
frameLayoutActivityAbout.addView(webView);
initWebView(webView);
}
private void initWebView(WebView webView) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true);
webView.loadUrl(aboutUs);
settings.setDefaultTextEncodingName("utf-8");
settings.setUseWideViewPort(true); //将图片调整到适合webview的大小
settings.setDomStorageEnabled(true);
settings.setLoadWithOverviewMode(true); // 缩放至屏幕的大小
settings.setCacheMode(WebSettings.LOAD_DEFAULT); //关闭webview中缓存
settings.setAllowFileAccess(true); //设置可以访问文件
settings.setJavaScriptCanOpenWindowsAutomatically(true); //支持通过JS打开新窗口
settings.setLoadsImagesAutomatically(true); //支持自动加载图片
settings.setDefaultTextEncodingName("utf-8");//设置编码格式
/*
* 解决在webview中跳转的问题
*/
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url == null) {
return false;
}
try {
if (url.startsWith("weixin://") //微信
|| url.startsWith("alipays://") //支付宝
|| url.startsWith("mailto://") //邮件
|| url.startsWith("tel://")//电话
|| url.startsWith("dianping://")//大众点评
|| url.startsWith("tmast://")
) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
return true;
}
} catch (Exception e) { //防止crash (如果手机上没有安装处理某个scheme开头的url的APP, 会导致crash)
return true;//没有安装该app时,返回true,表示拦截自定义链接,但不跳转,避免弹出上面的错误页面
}
view.loadUrl(url); //在当前的webview中跳转到新的url
return true;
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
// showLoading(null);
}
@Override
public void onPageFinished(WebView view, String url) {
dismissLoading();
}
});
webView.setDownloadListener(new DownloadListener() {
@Override
public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
Uri uri = Uri.parse(url);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});
}
@OnClick({R.id.imageview_title_left, R.id.linearlayout_view_title_back})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.imageview_title_left:
finish();
break;
case R.id.linearlayout_view_title_back:
finish();
break;
default:
break;
}
}
@Override
protected void onDestroy() {
if (webView != null) {
webView.loadDataWithBaseURL(null, "", "text/html", "utf-8", null);
webView.clearHistory();
((ViewGroup) webView.getParent()).removeView(webView);
webView.destroy();
webView = null;
}
super.onDestroy();
}
}
| [
"m17600380089@163.com"
] | m17600380089@163.com |
6c35a3aac4b781d2fbd0cef890b94a2390a60a86 | d85db2ac29e957e99950d43ff1a866b3977eed63 | /ArcadeShooter/Player.java | 057ed5e5a0984d7f102bde73c161bccc1b8db958 | [] | no_license | emurray8/personal | a7af61636aa65261db38d32a8abdb2a24e744f9f | 69ce25bbf35f347591b2d0497a02491fc763aae3 | refs/heads/master | 2021-01-10T12:35:48.957492 | 2018-04-06T03:09:49 | 2018-04-06T03:09:49 | 52,299,398 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,750 | java | import java.awt.Graphics;
import java.awt.Color;
import java.awt.event.KeyListener;
import java.awt.event.KeyEvent;
import javax.swing.ImageIcon;
import java.applet.Applet;
import java.applet.AudioClip;
public class Player extends Unit implements KeyListener, ShotListener
{
private Shot shot = new Shot();
private Shot powerShot1 = new Shot();
private Shot powerShot2 = new Shot();
private Shot missile = new Shot();
private ImageIcon galaxyGuy;
private Shooter shooter;
public boolean firing = false;
public boolean tripleShot = false;
public boolean shield = false;
public boolean rapidFire = false;
private armorPiercing armorPiercer;
private ImageIcon fire;
public boolean paused = false;
public Player()
{
setPosition(450, 570);
setSize(59, 59);
speed = 20;
setBounds(0, 900, 570, 570);
galaxyGuy = new ImageIcon("player.gif");
fire = new ImageIcon("fire.gif");
}
public void paintUnit(Graphics g)
{
updatePosition(false);
//g.setColor(Color.blue);
//g.fillOval(x - width/2, y - height/2, width, height);
galaxyGuy.paintIcon(shooter, g, x - width/2, y-width/2);
shot.paintUnit(g);
powerShot1.paintUnit(g);
powerShot2.paintUnit(g);
if(shot.shotAnimation)
{
paintFire(g);
}
}
public void paintFire(Graphics g)
{
fire.paintIcon(shooter, g, x-13, y - 60);
}
public Shot getShot()
{
return shot;
}
public Shot getShot2()
{
return powerShot1;
}
public Shot getShot3()
{
return powerShot2;
}
public int getX()
{
return x;
}
public int getY()
{
return y;
}
public boolean getShield()
{
return shield;
}
public boolean shotMoved(ShotEvent e)
{
if(contains(e.getX(), e.getY()))
{
x = 450;
Shooter.lives--;
return true;
}
return false;
}
public void keyPressed(KeyEvent e)
{
if(e.getKeyCode() == KeyEvent.VK_LEFT)
{
xVel = -speed;
}
if(e.getKeyCode() == KeyEvent.VK_RIGHT)
{
xVel = speed;
}
if(e.getKeyCode() == KeyEvent.VK_SPACE)
{
shot.fire(x, y, false);
firing = true;
if(rapidFire)
{
powerShot1.xVel = 0;
powerShot2.xVel = 0;
powerShot1.fire(x, y-15, false);
powerShot2.fire(x, y-30, false);
}
if(tripleShot)
{
powerShot1.xVel = 5;
powerShot2.xVel = -5;
powerShot1.fire(x, y, false);
powerShot2.fire(x, y, false);
}
}
if(e.getKeyCode() == KeyEvent.VK_ENTER)
{
Shooter.gameStart = true;
}
if(e.getKeyCode() == KeyEvent.VK_F)
{
System.exit(0);
}
}
public void keyReleased(KeyEvent e)
{
xVel = 0;
firing = false;
}
public void keyTyped(KeyEvent e)
{}
}
| [
"em7166@mcla.edu"
] | em7166@mcla.edu |
3f2fe189690ea026fcf5c27f9dbcf9c9fc887e3f | 0c56b86dac8663b0aaf25443394053a3a8558812 | /MMBank/src/test/java/com/mmbank/app/MMBank/MmBankApplicationTests.java | aab66e8a52361b78eecc26154aca20077cf69014 | [] | no_license | saikiranparvatham/Spring-Zulu-Gateway-Bankapp | 8fcb6808a65e1c09be52061aab2790010450764b | 925672044b0495ec4f11f7b7160a908b123e5840 | refs/heads/master | 2021-07-22T13:10:49.588363 | 2020-05-16T15:26:42 | 2020-05-16T15:26:42 | 167,379,976 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 339 | java | package com.mmbank.app.MMBank;
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 MmBankApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"saikiran.parvatham@capgemini.com"
] | saikiran.parvatham@capgemini.com |
f4b86b76e9d2029bf1ecfd4572adf0a3d7ac5369 | a1efc4a4916a74c9565057dd3aa22d3a93f35e2b | /src/webforms/SharedLib/src/org/purc/purcforms/client/view/RuntimeGroupView.java | edd4b5722b1af6af63984746e79d6996b4d51f74 | [
"LicenseRef-scancode-other-permissive"
] | permissive | samvrit/TEDS | 9a8ebd4c87ed1aabae548a058194596dffb0e1bd | 7d16508b3a26bafac0b8575dca6c2d8dbc368304 | refs/heads/master | 2021-01-20T19:42:10.799356 | 2015-08-12T06:26:34 | 2015-08-12T06:26:34 | 40,529,621 | 1 | 0 | null | 2015-08-11T08:07:25 | 2015-08-11T08:07:25 | null | UTF-8 | Java | false | false | 4,565 | java | package org.purc.purcforms.client.view;
import java.util.HashMap;
import java.util.List;
import org.purc.purcforms.client.controller.OpenFileDialogEventListener;
import org.purc.purcforms.client.controller.QuestionChangeListener;
import org.purc.purcforms.client.model.FormDef;
import org.purc.purcforms.client.model.OptionDef;
import org.purc.purcforms.client.model.QuestionDef;
import org.purc.purcforms.client.util.FormUtil;
import org.purc.purcforms.client.widget.RuntimeWidgetWrapper;
import com.google.gwt.http.client.URL;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Widget;
/**
*
* @author daniel
*
*/
public class RuntimeGroupView extends Composite implements OpenFileDialogEventListener,QuestionChangeListener{
public interface Images extends ClientBundle {
ImageResource error();
}
/** Images reference where we get the error icon for widgets with errors. */
protected final Images images;
/** Reference to the form definition. */
protected FormDef formDef;
/** The currently selected tab panel. */
protected AbsolutePanel selectedPanel;
protected Image image;
protected HTML html;
protected HashMap<QuestionDef,List<Widget>> labelMap;
protected HashMap<Widget,String> labelText;
protected HashMap<Widget,String> labelReplaceText;
protected HashMap<QuestionDef,List<CheckBox>> checkBoxGroupMap;
protected HashMap<String,RuntimeWidgetWrapper> widgetMap;
/**
* The first invalid widget. This is used when we validate more than one widget in a group
* and at the end of the list we want to set focus to the first widget that we found invalid.
*/
protected RuntimeWidgetWrapper firstInvalidWidget;
public RuntimeGroupView(Images images){
this.images = images;
}
public void onSetFileContents(String contents) {
if(contents != null && contents.trim().length() > 0){
contents = contents.replace("<pre>", "");
contents = contents.replace("</pre>", "");
RuntimeWidgetWrapper widgetWrapper = null;
if(image != null)
widgetWrapper = (RuntimeWidgetWrapper)image.getParent().getParent();
else
widgetWrapper = (RuntimeWidgetWrapper)html.getParent().getParent();
String xpath = widgetWrapper.getBinding();
if(!xpath.startsWith(formDef.getBinding()))
xpath = "/" + formDef.getBinding() + "/" + widgetWrapper.getBinding();
if(image != null)
image.setUrl(FormUtil.getMultimediaUrl()+"?action=recentbinary&time="+ new java.util.Date().getTime()+"&formId="+formDef.getId()+"&xpath="+xpath);
else{
String extension = "";//.3gp ".mpeg";
String contentType = "&contentType=video/3gpp";
if(widgetWrapper.getQuestionDef().getDataType() == QuestionDef.QTN_TYPE_AUDIO)
contentType = "&contentType=audio/3gpp"; //"&contentType=audio/x-wav";
//extension = ".wav";
contentType += "&name="+widgetWrapper.getQuestionDef().getBinding()+".3gp";
html.setVisible(true);
html.setHTML("<a href=" + URL.encode(FormUtil.getMultimediaUrl()+extension + "?formId="+formDef.getId()+"&xpath="+xpath+contentType+"&time="+ new java.util.Date().getTime()) + ">"+html.getText()+"</a>");
}
widgetWrapper.getQuestionDef().setAnswer(contents);
}
}
public void onEnabledChanged(QuestionDef sender,boolean enabled){
List<CheckBox> list = checkBoxGroupMap.get(sender);
if(list == null)
return;
for(CheckBox checkBox : list){
checkBox.setEnabled(enabled);
if(!enabled)
checkBox.setValue(false);
}
}
public void onVisibleChanged(QuestionDef sender,boolean visible){
List<CheckBox> list = checkBoxGroupMap.get(sender);
if(list == null)
return;
for(CheckBox checkBox : list){
checkBox.setVisible(visible);
if(!visible)
checkBox.setValue(false);
}
}
public void onRequiredChanged(QuestionDef sender,boolean required){
}
public void onLockedChanged(QuestionDef sender,boolean locked){
}
public void onBindingChanged(QuestionDef sender,String newValue){
}
public void onDataTypeChanged(QuestionDef sender,int dataType){
}
public void onOptionsChanged(QuestionDef sender,List<OptionDef> optionList){
}
}
| [
"vasanth.rajaraman@cps.iisc.ernet.in"
] | vasanth.rajaraman@cps.iisc.ernet.in |
83f033688b66a6bddf986e2ce412c73dd2020c42 | 9e8e3b39cb608af5af86e474130d079d6bf023c5 | /server/src/main/java/cz/vse/java/shootme/server/net/requests/JoinGameRequest.java | 955e08c50241f4db16e30823d9dd80ed4e3a61c6 | [] | no_license | shoot-me/shootme | 4c3e6edb8037440c542251f395bbf17cbd682e0a | 640aaafed14d1981fcef68f992e7d8ba5076bf25 | refs/heads/master | 2022-07-28T14:54:25.625180 | 2020-01-29T18:34:40 | 2020-01-29T18:34:40 | 222,635,076 | 0 | 0 | null | 2022-01-04T16:37:04 | 2019-11-19T07:29:12 | Java | UTF-8 | Java | false | false | 299 | java | package cz.vse.java.shootme.server.net.requests;
public class JoinGameRequest extends Request {
public final String gameName;
public final String avatar;
public JoinGameRequest(String gameName, String avatar) {
this.gameName = gameName;
this.avatar = avatar;
}
}
| [
"adajedlicka@gmail.com"
] | adajedlicka@gmail.com |
325c694df9a5237e7f67d70bab44c718225c1252 | c3336b74992a07ce57dc091c42ca0d703ce6ca27 | /A_20160916/A_1929.java | 8e0a6145409e8e6e9c26606de0c204e08b935377 | [] | no_license | djflexible/exerciseAlgorithm2 | b5b2eb1b3e8c53773df3b85ef53998c5700c92b6 | 427cd5f5063483545ba53555282f06df977c53e7 | refs/heads/master | 2021-01-11T04:07:23.652942 | 2016-11-06T01:25:36 | 2016-11-06T01:25:36 | 71,246,742 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 471 | java | package A_20160916;
import java.util.Scanner;
public class A_1929 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int m = sc.nextInt();
int n = sc.nextInt();
boolean flag = true;
for (int i = 2; i <= n; i++) {
flag = true;
for (int j = 2; j <= Math.sqrt(i); j++) {
if (i % j == 0) {
flag = false;
break;
}
}
if (flag == true && i >= m) {
System.out.println(i);
}
}
sc.close();
}
} | [
"dongdongalcohol@gmail.com"
] | dongdongalcohol@gmail.com |
247432b2bc7cef078d53265b5cdd6b345b280890 | 427857b06f3e357b5f7858efd61989e7c9a9d98a | /app/src/androidTest/java/ru/dev/naked/remindme/ExampleInstrumentedTest.java | 2423b67e7b6e2771a66f62dcd7605fbfe639af9e | [] | no_license | NakedDev/RemindMe | 12a145a0408d213aed525840bbace498553acf20 | 0e355a915f0663e7a2d445f49dc5066f030dc231 | refs/heads/master | 2021-07-11T13:50:06.956795 | 2017-10-11T13:34:02 | 2017-10-11T13:34:02 | 106,533,064 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 746 | java | package ru.dev.naked.remindme;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("ru.dev.naked.remindme", appContext.getPackageName());
}
}
| [
"naked.developer@bk.ru"
] | naked.developer@bk.ru |
5783e4c3e7860d07666ad95438a8564691a7fffb | 4b79c146cb0cd64ecfd408b52183aedda2c33fce | /talkaround/app/src/main/java/org/mixare/Preview.java | 4e8b8a9758155878e602e43f9418589f60907325 | [] | no_license | ddalko/GraduationProject | d07f4ce54247af4b8db0ed264432509060a8df39 | d3b105d9f264031a921f89cb60cd59b567e6982a | refs/heads/master | 2020-02-26T14:45:15.115595 | 2017-09-14T12:38:30 | 2017-09-14T12:38:30 | 95,538,141 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,924 | java | package org.mixare;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.List;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.YuvImage;
import android.hardware.Camera;
import android.hardware.Camera.Size;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
class Preview extends ViewGroup implements SurfaceHolder.Callback, Camera.PreviewCallback {
private final String TAG = "Preview";
Bitmap SharedBitmap;
SurfaceView mSurfaceView;
SurfaceHolder mHolder;
Size mPreviewSize;
List<Size> mSupportedPreviewSizes;
Camera mCamera;
Preview(Context context, SurfaceView sv ) {
super(context);
mSurfaceView = sv;
// addView(mSurfaceView);
mHolder = mSurfaceView.getHolder();
mHolder.addCallback(this);
mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
@Override
public void onPreviewFrame(byte[] data, Camera camera) {
Camera.Parameters params = camera.getParameters();
int w = params.getPreviewSize().width;
int h = params.getPreviewSize().height;
int format = params.getPreviewFormat();
YuvImage image = new YuvImage(data, format, w, h, null);
ByteArrayOutputStream out = new ByteArrayOutputStream();
Rect area = new Rect(0, 0, w, h);
image.compressToJpeg(area, 100, out);
Bitmap bm = BitmapFactory.decodeByteArray(out.toByteArray(), 0, out.size());
this.SharedBitmap = bm;
}
public Bitmap getSharedBitmap()
{
return this.SharedBitmap;
}
public void setCamera(Camera camera) {
if (mCamera != null) {
// Call stopPreview() to stop updating the preview surface.
mCamera.stopPreview();
// Important: Call release() to release the camera for use by other
// applications. Applications should release the camera immediately
// during onPause() and re-open() it during onResume()).
mCamera.release();
mCamera = null;
}
mCamera = camera;
if (mCamera != null) {
List<Size> localSizes = mCamera.getParameters().getSupportedPreviewSizes();
mSupportedPreviewSizes = localSizes;
requestLayout();
// get Camera parameters
Camera.Parameters params = mCamera.getParameters();
List<String> focusModes = params.getSupportedFocusModes();
if (focusModes.contains(Camera.Parameters.FOCUS_MODE_AUTO)) {
// set the focus mode
params.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);
// set Camera parameters
mCamera.setParameters(params);
}
try {
mCamera.setPreviewDisplay(mHolder);
} catch (IOException e) {
e.printStackTrace();
}
// Important: Call startPreview() to start updating the preview
// surface. Preview must be started before you can take a picture.
mCamera.startPreview();
}
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// We purposely disregard child measurements because act as a
// wrapper to a SurfaceView that centers the camera preview instead
// of stretching it.
final int width = resolveSize(getSuggestedMinimumWidth(), widthMeasureSpec);
final int height = resolveSize(getSuggestedMinimumHeight(), heightMeasureSpec);
setMeasuredDimension(width, height);
if (mSupportedPreviewSizes != null) {
mPreviewSize = getOptimalPreviewSize(mSupportedPreviewSizes, width, height);
}
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
if (changed && getChildCount() > 0) {
final View child = getChildAt(0);
final int width = r - l;
final int height = b - t;
int previewWidth = width;
int previewHeight = height;
if (mPreviewSize != null) {
previewWidth = mPreviewSize.width;
previewHeight = mPreviewSize.height;
}
// Center the child SurfaceView within the parent.
if (width * previewHeight > height * previewWidth) {
final int scaledChildWidth = previewWidth * height / previewHeight;
child.layout((width - scaledChildWidth) / 2, 0,
(width + scaledChildWidth) / 2, height);
} else {
final int scaledChildHeight = previewHeight * width / previewWidth;
child.layout(0, (height - scaledChildHeight) / 2,
width, (height + scaledChildHeight) / 2);
}
}
}
public void surfaceCreated(SurfaceHolder holder) {
//Toast.makeText(getContext(), "surfaceCreated", Toast.LENGTH_LONG).show();
Log.d( "@@@", "surfaceCreated" );
// The Surface has been created, acquire the camera and tell it where
// to draw.
try {
if (mCamera != null) {
mCamera.setPreviewDisplay(holder);
mCamera.setPreviewCallback(this);
}
} catch (IOException exception) {
Log.e(TAG, "IOException caused by setPreviewDisplay()", exception);
}
}
public void surfaceDestroyed(SurfaceHolder holder) {
// Surface will be destroyed when we return, so stop the preview.
if (mCamera != null) {
mCamera.stopPreview();
mCamera.setPreviewCallback(null);
mCamera.release();
}
}
private Size getOptimalPreviewSize(List<Size> sizes, int w, int h) {
final double ASPECT_TOLERANCE = 0.1;
double targetRatio = (double) w / h;
if (sizes == null) return null;
Size optimalSize = null;
double minDiff = Double.MAX_VALUE;
int targetHeight = h;
// Try to find an size match aspect ratio and size
for (Size size : sizes) {
double ratio = (double) size.width / size.height;
if (Math.abs(ratio - targetRatio) > ASPECT_TOLERANCE) continue;
if (Math.abs(size.height - targetHeight) < minDiff) {
optimalSize = size;
minDiff = Math.abs(size.height - targetHeight);
}
}
// Cannot find the one match the aspect ratio, ignore the requirement
if (optimalSize == null) {
minDiff = Double.MAX_VALUE;
for (Size size : sizes) {
if (Math.abs(size.height - targetHeight) < minDiff) {
optimalSize = size;
minDiff = Math.abs(size.height - targetHeight);
}
}
}
return optimalSize;
}
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
if ( mCamera != null) {
Camera.Parameters parameters = mCamera.getParameters();
List<Size> allSizes = parameters.getSupportedPreviewSizes();
Camera.Size size = allSizes.get(0); // get top size
for (int i = 0; i < allSizes.size(); i++) {
if (allSizes.get(i).width > size.width)
size = allSizes.get(i);
}
//set max Preview Size
parameters.setPreviewSize(size.width, size.height);
// Important: Call startPreview() to start updating the preview surface.
// Preview must be started before you can take a picture.
mCamera.startPreview();
}
}
} | [
"nglee10240@naver.com"
] | nglee10240@naver.com |
d03e357d8b21d844b4eadff3fc9ef852f6bcece1 | 26cb5a608d84cb47754030d207b29d812878b6dc | /src/main/java/com/nextpay/risk_management/model/RiskTransaction.java | 6e16d9b13fe142b0952aec69058cbd3c38a4d301 | [] | no_license | hongem/risktransactionver2 | c3ddd5ca585ddaa3404c54a34d5ef0c0dd7ca52a | c809f9704f6fc6810ec482e07ce11fa20add2b52 | refs/heads/master | 2023-01-13T02:31:12.045225 | 2020-11-18T09:13:51 | 2020-11-18T09:13:51 | 313,880,320 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,706 | java | package com.nextpay.risk_management.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.persistence.*;
import java.time.OffsetDateTime;
@Entity
@Data
@Table(name = "risktransaction")
public class RiskTransaction {
@Id
@Column(name = "id")
private Long id;
@Column(name = "code")
private String code;
@Column(name = "created")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yy HH:mm:ss")
private OffsetDateTime created;
@Column(name = "updated")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yy HH:mm:ss")
private OffsetDateTime updated;
@Column(name = "service_id")
private Long serviceId;
@Column(name = "service_code")
private String serviceCode;
@Column(name = "sender_cus_id")
private Long sennderCusId;
@Column(name = "fullname")
private String fullname;
@Column(name = "phone_number")
private String phoneNumber;
@Column(name = "email")
private String email;
@Column(name = "amount")
private Double amount;
@Column(name = "sender_fee")
private Double senderFee;
@Column(name = "receiver_fee")
private Double receiverFee;
@Column(name = "discount_amount")
private Double discountAmount;
@Column(name = "currency_code")
private String currencyCode;
@Column(name = "status")
private String status;
@Column(name = "vas_product_id")
private Long vasProductId;
@Column(name = "product_code")
private String productCode;
@Column(name = "product_name")
private String productName;
@Column(name = "vas_quantity")
private String vasQuantity;
} | [
"hongtt1@vimo.vn"
] | hongtt1@vimo.vn |
26ec5ac08dcba9d80d3d01751163a0f0f92df8b0 | a4e12e41ee2d0e654087730b1e59349e575cb823 | /class/p26.java | 8e666cd3e3ae75ea935c0f87b3caa736e5f9515d | [] | no_license | VIVEK8299/Java | 1cfeb435adedd5f8c7345285b22ec23ea65c8241 | f2af40cc92412fceb2f0593c1819feaa1311613c | refs/heads/main | 2022-12-24T02:49:28.688098 | 2020-10-08T17:17:03 | 2020-10-08T17:17:03 | 302,239,349 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 129 | java | class p26
{
public static void main(String[]R)
{
int ar[]={1,2,3,4,5};
for(int i:ar)
{
System.out.println(i);
}
}
} | [
"viveksri1212@gmail.com"
] | viveksri1212@gmail.com |
6bb8f45f93eb6348981a15a59f23c185d6854362 | 2c42f64d65b749369c9cc05b78bf9221f227c1c3 | /src/main/java/com/xk/bbs/service/impl/PostTypeServiceImpl.java | 6519f30088d9f59351cece21f6e44641b8b564c7 | [] | no_license | xkzh/bbs | a3ca5676750a0a96ce8d09a03d6e6c8797479a24 | 18186b5105b39136562f26180bf28a1a1afb203e | refs/heads/master | 2020-04-03T14:36:15.630722 | 2018-11-05T09:22:31 | 2018-11-05T09:22:31 | 155,327,821 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 736 | java | package com.xk.bbs.service.impl;
import com.xk.bbs.bean.PostType;
import com.xk.bbs.dao.BaseDaoImpl;
import com.xk.bbs.service.PostTypeService;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.List;
@Service
@Transactional
public class PostTypeServiceImpl extends BaseDaoImpl<PostType> implements PostTypeService {
@Override
public List<PostType> findAllPostType() {
return findAll();
}
@Override
public PostType findPostTypeByAlias(String alias) {
// .uniqueResult() 这个不能少,否则查不到结果
return (PostType) getSession().createQuery("from PostType where alias = ?0 ").setParameter(0,alias).uniqueResult();
}
}
| [
"zhangxiangkun0_0@sina.com"
] | zhangxiangkun0_0@sina.com |
4f5749e8015b18e14d737a03b1b3761fe9c6f943 | 6484f6689c0fc2a40ca352ed48d0de7bec542964 | /com.sap.cloud.lm.sl.cf.persistence/src/main/java/com/sap/cloud/lm/sl/cf/persistence/query/providers/SqlProgressMessageQueryProvider.java | 0a6c02bdcd1c7f34d88c319cca6e76f19eef8e4d | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | ttsokov/cf-mta-deploy-service | b5bec61902c8594702d0a3fe5f6c1f50470729e5 | 3d83899656582304b76c38a713ab4bc9a489fa17 | refs/heads/master | 2018-12-20T04:05:48.458717 | 2018-12-05T16:09:55 | 2018-12-12T12:31:50 | 106,009,969 | 0 | 0 | null | 2017-10-06T13:50:16 | 2017-10-06T13:50:15 | null | UTF-8 | Java | false | false | 14,171 | java | package com.sap.cloud.lm.sl.cf.persistence.query.providers;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.sap.cloud.lm.sl.cf.persistence.DataSourceWithDialect;
import com.sap.cloud.lm.sl.cf.persistence.dialects.DataSourceDialect;
import com.sap.cloud.lm.sl.cf.persistence.model.ProgressMessage;
import com.sap.cloud.lm.sl.cf.persistence.model.ProgressMessage.ProgressMessageType;
import com.sap.cloud.lm.sl.cf.persistence.query.SqlQuery;
import com.sap.cloud.lm.sl.cf.persistence.util.JdbcUtil;
public class SqlProgressMessageQueryProvider {
private static final String COLUMN_NAME_ID = "ID";
private static final String COLUMN_NAME_PROCESS_ID = "PROCESS_ID";
private static final String COLUMN_NAME_TASK_ID = "TASK_ID";
private static final String COLUMN_NAME_TASK_EXECUTION_ID = "TASK_EXECUTION_ID";
private static final String COLUMN_NAME_TYPE = "TYPE";
private static final String COLUMN_NAME_TEXT = "TEXT";
private static final String COLUMN_NAME_TIMESTAMP = "TIMESTAMP";
private static final String SELECT_MESSAGES_BY_PROCESS_ID = "SELECT ID, PROCESS_ID, TASK_ID, TASK_EXECUTION_ID, TYPE, TEXT, TIMESTAMP FROM %s WHERE PROCESS_ID=? ORDER BY ID";
private static final String SELECT_MESSAGES_BY_PROCESS_AND_TASK_ID_AND_TASK_EXECUTION_ID = "SELECT ID, PROCESS_ID, TASK_ID, TASK_EXECUTION_ID, TYPE, TEXT, TIMESTAMP FROM %s WHERE PROCESS_ID=? AND TASK_ID=? AND TASK_EXECUTION_ID=? ORDER BY ID";
private static final String SELECT_MESSAGES_BY_PROCESS_AND_TASK_ID = "SELECT TASK_EXECUTION_ID FROM %s WHERE PROCESS_ID=? AND TASK_ID=? ORDER BY ID DESC";
private static final String SELECT_SPECIFIC_MESSAGE = "SELECT ID, PROCESS_ID, TASK_ID, TASK_EXECUTION_ID, TYPE, TEXT, TIMESTAMP FROM %s WHERE PROCESS_ID=? AND TASK_ID=? AND TASK_EXECUTION_ID=? AND TYPE=? ORDER BY ID";
private static final String SELECT_MESSAGES_BY_PROCESS_ID_AND_TYPE = "SELECT ID, PROCESS_ID, TASK_ID, TASK_EXECUTION_ID, TYPE, TEXT, TIMESTAMP FROM %s WHERE PROCESS_ID=? AND TYPE=? ORDER BY ID";
private static final String SELECT_ALL_MESSAGES = "SELECT ID, PROCESS_ID, TASK_ID, TASK_EXECUTION_ID, TYPE, TEXT, TIMESTAMP FROM %s ORDER BY ID";
private static final String INSERT_MESSAGE = "INSERT INTO %s (ID, PROCESS_ID, TASK_ID, TASK_EXECUTION_ID, TYPE, TEXT, TIMESTAMP) VALUES(%s, ?, ?, ?, ?, ?, ?)";
private static final String DELETE_MESSAGES_BY_PROCESS_AND_TASK_ID = "DELETE FROM %s WHERE PROCESS_ID=? AND TASK_ID=? AND TASK_EXECUTION_ID=?";
private static final String DELETE_MESSAGES_BY_PROCESS_ID = "DELETE FROM %s WHERE PROCESS_ID=?";
private static final String DELETE_MESSAGES_BY_PROCESS_ID_AND_TASK_ID = "DELETE FROM %s WHERE PROCESS_ID=? AND TASK_ID=?";
private static final String DELETE_MESSAGES_OLDER_THAN = "DELETE FROM %s WHERE TIMESTAMP < ?";
private static final String UPDATE_MESSAGE_BY_ID = "UPDATE %s SET TEXT=?, TIMESTAMP=? WHERE ID=?";
private static final String ID_SEQ_NAME = "ID_SEQ";
private final String tableName;
private final DataSourceWithDialect dataSourceWithDialect;
public SqlProgressMessageQueryProvider(String tableName, DataSourceWithDialect dataSourceWithDialect) {
this.tableName = tableName;
this.dataSourceWithDialect = dataSourceWithDialect;
}
public SqlQuery<Boolean> getAddQuery(final ProgressMessage message) {
return (Connection connection) -> {
PreparedStatement statement = null;
try {
statement = connection.prepareStatement(getQuery(INSERT_MESSAGE, tableName));
statement.setString(1, message.getProcessId());
statement.setString(2, message.getTaskId());
statement.setString(3, message.getTaskExecutionId());
statement.setString(4, message.getType()
.name());
statement.setString(5, message.getText());
statement.setTimestamp(6, new Timestamp(message.getTimestamp()
.getTime()));
int rowsInserted = statement.executeUpdate();
return rowsInserted > 0;
} finally {
JdbcUtil.closeQuietly(statement);
}
};
}
public SqlQuery<Boolean> getUpdateQuery(final long existingId, final ProgressMessage newMessage) {
return (Connection connection) -> {
PreparedStatement statement = null;
try {
statement = connection.prepareStatement(getQuery(UPDATE_MESSAGE_BY_ID, tableName));
statement.setString(1, newMessage.getText());
statement.setTimestamp(2, new Timestamp(newMessage.getTimestamp()
.getTime()));
statement.setLong(3, existingId);
int rowsUpdated = statement.executeUpdate();
return rowsUpdated == 1;
} finally {
JdbcUtil.closeQuietly(statement);
}
};
}
public SqlQuery<Integer> getRemoveByProcessIdQuery(final String processId) {
return (Connection connection) -> {
PreparedStatement statement = null;
try {
statement = connection.prepareStatement(getQuery(DELETE_MESSAGES_BY_PROCESS_ID, tableName));
statement.setString(1, processId);
return statement.executeUpdate();
} finally {
JdbcUtil.closeQuietly(statement);
}
};
}
public SqlQuery<Integer> getRemoveByProcessIdTaskIdAndTaskExecutionIdQuery(final String processId, final String taskId,
final String taskExecutionId) {
return (Connection connection) -> {
PreparedStatement statement = null;
try {
statement = connection.prepareStatement(getQuery(DELETE_MESSAGES_BY_PROCESS_AND_TASK_ID, tableName));
statement.setString(1, processId);
statement.setString(2, taskId);
statement.setString(3, taskExecutionId);
return statement.executeUpdate();
} finally {
JdbcUtil.closeQuietly(statement);
}
};
}
public SqlQuery<Integer> getRemoveOlderThanQuery(Date timestamp) {
return (Connection connection) -> {
PreparedStatement statement = null;
try {
statement = connection.prepareStatement(getQuery(DELETE_MESSAGES_OLDER_THAN, tableName));
statement.setTimestamp(1, new Timestamp(timestamp.getTime()));
return statement.executeUpdate();
} finally {
JdbcUtil.closeQuietly(statement);
}
};
}
public SqlQuery<Integer> getRemoveByProcessInstanceIdAndTaskIdQuery(final String processId, String taskId) {
return (Connection connection) -> {
PreparedStatement statement = null;
try {
statement = connection.prepareStatement(getQuery(DELETE_MESSAGES_BY_PROCESS_ID_AND_TASK_ID, tableName));
statement.setString(1, processId);
statement.setString(2, taskId);
return statement.executeUpdate();
} finally {
JdbcUtil.closeQuietly(statement);
}
};
}
public SqlQuery<List<ProgressMessage>> getFindAllQuery() {
return (Connection connection) -> {
PreparedStatement statement = null;
ResultSet resultSet = null;
try {
List<ProgressMessage> messages = new ArrayList<>();
statement = connection.prepareStatement(getQuery(SELECT_ALL_MESSAGES, tableName));
resultSet = statement.executeQuery();
while (resultSet.next()) {
messages.add(getMessage(resultSet));
}
return messages;
} finally {
JdbcUtil.closeQuietly(resultSet);
JdbcUtil.closeQuietly(statement);
}
};
}
public SqlQuery<List<ProgressMessage>> getFindByProcessIdQuery(final String processId) {
return (Connection connection) -> {
PreparedStatement statement = null;
ResultSet resultSet = null;
try {
List<ProgressMessage> messages = new ArrayList<>();
statement = connection.prepareStatement(getQuery(SELECT_MESSAGES_BY_PROCESS_ID, tableName));
statement.setString(1, processId);
resultSet = statement.executeQuery();
while (resultSet.next()) {
messages.add(getMessage(resultSet));
}
return messages;
} finally {
JdbcUtil.closeQuietly(resultSet);
JdbcUtil.closeQuietly(statement);
}
};
}
public SqlQuery<List<ProgressMessage>> getFindByProcessIdTaskIdAndTaskExecutionIdQuery(final String processId, final String taskId,
final String taskExecutionId) {
return (Connection connection) -> {
PreparedStatement statement = null;
ResultSet resultSet = null;
try {
List<ProgressMessage> messages = new ArrayList<>();
statement = connection.prepareStatement(getQuery(SELECT_MESSAGES_BY_PROCESS_AND_TASK_ID_AND_TASK_EXECUTION_ID, tableName));
statement.setString(1, processId);
statement.setString(2, taskId);
statement.setString(3, taskExecutionId);
resultSet = statement.executeQuery();
while (resultSet.next()) {
messages.add(getMessage(resultSet));
}
return messages;
} finally {
JdbcUtil.closeQuietly(resultSet);
JdbcUtil.closeQuietly(statement);
}
};
}
public SqlQuery<String> getFindLastTaskExecutionIdQuery(final String processId, final String taskId) {
return (Connection connection) -> {
PreparedStatement statement = null;
ResultSet resultSet = null;
try {
statement = connection.prepareStatement(getQuery(SELECT_MESSAGES_BY_PROCESS_AND_TASK_ID, tableName));
statement.setString(1, processId);
statement.setString(2, taskId);
resultSet = statement.executeQuery();
if (resultSet.next()) {
return resultSet.getString(COLUMN_NAME_TASK_EXECUTION_ID);
}
} finally {
JdbcUtil.closeQuietly(resultSet);
JdbcUtil.closeQuietly(statement);
}
return null;
};
}
public SqlQuery<List<ProgressMessage>> getFindByProcessIdTaskIdTaskExecutionIdAndTypeQuery(final String processId, final String taskId,
final String taskExecutionId, final ProgressMessageType type) {
return (Connection connection) -> {
PreparedStatement statement = null;
ResultSet resultSet = null;
try {
List<ProgressMessage> messages = new ArrayList<>();
statement = connection.prepareStatement(getQuery(SELECT_SPECIFIC_MESSAGE, tableName));
statement.setString(1, processId);
statement.setString(2, taskId);
statement.setString(3, taskExecutionId);
statement.setString(4, type.name());
resultSet = statement.executeQuery();
while (resultSet.next()) {
messages.add(getMessage(resultSet));
}
return messages;
} finally {
JdbcUtil.closeQuietly(resultSet);
JdbcUtil.closeQuietly(statement);
}
};
}
public SqlQuery<List<ProgressMessage>> getFindByProcessidAndTypeQuery(final String processInstanceId, final ProgressMessageType type) {
return (Connection connection) -> {
PreparedStatement statement = null;
ResultSet resultSet = null;
try {
List<ProgressMessage> messages = new ArrayList<>();
statement = connection.prepareStatement(getQuery(SELECT_MESSAGES_BY_PROCESS_ID_AND_TYPE, tableName));
statement.setString(1, processInstanceId);
statement.setString(2, type.name());
resultSet = statement.executeQuery();
while (resultSet.next()) {
messages.add(getMessage(resultSet));
}
return messages;
} finally {
JdbcUtil.closeQuietly(resultSet);
JdbcUtil.closeQuietly(statement);
}
};
}
private ProgressMessage getMessage(ResultSet resultSet) throws SQLException {
ProgressMessage message = new ProgressMessage();
message.setId(resultSet.getLong(COLUMN_NAME_ID));
message.setProcessId(resultSet.getString(COLUMN_NAME_PROCESS_ID));
message.setTaskId(resultSet.getString(COLUMN_NAME_TASK_ID));
message.setTaskExecutionId(resultSet.getString(COLUMN_NAME_TASK_EXECUTION_ID));
message.setText(resultSet.getString(COLUMN_NAME_TEXT));
message.setType(ProgressMessageType.valueOf(resultSet.getString(COLUMN_NAME_TYPE)));
Timestamp dbTimestamp = resultSet.getTimestamp(COLUMN_NAME_TIMESTAMP);
Date timestamp = (dbTimestamp == null) ? new Date() : new Date(dbTimestamp.getTime());
message.setTimestamp(timestamp);
return message;
}
private String getQuery(String statementTemplate, String tableName) {
return String.format(statementTemplate, tableName, getDataSourceDialect().getSequenceNextValueSyntax(ID_SEQ_NAME));
}
protected DataSourceDialect getDataSourceDialect() {
return dataSourceWithDialect.getDataSourceDialect();
}
}
| [
"34945711+valentinEmpy@users.noreply.github.com"
] | 34945711+valentinEmpy@users.noreply.github.com |
f09047b95e0ddc43fae9819247b4680311f7703f | b78f4e4fb8689c0c3b71a1562a7ee4228a116cda | /JFramework/crypto/src/main/java/org/bouncycastle/crypto/tls/TlsECDHKeyExchange.java | a7e39fac9fecf10cf52c742e72e381c5fff6f73a | [
"LicenseRef-scancode-unknown-license-reference",
"MIT",
"Apache-2.0"
] | permissive | richkmeli/JFramework | 94c6888a6bb9af8cbff924e8a1525e6ec4765902 | 54250a32b196bb9408fb5715e1c677a26255bc29 | refs/heads/master | 2023-07-24T23:59:19.077417 | 2023-05-05T22:52:14 | 2023-05-05T22:52:14 | 176,379,860 | 5 | 6 | Apache-2.0 | 2023-07-13T22:58:27 | 2019-03-18T22:32:12 | Java | UTF-8 | Java | false | false | 9,032 | java | package org.bouncycastle.crypto.tls;
import org.bouncycastle.asn1.x509.KeyUsage;
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
import org.bouncycastle.crypto.params.AsymmetricKeyParameter;
import org.bouncycastle.crypto.params.ECDomainParameters;
import org.bouncycastle.crypto.params.ECPrivateKeyParameters;
import org.bouncycastle.crypto.params.ECPublicKeyParameters;
import org.bouncycastle.crypto.util.PublicKeyFactory;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Vector;
/**
* (D)TLS ECDH key exchange (see RFC 4492).
*
* @deprecated Migrate to the (D)TLS API in org.bouncycastle.tls (bctls jar).
*/
public class TlsECDHKeyExchange extends AbstractTlsKeyExchange {
protected TlsSigner tlsSigner;
protected int[] namedCurves;
protected short[] clientECPointFormats, serverECPointFormats;
protected AsymmetricKeyParameter serverPublicKey;
protected TlsAgreementCredentials agreementCredentials;
protected ECPrivateKeyParameters ecAgreePrivateKey;
protected ECPublicKeyParameters ecAgreePublicKey;
public TlsECDHKeyExchange(int keyExchange, Vector supportedSignatureAlgorithms, int[] namedCurves,
short[] clientECPointFormats, short[] serverECPointFormats) {
super(keyExchange, supportedSignatureAlgorithms);
switch (keyExchange) {
case KeyExchangeAlgorithm.ECDHE_RSA:
this.tlsSigner = new TlsRSASigner();
break;
case KeyExchangeAlgorithm.ECDHE_ECDSA:
this.tlsSigner = new TlsECDSASigner();
break;
case KeyExchangeAlgorithm.ECDH_anon:
case KeyExchangeAlgorithm.ECDH_RSA:
case KeyExchangeAlgorithm.ECDH_ECDSA:
this.tlsSigner = null;
break;
default:
throw new IllegalArgumentException("unsupported key exchange algorithm");
}
this.namedCurves = namedCurves;
this.clientECPointFormats = clientECPointFormats;
this.serverECPointFormats = serverECPointFormats;
}
public void init(TlsContext context) {
super.init(context);
if (this.tlsSigner != null) {
this.tlsSigner.init(context);
}
}
public void skipServerCredentials() throws IOException {
if (keyExchange != KeyExchangeAlgorithm.ECDH_anon) {
throw new TlsFatalAlert(AlertDescription.unexpected_message);
}
}
public void processServerCertificate(Certificate serverCertificate) throws IOException {
if (keyExchange == KeyExchangeAlgorithm.ECDH_anon) {
throw new TlsFatalAlert(AlertDescription.unexpected_message);
}
if (serverCertificate.isEmpty()) {
throw new TlsFatalAlert(AlertDescription.bad_certificate);
}
org.bouncycastle.asn1.x509.Certificate x509Cert = serverCertificate.getCertificateAt(0);
SubjectPublicKeyInfo keyInfo = x509Cert.getSubjectPublicKeyInfo();
try {
this.serverPublicKey = PublicKeyFactory.createKey(keyInfo);
} catch (RuntimeException e) {
throw new TlsFatalAlert(AlertDescription.unsupported_certificate, e);
}
if (tlsSigner == null) {
try {
this.ecAgreePublicKey = TlsECCUtils.validateECPublicKey((ECPublicKeyParameters) this.serverPublicKey);
} catch (ClassCastException e) {
throw new TlsFatalAlert(AlertDescription.certificate_unknown, e);
}
TlsUtils.validateKeyUsage(x509Cert, KeyUsage.keyAgreement);
} else {
if (!tlsSigner.isValidPublicKey(this.serverPublicKey)) {
throw new TlsFatalAlert(AlertDescription.certificate_unknown);
}
TlsUtils.validateKeyUsage(x509Cert, KeyUsage.digitalSignature);
}
super.processServerCertificate(serverCertificate);
}
public boolean requiresServerKeyExchange() {
switch (keyExchange) {
case KeyExchangeAlgorithm.ECDH_anon:
case KeyExchangeAlgorithm.ECDHE_ECDSA:
case KeyExchangeAlgorithm.ECDHE_RSA:
return true;
default:
return false;
}
}
public byte[] generateServerKeyExchange()
throws IOException {
if (!requiresServerKeyExchange()) {
return null;
}
// ECDH_anon is handled here, ECDHE_* in a subclass
ByteArrayOutputStream buf = new ByteArrayOutputStream();
this.ecAgreePrivateKey = TlsECCUtils.generateEphemeralServerKeyExchange(context.getSecureRandom(), namedCurves,
clientECPointFormats, buf);
return buf.toByteArray();
}
public void processServerKeyExchange(InputStream input)
throws IOException {
if (!requiresServerKeyExchange()) {
throw new TlsFatalAlert(AlertDescription.unexpected_message);
}
// ECDH_anon is handled here, ECDHE_* in a subclass
ECDomainParameters curve_params = TlsECCUtils.readECParameters(namedCurves, clientECPointFormats, input);
byte[] point = TlsUtils.readOpaque8(input);
this.ecAgreePublicKey = TlsECCUtils.validateECPublicKey(TlsECCUtils.deserializeECPublicKey(
clientECPointFormats, curve_params, point));
}
public void validateCertificateRequest(CertificateRequest certificateRequest) throws IOException {
if (keyExchange == KeyExchangeAlgorithm.ECDH_anon) {
throw new TlsFatalAlert(AlertDescription.handshake_failure);
}
/*
* RFC 4492 3. [...] The ECDSA_fixed_ECDH and RSA_fixed_ECDH mechanisms are usable with
* ECDH_ECDSA and ECDH_RSA. Their use with ECDHE_ECDSA and ECDHE_RSA is prohibited because
* the use of a long-term ECDH client key would jeopardize the forward secrecy property of
* these algorithms.
*/
short[] types = certificateRequest.getCertificateTypes();
for (int i = 0; i < types.length; ++i) {
switch (types[i]) {
case ClientCertificateType.rsa_sign:
case ClientCertificateType.dss_sign:
case ClientCertificateType.ecdsa_sign:
case ClientCertificateType.rsa_fixed_ecdh:
case ClientCertificateType.ecdsa_fixed_ecdh:
break;
default:
throw new TlsFatalAlert(AlertDescription.illegal_parameter);
}
}
}
public void processClientCredentials(TlsCredentials clientCredentials) throws IOException {
if (keyExchange == KeyExchangeAlgorithm.ECDH_anon) {
throw new TlsFatalAlert(AlertDescription.internal_error);
}
if (clientCredentials instanceof TlsAgreementCredentials) {
// TODO Validate client cert has matching parameters (see 'TlsECCUtils.areOnSameCurve')?
this.agreementCredentials = (TlsAgreementCredentials) clientCredentials;
} else if (clientCredentials instanceof TlsSignerCredentials) {
// OK
} else {
throw new TlsFatalAlert(AlertDescription.internal_error);
}
}
public void generateClientKeyExchange(OutputStream output) throws IOException {
if (agreementCredentials == null) {
this.ecAgreePrivateKey = TlsECCUtils.generateEphemeralClientKeyExchange(context.getSecureRandom(),
serverECPointFormats, ecAgreePublicKey.getParameters(), output);
}
}
public void processClientCertificate(Certificate clientCertificate) throws IOException {
if (keyExchange == KeyExchangeAlgorithm.ECDH_anon) {
throw new TlsFatalAlert(AlertDescription.unexpected_message);
}
// TODO Extract the public key
// TODO If the certificate is 'fixed', take the public key as ecAgreeClientPublicKey
}
public void processClientKeyExchange(InputStream input) throws IOException {
if (ecAgreePublicKey != null) {
// For ecdsa_fixed_ecdh and rsa_fixed_ecdh, the key arrived in the client certificate
return;
}
byte[] point = TlsUtils.readOpaque8(input);
ECDomainParameters curve_params = this.ecAgreePrivateKey.getParameters();
this.ecAgreePublicKey = TlsECCUtils.validateECPublicKey(TlsECCUtils.deserializeECPublicKey(
serverECPointFormats, curve_params, point));
}
public byte[] generatePremasterSecret() throws IOException {
if (agreementCredentials != null) {
return agreementCredentials.generateAgreement(ecAgreePublicKey);
}
if (ecAgreePrivateKey != null) {
return TlsECCUtils.calculateECDHBasicAgreement(ecAgreePublicKey, ecAgreePrivateKey);
}
throw new TlsFatalAlert(AlertDescription.internal_error);
}
}
| [
"richkmeli@gmail.com"
] | richkmeli@gmail.com |
011f207f41c29143afde81ff158fe4091ac6496c | 24d882dc128c93dc451c8baede898d47a0c2ae7b | /src/main/java/net/tack/school/springrest/errorhandler/ErrorHandler.java | d8e314495679d307bca9a8c8ee6a47707646f8e8 | [] | no_license | antongth/school_2020 | 47eab1d6aa96100e00d6c229ccdfd4b006bf91bc | 0eccc84645d5eaeb671d8b3c56b3f296d6c728a9 | refs/heads/main | 2023-03-29T23:36:36.043924 | 2021-04-05T12:37:24 | 2021-04-05T12:37:24 | 354,830,737 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,665 | java | package net.thumbtack.school.springrest.errorhandler;
import net.thumbtack.school.springrest.dto.ResponseError;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
@ControllerAdvice
public class ErrorHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(ErrorHandler.class);
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler(MethodArgumentNotValidException.class)
@ResponseBody
public ResponseError handleErrorValidation(MethodArgumentNotValidException exc) {
final ResponseError error = new ResponseError();
exc.getBindingResult().getFieldErrors().forEach(fieldError-> {
error.getAllErrors().add(String.format("%s:%s", fieldError.getField(), fieldError.getDefaultMessage()));
});
exc.getBindingResult().getGlobalErrors().forEach(err-> {
error.getAllErrors().add(String.format("global:%s", err.getDefaultMessage()));
});
return error;
}
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler(IllegalStateException.class)
@ResponseBody
public ResponseError handleErrorIllegalState(IllegalStateException exc) {
final ResponseError error = new ResponseError();
error.getAllErrors().add(exc.getMessage());
return error;
}
}
| [
"antongth@gmail.com"
] | antongth@gmail.com |
03f6d1b7e2f3a8aac4801499fb5e3415f5fb0b04 | a9bd48261e22fbacb8fcaf09cd9ce02aec478078 | /QwcNew/src/com/gservfocus/qwc/adapter/DetailSectionsPagerAdapter.java | 2a2c124bcf68c66fe30deeab92aa8aa23afd3563 | [] | no_license | Postgre/QwcNew | cffbd84328058d9b555abe41820127ff14a82527 | 92de0a177d593853e08e8f4e2c91bedd7589a2e0 | refs/heads/master | 2021-05-30T20:40:50.339540 | 2016-03-22T10:08:15 | 2016-03-22T10:08:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,204 | java | package com.gservfocus.qwc.adapter;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.view.ViewGroup;
import com.gservfocus.qwc.activity.fragment.HomeFragment;
import com.gservfocus.qwc.activity.fragment.MoreFragment;
public class DetailSectionsPagerAdapter extends FragmentStatePagerAdapter {
public static final int ARG_SECTION_COUNT = 2;
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
// TODO Auto-generated method stub
super.destroyItem(container, position, object);
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
// TODO Auto-generated method stub
return super.instantiateItem(container, position);
}
public DetailSectionsPagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int arg0) {
Fragment fragment = null;
switch (arg0) {
case 0:
fragment = new HomeFragment();
break;
case 1:
fragment = new MoreFragment();
break;
default:
break;
}
return fragment;
}
@Override
public int getCount() {
return ARG_SECTION_COUNT;
}
}
| [
"zhonghao.rao@shuyun.com"
] | zhonghao.rao@shuyun.com |
31530cf8f7e4e8ca16c370fb4dde2de2d5616e99 | 8be660e1c65ad997616315fb1d585300b9ac0eef | /Java基础/12综合练习/src/com/zzw/demo01/ArrayListToFileTest.java | 6efc1e50f869732e2aba46b35aa6f09db9cf2f2b | [] | no_license | xxBei/JavaStudy | 36db6fee727bc5a0abc50c55b83cc3dbc1e8d1be | 6f5a7363934032d3d62cb44878975fafd51c5e5d | refs/heads/master | 2022-12-27T00:32:38.042363 | 2019-05-27T15:22:34 | 2019-05-27T15:22:34 | 146,560,577 | 0 | 0 | null | 2022-12-16T04:49:02 | 2018-08-29T07:14:10 | Java | UTF-8 | Java | false | false | 7,977 | java | package com.zzw.demo01;
import java.io.*;
import java.util.ArrayList;
import java.util.Scanner;
public class ArrayListToFileTest {
/**
* 需求:
* 键盘录入3个学生的信息(学号,姓名,年龄,居住地)存入集合,然后遍历集合把每个学生信息
* 存入到文本文件(每个学生信息为一行数据,自己定义分隔符)
*
* */
public static void main(String[] args) throws IOException{
//文件路径
String fileName = "txt/StudentText";
while (true) {
//创键主界面
Scanner sc = new Scanner(System.in);
System.out.println("--------欢迎进入学生管理系统--------");
System.out.println("1.查询所有学生的信息");
System.out.println("2.添加学生的信息");
System.out.println("3.删除学生的信息");
System.out.println("4.修改学生的信息");
System.out.println("5.退出学生管理系统");
System.out.println("----------------------------------");
String changId = sc.nextLine();
//输入数字进行选择不同功能
switch (changId){
case "1":
//查询学生信息
selectStudent(fileName);
break;
case "2":
//添加学生信息
addStudent(fileName);
break;
case "3":
//删除学生信息
delStudent(fileName);
break;
case "4":
//修改学生信息
updateStudent(fileName);
break;
case "5":
default:
System.out.println("----已退出学生管理系统----");
System.exit(0);//退出jvm
break;
}
}
}
//查询学生信息
public static void selectStudent(String fileName) throws IOException{
//创键集合对象
ArrayList<Student> arrayList = new ArrayList<>();
//查询文件是否存在数据
readFile(fileName,arrayList);
if(arrayList.size() == 0){
System.out.println("抱歉,当前没有任何学生信息");
return;
}
System.out.println("学号\t\t姓名\t\t年级\t\t居住地");
for(int i=0;i<arrayList.size();i++){
Student s = arrayList.get(i);
System.out.println(s.getId()+"\t\t"+s.getName()+"\t\t"+s.getAge()+"\t\t"+s.getAddress());
}
}
//添加学生信息
public static void addStudent(String fileName) throws IOException{
// 创键集合对象
ArrayList<Student> arrayList = new ArrayList<>();
// 读取文件是否存在数据
readFile(fileName,arrayList);
//创键学生对象
Student student = new Student();
//创键键盘录入
Scanner sc = new Scanner(System.in);
System.out.println("请输入学号:");
String id = sc.nextLine();
for(int i=0;i<arrayList.size();i++){
Student s = arrayList.get(i);
if(s.getId().equals(id)){
System.out.println("输入的学号已存在,请重新选择");
return;
}
break;
}
System.out.println("请输入姓名:");
String name = sc.nextLine();
System.out.println("请输入年龄:");
String age = sc.nextLine();
System.out.println("请输入居住地:");
String address = sc.nextLine();
//将数据添加到学生对象
student.setId(id);
student.setName(name);
student.setAge(age);
student.setAddress(address);
//将学生对象添加到集合
arrayList.add(student);
writeFile(fileName,arrayList);
}
//删除学生信息
public static void delStudent(String fileName) throws IOException{
// 创键集合对象
ArrayList<Student> arrayList = new ArrayList<>();
// 读取文件中的数据
readFile(fileName,arrayList);
Scanner sc = new Scanner(System.in);
System.out.println("请输入要删除的学号:");
String id = sc.nextLine();
int index = -1;
//循环集合数据
for(int i=0;i<arrayList.size();i++){
Student s = arrayList.get(i);//获取到i对应的集合值
if(s.getId().equals(id)){
index = i;
break;
}
}
if(index == -1){
System.out.println("没有查到对应的学生请重新输入");
}else{
arrayList.remove(index);
writeFile(fileName,arrayList);
System.out.println("删除成功");
}
}
//修改学生信息
public static void updateStudent(String fileName) throws IOException{
// 创键集合对象
ArrayList<Student> arrayList = new ArrayList<>();
// 读取文件中的数据
readFile(fileName,arrayList);
Student student = new Student();
Scanner sc = new Scanner(System.in);
System.out.println("请输入要修改的学号:");
String id = sc.nextLine();
int index = -1;
for(int i=0;i<arrayList.size();i++){
Student s = arrayList.get(i);
if(s.getId().equals(id)){
index = i;
break;
}
}
if(index == -1){
System.out.println("您输入的学号已存在,请重新选择");
}else {
System.out.println("请输入新的姓名:");
String name = sc.nextLine();
System.out.println("请输入新的年龄:");
String age = sc.nextLine();
System.out.println("请输入新的居住地:");
String address = sc.nextLine();
student.setId(id);
student.setName(name);
student.setAge(age);
student.setAddress(address);
// 根据index,修改Student类中的数据
arrayList.set(index,student);
writeFile(fileName,arrayList);
System.out.println("修改成功");
}
}
// 缓冲输出流对象,用于存储数据
public static void writeFile(String fileName,ArrayList<Student> arrayList) throws IOException{
// 定义缓冲输出对象,用于写入对象
BufferedWriter bw = new BufferedWriter(new FileWriter(fileName));
for(int i=0;i<arrayList.size();i++){
// 存储集合中所有的数据
Student s = arrayList.get(i);
StringBuilder sb = new StringBuilder();
// 将所有的字符串进行拼接
sb.append(s.getId()).append(",").append(s.getName()).append(",").append(s.getAge()).append(",").append(s.getAddress());
// 写入字符串
bw.write(sb.toString());
bw.newLine();
bw.flush();
}
// 释放资源
bw.close();
}
// 缓冲输入流对象,用于读取数据
public static void readFile(String fileName,ArrayList<Student> arrayList) throws IOException{
// 定义缓冲流输入对象
BufferedReader br = new BufferedReader(new FileReader(fileName));
// 定义字符串用于接收读取的数据
String dates;
while ((dates=br.readLine()) != null){
// 定义数组用于接收分割的字符串
String[] array = dates.split(",");
// 定义学生类对象
Student s = new Student();
s.setId(array[0]);
s.setName(array[1]);
s.setAge(array[2]);
s.setAddress(array[3]);
// 接收学生类对象
arrayList.add(s);
}
// 释放资源
br.close();
}
}
| [
"zzw_bei@163.com"
] | zzw_bei@163.com |
043eca64a3c1538efc9d6fd8876ad1026c1fce97 | e573b3ce77920f5d52d60df1935b40ab3dda8385 | /aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/Gatekeeper.java | 851508d44da54a91bbdb408313c50bea4de24bfd | [] | no_license | gryphonjp/acis374withcustoms | b4453cb04616c14f3b452781ab470256bb519ab2 | 440d4714473280363d63b18ecf20f557685abca1 | refs/heads/master | 2020-05-14T13:41:51.788232 | 2019-04-17T04:52:38 | 2019-04-17T04:52:38 | 181,818,224 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,897 | java | package net.sf.l2j.gameserver.model.actor.instance;
import java.util.Calendar;
import java.util.StringTokenizer;
import net.sf.l2j.Config;
import net.sf.l2j.gameserver.data.cache.HtmCache;
import net.sf.l2j.gameserver.data.manager.CastleManager;
import net.sf.l2j.gameserver.data.xml.TeleportLocationData;
import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
import net.sf.l2j.gameserver.model.location.TeleportLocation;
import net.sf.l2j.gameserver.network.SystemMessageId;
import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
/**
* An instance type extending {@link Folk}, used for teleporters.<br>
* <br>
* A teleporter allows {@link Player}s to teleport to a specific location, for a fee.
*/
public final class Gatekeeper extends Folk
{
public Gatekeeper(int objectId, NpcTemplate template)
{
super(objectId, template);
}
@Override
public String getHtmlPath(int npcId, int val)
{
String filename = "";
if (val == 0)
filename = "" + npcId;
else
filename = npcId + "-" + val;
return "data/html/teleporter/" + filename + ".htm";
}
@Override
public void onBypassFeedback(Player player, String command)
{
// Generic PK check. Send back the HTM if found and cancel current action.
if (!Config.KARMA_PLAYER_CAN_USE_GK && player.getKarma() > 0 && showPkDenyChatWindow(player, "teleporter"))
return;
if (command.startsWith("goto"))
{
final StringTokenizer st = new StringTokenizer(command, " ");
st.nextToken();
// No more tokens.
if (!st.hasMoreTokens())
return;
// No interaction possible with the NPC.
if (!canInteract(player))
return;
// Retrieve the list.
final TeleportLocation list = TeleportLocationData.getInstance().getTeleportLocation(Integer.parseInt(st.nextToken()));
if (list == null)
return;
// Siege is currently in progress in this location.
if (CastleManager.getInstance().getActiveSiege(list.getX(), list.getY(), list.getZ()) != null)
{
player.sendPacket(SystemMessageId.CANNOT_PORT_VILLAGE_IN_SIEGE);
return;
}
// The list is for noble, but player isn't noble.
if (list.isNoble() && !player.isNoble())
{
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
html.setFile("data/html/teleporter/nobleteleporter-no.htm");
html.replace("%objectId%", getObjectId());
html.replace("%npcname%", getName());
player.sendPacket(html);
player.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
// Retrieve price list. Potentially cut it by 2 depending of current date.
int price = list.getPrice();
if (!list.isNoble())
{
Calendar cal = Calendar.getInstance();
if (cal.get(Calendar.HOUR_OF_DAY) >= 20 && cal.get(Calendar.HOUR_OF_DAY) <= 23 && (cal.get(Calendar.DAY_OF_WEEK) == 1 || cal.get(Calendar.DAY_OF_WEEK) == 7))
price /= 2;
}
// Delete related items, and if successful teleport the player to the location.
if (player.destroyItemByItemId("Teleport ", (list.isNoble()) ? 6651 : 57, price, this, true))
player.teleToLocation(list, 20);
player.sendPacket(ActionFailed.STATIC_PACKET);
}
else if (command.startsWith("Chat"))
{
int val = 0;
try
{
val = Integer.parseInt(command.substring(5));
}
catch (IndexOutOfBoundsException ioobe)
{
}
catch (NumberFormatException nfe)
{
}
// Show half price HTM depending of current date. If not existing, use the regular "-1.htm".
if (val == 1)
{
Calendar cal = Calendar.getInstance();
if (cal.get(Calendar.HOUR_OF_DAY) >= 20 && cal.get(Calendar.HOUR_OF_DAY) <= 23 && (cal.get(Calendar.DAY_OF_WEEK) == 1 || cal.get(Calendar.DAY_OF_WEEK) == 7))
{
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
String content = HtmCache.getInstance().getHtm("data/html/teleporter/half/" + getNpcId() + ".htm");
if (content == null)
content = HtmCache.getInstance().getHtmForce("data/html/teleporter/" + getNpcId() + "-1.htm");
html.setHtml(content);
html.replace("%objectId%", getObjectId());
html.replace("%npcname%", getName());
player.sendPacket(html);
player.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
}
showChatWindow(player, val);
}
else
super.onBypassFeedback(player, command);
}
@Override
public void showChatWindow(Player player, int val)
{
// Generic PK check. Send back the HTM if found and cancel current action.
if (!Config.KARMA_PLAYER_CAN_USE_GK && player.getKarma() > 0 && showPkDenyChatWindow(player, "teleporter"))
return;
showChatWindow(player, getHtmlPath(getNpcId(), val));
}
} | [
"gryphon.fellowship@gmail.com"
] | gryphon.fellowship@gmail.com |
01406b16ea918e031aa24c627a152f93f8c68d16 | 9652bc2593163f528fef15018e59c274cb8be5fa | /src/fr/skytasul/quests/gui/creation/stages/StagesGUI.java | 53856e34b6eca886923c8d6f8b11ab628c1f1c30 | [] | no_license | i998979/BeautyQuests | eabce667ae19603b5f8513586ccadcd6f0a92b14 | 07735b00c772d1bdfcae3cb701654afc2889eb5a | refs/heads/master | 2020-05-30T17:35:11.431816 | 2019-06-02T18:05:02 | 2019-06-02T18:05:02 | 189,876,343 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 25,148 | java | package fr.skytasul.quests.gui.creation.stages;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Map.Entry;
import org.bukkit.Bukkit;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import fr.skytasul.quests.Quest;
import fr.skytasul.quests.api.QuestsAPI;
import fr.skytasul.quests.api.rewards.AbstractReward;
import fr.skytasul.quests.api.stages.AbstractStage;
import fr.skytasul.quests.api.stages.StageCreationRunnables;
import fr.skytasul.quests.api.stages.StageCreator;
import fr.skytasul.quests.api.stages.StageType;
import fr.skytasul.quests.editors.DialogEditor;
import fr.skytasul.quests.editors.Editor;
import fr.skytasul.quests.editors.TextEditor;
import fr.skytasul.quests.editors.WaitBlockClick;
import fr.skytasul.quests.gui.CustomInventory;
import fr.skytasul.quests.gui.Inventories;
import fr.skytasul.quests.gui.ItemUtils;
import fr.skytasul.quests.gui.blocks.BlocksGUI;
import fr.skytasul.quests.gui.creation.FinishGUI;
import fr.skytasul.quests.gui.creation.ItemsGUI;
import fr.skytasul.quests.gui.creation.RewardsGUI;
import fr.skytasul.quests.gui.mobs.MobsListGUI;
import fr.skytasul.quests.gui.npc.SelectGUI;
import fr.skytasul.quests.stages.StageArea;
import fr.skytasul.quests.stages.StageBringBack;
import fr.skytasul.quests.stages.StageChat;
import fr.skytasul.quests.stages.StageFish;
import fr.skytasul.quests.stages.StageInteract;
import fr.skytasul.quests.stages.StageMine;
import fr.skytasul.quests.stages.StageMobs;
import fr.skytasul.quests.stages.StageNPC;
import fr.skytasul.quests.utils.DebugUtils;
import fr.skytasul.quests.utils.Lang;
import fr.skytasul.quests.utils.Utils;
import fr.skytasul.quests.utils.XMaterial;
import fr.skytasul.quests.utils.compatibility.WorldGuard;
import fr.skytasul.quests.utils.types.BlockData;
import fr.skytasul.quests.utils.types.Dialog;
import fr.skytasul.quests.utils.types.Mob;
import fr.skytasul.quests.utils.types.RunnableObj;
import net.citizensnpcs.api.npc.NPC;
public class StagesGUI implements CustomInventory {
private static final ItemStack stageCreate = ItemUtils.item(XMaterial.SLIME_BALL, Lang.stageCreate.toString());
private static final ItemStack stageRemove = ItemUtils.item(XMaterial.BARRIER, Lang.stageRemove.toString());
public static final ItemStack ending = ItemUtils.item(XMaterial.BAKED_POTATO, Lang.ending.toString());
private static final ItemStack descMessage = ItemUtils.item(XMaterial.OAK_SIGN, Lang.descMessage.toString());
private static final ItemStack startMessage = ItemUtils.item(XMaterial.FEATHER, Lang.startMsg.toString());
private List<Line> lines = new ArrayList<>();
private Quest edit;
private boolean stagesEdited = false;
private FinishGUI finish = null;
public Inventory inv;
int page;
private boolean stop = false;
public Inventory open(Player p) {
if (inv == null){
inv = Bukkit.createInventory(null, 54, Lang.INVENTORY_STAGES.toString());
page = 0;
lines.add(new Line(inv, 0, this));
setStageCreate(lines.get(0));
DebugUtils.debugMessage(p, "First line initialized.");
for (int i = 1; i < 15; i++) lines.add(new Line(inv, i, this));
DebugUtils.debugMessage(p, lines.size() + " lines created.");
inv.setItem(45, ItemUtils.itemLaterPage());
inv.setItem(49, ItemUtils.itemNextPage());
inv.setItem(51, ItemUtils.itemDone());
inv.setItem(52, ItemUtils.itemCancel());
refresh(p);
}
p.openInventory(inv);
return inv;
}
/**
* Get the StagesGUI, open it for player if specified, and re implement the player in the inventories system if on true
* @param p player to open (can be null)
* @param reImplement re implement the player in the inventories system
* @return this StagesGUI
*/
public StagesGUI reopen(Player p, boolean reImplement){
if (p != null){
DebugUtils.debugMessage(p, "open");
if (reImplement) Inventories.put(p, this, inv);
p.openInventory(inv);
}
return this;
}
private void setStageCreate(Line line){
line.removeItems();
line.setFirst(stageCreate.clone(), new StageRunnable() {
public void run(Player p, LineData datas, ItemStack item) {
line.setFirst(null, null);
int i = 0;
for (Entry<StageType, StageCreator> en : StageCreator.getCreators().entrySet()){
line.setItem(i, en.getValue().item, new StageRunnable() {
public void run(Player p, LineData datas, ItemStack item) {
runClick(line, datas, en.getKey());
en.getValue().runnables.start(p, datas);
}
}, true, false);
datas.put(i + "", en.getKey());
i++;
}
line.setItems(0);
}
});
line.setItems(0);
}
private void runClick(Line line, LineData datas, StageType type){
line.removeItems();
datas.clear();
datas.put("type", type);
datas.put("rewards", new ArrayList<>());
line.setItem(0, ending, new StageRunnable() {
public void run(Player p, LineData datas, ItemStack item){
Inventories.create(p, new RewardsGUI(new RunnableObj() {
public void run(Object obj){
datas.put("rewards", obj);
reopen(p, true);
}
}, (List<AbstractReward>) datas.get("rewards")));
}
});
line.setItem(1, descMessage.clone(), new StageRunnable() {
public void run(Player p, LineData datas, ItemStack item){
Lang.DESC_MESSAGE.send(p);
TextEditor text = Editor.enterOrLeave(p, new TextEditor(p, new RunnableObj() {
public void run(Object obj){
datas.put("customText", obj);
line.editItem(1, ItemUtils.lore(line.getItem(1), (String) obj));
reopen(p, false);
}
}));
text.nul = () -> {
datas.remove("customText");
line.editItem(1, ItemUtils.lore(line.getItem(1)));
reopen(p, false);
};
text.cancel = () -> {
reopen(p, false);
};
}
});
line.setItem(2, startMessage.clone(), new StageRunnable() {
public void run(Player p, LineData datas, ItemStack item){
Lang.START_TEXT.send(p);
TextEditor text = Editor.enterOrLeave(p, new TextEditor(p, new RunnableObj() {
public void run(Object obj){
datas.put("startMessage", obj);
line.editItem(2, ItemUtils.lore(line.getItem(2), (String) obj));
reopen(p, false);
}
}));
text.nul = () -> {
datas.remove("startMessage");
line.editItem(2, ItemUtils.lore(line.getItem(2)));
reopen(p, false);
};
text.cancel = () -> {
reopen(p, false);
};
}
});
line.setFirst(stageRemove.clone(), new StageRunnable() {
public void run(Player p, LineData datas, ItemStack item) {
datas.clear();
line.removeItems();
if (line.getLine() != 14){
for (int i = line.getLine() + 1; i < 15; i++){
getLine(i).exchangeLines(getLine(i - 1));
}
DebugUtils.debugMessage(p, "--");
}
for (int i = 0; i < 15; i++){
Line l = getLine(i);
if (!isActiveLine(l)){
if (isClearLine(l)) break;
setStageCreate(l);
break;
}
}
}
});
if (line.getLine() != 14){
Line next = getLine(line.getLine() + 1);
if (!next.data.containsKey("type")) setStageCreate(next);
}
}
private boolean isActiveLine(Line line){
return line.data.containsKey("type");
}
private boolean isClearLine(Line line){
return !isActiveLine(line) && line.first == null;
}
public Line getLine(int id){
for (Line l : lines){
if (l.getLine() == id) return l;
}
return null;
}
public boolean onClick(Player p, Inventory inv, ItemStack current, int slot, ClickType click) {
if (slot > 44) {
if (slot == 45) {
if (page > 0) {
page--;
refresh(p);
}
}else if (slot == 49) {
if (page < 2) {
page++;
refresh(p);
}
}else if (slot == 51) {
if (isActiveLine(getLine(0))) finish(p);
}else if (slot == 52) {
stop = true;
p.closeInventory();
if (isActiveLine(getLine(0))) {
if (edit == null) {
Lang.QUEST_CANCEL.send(p);
}else Lang.QUEST_EDIT_CANCEL.send(p);
}
}
}else {
stagesEdited = true;
Line line = getLine(Line.getLineNumber(slot)/9 +5*page);
line.click(slot, p, current);
}
return true;
}
public CloseBehavior onClose(Player p, Inventory inv){
if (!isActiveLine(getLine(0)) || stop) return CloseBehavior.REMOVE;
return CloseBehavior.REOPEN;
}
private void refresh(Player p) {
for (int i = 0; i < 3; i++) inv.setItem(i + 46, ItemUtils.itemSeparator(i == page ? DyeColor.GREEN : DyeColor.GRAY));
for (Line line : lines) {
line.setItems(line.getActivePage());
}
}
private void finish(Player p){
if (finish == null){
finish = Inventories.create(p, edit != null ? new FinishGUI(this, edit, stagesEdited) : new FinishGUI(this));
}else Inventories.create(p, finish);
}
public List<LineData> getLinesDatas(){
List<LineData> lines = new LinkedList<>();
for (int i = 0; i < 15; i++){
if (isActiveLine(getLine(i))) lines.add(/*i, */getLine(i).data);
}
return lines;
}
public void edit(Quest quest){
for (AbstractStage st : quest.getStageManager().getStages()){
Line line = getLine(st.getID());
runClick(line, line.data, st.getType());
//line.data.put("end", st.getEnding().clone());
line.data.put("rewards", st.getRewards());
if (st.getStartMessage() != null){
line.data.put("startMessage", st.getStartMessage());
line.editItem(2, ItemUtils.lore(line.getItem(2), st.getStartMessage()));
}
if (st.getCustomText() != null){
line.data.put("customText", st.getCustomText());
line.editItem(1, ItemUtils.lore(line.getItem(1), st.getCustomText()));
}
StageCreator.getCreators().get(st.getType()).runnables.edit(line.data, st);
line.setItems(0);
}
edit = quest;
}
private static final ItemStack stageNPC = ItemUtils.item(XMaterial.OAK_SIGN, Lang.stageNPC.toString());
private static final ItemStack stageItems = ItemUtils.item(XMaterial.CHEST, Lang.stageBring.toString());
private static final ItemStack stageArea = ItemUtils.item(XMaterial.WOODEN_AXE, Lang.stageGoTo.toString());
private static final ItemStack stageMobs = ItemUtils.item(XMaterial.WOODEN_SWORD, Lang.stageMobs.toString());
private static final ItemStack stageMine = ItemUtils.item(XMaterial.WOODEN_PICKAXE, Lang.stageMine.toString());
private static final ItemStack stageChat = ItemUtils.item(XMaterial.PLAYER_HEAD, Lang.stageChat.toString());
private static final ItemStack stageInteract = ItemUtils.item(XMaterial.OAK_PLANKS, Lang.stageInteract.toString());
private static final ItemStack stageFish = ItemUtils.item(XMaterial.COD, Lang.stageFish.toString());
public static void initialize(){
DebugUtils.broadcastDebugMessage("Initlializing default stage types.");
QuestsAPI.registerStage(new StageType("REGION", StageArea.class, Lang.Find.name(), "WorldGuard"), stageArea, new CreateArea());
QuestsAPI.registerStage(new StageType("NPC", StageNPC.class, Lang.Talk.name()), stageNPC, new CreateNPC());
QuestsAPI.registerStage(new StageType("ITEMS", StageBringBack.class, Lang.Items.name()), stageItems, new CreateBringBack());
QuestsAPI.registerStage(new StageType("MOBS", StageMobs.class, Lang.Mobs.name()), stageMobs, new CreateMobs());
QuestsAPI.registerStage(new StageType("MINE", StageMine.class, Lang.Mine.name()), stageMine, new CreateMine());
QuestsAPI.registerStage(new StageType("CHAT", StageChat.class, Lang.Chat.name()), stageChat, new CreateChat());
QuestsAPI.registerStage(new StageType("INTERACT", StageInteract.class, Lang.Interact.name()), stageInteract, new CreateInteract());
QuestsAPI.registerStage(new StageType("FISH", StageFish.class, Lang.Fish.name()), stageFish, new CreateFish());
}
}
/* RUNNABLES */
class CreateNPC implements StageCreationRunnables{
private static final ItemStack stageText = ItemUtils.item(XMaterial.WRITABLE_BOOK, Lang.stageText.toString());
public void start(Player p, LineData datas) {
StagesGUI sg = datas.getGUI();
Inventories.create(p, new SelectGUI((obj) -> {
sg.reopen(p, true);
npcDone((NPC) obj, sg, datas.getLine(), datas);
}));
}
public static void npcDone(NPC npc, StagesGUI sg, Line line, LineData datas){
datas.put("npc", npc);
datas.getLine().setItem(5, stageText.clone(), new StageRunnable() {
public void run(Player p, LineData datas, ItemStack item) {
Utils.sendMessage(p, Lang.NPC_TEXT.toString());
Editor.enterOrLeave(p, new DialogEditor(p, (NPC) datas.get("npc"), (obj) -> {
sg.reopen(p, false);
datas.put("npcText", obj);
}, datas.containsKey("npcText") ? (Dialog) datas.get("npcText") : new Dialog((NPC) datas.get("npc"))));
}
}, true, true);
datas.getLine().setItem(4, ItemUtils.itemSwitch(Lang.stageHide.toString(), datas.containsKey("hide") ? (boolean) datas.get("hide") : false), new StageRunnable() {
public void run(Player p, LineData datas, ItemStack item) {
datas.put("hide", ItemUtils.toggle(item));
}
}, true, true);
}
public static void setFinish(StageNPC stage, LineData datas) {
if (datas.containsKey("npcText")) stage.setDialog(datas.get("npcText"));
if (datas.containsKey("hide")) stage.setHid((boolean) datas.get("hide"));
}
public static void setEdit(StageNPC stage, LineData datas) {
if (stage.getDialog() != null) datas.put("npcText", new Dialog(stage.getDialog().getNPC(), stage.getDialog().messages.clone()));
if (stage.isHid()) datas.put("hide", true);
npcDone(stage.getNPC(), datas.getGUI(), datas.getLine(), datas);
}
public AbstractStage finish(LineData datas, Quest qu) {
StageNPC stage = new StageNPC(qu.getStageManager(), (NPC) datas.get("npc"));
setFinish(stage, datas);
return stage;
}
public void edit(LineData datas, AbstractStage stage){
StageNPC st = (StageNPC) stage;
setEdit(st, datas);
}
}
class CreateBringBack implements StageCreationRunnables{
private static final ItemStack stageItems = ItemUtils.item(XMaterial.DIAMOND_SWORD, Lang.stageItems.toString());
public void start(Player p, LineData datas) {
StagesGUI sg = datas.getGUI();
Line line = datas.getLine();
setItem(line, sg);
List<ItemStack> items = new ArrayList<>();
datas.put("items", items);
SelectGUI npcGUI = new SelectGUI((obj) -> {
Inventories.closeWithoutExit(p);
sg.reopen(p, true);
if (obj != null) CreateNPC.npcDone((NPC) obj, sg, line, datas);
});
ItemsGUI itemsGUI = new ItemsGUI(() -> {
Inventories.create(p, npcGUI);
}, items);
Inventories.create(p, itemsGUI);
}
public static void setItem(Line line, StagesGUI sg){
line.setItem(6, stageItems.clone(), new StageRunnable() {
public void run(Player p, LineData datas, ItemStack item) {
Inventories.create(p, new ItemsGUI(() -> {
sg.reopen(p, true);
}, (List<ItemStack>) datas.get("items")));
}
});
}
public AbstractStage finish(LineData datas, Quest qu) {
StageBringBack stage = new StageBringBack(qu.getStageManager(), (NPC) datas.get("npc"), ((List<ItemStack>) datas.get("items")).toArray(new ItemStack[0]));
CreateNPC.setFinish(stage, datas);
return stage;
}
public void edit(LineData datas, AbstractStage stage){
StageBringBack st = (StageBringBack) stage;
CreateNPC.setEdit(st, datas);
datas.put("items", new ArrayList<>());
((List<ItemStack>) datas.get("items")).addAll(Arrays.asList(st.getItems()));
setItem(datas.getLine(), datas.getGUI());
}
}
class CreateMobs implements StageCreationRunnables{
private static final ItemStack editMobs = ItemUtils.item(XMaterial.STONE_SWORD, Lang.editMobs.toString());
public void start(Player p, LineData datas) {
StagesGUI sg = datas.getGUI();
Line line = datas.getLine();
MobsListGUI mobs = Inventories.create(p, new MobsListGUI());
mobs.run = (obj) -> {
sg.reopen(p, true);
setItems(line, sg, datas);
datas.put("mobs", obj);
};
}
public static void setItems(Line line, StagesGUI sg, LineData datas){
line.setItem(5, editMobs.clone(), new StageRunnable() {
public void run(Player p, LineData datas, ItemStack item) {
MobsListGUI mobs = Inventories.create(p, new MobsListGUI());
mobs.setMobsFromList((List<Mob>) datas.get("mobs"));
mobs.run = (obj) -> {
sg.reopen(p, true);
datas.put("mobs", obj);
};
}
});
line.setItem(6, ItemUtils.itemSwitch(Lang.mobsKillType.toString(), datas.containsKey("shoot") ? (boolean) datas.get("shoot") : false), new StageRunnable() {
public void run(Player p, LineData datas, ItemStack item){
datas.put("shoot", ItemUtils.toggle(datas.getLine().getItem(6)));
}
});
}
public AbstractStage finish(LineData datas, Quest qu) {
StageMobs stage = new StageMobs(qu.getStageManager(), ((List<Mob>) datas.get("mobs")));
if (datas.containsKey("shoot")) stage.setShoot((boolean) datas.get("shoot"));
return stage;
}
public void edit(LineData datas, AbstractStage stage){
StageMobs st = (StageMobs) stage;
datas.put("mobs", new ArrayList<>(st.getMobs()));
datas.put("shoot", st.isShoot());
setItems(datas.getLine(), datas.getGUI(), datas);
}
}
class CreateArea implements StageCreationRunnables{
private static final ItemStack regionName = ItemUtils.item(XMaterial.PAPER, Lang.stageRegion.toString());
public void start(Player p, LineData datas) {
StagesGUI sg = datas.getGUI();
Line line = datas.getLine();
setItem(line, sg);
launchRegionEditor(p, line, sg, datas, true);
}
private static void launchRegionEditor(Player p, Line line, StagesGUI sg, LineData datas, boolean first){
Utils.sendMessage(p, Lang.REGION_NAME.toString() + (first ? "" : "\n" + Lang.TYPE_CANCEL.toString()));
TextEditor wt = Editor.enterOrLeave(p, new TextEditor(p, (obj) -> {
String msg = (String) obj;
if (WorldGuard.regionExists(msg, p.getWorld())) {
sg.reopen(p, false);
ItemUtils.name(line.getItem(6), msg);
datas.put("region", msg);
datas.put("world", p.getWorld().getName());
} else {
Utils.sendMessage(p, Lang.REGION_DOESNT_EXIST.toString());
sg.reopen(p, false);
if (first) line.executeFirst(p);
}
}));
wt.cancel = () -> {
sg.reopen(p, false);
if (first) line.executeFirst(p);
};
}
public static void setItem(Line line, StagesGUI sg){
line.setItem(6, regionName.clone(), new StageRunnable() {
public void run(Player p, LineData datas, ItemStack item) {
launchRegionEditor(p, line, sg, datas, false);
}
}, true, true);
}
public AbstractStage finish(LineData datas, Quest qu) {
StageArea stage = new StageArea(qu.getStageManager(), (String) datas.get("region"), (String) datas.get("world"));
return stage;
}
public void edit(LineData datas, AbstractStage stage){
StageArea st = (StageArea) stage;
datas.put("region", st.getRegion().getId());
datas.put("world", WorldGuard.getWorld(st.getRegion().getId()).getName());
setItem(datas.getLine(), datas.getGUI());
ItemUtils.name(datas.getLine().getItem(6), st.getRegion().getId());
}
}
class CreateMine implements StageCreationRunnables{
public void start(Player p, LineData datas){
StagesGUI sg = datas.getGUI();
BlocksGUI blocks = Inventories.create(p, new BlocksGUI());
blocks.run = (obj) -> {
sg.reopen(p, true);
datas.put("blocks", obj);
datas.put("prevent", false);
setItems(datas.getLine(), datas);
};
}
public AbstractStage finish(LineData datas, Quest qu){
StageMine stage = new StageMine(qu.getStageManager(), (List<BlockData>) datas.get("blocks"));
stage.setPlaceCancelled((boolean) datas.get("prevent"));
return stage;
}
public void edit(LineData datas, AbstractStage stage){
StageMine st = (StageMine) stage;
datas.put("blocks", new ArrayList<>(st.getBlocks()));
datas.put("prevent", st.isPlaceCancelled());
setItems(datas.getLine(), datas);
}
public static void setItems(Line line, LineData datas){
line.setItem(5, ItemUtils.item(XMaterial.STONE_PICKAXE, Lang.editBlocks.toString()), new StageRunnable() {
public void run(Player p, LineData datas, ItemStack item) {
BlocksGUI blocks = Inventories.create(p, new BlocksGUI());
blocks.setBlocksFromList(blocks.inv, (List<BlockData>) datas.get("blocks"));
blocks.run = (obj) -> {
datas.getGUI().reopen(p, true);
datas.put("blocks", obj);
};
}
});
line.setItem(4, ItemUtils.itemSwitch(Lang.preventBlockPlace.toString(), (boolean) datas.get("prevent")), new StageRunnable() {
public void run(Player p, LineData datas, ItemStack item) {
datas.put("prevent", ItemUtils.toggle(item));
}
});
}
}
class CreateChat implements StageCreationRunnables{
public void start(Player p, LineData datas){
datas.put("cancel", true);
setItems(datas);
launchEditor(p, datas);
}
public AbstractStage finish(LineData datas, Quest qu){
StageChat stage = new StageChat(qu.getStageManager(), (String) datas.get("text"), (boolean) datas.get("cancel"));
return stage;
}
public void edit(LineData datas, AbstractStage stage){
StageChat st = (StageChat) stage;
datas.put("text", st.getText());
datas.put("cancel", st.cancelEvent());
setItems(datas);
}
public static void setItems(LineData datas) {
datas.getLine().setItem(5, ItemUtils.item(XMaterial.PLAYER_HEAD, Lang.editMessage.toString()), new StageRunnable() {
public void run(Player p, LineData datas, ItemStack item){
launchEditor(p, datas);
}
});
datas.getLine().setItem(4, ItemUtils.itemSwitch(Lang.cancelEvent.toString(), (boolean) datas.get("cancel")), new StageRunnable() {
public void run(Player p, LineData datas, ItemStack item){
datas.put("cancel", ItemUtils.toggle(item));
}
});
}
public static void launchEditor(Player p, LineData datas){
Lang.CHAT_MESSAGE.send(p);
new TextEditor(p, (obj) -> {
datas.put("text", ((String) obj).replace("{SLASH}", "/"));
datas.getGUI().reopen(p, false);
}).enterOrLeave(p);
}
}
class CreateInteract implements StageCreationRunnables{
public void start(Player p, LineData datas){
Lang.CLICK_BLOCK.send(p);
new WaitBlockClick(p, (obj) -> {
datas.put("lc", obj);
datas.getGUI().reopen(p, false);
setItems(datas);
}, ItemUtils.item(XMaterial.STICK, Lang.blockLocation.toString())).enterOrLeave(p);
}
public static void setItems(LineData datas){
datas.getLine().setItem(4, ItemUtils.itemSwitch(Lang.leftClick.toString(), datas.containsKey("left") ? (boolean) datas.get("left") : false), new StageRunnable() {
public void run(Player p, LineData datas, ItemStack item){
datas.put("left", ItemUtils.toggle(item));
}
});
datas.getLine().setItem(5, ItemUtils.item(XMaterial.STICK, Lang.blockLocation.toString()), new StageRunnable() {
public void run(Player p, LineData datas, ItemStack item){
Lang.CLICK_BLOCK.send(p);
new WaitBlockClick(p, (obj) -> {
datas.getGUI().reopen(p, false);
datas.put("lc", obj);
}, ItemUtils.item(XMaterial.STICK, Lang.blockLocation.toString())).enterOrLeave(p);
}
});
}
public void edit(LineData datas, AbstractStage stage){
StageInteract st = (StageInteract) stage;
datas.put("lc", st.getLocation());
datas.put("left", st.needLeftClick());
setItems(datas);
}
public AbstractStage finish(LineData datas, Quest qu){
return new StageInteract(qu.getStageManager(), (Location) datas.get("lc"), datas.containsKey("left") ? (boolean) datas.get("left") : false);
}
}
class CreateFish implements StageCreationRunnables{
public void start(Player p, LineData datas){
List<ItemStack> items = new ArrayList<>();
datas.put("items", items);
Inventories.create(p, new ItemsGUI(() -> {
datas.getGUI().reopen(p, true);
setItem(datas.getLine(), datas.getGUI());
}, items));
}
public AbstractStage finish(LineData datas, Quest qu){
StageFish stage = new StageFish(qu.getStageManager(), ((List<ItemStack>) datas.get("items")).toArray(new ItemStack[0]));
return stage;
}
public void edit(LineData datas, AbstractStage stage){
datas.put("items", new ArrayList<>(Arrays.asList(((StageFish) stage).getFishes())));
setItem(datas.getLine(), datas.getGUI());
}
public static void setItem(Line line, StagesGUI sg){
line.setItem(5, ItemUtils.item(XMaterial.FISHING_ROD, Lang.editFishes.toString()), new StageRunnable() {
public void run(Player p, LineData datas, ItemStack item) {
Inventories.create(p, new ItemsGUI(() -> {
datas.getGUI().reopen(p, true);
}, (List<ItemStack>) datas.get("items")));
}
});
}
} | [
"Brian@Brian-PC"
] | Brian@Brian-PC |
195e1422e8ae2fd2b45ce42891c9bba9ae812a8b | 0d696022b2958a161514bacb40ee7e4115a4a6bb | /src/main/java/com/algaworks/cobranca/service/TituloService.java | 3539be0827df6a1cf50fd78cede4ec34f577cf9a | [] | no_license | rafaellbarros/workshop-comecando-com-spring-mvc | 5e53105806e5dcb8b0dd84575c387d347b35d25f | 24db661b3ad0441991f15f4db676249e50c3ac5a | refs/heads/master | 2020-06-02T18:51:19.832143 | 2019-06-17T00:14:30 | 2019-06-17T00:14:30 | 191,272,664 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 385 | java | package com.algaworks.cobranca.service;
import java.util.List;
import com.algaworks.cobranca.model.Titulo;
import com.algaworks.cobranca.repository.filter.TituloFilter;
public interface TituloService {
public void salvar(Titulo titulo);
public void excluir(Long codigo);
public String receber(Long codigo);
public List<Titulo> filtrar(TituloFilter filtro);
}
| [
"rafaelbarros.df@gmail.com"
] | rafaelbarros.df@gmail.com |
1993227052bc31df0ad164bc21942b12cd86ae42 | b8cb3cfb7d1c0af4722957d384fa1e83b054d66f | /Java/src/com/bfp/valueobjects/ReportGenerateVO.java | 760ed65a69332940a49f22af3934cc14db002d8b | [] | no_license | karthikmks/SME_Code_Base | 8246e75d32810206fe14da9ac7595420c41769ec | 5255654455696c45ffdd83491c926ef40f36d74f | refs/heads/master | 2020-04-10T16:59:07.226720 | 2014-04-21T04:29:03 | 2014-04-21T04:29:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,055 | java | package com.bfp.valueobjects;
/**
* @author tiruppathir
*
*/
public class ReportGenerateVO {
private String loanType;
/**
* @return the loanType
*/
public String getLoanType() {
return loanType;
}
/**
* @param loanType the loanType to set
*/
public void setLoanType(String loanType) {
this.loanType = loanType;
}
/**
* @return the fromDate
*/
public String getFromDate() {
return fromDate;
}
/**
* @param fromDate the fromDate to set
*/
public void setFromDate(String fromDate) {
this.fromDate = fromDate;
}
/**
* @return the toDate
*/
public String getToDate() {
return toDate;
}
/**
* @param toDate the toDate to set
*/
public void setToDate(String toDate) {
this.toDate = toDate;
}
/**
* @return the selectType
*/
public String getSelectType() {
return selectType;
}
/**
* @param selectType the selectType to set
*/
public void setSelectType(String selectType) {
this.selectType = selectType;
}
private String fromDate;
private String toDate;
private String selectType;
} | [
"karthikmks18@gmail.com"
] | karthikmks18@gmail.com |
cec7299af69675e9bef179756438fba0d6ec9c63 | 82a6fb7271581a24958bc0117413a1f7791c895b | /ocp/prog/test/Test.java | 9c215e76e303aa19e53afbaf97f344e98a630983 | [] | no_license | quantumducky/ducktv | b5d995845a52994aa77f54fc6316ef6ecd5abfbc | 0b63e35219b92fbf75ac8862f990fca4cab33783 | refs/heads/master | 2023-05-27T21:17:15.792563 | 2023-01-09T20:44:50 | 2023-01-09T20:44:50 | 162,330,248 | 3 | 3 | null | 2023-04-30T02:25:02 | 2018-12-18T18:31:58 | JavaScript | UTF-8 | Java | false | false | 3,679 | java | package test;
import java.util.stream.Stream;
import java.util.stream.Collectors;
import java.util.Comparator;
import java.util.List;
import java.util.ArrayList;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.Properties;
import java.time.*;
import java.time.temporal.*;
import java.io.IOException;
public class Test {
public static void main(String ...args) throws Exception {
var rb = ResourceBundle.getBundle("Test", new Locale.Builder().setLanguage("en").build());
hello();
}
private static void hello() {
try {
var duck = new Duck();
duck.hello();
} catch (IOException e) {
}
}
static class Duck extends Animal {
private int weight;
public Duck() {
super("Duck");
}
public Duck(String name, int weight) {
super(name);
this.weight = weight;
}
public int getWeight() { return weight; }
public boolean hasWeight(Boolean check) {
return check ? this.weight != 0 : false;
}
public void hello() {
}
}
abstract static class Animal implements Comparable<Animal> {
private String name;
private static long counter = 1;
public Animal() {
this.name = "Animal" + this.counter++;
}
public Animal(String name) {
this.name = name + this.counter++;
}
public String getName() { return name; }
@Override
public int compareTo(Animal d) {
return name.compareTo(d.name);
}
@Override
public String toString() {
return name;
}
@Override
public boolean equals(Object o) {
return (o instanceof Animal) && this.name.equals(((Animal) o).name);
}
}
}
/*
// 1) Which is a valid declaration:
// - double d = 4.322D; (valid)
// - int first = other, other = 15; (not valid)
-- Comparable and Comparator interfaces
var ducks = new HashSet<Duck>();
ducks.add(new Duck("abb", 14));
ducks.add(new Duck("cbb", 15));
ducks.add(new Duck("cbb", 15));
ducks.add(new Duck("dbb", 17));
ducks.add(new Duck("Zbb", 15));
Collections.sort(ducks, (x, y) -> x.name.compareTo(y.name));
Collections.sort(ducks, Comparator.comparingInt((Duck x) -> x.weight).thenComparing((Duck x) -> x.name));
Collections.sort(ducks, (d1, d2) -> d1.weight - d2.weight);
System.out.println(ducks);
-- Default functional interfaces
Map<String, Duck> map = new TreeMap<>();
BiPredicate<Duck, Boolean> biPredicate = Duck::hasWeight;
Supplier<Duck> supplier = Duck::new;
BiConsumer<String, Duck> biConsumer = map::put;
var d1 = new Duck("labas", 1);
var d2 = supplier.get();
biConsumer.accept("chicken", biPredicate.test(d1, true) ? d1 : null);
biConsumer.accept("chick", biPredicate.test(d2, false) ? d2 : null);
System.out.println(map);
var duck = new Duck("asdf", 15);
Supplier<String> supplierDuckName = duck::getName;
Supplier<Integer> supplierDuckWeight = duck::getWeight;
System.out.println(supplierDuckName.get());
System.out.println(supplierDuckWeight.get());
Genrerics
var baseDuck = new Duck("Duck2", 2);
List<Integer> numbers = new ArrayList<>();
List<Character> letters = new ArrayList<>();
numbers.add(1);
letters.add('a');
StringBuilder builder = new StringBuilder();
Stream<List<?>> good = Stream.of(numbers, letters);
good.peek(builder::append).map(List::size).forEach(System.out::print);
System.out.println(builder);
*/
/* INFO
<R> Stream<R> map(Function<? super T, ? extends R> mapper)
https://stackoverflow.com/questions/53755902/r-streamr-mapfunction-super-t-extends-r-mapper-stream
*/ | [
"quantumducky@gmail.com"
] | quantumducky@gmail.com |
a3f671cb582c787a58943592e3b0f89fd28e0e96 | 885bbcb490d6c3c4de1f898207baec09566a4de4 | /src/main/java/com/smbms/pojo/BillExample.java | eb2a28537a3aab66da0d5cbf60aad2d3f5052cfc | [] | no_license | LYC0114/CopySMBMS345 | d43280275affc1e0cdb594b4a32f83441d501e98 | d0651b03bc0386bd5b8f322a4ab8cf693a39456f | refs/heads/master | 2022-06-19T21:49:33.403890 | 2020-05-12T10:22:45 | 2020-05-12T10:22:45 | 263,306,961 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 33,832 | java | package com.smbms.pojo;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class BillExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public BillExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andBillCodeIsNull() {
addCriterion("billCode is null");
return (Criteria) this;
}
public Criteria andBillCodeIsNotNull() {
addCriterion("billCode is not null");
return (Criteria) this;
}
public Criteria andBillCodeEqualTo(String value) {
addCriterion("billCode =", value, "billCode");
return (Criteria) this;
}
public Criteria andBillCodeNotEqualTo(String value) {
addCriterion("billCode <>", value, "billCode");
return (Criteria) this;
}
public Criteria andBillCodeGreaterThan(String value) {
addCriterion("billCode >", value, "billCode");
return (Criteria) this;
}
public Criteria andBillCodeGreaterThanOrEqualTo(String value) {
addCriterion("billCode >=", value, "billCode");
return (Criteria) this;
}
public Criteria andBillCodeLessThan(String value) {
addCriterion("billCode <", value, "billCode");
return (Criteria) this;
}
public Criteria andBillCodeLessThanOrEqualTo(String value) {
addCriterion("billCode <=", value, "billCode");
return (Criteria) this;
}
public Criteria andBillCodeLike(String value) {
addCriterion("billCode like", value, "billCode");
return (Criteria) this;
}
public Criteria andBillCodeNotLike(String value) {
addCriterion("billCode not like", value, "billCode");
return (Criteria) this;
}
public Criteria andBillCodeIn(List<String> values) {
addCriterion("billCode in", values, "billCode");
return (Criteria) this;
}
public Criteria andBillCodeNotIn(List<String> values) {
addCriterion("billCode not in", values, "billCode");
return (Criteria) this;
}
public Criteria andBillCodeBetween(String value1, String value2) {
addCriterion("billCode between", value1, value2, "billCode");
return (Criteria) this;
}
public Criteria andBillCodeNotBetween(String value1, String value2) {
addCriterion("billCode not between", value1, value2, "billCode");
return (Criteria) this;
}
public Criteria andProductNameIsNull() {
addCriterion("productName is null");
return (Criteria) this;
}
public Criteria andProductNameIsNotNull() {
addCriterion("productName is not null");
return (Criteria) this;
}
public Criteria andProductNameEqualTo(String value) {
addCriterion("productName =", value, "productName");
return (Criteria) this;
}
public Criteria andProductNameNotEqualTo(String value) {
addCriterion("productName <>", value, "productName");
return (Criteria) this;
}
public Criteria andProductNameGreaterThan(String value) {
addCriterion("productName >", value, "productName");
return (Criteria) this;
}
public Criteria andProductNameGreaterThanOrEqualTo(String value) {
addCriterion("productName >=", value, "productName");
return (Criteria) this;
}
public Criteria andProductNameLessThan(String value) {
addCriterion("productName <", value, "productName");
return (Criteria) this;
}
public Criteria andProductNameLessThanOrEqualTo(String value) {
addCriterion("productName <=", value, "productName");
return (Criteria) this;
}
public Criteria andProductNameLike(String value) {
addCriterion("productName like", value, "productName");
return (Criteria) this;
}
public Criteria andProductNameNotLike(String value) {
addCriterion("productName not like", value, "productName");
return (Criteria) this;
}
public Criteria andProductNameIn(List<String> values) {
addCriterion("productName in", values, "productName");
return (Criteria) this;
}
public Criteria andProductNameNotIn(List<String> values) {
addCriterion("productName not in", values, "productName");
return (Criteria) this;
}
public Criteria andProductNameBetween(String value1, String value2) {
addCriterion("productName between", value1, value2, "productName");
return (Criteria) this;
}
public Criteria andProductNameNotBetween(String value1, String value2) {
addCriterion("productName not between", value1, value2, "productName");
return (Criteria) this;
}
public Criteria andProductDescIsNull() {
addCriterion("productDesc is null");
return (Criteria) this;
}
public Criteria andProductDescIsNotNull() {
addCriterion("productDesc is not null");
return (Criteria) this;
}
public Criteria andProductDescEqualTo(String value) {
addCriterion("productDesc =", value, "productDesc");
return (Criteria) this;
}
public Criteria andProductDescNotEqualTo(String value) {
addCriterion("productDesc <>", value, "productDesc");
return (Criteria) this;
}
public Criteria andProductDescGreaterThan(String value) {
addCriterion("productDesc >", value, "productDesc");
return (Criteria) this;
}
public Criteria andProductDescGreaterThanOrEqualTo(String value) {
addCriterion("productDesc >=", value, "productDesc");
return (Criteria) this;
}
public Criteria andProductDescLessThan(String value) {
addCriterion("productDesc <", value, "productDesc");
return (Criteria) this;
}
public Criteria andProductDescLessThanOrEqualTo(String value) {
addCriterion("productDesc <=", value, "productDesc");
return (Criteria) this;
}
public Criteria andProductDescLike(String value) {
addCriterion("productDesc like", value, "productDesc");
return (Criteria) this;
}
public Criteria andProductDescNotLike(String value) {
addCriterion("productDesc not like", value, "productDesc");
return (Criteria) this;
}
public Criteria andProductDescIn(List<String> values) {
addCriterion("productDesc in", values, "productDesc");
return (Criteria) this;
}
public Criteria andProductDescNotIn(List<String> values) {
addCriterion("productDesc not in", values, "productDesc");
return (Criteria) this;
}
public Criteria andProductDescBetween(String value1, String value2) {
addCriterion("productDesc between", value1, value2, "productDesc");
return (Criteria) this;
}
public Criteria andProductDescNotBetween(String value1, String value2) {
addCriterion("productDesc not between", value1, value2, "productDesc");
return (Criteria) this;
}
public Criteria andProductUnitIsNull() {
addCriterion("productUnit is null");
return (Criteria) this;
}
public Criteria andProductUnitIsNotNull() {
addCriterion("productUnit is not null");
return (Criteria) this;
}
public Criteria andProductUnitEqualTo(String value) {
addCriterion("productUnit =", value, "productUnit");
return (Criteria) this;
}
public Criteria andProductUnitNotEqualTo(String value) {
addCriterion("productUnit <>", value, "productUnit");
return (Criteria) this;
}
public Criteria andProductUnitGreaterThan(String value) {
addCriterion("productUnit >", value, "productUnit");
return (Criteria) this;
}
public Criteria andProductUnitGreaterThanOrEqualTo(String value) {
addCriterion("productUnit >=", value, "productUnit");
return (Criteria) this;
}
public Criteria andProductUnitLessThan(String value) {
addCriterion("productUnit <", value, "productUnit");
return (Criteria) this;
}
public Criteria andProductUnitLessThanOrEqualTo(String value) {
addCriterion("productUnit <=", value, "productUnit");
return (Criteria) this;
}
public Criteria andProductUnitLike(String value) {
addCriterion("productUnit like", value, "productUnit");
return (Criteria) this;
}
public Criteria andProductUnitNotLike(String value) {
addCriterion("productUnit not like", value, "productUnit");
return (Criteria) this;
}
public Criteria andProductUnitIn(List<String> values) {
addCriterion("productUnit in", values, "productUnit");
return (Criteria) this;
}
public Criteria andProductUnitNotIn(List<String> values) {
addCriterion("productUnit not in", values, "productUnit");
return (Criteria) this;
}
public Criteria andProductUnitBetween(String value1, String value2) {
addCriterion("productUnit between", value1, value2, "productUnit");
return (Criteria) this;
}
public Criteria andProductUnitNotBetween(String value1, String value2) {
addCriterion("productUnit not between", value1, value2, "productUnit");
return (Criteria) this;
}
public Criteria andProductCountIsNull() {
addCriterion("productCount is null");
return (Criteria) this;
}
public Criteria andProductCountIsNotNull() {
addCriterion("productCount is not null");
return (Criteria) this;
}
public Criteria andProductCountEqualTo(BigDecimal value) {
addCriterion("productCount =", value, "productCount");
return (Criteria) this;
}
public Criteria andProductCountNotEqualTo(BigDecimal value) {
addCriterion("productCount <>", value, "productCount");
return (Criteria) this;
}
public Criteria andProductCountGreaterThan(BigDecimal value) {
addCriterion("productCount >", value, "productCount");
return (Criteria) this;
}
public Criteria andProductCountGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("productCount >=", value, "productCount");
return (Criteria) this;
}
public Criteria andProductCountLessThan(BigDecimal value) {
addCriterion("productCount <", value, "productCount");
return (Criteria) this;
}
public Criteria andProductCountLessThanOrEqualTo(BigDecimal value) {
addCriterion("productCount <=", value, "productCount");
return (Criteria) this;
}
public Criteria andProductCountIn(List<BigDecimal> values) {
addCriterion("productCount in", values, "productCount");
return (Criteria) this;
}
public Criteria andProductCountNotIn(List<BigDecimal> values) {
addCriterion("productCount not in", values, "productCount");
return (Criteria) this;
}
public Criteria andProductCountBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("productCount between", value1, value2, "productCount");
return (Criteria) this;
}
public Criteria andProductCountNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("productCount not between", value1, value2, "productCount");
return (Criteria) this;
}
public Criteria andTotalPriceIsNull() {
addCriterion("totalPrice is null");
return (Criteria) this;
}
public Criteria andTotalPriceIsNotNull() {
addCriterion("totalPrice is not null");
return (Criteria) this;
}
public Criteria andTotalPriceEqualTo(BigDecimal value) {
addCriterion("totalPrice =", value, "totalPrice");
return (Criteria) this;
}
public Criteria andTotalPriceNotEqualTo(BigDecimal value) {
addCriterion("totalPrice <>", value, "totalPrice");
return (Criteria) this;
}
public Criteria andTotalPriceGreaterThan(BigDecimal value) {
addCriterion("totalPrice >", value, "totalPrice");
return (Criteria) this;
}
public Criteria andTotalPriceGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("totalPrice >=", value, "totalPrice");
return (Criteria) this;
}
public Criteria andTotalPriceLessThan(BigDecimal value) {
addCriterion("totalPrice <", value, "totalPrice");
return (Criteria) this;
}
public Criteria andTotalPriceLessThanOrEqualTo(BigDecimal value) {
addCriterion("totalPrice <=", value, "totalPrice");
return (Criteria) this;
}
public Criteria andTotalPriceIn(List<BigDecimal> values) {
addCriterion("totalPrice in", values, "totalPrice");
return (Criteria) this;
}
public Criteria andTotalPriceNotIn(List<BigDecimal> values) {
addCriterion("totalPrice not in", values, "totalPrice");
return (Criteria) this;
}
public Criteria andTotalPriceBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("totalPrice between", value1, value2, "totalPrice");
return (Criteria) this;
}
public Criteria andTotalPriceNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("totalPrice not between", value1, value2, "totalPrice");
return (Criteria) this;
}
public Criteria andIsPaymentIsNull() {
addCriterion("isPayment is null");
return (Criteria) this;
}
public Criteria andIsPaymentIsNotNull() {
addCriterion("isPayment is not null");
return (Criteria) this;
}
public Criteria andIsPaymentEqualTo(Integer value) {
addCriterion("isPayment =", value, "isPayment");
return (Criteria) this;
}
public Criteria andIsPaymentNotEqualTo(Integer value) {
addCriterion("isPayment <>", value, "isPayment");
return (Criteria) this;
}
public Criteria andIsPaymentGreaterThan(Integer value) {
addCriterion("isPayment >", value, "isPayment");
return (Criteria) this;
}
public Criteria andIsPaymentGreaterThanOrEqualTo(Integer value) {
addCriterion("isPayment >=", value, "isPayment");
return (Criteria) this;
}
public Criteria andIsPaymentLessThan(Integer value) {
addCriterion("isPayment <", value, "isPayment");
return (Criteria) this;
}
public Criteria andIsPaymentLessThanOrEqualTo(Integer value) {
addCriterion("isPayment <=", value, "isPayment");
return (Criteria) this;
}
public Criteria andIsPaymentIn(List<Integer> values) {
addCriterion("isPayment in", values, "isPayment");
return (Criteria) this;
}
public Criteria andIsPaymentNotIn(List<Integer> values) {
addCriterion("isPayment not in", values, "isPayment");
return (Criteria) this;
}
public Criteria andIsPaymentBetween(Integer value1, Integer value2) {
addCriterion("isPayment between", value1, value2, "isPayment");
return (Criteria) this;
}
public Criteria andIsPaymentNotBetween(Integer value1, Integer value2) {
addCriterion("isPayment not between", value1, value2, "isPayment");
return (Criteria) this;
}
public Criteria andCreatedByIsNull() {
addCriterion("createdBy is null");
return (Criteria) this;
}
public Criteria andCreatedByIsNotNull() {
addCriterion("createdBy is not null");
return (Criteria) this;
}
public Criteria andCreatedByEqualTo(Long value) {
addCriterion("createdBy =", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByNotEqualTo(Long value) {
addCriterion("createdBy <>", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByGreaterThan(Long value) {
addCriterion("createdBy >", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByGreaterThanOrEqualTo(Long value) {
addCriterion("createdBy >=", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByLessThan(Long value) {
addCriterion("createdBy <", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByLessThanOrEqualTo(Long value) {
addCriterion("createdBy <=", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByIn(List<Long> values) {
addCriterion("createdBy in", values, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByNotIn(List<Long> values) {
addCriterion("createdBy not in", values, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByBetween(Long value1, Long value2) {
addCriterion("createdBy between", value1, value2, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByNotBetween(Long value1, Long value2) {
addCriterion("createdBy not between", value1, value2, "createdBy");
return (Criteria) this;
}
public Criteria andCreationDateIsNull() {
addCriterion("creationDate is null");
return (Criteria) this;
}
public Criteria andCreationDateIsNotNull() {
addCriterion("creationDate is not null");
return (Criteria) this;
}
public Criteria andCreationDateEqualTo(Date value) {
addCriterion("creationDate =", value, "creationDate");
return (Criteria) this;
}
public Criteria andCreationDateNotEqualTo(Date value) {
addCriterion("creationDate <>", value, "creationDate");
return (Criteria) this;
}
public Criteria andCreationDateGreaterThan(Date value) {
addCriterion("creationDate >", value, "creationDate");
return (Criteria) this;
}
public Criteria andCreationDateGreaterThanOrEqualTo(Date value) {
addCriterion("creationDate >=", value, "creationDate");
return (Criteria) this;
}
public Criteria andCreationDateLessThan(Date value) {
addCriterion("creationDate <", value, "creationDate");
return (Criteria) this;
}
public Criteria andCreationDateLessThanOrEqualTo(Date value) {
addCriterion("creationDate <=", value, "creationDate");
return (Criteria) this;
}
public Criteria andCreationDateIn(List<Date> values) {
addCriterion("creationDate in", values, "creationDate");
return (Criteria) this;
}
public Criteria andCreationDateNotIn(List<Date> values) {
addCriterion("creationDate not in", values, "creationDate");
return (Criteria) this;
}
public Criteria andCreationDateBetween(Date value1, Date value2) {
addCriterion("creationDate between", value1, value2, "creationDate");
return (Criteria) this;
}
public Criteria andCreationDateNotBetween(Date value1, Date value2) {
addCriterion("creationDate not between", value1, value2, "creationDate");
return (Criteria) this;
}
public Criteria andModifyByIsNull() {
addCriterion("modifyBy is null");
return (Criteria) this;
}
public Criteria andModifyByIsNotNull() {
addCriterion("modifyBy is not null");
return (Criteria) this;
}
public Criteria andModifyByEqualTo(Long value) {
addCriterion("modifyBy =", value, "modifyBy");
return (Criteria) this;
}
public Criteria andModifyByNotEqualTo(Long value) {
addCriterion("modifyBy <>", value, "modifyBy");
return (Criteria) this;
}
public Criteria andModifyByGreaterThan(Long value) {
addCriterion("modifyBy >", value, "modifyBy");
return (Criteria) this;
}
public Criteria andModifyByGreaterThanOrEqualTo(Long value) {
addCriterion("modifyBy >=", value, "modifyBy");
return (Criteria) this;
}
public Criteria andModifyByLessThan(Long value) {
addCriterion("modifyBy <", value, "modifyBy");
return (Criteria) this;
}
public Criteria andModifyByLessThanOrEqualTo(Long value) {
addCriterion("modifyBy <=", value, "modifyBy");
return (Criteria) this;
}
public Criteria andModifyByIn(List<Long> values) {
addCriterion("modifyBy in", values, "modifyBy");
return (Criteria) this;
}
public Criteria andModifyByNotIn(List<Long> values) {
addCriterion("modifyBy not in", values, "modifyBy");
return (Criteria) this;
}
public Criteria andModifyByBetween(Long value1, Long value2) {
addCriterion("modifyBy between", value1, value2, "modifyBy");
return (Criteria) this;
}
public Criteria andModifyByNotBetween(Long value1, Long value2) {
addCriterion("modifyBy not between", value1, value2, "modifyBy");
return (Criteria) this;
}
public Criteria andModifyDateIsNull() {
addCriterion("modifyDate is null");
return (Criteria) this;
}
public Criteria andModifyDateIsNotNull() {
addCriterion("modifyDate is not null");
return (Criteria) this;
}
public Criteria andModifyDateEqualTo(Date value) {
addCriterion("modifyDate =", value, "modifyDate");
return (Criteria) this;
}
public Criteria andModifyDateNotEqualTo(Date value) {
addCriterion("modifyDate <>", value, "modifyDate");
return (Criteria) this;
}
public Criteria andModifyDateGreaterThan(Date value) {
addCriterion("modifyDate >", value, "modifyDate");
return (Criteria) this;
}
public Criteria andModifyDateGreaterThanOrEqualTo(Date value) {
addCriterion("modifyDate >=", value, "modifyDate");
return (Criteria) this;
}
public Criteria andModifyDateLessThan(Date value) {
addCriterion("modifyDate <", value, "modifyDate");
return (Criteria) this;
}
public Criteria andModifyDateLessThanOrEqualTo(Date value) {
addCriterion("modifyDate <=", value, "modifyDate");
return (Criteria) this;
}
public Criteria andModifyDateIn(List<Date> values) {
addCriterion("modifyDate in", values, "modifyDate");
return (Criteria) this;
}
public Criteria andModifyDateNotIn(List<Date> values) {
addCriterion("modifyDate not in", values, "modifyDate");
return (Criteria) this;
}
public Criteria andModifyDateBetween(Date value1, Date value2) {
addCriterion("modifyDate between", value1, value2, "modifyDate");
return (Criteria) this;
}
public Criteria andModifyDateNotBetween(Date value1, Date value2) {
addCriterion("modifyDate not between", value1, value2, "modifyDate");
return (Criteria) this;
}
public Criteria andProviderIdIsNull() {
addCriterion("providerId is null");
return (Criteria) this;
}
public Criteria andProviderIdIsNotNull() {
addCriterion("providerId is not null");
return (Criteria) this;
}
public Criteria andProviderIdEqualTo(Long value) {
addCriterion("providerId =", value, "providerId");
return (Criteria) this;
}
public Criteria andProviderIdNotEqualTo(Long value) {
addCriterion("providerId <>", value, "providerId");
return (Criteria) this;
}
public Criteria andProviderIdGreaterThan(Long value) {
addCriterion("providerId >", value, "providerId");
return (Criteria) this;
}
public Criteria andProviderIdGreaterThanOrEqualTo(Long value) {
addCriterion("providerId >=", value, "providerId");
return (Criteria) this;
}
public Criteria andProviderIdLessThan(Long value) {
addCriterion("providerId <", value, "providerId");
return (Criteria) this;
}
public Criteria andProviderIdLessThanOrEqualTo(Long value) {
addCriterion("providerId <=", value, "providerId");
return (Criteria) this;
}
public Criteria andProviderIdIn(List<Long> values) {
addCriterion("providerId in", values, "providerId");
return (Criteria) this;
}
public Criteria andProviderIdNotIn(List<Long> values) {
addCriterion("providerId not in", values, "providerId");
return (Criteria) this;
}
public Criteria andProviderIdBetween(Long value1, Long value2) {
addCriterion("providerId between", value1, value2, "providerId");
return (Criteria) this;
}
public Criteria andProviderIdNotBetween(Long value1, Long value2) {
addCriterion("providerId not between", value1, value2, "providerId");
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);
}
}
} | [
"test@test.com"
] | test@test.com |
bc7a28d9ed0880251feaa428fc644e91fd3d287a | 0b95886306feab017ba6f6b04180be5c0b0f7b2e | /src/main/java/fathzer/javaluator/Operator.java | a901e87a12aae4b8952e05f63502f49e7c07ed27 | [] | no_license | MrBretze/Artifice | 876dc283866d1c930eb8f30ec69874cc22da4fb1 | 44d0698642b71caf653aad8ac21ad8be6b562c89 | refs/heads/master | 2020-01-23T21:44:50.805896 | 2017-01-28T20:02:21 | 2017-01-28T20:02:21 | 74,694,517 | 1 | 0 | null | 2016-11-24T17:50:15 | 2016-11-24T17:50:15 | null | UTF-8 | Java | false | false | 3,876 | java | package fathzer.javaluator;
/** An <a href="http://en.wikipedia.org/wiki/Operator_(mathematics)">operator</a>.
* @author Jean-Marc Astesana
* @see <a href="../../../license.html">License information</a>
*/
public class Operator {
/** An Operator's <a href="http://en.wikipedia.org/wiki/Operator_associativity">associativity</a>.
*/
public enum Associativity {
/** Left associativity.*/
LEFT,
/** Right associativity. */
RIGHT,
/** No associativity.*/
NONE
}
private String symbol;
private int precedence;
private int operandCount;
private Associativity associativity;
/** Constructor.
* @param symbol The operator name (Currently, the name's length must be one character).
* @param operandCount The number of operands of the operator (must be 1 or 2).
* @param associativity true if operator is left associative
* @param precedence The <a href="http://en.wikipedia.org/wiki/Order_of_operations">precedence</a> of the operator.
* <br>The precedence is the priority of the operator. An operator with an higher precedence will be executed before an operator with a lower precedence.
* Example : In "<i>1+3*4</i>" * has a higher precedence than +, so the expression is interpreted as 1+(3*4).
* @throws IllegalArgumentException if operandCount if not 1 or 2 or if associativity is none
* @throws NullPointerException if symbol or associativity are null
*/
public Operator(String symbol, int operandCount, Associativity associativity, int precedence) {
if (symbol==null || associativity==null) {
throw new NullPointerException();
}
if (symbol.length()==0) {
throw new IllegalArgumentException("Operator symbol can't be null");
}
if ((operandCount<1) || (operandCount>2)) {
throw new IllegalArgumentException("Only unary and binary operators are supported");
}
if (Associativity.NONE.equals(associativity)) {
throw new IllegalArgumentException("None associativity operators are not supported");
}
this.symbol = symbol;
this.operandCount = operandCount;
this.associativity = associativity;
this.precedence = precedence;
}
/** Gets the operator's symbol.
* @return a String
*/
public String getSymbol() {
return this.symbol;
}
/** Gets the operator's operand count.
* @return an integer
*/
public int getOperandCount() {
return this.operandCount;
}
/** Gets this operator's associativity.
* @return true if the operator is left associative.
* @see <a href="http://en.wikipedia.org/wiki/Operator_associativity">Operator's associativity in Wikipedia</a>
*/
public Associativity getAssociativity() {
return this.associativity;
}
/** Gets the operator's precedence.
* @return an integer
* @see <a href="http://en.wikipedia.org/wiki/Order_of_operations">Operator's associativity in Wikipedia</a>
*/
public int getPrecedence() {
return this.precedence;
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + operandCount;
result = prime * result + ((associativity == null) ? 0 : associativity.hashCode());
result = prime * result + ((symbol == null) ? 0 : symbol.hashCode());
result = prime * result + precedence;
return result;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if ((obj == null) || (obj instanceof Operator)) {
return false;
}
Operator other = (Operator) obj;
if ((operandCount != other.operandCount) || (associativity != other.associativity)) {
return false;
}
if (symbol == null) {
if (other.symbol != null) {
return false;
}
} else if (!symbol.equals(other.symbol)) {
return false;
}
if (precedence != other.precedence) {
return false;
}
return true;
}
} | [
"shukaro@gmail.com"
] | shukaro@gmail.com |
cbeab1f1037ca83a8a3db446016be88aafcf5ee0 | f8fec97eff6d026b51f3a40b145b1546756aa07c | /src/main/java/com/github/narcissujsk/openstackjsk/model/identity/v3/Endpoint.java | ece9bca0b70d23ac5be7cdbb77105c240a6caf6d | [] | no_license | narcissujsk/openstackjsk | 3e4a24ca2664fb87b0420c9655bf466a38c535ad | 21b8681f9cfc3b9f9286bd678e3affac05cd9c74 | refs/heads/master | 2022-11-18T12:13:38.110554 | 2019-10-08T10:41:58 | 2019-10-08T10:41:58 | 207,704,102 | 0 | 0 | null | 2022-11-16T08:55:30 | 2019-09-11T02:20:32 | Java | UTF-8 | Java | false | false | 2,378 | java | /*******************************************************************************
* Copyright 2019 ContainX and OpenStack4j
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*******************************************************************************/
package com.github.narcissujsk.openstackjsk.model.identity.v3;
import java.net.URL;
import java.util.Map;
import com.github.narcissujsk.openstackjsk.api.types.Facing;
import com.github.narcissujsk.openstackjsk.common.Buildable;
import com.github.narcissujsk.openstackjsk.model.ModelEntity;
import com.github.narcissujsk.openstackjsk.model.identity.v3.builder.EndpointBuilder;
/**
* Endpoint model for identity v3.
*
* @see <a href="http://developer.openstack.org/api-ref-identity-v3.html#endpoints-v3">API reference</a>
*/
public interface Endpoint extends ModelEntity, Buildable<EndpointBuilder> {
/**
* Globally unique identifier.
*
* @return the Id of the endpoint
*/
String getId();
/**
* @return the type of the endpoint
*/
String getType();
/**
* @return the Description of the endpoint
*/
String getDescription();
/**
* @return the Interface of the endpoint
*/
Facing getIface();
/**
* @return the ServiceId of the endpoint
*/
String getServiceId();
/**
* @return the Name of the endpoint
*/
String getName();
/**
* @return the Region of the endpoint
*/
String getRegion();
/**
* @return the region identifier of the endpoint
*/
String getRegionId();
/**
* @return the URL of the endpoint
*/
URL getUrl();
/**
* @return the Links of the endpoint
*/
Map<String, String> getLinks();
/**
* @return true if the endpoint is enabled, otherwise false
*/
boolean isEnabled();
}
| [
"jiangsk@inspur.com"
] | jiangsk@inspur.com |
6758fd17cb4c8b6be90c83a132ecd28d5e078778 | 0ba903ad259e346fb880e78dcca23660be0dce4b | /wfe-core/src/main/java/ru/runa/wfe/report/ReportWithNameExistsException.java | d8f6710ef3d0f294e298adfb5f6633263d10c176 | [] | no_license | ARyaskov/runawfe-server | c61eaff10945c99a8dab423c55faa1b5b6159e1d | f721a7613da95b9dd3ac2bf5a86d3cac7bca683e | refs/heads/master | 2021-05-03T06:09:36.209627 | 2017-02-06T13:19:47 | 2017-02-06T13:19:47 | 70,156,281 | 0 | 0 | null | 2016-10-06T13:25:41 | 2016-10-06T13:25:41 | null | UTF-8 | Java | false | false | 778 | java | package ru.runa.wfe.report;
import ru.runa.wfe.InternalApplicationException;
public class ReportWithNameExistsException extends InternalApplicationException {
private static final long serialVersionUID = 1L;
private String reportName;
public ReportWithNameExistsException() {
super();
}
public ReportWithNameExistsException(String message, Throwable cause) {
super(message, cause);
}
public ReportWithNameExistsException(String message) {
super(message);
}
public ReportWithNameExistsException(Throwable cause) {
super(cause);
}
public String getReportName() {
return reportName;
}
public void setReportName(String reportName) {
this.reportName = reportName;
}
}
| [
"tarwirdur@ya.ru"
] | tarwirdur@ya.ru |
953f95b5e1690fff6c0ac23c078c8a454cf20d56 | d5e7a0e3082c1ca9bc7b25b20f06435b1bbe3142 | /Hibernate/src/cn/yb/hibernate/domain/Student.java | 73547313166d56e88c24dd50945d09eaa061b299 | [] | no_license | yaobin1107/frameWork | 13983e63d551e3279f59aa2ae85238cb088f1178 | b94c740dcc95e4cb9fe8b5c8810104cad48ae4a5 | refs/heads/master | 2022-12-20T09:16:31.493312 | 2019-07-02T13:43:09 | 2019-07-02T13:43:09 | 189,223,655 | 1 | 0 | null | 2022-12-16T02:56:20 | 2019-05-29T12:44:40 | Java | UTF-8 | Java | false | false | 895 | java | package cn.yb.hibernate.domain;
import java.util.HashSet;
import java.util.Set;
public class Student {
private Integer sid;
private String name;
private Set<Course> courses = new HashSet<>();
@Override
public String toString() {
return "Student{" +
"sid=" + sid +
", name='" + name + '\'' +
'}';
}
public Student(String name) {
this.name = name;
}
public Student() {
}
public Integer getSid() {
return sid;
}
public void setSid(Integer sid) {
this.sid = sid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Set<Course> getCourses() {
return courses;
}
public void setCourses(Set<Course> courses) {
this.courses = courses;
}
}
| [
"1059843714@qq.com"
] | 1059843714@qq.com |
c53f5a419ad59dc028df245872254f690c579f78 | 4e17cab91eaafeced333b8a7f66556df9132074c | /src/main/java/com/liangyi/mapper/UserMapper.java | 4948eab21831cad4795dcc92072e9b92983939ca | [] | no_license | guoyakun131/liangyi | 6c20e026877c92be9a2d13028457d864e9e51e3b | 5e34665634157c34a463a5ce58020119f0ef529e | refs/heads/master | 2021-05-06T09:45:40.191063 | 2018-02-09T09:59:25 | 2018-02-09T09:59:25 | 114,066,519 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,589 | java | package com.liangyi.mapper;
import com.liangyi.entity.Order;
import com.liangyi.entity.User;
import org.apache.ibatis.annotations.*;
import java.util.List;
import java.util.Map;
@Mapper
public interface UserMapper {
/**
* @return
*/
@Select("select * from user")
List<User> user();
/**
* 查询用户是否存在
*
* @param openid
* @return
*/
@Select("select open_id from user where open_id = #{openid}")
String selectUser(@Param("openid") String openid);
/**
* 添加用户到数据库
*
* @param avatar
* @param nick_name
* @param open_id
* @param add_time
*/
@Insert("INSERT into user (avatar,nick_name,open_id,add_time,sessionkey) VALUES (#{avatar},#{nick_name},#{open_id},#{add_time},#{session_id})")
void addUser(@Param("avatar") String avatar, @Param("nick_name") String nick_name, @Param("open_id") String open_id, @Param("add_time") int add_time, @Param("session_id") String session_id);
/**
* 更新用户
*
* @param avatar
* @param nick_name
* @param session_id
* @param open_id
*/
@Update("UPDATE user SET avatar = #{avatar}, nick_name = #{nick_name}, sessionkey = #{session_id} where open_id = #{open_id}")
void updateUser(@Param("avatar") String avatar, @Param("nick_name") String nick_name, @Param("session_id") String session_id, @Param("open_id") String open_id);
/**
* 查询用户Id
* @param session_id
* @return
*/
@Select("SELECT id FROM user WHERE sessionkey = #{session_id}")
User userId(String session_id);
/**
* 查询openId
* @param session_id
* @return
*/
@Select("select open_id from user where sessionkey = #{session_id}")
String openId(String session_id);
/**
* 查询物流号
* @param order_id
* @param userId
* @return
*/
@Select("SELECT express_num,expCode from `order` where id = #{order_id} and user_id = #{userId}")
Map<String,String> expressNum(@Param("order_id") int order_id, @Param("userId") int userId);
/**
* 用户列表
* @return
*/
@Select("SELECT id,avatar,nick_name as nickName,add_time as addTime from user ORDER BY id desc")
List<User> userList();
/**
* 后台按用户昵称模糊查询
* @param name
* @return
*/
@Select("select id,avatar,nick_name as nickName,add_time as addTime from user where nick_name LIKE '%${nickName}%' ORDER BY id desc")
List<User> userLsitByName(@Param("nickName") String nickName);
} | [
"mrguoyakun@163.com"
] | mrguoyakun@163.com |
43d417dd9eb126c043e9f88b84919c2b9a6f25b4 | 6529cc339e6fd6a06c667aed85ce28a2d8676d4d | /src/main/java/com/qixiafei/book/headfirst/gof/c6/package-info.java | cf8fe67145b97a53cb55265617ff70623bb06f2c | [] | no_license | TheOldQi/book-effect-java | 850d461af40dc225525d45ba7f734c81f3ce39e0 | 0bb130f31e543f8d491dbf96f604dcc25a2642b5 | refs/heads/master | 2020-06-28T09:03:27.025335 | 2019-08-14T14:20:07 | 2019-08-14T14:20:07 | 200,194,496 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 315 | java | /**
* <P>Description: 第六章 命令模式. </P>
* <P>CALLED BY: 齐霞飞 </P>
* <P>UPDATE BY: 齐霞飞 </P>
* <P>CREATE AT: 2019/3/11 16:56</P>
* <P>UPDATE AT: 2019/3/11 16:56</P>
*
* @author 齐霞飞
* @version 1.0
* @since java 1.8.0
*/
package com.qixiafei.book.headfirst.gof.c6;
| [
"qixiafei@meicai.cn"
] | qixiafei@meicai.cn |
f790c88f2e9046a6e0d49bc31af0fb7bb4e25eff | bbf9e86f98954fb4ec6697ccdc62247b28287c95 | /eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/utils/StreamValidator.java | a1f64d93c5f049d86a0a66738aee8be055fe0de4 | [
"Apache-2.0",
"MIT",
"BSD-2-Clause"
] | permissive | wwjiang007/eagle | 9028730a9939df4c0866ad0ad72897505af88c7d | 9d671f0cd4974e3fe28f523508823dad67dba01b | refs/heads/master | 2022-12-12T06:41:12.144701 | 2020-09-04T14:07:34 | 2020-09-04T14:07:34 | 125,138,713 | 0 | 0 | Apache-2.0 | 2020-09-04T14:07:35 | 2018-03-14T01:43:58 | Java | UTF-8 | Java | false | false | 2,412 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.eagle.alert.utils;
import org.apache.commons.lang3.StringUtils;
import org.apache.eagle.alert.engine.coordinator.StreamColumn;
import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
public class StreamValidator {
private final StreamDefinition streamDefinition;
private final Map<String, StreamColumn> streamColumnMap;
public StreamValidator(StreamDefinition streamDefinition) {
this.streamDefinition = streamDefinition;
this.streamColumnMap = new HashMap<>();
for (StreamColumn column : this.streamDefinition.getColumns()) {
streamColumnMap.put(column.getName(), column);
}
}
public void validateMap(Map<String, Object> event) throws StreamValidationException {
final List<String> errors = new LinkedList<>();
this.streamDefinition.getColumns().forEach((column -> {
if (column.isRequired() && !event.containsKey(column.getName())) {
errors.add("[" + column.getName() + "]: required but absent");
}
}));
for (Object eventKey : event.keySet()) {
if (!streamColumnMap.containsKey(eventKey)) {
errors.add("[" + eventKey + "]: invalid column");
}
}
if (errors.size() > 0) {
throw new StreamValidationException(errors.size() + " validation errors: " + StringUtils.join(errors.toArray(), "; "));
}
}
}
| [
"hao@apache.org"
] | hao@apache.org |
491e9bac8a1757a9947eb6afc2083d1d8271c4c1 | 24cf5a9b05e4029be71b11396235c253b25ed149 | /Prac3/app/src/main/java/com/nicholas/islandbuilder/MapData.java | e4c8114338f884d14e6f793cd734d8c93121cb15 | [] | no_license | Nicholaskl/MAD | d2457b83ed3956c67aa3e34fc71a8391b9738d59 | 66989e55b0aeb0bb0b6eccaf083b2ad0137f2d92 | refs/heads/master | 2023-01-24T11:18:43.944522 | 2020-11-21T03:04:03 | 2020-11-21T03:04:03 | 289,423,332 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,529 | java | package com.nicholas.islandbuilder;
import java.util.Random;
/**
* Represents the overall map, and contains a grid of MapElement objects (accessible using the
* get(row, col) method). The two static constants WIDTH and HEIGHT indicate the size of the map.
*
* There is a static get() method to be used to obtain an instance (rather than calling the
* constructor directly).
*
* There is also a regenerate() method. The map is randomly-generated, and this method will invoke
* the algorithm again to replace all the map data with a new randomly-generated grid.
*/
public class MapData
{
public static final int WIDTH = 30;
public static final int HEIGHT = 10;
private static final int WATER = R.drawable.ic_water;
private static final int[] GRASS = {R.drawable.ic_grass1, R.drawable.ic_grass2,
R.drawable.ic_grass3, R.drawable.ic_grass4};
private static final Random rng = new Random();
private MapElement[][] grid;
private static MapData instance = null;
public static MapData get()
{
if(instance == null)
{
instance = new MapData(generateGrid());
}
return instance;
}
private static MapElement[][] generateGrid()
{
final int HEIGHT_RANGE = 256;
final int WATER_LEVEL = 112;
final int INLAND_BIAS = 24;
final int AREA_SIZE = 1;
final int SMOOTHING_ITERATIONS = 2;
int[][] heightField = new int[HEIGHT][WIDTH];
for(int i = 0; i < HEIGHT; i++)
{
for(int j = 0; j < WIDTH; j++)
{
heightField[i][j] =
rng.nextInt(HEIGHT_RANGE)
+ INLAND_BIAS * (
Math.min(Math.min(i, j), Math.min(HEIGHT - i - 1, WIDTH - j - 1)) -
Math.min(HEIGHT, WIDTH) / 4);
}
}
int[][] newHf = new int[HEIGHT][WIDTH];
for(int s = 0; s < SMOOTHING_ITERATIONS; s++)
{
for(int i = 0; i < HEIGHT; i++)
{
for(int j = 0; j < WIDTH; j++)
{
int areaSize = 0;
int heightSum = 0;
for(int areaI = Math.max(0, i - AREA_SIZE);
areaI < Math.min(HEIGHT, i + AREA_SIZE + 1);
areaI++)
{
for(int areaJ = Math.max(0, j - AREA_SIZE);
areaJ < Math.min(WIDTH, j + AREA_SIZE + 1);
areaJ++)
{
areaSize++;
heightSum += heightField[areaI][areaJ];
}
}
newHf[i][j] = heightSum / areaSize;
}
}
int[][] tmpHf = heightField;
heightField = newHf;
newHf = tmpHf;
}
MapElement[][] grid = new MapElement[HEIGHT][WIDTH];
for(int i = 0; i < HEIGHT; i++)
{
for(int j = 0; j < WIDTH; j++)
{
MapElement element;
if(heightField[i][j] >= WATER_LEVEL)
{
boolean waterN = (i == 0) || (heightField[i - 1][j] < WATER_LEVEL);
boolean waterE = (j == WIDTH - 1) || (heightField[i][j + 1] < WATER_LEVEL);
boolean waterS = (i == HEIGHT - 1) || (heightField[i + 1][j] < WATER_LEVEL);
boolean waterW = (j == 0) || (heightField[i][j - 1] < WATER_LEVEL);
boolean waterNW = (i == 0) || (j == 0) || (heightField[i - 1][j - 1] < WATER_LEVEL);
boolean waterNE = (i == 0) || (j == WIDTH - 1) || (heightField[i - 1][j + 1] < WATER_LEVEL);
boolean waterSW = (i == HEIGHT - 1) || (j == 0) || (heightField[i + 1][j - 1] < WATER_LEVEL);
boolean waterSE = (i == HEIGHT - 1) || (j == WIDTH - 1) || (heightField[i + 1][j + 1] < WATER_LEVEL);
boolean coast = waterN || waterE || waterS || waterW ||
waterNW || waterNE || waterSW || waterSE;
grid[i][j] = new MapElement(
!coast,
choose(waterN, waterW, waterNW,
R.drawable.ic_coast_north, R.drawable.ic_coast_west,
R.drawable.ic_coast_northwest, R.drawable.ic_coast_northwest_concave),
choose(waterN, waterE, waterNE,
R.drawable.ic_coast_north, R.drawable.ic_coast_east,
R.drawable.ic_coast_northeast, R.drawable.ic_coast_northeast_concave),
choose(waterS, waterW, waterSW,
R.drawable.ic_coast_south, R.drawable.ic_coast_west,
R.drawable.ic_coast_southwest, R.drawable.ic_coast_southwest_concave),
choose(waterS, waterE, waterSE,
R.drawable.ic_coast_south, R.drawable.ic_coast_east,
R.drawable.ic_coast_southeast, R.drawable.ic_coast_southeast_concave),
null);
}
else
{
grid[i][j] = new MapElement(
false, WATER, WATER, WATER, WATER, null);
}
}
}
return grid;
}
private static int choose(boolean nsWater, boolean ewWater, boolean diagWater,
int nsCoastId, int ewCoastId, int convexCoastId, int concaveCoastId)
{
int id;
if(nsWater)
{
if(ewWater)
{
id = convexCoastId;
}
else
{
id = nsCoastId;
}
}
else
{
if(ewWater)
{
id = ewCoastId;
}
else if(diagWater)
{
id = concaveCoastId;
}
else
{
id = GRASS[rng.nextInt(GRASS.length)];
}
}
return id;
}
protected MapData(MapElement[][] grid)
{
this.grid = grid;
}
public void regenerate()
{
this.grid = generateGrid();
}
public MapElement get(int i, int j)
{
return grid[i][j];
}
}
| [
"33146327+Nicholas2252@users.noreply.github.com"
] | 33146327+Nicholas2252@users.noreply.github.com |
88aa5cda94088c5a6bdc6fe320c414977d5d6ee1 | 086559bcba8e21712d3c0fc70415e69c350acb4d | /src/main/java/com/behavioral/visitor/VisitorBad/AtvPart.java | 6cd3dc750c37ebeeea39d7dc82023d2da04c3c1c | [] | no_license | wrojas32/design-patterns | 8bf2ab7523d6d7b26bf17fbf5792a4f02add4fcf | e872c18e0c73cd6c1bcc54a2f3c8dca91909d5ba | refs/heads/master | 2022-12-22T16:54:53.126646 | 2022-12-15T00:33:12 | 2022-12-15T00:33:12 | 174,434,830 | 0 | 0 | null | 2022-06-29T19:34:32 | 2019-03-07T23:13:45 | Java | UTF-8 | Java | false | false | 112 | java | package com.behavioral.visitor.VisitorBad;
public interface AtvPart {
public double calculateShipping();
}
| [
"wrojas32@gmail.com"
] | wrojas32@gmail.com |
34d2b24baeb7dc7a78f687841d4072f7f487b6f2 | b5f84fb91216d05c092691159d044e09a9e968c8 | /src/main/java/leedcode/GetKthFromEnd.java | a358cd3c489e5a5d3ddd4f1b4c5dae37612d0a95 | [] | no_license | zhoukangning-bjut/algorithm | 7decca5894b5777ac207349f5ced491223a6d677 | ae12a4cf3adb9c5d53f37c4b440fba26c6311c8a | refs/heads/main | 2023-04-10T15:35:16.624262 | 2021-03-05T13:02:27 | 2021-03-05T13:02:27 | 334,614,677 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,596 | java | package leedcode;
public class GetKthFromEnd {
/**
* 链表中倒数第k个节点
* <p>
* 输入一个链表,输出该链表中倒数第k个节点。为了符合大多数人的习惯,
* 本题从1开始计数,即链表的尾节点是倒数第1个节点。
* <p>
* 例如,一个链表有 6 个节点,从头节点开始,它们的值依次是 1、2、3、4、5、6。
* 这个链表的倒数第 3 个节点是值为 4 的节点。
* <p>
* 示例:
* 给定一个链表: 1->2->3->4->5, 和 k = 2.
* 返回链表 4->5
*
* @param args
*/
public static void main(String[] args) {
ListNode node1 = new ListNode(1);
ListNode node2 = new ListNode(2);
ListNode node3 = new ListNode(3);
ListNode node4 = new ListNode(4);
ListNode node5 = new ListNode(5);
node1.next = node2;
node2.next = node3;
node3.next = node4;
node4.next = node5;
ListNode result = getKthFromEnd(node1,2);
System.out.println(result.val);
}
public static ListNode getKthFromEnd(ListNode head, int k) {
ListNode fast = head;
ListNode slow = head;
for (int i = 1; i < k; i ++){
if (fast.next != null)
fast = fast.next;
}
while (fast.next != null){
slow = slow.next;
fast = fast.next;
}
return slow;
}
static class ListNode {
int val;
ListNode next;
ListNode(int x) {
val = x;
}
}
}
| [
"zhoukangning_bjut@163.com"
] | zhoukangning_bjut@163.com |
da4ab2428220aa1cbf2c8d500caccaaaaa289d23 | dae939820b9c6dcd2a6391a727ea731eb2b9fa5f | /ssdd/src/com/ssdd/ntp/client/NTPClient.java | 1b88b41ee444574d91aa5b78faa4613ef33ae7ec | [] | no_license | GandalFran/ricart-and-agrawala | b7ae20cb917bd94906809f487f6c357a8ec887ab | 7059460957fc46e74b6cb3be677d0b6b4f4ff619 | refs/heads/master | 2022-11-21T06:28:31.638245 | 2020-07-23T10:25:22 | 2020-07-23T10:25:22 | 245,209,302 | 3 | 2 | null | null | null | null | ISO-8859-1 | Java | false | false | 4,351 | java | package com.ssdd.ntp.client;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.ssdd.ntp.bean.MarzulloTuple;
import com.ssdd.ntp.bean.Pair;
import com.ssdd.ntp.service.NTPService;
import com.ssdd.ntp.service.NTPServiceProxy;
import com.ssdd.util.constants.INtpConstants;
import com.ssdd.util.logging.SSDDLogFactory;
/**
* NTP client to wrapp the access to implement the client part
* of the NTP algorithm.
*
* @version 1.0
* @author Héctor Sánchez San Blas
* @author Francisco Pinto Santos
*/
public class NTPClient {
/**
* Class logger generated with {@link com.ssdd.util.logging.SSDDLogFactory#logger(Class)}
* */
private final static Logger LOGGER = SSDDLogFactory.logger(NTPClient.class);
/**
* list of services to request the time samples.
* */
private NTPService [] services;
public NTPClient() {
super();
this.services = null;
}
public NTPClient(NTPService [] services) {
super();
this.services = services;
}
/**
* for each service, samples time in host and server and calculates the delay and offset for {@link com.ssdd.util.constants.INtpConstants#NUM_SAMPLES} times
*
* @see com.ssdd.ntp.service.NTPService#time()
*
* @version 1.0
* @author Héctor Sánchez San Blas
* @author Francisco Pinto Santos
*
* @return map with an association between {@link com.ssdd.ntp.service.NTPService} and an array with calculated {@link com.ssdd.ntp.bean.Pair} from servers
* */
public Map<NTPService, Pair []> sample() {
Map<NTPService, Pair []> samples = new HashMap<>();
NTPConcurrentSender sender = new NTPConcurrentSender();
List<Runnable> tasks = sender.buildTasks(this, services, samples);
sender.multicastSend(tasks);
sender.await();
return samples;
}
public Pair [] sample(NTPService service) throws NTPMaxFailsReachedException{
long time0, time1, time2, time3;
Pair [] pairs = new Pair [INtpConstants.NUM_SAMPLES];
int failed = 0;
for(int currIteration=0; currIteration<INtpConstants.NUM_SAMPLES && failed<INtpConstants.MAX_FAILED_ATTEMPTS; currIteration++) {
// get times
time0 = System.currentTimeMillis();
long [] response = NTPServiceProxy.parseTimeResponse(service.time());
time3 = System.currentTimeMillis();
if(response == null) {
LOGGER.log(Level.INFO, "error sampling pair");
currIteration--;
failed++;
continue;
}else {
time1 = response[0];
time2 = response[1];
}
pairs[currIteration] = new Pair(time0, time1, time2, time3);
LOGGER.log(Level.INFO, String.format("sampled pair %s", pairs[currIteration].toString()));
}
if(failed == INtpConstants.MAX_FAILED_ATTEMPTS) {
throw new NTPMaxFailsReachedException(service);
}
return pairs;
}
/**
* Given a list of Pairs (delay, offset), selects the best pair. Currently, the pair selected as best
* is the one selected with the Marzullo's algorithm.
*
* @version 1.0
* @author Héctor Sánchez San Blas
* @author Francisco Pinto Santos
*
* @param pairs list from which pair will be selected
*
* @return the Pair selected as Best.
* */
public Pair selectBestPair(Pair [] pairs) {
List <MarzulloTuple> table = this.populateMarzulloTable(pairs);
Collections.sort(table);
int cnt=0, best=0;
double bestStart=0.0, bestEnd=0.0;
for(int i = 0; i< table.size(); i++) {
cnt = cnt - table.get(i).getType();
if(cnt > best) {
best = cnt;
bestStart = table.get(i).getOffset();
bestEnd = table.get(i+1).getOffset();
}
}
Pair pair = MarzulloTuple.toPair(bestStart, bestEnd);
return pair;
}
/**
* facility to populate the marzullo's algorithm tuples table
* using pairs of (delay, offset) resulting from the NTP time sampling.
*
* @version 1.0
* @author Héctor Sánchez San Blas
* @author Francisco Pinto Santos
*
* @param pairs list of pairs to populate the table.
*
* @return the table
* */
private List <MarzulloTuple> populateMarzulloTable(Pair [] pairs) {
List <MarzulloTuple> table = new ArrayList<>();
for(Pair p: pairs) {
MarzulloTuple [] inverval = p.toMarzulloTuple();
table.add(inverval[0]);
table.add(inverval[1]);
}
return table;
}
}
| [
"franpintosantos@usal.es"
] | franpintosantos@usal.es |
86266d23cbb33535a5adbf0b44a6fabc65f5f132 | 5903bb32c9bf454572df51f0bd8198c566b3d9a0 | /basex-core/src/main/java/org/basex/gui/layout/BaseXList.java | e2be77503b4bef391e03f186e546ff2b86cbd13e | [
"BSD-3-Clause"
] | permissive | pralitp/basex | 8a12fca7dc9c5f6657cfea3c0140e4dd80c3e232 | f5341cc3d38cf831c39ef0ef238200f17a1f9983 | refs/heads/master | 2021-01-21T03:13:50.857088 | 2015-12-29T09:06:24 | 2015-12-29T09:06:24 | 48,752,962 | 0 | 0 | null | 2015-12-29T15:11:38 | 2015-12-29T15:11:38 | null | UTF-8 | Java | false | false | 8,574 | java | package org.basex.gui.layout;
import static org.basex.gui.layout.BaseXKeys.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.util.List;
import javax.swing.*;
import javax.swing.event.*;
import org.basex.io.*;
import org.basex.util.*;
import org.basex.util.list.*;
/**
* Combination of text field and a list, communicating with each other.
* List entries are automatically completed if they match the first characters
* of the typed in text. Moreover, the cursor keys can be used to scroll
* through the list, and list entries can be chosen with mouse clicks.
*
* @author BaseX Team 2005-15, BSD License
* @author Christian Gruen
*/
public final class BaseXList extends BaseXBack {
/** Single choice. */
private final boolean single;
/** Text field. */
private final BaseXTextField text;
/** List. */
private final JList<String> list;
/** Scroll pane. */
private final JScrollPane scroll;
/** List values. */
private String[] values;
/** Numeric list. */
private boolean num = true;
/**
* Default constructor.
* @param choice the input values for the list
* @param d dialog reference
*/
public BaseXList(final String[] choice, final BaseXDialog d) {
this(choice, d, true);
}
/**
* Default constructor.
* @param choice the input values for the list
* @param d dialog reference
* @param s only allow single choices
*/
public BaseXList(final String[] choice, final BaseXDialog d, final boolean s) {
// cache list values
values = choice.clone();
single = s;
// checks if list is purely numeric
for(final String v : values) num = num && v.matches("[0-9]+");
layout(new TableLayout(2, 1));
text = new BaseXTextField(d);
text.addKeyListener(new KeyAdapter() {
boolean multi, typed;
String old = "";
@Override
public void keyPressed(final KeyEvent e) {
final int page = getHeight() / getFont().getSize();
final int[] inds = list.getSelectedIndices();
final int op1 = inds.length == 0 ? -1 : inds[0];
final int op2 = inds.length == 0 ? -1 : inds[inds.length - 1];
int np1 = op1, np2 = op2;
if(NEXTLINE.is(e)) {
np2 = Math.min(op2 + 1, values.length - 1);
} else if(PREVLINE.is(e)) {
np1 = Math.max(op1 - 1, 0);
} else if(NEXTPAGE.is(e)) {
np2 = Math.min(op2 + page, values.length - 1);
} else if(PREVPAGE.is(e)) {
np1 = Math.max(op1 - page, 0);
} else if(TEXTSTART.is(e)) {
np1 = 0;
} else if(TEXTEND.is(e)) {
np2 = values.length - 1;
} else {
return;
}
final IntList il = new IntList();
for(int n = np1; n <= np2; n++) il.add(n);
// choose new list value
final int nv = op2 == np2 ? np1 : np2;
final String val = values[nv];
list.setSelectedValue(val, true);
multi = il.size() > 1;
if(e.isShiftDown() && !single) {
list.setSelectedIndices(il.finish());
text.setText("");
} else {
list.setSelectedIndex(nv);
text.setText(val);
text.selectAll();
}
}
@Override
public void keyTyped(final KeyEvent e) {
final char ch = e.getKeyChar();
if(num) {
typed = ch >= '0' && ch <= '9';
if(!typed) e.consume();
} else {
typed = ch >= ' ' && ch != 127;
}
multi = false;
}
@Override
public void keyReleased(final KeyEvent e) {
String txt = text.getText().trim().toLowerCase(Locale.ENGLISH);
if(!txt.equals(old) && !multi) {
final boolean glob = txt.matches("^.*[*?,].*$");
final String regex = glob ? IOFile.regex(txt, false) : null;
final IntList il = new IntList();
final int vl = values.length;
for(int v = 0; v < vl; ++v) {
final String value = values[v].trim().toLowerCase(Locale.ENGLISH);
if(glob) {
if(value.matches(regex)) il.add(v);
} else if(value.startsWith(txt)) {
if(typed) {
final int c = text.getCaretPosition();
text.setText(values[v]);
text.select(c, values[v].length());
txt = value;
}
il.add(v);
break;
}
}
if(!il.isEmpty()) {
list.setSelectedValue(values[il.get(il.size() - 1)], true);
}
list.setSelectedIndices(il.finish());
}
d.action(BaseXList.this);
typed = false;
old = txt;
}
});
add(text);
final MouseInputAdapter mouse = new MouseInputAdapter() {
@Override
public void mouseEntered(final MouseEvent e) {
BaseXLayout.focus(text);
}
@Override
public void mousePressed(final MouseEvent e) {
final List<String> vals = list.getSelectedValuesList();
text.setText(vals.size() == 1 ? vals.get(0) : "");
text.requestFocusInWindow();
text.selectAll();
d.action(BaseXList.this);
}
@Override
public void mouseDragged(final MouseEvent e) {
mousePressed(e);
}
@Override
public void mouseClicked(final MouseEvent e) {
if(e.getClickCount() == 2) {
d.close();
}
}
};
list = new JList<>(choice);
list.setFocusable(false);
if(s) list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.addMouseListener(mouse);
list.addMouseMotionListener(mouse);
text.setFont(list.getFont());
text.setPreferredSize(new Dimension(list.getWidth(), text.getPreferredSize().height));
BaseXLayout.addInteraction(list, d);
scroll = new JScrollPane(list);
add(scroll);
setIndex(0);
}
/**
* Chooses the specified value in the text field and list.
* @param value the value to be set
*/
public void setValue(final String value) {
list.setSelectedValue(value, true);
text.setText(value);
}
@Override
public void setEnabled(final boolean en) {
list.setEnabled(en);
text.setEnabled(en);
}
@Override
public boolean isEnabled() {
return list.isEnabled();
}
/**
* Sets the specified font.
* @param font font name
* @param style style
*/
public void setFont(final String font, final int style) {
final Font f = text.getFont();
text.setFont(new Font(font, style, f.getSize()));
}
/**
* Returns all list choices.
* @return list index entry
*/
public String[] getList() {
return values;
}
/**
* Returns the selected value of the text field.
* An empty string is returned if no or multiple values are selected.
* @return text field value
*/
public String getValue() {
final List<String> vals = list.getSelectedValuesList();
return vals.size() == 1 ? vals.get(0) : "";
}
/**
* Returns all selected values.
* @return text field value
*/
public StringList getValues() {
final StringList sl = new StringList();
for(final String val : list.getSelectedValuesList()) sl.add(val);
return sl;
}
/**
* Returns the numeric representation of the user input. If the
* text field is invalid, the list entry is returned.
* @return numeric value
*/
public int getNum() {
final int i = Strings.toInt(text.getText());
if(i != Integer.MIN_VALUE) return i;
final Object value = list.getSelectedValue();
return value != null ? Strings.toInt(value.toString()) : 0;
}
/**
* Returns the current list index.
* @return list index entry
*/
public int getIndex() {
return list.getSelectedIndex();
}
/**
* Sets the specified list index.
* @param i list entry
*/
private void setIndex(final int i) {
if(i < values.length) setValue(values[i]);
else text.setText("");
}
@Override
public void setSize(final int w, final int h) {
setWidth(w);
BaseXLayout.setHeight(scroll, h);
}
/**
* Sets the width of the component.
* @param w width
*/
public void setWidth(final int w) {
BaseXLayout.setWidth(text, w);
BaseXLayout.setWidth(scroll, w);
}
/**
* Resets the data shown in the list.
* @param data list data
*/
public void setData(final String[] data) {
values = data.clone();
list.setListData(data);
setIndex(0);
}
@Override
public boolean requestFocusInWindow() {
return text.requestFocusInWindow();
}
}
| [
"christian.gruen@gmail.com"
] | christian.gruen@gmail.com |
31915a3ecb0f1d3cc6b11a0a865501bf21834a88 | 707b136cc051ddf7900c95239e2c035f6358738d | /src/main/java/com/coderman/XinguanApplication.java | ea87f924de4b7a2429155de8b96c6be4b33af0f5 | [] | no_license | 347chenyu8/gyqx | 4143b411782ce724c20b656e9c128a98edfcce8a | 691057b4a5b200c8c8fae92473a284468e8c0ad3 | refs/heads/master | 2023-02-21T13:58:41.652621 | 2021-02-02T02:39:05 | 2021-02-02T02:39:05 | 316,082,927 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 690 | java | package com.coderman;
import com.github.tobato.fastdfs.FdfsClientConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Import;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import tk.mybatis.spring.annotation.MapperScan;
@EnableTransactionManagement //开启事务管理
@MapperScan("com.coderman.api.*.mapper") //扫描mapper
@SpringBootApplication
@Import(FdfsClientConfig.class)
public class XinguanApplication {
public static void main(String[] args) {
SpringApplication.run(XinguanApplication.class, args);
}
}
| [
"cheny@longjitech.com"
] | cheny@longjitech.com |
ec98ad40fb82f70929b0c0df5199cca5b7528efe | df882bde8a8b3b4a85ee16003bfc520230e2d4d0 | /app/src/main/java/com/capstone/JobR/DBA/NullOnEmptyConverterFactory.java | 3475358826ab97fa94a931f3d5a033f10c02f00d | [] | no_license | jya018/JobR_Android | 07d03b1c1e14e6e1b91e883ec4e3290d92ac4260 | 548739df46f2d303488975b8902fdb051cf12d05 | refs/heads/main | 2023-06-13T23:29:54.150992 | 2021-07-19T07:01:30 | 2021-07-19T07:01:30 | 380,097,554 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 717 | java | package com.capstone.JobR.DBA;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import okhttp3.ResponseBody;
import retrofit2.Converter;
import retrofit2.Retrofit;
public class NullOnEmptyConverterFactory extends Converter.Factory {
@Override
public Converter<ResponseBody, ?> responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit)
{
final Converter<ResponseBody, ?> delegate = retrofit.nextResponseBodyConverter(this, type, annotations);
return (Converter<ResponseBody, Object>) body -> {
if (body.contentLength() == 0) {
return null;
}
return delegate.convert(body);
};
}
}
| [
"55496667+jya018@users.noreply.github.com"
] | 55496667+jya018@users.noreply.github.com |
93b4ba27987ade5f6775984d68fb16e7483c35c4 | 91336c4fe5bcfa47b4ba2892e8b18e51c8943c42 | /src/main/java/finalmodifier/TaxCalculator.java | ae72d628eeea09353368399656ecb1acc08bb569 | [] | no_license | Radacs-Bence/training-solutions | cf8a701f73ce984cb75c6b0a2c87f0b4cbbc28a4 | 48ed3f840c388eaefa86399cceea83d407eaa485 | refs/heads/master | 2023-03-08T02:41:19.822357 | 2021-02-21T00:17:21 | 2021-02-21T00:17:21 | 308,308,748 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 459 | java | package finalmodifier;
public class TaxCalculator {
public static final double TAX_RATE = 27;
public double tax(double price) {
return price * (TAX_RATE / 100);
}
public double priceWithTax(double price) {
return price + tax(price);
}
public static void main(String[] args) {
System.out.println(new TaxCalculator().tax(20000));
System.out.println(new TaxCalculator().priceWithTax(20000));
}
}
| [
"bence.radacs@gmail.com"
] | bence.radacs@gmail.com |
ced091470804f80a838d021be7cabf6e1dd951f6 | 8f658bb2f11fdafad22fc324758ecf5ef9dee18e | /app/src/main/java/com/shuangpin/rich/linechart/utils/constant/SharedPreferencesKey.java | 5c6422cd9ab8646eb583d2ad5cefc1e1010dad1b | [] | no_license | XiePengLearn/FuXiBao | 9835379e1b4d03a6aa761189910c031816ac7434 | dcfba04a20fe1bfb47802a25a4b6c24410005ca7 | refs/heads/master | 2020-07-03T01:31:46.408699 | 2019-08-11T09:14:26 | 2019-08-11T09:14:26 | 201,741,879 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 771 | java | package com.shuangpin.rich.linechart.utils.constant;
/**
* Created by linhe on 2016/8/23.
*/
public interface SharedPreferencesKey {
/**
* user authCode
*/
String SP_KEY_TOKEN = "token";
/**
* 用户手机号
*/
String SP_KEY_STAFF_PHONE = "staff_phone";
/**
* 用户登录时输入的用户名
*/
String SP_KEY_USERNAME = "username";
/**
* 用户真实姓名
*/
String SP_KEY_REALNAME="realname";
/**
* 移动设备唯一ID(deviceId + mac)
*/
String SP_KEY_UMID = "sp_key_umid";
/**
* 成功登录的身份证json串
*/
String SP_KEY_CARD="sp_key_card";
/**
* 用户是否退出应用程序
*/
String SP_KEY_EXIT="sp_key_exit";
}
| [
"769783182@qq.com"
] | 769783182@qq.com |
22b2dc86104a46a2ae77d5ff834194cbc8ab6f36 | b911ac043b3d489c811be2f9ce08fa789b7b2a32 | /src/Room.java | 7b1f9fbcfe6f20a57044ee98955b698b8128c1a3 | [
"MIT"
] | permissive | prathamesh-88/HotelManagement | 7c7101f87d1f4a79238e51841c740de8930cd6cf | a1b0c772ca0af5f1c681948c8c73ed6a80e35794 | refs/heads/main | 2023-04-14T03:30:59.872754 | 2021-04-25T15:40:31 | 2021-04-25T15:40:31 | 361,468,199 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,584 | java |
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
/*
* 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.
*/
/**
*
* @author Prathamesh
*/
public class Room {
MY_CONNECTION connect=new MY_CONNECTION();
public boolean CheckIn(int roomno,String CheckIn,String CheckOut){
PreparedStatement ps;
ResultSet rs;
String SetQuery="UPDATE `rooms` SET `Check in`=?,`Checkout`=?,`Availability`=? WHERE `Room No.`=?";
try {
ps=connect.CreateConnection().prepareStatement(SetQuery);
ps.setString(1,CheckIn);
ps.setString(2,CheckOut);
ps.setString(3, "Unavailable");
ps.setInt(4, roomno);
if(ps.executeUpdate()>0) {
return true;
}
else {
return false;
}
} catch (SQLException ex) {
Logger.getLogger(Room.class.getName()).log(Level.SEVERE, null, ex);
return false;
}
}
public boolean CheckOut(int roomno){
PreparedStatement ps;
ResultSet rs;
String SetQuery="UPDATE `rooms` SET `Check in`=?,`Checkout`=?,`Availability`=? WHERE `Room No.`=?";
try {
ps=connect.CreateConnection().prepareStatement(SetQuery);
ps.setDate(1,null);
ps.setDate(2,null);
ps.setString(3, "Available");
ps.setInt(4, roomno);
if(ps.executeUpdate()>0) {
return true;
}
else {
return false;
}
} catch (SQLException ex) {
Logger.getLogger(Room.class.getName()).log(Level.SEVERE, null, ex);
return false;
}
}
public void FillRoomJTable(JTable table)
{
PreparedStatement ps;
ResultSet rs;
String SetQuery="SELECT `Room No.`, `Type`, `Check in`, `Checkout`, `Availability` FROM `rooms`";
try {
ps=connect.CreateConnection().prepareStatement(SetQuery);
rs=ps.executeQuery();
DefaultTableModel objT= (DefaultTableModel) table.getModel();
Object row[];
while(rs.next())
{
row=new Object[5];
row[0]=rs.getString(1);
row[1]=rs.getString(2);
row[2]=rs.getString(3);
row[3]=rs.getString(4);
row[4]=rs.getString(5);
objT.addRow(row);
}
} catch (SQLException ex) {
Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
}
}
public boolean isAvailable(int roomno)
{
PreparedStatement ps;
ResultSet rs;
String setQuery="SELECT `Availability` FROM `rooms` WHERE `Room No.`=?";
try {
ps=connect.CreateConnection().prepareStatement(setQuery);
ps.setInt(1,roomno);
rs=ps.executeQuery();
if(rs.next()){
String check=rs.getString(1);
return check.equals("Available");
}
else {
return false;
}
} catch (SQLException ex) {
Logger.getLogger(Room.class.getName()).log(Level.SEVERE, null, ex);
return false;
}
}
}
| [
"prathameshtamanekar@gmail.com"
] | prathameshtamanekar@gmail.com |
b8fffad5174ea237a9ccb09c308eb1f0bd6725c3 | fa7b580ab228bf157300226db4fe57352466520a | /Chapter20190805/src/main/java/com/gplbj/httpclient/cookies/MyCookiesForGet.java | 5660f513d41b0a0d77284ccd490bc6928f504cd5 | [] | no_license | gplbj/AutoTest | 514f23b9355506e5ecad4b0242e5c28dd28ad7aa | 0b829c840ce2ebd66815bcbd258c0c9ef0c61c00 | refs/heads/master | 2022-07-03T23:12:50.637800 | 2019-08-20T00:15:41 | 2019-08-20T00:15:42 | 199,942,007 | 0 | 0 | null | 2022-06-21T01:42:04 | 2019-07-31T23:21:51 | HTML | UTF-8 | Java | false | false | 2,592 | java | package com.gplbj.httpclient.cookies;
import org.apache.http.HttpResponse;
import org.apache.http.client.CookieStore;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.cookie.Cookie;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import java.io.IOException;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
public class MyCookiesForGet {
private String url;
private ResourceBundle bundle;
//用来存储cookies信息的变量
CookieStore store;
@BeforeTest
public void beforeTest() {
bundle = ResourceBundle.getBundle("application", Locale.CHINA); //加载 application配置文件
url = bundle.getString("test.url");
}
@Test
public void testGetCookies() throws IOException {
String result;
//从配置文件中 拼接测试的url
String uri = bundle.getString("getCookies.uri");
String testUrl = this.url + uri;
//测试逻辑代码书写
HttpGet get = new HttpGet(testUrl);
DefaultHttpClient client = new DefaultHttpClient();
HttpResponse response = client.execute(get);
result = EntityUtils.toString(response.getEntity(), "utf-8");
System.out.println(result);
//获取cookies 信息
this.store = client.getCookieStore();
List<Cookie> cookieList = store.getCookies();
for (Cookie cookie :
cookieList) {
String name = cookie.getName();
String value = cookie.getValue();
System.out.println("cookie name = " + name + "; cookie value = " + value);
}
}
@Test(dependsOnMethods = "testGetCookies")
public void testGetWithCookies() throws IOException {
String uri = bundle.getString("test.get.with.cookies");
String testUrl = this.url + uri;
HttpGet get = new HttpGet(testUrl);
DefaultHttpClient client = new DefaultHttpClient();
//设置cookies信息
client.setCookieStore(this.store);
HttpResponse response = client.execute(get);
//获取响应的状态码
int statusCode = response.getStatusLine().getStatusCode();
System.out.println("响应的状态码statusCode " + statusCode);
if (statusCode == 200) {
String result = EntityUtils.toString(response.getEntity(), "utf-8");
System.out.println(result);
}
}
}
| [
"2602251350@qq.com"
] | 2602251350@qq.com |
202427e751c465bb2e477c9ead59ff4514d88cac | 883b7801d828a0994cae7367a7097000f2d2e06a | /python/experiments/projects/opencb-opencga/real_error_dataset/1/242/FamilyCommandExecutor.java | 968b0ca22a6c165dbe2b197410c246893effb7c7 | [] | no_license | pombredanne/styler | 9c423917619912789289fe2f8982d9c0b331654b | f3d752d2785c2ab76bacbe5793bd8306ac7961a1 | refs/heads/master | 2023-07-08T05:55:18.284539 | 2020-11-06T05:09:47 | 2020-11-06T05:09:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,638 | java | package org.opencb.opencga.app.cli.internal.executors;
import org.opencb.commons.datastore.core.ObjectMap;
import org.opencb.opencga.analysis.family.FamilyIndexTask;
import org.opencb.opencga.app.cli.internal.options.FamilyCommandOptions;
import org.opencb.opencga.core.exceptions.ToolException;
import java.nio.file.Path;
import java.nio.file.Paths;
public class FamilyCommandExecutor extends InternalCommandExecutor {
private final FamilyCommandOptions familyCommandOptions;
public FamilyCommandExecutor(FamilyCommandOptions options) {
super(options.familyCommandOptions);
familyCommandOptions = options;
}
@Override
public void execute() throws Exception {
logger.debug("Executing family command line");
String subCommandString = getParsedSubCommand(familyCommandOptions.jCommander);
configure();
switch (subCommandString) {
case "secondary-index":
secondaryIndex();
break;
default:
logger.error("Subcommand not valid");
break;
}
}
private void secondaryIndex() throws ToolException {
FamilyCommandOptions.SecondaryIndex options = familyCommandOptions.secondaryIndex;
Path outDir = Paths.get(options.outDir);
Path opencgaHome = Paths.get(configuration.getWorkspace()).getParent();
// Prepare analysis parameters and config
FamilyIndexTask indexTask = new FamilyIndexTask();
indexTask.setUp(opencgaHome.toString(), new ObjectMap(), outDir, options.commonOptions.token);
indexTask.start();
}
} | [
"fer.madeiral@gmail.com"
] | fer.madeiral@gmail.com |
a98919c2207cb189cba713e1758d33c91ade75d9 | 64cc08fc7ddc8ecc91a81c23fdf66490c3f37fab | /trimph/src/main/java/com/trimh/trimphmvp/disk/ACache.java | b28190e3dedecc7733c7165a7c540da161de7071 | [] | no_license | triumph20150514/TrimphJuneFifty-master | 837af8599a1ab1f3f7146d0233d0727fc6c0a3ff | b1975a9fd67410569fd2e798ddf8e21906d0e159 | refs/heads/master | 2020-05-22T06:53:06.758375 | 2016-09-23T06:17:05 | 2016-09-23T06:17:05 | 64,370,328 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,715 | java | /**
* Copyright (c) 2012-2013, Michael Yang 杨福海 (www.yangfuhai.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.trimh.trimphmvp.disk;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.PixelFormat;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.RandomAccessFile;
import java.io.Serializable;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
/**
* @author Michael Yang(www.yangfuhai.com) update at 2013.08.07
*/
public class ACache {
public static final int TIME_HOUR = 60 * 60;
public static final int TIME_DAY = TIME_HOUR * 24;
private static final int MAX_SIZE = 1000 * 1000 * 50; // 50 mb
private static final int MAX_COUNT = Integer.MAX_VALUE; // 不限制存放数据的数量
private static Map<String, ACache> mInstanceMap = new HashMap<String, ACache>();
private ACacheManager mCache;
public static ACache get(Context ctx) {
return get(ctx, "ACache");
}
public static ACache get(Context ctx, String cacheName) {
File f = new File(ctx.getCacheDir(), cacheName);
return get(f, MAX_SIZE, MAX_COUNT);
}
public static ACache get(File cacheDir) {
return get(cacheDir, MAX_SIZE, MAX_COUNT);
}
public static ACache get(Context ctx, long max_zise, int max_count) {
File f = new File(ctx.getCacheDir(), "ACache");
return get(f, max_zise, max_count);
}
public static ACache get(File cacheDir, long max_zise, int max_count) {
ACache manager = mInstanceMap.get(cacheDir.getAbsoluteFile() + myPid());
if (manager == null) {
manager = new ACache(cacheDir, max_zise, max_count);
mInstanceMap.put(cacheDir.getAbsolutePath() + myPid(), manager);
}
return manager;
}
private static String myPid() {
return "_" + android.os.Process.myPid();
}
private ACache(File cacheDir, long max_size, int max_count) {
if (!cacheDir.exists() && !cacheDir.mkdirs()) {
throw new RuntimeException("can't make dirs in " + cacheDir.getAbsolutePath());
}
mCache = new ACacheManager(cacheDir, max_size, max_count);
}
/**
* Provides a means to save a cached file before the data are available.
* Since writing about the file is complete, and its close method is called,
* its contents will be registered in the cache. Example of use:
*
* ACache cache = new ACache(this) try { OutputStream stream =
* cache.put("myFileName") stream.write("some bytes".getBytes()); // now
* update cache! stream.close(); } catch(FileNotFoundException e){
* e.printStackTrace() }
*/
class xFileOutputStream extends FileOutputStream {
File file;
public xFileOutputStream(File file) throws FileNotFoundException {
super(file);
this.file = file;
}
public void close() throws IOException {
super.close();
mCache.put(file);
}
}
// =======================================
// ============ String数据 读写 ==============
// =======================================
/**
* 保存 String数据 到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的String数据
*/
public void put(String key, String value) {
File file = mCache.newFile(key);
BufferedWriter out = null;
try {
out = new BufferedWriter(new FileWriter(file), 1024);
out.write(value);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (out != null) {
try {
out.flush();
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
mCache.put(file);
}
}
/**
* 保存 String数据 到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的String数据
* @param saveTime
* 保存的时间,单位:秒
*/
public void put(String key, String value, int saveTime) {
put(key, Utils.newStringWithDateInfo(saveTime, value));
}
/**
* 读取 String数据
*
* @param key
* @return String 数据
*/
public String getAsString(String key) {
File file = mCache.get(key);
if (!file.exists())
return null;
boolean removeFile = false;
BufferedReader in = null;
try {
in = new BufferedReader(new FileReader(file));
String readString = "";
String currentLine;
while ((currentLine = in.readLine()) != null) {
readString += currentLine;
}
if (!Utils.isDue(readString)) {
return Utils.clearDateInfo(readString);
} else {
removeFile = true;
return null;
}
} catch (IOException e) {
e.printStackTrace();
return null;
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (removeFile)
remove(key);
}
}
// =======================================
// ============= JSONObject 数据 读写 ==============
// =======================================
/**
* 保存 JSONObject数据 到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的JSON数据
*/
public void put(String key, JSONObject value) {
put(key, value.toString());
}
/**
* 保存 JSONObject数据 到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的JSONObject数据
* @param saveTime
* 保存的时间,单位:秒
*/
public void put(String key, JSONObject value, int saveTime) {
put(key, value.toString(), saveTime);
}
/**
* 读取JSONObject数据
*
* @param key
* @return JSONObject数据
*/
public JSONObject getAsJSONObject(String key) {
String JSONString = getAsString(key);
try {
JSONObject obj = new JSONObject(JSONString);
return obj;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
// =======================================
// ============ JSONArray 数据 读写 =============
// =======================================
/**
* 保存 JSONArray数据 到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的JSONArray数据
*/
public void put(String key, JSONArray value) {
put(key, value.toString());
}
/**
* 保存 JSONArray数据 到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的JSONArray数据
* @param saveTime
* 保存的时间,单位:秒
*/
public void put(String key, JSONArray value, int saveTime) {
put(key, value.toString(), saveTime);
}
/**
* 读取JSONArray数据
*
* @param key
* @return JSONArray数据
*/
public JSONArray getAsJSONArray(String key) {
String JSONString = getAsString(key);
try {
JSONArray obj = new JSONArray(JSONString);
return obj;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
// =======================================
// ============== byte 数据 读写 =============
// =======================================
/**
* 保存 byte数据 到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的数据
*/
public void put(String key, byte[] value) {
File file = mCache.newFile(key);
FileOutputStream out = null;
try {
out = new FileOutputStream(file);
out.write(value);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (out != null) {
try {
out.flush();
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
mCache.put(file);
}
}
/**
* Cache for a stream
*
* @param key
* the file name.
* @return OutputStream stream for writing data.
* @throws FileNotFoundException
* if the file can not be created.
*/
public OutputStream put(String key) throws FileNotFoundException {
return new xFileOutputStream(mCache.newFile(key));
}
/**
*
* @param key
* the file name.
* @return (InputStream or null) stream previously saved in cache.
* @throws FileNotFoundException
* if the file can not be opened
*/
public InputStream get(String key) throws FileNotFoundException {
File file = mCache.get(key);
if (!file.exists())
return null;
return new FileInputStream(file);
}
/**
* 保存 byte数据 到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的数据
* @param saveTime
* 保存的时间,单位:秒
*/
public void put(String key, byte[] value, int saveTime) {
put(key, Utils.newByteArrayWithDateInfo(saveTime, value));
}
/**
* 获取 byte 数据
*
* @param key
* @return byte 数据
*/
public byte[] getAsBinary(String key) {
RandomAccessFile RAFile = null;
boolean removeFile = false;
try {
File file = mCache.get(key);
if (!file.exists())
return null;
RAFile = new RandomAccessFile(file, "r");
byte[] byteArray = new byte[(int) RAFile.length()];
RAFile.read(byteArray);
if (!Utils.isDue(byteArray)) {
return Utils.clearDateInfo(byteArray);
} else {
removeFile = true;
return null;
}
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
if (RAFile != null) {
try {
RAFile.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (removeFile)
remove(key);
}
}
// =======================================
// ============= 序列化 数据 读写 ===============
// =======================================
/**
* 保存 Serializable数据 到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的value
*/
public void put(String key, Serializable value) {
put(key, value, -1);
}
/**
* 保存 Serializable数据到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的value
* @param saveTime
* 保存的时间,单位:秒
*/
public void put(String key, Serializable value, int saveTime) {
ByteArrayOutputStream baos = null;
ObjectOutputStream oos = null;
try {
baos = new ByteArrayOutputStream();
oos = new ObjectOutputStream(baos);
oos.writeObject(value);
byte[] data = baos.toByteArray();
if (saveTime != -1) {
put(key, data, saveTime);
} else {
put(key, data);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
oos.close();
} catch (IOException e) {
}
}
}
/**
* 读取 Serializable数据
*
* @param key
* @return Serializable 数据
*/
public Object getAsObject(String key) {
byte[] data = getAsBinary(key);
if (data != null) {
ByteArrayInputStream bais = null;
ObjectInputStream ois = null;
try {
bais = new ByteArrayInputStream(data);
ois = new ObjectInputStream(bais);
Object reObject = ois.readObject();
return reObject;
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
try {
if (bais != null)
bais.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
if (ois != null)
ois.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return null;
}
// =======================================
// ============== bitmap 数据 读写 =============
// =======================================
/**
* 保存 bitmap 到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的bitmap数据
*/
public void put(String key, Bitmap value) {
put(key, Utils.Bitmap2Bytes(value));
}
/**
* 保存 bitmap 到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的 bitmap 数据
* @param saveTime
* 保存的时间,单位:秒
*/
public void put(String key, Bitmap value, int saveTime) {
put(key, Utils.Bitmap2Bytes(value), saveTime);
}
/**
* 读取 bitmap 数据
*
* @param key
* @return bitmap 数据
*/
public Bitmap getAsBitmap(String key) {
if (getAsBinary(key) == null) {
return null;
}
return Utils.Bytes2Bimap(getAsBinary(key));
}
// =======================================
// ============= drawable 数据 读写 =============
// =======================================
/**
* 保存 drawable 到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的drawable数据
*/
public void put(String key, Drawable value) {
put(key, Utils.drawable2Bitmap(value));
}
/**
* 保存 drawable 到 缓存中
*
* @param key
* 保存的key
* @param value
* 保存的 drawable 数据
* @param saveTime
* 保存的时间,单位:秒
*/
public void put(String key, Drawable value, int saveTime) {
put(key, Utils.drawable2Bitmap(value), saveTime);
}
/**
* 读取 Drawable 数据
*
* @param key
* @return Drawable 数据
*/
public Drawable getAsDrawable(String key) {
if (getAsBinary(key) == null) {
return null;
}
return Utils.bitmap2Drawable(Utils.Bytes2Bimap(getAsBinary(key)));
}
/**
* 获取缓存文件
*
* @param key
* @return value 缓存的文件
*/
public File file(String key) {
File f = mCache.newFile(key);
if (f.exists())
return f;
return null;
}
/**
* 移除某个key
*
* @param key
* @return 是否移除成功
*/
public boolean remove(String key) {
return mCache.remove(key);
}
/**
* 清除所有数据
*/
public void clear() {
mCache.clear();
}
/**
* @title 缓存管理器
* @author 杨福海(michael) www.yangfuhai.com
* @version 1.0
*/
public class ACacheManager {
private final AtomicLong cacheSize;
private final AtomicInteger cacheCount;
private final long sizeLimit;
private final int countLimit;
private final Map<File, Long> lastUsageDates = Collections.synchronizedMap(new HashMap<File, Long>());
protected File cacheDir;
private ACacheManager(File cacheDir, long sizeLimit, int countLimit) {
this.cacheDir = cacheDir;
this.sizeLimit = sizeLimit;
this.countLimit = countLimit;
cacheSize = new AtomicLong();
cacheCount = new AtomicInteger();
calculateCacheSizeAndCacheCount();
}
/**
* 计算 cacheSize和cacheCount
*/
private void calculateCacheSizeAndCacheCount() {
new Thread(new Runnable() {
@Override
public void run() {
int size = 0;
int count = 0;
File[] cachedFiles = cacheDir.listFiles();
if (cachedFiles != null) {
for (File cachedFile : cachedFiles) {
size += calculateSize(cachedFile);
count += 1;
lastUsageDates.put(cachedFile, cachedFile.lastModified());
}
cacheSize.set(size);
cacheCount.set(count);
}
}
}).start();
}
private void put(File file) {
int curCacheCount = cacheCount.get();
while (curCacheCount + 1 > countLimit) {
long freedSize = removeNext();
cacheSize.addAndGet(-freedSize);
curCacheCount = cacheCount.addAndGet(-1);
}
cacheCount.addAndGet(1);
long valueSize = calculateSize(file);
long curCacheSize = cacheSize.get();
while (curCacheSize + valueSize > sizeLimit) {
long freedSize = removeNext();
curCacheSize = cacheSize.addAndGet(-freedSize);
}
cacheSize.addAndGet(valueSize);
Long currentTime = System.currentTimeMillis();
file.setLastModified(currentTime);
lastUsageDates.put(file, currentTime);
}
private File get(String key) {
File file = newFile(key);
Long currentTime = System.currentTimeMillis();
file.setLastModified(currentTime);
lastUsageDates.put(file, currentTime);
return file;
}
private File newFile(String key) {
return new File(cacheDir, key.hashCode() + "");
}
private boolean remove(String key) {
File image = get(key);
return image.delete();
}
private void clear() {
lastUsageDates.clear();
cacheSize.set(0);
File[] files = cacheDir.listFiles();
if (files != null) {
for (File f : files) {
f.delete();
}
}
}
/**
* 移除旧的文件
*
* @return
*/
private long removeNext() {
if (lastUsageDates.isEmpty()) {
return 0;
}
Long oldestUsage = null;
File mostLongUsedFile = null;
Set<Entry<File, Long>> entries = lastUsageDates.entrySet();
synchronized (lastUsageDates) {
for (Entry<File, Long> entry : entries) {
if (mostLongUsedFile == null) {
mostLongUsedFile = entry.getKey();
oldestUsage = entry.getValue();
} else {
Long lastValueUsage = entry.getValue();
if (lastValueUsage < oldestUsage) {
oldestUsage = lastValueUsage;
mostLongUsedFile = entry.getKey();
}
}
}
}
long fileSize = calculateSize(mostLongUsedFile);
if (mostLongUsedFile.delete()) {
lastUsageDates.remove(mostLongUsedFile);
}
return fileSize;
}
private long calculateSize(File file) {
return file.length();
}
}
/**
* @title 时间计算工具类
* @author 杨福海(michael) www.yangfuhai.com
* @version 1.0
*/
private static class Utils {
/**
* 判断缓存的String数据是否到期
*
* @param str
* @return true:到期了 false:还没有到期
*/
private static boolean isDue(String str) {
return isDue(str.getBytes());
}
/**
* 判断缓存的byte数据是否到期
*
* @param data
* @return true:到期了 false:还没有到期
*/
private static boolean isDue(byte[] data) {
String[] strs = getDateInfoFromDate(data);
if (strs != null && strs.length == 2) {
String saveTimeStr = strs[0];
while (saveTimeStr.startsWith("0")) {
saveTimeStr = saveTimeStr.substring(1, saveTimeStr.length());
}
long saveTime = Long.valueOf(saveTimeStr);
long deleteAfter = Long.valueOf(strs[1]);
if (System.currentTimeMillis() > saveTime + deleteAfter * 1000) {
return true;
}
}
return false;
}
private static String newStringWithDateInfo(int second, String strInfo) {
return createDateInfo(second) + strInfo;
}
private static byte[] newByteArrayWithDateInfo(int second, byte[] data2) {
byte[] data1 = createDateInfo(second).getBytes();
byte[] retdata = new byte[data1.length + data2.length];
System.arraycopy(data1, 0, retdata, 0, data1.length);
System.arraycopy(data2, 0, retdata, data1.length, data2.length);
return retdata;
}
private static String clearDateInfo(String strInfo) {
if (strInfo != null && hasDateInfo(strInfo.getBytes())) {
strInfo = strInfo.substring(strInfo.indexOf(mSeparator) + 1, strInfo.length());
}
return strInfo;
}
private static byte[] clearDateInfo(byte[] data) {
if (hasDateInfo(data)) {
return copyOfRange(data, indexOf(data, mSeparator) + 1, data.length);
}
return data;
}
private static boolean hasDateInfo(byte[] data) {
return data != null && data.length > 15 && data[13] == '-' && indexOf(data, mSeparator) > 14;
}
private static String[] getDateInfoFromDate(byte[] data) {
if (hasDateInfo(data)) {
String saveDate = new String(copyOfRange(data, 0, 13));
String deleteAfter = new String(copyOfRange(data, 14, indexOf(data, mSeparator)));
return new String[] { saveDate, deleteAfter };
}
return null;
}
private static int indexOf(byte[] data, char c) {
for (int i = 0; i < data.length; i++) {
if (data[i] == c) {
return i;
}
}
return -1;
}
private static byte[] copyOfRange(byte[] original, int from, int to) {
int newLength = to - from;
if (newLength < 0)
throw new IllegalArgumentException(from + " > " + to);
byte[] copy = new byte[newLength];
System.arraycopy(original, from, copy, 0, Math.min(original.length - from, newLength));
return copy;
}
private static final char mSeparator = ' ';
private static String createDateInfo(int second) {
String currentTime = System.currentTimeMillis() + "";
while (currentTime.length() < 13) {
currentTime = "0" + currentTime;
}
return currentTime + "-" + second + mSeparator;
}
/*
* Bitmap → byte[]
*/
private static byte[] Bitmap2Bytes(Bitmap bm) {
if (bm == null) {
return null;
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bm.compress(Bitmap.CompressFormat.PNG, 100, baos);
return baos.toByteArray();
}
/*
* byte[] → Bitmap
*/
private static Bitmap Bytes2Bimap(byte[] b) {
if (b.length == 0) {
return null;
}
return BitmapFactory.decodeByteArray(b, 0, b.length);
}
/*
* Drawable → Bitmap
*/
private static Bitmap drawable2Bitmap(Drawable drawable) {
if (drawable == null) {
return null;
}
// 取 drawable 的长宽
int w = drawable.getIntrinsicWidth();
int h = drawable.getIntrinsicHeight();
// 取 drawable 的颜色格式
Bitmap.Config config = drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565;
// 建立对应 bitmap
Bitmap bitmap = Bitmap.createBitmap(w, h, config);
// 建立对应 bitmap 的画布
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, w, h);
// 把 drawable 内容画到画布中
drawable.draw(canvas);
return bitmap;
}
/*
* Bitmap → Drawable
*/
@SuppressWarnings("deprecation")
private static Drawable bitmap2Drawable(Bitmap bm) {
if (bm == null) {
return null;
}
BitmapDrawable bd=new BitmapDrawable(bm);
bd.setTargetDensity(bm.getDensity());
return new BitmapDrawable(bm);
}
}
}
| [
"tx09trimph@163.com"
] | tx09trimph@163.com |
07b23f22a26f5a2e2492156d07b13e2f53582622 | 41668ddc415c2ca5408e6be098af0b6afc185c91 | /WiseKG.Server/src/main/java/org/linkeddatafragments/views/HtmlTriplePatternFragmentWriterImpl.java | 9c6845a18b2a335ed9cef47ba49da0f9cf006fb3 | [
"MIT"
] | permissive | dkw-aau/WiseKG-Java | a32cca456693cda210a0d2c34c66228ebab03b01 | 808ea32f3b20e232ab9d4f60b4744f4404cb6950 | refs/heads/main | 2022-12-30T14:54:52.810899 | 2020-10-18T15:54:39 | 2020-10-18T15:54:39 | 490,197,849 | 0 | 0 | MIT | 2022-05-09T08:30:16 | 2022-05-09T08:30:15 | null | UTF-8 | Java | false | false | 5,689 | java | package org.linkeddatafragments.views;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import freemarker.template.TemplateExceptionHandler;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import org.apache.jena.rdf.model.RDFNode;
import org.apache.jena.rdf.model.Statement;
import org.apache.jena.rdf.model.StmtIterator;
import org.linkeddatafragments.datasource.IDataSource;
import org.linkeddatafragments.datasource.index.IndexDataSource;
import org.linkeddatafragments.fragments.ILinkedDataFragment;
import org.linkeddatafragments.fragments.tpf.ITriplePatternFragment;
import org.linkeddatafragments.fragments.tpf.ITriplePatternFragmentRequest;
//TODO: Refactor to a composable & flexible architecture using DataSource types, fragments types and request types
public class HtmlTriplePatternFragmentWriterImpl extends TriplePatternFragmentWriterBase implements ILinkedDataFragmentWriter {
private final Configuration cfg;
private final Template indexTemplate;
private final Template datasourceTemplate;
private final Template notfoundTemplate;
private final Template errorTemplate;
private final String HYDRA = "http://www.w3.org/ns/hydra/core#";
/**
*
* @param prefixes
* @param datasources
* @throws IOException
*/
public HtmlTriplePatternFragmentWriterImpl(Map<String, String> prefixes, HashMap<String, IDataSource> datasources) throws IOException {
super(prefixes, datasources);
cfg = new Configuration(Configuration.VERSION_2_3_22);
cfg.setClassForTemplateLoading(getClass(), "/views");
cfg.setDefaultEncoding("UTF-8");
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
indexTemplate = cfg.getTemplate("index.ftl.html");
datasourceTemplate = cfg.getTemplate("datasource.ftl.html");
notfoundTemplate = cfg.getTemplate("notfound.ftl.html");
errorTemplate = cfg.getTemplate("error.ftl.html");
}
/**
*
* @param outputStream
* @param datasource
* @param fragment
* @param tpfRequest
* @throws IOException
* @throws TemplateException
*/
@Override
public void writeFragment(OutputStream outputStream, IDataSource datasource, ITriplePatternFragment fragment, ITriplePatternFragmentRequest tpfRequest) throws IOException, TemplateException{
Map data = new HashMap();
// base.ftl.html
data.put("assetsPath", "assets/");
data.put("header", datasource.getTitle());
data.put("date", new Date());
// fragment.ftl.html
data.put("datasourceUrl", tpfRequest.getDatasetURL());
data.put("datasource", datasource);
// Parse controls to template variables
StmtIterator controls = fragment.getControls();
while (controls.hasNext()) {
Statement control = controls.next();
String predicate = control.getPredicate().getURI();
RDFNode object = control.getObject();
if (!object.isAnon()) {
String value = object.isURIResource() ? object.asResource().getURI() : object.asLiteral().getLexicalForm();
data.put(predicate.replaceFirst(HYDRA, ""), value);
}
}
// Add metadata
data.put("totalEstimate", fragment.getTotalSize());
data.put("itemsPerPage", fragment.getMaxPageSize());
// Add triples and datasources
List<Statement> triples = fragment.getTriples().toList();
data.put("triples", triples);
data.put("datasources", getDatasources());
// Calculate start and end triple number
Long start = ((tpfRequest.getPageNumber() - 1) * fragment.getMaxPageSize()) + 1;
data.put("start", start);
data.put("end", start + (triples.size() < fragment.getMaxPageSize() ? triples.size() : fragment.getMaxPageSize()));
// Compose query object
Map query = new HashMap();
query.put("subject", !tpfRequest.getSubject().isVariable() ? tpfRequest.getSubject().asConstantTerm() : "");
query.put("predicate", !tpfRequest.getPredicate().isVariable() ? tpfRequest.getPredicate().asConstantTerm() : "");
query.put("object", !tpfRequest.getObject().isVariable() ? tpfRequest.getObject().asConstantTerm() : "");
data.put("query", query);
// Get the template (uses cache internally)
Template temp = datasource instanceof IndexDataSource ? indexTemplate : datasourceTemplate;
// Merge data-model with template
temp.process(data, new OutputStreamWriter(outputStream));
}
@Override
public void writeNotFound(ServletOutputStream outputStream, HttpServletRequest request) throws Exception {
Map data = new HashMap();
data.put("assetsPath", "assets/");
data.put("datasources", getDatasources());
data.put("date", new Date());
data.put("url", request.getRequestURL().toString());
notfoundTemplate.process(data, new OutputStreamWriter(outputStream));
}
@Override
public void writeError(ServletOutputStream outputStream, Exception ex) throws Exception {
Map data = new HashMap();
data.put("assetsPath", "assets/");
data.put("date", new Date());
data.put("error", ex);
errorTemplate.process(data, new OutputStreamWriter(outputStream));
}
}
| [
"wisekgorg@gmail.com"
] | wisekgorg@gmail.com |
5fca64f69ccacb7521ec5d76085c6f98e502c30c | 2be68ce1c354411b2159caedcd25610a9b941ca1 | /src/edu/mum/asd/library/dbconfiguration/StrategyContext.java | e8d02f1f69e72e8417115b95a562dde65cb8a344 | [] | no_license | MafrelKarki/ASD-Library-Framework | 8aae2be369fa464e58e4273c562fabc8b954bf46 | 111e64328adbf6a93fd971e4b80a14ba9a5b2377 | refs/heads/master | 2020-03-17T19:41:57.769577 | 2018-05-21T17:47:19 | 2018-05-21T17:47:19 | 133,873,564 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 559 | java | package edu.mum.asd.library.dbconfiguration;
import java.sql.Connection;
import java.sql.SQLException;
public class StrategyContext {
private IDbmsConnection dbmsConnection;
public Connection connect(DatabaseDescriptor dbDescription) throws ClassNotFoundException, SQLException {
return dbmsConnection.connect(dbDescription);
}
public void disconnect() throws ClassNotFoundException, SQLException {
dbmsConnection.disconnect();
}
public void setDbmsConnection(IDbmsConnection dbmsConnection) {
this.dbmsConnection = dbmsConnection;
}
}
| [
"37524284+gakyvan@users.noreply.github.com"
] | 37524284+gakyvan@users.noreply.github.com |
98b637f93c3f45476d652e4b5acd5dac3b83568f | bd5562090487237b27274d6ad4b0e64c90d70604 | /abc.web/src/main/java/com/autoserve/abc/web/module/screen/link/json/AddFriendLink.java | ed80f8ed72cda28efd6c3e01a1e3b121f9bf8744 | [] | no_license | haxsscker/abc.parent | 04b0d659958a4c1b91bb41a002e814ea31bd0e85 | 0522c15aed591e755662ff16152b702182692f54 | refs/heads/master | 2020-05-04T20:25:34.863818 | 2019-04-04T05:49:01 | 2019-04-04T05:49:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,372 | java | package com.autoserve.abc.web.module.screen.link.json;
import javax.annotation.Resource;
import com.alibaba.citrus.service.requestcontext.parser.ParameterParser;
import com.autoserve.abc.dao.dataobject.SysLinkInfoDO;
import com.autoserve.abc.service.biz.intf.sys.SysLinkInfoService;
import com.autoserve.abc.service.biz.result.BaseResult;
import com.autoserve.abc.web.vo.JsonBaseVO;
/**
* 类AddFriendLink.java的实现描述:TODO 类实现描述
*
* @author liuwei 2014年12月3日 下午1:21:02
*/
public class AddFriendLink {
@Resource
private SysLinkInfoService sysLinkInfoService;
public JsonBaseVO execute(ParameterParser params) {
String slTitle = params.getString("sys_link_title");
String slAddress = params.getString("sys_link_address");
Integer slOrder = params.getInt("sys_link_order");
String slLogo = params.getString("sys_link_logo");
SysLinkInfoDO sysLinkInfo = new SysLinkInfoDO();
sysLinkInfo.setSlTitle(slTitle);
sysLinkInfo.setSlAddress(slAddress);
sysLinkInfo.setSlOrder(slOrder);
sysLinkInfo.setSlLogo(slLogo);
BaseResult result = this.sysLinkInfoService.createSyslinkInfo(sysLinkInfo);
JsonBaseVO vo = new JsonBaseVO();
vo.setSuccess(result.isSuccess());
vo.setMessage(result.getMessage());
return vo;
}
}
| [
"845534336@qq.com"
] | 845534336@qq.com |
df2123bf068f3ffb6ef58ad30ccd71e155a4462c | b8df3b80ef6704622215f187cd26bc1698f82d46 | /app/src/main/java/com/andrew/bcamerchantservice/ui/tabpromorequest/promostatus/PromoStatusPresenter.java | 02503400afb032502cd40880b926770f2df9f6b4 | [] | no_license | CIKOOOOO/BCAMerchantService | 7ccf63829b70eedb0f4b6ee0398c01f2ec1f080c | b30370189a67115c841b935e4c9074c8055bd562 | refs/heads/master | 2020-08-29T23:16:05.073435 | 2020-02-12T08:18:02 | 2020-02-12T08:18:02 | 218,198,360 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,979 | java | package com.andrew.bcamerchantservice.ui.tabpromorequest.promostatus;
import android.support.annotation.NonNull;
import com.andrew.bcamerchantservice.model.PromoRequest;
import com.andrew.bcamerchantservice.utils.Constant;
import com.andrew.bcamerchantservice.utils.Utils;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class PromoStatusPresenter implements IPromoStatusPresenter {
private IPromoStatusView view;
private DatabaseReference dbRef;
PromoStatusPresenter(IPromoStatusView view) {
this.view = view;
dbRef = FirebaseDatabase.getInstance().getReference();
}
@Override
public void loadData(String MID, int MCC) {
final String path = Constant.DB_REFERENCE_PROMO_REQUEST + "/" + Constant.DB_REFERENCE_MERCHANT_PROMO_REQUEST + "/" + MCC + "/" + MID;
dbRef.child(path)
.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
List<PromoRequest> promoRequestList = new ArrayList<>();
for (DataSnapshot snapshot : dataSnapshot.getChildren()) {
final PromoRequest promoRequest = snapshot.getValue(PromoRequest.class);
if (promoRequest != null) {
try {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Date date1 = sdf.parse(Utils.getTime("dd/MM/yyyy"));
Date date2 = sdf.parse(promoRequest.getPromo_start_date());
/*
* Promo tidak boleh sesudah tanggal mulai
* Promo tidak boleh berada dihari yang sama dengan tanggal mulai
* */
if (date1.compareTo(date2) < 0 && date1.compareTo(date2) != 0) {
dbRef.child(Constant.DB_REFERENCE_PROMO_REQUEST)
.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
PromoRequest.PromoType promoType = dataSnapshot.child(Constant.DB_REFERENCE_PROMO_REQUEST_TYPE
+ "/" + promoRequest.getPromo_type_id()).getValue(PromoRequest.PromoType.class);
PromoRequest.PromoStatus promoStatus = dataSnapshot.child(Constant.DB_REFERENCE_PROMO_STATUS
+ "/" + promoRequest.getPromo_status()).getValue(PromoRequest.PromoStatus.class);
if (promoType != null && promoStatus != null)
view.onLoadPromoType(promoType, promoStatus);
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
promoRequestList.add(0, promoRequest);
} else if (promoRequest.getPromo_status().equals("promo_status_2") || promoRequest.getPromo_status().equals("promo_status_1")) {
Map<String, Object> map = new HashMap<>();
map.put("promo_status", "Ditolak");
dbRef.child(path + "/" + promoRequest.getPromo_request_id())
.updateChildren(map);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
view.onLoadData(promoRequestList);
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
}
| [
"abedcreen@gmail.com"
] | abedcreen@gmail.com |
93964a6764c0a838cdb474bcfde47fcdd9f70355 | bcee044b46545062ad8dbde6c6e3641770d3b8a3 | /library/src/main/java/cyclone/otusspring/library/repository/AuthorRepository.java | ea460f85ef23d5934e4129c10e31ddc47b595a9b | [] | no_license | lanaflonPerso/otus-spring-hw | d80b8615b182f955ae049a042cba7b86281dd64b | 1aefba9a0b0a807c25f64064bbf6bdca20cfa344 | refs/heads/master | 2020-12-06T06:41:44.530086 | 2019-08-03T09:21:15 | 2019-08-03T09:21:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 389 | java | package cyclone.otusspring.library.repository;
import cyclone.otusspring.library.model.Author;
import java.util.List;
public interface AuthorRepository {
List<Author> findAll();
List<Author> findByName(String name);
Author findOne(String id);
Author save(Author author);
void delete(String id);
void delete(Author author);
boolean exists(String id);
}
| [
"ilya.cyclone@gmail.com"
] | ilya.cyclone@gmail.com |
f72a8e57c80f70afee01c4d54e33cc6862777456 | 8dd943facb256c1cb248246cdb0b23ba3e285100 | /service-oa/src/main/java/com/bit/module/oa/service/LocationService.java | e76c2de5193215150f6cfed52e460096b88bf769 | [] | no_license | ouyangcode/WisdomTown | 6a121be9d23e565246b41c7c29716f3035d86992 | 5176a7cd0f92d47ffee6c5b4976aa8d185025bd9 | refs/heads/master | 2023-09-02T06:54:37.124507 | 2020-07-09T02:29:59 | 2020-07-09T02:29:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 357 | java | package com.bit.module.oa.service;
import com.bit.module.oa.vo.location.LocationQO;
import com.bit.module.oa.vo.location.LocationUserVO;
import java.util.List;
/**
* @Description :
* @Date : 2019/2/15 10:34
*/
public interface LocationService {
List<LocationUserVO> findLocationList(List<Long> executeIds);
void add(LocationQO location);
}
| [
"liyang@126.com"
] | liyang@126.com |
d852043a98f3fbf2da3342fb70acedb3eb562461 | 5e5f296e7284cd8e303e8c6d65ef8cb5f8abccd7 | /src/main/java/uy/com/innobit/rem/presentation/OptimizedConnectorBundleLoaderFactory.java | 061d5eb0e8d7b7c8b8060af029b35506859f9f1b | [] | no_license | araujomelogno/LocalesSantosDumont | 73e314b0104d0b76f6385b879f8f9111df3821ea | 64f434fbc57a9b6f270ee99df25d205bbdb4c42d | refs/heads/master | 2021-01-20T05:09:17.127096 | 2017-06-27T18:32:59 | 2017-06-27T18:32:59 | 89,752,743 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,044 | java | package uy.com.innobit.rem.presentation;
import java.util.HashSet;
import java.util.Set;
import com.google.gwt.core.ext.typeinfo.JClassType;
import com.vaadin.client.ui.button.ButtonConnector;
import com.vaadin.client.ui.csslayout.CssLayoutConnector;
import com.vaadin.client.ui.label.LabelConnector;
import com.vaadin.client.ui.orderedlayout.HorizontalLayoutConnector;
import com.vaadin.client.ui.orderedlayout.VerticalLayoutConnector;
import com.vaadin.client.ui.panel.PanelConnector;
import com.vaadin.client.ui.passwordfield.PasswordFieldConnector;
import com.vaadin.client.ui.textfield.TextFieldConnector;
import com.vaadin.client.ui.ui.UIConnector;
import com.vaadin.client.ui.window.WindowConnector;
import com.vaadin.server.widgetsetutils.ConnectorBundleLoaderFactory;
import com.vaadin.shared.ui.Connect.LoadStyle;
public final class OptimizedConnectorBundleLoaderFactory extends
ConnectorBundleLoaderFactory {
private final Set<String> eagerConnectors = new HashSet<String>();
{
eagerConnectors.add(PasswordFieldConnector.class.getName());
eagerConnectors.add(VerticalLayoutConnector.class.getName());
eagerConnectors.add(HorizontalLayoutConnector.class.getName());
eagerConnectors.add(ButtonConnector.class.getName());
eagerConnectors.add(UIConnector.class.getName());
eagerConnectors.add(CssLayoutConnector.class.getName());
eagerConnectors.add(TextFieldConnector.class.getName());
eagerConnectors.add(PanelConnector.class.getName());
eagerConnectors.add(LabelConnector.class.getName());
eagerConnectors.add(WindowConnector.class.getName());
}
@Override
protected LoadStyle getLoadStyle(final JClassType connectorType) {
if (eagerConnectors.contains(connectorType.getQualifiedBinaryName())) {
return LoadStyle.EAGER;
} else {
// Loads all other connectors immediately after the initial view has
// been rendered
return LoadStyle.DEFERRED;
}
}
} | [
"araujomelogno@gmail.com"
] | araujomelogno@gmail.com |
c08a10a96c6aeab81ca84de4a87c038da9c17b7e | 0b8d3b86d97feeb4b77aa79245e5b16dcc492a88 | /src/main/java/com/sprjjs/book/utils/JsonUtil.java | b0137539f0e46bf6455cb219d1f922bc14aee2ff | [] | no_license | hkmhso/book-store-springboot | f580a56f82ab53b40933f5c5af5a9fa1b6590255 | ae53b67dbe0cba6a21f83c27a62983d257977c1c | refs/heads/master | 2022-12-25T22:53:56.655749 | 2020-09-27T06:18:03 | 2020-09-27T06:18:03 | 294,084,146 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,849 | java | package com.sprjjs.book.utils;
import java.io.Serializable;
import java.util.List;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
/**
* 易购商城自定义响应结构
*/
public class JsonUtil implements Serializable{
// 定义jackson对象
private static final ObjectMapper MAPPER = new ObjectMapper();
/**
* 将对象转换成json字符串。
* <p>Title: pojoToJson</p>
* <p>Description: </p>
* @param data
* @return
*/
public static String objectToJson(Object data) {
try {
String string = MAPPER.writeValueAsString(data);
return string;
} catch (JsonProcessingException e) {
e.printStackTrace();
}
return null;
}
/**
* 将json结果集转化为对象
*
* @param jsonData json数据
* @param clazz 对象中的object类型
* @return
*/
public static <T> T jsonToPojo(String jsonData, Class<T> beanType) {
try {
T t = MAPPER.readValue(jsonData, beanType);
return t;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 将json数据转换成pojo对象list
* <p>Title: jsonToList</p>
* <p>Description: </p>
* @param jsonData
* @param beanType
* @return
*/
public static <T>List<T> jsonToList(String jsonData, Class<T> beanType) {
JavaType javaType = MAPPER.getTypeFactory().constructParametricType(List.class, beanType);
try {
List<T> list = MAPPER.readValue(jsonData, javaType);
return list;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
| [
"you@example.com"
] | you@example.com |
19185eac54c20587bc777d2541ce643f2118da9c | 326e495413e557d9cff6d11a57c3a8ff254764ac | /src/Tabulation/Connections/Copy_Files.java | 63863269b0ed8305da7211b55e0b763b4d5d2709 | [] | no_license | imZEH/Tabulation-System-Java | 7c93c2b937bd93af34d83682cdcfd613f76c317c | b5d6d87268fbf165a061fa0956331a27ad4988b7 | refs/heads/master | 2021-06-19T10:47:38.800945 | 2021-03-12T04:54:19 | 2021-03-12T04:54:19 | 22,260,731 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,830 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Tabulation.Connections;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
/**
*
* @author Neil
*/
public class Copy_Files {
public static void copyFile(File sourceFile, File destFile)
throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel();
destination = new FileOutputStream(destFile).getChannel();
// previous code: destination.transferFrom(source, 0, source.size());
// to avoid infinite loops, should be:
long count = 0;
long size = source.size();
while ((count += destination.transferFrom(source, count, size
- count)) < size)
;
} finally {
if (source != null) {
source.close();
}
if (destination != null) {
destination.close();
}
}
}
public void PATH1(String Path) {
try {
File sourceFile = new File(Path);
File destFile = new File("CompanyLOGO.png");
copyFile(sourceFile,destFile);
} catch (IOException ex) {
ex.printStackTrace();
}
}
public void PATH2(String Path) {
try {
File sourceFile = new File(Path);
File destFile = new File("OragnizationLOGO.png");
copyFile(sourceFile,destFile);
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
| [
"ngr_24@ymail.com"
] | ngr_24@ymail.com |
01d8d6d2f3df6d4da2acc45736f235b225f4c063 | 8af5ce5b803e436129566eeea660c8d7d61aeba5 | /airline_tickets_agency_management/src/main/java/com/backend/airline_tickets_agency_management/model/service/flight_ticket/ticket/ISearchFlightService.java | 57bd890e6c8e3824542593bfa97c2a14fa05ab9b | [] | no_license | C0221G1-Airline-tickets-agency/BackEnd | 746181d8a85824584fff6b612d80f8075982ecdf | 1ad1e4e75d17bb9928aaef52b80a2750d359c2cb | refs/heads/main | 2023-08-03T16:45:57.390479 | 2021-09-16T09:39:51 | 2021-09-16T09:39:51 | 401,923,978 | 0 | 0 | null | 2021-09-15T07:41:39 | 2021-09-01T03:53:32 | Java | UTF-8 | Java | false | false | 418 | java | package com.backend.airline_tickets_agency_management.model.service.flight_ticket.ticket;
import com.backend.airline_tickets_agency_management.model.dto.flight_ticket.SearchFlightDto;
import java.util.List;
public interface ISearchFlightService {
List<SearchFlightDto> searchFlight(String pointOfDeparture, String destination, String flightDate, String passengerType1, String passengerType2, String orderBy);
} | [
"hoanghatay2@gmail.com"
] | hoanghatay2@gmail.com |
2564b92239a966c118f3ee9d459fceda54949856 | f4c7b31e83556a43873dd3adf56a85494e09be4f | /sesdfsdf/test/java/org/elasticsearch/client/DeadHostStateTests.java | 7d21f1cbe7ca8d4c22f26b0720ee51898017876d | [
"Apache-2.0"
] | permissive | b-3-n/zulip-android | 031a6c1a075a1303adeb36c6523ea98d6f7e4cfb | 03947c8eb1284b62e617e6e545223780eaa8e921 | refs/heads/oauth-patch | 2022-01-14T19:22:09.512266 | 2019-05-31T08:54:40 | 2019-05-31T08:54:40 | 107,560,436 | 0 | 1 | Apache-2.0 | 2019-05-31T08:53:58 | 2017-10-19T14:53:35 | Java | UTF-8 | Java | false | false | 6,120 | java | /*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.client;
import java.util.concurrent.TimeUnit;
import org.elasticsearch.client.DeadHostState.TimeSupplier;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.lessThan;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
public class DeadHostStateTests extends RestClientTestCase {
private static long[] EXPECTED_TIMEOUTS_SECONDS = new long[]{60, 84, 120, 169, 240, 339, 480, 678, 960, 1357, 1800};
public void testInitialDeadHostStateDefaultTimeSupplier() {
assumeFalse("https://github.com/elastic/elasticsearch/issues/33747", System.getProperty("os.name").startsWith("Windows"));
DeadHostState deadHostState = new DeadHostState(DeadHostState.TimeSupplier.DEFAULT);
long currentTime = System.nanoTime();
assertThat(deadHostState.getDeadUntilNanos(), greaterThan(currentTime));
assertThat(deadHostState.getFailedAttempts(), equalTo(1));
}
public void testDeadHostStateFromPreviousDefaultTimeSupplier() {
DeadHostState previous = new DeadHostState(DeadHostState.TimeSupplier.DEFAULT);
int iters = randomIntBetween(5, 30);
for (int i = 0; i < iters; i++) {
DeadHostState deadHostState = new DeadHostState(previous);
assertThat(deadHostState.getDeadUntilNanos(), greaterThan(previous.getDeadUntilNanos()));
assertThat(deadHostState.getFailedAttempts(), equalTo(previous.getFailedAttempts() + 1));
previous = deadHostState;
}
}
public void testCompareToDefaultTimeSupplier() {
assumeFalse("https://github.com/elastic/elasticsearch/issues/33747", System.getProperty("os.name").startsWith("Windows"));
int numObjects = randomIntBetween(EXPECTED_TIMEOUTS_SECONDS.length, 30);
DeadHostState[] deadHostStates = new DeadHostState[numObjects];
for (int i = 0; i < numObjects; i++) {
if (i == 0) {
deadHostStates[i] = new DeadHostState(DeadHostState.TimeSupplier.DEFAULT);
} else {
deadHostStates[i] = new DeadHostState(deadHostStates[i - 1]);
}
}
for (int k = 1; k < deadHostStates.length; k++) {
assertThat(deadHostStates[k - 1].getDeadUntilNanos(), lessThan(deadHostStates[k].getDeadUntilNanos()));
assertThat(deadHostStates[k - 1], lessThan(deadHostStates[k]));
}
}
public void testCompareToDifferingTimeSupplier() {
try {
new DeadHostState(TimeSupplier.DEFAULT).compareTo(
new DeadHostState(new ConfigurableTimeSupplier()));
fail("expected failure");
} catch (IllegalArgumentException e) {
assertEquals("can't compare DeadHostStates with different clocks [nanoTime != configured[0]]",
e.getMessage());
}
}
public void testShallBeRetried() {
ConfigurableTimeSupplier timeSupplier = new ConfigurableTimeSupplier();
DeadHostState deadHostState = null;
for (int i = 0; i < EXPECTED_TIMEOUTS_SECONDS.length; i++) {
long expectedTimeoutSecond = EXPECTED_TIMEOUTS_SECONDS[i];
timeSupplier.nanoTime = 0;
if (i == 0) {
deadHostState = new DeadHostState(timeSupplier);
} else {
deadHostState = new DeadHostState(deadHostState);
}
for (int j = 0; j < expectedTimeoutSecond; j++) {
timeSupplier.nanoTime += TimeUnit.SECONDS.toNanos(1);
assertThat(deadHostState.shallBeRetried(), is(false));
}
int iters = randomIntBetween(5, 30);
for (int j = 0; j < iters; j++) {
timeSupplier.nanoTime += TimeUnit.SECONDS.toNanos(1);
assertThat(deadHostState.shallBeRetried(), is(true));
}
}
}
public void testDeadHostStateTimeouts() {
ConfigurableTimeSupplier zeroTimeSupplier = new ConfigurableTimeSupplier();
zeroTimeSupplier.nanoTime = 0L;
DeadHostState previous = new DeadHostState(zeroTimeSupplier);
for (long expectedTimeoutsSecond : EXPECTED_TIMEOUTS_SECONDS) {
assertThat(TimeUnit.NANOSECONDS.toSeconds(previous.getDeadUntilNanos()), equalTo(expectedTimeoutsSecond));
previous = new DeadHostState(previous);
}
//check that from here on the timeout does not increase
int iters = randomIntBetween(5, 30);
for (int i = 0; i < iters; i++) {
DeadHostState deadHostState = new DeadHostState(previous);
assertThat(TimeUnit.NANOSECONDS.toSeconds(deadHostState.getDeadUntilNanos()),
equalTo(EXPECTED_TIMEOUTS_SECONDS[EXPECTED_TIMEOUTS_SECONDS.length - 1]));
previous = deadHostState;
}
}
static class ConfigurableTimeSupplier implements DeadHostState.TimeSupplier {
long nanoTime;
@Override
public long nanoTime() {
return nanoTime;
}
@Override
public String toString() {
return "configured[" + nanoTime + "]";
}
}
}
| [
"benjamin@deepcode.ai"
] | benjamin@deepcode.ai |
5093fbf255d5806af9f6f292664cf8853116468a | 8ba5bffbaa50ed76d467b3ef38dc38a6204203da | /src/gwtscheduler/client/widgets/common/CalendarPresenter.java | 376ca502df072c2c5a331d0d45be96230a8d31e9 | [] | no_license | Jenner4S/gwt-scheduler | da7ad2bdc9d30d65094e6b51abeb0f6ae92d3e7f | 461b19a9b24468140a0c74c03935f25856d93c3c | refs/heads/master | 2021-05-29T07:49:48.253650 | 2010-02-26T09:42:36 | 2010-02-26T09:42:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,311 | java | package gwtscheduler.client.widgets.common;
import org.goda.time.Instant;
import org.goda.time.Interval;
import gwtscheduler.client.widgets.common.navigation.EventNavigationListener;
import net.customware.gwt.presenter.client.Presenter;
import com.google.gwt.user.client.ui.Widget;
/**
* Defines a calendar controller. Responsible for mediating the view and the
* listener. For most cases, the implementing class will be the listener itself.
* @author malp
*/
public interface CalendarPresenter extends Presenter {
/**
* Gets the label for the view.
* @return the label
*/
String getTabLabel();
/**
* Gets the navigation events listener.
* @return the listener
*/
EventNavigationListener getNavigationListener();
/**
* Gets the widget.
* @return the widget
*/
Widget getWidgetDisplay();
/**
* Forces the layout of the display.
*/
void forceLayout();
/**
* Gets the correspondent time interval for a given cell range
* @param start the starting cell
* @param end the end cell
* @return the time interval
*/
Interval getIntervalForRange(int[] start, int[] end);
/**
* Gets the correspondent instant for a cell
* @param start the starting cell
* @param end the end cell
*/
Instant getInstantForCell(int[] start);
}
| [
"miguel.ping@gmail.com"
] | miguel.ping@gmail.com |
953ae6e8d5a7ea12377615ed34c5d6d5751b85dc | b7efba53d5c52be549f6e3d3594a1068fae51464 | /gen/com/gmail/blueboxware/libgdxplugin/filetypes/atlas2/psi/Atlas2Key.java | ecf012162d2dde80d63af28996199322db066688 | [
"Apache-2.0"
] | permissive | BlueBoxWare/LibGDXPlugin | 059562a9e7aaded782ee8538720e25e397e66d02 | add7e362d2f94809ad52cccdd848f458f7ebc5f1 | refs/heads/master | 2023-06-08T09:02:37.570105 | 2023-06-06T13:19:12 | 2023-06-06T13:19:12 | 64,067,118 | 163 | 11 | Apache-2.0 | 2021-04-08T13:45:49 | 2016-07-24T13:40:53 | Kotlin | UTF-8 | Java | false | true | 385 | java | // This is a generated file. Not intended for manual editing.
package com.gmail.blueboxware.libgdxplugin.filetypes.atlas2.psi;
import java.util.List;
import org.jetbrains.annotations.*;
import com.intellij.psi.PsiElement;
import com.gmail.blueboxware.libgdxplugin.filetypes.atlas2.Atlas2Element;
public interface Atlas2Key extends Atlas2Element {
@NotNull
String getValue();
}
| [
"BlueBoxWare@users.noreply.github.com"
] | BlueBoxWare@users.noreply.github.com |
c806afe30cad316df8b74ab1652fb7eca1c54541 | 79ccca222468166461b087dd06ca3020ddf142eb | /src/test/java/Collections/Set/Flower.java | 9c10645b7e03a4da81ec90214b3d1e7c604d4a98 | [] | no_license | Renas63/renas63-javacodes | 34617f115893d3f5e15e9c52f2c16b1af738ea90 | ea10609bb07f4b0560e96629462c0a881b63c8c2 | refs/heads/master | 2023-03-21T15:07:44.994493 | 2021-03-14T15:08:13 | 2021-03-14T15:08:13 | 343,214,533 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 962 | java | package Collections.Set;
public class Flower {
String name;
String color;
/*
reate one flower class with following instannce variables name and color
Create one construcgtor to initialize your instance variables
Create getters and setters
Create one toString method to print variable information
FLOWERTEST
Create one flowerTest class
Create 5 flower object
Create one HashSet collection to store 5 flower object.
Print all name and color of the flowers from hashSet.
*/
public Flower(String name, String color) {
this.name = name;
this.color = color;
}
public void setName(String name) {
this.name = name;
}
public void setColor(String color) {
this.color = color;
}
public String getName() {
return name;
}
public String getColor() {
return color;
}
public String toString(){
return "Name:" +name + " ,"+" Color:" +color;
}
}
| [
"75856707+Renas63@users.noreply.github.com"
] | 75856707+Renas63@users.noreply.github.com |
9675f070b2a836dd354e779e5f5668ffd90ff5f2 | 3a8ea0d9f837ffe5f27bfa3bfc12c1dd0a059c0c | /ch2/src/main/java/com/apress/prospring3/ch4/FtpArtworkSender.java | f00cf6ef7e11d086ad817e6508daca42115148a0 | [] | no_license | wilariz/spring | 465bd0ec4fc91977a8b9f8be28e7d3346f67d1f0 | 2ec592f6f6fde775f4a65127304d502e95c265ab | refs/heads/master | 2016-09-05T12:16:11.277008 | 2013-11-11T22:26:59 | 2013-11-11T22:26:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 377 | java | package com.apress.prospring3.ch4;
public class FtpArtworkSender implements ArtworkSender {
// public void sendArtwork(String artworkPath, Recipient recipient) {
// // ftp logic here...
// }
public String getFriendlyName() {
// TODO Auto-generated method stub
return null;
}
public String getShortName() {
// TODO Auto-generated method stub
return null;
}
}
| [
"wilarizz@hotmail.com"
] | wilarizz@hotmail.com |
8d2c800e951b8ed7ab1e43df33fa87200b042c5c | d3f77931dc84ba4f036241a391f7560a32442323 | /MatZipSpring/src/main/java/com/koreait/matzip/user/UserService.java | cf298abf0e8dff4eb235243139cb90e598a11229 | [] | no_license | truespring/spring-koreait | 4bd349efffcdac0bb7e92719d492d6e503e2b8d1 | 321fa7c046aee403f1a218107a55e546ea382e42 | refs/heads/master | 2023-01-09T00:31:34.179427 | 2020-11-11T08:18:13 | 2020-11-11T08:18:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,362 | java | package com.koreait.matzip.user;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.koreait.matzip.Const;
import com.koreait.matzip.SecurityUtils;
import com.koreait.matzip.rest.RestMapper;
import com.koreait.matzip.rest.model.RestPARAM;
import com.koreait.matzip.rest.model.RestRecMenuVO;
import com.koreait.matzip.user.model.UserDMI;
import com.koreait.matzip.user.model.UserPARAM;
import com.koreait.matzip.user.model.UserVO;
@Service
public class UserService {
@Autowired
private UserMapper mapper;
@Autowired
private RestMapper restMapper;
// 1번 로그인 성공, 2번 아이디 없음, 3번 비번 다름
public int login(UserPARAM param) {
if(param.getUser_id().equals("")) {
return Const.NO_ID;
}
UserDMI dbUser = mapper.selUser(param);
if(dbUser == null) {
return Const.NO_ID;
}
// 여기까지 왔다면 ID는 존재함!
String cryptPw = SecurityUtils.getEncrypt(param.getUser_pw(), dbUser.getSalt());
if(!cryptPw.equals(dbUser.getUser_pw())) {
return Const.NO_PW;
}
param.setI_user(dbUser.getI_user());
param.setUser_pw(null);
param.setNm(dbUser.getNm());
param.setProfile_img(dbUser.getProfile_img());
return Const.SUCCESS;
}
public int join(UserVO param) { // 이미 param에는 이름, 아이디, 비밀번호가 담겨있다
String pw = param.getUser_pw();
String salt = SecurityUtils.generateSalt();
String cryptPw = SecurityUtils.getEncrypt(pw, salt);
param.setSalt(salt);
param.setUser_pw(cryptPw);
// 파람에는 아이디, 암호화된 비밀번호, 솔트, 이름이 담겨있다
return mapper.insUser(param);
}
public int ajaxToggleFavorite(UserPARAM param) {
switch(param.getProc_type()) {
case "ins":
return mapper.insFavorite(param);
case "del":
return mapper.delFavorite(param);
}
return 0;
}
public List<UserDMI> selFavoriteList(UserPARAM param) {
List<UserDMI> list = mapper.selFavoriteList(param);
for(UserDMI vo : list) {
RestPARAM param2 = new RestPARAM();
param2.setI_rest(vo.getI_rest());
List<RestRecMenuVO> eachRecMenuList = restMapper.selRestRecMenus(param2);
vo.setMenuList(eachRecMenuList);
}
return list;
}
}
| [
"true_spring_@naver.com"
] | true_spring_@naver.com |
84c628693f30150660166634c4454bea5d54aedc | 5482a4fb87137cb2116f4ce3ae9f5fb72c150d4d | /app/src/androidTest/java/cityofontario/rattletech/com/helloworldgithub/ExampleInstrumentedTest.java | 4094a90c27d38612866294efce8f841ead3d581b | [] | no_license | Nithya-rattletech/HelloWorldGitHub | 7de8f34d48c9a27d2a128eee5de4f85d74a14a1c | 57d99e14bda20dbe6005505e5e9eb2eb9d1f64b6 | refs/heads/master | 2021-09-04T08:48:02.609269 | 2017-12-22T07:55:46 | 2017-12-22T07:55:46 | 115,083,613 | 0 | 0 | null | 2018-01-17T12:26:10 | 2017-12-22T06:19:17 | Java | UTF-8 | Java | false | false | 794 | java | package cityofontario.rattletech.com.helloworldgithub;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("cityofontario.rattletech.com.helloworldgithub", appContext.getPackageName());
}
}
| [
"nithya@rattletech.com"
] | nithya@rattletech.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.