blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e70eb60e4b77a118caf7de9712419a79b3a514fc | dee8ad2bf16602d790210551d02f787f54a1198a | /HotelBooking/src/main/java/com/hms/deloitte/model/Transaction.java | 3a1996d698b1abb7ff4abc4f199e2417954d80ce | [] | no_license | 7android/deloittetraining | c94ca6e6cbdbb5831a20e54196f9894a6235d0dd | 74dbe9a35cb52022a8ebd622914023f48f76bc21 | refs/heads/master | 2021-07-07T23:55:10.133825 | 2019-08-09T10:04:08 | 2019-08-09T10:04:08 | 196,966,813 | 0 | 0 | null | 2020-10-13T15:12:55 | 2019-07-15T09:22:51 | Java | UTF-8 | Java | false | false | 2,044 | java | package com.hms.deloitte.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(schema = "hr", name = "transaction")
public class Transaction {
@Id
private String trnum;
@Column
private String feedback;
@Column
private int cardNumber;
public Transaction() {
// TODO Auto-generated constructor stub
}
public Transaction(String trnum, String feedback, int cardNumber) {
super();
this.trnum = trnum;
this.feedback = feedback;
this.cardNumber = cardNumber;
}
public String getTrnum() {
return trnum;
}
public void setTrnum(String trnum) {
this.trnum = trnum;
}
public String getFeedback() {
return feedback;
}
public void setFeedback(String feedback) {
this.feedback = feedback;
}
public int getCardNumber() {
return cardNumber;
}
public void setCardNumber(int cardNumber) {
this.cardNumber = cardNumber;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + cardNumber;
result = prime * result + ((feedback == null) ? 0 : feedback.hashCode());
result = prime * result + ((trnum == null) ? 0 : trnum.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Transaction other = (Transaction) obj;
if (cardNumber != other.cardNumber)
return false;
if (feedback == null) {
if (other.feedback != null)
return false;
} else if (!feedback.equals(other.feedback))
return false;
if (trnum == null) {
if (other.trnum != null)
return false;
} else if (!trnum.equals(other.trnum))
return false;
return true;
}
@Override
public String toString() {
return "\nTransaction [trnum=" + trnum + ", feedback=" + feedback + ", cardNumber=" + cardNumber + "]";
}
}
| [
"[email protected]"
] | |
9def95fab6ecf7d045f99a8ac8629e5e154d4266 | 1a0dbbe3a79436631c5b1620db5602e076dcd878 | /CustomSpinnerTutorial/app/src/main/java/com/androideasily/customspinnertutorial/SpinnerData.java | 2aaa312bad67e48dc3051bb7824dd3364c8decd6 | [
"MIT"
] | permissive | a-anand-91119/Android-Easily-Projects | de8c7f6163743970cc0063c8b0b52f70fdd71ca1 | f4e4cd3c99c5b9dbce8656b0c9b04056e45d4171 | refs/heads/master | 2021-04-28T05:13:17.792596 | 2020-04-21T06:13:20 | 2020-04-21T06:13:20 | 122,174,402 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 414 | java | package com.androideasily.customspinnertutorial;
/**
* Created by Anand on 28-06-2017.
*/
public class SpinnerData {
private int icon;
private String iconName;
public SpinnerData(int icon, String iconName) {
this.icon = icon;
this.iconName = iconName;
}
public int getIcon() {
return icon;
}
public String getIconName() {
return iconName;
}
}
| [
"[email protected]"
] | |
01291a6371188a439767f2831c33a187c6b6ac81 | b30f6f815177defda41a26e1af14f9133a3e6c07 | /app/src/main/java/com/example/kvedantam/sunshine/MainActivity.java | 9c2ea0eecef47170506e2d5f771654da958cb305 | [] | no_license | krishna123499/UdacitySun | a82ba01b0a6735decb8f82ee3c646369ab16c979 | 55e20b8fb8aa1f000fe907661ef78d40e8662d7c | refs/heads/master | 2021-01-09T20:19:07.154814 | 2016-07-13T07:23:00 | 2016-07-13T07:23:00 | 63,223,485 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 343 | java | package com.example.kvedantam.sunshine;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"[email protected]"
] | |
1eb3e0e0e0f8f0d7583a142a2fef7de9ddaf937d | c7638e90501ea6df2d676ad7eb641c07f0377cf1 | /src/main/java/coupon/web/app/service/User.java | f7346a099a67e2fa0838dc959cdb4686d6c37a24 | [] | no_license | ilyashusterman/CouponWebApp-deprecated | 8fcffbc2b130dfe887b3d5f04d26552f2c584aa0 | fc3487c7fdc0ca1f4a727c1b703fa85fca8054a8 | refs/heads/master | 2021-05-01T13:56:28.393843 | 2016-11-25T23:26:14 | 2016-11-25T23:26:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 916 | java | package coupon.web.app.service;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class User {
private String username;
private String password;
private String clientType;
public User() {
super();
}
public User(String username, String password, String clientType) {
super();
this.username = username;
this.password = password;
this.clientType = clientType;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getClientType() {
return clientType;
}
public void setClientType(String clientType) {
this.clientType = clientType;
}
@Override
public String toString() {
return "User [username=" + username + ", password=" + password + ", clientType=" + clientType + "]";
}
}
| [
"[email protected]"
] | |
f0a4ae10ea33dff69fd7f7301c83807f80d3fe68 | f3beb239c1c70aaa0e458c0499161a05306cb1dc | /src/main/java/wisdom21/model/system/mapper/db1/User1Mapper.java | 5ad0204b69d44a7d61a3393bb15ec371d8663d71 | [] | no_license | wisdom-21/book-druid-mybatis_plus | ecc1d76b6f84bdc9a1cf02250a9b0d64a1832e63 | bf0a686188d13bd0ff084d2822a4f92c94e92983 | refs/heads/master | 2022-06-30T08:12:48.844056 | 2019-08-16T09:11:50 | 2019-08-16T09:11:50 | 202,696,715 | 1 | 0 | null | 2022-06-21T01:40:55 | 2019-08-16T09:11:37 | Java | UTF-8 | Java | false | false | 316 | java | package wisdom21.model.system.mapper.db1;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import wisdom21.model.system.entity.User1Entity;
/**
* @author Joaz
* @date 2019/8/16 15:25
*/
@Mapper
public interface User1Mapper extends BaseMapper<User1Entity> {
}
| [
"[email protected]"
] | |
5c9c2838f71c1c2efb51d2090ca93e9b422da2bf | eb668d754f2d6182a64c4ca522cfb73406b1529d | /danmu_collector_server/src/main/java/cn/partytime/collector/service/DanmuCollectorDanmuService.java | f6fdd4a6a33505adcdd708c0bb879e01166652c5 | [] | no_license | Sue0115/danmu_system | fb1b76ad09f08ee61f59ac3a2aeb95e0a4784d5f | 0be93d54ff8abb904d8ef54e0d9a0cd8c78770d7 | refs/heads/master | 2021-06-04T20:10:04.758329 | 2016-06-23T07:31:01 | 2016-06-23T07:31:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 526 | java | package cn.partytime.collector.service;
import java.util.Date;
/**
* Created by user on 16/6/22.
*/
public interface DanmuCollectorDanmuService {
/**
*
* @param msg 发送的消息
* @param color 颜色
* @param isBlockKey 是否是敏感词
* @param type 类型
* @param date 日期
* @param danmuPoolId 弹幕池编号
* @param userId 用户编号
*/
void danmuSave(String msg,String color,boolean isBlockKey,int type,Date date,String danmuPoolId,String userId);
}
| [
"[email protected]"
] | |
c4c360613f438cee42e393459fdeaac0dc63db99 | f81c7375389103dc082663d71f1ab19a1d40688b | /app/src/main/java/example/codeclan/com/blackjack/BlackJackStartActivity.java | a0720522ae1e0400fa6f6bd14f44d6c555c12535 | [] | no_license | CrawfordD1/BlackJack_Android | 67ef30ea82d293be3e3cd20abdfb9948a97f6bf5 | 5050e665dd11d726a256fb4db4a7679884fd9fa9 | refs/heads/master | 2020-12-02T16:21:34.644906 | 2017-08-09T17:16:23 | 2017-08-09T17:16:23 | 96,540,259 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 395 | java | package example.codeclan.com.blackjack;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
public class BlackJackStartActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_black_jack_start);
}
}
| [
"[email protected]"
] | |
0f8f8a258c3fa5f3b3f9e55d2af30e5965e1a436 | c62f0f7b407dc1c774ccb1a623cfee052b458f32 | /inputview/src/main/java/com/agsw/FabricView/DrawableObjects/CDrawable.java | 57808242deab07a5efa1d42c0b7220777a319777 | [
"Apache-2.0"
] | permissive | whoze/FabricView | 3c89a8a0cf79cb5a99f9af634b5d496b9eed5abb | 05549effd9c207cb2159637302ee8a2f83e21fbe | refs/heads/master | 2020-07-02T16:31:00.886994 | 2015-10-09T23:04:19 | 2015-10-09T23:04:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 364 | java | package com.agsw.FabricView.DrawableObjects;
import android.graphics.Canvas;
import android.graphics.Paint;
/**
* Created by antwan on 10/3/2015.
*/
public interface CDrawable {
Paint getPaint();
int getXcoords();
int getYcoords();
void setXcoords(int x);
void setYcoords(int y);
void setPaint(Paint p);
void draw(Canvas canvas);
}
| [
"[email protected]"
] | |
883ac2a9692c9845654dc0911838c312a905a3cd | f50981b391d075e280fca88954caef5d42a21c35 | /src/leetcode/array/LC_332_ReconstructItinerary.java | bdb64706688cd925b1902a10c5344a6a3c93014c | [] | no_license | fengjiny/algorithm | e2a953c56e3f3da048bf9bcc799a43060274d34a | 9ca3fcd0447debff214ce53816a01131124f25fc | refs/heads/master | 2020-03-10T17:25:41.691258 | 2018-05-09T07:59:19 | 2018-05-09T07:59:19 | 129,500,074 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,027 | java | package leetcode.array;
import java.util.*;
public class LC_332_ReconstructItinerary {
public static List<String> findItinerary(String[][] tickets) {
List<String> res = new LinkedList<>();
Map<String, PriorityQueue<String>> map = new HashMap<>();
for(String[] ticket : tickets) {
map.computeIfAbsent(ticket[0], v -> new PriorityQueue()).add(ticket[1]);
}
Stack<String> stack = new Stack<String>();
stack.push("JFK");
while(!stack.isEmpty()) {
while (map.containsKey(stack.peek()) && !map.get(stack.peek()).isEmpty())
stack.push(map.get(stack.peek()).poll());
res.add(0, stack.pop());
}
return res;
}
public static void main(String[] args) {
String[][] tickets = {{"MUC", "LHR"}, {"JFK", "MUC"}, {"SFO", "SJC"}, {"LHR", "SFO"}, {"JFK", "ATL"}};
List<String> list = findItinerary(tickets);
list.forEach(s-> {
System.out.println(s);
});
}
}
| [
"[email protected]"
] | |
5affeaf481e4f5e87b90b32cb3f57ec11d0f128f | 5a54bfa4f05274b4ca5caa907d7d0141b8e5c488 | /src/oculusRoomTiny/rendering/glsl/FillCollection.java | effc956c429ef8361ae09681beefcde18a6a1eb9 | [
"MIT"
] | permissive | elect86/JavaOculusRoomTiny | dff779a7c7aa46a373abd54235b9c0802947a7a7 | 978da34e72b1c03500849500756b6a84d21b40e6 | refs/heads/master | 2021-01-01T16:56:03.946509 | 2015-04-20T07:27:28 | 2015-04-20T07:27:28 | 17,250,333 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,086 | 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 oculusRoomTiny.rendering.glsl;
import com.jogamp.opengl.GL3;
import jglm.Vec2i;
import jglm.Vec4;
import oculusRoomTiny.rendering.Texture;
import static oculusRoomTiny.rendering.Texture.BuiltinTexture.tex_checker;
import static oculusRoomTiny.rendering.Texture.BuiltinTexture.tex_count;
import static oculusRoomTiny.rendering.Texture.BuiltinTexture.tex_panel;
import oculusRoomTiny.rendering.TextureFormat;
import oculusRoomTiny.rendering.glsl.shaders.BuiltinShaders;
/**
*
* @author gbarbieri
*/
public class FillCollection {
private ShaderFill litSolid;
private ShaderFill[] litTextures;
public FillCollection(GL3 gl3) {
Texture[] builtinTextures = new Texture[tex_count.ordinal()];
/**
* Create floor checkerboard texture.
*/
{
Vec4 a = new Vec4(180f, 180f, 180f, 255f);
Vec4 b = new Vec4(80f, 80f, 80f, 255f);
byte[] checker = new byte[256 * 256 * 4];
for (int j = 0; j < 256; j++) {
for (int i = 0; i < 256; i++) {
Vec4 color = (((i / 4 >> 5) ^ (j / 4 >> 5)) & 1) == 1 ? b : a;
checker[(j * 256 + i) * 4] = (byte) color.x;
checker[(j * 256 + i) * 4 + 1] = (byte) color.y;
checker[(j * 256 + i) * 4 + 2] = (byte) color.z;
checker[(j * 256 + i) * 4 + 3] = (byte) color.w;
}
}
builtinTextures[tex_checker.ordinal()] = Texture.create(gl3, TextureFormat.RGBA, new Vec2i(256, 256), checker);
}
/**
* Ceiling panel texture.
*/
{
Vec4 a = new Vec4(80f, 80f, 80f, 255f);
Vec4 b = new Vec4(180f, 180f, 180f, 255f);
byte[] panel = new byte[256 * 256 * 4];
for (int j = 0; j < 256; j++) {
for (int i = 0; i < 256; i++) {
Vec4 color = (i / 4 == 0 || j / 4 == 0) ? a : b;
panel[(j * 256 + i) * 4] = (byte) color.x;
panel[(j * 256 + i) * 4 + 1] = (byte) color.y;
panel[(j * 256 + i) * 4 + 2] = (byte) color.z;
panel[(j * 256 + i) * 4 + 3] = (byte) color.w;
}
}
builtinTextures[tex_panel.ordinal()] = Texture.create(gl3, TextureFormat.RGBA, new Vec2i(256, 256), panel);
}
litTextures = new ShaderFill[tex_count.ordinal()];
LitTexturesProgram program = new LitTexturesProgram(gl3, BuiltinShaders.filepath, BuiltinShaders.standard_VS, BuiltinShaders.litTexture_FS);
for (int i = 1; i < 3; i++) {
litTextures[i] = new ShaderFill(program, builtinTextures[i]);
}
}
public ShaderFill getLitSolid() {
return litSolid;
}
public ShaderFill[] getLitTextures() {
return litTextures;
}
}
| [
"gbarbieri@reknow05"
] | gbarbieri@reknow05 |
0505845318049a755ff158f86a14c33113221134 | 4f83c12631cfd6b8594a9c99653d0a8df96db799 | /app/src/test/java/com/eton/roomdb/ExampleUnitTest.java | 08156629f1c9620ed47ace49395fe9c356596966 | [] | no_license | CrossLeaf/RoomDb | 6e8fbedf936db52f9d3e4885c22953d9624ebb89 | 3634878839e146385ced8109fc5558383fa5e7a0 | refs/heads/master | 2020-05-13T16:06:45.963732 | 2019-04-25T15:02:36 | 2019-04-25T15:02:36 | 181,637,000 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 376 | java | package com.eton.roomdb;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
7fa5b7848c8f09cb5cebc6d7e3c515ed51bb62fd | da7a1b5cd6301f7bc963f99249eb8c1297f47163 | /src/main/java/io/github/doocs/im/model/request/IMRemoveAttrRequest.java | b43216fdcc585b5bd484c180af347a3d6afca8f2 | [
"Apache-2.0"
] | permissive | StringZhang/qcloud-im-server-sdk-java | 256bd094f54817c523ff1bbd268b4babe46bea1e | 5ba6e8ff9e8558e399c7e10aba150af1f5a6b143 | refs/heads/main | 2023-07-20T07:53:20.696095 | 2021-08-27T03:52:32 | 2021-08-27T03:52:32 | 397,852,710 | 0 | 0 | Apache-2.0 | 2021-08-19T07:17:38 | 2021-08-19T07:17:37 | null | UTF-8 | Java | false | false | 641 | java | package io.github.doocs.im.model.request;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.github.doocs.im.model.response.UserAttrItem;
import java.util.List;
/**
* @author bingo
* @since 2021/7/31 17:01
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class IMRemoveAttrRequest extends GenericRequest {
@JsonProperty("UserAttrs")
private List<UserAttrItem> userAttrs;
public List<UserAttrItem> getUserAttrs() {
return userAttrs;
}
public void setUserAttrs(List<UserAttrItem> userAttrs) {
this.userAttrs = userAttrs;
}
}
| [
"[email protected]"
] | |
68f2fda3655c01837fa24a21cb08047adedd3003 | e386d1153b65ef0d0076e154009db72b4beffdfb | /src/br/com/drummond/dal/ModuloConexao.java | 253b34ddfa9442066ec29606b2ae4ecc7962a071 | [] | no_license | Davimmr/ProjetoFaculdade | 5b55f990116fbb5e71d097fc709e27c77ba4fcf7 | c036f60f33f08c21031d9cbbec40deb61e3a87eb | refs/heads/main | 2023-07-31T12:20:17.305964 | 2021-09-15T18:10:00 | 2021-09-15T18:10:00 | 406,878,197 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,367 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package br.com.drummond.dal;
import java.sql.*;
/*data acess learn*
*
* @author Miticos
*/
public class ModuloConexao {
//metodo responsavel por estabelecer a conexao com o bd
public static Connection conector() {
java.sql.Connection conexao = null;
// a linha abaixo chama o driver
//qual o tipo de bd
String driver = "com.mysql.jdbc.Driver";
//qual o caminho e o nome do bd e dps qual usuario pode acessar o bd q
// q seria do xampp o root e sem senha
// armazenando informacoes referente ao banco
String url = "jdbc:mysql://localhost:3306/dbTIO";
String user = "root";
String password = "";
//estabelecendo a conexao com o banco
// vai exe a linha do drive, obtendo conexao pelo caminho usuario e senha
// para poder ligar o bd com o java e entao returna a conexao ""
try {
Class.forName(driver);
conexao = DriverManager.getConnection(url, user, password);
return conexao;
}
catch (Exception e)
{
//System.out.println(e);
return null;
}
}
}
| [
"[email protected]"
] | |
36ccc8b0fd27e61c7b1a8f5462b199a810d8ea4c | cc94380c744676115f5ca2af575f8dca6da38269 | /src/main/java/com/google/cloud/compute/v1/AggregatedListTargetHttpsProxiesHttpRequest.java | 142ac139c9a5f009a15c0fffb2f84c75da3da5ac | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | vchudnov-g/java-compute | cfb70898c5c220c2bafa7f24126b799235d7ab11 | 93041a581cd44b23afb085962b3eb56e9b34051b | refs/heads/master | 2021-01-07T17:01:11.362233 | 2020-02-04T19:21:18 | 2020-02-04T19:21:18 | 241,762,450 | 0 | 0 | null | 2020-02-20T01:03:29 | 2020-02-20T01:03:28 | null | UTF-8 | Java | false | false | 22,768 | java | /*
* Copyright 2020 Google 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
*
* https://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.google.cloud.compute.v1;
import com.google.api.core.BetaApi;
import com.google.api.gax.httpjson.ApiMessage;
import java.util.List;
import java.util.Objects;
import javax.annotation.Generated;
import javax.annotation.Nullable;
@Generated("by GAPIC")
@BetaApi
/**
* Request object for method compute.targetHttpsProxies.aggregatedList. Retrieves the list of all
* TargetHttpsProxy resources, regional and global, available to the specified project.
*/
public final class AggregatedListTargetHttpsProxiesHttpRequest implements ApiMessage {
private final String access_token;
private final String callback;
private final String fields;
private final String filter;
private final String key;
private final Integer maxResults;
private final String orderBy;
private final String pageToken;
private final String prettyPrint;
private final String project;
private final String quotaUser;
private final String userIp;
private AggregatedListTargetHttpsProxiesHttpRequest() {
this.access_token = null;
this.callback = null;
this.fields = null;
this.filter = null;
this.key = null;
this.maxResults = null;
this.orderBy = null;
this.pageToken = null;
this.prettyPrint = null;
this.project = null;
this.quotaUser = null;
this.userIp = null;
}
private AggregatedListTargetHttpsProxiesHttpRequest(
String access_token,
String callback,
String fields,
String filter,
String key,
Integer maxResults,
String orderBy,
String pageToken,
String prettyPrint,
String project,
String quotaUser,
String userIp) {
this.access_token = access_token;
this.callback = callback;
this.fields = fields;
this.filter = filter;
this.key = key;
this.maxResults = maxResults;
this.orderBy = orderBy;
this.pageToken = pageToken;
this.prettyPrint = prettyPrint;
this.project = project;
this.quotaUser = quotaUser;
this.userIp = userIp;
}
@Override
public Object getFieldValue(String fieldName) {
if ("access_token".equals(fieldName)) {
return access_token;
}
if ("callback".equals(fieldName)) {
return callback;
}
if ("fields".equals(fieldName)) {
return fields;
}
if ("filter".equals(fieldName)) {
return filter;
}
if ("key".equals(fieldName)) {
return key;
}
if ("maxResults".equals(fieldName)) {
return maxResults;
}
if ("orderBy".equals(fieldName)) {
return orderBy;
}
if ("pageToken".equals(fieldName)) {
return pageToken;
}
if ("prettyPrint".equals(fieldName)) {
return prettyPrint;
}
if ("project".equals(fieldName)) {
return project;
}
if ("quotaUser".equals(fieldName)) {
return quotaUser;
}
if ("userIp".equals(fieldName)) {
return userIp;
}
return null;
}
@Nullable
@Override
public ApiMessage getApiMessageRequestBody() {
return null;
}
@Nullable
@Override
/**
* The fields that should be serialized (even if they have empty values). If the containing
* message object has a non-null fieldmask, then all the fields in the field mask (and only those
* fields in the field mask) will be serialized. If the containing object does not have a
* fieldmask, then only non-empty fields will be serialized.
*/
public List<String> getFieldMask() {
return null;
}
/** OAuth 2.0 token for the current user. */
public String getAccessToken() {
return access_token;
}
/** Name of the JavaScript callback function that handles the response. */
public String getCallback() {
return callback;
}
/** Selector specifying a subset of fields to include in the response. */
public String getFields() {
return fields;
}
/**
* A filter expression that filters resources listed in the response. The expression must specify
* the field name, a comparison operator, and the value that you want to use for filtering. The
* value must be a string, a number, or a boolean. The comparison operator must be either =, !=,
* >, or <.
*
* <p>For example, if you are filtering Compute Engine instances, you can exclude instances named
* example-instance by specifying name != example-instance.
*
* <p>You can also filter nested fields. For example, you could specify
* scheduling.automaticRestart = false to include instances only if they are not scheduled for
* automatic restarts. You can use filtering on nested fields to filter based on resource labels.
*
* <p>To filter on multiple expressions, provide each separate expression within parentheses. For
* example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each
* expression is an AND expression. However, you can include AND and OR expressions explicitly.
* For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND
* (scheduling.automaticRestart = true).
*/
public String getFilter() {
return filter;
}
/** API key. Required unless you provide an OAuth 2.0 token. */
public String getKey() {
return key;
}
/**
* The maximum number of results per page that should be returned. If the number of available
* results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to
* get the next page of results in subsequent list requests. Acceptable values are 0 to 500,
* inclusive. (Default: 500)
*/
public Integer getMaxResults() {
return maxResults;
}
/**
* Sorts list results by a certain order. By default, results are returned in alphanumerical order
* based on the resource name.
*
* <p>You can also sort results in descending order based on the creation timestamp using
* orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in
* reverse chronological order (newest result first). Use this to sort resources like operations
* so that the newest operation is returned first.
*
* <p>Currently, only sorting by name or creationTimestamp desc is supported.
*/
public String getOrderBy() {
return orderBy;
}
/**
* Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list
* request to get the next page of results.
*/
public String getPageToken() {
return pageToken;
}
/** Returns response with indentations and line breaks. */
public String getPrettyPrint() {
return prettyPrint;
}
/**
* Name of the project scoping this request. It must have the format
* `{project}/aggregated/targetHttpsProxies`. \`{project}\` must start with a letter, and contain
* only letters (\`[A-Za-z]\`), numbers (\`[0-9]\`), dashes (\`-\`), * underscores (\`_\`),
* periods (\`.\`), tildes (\`~\`), plus (\`+\`) or percent * signs (\`%\`). It must be
* between 3 and 255 characters in length, and it * must not start with \`"goog"\`.
*/
public String getProject() {
return project;
}
/** Alternative to userIp. */
public String getQuotaUser() {
return quotaUser;
}
/** IP address of the end user for whom the API call is being made. */
public String getUserIp() {
return userIp;
}
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(AggregatedListTargetHttpsProxiesHttpRequest prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
public Builder toBuilder() {
return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
}
public static AggregatedListTargetHttpsProxiesHttpRequest getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final AggregatedListTargetHttpsProxiesHttpRequest DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new AggregatedListTargetHttpsProxiesHttpRequest();
}
public static class Builder {
private String access_token;
private String callback;
private String fields;
private String filter;
private String key;
private Integer maxResults;
private String orderBy;
private String pageToken;
private String prettyPrint;
private String project;
private String quotaUser;
private String userIp;
Builder() {}
public Builder mergeFrom(AggregatedListTargetHttpsProxiesHttpRequest other) {
if (other == AggregatedListTargetHttpsProxiesHttpRequest.getDefaultInstance()) return this;
if (other.getAccessToken() != null) {
this.access_token = other.access_token;
}
if (other.getCallback() != null) {
this.callback = other.callback;
}
if (other.getFields() != null) {
this.fields = other.fields;
}
if (other.getFilter() != null) {
this.filter = other.filter;
}
if (other.getKey() != null) {
this.key = other.key;
}
if (other.getMaxResults() != null) {
this.maxResults = other.maxResults;
}
if (other.getOrderBy() != null) {
this.orderBy = other.orderBy;
}
if (other.getPageToken() != null) {
this.pageToken = other.pageToken;
}
if (other.getPrettyPrint() != null) {
this.prettyPrint = other.prettyPrint;
}
if (other.getProject() != null) {
this.project = other.project;
}
if (other.getQuotaUser() != null) {
this.quotaUser = other.quotaUser;
}
if (other.getUserIp() != null) {
this.userIp = other.userIp;
}
return this;
}
Builder(AggregatedListTargetHttpsProxiesHttpRequest source) {
this.access_token = source.access_token;
this.callback = source.callback;
this.fields = source.fields;
this.filter = source.filter;
this.key = source.key;
this.maxResults = source.maxResults;
this.orderBy = source.orderBy;
this.pageToken = source.pageToken;
this.prettyPrint = source.prettyPrint;
this.project = source.project;
this.quotaUser = source.quotaUser;
this.userIp = source.userIp;
}
/** OAuth 2.0 token for the current user. */
public String getAccessToken() {
return access_token;
}
/** OAuth 2.0 token for the current user. */
public Builder setAccessToken(String access_token) {
this.access_token = access_token;
return this;
}
/** Name of the JavaScript callback function that handles the response. */
public String getCallback() {
return callback;
}
/** Name of the JavaScript callback function that handles the response. */
public Builder setCallback(String callback) {
this.callback = callback;
return this;
}
/** Selector specifying a subset of fields to include in the response. */
public String getFields() {
return fields;
}
/** Selector specifying a subset of fields to include in the response. */
public Builder setFields(String fields) {
this.fields = fields;
return this;
}
/**
* A filter expression that filters resources listed in the response. The expression must
* specify the field name, a comparison operator, and the value that you want to use for
* filtering. The value must be a string, a number, or a boolean. The comparison operator must
* be either =, !=, >, or <.
*
* <p>For example, if you are filtering Compute Engine instances, you can exclude instances
* named example-instance by specifying name != example-instance.
*
* <p>You can also filter nested fields. For example, you could specify
* scheduling.automaticRestart = false to include instances only if they are not scheduled for
* automatic restarts. You can use filtering on nested fields to filter based on resource
* labels.
*
* <p>To filter on multiple expressions, provide each separate expression within parentheses.
* For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By
* default, each expression is an AND expression. However, you can include AND and OR
* expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel
* Broadwell") AND (scheduling.automaticRestart = true).
*/
public String getFilter() {
return filter;
}
/**
* A filter expression that filters resources listed in the response. The expression must
* specify the field name, a comparison operator, and the value that you want to use for
* filtering. The value must be a string, a number, or a boolean. The comparison operator must
* be either =, !=, >, or <.
*
* <p>For example, if you are filtering Compute Engine instances, you can exclude instances
* named example-instance by specifying name != example-instance.
*
* <p>You can also filter nested fields. For example, you could specify
* scheduling.automaticRestart = false to include instances only if they are not scheduled for
* automatic restarts. You can use filtering on nested fields to filter based on resource
* labels.
*
* <p>To filter on multiple expressions, provide each separate expression within parentheses.
* For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By
* default, each expression is an AND expression. However, you can include AND and OR
* expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel
* Broadwell") AND (scheduling.automaticRestart = true).
*/
public Builder setFilter(String filter) {
this.filter = filter;
return this;
}
/** API key. Required unless you provide an OAuth 2.0 token. */
public String getKey() {
return key;
}
/** API key. Required unless you provide an OAuth 2.0 token. */
public Builder setKey(String key) {
this.key = key;
return this;
}
/**
* The maximum number of results per page that should be returned. If the number of available
* results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to
* get the next page of results in subsequent list requests. Acceptable values are 0 to 500,
* inclusive. (Default: 500)
*/
public Integer getMaxResults() {
return maxResults;
}
/**
* The maximum number of results per page that should be returned. If the number of available
* results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to
* get the next page of results in subsequent list requests. Acceptable values are 0 to 500,
* inclusive. (Default: 500)
*/
public Builder setMaxResults(Integer maxResults) {
this.maxResults = maxResults;
return this;
}
/**
* Sorts list results by a certain order. By default, results are returned in alphanumerical
* order based on the resource name.
*
* <p>You can also sort results in descending order based on the creation timestamp using
* orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in
* reverse chronological order (newest result first). Use this to sort resources like operations
* so that the newest operation is returned first.
*
* <p>Currently, only sorting by name or creationTimestamp desc is supported.
*/
public String getOrderBy() {
return orderBy;
}
/**
* Sorts list results by a certain order. By default, results are returned in alphanumerical
* order based on the resource name.
*
* <p>You can also sort results in descending order based on the creation timestamp using
* orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in
* reverse chronological order (newest result first). Use this to sort resources like operations
* so that the newest operation is returned first.
*
* <p>Currently, only sorting by name or creationTimestamp desc is supported.
*/
public Builder setOrderBy(String orderBy) {
this.orderBy = orderBy;
return this;
}
/**
* Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list
* request to get the next page of results.
*/
public String getPageToken() {
return pageToken;
}
/**
* Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list
* request to get the next page of results.
*/
public Builder setPageToken(String pageToken) {
this.pageToken = pageToken;
return this;
}
/** Returns response with indentations and line breaks. */
public String getPrettyPrint() {
return prettyPrint;
}
/** Returns response with indentations and line breaks. */
public Builder setPrettyPrint(String prettyPrint) {
this.prettyPrint = prettyPrint;
return this;
}
/**
* Name of the project scoping this request. It must have the format
* `{project}/aggregated/targetHttpsProxies`. \`{project}\` must start with a letter, and
* contain only letters (\`[A-Za-z]\`), numbers (\`[0-9]\`), dashes (\`-\`), * underscores
* (\`_\`), periods (\`.\`), tildes (\`~\`), plus (\`+\`) or percent * signs (\`%\`). It
* must be between 3 and 255 characters in length, and it * must not start with \`"goog"\`.
*/
public String getProject() {
return project;
}
/**
* Name of the project scoping this request. It must have the format
* `{project}/aggregated/targetHttpsProxies`. \`{project}\` must start with a letter, and
* contain only letters (\`[A-Za-z]\`), numbers (\`[0-9]\`), dashes (\`-\`), * underscores
* (\`_\`), periods (\`.\`), tildes (\`~\`), plus (\`+\`) or percent * signs (\`%\`). It
* must be between 3 and 255 characters in length, and it * must not start with \`"goog"\`.
*/
public Builder setProject(String project) {
this.project = project;
return this;
}
/** Alternative to userIp. */
public String getQuotaUser() {
return quotaUser;
}
/** Alternative to userIp. */
public Builder setQuotaUser(String quotaUser) {
this.quotaUser = quotaUser;
return this;
}
/** IP address of the end user for whom the API call is being made. */
public String getUserIp() {
return userIp;
}
/** IP address of the end user for whom the API call is being made. */
public Builder setUserIp(String userIp) {
this.userIp = userIp;
return this;
}
public AggregatedListTargetHttpsProxiesHttpRequest build() {
String missing = "";
if (project == null) {
missing += " project";
}
if (!missing.isEmpty()) {
throw new IllegalStateException("Missing required properties:" + missing);
}
return new AggregatedListTargetHttpsProxiesHttpRequest(
access_token,
callback,
fields,
filter,
key,
maxResults,
orderBy,
pageToken,
prettyPrint,
project,
quotaUser,
userIp);
}
public Builder clone() {
Builder newBuilder = new Builder();
newBuilder.setAccessToken(this.access_token);
newBuilder.setCallback(this.callback);
newBuilder.setFields(this.fields);
newBuilder.setFilter(this.filter);
newBuilder.setKey(this.key);
newBuilder.setMaxResults(this.maxResults);
newBuilder.setOrderBy(this.orderBy);
newBuilder.setPageToken(this.pageToken);
newBuilder.setPrettyPrint(this.prettyPrint);
newBuilder.setProject(this.project);
newBuilder.setQuotaUser(this.quotaUser);
newBuilder.setUserIp(this.userIp);
return newBuilder;
}
}
@Override
public String toString() {
return "AggregatedListTargetHttpsProxiesHttpRequest{"
+ "access_token="
+ access_token
+ ", "
+ "callback="
+ callback
+ ", "
+ "fields="
+ fields
+ ", "
+ "filter="
+ filter
+ ", "
+ "key="
+ key
+ ", "
+ "maxResults="
+ maxResults
+ ", "
+ "orderBy="
+ orderBy
+ ", "
+ "pageToken="
+ pageToken
+ ", "
+ "prettyPrint="
+ prettyPrint
+ ", "
+ "project="
+ project
+ ", "
+ "quotaUser="
+ quotaUser
+ ", "
+ "userIp="
+ userIp
+ "}";
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof AggregatedListTargetHttpsProxiesHttpRequest) {
AggregatedListTargetHttpsProxiesHttpRequest that =
(AggregatedListTargetHttpsProxiesHttpRequest) o;
return Objects.equals(this.access_token, that.getAccessToken())
&& Objects.equals(this.callback, that.getCallback())
&& Objects.equals(this.fields, that.getFields())
&& Objects.equals(this.filter, that.getFilter())
&& Objects.equals(this.key, that.getKey())
&& Objects.equals(this.maxResults, that.getMaxResults())
&& Objects.equals(this.orderBy, that.getOrderBy())
&& Objects.equals(this.pageToken, that.getPageToken())
&& Objects.equals(this.prettyPrint, that.getPrettyPrint())
&& Objects.equals(this.project, that.getProject())
&& Objects.equals(this.quotaUser, that.getQuotaUser())
&& Objects.equals(this.userIp, that.getUserIp());
}
return false;
}
@Override
public int hashCode() {
return Objects.hash(
access_token,
callback,
fields,
filter,
key,
maxResults,
orderBy,
pageToken,
prettyPrint,
project,
quotaUser,
userIp);
}
}
| [
"[email protected]"
] | |
176e7b731a48b5904237acecc55d3a7e3b74c73c | 4b2b6fe260ba39f684f496992513cb8bc07dfcbc | /com/planet_ink/coffee_mud/Commands/Hold.java | 45b7e22068808ae1d5cd13109fb0bb18bfb8dffe | [
"Apache-2.0"
] | permissive | vjanmey/EpicMudfia | ceb26feeac6f5b3eb48670f81ea43d8648314851 | 63c65489c673f4f8337484ea2e6ebfc11a09364c | refs/heads/master | 2021-01-18T20:12:08.160733 | 2014-06-22T04:38:14 | 2014-06-22T04:38:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,052 | java | package com.planet_ink.coffee_mud.Commands;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;
import java.util.*;
/*
Copyright 2000-2014 Bo Zimmerman
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.
*/
@SuppressWarnings({"unchecked","rawtypes"})
public class Hold extends StdCommand
{
public Hold(){}
private final String[] access=_i(new String[]{"HOLD","HOL","HO","H"});
@Override public String[] getAccessWords(){return access;}
@Override
public boolean execute(MOB mob, Vector commands, int metaFlags)
throws java.io.IOException
{
if(commands.size()<2)
{
mob.tell(_("Hold what?"));
return false;
}
commands.removeElementAt(0);
final List<Item> items=CMLib.english().fetchItemList(mob,mob,null,commands,Wearable.FILTER_UNWORNONLY,false);
if(items.size()==0)
mob.tell(_("You don't seem to be carrying that."));
else
for(int i=0;i<items.size();i++)
if((items.size()==1)||(items.get(i).canWear(mob,Wearable.WORN_HELD)))
{
final Item item=items.get(i);
int msgType=CMMsg.MSG_HOLD;
String str=_("<S-NAME> hold(s) <T-NAME>.");
if((mob.freeWearPositions(Wearable.WORN_WIELD,(short)0,(short)0)>0)
&&((item.rawProperLocationBitmap()==Wearable.WORN_WIELD)
||(item.rawProperLocationBitmap()==(Wearable.WORN_HELD|Wearable.WORN_WIELD))))
{
str=_("<S-NAME> wield(s) <T-NAME>.");
msgType=CMMsg.MSG_WIELD;
}
final CMMsg newMsg=CMClass.getMsg(mob,item,null,msgType,str);
if(mob.location().okMessage(mob,newMsg))
mob.location().send(mob,newMsg);
}
return false;
}
@Override public double combatActionsCost(final MOB mob, final List<String> cmds){return CMProps.getCombatActionCost(ID());}
@Override public double actionsCost(final MOB mob, final List<String> cmds){return CMProps.getActionCost(ID());}
@Override public boolean canBeOrdered(){return true;}
}
| [
"[email protected]"
] | |
9e642fe7468b33597e7bfce441e1a1ee6c96ad8d | 5730a8865d01d09a662499f2ef2ff635e853c59f | /src/test/java/uk/co/maclon/claimant/repository/ClaimantRepositoryTest.java | 21b28d62fd95fe26c4d858d5f6374e0b459b86b2 | [] | no_license | philbarton/springReactive | 28010ae63e1ec25b3a23929a029e745543100528 | 89d309b68e059d0a7c0ee45ae344bb5935add8a3 | refs/heads/master | 2020-03-20T05:52:33.925928 | 2018-06-18T09:29:34 | 2018-06-18T09:29:34 | 137,229,320 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,071 | java | package uk.co.maclon.claimant.repository;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.mongodb.core.ReactiveMongoTemplate;
import org.springframework.test.context.junit4.SpringRunner;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.test.StepVerifier;
import uk.co.maclon.claimant.model.Claimant;
import uk.co.maclon.claimant.model.Gender;
import uk.co.maclon.claimant.model.RelationshipStatus;
import uk.co.maclon.claimant.model.Title;
import java.time.LocalDate;
@RunWith(SpringRunner.class)
@SpringBootTest
public class ClaimantRepositoryTest {
@Autowired
ReactiveMongoTemplate template;
@Autowired
ClaimantRepository claimantRepository;
@Before
public void setUp() {
StepVerifier.create(template.dropCollection(Claimant.class)).verifyComplete();
}
@Test
public void insertOneRepo() {
Claimant claimant = createClaimant("QQ123456C");
Mono<Claimant> claimantMono = claimantRepository.save(claimant);
StepVerifier.create(claimantMono).expectNextCount(1).verifyComplete();
}
@Test
public void insertOneTemplate() {
Claimant claimant = createClaimant("QQ123456C");
Flux<Claimant> insertOne = template
.insertAll(Flux.just(claimant).collectList());
StepVerifier.create(insertOne).expectNextCount(1).verifyComplete();
}
private static Claimant createClaimant(String nino) {
return Claimant
.builder()
.nino(nino)
.dateOfBirth(LocalDate.now())
.title(Title.MR)
.firstName("phil")
.lastName("barton")
.gender(Gender.MALE)
.hasPartner(true)
.relationshipStatus(RelationshipStatus.MARRIED)
.hasSavings(false)
.build();
}
} | [
"[email protected]"
] | |
b20d3c928bdd3d767da5ce2026351f1ae714c084 | 5c6cfd2f44672806fb8433c789cf4b1e63f6fc3f | /src/Main.java | d74ecfc6c2a6e49ce0544ccf5724cc25fff593ca | [] | no_license | IlyaKukarkin/JavaThreadGame | c1f0decf5ee0f810a5339715cd34bf55f37cfe3d | 6f2f3b7f62635a30a50fad5e9d519886209b92c6 | refs/heads/master | 2020-03-09T15:28:18.757767 | 2018-04-10T02:16:21 | 2018-04-10T02:16:21 | 128,859,916 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,495 | java | import org.jetbrains.annotations.Contract;
import java.awt.*;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.Random;
import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReentrantLock;
public class Main {
private static Random rnd = new Random();
static CreateMainWindow window = new CreateMainWindow(new MyKeyListener(), 40, 40);
static int gunX = 20,
gunY = 39;
private static final char gunSymbol = '¤';
static AtomicInteger hit = new AtomicInteger(0), miss = new AtomicInteger(0);
static Semaphore bulletSemaphore = new Semaphore(3, true);
private static ReentrantLock randomLock = new ReentrantLock();
public static void main(String[] args) {
window.setSymbol(gunX, gunY, gunSymbol, Color.BLACK);
new CreateEnemy().start();
}
public static class MyKeyListener implements KeyListener {
@Override
public void keyTyped(KeyEvent e) { }
@Override
public void keyPressed(KeyEvent e) {
switch (e.getExtendedKeyCode()){
case KeyEvent.VK_RIGHT: Main.stepRight();
break;
case KeyEvent.VK_LEFT: Main.stepLeft();
break;
case KeyEvent.VK_UP: Main.stepUp();
break;
case KeyEvent.VK_DOWN: Main.stepDown();
break;
case KeyEvent.VK_SPACE: Main.OpenFire();
}
}
@Override
public void keyReleased(KeyEvent e) { }
}
public static class CreateMainWindow extends Frame{
private static final int
screenOffset = 8,
baseX = 8, baseY = 31,
symbolWidth = 16, symbolHeight = 16;
private Font defaultFont = new Font(Font.MONOSPACED, Font.PLAIN, symbolHeight);
private ReentrantLock screenLock = new ReentrantLock();
CreateMainWindow(KeyListener keyListener, int screenWidth, int screenHeight){
setSize(baseX + screenOffset + screenWidth * symbolWidth, baseY + screenOffset + screenHeight * symbolHeight);
setLayout(null);
setVisible(true);
addKeyListener(keyListener);
}
@Contract(pure = true)
private int toPixelCoordinateX(int x){
return x * symbolWidth + baseX;
}
@Contract(pure = true)
private int toPixelCoordinateY(int y){
return y * symbolHeight + baseY;
}
void setSymbol(int x, int y, char symbol, Color color){
Label label = new Label(String.valueOf(symbol));
label.setFont(defaultFont);
label.setForeground(color);
label.setBounds(toPixelCoordinateX(x), toPixelCoordinateY(y), symbolWidth, symbolHeight);
screenLock.lock();
add(label);
screenLock.unlock();
}
void removeSymbol(int x, int y){
Component component = getComponentAt(toPixelCoordinateX(x),toPixelCoordinateY(y));
screenLock.lock();
remove(component);
screenLock.unlock();
}
boolean isNotFree(int x, int y){
return !getComponentAt(toPixelCoordinateX(x),toPixelCoordinateY(y)).getName().equals("frame0");
}
}
public static class CreateEnemy extends Thread {
private static final int enemyDelation = 1200;
@Override
public void run() {
do {
if (Main.getNextRandomInt(2) == 1)
new Enemy().start();
try {
sleep(enemyDelation);
} catch (InterruptedException e) {
e.printStackTrace();
}
} while (true);
}
}
public static class Enemy extends Thread {
private static final int enemySleepingTime = 400;
static final char enemy = '-';
static final Color[] colorMas = {Color.BLUE, Color.GREEN, Color.RED};
private static Random rnd = new Random();
@Override
public void run() {
int enemyY = Main.getNextRandomInt(25);
int increment, boundX, enemyX;
if (enemyY % 2 == 0) {
increment = 1;
boundX = 39;
enemyX = 1;
} else {
increment = -1;
boundX = 0;
enemyX = 39;
}
while (enemyX != boundX){
if (!Main.window.isNotFree(enemyX, enemyY)) {
Main.window.setSymbol(enemyX, enemyY, enemy, colorMas[rnd.nextInt(3)]);
} else {
Main.window.removeSymbol(enemyX, enemyY);
break;
}
try {
sleep(enemySleepingTime);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (Main.window.isNotFree(enemyX, enemyY)) {
Main.window.removeSymbol(enemyX, enemyY);
} else {
return;
}
enemyX += increment;
}
}
}
public static class Bullet extends Thread {
private static final int bulletSleepPeriod = 25;
static final char bullet = '^';
@Override
public void run() {
if (!Main.bulletSemaphore.tryAcquire()) return;
int bulletX = Main.gunX, bulletY = Main.gunY - 1;
while(bulletY >= 0) {
if (bulletY == 0)
Main.IncMiss();
if (!Main.window.isNotFree(bulletX, bulletY)) {
Main.window.setSymbol(bulletX, bulletY, bullet, Color.BLACK);
} else {
Main.IncHit();
Main.window.removeSymbol(bulletX, bulletY);
break;
}
try {
sleep(bulletSleepPeriod);
} catch (InterruptedException e) {
e.printStackTrace();
}
Main.window.removeSymbol(bulletX, bulletY);
bulletY--;
}
Main.bulletSemaphore.release();
}
}
static void stepLeft() {
if (gunX - 1 >= 0) {
window.removeSymbol(gunX, gunY);
window.setSymbol(--gunX, gunY, gunSymbol, Color.BLACK);
}
}
static void stepRight() {
if (gunX + 1 < 40) {
window.removeSymbol(gunX, gunY);
window.setSymbol(++gunX, gunY, gunSymbol, Color.BLACK);
}
}
static void stepUp() {
if (gunY + 1 > 25) {
window.removeSymbol(gunX, gunY);
window.setSymbol(gunX, --gunY, gunSymbol, Color.BLACK);
}
}
static void stepDown() {
if (gunY + 1 < 40) {
window.removeSymbol(gunX, gunY);
window.setSymbol(gunX, ++gunY, gunSymbol, Color.BLACK);
}
}
static void OpenFire(){
new Bullet().start();
}
static int getNextRandomInt(int limit){
randomLock.lock();
int randomInt = rnd.nextInt(limit);
randomLock.unlock();
return randomInt;
}
static void IncHit(){
hit.addAndGet(1);
}
static void IncMiss(){
miss.addAndGet(1);
}
} | [
"[email protected]"
] | |
82eb3c23e30b9c8137f4d8d3df44b12e51b3d269 | e3a493bb01f450d9106c12681be3fc9a7e913a5f | /encog-java-core-2.5.3/src/org/encog/bot/browse/range/DocumentRange.java | bd70e732e221f63bf4162f252a97524a2f326245 | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | cassandracomar/VAFusion2 | aaf67a0560e89d750005bd9a89b02c33dc478c5d | ebf550f465a72525d2a2bd2fcc6f9f98796e029c | refs/heads/master | 2021-05-28T01:17:38.452166 | 2011-05-17T16:01:21 | 2011-05-17T16:01:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,143 | java | /*
* Encog(tm) Core v2.5 - Java Version
* http://www.heatonresearch.com/encog/
* http://code.google.com/p/encog-java/
* Copyright 2008-2010 Heaton Research, Inc.
*
* 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.
*
* For more information on Heaton Research copyrights, licenses
* and trademarks visit:
* http://www.heatonresearch.com/copyright
*/
package org.encog.bot.browse.range;
import java.util.ArrayList;
import java.util.List;
import org.encog.bot.browse.WebPage;
import org.encog.bot.dataunit.DataUnit;
import org.encog.bot.dataunit.TextDataUnit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Base class that represents a document range. A document range is a collection
* of tags that all apply to one "concept". For example, a Form, or a Link. This
* allows the form to collect the elements inside the form, or a link to collect
* the text along with the link tag.
*
* @author jheaton
*
*/
public class DocumentRange {
/**
* The beginning index for this range.
*/
private int begin;
/**
* The ending index for this range.
*/
private int end;
/**
* The source page for this range.
*/
private WebPage source;
/**
* The id attribute, on the source tag. Useful for DIV tags.
*/
private String idAttribute;
/**
* The class attribute. on the source tag.
*/
private String classAttribute;
/**
* Sub elements of this range.
*/
private final List<DocumentRange> elements = new ArrayList<DocumentRange>();
/**
* The parent to this range, or null if top.
*/
private DocumentRange parent;
/**
* The logger.
*/
@SuppressWarnings("unused")
private final Logger logger = LoggerFactory.getLogger(this.getClass());
/**
* Construct a document range from the specified WebPage.
*
* @param source
* The web page that this range belongs to.
*/
public DocumentRange(final WebPage source) {
this.source = source;
}
/**
* Add an element.
*
* @param element
* The element to add.
*/
public void addElement(final DocumentRange element) {
this.elements.add(element);
element.setParent(this);
}
/**
* @return The beginning index.
*/
public int getBegin() {
return this.begin;
}
/**
* @return the classAttribute
*/
public String getClassAttribute() {
return this.classAttribute;
}
/**
* @return The elements of this document range.
*/
public List<DocumentRange> getElements() {
return this.elements;
}
/**
* @return The ending index.
*/
public int getEnd() {
return this.end;
}
/**
* @return the idAttribute
*/
public String getIdAttribute() {
return this.idAttribute;
}
/**
* @return The web page that owns this class.
*/
public DocumentRange getParent() {
return this.parent;
}
/**
* @return The web page that this range is owned by.
*/
public WebPage getSource() {
return this.source;
}
/**
* Get the text from this range.
*
* @return The text from this range.
*/
public String getTextOnly() {
final StringBuilder result = new StringBuilder();
for (int i = getBegin(); i < getEnd(); i++) {
final DataUnit du = this.source.getData().get(i);
if (du instanceof TextDataUnit) {
result.append(du.toString());
result.append("\n");
}
}
return result.toString();
}
/**
* Set the beginning index.
*
* @param begin
* The beginning index.
*/
public void setBegin(final int begin) {
this.begin = begin;
}
/**
* @param classAttribute
* the classAttribute to set
*/
public void setClassAttribute(final String classAttribute) {
this.classAttribute = classAttribute;
}
/**
* Set the ending index.
*
* @param end
* The ending index.
*/
public void setEnd(final int end) {
this.end = end;
}
/**
* @param idAttribute
* the idAttribute to set
*/
public void setIdAttribute(final String idAttribute) {
this.idAttribute = idAttribute;
}
/**
* Set the parent.
*
* @param parent
* The parent.
*/
public void setParent(final DocumentRange parent) {
this.parent = parent;
}
/**
* Set the source web page.
*
* @param source
* The source web page.
*/
public void setSource(final WebPage source) {
this.source = source;
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
return getTextOnly();
}
}
| [
"[email protected]"
] | |
00ea3bab69e5ff8357997d5bd0065f5bd769b123 | 9a34516ec63144052b251b62fa7e9bdd0986adc4 | /src/main/java/com/drag/tb1906/ms/resp/MsGoodsResp.java | 417ae3a057c23f7deac6087aa62f3a3295fbbd67 | [] | no_license | longyunbo/tb1906 | ce8df105c5c50bdc98a3c465169c180e35b5f8f2 | 7129b5387d756a8ae13e5677723528da9d0dc6aa | refs/heads/master | 2020-03-29T04:45:41.730224 | 2018-09-20T03:42:24 | 2018-09-20T03:42:24 | 149,546,902 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 239 | java | package com.drag.tb1906.ms.resp;
import com.drag.tb1906.common.BaseResponse;
import lombok.Data;
@Data
public class MsGoodsResp extends BaseResponse{
private static final long serialVersionUID = 5892514759638449628L;
}
| [
"[email protected]"
] | |
915985f1bd60c775cc3c5e2af4e85999c83823bd | 603cd3e2be567331529672c2372b96ea295a54e9 | /feign/basic-master/src/main/java/com/ZhaoChenheng/thread/ThreadPoolDemo.java | ff210b9bef7c60a378a2a09f48f9f66930db5209 | [] | no_license | ZhaoChenheng/ZCH4 | 0393878ff640ff31618234ad47bfc3d0415aabee | e0bfe7405dff244fbd871302b4ed203e5313f75d | refs/heads/master | 2022-06-27T21:08:17.613808 | 2020-11-04T03:27:40 | 2020-11-04T03:27:40 | 224,595,946 | 0 | 0 | null | 2022-06-17T02:44:22 | 2019-11-28T07:36:58 | Java | UTF-8 | Java | false | false | 861 | java | package com.ZhaoChenheng.thread;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class ThreadPoolDemo {
public static class MyTask implements Runnable {
public void run() {
System.out.println(System.currentTimeMillis()
// + ":Thread ID:" + Thread.currentThread().getId()
+ ":Thread Name: " + Thread.currentThread().getName());
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
public static void main(String[] args) {
MyTask task = new MyTask();
ExecutorService es = Executors.newFixedThreadPool(5);
for (int i = 0; i < 10; i++) {
es.submit(task);
}
es.shutdown();
}
}
| [
"[email protected]"
] | |
38a6e71931fa0b5d7249da1ca374d7321dcc7503 | de8140d8e0752a0a842465845eddf1fe69537cfd | /TD - TP/imohamedraffique/Exo3TD1/src/Contenu.java | 8da99dd0ffdc0b4113b7e81a47ad8c9852a62627 | [] | no_license | Ssoap/IUT-Orsay-TP351-groupe-1 | 704a02b0c123243ed749b1ef04f2047154218a74 | 9f195f2f90dd9082fb526b697c041618a78fa7a1 | refs/heads/master | 2016-09-06T01:28:49.763633 | 2015-01-16T19:00:56 | 2015-01-16T19:00:56 | 26,429,360 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 515 | java |
public class Contenu {
Article article;
Resume resume;
public Contenu(Article a, Resume r)
{
article = a;
resume = r;
}
public Contenu(Article a)
{
article = a;
}
public Contenu(Resume r)
{
resume = r;
}
public String toStringft() {
return "article: " + article.getArticle() + ", resume: " + resume.getResume();
}
public String toStringfto()
{
return "article: " + article.getArticle();
}
public String toStringsms()
{
return "resume: " + resume.getResume();
}
}
| [
"[email protected]"
] | |
23c89ededb79356c31d0d55b5235ea733093b351 | 49e5c3fe24190171b856c6992ab1ef45dcd8ba2e | /src/main/java/com/dengzhanglin/xyeh/web/form/RegisterForm.java | 706754ab5d71861dba6c869aa45db5fd5a8d2c2f | [
"MIT"
] | permissive | zhanglindeng/xyeh | cfea25a02d3eeebf5d8170020777b3852e93db99 | 0f1fbff5f34840fd97abeac18a619fe50223a25a | refs/heads/master | 2021-01-24T17:49:34.586576 | 2018-05-06T12:29:16 | 2018-05-06T12:29:16 | 47,622,681 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,473 | java | package com.dengzhanglin.xyeh.web.form;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
public class RegisterForm {
@NotBlank
@Email
private String email;
@NotNull
@Size(min = 6, max = 20)
private String password;
@NotNull
@Size(min = 6, max = 20)
private String password2;
@NotNull
@Size(min = 6, max = 6, message = "无效的验证码")
private String verifyCode;
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getPassword2() {
return password2;
}
public void setPassword2(String password2) {
this.password2 = password2;
}
public String getVerifyCode() {
return verifyCode;
}
public void setVerifyCode(String verifyCode) {
this.verifyCode = verifyCode;
}
@Override
public String toString() {
return "RegisterForm{" +
"email='" + email + '\'' +
", password='" + password + '\'' +
", password2='" + password2 + '\'' +
", verifyCode='" + verifyCode + '\'' +
'}';
}
}
| [
"[email protected]"
] | |
0da67bffbaa826ac31688c3ac8fa8c0f47a66884 | d69101efcbce0e033d42a3e9ca82f81719728aa7 | /bobo-mall/bobo-manager/bobo-manager-service/src/main/java/com/bobo/service/ItemCatService.java | d0f4ad90e02742a0c369d8c8cb4aacc6bd86bdf8 | [] | no_license | a982338665/lf-project-java-mall | 22bf23d6385bf9e887f6f1c73fcc58f99593c132 | 62af77cc795239200b9437d0c1ee1ea36d99bef3 | refs/heads/master | 2021-09-14T23:32:56.788897 | 2018-05-22T09:25:52 | 2018-05-22T09:25:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 257 | java | package com.bobo.service;
import com.bobo.common.pojo.EUTreeNode;
import java.util.List;
public interface ItemCatService {
/**
* 根据父类目id查询类目列表
* @param parentId
* @return
*/
List<EUTreeNode> getCatList(long parentId);
}
| [
"[email protected]"
] | |
16892a2302bfc93b85081692ab10195edc16d39b | e79020cc4ac0c9ef0d9ec3dc9a98bb31c0866bcb | /POO/TestaCliente.java | 1198c48c7f9a6341aa8360ed05889b46a1c0658d | [] | no_license | AntLucas/Generation | bee7360c5a9bc76927f608a640ed8042737b769f | a721ca856a2bed2152d9c68f3680782739633be3 | refs/heads/main | 2023-05-04T20:14:58.625694 | 2021-05-21T22:24:52 | 2021-05-21T22:24:52 | 363,952,393 | 0 | 1 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,850 | java | package POO;
import java.util.Scanner;
public class TestaCliente {
public static void main(String[] args) {
Scanner ler = new Scanner(System.in);
double valorGasto=0.0;
int resp;
System.out.println("Digite o nome do cliente: ");
String nomeCli = ler.nextLine();
System.out.println(nomeCli);
System.out.println("Quantas compras esse cliente já fez nessa loja? ");
int numCompras = ler.nextInt();
while(numCompras < 0) {
System.out.println("Valor incorreto!\nQuantas compras esse cliente já fez nessa loja? ");
numCompras = ler.nextInt();
}
if(numCompras != 0) {
System.out.println("Qual o valor total gasto nessas compras?");
valorGasto = ler.nextDouble();
while(valorGasto <= 0) {
System.out.println("Valor incorreto!\nQual o valor total gasto nessas compras?");
valorGasto = ler.nextDouble();
}
}
Cliente cliente1 = new Cliente(nomeCli, numCompras, valorGasto);
do {
System.out.println("O cliente deseja fazer alguma compra? Digite 1 para sim e 2 para "
+ "não");
resp = ler.nextInt();
while(resp != 1 && resp != 2) {
System.out.println("Resposta incorreta!\nO cliente deseja fazer alguma compra? "
+ "Digite 1 para sim e 2 para não");
resp = ler.nextInt();
}
if(resp == 1) {
cliente1.comprou();
System.out.println("\nQual o valor dessa compra?");
valorGasto = ler.nextDouble();
while(valorGasto <= 0) {
System.out.println("Valor incorreto!\nQual o valor total gasto nessas compras?");
valorGasto = ler.nextDouble();
}
cliente1.valorCompra(valorGasto);
}
}while(resp != 2);
System.out.println("\n\nO cliente "+cliente1.getNome()+" realizou "+cliente1.getNumCompras()+
" compras e gastou R$"+cliente1.getValorGasto()+" no total.");
}
}
| [
"[email protected]"
] | |
3e8a389b89e53237443c02ace8ee3a4daa0e046a | c3ee07d146f8f88aaa3e66ef4b7562b6dffc6c21 | /src/main/java/in/nu/learn/patterns/creational/abstractfactory/DesktopFactory.java | 667d37b4fbc288c68240661bd03d02e0828ce553 | [] | no_license | krnbr/learning | 4cfdd4d2861c09a3e07bcf66ef86de7b49c42821 | 8b86a3cfabdaad59616db77d7dac2e973282bd85 | refs/heads/master | 2020-04-14T06:21:32.439775 | 2019-10-13T19:46:13 | 2019-10-13T19:46:13 | 163,684,174 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 473 | java | package in.nu.learn.patterns.creational.abstractfactory;
public class DesktopFactory implements ComputerAbstractFactory {
private int ram;
private int hdd;
private OSTypes osType = OSTypes.WINDOWS;
public DesktopFactory(int ram, int hdd, OSTypes osType){
this.ram=ram;
this.hdd=hdd;
this.osType=osType;
}
@Override
public Computer setupComputer() {
return new Desktop(this.hdd, this.ram, this.osType);
}
} | [
"[email protected]"
] | |
221c039af09d7012e980a90a5729e1b995f9b49e | 5b7043c0020a1ffbc5f01150d76de461f3f919c6 | /jOOQ/src/main/java/org/jooq/impl/DropIndexImpl.java | 5c06027bbaa08b726ef2d001a595ba4ac09fae06 | [
"Apache-2.0"
] | permissive | brmeyer/jOOQ | b8566ff3438c2cae57949c8a1575502945bd707a | 33e616356d268d574eb52297c38176c8ed0cc247 | refs/heads/master | 2021-01-18T19:54:26.050884 | 2015-01-26T14:43:40 | 2015-01-26T14:43:40 | 29,864,793 | 0 | 1 | null | 2015-01-26T14:36:40 | 2015-01-26T14:36:39 | null | UTF-8 | Java | false | false | 4,007 | java | /**
* Copyright (c) 2009-2015, Data Geekery GmbH (http://www.datageekery.com)
* All rights reserved.
*
* This work is dual-licensed
* - under the Apache Software License 2.0 (the "ASL")
* - under the jOOQ License and Maintenance Agreement (the "jOOQ License")
* =============================================================================
* You may choose which license applies to you:
*
* - If you're using this work with Open Source databases, you may choose
* either ASL or jOOQ License.
* - If you're using this work with at least one commercial database, you must
* choose jOOQ License
*
* For more information, please visit http://www.jooq.org/licenses
*
* Apache Software License 2.0:
* -----------------------------------------------------------------------------
* 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.
*
* jOOQ License and Maintenance Agreement:
* -----------------------------------------------------------------------------
* Data Geekery grants the Customer the non-exclusive, timely limited and
* non-transferable license to install and use the Software under the terms of
* the jOOQ License and Maintenance Agreement.
*
* This library is distributed with a LIMITED WARRANTY. See the jOOQ License
* and Maintenance Agreement for more details: http://www.jooq.org/licensing
*/
package org.jooq.impl;
import static java.util.Arrays.asList;
import static org.jooq.Clause.DROP_INDEX;
// ...
// ...
import static org.jooq.SQLDialect.CUBRID;
// ...
import static org.jooq.SQLDialect.DERBY;
import static org.jooq.SQLDialect.FIREBIRD;
// ...
// ...
import static org.jooq.impl.DSL.name;
import static org.jooq.impl.DropStatementType.INDEX;
import org.jooq.Clause;
import org.jooq.Configuration;
import org.jooq.Context;
import org.jooq.DropIndexFinalStep;
/**
* @author Lukas Eder
*/
class DropIndexImpl extends AbstractQuery implements
// Cascading interface implementations for DROP INDEX behaviour
DropIndexFinalStep {
/**
* Generated UID
*/
private static final long serialVersionUID = 8904572826501186329L;
private static final Clause[] CLAUSES = { DROP_INDEX };
private final String index;
private final boolean ifExists;
DropIndexImpl(Configuration configuration, String index) {
this(configuration, index, false);
}
DropIndexImpl(Configuration configuration, String index, boolean ifExists) {
super(configuration);
this.index = index;
this.ifExists = ifExists;
}
// ------------------------------------------------------------------------
// XXX: QueryPart API
// ------------------------------------------------------------------------
private final boolean supportsIfExists(Context<?> ctx) {
return !asList(CUBRID, DERBY, FIREBIRD).contains(ctx.family());
}
@Override
public final void accept(Context<?> ctx) {
if (ifExists && !supportsIfExists(ctx)) {
Utils.executeImmediateBegin(ctx, INDEX);
accept0(ctx);
Utils.executeImmediateEnd(ctx, INDEX);
}
else {
accept0(ctx);
}
}
private void accept0(Context<?> ctx) {
ctx.keyword("drop index").sql(" ");
if (ifExists && supportsIfExists(ctx))
ctx.keyword("if exists").sql(" ");
ctx.visit(name(index));
}
@Override
public final Clause[] clauses(Context<?> ctx) {
return CLAUSES;
}
}
| [
"[email protected]"
] | |
8f7b265bde80ad9f4bb5df2d70ca6196d8472aa7 | 20eb9cf15903a0321782da267fc8d53eac513655 | /src/main/java/com/qf/etl/util/ip/IPSeeker.java | 5ed34c3e7933ef83c643ad208ba24d1fbbe1eba0 | [] | no_license | banfusheng/logAnalystic | 8158b6f10b7eee812af9de956b5fd4aac37167c4 | 33cd607ff35e637eed548bccc76ba7ef6bc58c95 | refs/heads/master | 2020-03-26T11:34:20.964471 | 2018-08-23T01:15:11 | 2018-08-23T01:15:11 | 144,849,443 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 26,084 | java | package com.qf.etl.util.ip;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.io.UnsupportedEncodingException;
import java.nio.ByteOrder;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
/** */
/**
* * 用来读取QQwry.dat文件,以根据ip获得好友位置,QQwry.dat的格式是 一. 文件头,共8字节 1. 第一个起始IP的绝对偏移, 4字节
* 2. 最后一个起始IP的绝对偏移, 4字节 二. "结束地址/国家/区域"记录区 四字节ip地址后跟的每一条记录分成两个部分 1. 国家记录 2.
* 地区记录 但是地区记录是不一定有的。而且国家记录和地区记录都有两种形式 1. 以0结束的字符串 2. 4个字节,一个字节可能为0x1或0x2 a.
* 为0x1时,表示在绝对偏移后还跟着一个区域的记录,注意是绝对偏移之后,而不是这四个字节之后 b. 为0x2时,表示在绝对偏移后没有区域记录
* 不管为0x1还是0x2,后三个字节都是实际国家名的文件内绝对偏移
* 如果是地区记录,0x1和0x2的含义不明,但是如果出现这两个字节,也肯定是跟着3个字节偏移,如果不是 则为0结尾字符串 三.
* "起始地址/结束地址偏移"记录区 1. 每条记录7字节,按照起始地址从小到大排列 a. 起始IP地址,4字节 b. 结束ip地址的绝对偏移,3字节
*
* 注意,这个文件里的ip地址和所有的偏移量均采用little-endian格式,而java是采用 big-endian格式的,要注意转换
*
*
*/
public class IPSeeker {
// 一些固定常量,比如记录长度等等
private static final int IP_RECORD_LENGTH = 7;
private static final byte AREA_FOLLOWED = 0x01;
private static final byte NO_AREA = 0x2;
// 用来做为cache,查询一个ip时首先查看cache,以减少不必要的重复查找
private Hashtable ipCache;
// 随机文件访问类
private RandomAccessFile ipFile;
// 内存映射文件
private MappedByteBuffer mbb;
// 单一模式实例
private static IPSeeker instance = null;
// 起始地区的开始和结束的绝对偏移
private long ipBegin, ipEnd;
// 为提高效率而采用的临时变量
private IPLocation loc;
private byte[] buf;
private byte[] b4;
private byte[] b3;
/** */
/**
* 私有构造函数
*/
protected IPSeeker() {
ipCache = new Hashtable();
loc = new IPLocation();
buf = new byte[100];
b4 = new byte[4];
b3 = new byte[3];
try {
String ipFilePath = IPSeeker.class.getResource("/qqwry.dat").getFile();
ipFile = new RandomAccessFile(ipFilePath, "r");
} catch (FileNotFoundException e) {
System.out.println("IP地址信息文件没有找到,IP显示功能将无法使用");
ipFile = null;
}
// 如果打开文件成功,读取文件头信息
if (ipFile != null) {
try {
ipBegin = readLong4(0);
ipEnd = readLong4(4);
if (ipBegin == -1 || ipEnd == -1) {
ipFile.close();
ipFile = null;
}
} catch (IOException e) {
System.out.println("IP地址信息文件格式有错误,IP显示功能将无法使用");
ipFile = null;
}
}
}
/** */
/**
* @return 单一实例
*/
public static IPSeeker getInstance() {
if (instance == null) {
instance = new IPSeeker();
}
return instance;
}
/** */
/**
* 给定一个地点的不完全名字,得到一系列包含s子串的IP范围记录
*
* @param s
* 地点子串
* @return 包含IPEntry类型的List
*/
public List getIPEntriesDebug(String s) {
List ret = new ArrayList();
long endOffset = ipEnd + 4;
for (long offset = ipBegin + 4; offset <= endOffset; offset += IP_RECORD_LENGTH) {
// 读取结束IP偏移
long temp = readLong3(offset);
// 如果temp不等于-1,读取IP的地点信息
if (temp != -1) {
IPLocation loc = getIPLocation(temp);
// 判断是否这个地点里面包含了s子串,如果包含了,添加这个记录到List中,如果没有,继续
if (loc.country.indexOf(s) != -1 || loc.area.indexOf(s) != -1) {
IPEntry entry = new IPEntry();
entry.country = loc.country;
entry.area = loc.area;
// 得到起始IP
readIP(offset - 4, b4);
entry.beginIp = IPSeekerUtils.getIpStringFromBytes(b4);
// 得到结束IP
readIP(temp, b4);
entry.endIp = IPSeekerUtils.getIpStringFromBytes(b4);
// 添加该记录
ret.add(entry);
}
}
}
return ret;
}
/** */
/**
* 给定一个地点的不完全名字,得到一系列包含s子串的IP范围记录
*
* @param s
* 地点子串
* @return 包含IPEntry类型的List
*/
public List getIPEntries(String s) {
List ret = new ArrayList();
try {
// 映射IP信息文件到内存中
if (mbb == null) {
FileChannel fc = ipFile.getChannel();
mbb = fc.map(FileChannel.MapMode.READ_ONLY, 0, ipFile.length());
mbb.order(ByteOrder.LITTLE_ENDIAN);
}
int endOffset = (int) ipEnd;
for (int offset = (int) ipBegin + 4; offset <= endOffset; offset += IP_RECORD_LENGTH) {
int temp = readInt3(offset);
if (temp != -1) {
IPLocation loc = getIPLocation(temp);
// 判断是否这个地点里面包含了s子串,如果包含了,添加这个记录到List中,如果没有,继续
if (loc.country.indexOf(s) != -1 || loc.area.indexOf(s) != -1) {
IPEntry entry = new IPEntry();
entry.country = loc.country;
entry.area = loc.area;
// 得到起始IP
readIP(offset - 4, b4);
entry.beginIp = IPSeekerUtils.getIpStringFromBytes(b4);
// 得到结束IP
readIP(temp, b4);
entry.endIp = IPSeekerUtils.getIpStringFromBytes(b4);
// 添加该记录
ret.add(entry);
}
}
}
} catch (IOException e) {
System.out.println(e.getMessage());
}
return ret;
}
/** */
/**
* 从内存映射文件的offset位置开始的3个字节读取一个int
*
* @param offset
* @return
*/
private int readInt3(int offset) {
mbb.position(offset);
return mbb.getInt() & 0x00FFFFFF;
}
/** */
/**
* 从内存映射文件的当前位置开始的3个字节读取一个int
*
* @return
*/
private int readInt3() {
return mbb.getInt() & 0x00FFFFFF;
}
/** */
/**
* 根据IP得到国家名
*
* @param ip
* ip的字节数组形式
* @return 国家名字符串
*/
public String getCountry(byte[] ip) {
// 检查ip地址文件是否正常
if (ipFile == null)
return "错误的IP数据库文件";
// 保存ip,转换ip字节数组为字符串形式
String ipStr = IPSeekerUtils.getIpStringFromBytes(ip);
// 先检查cache中是否已经包含有这个ip的结果,没有再搜索文件
if (ipCache.containsKey(ipStr)) {
IPLocation loc = (IPLocation) ipCache.get(ipStr);
return loc.country;
} else {
IPLocation loc = getIPLocation(ip);
ipCache.put(ipStr, loc.getCopy());
return loc.country;
}
}
/** */
/**
* 根据IP得到国家名
*
* @param ip
* IP的字符串形式
* @return 国家名字符串
*/
public String getCountry(String ip) {
return getCountry(IPSeekerUtils.getIpByteArrayFromString(ip));
}
/** */
/**
* 根据IP得到地区名
*
* @param ip
* ip的字节数组形式
* @return 地区名字符串
*/
public String getArea(byte[] ip) {
// 检查ip地址文件是否正常
if (ipFile == null)
return "错误的IP数据库文件";
// 保存ip,转换ip字节数组为字符串形式
String ipStr = IPSeekerUtils.getIpStringFromBytes(ip);
// 先检查cache中是否已经包含有这个ip的结果,没有再搜索文件
if (ipCache.containsKey(ipStr)) {
IPLocation loc = (IPLocation) ipCache.get(ipStr);
return loc.area;
} else {
IPLocation loc = getIPLocation(ip);
ipCache.put(ipStr, loc.getCopy());
return loc.area;
}
}
/**
* 根据IP得到地区名
*
* @param ip
* IP的字符串形式
* @return 地区名字符串
*/
public String getArea(String ip) {
return getArea(IPSeekerUtils.getIpByteArrayFromString(ip));
}
/** */
/**
* 根据ip搜索ip信息文件,得到IPLocation结构,所搜索的ip参数从类成员ip中得到
*
* @param ip
* 要查询的IP
* @return IPLocation结构
*/
public IPLocation getIPLocation(byte[] ip) {
IPLocation info = null;
long offset = locateIP(ip);
if (offset != -1)
info = getIPLocation(offset);
if (info == null) {
info = new IPLocation();
info.country = "未知国家";
info.area = "未知地区";
}
return info;
}
/**
* 从offset位置读取4个字节为一个long,因为java为big-endian格式,所以没办法 用了这么一个函数来做转换
*
* @param offset
* @return 读取的long值,返回-1表示读取文件失败
*/
private long readLong4(long offset) {
long ret = 0;
try {
ipFile.seek(offset);
ret |= (ipFile.readByte() & 0xFF);
ret |= ((ipFile.readByte() << 8) & 0xFF00);
ret |= ((ipFile.readByte() << 16) & 0xFF0000);
ret |= ((ipFile.readByte() << 24) & 0xFF000000);
return ret;
} catch (IOException e) {
return -1;
}
}
/**
* 从offset位置读取3个字节为一个long,因为java为big-endian格式,所以没办法 用了这么一个函数来做转换
*
* @param offset
* @return 读取的long值,返回-1表示读取文件失败
*/
private long readLong3(long offset) {
long ret = 0;
try {
ipFile.seek(offset);
ipFile.readFully(b3);
ret |= (b3[0] & 0xFF);
ret |= ((b3[1] << 8) & 0xFF00);
ret |= ((b3[2] << 16) & 0xFF0000);
return ret;
} catch (IOException e) {
return -1;
}
}
/**
* 从当前位置读取3个字节转换成long
*
* @return
*/
private long readLong3() {
long ret = 0;
try {
ipFile.readFully(b3);
ret |= (b3[0] & 0xFF);
ret |= ((b3[1] << 8) & 0xFF00);
ret |= ((b3[2] << 16) & 0xFF0000);
return ret;
} catch (IOException e) {
return -1;
}
}
/**
* 从offset位置读取四个字节的ip地址放入ip数组中,读取后的ip为big-endian格式,但是
* 文件中是little-endian形式,将会进行转换
*
* @param offset
* @param ip
*/
private void readIP(long offset, byte[] ip) {
try {
ipFile.seek(offset);
ipFile.readFully(ip);
byte temp = ip[0];
ip[0] = ip[3];
ip[3] = temp;
temp = ip[1];
ip[1] = ip[2];
ip[2] = temp;
} catch (IOException e) {
System.out.println(e.getMessage());
}
}
/**
* 从offset位置读取四个字节的ip地址放入ip数组中,读取后的ip为big-endian格式,但是
* 文件中是little-endian形式,将会进行转换
*
* @param offset
* @param ip
*/
private void readIP(int offset, byte[] ip) {
mbb.position(offset);
mbb.get(ip);
byte temp = ip[0];
ip[0] = ip[3];
ip[3] = temp;
temp = ip[1];
ip[1] = ip[2];
ip[2] = temp;
}
/**
* 把类成员ip和beginIp比较,注意这个beginIp是big-endian的
*
* @param ip
* 要查询的IP
* @param beginIp
* 和被查询IP相比较的IP
* @return 相等返回0,ip大于beginIp则返回1,小于返回-1。
*/
private int compareIP(byte[] ip, byte[] beginIp) {
for (int i = 0; i < 4; i++) {
int r = compareByte(ip[i], beginIp[i]);
if (r != 0)
return r;
}
return 0;
}
/**
* 把两个byte当作无符号数进行比较
*
* @param b1
* @param b2
* @return 若b1大于b2则返回1,相等返回0,小于返回-1
*/
private int compareByte(byte b1, byte b2) {
if ((b1 & 0xFF) > (b2 & 0xFF)) // 比较是否大于
return 1;
else if ((b1 ^ b2) == 0)// 判断是否相等
return 0;
else
return -1;
}
/**
* 这个方法将根据ip的内容,定位到包含这个ip国家地区的记录处,返回一个绝对偏移 方法使用二分法查找。
*
* @param ip
* 要查询的IP
* @return 如果找到了,返回结束IP的偏移,如果没有找到,返回-1
*/
private long locateIP(byte[] ip) {
long m = 0;
int r;
// 比较第一个ip项
readIP(ipBegin, b4);
r = compareIP(ip, b4);
if (r == 0)
return ipBegin;
else if (r < 0)
return -1;
// 开始二分搜索
for (long i = ipBegin, j = ipEnd; i < j;) {
m = getMiddleOffset(i, j);
readIP(m, b4);
r = compareIP(ip, b4);
// log.debug(Utils.getIpStringFromBytes(b));
if (r > 0)
i = m;
else if (r < 0) {
if (m == j) {
j -= IP_RECORD_LENGTH;
m = j;
} else
j = m;
} else
return readLong3(m + 4);
}
// 如果循环结束了,那么i和j必定是相等的,这个记录为最可能的记录,但是并非
// 肯定就是,还要检查一下,如果是,就返回结束地址区的绝对偏移
m = readLong3(m + 4);
readIP(m, b4);
r = compareIP(ip, b4);
if (r <= 0)
return m;
else
return -1;
}
/**
* 得到begin偏移和end偏移中间位置记录的偏移
*
* @param begin
* @param end
* @return
*/
private long getMiddleOffset(long begin, long end) {
long records = (end - begin) / IP_RECORD_LENGTH;
records >>= 1;
if (records == 0)
records = 1;
return begin + records * IP_RECORD_LENGTH;
}
/**
* 给定一个ip国家地区记录的偏移,返回一个IPLocation结构
*
* @param offset
* @return
*/
private IPLocation getIPLocation(long offset) {
try {
// 跳过4字节ip
ipFile.seek(offset + 4);
// 读取第一个字节判断是否标志字节
byte b = ipFile.readByte();
if (b == AREA_FOLLOWED) {
// 读取国家偏移
long countryOffset = readLong3();
// 跳转至偏移处
ipFile.seek(countryOffset);
// 再检查一次标志字节,因为这个时候这个地方仍然可能是个重定向
b = ipFile.readByte();
if (b == NO_AREA) {
loc.country = readString(readLong3());
ipFile.seek(countryOffset + 4);
} else
loc.country = readString(countryOffset);
// 读取地区标志
loc.area = readArea(ipFile.getFilePointer());
} else if (b == NO_AREA) {
loc.country = readString(readLong3());
loc.area = readArea(offset + 8);
} else {
loc.country = readString(ipFile.getFilePointer() - 1);
loc.area = readArea(ipFile.getFilePointer());
}
return loc;
} catch (IOException e) {
return null;
}
}
/**
* @param offset
* @return
*/
private IPLocation getIPLocation(int offset) {
// 跳过4字节ip
mbb.position(offset + 4);
// 读取第一个字节判断是否标志字节
byte b = mbb.get();
if (b == AREA_FOLLOWED) {
// 读取国家偏移
int countryOffset = readInt3();
// 跳转至偏移处
mbb.position(countryOffset);
// 再检查一次标志字节,因为这个时候这个地方仍然可能是个重定向
b = mbb.get();
if (b == NO_AREA) {
loc.country = readString(readInt3());
mbb.position(countryOffset + 4);
} else
loc.country = readString(countryOffset);
// 读取地区标志
loc.area = readArea(mbb.position());
} else if (b == NO_AREA) {
loc.country = readString(readInt3());
loc.area = readArea(offset + 8);
} else {
loc.country = readString(mbb.position() - 1);
loc.area = readArea(mbb.position());
}
return loc;
}
/**
* 从offset偏移开始解析后面的字节,读出一个地区名
*
* @param offset
* @return 地区名字符串
* @throws IOException
*/
private String readArea(long offset) throws IOException {
ipFile.seek(offset);
byte b = ipFile.readByte();
if (b == 0x01 || b == 0x02) {
long areaOffset = readLong3(offset + 1);
if (areaOffset == 0)
return "未知地区";
else
return readString(areaOffset);
} else
return readString(offset);
}
/**
* @param offset
* @return
*/
private String readArea(int offset) {
mbb.position(offset);
byte b = mbb.get();
if (b == 0x01 || b == 0x02) {
int areaOffset = readInt3();
if (areaOffset == 0)
return "未知地区";
else
return readString(areaOffset);
} else
return readString(offset);
}
/**
* 从offset偏移处读取一个以0结束的字符串
*
* @param offset
* @return 读取的字符串,出错返回空字符串
*/
private String readString(long offset) {
try {
ipFile.seek(offset);
int i;
for (i = 0, buf[i] = ipFile.readByte(); buf[i] != 0; buf[++i] = ipFile.readByte())
;
if (i != 0)
return IPSeekerUtils.getString(buf, 0, i, "GBK");
} catch (IOException e) {
System.out.println(e.getMessage());
}
return "";
}
/**
* 从内存映射文件的offset位置得到一个0结尾字符串
*
* @param offset
* @return
*/
private String readString(int offset) {
try {
mbb.position(offset);
int i;
for (i = 0, buf[i] = mbb.get(); buf[i] != 0; buf[++i] = mbb.get())
;
if (i != 0)
return IPSeekerUtils.getString(buf, 0, i, "GBK");
} catch (IllegalArgumentException e) {
System.out.println(e.getMessage());
}
return "";
}
public String getAddress(String ip) {
String country = getCountry(ip).equals(" CZ88.NET") ? "" : getCountry(ip);
String area = getArea(ip).equals(" CZ88.NET") ? "" : getArea(ip);
String address = country + " " + area;
return address.trim();
}
/**
* * 用来封装ip相关信息,目前只有两个字段,ip所在的国家和地区
*
*
* @author swallow
*/
public class IPLocation {
public String country;
public String area;
public IPLocation() {
country = area = "";
}
public IPLocation getCopy() {
IPLocation ret = new IPLocation();
ret.country = country;
ret.area = area;
return ret;
}
}
/**
* 一条IP范围记录,不仅包括国家和区域,也包括起始IP和结束IP *
*
*
* @author gerry liu
*/
public class IPEntry {
public String beginIp;
public String endIp;
public String country;
public String area;
public IPEntry() {
beginIp = endIp = country = area = "";
}
public String toString() {
return this.area + " " + this.country + "IP Χ:" + this.beginIp + "-" + this.endIp;
}
}
/**
* 操作工具类
*
* @author gerryliu
*
*/
public static class IPSeekerUtils {
/**
* 从ip的字符串形式得到字节数组形式
*
* @param ip
* 字符串形式的ip
* @return 字节数组形式的ip
*/
public static byte[] getIpByteArrayFromString(String ip) {
byte[] ret = new byte[4];
java.util.StringTokenizer st = new java.util.StringTokenizer(ip, ".");
try {
ret[0] = (byte) (Integer.parseInt(st.nextToken()) & 0xFF);
ret[1] = (byte) (Integer.parseInt(st.nextToken()) & 0xFF);
ret[2] = (byte) (Integer.parseInt(st.nextToken()) & 0xFF);
ret[3] = (byte) (Integer.parseInt(st.nextToken()) & 0xFF);
} catch (Exception e) {
System.out.println(e.getMessage());
}
return ret;
}
/**
* 对原始字符串进行编码转换,如果失败,返回原始的字符串
*
* @param s
* 原始字符串
* @param srcEncoding
* 源编码方式
* @param destEncoding
* 目标编码方式
* @return 转换编码后的字符串,失败返回原始字符串
*/
public static String getString(String s, String srcEncoding, String destEncoding) {
try {
return new String(s.getBytes(srcEncoding), destEncoding);
} catch (UnsupportedEncodingException e) {
return s;
}
}
/**
* 根据某种编码方式将字节数组转换成字符串
*
* @param b
* 字节数组
* @param encoding
* 编码方式
* @return 如果encoding不支持,返回一个缺省编码的字符串
*/
public static String getString(byte[] b, String encoding) {
try {
return new String(b, encoding);
} catch (UnsupportedEncodingException e) {
return new String(b);
}
}
/**
* 根据某种编码方式将字节数组转换成字符串
*
* @param b
* 字节数组
* @param offset
* 要转换的起始位置
* @param len
* 要转换的长度
* @param encoding
* 编码方式
* @return 如果encoding不支持,返回一个缺省编码的字符串
*/
public static String getString(byte[] b, int offset, int len, String encoding) {
try {
return new String(b, offset, len, encoding);
} catch (UnsupportedEncodingException e) {
return new String(b, offset, len);
}
}
/**
* @param ip
* ip的字节数组形式
* @return 字符串形式的ip
*/
public static String getIpStringFromBytes(byte[] ip) {
StringBuffer sb = new StringBuffer();
sb.append(ip[0] & 0xFF);
sb.append('.');
sb.append(ip[1] & 0xFF);
sb.append('.');
sb.append(ip[2] & 0xFF);
sb.append('.');
sb.append(ip[3] & 0xFF);
return sb.toString();
}
}
/**
* 获取全部ip地址集合列表
*
* @return
*/
public List<String> getAllIp() {
List<String> list = new ArrayList<String>();
byte[] buf = new byte[4];
for (long i = ipBegin; i < ipEnd; i += IP_RECORD_LENGTH) {
try {
this.readIP(this.readLong3(i + 4), buf); // 读取ip,最终ip放到buf中
String ip = IPSeekerUtils.getIpStringFromBytes(buf);
list.add(ip);
} catch (Exception e) {
// nothing
}
}
return list;
}
} | [
"[email protected]"
] | |
bb26f91c3bdb5e478d63c7b7d27f5b126e830999 | 77ed8ef81c623adac9e8604b96a22d4267c81e82 | /Repuestos Comun/src/comun/DTOs/ProveedorDTO.java | d1f79263aed736e5a155b2bb48522d449123e177 | [] | no_license | Matias-Bernal/tagle-gardien | bc67ffa4082135b90cc51452eb7ea750d99cc5fe | 6f259defda353db597b01faeb39aab84c0a3903a | refs/heads/master | 2021-01-23T11:40:20.457990 | 2014-07-10T07:45:33 | 2014-07-10T07:45:33 | 32,119,758 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,354 | java | /********************************************************
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************/
package comun.DTOs;
import java.io.Serializable;
public class ProveedorDTO implements Serializable{
protected static final long serialVersionUID = 1L;
protected Long id;
protected String nombre;
public ProveedorDTO(){}
public ProveedorDTO(Long id, String nombre) {
super();
this.id = id;
this.nombre = nombre;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
}
| [
"[email protected]@7b2b483b-7b46-f909-ec13-8b39806d40dd"
] | [email protected]@7b2b483b-7b46-f909-ec13-8b39806d40dd |
9b82fed750fdcab68cabeca7e353b5832d6268e6 | 10a08e5e00a1a3a16b41db868b13a03da2ce34d2 | /src/Q402_RemoveKdigits.java | 850b9007f661fb4e4d8c6dde600b134fe968e657 | [] | no_license | Xprsh/LeetCodeSolution | fa1e1f1faffced0b3b4dafe9348489be1364d84b | ceba460460f7ba71388d17547bb57ab7a6c28922 | refs/heads/master | 2023-01-08T18:32:05.824859 | 2020-10-27T02:03:18 | 2020-10-27T02:03:18 | 294,639,371 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,563 | java | import java.util.LinkedList;
/**
* Q402. 移掉 K 位数字
* <p>
* 给定一个以字符串表示的非负整数 num,移除这个数中的 k 位数字,使得剩下的数字最小。
*/
public class Q402_RemoveKdigits {
public String removeKdigits(String num, int k) {
if (num == null || k >= num.length()) {
return "0";
}
LinkedList<Character> list = new LinkedList<>();
for (Character c : num.toCharArray()) {
// 第一个数字,直接存入
if (list.isEmpty()) {
list.addLast(c);
} else {
while (list.size() > 0 && c < list.peekLast() && k > 0) {
list.removeLast();
k--;
}
list.addLast(c);
}
}
// 遍历完一轮后仍然没有移除足够位数,需要删除最后k位
for (int i = 0; i < k; i++) {
list.removeLast();
}
// 移除前面的 0
while (!list.isEmpty()) {
if (list.peekFirst() == '0') {
list.removeFirst();
} else {
break;
}
}
StringBuilder newStr = new StringBuilder();
for (Character c : list) {
newStr.append(c);
}
return list.isEmpty() ? "0" : newStr.toString();
}
public static void main(String[] args) {
Q402_RemoveKdigits obj = new Q402_RemoveKdigits();
System.out.println(obj.removeKdigits("1234567890", 9));
}
}
| [
"[email protected]"
] | |
7f0ac49900eca884a223d84d2704020daa16483d | ae177443e7cfe52e7a29dfa48a30ab64b635e813 | /XvXvDoctor/app/src/main/java/cn/com/xxdoctor/bean/CardBean.java | 6af7b04c15c01ba704464000da1dbb445e6efb1d | [] | no_license | Galvatron0521/XvXvDoctor | 4b09a4549567f0b62e3b4f019f63c7920b49df43 | 27a4abdc525fa53ca94c03d4eb94dcf3f87d6a75 | refs/heads/master | 2022-01-15T10:08:35.377429 | 2019-06-03T03:30:52 | 2019-06-03T03:30:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,748 | java | package cn.com.xxdoctor.bean;
import com.bigkoo.pickerview.model.IPickerViewData;
/**
* Created by KyuYi on 2017/3/2.
* E-Mail:[email protected]
* 功能:
*/
public class CardBean implements IPickerViewData {
public String cardItemId;
public String cardItemName;
public Object tag;
//课题使用
public String id;
public String isHaveChild;
public String fieldName;
public CardBean(String cardItemId, String cardItemName) {
this.cardItemId = cardItemId;
this.cardItemName = cardItemName;
}
public CardBean(String cardItemId, String cardItemName, String id, String isHaveChild,String fieldName) {
this.cardItemId = cardItemId;
this.cardItemName = cardItemName;
this.id = id;
this.isHaveChild = isHaveChild;
this.fieldName = fieldName;
}
@Override
public String toString() {
return "CardBean{" +
"cardItemId='" + cardItemId + '\'' +
", cardItemName='" + cardItemName + '\'' +
", tag=" + tag +
", id='" + id + '\'' +
", isHaveChild='" + isHaveChild + '\'' +
", fieldName='" + fieldName + '\'' +
'}';
}
public String getId() {
return cardItemId;
}
public void setId(String id) {
this.cardItemId = id;
}
public String getCardNo() {
return cardItemName;
}
public void setCardNo(String cardNo) {
this.cardItemName = cardNo;
}
public Object getTag() {
return tag;
}
public void setTag(Object tag) {
this.tag = tag;
}
@Override
public String getPickerViewText() {
return cardItemName;
}
}
| [
"[email protected]"
] | |
95c45b1a29e6ab7405379296c01b94a6a790396e | bd85dc52b99a18ae8a8200c3e6910cd13ab699fd | /design_patterns/command/command/LightOnCommand.java | 1f8e70fa32d5fb48131db77a6ada5b1234d6d53d | [] | no_license | RyotaBannai/design-patterns | 6e319a44e62f3bd0a57024786717826dd0bba420 | cb699c0d2f9b69e38bf1ecea3a2ebd2d86dd104e | refs/heads/master | 2022-12-17T20:45:40.815665 | 2020-09-24T14:04:50 | 2020-09-24T14:04:50 | 295,413,712 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 313 | java | package design_patterns.command.command;
import design_patterns.command.vender.Light;
public class LightOnCommand implements Command {
Light light;
public LightOnCommand(Light light) {
this.light = light;
}
public void execute() {
light.on();
}
public void undo() {
light.off();
}
} | [
"[email protected]"
] | |
6e1a1de1f9c52a48747aabd9f76280eed11a50e1 | d92b622ddb9fd3d8f0c6bf521cbe62d8f4b6645d | /app/src/main/java/com/project/android/finanzm/viewmodel/ConfigurationViewModel.java | f56d07087bbc1c924197344ae0712d497571115b | [] | no_license | romstarjohn/Mydigit | 2049b92720006298836634ca25f6edaea33086fa | 395778a026e835459f61c9b15985bd2aa6c0d459 | refs/heads/master | 2022-02-28T08:43:08.096758 | 2019-10-23T21:38:25 | 2019-10-23T21:38:25 | 205,209,715 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,626 | java | package com.project.android.finanzm.viewmodel;
import android.app.Application;
import android.arch.lifecycle.AndroidViewModel;
import android.arch.lifecycle.LiveData;
import android.support.annotation.NonNull;
import com.project.android.finanzm.database.AppRepository;
import com.project.android.finanzm.database.Product;
import com.project.android.finanzm.services.StoreInitService;
import com.project.android.finanzm.utility.Constants;
import com.project.android.finanzm.utility.NetworkUtil;
import com.project.android.finanzm.utility.StoreInitData;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class ConfigurationViewModel extends AndroidViewModel {
private StoreInitService storeInitService;
private LiveData<List<Product>> allProducts;
StoreInitData storeInitData;
private AppRepository mRepository;
public ConfigurationViewModel(@NonNull Application application) {
super(application);
mRepository = AppRepository.getInstance(getApplication().getApplicationContext());
initAnonService();
}
public LiveData<List<Product>> getAllProductsForCategories(int id){
if(id == 0){
return mRepository.getAllProducts();
}
return mRepository.getProductByCategories(id);
}
// Configure Retrofit Instance
public void initAnonService(){
Retrofit retrofit = new Retrofit.Builder().baseUrl(Constants.URL_SERVER)
.addConverterFactory(GsonConverterFactory.create())
.build();
storeInitService = retrofit.create(StoreInitService.class);
}
public void startStoreInit(){
storeInitService.getAllStoresData().enqueue(new Callback<StoreInitData>() {
@Override
public void onResponse(Call<StoreInitData> call, Response<StoreInitData> response) {
if (!response.isSuccessful()){
showError(NetworkUtil.onServerResponseError(response));
return;
}
if(response.body() != null){
if(storeInitData == null)
storeInitData = new StoreInitData();
storeInitData = response.body();
}
}
@Override
public void onFailure(Call<StoreInitData> call, Throwable t) {
showError(t.getLocalizedMessage());
}
});
}
private void showError(String message) {
}
}
| [
"[email protected]"
] | |
b3faa96b6b2598c905a9bf57a0dcc7a833d20a4b | ad60018d3c6ef8e77e8d3efcd872b0005531d26e | /Zeiterfassung_Core_Api/src/main/java/com/adcubum/timerecording/app/TimeRecorderFactory.java | 49c022ef82a20ebc7dfced94651b29fdc817efdd | [] | no_license | brugalibre/Zeiterfassung | 3df1ab57135b47e05a25fec4811f521a0b791fb1 | 47c4dc836bbbf2d22c97758a029f99b1727065be | refs/heads/master | 2023-05-10T23:54:29.224470 | 2023-04-22T06:39:00 | 2023-04-22T07:27:37 | 118,165,522 | 5 | 1 | null | 2023-03-07T07:18:41 | 2018-01-19T18:56:56 | Java | UTF-8 | Java | false | false | 818 | java | package com.adcubum.timerecording.app;
import com.adcubum.timerecording.core.factory.AbstractFactory;
/**
* Factory used to create and instantiate new {@link TimeRecorder} instances
*
* @author DStalder
*
*/
public class TimeRecorderFactory extends AbstractFactory {
private static final String BEAN_NAME = "timerecorder";
private static final TimeRecorderFactory INSTANCE = new TimeRecorderFactory();
private TimeRecorderFactory() {
super("modul-configration.xml");
}
/**
* Creates a new Instance of the {@link TimeRecorder} or returns an already created instance
*
* @return a new Instance of the {@link TimeRecorder} or returns an already created instance
*/
public static TimeRecorder createNew() {
return INSTANCE.createNewWithAgruments(BEAN_NAME);
}
}
| [
"[email protected]"
] | |
733a205b3c0e7e8040f391476f72e0ae3fe5c7f2 | 23325394ddc79dfaa50e78673858951007c293ae | /src/main/java/es/animal/protection/animalshelter/configuration/WebFluxConfiguration.java | 01f31fb8e3ac9e95b309144042ece99e4bfb58ad | [] | no_license | vivicast/animal-shelter-spring | aaf09ded8c398595839d9e0e579cffb239ba2685 | 30293413851d3ac405f39e34b9ad52da39e73bca | refs/heads/master | 2023-05-05T07:57:55.645213 | 2021-05-18T23:12:21 | 2021-05-18T23:12:21 | 363,427,725 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 643 | java | package es.animal.protection.animalshelter.configuration;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.config.CorsRegistry;
import org.springframework.web.reactive.config.EnableWebFlux;
import org.springframework.web.reactive.config.WebFluxConfigurer;
@Configuration
@EnableWebFlux
public class WebFluxConfiguration implements WebFluxConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry
.addMapping("/**")
.allowedMethods("*")
.allowedOrigins("*")
.maxAge(3600);
}
}
| [
"[email protected]"
] | |
70daaefad230415bde9e9f468ca35f1e5cb4db35 | 1421832092d6d5c380782bcde2510adf32bd87d7 | /src/CollectionExample/CollectionTask14.java | 2390c07a30dc5988e1bae552a7f35ebb848cc85e | [] | no_license | Victoria-Tkachova/Java-lessons | 358509ed9e9a3acc6518914e587229a016774933 | b0c20b6c7bf8fc3aa07918bdce5ad0b87d94821a | refs/heads/master | 2020-09-08T14:25:03.666639 | 2020-01-27T15:22:23 | 2020-01-27T15:22:23 | 221,158,418 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,245 | java | package CollectionExample;
import java.time.LocalDate;
import java.util.*;
class Transport {
int price;
int horses;
List<LocalDate> list=new ArrayList<>();
void comparePriceHorses() {
System.out.println("За " + price + " $ США Вы получите " + horses + " лошадиных сил.");
}
double length;
double weight;
double high;
Transport(Transport ob) {
length = ob.length;
weight = ob.weight;
high = ob.high;
for (LocalDate temp:ob.list ) {
this.list.add(temp);
}
}
Transport(double length, double w, double h) {
this.length = length;
weight = w;
high = h;
parameters();
Iterator<Integer> qwe= new Iterator<Integer>() {
@Override
public boolean hasNext() {
return false;
}
@Override
public Integer next() {
return null;
}
};
}
Transport() {
System.out.println("Это конструктор по умолчанию");
}
void parameters() {
System.out.println("Параментры транспорта: длинна - " + length + "; высота - " + high + "; вес - " + weight);
}
public static void main(String[] args) {
Auto myAuto1 = new Auto(10, 20, 2.5, 4);
Ship myShip1 = new Ship (35, 12, 2.7, 35); // конструкторы вызываются в порядке наследования; если метод super не вызывается, то используется конструктор по умолчанию
Airplane myAirplane1 = new Airplane (57, 45, 5.6, 300);
myAirplane1.parameters();
Transport myTransport1 = new Transport();
myTransport1 = myAuto1; // но у этого объекта нет доступа к полю doors, так как он не определён в суперклассе
myTransport1.parameters();
Car myCar1 = new Car (5, 2, 1.5, 5, "Beetle");
Transport trans;
trans = myAuto1;
trans.parameters();
trans = myShip1;
trans.parameters();
Set <String> newSet= new HashSet<>();
Collections.addAll(newSet,"sw","qwqwq","sdsd","sw");
System.out.println(newSet);
String str=new String("sw");
String qwe="sw";
String asd="sw";
newSet.add(str);
System.out.println(newSet);
}
}
class Auto extends Transport {
double doors;
Auto (double l, double w, double h, double d) {
super (l,w,h); // при вызове должен быть в первом операторе в конструкторе подкласса
doors = d;
System.out.println("Это параметры автомобиля: длинна - " + l + " высота - " + h + " вес - " + w + " количество дверей - " +d);
}
Auto () {
System.out.println("Конструктор по молчанию для автотранспорта"); // от этого подкласса нельзя наследовать пока нет конструктора по умолчанию
}
void parameters() {
System.out.println("Параментры автомобильного транспорта: длинна - " + length + "; высота - " + high + "; вес - " + weight);
}
}
class Ship extends Transport {
int speed;
Ship (double l, double w, double h, int s) {
length = l;
weight = w;
high = h;
speed = s;
System.out.println("Это параментры судна: длинна - " + l + " высота - " + h + " вес - " + w + " скорость - " + s);
}
void parameters() {
System.out.println("Параментры водного транспорта: длинна - " + length + "; высота - " + high + "; вес - " + weight);
}
}
class Airplane extends Transport {
int passengers;
Airplane (double l, double w, double h, int p) {
length = l;
weight = w;
high = h;
passengers = p;
System.out.println("Это параментры самолёта: длинна - " + l + " высота - " + h + " вес - " + w + " количество пассажиров - " + p);
}
void parameters() {
System.out.println("Параментры воздушного транспорта: длинна - " + length + "; высота - " + high + "; вес - " + weight);
}
}
class Car extends Auto {
String model;
Car (double l, double w, double h, double d, String m) {
super (l,w,h,d);
model = m;
System.out.println("Это параметры автомобиля: длинна - " + l + " высота - " + h + " вес - " + w + " количество дверей - " +d +
"\nа для легкового автомобиля ещё и модель - " + m);
}
}
| [
"[email protected]"
] | |
f829440845f9e396e1d831d95f4542320b405f02 | 5e7783f03bb29d4c7429cfee3497402ea02305e9 | /src/proyectoso/Estante.java | 644381967f16a41892321e9c7ccbc03b50c7271b | [] | no_license | Someguy300/ProyectoSO | 4c19609d79688a08ef2483f4bb27918cc281b73d | 4ddfc2dd1692cc64ba2e13fa3ab57034baef8768 | refs/heads/master | 2022-10-21T18:20:33.527132 | 2020-06-15T22:34:46 | 2020-06-15T22:34:46 | 269,408,340 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,349 | 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 proyectoso;
import static java.lang.Math.random;
import java.util.concurrent.Semaphore;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author Jesus Barrios
*/
public class Estante {
//Variables
//ints para darle precio a los productos y cuantos productos
//se va a agarrar
int randomInt, randomCost;
//numero de productos en el estante y su capacidad
//en un comienzo tienen el mismo valor
private int nroProd,cap;
//su semaforo
private Semaphore semS;
//el cliente es null porque bueno...el cliente que accede al
//estante cambia cada rato
public Estante(int nroProd){
this.nroProd = nroProd;
this.cap = nroProd;
this.semS = new Semaphore(1);
}
/*Este deberia ser el get de productor consumidor, por ahora..o para el
momento de la entrega este proceso raro el cual estoy seguro no aplica
productor consumidor*/
/**
* Metodo para obtener productos del estante
* @param cliente thread que va a usar el estante
* @throws InterruptedException
*/
void get(Cliente cliente) throws InterruptedException {
/*El cliente puede(decidir)agarrar productos(el gafo igual puede decidir
agarrar 0 productos), si no hay productos ve al "else" de este "if"
para mas detalles*/
if(nroProd!=0){
//se le asigna al cliente el semaforo de este estante
cliente.setSemE(semS);
//Se le pide permiso al semaforo para acceder al estante
cliente.getSemE().acquire();
// System.out.println("-----------------");
// System.out.println(cliente.getNro()+" dice: Estoy en el estante");
//el tiempo que usa el cliente para decidir que va a agarrar
cliente.sleep(Control.minuto);
//Un switch dependiendo del nro de productos que hay en el estante
switch(nroProd){
//no voy a explicar los 2 casos, hacen lo mismo,
//solo que el case 1 hace un random entra 0...vea el caso default
case 1:
randomInt = (int)(2 * Math.random());
cliente.setNroItems(cliente.getNroItems()+randomInt);
//System.out.println(cliente.getNro()+" dice: agarre "+randomInt+" productos");
nroProd = nroProd - randomInt;
if(randomInt!=0){
randomCost= 1 + ((int)(10 * Math.random()));
cliente.setTotal(cliente.getTotal()+randomCost);
}
break;
default:
//Se escoge cuandos productos va a agarrar el cliente
randomInt = (int)(3 * Math.random());
/*se modifica el nro de prod que el cliente tiene
ahora que escribo esto lo del nro de prod que el cliente
tiene es inutil...¿tiene algo que ver con el enunciado
del proyecto?*/
cliente.setNroItems(cliente.getNroItems()+randomInt);
//sout de verificacion
//System.out.println(cliente.getNro()+" dice: agarre "+randomInt+" productos");
/*Aqui si es importante el randomInt porque se le resta al
total de productos que le quedan al estante despues de que
el cliente agarro*/
nroProd = nroProd - randomInt;
//Si el cliente agarro productos aqui se le asigna el
//precio a c/producto que agarro el cliente
if(randomInt!=0){
for (int i = 0; i < randomInt; i++) {
//Se inventa el precio
randomCost= 1 + ((int)(10 * Math.random()));
//Se suma al total que tiene que pagar el cliente
//y por lo tanto lo que iria al contador global
cliente.setTotal(cliente.getTotal()+randomCost);
}
}
break;
}
//verificacion
// System.out.println("-----------------");
// System.out.println("PRODUCTOS RESTANTES:"+nroProd);
//el cliente deja ir el semaforo
cliente.getSemE().release();
} else {
//Si el estante esta vacio se entra en un loop infinito hasta
//que el empleado rellene el estante,luego de eso se vuelve a llamar
//a la funcion
//System.out.println(cliente.getNro()+" dice: Estante vacio,esperare");
while(nroProd==0){}
get(cliente);
}
}
/*Este deberia ser el put de productor consumidor, por ahora..o para el
momento de la entrega este proceso raro el cual estoy seguro no aplica
productor consumidor*/
/**
* Metodo para reponer productos del estante
* @param empleado thread que va a usar el estante
* @throws InterruptedException
*/
void put (Empleado empleado) throws InterruptedException {
//Si el empleado no tiene semaforo asignado, se le asigna el semaforo
//de su respectivo estante...me da miedo cambiar esto
if(empleado.getSem()==null){
empleado.setSem(semS);
}
//si el numero de productos es lo suficientemente pequeño como
//para el empleado vaya a buscar una caja se ejecuta esto
if(nroProd<=(cap-3)){
//verificando que el thread empleado funcione
//System.out.println("Empleado dice: Oh no el estante tiene que ser repuesto");
//buscando la caja...
Thread.sleep(Control.minuto*4);
//se pide permiso para usar el estante
empleado.getSem().acquire();
//El minuto en el que se repone el estante+verificacion por cout
//System.out.println("Empleado dice: reponiendo estante");
empleado.sleep(Control.minuto);
//Se repone el estante
//System.out.println("Empleado dice: Estante repuesto con 3 productos");
nroProd = nroProd + 3;
//verificacion+se suelta el permiso para usar el semaforo
//del estante...me sigo preguntando si eso esta bien dicho
//System.out.println("PRODUCTOS RESTANTES: "+nroProd);
empleado.getSem().release();
}
}
//getters y setters
public int getNroProd() {
return nroProd;
}
public void setNroProd(int nroProd) {
this.nroProd = nroProd;
}
public Semaphore getSemS() {
return semS;
}
public void setSemS(Semaphore semS) {
this.semS = semS;
}
}
| [
"[email protected]"
] | |
1752d4c4c5c913ae101e6900f5d91d1c9f688e24 | 740a27a38e91510f06069a204c612fd9ee26a55d | /src/main/java/algorithms/easy/E053_MaximumSubarray.java | fb9be51aa16ba736c3bbd19e646d27d8a211addc | [] | no_license | renguangqian1993/leetcode | 88e4887fed8f7afc89bee3f72abcc6608b2a9422 | d6a76f04f2b68cd51087723a06beea6e5b256c6d | refs/heads/master | 2021-08-03T16:04:49.613965 | 2021-07-25T12:25:36 | 2021-07-25T12:25:36 | 168,274,106 | 0 | 0 | null | 2020-10-18T06:46:50 | 2019-01-30T03:39:13 | Java | UTF-8 | Java | false | false | 3,139 | java | package algorithms.easy;
/**
* Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.
*
* Example:
*
* Input: [-2,1,-3,4,-1,2,1,-5,4],
* Output: 6
* Explanation: [4,-1,2,1] has the largest sum = 6.
*
* 来源:力扣(LeetCode)
* 链接:https://leetcode-cn.com/problems/maximum-subarray
* 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
*/
public class E053_MaximumSubarray {
//TODO 动态规划,分治法
public int maxSubArray(int[] nums) {
int ans = nums[0];
int sum = 0;
for(int num: nums) {
if(sum > 0) {
sum += num;
} else {
sum = num;
}
ans = Math.max(ans, sum);
}
return ans;
}
/**
* TODO 分治法
* 这种分治法有个问题,时间复杂度为O(n*log(n))
* 分治需要划分到一个组中只有一个节点,然后往上走,每次分组都要扫描组内每个节点
*/
public int maxSubArray2(int[] nums) {
int len = nums.length;
if (len == 0) {
return 0;
}
return maxSubArraySum(nums, 0, len - 1);
}
private int maxSubArraySum(int[] nums, int left, int right) {
if (left == right) {
return nums[left];
}
int mid = (left + right) >>> 1;
return Math.max(
Math.max(maxSubArraySum(nums, left, mid), maxSubArraySum(nums, mid + 1, right)),
maxCrossingSum(nums, left, mid, right));
}
private int maxCrossingSum(int[] nums, int left, int mid, int right) {
// 一定会包含 nums[mid] 这个元素
int sum = 0;
int leftSum = Integer.MIN_VALUE;
// 左半边包含 nums[mid] 元素,最多可以到什么地方
// 走到最边界,看看最值是什么
// 计算以 mid 结尾的最大的子数组的和
for (int i = mid; i >= left; i--) {
sum += nums[i];
if (sum > leftSum) {
leftSum = sum;
}
}
sum = 0;
int rightSum = Integer.MIN_VALUE;
// 右半边不包含 nums[mid] 元素,最多可以到什么地方
// 计算以 mid+1 开始的最大的子数组的和
for (int i = mid + 1; i <= right; i++) {
sum += nums[i];
if (sum > rightSum) {
rightSum = sum;
}
}
return leftSum + rightSum;
}
/**
* 动态规划
* 执行用时 :2 ms, 在所有 Java 提交中击败了90.86%的用户
* 内存消耗 :38.9 MB, 在所有 Java 提交中击败了80.30%的用户
*/
public int maxSubArray3(int[] nums) {
int maxSum = Integer.MIN_VALUE;
int tmpSum = 0;
for (int num : nums) {
if (tmpSum > 0) {
tmpSum += num;
} else {
tmpSum = num;
}
maxSum = Math.max(maxSum, tmpSum);
}
return maxSum;
}
}
| [
"[email protected]"
] | |
01508f1d6b2c800840df7bed612443f0b4553ada | 26df6dd75086e0d6f8890c51613ae4538e231e0f | /mylibrary/src/androidTest/java/com/attiqrao/systemsltd/tree/ApplicationTest.java | a24fa5116dfc69dfd9ed0d74da97315b1958c07e | [] | no_license | attiqrehman1991/TreeviewForSystem | 7995fbc092fdb6c74eb4eb1108510b4d6283470d | db4b876b3c6af0714348e26410e4392e073a0bac | refs/heads/master | 2016-08-12T02:57:58.642630 | 2016-04-07T06:37:49 | 2016-04-07T06:37:49 | 55,664,899 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 359 | java | package com.attiqrao.systemsltd.tree;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"attiq.ur.rehman1991@gmailcom"
] | attiq.ur.rehman1991@gmailcom |
9dd5bf6b5856507fb02d12e80c307f8da425af04 | c3dfa715d75662be130ff601bb3ff256f8020f57 | /src/media/Principal.java | b5e2636c8cadd85fc4cec3cd7dd8bfae83e1365d | [] | no_license | caiomoMack/LP2 | c7fc386dbbd04a18c7958b44ae3dc745fdbbb919 | 52dcec0feb80e25d786614d537288f7f5caabee7 | refs/heads/master | 2021-01-19T08:15:53.520710 | 2012-04-24T20:09:08 | 2012-04-24T20:09:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 175 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package media;
/**
*
* @author hkom
*/
public class Principal {
}
| [
"hkom@hkom-PC"
] | hkom@hkom-PC |
20906810d8a0b43fe92b37801defef0a38e5562a | bad527160d931e9a4421d9d985b15dfb82966f0b | /src/main/java/com/fps/mpits/modules/auth/eo/McasUserAppStatusEntityId.java | 0f9ea435a6345872e15e6bd86325d25945d81d4c | [] | no_license | hieuboyfc/mpits_sync_data | ae37aa7750ae94ac4db3c5372df0a1360c5a8c68 | 86dc97889edefbabdbf0ca537ec7afa9aa703ca4 | refs/heads/master | 2023-01-13T09:52:16.537299 | 2020-11-12T05:37:56 | 2020-11-12T05:37:56 | 268,700,781 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 850 | java | package com.fps.mpits.modules.auth.eo;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import javax.persistence.Embeddable;
import java.io.Serializable;
/**
* @author HieuDT28 - (Hiếu Boy)
* created 19/05/2020 - 17:30
* @see <a href="https://www.objectdb.com/java/jpa/entity/id"></a>
*/
@Accessors(fluent = true)
@NoArgsConstructor
@AllArgsConstructor
@Data
@JsonAutoDetect(fieldVisibility = Visibility.ANY)
@Embeddable
public class McasUserAppStatusEntityId implements Serializable {
private static final long serialVersionUID = 1L;
// Mã ứng dụng
private String appCode;
// Username
private String username;
} | [
"[email protected]"
] | |
4eb23ee552cb455f7ad40b2feb667934fbc49b3a | e457d389727a51a0055c3ec04d0705e49cd292bb | /app/src/main/java/com/example/user/mvvmdemo/network/LiveDataCallAdapterFactory.java | 70b133a2b13adbb5e271a77fea4ab96f3b56d46e | [] | no_license | AsadLeo14/MVVM-Demo | 6d5ca5fb77d149dd14f1fb848b8402cac9e277a8 | 20566b475184d444f2016fe6c60d6d25782fa278 | refs/heads/master | 2020-03-25T18:58:24.562110 | 2018-08-10T19:23:25 | 2018-08-10T19:23:25 | 144,058,590 | 6 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,127 | java | package com.example.user.mvvmdemo.network;
import android.arch.lifecycle.LiveData;
import java.lang.annotation.Annotation;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import retrofit2.CallAdapter;
import retrofit2.Retrofit;
public class LiveDataCallAdapterFactory extends CallAdapter.Factory {
@Override
public CallAdapter<?, ?> get(Type returnType, Annotation[] annotations, Retrofit retrofit) {
if (getRawType(returnType) != LiveData.class) {
return null;
}
Type observableType = getParameterUpperBound(0, (ParameterizedType) returnType);
Class<?> rawObservableType = getRawType(observableType);
if (rawObservableType != ApiResponse.class) {
throw new IllegalArgumentException("type must be a resource");
}
if (! (observableType instanceof ParameterizedType)) {
throw new IllegalArgumentException("resource must be parameterized");
}
Type bodyType = getParameterUpperBound(0, (ParameterizedType) observableType);
return new LiveDataCallAdapter<>(bodyType);
}
}
| [
"[email protected]"
] | |
1223d27b7a7c0328546fc95f6a2dc72b6dd756f9 | cafd3eabfb5eb2c3472cb51116430f934057513b | /src/main/java/com/dada/inject/service/UserServiceImpl.java | a5c075f4143110a81e9dede1e5c006790efcfc7a | [] | no_license | pisory/spring-content-test | 88bfa7b423363f8ba992a3cdda4cba94d3660414 | 82cfb70da70115656a8b2dfef2cedd3ae84490f6 | refs/heads/master | 2022-12-23T11:32:56.437452 | 2019-12-07T04:01:17 | 2019-12-07T04:01:17 | 210,639,806 | 0 | 0 | null | 2022-12-16T09:43:07 | 2019-09-24T15:43:27 | Java | UTF-8 | Java | false | false | 546 | java | package com.dada.inject.service;
import com.dada.inject.dao.UserDao;
/**
* @author zhoudahua
* @date 2019/6/26
* @description
*/
public class UserServiceImpl implements UserService {
UserDao dao;
@Override
public void find() {
System.out.println("service");
dao.query();
}
/**
* 使用setter注入:方法名称叫setXxx:必须和ref的名称一致,开头字幕大写<property ref="dao"></property>
* @param dao
*/
public void setDao(UserDao dao) {
this.dao = dao;
}
}
| [
"[email protected]"
] | |
8490d0e3917ffc4fe620806f518f6db55c712291 | 8457e0c27d238b33cde5ba1b6069991aedea8e30 | /CoreJava/src/com/myapp/oops/Test.java | df13956948d04d62493f23fb069ea04a84abdb63 | [] | no_license | raghunandancm/java-microservices-kafka | 3f4669fea4d605d26a9f5566fd51bea4e6536727 | acc692644ee04f661498dc2e5fda9e2e65dc823c | refs/heads/master | 2023-04-02T00:45:49.727012 | 2021-04-01T04:44:55 | 2021-04-01T04:44:55 | 353,579,932 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 214 | java | package com.myapp.oops;
//import java.util.*;
/*
*
*
*/
public class Test {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("Hello");
}
}
| [
"[email protected]"
] | |
10e21d16b7ef069fa3e3a0ce47c0145d0f36e41f | 62d78f842fcbab7002877dd6f59ee67859177bd2 | /app/src/main/java/com/teamcreative/totassignment/util/ItemDecorationUtil.java | 2e70c4f5e988329e1b126c88fe23159b453d9f08 | [] | no_license | NerdFaisal404/TotAssignmentFinal | b92b6ca50c41cda21bccb4d53ad0cc1ba73d757d | f485c1429bc3da50286d7d1d484043c978ee6860 | refs/heads/master | 2020-03-12T06:29:48.455572 | 2018-04-21T15:25:32 | 2018-04-21T15:25:32 | 130,486,458 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 793 | java | package com.teamcreative.totassignment.util;
import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;
public class ItemDecorationUtil extends RecyclerView.ItemDecoration {
private int mHalfSpace;
public ItemDecorationUtil(int space) {
this.mHalfSpace = space / 2;
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
if (parent.getPaddingLeft() != mHalfSpace) {
parent.setPadding(mHalfSpace, mHalfSpace, mHalfSpace, mHalfSpace);
parent.setClipToPadding(false);
}
outRect.top = mHalfSpace;
outRect.right = mHalfSpace;
outRect.bottom = mHalfSpace;
outRect.left = mHalfSpace;
}
}
| [
"[email protected]"
] | |
bbf7d91154e737fdc750242428db68ae9c085e36 | c3487be466f7b4111cde63d47d30c3d6c753b25e | /src/lojaroupas/control/InterfaceCadastro.java | 8410b5e32667e9111e25c30e9c32e5f075506274 | [] | no_license | david-augusto/Loja-de-Roupas | e60ad1f75c3fcd6c94a80ccad049f2f7a2b47deb | 2b30b7fa8fbc0cc9264fb68029efe2ecb594c64c | refs/heads/main | 2023-01-30T20:19:42.066583 | 2020-12-13T23:37:13 | 2020-12-13T23:37:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 223 | java | package lojaroupas.control;
public interface InterfaceCadastro {
public void cadastrar() throws CPFException;
public void visualizar();
public void atualizar();
public void deletar();
}
| [
"[email protected]"
] | |
cd203343ed6fb1d8eb7cbf5824fb2e1c4388839d | c0d41d3ee334e4e4c42b580bd6ace1f99ee54ed6 | /app/src/main/java/com/lagel/com/mqttchat/ViewHolders/ViewHolderVideoMedia.java | 387402ec4a60eec36298c3dd02db839395f203cb | [] | no_license | mahmoudSol/lagel | d522751ed17c5cce7582a0e8b6b2f484584b9647 | 76856e78d55832bb0c747dd852f4e01e4d8c6e20 | refs/heads/master | 2020-04-20T08:23:50.871154 | 2019-02-01T17:55:36 | 2019-02-01T17:55:36 | 168,737,516 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 646 | java | package com.lagel.com.mqttchat.ViewHolders;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;
import com.lagel.com.R;
import com.lagel.com.mqttchat.Utilities.AdjustableImageView;
/**
* View holder for media history video recycler view item
*/
public class ViewHolderVideoMedia extends RecyclerView.ViewHolder {
public AdjustableImageView thumbnail;
public TextView fnf;
public ViewHolderVideoMedia(View view) {
super(view);
fnf = (TextView) view.findViewById(R.id.fnf);
thumbnail = (AdjustableImageView) view.findViewById(R.id.vidshow);
}
}
| [
"[email protected]"
] | |
ac6ff9328eb3b519607f20e0909c68faa163bba2 | b35333ab26ad05e427dd34eb00e6b146d27aabd4 | /src/main/java/com/example/demo/student/StudentConfig.java | ffdd700f0e608f750a928cc761a5177105a05213 | [] | no_license | lsgomez93/java-spring-boot | 525d2cfe480422dc8070339cb2ef706edff59335 | 0b2b602658786b5db5d00f9f6716e64b2229817b | refs/heads/main | 2023-07-05T09:42:14.110808 | 2021-08-23T17:43:54 | 2021-08-23T17:43:54 | 399,178,727 | 0 | 0 | null | 2021-08-23T17:43:54 | 2021-08-23T16:43:32 | null | UTF-8 | Java | false | false | 501 | java | package com.example.demo.student;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class StudentConfig {
@Bean
CommandLineRunner commandLineRunner(
StudentRepository repository){
return args->{
Student hello = new Student(
"Hello"
);
repository.save(hello);
};
}
}
| [
"[email protected]"
] | |
818a28743ceb16970644c1e821fba804375f088f | 69a4e0b4990504fa4c3a468be0e84f0f33a6ec2e | /zagar_server/src/main/java/messageSystem/messages/ReplicateMsg.java | 1d04dc59358eff0083b4203b0541d5cbd262e5bd | [] | no_license | lockyStar/Zagar | 96da6dcbd0d57ac9f633faace92263cb6719c537 | 51d6434bb12555b69751909092e6ae8753911f88 | refs/heads/master | 2020-06-19T19:57:30.936269 | 2016-11-28T19:25:13 | 2016-11-28T19:25:13 | 74,843,533 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 748 | java | package messageSystem.messages;
import main.ApplicationContext;
import messageSystem.Abonent;
import messageSystem.Address;
import messageSystem.Message;
import messageSystem.MessageSystem;
import network.ClientConnectionServer;
import replication.Replicator;
import java.io.IOException;
/**
* Created by alpie on 15.11.2016.
*/
public class ReplicateMsg extends Message {
public ReplicateMsg(Address from) {
super(from, ApplicationContext.instance().get(MessageSystem.class).getService(ClientConnectionServer.class).getAddress());
}
@Override
public void exec(Abonent abonent) {
try {
ApplicationContext.instance().get(Replicator.class).replicate();
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
fcf77a36d77fb122303ee8f50329c3a98d1c09c1 | c306615df3a057d42b3b48dbd2a82ac440ef5636 | /app/src/main/java/com/kanjih/inventoryapp/SupplierActivity.java | 7e2d58a64727ca403307cc5243c57c2d245312aa | [] | no_license | kanjih-ciandt/InventoryApp | a0aa801bfca01d7b5ba5c850ae8eea1011eaf0f8 | aa90e971b289e92fa78f8b2f54cb755218aa70d5 | refs/heads/master | 2021-01-19T00:09:42.217869 | 2017-04-17T13:26:29 | 2017-04-17T13:26:29 | 87,145,948 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,269 | java | package com.kanjih.inventoryapp;
import android.content.ContentValues;
import android.content.DialogInterface;
import android.net.Uri;
import android.support.v4.app.NavUtils;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import com.kanjih.inventoryapp.data.SupplierContract.SupplierEntry;
public class SupplierActivity extends AppCompatActivity {
/**
* Content URI
*/
private Uri mCurrentUri;
private boolean mSupplierHasChanged = false;
private EditText mNameEditText;
private EditText mEmailEditText;
private EditText mPhoneEditText;
private EditText mMobileEditText;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_supplier);
mNameEditText = (EditText) findViewById(R.id.edit_supplier_name);
mEmailEditText = (EditText) findViewById(R.id.edit_supplier_email);
mPhoneEditText = (EditText) findViewById(R.id.edit_supplier_phone);
mMobileEditText = (EditText) findViewById(R.id.edit_supplier_mobile);
mNameEditText.setOnTouchListener(mTouchListener);
mEmailEditText.setOnTouchListener(mTouchListener);
mPhoneEditText.setOnTouchListener(mTouchListener);
mMobileEditText.setOnTouchListener(mTouchListener);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu options from the res/menu/menu_editor.xml file.
getMenuInflater().inflate(R.menu.menu_detail, menu);
return true;
}
private View.OnTouchListener mTouchListener = new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
mSupplierHasChanged = true;
return false;
}
};
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// User clicked on a menu option in the app bar overflow menu
switch (item.getItemId()) {
// Respond to a click on the "Save" menu option
case R.id.action_save:
// Do nothing for now
if(!isValidFields()){
Toast.makeText(this, "Fields shoudn't be null ", Toast.LENGTH_SHORT).show();
return true;
} else {
saveSupplier();
finish();
}
return true;
// Respond to a click on the "Delete" menu option
case R.id.action_delete:
showDeleteConfirmationDialog();
finish();
return true;
// Respond to a click on the "Up" arrow button in the app bar
case android.R.id.home:
// If the pet hasn't changed, continue with navigating up to parent activity
// which is the {@link CatalogActivity}.
if (!mSupplierHasChanged) {
NavUtils.navigateUpFromSameTask(SupplierActivity.this);
return true;
}
// Otherwise if there are unsaved changes, setup a dialog to warn the user.
// Create a click listener to handle the user confirming that
// changes should be discarded.
DialogInterface.OnClickListener discardButtonClickListener =
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
// User clicked "Discard" button, navigate to parent activity.
NavUtils.navigateUpFromSameTask(SupplierActivity.this);
}
};
// Show a dialog that notifies the user they have unsaved changes
showUnsavedChangesDialog(discardButtonClickListener);
return true;
}
return super.onOptionsItemSelected(item);
}
private boolean isValidFields() {
return ! (mNameEditText.getText().toString().trim().isEmpty() ||
mEmailEditText.getText().toString().trim().isEmpty() );
}
private void showUnsavedChangesDialog(
DialogInterface.OnClickListener discardButtonClickListener) {
// Create an AlertDialog.Builder and set the message, and click listeners
// for the positive and negative buttons on the dialog.
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.unsaved_changes_dialog_msg);
builder.setPositiveButton(R.string.discard, discardButtonClickListener);
builder.setNegativeButton(R.string.keep_editing, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// User clicked the "Keep editing" button, so dismiss the dialog
// and continue editing the pet.
if (dialog != null) {
dialog.dismiss();
}
}
});
// Create and show the AlertDialog
AlertDialog alertDialog = builder.create();
alertDialog.show();
}
@Override
public void onBackPressed() {
// If the pet hasn't changed, continue with handling back button press
if (!mSupplierHasChanged) {
super.onBackPressed();
return;
}
// Otherwise if there are unsaved changes, setup a dialog to warn the user.
// Create a click listener to handle the user confirming that changes should be discarded.
DialogInterface.OnClickListener discardButtonClickListener =
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
// User clicked "Discard" button, close the current activity.
finish();
}
};
// Show dialog that there are unsaved changes
showUnsavedChangesDialog(discardButtonClickListener);
}
private void showDeleteConfirmationDialog() {
// Create an AlertDialog.Builder and set the message, and click listeners
// for the postivie and negative buttons on the dialog.
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.delete_dialog_msg_supplier);
builder.setPositiveButton(R.string.delete, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// User clicked the "Delete" button, so delete the pet.
deleteSupplier();
}
});
builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// User clicked the "Cancel" button, so dismiss the dialog
// and continue editing the pet.
if (dialog != null) {
dialog.dismiss();
}
}
});
// Create and show the AlertDialog
AlertDialog alertDialog = builder.create();
alertDialog.show();
}
/**
* Get user input from editor and save new pet into database.
*/
private void saveSupplier() {
// Read from input fields
// Use trim to eliminate leading or trailing white space
String nameString = mNameEditText.getText().toString().trim();
String emailString = mEmailEditText.getText().toString().trim();
String phoneString = mPhoneEditText.getText().toString().trim();
String mobileString = mMobileEditText.getText().toString().trim();
// Create a ContentValues object where column names are the keys,
// and pet attributes from the editor are the values.
ContentValues values = new ContentValues();
values.put(SupplierEntry.COLUMN_SUP_NAME, nameString);
values.put(SupplierEntry.COLUMN_SUP_MAIL, emailString);
values.put(SupplierEntry.COLUMN_SUP_PHONE, phoneString);
values.put(SupplierEntry.COLUMN_SUP_MOBILE, mobileString);
boolean isOk;
if (mCurrentUri != null) {
int id = getContentResolver().update(mCurrentUri, values, null, null);
isOk = (id != -1);
} else {
Uri newRowId = getContentResolver().insert(SupplierEntry.CONTENT_URI, values);
isOk = (newRowId != null);
}
// Insert a new row for pet in the database, returning the ID of that new row.
// Show a toast message depending on whether or not the insertion was successful
if (isOk) {
// If the row ID is -1, then there was an error with insertion.
Toast.makeText(this, R.string.editor_save_supplier_successful, Toast.LENGTH_SHORT).show();
} else {
// Otherwise, the insertion was successful and we can display a toast with the row ID.
Toast.makeText(this, R.string.editor_save_supplier_failed, Toast.LENGTH_SHORT).show();
}
}
/**
* Perform the deletion of the pet in the database.
*/
private void deleteSupplier() {
int rowsDeleted = getContentResolver().delete(mCurrentUri, null, null);
// Show a toast message depending on whether or not the delete was successful.
if (rowsDeleted == 0) {
// If no rows were deleted, then there was an error with the delete.
Toast.makeText(this, getString(R.string.editor_delete_supplier_failed),
Toast.LENGTH_SHORT).show();
} else {
// Otherwise, the delete was successful and we can display a toast.
Toast.makeText(this, getString(R.string.editor_delete_supplier_successful),
Toast.LENGTH_SHORT).show();
}
}
}
| [
"[email protected]"
] | |
04b341409f57188b097dc41d8c0218480ece3c43 | f854f26b913871694cce85c273be65b2315157ac | /src/integration/java/org/arkecosystem/client/api/BlocksTest.java | 500fc554cc354cacc4db7da415440bba0809bf95 | [
"MIT"
] | permissive | ArkEcosystem/java-client | eb65ca55595f41130230ff14a8698e034aacfaa0 | c9cf27f6c7eae662d21bec40699d7d672eaae7a1 | refs/heads/master | 2021-11-27T02:45:01.369762 | 2021-09-21T12:24:55 | 2021-09-21T12:24:55 | 138,148,593 | 2 | 29 | MIT | 2021-09-21T12:24:57 | 2018-06-21T09:22:22 | Java | UTF-8 | Java | false | false | 2,515 | java | package org.arkecosystem.client.api;
import org.arkecosystem.client.BaseClientTest;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.util.Map;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasEntry;
import static org.hamcrest.Matchers.hasKey;
@SuppressWarnings("unchecked")
public class BlocksTest extends BaseClientTest {
@Test
void all() throws IOException {
Map<String, Object> actual = connection.api().blocks.all();
assertThat(actual, hasKey("data"));
assertThat(actual, hasKey("meta"));
}
@Test
void allWithParams() throws IOException {
Map<String, Object> actual =
connection.api().blocks.param("page", 1).param("limit", 100).all();
assertThat(actual, hasKey("data"));
assertThat(actual, hasKey("meta"));
}
@Test
void first() throws IOException {
Map<String, Object> actual = connection.api().blocks.first();
assertThat(actual, hasKey("data"));
}
@Test
void last() throws IOException {
Map<String, Object> actual = connection.api().blocks.last();
assertThat(actual, hasKey("data"));
}
@Test
void showByHeight() throws IOException {
Map<String, Object> actual = connection.api().blocks.show("1");
assertThat(actual, hasKey("data"));
assertThat((Map<String, ?>) actual.get("data"), hasEntry("height", 1.0));
}
@Test
void showByHash() throws IOException {
Map<String, Object> actual = connection.api().blocks.show("13114381566690093367");
assertThat(actual, hasKey("data"));
assertThat((Map<String, ?>) actual.get("data"), hasEntry("height", 1.0));
}
@Test
void transactions() throws IOException {
Map<String, Object> actual = connection.api().blocks.transactions("1");
assertThat(actual, hasKey("meta"));
assertThat(actual, hasKey("data"));
assertThat((Map<String, ?>) actual.get("meta"), hasEntry("count", 52.0));
}
@Test
void transactionsWithParams() throws IOException {
Map<String, Object> actual =
connection.api().blocks.param("page", 2).param("limit", 10).transactions("1");
assertThat(actual, hasKey("meta"));
assertThat(actual, hasKey("data"));
assertThat((Map<String, ?>) actual.get("meta"), hasEntry("count", 10.0));
assertThat((Map<String, ?>) actual.get("meta"), hasEntry("pageCount", 7.0));
}
}
| [
"[email protected]"
] | |
f93ffbc938f289eea61d99103ce62d139eadc107 | 58fd39de2a37fc30159fed0d349332a8d8d4cc8c | /MusicUI/src/sample/model/Album.java | 12f308169cf18102570220772f03cf1315c26e58 | [] | no_license | glowackiRafal/MusicDB | 4cc9353d3c606e197b2d6fa2b8f4dcaf23165044 | 3a4c5a036d47d1ac0320de6d3d6ebd92bd5aa7e6 | refs/heads/master | 2020-03-29T06:14:01.271715 | 2018-09-27T10:04:37 | 2018-09-27T10:04:37 | 149,615,672 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 904 | java | package sample.model;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
public class Album {
private SimpleIntegerProperty id;
private SimpleStringProperty name;
private SimpleIntegerProperty artistId;
public Album() {
this.id = new SimpleIntegerProperty();
this.name = new SimpleStringProperty();
this.artistId = new SimpleIntegerProperty();
}
public int getId() {
return id.get();
}
public void setId(int id) {
this.id.set(id);
}
public String getName() {
return name.get();
}
public void setName(String name) {
this.name.set(name);
}
public int getArtistId() {
return artistId.get();
}
public void setArtistId(int artistId) {
this.artistId.set(artistId);
}
}
| [
"[email protected]"
] | |
699ce2033213304594ce999594dd64747c710e30 | 1b7cfbedc73190e92697d953b71015dbceadf96d | /app/src/main/java/texel/com/depoproject/Pages/SignActivities/SignIn.java | 79f17b9daf99d3f45a59c4d30bebc71843bf0a02 | [] | no_license | FeridAdashov/Depo-Project | e2623d2219dd472f4751c0f3f961f3cde574f996 | 8d05dca4c367b3fe5ca9142035228a8dbbc47487 | refs/heads/main | 2023-04-07T04:11:42.856040 | 2021-04-14T16:55:42 | 2021-04-14T16:55:42 | 357,975,073 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,690 | java | package texel.com.depoproject.Pages.SignActivities;
import android.Manifest;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
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 androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.google.firebase.auth.FirebaseAuth;
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 org.apache.commons.net.ntp.NTPUDPClient;
import org.apache.commons.net.ntp.TimeInfo;
import java.net.InetAddress;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
import texel.com.depoproject.CustomDialogs.CustomHorizontalProgressBar;
import texel.com.depoproject.HelperClasses.DatabaseFunctions;
import texel.com.depoproject.HelperClasses.SharedClass;
import texel.com.depoproject.Pages.AboutUs.AboutUsActivity;
import texel.com.depoproject.Pages.BUYER.BuyerProfile;
import texel.com.depoproject.Pages.DEPO.DepoProfile;
import texel.com.depoproject.Pages.SELLER.SellerProfile;
import texel.com.depoproject.R;
public class SignIn extends AppCompatActivity implements View.OnClickListener {
public static final String TIME_SERVER = "time-a.nist.gov";
public static String app_name;
private final int TAG_WRITE_EXTERNAL_STORAGE = 1;
private final int TAG_READ_EXTERNAL_STORAGE = 2;
private final int PROJECT_VERSION = 2;
private final SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy hh:mm:SS");
private final Timer timer = new Timer();
private String rootName;
private EditText editTextEmail;
private EditText editTextPassword;
private TextView textViewSignUp, buttonSignIn;
private Button buttonAboutUs;
private CustomHorizontalProgressBar progressBar;
private FirebaseAuth firebaseAuth;
private DatabaseReference databaseReference;
private Activity activity;
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
NTPUDPClient timeClient = new NTPUDPClient();
InetAddress inetAddress = InetAddress.getByName(TIME_SERVER);
TimeInfo timeInfo = timeClient.getTime(inetAddress);
long returnTime = timeInfo.getMessage().getTransmitTimeStamp().getTime(); //server time
Date date_1 = formatter.parse(formatter.format(new Date(returnTime)));
Date date_2 = formatter.parse(formatter.format(new Date()));
differenceBetweenGlobalAndLocalClock(date_1, date_2);
} catch (Exception e) {
Log.d("AAAAA", e.toString());
runOnUiThread(new TimerTask() {
@Override
public void run() {
changeProgressBarVisibility(false);
Toast.makeText(activity, R.string.error_check_internet, Toast.LENGTH_SHORT).show();
activity.finish();
}
});
}
}
});
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_in);
activity = this;
app_name = getString(R.string.app_name);
buttonSignIn = findViewById(R.id.buttonSignIn);
progressBar = findViewById(R.id.progress);
changeProgressBarVisibility(true);
// thread.start();
reLoadSeed();
}
public void differenceBetweenGlobalAndLocalClock(final Date startDate, final Date endDate) {
//seconds
final long different = (endDate.getTime() - startDate.getTime()) / 1000;
activity.runOnUiThread(new TimerTask() {
@Override
public void run() {
if (Math.abs(different) > 60 * 60) {
changeProgressBarVisibility(false);
Toast.makeText(activity, "Telefonunuzda SAAT SƏHVDİR! Saat: " + formatter.format(startDate) + " olmalıdır!", Toast.LENGTH_LONG).show();
finish();
} else
reLoadSeed();
}
});
}
private void loadDatabases() {
if (firebaseAuth.getCurrentUser() != null) {
changeProgressBarVisibility(true);
rootName = firebaseAuth.getCurrentUser().getEmail().split("@")[0];
databaseReference = DatabaseFunctions.getDatabases(this).get(0);
databaseReference.child("DatabaseInformation/version").addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
Integer version = dataSnapshot.getValue(Integer.class);
if (version != null && version == PROJECT_VERSION)
goToProfile();
else {
changeProgressBarVisibility(false);
firebaseAuth.signOut();
Toast.makeText(getBaseContext(), "Proqramı Güncəlləyin!", Toast.LENGTH_LONG).show();
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
changeProgressBarVisibility(false);
}
});
} else changeProgressBarVisibility(false);
}
private void reLoadSeed() {
buttonSignIn.setOnClickListener(this);
editTextEmail = findViewById(R.id.editTextEmail);
editTextPassword = findViewById(R.id.editTextPassword);
textViewSignUp = findViewById(R.id.textViewSignUp);
textViewSignUp.setOnClickListener(this);
buttonAboutUs = findViewById(R.id.buttonAboutUs);
buttonAboutUs.setOnClickListener(this);
firebaseAuth = FirebaseAuth.getInstance();
checkMyPermissions();
}
private void checkMyPermissions() {
int permissionWriteExternal = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE);
int permissionReadExternal = ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE);
if (permissionWriteExternal != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, TAG_WRITE_EXTERNAL_STORAGE);
return;
}
if (permissionReadExternal != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, TAG_READ_EXTERNAL_STORAGE);
return;
}
loadDatabases();
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
switch (requestCode) {
case TAG_WRITE_EXTERNAL_STORAGE: {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
changeProgressBarVisibility(true);
checkMyPermissions();
} else {
Toast.makeText(this, getString(R.string.write_permission_denied), Toast.LENGTH_SHORT).show();
finish();
}
return;
}
case TAG_READ_EXTERNAL_STORAGE: {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
changeProgressBarVisibility(true);
checkMyPermissions();
} else {
Toast.makeText(this, getString(R.string.read_permission_denied), Toast.LENGTH_SHORT).show();
finish();
}
}
}
}
private void goToProfile() {
databaseReference.child("USERS").addListenerForSingleValueEvent(new ValueEventListener() {
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
changeProgressBarVisibility(false);
try {
Class user;
if (dataSnapshot.child("DEPO/" + rootName).exists())
user = DepoProfile.class;
else if (dataSnapshot.child("SELLER/" + rootName).exists())
user = SellerProfile.class;
else if (dataSnapshot.child("BUYER/" + rootName).exists())
user = BuyerProfile.class;
else return;
Intent intent = new Intent(getBaseContext(), user);
intent.putExtra("profile_name", user);
finish();
startActivity(intent);
} catch (Exception e) {
changeProgressBarVisibility(false);
firebaseAuth.signOut();
Toast.makeText(getBaseContext(), R.string.maybe_profile_data_wrong, Toast.LENGTH_SHORT).show();
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
changeProgressBarVisibility(false);
Toast.makeText(getBaseContext(), R.string.error_check_internet, Toast.LENGTH_SHORT).show();
}
});
}
private void userLogIn() {
String email = editTextEmail.getText().toString().trim();
String password = editTextPassword.getText().toString().trim();
if (TextUtils.isEmpty(email)) {
Toast.makeText(this, R.string.enter_email, Toast.LENGTH_SHORT).show();
return;
} else email += "@mail.ru";
if (TextUtils.isEmpty(password)) {
Toast.makeText(this, R.string.enter_password, Toast.LENGTH_SHORT).show();
return;
}
firebaseAuth = FirebaseAuth.getInstance();
changeProgressBarVisibility(true);
firebaseAuth.signInWithEmailAndPassword(email, password).addOnCompleteListener(this, task -> {
if (task.isSuccessful()) {
loadDatabases();
} else {
changeProgressBarVisibility(false);
SharedClass.showSnackBar(activity, getString(R.string.incorrect_email));
}
}).addOnFailureListener(Throwable::printStackTrace);
}
@Override
public void onClick(View view) {
if (view == buttonAboutUs) {
startActivity(new Intent(this, AboutUsActivity.class));
}
if (view == buttonSignIn) {
userLogIn();
}
if (view == textViewSignUp) {
startActivity(new Intent(this, SignUp.class));
}
}
@Override
protected void onDestroy() {
super.onDestroy();
if (timer != null) timer.cancel();
}
private void changeProgressBarVisibility(boolean b) {
progressBar.setVisibility(b ? View.VISIBLE : View.GONE);
buttonSignIn.setEnabled(!b);
}
} | [
"[email protected]"
] | |
58afbdf1fe6bbdd33f1036a5b376c69d5b7c3d8c | 70c975e7ecb7db38a629a3d56d355e04a0ce277a | /src/main/java/co/com/choucair/certification/retotecnico/userinterface/DatosPasoTres.java | b4dfcecea0978299ee9c58ab1496c305b9fd5339 | [] | no_license | Pedrocr11/Retotecnico | b7350307bcfd327a898f828b1bdcdef10cff2148 | ddd48e8f7684f88f14ee2cb2075f362ca4dca4d6 | refs/heads/master | 2023-04-15T18:24:02.428125 | 2021-04-20T04:54:48 | 2021-04-20T04:54:48 | 358,445,093 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,581 | java | package co.com.choucair.certification.retotecnico.userinterface;
import net.serenitybdd.screenplay.targets.Target;
import org.openqa.selenium.By;
public class DatosPasoTres {
public static final Target CLICK_YOUR_COMPUTER = Target.the("click en la opcion your computer")
.located(By.xpath("//*[@id=\"web-device\"]/div[1]/div[2]/div/div[1]/span/span[2]"));
public static final Target INPUT_COMPUTER = Target.the("selecciona el tipo de computadora")
.located(By.xpath("//*[@id=\"web-device\"]/div[1]/div[2]/div/input[1]"));
public static final Target VERSION = Target.the("click en la opcion version")
.located(By.xpath("//*[@id=\"web-device\"]/div[2]/div[2]/div/div[1]/span/span[1]"));
public static final Target INPUT_VERSION = Target.the("selecciona la version")
.located(By.xpath("//*[@id=\"web-device\"]/div[2]/div[2]/div/input[1]"));
public static final Target CLICK_LANGUAGE = Target.the("click en la opcion seleccionar lenguaje")
.located(By.xpath("//*[@id=\"web-device\"]/div[3]/div[2]/div/div[1]/span/span[1]"));
public static final Target INPUT_LANGUAGE = Target.the("selecciona el lenguaje")
.located(By.xpath("//*[@id=\"web-device\"]/div[3]/div[2]/div/input[1]"));
public static final Target CLICK_DISP = Target.the("click en la opcion seleccionar dispositivo")
.located(By.xpath("//*[@id=\"mobile-device\"]/div[1]/div[2]/div/div[1]/span/i"));
public static final Target INPUT_DISP = Target.the("selecciona el dispositivo")
.located(By.xpath("//*[@id=\"mobile-device\"]/div[1]/div[2]/div/input[1]"));
public static final Target CLICK_MODEL = Target.the("click en la opcion seleccionar model")
.located(By.xpath("//*[@id=\"mobile-device\"]/div[2]/div[2]/div/div[1]/span"));
public static final Target INPUT_MODEL = Target.the("selecciona el modelo")
.located(By.xpath("//*[@id=\"mobile-device\"]/div[2]/div[2]/div/input[1]"));
public static final Target CLICK_SYSTEM = Target.the("click en la opcion seleccionar sistema operativo")
.located(By.xpath("//*[@id=\"mobile-device\"]/div[3]/div[2]/div/div[1]/span"));
public static final Target INPUT_SYSTEM = Target.the("selecciona el sistema operativo")
.located(By.xpath("//*[@id=\"mobile-device\"]/div[3]/div[2]/div/input[1]"));
public static final Target NEXT3 = Target.the("siguiente ventana de registro")
.located(By.xpath("//*[@id=\"regs_container\"]/div/div[2]/div/div[2]/div/div[2]/div/a"));
}
| [
"[email protected]"
] | |
53242590c21f3fa6f76db420313cd367d04ca359 | 85c49bcf9c881e14997e3e38972959ebaedd9265 | /src/com/coding/practice/BullsCows.java | a10ba454b02b415409d24f76bcfe6100db2a14ff | [] | no_license | anujassal/CodingPractice | 02215ade7e5bbf1b6a3c1531f4d000b51a6b4667 | f067726834718641bba016c2cf5718a0b59e5205 | refs/heads/master | 2020-11-27T04:05:03.751169 | 2020-01-21T15:48:49 | 2020-01-21T15:48:49 | 229,297,736 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 987 | java | package com.coding.practice;
import java.util.HashMap;
import java.util.Map;
/*
* Input: secret = "1807", guess = "7810"
Output: "1A3B"
*/
public class BullsCows {
public static void main(String[] args){
String secret = "1123";
String guess = "0111";
System.out.println(getHint(secret,guess));
}
private static String getHint(String secret,String guess){
if(secret==null||guess==null)
return "";
if(secret!=null && guess!=null && secret.length()!=guess.length())
return "";
Map<String,Integer> count = new HashMap<>();
for(int i=0;i<secret.length();i++){
char s = secret.charAt(i);
char g = guess.charAt(i);
if(s==g)
count.put("A", count.getOrDefault("A", 0)+1);
else
count.put("B", count.getOrDefault("B", 0)+1);
}
StringBuilder builder = new StringBuilder();
for(Map.Entry<String, Integer> entry:count.entrySet()){
builder.append(entry.getValue());
builder.append(entry.getKey());
}
return builder.toString();
}
}
| [
"[email protected]"
] | |
98f776d5ce2c3a24b0f395097788f85d07b7574a | b7fc25dc46d2f0315afa3e8e5c642652ca7826c0 | /single-table-tools1.0/src/com/qieren/tool/util/.svn/text-base/ConfigUtil.java.svn-base | dc26b4dcd59a1cfaf7b44872e6388910a75ea8af | [] | no_license | liulei0225/single-table-tools | 36ab280417192eacb99ae0b4fb83c4392c5d7fc1 | 4924c5fbecab2ccec84ee22974d50a837d00b26a | refs/heads/master | 2021-05-02T12:01:06.568678 | 2018-02-08T09:34:17 | 2018-02-08T09:34:17 | 120,734,434 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 817 | package com.qieren.tool.util;
import java.io.IOException;
import java.util.Properties;
/**
* @author qieren
* @version 1.0
* @since 2013-11-04
*/
public class ConfigUtil {
private static Properties properties;
private static Properties getProperties() {
if (properties == null) {
Properties _properties = new Properties();
try {
_properties.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("common-config.properties"));
} catch (IOException e) {
throw new RuntimeException(e);
}
properties = _properties;
}
return properties;
}
public static String get(String key) {
return getProperties().getProperty(key);
}
}
| [
"[email protected]"
] | ||
494d8b0aa4336f779907ae76eecb0cbe5732d7f7 | 2dafa875d0d2a03ce75ca20e0da8af40bf8d8da2 | /bibliotheque/webAppliBiblio/src/main/java/fr/khady/webAppliBiblio/action/GestionOuvrageAction.java | e2593965341e8e1ca4c6698b7c1b19636b8c8ae8 | [] | no_license | MyOpenClassrooms/Biblio | e4877fe62e0194ff3d91acf3407ed130fcb78d81 | d3bdee4d2f13170f49bb530519cb737401d8fcbb | refs/heads/master | 2020-04-02T18:12:09.654282 | 2018-12-27T13:26:12 | 2018-12-27T13:26:12 | 154,690,458 | 0 | 0 | null | 2018-10-25T15:00:46 | 2018-10-25T15:00:45 | null | UTF-8 | Java | false | false | 3,940 | java | package fr.khady.webAppliBiblio.action;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Map;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
import org.apache.struts2.interceptor.SessionAware;
import org.jasypt.util.password.StrongPasswordEncryptor;
import com.opensymphony.xwork2.ActionSupport;
import fr.khady.wsBiblioClient.Auteur;
import fr.khady.wsBiblioClient.BibliothequeException;
import fr.khady.wsBiblioClient.Exemplaire;
import fr.khady.wsBiblioClient.ExemplaireService;
import fr.khady.wsBiblioClient.ExemplaireService_Service;
import fr.khady.wsBiblioClient.Ouvrage;
import fr.khady.wsBiblioClient.OuvrageService;
import fr.khady.wsBiblioClient.OuvrageService_Service;
import fr.khady.wsBiblioClient.Reservation;
import fr.khady.wsBiblioClient.ReservationService;
import fr.khady.wsBiblioClient.ReservationService_Service;
import fr.khady.wsBiblioClient.Utilisateur;
public class GestionOuvrageAction extends ActionSupport {
private static final long serialVersionUID = -4423447871500036097L;
private Long idOuvrage;
private String titre;
private String isbn;
private String nomAuteur;
private Boolean dispo;
public Ouvrage ouvrage = new Ouvrage();
public Auteur auteur = new Auteur();
public Exemplaire exemplaire = new Exemplaire();
public Utilisateur utilisateur = new Utilisateur();
public List<Ouvrage> ouvrages;
// private Date dateRetourPrevu;
XMLGregorianCalendar dateRetourPrevu;
OuvrageService_Service service = new OuvrageService_Service();
OuvrageService ouvragePort = service.getOuvrageServicePort();
ExemplaireService_Service serviceEx = new ExemplaireService_Service();
ExemplaireService exemplairePort = serviceEx.getExemplaireServicePort();
ReservationService_Service serviceResa = new ReservationService_Service();
ReservationService reservationPort = serviceResa.getReservationServicePort();
public List<Reservation> reservations;
public String index() {
titre = ouvrage.getTitre();
isbn = ouvrage.getIsbn();
nomAuteur = auteur.getNom();
dispo = ouvrage.isDisponibilite();
System.out.println("dispo " + dispo);
ouvrages = ouvragePort.listerOuvrage();
if (titre == null && isbn == null && nomAuteur == null && dispo == null) {
ouvrages = ouvragePort.listerOuvrage();
// this.addActionMessage("AUCUN Result pour la recherche");
} else {
try {
ouvrages = ouvragePort.trouverOuvrageParIsbnTitreAuteur(isbn, titre, nomAuteur, dispo);
} catch (Exception pEx) {
this.addActionMessage("AUCUN OUVRAGE");
}
}
if (ouvrages.isEmpty()) {
this.addActionMessage("Aucun ouvrage");
}
return SUCCESS;
}
public String doDetail() {
idOuvrage = ouvrage.getIdOuvrage();
try {
ouvrage = ouvragePort.trouverOuvrageParId(idOuvrage);
reservations = reservationPort.trouverReservationParOuvrage(ouvrage);
exemplaire = exemplairePort.trouverExemplaireParOuvrage(idOuvrage);
dateRetourPrevu = reservationPort.dateRetourPrevu(idOuvrage);
} catch (BibliothequeException e) {
e.printStackTrace();
}
return SUCCESS;
}
public List<Reservation> getReservations() {
return reservations;
}
public void setReservations(List<Reservation> reservations) {
this.reservations = reservations;
}
public XMLGregorianCalendar getDateRetourPrevu() {
return dateRetourPrevu;
}
public void setDateRetourPrevu(XMLGregorianCalendar dateRetourPrevu) {
this.dateRetourPrevu = dateRetourPrevu;
}
// public String listeParTitre() {
// // String vResult = ActionSupport.INPUT;
// titre = ouvrage.getTitre();
// System.out.println("titre " + titre);
// if (titre != null) {
// try {
// ouvrages = ouvragePort.trouverOuvrageParTitre(titre);
//
// } catch (Exception pEx) {
// this.addActionMessage("AUCUN OUVRAGE");
// }
//
// }
// return SUCCESS;
// }
}
| [
"[email protected]"
] | |
f7c8275aa5acc725db695d720613d7edbf657ff1 | 17bd1959f27bf667cbf349b6c180ceea8692e502 | /house-biz/src/main/java/com/ryan/house/biz/pojo/HouseUser.java | bfdbb6794c00cc5163b00e46d2a4b9f5f86bd58e | [] | no_license | ryangogo/houses | 570c2cf13ed5fe9b25049d6822f0fd12de20dc91 | 57e83944eb8f3792a1aa1e666a292c662261aa09 | refs/heads/master | 2020-03-20T08:17:47.068670 | 2018-06-19T08:12:57 | 2018-06-19T08:12:57 | 137,304,312 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,816 | java | package com.ryan.house.biz.pojo;
import java.util.Date;
public class HouseUser {
private Long id;
/**
* 房屋id
*/
private Long houseId;
/**
* 用户id
*/
private Long userId;
/**
* 创建时间
*/
private Date createTime;
/**
* 1:售卖,2:收藏
*/
private Boolean type;
/**
* @return id
*/
public Long getId() {
return id;
}
/**
* @param id
*/
public void setId(Long id) {
this.id = id;
}
/**
* 获取房屋id
*
* @return house_id - 房屋id
*/
public Long getHouseId() {
return houseId;
}
/**
* 设置房屋id
*
* @param houseId 房屋id
*/
public void setHouseId(Long houseId) {
this.houseId = houseId;
}
/**
* 获取用户id
*
* @return user_id - 用户id
*/
public Long getUserId() {
return userId;
}
/**
* 设置用户id
*
* @param userId 用户id
*/
public void setUserId(Long userId) {
this.userId = userId;
}
/**
* 获取创建时间
*
* @return create_time - 创建时间
*/
public Date getCreateTime() {
return createTime;
}
/**
* 设置创建时间
*
* @param createTime 创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取1:售卖,2:收藏
*
* @return type - 1:售卖,2:收藏
*/
public Boolean getType() {
return type;
}
/**
* 设置1:售卖,2:收藏
*
* @param type 1:售卖,2:收藏
*/
public void setType(Boolean type) {
this.type = type;
}
} | [
"[email protected]"
] | |
482a57d36a60849ca6c7fe5ebbb35bbf806e6719 | e8961003a724cf08cdf0ead9d45b53a14038fc2c | /app/src/main/java/classact/com/xprize/database/helper/LetterSequenceHelper.java | 9a88733eb4cc2880c3e404ca3535330934f8d9c9 | [] | no_license | classact/XPrize | 5b7f60e3cfd5e7c610949ed391ab5121d4e3ece0 | f7b8e3928dba59d581f78c40c290f2a6c05dbb67 | refs/heads/master | 2021-01-24T12:12:11.233937 | 2018-02-22T18:08:01 | 2018-02-22T18:08:01 | 58,711,608 | 1 | 0 | null | 2018-02-22T18:08:02 | 2016-05-13T07:18:11 | Java | UTF-8 | Java | false | false | 3,002 | java | package classact.com.xprize.database.helper;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import java.util.ArrayList;
import classact.com.xprize.database.model.LetterSequence;
public class LetterSequenceHelper {
public static ArrayList<LetterSequence> getLetterSequence(SQLiteDatabase db, int languageID, int unitId, int subId) {
ArrayList<LetterSequence> letterSequences = new ArrayList<>();
String[] columns = new String[]{"_id", "LanguageID", "UnitID", "UnitSubID", "letterID"};
String OrderBy = "_id asc";
Cursor cursor = db.query("tbl_lettersequence", columns, "LanguageID=? AND UnitID=? AND UnitSubID=?", new String[]{String.valueOf(languageID), String.valueOf(unitId), String.valueOf(subId)}, null, null, OrderBy);
LetterSequence sequence = new LetterSequence();
if (cursor.moveToFirst()) {
do {
sequence = new LetterSequence();
sequence.setLanguageID(cursor.getInt(0));
sequence.setSequenceID(cursor.getInt(1));
sequence.setUnitID(cursor.getInt(2));
sequence.setSubUnitID(cursor.getInt(3));
sequence.setLetterID(cursor.getInt(4));
letterSequences.add(sequence);
} while (cursor.moveToNext());
}
cursor.close();
return letterSequences;
}
public static int getLetterID (SQLiteDatabase db, int languageID, int unitId, int subId) throws SQLiteException {
String[] columns = new String[]{"LetterID"};
String OrderBy = "_id asc";
Cursor cursor = db.query("tbl_LetterSequence", columns, "LanguageID=? AND UnitID=? AND UnitSubID=?", new String[]{String.valueOf(languageID), String.valueOf(unitId), String.valueOf(subId)}, null, null, OrderBy);
int letterID = 0;
try {
if (cursor.getCount()>0) {
cursor.moveToFirst();
letterID = cursor.getInt(cursor.getColumnIndex("LetterID"));
}
return letterID;
}finally {
cursor.close();
}
}
public static ArrayList getWrongLetters(SQLiteDatabase db, int languageID, int unitId, int limit){
ArrayList letters = new ArrayList();
Cursor cursor = db.rawQuery("SELECT LetterID FROM tbl_LetterSequence where LanguageID = "+languageID+" and UnitID <> " + unitId + " ORDER BY RANDOM() LIMIT " + limit +";", null);
//LetterSequence letterSequence = new LetterSequence();
int letterSequence = 0;
try {
if (cursor.moveToFirst()) {
do {
//letterSequence = new LetterSequence();
letterSequence = cursor.getInt(0);
letters.add(letterSequence);
} while (cursor.moveToNext());
}
return letters;
}finally {
cursor.close();
}
}
}
| [
"[email protected]"
] | |
a0dc2024002975ca3a883db1277f3a7915f3ea9e | 82845020e1f0efeeaa1adef456091915150e534e | /13PrimeNumber/src/prime/PrimeNumber.java | 3303ef7eb9b46d643c8f4536e60ea4742a9f1239 | [] | no_license | nazneenbee/PlacementPrepareCode | 11a1ad96fb2d0b5b205d3f46b774d6142ed51382 | 5e8950c6c4501045ad6be417c5dd401af03c60ff | refs/heads/main | 2023-03-01T08:09:19.912752 | 2021-02-03T16:50:27 | 2021-02-03T16:50:27 | 335,684,819 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 590 | java | package prime;
import java.util.Scanner;
public class PrimeNumber {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
System.out.println("enter a number");
int num=sc.nextInt();
int count=0;
if(num==1)
{
System.out.println("not a prime not a composite");
}
else if(num>=2)
{
for(int i=2; i<num; i++)
{
if(num%i==0)
{
count++;
}
}
if(count>0)
{
System.out.println("number is not prime");
}
else
{
System.out.println("number is prime");
}
}
}
}
| [
"[email protected]"
] | |
300f4e7900c74ad3e8a0df8dbdd78b9d9227af08 | 71e8c35d8620ef64f29276514f2177b7bbfd0aac | /gdpdu-models/src/main/java/com/opencore/gdpdu/index/models/DataType.java | 2f4e948e69b61ecc90d0e28ba5c47f80ed3c3afd | [
"Apache-2.0"
] | permissive | Malte-Neu/gdpdu-java | c2b1022aa81047420d34d52036ce7b84534ec963 | c887d4cebc23ac760f46de468540924050dd93ed | refs/heads/master | 2023-01-02T12:26:54.365426 | 2020-08-12T07:06:12 | 2020-08-12T07:06:12 | 298,536,381 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 890 | java | /*
* Licensed to OpenCore GmbH & Co. KG under one or more contributor license agreements.
* See the NOTICE file distributed with this work for additional information regarding copyright ownership.
* OpenCore GmbH & Co. KG licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and limitations under the License.
*/
package com.opencore.gdpdu.index.models;
public enum DataType {
Numeric,
AlphaNumeric,
Date
}
| [
"[email protected]"
] | |
8b29aa530cbc08ac247cab839dbba2d8bb59c299 | 169d3b6f77236c9e028e8f6264bd5ae4817d2740 | /src/objects/LoggedInUser.java | 199ccd53a027f6c9afcc5d3055eacfb4cc933f38 | [] | no_license | Orinta92/ProjectJava | b1cf0adb2f50ac3c186b612ecc2544897e804b92 | 33c32100cea5b5e948cf941e41911e63d89e1e37 | refs/heads/master | 2020-12-15T16:15:11.969239 | 2020-01-20T19:15:09 | 2020-01-20T19:15:09 | 235,173,415 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 84 | java | package objects;
public class LoggedInUser {
public static int userId;
}
| [
"[email protected]"
] | |
25de96909a9ae03b44107e58a84ab95be45086f8 | a87356e29b4d7457079558b489ecdb4e901ab2d2 | /app/src/main/java/com/example/sesion1/WeatherClouds.java | dbecdfccc35f2413cb9c0e11e8b4d76e8b8e2ea5 | [] | no_license | rossvillcol/Test1 | 0610e4ca93d3e2512e44b693a78647c6fa9e6054 | 122d32cedb6165c15c2eb1298f0c4a29d76cfb4f | refs/heads/master | 2023-03-07T02:45:37.238744 | 2021-02-12T19:16:05 | 2021-02-12T19:16:05 | 338,408,443 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 212 | java | package com.example.sesion1;
public class WeatherClouds {
private Integer all;
public Integer getAll() {
return all;
}
public void setAll(Integer all) {
this.all = all;
}
}
| [
"[email protected]"
] | |
dae2494456b849339e528c9abcad75d28a7abc6e | 6f461acdb4dc2f2667c8682ff50c612096405570 | /logserver/src/main/java/com/gaea/game/log/LogService.java | b19746d3ecf1b538ebcb339c0da76d81389cb170 | [] | no_license | ymw520369/gaeagame | f1584aa3d5dd5a186b3318ea3530d2b5814b3749 | 0e989a1fc57a9221d230cc1e2e465fa6c3bedbc3 | refs/heads/master | 2021-01-19T18:49:09.886818 | 2017-10-09T10:18:20 | 2017-10-09T10:18:20 | 101,168,005 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,237 | java | package com.gaea.game.log;
import com.alibaba.dubbo.config.annotation.Service;
import com.alibaba.fastjson.JSON;
import com.gaea.game.core.log.ILogService;
import com.mongodb.BasicDBObject;
import com.mongodb.DBCollection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import java.util.Map;
/**
* Created on 2017/9/8.
*
* @author Alan
* @since 1.0
*/
@Service(version = "1.0.0")
public class LogService implements ILogService {
Logger log = LoggerFactory.getLogger(LogService.class);
//@Autowired
//RecordManager recordManager;
@Autowired
MongoTemplate mongoTemplate;
@Override
public boolean log(Map<String, Object> map) {
log.info("收到日志消息,map=" + JSON.toJSONString(map));
if (map == null || map.isEmpty()) {
log.warn("消息数据为空");
return true;
}
String dbName = map.get("name").toString();
DBCollection collection = mongoTemplate.getCollection(dbName);
BasicDBObject dbObject = new BasicDBObject(map);
collection.insert(dbObject);
return true;
}
}
| [
"[email protected]"
] | |
921e9db0cc4e63366de1ab888dac315ef71281ea | c81fdd83743502a5de7da45b8bbaf6a06825f9bf | /src/MinUnitLengthIntervals.java | 764899bb8c2e6dcb552e81e3ea14b831e860a0ca | [] | no_license | delahiri/Greedy-Algorithm | 179fbb0770da499e9e67a6d06edc06056e78c150 | c04de498c7f665599f27e56baebff15ebe481f52 | refs/heads/master | 2021-01-10T11:56:37.198204 | 2015-10-16T19:49:39 | 2015-10-16T19:49:39 | 43,195,355 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,210 | java | import java.util.ArrayList;
import java.util.List;
public class MinUnitLengthIntervals {
public static void main(String[] args) {
double []a = {0.7,1.0,1.5,2.0,2.3,2.6,3.1,3.6,3.9,4.2,4.7,5.2,5.5};
quickSort(a,0,a.length-1);
List<ArrayList<Double>> lines = new ArrayList<ArrayList<Double>>();
ArrayList<Double> oneLine = new ArrayList<Double>();
double upto = a[0]+1.0f;
oneLine.add(a[0]);
for(int i= 1;i<a.length;i++)
{
if(a[i]<=upto)
{
oneLine.add(a[i]);
}
else
{
lines.add(oneLine);
oneLine = new ArrayList<Double>();
upto = a[i]+1.0f;
oneLine.add(a[i]);
}
}
lines.add(oneLine);
for(List<Double> p:lines)
{
for(Double n: p)
System.out.print(n+",");
System.out.println();
}
}
private static void quickSort(double[] a,int start, int end)
{
int i = start, j=end;
double pivot = a[(i+j)/2];
while(i<=j)
{
while(a[i]<pivot)
{
i++;
}
while(a[j]>pivot)
{
j--;
}
if(i<=j)
{
double temp = a[i];
a[i] = a[j];
a[j] = temp;
i++;
j--;
}
}
if(start < i-1)
quickSort(a, start, i-1);
if(end > i)
quickSort(a, i, end);
}
}
| [
"[email protected]"
] | |
6018c6818fd28d796f2c0b674821cd15aa005187 | d9040b2ed27469dbefe1df4425c143f985a0f0cf | /app/src/androidTest/java/com/chemanman/gson/ExampleInstrumentedTest.java | 1226772e079e4fc46499763f6e670f9c4c797c4c | [] | no_license | zkdengta/MGson | 0746a87a7dd376e719a742247931cc3c9c9a205d | a724feceb9c43c6caacde1f86155a55342c68fc0 | refs/heads/master | 2021-01-26T16:31:44.754274 | 2018-01-31T06:57:37 | 2018-01-31T06:57:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 740 | java | package com.chemanman.gson;
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("com.chemanman.gson", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
d12a94f6f3da41e2669efeb2bfd51ea311f8412f | 69ec9597118e13de103d0a4e314a1cb2141a25fa | /src/de/msiggi/sportsdata/webservices/GetMatchdataByGroupLeagueSaison.java | 272814ab2e4d2b6e9a0ae5b5c4f814d1cebe878f | [] | no_license | ralfp1979/amazonas-project | 9ef2e320d5e6be10922ead3b04efecafededf1f0 | f5f688b9bfac5c889ca23684ff46246d158d06af | refs/heads/master | 2020-04-18T07:57:53.295519 | 2014-02-05T20:33:04 | 2014-02-05T20:33:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,609 | java |
package de.msiggi.sportsdata.webservices;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="groupOrderID" type="{http://www.w3.org/2001/XMLSchema}int"/>
* <element name="leagueShortcut" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="leagueSaison" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"groupOrderID",
"leagueShortcut",
"leagueSaison"
})
@XmlRootElement(name = "GetMatchdataByGroupLeagueSaison")
public class GetMatchdataByGroupLeagueSaison {
protected int groupOrderID;
protected String leagueShortcut;
protected String leagueSaison;
/**
* Gets the value of the groupOrderID property.
*
*/
public int getGroupOrderID() {
return groupOrderID;
}
/**
* Sets the value of the groupOrderID property.
*
*/
public void setGroupOrderID(int value) {
this.groupOrderID = value;
}
/**
* Gets the value of the leagueShortcut property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLeagueShortcut() {
return leagueShortcut;
}
/**
* Sets the value of the leagueShortcut property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLeagueShortcut(String value) {
this.leagueShortcut = value;
}
/**
* Gets the value of the leagueSaison property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLeagueSaison() {
return leagueSaison;
}
/**
* Sets the value of the leagueSaison property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLeagueSaison(String value) {
this.leagueSaison = value;
}
}
| [
"[email protected]"
] | |
49746586e1001c82bb828ba99e1b8a527386dddc | 52b86673434cf5cee879f69682d8e2a130704c3f | /JSP1127/MemberBoard/src/controller/JoinController.java | 710461b1a828271f20be6f38f969068af15a5f09 | [] | no_license | Dan-Doit/JAVA_Practice | 3c3e17e9ecf39c101976f7a7087a91d557b997f1 | b4d5af939e194b1dfb50a3ff4e8bb571b546d500 | refs/heads/master | 2023-02-08T09:39:38.083310 | 2020-12-27T06:51:46 | 2020-12-27T06:51:46 | 295,732,796 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,268 | java | package controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import dto.memberDTO;
import service.MemberService;
@WebServlet("/memberJoin")
public class JoinController extends HttpServlet {
private static final long serialVersionUID = 1L;
public JoinController() {
super();
// TODO Auto-generated constructor stub
}
protected void doProcess(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("1.controller");
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=UTF-8");
// jsp에서 받아온 정보들
String userId = request.getParameter("userId");
String userPw = request.getParameter("userPw");
String userName = request.getParameter("userName");
String userBirth = request.getParameter("userBirth");
String userGender = request.getParameter("userGender");
String userEmail = request.getParameter("userEmail");
// dto와 service import
memberDTO member = new memberDTO();
MemberService joinsvc = new MemberService();
// jsp에서 넘어온 정보를
// dto 타입인 member에 저장
member.setUserId1(userId);
member.setUserPw(userPw);
member.setUserName(userName);
member.setUserBirth(userBirth);
member.setUserGender(userGender);
member.setUserEmail(userEmail);
// member의 정보를 가지고 service로 이동
int result = joinsvc.memberJoin(member);
// service에서 return 받은 값
System.out.println("7.controller : " + result);
if(result>0) {
response.sendRedirect("JoinSuccess.jsp");
} else {
response.sendRedirect("JoinFail.jsp");
}
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doProcess(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doProcess(request, response);
}
}
| [
"[email protected]"
] | |
7fd59a2c91ebac2be60212d4bc32395f40b98272 | 288edf7e72db46d213ca2ead631bdd65dbbfa792 | /app/src/main/java/com/pradipatle/androidkt/MainHomeAcitity.java | 6baf6b3c2afe5653adc14ea3046cba7c6d3699d0 | [] | no_license | pradippatle/InterviewQuestionApp | 12d713032735445a27ee18acf29f37ccbc0bded4 | 57d503108f418ab6baf41d943440308f42f12785 | refs/heads/master | 2021-07-09T13:37:32.677597 | 2017-10-09T14:26:11 | 2017-10-09T14:26:11 | 105,876,182 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,699 | java | package com.pradipatle.androidkt;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.LinearLayout;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.pradipatle.androidkt.Android.AndroidActivity;
import com.pradipatle.androidkt.Java.JavaActivity;
/**
* Created by Aeon-02 on 10/9/2017.
*/
public class MainHomeAcitity extends AppCompatActivity implements View.OnClickListener{
LinearLayout MenuAndroid, MenuJava;
private AdView mAdView;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.home_acivity);
mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
MenuAndroid = (LinearLayout)findViewById(R.id.id_android_menu);
MenuJava = (LinearLayout)findViewById(R.id.id_java_menu);
MenuAndroid.setOnClickListener(this);
MenuJava.setOnClickListener(this);
}
@Override
public void onClick(View v) {
int i = v.getId();
switch (i){
case R.id.id_android_menu :
Intent iAndroid = new Intent(MainHomeAcitity.this, AndroidActivity.class);
startActivity(iAndroid);
break;
case R.id.id_java_menu :
Intent iJava = new Intent(MainHomeAcitity.this, JavaActivity.class);
startActivity(iJava);
break;
}
}
}
| [
"[email protected]"
] | |
1be7bd61c7b4d31551fddf32c0abb8008c250c01 | 5223a8e64af1c571b39dbf0319407d9727526cbd | /oims-sys/src/main/java/com/wms/web/shop/model/catalog/Attribute.java | 918e2835cc598dd151139d6985501b8eaec97c21 | [] | no_license | repo-upadhyay/oims | 32bb56e2837e00e28f79d66bf13b0b74a5c70ef5 | 57ac044e724fa7de8d412086659ebf731a1ef407 | refs/heads/master | 2020-03-31T02:27:31.810973 | 2016-06-26T19:08:23 | 2016-06-26T19:08:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,145 | java | package com.wms.web.shop.model.catalog;
import java.io.Serializable;
import java.util.List;
import com.wms.web.entity.ShopEntity;
public class Attribute extends ShopEntity implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private String name = null;
private String type = null;
private String code = null;
private List<AttributeValue> values = null;
private AttributeValue readOnlyValue = null;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public void setValues(List<AttributeValue> values) {
this.values = values;
}
public List<AttributeValue> getValues() {
return values;
}
public void setCode(String code) {
this.code = code;
}
public String getCode() {
return code;
}
public void setReadOnlyValue(AttributeValue readOnlyValue) {
this.readOnlyValue = readOnlyValue;
}
public AttributeValue getReadOnlyValue() {
return readOnlyValue;
}
}
| [
"[email protected]"
] | |
6ed805847a4bfc0c179839a20835f1291cc8da53 | bb799850c9c16e525b814732a46640ada33fa984 | /src/main/java/com/francisco/loja/dao/CarrinhoDAO.java | d05ff395dda6c5056c1fb47043bda1bb8e682efe | [] | no_license | francsousa/webservices-rest-com-jaxrs-e-jersey | e10ec7cd4e2fb14edb6be53b2b1315e171e471a9 | 92e93fce0205154278eb2506066fbcc4c31c2f91 | refs/heads/master | 2023-03-06T00:33:28.268306 | 2021-02-22T14:06:39 | 2021-02-22T14:06:39 | 337,219,794 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 990 | java | package com.francisco.loja.dao;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
import com.francisco.loja.modelo.Carrinho;
import com.francisco.loja.modelo.Produto;
public class CarrinhoDAO {
private static Map<Long, Carrinho> banco = new HashMap<Long, Carrinho>();
private static AtomicLong contador = new AtomicLong(1);
static {
Produto videogame = new Produto(6237, "Videogame 4", 4000, 1);
Produto esporte = new Produto(3467, "Jogo de esporte", 60, 2);
Carrinho carrinho = new Carrinho()
.adiciona(videogame)
.adiciona(esporte)
.para("Rua Vergueiro 3185, 8 andar", "São Paulo")
.setId(1l);
banco.put(1l, carrinho);
}
public void adiciona(Carrinho carrinho) {
long id = contador.incrementAndGet();
carrinho.setId(id);
banco.put(id, carrinho);
}
public Carrinho busca(Long id) {
return banco.get(id);
}
public Carrinho remove(long id) {
return banco.remove(id);
}
}
| [
"[email protected]"
] | |
879779c742dd1d6b4c12b6bb50581478afd47263 | 69a4f2d51ebeea36c4d8192e25cfb5f3f77bef5e | /methods/Method_22218.java | cf7e69c6739263d7e81c3b1203ab1dc4f0df5b66 | [] | no_license | P79N6A/icse_20_user_study | 5b9c42c6384502fdc9588430899f257761f1f506 | 8a3676bc96059ea2c4f6d209016f5088a5628f3c | refs/heads/master | 2020-06-24T08:25:22.606717 | 2019-07-25T15:31:16 | 2019-07-25T15:31:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 232 | java | private void collectSize(@NonNull Display display,@NonNull JSONObject container) throws JSONException {
final Point size=new Point();
display.getSize(size);
container.put("size",new JSONArray(Arrays.asList(size.x,size.y)));
}
| [
"[email protected]"
] | |
5f42cb29b22a865f91c98273215d3b883d647828 | b37e602ba28f039563b43ed36c264d631916b2f4 | /app/src/main/java/com/example/proyectoregistropersonal/database/DatabaseHelper.java | 85d654a183503c581c2b02ddb66ad828c09ee459 | [] | no_license | juver1212/ProyectoRegistroPersonal | 66928ed2897792e3cab2c75a485c72db98cdd3a6 | cd609d1e634a1865a650e44a5da003b7aba595e1 | refs/heads/master | 2022-12-24T00:44:01.710191 | 2020-10-02T02:20:23 | 2020-10-02T02:20:23 | 295,249,242 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,461 | java | package com.example.proyectoregistropersonal.database;
/**
* Created by anupamchugh on 19/10/15.
*/
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
public class DatabaseHelper extends SQLiteOpenHelper {
// Table Name
public static final String TABLE_NAME_TRABAJADOR = "trabajadores";
public static final String TABLE_NAME_MARCACION = "trabajadormarcacion";
public static final String TABLE_NAME_USUARIO = "usuario";
public static final String TABLE_NAME_SINCRONIZAR_REGISTRO = "sincronizacion_registro";
// Table columns
public static final String Documento = "Documento";
public static final String Nombres = "Nombres";
public static final String Cargo = "Cargo";
public static final String Sueldo = "Sueldo";
public static final String AsigFam = "AsigFam";
public static final String EntidadFinanciera = "EntidadFinanciera";
public static final String CCI = "CCI";
public static final String NroCuenta = "NroCuenta";
public static final String Categoria = "Categoria";
public static final String CentroCosto = "CentroCosto";
public static final String FechaIngreso = "FechaIngreso";
public static final String FechaCese = "FechaCese";
public static final String Estado = "Estado";
public static final String CodEmpresa = "CodEmpresa";
public static final String Foto = "Foto";
public static final String UsuReg = "UsuReg";
public static final String FecReg = "FecReg";
public static final String UsuMod = "UsuMod";
public static final String FecMod = "FecMod";
public static final String Latitud = "Latitud";
public static final String Longitud = "Longitud";
public static final String Fecha = "Fecha";
public static final String Hora = "Hora";
public static final String Imagen = "Imagen";
// Database Information
public static final String DB_NAME = "REGISTRO.DB";
// database version
static final int DB_VERSION = 1;
// Creating table query
private static final String CREATE_TABLE = "create table " + TABLE_NAME_TRABAJADOR + "("
+ Documento + " TEXT, " + Nombres + " TEXT , " + Cargo + " TEXT, "
+ Sueldo + " REAL, " + AsigFam + " REAL , " + EntidadFinanciera + " TEXT, "
+ CCI + " TEXT, " + NroCuenta + " TEXT , " + Categoria + " TEXT, "
+ CentroCosto + " TEXT, " + FechaIngreso + " TEXT , " + FechaCese + " TEXT, "
+ Estado + " TEXT, " + CodEmpresa + " TEXT , " + Foto + " BLOB, "
+ UsuReg + " TEXT, " + FecReg + " TEXT ,"
+ UsuMod + " TEXT, " + FecMod + " TEXT );";
private static final String CREATE_TABLE_MARCACION = "create table " + TABLE_NAME_MARCACION + "("
+ "id INTEGER PRIMARY KEY AUTOINCREMENT ," + CodEmpresa + " TEXT, " + Documento + " TEXT , " + Fecha + " TEXT, " + Hora + " TEXT, "
+ Latitud + " TEXT, " + Longitud + " TEXT , " + Estado + " TEXT, "
+ Imagen + " BLOB, " + UsuMod + " TEXT , " + FecMod + " TEXT );";
private static final String CREATE_TABLE_USUARIO = "create table " + TABLE_NAME_USUARIO + "("
+ "id INTEGER PRIMARY KEY AUTOINCREMENT, IDUsuario TEXT, USU_CODIGO TEXT, CodEmpresa TEXT, DesEmpresa TEXT," +
"NomUsuario TEXT, ClaveUsuario TEXT, Documento TEXT, TipoUsuario TEXT );";
private static final String CREATE_TABLE_REGISTRO_SINCRONIZACION = "create table " + TABLE_NAME_SINCRONIZAR_REGISTRO + "("
+ "id INTEGER PRIMARY KEY AUTOINCREMENT, Fecha TEXT, Hora TEXT );";
public DatabaseHelper(Context context) {
super(context, DB_NAME, null, DB_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_TABLE);
db.execSQL(CREATE_TABLE_MARCACION);
db.execSQL(CREATE_TABLE_USUARIO);
db.execSQL(CREATE_TABLE_REGISTRO_SINCRONIZACION);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME_TRABAJADOR);
onCreate(db);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME_MARCACION);
onCreate(db);
db.execSQL("DROP TABLE IF EXISTS "+ TABLE_NAME_USUARIO);
onCreate(db);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME_SINCRONIZAR_REGISTRO);
onCreate(db);
}
}
| [
"[email protected]"
] | |
aebd760303c6d71a1ee88e9688b03121c63ba64f | 7be5e0a4b6da61f44191b2213d47e382c69a1e7e | /src/main/java/com/MyBlog/ServiceImpl/UserServiceImpl.java | b43f25be31f17d6db9488b4a360e63def0e30135 | [] | no_license | Beloya/SSM | ab36e11ecb6b9c4f157b4d021034002fbeaeec54 | 87bcd945f2834b2afaad2899d60f7c6c8235174c | refs/heads/master | 2021-07-06T09:10:02.624698 | 2019-03-09T16:29:24 | 2019-03-09T16:29:24 | 143,831,043 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,197 | java | package com.MyBlog.ServiceImpl;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.LockedAccountException;
import org.apache.shiro.authc.UnknownAccountException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.crypto.hash.Md5Hash;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.MyBlog.Dao.UsersMapper;
import com.MyBlog.Service.userService;
import com.MyBlog.entity.Users;
import com.MyBlog.utils.myStringUtils;
import com.github.pagehelper.util.StringUtil;
@Component
public class UserServiceImpl implements userService{
@Resource
private UsersMapper uMapper;
public Users createUser(Users user) {
//加密密码
// passwordHelper.encryptPassword(user);
return user;
}
public void changePassword(Long userId, String newPassword) {
}
public Users FindByUserName(String UserName) {
// TODO Auto-generated method stub
return uMapper.FindByUserName(UserName);
}
public List<Users> FindAll() {
// TODO Auto-generated method stub
return uMapper.FindAll();
}
public Object Login(Users user, String RememberMe) {
Map<String, String> LoginMsg=null;
Subject subject = null;
String passWordmd5=null;
UsernamePasswordToken usernamePasswordToken=null;
try {
LoginMsg=new HashMap<String, String>();
subject = SecurityUtils.getSubject();
passWordmd5 = new Md5Hash(user.getPassWord()).toString();//加密
usernamePasswordToken = new UsernamePasswordToken(user.getUserName(),passWordmd5);
if(RememberMe.equals("on")) {
usernamePasswordToken.setRememberMe(true);
}
subject.login(usernamePasswordToken);
LoginMsg.put("code","0");
LoginMsg.put("msg","登陆成功");
}
catch(UnknownAccountException e){
LoginMsg.put("code","1");
LoginMsg.put("msg","账号或密码错误");
}
catch(IncorrectCredentialsException e){
LoginMsg.put("code","1");
LoginMsg.put("msg","账号或密码错误");
}
catch(LockedAccountException e){
LoginMsg.put("code","1");
LoginMsg.put("msg","账号被锁定");
}
catch (Exception e) {
e.printStackTrace();
LoginMsg.put("code","1");
LoginMsg.put("msg","系统错误");
}
return LoginMsg;
}
public Object CreateUser(Users user) {
Map<String, String> Msg=null;
try {
if(myStringUtils.isIllegalCharacter(user.getUserName())) {
Msg.put("code","500");
Msg.put("msg","用户名含有非法字符");
return Msg;
}
Msg=new HashMap<String, String>();
TimeZone tz = TimeZone.getTimeZone("GMT+8");
TimeZone.setDefault(tz);
String passWordmd5 = new Md5Hash(user.getPassWord()).toString();
user.setRId(4);
user.setCreatorId(0);
user.setUserImg("/images/MyT.jpg");
user.setLocked(1);
user.setSex(3);
user.setCreateDate(new Date());
user.setDataLevel(0);
user.setSalt(passWordmd5);
user.setPassWord(passWordmd5);
uMapper.CreateUser(user);
Msg.put("code","0");
Msg.put("msg","注册成功");
Subject subject = SecurityUtils.getSubject();
UsernamePasswordToken usernamePasswordToken = new
UsernamePasswordToken(user.getUserName(),passWordmd5);
subject.login(usernamePasswordToken);
Login(user, "off");
} catch (Exception e) {
e.printStackTrace();
Msg.put("code","1");
Msg.put("msg","系统错误");
}
return Msg;
}
}
| [
"[email protected]"
] | |
9a020035e603d5249c7eae8bf6940df4c56329d0 | edda4943b9a86946a02e8064d210a82c860f1f4d | /src/main/java/leetcode/lc279/PerfectSquares.java | 500a50243276fd406184f5e213232b04fb135777 | [] | no_license | DehaoWang/lcaj | 2bc8842029d5ffadf762aa9e5207e4f2643e2531 | 0371fef310f2cea0cc131ee12b1b59ffda61133c | refs/heads/master | 2021-06-17T23:39:45.491494 | 2021-01-06T08:55:30 | 2021-01-06T08:55:30 | 130,051,028 | 0 | 0 | null | 2020-10-12T19:52:00 | 2018-04-18T11:19:20 | Java | UTF-8 | Java | false | false | 1,546 | java | package leetcode.lc279;
import java.util.Arrays;
/**
* Created by wangdehao on 19/5/28.
*/
public class PerfectSquares {
public static void main(String[] args) {
for (int i = 0; i < 15; i++) {
System.out.println("i = " + i + ", numSquares = " + numSquares(i));
System.out.println("i = " + i + ", numSquaresFast = " + numSquaresFast(i));
}
}
public static int numSquares(int n) {
if (n <= 1) {
return n;
}
int[] memo = new int[n + 1];
memo[0] = 0;
memo[1] = 1;
for (int i = 2; i < n + 1; i++) {
if (isSquare(i)) {
memo[i] = 1;
continue;
}
memo[i] = Integer.MAX_VALUE;
for (int j = 1; j <= i / 2; j++) {
// i = j + i-j
int count = memo[j] + memo[i - j];
memo[i] = Math.min(memo[i], count);
}
}
return memo[n];
}
private static boolean isSquare(int i) {
double sqrt = Math.sqrt(i);
return sqrt == (int) sqrt;
}
public static int numSquaresFast(int n) {
int[] dp = new int[n + 1];
Arrays.fill(dp, Integer.MAX_VALUE);
dp[0] = 0;
for(int i = 1; i <= n; ++i) {
int min = Integer.MAX_VALUE;
int j = 1;
while(i - j*j >= 0) {
min = Math.min(min, dp[i - j*j] + 1);
j++;
}
dp[i] = min;
}
return dp[n];
}
}
| [
"[email protected]"
] | |
8e9c9798abb98937bd6ca1b8d5c7e0af3de8fc0a | 7e98a58fdf42905a2901507e060c86b991dbc328 | /src/main/java/by/itransition/mathtasksapp/controllers/rest/AnswerController.java | d0fdfdb3bfdbc331574e080d301b7555ba971376 | [] | no_license | missaouib/mathtasksapp | fdd6f0b6ef3db268caef7419cf287c54ae41e5ef | ebcacf8ea916d70ccce51b5e9bd0a740248f5518 | refs/heads/master | 2023-09-02T05:18:56.915362 | 2021-10-19T14:35:06 | 2021-10-19T14:35:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,653 | java | package by.itransition.mathtasksapp.controllers.rest;
import by.itransition.mathtasksapp.models.Task;
import by.itransition.mathtasksapp.services.AnswerService;
import by.itransition.mathtasksapp.services.TaskService;
import by.itransition.mathtasksapp.services.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.security.oauth2.core.user.OAuth2User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class AnswerController {
private final AnswerService answerService;
private final TaskService taskService;
private final UserService userService;
@Autowired
public AnswerController(AnswerService answerService, TaskService taskService, UserService userService) {
this.answerService = answerService;
this.taskService = taskService;
this.userService = userService;
}
@GetMapping("/checkAnswer/{task}")
public boolean checkAnswer(@PathVariable("task") Long task, @RequestParam("answer") String answer,
@AuthenticationPrincipal OAuth2User principal){
Task currentTask=taskService.getById(task);
if(answerService.containsAnswer(currentTask,answer)){
userService.addSolved((Long)principal.getAttributes().get("id"),currentTask);
return true;
}
return false;
}
}
| [
"[email protected]"
] | |
787bccee48d143aef06ba5650c83ba5c221a2692 | 17391171a078bbd9bd2889fbeb8d8441101e6602 | /SpringFramework5/spring5-recipe-app/src/main/java/guru/springframework/recipe/repositories/RecipeRepository.java | b35b3b7ab939c504276a4fc25d4f6835a306da49 | [] | no_license | iamVaibhavPatil/SpringFramework | f0369a6872cc41ef122e52a336b4f03ea21ae4b0 | 42eb78373dea2f4673c551520060d7190556e62c | refs/heads/master | 2020-03-23T18:41:24.095127 | 2019-02-12T22:26:04 | 2019-02-12T22:26:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 299 | java | package guru.springframework.recipe.repositories;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import guru.springframework.recipe.domain.Recipe;
@Repository
public interface RecipeRepository extends CrudRepository<Recipe, Long>{
}
| [
"[email protected]"
] | |
5c6e049b6f02e88324cdaead2cc4bf617f214269 | 330292fa94bc678e06746b709335a29934feccf3 | /app/src/main/java/com/jsj/designpatterns/singleton/ContainerSingleton.java | b8010ab4ae22c5171eb6f8d2f50ab093cab64a0a | [] | no_license | jiangshujing/DesignPatterns | 60108db54da45d86f41f9f8547a5b42b01518a1f | a0f705869c54e5a59241d7110b967b2e22d22e18 | refs/heads/master | 2021-09-07T17:41:24.972589 | 2018-02-27T01:33:47 | 2018-02-27T01:33:47 | 109,373,512 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 163 | java | package com.jsj.designpatterns.singleton;
/**
* Created by jiangshujing on 2018/2/26.
* 使用容器实现单例模式
*/
public class ContainerSingleton {
}
| [
"[email protected]"
] | |
68372466fc031cfb118b1324d1ac3cd5ed77f2ee | 9eb8fbc45bc655d0516009852c55df52980063a7 | /library/src/main/java/com/github/gfranks/minimal/notification/GFUndoNotification.java | a7f8b6e26ef7768379965b17c500c2f0f653e5e2 | [
"MIT"
] | permissive | mohsinalimat/GFMinimalNotifications | 99d73c85aef87a698ef83ba3db93c9a043a1e08a | 1b7f33c30a675437e064449a23c02a6939486a99 | refs/heads/master | 2020-12-24T16:06:33.933459 | 2015-01-08T23:29:27 | 2015-12-30T21:50:50 | 60,669,949 | 1 | 0 | null | 2016-06-08T05:07:26 | 2016-06-08T05:07:26 | null | UTF-8 | Java | false | false | 10,893 | java | package com.github.gfranks.minimal.notification;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
public class GFUndoNotification extends GFMinimalNotification {
private GFUndoNotificationCallback mUndoCallback;
public GFUndoNotification(Builder builder) {
this(builder.mContext, builder.mDuration);
setTitleText(builder.mTitle);
setSubtitleText(builder.mSubtitle);
mAnimationDuration = builder.mAnimationDuration;
if (builder.mBackground != null) {
setNotificationBackground(builder.mBackground);
}
if (builder.mLeftView != null) {
setLeftView(builder.mLeftView);
} else if (builder.mLeftImageDrawable != null) {
setLeftImageDrawable(builder.mLeftImageDrawable);
}
mSlideDirection = builder.mDirection;
mCallback = builder.mNotificationCallback;
mUndoCallback = builder.mUndoCallback;
mOnGFMinimalNotificationClickListener = builder.mListener;
}
public GFUndoNotification(Context context) {
this(context, LENGTH_SHORT);
}
public GFUndoNotification(Context context, long duration) {
mNotificationViewHeight = context.getResources().getDimensionPixelSize(R.dimen.notification_height);
setDuration(duration);
init(context);
}
public GFUndoNotification(Context context, int titleResId) {
this(context, titleResId, LENGTH_SHORT);
}
public GFUndoNotification(Context context, String title) {
this(context, title, null, LENGTH_SHORT);
}
public GFUndoNotification(Context context, int titleResId, int subtitleResId) {
this(context, titleResId, subtitleResId, LENGTH_SHORT);
}
public GFUndoNotification(Context context, String title, String subtitle) {
this(context, title, subtitle, LENGTH_SHORT);
}
public GFUndoNotification(Context context, int titleResId, long duration) {
this(context, context.getString(titleResId), null, duration);
}
public GFUndoNotification(Context context, int titleResId, int subtitleResId, long duration) {
this(context, context.getString(titleResId), context.getString(subtitleResId), duration);
}
public GFUndoNotification(Context context, String title, long duration) {
this(context, title, null, duration);
}
public GFUndoNotification(Context context, String title, String subtitle, long duration) {
if (duration > 0) {
mDuration = duration;
mCanSelfDismiss = true;
} else {
mCanSelfDismiss = false;
}
mNotificationViewHeight = context.getResources().getDimensionPixelSize(R.dimen.notification_height);
init(context);
setTitleText(title);
setSubtitleText(subtitle);
}
/**
* Static method to instantiate GFUndoNotification to build the notification
*
* @param context Context to be used to inflate the undo notification and set additional values
* @return GFUndoNotification
*/
public static GFUndoNotification with(Context context) {
return new GFUndoNotification(context);
}
/**
* @param callback The desired callback to be fired when the notification is shown, dismissed, or when the undo action should be performed
* @return GFUndoNotification
*/
public GFUndoNotification setGFUndoNotificationCallback(GFUndoNotificationCallback callback) {
mUndoCallback = callback;
return this;
}
/**
* If the notification is already showing, you may update it with a Builder. NOTE: Slide Direction cannot change in this instance if
* notification is already showing
*
* @param builder Builder to build the notification view
* @return GFUndoNotification
*/
public GFUndoNotification updateFromBuilder(Builder builder) {
setTitleText(builder.mTitle);
setSubtitleText(builder.mSubtitle);
mAnimationDuration = builder.mAnimationDuration;
if (builder.mBackground != null) {
setNotificationBackground(builder.mBackground);
}
if (builder.mLeftView != null) {
setLeftView(builder.mLeftView);
} else if (builder.mLeftImageDrawable != null) {
setLeftImageDrawable(builder.mLeftImageDrawable);
}
mSlideDirection = builder.mDirection;
mCallback = builder.mNotificationCallback;
mUndoCallback = builder.mUndoCallback;
mOnGFMinimalNotificationClickListener = builder.mListener;
if (isShowing()) {
doShow();
}
return this;
}
/**
* Do to this being an undo notification, no styling may be applied. To apply styling, you may call any of the provided
* methods to alter the notification background, alter the title or subtitle text colors/fonts, etc.
*
* @param style The desired GFMinimalNotificationStyle
* @return GFUndoNotification
*/
@Override
public GFUndoNotification setStyle(GFMinimalNotificationStyle style) {
// no styling available for undo notifications
return this;
}
/**
* Do to this being an undo notification, the right view is a text view and may not be altered unless you call getUndoView()
*
* @param imageResId The desired image resource to be set as the right view if not replaced
* @return GFUndoNotification
*/
@Override
public GFMinimalNotification setRightImageResource(int imageResId) {
// right view unavailable, right view is the undo option
return this;
}
/**
* Do to this being an undo notification, the right view is a text view and may not be altered unless you call getUndoView()
*
* @param drawable The desired drawable to be set as the right view if not replaced
* @return GFUndoNotification
*/
@Override
public GFUndoNotification setRightImageDrawable(Drawable drawable) {
// right view unavailable, right view is the undo option
return this;
}
/**
* Do to this being an undo notification, the right view is a text view and may not be altered unless you call getUndoView()
*
* @param visible Set the right view visible or not
* @return GFUndoNotification
*/
@Override
public GFUndoNotification setRightImageVisible(boolean visible) {
// right view unavailable, right view is the undo option
return this;
}
/**
* @param view The desired view to replace the current right view
* @return GFUndoNotification
*/
@Override
public GFUndoNotification setRightView(View view) {
// right view unavailable, right view is the undo option
return this;
}
/**
* Returns the undo text view so you may alter it's color, background, font, etc.
*
* @return TextView
*/
public TextView getUndoView() {
return (TextView) getRightView();
}
/**
* @param v View clicked
*/
@Override
public void onClick(View v) {
if (v.getId() == mRightView.getId()) {
if (mUndoCallback != null) {
mUndoCallback.onUndoAction(this);
}
}
super.onClick(v);
}
@Override
protected int getNotificationLayout() {
return R.layout.layout_gf_undo_notification;
}
@Override
protected void initViews(Context context) {
super.initViews(context);
mRightView.setOnClickListener(this);
setSlideDirection(SLIDE_BOTTOM);
setNotificationBackgroundColor(context.getResources().getColor(R.color.gf_notification_black));
}
public static class Builder {
private Context mContext;
private long mDuration = LENGTH_SHORT;
private long mAnimationDuration = DEFAULT_ANIMATION_DURATION;
private String mTitle;
private String mSubtitle;
private Drawable mLeftImageDrawable;
private View mLeftView;
private Drawable mBackground;
private int mDirection = SLIDE_BOTTOM;
private GFMinimalNotificationCallback mNotificationCallback;
private GFUndoNotificationCallback mUndoCallback;
private OnGFMinimalNotificationClickListener mListener;
public Builder(Context context) {
mContext = context;
}
public Builder duration(long duration) {
mDuration = duration;
return this;
}
public Builder animationDuration(long animationDuration) {
mAnimationDuration = animationDuration;
return this;
}
public Builder title(int titleResId) {
return title(mContext.getString(titleResId));
}
public Builder title(String title) {
mTitle = title;
return this;
}
public Builder subtitle(int subtitleResId) {
return subtitle(mContext.getString(subtitleResId));
}
public Builder subtitle(String subtitle) {
mSubtitle = subtitle;
return this;
}
public Builder leftImage(int imageRes) {
return leftImage(mContext.getResources().getDrawable(imageRes));
}
public Builder leftImage(Drawable drawable) {
mLeftImageDrawable = drawable;
return this;
}
public Builder leftView(View view) {
mLeftView = view;
return this;
}
public Builder backgroundColor(int color) {
return background(new ColorDrawable(color));
}
public Builder background(int backgroundRes) {
return background(mContext.getResources().getDrawable(backgroundRes));
}
public Builder background(Drawable drawable) {
mBackground = drawable;
return this;
}
public Builder direction(int direction) {
mDirection = direction;
return this;
}
public Builder notificationCallback(GFMinimalNotificationCallback callback) {
mNotificationCallback = callback;
return this;
}
public Builder undoCallback(GFUndoNotificationCallback callback) {
mUndoCallback = callback;
return this;
}
public Builder clickListener(OnGFMinimalNotificationClickListener listener) {
mListener = listener;
return this;
}
public GFUndoNotification build() {
return new GFUndoNotification(this);
}
public void show(ViewGroup viewGroup) {
build().show(viewGroup);
}
}
} | [
"[email protected]"
] | |
314aebd998408a9d4a136ac656f3f8ee9ad823ff | 721c8b0ebcef970d5b726e69f3412fd6f4aba549 | /Vidhvaa/src/objectDetails_VidhvaasModelQuestions/ModelQuestions_2.java | d8fc42b8a8fea7b0243266ace809fcb2a8ab180a | [] | no_license | Vickyradan/Java | 54ddc3141fe4cfe98a44761dc486317a1485bcfb | 5190885925aab10720cff6fbcc0b401fa066d28f | refs/heads/main | 2023-08-19T14:25:39.492891 | 2021-11-02T09:53:28 | 2021-11-02T09:53:28 | 356,565,192 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 371 | java | package objectDetails_VidhvaasModelQuestions;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
public class ModelQuestions_2 {
@FindBy(xpath="//*[@id='hid5']/h3/a")
public static WebElement VidhvaaModelQuestion;
@FindBy(xpath="//*[@id='tab-11']/div/div/div/div[2]/div[2]/a")
public static WebElement question2;
}
| [
"KAVINESH@KAVINESH-PC"
] | KAVINESH@KAVINESH-PC |
2b7f552a3f0a3b95f9314ef8582dae92a6e0ba5a | 1fdfc6c5b22cfb5cd3ddcb2def2342194380258b | /src/main/java/com/tarikh/interview/starling/api/TransactionDTO.java | 6e8699f95fcfd6e3e5d11d8baab6d2d904f64a33 | [] | no_license | tcho16/starling | aff953213fd50c9f8a91ce949c75674eb8dd977a | 338e4d48330c0b123933fd396448000f8a1a0635 | refs/heads/main | 2023-08-24T18:49:24.237385 | 2021-10-27T18:36:31 | 2021-10-27T18:36:31 | 419,115,770 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 491 | java | package com.tarikh.interview.starling.api;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@NoArgsConstructor
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class TransactionDTO {
@JsonProperty("accountUid")
private int transactionAmount;
}
| [
"[email protected]"
] | |
e29fd99ab0589178ac0ad6f232856cf86baf40aa | 2e4777a071b4776016b2d322c8ea5a029c7c39c1 | /socketandroidclient-master/app/src/main/java/fi/metropolia/chatclient/MainActivity.java | 978e195ca50e87c5cb15d10efd92e4b5cbf04cc8 | [] | no_license | Apollina/javaChatAndroidClient | 5447f3935c0394a461c013f9f893b9061f43f3a7 | ddeb375e42cdb7689ee5ad4c5942863a7350d6dc | refs/heads/master | 2021-01-10T22:14:38.363886 | 2016-10-08T13:53:54 | 2016-10-08T13:53:54 | 70,334,216 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,532 | java | package fi.metropolia.chatclient;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
import com.joanzapata.iconify.IconDrawable;
import com.joanzapata.iconify.Iconify;
import com.joanzapata.iconify.fonts.FontAwesomeIcons;
import com.joanzapata.iconify.fonts.FontAwesomeModule;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import fi.metropolia.chatclient.chat.ChatClient;
import fi.metropolia.chatclient.chat.ChatClient.ChatClientObserver;
import fi.metropolia.chatclient.chat.History.HistoryChangeListener;
import fi.metropolia.chatclient.chat.Message;
import fi.metropolia.chatclient.models.Settings;
import fi.metropolia.chatclient.models.UserSession;
public class MainActivity extends AppCompatActivity implements ChatClientObserver, HistoryChangeListener, TextWatcher, OnEditorActionListener {
private static final int LOGIN_ACTIVITY_CODE = 88;
@BindView(R.id.messageInput)
EditText messageInput;
@BindView(R.id.listView)
ListView messagesListView;
@BindView(R.id.sendButton)
Button sendButton;
@BindView(R.id.toolbar)
Toolbar toolbar;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Iconify.with(new FontAwesomeModule());
Settings.initialize(getApplicationContext());
ButterKnife.bind(this);
messageInput.addTextChangedListener(this);
messageInput.setOnEditorActionListener(this);
setSupportActionBar(toolbar);
if (!UserSession.getInstance().isOpen()) {
showLoginScreen();
}
}
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main_menu, menu);
menu.findItem(R.id.users).setIcon(
new IconDrawable(this, FontAwesomeIcons.fa_users)
.colorRes(android.R.color.white)
.actionBarSize()
);
menu.findItem(R.id.logout).setIcon(
new IconDrawable(this, FontAwesomeIcons.fa_sign_out)
.colorRes(android.R.color.white)
.actionBarSize()
);
return true;
}
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.users:
usersButtonPressed();
return true;
case R.id.logout:
logoutButtonPressed();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
private void showLoginScreen() {
startActivityForResult(new Intent(this, LoginActivity.class), LOGIN_ACTIVITY_CODE);
}
private void resetHistory() {
onHistoryUpdated(new ArrayList<Message>());
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == LOGIN_ACTIVITY_CODE && resultCode == -1) {
onSuccessfulLogin();
}
}
protected void onPause() {
super.onPause();
deregisterNotifications();
}
protected void onResume() {
super.onResume();
if (UserSession.getInstance().isOpen()) {
ChatClient.getInstance().registerObserver(this);
ChatClient.getInstance().getHistory().setListener(this);
ChatClient.getInstance().loadHistory();
ChatClient.getInstance().loadUsers();
}
}
private void deregisterNotifications() {
ChatClient.getInstance().deregisterObserver(this);
ChatClient.getInstance().getHistory().setListener(null);
}
private void onSuccessfulLogin() {
}
private void logoutButtonPressed() {
new AlertDialog.Builder(this)
.setTitle(R.string.log_out_warning)
.setPositiveButton(R.string.action_log_out, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
deregisterNotifications();
ChatClient.getInstance().disconnect();
UserSession.getInstance().close();
showLoginScreen();
resetHistory();
}
})
.setNegativeButton(R.string.action_cancel, null)
.show();
}
private void usersButtonPressed() {
startActivity(new Intent(this, UsersActivity.class));
}
@OnClick({R.id.sendButton})
public void sendButtonPressed() {
String message = messageInput.getText().toString();
messageInput.setText("");
ChatClient.getInstance().sendMessage(message);
}
public void onError(Exception error) {
onConnectionError(error);
}
public void onUsernameRegistered(String username) {
}
public void onHistoryUpdated(List<Message> history) {
messagesListView.setAdapter(new ChatListAdapter(this, history));
}
public void onConnectedToSocket() {
}
public void onConnectionError(Exception error) {
Snackbar.make(findViewById(android.R.id.content), error.getMessage(), Snackbar.LENGTH_INDEFINITE).show();
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
public void afterTextChanged(Editable s) {
this.sendButton.setEnabled(!TextUtils.isEmpty(s));
}
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId != 4 || TextUtils.isEmpty(v.getText())) {
return false;
}
sendButtonPressed();
return true;
}
}
| [
"[email protected]"
] | |
2f02fd60335316a47727b10463f779ca2dfbb61c | 8d1142c34f7ef5cb63c5e3115f4b58e19c036b51 | /dump-code/panelpower/retrofit2.Callback.java | db0ca301b38faf032b87a9c2e675725ae9586fb4 | [] | no_license | kingking888/android-auto-hack | b19c979f2c39a3584ba5841c7b13b253cfc798c8 | e91cb827c7ebf53ad253f965df55bfcaa9e82c32 | refs/heads/master | 2021-01-26T11:09:51.958052 | 2020-02-27T02:59:49 | 2020-02-27T02:59:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 158 | java | package retrofit2;
public interface Callback<T> {
void onFailure(Call<T> call, Throwable th);
void onResponse(Call<T> call, Response<T> response);
} | [
"[email protected]"
] | |
5b047241a023c7db3fa91945b43aff361f0a6000 | 10e1fe4940718d045f980577b82dd427315153e0 | /src/android/Starbuzz/app/build/generated/source/buildConfig/debug/com/example/starbuzz/BuildConfig.java | dfe07937a3f54ae7154d57342bfd685080d8a979 | [] | no_license | ValenbergHar/G-JD1-2019-10-01_ValenbergHar | 6b693f08becdf624b235170712e552a4ff148ac3 | bff38b21a10594cdfa7a719c216c04614cc01ac3 | refs/heads/master | 2022-12-22T12:10:22.999080 | 2020-10-20T21:02:01 | 2020-10-20T21:02:01 | 212,853,204 | 0 | 1 | null | 2022-12-16T15:42:29 | 2019-10-04T16:00:20 | Java | UTF-8 | Java | false | false | 447 | java | /**
* Automatically generated file. DO NOT MODIFY
*/
package com.example.starbuzz;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.example.starbuzz";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "1.0";
}
| [
"[email protected]"
] | |
a7a993158d2247b0d7c2eb63240204aea8e20cd6 | e77f3d9e6be6a23230797984c8bea3bd70e0d6b5 | /src/zoohandlung/Schwimmen.java | a3f9d3f59cd7a858e8cd15350410dc1f8191928a | [] | no_license | timA0123/Zoohandlung_Interfaces | ce4ca3ddff6e1153119295295ec4b5caf3e04ef1 | f836b2ea5d4078e8ec1f1083e9fd295074e70b07 | refs/heads/master | 2021-01-24T04:19:53.697620 | 2018-02-26T08:16:47 | 2018-02-26T08:16:47 | 122,930,266 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 92 | java | package zoohandlung;
public interface Schwimmen {
public void schwimme();
}
| [
"[email protected]"
] | |
656c7c515fdf4d3957cd4ad0807216c74e979f50 | 70e0b8fb7fb52e7f9e9b47a69f8a9b54802a652f | /sdu.mdsd.restful/src-gen/sdu/mdsd/restful/serializer/RestControllerGenerationSyntacticSequencer.java | c4ad0c3e9fc0b0c5887dd3c88224b42ae626cfaf | [] | no_license | dstoft/MdsdpRestfulProject | c5e3d7c8deeb478183baebd35802a2964330e3c3 | 84d76eb310064b3821a06850f3bb051dbf28fdb4 | refs/heads/master | 2023-05-04T05:35:10.992724 | 2021-05-26T13:56:14 | 2021-05-26T13:56:14 | 352,556,255 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,497 | java | /*
* generated by Xtext 2.24.0
*/
package sdu.mdsd.restful.serializer;
import com.google.inject.Inject;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.IGrammarAccess;
import org.eclipse.xtext.RuleCall;
import org.eclipse.xtext.nodemodel.INode;
import org.eclipse.xtext.serializer.analysis.GrammarAlias.AbstractElementAlias;
import org.eclipse.xtext.serializer.analysis.GrammarAlias.TokenAlias;
import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynNavigable;
import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynTransition;
import org.eclipse.xtext.serializer.sequencer.AbstractSyntacticSequencer;
import sdu.mdsd.restful.services.RestControllerGenerationGrammarAccess;
@SuppressWarnings("all")
public class RestControllerGenerationSyntacticSequencer extends AbstractSyntacticSequencer {
protected RestControllerGenerationGrammarAccess grammarAccess;
protected AbstractElementAlias match_Primitive_LeftParenthesisKeyword_3_0_a;
protected AbstractElementAlias match_Primitive_LeftParenthesisKeyword_3_0_p;
@Inject
protected void init(IGrammarAccess access) {
grammarAccess = (RestControllerGenerationGrammarAccess) access;
match_Primitive_LeftParenthesisKeyword_3_0_a = new TokenAlias(true, true, grammarAccess.getPrimitiveAccess().getLeftParenthesisKeyword_3_0());
match_Primitive_LeftParenthesisKeyword_3_0_p = new TokenAlias(true, false, grammarAccess.getPrimitiveAccess().getLeftParenthesisKeyword_3_0());
}
@Override
protected String getUnassignedRuleCallToken(EObject semanticObject, RuleCall ruleCall, INode node) {
return "";
}
@Override
protected void emitUnassignedTokens(EObject semanticObject, ISynTransition transition, INode fromNode, INode toNode) {
if (transition.getAmbiguousSyntaxes().isEmpty()) return;
List<INode> transitionNodes = collectNodes(fromNode, toNode);
for (AbstractElementAlias syntax : transition.getAmbiguousSyntaxes()) {
List<INode> syntaxNodes = getNodesFor(transitionNodes, syntax);
if (match_Primitive_LeftParenthesisKeyword_3_0_a.equals(syntax))
emit_Primitive_LeftParenthesisKeyword_3_0_a(semanticObject, getLastNavigableState(), syntaxNodes);
else if (match_Primitive_LeftParenthesisKeyword_3_0_p.equals(syntax))
emit_Primitive_LeftParenthesisKeyword_3_0_p(semanticObject, getLastNavigableState(), syntaxNodes);
else acceptNodes(getLastNavigableState(), syntaxNodes);
}
}
/**
* Ambiguous syntax:
* '('*
*
* This ambiguous syntax occurs at:
* (rule start) (ambiguity) reference=[Attribute|ID]
* (rule start) (ambiguity) value=INT
* (rule start) (ambiguity) varName=[Attribute|ID]
* (rule start) (ambiguity) {Add.left=}
* (rule start) (ambiguity) {Div.left=}
* (rule start) (ambiguity) {Mul.left=}
* (rule start) (ambiguity) {Sub.left=}
*/
protected void emit_Primitive_LeftParenthesisKeyword_3_0_a(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
acceptNodes(transition, nodes);
}
/**
* Ambiguous syntax:
* '('+
*
* This ambiguous syntax occurs at:
* (rule start) (ambiguity) {Add.left=}
* (rule start) (ambiguity) {Div.left=}
* (rule start) (ambiguity) {Mul.left=}
* (rule start) (ambiguity) {Sub.left=}
*/
protected void emit_Primitive_LeftParenthesisKeyword_3_0_p(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
acceptNodes(transition, nodes);
}
}
| [
"[email protected]"
] | |
315ab8dcdb809fec3e81e32691f8a6dfc172b53e | 702193b0a97f4e5b8a7a37e8add77c4df04133bf | /springmore-easygrid/src/main/java/org/easygrid/action/ExcelExportAction.java | 85c7d6802d4ea37255defcc30e11e991a67fbb3c | [] | no_license | popotans/springmore | 5c25e7a86dbde94db3e6d45468b23914b3ac8684 | 842fe1b040c04ae8d66609e068db994c0895c72b | refs/heads/master | 2021-01-25T13:29:13.731684 | 2017-03-23T05:55:49 | 2017-03-23T05:55:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,441 | java | package org.easygrid.action;
import java.util.List;
import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.easygrid.excel.ExcelWriter;
import org.easygrid.grid.Grid;
import org.easygrid.util.GridJSONUtil;
/**
* excel导出 配合 grid组件用
* @author 唐延波
* @date 2013-12-3
*/
@SuppressWarnings("serial")
@ParentPackage("struts-default")
@Namespace("/")
public class ExcelExportAction extends DownloadAction {
private final Logger log = Logger.getLogger(this.getClass());
private String header;
private String data;
private String title;
private String fileName;
private String girds;
private String grid;
/**
* 单表导出excel
* @author 唐延波
* @date 2013-12-3
*/
@Action("exportExcel")
public void exportExcel() {
try {
Grid gridObject = GridJSONUtil.transformJSONToGrid(grid);
ExcelWriter excelWriter = ExcelWriter.getInstance(title, fileName, gridObject, response);
excelWriter.exportExcel();
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
/**
* 多表导出excel
* @author 唐延波
* @date 2013-12-3
*/
@Action("exportExcelMultipleTable")
public void exportExcelMultipleTable() {
try {
List<Grid> gridList = GridJSONUtil.transformJSONToGridList(girds);
ExcelWriter excelWriter = ExcelWriter.getInstance(title, fileName, gridList, response);
excelWriter.exportExcelMultipleGrid();
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
public String getHeader() {
return header;
}
public void setHeader(String header) {
this.header = header;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getGirds() {
return girds;
}
public void setGirds(String girds) {
this.girds = girds;
}
public String getGrid() {
return grid;
}
public void setGrid(String grid) {
this.grid = grid;
}
}
| [
"[email protected]"
] | |
a9e9a3410ef90195d1dc62cd0f17b173a73dabab | 37d4b75f39dea82d8d82377b245a375eaecbf971 | /shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/condition/engine/ShardingConditionEngineFactoryTest.java | 70d339b60d003742ad66f7be6fc0364bbdff4cab | [
"Apache-2.0"
] | permissive | dhc575757/shardingsphere | 6bb120a27d69021837a7191b6fcecd812a0b8921 | 3d2d99d6e18bd726fac465a35a18de0f73f55635 | refs/heads/master | 2022-12-16T00:28:52.896105 | 2022-09-16T00:27:15 | 2022-09-16T00:27:15 | 289,595,678 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,301 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.shardingsphere.sharding.route.engine.condition.engine;
import org.apache.shardingsphere.infra.binder.QueryContext;
import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
import org.apache.shardingsphere.infra.binder.statement.dml.InsertStatementContext;
import org.apache.shardingsphere.infra.database.DefaultDatabase;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereSchema;
import org.apache.shardingsphere.sharding.route.engine.condition.engine.impl.InsertClauseShardingConditionEngine;
import org.apache.shardingsphere.sharding.route.engine.condition.engine.impl.WhereClauseShardingConditionEngine;
import org.apache.shardingsphere.sharding.rule.ShardingRule;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Answers;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
public final class ShardingConditionEngineFactoryTest {
@Mock
private QueryContext queryContext;
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private ShardingSphereDatabase database;
@Mock
private ShardingRule shardingRule;
@Before
public void setUp() {
when(database.getSchema(DefaultDatabase.LOGIC_NAME)).thenReturn(mock(ShardingSphereSchema.class));
}
@SuppressWarnings({"rawtypes", "unchecked"})
@Test
public void assertCreateInsertClauseShardingConditionEngine() {
SQLStatementContext insertStatementContext = mock(InsertStatementContext.class);
when(queryContext.getSqlStatementContext()).thenReturn(insertStatementContext);
ShardingConditionEngine<?> actual = ShardingConditionEngineFactory.createShardingConditionEngine(queryContext, database, shardingRule);
assertThat(actual, instanceOf(InsertClauseShardingConditionEngine.class));
}
@Test
public void assertCreateWhereClauseShardingConditionEngine() {
ShardingConditionEngine<?> actual = ShardingConditionEngineFactory.createShardingConditionEngine(queryContext, database, shardingRule);
assertThat(actual, instanceOf(WhereClauseShardingConditionEngine.class));
}
}
| [
"[email protected]"
] | |
8f5b0514b2c4c81a4527add2b9a34fb525687361 | 0ca74be41f99150e743e2ef9083c3fd578d6be3c | /ToDo_App/src/main/java/com/bridgeit/todo/user/utility/UserEmailNotFound.java | 0a4bf29fbea8da325e18be646f5e3040c2980e08 | [] | no_license | FAIROJ123/ToDo | 08301058d7e344dcc68437f84eb1ad19321396ed | 9df902ec68ed50cfe75c498c3f2419f43084fbd7 | refs/heads/master | 2020-03-22T05:32:38.195512 | 2018-08-28T05:08:03 | 2018-08-28T05:08:03 | 139,573,344 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 163 | java | package com.bridgeit.todo.user.utility;
public class UserEmailNotFound extends Exception{
public UserEmailNotFound(String msg) {
super(msg);
}
}
| [
"[email protected]"
] | |
45fef4a6580dd227bebfff70ec18f5c019d37192 | 2c4cf46179743b2458c55f794b0fe178ac79f9e2 | /src/com/qiheng/server/ServerMessageThread.java | 60dea58597050690e6313dd6f28d618c51464fc2 | [] | no_license | wlgcqh/qh | 98af882ab0d145881c422ff099b6a9ac1bf56ba8 | 9a349716511a607937f22eeec4800ac28ac18835 | refs/heads/master | 2020-09-22T18:01:54.247861 | 2014-12-09T14:03:57 | 2014-12-09T14:03:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,108 | java | package com.qiheng.server;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import com.qiheng.util.CharacterUtil;
import com.qiheng.util.XMLUtil;
public class ServerMessageThread extends Thread {
private Server server;
private InputStream in;
private OutputStream out;
public ServerMessageThread(Server server, Socket socket) {
try {
this.server = server;
this.in = socket.getInputStream();
this.out = socket.getOutputStream();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
// 更新用户列表
// 首先更新服务器端用户列表,然后更新用户端
public void updateUserList() {
// 用户名集合
Set<String> users = this.server.getMap().keySet();
// 构造向客户端发送的信息
String xml = XMLUtil.constructUserList(users);
String str = "";
for (String user : users) {
str += user + "\n";
}
// 更新服务器端列表
this.server.getTextarea().setText(str);
// 更新客户端列表
Collection<ServerMessageThread> cols = this.server.getMap().values();
for (ServerMessageThread smt : cols) {
smt.sendMessage(xml);
}
}
public void sendMessage(String message) {
try {
this.out.write(message.getBytes());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public void run() {
while (true) {
try {
byte[] buf = new byte[5000];
int length = this.in.read(buf);
// 客户端发来的信息
String xml = new String(buf, 0, length);
int type = Integer.parseInt(XMLUtil.getType(xml));
// 聊天数据
if (type == CharacterUtil.CLIENT_MESSAGE) {
// System.out.println(xml);
// 解析出用户名
String username = XMLUtil.extractUsername(xml);
// 解析出聊天内容
String content = XMLUtil.extractContent(xml);
// 构造像客户端发送的信息
String message = username + ":" + content;
String xmlMessage=XMLUtil.constructServerMessageXML(message);
Map<String, ServerMessageThread> map=this.server.getMap();
Collection<ServerMessageThread> cols = map.values();
for (ServerMessageThread smt : cols) {
smt.sendMessage(xmlMessage);
}
}
//关闭客户端窗口
else if(type == CharacterUtil.CLIENT_CLOSED){
String user=XMLUtil.extractUsername(xml);
//获得待删除线程对象
ServerMessageThread smt = this.server.getMap().get(user);
//向客户端发送退出信息
smt.sendMessage(xml);
//从用户列表中将该用户删除
this.server.getMap().remove(user);
//更新用户列表
this.updateUserList();
this.in.close();
this.out.close();
break;//关闭线程
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
| [
"[email protected]"
] | |
81bec235f093fc344ce66031c65394f057dbe72e | b2c250888458d48c5c3f6f61378bd913a324ef03 | /src/main/java/com/panda/study/design/pattern/delegate/employ/Boss.java | 1e261e02bc4e7d958845665e2dcb0955ce753092 | [] | no_license | zhangwei921003/design-principle | c69721334382676385c6d00a7b24dfa1ae9fa821 | e1ece7914a52b7d19a582ae22466254337b5e55e | refs/heads/master | 2022-12-21T08:59:02.078235 | 2020-03-31T08:31:47 | 2020-03-31T08:31:47 | 247,595,936 | 0 | 0 | null | 2022-12-16T15:28:23 | 2020-03-16T02:46:49 | Java | UTF-8 | Java | false | false | 168 | java | package com.panda.study.design.pattern.delegate.employ;
public class Boss {
public void command(String task, Leader leader) {
leader.doing(task);
}
}
| [
"[email protected]"
] | |
0535ff49e8a54ab48a7f247c222f689a8a29ccdf | 5217e193f5274b2f062512db0abb80ca4675c169 | /Assignment 2/Star3.java | 1b2f4ca3aba763fa64783586a6da01b51eca3afb | [] | no_license | AshishNamdeo14/EDACmay2021 | f2d0578a8c558cefc31df5bb962105ef554f8126 | 0e0fbeb352ff40197372710a56b320196f70b209 | refs/heads/main | 2023-04-19T09:29:04.328824 | 2021-05-09T15:14:03 | 2021-05-09T15:14:03 | 365,245,447 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 200 | java | class Star3
{
public static void main(String args[])
{
for(int i=1;i<=3;i++)
{
for(int j=3;j>=i;j--)
{
System.out.print("*");
}
System.out.println("");
}
}
} | [
"[email protected]"
] | |
eec6bfaea84dd13cd5892587fac4b97c3f38499f | 7d0171539b3cb38f593ba57cce6b0e3e9741abcb | /demo-dubbo-provider-remote/src/main/java/com/example/provider/service/CmsConfServiceImpl.java | 75e7dbd6fb157577770b0a7f9a2a333f973ee6c4 | [] | no_license | zdbao/dubbo2springCloud | 1b197b2264868011f96ccdefb0e2a10b2dd372bc | af847c4f7b25e2d8e116449273ea9ddd75451b28 | refs/heads/master | 2022-06-28T19:49:36.988949 | 2020-03-02T10:46:09 | 2020-03-02T10:46:09 | 243,706,458 | 1 | 1 | null | 2022-06-17T02:58:38 | 2020-02-28T07:45:22 | Java | UTF-8 | Java | false | false | 1,963 | java | package com.example.provider.service;
import com.alibaba.fastjson.JSON;
import com.example.provider.dto.CmsConfList;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.util.Assert;
import java.util.*;
@Service
public class CmsConfServiceImpl implements CmsConfService{
@Override
public Map<String, String> getByConfKey(String confKey) {
Assert.notNull(confKey,"confKey not null");
Map<String,String> map = new HashMap<>();
map.put("success","true");
map.put("confKey",confKey);
return map;
}
@Override
public List<CmsConfList> getCmsConfList(String title, String confKey, String productName, Integer showStatus) {
CmsConfList cmsConfList = new CmsConfList();
cmsConfList.setConfKey(confKey);
cmsConfList.setTitle(title);
cmsConfList.setProductName(productName);
cmsConfList.setId(showStatus);
cmsConfList.setUpdateTime(new Date());
List<CmsConfList> list = new ArrayList<>();
list.add(cmsConfList);
return list;
}
@Override
public String addCmsConfList(CmsConfList dto) {
return "添加成功: " + JSON.toJSONString(dto);
}
@Override
public Map<String, String> getCmsConfNodeList(String confKey, Integer level) {
Map<String,String> map = new HashMap<>();
map.put("success","true");
map.put("ms","我是重载方法1");
map.put("confKey",confKey);
map.put("level",String.valueOf(level));
return map;
}
@Override
public Map<String, String> getCmsConfNodeList(String confKey, Integer level, Integer parentId) {
Map<String,String> map = new HashMap<>();
map.put("success","true");
map.put("ms","我是重载方法2");
map.put("confKey",confKey);
map.put("level",String.valueOf(level));
map.put("parentId",String.valueOf(parentId));
return map;
}
}
| [
"[email protected]"
] | |
db480852d3eb730ba1cdbe00403073bb0ec847b1 | 9a8e3137db2b3e29dceb170887144e991974c1f2 | /rsc/rsc/TheLoveMachine/TLM/KeyHandler.java | 5a066d50de5d9542b15148a955a11f58b5091bbd | [] | no_license | drewjbartlett/runescape-classic-dump | 07155b735cfb6bf7b7b727557d1dd0c6f8e0db0b | f90e3bcc77ffb7ea4a78f087951f1d4cb0f6ad8e | refs/heads/master | 2021-01-19T21:32:45.000029 | 2015-09-05T22:36:22 | 2015-09-05T22:36:22 | 88,663,647 | 1 | 0 | null | 2017-04-18T19:40:23 | 2017-04-18T19:40:23 | null | UTF-8 | Java | false | false | 444 | java | // Decompiled by DJ v3.7.7.81 Copyright 2004 Atanas Neshkov Date: 19/09/2004 20:04:12
// Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name: KeyHandler.java
import java.awt.*;
public interface KeyHandler
{
public abstract int[] getAssociatedKeys();
public abstract void activate(int i, KeyState ks, boolean down);
}
| [
"[email protected]"
] | |
346f8f52e57a1e7f54a61e61277cfdcb911b3e7c | 32069bde2dcfb5c142e3118509e1d9737312bd84 | /net.opensg.tcs.multiedit/src/net/opensg/tcs/multiedit/views/ContEditor.java | c96f25855d4d33903b40c0e95f7a98c7830ac7ae | [] | no_license | radiobaek01/start | 91ca2c006a640dc120f7723cb9543108480371f8 | 59f5ebd5e2d3b93787cfdf343ca57a0ca95740b0 | refs/heads/master | 2020-05-29T11:46:58.143794 | 2015-04-13T10:31:03 | 2015-04-13T10:31:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,782 | java | package net.opensg.tcs.multiedit.views;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.EditorPart;
public class ContEditor extends EditorPart {
public static final String ID = "net.opensg.tcs.multiedit.views.ContEditor"; //$NON-NLS-1$
private Display display = null;
private TableViewer tableViewer = null;
private Table table;
public ContEditor() {
}
/**
* Create contents of the editor part.
* @param parent
*/
@Override
public void createPartControl(Composite parent) {
this.display = parent.getDisplay();
parent.setLayout(new GridLayout(1, false));
// (1) Create Table
tableViewer = new TableViewer(parent, SWT.BORDER | SWT.FULL_SELECTION);
table = tableViewer.getTable();
table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
table.setLinesVisible(true);
table.setHeaderVisible(true);
// (2) Create Columns
TableViewerColumn viewerColName = new TableViewerColumn(tableViewer, SWT.NONE);
TableColumn tblColName = viewerColName.getColumn();
tblColName.setWidth(150);
tblColName.setText("Name");
TableViewerColumn viewerColEmail = new TableViewerColumn(tableViewer, SWT.NONE);
TableColumn tblColEmail = viewerColEmail.getColumn();
tblColEmail.setWidth(150);
tblColEmail.setText("E-Mail");
TableViewerColumn viewerColPhone = new TableViewerColumn(tableViewer, SWT.NONE);
TableColumn tblColPhone = viewerColPhone.getColumn();
tblColPhone.setWidth(150);
tblColPhone.setText("Phone");
tableViewer.setContentProvider(new ContEditorContentProvider());
tableViewer.setLabelProvider(new ContEditorLabelProvider());
}
public void BindData(Object data) {
tableViewer.setInput(data);
}
@Override
public void setFocus() {
// Set the focus
}
@Override
public void doSave(IProgressMonitor monitor) {
// Do the Save operation
}
@Override
public void doSaveAs() {
// Do the Save As operation
}
@Override
public void init(IEditorSite site, IEditorInput input)
throws PartInitException {
// Initialize the editor part
}
@Override
public boolean isDirty() {
return false;
}
@Override
public boolean isSaveAsAllowed() {
return false;
}
}
| [
"[email protected]"
] | |
ab6145903e4123caecaa5be93d2f00d7ca3e3f70 | f4e15ee34808877459d81fd601d6be03bdfb4a9d | /com/sun/tools/xjc/reader/annotator/RelationNormalizer.java | eca48406a7c51cc446c6a99d56a0efb62eba843e | [] | no_license | Lianite/wurm-server-reference | 369081debfa72f44eafc6a080002c4a3970f8385 | e4dd8701e4af13901268cf9a9fa206fcb5196ff0 | refs/heads/master | 2023-07-22T16:06:23.426163 | 2020-04-07T23:15:35 | 2020-04-07T23:15:35 | 253,933,452 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,243 | java | //
// Decompiled by Procyon v0.5.30
//
package com.sun.tools.xjc.reader.annotator;
import com.sun.msv.grammar.util.ExpressionPrinter;
import com.sun.msv.datatype.DatabindableDatatype;
import com.sun.tools.xjc.grammar.xducer.Transducer;
import com.sun.msv.datatype.xsd.XSDatatype;
import com.sun.msv.datatype.xsd.StringType;
import com.sun.tools.xjc.grammar.xducer.IdentityTransducer;
import com.sun.tools.xjc.grammar.ExternalItem;
import com.sun.tools.xjc.grammar.TypeItem;
import com.sun.tools.xjc.grammar.util.AnnotationRemover;
import com.sun.msv.grammar.OtherExp;
import com.sun.msv.grammar.ReferenceExp;
import com.sun.msv.grammar.ValueExp;
import com.sun.msv.grammar.DataExp;
import com.sun.msv.grammar.OneOrMoreExp;
import com.sun.msv.grammar.InterleaveExp;
import com.sun.msv.grammar.SequenceExp;
import com.sun.msv.grammar.ChoiceExp;
import com.sun.msv.grammar.ConcurExp;
import com.sun.msv.grammar.ListExp;
import com.sun.msv.grammar.MixedExp;
import com.sun.msv.grammar.trex.ElementPattern;
import com.sun.msv.grammar.ElementExp;
import com.sun.msv.grammar.Expression;
import com.sun.msv.grammar.AttributeExp;
import com.sun.tools.xjc.grammar.util.Multiplicity;
import com.sun.tools.xjc.grammar.JavaItem;
import com.sun.tools.xjc.grammar.IgnoreItem;
import com.sun.tools.xjc.grammar.PrimitiveItem;
import com.sun.tools.xjc.grammar.SuperClassItem;
import com.sun.codemodel.JClass;
import com.sun.codemodel.JType;
import com.sun.xml.bind.JAXBAssertionError;
import java.util.Set;
import com.sun.tools.xjc.grammar.FieldUse;
import com.sun.tools.xjc.grammar.InterfaceItem;
import com.sun.tools.xjc.grammar.ClassItem;
import org.xml.sax.Locator;
import com.sun.tools.xjc.reader.TypeUtil;
import com.sun.tools.xjc.grammar.FieldItem;
import java.util.HashSet;
import com.sun.tools.xjc.grammar.util.FieldMultiplicityCounter;
import com.sun.msv.grammar.ExpressionVisitorExpression;
import com.sun.tools.xjc.grammar.AnnotatedGrammar;
import com.sun.msv.grammar.ExpressionPool;
public final class RelationNormalizer
{
private final AnnotatorController controller;
private final ExpressionPool pool;
private final AnnotatedGrammar grammar;
private RelationNormalizer(final AnnotatorController _controller, final AnnotatedGrammar _grammar) {
this.controller = _controller;
this.pool = _grammar.getPool();
this.grammar = _grammar;
}
public static void normalize(final AnnotatedGrammar grammar, final AnnotatorController controller) {
final RelationNormalizer n = new RelationNormalizer(controller, grammar);
final ClassItem[] classItems = grammar.getClasses();
final InterfaceItem[] interfaceItems = grammar.getInterfaces();
final RelationNormalizer relationNormalizer = n;
relationNormalizer.getClass();
final Pass1 pass1 = new Pass1(relationNormalizer, (RelationNormalizer$1)null);
for (int i = 0; i < classItems.length; ++i) {
pass1.process(classItems[i]);
}
for (int i = 0; i < interfaceItems.length; ++i) {
interfaceItems[i].visit((ExpressionVisitorExpression)pass1);
}
for (int i = 0; i < classItems.length; ++i) {
final FieldUse[] fieldUses = classItems[i].getDeclaredFieldUses();
for (int j = 0; j < fieldUses.length; ++j) {
fieldUses[j].multiplicity = FieldMultiplicityCounter.count(classItems[i].exp, fieldUses[j]);
final Set possibleTypes = new HashSet();
final FieldItem[] fields = fieldUses[j].items.toArray(new FieldItem[0]);
for (int k = 0; k < fields.length; ++k) {
possibleTypes.add(fields[k].getType(grammar.codeModel));
}
fieldUses[j].type = TypeUtil.getCommonBaseType(grammar.codeModel, possibleTypes);
if (fieldUses[j].isDelegated() && !fieldUses[j].multiplicity.isAtMostOnce()) {
controller.reportError(new Locator[] { classItems[i].locator }, Messages.format("Normalizer.DelegationMultiplicityMustBe1", (Object)fieldUses[j].name));
}
}
}
}
private static void _assert(final boolean b) {
if (!b) {
throw new JAXBAssertionError();
}
}
private static boolean isInterface(final JType t) {
return !t.isPrimitive() && ((JClass)t).isInterface();
}
private static boolean isClass(final Object exp) {
return exp instanceof ClassItem;
}
private static boolean isSuperClass(final Object exp) {
return exp instanceof SuperClassItem;
}
private static boolean isInterface(final Object exp) {
return exp instanceof InterfaceItem;
}
private static boolean isField(final Object exp) {
return exp instanceof FieldItem;
}
private static boolean isPrimitive(final Object exp) {
return exp instanceof PrimitiveItem;
}
private static boolean isIgnore(final Object exp) {
return exp instanceof IgnoreItem;
}
private class Pass1 implements ExpressionVisitorExpression
{
private final Set visitedClasses;
private JavaItem parentItem;
private Multiplicity multiplicity;
private Pass1(final RelationNormalizer this$0) {
this.this$0 = this$0;
this.visitedClasses = new HashSet();
this.parentItem = null;
this.multiplicity = null;
}
public Expression onAttribute(final AttributeExp exp) {
final Expression newContent = exp.exp.visit((ExpressionVisitorExpression)this);
if (newContent != exp.exp) {
return this.this$0.pool.createAttribute(exp.getNameClass(), newContent);
}
return (Expression)exp;
}
public Expression onElement(final ElementExp exp) {
final Expression body = exp.contentModel.visit((ExpressionVisitorExpression)this);
if (body == exp.contentModel) {
return (Expression)exp;
}
return (Expression)new ElementPattern(exp.getNameClass(), body);
}
public Expression onMixed(final MixedExp exp) {
return this.this$0.pool.createMixed(exp.exp.visit((ExpressionVisitorExpression)this));
}
public Expression onList(final ListExp exp) {
return this.this$0.pool.createList(exp.exp.visit((ExpressionVisitorExpression)this));
}
public Expression onConcur(final ConcurExp exp) {
throw new Error("concur is not supported");
}
public Expression onChoice(final ChoiceExp exp) {
final Expression lhs = exp.exp1.visit((ExpressionVisitorExpression)this);
final Multiplicity lhc = this.multiplicity;
final Expression rhs = exp.exp2.visit((ExpressionVisitorExpression)this);
final Multiplicity rhc = this.multiplicity;
this.multiplicity = Multiplicity.choice(lhc, rhc);
return this.this$0.pool.createChoice(lhs, rhs);
}
public Expression onSequence(final SequenceExp exp) {
final Expression lhs = exp.exp1.visit((ExpressionVisitorExpression)this);
final Multiplicity lhc = this.multiplicity;
final Expression rhs = exp.exp2.visit((ExpressionVisitorExpression)this);
final Multiplicity rhc = this.multiplicity;
this.multiplicity = Multiplicity.group(lhc, rhc);
return this.this$0.pool.createSequence(lhs, rhs);
}
public Expression onInterleave(final InterleaveExp exp) {
final Expression lhs = exp.exp1.visit((ExpressionVisitorExpression)this);
final Multiplicity lhc = this.multiplicity;
final Expression rhs = exp.exp2.visit((ExpressionVisitorExpression)this);
final Multiplicity rhc = this.multiplicity;
this.multiplicity = Multiplicity.group(lhc, rhc);
return this.this$0.pool.createInterleave(lhs, rhs);
}
public Expression onOneOrMore(final OneOrMoreExp exp) {
final Expression p = this.this$0.pool.createOneOrMore(exp.exp.visit((ExpressionVisitorExpression)this));
this.multiplicity = Multiplicity.oneOrMore(this.multiplicity);
return p;
}
public Expression onEpsilon() {
this.multiplicity = Multiplicity.zero;
return Expression.epsilon;
}
public Expression onNullSet() {
this.multiplicity = Multiplicity.zero;
return Expression.nullSet;
}
public Expression onAnyString() {
throw new Error();
}
public Expression onData(final DataExp exp) {
this.multiplicity = Multiplicity.zero;
return (Expression)exp;
}
public Expression onValue(final ValueExp exp) {
this.multiplicity = Multiplicity.zero;
return (Expression)exp;
}
public Expression onRef(final ReferenceExp exp) {
return exp.exp.visit((ExpressionVisitorExpression)this);
}
public void process(final ClassItem ci) {
if (!this.visitedClasses.add(ci)) {
return;
}
final JavaItem oldParent = this.parentItem;
this.parentItem = ci;
ci.exp.visit((ExpressionVisitorExpression)this);
this.parentItem = oldParent;
if (ci.getSuperClass() != null) {
this.process(ci.getSuperClass());
}
ci.removeDuplicateFieldUses();
final FieldUse[] fus = ci.getDeclaredFieldUses();
for (int i = 0; i < fus.length; ++i) {
if (fus[i].isDelegated()) {
if (fus[i].items.size() != 1) {
throw new JAXBAssertionError();
}
final FieldItem fi = fus[i].items.iterator().next();
final JType t = fi.getType(this.this$0.grammar.codeModel);
if (t == this.this$0.grammar.codeModel.ref((RelationNormalizer.class$java$lang$Object == null) ? (RelationNormalizer.class$java$lang$Object = RelationNormalizer.class$("java.lang.Object")) : RelationNormalizer.class$java$lang$Object)) {
fus[i].disableDelegation();
}
else {
if (!RelationNormalizer.access$300(t)) {
this.this$0.controller.reportError(new Locator[] { ci.locator }, Messages.format("Normalizer.DelegationMustBeInterface", (Object)ci.name, (Object)t.fullName()));
}
ci.getTypeAsDefined()._implements((JClass)t);
}
}
}
}
public Expression onOther(final OtherExp exp) {
if (!(exp instanceof JavaItem)) {
exp.exp = exp.exp.visit((ExpressionVisitorExpression)this);
return (Expression)exp;
}
if (RelationNormalizer.access$500((Object)this.parentItem)) {
return exp.exp.visit((ExpressionVisitorExpression)this);
}
if (exp instanceof IgnoreItem) {
exp.exp = AnnotationRemover.remove(exp.exp, this.this$0.pool);
this.multiplicity = Multiplicity.zero;
return (Expression)exp;
}
final JavaItem oldParent = this.parentItem;
if (exp instanceof JavaItem) {
this.sanityCheck(this.parentItem, (JavaItem)exp);
if (RelationNormalizer.access$600((Object)this.parentItem) && RelationNormalizer.access$700((Object)exp)) {
final FieldItem fi = (FieldItem)exp;
((ClassItem)this.parentItem).getOrCreateFieldUse(fi.name).items.add(fi);
}
if (RelationNormalizer.access$700((Object)this.parentItem) && exp instanceof TypeItem) {
final TypeItem ti = (TypeItem)exp;
final FieldItem fi2 = (FieldItem)this.parentItem;
try {
fi2.addType(ti);
}
catch (FieldItem.BadTypeException e) {
this.this$0.controller.reportError(new Locator[] { fi2.locator }, Messages.format("Normalizer.ConflictBetweenUserTypeAndActualType", (Object)fi2.name, (Object)e.getUserSpecifiedType().name(), (Object)ti.getType().name()));
}
}
if (exp instanceof ClassItem || !this.visitedClasses.add(exp)) {
this.multiplicity = this.getJavaItemMultiplicity(exp);
return (Expression)exp;
}
this.parentItem = (JavaItem)exp;
}
if (exp instanceof ExternalItem) {
exp.exp = AnnotationRemover.remove(exp.exp, this.this$0.pool);
}
else {
exp.exp = exp.exp.visit((ExpressionVisitorExpression)this);
}
this.parentItem = oldParent;
if (RelationNormalizer.access$800((Object)exp)) {
final SuperClassItem sci = (SuperClassItem)exp;
if (sci.definition == null) {
this.this$0.controller.reportError(new Expression[] { exp }, Messages.format("Normalizer.MissingSuperClassBody"));
}
else if (!this.multiplicity.isUnique()) {
this.this$0.controller.reportError(new Expression[] { exp, sci.definition }, Messages.format("Normalizer.BadSuperClassBodyMultiplicity", new Object[] { sci.definition.name }));
}
}
if (RelationNormalizer.access$700((Object)exp)) {
final FieldItem fi = (FieldItem)exp;
if (fi.multiplicity == null) {
fi.multiplicity = this.multiplicity;
}
else {
RelationNormalizer.access$900(fi.multiplicity.includes(this.multiplicity));
}
if (!fi.hasTypes()) {
this.this$0.controller.reportError(new Locator[] { fi.locator }, Messages.format("Normalizer.EmptyProperty", new Object[] { fi.name }));
try {
fi.addType(this.this$0.grammar.createPrimitiveItem((Transducer)new IdentityTransducer(this.this$0.grammar.codeModel), (DatabindableDatatype)StringType.theInstance, this.this$0.pool.createData((XSDatatype)StringType.theInstance), fi.locator));
}
catch (FieldItem.BadTypeException ex) {}
}
}
if (RelationNormalizer.access$1000((Object)exp)) {
final InterfaceItem ii = (InterfaceItem)exp;
if (!this.multiplicity.isAtMostOnce()) {
System.out.println(ExpressionPrinter.printContentModel(exp.exp));
this.this$0.controller.reportError(new Expression[] { ii }, Messages.format("Normalizer.BadInterfaceToClassMultiplicity", new Object[] { ii.name }));
}
return (Expression)exp;
}
this.multiplicity = this.getJavaItemMultiplicity(exp);
return (Expression)exp;
}
private Multiplicity getJavaItemMultiplicity(final OtherExp item) {
if (item instanceof IgnoreItem) {
return Multiplicity.zero;
}
return Multiplicity.one;
}
private void sanityCheck(final JavaItem parent, final JavaItem child) {
if (RelationNormalizer.access$800((Object)parent) && !RelationNormalizer.access$600((Object)child)) {
this.this$0.controller.reportError(new Expression[] { parent, child }, Messages.format("Normalizer.BadSuperClassUse"));
return;
}
if (RelationNormalizer.access$1100((Object)parent)) {
throw new Error("internal error: use of primitive-" + child + " relation.");
}
if ((RelationNormalizer.access$700((Object)parent) && (RelationNormalizer.access$800((Object)child) || RelationNormalizer.access$700((Object)child))) || (RelationNormalizer.access$1000((Object)parent) && (RelationNormalizer.access$800((Object)child) || RelationNormalizer.access$700((Object)child) || RelationNormalizer.access$1100((Object)child)))) {
this.this$0.controller.reportError(new Expression[] { parent, child }, Messages.format("Normalizer.BadItemUse", (Object)parent, (Object)child));
return;
}
if (RelationNormalizer.access$600((Object)parent) && child instanceof TypeItem) {
throw new Error("internal error. C-C/C-I/C-P relation " + ((ClassItem)parent).getTypeAsDefined().name() + " " + child.toString() + " " + ExpressionPrinter.printContentModel((Expression)parent));
}
}
}
}
| [
"[email protected]"
] | |
91c612757f7bfc34f32056303a800762c6e746c2 | 3a8d6ae49beca8ef7d07a162c493a1d67784088d | /app/src/test/java/com/lantier/xxb_student/ajustpan/ExampleUnitTest.java | 0bd10037e65d97f20f574a7353c86c66fc00640c | [] | no_license | lantier743865/WuZiQi | 69539dec975a7bef5b769edb7f06197cdade08c8 | bda977938fb4d4903c9b1acbe6cc90d38e9669d8 | refs/heads/master | 2021-01-23T04:08:48.310966 | 2017-03-28T14:03:52 | 2017-03-28T14:03:52 | 86,156,751 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 410 | java | package com.lantier.xxb_student.ajustpan;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
ea24849ec94af1db37f1dac323d4b17a677e4353 | 346caf3e07cc60d1463b9ca1d3bca698796c7160 | /src/Fundamentals/BasicProgModel/Exec_1_1_21.java | 0b26b168c1ebbdb2a2a8bd13422b2b4eaadabd25 | [] | no_license | dadisdad/AlgorithmSedgewickJava | 678c12fd8924244551febd1ee77930a700164e2a | 87e58d27409498ee67fea02829a8bb1eba6691d4 | refs/heads/master | 2021-09-10T22:19:09.040514 | 2018-04-03T07:37:20 | 2018-04-03T07:37:20 | 90,644,033 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 473 | java | package Fundamentals.BasicProgModel;
import Std.In;
import Std.StdIn;
import Std.StdOut;
/**
* Created by dadisdad on 2017/7/5.
*/
public class Exec_1_1_21 {
public static void main(String[] args) {
String ss = StdIn.readLine();
String[] a = ss.split(" ");
double b = Double.parseDouble(a[1]);
double c = Double.parseDouble(a[2]);
double res = b / c;
StdOut.printf("%s %s %s %10.3f", a[0], a[1], a[2], res);
}
}
| [
"[email protected]"
] | |
18e3882dd7ae97ca4e982afa67be7b55219c0614 | a19c14bd99ccc95baddf56f18c8ee6680c79fae2 | /src/com/bcas/thread/TestJoinMethod1.java | 43bf1ae0747bac5626a459a3bdeb4c1d064ae240 | [] | no_license | bcascsd8/MyJava | dc273f2724556cde70aedddb68b26da5b675372c | ddb0d4bf1f96d070a4b2c228c1e004350a2dd667 | refs/heads/master | 2021-01-22T19:23:00.105782 | 2017-08-19T06:05:05 | 2017-08-19T06:05:05 | 100,773,765 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 549 | java | package com.bcas.thread;
class TestJoinMethod1 extends Thread {
public void run() {
for (int i = 1; i <= 5; i++) {
try {
Thread.sleep(500);
} catch (Exception e) {
System.out.println(e);
}
System.out.println(i);
}
}
public static void main(String args[]) {
TestJoinMethod1 t1 = new TestJoinMethod1();
TestJoinMethod1 t2 = new TestJoinMethod1();
TestJoinMethod1 t3 = new TestJoinMethod1();
t1.start();
try {
t1.join();
} catch (Exception e) {
System.out.println(e);
}
t2.start();
t3.start();
}
} | [
"[email protected]"
] | |
9b9159693a7e9fe587a4bd7d9bcf098cfeb62619 | 060da70d01f8c35556409ce99cfe30dfe799d5e6 | /src/main/java/G37_Reto3/Servicios/ServiciosMensaje.java | 3c98590026ef700a6bed0dcecea29c0c7df54a99 | [] | no_license | MaicolMoreno/Reto3 | c734d72ad2d720ce02f808d78d6261cce2292d6b | 6a566f2876e0d156516531a37c188779de8b6640 | refs/heads/master | 2023-08-16T02:42:14.000396 | 2021-10-23T02:56:10 | 2021-10-23T02:56:10 | 419,554,968 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,974 | java | /*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package G37_Reto3.Servicios;
import G37_Reto3.Modelo.Mensaje;
import G37_Reto3.Repositorio.RepositorioMensaje;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
* @author Maicol Moreno
*/
@Service
public class ServiciosMensaje {
@Autowired
private RepositorioMensaje metodosCrud;
public List<Mensaje> getAll(){
return metodosCrud.getAll();
}
public Optional<Mensaje> getMessage(int messageId) {
return metodosCrud.getMessage(messageId);
}
public Mensaje save(Mensaje message){
if(message.getIdMessage()==null){
return metodosCrud.save(message);
}else{
Optional<Mensaje> e= metodosCrud.getMessage(message.getIdMessage());
if(e.isEmpty()){
return metodosCrud.save(message);
}else{
return message;
}
}
}
public Mensaje update(Mensaje message){
if(message.getIdMessage()!=null){
Optional<Mensaje> e= metodosCrud.getMessage(message.getIdMessage());
if(!e.isEmpty()){
if(message.getMessageText()!=null){
e.get().setMessageText(message.getMessageText());
}
metodosCrud.save(e.get());
return e.get();
}else{
return message;
}
}else{
return message;
}
}
public boolean deleteMessage(int messageId) {
Boolean aBoolean = getMessage(messageId).map(message -> {
metodosCrud.delete(message);
return true;
}).orElse(false);
return aBoolean;
}
}
| [
"[email protected]"
] | |
cf625933657a5669cce9ce38a5e1df5fb4b76f18 | 4f51388d0217982d540ea0930c2ce021e7f49c79 | /basic-code/day02-code/src/cn/itcast/day06code/Demo01/Demo04Student.java | 04ab7a7c15497035a55d541e4612f9a61d20b7c0 | [] | no_license | Miku-1/IdeaProjects | 4cae4861e8699433f096a2a2d5f59a0da1e048cf | aa623294930ce55a7ece2ef04c6b9f257047c9fc | refs/heads/master | 2022-08-22T17:44:06.573392 | 2019-12-21T07:37:09 | 2019-12-21T07:37:09 | 226,094,917 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 300 | java | package cn.itcast.day06code.Demo01;
public class Demo04Student {
public static void main(String[] args) {
Student stu1 = new Student();
Student stu2 = new Student("南球",22);
// System.out.println(stu1);
System.out.println(stu2.getName()+stu2.getAge());
}
}
| [
"[email protected]"
] |
Subsets and Splits